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,783 +1 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
- require("core-js/modules/es.symbol");
6
-
7
- require("core-js/modules/es.symbol.description");
8
-
9
- require("core-js/modules/es.symbol.iterator");
10
-
11
- require("core-js/modules/es.array.iterator");
12
-
13
- require("core-js/modules/es.object.get-own-property-descriptor");
14
-
15
- require("core-js/modules/es.object.to-string");
16
-
17
- require("core-js/modules/es.promise");
18
-
19
- require("core-js/modules/es.regexp.to-string");
20
-
21
- require("core-js/modules/es.string.iterator");
22
-
23
- require("core-js/modules/es.weak-map");
24
-
25
- require("core-js/modules/web.dom-collections.iterator");
26
-
27
- Object.defineProperty(exports, "__esModule", {
28
- value: true
29
- });
30
- exports.default = identify_user;
31
- exports.he_pin_mo_redir_header_enrichment = exports.he_mo_redir_one_click_header_enrichment = exports.he_pin_one_click_header_enrichment = exports.pin_header_enrichment = void 0;
32
-
33
- require("regenerator-runtime/runtime");
34
-
35
- var _ = require("..");
36
-
37
- var RDS = _interopRequireWildcard(require("../../../common-types/RemoteDataState"));
38
-
39
- var _tryGetIPRangeName = _interopRequireDefault(require("../../../ips/tryGetIPRangeName"));
40
-
41
- var _utils = require("../utils");
42
-
43
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
44
-
45
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
46
-
47
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
48
-
49
- 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); } }
50
-
51
- 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); }); }; }
52
-
53
- function identify_user() {
54
- return function (dispatch) {
55
- try {
56
- dispatch({
57
- type: 'HE_IDENTIFY',
58
- payload: {
59
- type: 'HE_IDENTIFY',
60
- result: RDS.Loading()
61
- }
62
- });
63
-
64
- var _getConfig = (0, _utils.getConfig)(),
65
- strategy = _getConfig.strategy,
66
- strategyConfigs = _getConfig.strategyConfigs;
67
-
68
- var defaultFlow = strategyConfigs.default;
69
-
70
- switch (strategy) {
71
- case 'pin-header-enrichment':
72
- return dispatch(pin_header_enrichment(defaultFlow));
73
-
74
- case 'he-pin-mo-redir-header-enrichment':
75
- return dispatch(he_pin_mo_redir_header_enrichment(defaultFlow));
76
-
77
- case 'he-pin-one-click-header-enrichment':
78
- return dispatch(he_pin_one_click_header_enrichment(defaultFlow));
79
-
80
- case 'he-mo-redir-one-click-header-enrichment':
81
- return dispatch(he_mo_redir_one_click_header_enrichment(defaultFlow));
82
- }
83
- } catch (err) {
84
- dispatch({
85
- type: 'HE_IDENTIFY',
86
- payload: {
87
- type: 'HE_IDENTIFY',
88
- result: RDS.Failure(err)
89
- }
90
- });
91
- }
92
- };
93
- }
94
-
95
- var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
96
- return /*#__PURE__*/function () {
97
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(dispatch) {
98
- var ipRangeName, heResult, flowObj, msisdn, operator;
99
- return regeneratorRuntime.wrap(function _callee$(_context) {
100
- while (1) {
101
- switch (_context.prev = _context.next) {
102
- case 0:
103
- _context.prev = 0;
104
- _context.next = 3;
105
- return (0, _tryGetIPRangeName.default)(window.pac_analytics.visitor);
106
-
107
- case 3:
108
- ipRangeName = _context.sent;
109
- console.log('IP ipRangeName', ipRangeName);
110
-
111
- if (!(ipRangeName == null)) {
112
- _context.next = 8;
113
- break;
114
- }
115
-
116
- _.tracker.sendOptInFlowEvent('Pin');
117
-
118
- return _context.abrupt("return", dispatch({
119
- type: 'IDENTIFY_FLOW_BY_HE',
120
- payload: {
121
- type: 'PIN',
122
- result: {
123
- nextAction: 'submitMSISDNAction',
124
- config: defaultFlow.flowConfig
125
- }
126
- }
127
- }));
128
-
129
- case 8:
130
- _context.next = 10;
131
- return (0, _utils.identifyUser)();
132
-
133
- case 10:
134
- heResult = _context.sent;
135
- flowObj = defaultFlow;
136
-
137
- if (!(heResult.msisdn !== undefined && heResult.msisdn !== '')) {
138
- _context.next = 18;
139
- break;
140
- }
141
-
142
- msisdn = heResult.msisdn;
143
- operator = heResult.operator;
144
-
145
- _.tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-detected', {
146
- msisdn: msisdn
147
- });
148
-
149
- _.tracker.sendOptInFlowEvent('Hybrid Pin');
150
-
151
- return _context.abrupt("return", dispatch({
152
- type: 'IDENTIFY_FLOW_BY_HE',
153
- payload: {
154
- type: 'PIN',
155
- result: {
156
- nextAction: 'submitMSISDNAction',
157
- config: flowObj.flowConfig,
158
- msisdn: msisdn,
159
- rockman_id: flowObj.rockman_id,
160
- isHeaderEnrichmentSuccess: true
161
- }
162
- }
163
- }));
164
-
165
- case 18:
166
- _.tracker.sendOptInFlowEvent('Pin');
167
-
168
- return _context.abrupt("return", dispatch({
169
- type: 'IDENTIFY_FLOW_BY_HE',
170
- payload: {
171
- type: 'PIN',
172
- result: {
173
- nextAction: 'submitMSISDNAction',
174
- config: flowObj.flowConfig
175
- }
176
- }
177
- }));
178
-
179
- case 22:
180
- _context.prev = 22;
181
- _context.t0 = _context["catch"](0);
182
- console.warn(_context.t0);
183
-
184
- _.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-detection-failure', {
185
- errorType: _context.t0.toString()
186
- });
187
-
188
- _.tracker.sendOptInFlowEvent('Pin');
189
-
190
- dispatch({
191
- type: 'IDENTIFY_FLOW_BY_HE',
192
- payload: {
193
- type: 'PIN',
194
- result: {
195
- nextAction: 'submitMSISDNAction',
196
- config: defaultFlow.flowConfig
197
- }
198
- }
199
- });
200
-
201
- case 28:
202
- case "end":
203
- return _context.stop();
204
- }
205
- }
206
- }, _callee, null, [[0, 22]]);
207
- }));
208
-
209
- return function (_x) {
210
- return _ref.apply(this, arguments);
211
- };
212
- }();
213
- };
214
-
215
- exports.pin_header_enrichment = pin_header_enrichment;
216
-
217
- var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrichment(defaultFlow) {
218
- return /*#__PURE__*/function () {
219
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(dispatch) {
220
- var switchState, ipRangeName, flowObj, heResult, msisdn, subscription_url, redirect_url, operator, _flowObj, _flowObj2;
221
-
222
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
223
- while (1) {
224
- switch (_context2.prev = _context2.next) {
225
- case 0:
226
- switchState = function switchState(_ref3) {
227
- var flowObj = _ref3.flowObj,
228
- msisdn = _ref3.msisdn,
229
- operator = _ref3.operator,
230
- subscription_url = _ref3.subscription_url,
231
- redirect_url = _ref3.redirect_url;
232
- var isHeaderEnrichmentSuccess = !!(msisdn !== undefined && msisdn !== '');
233
-
234
- switch (flowObj.flow) {
235
- case 'oneClick':
236
- _.tracker.sendOptInFlowEvent('3G click');
237
-
238
- return dispatch({
239
- type: 'IDENTIFY_FLOW_BY_HE',
240
- payload: {
241
- type: 'ONE_CLICK',
242
- result: {
243
- nextAction: 'getRedirectUrlAction',
244
- config: flowObj.flowConfig,
245
- operator: flowObj.operator,
246
- subscription_url: subscription_url || null,
247
- redirect_url: redirect_url || null
248
- }
249
- }
250
- });
251
-
252
- case 'pin':
253
- if (isHeaderEnrichmentSuccess == true) {
254
- _.tracker.sendOptInFlowEvent('Hybrid Pin');
255
- } else {
256
- _.tracker.sendOptInFlowEvent('Pin');
257
- }
258
-
259
- return dispatch({
260
- type: 'IDENTIFY_FLOW_BY_HE',
261
- payload: {
262
- type: 'PIN',
263
- result: {
264
- nextAction: 'submitMSISDNAction',
265
- config: flowObj.flowConfig,
266
- msisdn: msisdn,
267
- rockman_id: flowObj.rockman_id,
268
- operator: operator,
269
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
270
- }
271
- }
272
- });
273
-
274
- default:
275
- _.tracker.sendOptInFlowEvent('Pin');
276
-
277
- return dispatch({
278
- type: 'IDENTIFY_FLOW_BY_HE',
279
- payload: {
280
- type: 'PIN',
281
- result: {
282
- nextAction: 'submitMSISDNAction',
283
- config: defaultFlow.flowConfig,
284
- rockman_id: defaultFlow.rockman_id
285
- }
286
- }
287
- });
288
- }
289
- };
290
-
291
- _context2.next = 3;
292
- return (0, _tryGetIPRangeName.default)(window.pac_analytics.visitor);
293
-
294
- case 3:
295
- ipRangeName = _context2.sent;
296
- console.log('IP ipRangeName', ipRangeName);
297
-
298
- if (!(ipRangeName == null)) {
299
- _context2.next = 7;
300
- break;
301
- }
302
-
303
- return _context2.abrupt("return", dispatch({
304
- type: 'IDENTIFY_FLOW_BY_HE',
305
- payload: {
306
- type: 'PIN',
307
- result: {
308
- nextAction: 'submitMSISDNAction',
309
- config: defaultFlow.flowConfig,
310
- rockman_id: defaultFlow.rockman_id
311
- }
312
- }
313
- }));
314
-
315
- case 7:
316
- _context2.prev = 7;
317
- flowObj = (0, _utils.determineFlowByOperator)(ipRangeName.toUpperCase());
318
-
319
- if (!(flowObj.flow == 'oneClick')) {
320
- _context2.next = 18;
321
- break;
322
- }
323
-
324
- _context2.next = 12;
325
- return (0, _utils.identifyUser)({
326
- operator: ipRangeName
327
- });
328
-
329
- case 12:
330
- heResult = _context2.sent;
331
- msisdn = heResult.msisdn, subscription_url = heResult.subscription_url, redirect_url = heResult.redirect_url;
332
- operator = heResult.operator ? heResult.operator.toUpperCase() : ipRangeName.toUpperCase();
333
-
334
- if (msisdn && msisdn !== '') {
335
- _.tracker.advancedInFlow('identify-user', 'msisdn-detected', {
336
- msisdn: msisdn
337
- });
338
-
339
- _flowObj = (0, _utils.determineFlowByOperator)(operator);
340
- switchState({
341
- flowObj: _flowObj,
342
- msisdn: msisdn,
343
- operator: operator,
344
- subscription_url: subscription_url,
345
- redirect_url: redirect_url
346
- });
347
- } else {
348
- _flowObj2 = (0, _utils.determineFlowByOperator)(operator);
349
- switchState({
350
- flowObj: _flowObj2,
351
- redirect_url: redirect_url,
352
- subscription_url: subscription_url,
353
- operator: operator
354
- });
355
- }
356
-
357
- _context2.next = 19;
358
- break;
359
-
360
- case 18:
361
- return _context2.abrupt("return", dispatch({
362
- type: 'IDENTIFY_FLOW_BY_HE',
363
- payload: {
364
- type: 'PIN',
365
- result: {
366
- nextAction: 'submitMSISDNAction',
367
- config: defaultFlow.flowConfig,
368
- rockman_id: defaultFlow.rockman_id
369
- }
370
- }
371
- }));
372
-
373
- case 19:
374
- _context2.next = 27;
375
- break;
376
-
377
- case 21:
378
- _context2.prev = 21;
379
- _context2.t0 = _context2["catch"](7);
380
- console.warn(_context2.t0);
381
-
382
- _.tracker.recedeInFlow('identify-user', 'msisdn-detection-failure', {
383
- errorType: _context2.t0.toString()
384
- });
385
-
386
- _.tracker.sendOptInFlowEvent('Pin');
387
-
388
- dispatch({
389
- type: 'IDENTIFY_FLOW_BY_HE',
390
- payload: {
391
- type: 'PIN',
392
- result: {
393
- nextAction: 'submitMSISDNAction',
394
- config: defaultFlow.flowConfig
395
- }
396
- }
397
- });
398
-
399
- case 27:
400
- case "end":
401
- return _context2.stop();
402
- }
403
- }
404
- }, _callee2, null, [[7, 21]]);
405
- }));
406
-
407
- return function (_x2) {
408
- return _ref2.apply(this, arguments);
409
- };
410
- }();
411
- };
412
-
413
- exports.he_pin_one_click_header_enrichment = he_pin_one_click_header_enrichment;
414
-
415
- var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_header_enrichment(defaultFlow) {
416
- return /*#__PURE__*/function () {
417
- var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(dispatch) {
418
- var switchState, ipRangeName, flowObj, heResult, msisdn, subscription_url, redirect_url, operator, _flowObj3, _flowObj4;
419
-
420
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
421
- while (1) {
422
- switch (_context3.prev = _context3.next) {
423
- case 0:
424
- switchState = function switchState(_ref5) {
425
- var flowObj = _ref5.flowObj,
426
- msisdn = _ref5.msisdn,
427
- operator = _ref5.operator,
428
- subscription_url = _ref5.subscription_url,
429
- redirect_url = _ref5.redirect_url;
430
- var isHeaderEnrichmentSuccess = !!(msisdn !== undefined && msisdn !== '');
431
-
432
- switch (flowObj.flow) {
433
- case 'oneClick':
434
- _.tracker.sendOptInFlowEvent('3G click');
435
-
436
- return dispatch({
437
- type: 'IDENTIFY_FLOW_BY_HE',
438
- payload: {
439
- type: 'ONE_CLICK',
440
- result: {
441
- nextAction: 'getRedirectUrlAction',
442
- config: flowObj.flowConfig,
443
- operator: flowObj.operator,
444
- subscription_url: subscription_url || null,
445
- redirect_url: redirect_url || null
446
- }
447
- }
448
- });
449
-
450
- case 'moRedir':
451
- _.tracker.sendOptInFlowEvent('Redirect');
452
-
453
- return dispatch({
454
- type: 'IDENTIFY_FLOW_BY_HE',
455
- payload: {
456
- type: 'MO_REDIR',
457
- result: {
458
- nextAction: 'submitMSISDNAction',
459
- config: flowObj.flowConfig,
460
- msisdn: msisdn,
461
- rockman_id: flowObj.rockman_id,
462
- operator: operator,
463
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
464
- }
465
- }
466
- });
467
-
468
- default:
469
- _.tracker.sendOptInFlowEvent('Redirect');
470
-
471
- return dispatch({
472
- type: 'IDENTIFY_FLOW_BY_HE',
473
- payload: {
474
- type: 'MO_REDIR',
475
- result: {
476
- nextAction: 'submitMSISDNAction',
477
- config: defaultFlow.flowConfig,
478
- rockman_id: defaultFlow.rockman_id
479
- }
480
- }
481
- });
482
- }
483
- };
484
-
485
- _context3.next = 3;
486
- return (0, _tryGetIPRangeName.default)(window.pac_analytics.visitor);
487
-
488
- case 3:
489
- ipRangeName = _context3.sent;
490
- console.log('IP ipRangeName', ipRangeName);
491
-
492
- if (!(ipRangeName == null)) {
493
- _context3.next = 7;
494
- break;
495
- }
496
-
497
- return _context3.abrupt("return", dispatch({
498
- type: 'IDENTIFY_FLOW_BY_HE',
499
- payload: {
500
- type: 'MO_REDIR',
501
- result: {
502
- nextAction: 'submitMSISDNAction',
503
- config: defaultFlow.flowConfig,
504
- rockman_id: defaultFlow.rockman_id
505
- }
506
- }
507
- }));
508
-
509
- case 7:
510
- _context3.prev = 7;
511
- flowObj = (0, _utils.determineFlowByOperator)(ipRangeName.toUpperCase());
512
-
513
- if (!(flowObj.flow == 'oneClick')) {
514
- _context3.next = 18;
515
- break;
516
- }
517
-
518
- _context3.next = 12;
519
- return (0, _utils.identifyUser)({
520
- operator: ipRangeName
521
- });
522
-
523
- case 12:
524
- heResult = _context3.sent;
525
- msisdn = heResult.msisdn, subscription_url = heResult.subscription_url, redirect_url = heResult.redirect_url;
526
- operator = heResult.operator ? heResult.operator.toUpperCase() : ipRangeName.toUpperCase();
527
-
528
- if (msisdn && msisdn !== '') {
529
- _.tracker.advancedInFlow('identify-user', 'msisdn-detected', {
530
- msisdn: msisdn
531
- });
532
-
533
- _flowObj3 = (0, _utils.determineFlowByOperator)(operator);
534
- switchState({
535
- flowObj: _flowObj3,
536
- msisdn: msisdn,
537
- operator: operator,
538
- subscription_url: subscription_url,
539
- redirect_url: redirect_url
540
- });
541
- } else {
542
- _flowObj4 = (0, _utils.determineFlowByOperator)(operator);
543
- switchState({
544
- flowObj: _flowObj4,
545
- redirect_url: redirect_url,
546
- subscription_url: subscription_url,
547
- operator: operator
548
- });
549
- }
550
-
551
- _context3.next = 19;
552
- break;
553
-
554
- case 18:
555
- return _context3.abrupt("return", dispatch({
556
- type: 'IDENTIFY_FLOW_BY_HE',
557
- payload: {
558
- type: 'MO_REDIR',
559
- result: {
560
- nextAction: 'submitMSISDNAction',
561
- config: defaultFlow.flowConfig,
562
- rockman_id: defaultFlow.rockman_id
563
- }
564
- }
565
- }));
566
-
567
- case 19:
568
- _context3.next = 27;
569
- break;
570
-
571
- case 21:
572
- _context3.prev = 21;
573
- _context3.t0 = _context3["catch"](7);
574
- console.warn(_context3.t0);
575
-
576
- _.tracker.recedeInFlow('identify-user', 'msisdn-detection-failure', {
577
- errorType: _context3.t0.toString()
578
- });
579
-
580
- _.tracker.sendOptInFlowEvent('Pin');
581
-
582
- dispatch({
583
- type: 'IDENTIFY_FLOW_BY_HE',
584
- payload: {
585
- type: 'MO_REDIR',
586
- result: {
587
- nextAction: 'submitMSISDNAction',
588
- config: defaultFlow.flowConfig
589
- }
590
- }
591
- });
592
-
593
- case 27:
594
- case "end":
595
- return _context3.stop();
596
- }
597
- }
598
- }, _callee3, null, [[7, 21]]);
599
- }));
600
-
601
- return function (_x3) {
602
- return _ref4.apply(this, arguments);
603
- };
604
- }();
605
- };
606
-
607
- exports.he_mo_redir_one_click_header_enrichment = he_mo_redir_one_click_header_enrichment;
608
-
609
- var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichment(defaultFlow) {
610
- return /*#__PURE__*/function () {
611
- var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(dispatch) {
612
- var switchState, heResult, msisdn, operator, flowObj, _flowObj5, _flowObj6, _flowObj7;
613
-
614
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
615
- while (1) {
616
- switch (_context4.prev = _context4.next) {
617
- case 0:
618
- switchState = function switchState(flowObj, msisdn, operator) {
619
- var isHeaderEnrichmentSuccess = !!(msisdn !== undefined && msisdn !== '');
620
-
621
- switch (flowObj.flow) {
622
- case 'moRedir':
623
- _.tracker.sendOptInFlowEvent('Redirect');
624
-
625
- return dispatch({
626
- type: 'IDENTIFY_FLOW_BY_HE',
627
- payload: {
628
- type: 'MO_REDIR',
629
- result: {
630
- nextAction: 'submitMSISDNAction',
631
- config: flowObj.flowConfig,
632
- msisdn: msisdn,
633
- rockman_id: flowObj.rockman_id,
634
- operator: operator,
635
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
636
- }
637
- }
638
- });
639
-
640
- case 'pin':
641
- if (isHeaderEnrichmentSuccess == true) {
642
- _.tracker.sendOptInFlowEvent('Hybrid Pin');
643
- } else {
644
- _.tracker.sendOptInFlowEvent('Pin');
645
- }
646
-
647
- return dispatch({
648
- type: 'IDENTIFY_FLOW_BY_HE',
649
- payload: {
650
- type: 'PIN',
651
- result: {
652
- nextAction: 'submitMSISDNAction',
653
- config: flowObj.flowConfig,
654
- msisdn: msisdn,
655
- rockman_id: flowObj.rockman_id,
656
- operator: operator,
657
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
658
- }
659
- }
660
- });
661
-
662
- default:
663
- _.tracker.sendOptInFlowEvent('Pin');
664
-
665
- return dispatch({
666
- type: 'IDENTIFY_FLOW_BY_HE',
667
- payload: {
668
- type: 'PIN',
669
- result: {
670
- nextAction: 'submitMSISDNAction',
671
- config: defaultFlow.flowConfig,
672
- rockman_id: defaultFlow.rockman_id
673
- }
674
- }
675
- });
676
- }
677
- };
678
-
679
- _context4.prev = 1;
680
- _context4.next = 4;
681
- return (0, _utils.identifyUser)();
682
-
683
- case 4:
684
- heResult = _context4.sent;
685
-
686
- if (!(heResult.msisdn !== undefined && heResult.msisdn !== '')) {
687
- _context4.next = 20;
688
- break;
689
- }
690
-
691
- msisdn = heResult.msisdn;
692
- operator = heResult.operator;
693
-
694
- _.tracker.advancedInFlow('identify-user', 'msisdn-detected', {
695
- msisdn: msisdn
696
- });
697
-
698
- if (!(!!operator && operator !== '')) {
699
- _context4.next = 14;
700
- break;
701
- }
702
-
703
- flowObj = (0, _utils.determineFlowByOperator)(operator);
704
- switchState(flowObj, msisdn, operator);
705
- _context4.next = 18;
706
- break;
707
-
708
- case 14:
709
- _context4.next = 16;
710
- return (0, _utils.determineFlowByOperatorFromIp)();
711
-
712
- case 16:
713
- _flowObj5 = _context4.sent;
714
- switchState(_flowObj5, msisdn);
715
-
716
- case 18:
717
- _context4.next = 24;
718
- break;
719
-
720
- case 20:
721
- _context4.next = 22;
722
- return (0, _utils.determineFlowByOperatorFromIp)();
723
-
724
- case 22:
725
- _flowObj6 = _context4.sent;
726
- switchState(_flowObj6);
727
-
728
- case 24:
729
- _context4.next = 42;
730
- break;
731
-
732
- case 26:
733
- _context4.prev = 26;
734
- _context4.t0 = _context4["catch"](1);
735
- console.warn(_context4.t0);
736
-
737
- _.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-detection-failure', {
738
- errorType: _context4.t0.toString()
739
- });
740
-
741
- _context4.prev = 30;
742
- _context4.next = 33;
743
- return (0, _utils.determineFlowByOperatorFromIp)();
744
-
745
- case 33:
746
- _flowObj7 = _context4.sent;
747
- switchState(_flowObj7);
748
- _context4.next = 42;
749
- break;
750
-
751
- case 37:
752
- _context4.prev = 37;
753
- _context4.t1 = _context4["catch"](30);
754
- console.warn(_context4.t1);
755
-
756
- _.tracker.sendOptInFlowEvent('Pin');
757
-
758
- dispatch({
759
- type: 'IDENTIFY_FLOW_BY_HE',
760
- payload: {
761
- type: 'PIN',
762
- result: {
763
- nextAction: 'submitMSISDNAction',
764
- config: defaultFlow.flowConfig
765
- }
766
- }
767
- });
768
-
769
- case 42:
770
- case "end":
771
- return _context4.stop();
772
- }
773
- }
774
- }, _callee4, null, [[1, 26], [30, 37]]);
775
- }));
776
-
777
- return function (_x4) {
778
- return _ref6.apply(this, arguments);
779
- };
780
- }();
781
- };
782
-
783
- exports.he_pin_mo_redir_header_enrichment = he_pin_mo_redir_header_enrichment;
1
+ "use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.symbol.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.symbol.async-iterator.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=identify_user,exports.pin_header_enrichment=exports.he_pin_one_click_header_enrichment=exports.he_pin_mo_redir_header_enrichment=exports.he_mo_redir_one_click_header_enrichment=void 0,require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.string.includes.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js");var _=require(".."),RDS=_interopRequireWildcard(require("../../../common-types/RemoteDataState")),_tryGetIPRangeName=_interopRequireDefault(require("../../../ips/tryGetIPRangeName")),_utilities=require("../../../utilities"),_utils=require("../utils");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!=key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _regeneratorRuntime(){"use strict";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}(innerFn,self,context),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg)})})}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject)},function(err){invoke("throw",err,resolve,reject)}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result)},function(error){return invoke("throw",error,resolve,reject)})}reject(record.arg)}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject)})}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(void 0===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method")}return ContinueSentinel}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";try{define({},"")}catch(err){define=function(obj,key,value){return obj[key]=value}}exports.wrap=wrap;var ContinueSentinel={},IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next()})},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this}),define(Gp,"toString",function(){return"[object Generator]"}),exports.keys=function(object){var keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}if(this.done)throw exception;for(var context=this,i=this.tryEntries.length-1;0<=i;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(!hasCatch){if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}}},abrupt:function abrupt(type,arg){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel},catch:function _catch(tryLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}function identify_user(){return function(dispatch){try{var _getConfig=(0,_utils.getConfig)(),strategy=_getConfig.strategy,strategyConfigs=_getConfig.strategyConfigs,defaultFlow=strategyConfigs.default;switch(strategy){case"pin-header-enrichment":return dispatch(pin_header_enrichment(defaultFlow));case"he-pin-mo-redir-header-enrichment":return dispatch(he_pin_mo_redir_header_enrichment(defaultFlow));case"he-pin-one-click-header-enrichment":return dispatch(he_pin_one_click_header_enrichment(defaultFlow));case"he-mo-redir-one-click-header-enrichment":return dispatch(he_mo_redir_one_click_header_enrichment(defaultFlow));}}catch(err){dispatch({type:"HE_IDENTIFY",payload:{type:"HE_IDENTIFY",result:RDS.Failure(err)}})}}}var pin_header_enrichment=function(defaultFlow){return function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(dispatch){var _ipRangeName$toLowerC,_window,_window$pac_analytics,_window$pac_analytics2,_window$pac_analytics3,ipRangeName,isIPInRnge,heResult,flowObj,msisdn;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:return _context.prev=0,_context.next=3,(0,_tryGetIPRangeName.default)(window.pac_analytics.visitor);case 3:if(ipRangeName=_context.sent,isIPInRnge=null!==ipRangeName||(null===ipRangeName||void 0===ipRangeName||null===(_ipRangeName$toLowerC=ipRangeName.toLowerCase())||void 0===_ipRangeName$toLowerC?void 0:_ipRangeName$toLowerC.includes("".concat(null===(_window=window)||void 0===_window||null===(_window$pac_analytics=_window.pac_analytics)||void 0===_window$pac_analytics||null===(_window$pac_analytics2=_window$pac_analytics.visitor)||void 0===_window$pac_analytics2||null===(_window$pac_analytics3=_window$pac_analytics2.country)||void 0===_window$pac_analytics3?void 0:_window$pac_analytics3.toLowerCase()))),isIPInRnge&&(0,_utils.searchToObject)().msisdn){_context.next=8;break}return _.tracker.sendOptInFlowEvent("Pin"),_context.abrupt("return",dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:defaultFlow.flowConfig}}}));case 8:return _context.next=10,(0,_utils.identifyUser)();case 10:if(heResult=_context.sent,flowObj=defaultFlow,void 0===heResult.msisdn||""===heResult.msisdn){_context.next=17;break}return msisdn=heResult.msisdn,_.tracker.customEvent("Flow","advance-auto","msisdn-detected",{msisdn:msisdn}),_.tracker.sendOptInFlowEvent("Hybrid Pin"),_context.abrupt("return",dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:flowObj.flowConfig,msisdn:msisdn,rockman_id:flowObj.rockman_id,isHeaderEnrichmentSuccess:!0}}}));case 17:return _.tracker.sendOptInFlowEvent("Pin"),_context.abrupt("return",dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:flowObj.flowConfig}}}));case 21:_context.prev=21,_context.t0=_context["catch"](0),console.warn(_context.t0),_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:null===_context.t0||void 0===_context.t0?void 0:_context.t0.message}),_.tracker.sendOptInFlowEvent("Pin"),dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:defaultFlow.flowConfig}}});case 27:case"end":return _context.stop();}},_callee,null,[[0,21]])}));return function(_x){return _ref.apply(this,arguments)}}()};exports.pin_header_enrichment=pin_header_enrichment;var he_pin_one_click_header_enrichment=function he_pin_one_click_header_enrichment(defaultFlow){return function(){var _ref2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(dispatch){var _window2,_window2$pac_analytic,_window2$pac_analytic2,_window2$pac_analytic3,_window2$pac_analytic4,search,switchState,ipRangeName,_window3,_window3$pac_analytic,_window3$pac_analytic2,mapIpRangeToAgency,flowObj,heResult,msisdn,subscription_url,redirect_url,operator;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:if(search=(0,_utils.searchToObject)(),switchState=function switchState(_ref3){var flowObj=_ref3.flowObj,msisdn=_ref3.msisdn,operator=_ref3.operator,subscription_url=_ref3.subscription_url,redirect_url=_ref3.redirect_url,isHeaderEnrichmentSuccess=void 0!==msisdn&&""!==msisdn;switch(flowObj.flow){case"oneClick":return _.tracker.sendOptInFlowEvent("3G click"),dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"ONE_CLICK",result:{nextAction:"getRedirectUrlAction",config:flowObj.flowConfig,operator:flowObj.operator,subscription_url:subscription_url||null,redirect_url:redirect_url||null}}});case"pin":return!0===isHeaderEnrichmentSuccess?_.tracker.sendOptInFlowEvent("Hybrid Pin"):_.tracker.sendOptInFlowEvent("Pin"),dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:flowObj.flowConfig,msisdn:msisdn,rockman_id:flowObj.rockman_id,operator:operator,isHeaderEnrichmentSuccess:isHeaderEnrichmentSuccess}}});default:return _.tracker.sendOptInFlowEvent("Pin"),dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:defaultFlow.flowConfig,rockman_id:defaultFlow.rockman_id}}});}},_context2.t0=null===search||void 0===search?void 0:search.operator,_context2.t0){_context2.next=7;break}return _context2.next=6,(0,_tryGetIPRangeName.default)(window.pac_analytics.visitor);case 6:_context2.t0=_context2.sent;case 7:if(ipRangeName=_context2.t0,null!==(_window2=window)&&void 0!==_window2&&null!==(_window2$pac_analytic=_window2.pac_analytics)&&void 0!==_window2$pac_analytic&&null!==(_window2$pac_analytic2=_window2$pac_analytic.visitor)&&void 0!==_window2$pac_analytic2&&null!==(_window2$pac_analytic3=_window2$pac_analytic2.ip_range_name)&&void 0!==_window2$pac_analytic3&&null!==(_window2$pac_analytic4=_window2$pac_analytic3.toLowerCase())&&void 0!==_window2$pac_analytic4&&_window2$pac_analytic4.includes("cz")){_context2.next=11;break}return _.tracker.sendOptInFlowEvent("Pin"),_context2.abrupt("return",dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:defaultFlow.flowConfig,rockman_id:defaultFlow.rockman_id}}}));case 11:if(_context2.prev=11,mapIpRangeToAgency={om_ooredoo:"o2_ooredoo"},flowObj=(0,_utils.determineFlowByOperator)((0,_utilities.hasNumber)(null===(_window3=window)||void 0===_window3||null===(_window3$pac_analytic=_window3.pac_analytics)||void 0===_window3$pac_analytic||null===(_window3$pac_analytic2=_window3$pac_analytic.visitor)||void 0===_window3$pac_analytic2?void 0:_window3$pac_analytic2.country)?mapIpRangeToAgency[ipRangeName]:ipRangeName),"oneClick"!==flowObj.flow){_context2.next=23;break}return _context2.next=17,(0,_utils.identifyUser)({operator:ipRangeName});case 17:heResult=_context2.sent,msisdn=heResult.msisdn,subscription_url=heResult.subscription_url,redirect_url=heResult.redirect_url,operator=heResult.operator?heResult.operator.toUpperCase():ipRangeName.toUpperCase(),msisdn&&""!==msisdn?(_.tracker.customEvent("Flow","advance-auto","msisdn-detected",{msisdn:msisdn}),switchState({flowObj:flowObj,msisdn:msisdn,operator:operator,subscription_url:subscription_url,redirect_url:redirect_url})):switchState({flowObj:flowObj,redirect_url:redirect_url,subscription_url:subscription_url,operator:operator}),_context2.next=25;break;case 23:return _.tracker.sendOptInFlowEvent("Pin"),_context2.abrupt("return",dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:defaultFlow.flowConfig,rockman_id:defaultFlow.rockman_id}}}));case 25:_context2.next=33;break;case 27:_context2.prev=27,_context2.t1=_context2["catch"](11),console.warn(_context2.t1),_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:null===_context2.t1||void 0===_context2.t1?void 0:_context2.t1.message}),_.tracker.sendOptInFlowEvent("Pin"),dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:defaultFlow.flowConfig}}});case 33:case"end":return _context2.stop();}},_callee2,null,[[11,27]])}));return function(_x2){return _ref2.apply(this,arguments)}}()};exports.he_pin_one_click_header_enrichment=he_pin_one_click_header_enrichment;var he_mo_redir_one_click_header_enrichment=function he_mo_redir_one_click_header_enrichment(defaultFlow){return function(){var _ref4=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(dispatch){var switchState,searchObj,ipRangeName,flowObj,heResult,msisdn,subscription_url,redirect_url,operator;return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:if(switchState=function switchState(_ref5){var flowObj=_ref5.flowObj,msisdn=_ref5.msisdn,operator=_ref5.operator,subscription_url=_ref5.subscription_url,redirect_url=_ref5.redirect_url,isHeaderEnrichmentSuccess=void 0!==msisdn&&""!==msisdn;switch(flowObj.flow){case"oneClick":return _.tracker.sendOptInFlowEvent("3G click"),dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"ONE_CLICK",result:{nextAction:"getRedirectUrlAction",config:flowObj.flowConfig,operator:flowObj.operator,subscription_url:subscription_url||null,redirect_url:redirect_url||null}}});case"moRedir":return _.tracker.sendOptInFlowEvent("Redirect"),dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"MO_REDIR",result:{nextAction:"submitMSISDNAction",config:flowObj.flowConfig,msisdn:msisdn,rockman_id:flowObj.rockman_id,operator:operator,isHeaderEnrichmentSuccess:isHeaderEnrichmentSuccess}}});default:return _.tracker.sendOptInFlowEvent("Redirect"),dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"MO_REDIR",result:{nextAction:"submitMSISDNAction",config:defaultFlow.flowConfig,rockman_id:defaultFlow.rockman_id}}});}},searchObj=(0,_utils.searchToObject)(),_context3.t1=null===searchObj||void 0===searchObj?void 0:searchObj.operator,_context3.t1){_context3.next=7;break}return _context3.next=6,(0,_tryGetIPRangeName.default)(window.pac_analytics.visitor);case 6:_context3.t1=_context3.sent;case 7:if(_context3.t0=_context3.t1,_context3.t0){_context3.next=10;break}_context3.t0=null;case 10:if(ipRangeName=_context3.t0,null!==ipRangeName){_context3.next=14;break}return _.tracker.sendOptInFlowEvent("Redirect"),_context3.abrupt("return",dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"MO_REDIR",result:{nextAction:"submitMSISDNAction",config:defaultFlow.flowConfig,rockman_id:defaultFlow.rockman_id}}}));case 14:if(_context3.prev=14,flowObj=(0,_utils.determineFlowByOperator)(ipRangeName.toUpperCase()),"oneClick"!==flowObj.flow){_context3.next=25;break}return _context3.next=19,(0,_utils.identifyUser)({operator:ipRangeName});case 19:heResult=_context3.sent,msisdn=heResult.msisdn,subscription_url=heResult.subscription_url,redirect_url=heResult.redirect_url,operator=heResult.operator?heResult.operator.toUpperCase():ipRangeName.toUpperCase(),msisdn&&""!==msisdn?(_.tracker.customEvent("Flow","advance-auto","msisdn-detected",{msisdn:msisdn}),switchState({flowObj:flowObj,msisdn:msisdn,operator:operator,subscription_url:subscription_url,redirect_url:redirect_url})):switchState({flowObj:flowObj,redirect_url:redirect_url,subscription_url:subscription_url,operator:operator}),_context3.next=27;break;case 25:return _.tracker.sendOptInFlowEvent("Redirect"),_context3.abrupt("return",dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"MO_REDIR",result:{nextAction:"submitMSISDNAction",config:defaultFlow.flowConfig,rockman_id:defaultFlow.rockman_id}}}));case 27:_context3.next=35;break;case 29:_context3.prev=29,_context3.t2=_context3["catch"](14),console.warn(_context3.t2),_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:null===_context3.t2||void 0===_context3.t2?void 0:_context3.t2.message}),_.tracker.sendOptInFlowEvent("Redirect"),dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"MO_REDIR",result:{nextAction:"submitMSISDNAction",config:defaultFlow.flowConfig}}});case 35:case"end":return _context3.stop();}},_callee3,null,[[14,29]])}));return function(_x3){return _ref4.apply(this,arguments)}}()};exports.he_mo_redir_one_click_header_enrichment=he_mo_redir_one_click_header_enrichment;var he_pin_mo_redir_header_enrichment=function he_pin_mo_redir_header_enrichment(defaultFlow){return function(){var _ref6=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(dispatch){var switchState,heResult,msisdn,operator,flowObj,_flowObj,_flowObj2,_flowObj3;return _regeneratorRuntime().wrap(function _callee4$(_context4){for(;1;)switch(_context4.prev=_context4.next){case 0:return switchState=function switchState(flowObj,msisdn,operator){var isHeaderEnrichmentSuccess=void 0!==msisdn&&""!==msisdn;switch(flowObj.flow){case"moRedir":return _.tracker.sendOptInFlowEvent("Redirect"),dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"MO_REDIR",result:{nextAction:"submitMSISDNAction",config:flowObj.flowConfig,msisdn:msisdn,rockman_id:flowObj.rockman_id,operator:operator,isHeaderEnrichmentSuccess:isHeaderEnrichmentSuccess}}});case"pin":return!0===isHeaderEnrichmentSuccess?_.tracker.sendOptInFlowEvent("Hybrid Pin"):_.tracker.sendOptInFlowEvent("Pin"),dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:flowObj.flowConfig,msisdn:msisdn,rockman_id:flowObj.rockman_id,operator:operator,isHeaderEnrichmentSuccess:isHeaderEnrichmentSuccess}}});default:return _.tracker.sendOptInFlowEvent("Pin"),dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:defaultFlow.flowConfig,rockman_id:defaultFlow.rockman_id}}});}},_context4.prev=1,_context4.next=4,(0,_utils.identifyUser)();case 4:if(heResult=_context4.sent,void 0===heResult.msisdn||""===heResult.msisdn){_context4.next=20;break}if(msisdn=heResult.msisdn,operator=heResult.operator,_.tracker.customEvent("Flow","advance-auto","msisdn-detected",{msisdn:msisdn}),!operator||""===operator){_context4.next=14;break}flowObj=(0,_utils.determineFlowByOperator)(operator),switchState(flowObj,msisdn,operator),_context4.next=18;break;case 14:return _context4.next=16,(0,_utils.determineFlowByOperatorFromIp)();case 16:_flowObj=_context4.sent,switchState(_flowObj,msisdn);case 18:_context4.next=24;break;case 20:return _context4.next=22,(0,_utils.determineFlowByOperatorFromIp)();case 22:_flowObj2=_context4.sent,switchState(_flowObj2);case 24:_context4.next=42;break;case 26:return _context4.prev=26,_context4.t0=_context4["catch"](1),console.warn(_context4.t0),_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:null===_context4.t0||void 0===_context4.t0?void 0:_context4.t0.message}),_context4.prev=30,_context4.next=33,(0,_utils.determineFlowByOperatorFromIp)();case 33:_flowObj3=_context4.sent,switchState(_flowObj3),_context4.next=42;break;case 37:_context4.prev=37,_context4.t1=_context4["catch"](30),console.warn(_context4.t1),_.tracker.sendOptInFlowEvent("Pin"),dispatch({type:"IDENTIFY_FLOW_BY_HE",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:defaultFlow.flowConfig}}});case 42:case"end":return _context4.stop();}},_callee4,null,[[1,26],[30,37]])}));return function(_x4){return _ref6.apply(this,arguments)}}()};exports.he_pin_mo_redir_header_enrichment=he_pin_mo_redir_header_enrichment;