Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #284 from markwylde-deriv/add-trackjs
Browse files Browse the repository at this point in the history
chore: add trackjs
  • Loading branch information
sandeep-deriv authored Mar 18, 2024
2 parents f1b3144 + a54fab9 commit a3e2ef1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ const config = {
projectName: 'deriv-api-docs', // Usually your repo name.
trailingSlash: false,

customFields: {
trackJsToken: process.env.TRACKJS_TOKEN,
},

// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"sass": "^1.57.1",
"sass-loader": "^13.2.0",
"swiper": "^8.3.2",
"trackjs": "^3.10.4",
"ts-jest": "^29.0.3",
"usehooks-ts": "^2.9.1",
"yup": "^0.32.11"
Expand Down
8 changes: 8 additions & 0 deletions src/theme/Root.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import { ThemeProvider } from '@deriv/ui';
import type { ReactNode } from 'react';
import { TrackJS } from 'trackjs';
import siteConfig from '@generated/docusaurus.config';
import AuthProvider from '../contexts/auth/auth.provider';
import ApiTokenProvider from '../contexts/api-token/api-token.provider';
import AppManagerContextProvider from '../contexts/app-manager/app-manager.provider';
Expand All @@ -11,6 +13,12 @@ type TRootProps = {
children: ReactNode;
};

if (siteConfig.customFields.trackJsToken) {
TrackJS.install({ token: siteConfig.customFields.trackJsToken.toString() });
} else {
console.warn('trackjs is not installed due to a missing token');
}

export default function Root({ children }: TRootProps) {
return (
<>
Expand Down

0 comments on commit a3e2ef1

Please sign in to comment.