zh-web-sdk 2.16.1 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +225 -32
  2. package/package.json +6 -1
  3. package/.eslintrc.js +0 -12
  4. package/.github/CHANGELOG_TEMPLATE.md +0 -73
  5. package/.github/PULL_REQUEST_TEMPLATE.md +0 -10
  6. package/.github/backup/publish-tag.yaml +0 -14
  7. package/.github/workflows/build.yaml +0 -13
  8. package/.github/workflows/pr.yaml +0 -14
  9. package/.github/workflows/publish.yaml +0 -13
  10. package/.github/workflows/security.yml +0 -15
  11. package/.github/workflows/tag.yaml +0 -14
  12. package/RELEASING.md +0 -39
  13. package/jest.config.js +0 -8
  14. package/jest.setup.js +0 -24
  15. package/scripts/build.js +0 -34
  16. package/scripts/zip.js +0 -49
  17. package/src/__tests__/jwt-auth-detection.test.ts +0 -96
  18. package/src/api/convert-token.ts +0 -23
  19. package/src/constants.ts +0 -2
  20. package/src/hooks/__tests__/use-window-size.test.tsx +0 -26
  21. package/src/hooks/use-window-size.ts +0 -19
  22. package/src/iframe-container/AppContainer.tsx +0 -495
  23. package/src/iframe-container/__tests__/AppContainer.test.tsx +0 -300
  24. package/src/iframe-container/hooks/__tests__/use-style-updates.test.ts +0 -430
  25. package/src/iframe-container/hooks/use-style-updates.ts +0 -82
  26. package/src/index.tsx +0 -645
  27. package/src/redux/actions/index.ts +0 -27
  28. package/src/redux/reducers/constants.ts +0 -10
  29. package/src/redux/reducers/crypto-account-link-payouts.ts +0 -60
  30. package/src/redux/reducers/crypto-account-link.ts +0 -60
  31. package/src/redux/reducers/crypto-buy.ts +0 -75
  32. package/src/redux/reducers/crypto-sell.ts +0 -64
  33. package/src/redux/reducers/crypto-withdrawals.ts +0 -64
  34. package/src/redux/reducers/fiat-account-link.ts +0 -60
  35. package/src/redux/reducers/fiat-deposits.ts +0 -64
  36. package/src/redux/reducers/fiat-withdrawals.ts +0 -64
  37. package/src/redux/reducers/fund.ts +0 -75
  38. package/src/redux/reducers/index.ts +0 -35
  39. package/src/redux/reducers/onboarding.ts +0 -74
  40. package/src/redux/reducers/pay.ts +0 -64
  41. package/src/redux/reducers/payouts.ts +0 -64
  42. package/src/redux/reducers/profile.ts +0 -63
  43. package/src/redux/store/index.ts +0 -10
  44. package/src/styles.ts +0 -108
  45. package/src/types.ts +0 -578
  46. package/src/utils/auth-to-fund-mapper.ts +0 -174
  47. package/src/utils/strings.ts +0 -19
  48. package/src/utils/test-utils.tsx +0 -36
  49. package/src/utils/world-app-utils.ts +0 -8
  50. package/src/utils.ts +0 -27
  51. package/tsconfig.json +0 -26
