ouisys-engine 3.0.3 → 3.0.5

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 (195) hide show
  1. package/.babelrc +4 -8
  2. package/.eslintrc.js +1 -1
  3. package/.husky/pre-commit +4 -0
  4. package/.nvmrc +1 -1
  5. package/.prettierignore +2 -1
  6. package/.vscode/settings.json +1 -1
  7. package/README.md +2 -4
  8. package/dist/api/index.d.ts +5 -5
  9. package/dist/api/index.js +76 -76
  10. package/dist/common-types/AppThunk.d.ts +11 -12
  11. package/dist/common-types/IOptInFlowName.d.ts +1 -1
  12. package/dist/common-types/ITracker.js +1 -2
  13. package/dist/common-types/RemoteDataState.d.ts +4 -4
  14. package/dist/common-types/RemoteDataState.js +17 -17
  15. package/dist/flows/click2smsFlow.d.ts +2 -2
  16. package/dist/flows/moFlow.d.ts +2 -2
  17. package/dist/flows/moRedirFlow.d.ts +2 -2
  18. package/dist/flows/oneClickFlow.d.ts +2 -2
  19. package/dist/flows/pinFlow.d.ts +2 -2
  20. package/dist/flows/pinFlow.js +2 -0
  21. package/dist/flows/strategy.d.ts +8 -8
  22. package/dist/flows/ussdFlow.d.ts +2 -2
  23. package/dist/ips/tryGetIPRangeName.d.ts +1 -1
  24. package/dist/ips/tryGetIPRangeName.js +7 -5
  25. package/dist/jest.config.js +1 -1
  26. package/dist/pacman/index.d.ts +2 -2
  27. package/dist/pacman/index.js +41 -41
  28. package/dist/pacman/queryString.js +11 -9
  29. package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +19 -19
  30. package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +1 -1
  31. package/dist/reducers/click2smsFlow/index.d.ts +2 -2
  32. package/dist/reducers/click2smsFlow/index.js +24 -24
  33. package/dist/reducers/click2smsFlow/utils.d.ts +1 -1
  34. package/dist/reducers/click2smsFlow/utils.js +30 -30
  35. package/dist/reducers/moFlow/IMoConstants.d.ts +1 -1
  36. package/dist/reducers/moFlow/MoTypes.d.ts +13 -13
  37. package/dist/reducers/moFlow/index.d.ts +3 -3
  38. package/dist/reducers/moFlow/index.js +27 -27
  39. package/dist/reducers/moFlow/utils.d.ts +1 -2
  40. package/dist/reducers/moFlow/utils.js +28 -26
  41. package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +1 -1
  42. package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +13 -13
  43. package/dist/reducers/moRedirFlow/index.d.ts +3 -3
  44. package/dist/reducers/moRedirFlow/index.js +27 -27
  45. package/dist/reducers/moRedirFlow/utils.d.ts +1 -1
  46. package/dist/reducers/moRedirFlow/utils.js +17 -17
  47. package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +1 -1
  48. package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +10 -10
  49. package/dist/reducers/oneClickFlow/index.d.ts +3 -3
  50. package/dist/reducers/oneClickFlow/index.js +75 -68
  51. package/dist/reducers/oneClickFlow/utils.d.ts +2 -2
  52. package/dist/reducers/oneClickFlow/utils.js +38 -38
  53. package/dist/reducers/pinFlow/IPinConstants.d.ts +1 -1
  54. package/dist/reducers/pinFlow/PinTypes.d.ts +23 -23
  55. package/dist/reducers/pinFlow/index.d.ts +3 -3
  56. package/dist/reducers/pinFlow/index.js +76 -76
  57. package/dist/reducers/pinFlow/utils.d.ts +1 -1
  58. package/dist/reducers/pinFlow/utils.js +61 -65
  59. package/dist/reducers/strategy/IStategyActionContants.d.ts +1 -1
  60. package/dist/reducers/strategy/StrategyTypes.d.ts +56 -56
  61. package/dist/reducers/strategy/index.d.ts +2 -2
  62. package/dist/reducers/strategy/index.js +99 -99
  63. package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +2 -2
  64. package/dist/reducers/strategy/strategies/ask_mobile_number.js +78 -78
  65. package/dist/reducers/strategy/strategies/ask_operator.d.ts +2 -2
  66. package/dist/reducers/strategy/strategies/ask_operator.js +64 -68
  67. package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +2 -2
  68. package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +97 -97
  69. package/dist/reducers/strategy/strategies/header_enrichment.d.ts +2 -2
  70. package/dist/reducers/strategy/strategies/header_enrichment.js +116 -120
  71. package/dist/reducers/strategy/utils.d.ts +3 -3
  72. package/dist/reducers/strategy/utils.js +115 -111
  73. package/dist/reducers/ussdFlow/IUssdConstants.d.ts +1 -1
  74. package/dist/reducers/ussdFlow/UssdTypes.d.ts +13 -13
  75. package/dist/reducers/ussdFlow/index.d.ts +3 -3
  76. package/dist/reducers/ussdFlow/index.js +27 -27
  77. package/dist/reducers/ussdFlow/utils.d.ts +1 -2
  78. package/dist/reducers/ussdFlow/utils.js +19 -17
  79. package/dist/store/index.d.ts +8 -8
  80. package/dist/store/index.js +87 -83
  81. package/dist/store/reducers.d.ts +7 -7
  82. package/dist/store/reducers.js +4 -4
  83. package/dist/utilities/handleSubmitNumber.d.ts +7 -3
  84. package/dist/utilities/handleSubmitNumber.js +15 -18
  85. package/dist/utilities/index.d.ts +1 -1
  86. package/dist/utilities/index.js +13 -11
  87. package/dist/utilities/loadScriptInnerHtml.js +0 -1
  88. package/index.html +21 -28
  89. package/mockData/config.json +1 -1
  90. package/package.json +23 -15
  91. package/setupJest.js +1 -1
  92. package/tsconfig.json +2 -2
  93. package/dist/api/click2sms.js +0 -357
  94. package/dist/api/mo.js +0 -274
  95. package/dist/api/moRedir.js +0 -186
  96. package/dist/api/oneClick.js +0 -366
  97. package/dist/api/pin.js +0 -493
  98. package/dist/api/strategies.js +0 -704
  99. package/dist/api/ussd.js +0 -1
  100. package/dist/app/store.js +0 -35
  101. package/dist/features/strategies/categories/askMobileNumber.js +0 -395
  102. package/dist/features/strategies/categories/askOperator.js +0 -311
  103. package/dist/features/strategies/categories/detectOperatorByIp.js +0 -606
  104. package/dist/features/strategies/categories/headerEnrichment.js +0 -670
  105. package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +0 -12
  106. package/dist/features/strategies/categories/typings/identifySliceTypes.js +0 -22
  107. package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +0 -22
  108. package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +0 -21
  109. package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +0 -13
  110. package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +0 -13
  111. package/dist/features/strategies/click2smsFlowSlice.js +0 -172
  112. package/dist/features/strategies/identifySlice.js +0 -455
  113. package/dist/features/strategies/moFlowSlice.js +0 -196
  114. package/dist/features/strategies/moRedirFlowSlice.js +0 -190
  115. package/dist/features/strategies/oneClickFlowSlice.js +0 -277
  116. package/dist/features/strategies/pinFlowSlice.js +0 -313
  117. package/dist/features/strategies/ussdFlowSlice.js +0 -1
  118. package/dist/flows/tpayHeFlow.d.ts +0 -7
  119. package/dist/flows/tpayHeFlow.js +0 -23
  120. package/dist/mockServer/browser.js +0 -48
  121. package/dist/mockServer/handlers.js +0 -22
  122. package/dist/mockServer/server.js +0 -48
  123. package/dist/reducers/tpayHeFlow/ITpayHeConstants.d.ts +0 -2
  124. package/dist/reducers/tpayHeFlow/ITpayHeConstants.js +0 -1
  125. package/dist/reducers/tpayHeFlow/TpayHeTypes.d.ts +0 -114
  126. package/dist/reducers/tpayHeFlow/TpayHeTypes.js +0 -1
  127. package/dist/reducers/tpayHeFlow/index.d.ts +0 -7
  128. package/dist/reducers/tpayHeFlow/index.js +0 -331
  129. package/dist/reducers/tpayHeFlow/utils.d.ts +0 -20
  130. package/dist/reducers/tpayHeFlow/utils.js +0 -510
  131. package/dist/test/setup.js +0 -24
  132. package/dist/test/test-utils.js +0 -51
  133. package/prettier.config.js +0 -7
  134. package/src/@types/react-tracker.d.ts +0 -16
  135. package/src/@types/redux-cli-logger.d.ts +0 -1
  136. package/src/@types/tiny-async-pool.d.ts +0 -3
  137. package/src/@types/window.d.ts +0 -74
  138. package/src/api/index.ts +0 -225
  139. package/src/common-types/AppThunk.ts +0 -19
  140. package/src/common-types/Either.ts +0 -3
  141. package/src/common-types/IError.ts +0 -5
  142. package/src/common-types/IOptInFlowName.ts +0 -1
  143. package/src/common-types/ITracker.ts +0 -10
  144. package/src/common-types/IVisitor.ts +0 -16
  145. package/src/common-types/RemoteDataState.ts +0 -88
  146. package/src/flows/click2smsFlow.ts +0 -18
  147. package/src/flows/moFlow.ts +0 -20
  148. package/src/flows/moRedirFlow.ts +0 -20
  149. package/src/flows/oneClickFlow.ts +0 -20
  150. package/src/flows/pinFlow.ts +0 -25
  151. package/src/flows/strategy.ts +0 -51
  152. package/src/flows/ussdFlow.ts +0 -20
  153. package/src/index.ts +0 -3
  154. package/src/ips/tryGetIPRangeName.ts +0 -22
  155. package/src/jest.config.js +0 -194
  156. package/src/pacman/index.ts +0 -71
  157. package/src/pacman/queryString.ts +0 -24
  158. package/src/reducers/click2smsFlow/Click2smsTypes.ts +0 -93
  159. package/src/reducers/click2smsFlow/IClick2smsConstants.ts +0 -4
  160. package/src/reducers/click2smsFlow/index.ts +0 -105
  161. package/src/reducers/click2smsFlow/utils.ts +0 -126
  162. package/src/reducers/moFlow/IMoConstants.ts +0 -7
  163. package/src/reducers/moFlow/MoTypes.ts +0 -125
  164. package/src/reducers/moFlow/index.ts +0 -150
  165. package/src/reducers/moFlow/utils.ts +0 -135
  166. package/src/reducers/moRedirFlow/IMoRedirConstants.ts +0 -7
  167. package/src/reducers/moRedirFlow/MoRedirTypes.ts +0 -99
  168. package/src/reducers/moRedirFlow/index.ts +0 -137
  169. package/src/reducers/moRedirFlow/utils.ts +0 -78
  170. package/src/reducers/oneClickFlow/IOneClickConstants.ts +0 -3
  171. package/src/reducers/oneClickFlow/OneClickTypes.ts +0 -108
  172. package/src/reducers/oneClickFlow/index.ts +0 -268
  173. package/src/reducers/oneClickFlow/utils.ts +0 -219
  174. package/src/reducers/pinFlow/IPinConstants.ts +0 -9
  175. package/src/reducers/pinFlow/PinTypes.ts +0 -190
  176. package/src/reducers/pinFlow/index.ts +0 -331
  177. package/src/reducers/pinFlow/utils.ts +0 -232
  178. package/src/reducers/strategy/IStategyActionContants.ts +0 -17
  179. package/src/reducers/strategy/StrategyTypes.ts +0 -376
  180. package/src/reducers/strategy/index.ts +0 -322
  181. package/src/reducers/strategy/strategies/ask_mobile_number.ts +0 -366
  182. package/src/reducers/strategy/strategies/ask_operator.ts +0 -195
  183. package/src/reducers/strategy/strategies/detect_operator_by_ip.ts +0 -414
  184. package/src/reducers/strategy/strategies/header_enrichment.ts +0 -489
  185. package/src/reducers/strategy/utils.ts +0 -357
  186. package/src/reducers/ussdFlow/IUssdConstants.ts +0 -7
  187. package/src/reducers/ussdFlow/UssdTypes.ts +0 -112
  188. package/src/reducers/ussdFlow/index.ts +0 -146
  189. package/src/reducers/ussdFlow/utils.ts +0 -88
  190. package/src/store/index.ts +0 -150
  191. package/src/store/reducers.ts +0 -37
  192. package/src/utilities/handleSubmitNumber.ts +0 -65
  193. package/src/utilities/index.ts +0 -114
  194. package/src/utilities/loadScriptInnerHtml.ts +0 -14
  195. package/src/utilities/loadScriptSrc.ts +0 -26
