zh-web-sdk 2.7.2 → 2.8.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.
- package/dist/iframe-container/AppContainer.d.ts +4 -2
- package/dist/index.d.ts +8 -3
- package/dist/index.js +7 -7
- package/dist/index.js.map +4 -4
- package/dist/redux/reducers/constants.d.ts +1 -0
- package/dist/redux/reducers/fund.d.ts +13 -0
- package/dist/redux/reducers/index.d.ts +2 -2
- package/dist/redux/reducers/onboarding.d.ts +3 -0
- package/dist/redux/store/index.d.ts +2 -2
- package/dist/types.d.ts +32 -15
- package/package.json +1 -1
- package/src/iframe-container/AppContainer.tsx +36 -5
- package/src/index.tsx +27 -17
- package/src/redux/reducers/constants.ts +2 -1
- package/src/redux/reducers/fund.ts +63 -0
- package/src/redux/reducers/index.ts +2 -2
- package/src/redux/reducers/onboarding.ts +12 -2
- package/src/types.ts +297 -279
- package/dist/redux/reducers/fund-with-crypto.d.ts +0 -13
- package/src/redux/reducers/fund-with-crypto.ts +0 -63
|
@@ -1,63 +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 IFundWithCryptoState {
|
|
10
|
-
jwt: string;
|
|
11
|
-
isAppLoaded: boolean;
|
|
12
|
-
isAppActive: boolean;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface IFundWithCryptoAction {
|
|
16
|
-
type: string;
|
|
17
|
-
jwt?: string;
|
|
18
|
-
isAppActive?: boolean;
|
|
19
|
-
isAppLoaded?: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const INITIAL_STATE: IFundWithCryptoState = {
|
|
23
|
-
jwt: "",
|
|
24
|
-
isAppActive: false,
|
|
25
|
-
isAppLoaded: false
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const applySetIsAppActive = (state: IFundWithCryptoState, action: IFundWithCryptoAction) : IFundWithCryptoState => {
|
|
29
|
-
return {
|
|
30
|
-
...state,
|
|
31
|
-
isAppActive: !!action.isAppActive,
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const applySetSendJWTToApp = (state: IFundWithCryptoState, action: IFundWithCryptoAction) : IFundWithCryptoState => {
|
|
36
|
-
return {
|
|
37
|
-
...state,
|
|
38
|
-
isAppLoaded: !!action.isAppLoaded,
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const applySetJWT = (state: IFundWithCryptoState, action: IFundWithCryptoAction) : IFundWithCryptoState => {
|
|
43
|
-
return {
|
|
44
|
-
...state,
|
|
45
|
-
jwt: action.jwt as string,
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const reducerMap: { [actionType: string]: (state: IFundWithCryptoState, action: IFundWithCryptoAction) => IFundWithCryptoState } = {
|
|
50
|
-
[`${appIdentifierToActionPrefixMap.get(AppIdentifier.FUND_WITH_CRYPTO)}${ACTION_SET_JWT}`]: applySetJWT,
|
|
51
|
-
[`${appIdentifierToActionPrefixMap.get(AppIdentifier.FUND_WITH_CRYPTO)}${ACTION_SET_MODAL_STATE}`]: applySetIsAppActive,
|
|
52
|
-
[`${appIdentifierToActionPrefixMap.get(AppIdentifier.FUND_WITH_CRYPTO)}${ACTION_APP_LOADED}`]: applySetSendJWTToApp,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const fundWithCryptoReducer = (state = INITIAL_STATE, action: IFundWithCryptoAction) => {
|
|
56
|
-
if (!!action.type && !!reducerMap[action.type]) {
|
|
57
|
-
return reducerMap[action.type](state, action);
|
|
58
|
-
} else {
|
|
59
|
-
return state;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default fundWithCryptoReducer;
|