ouisys-engine 3.0.2 → 3.0.6

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