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.
Files changed (198) hide show
  1. package/.babelrc +4 -8
  2. package/.eslintrc.js +1 -1
  3. package/.nvmrc +1 -1
  4. package/.prettierignore +2 -1
  5. package/README.md +2 -4
  6. package/dist/api/index.d.ts +5 -5
  7. package/dist/api/index.js +76 -76
  8. package/dist/common-types/AppThunk.d.ts +11 -12
  9. package/dist/common-types/IOptInFlowName.d.ts +1 -1
  10. package/dist/common-types/ITracker.js +1 -2
  11. package/dist/common-types/RemoteDataState.d.ts +4 -4
  12. package/dist/common-types/RemoteDataState.js +17 -17
  13. package/dist/flows/click2smsFlow.d.ts +2 -2
  14. package/dist/flows/moFlow.d.ts +2 -2
  15. package/dist/flows/moRedirFlow.d.ts +2 -2
  16. package/dist/flows/oneClickFlow.d.ts +2 -2
  17. package/dist/flows/pinFlow.d.ts +2 -2
  18. package/dist/flows/pinFlow.js +2 -0
  19. package/dist/flows/strategy.d.ts +8 -8
  20. package/dist/flows/ussdFlow.d.ts +2 -2
  21. package/dist/ips/tryGetIPRangeName.d.ts +1 -1
  22. package/dist/ips/tryGetIPRangeName.js +7 -5
  23. package/dist/jest.config.js +1 -1
  24. package/dist/pacman/index.d.ts +2 -2
  25. package/dist/pacman/index.js +41 -41
  26. package/dist/pacman/queryString.js +11 -9
  27. package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +19 -19
  28. package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +1 -1
  29. package/dist/reducers/click2smsFlow/index.d.ts +2 -2
  30. package/dist/reducers/click2smsFlow/index.js +24 -24
  31. package/dist/reducers/click2smsFlow/utils.d.ts +1 -1
  32. package/dist/reducers/click2smsFlow/utils.js +30 -30
  33. package/dist/reducers/moFlow/IMoConstants.d.ts +1 -1
  34. package/dist/reducers/moFlow/MoTypes.d.ts +13 -13
  35. package/dist/reducers/moFlow/index.d.ts +3 -3
  36. package/dist/reducers/moFlow/index.js +27 -27
  37. package/dist/reducers/moFlow/utils.d.ts +1 -2
  38. package/dist/reducers/moFlow/utils.js +28 -26
  39. package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +1 -1
  40. package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +13 -13
  41. package/dist/reducers/moRedirFlow/index.d.ts +3 -3
  42. package/dist/reducers/moRedirFlow/index.js +27 -27
  43. package/dist/reducers/moRedirFlow/utils.d.ts +1 -1
  44. package/dist/reducers/moRedirFlow/utils.js +17 -17
  45. package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +1 -1
  46. package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +10 -10
  47. package/dist/reducers/oneClickFlow/index.d.ts +3 -3
  48. package/dist/reducers/oneClickFlow/index.js +75 -68
  49. package/dist/reducers/oneClickFlow/utils.d.ts +2 -2
  50. package/dist/reducers/oneClickFlow/utils.js +70 -69
  51. package/dist/reducers/pinFlow/IPinConstants.d.ts +1 -1
  52. package/dist/reducers/pinFlow/PinTypes.d.ts +23 -23
  53. package/dist/reducers/pinFlow/index.d.ts +3 -3
  54. package/dist/reducers/pinFlow/index.js +76 -76
  55. package/dist/reducers/pinFlow/utils.d.ts +1 -1
  56. package/dist/reducers/pinFlow/utils.js +61 -65
  57. package/dist/reducers/strategy/IStategyActionContants.d.ts +1 -1
  58. package/dist/reducers/strategy/StrategyTypes.d.ts +56 -56
  59. package/dist/reducers/strategy/index.d.ts +2 -2
  60. package/dist/reducers/strategy/index.js +99 -99
  61. package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +3 -2
  62. package/dist/reducers/strategy/strategies/ask_mobile_number.js +132 -74
  63. package/dist/reducers/strategy/strategies/ask_operator.d.ts +2 -2
  64. package/dist/reducers/strategy/strategies/ask_operator.js +64 -68
  65. package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +2 -2
  66. package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +97 -97
  67. package/dist/reducers/strategy/strategies/header_enrichment.d.ts +2 -2
  68. package/dist/reducers/strategy/strategies/header_enrichment.js +116 -120
  69. package/dist/reducers/strategy/utils.d.ts +3 -3
  70. package/dist/reducers/strategy/utils.js +115 -111
  71. package/dist/reducers/ussdFlow/IUssdConstants.d.ts +1 -1
  72. package/dist/reducers/ussdFlow/UssdTypes.d.ts +13 -13
  73. package/dist/reducers/ussdFlow/index.d.ts +3 -3
  74. package/dist/reducers/ussdFlow/index.js +27 -27
  75. package/dist/reducers/ussdFlow/utils.d.ts +1 -2
  76. package/dist/reducers/ussdFlow/utils.js +19 -17
  77. package/dist/store/index.d.ts +8 -8
  78. package/dist/store/index.js +87 -83
  79. package/dist/store/reducers.d.ts +7 -7
  80. package/dist/store/reducers.js +4 -4
  81. package/dist/utilities/handleSubmitNumber.d.ts +7 -3
  82. package/dist/utilities/handleSubmitNumber.js +15 -18
  83. package/dist/utilities/index.d.ts +1 -1
  84. package/dist/utilities/index.js +13 -11
  85. package/dist/utilities/loadScriptInnerHtml.js +0 -1
  86. package/index.html +21 -28
  87. package/package.json +23 -15
  88. package/setupJest.js +1 -1
  89. package/tsconfig.json +2 -2
  90. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  91. package/.idea/modules.xml +0 -8
  92. package/.idea/ouisys-engine.iml +0 -12
  93. package/.idea/vcs.xml +0 -6
  94. package/.vscode/settings.json +0 -6
  95. package/dist/api/click2sms.js +0 -357
  96. package/dist/api/mo.js +0 -274
  97. package/dist/api/moRedir.js +0 -186
  98. package/dist/api/oneClick.js +0 -366
  99. package/dist/api/pin.js +0 -493
  100. package/dist/api/strategies.js +0 -704
  101. package/dist/api/ussd.js +0 -1
  102. package/dist/app/store.js +0 -35
  103. package/dist/features/strategies/categories/askMobileNumber.js +0 -395
  104. package/dist/features/strategies/categories/askOperator.js +0 -311
  105. package/dist/features/strategies/categories/detectOperatorByIp.js +0 -606
  106. package/dist/features/strategies/categories/headerEnrichment.js +0 -670
  107. package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +0 -12
  108. package/dist/features/strategies/categories/typings/identifySliceTypes.js +0 -22
  109. package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +0 -22
  110. package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +0 -21
  111. package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +0 -13
  112. package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +0 -13
  113. package/dist/features/strategies/click2smsFlowSlice.js +0 -172
  114. package/dist/features/strategies/identifySlice.js +0 -455
  115. package/dist/features/strategies/moFlowSlice.js +0 -196
  116. package/dist/features/strategies/moRedirFlowSlice.js +0 -190
  117. package/dist/features/strategies/oneClickFlowSlice.js +0 -277
  118. package/dist/features/strategies/pinFlowSlice.js +0 -313
  119. package/dist/features/strategies/ussdFlowSlice.js +0 -1
  120. package/dist/flows/tpayHeFlow.d.ts +0 -7
  121. package/dist/flows/tpayHeFlow.js +0 -23
  122. package/dist/mockServer/browser.js +0 -48
  123. package/dist/mockServer/handlers.js +0 -22
  124. package/dist/mockServer/server.js +0 -48
  125. package/dist/reducers/tpayHeFlow/ITpayHeConstants.d.ts +0 -2
  126. package/dist/reducers/tpayHeFlow/ITpayHeConstants.js +0 -1
  127. package/dist/reducers/tpayHeFlow/TpayHeTypes.d.ts +0 -114
  128. package/dist/reducers/tpayHeFlow/TpayHeTypes.js +0 -1
  129. package/dist/reducers/tpayHeFlow/index.d.ts +0 -7
  130. package/dist/reducers/tpayHeFlow/index.js +0 -331
  131. package/dist/reducers/tpayHeFlow/utils.d.ts +0 -20
  132. package/dist/reducers/tpayHeFlow/utils.js +0 -510
  133. package/dist/test/setup.js +0 -24
  134. package/dist/test/test-utils.js +0 -51
  135. package/mockData/config.json +0 -28
  136. package/prettier.config.js +0 -7
  137. package/src/@types/react-tracker.d.ts +0 -16
  138. package/src/@types/redux-cli-logger.d.ts +0 -1
  139. package/src/@types/tiny-async-pool.d.ts +0 -3
  140. package/src/@types/window.d.ts +0 -74
  141. package/src/api/index.ts +0 -225
  142. package/src/common-types/AppThunk.ts +0 -19
  143. package/src/common-types/Either.ts +0 -3
  144. package/src/common-types/IError.ts +0 -5
  145. package/src/common-types/IOptInFlowName.ts +0 -1
  146. package/src/common-types/ITracker.ts +0 -10
  147. package/src/common-types/IVisitor.ts +0 -16
  148. package/src/common-types/RemoteDataState.ts +0 -88
  149. package/src/flows/click2smsFlow.ts +0 -18
  150. package/src/flows/moFlow.ts +0 -20
  151. package/src/flows/moRedirFlow.ts +0 -20
  152. package/src/flows/oneClickFlow.ts +0 -20
  153. package/src/flows/pinFlow.ts +0 -25
  154. package/src/flows/strategy.ts +0 -51
  155. package/src/flows/ussdFlow.ts +0 -20
  156. package/src/index.ts +0 -3
  157. package/src/ips/tryGetIPRangeName.ts +0 -22
  158. package/src/jest.config.js +0 -194
  159. package/src/pacman/index.ts +0 -71
  160. package/src/pacman/queryString.ts +0 -24
  161. package/src/reducers/click2smsFlow/Click2smsTypes.ts +0 -93
  162. package/src/reducers/click2smsFlow/IClick2smsConstants.ts +0 -4
  163. package/src/reducers/click2smsFlow/index.ts +0 -105
  164. package/src/reducers/click2smsFlow/utils.ts +0 -126
  165. package/src/reducers/moFlow/IMoConstants.ts +0 -7
  166. package/src/reducers/moFlow/MoTypes.ts +0 -125
  167. package/src/reducers/moFlow/index.ts +0 -150
  168. package/src/reducers/moFlow/utils.ts +0 -135
  169. package/src/reducers/moRedirFlow/IMoRedirConstants.ts +0 -7
  170. package/src/reducers/moRedirFlow/MoRedirTypes.ts +0 -99
  171. package/src/reducers/moRedirFlow/index.ts +0 -137
  172. package/src/reducers/moRedirFlow/utils.ts +0 -78
  173. package/src/reducers/oneClickFlow/IOneClickConstants.ts +0 -3
  174. package/src/reducers/oneClickFlow/OneClickTypes.ts +0 -108
  175. package/src/reducers/oneClickFlow/index.ts +0 -268
  176. package/src/reducers/oneClickFlow/utils.ts +0 -217
  177. package/src/reducers/pinFlow/IPinConstants.ts +0 -9
  178. package/src/reducers/pinFlow/PinTypes.ts +0 -190
  179. package/src/reducers/pinFlow/index.ts +0 -331
  180. package/src/reducers/pinFlow/utils.ts +0 -232
  181. package/src/reducers/strategy/IStategyActionContants.ts +0 -17
  182. package/src/reducers/strategy/StrategyTypes.ts +0 -375
  183. package/src/reducers/strategy/index.ts +0 -321
  184. package/src/reducers/strategy/strategies/ask_mobile_number.ts +0 -316
  185. package/src/reducers/strategy/strategies/ask_operator.ts +0 -195
  186. package/src/reducers/strategy/strategies/detect_operator_by_ip.ts +0 -414
  187. package/src/reducers/strategy/strategies/header_enrichment.ts +0 -489
  188. package/src/reducers/strategy/utils.ts +0 -357
  189. package/src/reducers/ussdFlow/IUssdConstants.ts +0 -7
  190. package/src/reducers/ussdFlow/UssdTypes.ts +0 -112
  191. package/src/reducers/ussdFlow/index.ts +0 -146
  192. package/src/reducers/ussdFlow/utils.ts +0 -88
  193. package/src/store/index.ts +0 -150
  194. package/src/store/reducers.ts +0 -37
  195. package/src/utilities/handleSubmitNumber.ts +0 -65
  196. package/src/utilities/index.ts +0 -114
  197. package/src/utilities/loadScriptInnerHtml.ts +0 -14
  198. package/src/utilities/loadScriptSrc.ts +0 -26