@@ -1,60 +0,0 @@
1
- import {AppIdentifier, appIdentifierToActionPrefixMap} from "../../types";
2
- import {ACTION_APP_LOADED, ACTION_SET_JWT, ACTION_SET_MODAL_STATE} from "./constants";
3
-
4
- export interface ICryptoAccountLinkPayoutsState {
5
- jwt: string;
6
- isAppLoaded: boolean;
7
- isAppActive: boolean;
8
- }
9
-
10
- export interface ICryptoAccountLinkPayoutsAction {
11
- type: string;
12
- jwt?: string;
13
- isAppActive?: boolean;
14
- isAppLoaded?: boolean;
15
- }
16
-
17
- const INITIAL_STATE: ICryptoAccountLinkPayoutsState = {
18
- jwt: "",
19
- isAppActive: false,
20
- isAppLoaded: false
21
- }
22
-
23
- const applySetIsAppActive = (state: ICryptoAccountLinkPayoutsState, action: ICryptoAccountLinkPayoutsAction): ICryptoAccountLinkPayoutsState => {
24
- return {
25
- ...state,
26
- isAppActive: !!action.isAppActive,
27
- }
28
- }
29
-
30
- const applySetSendJWTToApp = (state: ICryptoAccountLinkPayoutsState, action: ICryptoAccountLinkPayoutsAction): ICryptoAccountLinkPayoutsState => {
31
- return {
32
- ...state,
33
- isAppLoaded: !!action.isAppLoaded,
34
- }
35
- }
36
-
37
- const applySetJWT = (state: ICryptoAccountLinkPayoutsState, action: ICryptoAccountLinkPayoutsAction): ICryptoAccountLinkPayoutsState => {
38
- return {
39
- ...state,
40
- jwt: action.jwt as string,
41
- }
42
- }
43
-
44
- const reducerMap: {
45
- [actionType: string]: (state: ICryptoAccountLinkPayoutsState, action: ICryptoAccountLinkPayoutsAction) => ICryptoAccountLinkPayoutsState
46
- } = {
47
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_ACCOUNT_LINK_PAYOUTS)}${ACTION_SET_JWT}`]: applySetJWT,
48
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_ACCOUNT_LINK_PAYOUTS)}${ACTION_SET_MODAL_STATE}`]: applySetIsAppActive,
49
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_ACCOUNT_LINK_PAYOUTS)}${ACTION_APP_LOADED}`]: applySetSendJWTToApp,
50
- };
51
-
52
- const cryptoAccountLinkPayoutsReducer = (state = INITIAL_STATE, action: ICryptoAccountLinkPayoutsAction) => {
53
- if (!!action.type && !!reducerMap[action.type]) {
54
- return reducerMap[action.type](state, action);
55
- } else {
56
- return state;
57
- }
58
- }
59
-
60
- export default cryptoAccountLinkPayoutsReducer;
@@ -1,60 +0,0 @@
1
- import {AppIdentifier, appIdentifierToActionPrefixMap} from "../../types";
2
- import {ACTION_APP_LOADED, ACTION_SET_JWT, ACTION_SET_MODAL_STATE} from "./constants";
3
-
4
- export interface ICryptoAccountLinkState {
5
- jwt: string;
6
- isAppLoaded: boolean;
7
- isAppActive: boolean;
8
- }
9
-
10
- export interface ICryptoAccountLinkAction {
11
- type: string;
12
- jwt?: string;
13
- isAppActive?: boolean;
14
- isAppLoaded?: boolean;
15
- }
16
-
17
- const INITIAL_STATE: ICryptoAccountLinkState = {
18
- jwt: "",
19
- isAppActive: false,
20
- isAppLoaded: false
21
- }
22
-
23
- const applySetIsAppActive = (state: ICryptoAccountLinkState, action: ICryptoAccountLinkAction): ICryptoAccountLinkState => {
24
- return {
25
- ...state,
26
- isAppActive: !!action.isAppActive,
27
- }
28
- }
29
-
30
- const applySetSendJWTToApp = (state: ICryptoAccountLinkState, action: ICryptoAccountLinkAction): ICryptoAccountLinkState => {
31
- return {
32
- ...state,
33
- isAppLoaded: !!action.isAppLoaded,
34
- }
35
- }
36
-
37
- const applySetJWT = (state: ICryptoAccountLinkState, action: ICryptoAccountLinkAction): ICryptoAccountLinkState => {
38
- return {
39
- ...state,
40
- jwt: action.jwt as string,
41
- }
42
- }
43
-
44
- const reducerMap: {
45
- [actionType: string]: (state: ICryptoAccountLinkState, action: ICryptoAccountLinkAction) => ICryptoAccountLinkState
46
- } = {
47
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_ACCOUNT_LINK)}${ACTION_SET_JWT}`]: applySetJWT,
48
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_ACCOUNT_LINK)}${ACTION_SET_MODAL_STATE}`]: applySetIsAppActive,
49
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_ACCOUNT_LINK)}${ACTION_APP_LOADED}`]: applySetSendJWTToApp,
50
- };
51
-
52
- const cryptoAccountLinkReducer = (state = INITIAL_STATE, action: ICryptoAccountLinkAction) => {
53
- if (!!action.type && !!reducerMap[action.type]) {
54
- return reducerMap[action.type](state, action);
55
- } else {
56
- return state;
57
- }
58
- }
59
-
60
- export default cryptoAccountLinkReducer;
@@ -1,75 +0,0 @@
1
- import { AppIdentifier, Filters } from "../../types";
2
- import { appIdentifierToActionPrefixMap } from "../../types";
3
- import {
4
- ACTION_SET_JWT,
5
- ACTION_SET_MODAL_STATE,
6
- ACTION_APP_LOADED,
7
- ACTION_SET_FILTERS
8
- } from "./constants";
9
-
10
- export interface ICryptoBuyState {
11
- jwt: string;
12
- isAppLoaded: boolean;
13
- isAppActive: boolean;
14
- filters?: Filters
15
- }
16
-
17
- export interface ICryptoBuyAction {
18
- type: string;
19
- jwt?: string;
20
- isAppActive?: boolean;
21
- isAppLoaded?: boolean;
22
- filters?: Filters;
23
- }
24
-
25
- const INITIAL_STATE: ICryptoBuyState = {
26
- jwt: "",
27
- isAppActive: false,
28
- isAppLoaded: false
29
- }
30
-
31
- const applySetIsAppActive = (state: ICryptoBuyState, action: ICryptoBuyAction) : ICryptoBuyState => {
32
- return {
33
- ...state,
34
- isAppActive: !!action.isAppActive,
35
- }
36
- }
37
-
38
- const applySetSendJWTToApp = (state: ICryptoBuyState, action: ICryptoBuyAction) : ICryptoBuyState => {
39
- return {
40
- ...state,
41
- isAppLoaded: !!action.isAppLoaded,
42
- }
43
- }
44
-
45
- const applySetJWT = (state: ICryptoBuyState, action: ICryptoBuyAction) : ICryptoBuyState => {
46
- return {
47
- ...state,
48
- jwt: action.jwt as string,
49
- }
50
- }
51
-
52
- const applySetFilters = (state: ICryptoBuyState, action: ICryptoBuyAction) : ICryptoBuyState => {
53
- return {
54
- ...state,
55
- filters: action.filters,
56
- }
57
- }
58
-
59
- const reducerMap: { [actionType: string]: (state: ICryptoBuyState, action: ICryptoBuyAction) => ICryptoBuyState } = {
60
- // Crypto buy reducer
61
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_BUY)}${ACTION_SET_JWT}`]: applySetJWT,
62
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_BUY)}${ACTION_SET_MODAL_STATE}`]: applySetIsAppActive,
63
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_BUY)}${ACTION_APP_LOADED}`]: applySetSendJWTToApp,
64
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_BUY)}${ACTION_SET_FILTERS}`]: applySetFilters,
65
- };
66
-
67
- const cryptoBuyReducer = (state = INITIAL_STATE, action: ICryptoBuyAction) => {
68
- if (!!action.type && !!reducerMap[action.type]) {
69
- return reducerMap[action.type](state, action);
70
- } else {
71
- return state;
72
- }
73
- }
74
-
75
- export default cryptoBuyReducer;
@@ -1,64 +0,0 @@
1
- import { AppIdentifier } from "../../types";
2
- import { appIdentifierToActionPrefixMap } from "../../types";
3
- import {
4
- ACTION_SET_JWT,
5
- ACTION_SET_MODAL_STATE,
6
- ACTION_APP_LOADED
7
- } from "./constants";
8
-
9
- export interface ICryptoSellState {
10
- jwt: string;
11
- isAppLoaded: boolean;
12
- isAppActive: boolean;
13
- }
14
-
15
- export interface ICryptoSellAction {
16
- type: string;
17
- jwt?: string;
18
- isAppActive?: boolean;
19
- isAppLoaded?: boolean;
20
- }
21
-
22
- const INITIAL_STATE: ICryptoSellState = {
23
- jwt: "",
24
- isAppActive: false,
25
- isAppLoaded: false
26
- }
27
-
28
- const applySetIsAppActive = (state: ICryptoSellState, action: ICryptoSellAction) : ICryptoSellState => {
29
- return {
30
- ...state,
31
- isAppActive: !!action.isAppActive,
32
- }
33
- }
34
-
35
- const applySetSendJWTToApp = (state: ICryptoSellState, action: ICryptoSellAction) : ICryptoSellState => {
36
- return {
37
- ...state,
38
- isAppLoaded: !!action.isAppLoaded,
39
- }
40
- }
41
-
42
- const applySetJWT = (state: ICryptoSellState, action: ICryptoSellAction) : ICryptoSellState => {
43
- return {
44
- ...state,
45
- jwt: action.jwt as string,
46
- }
47
- }
48
-
49
- const reducerMap: { [actionType: string]: (state: ICryptoSellState, action: ICryptoSellAction) => ICryptoSellState } = {
50
- // Crypto sell reducer
51
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_SELL)}${ACTION_SET_JWT}`]: applySetJWT,
52
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_SELL)}${ACTION_SET_MODAL_STATE}`]: applySetIsAppActive,
53
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_SELL)}${ACTION_APP_LOADED}`]: applySetSendJWTToApp,
54
- };
55
-
56
- const cryptoSellReducer = (state = INITIAL_STATE, action: ICryptoSellAction) => {
57
- if (!!action.type && !!reducerMap[action.type]) {
58
- return reducerMap[action.type](state, action);
59
- } else {
60
- return state;
61
- }
62
- }
63
-
64
- export default cryptoSellReducer;
@@ -1,64 +0,0 @@
1
- import { AppIdentifier } from "../../types";
2
- import { appIdentifierToActionPrefixMap } from "../../types";
3
- import {
4
- ACTION_SET_JWT,
5
- ACTION_SET_MODAL_STATE,
6
- ACTION_APP_LOADED
7
- } from "./constants";
8
-
9
- export interface ICryptoWithdrawalsState {
10
- jwt: string;
11
- isAppLoaded: boolean;
12
- isAppActive: boolean;
13
- }
14
-
15
- export interface ICryptoWithdrawalsAction {
16
- type: string;
17
- jwt?: string;
18
- isAppActive?: boolean;
19
- isAppLoaded?: boolean;
20
- }
21
-
22
- const INITIAL_STATE: ICryptoWithdrawalsState = {
23
- jwt: "",
24
- isAppActive: false,
25
- isAppLoaded: false
26
- }
27
-
28
- const applySetIsAppActive = (state: ICryptoWithdrawalsState, action: ICryptoWithdrawalsAction) : ICryptoWithdrawalsState => {
29
- return {
30
- ...state,
31
- isAppActive: !!action.isAppActive,
32
- }
33
- }
34
-
35
- const applySetSendJWTToApp = (state: ICryptoWithdrawalsState, action: ICryptoWithdrawalsAction) : ICryptoWithdrawalsState => {
36
- return {
37
- ...state,
38
- isAppLoaded: !!action.isAppLoaded,
39
- }
40
- }
41
-
42
- const applySetJWT = (state: ICryptoWithdrawalsState, action: ICryptoWithdrawalsAction) : ICryptoWithdrawalsState => {
43
- return {
44
- ...state,
45
- jwt: action.jwt as string,
46
- }
47
- }
48
-
49
- const reducerMap: { [actionType: string]: (state: ICryptoWithdrawalsState, action: ICryptoWithdrawalsAction) => ICryptoWithdrawalsState } = {
50
- // Crypto Withdrawals reducer
51
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_WITHDRAWALS)}${ACTION_SET_JWT}`]: applySetJWT,
52
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_WITHDRAWALS)}${ACTION_SET_MODAL_STATE}`]: applySetIsAppActive,
53
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.CRYPTO_WITHDRAWALS)}${ACTION_APP_LOADED}`]: applySetSendJWTToApp,
54
- };
55
-
56
- const cryptoWithdrawalsReducer = (state = INITIAL_STATE, action: ICryptoWithdrawalsAction) => {
57
- if (!!action.type && !!reducerMap[action.type]) {
58
- return reducerMap[action.type](state, action);
59
- } else {
60
- return state;
61
- }
62
- }
63
-
64
- export default cryptoWithdrawalsReducer;
@@ -1,60 +0,0 @@
1
- import { AppIdentifier, appIdentifierToActionPrefixMap } from "../../types";
2
- import { ACTION_APP_LOADED, ACTION_SET_JWT, ACTION_SET_MODAL_STATE } from "./constants";
3
-
4
- export interface IFiatAccountLinkState {
5
- jwt: string;
6
- isAppLoaded: boolean;
7
- isAppActive: boolean;
8
- }
9
-
10
- export interface IFiatAccountLinkAction {
11
- type: string;
12
- jwt?: string;
13
- isAppActive?: boolean;
14
- isAppLoaded?: boolean;
15
- }
16
-
17
- const INITIAL_STATE: IFiatAccountLinkState = {
18
- jwt: "",
19
- isAppActive: false,
20
- isAppLoaded: false
21
- }
22
-
23
- const applySetIsAppActive = (state: IFiatAccountLinkState, action: IFiatAccountLinkAction): IFiatAccountLinkState => {
24
- return {
25
- ...state,
26
- isAppActive: !!action.isAppActive,
27
- }
28
- }
29
-
30
- const applySetSendJWTToApp = (state: IFiatAccountLinkState, action: IFiatAccountLinkAction): IFiatAccountLinkState => {
31
- return {
32
- ...state,
33
- isAppLoaded: !!action.isAppLoaded,
34
- }
35
- }
36
-
37
- const applySetJWT = (state: IFiatAccountLinkState, action: IFiatAccountLinkAction): IFiatAccountLinkState => {
38
- return {
39
- ...state,
40
- jwt: action.jwt as string,
41
- }
42
- }
43
-
44
- const reducerMap: {
45
- [actionType: string]: (state: IFiatAccountLinkState, action: IFiatAccountLinkAction) => IFiatAccountLinkState
46
- } = {
47
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.FIAT_ACCOUNT_LINK)}${ACTION_SET_JWT}`]: applySetJWT,
48
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.FIAT_ACCOUNT_LINK)}${ACTION_SET_MODAL_STATE}`]: applySetIsAppActive,
49
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.FIAT_ACCOUNT_LINK)}${ACTION_APP_LOADED}`]: applySetSendJWTToApp,
50
- };
51
-
52
- const fiatAccountLinkReducer = (state = INITIAL_STATE, action: IFiatAccountLinkAction) => {
53
- if (!!action.type && !!reducerMap[action.type]) {
54
- return reducerMap[action.type](state, action);
55
- } else {
56
- return state;
57
- }
58
- }
59
-
60
- export default fiatAccountLinkReducer;
@@ -1,64 +0,0 @@
1
- import { AppIdentifier } from "../../types";
2
- import { appIdentifierToActionPrefixMap } from "../../types";
3
- import {
4
- ACTION_SET_JWT,
5
- ACTION_SET_MODAL_STATE,
6
- ACTION_APP_LOADED
7
- } from "./constants";
8
-
9
- export interface IFiatDepositsState {
10
- jwt: string;
11
- isAppLoaded: boolean;
12
- isAppActive: boolean;
13
- }
14
-
15
- export interface IFiatDepositsAction {
16
- type: string;
17
- jwt?: string;
18
- isAppActive?: boolean;
19
- isAppLoaded?: boolean;
20
- }
21
-
22
- const INITIAL_STATE: IFiatDepositsState = {
23
- jwt: "",
24
- isAppActive: false,
25
- isAppLoaded: false
26
- }
27
-
28
- const applySetIsAppActive = (state: IFiatDepositsState, action: IFiatDepositsAction): IFiatDepositsState => {
29
- return {
30
- ...state,
31
- isAppActive: !!action.isAppActive,
32
- }
33
- }
34
-
35
- const applySetSendJWTToApp = (state: IFiatDepositsState, action: IFiatDepositsAction): IFiatDepositsState => {
36
- return {
37
- ...state,
38
- isAppLoaded: !!action.isAppLoaded,
39
- }
40
- }
41
-
42
- const applySetJWT = (state: IFiatDepositsState, action: IFiatDepositsAction): IFiatDepositsState => {
43
- return {
44
- ...state,
45
- jwt: action.jwt as string,
46
- }
47
- }
48
-
49
- const reducerMap: { [actionType: string]: (state: IFiatDepositsState, action: IFiatDepositsAction) => IFiatDepositsState } = {
50
- // Fiat Deposits reducer
51
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.FIAT_DEPOSITS)}${ACTION_SET_JWT}`]: applySetJWT,
52
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.FIAT_DEPOSITS)}${ACTION_SET_MODAL_STATE}`]: applySetIsAppActive,
53
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.FIAT_DEPOSITS)}${ACTION_APP_LOADED}`]: applySetSendJWTToApp,
54
- };
55
-
56
- const fiatDepositsReducer = (state = INITIAL_STATE, action: IFiatDepositsAction) => {
57
- if (!!action.type && !!reducerMap[action.type]) {
58
- return reducerMap[action.type](state, action);
59
- } else {
60
- return state;
61
- }
62
- }
63
-
64
- export default fiatDepositsReducer;
@@ -1,64 +0,0 @@
1
- import { AppIdentifier } from "../../types";
2
- import { appIdentifierToActionPrefixMap } from "../../types";
3
- import {
4
- ACTION_SET_JWT,
5
- ACTION_SET_MODAL_STATE,
6
- ACTION_APP_LOADED
7
- } from "./constants";
8
-
9
- export interface IFiatWithdrawalsState {
10
- jwt: string;
11
- isAppLoaded: boolean;
12
- isAppActive: boolean;
13
- }
14
-
15
- export interface IFiatWithdrawalsAction {
16
- type: string;
17
- jwt?: string;
18
- isAppActive?: boolean;
19
- isAppLoaded?: boolean;
20
- }
21
-
22
- const INITIAL_STATE: IFiatWithdrawalsState = {
23
- jwt: "",
24
- isAppActive: false,
25
- isAppLoaded: false
26
- }
27
-
28
- const applySetIsAppActive = (state: IFiatWithdrawalsState, action: IFiatWithdrawalsAction) : IFiatWithdrawalsState => {
29
- return {
30
- ...state,
31
- isAppActive: !!action.isAppActive,
32
- }
33
- }
34
-
35
- const applySetSendJWTToApp = (state: IFiatWithdrawalsState, action: IFiatWithdrawalsAction) : IFiatWithdrawalsState => {
36
- return {
37
- ...state,
38
- isAppLoaded: !!action.isAppLoaded,
39
- }
40
- }
41
-
42
- const applySetJWT = (state: IFiatWithdrawalsState, action: IFiatWithdrawalsAction) : IFiatWithdrawalsState => {
43
- return {
44
- ...state,
45
- jwt: action.jwt as string,
46
- }
47
- }
48
-
49
- const reducerMap: { [actionType: string]: (state: IFiatWithdrawalsState, action: IFiatWithdrawalsAction) => IFiatWithdrawalsState } = {
50
- // Fiat Withdrawals reducer
51
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.FIAT_WITHDRAWALS)}${ACTION_SET_JWT}`]: applySetJWT,
52
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.FIAT_WITHDRAWALS)}${ACTION_SET_MODAL_STATE}`]: applySetIsAppActive,
53
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.FIAT_WITHDRAWALS)}${ACTION_APP_LOADED}`]: applySetSendJWTToApp,
54
- };
55
-
56
- const fiatWithdrawalsReducer = (state = INITIAL_STATE, action: IFiatWithdrawalsAction) => {
57
- if (!!action.type && !!reducerMap[action.type]) {
58
- return reducerMap[action.type](state, action);
59
- } else {
60
- return state;
61
- }
62
- }
63
-
64
- export default fiatWithdrawalsReducer;
@@ -1,75 +0,0 @@
1
- import { AppIdentifier } from "../../types";
2
- import { appIdentifierToActionPrefixMap } from "../../types";
3
- import {
4
- ACTION_SET_JWT,
5
- ACTION_SET_MODAL_STATE,
6
- ACTION_APP_LOADED,
7
- ACTION_SET_USE_AUTH
8
- } from "./constants";
9
-
10
- export interface IFundState {
11
- jwt: string;
12
- isAppLoaded: boolean;
13
- isAppActive: boolean;
14
- useAuth?: boolean;
15
- }
16
-
17
- export interface IFundAction {
18
- type: string;
19
- jwt?: string;
20
- isAppActive?: boolean;
21
- isAppLoaded?: boolean;
22
- useAuth?: boolean;
23
- }
24
-
25
- const INITIAL_STATE: IFundState = {
26
- jwt: "",
27
- isAppActive: false,
28
- isAppLoaded: false,
29
- useAuth: false
30
- }
31
-
32
- const applySetIsAppActive = (state: IFundState, action: IFundAction) : IFundState => {
33
- return {
34
- ...state,
35
- isAppActive: !!action.isAppActive,
36
- }
37
- }
38
-
39
- const applySetSendJWTToApp = (state: IFundState, action: IFundAction) : IFundState => {
40
- return {
41
- ...state,
42
- isAppLoaded: !!action.isAppLoaded,
43
- }
44
- }
45
-
46
- const applySetJWT = (state: IFundState, action: IFundAction) : IFundState => {
47
- return {
48
- ...state,
49
- jwt: action.jwt as string,
50
- }
51
- }
52
-
53
- const applySetUseAuth = (state: IFundState, action: IFundAction) : IFundState => {
54
- return {
55
- ...state,
56
- useAuth: action.useAuth,
57
- }
58
- }
59
-
60
- const reducerMap: { [actionType: string]: (state: IFundState, action: IFundAction) => IFundState } = {
61
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.FUND)}${ACTION_SET_JWT}`]: applySetJWT,
62
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.FUND)}${ACTION_SET_MODAL_STATE}`]: applySetIsAppActive,
63
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.FUND)}${ACTION_APP_LOADED}`]: applySetSendJWTToApp,
64
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.FUND)}${ACTION_SET_USE_AUTH}`]: applySetUseAuth,
65
- };
66
-
67
- const fundReducer = (state = INITIAL_STATE, action: IFundAction) => {
68
- if (!!action.type && !!reducerMap[action.type]) {
69
- return reducerMap[action.type](state, action);
70
- } else {
71
- return state;
72
- }
73
- }
74
-
75
- export default fundReducer;
@@ -1,35 +0,0 @@
1
- import { combineReducers } from "redux";
2
- import cryptoWithdrawalsReducer from './crypto-withdrawals'
3
- import onboardingReducer from "./onboarding";
4
- import fiatDepositsReducer from "./fiat-deposits";
5
- import fiatWithdrawalsReducer from "./fiat-withdrawals";
6
- import cryptoBuyReducer from "./crypto-buy";
7
- import cryptoSellReducer from "./crypto-sell";
8
- import fundReducer from "./fund";
9
- import profileReducer from "./profile";
10
- import cryptoAccountLinkReducer from "./crypto-account-link";
11
- import cryptoAccountLinkPayoutsReducer from "./crypto-account-link-payouts";
12
- import payoutsReducer from "./payouts";
13
- import payReducer from "./pay";
14
- import fiatAccountLinkReducer from "./fiat-account-link";
15
-
16
- const rootReducer = combineReducers({
17
- ["crypto-withdrawals"]: cryptoWithdrawalsReducer,
18
- ["onboarding"]: onboardingReducer,
19
- ["fiat-deposits"]: fiatDepositsReducer,
20
- ["fiat-withdrawals"]: fiatWithdrawalsReducer,
21
- ["crypto-buy"]: cryptoBuyReducer,
22
- ["crypto-sell"]: cryptoSellReducer,
23
- ["csp-crypto-withdrawals"]: cryptoWithdrawalsReducer,
24
- ["csp-fiat-withdrawals"]: fiatWithdrawalsReducer,
25
- ["csp-crypto-sell"]: cryptoSellReducer,
26
- ["fund"]: fundReducer,
27
- ["profile"]: profileReducer,
28
- ["crypto-account-link"]: cryptoAccountLinkReducer,
29
- ["crypto-account-link-payouts"]: cryptoAccountLinkPayoutsReducer,
30
- ["payouts"]: payoutsReducer,
31
- ["pay"]: payReducer,
32
- ["fiat-account-link"]: fiatAccountLinkReducer,
33
- });
34
-
35
- export default rootReducer;
@@ -1,74 +0,0 @@
1
- import { AppIdentifier, OnboardingPage } from "../../types";
2
- import { appIdentifierToActionPrefixMap } from "../../types";
3
- import {
4
- ACTION_SET_JWT,
5
- ACTION_SET_MODAL_STATE,
6
- ACTION_APP_LOADED,
7
- ACTION_SET_NAVIGATE
8
- } from "./constants";
9
-
10
- export interface IOnboardingState {
11
- jwt: string;
12
- isAppLoaded: boolean;
13
- isAppActive: boolean;
14
- navigate?: OnboardingPage;
15
- }
16
-
17
- export interface IOnboardingAction {
18
- type: string;
19
- jwt?: string;
20
- isAppActive?: boolean;
21
- isAppLoaded?: boolean;
22
- navigate?: OnboardingPage;
23
- }
24
-
25
- const INITIAL_STATE: IOnboardingState = {
26
- jwt: "",
27
- isAppActive: false,
28
- isAppLoaded: false
29
- }
30
-
31
- const applySetIsAppActive = (state: IOnboardingState, action: IOnboardingAction) : IOnboardingState => {
32
- return {
33
- ...state,
34
- isAppActive: !!action.isAppActive,
35
- }
36
- }
37
-
38
- const applySetSendJWTToApp = (state: IOnboardingState, action: IOnboardingAction) : IOnboardingState => {
39
- return {
40
- ...state,
41
- isAppLoaded: !!action.isAppLoaded,
42
- }
43
- }
44
-
45
- const applySetJWT = (state: IOnboardingState, action: IOnboardingAction) : IOnboardingState => {
46
- return {
47
- ...state,
48
- jwt: action.jwt as string,
49
- }
50
- }
51
- const applySetNavigate = (state: IOnboardingState, action: IOnboardingAction): IOnboardingState => {
52
- return {
53
- ...state,
54
- navigate: action.navigate,
55
- }
56
- }
57
-
58
- const reducerMap: { [actionType: string]: (state: IOnboardingState, action: IOnboardingAction) => IOnboardingState } = {
59
- // Onboarding reducer
60
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.ONBOARDING)}${ACTION_SET_JWT}`]: applySetJWT,
61
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.ONBOARDING)}${ACTION_SET_MODAL_STATE}`]: applySetIsAppActive,
62
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.ONBOARDING)}${ACTION_APP_LOADED}`]: applySetSendJWTToApp,
63
- [`${appIdentifierToActionPrefixMap.get(AppIdentifier.ONBOARDING)}${ACTION_SET_NAVIGATE}`]: applySetNavigate,
64
- };
65
-
66
- const onboardingReducer = (state = INITIAL_STATE, action: IOnboardingAction) => {
67
- if (!!action.type && !!reducerMap[action.type]) {
68
- return reducerMap[action.type](state, action);
69
- } else {
70
- return state;
71
- }
72
- }
73
-
74
- export default onboardingReducer;