ouisys-engine 3.0.2 → 3.0.6
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/.babelrc +4 -8
- package/.eslintrc.js +1 -1
- package/.nvmrc +1 -1
- package/.prettierignore +2 -1
- package/README.md +2 -4
- package/dist/api/index.d.ts +5 -5
- package/dist/api/index.js +76 -76
- package/dist/common-types/AppThunk.d.ts +11 -12
- package/dist/common-types/IOptInFlowName.d.ts +1 -1
- package/dist/common-types/ITracker.js +1 -2
- package/dist/common-types/RemoteDataState.d.ts +4 -4
- package/dist/common-types/RemoteDataState.js +17 -17
- package/dist/flows/click2smsFlow.d.ts +2 -2
- package/dist/flows/moFlow.d.ts +2 -2
- package/dist/flows/moRedirFlow.d.ts +2 -2
- package/dist/flows/oneClickFlow.d.ts +2 -2
- package/dist/flows/pinFlow.d.ts +2 -2
- package/dist/flows/pinFlow.js +2 -0
- package/dist/flows/strategy.d.ts +8 -8
- package/dist/flows/ussdFlow.d.ts +2 -2
- package/dist/ips/tryGetIPRangeName.d.ts +1 -1
- package/dist/ips/tryGetIPRangeName.js +7 -5
- package/dist/jest.config.js +1 -1
- package/dist/pacman/index.d.ts +2 -2
- package/dist/pacman/index.js +41 -41
- package/dist/pacman/queryString.js +11 -9
- package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +19 -19
- package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +1 -1
- package/dist/reducers/click2smsFlow/index.d.ts +2 -2
- package/dist/reducers/click2smsFlow/index.js +24 -24
- package/dist/reducers/click2smsFlow/utils.d.ts +1 -1
- package/dist/reducers/click2smsFlow/utils.js +30 -30
- package/dist/reducers/moFlow/IMoConstants.d.ts +1 -1
- package/dist/reducers/moFlow/MoTypes.d.ts +13 -13
- package/dist/reducers/moFlow/index.d.ts +3 -3
- package/dist/reducers/moFlow/index.js +27 -27
- package/dist/reducers/moFlow/utils.d.ts +1 -2
- package/dist/reducers/moFlow/utils.js +28 -26
- package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +1 -1
- package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +13 -13
- package/dist/reducers/moRedirFlow/index.d.ts +3 -3
- package/dist/reducers/moRedirFlow/index.js +27 -27
- package/dist/reducers/moRedirFlow/utils.d.ts +1 -1
- package/dist/reducers/moRedirFlow/utils.js +17 -17
- package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +1 -1
- package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +10 -10
- package/dist/reducers/oneClickFlow/index.d.ts +3 -3
- package/dist/reducers/oneClickFlow/index.js +75 -68
- package/dist/reducers/oneClickFlow/utils.d.ts +2 -2
- package/dist/reducers/oneClickFlow/utils.js +70 -69
- package/dist/reducers/pinFlow/IPinConstants.d.ts +1 -1
- package/dist/reducers/pinFlow/PinTypes.d.ts +23 -23
- package/dist/reducers/pinFlow/index.d.ts +3 -3
- package/dist/reducers/pinFlow/index.js +76 -76
- package/dist/reducers/pinFlow/utils.d.ts +1 -1
- package/dist/reducers/pinFlow/utils.js +61 -65
- package/dist/reducers/strategy/IStategyActionContants.d.ts +1 -1
- package/dist/reducers/strategy/StrategyTypes.d.ts +56 -56
- package/dist/reducers/strategy/index.d.ts +2 -2
- package/dist/reducers/strategy/index.js +99 -99
- package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +3 -2
- package/dist/reducers/strategy/strategies/ask_mobile_number.js +132 -74
- package/dist/reducers/strategy/strategies/ask_operator.d.ts +2 -2
- package/dist/reducers/strategy/strategies/ask_operator.js +64 -68
- package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +2 -2
- package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +97 -97
- package/dist/reducers/strategy/strategies/header_enrichment.d.ts +2 -2
- package/dist/reducers/strategy/strategies/header_enrichment.js +116 -120
- package/dist/reducers/strategy/utils.d.ts +3 -3
- package/dist/reducers/strategy/utils.js +115 -111
- package/dist/reducers/ussdFlow/IUssdConstants.d.ts +1 -1
- package/dist/reducers/ussdFlow/UssdTypes.d.ts +13 -13
- package/dist/reducers/ussdFlow/index.d.ts +3 -3
- package/dist/reducers/ussdFlow/index.js +27 -27
- package/dist/reducers/ussdFlow/utils.d.ts +1 -2
- package/dist/reducers/ussdFlow/utils.js +19 -17
- package/dist/store/index.d.ts +8 -8
- package/dist/store/index.js +87 -83
- package/dist/store/reducers.d.ts +7 -7
- package/dist/store/reducers.js +4 -4
- package/dist/utilities/handleSubmitNumber.d.ts +7 -3
- package/dist/utilities/handleSubmitNumber.js +15 -18
- package/dist/utilities/index.d.ts +1 -1
- package/dist/utilities/index.js +13 -11
- package/dist/utilities/loadScriptInnerHtml.js +0 -1
- package/index.html +21 -28
- package/package.json +23 -15
- package/setupJest.js +1 -1
- package/tsconfig.json +2 -2
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/ouisys-engine.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.vscode/settings.json +0 -6
- package/dist/api/click2sms.js +0 -357
- package/dist/api/mo.js +0 -274
- package/dist/api/moRedir.js +0 -186
- package/dist/api/oneClick.js +0 -366
- package/dist/api/pin.js +0 -493
- package/dist/api/strategies.js +0 -704
- package/dist/api/ussd.js +0 -1
- package/dist/app/store.js +0 -35
- package/dist/features/strategies/categories/askMobileNumber.js +0 -395
- package/dist/features/strategies/categories/askOperator.js +0 -311
- package/dist/features/strategies/categories/detectOperatorByIp.js +0 -606
- package/dist/features/strategies/categories/headerEnrichment.js +0 -670
- package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +0 -12
- package/dist/features/strategies/categories/typings/identifySliceTypes.js +0 -22
- package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +0 -22
- package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +0 -21
- package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +0 -13
- package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +0 -13
- package/dist/features/strategies/click2smsFlowSlice.js +0 -172
- package/dist/features/strategies/identifySlice.js +0 -455
- package/dist/features/strategies/moFlowSlice.js +0 -196
- package/dist/features/strategies/moRedirFlowSlice.js +0 -190
- package/dist/features/strategies/oneClickFlowSlice.js +0 -277
- package/dist/features/strategies/pinFlowSlice.js +0 -313
- package/dist/features/strategies/ussdFlowSlice.js +0 -1
- package/dist/flows/tpayHeFlow.d.ts +0 -7
- package/dist/flows/tpayHeFlow.js +0 -23
- package/dist/mockServer/browser.js +0 -48
- package/dist/mockServer/handlers.js +0 -22
- package/dist/mockServer/server.js +0 -48
- package/dist/reducers/tpayHeFlow/ITpayHeConstants.d.ts +0 -2
- package/dist/reducers/tpayHeFlow/ITpayHeConstants.js +0 -1
- package/dist/reducers/tpayHeFlow/TpayHeTypes.d.ts +0 -114
- package/dist/reducers/tpayHeFlow/TpayHeTypes.js +0 -1
- package/dist/reducers/tpayHeFlow/index.d.ts +0 -7
- package/dist/reducers/tpayHeFlow/index.js +0 -331
- package/dist/reducers/tpayHeFlow/utils.d.ts +0 -20
- package/dist/reducers/tpayHeFlow/utils.js +0 -510
- package/dist/test/setup.js +0 -24
- package/dist/test/test-utils.js +0 -51
- package/mockData/config.json +0 -28
- package/prettier.config.js +0 -7
- package/src/@types/react-tracker.d.ts +0 -16
- package/src/@types/redux-cli-logger.d.ts +0 -1
- package/src/@types/tiny-async-pool.d.ts +0 -3
- package/src/@types/window.d.ts +0 -74
- package/src/api/index.ts +0 -225
- package/src/common-types/AppThunk.ts +0 -19
- package/src/common-types/Either.ts +0 -3
- package/src/common-types/IError.ts +0 -5
- package/src/common-types/IOptInFlowName.ts +0 -1
- package/src/common-types/ITracker.ts +0 -10
- package/src/common-types/IVisitor.ts +0 -16
- package/src/common-types/RemoteDataState.ts +0 -88
- package/src/flows/click2smsFlow.ts +0 -18
- package/src/flows/moFlow.ts +0 -20
- package/src/flows/moRedirFlow.ts +0 -20
- package/src/flows/oneClickFlow.ts +0 -20
- package/src/flows/pinFlow.ts +0 -25
- package/src/flows/strategy.ts +0 -51
- package/src/flows/ussdFlow.ts +0 -20
- package/src/index.ts +0 -3
- package/src/ips/tryGetIPRangeName.ts +0 -22
- package/src/jest.config.js +0 -194
- package/src/pacman/index.ts +0 -71
- package/src/pacman/queryString.ts +0 -24
- package/src/reducers/click2smsFlow/Click2smsTypes.ts +0 -93
- package/src/reducers/click2smsFlow/IClick2smsConstants.ts +0 -4
- package/src/reducers/click2smsFlow/index.ts +0 -105
- package/src/reducers/click2smsFlow/utils.ts +0 -126
- package/src/reducers/moFlow/IMoConstants.ts +0 -7
- package/src/reducers/moFlow/MoTypes.ts +0 -125
- package/src/reducers/moFlow/index.ts +0 -150
- package/src/reducers/moFlow/utils.ts +0 -135
- package/src/reducers/moRedirFlow/IMoRedirConstants.ts +0 -7
- package/src/reducers/moRedirFlow/MoRedirTypes.ts +0 -99
- package/src/reducers/moRedirFlow/index.ts +0 -137
- package/src/reducers/moRedirFlow/utils.ts +0 -78
- package/src/reducers/oneClickFlow/IOneClickConstants.ts +0 -3
- package/src/reducers/oneClickFlow/OneClickTypes.ts +0 -108
- package/src/reducers/oneClickFlow/index.ts +0 -268
- package/src/reducers/oneClickFlow/utils.ts +0 -217
- package/src/reducers/pinFlow/IPinConstants.ts +0 -9
- package/src/reducers/pinFlow/PinTypes.ts +0 -190
- package/src/reducers/pinFlow/index.ts +0 -331
- package/src/reducers/pinFlow/utils.ts +0 -232
- package/src/reducers/strategy/IStategyActionContants.ts +0 -17
- package/src/reducers/strategy/StrategyTypes.ts +0 -375
- package/src/reducers/strategy/index.ts +0 -321
- package/src/reducers/strategy/strategies/ask_mobile_number.ts +0 -316
- package/src/reducers/strategy/strategies/ask_operator.ts +0 -195
- package/src/reducers/strategy/strategies/detect_operator_by_ip.ts +0 -414
- package/src/reducers/strategy/strategies/header_enrichment.ts +0 -489
- package/src/reducers/strategy/utils.ts +0 -357
- package/src/reducers/ussdFlow/IUssdConstants.ts +0 -7
- package/src/reducers/ussdFlow/UssdTypes.ts +0 -112
- package/src/reducers/ussdFlow/index.ts +0 -146
- package/src/reducers/ussdFlow/utils.ts +0 -88
- package/src/store/index.ts +0 -150
- package/src/store/reducers.ts +0 -37
- package/src/utilities/handleSubmitNumber.ts +0 -65
- package/src/utilities/index.ts +0 -114
- package/src/utilities/loadScriptInnerHtml.ts +0 -14
- package/src/utilities/loadScriptSrc.ts +0 -26
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
// LIBRARIES
|
|
2
|
-
|
|
3
|
-
import * as RDS from "../../common-types/RemoteDataState";
|
|
4
|
-
import { AppThunk } from "../../common-types/AppThunk";
|
|
5
|
-
import {
|
|
6
|
-
getConfig, mockedClick2smsFlow, mockedMoFlow, mockedMoRdirFlow, mockedOneClickFlow, mockedPinFlow, mockedTPayFlow, mockedUssdFlow, searchToObject
|
|
7
|
-
} from "./utils";
|
|
8
|
-
import {
|
|
9
|
-
IStrategyReducerState,
|
|
10
|
-
IStrategyActions,
|
|
11
|
-
IStrategyActionMaps,
|
|
12
|
-
IIdenyifyStrategyPayload,
|
|
13
|
-
IMockFlowParams, IIdentifyFlowByHePayload, IIdentifyFlowByIpOperatorPayload, ISubmitMsisdnPayload, IIdenyifyFlowByMsisdnPayload, IOperatorSelectPayload, IOperatorSelectFlowIdentifyPayload
|
|
14
|
-
} from "./StrategyTypes";
|
|
15
|
-
|
|
16
|
-
import ask_operator,
|
|
17
|
-
{
|
|
18
|
-
selectOperator
|
|
19
|
-
} from "./strategies/ask_operator";
|
|
20
|
-
import ask_mobile_number,
|
|
21
|
-
{
|
|
22
|
-
submitMSISDNAction
|
|
23
|
-
} from "./strategies/ask_mobile_number";
|
|
24
|
-
import update from 'immutability-helper';
|
|
25
|
-
import mkTracker from "../../pacman";
|
|
26
|
-
import detect_operator_by_ip from "./strategies/detect_operator_by_ip";
|
|
27
|
-
import { loadOc2sms } from "../click2smsFlow";
|
|
28
|
-
import { checkSubscription } from "../click2smsFlow/utils";
|
|
29
|
-
import identify_user from "./strategies/header_enrichment";
|
|
30
|
-
import { mockPinFlow } from "../pinFlow";
|
|
31
|
-
import { IMockPinFlowStates } from "../pinFlow/PinTypes";
|
|
32
|
-
import { mockMoFlow } from "../moFlow";
|
|
33
|
-
import { mockMoRedirFlow } from "../moRedirFlow";
|
|
34
|
-
import { mockUssdFlow } from "../ussdFlow";
|
|
35
|
-
import { mockOneClickFlow } from "../oneClickFlow";
|
|
36
|
-
|
|
37
|
-
export const tracker = mkTracker(
|
|
38
|
-
typeof window != "undefined" ? window : null
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
export function mockStrategyStateByUrlParam():AppThunk {
|
|
42
|
-
return (dispatch)=>{
|
|
43
|
-
const search = searchToObject() as IMockFlowParams<any>;
|
|
44
|
-
|
|
45
|
-
if(search["mock-flow"] !== undefined){
|
|
46
|
-
switch (search["mock-flow"]) {
|
|
47
|
-
case "pin":
|
|
48
|
-
dispatch({
|
|
49
|
-
type:"MOCK_STRATEGY_STATE",
|
|
50
|
-
payload:mockedPinFlow.currentState
|
|
51
|
-
})
|
|
52
|
-
dispatch(mockPinFlow(search["current-state"]))
|
|
53
|
-
break;
|
|
54
|
-
case "mo":
|
|
55
|
-
dispatch({
|
|
56
|
-
type:"MOCK_STRATEGY_STATE",
|
|
57
|
-
payload:mockedMoFlow.currentState
|
|
58
|
-
})
|
|
59
|
-
dispatch(mockMoFlow(search["current-state"]))
|
|
60
|
-
break;
|
|
61
|
-
case "moredir":
|
|
62
|
-
dispatch({
|
|
63
|
-
type:"MOCK_STRATEGY_STATE",
|
|
64
|
-
payload:mockedMoRdirFlow.currentState
|
|
65
|
-
})
|
|
66
|
-
dispatch(mockMoRedirFlow(search["current-state"]))
|
|
67
|
-
break;
|
|
68
|
-
case "oneclick":
|
|
69
|
-
dispatch({
|
|
70
|
-
type:"MOCK_STRATEGY_STATE",
|
|
71
|
-
payload:mockedOneClickFlow.currentState
|
|
72
|
-
})
|
|
73
|
-
setTimeout(() => {
|
|
74
|
-
dispatch(mockOneClickFlow(search["current-state"]))
|
|
75
|
-
|
|
76
|
-
}, 2000);
|
|
77
|
-
break;
|
|
78
|
-
case "click2sms":
|
|
79
|
-
dispatch({
|
|
80
|
-
type:"MOCK_STRATEGY_STATE",
|
|
81
|
-
payload:mockedClick2smsFlow.currentState
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
break;
|
|
85
|
-
case "ussd":
|
|
86
|
-
dispatch({
|
|
87
|
-
type:"MOCK_STRATEGY_STATE",
|
|
88
|
-
payload:mockedUssdFlow.currentState
|
|
89
|
-
})
|
|
90
|
-
dispatch(mockUssdFlow(search["current-state"]))
|
|
91
|
-
break;
|
|
92
|
-
default:
|
|
93
|
-
throw "Mock Flow not supported";
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
export function identifyStrategy():AppThunk {
|
|
101
|
-
return async (dispatch)=>{
|
|
102
|
-
const { strategy, strategyConfigs } = getConfig();
|
|
103
|
-
const { isUseMsisdnPrefix } = strategyConfigs;
|
|
104
|
-
const search = searchToObject() as IMockFlowParams<IMockPinFlowStates>;
|
|
105
|
-
|
|
106
|
-
if(search["mock-flow"] !== undefined){
|
|
107
|
-
dispatch(mockStrategyStateByUrlParam())
|
|
108
|
-
}else{
|
|
109
|
-
switch (strategy) {
|
|
110
|
-
case "pin-mo-ask-operator":
|
|
111
|
-
return dispatch(ask_operator());
|
|
112
|
-
case "pin-mo-redir-ask-mobile-number":
|
|
113
|
-
case "pin-mo-ask-mobile-number":
|
|
114
|
-
return dispatch(ask_mobile_number());
|
|
115
|
-
case "pin-one-click-detect-operator-by-ip":
|
|
116
|
-
case "one-click-mo-pin-detect-operator-by-ip-or-msisdn":
|
|
117
|
-
case "mo-redir-one-click-detect-operator-by-ip":
|
|
118
|
-
case "mo-one-click-detect-operator-by-ip":
|
|
119
|
-
case "click2sms-one-click-detect-operator-by-ip":
|
|
120
|
-
case "pin-mo-detect-operator-by-ip":
|
|
121
|
-
return dispatch(detect_operator_by_ip());
|
|
122
|
-
case "pin-click2sms-ask-operator":
|
|
123
|
-
case "he-pin-one-click-ask-operator":
|
|
124
|
-
case "click2sms-one-click-ask-operator":
|
|
125
|
-
case "pin-one-click-ask-operator":
|
|
126
|
-
return dispatch(ask_operator());
|
|
127
|
-
case "pin-header-enrichment":
|
|
128
|
-
case "he-pin-mo-redir-header-enrichment":
|
|
129
|
-
case "he-pin-one-click-header-enrichment":
|
|
130
|
-
case "he-mo-redir-one-click-header-enrichment":
|
|
131
|
-
return dispatch(identify_user());
|
|
132
|
-
//single flow strategies
|
|
133
|
-
case "pin":
|
|
134
|
-
tracker.sendOptInFlowEvent("Pin")
|
|
135
|
-
|
|
136
|
-
return dispatch({
|
|
137
|
-
type:"IDENTIFY_STRATEGY",
|
|
138
|
-
payload:{
|
|
139
|
-
type:"PIN",
|
|
140
|
-
result: {
|
|
141
|
-
nextAction:"submitMSISDNAction",
|
|
142
|
-
config:strategyConfigs.default.flowConfig,
|
|
143
|
-
isUseMsisdnPrefix
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
case "mo":
|
|
148
|
-
tracker.sendOptInFlowEvent("Msisdn to sms")
|
|
149
|
-
|
|
150
|
-
return dispatch({
|
|
151
|
-
type:"IDENTIFY_STRATEGY",
|
|
152
|
-
payload:{
|
|
153
|
-
type:"MO",
|
|
154
|
-
result:{
|
|
155
|
-
nextAction:"submitMSISDNAction",
|
|
156
|
-
config:strategyConfigs.default.flowConfig
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
case "mo-redir":
|
|
161
|
-
tracker.sendOptInFlowEvent("Redirect")
|
|
162
|
-
|
|
163
|
-
return dispatch({
|
|
164
|
-
type:"IDENTIFY_STRATEGY",
|
|
165
|
-
payload:{
|
|
166
|
-
type:"MO_REDIR",
|
|
167
|
-
result: {
|
|
168
|
-
nextAction:"submitMSISDNAction",
|
|
169
|
-
config:strategyConfigs.default.flowConfig
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
case "one-click":
|
|
174
|
-
tracker.sendOptInFlowEvent("3G click")
|
|
175
|
-
|
|
176
|
-
return dispatch({
|
|
177
|
-
type:"IDENTIFY_STRATEGY",
|
|
178
|
-
payload:{
|
|
179
|
-
type:"ONE_CLICK",
|
|
180
|
-
result: {
|
|
181
|
-
nextAction:"getRedirectUrlAction",
|
|
182
|
-
config:strategyConfigs.default.flowConfig
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
case "tallyman-one-click":
|
|
187
|
-
tracker.sendOptInFlowEvent("3G click")
|
|
188
|
-
|
|
189
|
-
return dispatch({
|
|
190
|
-
type:"IDENTIFY_STRATEGY",
|
|
191
|
-
payload:{
|
|
192
|
-
type:"TALLYMAN_ONE_CLICK",
|
|
193
|
-
result: {
|
|
194
|
-
nextAction:"getRedirectUrlAction",
|
|
195
|
-
config:strategyConfigs.default.flowConfig
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
case "click2sms":
|
|
200
|
-
tracker.sendOptInFlowEvent("Click to sms")
|
|
201
|
-
|
|
202
|
-
return dispatch({
|
|
203
|
-
type:"IDENTIFY_STRATEGY",
|
|
204
|
-
payload:{
|
|
205
|
-
type:"CLICK2SMS",
|
|
206
|
-
result: {
|
|
207
|
-
nextAction:"loadOc2sms",
|
|
208
|
-
config:strategyConfigs.default.flowConfig
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
case "ussd":
|
|
214
|
-
tracker.sendOptInFlowEvent("Msisdn to sms")
|
|
215
|
-
|
|
216
|
-
return dispatch({
|
|
217
|
-
type:"IDENTIFY_STRATEGY",
|
|
218
|
-
payload:{
|
|
219
|
-
type:"USSD",
|
|
220
|
-
result: {
|
|
221
|
-
nextAction:"submitMSISDNAction",
|
|
222
|
-
config:strategyConfigs.default.flowConfig
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
case "tpay-he":
|
|
227
|
-
tracker.sendOptInFlowEvent("Hybrid Pin")
|
|
228
|
-
return dispatch({
|
|
229
|
-
type:"IDENTIFY_STRATEGY",
|
|
230
|
-
payload:{
|
|
231
|
-
type:"TPAY_HE",
|
|
232
|
-
result: {
|
|
233
|
-
nextAction:"loadTpayAction",
|
|
234
|
-
config:strategyConfigs.default.flowConfig
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
default:
|
|
239
|
-
throw "Strategy not supported";
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
export function checkSubscriptionAction(trackingArgs:{flow: string, action: string, args?: any}):AppThunk{
|
|
249
|
-
return async (dispatch, store)=>{
|
|
250
|
-
const {currentState} = store().strategy
|
|
251
|
-
|
|
252
|
-
//@ts-ignore
|
|
253
|
-
const maybeConfig = currentState.result.config;
|
|
254
|
-
|
|
255
|
-
try {
|
|
256
|
-
dispatch({
|
|
257
|
-
type:"CHECK_SUBSCRIPTION"
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
checkSubscription(window, maybeConfig)
|
|
261
|
-
.then((product_url)=>{
|
|
262
|
-
tracker.advancedInFlow(trackingArgs.flow, trackingArgs.action, trackingArgs.args);
|
|
263
|
-
setTimeout(() => {
|
|
264
|
-
window.location.href = product_url
|
|
265
|
-
}, 1000);
|
|
266
|
-
})
|
|
267
|
-
|
|
268
|
-
} catch (ex) {
|
|
269
|
-
console.warn(ex)
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
export function genericHandler<S,P>(state:S, payload:P){
|
|
274
|
-
return update(state, {
|
|
275
|
-
//@ts-ignore
|
|
276
|
-
currentState:{
|
|
277
|
-
$set: payload
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
const initialState:IStrategyReducerState = {
|
|
283
|
-
currentState:{
|
|
284
|
-
type: "IDENTIFY_STRATEGY",
|
|
285
|
-
result:RDS.NothingYet()
|
|
286
|
-
}
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
export const StrategyFlowActionMaps:IStrategyActionMaps = {
|
|
290
|
-
selectOperator:selectOperator,
|
|
291
|
-
submitMSISDNAction:submitMSISDNAction,
|
|
292
|
-
loadOc2sms:loadOc2sms
|
|
293
|
-
}
|
|
294
|
-
export default function StrategyReducer(state = initialState, action:IStrategyActions) {
|
|
295
|
-
switch (action.type) {
|
|
296
|
-
case "IDENTIFY_STRATEGY":
|
|
297
|
-
return genericHandler<IStrategyReducerState, IIdenyifyStrategyPayload>(state, action.payload)
|
|
298
|
-
case "IDENTIFY_FLOW_BY_OPERATOR_SELECT":
|
|
299
|
-
return genericHandler<IStrategyReducerState, IOperatorSelectFlowIdentifyPayload>(state, action.payload)
|
|
300
|
-
case "OPERATOR_SELECT":
|
|
301
|
-
return genericHandler<IStrategyReducerState, IOperatorSelectPayload>(state, action.payload)
|
|
302
|
-
case "IDENTIFY_FLOW_BY_MSISDN":
|
|
303
|
-
return genericHandler<IStrategyReducerState, IIdenyifyFlowByMsisdnPayload>(state, action.payload)
|
|
304
|
-
case "IDENTIFY_FLOW_BY_MSISDN_SUBMIT":
|
|
305
|
-
return genericHandler<IStrategyReducerState, ISubmitMsisdnPayload>(state, action.payload)
|
|
306
|
-
case "IDENTIFY_FLOW_BY_IP":
|
|
307
|
-
return genericHandler<IStrategyReducerState, IIdentifyFlowByIpOperatorPayload>(state, action.payload)
|
|
308
|
-
case "IDENTIFY_FLOW_BY_IP_OPERATOR":
|
|
309
|
-
return genericHandler<IStrategyReducerState, IIdentifyFlowByIpOperatorPayload>(state, action.payload)
|
|
310
|
-
case "IDENTIFY_FLOW_BY_HE":
|
|
311
|
-
return genericHandler<IStrategyReducerState, IIdentifyFlowByHePayload>(state, action.payload)
|
|
312
|
-
case "HE_IDENTIFY":
|
|
313
|
-
//@ts-ignore
|
|
314
|
-
return genericHandler<IStrategyReducerState, IIdentifyFlowByHePayload>(state, action.payload)
|
|
315
|
-
case "MOCK_STRATEGY_STATE":
|
|
316
|
-
//@ts-ignore
|
|
317
|
-
return genericHandler<IStrategyReducerState, IIdenyifyStrategyPayload>(state, action.payload)
|
|
318
|
-
default:
|
|
319
|
-
return state;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
@@ -1,316 +0,0 @@
|
|
|
1
|
-
import * as RDS from "../../../common-types/RemoteDataState";
|
|
2
|
-
|
|
3
|
-
import { AppThunk } from "../../../common-types/AppThunk";
|
|
4
|
-
import { determineFlowByMsidn, getConfig } from "../utils";
|
|
5
|
-
import {
|
|
6
|
-
IFlow,
|
|
7
|
-
IDENTIFYMSISDNEntryErrorTypes,
|
|
8
|
-
IDENTIFYMSISDNEntryFailure,
|
|
9
|
-
IDENTIFYMSISDNEntrySuccess
|
|
10
|
-
} from "../StrategyTypes";
|
|
11
|
-
import { tracker } from "..";
|
|
12
|
-
|
|
13
|
-
export default function ask_mobile_number():AppThunk {
|
|
14
|
-
return(dispatch)=>{
|
|
15
|
-
try{
|
|
16
|
-
dispatch({
|
|
17
|
-
type:"IDENTIFY_FLOW_BY_MSISDN",
|
|
18
|
-
payload:{
|
|
19
|
-
type: "IDENTIFY_FLOW_BY_MSISDN",
|
|
20
|
-
result: RDS.NothingYet(),
|
|
21
|
-
nextData:{
|
|
22
|
-
nextAction:"submitMSISDNAction"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
}catch(err){
|
|
27
|
-
dispatch({
|
|
28
|
-
type:"IDENTIFY_FLOW_BY_MSISDN_ERROR",
|
|
29
|
-
payload:{
|
|
30
|
-
type:"IDENTIFY_FLOW_BY_MSISDN",
|
|
31
|
-
result:RDS.Failure(err)
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function submitMSISDNAction(internationalMSISDN:string):AppThunk{
|
|
39
|
-
return async (dispatch)=>{
|
|
40
|
-
try {
|
|
41
|
-
dispatch({
|
|
42
|
-
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
43
|
-
payload:{
|
|
44
|
-
type: "IDENTIFY_FLOW_BY_MSISDN",
|
|
45
|
-
result: RDS.Loading(),
|
|
46
|
-
nextData:{
|
|
47
|
-
nextAction:"submitMSISDNAction"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
const { strategy } = getConfig();
|
|
52
|
-
const flowObj = await determineFlowByMsidn(internationalMSISDN);
|
|
53
|
-
dispatch({
|
|
54
|
-
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
55
|
-
payload:{
|
|
56
|
-
type: "IDENTIFY_FLOW_BY_MSISDN",
|
|
57
|
-
result: RDS.Success(flowObj),
|
|
58
|
-
nextData:{
|
|
59
|
-
nextAction:"submitMSISDNAction",
|
|
60
|
-
...(flowObj.operator && {operator:flowObj.operator})
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
switch (strategy) {
|
|
65
|
-
case "pin-mo-redir-ask-mobile-number":
|
|
66
|
-
return dispatch(pin_mo_redir_ask_mobile_number(flowObj, internationalMSISDN))
|
|
67
|
-
case "pin-mo-ask-mobile-number":
|
|
68
|
-
return dispatch(pin_mo_ask_mobile_number(flowObj, internationalMSISDN))
|
|
69
|
-
}
|
|
70
|
-
} catch (ex) {
|
|
71
|
-
console.warn(ex)
|
|
72
|
-
const errorType: IDENTIFYMSISDNEntryErrorTypes =
|
|
73
|
-
"SEAlreadySubscribed" === ex.type
|
|
74
|
-
? "AlreadySubscribed"
|
|
75
|
-
: "SEInvalidMSISDN" == ex.type
|
|
76
|
-
? "InvalidMSISDN"
|
|
77
|
-
: "UnknownError";
|
|
78
|
-
dispatch({
|
|
79
|
-
type: "IDENTIFY_FLOW_BY_MSISDN_SUBMIT_ERROR",
|
|
80
|
-
payload:{
|
|
81
|
-
type:"IDENTIFY_FLOW_BY_MSISDN",
|
|
82
|
-
result: RDS.Failure<IDENTIFYMSISDNEntryFailure, IDENTIFYMSISDNEntrySuccess>({
|
|
83
|
-
errorType: errorType,
|
|
84
|
-
error: ex
|
|
85
|
-
})
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export const pin_mo_ask_mobile_number = (flowObj:IFlow, msisdn:string):AppThunk=>{
|
|
95
|
-
return(dispatch)=>{
|
|
96
|
-
switch (flowObj.flow) {
|
|
97
|
-
case "pin":
|
|
98
|
-
tracker.sendOptInFlowEvent("Pin")
|
|
99
|
-
dispatch({
|
|
100
|
-
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
101
|
-
payload:{
|
|
102
|
-
type: "IDENTIFY_FLOW_BY_MSISDN",
|
|
103
|
-
result: RDS.Loading(),
|
|
104
|
-
nextData:{
|
|
105
|
-
nextAction:"submitMSISDNAction",
|
|
106
|
-
...(flowObj.operator && {operator:flowObj.operator})
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
})
|
|
110
|
-
return dispatch({
|
|
111
|
-
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
112
|
-
payload:{
|
|
113
|
-
type:"PIN",
|
|
114
|
-
result: {
|
|
115
|
-
nextAction:"submitMSISDNAction",
|
|
116
|
-
config:flowObj.flowConfig,
|
|
117
|
-
msisdn,
|
|
118
|
-
...(flowObj.operator && {operator:flowObj.operator})
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
case "mo":
|
|
123
|
-
tracker.sendOptInFlowEvent("Msisdn to sms")
|
|
124
|
-
return dispatch({
|
|
125
|
-
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
126
|
-
payload:{
|
|
127
|
-
type:"MO",
|
|
128
|
-
result: {
|
|
129
|
-
nextAction:"submitMSISDNAction",
|
|
130
|
-
config:flowObj.flowConfig,
|
|
131
|
-
msisdn,
|
|
132
|
-
rockman_id:flowObj.rockman_id,
|
|
133
|
-
...(flowObj.operator && {operator:flowObj.operator})
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
default:
|
|
138
|
-
tracker.sendOptInFlowEvent("Pin")
|
|
139
|
-
|
|
140
|
-
return dispatch({
|
|
141
|
-
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
142
|
-
payload:{
|
|
143
|
-
type:"PIN",
|
|
144
|
-
result: {
|
|
145
|
-
nextAction:"submitMSISDNAction",
|
|
146
|
-
config:flowObj.flowConfig,
|
|
147
|
-
rockman_id:flowObj.rockman_id,
|
|
148
|
-
...(flowObj.operator && {operator:flowObj.operator})
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
export const pin_mo_redir_ask_mobile_number = (flowObj:IFlow, msisdn:string):AppThunk=>{
|
|
158
|
-
return(dispatch)=>{
|
|
159
|
-
switch (flowObj.flow) {
|
|
160
|
-
case "pin":
|
|
161
|
-
tracker.sendOptInFlowEvent("Pin")
|
|
162
|
-
|
|
163
|
-
dispatch({
|
|
164
|
-
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
165
|
-
payload:{
|
|
166
|
-
type: "IDENTIFY_FLOW_BY_MSISDN",
|
|
167
|
-
result: RDS.Loading(),
|
|
168
|
-
nextData:{
|
|
169
|
-
nextAction:"submitMSISDNAction"
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
})
|
|
173
|
-
return dispatch({
|
|
174
|
-
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
175
|
-
payload:{
|
|
176
|
-
type:"PIN",
|
|
177
|
-
result: {
|
|
178
|
-
nextAction:"submitMSISDNAction",
|
|
179
|
-
config:flowObj.flowConfig,
|
|
180
|
-
msisdn,
|
|
181
|
-
rockman_id:flowObj.rockman_id
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
case "moRedir":
|
|
186
|
-
tracker.sendOptInFlowEvent("Redirect")
|
|
187
|
-
|
|
188
|
-
return dispatch({
|
|
189
|
-
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
190
|
-
payload:{
|
|
191
|
-
type:"MO_REDIR",
|
|
192
|
-
result: {
|
|
193
|
-
nextAction:"submitMSISDNAction",
|
|
194
|
-
config:flowObj.flowConfig,
|
|
195
|
-
msisdn,
|
|
196
|
-
rockman_id:flowObj.rockman_id
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
default:
|
|
201
|
-
tracker.sendOptInFlowEvent("Pin")
|
|
202
|
-
|
|
203
|
-
return dispatch({
|
|
204
|
-
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
205
|
-
payload:{
|
|
206
|
-
type:"PIN",
|
|
207
|
-
result: {
|
|
208
|
-
nextAction:"submitMSISDNAction",
|
|
209
|
-
config:flowObj.flowConfig,
|
|
210
|
-
rockman_id:flowObj.rockman_id
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
export const one_click_mo_pin_detect_operator_by_ip_or_msisdn = (flowObj:IFlow, msisdn:string):AppThunk=>{
|
|
219
|
-
return(dispatch)=>{
|
|
220
|
-
switch (flowObj.flow) {
|
|
221
|
-
case "oneClick":
|
|
222
|
-
tracker.sendOptInFlowEvent("3G click")
|
|
223
|
-
|
|
224
|
-
return dispatch({
|
|
225
|
-
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
226
|
-
payload:{
|
|
227
|
-
type:"ONE_CLICK",
|
|
228
|
-
result: {
|
|
229
|
-
nextAction:"submitMSISDNAction",
|
|
230
|
-
config:flowObj.flowConfig,
|
|
231
|
-
msisdn,
|
|
232
|
-
rockman_id:flowObj.rockman_id
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
case "mo":
|
|
237
|
-
tracker.sendOptInFlowEvent("Msisdn to sms")
|
|
238
|
-
|
|
239
|
-
return dispatch({
|
|
240
|
-
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
241
|
-
payload:{
|
|
242
|
-
type:"MO",
|
|
243
|
-
result: {
|
|
244
|
-
nextAction:"submitMSISDNAction",
|
|
245
|
-
config:flowObj.flowConfig,
|
|
246
|
-
msisdn,
|
|
247
|
-
rockman_id:flowObj.rockman_id
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
default:
|
|
252
|
-
tracker.sendOptInFlowEvent("Pin")
|
|
253
|
-
|
|
254
|
-
return dispatch({
|
|
255
|
-
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
256
|
-
payload:{
|
|
257
|
-
type:"PIN",
|
|
258
|
-
result: {
|
|
259
|
-
nextAction:"submitMSISDNAction",
|
|
260
|
-
config:flowObj.flowConfig,
|
|
261
|
-
rockman_id:flowObj.rockman_id
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
// const pinMoRedirAskMobileNumber = (flowObj:IFlow)=>{
|
|
273
|
-
// switch (flowObj.flow) {
|
|
274
|
-
// case "pin":
|
|
275
|
-
// self.setState({
|
|
276
|
-
// currentState: {type: "PIN", result: pinFlow(tracker, flowObj, msisdn, extraParams) } as State,
|
|
277
|
-
// })
|
|
278
|
-
// tracker.advancedInFlow('tallyman/v1', 'pin-flow',{msisdn})
|
|
279
|
-
// break;
|
|
280
|
-
// case "moRedir":
|
|
281
|
-
// self.setState({
|
|
282
|
-
// currentState: {type: "MOREDIR", result: moRedirFlow(tracker, flowObj, msisdn, bupperNumber) } as State,
|
|
283
|
-
// })
|
|
284
|
-
// tracker.advancedInFlow('tallyman/v1', 'moRedir-flow',{msisdn})
|
|
285
|
-
// break;
|
|
286
|
-
// default:
|
|
287
|
-
// self.setState({
|
|
288
|
-
// currentState: {type: flowObj.default.flow.toUpperCase(), result: pinFlow(tracker, flowObj.default, msisdn, extraParams) } as State,
|
|
289
|
-
// })
|
|
290
|
-
// tracker.advancedInFlow('tallyman/v1', 'pin-flow',{msisdn})
|
|
291
|
-
// break;
|
|
292
|
-
// }
|
|
293
|
-
// }
|
|
294
|
-
|
|
295
|
-
// const pinClick2SmsAskMobileNumber = (flowObj:IFlow)=>{
|
|
296
|
-
// switch (flowObj.flow) {
|
|
297
|
-
// case "pin":
|
|
298
|
-
// self.setState({
|
|
299
|
-
// currentState: {type: "PIN", result: pinFlow(tracker, flowObj, msisdn, extraParams) } as State,
|
|
300
|
-
// })
|
|
301
|
-
// tracker.advancedInFlow('tallyman/v1', 'pin-flow',{msisdn})
|
|
302
|
-
// break;
|
|
303
|
-
// case "click2sms":
|
|
304
|
-
// self.setState({
|
|
305
|
-
// currentState: {type: "CLICK2SMS", result: click2smsFlow(tracker, flowObj) } as State,
|
|
306
|
-
// })
|
|
307
|
-
// tracker.advancedInFlow('tallyman/v1', 'click2sms-flow',{msisdn})
|
|
308
|
-
// break;
|
|
309
|
-
// default:
|
|
310
|
-
// self.setState({
|
|
311
|
-
// currentState: {type: flowObj.default.flow.toUpperCase(), result: pinFlow(tracker, flowObj.default, msisdn, extraParams) } as State,
|
|
312
|
-
// })
|
|
313
|
-
// tracker.advancedInFlow('tallyman/v1', 'pin-flow',{msisdn})
|
|
314
|
-
// break;
|
|
315
|
-
// }
|
|
316
|
-
// }
|