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,665 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.object.to-string");
4
-
5
- require("core-js/modules/es.promise");
6
-
7
- require("core-js/modules/es.regexp.to-string");
8
-
9
- Object.defineProperty(exports, "__esModule", {
10
- value: true
11
- });
12
- exports.identifyUserByHe = exports.heMoRedirOneClickHeaderEnrichment = exports.hePinOneClickHeaderEnrichment = exports.hePinMoRedirHeaderEnrichment = exports.pinHeaderEnrichment = void 0;
13
-
14
- require("regenerator-runtime/runtime");
15
-
16
- var _tryGetIPRangeName = _interopRequireDefault(require("../../../ips/tryGetIPRangeName"));
17
-
18
- var _utils = require("../../../reducers/strategy/utils");
19
-
20
- var _identifySlice = require("../identifySlice");
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
- 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); } }
25
-
26
- 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); }); }; }
27
-
28
- var oneClick = function oneClick(_ref) {
29
- var flowObj = _ref.flowObj,
30
- msisdn = _ref.msisdn,
31
- operator = _ref.operator,
32
- isHeaderEnrichmentSuccess = _ref.isHeaderEnrichmentSuccess,
33
- subscriptionUrl = _ref.subscriptionUrl,
34
- redirectUrl = _ref.redirectUrl;
35
-
36
- _identifySlice.tracker.sendOptInFlowEvent('3G click');
37
-
38
- return {
39
- type: _identifySlice.StrategyStates.ONE_CLICK,
40
- result: {
41
- config: flowObj.flowConfig,
42
- operator: flowObj.operator,
43
- msisdn: msisdn,
44
- redirectUrl: redirectUrl,
45
- subscriptionUrl: subscriptionUrl,
46
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
47
- }
48
- };
49
- };
50
-
51
- var pin = function pin(_ref2) {
52
- var flowObj = _ref2.flowObj,
53
- msisdn = _ref2.msisdn,
54
- isHeaderEnrichmentSuccess = _ref2.isHeaderEnrichmentSuccess;
55
-
56
- if (isHeaderEnrichmentSuccess !== true) {
57
- _identifySlice.tracker.sendOptInFlowEvent('Pin');
58
- } else {
59
- _identifySlice.tracker.sendOptInFlowEvent('Hybrid Pin');
60
- }
61
-
62
- return {
63
- type: _identifySlice.StrategyStates.PIN,
64
- result: {
65
- config: flowObj.flowConfig,
66
- operator: flowObj.operator,
67
- msisdn: msisdn,
68
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
69
- }
70
- };
71
- };
72
-
73
- var moRedir = function moRedir(_ref3) {
74
- var flowObj = _ref3.flowObj,
75
- msisdn = _ref3.msisdn,
76
- isHeaderEnrichmentSuccess = _ref3.isHeaderEnrichmentSuccess;
77
-
78
- _identifySlice.tracker.sendOptInFlowEvent('Redirect');
79
-
80
- return {
81
- type: _identifySlice.StrategyStates.MO_REDIR,
82
- result: {
83
- config: flowObj.flowConfig,
84
- operator: flowObj.operator,
85
- msisdn: msisdn,
86
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
87
- }
88
- };
89
- };
90
-
91
- var pinHeaderEnrichment = /*#__PURE__*/function () {
92
- var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref4) {
93
- var configs, strategyConfigs, defaultFlow, ipRangeName, heResult, msisdn, operator, isHeaderEnrichmentSuccess;
94
- return regeneratorRuntime.wrap(function _callee$(_context) {
95
- while (1) {
96
- switch (_context.prev = _context.next) {
97
- case 0:
98
- configs = _ref4.configs;
99
- strategyConfigs = configs.strategyConfigs;
100
- defaultFlow = strategyConfigs.default;
101
- _context.prev = 3;
102
- _context.next = 6;
103
- return (0, _tryGetIPRangeName.default)(window.pac_analytics.visitor);
104
-
105
- case 6:
106
- ipRangeName = _context.sent;
107
-
108
- if (!(ipRangeName == null)) {
109
- _context.next = 9;
110
- break;
111
- }
112
-
113
- return _context.abrupt("return", pin({
114
- flowObj: defaultFlow
115
- }));
116
-
117
- case 9:
118
- _context.next = 11;
119
- return (0, _utils.identifyUser)({
120
- configs: configs
121
- });
122
-
123
- case 11:
124
- heResult = _context.sent;
125
- msisdn = heResult.msisdn;
126
- operator = heResult.operator;
127
- isHeaderEnrichmentSuccess = !!msisdn;
128
- return _context.abrupt("return", pin({
129
- flowObj: defaultFlow,
130
- msisdn: msisdn,
131
- operator: operator,
132
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
133
- }));
134
-
135
- case 18:
136
- _context.prev = 18;
137
- _context.t0 = _context["catch"](3);
138
- console.warn(_context.t0);
139
- return _context.abrupt("return", pin({
140
- flowObj: defaultFlow
141
- }));
142
-
143
- case 22:
144
- case "end":
145
- return _context.stop();
146
- }
147
- }
148
- }, _callee, null, [[3, 18]]);
149
- }));
150
-
151
- return function pinHeaderEnrichment(_x) {
152
- return _ref5.apply(this, arguments);
153
- };
154
- }();
155
-
156
- exports.pinHeaderEnrichment = pinHeaderEnrichment;
157
-
158
- var hePinMoRedirHeaderEnrichment = /*#__PURE__*/function () {
159
- var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref6) {
160
- var configs, strategyConfigs, defaultFlow, switchState, heResult, msisdn, operator, _flowObj2, _flowObj, flowObj, _flowObj3;
161
-
162
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
163
- while (1) {
164
- switch (_context2.prev = _context2.next) {
165
- case 0:
166
- configs = _ref6.configs;
167
- strategyConfigs = configs.strategyConfigs;
168
- defaultFlow = strategyConfigs.default;
169
-
170
- switchState = function switchState(flowObj, msisdn, operator) {
171
- var isHeaderEnrichmentSuccess = !!(msisdn !== undefined && msisdn !== '');
172
-
173
- switch (flowObj.flow) {
174
- case 'moRedir':
175
- return moRedir({
176
- flowObj: flowObj,
177
- msisdn: msisdn,
178
- operator: operator,
179
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
180
- });
181
-
182
- case 'pin':
183
- return pin({
184
- flowObj: flowObj,
185
- msisdn: msisdn,
186
- operator: operator,
187
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
188
- });
189
-
190
- default:
191
- return pin({
192
- flowObj: defaultFlow
193
- });
194
- }
195
- };
196
-
197
- _context2.prev = 4;
198
- _context2.next = 7;
199
- return (0, _utils.identifyUser)({
200
- configs: configs
201
- });
202
-
203
- case 7:
204
- heResult = _context2.sent;
205
-
206
- if (!(heResult.msisdn !== undefined && heResult.msisdn !== '')) {
207
- _context2.next = 19;
208
- break;
209
- }
210
-
211
- msisdn = heResult.msisdn;
212
- operator = heResult.operator;
213
-
214
- _identifySlice.tracker.customEvent('identify-user', 'msisdn-detected', 'msisdn-detected', {
215
- msisdn: msisdn
216
- });
217
-
218
- if (!(!!operator && operator !== '')) {
219
- _context2.next = 15;
220
- break;
221
- }
222
-
223
- _flowObj2 = (0, _utils.determineFlowByOperator)({
224
- configs: configs,
225
- operator: operator
226
- });
227
- return _context2.abrupt("return", switchState(_flowObj2, msisdn, operator));
228
-
229
- case 15:
230
- _context2.next = 17;
231
- return (0, _utils.determineFlowByOperatorFromIp)({
232
- configs: configs
233
- });
234
-
235
- case 17:
236
- _flowObj = _context2.sent;
237
- return _context2.abrupt("return", switchState(_flowObj, msisdn));
238
-
239
- case 19:
240
- _context2.next = 21;
241
- return (0, _utils.determineFlowByOperatorFromIp)({
242
- configs: configs
243
- });
244
-
245
- case 21:
246
- flowObj = _context2.sent;
247
- return _context2.abrupt("return", switchState(flowObj));
248
-
249
- case 25:
250
- _context2.prev = 25;
251
- _context2.t0 = _context2["catch"](4);
252
- console.warn(_context2.t0);
253
-
254
- _identifySlice.tracker.customEvent('tallyman.v1-pin', 'msisdn-detection-failure', 'msisdn-detection-failure', {
255
- errorType: _context2.t0.toString()
256
- });
257
-
258
- _context2.prev = 29;
259
- _context2.next = 32;
260
- return (0, _utils.determineFlowByOperatorFromIp)({
261
- configs: configs
262
- });
263
-
264
- case 32:
265
- _flowObj3 = _context2.sent;
266
- return _context2.abrupt("return", switchState(_flowObj3));
267
-
268
- case 36:
269
- _context2.prev = 36;
270
- _context2.t1 = _context2["catch"](29);
271
- console.warn(_context2.t1);
272
- return _context2.abrupt("return", pin({
273
- flowObj: defaultFlow
274
- }));
275
-
276
- case 40:
277
- case "end":
278
- return _context2.stop();
279
- }
280
- }
281
- }, _callee2, null, [[4, 25], [29, 36]]);
282
- }));
283
-
284
- return function hePinMoRedirHeaderEnrichment(_x2) {
285
- return _ref7.apply(this, arguments);
286
- };
287
- }();
288
-
289
- exports.hePinMoRedirHeaderEnrichment = hePinMoRedirHeaderEnrichment;
290
-
291
- var hePinOneClickHeaderEnrichment = /*#__PURE__*/function () {
292
- var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(_ref8) {
293
- var configs, strategyConfigs, defaultFlow, switchState, ipRangeName, flowObj, heResult, msisdn, _subscriptionUrl, _redirectUrl, operator;
294
-
295
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
296
- while (1) {
297
- switch (_context3.prev = _context3.next) {
298
- case 0:
299
- configs = _ref8.configs;
300
- strategyConfigs = configs.strategyConfigs;
301
- defaultFlow = strategyConfigs.default;
302
-
303
- switchState = function switchState(_ref10) {
304
- var flowObj = _ref10.flowObj,
305
- msisdn = _ref10.msisdn,
306
- operator = _ref10.operator,
307
- subscriptionUrl = _ref10.subscriptionUrl,
308
- redirectUrl = _ref10.redirectUrl;
309
- var isHeaderEnrichmentSuccess = !!(msisdn !== undefined && msisdn !== '');
310
-
311
- switch (flowObj.flow) {
312
- case 'oneClick':
313
- return oneClick({
314
- flowObj: flowObj,
315
- msisdn: msisdn,
316
- operator: operator,
317
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess,
318
- subscriptionUrl: subscriptionUrl,
319
- redirectUrl: redirectUrl
320
- });
321
-
322
- case 'pin':
323
- return pin({
324
- flowObj: flowObj,
325
- msisdn: msisdn,
326
- operator: operator,
327
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
328
- });
329
-
330
- default:
331
- return pin({
332
- flowObj: defaultFlow
333
- });
334
- }
335
- };
336
-
337
- _context3.next = 6;
338
- return (0, _tryGetIPRangeName.default)(window.pac_analytics.visitor);
339
-
340
- case 6:
341
- ipRangeName = _context3.sent;
342
-
343
- if (!(ipRangeName == null)) {
344
- _context3.next = 9;
345
- break;
346
- }
347
-
348
- return _context3.abrupt("return", pin({
349
- flowObj: defaultFlow
350
- }));
351
-
352
- case 9:
353
- _context3.prev = 9;
354
- flowObj = (0, _utils.determineFlowByOperator)({
355
- configs: configs,
356
- operator: ipRangeName.toUpperCase()
357
- });
358
-
359
- if (!(flowObj.flow === 'oneClick')) {
360
- _context3.next = 23;
361
- break;
362
- }
363
-
364
- _context3.next = 14;
365
- return (0, _utils.identifyUser)({
366
- configs: configs
367
- });
368
-
369
- case 14:
370
- heResult = _context3.sent;
371
- msisdn = heResult.msisdn, _subscriptionUrl = heResult.subscriptionUrl, _redirectUrl = heResult.redirectUrl;
372
- operator = heResult.operator ? heResult.operator.toUpperCase() : ipRangeName.toUpperCase();
373
-
374
- if (!(msisdn && msisdn !== '')) {
375
- _context3.next = 21;
376
- break;
377
- }
378
-
379
- _identifySlice.tracker.customEvent('identify-user', 'msisdn-detected', 'msisdn-detected', {
380
- msisdn: msisdn
381
- });
382
-
383
- flowObj = (0, _utils.determineFlowByOperator)({
384
- configs: configs,
385
- operator: operator
386
- });
387
- return _context3.abrupt("return", switchState({
388
- flowObj: flowObj,
389
- msisdn: msisdn,
390
- operator: operator,
391
- subscriptionUrl: _subscriptionUrl,
392
- redirectUrl: _redirectUrl
393
- }));
394
-
395
- case 21:
396
- flowObj = (0, _utils.determineFlowByOperator)({
397
- configs: configs,
398
- operator: operator
399
- });
400
- return _context3.abrupt("return", switchState({
401
- flowObj: flowObj,
402
- subscriptionUrl: _subscriptionUrl,
403
- redirectUrl: _redirectUrl,
404
- operator: operator
405
- }));
406
-
407
- case 23:
408
- return _context3.abrupt("return", pin({
409
- flowObj: defaultFlow
410
- }));
411
-
412
- case 26:
413
- _context3.prev = 26;
414
- _context3.t0 = _context3["catch"](9);
415
- console.warn(_context3.t0);
416
-
417
- _identifySlice.tracker.customEvent('identify-user', 'msisdn-detection-failure', 'msisdn-detection-failure', {
418
- errorType: _context3.t0.toString()
419
- });
420
-
421
- return _context3.abrupt("return", pin({
422
- flowObj: defaultFlow
423
- }));
424
-
425
- case 31:
426
- case "end":
427
- return _context3.stop();
428
- }
429
- }
430
- }, _callee3, null, [[9, 26]]);
431
- }));
432
-
433
- return function hePinOneClickHeaderEnrichment(_x3) {
434
- return _ref9.apply(this, arguments);
435
- };
436
- }();
437
-
438
- exports.hePinOneClickHeaderEnrichment = hePinOneClickHeaderEnrichment;
439
-
440
- var heMoRedirOneClickHeaderEnrichment = /*#__PURE__*/function () {
441
- var _ref12 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(_ref11) {
442
- var configs, strategyConfigs, defaultFlow, switchState, ipRangeName, flowObj, heResult, msisdn, _subscriptionUrl2, _redirectUrl2, operator;
443
-
444
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
445
- while (1) {
446
- switch (_context4.prev = _context4.next) {
447
- case 0:
448
- configs = _ref11.configs;
449
- strategyConfigs = configs.strategyConfigs;
450
- defaultFlow = strategyConfigs.default;
451
-
452
- switchState = function switchState(_ref13) {
453
- var flowObj = _ref13.flowObj,
454
- msisdn = _ref13.msisdn,
455
- operator = _ref13.operator;
456
- var isHeaderEnrichmentSuccess = !!(msisdn !== undefined && msisdn !== '');
457
-
458
- switch (flowObj.flow) {
459
- case 'oneClick':
460
- return oneClick({
461
- flowObj: flowObj,
462
- msisdn: msisdn,
463
- operator: operator,
464
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess,
465
- subscriptionUrl: subscriptionUrl,
466
- redirectUrl: redirectUrl
467
- });
468
-
469
- case 'moRedir':
470
- return moRedir({
471
- flowObj: flowObj,
472
- msisdn: msisdn,
473
- operator: operator,
474
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
475
- });
476
-
477
- default:
478
- return moRedir({
479
- flowObj: defaultFlow
480
- });
481
- }
482
- };
483
-
484
- _context4.next = 6;
485
- return (0, _tryGetIPRangeName.default)(window.pac_analytics.visitor);
486
-
487
- case 6:
488
- ipRangeName = _context4.sent;
489
-
490
- if (!(ipRangeName == null)) {
491
- _context4.next = 9;
492
- break;
493
- }
494
-
495
- return _context4.abrupt("return", moRedir({
496
- flowObj: defaultFlow
497
- }));
498
-
499
- case 9:
500
- _context4.prev = 9;
501
- flowObj = (0, _utils.determineFlowByOperator)({
502
- configs: configs,
503
- operator: ipRangeName.toUpperCase()
504
- });
505
-
506
- if (!(flowObj.flow === 'oneClick')) {
507
- _context4.next = 23;
508
- break;
509
- }
510
-
511
- _context4.next = 14;
512
- return (0, _utils.identifyUser)({
513
- configs: configs
514
- });
515
-
516
- case 14:
517
- heResult = _context4.sent;
518
- msisdn = heResult.msisdn, _subscriptionUrl2 = heResult.subscriptionUrl, _redirectUrl2 = heResult.redirectUrl;
519
- operator = heResult.operator ? heResult.operator.toUpperCase() : ipRangeName.toUpperCase();
520
-
521
- if (!(msisdn && msisdn !== '')) {
522
- _context4.next = 21;
523
- break;
524
- }
525
-
526
- _identifySlice.tracker.customEvent('identify-user', 'msisdn-detected', 'msisdn-detected', {
527
- msisdn: msisdn
528
- });
529
-
530
- flowObj = (0, _utils.determineFlowByOperator)({
531
- configs: configs,
532
- operator: operator
533
- });
534
- return _context4.abrupt("return", switchState({
535
- flowObj: flowObj,
536
- msisdn: msisdn,
537
- operator: operator,
538
- subscriptionUrl: _subscriptionUrl2,
539
- redirectUrl: _redirectUrl2
540
- }));
541
-
542
- case 21:
543
- flowObj = (0, _utils.determineFlowByOperator)({
544
- configs: configs,
545
- operator: operator
546
- });
547
- return _context4.abrupt("return", switchState({
548
- flowObj: flowObj,
549
- subscriptionUrl: _subscriptionUrl2,
550
- redirectUrl: _redirectUrl2,
551
- operator: operator
552
- }));
553
-
554
- case 23:
555
- return _context4.abrupt("return", moRedir({
556
- flowObj: defaultFlow
557
- }));
558
-
559
- case 26:
560
- _context4.prev = 26;
561
- _context4.t0 = _context4["catch"](9);
562
- console.warn(_context4.t0);
563
-
564
- _identifySlice.tracker.customEvent('identify-user', 'msisdn-detection-failure', 'msisdn-detection-failure', {
565
- errorType: _context4.t0.toString()
566
- });
567
-
568
- return _context4.abrupt("return", moRedir({
569
- flowObj: defaultFlow
570
- }));
571
-
572
- case 31:
573
- case "end":
574
- return _context4.stop();
575
- }
576
- }
577
- }, _callee4, null, [[9, 26]]);
578
- }));
579
-
580
- return function heMoRedirOneClickHeaderEnrichment(_x4) {
581
- return _ref12.apply(this, arguments);
582
- };
583
- }();
584
-
585
- exports.heMoRedirOneClickHeaderEnrichment = heMoRedirOneClickHeaderEnrichment;
586
-
587
- var identifyUserByHe = /*#__PURE__*/function () {
588
- var _ref15 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(_ref14) {
589
- var configs, strategy;
590
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
591
- while (1) {
592
- switch (_context5.prev = _context5.next) {
593
- case 0:
594
- configs = _ref14.configs;
595
- strategy = configs.strategy;
596
- _context5.prev = 2;
597
- _context5.t0 = strategy;
598
- _context5.next = _context5.t0 === 'pin-header-enrichment' ? 6 : _context5.t0 === 'he-pin-mo-redir-header-enrichment' ? 9 : _context5.t0 === 'he-pin-one-click-header-enrichment' ? 12 : _context5.t0 === 'he-mo-redir-one-click-header-enrichment' ? 15 : 18;
599
- break;
600
-
601
- case 6:
602
- _context5.next = 8;
603
- return pinHeaderEnrichment({
604
- configs: configs
605
- });
606
-
607
- case 8:
608
- return _context5.abrupt("return", _context5.sent);
609
-
610
- case 9:
611
- _context5.next = 11;
612
- return hePinMoRedirHeaderEnrichment({
613
- configs: configs
614
- });
615
-
616
- case 11:
617
- return _context5.abrupt("return", _context5.sent);
618
-
619
- case 12:
620
- _context5.next = 14;
621
- return hePinOneClickHeaderEnrichment({
622
- configs: configs
623
- });
624
-
625
- case 14:
626
- return _context5.abrupt("return", _context5.sent);
627
-
628
- case 15:
629
- _context5.next = 17;
630
- return heMoRedirOneClickHeaderEnrichment({
631
- configs: configs
632
- });
633
-
634
- case 17:
635
- return _context5.abrupt("return", _context5.sent);
636
-
637
- case 18:
638
- console.error('detectOperatorByIp', 'Strategy not supported');
639
- return _context5.abrupt("return", null);
640
-
641
- case 20:
642
- _context5.next = 26;
643
- break;
644
-
645
- case 22:
646
- _context5.prev = 22;
647
- _context5.t1 = _context5["catch"](2);
648
- console.error('detectOperatorByIp', _context5.t1); // You can choose to use the message attached to err or write a custom error
649
-
650
- return _context5.abrupt("return", null);
651
-
652
- case 26:
653
- case "end":
654
- return _context5.stop();
655
- }
656
- }
657
- }, _callee5, null, [[2, 22]]);
658
- }));
659
-
660
- return function identifyUserByHe(_x5) {
661
- return _ref15.apply(this, arguments);
662
- };
663
- }();
664
-
665
- exports.identifyUserByHe = identifyUserByHe;
@@ -1 +0,0 @@
1
- "use strict";