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