@@ -1,195 +0,0 @@
1
- import * as RDS from "../../../common-types/RemoteDataState";
2
-
3
- import { getOperators, determineFlowByOperator, identifyUser, getConfig } from "../utils";
4
- import { AppThunk } from "../../../common-types/AppThunk";
5
- import {
6
- IFlow
7
- } from "../StrategyTypes";
8
- import { tracker } from "..";
9
-
10
- export default function ask_operator():AppThunk {
11
- return async(dispatch)=>{
12
- try{
13
- const operators = getOperators();
14
- dispatch({
15
- type:"IDENTIFY_FLOW_BY_OPERATOR_SELECT",
16
- payload:{
17
- type:"IDENTIFY_FLOW_BY_OPERATOR_SELECT",
18
- result:{operators, nextAction:"selectOperator"}
19
- }
20
- })
21
- }catch(err){
22
- dispatch({
23
- type:"IDENTIFY_FLOW_BY_OPERATOR_SELECT",
24
- payload:{
25
- type:"IDENTIFY_FLOW_BY_OPERATOR_SELECT",
26
- result:RDS.Failure(err)
27
- }
28
- });
29
- }
30
- }
31
- }
32
-
33
-
34
- export const he_pin_one_click_ask_operator = (flowObj:IFlow):AppThunk=>{
35
- return async(dispatch)=>{
36
- try{
37
-
38
- dispatch({
39
- type:"OPERATOR_SELECT",
40
- payload:{
41
- type: "PIN",
42
- result: RDS.Loading()
43
- }
44
- });
45
- const heResult = await identifyUser();
46
-
47
- if(heResult.msisdn !== undefined && heResult.msisdn !== ""){
48
-
49
- const msisdn = heResult.msisdn;
50
- const operator = heResult.operator;
51
- tracker.sendOptInFlowEvent("Hybrid Pin")
52
-
53
- return dispatch({
54
- type:"OPERATOR_SELECT",
55
- payload:{
56
- type:"PIN",
57
- result: {
58
- nextAction:"submitMSISDNAction",
59
- config:flowObj.flowConfig,
60
- msisdn,
61
- rockman_id:flowObj.rockman_id,
62
- isHeaderEnrichmentSuccess:true
63
- }
64
- }
65
- });
66
- }else{
67
- tracker.sendOptInFlowEvent("Pin")
68
-
69
- return dispatch({
70
- type:"OPERATOR_SELECT",
71
- payload:{
72
- type:"PIN",
73
- result: {
74
- nextAction:"submitMSISDNAction",
75
- config:flowObj.flowConfig,
76
- }
77
- }
78
- });
79
- }
80
- }catch(err){
81
- console.warn(err)
82
- tracker.sendOptInFlowEvent("Pin")
83
-
84
- dispatch({
85
- type:"OPERATOR_SELECT",
86
- payload:{
87
- type:"PIN",
88
- result: {
89
- nextAction:"submitMSISDNAction",
90
- config:flowObj.flowConfig,
91
- }
92
- }
93
- });
94
- }
95
- }
96
- }
97
-
98
- export function selectOperator(operator:string):AppThunk{
99
-
100
- return (dispatch)=>{
101
- try {
102
- const flowObj = determineFlowByOperator(operator);
103
- const { strategy, strategyConfigs } = getConfig();
104
- switch (flowObj.flow) {
105
- case "pin":
106
-
107
- if(strategy === "he-pin-one-click-ask-operator"){
108
- return dispatch(he_pin_one_click_ask_operator(flowObj))
109
- }else{
110
- tracker.sendOptInFlowEvent("Pin")
111
-
112
- return dispatch({
113
- type:"OPERATOR_SELECT",
114
- payload:{
115
- type:"PIN",
116
- result: {
117
- nextAction:"submitMSISDNAction",
118
- config:flowObj.flowConfig,
119
- operator
120
- }
121
- }
122
- });
123
- }
124
- case "mo":
125
- tracker.sendOptInFlowEvent("Msisdn to sms")
126
-
127
- return dispatch({
128
- type:"OPERATOR_SELECT",
129
- payload:{
130
- type:"MO",
131
- result: {
132
- nextAction:"submitMSISDNAction",
133
- config:flowObj.flowConfig,
134
- operator
135
- }
136
- }
137
- });
138
- case "click2sms":
139
- tracker.sendOptInFlowEvent("Click to sms")
140
-
141
- return dispatch({
142
- type:"OPERATOR_SELECT",
143
- payload:{
144
- type:"CLICK2SMS",
145
- result: {
146
- nextAction:"loadOc2sms",
147
- config:{
148
- operators:[operator],
149
- ...flowObj.flowConfig
150
- },
151
- operator
152
- }
153
- }
154
- });
155
- case "oneClick":
156
- tracker.sendOptInFlowEvent("3G click")
157
-
158
- return dispatch({
159
- type:"OPERATOR_SELECT",
160
- payload:{
161
- type:"ONE_CLICK",
162
- result: {
163
- nextAction:"getRedirectUrlAction",
164
- config:flowObj.flowConfig,
165
- operator:operator,
166
- autoRedirect:true
167
- }
168
- }
169
- });
170
- default:
171
- tracker.sendOptInFlowEvent("Pin")
172
-
173
- return dispatch({
174
- type:"OPERATOR_SELECT",
175
- payload:{
176
- type: "PIN",
177
- result: RDS.NothingYet()
178
- }
179
- });
180
- }
181
- }catch(ex) {
182
- tracker.sendOptInFlowEvent("Pin")
183
-
184
- console.log(ex)
185
- dispatch({
186
- type:"OPERATOR_SELECT",
187
- payload:{
188
- type: "PIN",
189
- result: RDS.NothingYet(),
190
- }
191
- })
192
- }
193
- }
194
- }
195
-
@@ -1,414 +0,0 @@
1
- import * as RDS from "../../../common-types/RemoteDataState";
2
-
3
- import {getConfig, determineFlowByOperatorFromIp } from "../utils";
4
- import { AppThunk } from "../../../common-types/AppThunk";
5
- import {
6
- IFlow
7
- } from "../StrategyTypes";
8
- import ask_mobile_number from "./ask_mobile_number";
9
- import { tracker } from "..";
10
-
11
- export default function detect_operator_by_ip():AppThunk {
12
- return (dispatch)=>{
13
- try{
14
- dispatch({
15
- type:"DETECT_OPERATOR_BY_IP",
16
- payload:{
17
- type:"DETECT_OPERATOR_BY_IP",
18
- result:RDS.Loading()
19
- }
20
- });
21
-
22
- const { strategy, strategyConfigs } = getConfig();
23
- const defaultFlow = strategyConfigs.default
24
-
25
- switch (strategy) {
26
- case "pin-one-click-detect-operator-by-ip":
27
- return dispatch(pin_one_click_detect_operator_by_ip(defaultFlow))
28
- case "one-click-mo-pin-detect-operator-by-ip-or-msisdn":
29
- return dispatch(one_click_mo_pin_detect_operator_by_ip_or_msisdn(defaultFlow))
30
- case "mo-redir-one-click-detect-operator-by-ip":
31
- return dispatch(mo_redir_one_click_detect_operator_by_ip(defaultFlow))
32
- case "mo-one-click-detect-operator-by-ip":
33
- return dispatch(mo_one_click_detect_operator_by_ip(defaultFlow))
34
- case "click2sms-one-click-detect-operator-by-ip":
35
- return dispatch(click2sms_one_click_detect_operator_by_ip(defaultFlow))
36
- case "pin-mo-detect-operator-by-ip":
37
- return dispatch(pin_mo_detect_operator_by_ip(defaultFlow))
38
- }
39
- }catch(err){
40
- dispatch({
41
- type:"DETECT_OPERATOR_BY_IP",
42
- payload:{
43
- type:"DETECT_OPERATOR_BY_IP",
44
- result:RDS.Failure(err)
45
- }
46
- });
47
- }
48
- }
49
- }
50
-
51
-
52
- export const pin_mo_detect_operator_by_ip = (defaultFlow:IFlow):AppThunk=>{
53
- return async(dispatch)=>{
54
- try{
55
- const flowObj = await determineFlowByOperatorFromIp()
56
- switch (flowObj.flow) {
57
- case "mo":
58
- tracker.sendOptInFlowEvent("Msisdn to sms")
59
-
60
- return dispatch({
61
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
62
- payload:{
63
- type:"MO",
64
- result: {
65
- nextAction:"submitMSISDNAction",
66
- config:flowObj.flowConfig,
67
- operator:flowObj.operator
68
- }
69
- }
70
- });
71
- case "pin":
72
- return dispatch({
73
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
74
- payload:{
75
- type:"PIN",
76
- result: {
77
- nextAction:"submitMSISDNAction",
78
- config:flowObj.flowConfig,
79
- }
80
- }
81
- });
82
- default:
83
- tracker.sendOptInFlowEvent("Msisdn to sms")
84
-
85
- return dispatch({
86
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
87
- payload:{
88
- type:defaultFlow.flow.toUpperCase(),
89
- result: {
90
- nextAction:"submitMSISDNAction",
91
- config:defaultFlow.flowConfig,
92
- }
93
- }
94
- });
95
- }
96
- }catch(err){
97
- console.warn(err)
98
- tracker.sendOptInFlowEvent("Msisdn to sms")
99
-
100
- dispatch({
101
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
102
- payload:{
103
- type:defaultFlow.flow.toUpperCase(),
104
- result: {
105
- nextAction:"submitMSISDNAction",
106
- config:defaultFlow.flowConfig,
107
- }
108
- }
109
- });
110
- }
111
- }
112
- }
113
-
114
- export const mo_one_click_detect_operator_by_ip = (defaultFlow:IFlow):AppThunk=>{
115
- return async(dispatch)=>{
116
- try{
117
- const flowObj = await determineFlowByOperatorFromIp()
118
- switch (flowObj.flow) {
119
- case "mo":
120
- tracker.sendOptInFlowEvent("Msisdn to sms")
121
-
122
- return dispatch({
123
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
124
- payload:{
125
- type:"MO",
126
- result: {
127
- nextAction:"submitMSISDNAction",
128
- config:flowObj.flowConfig,
129
- operator:flowObj.operator
130
- }
131
- }
132
- });
133
- case "oneClick":
134
- tracker.sendOptInFlowEvent("3G click")
135
-
136
- return dispatch({
137
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
138
- payload:{
139
- type:"ONE_CLICK",
140
- result: {
141
- nextAction:"getRedirectUrlAction",
142
- config:flowObj.flowConfig,
143
- operator:flowObj.operator
144
- }
145
- }
146
- });
147
- default:
148
- tracker.sendOptInFlowEvent("Msisdn to sms")
149
-
150
- return dispatch({
151
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
152
- payload:{
153
- type:"MO",
154
- result: {
155
- nextAction:"submitMSISDNAction",
156
- config:defaultFlow.flowConfig,
157
- }
158
- }
159
- });
160
- }
161
- }catch(err){
162
- console.warn(err)
163
- tracker.sendOptInFlowEvent("Msisdn to sms")
164
-
165
- dispatch({
166
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
167
- payload:{
168
- type:"MO",
169
- result: {
170
- nextAction:"submitMSISDNAction",
171
- config:defaultFlow.flowConfig,
172
- }
173
- }
174
- });
175
- }
176
- }
177
- }
178
-
179
- export const click2sms_one_click_detect_operator_by_ip = (defaultFlow:IFlow):AppThunk=>{
180
- return async(dispatch)=>{
181
- try{
182
- const flowObj = await determineFlowByOperatorFromIp()
183
-
184
- switch (flowObj.flow) {
185
- case "click2sms":
186
- tracker.sendOptInFlowEvent("Click to sms")
187
-
188
- return dispatch({
189
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
190
- payload:{
191
- type:"CLICK2SMS",
192
- result: {
193
- nextAction:"loadOc2sms",
194
- config:{operators:[flowObj.operator],...flowObj.flowConfig},
195
- operator:flowObj.operator
196
- }
197
- }
198
- });
199
- case "oneClick":
200
- tracker.sendOptInFlowEvent("3G click")
201
-
202
- return dispatch({
203
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
204
- payload:{
205
- type:"ONE_CLICK",
206
- result: {
207
- nextAction:"getRedirectUrlAction",
208
- config:flowObj.flowConfig,
209
- operator:flowObj.operator
210
- }
211
- }
212
- });
213
- default:
214
- tracker.sendOptInFlowEvent("Click to sms")
215
-
216
- return dispatch({
217
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
218
- payload:{
219
- type:"CLICK2SMS",
220
- result: {
221
- nextAction:"loadOc2sms",
222
- config:defaultFlow.flowConfig
223
- }
224
- }
225
- });
226
- }
227
- }catch(err){
228
- console.warn(err)
229
- tracker.sendOptInFlowEvent("Click to sms")
230
-
231
- dispatch({
232
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
233
- payload:{
234
- type:"CLICK2SMS",
235
- result: {
236
- nextAction:"loadOc2sms",
237
- config:defaultFlow.flowConfig,
238
- }
239
- }
240
- });
241
- }
242
- }
243
- }
244
-
245
-
246
-
247
- export const pin_one_click_detect_operator_by_ip = (defaultFlow:IFlow):AppThunk=>{
248
- return async(dispatch)=>{
249
- try{
250
- const flowObj = await determineFlowByOperatorFromIp()
251
-
252
- switch (flowObj.flow) {
253
- case "pin":
254
- return dispatch({
255
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
256
- payload:{
257
- type:"PIN",
258
- result: {
259
- nextAction:"submitMSISDNAction",
260
- config:flowObj.flowConfig,
261
- }
262
- }
263
- });
264
- case "oneClick":
265
- return dispatch({
266
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
267
- payload:{
268
- type:"ONE_CLICK",
269
- result: {
270
- nextAction:"getRedirectUrlAction",
271
- config:flowObj.flowConfig,
272
- operator:flowObj.operator
273
- }
274
- }
275
- });
276
- default:
277
-
278
- return dispatch({
279
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
280
- payload:{
281
- type:"PIN",
282
- result: {
283
- nextAction:"submitMSISDNAction",
284
- config:defaultFlow.flowConfig,
285
- }
286
- }
287
- });
288
- }
289
- }catch(err){
290
- console.warn(err)
291
-
292
- console.log("defaultFlow",defaultFlow)
293
- dispatch({
294
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
295
- payload:{
296
- type:"PIN",
297
- result: {
298
- nextAction:"submitMSISDNAction",
299
- config:defaultFlow.flowConfig,
300
- }
301
- }
302
- });
303
- }
304
- }
305
- }
306
-
307
- export const one_click_mo_pin_detect_operator_by_ip_or_msisdn = (defaultFlow:IFlow):AppThunk=>{
308
- return async(dispatch)=>{
309
- try{
310
- const flowObj = await determineFlowByOperatorFromIp()
311
- switch (flowObj.flow) {
312
- case "pin":
313
- return dispatch({
314
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
315
- payload:{
316
- type:"PIN",
317
- result: {
318
- nextAction:"submitMSISDNAction",
319
- config:flowObj.flowConfig,
320
- operator:flowObj.operator
321
- }
322
- }
323
- });
324
- case "oneClick":
325
- return dispatch({
326
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
327
- payload:{
328
- type:"MO_REDIR",
329
- result: {
330
- nextAction:"submitMSISDNAction",
331
- config:flowObj.flowConfig,
332
- operator:flowObj.operator
333
- }
334
- }
335
- });
336
- default:
337
- return dispatch({
338
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
339
- payload:{
340
- type:"PIN",
341
- result: {
342
- nextAction:"submitMSISDNAction",
343
- config:flowObj.flowConfig,
344
- }
345
- }
346
- });
347
- }
348
- }catch(err){
349
- console.warn(err)
350
- dispatch(ask_mobile_number())
351
- }
352
- }
353
- }
354
-
355
- export const mo_redir_one_click_detect_operator_by_ip = (defaultFlow:IFlow):AppThunk=>{
356
- return async(dispatch)=>{
357
- try{
358
- const flowObj = await determineFlowByOperatorFromIp();
359
-
360
- switch (flowObj.flow) {
361
- case "moRedir":
362
- return dispatch({
363
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
364
- payload:{
365
- type:"MO_REDIR",
366
- result: {
367
- nextAction:"submitMSISDNAction",
368
- config:flowObj.flowConfig,
369
- operator:flowObj.operator
370
- }
371
- }
372
- });
373
- case "oneClick":
374
- return dispatch({
375
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
376
- payload:{
377
- type:"ONE_CLICK",
378
- result: {
379
- nextAction:"getRedirectUrlAction",
380
- config:flowObj.flowConfig,
381
- operator:flowObj.operator
382
- }
383
- }
384
- });
385
- default:
386
- return dispatch({
387
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
388
- payload:{
389
- type:"MO_REDIR",
390
- result: {
391
- nextAction:"submitMSISDNAction",
392
- config:defaultFlow.flowConfig
393
- }
394
- }
395
- });
396
- }
397
- }catch(err){
398
- console.warn(err)
399
- // console.log("defaul", defaultFlow.flowConfig)
400
-
401
- return dispatch({
402
- type:"IDENTIFY_FLOW_BY_IP_OPERATOR",
403
- payload:{
404
- type:"MO_REDIR",
405
- result: {
406
- nextAction:"submitMSISDNAction",
407
- config:defaultFlow.flowConfig
408
- }
409
- }
410
- });
411
- }
412
- }
413
- }
414
-