@@ -1,606 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.symbol");
4
-
5
- require("core-js/modules/es.array.filter");
6
-
7
- require("core-js/modules/es.object.get-own-property-descriptor");
8
-
9
- require("core-js/modules/es.object.get-own-property-descriptors");
10
-
11
- require("core-js/modules/es.object.keys");
12
-
13
- require("core-js/modules/es.object.to-string");
14
-
15
- require("core-js/modules/es.promise");
16
-
17
- require("core-js/modules/web.dom-collections.for-each");
18
-
19
- Object.defineProperty(exports, "__esModule", {
20
- value: true
21
- });
22
- exports.pinMoDetectOperatorByIp = exports.moOneClickDetectOperatorByIp = exports.detectOperatorByIp = void 0;
23
-
24
- require("regenerator-runtime/runtime");
25
-
26
- var _strategies = require("../../../api/strategies");
27
-
28
- var _identifySlice = require("../identifySlice");
29
-
30
- var _identifySliceTypes = require("./typings/identifySliceTypes");
31
-
32
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
33
-
34
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
35
-
36
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
37
-
38
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
39
-
40
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
41
-
42
- var oneClick = function oneClick(_ref) {
43
- var flowObj = _ref.flowObj;
44
-
45
- _identifySlice.tracker.sendOptInFlowEvent('3G click');
46
-
47
- return {
48
- type: _identifySliceTypes.StrategyStates.ONE_CLICK,
49
- result: {},
50
- nextData: {
51
- config: flowObj.flowConfig,
52
- operator: flowObj.operator
53
- }
54
- };
55
- };
56
-
57
- var pin = function pin(_ref2) {
58
- var flowObj = _ref2.flowObj;
59
-
60
- _identifySlice.tracker.sendOptInFlowEvent('Pin');
61
-
62
- return {
63
- type: _identifySliceTypes.StrategyStates.PIN,
64
- result: {},
65
- nextData: {
66
- config: flowObj.flowConfig,
67
- operator: flowObj.operator
68
- }
69
- };
70
- };
71
-
72
- var moRedir = function moRedir(_ref3) {
73
- var flowObj = _ref3.flowObj;
74
-
75
- _identifySlice.tracker.sendOptInFlowEvent('Redirect');
76
-
77
- return {
78
- type: _identifySliceTypes.StrategyStates.MO_REDIR,
79
- result: {},
80
- nextData: {
81
- config: flowObj.flowConfig,
82
- operator: flowObj.operator
83
- }
84
- };
85
- };
86
-
87
- var click2sms = function click2sms(_ref4) {
88
- var flowObj = _ref4.flowObj;
89
-
90
- _identifySlice.tracker.sendOptInFlowEvent('Click to sms');
91
-
92
- return {
93
- type: _identifySliceTypes.StrategyStates.CLICK2SMS,
94
- result: {},
95
- nextData: {
96
- config: _objectSpread({
97
- operators: [flowObj.operator]
98
- }, flowObj.flowConfig),
99
- operator: flowObj.operator
100
- }
101
- };
102
- };
103
-
104
- var mo = function mo(_ref5) {
105
- var flowObj = _ref5.flowObj;
106
-
107
- _identifySlice.tracker.sendOptInFlowEvent('Msisdn to sms');
108
-
109
- return {
110
- type: _identifySliceTypes.StrategyStates.MO,
111
- result: {},
112
- nextData: {
113
- config: flowObj.flowConfig,
114
- operator: flowObj.operator
115
- }
116
- };
117
- };
118
-
119
- var pinOneClickDetectOperatorByIp = /*#__PURE__*/function () {
120
- var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref6) {
121
- var configs, strategyConfigs, defaultFlow, flowObj;
122
- return regeneratorRuntime.wrap(function _callee$(_context) {
123
- while (1) {
124
- switch (_context.prev = _context.next) {
125
- case 0:
126
- configs = _ref6.configs;
127
- strategyConfigs = configs.strategyConfigs;
128
- defaultFlow = strategyConfigs.default;
129
- _context.prev = 3;
130
- _context.next = 6;
131
- return (0, _strategies.determineFlowByOperatorFromIp)({
132
- configs: configs
133
- });
134
-
135
- case 6:
136
- flowObj = _context.sent;
137
- _context.t0 = flowObj.flow;
138
- _context.next = _context.t0 === 'pin' ? 10 : _context.t0 === 'oneClick' ? 11 : 12;
139
- break;
140
-
141
- case 10:
142
- return _context.abrupt("return", pin({
143
- flowObj: flowObj
144
- }));
145
-
146
- case 11:
147
- return _context.abrupt("return", oneClick({
148
- flowObj: flowObj
149
- }));
150
-
151
- case 12:
152
- return _context.abrupt("return", pin({
153
- flowObj: _objectSpread(_objectSpread({}, defaultFlow), {}, {
154
- operator: flowObj.operator
155
- })
156
- }));
157
-
158
- case 13:
159
- _context.next = 19;
160
- break;
161
-
162
- case 15:
163
- _context.prev = 15;
164
- _context.t1 = _context["catch"](3);
165
- console.warn(_context.t1);
166
- return _context.abrupt("return", pin({
167
- flowObj: defaultFlow
168
- }));
169
-
170
- case 19:
171
- case "end":
172
- return _context.stop();
173
- }
174
- }
175
- }, _callee, null, [[3, 15]]);
176
- }));
177
-
178
- return function pinOneClickDetectOperatorByIp(_x) {
179
- return _ref7.apply(this, arguments);
180
- };
181
- }();
182
-
183
- var oneClickMoPinDetectOperatorByIpOrMsisdn = /*#__PURE__*/function () {
184
- var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref8) {
185
- var configs, strategyConfigs, defaultFlow, flowObj;
186
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
187
- while (1) {
188
- switch (_context2.prev = _context2.next) {
189
- case 0:
190
- configs = _ref8.configs;
191
- strategyConfigs = configs.strategyConfigs;
192
- defaultFlow = strategyConfigs.default;
193
- _context2.prev = 3;
194
- _context2.next = 6;
195
- return (0, _strategies.determineFlowByOperatorFromIp)({
196
- configs: configs
197
- });
198
-
199
- case 6:
200
- flowObj = _context2.sent;
201
- _context2.t0 = flowObj.flow;
202
- _context2.next = _context2.t0 === 'pin' ? 10 : _context2.t0 === 'oneClick' ? 11 : 12;
203
- break;
204
-
205
- case 10:
206
- return _context2.abrupt("return", pin({
207
- flowObj: flowObj
208
- }));
209
-
210
- case 11:
211
- return _context2.abrupt("return", oneClick({
212
- flowObj: flowObj
213
- }));
214
-
215
- case 12:
216
- return _context2.abrupt("return", pin({
217
- flowObj: _objectSpread(_objectSpread({}, defaultFlow), {}, {
218
- operator: flowObj.operator
219
- })
220
- }));
221
-
222
- case 13:
223
- _context2.next = 19;
224
- break;
225
-
226
- case 15:
227
- _context2.prev = 15;
228
- _context2.t1 = _context2["catch"](3);
229
- console.warn(_context2.t1); // TODO
230
- // Use ask_mobile_number
231
-
232
- return _context2.abrupt("return", pin({
233
- flowObj: defaultFlow
234
- }));
235
-
236
- case 19:
237
- case "end":
238
- return _context2.stop();
239
- }
240
- }
241
- }, _callee2, null, [[3, 15]]);
242
- }));
243
-
244
- return function oneClickMoPinDetectOperatorByIpOrMsisdn(_x2) {
245
- return _ref9.apply(this, arguments);
246
- };
247
- }();
248
-
249
- var moRedirOneClickDetectOperatorByIp = /*#__PURE__*/function () {
250
- var _ref11 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(_ref10) {
251
- var configs, strategyConfigs, defaultFlow, flowObj;
252
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
253
- while (1) {
254
- switch (_context3.prev = _context3.next) {
255
- case 0:
256
- configs = _ref10.configs;
257
- strategyConfigs = configs.strategyConfigs;
258
- defaultFlow = strategyConfigs.default;
259
- _context3.prev = 3;
260
- _context3.next = 6;
261
- return (0, _strategies.determineFlowByOperatorFromIp)({
262
- configs: configs
263
- });
264
-
265
- case 6:
266
- flowObj = _context3.sent;
267
- _context3.t0 = flowObj.flow;
268
- _context3.next = _context3.t0 === 'moRedir' ? 10 : _context3.t0 === 'oneClick' ? 11 : 12;
269
- break;
270
-
271
- case 10:
272
- return _context3.abrupt("return", moRedir({
273
- flowObj: flowObj
274
- }));
275
-
276
- case 11:
277
- return _context3.abrupt("return", oneClick({
278
- flowObj: flowObj
279
- }));
280
-
281
- case 12:
282
- return _context3.abrupt("return", moRedir({
283
- flowObj: _objectSpread(_objectSpread({}, defaultFlow), {}, {
284
- operator: flowObj.operator
285
- })
286
- }));
287
-
288
- case 13:
289
- _context3.next = 19;
290
- break;
291
-
292
- case 15:
293
- _context3.prev = 15;
294
- _context3.t1 = _context3["catch"](3);
295
- console.warn(_context3.t1); // console.log("defaul", defaultFlow.flowConfig)
296
-
297
- return _context3.abrupt("return", moRedir({
298
- flowObj: defaultFlow
299
- }));
300
-
301
- case 19:
302
- case "end":
303
- return _context3.stop();
304
- }
305
- }
306
- }, _callee3, null, [[3, 15]]);
307
- }));
308
-
309
- return function moRedirOneClickDetectOperatorByIp(_x3) {
310
- return _ref11.apply(this, arguments);
311
- };
312
- }();
313
-
314
- var click2smsOneClickDetectOperatorByIp = /*#__PURE__*/function () {
315
- var _ref13 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(_ref12) {
316
- var configs, strategyConfigs, defaultFlow, flowObj;
317
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
318
- while (1) {
319
- switch (_context4.prev = _context4.next) {
320
- case 0:
321
- configs = _ref12.configs;
322
- strategyConfigs = configs.strategyConfigs;
323
- defaultFlow = strategyConfigs.default;
324
- _context4.prev = 3;
325
- _context4.next = 6;
326
- return (0, _strategies.determineFlowByOperatorFromIp)({
327
- configs: configs
328
- });
329
-
330
- case 6:
331
- flowObj = _context4.sent;
332
- _context4.t0 = flowObj.flow;
333
- _context4.next = _context4.t0 === 'click2sms' ? 10 : _context4.t0 === 'oneClick' ? 11 : 12;
334
- break;
335
-
336
- case 10:
337
- return _context4.abrupt("return", click2sms({
338
- flowObj: flowObj
339
- }));
340
-
341
- case 11:
342
- return _context4.abrupt("return", oneClick({
343
- flowObj: flowObj
344
- }));
345
-
346
- case 12:
347
- return _context4.abrupt("return", click2sms({
348
- flowObj: _objectSpread(_objectSpread({}, defaultFlow), {}, {
349
- operator: flowObj.operator
350
- })
351
- }));
352
-
353
- case 13:
354
- _context4.next = 19;
355
- break;
356
-
357
- case 15:
358
- _context4.prev = 15;
359
- _context4.t1 = _context4["catch"](3);
360
- console.warn(_context4.t1);
361
- return _context4.abrupt("return", click2sms({
362
- flowObj: defaultFlow
363
- }));
364
-
365
- case 19:
366
- case "end":
367
- return _context4.stop();
368
- }
369
- }
370
- }, _callee4, null, [[3, 15]]);
371
- }));
372
-
373
- return function click2smsOneClickDetectOperatorByIp(_x4) {
374
- return _ref13.apply(this, arguments);
375
- };
376
- }();
377
-
378
- var moOneClickDetectOperatorByIp = /*#__PURE__*/function () {
379
- var _ref15 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(_ref14) {
380
- var configs, strategyConfigs, defaultFlow, flowObj;
381
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
382
- while (1) {
383
- switch (_context5.prev = _context5.next) {
384
- case 0:
385
- configs = _ref14.configs;
386
- strategyConfigs = configs.strategyConfigs;
387
- defaultFlow = strategyConfigs.default;
388
- _context5.prev = 3;
389
- _context5.next = 6;
390
- return (0, _strategies.determineFlowByOperatorFromIp)({
391
- configs: configs
392
- });
393
-
394
- case 6:
395
- flowObj = _context5.sent;
396
- _context5.t0 = flowObj.flow;
397
- _context5.next = _context5.t0 === 'mo' ? 10 : _context5.t0 === 'oneClick' ? 11 : 12;
398
- break;
399
-
400
- case 10:
401
- return _context5.abrupt("return", mo({
402
- flowObj: flowObj
403
- }));
404
-
405
- case 11:
406
- return _context5.abrupt("return", oneClick({
407
- flowObj: flowObj
408
- }));
409
-
410
- case 12:
411
- return _context5.abrupt("return", mo({
412
- flowObj: _objectSpread(_objectSpread({}, defaultFlow), {}, {
413
- operator: flowObj.operator
414
- })
415
- }));
416
-
417
- case 13:
418
- _context5.next = 19;
419
- break;
420
-
421
- case 15:
422
- _context5.prev = 15;
423
- _context5.t1 = _context5["catch"](3);
424
- console.warn(_context5.t1);
425
- return _context5.abrupt("return", mo({
426
- flowObj: defaultFlow
427
- }));
428
-
429
- case 19:
430
- case "end":
431
- return _context5.stop();
432
- }
433
- }
434
- }, _callee5, null, [[3, 15]]);
435
- }));
436
-
437
- return function moOneClickDetectOperatorByIp(_x5) {
438
- return _ref15.apply(this, arguments);
439
- };
440
- }();
441
-
442
- exports.moOneClickDetectOperatorByIp = moOneClickDetectOperatorByIp;
443
-
444
- var pinMoDetectOperatorByIp = /*#__PURE__*/function () {
445
- var _ref17 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(_ref16) {
446
- var configs, strategyConfigs, defaultFlow, flowObj;
447
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
448
- while (1) {
449
- switch (_context6.prev = _context6.next) {
450
- case 0:
451
- configs = _ref16.configs;
452
- strategyConfigs = configs.strategyConfigs;
453
- defaultFlow = strategyConfigs.default;
454
- _context6.prev = 3;
455
- _context6.next = 6;
456
- return (0, _strategies.determineFlowByOperatorFromIp)({
457
- configs: configs
458
- });
459
-
460
- case 6:
461
- flowObj = _context6.sent;
462
- _context6.t0 = flowObj.flow;
463
- _context6.next = _context6.t0 === 'mo' ? 10 : _context6.t0 === 'pin' ? 11 : 12;
464
- break;
465
-
466
- case 10:
467
- return _context6.abrupt("return", mo({
468
- flowObj: flowObj
469
- }));
470
-
471
- case 11:
472
- return _context6.abrupt("return", pin({
473
- flowObj: flowObj
474
- }));
475
-
476
- case 12:
477
- return _context6.abrupt("return", pin({
478
- flowObj: _objectSpread(_objectSpread({}, defaultFlow), {}, {
479
- operator: flowObj.operator
480
- })
481
- }));
482
-
483
- case 13:
484
- _context6.next = 19;
485
- break;
486
-
487
- case 15:
488
- _context6.prev = 15;
489
- _context6.t1 = _context6["catch"](3);
490
- console.warn(_context6.t1);
491
- return _context6.abrupt("return", pin({
492
- flowObj: defaultFlow
493
- }));
494
-
495
- case 19:
496
- case "end":
497
- return _context6.stop();
498
- }
499
- }
500
- }, _callee6, null, [[3, 15]]);
501
- }));
502
-
503
- return function pinMoDetectOperatorByIp(_x6) {
504
- return _ref17.apply(this, arguments);
505
- };
506
- }();
507
-
508
- exports.pinMoDetectOperatorByIp = pinMoDetectOperatorByIp;
509
-
510
- var detectOperatorByIp = /*#__PURE__*/function () {
511
- var _ref19 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(_ref18) {
512
- var configs, strategy;
513
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
514
- while (1) {
515
- switch (_context7.prev = _context7.next) {
516
- case 0:
517
- configs = _ref18.configs;
518
- strategy = configs.strategy;
519
- _context7.prev = 2;
520
- _context7.t0 = strategy;
521
- _context7.next = _context7.t0 === 'pin-one-click-detect-operator-by-ip' ? 6 : _context7.t0 === 'one-click-mo-pin-detect-operator-by-ip-or-msisdn' ? 9 : _context7.t0 === 'mo-redir-one-click-detect-operator-by-ip' ? 12 : _context7.t0 === 'mo-one-click-detect-operator-by-ip' ? 15 : _context7.t0 === 'click2sms-one-click-detect-operator-by-ip' ? 18 : _context7.t0 === 'pin-mo-detect-operator-by-ip' ? 21 : 24;
522
- break;
523
-
524
- case 6:
525
- _context7.next = 8;
526
- return pinOneClickDetectOperatorByIp({
527
- configs: configs
528
- });
529
-
530
- case 8:
531
- return _context7.abrupt("return", _context7.sent);
532
-
533
- case 9:
534
- _context7.next = 11;
535
- return oneClickMoPinDetectOperatorByIpOrMsisdn({
536
- configs: configs
537
- });
538
-
539
- case 11:
540
- return _context7.abrupt("return", _context7.sent);
541
-
542
- case 12:
543
- _context7.next = 14;
544
- return moRedirOneClickDetectOperatorByIp({
545
- configs: configs
546
- });
547
-
548
- case 14:
549
- return _context7.abrupt("return", _context7.sent);
550
-
551
- case 15:
552
- _context7.next = 17;
553
- return moOneClickDetectOperatorByIp({
554
- configs: configs
555
- });
556
-
557
- case 17:
558
- return _context7.abrupt("return", _context7.sent);
559
-
560
- case 18:
561
- _context7.next = 20;
562
- return click2smsOneClickDetectOperatorByIp({
563
- configs: configs
564
- });
565
-
566
- case 20:
567
- return _context7.abrupt("return", _context7.sent);
568
-
569
- case 21:
570
- _context7.next = 23;
571
- return pinMoDetectOperatorByIp({
572
- configs: configs
573
- });
574
-
575
- case 23:
576
- return _context7.abrupt("return", _context7.sent);
577
-
578
- case 24:
579
- console.error('detectOperatorByIp', 'Strategy not supported');
580
- return _context7.abrupt("return", null);
581
-
582
- case 26:
583
- _context7.next = 32;
584
- break;
585
-
586
- case 28:
587
- _context7.prev = 28;
588
- _context7.t1 = _context7["catch"](2);
589
- console.error('detectOperatorByIp', _context7.t1); // You can choose to use the message attached to err or write a custom error
590
-
591
- return _context7.abrupt("return", null);
592
-
593
- case 32:
594
- case "end":
595
- return _context7.stop();
596
- }
597
- }
598
- }, _callee7, null, [[2, 28]]);
599
- }));
600
-
601
- return function detectOperatorByIp(_x7) {
602
- return _ref19.apply(this, arguments);
603
- };
604
- }();
605
-
606
- exports.detectOperatorByIp = detectOperatorByIp;