Skip to content

Commit 65085fa

Browse files
Merge pull request #130 from adrienne-deriv/setup-hydra-autgh
Integrate auth-client for Hydra logout functionality
2 parents e84abbe + 96bbc45 commit 65085fa

File tree

11 files changed

+35
-18
lines changed

11 files changed

+35
-18
lines changed

.github/actions/build/action.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ inputs:
1414
GROWTHBOOK_CLIENT_KEY:
1515
description: Growthbook client key for analytics
1616
required: false
17-
GROWTHBOOK_DECRYPTION_KEY:
18-
description: Growthbook decryption key for analytics
19-
required: false
2017
runs:
2118
using: composite
2219
steps:
@@ -26,6 +23,5 @@ runs:
2623
TRACKJS_TOKEN: ${{ inputs.TRACKJS_TOKEN }}
2724
RUDDERSTACK_KEY: ${{ inputs.RUDDERSTACK_KEY }}
2825
GROWTHBOOK_CLIENT_KEY: ${{ inputs.GROWTHBOOK_CLIENT_KEY }}
29-
GROWTHBOOK_DECRYPTION_KEY: ${{ inputs.GROWTHBOOK_DECRYPTION_KEY }}
3026
run: npm run build
3127
shell: bash

.github/workflows/release_production.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ jobs:
2525
NODE_ENV: production
2626
TRACKJS_TOKEN: ${{ secrets.TRACKJS_TOKEN }}
2727
RUDDERSTACK_KEY: ${{ vars.RUDDERSTACK_KEY }}
28-
GROWTHBOOK_DECRYPTION_KEY: ${{ secrets.GROWTHBOOK_DECRYPTION_KEY }}
2928
GROWTHBOOK_CLIENT_KEY: ${{ vars.GROWTHBOOK_CLIENT_KEY }}
3029
- name: Versioning
3130
uses: ./.github/actions/versioning

.github/workflows/release_staging.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
with:
2323
NODE_ENV: staging
2424
RUDDERSTACK_KEY: ${{ vars.RUDDERSTACK_KEY }}
25-
GROWTHBOOK_DECRYPTION_KEY: ${{ secrets.GROWTHBOOK_DECRYPTION_KEY }}
2625
GROWTHBOOK_CLIENT_KEY: ${{ vars.GROWTHBOOK_CLIENT_KEY }}
2726
- name: Versioning
2827
uses: ./.github/actions/versioning

.github/workflows/release_test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
NODE_ENV: staging
2828
TRACKJS_TOKEN: ${{ secrets.TRACKJS_TOKEN }}
2929
RUDDERSTACK_KEY: ${{ vars.RUDDERSTACK_KEY }}
30-
GROWTHBOOK_DECRYPTION_KEY: ${{ secrets.GROWTHBOOK_DECRYPTION_KEY }}
3130
GROWTHBOOK_CLIENT_KEY: ${{ vars.GROWTHBOOK_CLIENT_KEY }}
3231
- name: Versioning
3332
uses: ./.github/actions/versioning

docusaurus.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const config = {
2121
customFields: {
2222
trackJsToken: process.env.TRACKJS_TOKEN,
2323
rudderstackKey: process.env.RUDDERSTACK_KEY,
24-
growthbookDecryptionKey: process.env.GROWTHBOOK_DECRYPTION_KEY,
2524
growthbookClientKey: process.env.GROWTHBOOK_CLIENT_KEY,
2625
},
2726

jest.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ module.exports = {
2121
],
2222
'^.+\\.mjs$': 'babel-jest',
2323
},
24-
transformIgnorePatterns: ['node_modules/(?!(@docusaurus|swiper|ssr-window|dom7)|@theme)'],
24+
transformIgnorePatterns: [
25+
'node_modules/(?!(@docusaurus|swiper|ssr-window|dom7)|@theme|@deriv-com/auth-client)',
26+
],
2527
moduleNameMapper: {
2628
'@theme/(.*)': '@docusaurus/theme-classic/src/theme/$1',
2729

package-lock.json

Lines changed: 19 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"format": "prettier --write 'src/**/*.{js,jsx,ts,tsx,md,json}' --config ./.prettierrc"
2727
},
2828
"dependencies": {
29-
"@deriv-com/analytics": "^1.18.0",
29+
"@deriv-com/analytics": "^1.22.1",
30+
"@deriv-com/auth-client": "^1.0.27",
3031
"@deriv/deriv-api": "^1.0.11",
3132
"@deriv/quill-icons": "^1.22.10",
3233
"@deriv/ui": "^0.8.0",

src/components/AccountSwitcher/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React, { useState, useRef } from 'react';
2+
import { useOAuth2, TOAuth2EnabledAppList } from '@deriv-com/auth-client';
23
import { isNotDemoCurrency } from '@site/src/utils';
34
import useLogout from '@site/src/hooks/useLogout';
5+
import useGrowthbookGetFeatureValue from '@site/src/hooks/useGrowthbookGetFeatureValue';
46
import useAuthContext from '@site/src/hooks/useAuthContext';
57
import useOnClickOutside from '@site/src/hooks/useOnClickOutside';
68
import CurrencyIcon from '../CurrencyIcon';
@@ -11,7 +13,13 @@ import SearchButton from '../SearchButton';
1113
import Translate from '@docusaurus/Translate';
1214

1315
const AccountSwitcher = () => {
16+
const [OAuth2EnabledApps, OAuth2EnabledAppsInitialised] =
17+
useGrowthbookGetFeatureValue<TOAuth2EnabledAppList>({
18+
featureFlag: 'hydra_be',
19+
});
20+
1421
const { logout } = useLogout();
22+
const { OAuth2Logout } = useOAuth2({ OAuth2EnabledApps, OAuth2EnabledAppsInitialised }, logout);
1523

1624
const { currentLoginAccount } = useAuthContext();
1725
const [is_toggle_dropdown, setToggleDropdown] = useState(false);
@@ -57,7 +65,7 @@ const AccountSwitcher = () => {
5765
</div>
5866
<div className={styles.logoutButtonContainer}>
5967
<button
60-
onClick={logout}
68+
onClick={OAuth2Logout}
6169
type='button'
6270
color={'tertiary'}
6371
className={styles.logoutButton}

src/hooks/useGrowthbookGetFeatureValue/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect, useState } from 'react';
22
import { Analytics } from '@deriv-com/analytics';
3-
import useIsGrowthbookIsLoaded from './useIsGrowthbookLoaded';
3+
import useIsGrowthbookIsLoaded from '../useIsGrowthbookLoaded';
44

55
type featureValueTypes = Record<string, boolean> | boolean | string | [];
66

0 commit comments

Comments
 (0)