diff --git a/.env.example b/.env.example index 40d71246..34f32956 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,2 @@ -FEEDBACK_CONTENT_SET_ID= \ No newline at end of file +FEEDBACK_CONTENT_SET_ID= +HOTJAR_ID=abc \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..15451b66 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,91 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# GitHub recommends pinning actions to a commit SHA. +# To get a newer version, you will need to update the SHA. +# You can also reference a tag or branch, but the action may change without warning. + +name: Publish Docker image + +on: + push: + branches: [main] + +jobs: + build: + name: Build and Push Docker image to Docker Hub + runs-on: ubuntu-latest + environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }} + permissions: + contents: read + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: 'npm' + + - run: npm install + - name: create env file + run: | + touch .env + echo TYPESENSE_COLLECTION_NAME=${{ vars.TYPESENSE_COLLECTION_NAME }} >> .env + echo TYPESENSE_SERVER_HOST=${{ vars.TYPESENSE_SERVER_HOST }} >> .env + echo TYPESENSE_SEARCH_ONLY_APIKEY=${{ vars.TYPESENSE_SEARCH_ONLY_APIKEY }} >> .env + echo HOTJAR_ID=${{ vars.HOTJAR_ID }} >> .env + + - run: npm run build + + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }} + tags: | + type=sha + # set latest tag for default branch + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push Docker image + id: push + uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Set short git commit SHA + id: vars + run: | + calculatedSha=$(git rev-parse --short ${{ github.sha }}) + echo "short_sha=$calculatedSha" >> "$GITHUB_OUTPUT" + + - name: Deploy + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.WORKFLOW_DISPATCH }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'poc-aaa', + repo: 'devops', + workflow_id: 'deploy.yaml', + ref: 'main', + inputs: { + env: '${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}', + appName: 'docs', + appProject: 'aelf-docs', + commit_sha: 'sha-${{ steps.vars.outputs.short_sha }}', + } + }) diff --git a/.github/workflows/s3.yml b/.github/workflows/s3.yml index cd983e40..6487146b 100644 --- a/.github/workflows/s3.yml +++ b/.github/workflows/s3.yml @@ -1,12 +1,9 @@ name: Deploy to S3 - on: push: branches: [ "main", "develop" ] workflow_dispatch: - jobs: - build: environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }} permissions: @@ -23,14 +20,13 @@ jobs: run: | touch .env echo FEEDBACK_CONTENT_SET_ID=${{ vars.FEEDBACK_CONTENT_SET_ID }} >> .env + echo HOTJAR_ID=${{ vars.HOTJAR_ID }} >> .env - run: npm run build - - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v2 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ap-northeast-1 - - name: Sync to S3 - run: aws s3 sync ./build s3://${{ secrets.AWS_S3_BUCKET }} + run: aws s3 sync ./build s3://${{ secrets.AWS_S3_BUCKET }} \ No newline at end of file diff --git a/docs/legal/privacy-policy/index.md b/docs/legal/privacy-policy/index.md index 03c303b8..4d04a6bf 100644 --- a/docs/legal/privacy-policy/index.md +++ b/docs/legal/privacy-policy/index.md @@ -2,7 +2,7 @@ sidebar_position: 2 title: Privacy Policy --- -**Last updated: 25 June 2024** +**Last updated: 3 September 2024** This privacy policy ("Privacy Policy") elucidates the procedures by which Aelf Pte Ltd("Aelf", "our", "Company", "we", or "us") gathers, employs, and divulges information about you. @@ -140,9 +140,9 @@ We only share and disclose your information with the following categories of thi \- Website Hosting Service Providers -**7. Use Cookies And Other Tracking Technologies?** +**7. Use of Cookies And Other Tracking Technologies** -We do not use cookies or tracking technologies. Rather, we utilise anonymous page view tracking information provided by third-party analytics providers which do not collect or store any personal data. As such, we make no use of cookies. +While we do not directly utilize cookies or other tracking technologies on our Website, we may engage with third-party service providers who deploy such technologies as part of their service offerings. For instance, we use Hotjar in order to better understand our users' needs and to optimize this service and experience. Hotjar is a technology service that helps us better understand our users' experience (eg how much time they spend on which pages, which links they choose to click, what users do and don't like, etc.) and this enables us to build and maintain our service with user feedback. Hotjar uses cookies and other technologies to collect data on our users' behavior and their devices device's IP address (processed during your session and stored in a de-identified form), device screen size, device type (unique device identifiers), browser information, geographic location (country only), and the preferred language used to display our website. Hotjar stores this information on our behalf in a pseudonymized user profile. Hotjar is contractually forbidden to sell any of the data collected on our behalf. By interacting with our Website, you may be subject to these third-party technologies, which are governed by the respective provider's privacy policies. We recommend reviewing these policies to understand how your information may be collected and used. For further details, please see the 'about Hotjar' section of [Hotjar's support site](https://help.hotjar.com/hc/en-us/categories/115001323967-About-Hotjar). **8. Transfer of Information to Other Jurisdictions** diff --git a/docs/tools/aelf-playground/index.md b/docs/tools/aelf-playground/index.md index a60a971d..64e268d1 100644 --- a/docs/tools/aelf-playground/index.md +++ b/docs/tools/aelf-playground/index.md @@ -50,17 +50,19 @@ The interaction with the workspace project code inside `src` and `test` folders ![drag-and-drop-3](/img/playground-7.png) -- Also, you can choose to import the project directly from the github. - 1. Click on `enter a GitHub repo url`. - 2. Enter the github URL. - 3. Choose the required `.csproj` file. - 4. Enter the workspace name and click Submit. +- Also, you can choose to import the project directly from the github. + + 1. Click on `enter a GitHub repo url`. + 2. Enter the github URL. + 3. Choose the required `.csproj` file. + 4. Enter the workspace name and click Submit. ![drag-and-drop-3](/img/playground-8.png) ### Features of the aelf-playground Now as the workspace setup is done and project is setup inside aelf's playground. The user can now edit the smart contract logic according to the user needs. The changes will majorly takes place inside the below files: + - src/Protobuf/contract/`contract_proto_file_name`.proto file - src/`ContractName`.cs - src/`ContractName`State.cs @@ -70,18 +72,20 @@ Once all the changes are done in the above files and all other required files (w ![AI-Audit](/img/playground-9.png) -2. **Save Gas Fee**: Optimise the smart contract to save gas fee. It will suggest to make changes to the smart contract if the smart contract is not optimised. If the smart contract is already optimed then result like below will appear. +![AI-Audit](/img/playground-9.png) + +2. **Save Gas Fee**: Optimise the smart contract to save gas fee. It will suggest to make changes to the smart contract if the smart contract is not optimised. If the smart contract is already optimed then result like below will appear. - ![Save-Gas-Fee](/img/playground-10.png) +![Save-Gas-Fee](/img/playground-10.png) 3. **Build**: Build the smart contract code. It will show `building` status when the user clicks the `Build` button and will output below result including whether build was successful or failed once the build process ends. - ![Build](/img/playground-11.png) - +![Build](/img/playground-11.png) + 4. **Test**: Test the smart contract code. It will show `Running Tests` status when the user clicks the `Test` button and will output below result including how many tests have passed and failed once the test process ends. - ![Test](/img/playground-12.png) - +![Test](/img/playground-12.png) + 5. **Deploy**: Deploy the smart contract code on the aelf blockchain. It will show `Deploying` status when the user clicks the `Deploy` button and will output below result including `transactionId`, `proposal status` and `contract address` once the build process ends. You can verify the contract address by visiting [aelf testnet explorer](https://testnet.aelfscan.io/tDVW). ![Deploy](/img/playground-13.png) @@ -96,7 +100,7 @@ Once all the changes are done in the above files and all other required files (w 8. **Share**: Share the project with a sharable link. It will show `Generating share link` status when the user clicks the `Share` button and will output below result including the sharable link. - ![Share](/img/playground-15.png) +![Share](/img/playground-15.png) 9. **Command Line Options**: Command line additionally provides options to check txID and clear terminal including above options. Use the help command to see all the options inside terminal. `check txID` helps in checking the transaction details. @@ -108,11 +112,11 @@ Once all the changes are done in the above files and all other required files (w 11. **Add a New File**: Manually add a new file in the playground project structure. It will allow users to add a new file in the workspace project structure add smart contract code, new proto files, etc. - ![Add a New File](/img/playground-18.png) +![Add a New File](/img/playground-18.png) 12. **Rename & Delete File**: `Renames` & `Deletes` the chosen file or folders in the project directory structure. - ![Add a New File](/img/playground-19.png) +![Add a New File](/img/playground-19.png) 13. **Tutorials**: Some pre-compiled tutorials are curated under `Tutorials` section of aelf-playground. It provides an option to filter the tutorials based on the difficulty level (`Beginner`, `Intermediate` & `Advanced`) and smart contracts languages (C# & Solidity). @@ -120,15 +124,14 @@ Once all the changes are done in the above files and all other required files (w 14. **Deployments**: `Deployments` section provides a list of all deployed tutorials along with the wallet address used to deploy smart contracts on the aelf blockchain. You can click on the wallet address to view wallet details on the aelf explorer. - ![Add a New File](/img/playground-21.png) +![Add a New File](/img/playground-21.png) 15. **Privatekey**: You can export your wallet's private key from the `Deployments` section. Simply click the eye icon to reveal the private key, which you can then copy. ![Add a New File](/img/playground-24.png) 16. **Themes**: Users can also choose to toggle between `dark` and `light` themes. - ![Add a New File](/img/playground-22.png) - +![Add a New File](/img/playground-22.png) ## 4. Example @@ -249,7 +252,7 @@ namespace AElf.Contracts.ToDo - The `State.cs` file in an aelf blockchain smart contract holds the variables that store the contract's data, making sure this data is saved and accessible whenever the contract needs it. -#### Implement ToDo Smart Contract +#### Implement ToDo Smart Contract The implementation of the ToDo App smart contract inside file `src/todo-dapp.cs` is as follows: @@ -449,4 +452,5 @@ namespace AElf.Contracts.ToDo 🎉 Congratulations, We got the contract address after successful deployment of todo-dapp smart contract using playground. ## Conclusion -The aelf Playground offers a seamless and accessible platform for developers to build, test, and deploy smart contracts without the need for any local setup. With built-in features like AI audit, gas fee optimization, and GitHub integration, it simplifies the entire smart contract development process. Whether you're writing new code or modifying existing templates, the aelf Playground provides all the essential tools in one place, making it an ideal sandbox for both beginners and experienced developers. \ No newline at end of file + +The aelf Playground offers a seamless and accessible platform for developers to build, test, and deploy smart contracts without the need for any local setup. With built-in features like AI audit, gas fee optimization, and GitHub integration, it simplifies the entire smart contract development process. Whether you're writing new code or modifying existing templates, the aelf Playground provides all the essential tools in one place, making it an ideal sandbox for both beginners and experienced developers. diff --git a/docusaurus.config.ts b/docusaurus.config.ts index b843d27d..ef20bbf4 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -35,7 +35,6 @@ const config: Config = { defaultLocale: "en", locales: ["en"], }, - presets: [ [ "classic", diff --git a/package-lock.json b/package-lock.json index f06121da..fafa64c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,9 @@ "name": "aelf-docs-cms", "version": "0.0.0", "dependencies": { + "@amplitude/analytics-browser": "^2.11.7", + "@amplitude/plugin-ga-events-forwarder-browser": "^0.3.4", + "@amplitude/plugin-session-replay-browser": "^1.8.0", "@docusaurus/core": "3.4.0", "@docusaurus/preset-classic": "3.4.0", "@feelback/react": "^0.3.4", @@ -19,6 +22,9 @@ "prism-react-renderer": "^2.3.0", "react": "^18.0.0", "react-dom": "^18.0.0", + "react-ga4": "^2.1.0", + "react-gtm-module": "^2.0.11", + "react-hotjar": "^6.3.1", "rehype-katex": "^7.0.0", "remark-math": "^6.0.0" }, @@ -211,6 +217,173 @@ "@algolia/requester-common": "4.23.3" } }, + "node_modules/@amplitude/analytics-browser": { + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-browser/-/analytics-browser-2.11.8.tgz", + "integrity": "sha512-lFv8deROLwBfSlg92+r1NitWJ6BN45IKwpPLoixA0fZytScXEJqc0Gl5O+BY4qScbFECYt9PFKblhB+jC+IvPg==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-client-common": "^2.3.4", + "@amplitude/analytics-core": "^2.5.3", + "@amplitude/analytics-remote-config": "^0.4.0", + "@amplitude/analytics-types": "^2.8.3", + "@amplitude/plugin-autocapture-browser": "^1.0.2", + "@amplitude/plugin-page-view-tracking-browser": "^2.3.4", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/analytics-client-common": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-client-common/-/analytics-client-common-2.3.4.tgz", + "integrity": "sha512-3oqdvca5W4BPblTaxf60YRtlh2uC+N3rA99wowDAhTBJoMJJaauOBoXu5BbiQO1u8Zw/c8ymyr8E20+glyptUg==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-connector": "^1.4.8", + "@amplitude/analytics-core": "^2.5.3", + "@amplitude/analytics-types": "^2.8.3", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/analytics-connector": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-connector/-/analytics-connector-1.5.0.tgz", + "integrity": "sha512-T8mOYzB9RRxckzhL0NTHwdge9xuFxXEOplC8B1Y3UX3NHa3BLh7DlBUZlCOwQgMc2nxDfnSweDL5S3bhC+W90g==", + "license": "MIT" + }, + "node_modules/@amplitude/analytics-core": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-core/-/analytics-core-2.5.3.tgz", + "integrity": "sha512-dvx3PS0adnHRS22VbuP9YtWg//bQGF2c61Pj5IYXVsemtRRHqiS7XJ860brk3WeQgOkqf3Gyc023DoYcsWGoNQ==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-types": "^2.8.3", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/analytics-remote-config": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-remote-config/-/analytics-remote-config-0.4.1.tgz", + "integrity": "sha512-BYl6kQ9qjztrCACsugpxO+foLaQIC0aSEzoXEAb/gwOzInmqkyyI+Ub+aWTBih4xgB/lhWlOcidWHAmNiTJTNw==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-client-common": ">=1 <3", + "@amplitude/analytics-core": ">=1 <3", + "@amplitude/analytics-types": ">=1 <3", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/analytics-types": { + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/@amplitude/analytics-types/-/analytics-types-2.8.3.tgz", + "integrity": "sha512-HNmKVd0ACoi3xTi86xi+is7WgqKT78JA4fYLcM25/ckFkZ1zVCqD1AubaADEh26m34nJ3qDLK5Pob4QptQNPAg==", + "license": "MIT" + }, + "node_modules/@amplitude/plugin-autocapture-browser": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@amplitude/plugin-autocapture-browser/-/plugin-autocapture-browser-1.0.3.tgz", + "integrity": "sha512-XUQWUAw9VqtJPlmOyWjnhsEspyVakd9LuSjVNtLjhwlWv+f/yZM1AAQVUdq/Os1+b5OptSgJQ2pPfRJJHZDXTw==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-client-common": ">=1 <3", + "@amplitude/analytics-types": "^2.8.2", + "rxjs": "^7.8.1", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/plugin-ga-events-forwarder-browser": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@amplitude/plugin-ga-events-forwarder-browser/-/plugin-ga-events-forwarder-browser-0.3.4.tgz", + "integrity": "sha512-DrwZJZ6zhT70UIfT8Lg9qnCIXRX3HVgDp1Hviyu66uqLr0GitycbFFLQaJlJK+ipOfCgCcy5OpKp0DjQXLErBA==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-client-common": ">=1 <3", + "@amplitude/analytics-types": ">=1 <3", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/plugin-page-view-tracking-browser": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/@amplitude/plugin-page-view-tracking-browser/-/plugin-page-view-tracking-browser-2.3.4.tgz", + "integrity": "sha512-l7RS5gssG0BPYlgirV0NQ94EPzTOdDkp0z2jqU45D3DQAJXkoloUyw5lw/cbUXYwNulHZTG/BExcERfdvVWkLA==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-client-common": "^2.3.4", + "@amplitude/analytics-types": "^2.8.3", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/plugin-session-replay-browser": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@amplitude/plugin-session-replay-browser/-/plugin-session-replay-browser-1.8.1.tgz", + "integrity": "sha512-FlaIawFN57VflRN0Gj6/KYfA8p0PxphFoAybLrS37dDpLoyC+UBvG0aUNhtF7GzjHbKxGNntCPqFSMv4VNlk6w==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-client-common": ">=1 <3", + "@amplitude/analytics-core": ">=1 <3", + "@amplitude/analytics-types": ">=1 <3", + "@amplitude/session-replay-browser": "^1.15.0", + "idb-keyval": "^6.2.1", + "tslib": "^2.4.1" + } + }, + "node_modules/@amplitude/rrdom": { + "version": "2.0.0-alpha.25", + "resolved": "https://registry.npmjs.org/@amplitude/rrdom/-/rrdom-2.0.0-alpha.25.tgz", + "integrity": "sha512-GTdwpDJmwAZcllNmGH3xmLEfKkMhOqmqkpG9G0MVGdhRmL3pTAhmSZuyPUYUho71ZjKQtGnHMDPgfOtniWsWbw==", + "license": "MIT", + "dependencies": { + "@amplitude/rrweb-snapshot": "^2.0.0-alpha.25" + } + }, + "node_modules/@amplitude/rrweb": { + "version": "2.0.0-alpha.21", + "resolved": "https://registry.npmjs.org/@amplitude/rrweb/-/rrweb-2.0.0-alpha.21.tgz", + "integrity": "sha512-Ry5J4U7jBcqG2i7cXwo9v1JSQqh0wh4nTRKOgIxM3vXvNti1hzS88I4nsCjrytm8aaCTNB6SCVa3n+yrGE3b8A==", + "license": "MIT", + "dependencies": { + "@amplitude/rrdom": "^2.0.0-alpha.21", + "@amplitude/rrweb-snapshot": "^2.0.0-alpha.21", + "@amplitude/rrweb-types": "^2.0.0-alpha.21", + "@types/css-font-loading-module": "0.0.7", + "@xstate/fsm": "^1.4.0", + "base64-arraybuffer": "^1.0.1", + "fflate": "^0.4.4", + "mitt": "^3.0.0" + } + }, + "node_modules/@amplitude/rrweb-snapshot": { + "version": "2.0.0-alpha.25", + "resolved": "https://registry.npmjs.org/@amplitude/rrweb-snapshot/-/rrweb-snapshot-2.0.0-alpha.25.tgz", + "integrity": "sha512-sXNJHGGqFeVoua7qXKd8cuI4s4RtWZyse1ovKmTLyKVLIWDNtv+kbubpR6ze4EAy5ciOvLe7H41L8ps6JZZg7g==", + "license": "MIT", + "dependencies": { + "postcss": "^8.4.38" + } + }, + "node_modules/@amplitude/rrweb-types": { + "version": "2.0.0-alpha.25", + "resolved": "https://registry.npmjs.org/@amplitude/rrweb-types/-/rrweb-types-2.0.0-alpha.25.tgz", + "integrity": "sha512-KtHn3Bu9EhTPJ5bRbf6Qs8+uz4PUlmk4qg+c4N5b1P36erHnhX5tuk9bfwzJawtDYX7x5a4jEdeqFBwLQrt//g==", + "license": "MIT", + "dependencies": { + "@amplitude/rrweb-snapshot": "^2.0.0-alpha.25" + } + }, + "node_modules/@amplitude/session-replay-browser": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/@amplitude/session-replay-browser/-/session-replay-browser-1.15.0.tgz", + "integrity": "sha512-66Y7iDu03NM3xYzzV2PAzG4TR3qU23hP1JJB/yJENXkLCVxrFQQ+32+8ZQJxokfso3lpN/COnYlv2qtTGJNB3Q==", + "license": "MIT", + "dependencies": { + "@amplitude/analytics-client-common": ">=1 <3", + "@amplitude/analytics-core": ">=1 <3", + "@amplitude/analytics-remote-config": "^0.4.1", + "@amplitude/analytics-types": ">=1 <3", + "@amplitude/rrweb": "2.0.0-alpha.21", + "idb": "^8.0.0", + "tslib": "^2.4.1" + } + }, "node_modules/@ampproject/remapping": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", @@ -3338,6 +3511,12 @@ "@types/node": "*" } }, + "node_modules/@types/css-font-loading-module": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/@types/css-font-loading-module/-/css-font-loading-module-0.0.7.tgz", + "integrity": "sha512-nl09VhutdjINdWyXxHWN/w9zlNCfr60JUqJbd24YXUuCwgeL0TpFSdElCwb6cxfB6ybE19Gjj4g0jsgkXxKv1Q==", + "license": "MIT" + }, "node_modules/@types/debug": { "version": "4.1.12", "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", @@ -3776,6 +3955,12 @@ "@xtuc/long": "4.2.2" } }, + "node_modules/@xstate/fsm": { + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/@xstate/fsm/-/fsm-1.6.5.tgz", + "integrity": "sha512-b5o1I6aLNeYlU/3CPlj/Z91ybk1gUsKT+5NAJI+2W4UjvS5KLG28K9v5UvNoFVjHV8PajVZ00RH3vnjyQO7ZAw==", + "license": "MIT" + }, "node_modules/@xtuc/ieee754": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", @@ -4178,6 +4363,15 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, + "node_modules/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/batch": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", @@ -6236,6 +6430,12 @@ "node": ">=0.4.0" } }, + "node_modules/fflate": { + "version": "0.4.8", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.4.8.tgz", + "integrity": "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==", + "license": "MIT" + }, "node_modules/file-loader": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-6.2.0.tgz", @@ -7536,6 +7736,18 @@ "postcss": "^8.1.0" } }, + "node_modules/idb": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/idb/-/idb-8.0.0.tgz", + "integrity": "sha512-l//qvlAKGmQO31Qn7xdzagVPPaHTxXx199MhrAFuVBTPqydcPYBWjkrbv4Y0ktB+GmWOiwHl237UUOrLmQxLvw==", + "license": "ISC" + }, + "node_modules/idb-keyval": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/idb-keyval/-/idb-keyval-6.2.1.tgz", + "integrity": "sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg==", + "license": "Apache-2.0" + }, "node_modules/ignore": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", @@ -10605,6 +10817,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/mitt": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz", + "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", + "license": "MIT" + }, "node_modules/mrmime": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.0.tgz", @@ -12163,6 +12381,18 @@ "resolved": "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.2.tgz", "integrity": "sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ==" }, + "node_modules/react-ga4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/react-ga4/-/react-ga4-2.1.0.tgz", + "integrity": "sha512-ZKS7PGNFqqMd3PJ6+C2Jtz/o1iU9ggiy8Y8nUeksgVuvNISbmrQtJiZNvC/TjDsqD0QlU5Wkgs7i+w9+OjHhhQ==", + "license": "MIT" + }, + "node_modules/react-gtm-module": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/react-gtm-module/-/react-gtm-module-2.0.11.tgz", + "integrity": "sha512-8gyj4TTxeP7eEyc2QKawEuQoAZdjKvMY4pgWfycGmqGByhs17fR+zEBs0JUDq4US/l+vbTl+6zvUIx27iDo/Vw==", + "license": "MIT" + }, "node_modules/react-helmet-async": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/react-helmet-async/-/react-helmet-async-1.3.0.tgz", @@ -12179,6 +12409,12 @@ "react-dom": "^16.6.0 || ^17.0.0 || ^18.0.0" } }, + "node_modules/react-hotjar": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/react-hotjar/-/react-hotjar-6.3.1.tgz", + "integrity": "sha512-EwMqL+ROSlKzatMhT/aqRq7XWWfzlnHynSBSTJh5M2O78mBiPohiSl4Ysls3HOQkkD9y6L22BW0c9bxK2JguwQ==", + "license": "MIT" + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -12858,6 +13094,15 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/rxjs": { + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", + "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", diff --git a/package.json b/package.json index f7d3661c..e763f8d6 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,9 @@ "typecheck": "tsc" }, "dependencies": { + "@amplitude/analytics-browser": "^2.11.7", + "@amplitude/plugin-ga-events-forwarder-browser": "^0.3.4", + "@amplitude/plugin-session-replay-browser": "^1.8.0", "@docusaurus/core": "3.4.0", "@docusaurus/preset-classic": "3.4.0", "@feelback/react": "^0.3.4", @@ -26,6 +29,9 @@ "prism-react-renderer": "^2.3.0", "react": "^18.0.0", "react-dom": "^18.0.0", + "react-ga4": "^2.1.0", + "react-gtm-module": "^2.0.11", + "react-hotjar": "^6.3.1", "rehype-katex": "^7.0.0", "remark-math": "^6.0.0" }, @@ -49,5 +55,8 @@ }, "engines": { "node": ">=18.0" + }, + "overrides": { + "path-to-regexp": "^1.9.0" } } diff --git a/src/theme/Root.tsx b/src/theme/Root.tsx index 999a7069..b33af026 100644 --- a/src/theme/Root.tsx +++ b/src/theme/Root.tsx @@ -1,11 +1,16 @@ // https://docusaurus.io/docs/3.4.0/swizzling#wrapper-your-site-with-root import BrowserOnly from "@docusaurus/BrowserOnly"; -import React from "react"; +import React, { useEffect } from "react"; import ChatComponent from "./ChatPAAL"; +import { analytics } from "./analytics"; // Default implementation, that you can customize export default function Root({ children }) { + useEffect(() => { + analytics(); + }, []); + return ( <> {children} diff --git a/src/theme/analytics.ts b/src/theme/analytics.ts new file mode 100644 index 00000000..b56f9dbe --- /dev/null +++ b/src/theme/analytics.ts @@ -0,0 +1,22 @@ +import * as amplitude from "@amplitude/analytics-browser"; +import { gaEventsForwarderPlugin } from "@amplitude/plugin-ga-events-forwarder-browser"; +import { sessionReplayPlugin } from "@amplitude/plugin-session-replay-browser"; +import ReactGA from "react-ga4"; +import TagManager from "react-gtm-module"; +import { hotjar } from "react-hotjar"; + +export const analytics = () => { + const gaEventsForwarder = gaEventsForwarderPlugin(); + amplitude.add(gaEventsForwarder); + amplitude.init("7652218546e8f6cc3d045e43a68830f6", { autocapture: true }); + const sessionReplayTracking = sessionReplayPlugin({ + sampleRate: 1, + }); + amplitude.add(sessionReplayTracking); + + hotjar.initialize({ id: 5120800, sv: 6 }); + ReactGA.initialize("G-PFZ0BCQHMY"); + TagManager.initialize({ + gtmId: "GTM-NKWDMQ52", + }); +};