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,313 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.symbol");
4
-
5
- require("core-js/modules/es.array.filter");
6
-
7
- require("core-js/modules/es.object.get-own-property-descriptor");
8
-
9
- require("core-js/modules/es.object.get-own-property-descriptors");
10
-
11
- require("core-js/modules/es.object.keys");
12
-
13
- require("core-js/modules/es.object.to-string");
14
-
15
- require("core-js/modules/es.promise");
16
-
17
- require("core-js/modules/web.dom-collections.for-each");
18
-
19
- Object.defineProperty(exports, "__esModule", {
20
- value: true
21
- });
22
- exports.selectOperatorAction = exports.askOperator = exports.hePinOneClickAskOperator = exports.pin = void 0;
23
-
24
- require("regenerator-runtime/runtime");
25
-
26
- var _toolkit = require("@reduxjs/toolkit");
27
-
28
- var _utils = require("../../../reducers/strategy/utils");
29
-
30
- var _identifySlice = require("../identifySlice");
31
-
32
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
33
-
34
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
35
-
36
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
37
-
38
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
39
-
40
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
41
-
42
- var oneClick = function oneClick(_ref) {
43
- var flowObj = _ref.flowObj;
44
-
45
- _identifySlice.tracker.sendOptInFlowEvent('3G click');
46
-
47
- return {
48
- type: _identifySlice.StrategyStates.ONE_CLICK,
49
- result: {
50
- config: flowObj.flowConfig,
51
- operator: flowObj.operator
52
- }
53
- };
54
- };
55
-
56
- var pin = function pin(_ref2) {
57
- var flowObj = _ref2.flowObj,
58
- msisdn = _ref2.msisdn,
59
- isHeaderEnrichmentSuccess = _ref2.isHeaderEnrichmentSuccess;
60
-
61
- if (isHeaderEnrichmentSuccess !== true) {
62
- _identifySlice.tracker.sendOptInFlowEvent('Pin');
63
- } else {
64
- _identifySlice.tracker.sendOptInFlowEvent('Hybrid Pin');
65
- }
66
-
67
- return {
68
- type: _identifySlice.StrategyStates.PIN,
69
- result: {
70
- config: flowObj.flowConfig,
71
- operator: flowObj.operator,
72
- msisdn: msisdn,
73
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
74
- }
75
- };
76
- };
77
-
78
- exports.pin = pin;
79
-
80
- var moRedir = function moRedir(_ref3) {
81
- var flowObj = _ref3.flowObj;
82
-
83
- _identifySlice.tracker.sendOptInFlowEvent('Redirect');
84
-
85
- return {
86
- type: _identifySlice.StrategyStates.MO_REDIR,
87
- result: {
88
- config: flowObj.flowConfig,
89
- operator: flowObj.operator
90
- }
91
- };
92
- };
93
-
94
- var click2sms = function click2sms(_ref4) {
95
- var flowObj = _ref4.flowObj;
96
-
97
- _identifySlice.tracker.sendOptInFlowEvent('Click to sms');
98
-
99
- return {
100
- type: _identifySlice.StrategyStates.CLICK2SMS,
101
- result: {
102
- config: _objectSpread({
103
- operators: [flowObj.operator]
104
- }, flowObj.flowConfig),
105
- operator: flowObj.operator
106
- }
107
- };
108
- };
109
-
110
- var mo = function mo(_ref5) {
111
- var flowObj = _ref5.flowObj;
112
-
113
- _identifySlice.tracker.sendOptInFlowEvent('Msisdn to sms');
114
-
115
- return {
116
- type: _identifySlice.StrategyStates.MO,
117
- result: {
118
- config: flowObj.flowConfig,
119
- operator: flowObj.operator
120
- }
121
- };
122
- };
123
-
124
- var hePinOneClickAskOperator = /*#__PURE__*/function () {
125
- var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref6) {
126
- var configs, flowObj, extraParams, strategyConfigs, defaultFlow, heResult, msisdn, _operator, isHeaderEnrichmentSuccess;
127
-
128
- return regeneratorRuntime.wrap(function _callee$(_context) {
129
- while (1) {
130
- switch (_context.prev = _context.next) {
131
- case 0:
132
- configs = _ref6.configs, flowObj = _ref6.flowObj, extraParams = _ref6.extraParams;
133
- strategyConfigs = configs.strategyConfigs;
134
- defaultFlow = strategyConfigs.default;
135
- _context.prev = 3;
136
- _context.next = 6;
137
- return (0, _utils.identifyUser)({
138
- configs: configs,
139
- extraParams: extraParams
140
- });
141
-
142
- case 6:
143
- heResult = _context.sent;
144
- msisdn = heResult.msisdn;
145
- _operator = heResult.operator;
146
- isHeaderEnrichmentSuccess = !!msisdn;
147
- return _context.abrupt("return", pin({
148
- flowObj: flowObj,
149
- msisdn: msisdn,
150
- operator: _operator,
151
- isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
152
- }));
153
-
154
- case 13:
155
- _context.prev = 13;
156
- _context.t0 = _context["catch"](3);
157
- console.warn(_context.t0);
158
- return _context.abrupt("return", pin({
159
- flowObj: defaultFlow,
160
- operator: operator
161
- }));
162
-
163
- case 17:
164
- case "end":
165
- return _context.stop();
166
- }
167
- }
168
- }, _callee, null, [[3, 13]]);
169
- }));
170
-
171
- return function hePinOneClickAskOperator(_x) {
172
- return _ref7.apply(this, arguments);
173
- };
174
- }();
175
-
176
- exports.hePinOneClickAskOperator = hePinOneClickAskOperator;
177
-
178
- var askOperator = /*#__PURE__*/function () {
179
- var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref8) {
180
- var configs, operators;
181
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
182
- while (1) {
183
- switch (_context2.prev = _context2.next) {
184
- case 0:
185
- configs = _ref8.configs;
186
- operators = (0, _utils.getOperators)({
187
- configs: configs
188
- });
189
- return _context2.abrupt("return", {
190
- type: _identifySlice.StrategyStates.IDENTIFY_FLOW_BY_OPERATOR_SELECT,
191
- result: {
192
- operators: operators
193
- }
194
- });
195
-
196
- case 3:
197
- case "end":
198
- return _context2.stop();
199
- }
200
- }
201
- }, _callee2);
202
- }));
203
-
204
- return function askOperator(_x2) {
205
- return _ref9.apply(this, arguments);
206
- };
207
- }();
208
-
209
- exports.askOperator = askOperator;
210
- var selectOperatorAction = (0, _toolkit.createAsyncThunk)('strategy/selectOperatorAction',
211
- /*#__PURE__*/
212
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
213
- // @ts-ignore
214
- function () {
215
- var _ref10 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(payload, thunkApi) {
216
- var configs, strategy, strategyConfigs, operator, defaultFlow, _flowObj;
217
-
218
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
219
- while (1) {
220
- switch (_context3.prev = _context3.next) {
221
- case 0:
222
- configs = payload.configs || (0, _utils.getConfig)();
223
- strategy = configs.strategy, strategyConfigs = configs.strategyConfigs;
224
- operator = payload.operator;
225
- defaultFlow = strategyConfigs.default;
226
- _context3.prev = 4;
227
- _flowObj = (0, _utils.determineFlowByOperator)({
228
- configs: configs,
229
- operator: operator
230
- });
231
- _context3.t0 = _flowObj.flow;
232
- _context3.next = _context3.t0 === 'pin' ? 9 : _context3.t0 === 'mo' ? 14 : _context3.t0 === 'moRedir' ? 15 : _context3.t0 === 'click2sms' ? 16 : _context3.t0 === 'oneClick' ? 17 : 18;
233
- break;
234
-
235
- case 9:
236
- if (!(strategy === 'he-pin-one-click-ask-operator')) {
237
- _context3.next = 13;
238
- break;
239
- }
240
-
241
- _context3.next = 12;
242
- return hePinOneClickAskOperator({
243
- configs: configs,
244
- flowObj: _flowObj,
245
- operator: operator
246
- });
247
-
248
- case 12:
249
- return _context3.abrupt("return", _context3.sent);
250
-
251
- case 13:
252
- return _context3.abrupt("return", pin({
253
- flowObj: _flowObj,
254
- operator: operator
255
- }));
256
-
257
- case 14:
258
- return _context3.abrupt("return", mo({
259
- flowObj: _flowObj
260
- }));
261
-
262
- case 15:
263
- return _context3.abrupt("return", moRedir({
264
- flowObj: _flowObj
265
- }));
266
-
267
- case 16:
268
- return _context3.abrupt("return", click2sms({
269
- flowObj: _flowObj
270
- }));
271
-
272
- case 17:
273
- return _context3.abrupt("return", oneClick({
274
- flowObj: _flowObj
275
- }));
276
-
277
- case 18:
278
- console.error('selectOperatorAction', 'Strategy not supported');
279
- return _context3.abrupt("return", pin({
280
- flowObj: _objectSpread(_objectSpread({}, defaultFlow), {}, {
281
- operator: _flowObj.operator
282
- }),
283
- msisdn: internationalMSISDN
284
- }));
285
-
286
- case 20:
287
- _context3.next = 26;
288
- break;
289
-
290
- case 22:
291
- _context3.prev = 22;
292
- _context3.t1 = _context3["catch"](4);
293
- console.error('identifySuselectOperatorActionbmitMSISDNAction', JSON.stringify(_context3.t1));
294
- return _context3.abrupt("return", pin({
295
- flowObj: _objectSpread(_objectSpread({}, defaultFlow), {}, {
296
- operator: flowObj.operator
297
- }),
298
- msisdn: internationalMSISDN
299
- }));
300
-
301
- case 26:
302
- case "end":
303
- return _context3.stop();
304
- }
305
- }
306
- }, _callee3, null, [[4, 22]]);
307
- }));
308
-
309
- return function (_x3, _x4) {
310
- return _ref10.apply(this, arguments);
311
- };
312
- }());
313
- exports.selectOperatorAction = selectOperatorAction;