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