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.
- package/dist/@types/window.d.js +1 -1
- package/dist/api/index.d.ts +43 -0
- package/dist/api/index.js +1 -728
- package/dist/common-types/AppThunk.d.ts +13 -0
- package/dist/common-types/AppThunk.js +1 -1
- package/dist/common-types/Either.d.ts +8 -0
- package/dist/common-types/Either.js +1 -1
- package/dist/common-types/IError.d.ts +3 -0
- package/dist/common-types/IError.js +1 -1
- package/dist/common-types/IOptInFlowName.d.ts +1 -0
- package/dist/common-types/ITracker.d.ts +9 -0
- package/dist/common-types/ITracker.js +1 -3
- package/dist/common-types/IVisitor.d.ts +14 -0
- package/dist/common-types/IVisitor.js +1 -1
- package/dist/common-types/RemoteDataState.d.ts +38 -0
- package/dist/common-types/RemoteDataState.js +1 -135
- package/dist/custom-hooks/useOneClickRedirectUrl.d.ts +3 -0
- package/dist/custom-hooks/useOneClickRedirectUrl.js +1 -0
- package/dist/custom-hooks/usePinEntryState.d.ts +8 -0
- package/dist/custom-hooks/usePinEntryState.js +1 -0
- package/dist/custom-hooks/useStrategyConfig.d.ts +4 -0
- package/dist/custom-hooks/useStrategyConfig.js +1 -0
- package/dist/flows/click2smsFlow.d.ts +6 -0
- package/dist/flows/click2smsFlow.js +1 -19
- package/dist/flows/creditCardFlow.d.ts +6 -0
- package/dist/flows/creditCardFlow.js +1 -0
- package/dist/flows/moFlow.d.ts +6 -0
- package/dist/flows/moFlow.js +1 -19
- package/dist/flows/moRedirFlow.d.ts +6 -0
- package/dist/flows/moRedirFlow.js +1 -19
- package/dist/flows/oneClickFlow.d.ts +7 -0
- package/dist/flows/oneClickFlow.js +1 -23
- package/dist/flows/pinFlow.d.ts +7 -0
- package/dist/flows/pinFlow.js +1 -23
- package/dist/flows/strategy.d.ts +14 -0
- package/dist/flows/strategy.js +1 -53
- package/dist/flows/ussdFlow.d.ts +6 -0
- package/dist/flows/ussdFlow.js +1 -19
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -2
- package/dist/ips/tryGetIPRangeName.d.ts +2 -0
- package/dist/ips/tryGetIPRangeName.js +1 -74
- package/dist/jest.config.js +194 -0
- package/dist/pacman/index.d.ts +6 -0
- package/dist/pacman/index.js +1 -108
- package/dist/pacman/queryString.d.ts +3 -0
- package/dist/pacman/queryString.js +1 -45
- package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +76 -0
- package/dist/reducers/click2smsFlow/Click2smsTypes.js +1 -1
- package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +2 -0
- package/dist/reducers/click2smsFlow/IClick2smsConstants.js +1 -1
- package/dist/reducers/click2smsFlow/index.d.ts +5 -0
- package/dist/reducers/click2smsFlow/index.js +1 -183
- package/dist/reducers/click2smsFlow/utils.d.ts +4 -0
- package/dist/reducers/click2smsFlow/utils.js +1 -357
- package/dist/reducers/creditCardFlow/CreditCardTypes.d.ts +79 -0
- package/dist/reducers/creditCardFlow/CreditCardTypes.js +1 -0
- package/dist/reducers/creditCardFlow/ICreditCardConstants.d.ts +2 -0
- package/dist/reducers/creditCardFlow/ICreditCardConstants.js +1 -0
- package/dist/reducers/creditCardFlow/index.d.ts +5 -0
- package/dist/reducers/creditCardFlow/index.js +1 -0
- package/dist/reducers/creditCardFlow/utils.d.ts +8 -0
- package/dist/reducers/creditCardFlow/utils.js +1 -0
- package/dist/reducers/moFlow/IMoConstants.d.ts +2 -0
- package/dist/reducers/moFlow/IMoConstants.js +1 -1
- package/dist/reducers/moFlow/MoTypes.d.ts +88 -0
- package/dist/reducers/moFlow/MoTypes.js +1 -1
- package/dist/reducers/moFlow/index.d.ts +16 -0
- package/dist/reducers/moFlow/index.js +1 -251
- package/dist/reducers/moFlow/utils.d.ts +12 -0
- package/dist/reducers/moFlow/utils.js +1 -284
- package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +2 -0
- package/dist/reducers/moRedirFlow/IMoRedirConstants.js +1 -1
- package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +64 -0
- package/dist/reducers/moRedirFlow/MoRedirTypes.js +1 -1
- package/dist/reducers/moRedirFlow/index.d.ts +14 -0
- package/dist/reducers/moRedirFlow/index.js +1 -226
- package/dist/reducers/moRedirFlow/utils.d.ts +10 -0
- package/dist/reducers/moRedirFlow/utils.js +1 -186
- package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +2 -0
- package/dist/reducers/oneClickFlow/IOneClickConstants.js +1 -1
- package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +85 -0
- package/dist/reducers/oneClickFlow/OneClickTypes.js +1 -1
- package/dist/reducers/oneClickFlow/index.d.ts +13 -0
- package/dist/reducers/oneClickFlow/index.js +1 -409
- package/dist/reducers/oneClickFlow/utils.d.ts +16 -0
- package/dist/reducers/oneClickFlow/utils.js +1 -366
- package/dist/reducers/pinFlow/IPinConstants.d.ts +2 -0
- package/dist/reducers/pinFlow/IPinConstants.js +1 -1
- package/dist/reducers/pinFlow/PinTypes.d.ts +156 -0
- package/dist/reducers/pinFlow/PinTypes.js +1 -1
- package/dist/reducers/pinFlow/index.d.ts +19 -0
- package/dist/reducers/pinFlow/index.js +1 -514
- package/dist/reducers/pinFlow/utils.d.ts +11 -0
- package/dist/reducers/pinFlow/utils.js +1 -494
- package/dist/reducers/strategy/IStategyActionContants.d.ts +2 -0
- package/dist/reducers/strategy/IStategyActionContants.js +1 -1
- package/dist/reducers/strategy/StrategyTypes.d.ts +248 -0
- package/dist/reducers/strategy/StrategyTypes.js +1 -1
- package/dist/reducers/strategy/index.d.ts +13 -0
- package/dist/reducers/strategy/index.js +1 -389
- package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +15 -0
- package/dist/reducers/strategy/strategies/ask_mobile_number.js +1 -403
- package/dist/reducers/strategy/strategies/ask_operator.d.ts +5 -0
- package/dist/reducers/strategy/strategies/ask_operator.js +1 -305
- package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +10 -0
- package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +1 -459
- package/dist/reducers/strategy/strategies/header_enrichment.d.ts +7 -0
- package/dist/reducers/strategy/strategies/header_enrichment.js +1 -783
- package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.d.ts +2 -0
- package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.js +1 -0
- package/dist/reducers/strategy/utils.d.ts +30 -0
- package/dist/reducers/strategy/utils.js +1 -702
- package/dist/reducers/ussdFlow/IUssdConstants.d.ts +2 -0
- package/dist/reducers/ussdFlow/IUssdConstants.js +1 -1
- package/dist/reducers/ussdFlow/UssdTypes.d.ts +77 -0
- package/dist/reducers/ussdFlow/UssdTypes.js +1 -1
- package/dist/reducers/ussdFlow/index.d.ts +14 -0
- package/dist/reducers/ussdFlow/index.js +1 -251
- package/dist/reducers/ussdFlow/utils.d.ts +11 -0
- package/dist/reducers/ussdFlow/utils.js +1 -225
- package/dist/store/index.d.ts +14 -0
- package/dist/store/index.js +1 -177
- package/dist/store/reducers.d.ts +20 -0
- package/dist/store/reducers.js +1 -41
- package/dist/utilities/addEmpelloToken.d.ts +4 -0
- package/dist/utilities/addEmpelloToken.js +1 -0
- package/dist/utilities/handleSubmitNumber.d.ts +21 -0
- package/dist/utilities/handleSubmitNumber.js +1 -59
- package/dist/utilities/index.d.ts +14 -0
- package/dist/utilities/index.js +1 -0
- package/dist/utilities/loadScriptInnerHtml.d.ts +2 -0
- package/dist/utilities/loadScriptInnerHtml.js +1 -0
- package/dist/utilities/loadScriptSrc.d.ts +8 -0
- package/dist/utilities/loadScriptSrc.js +1 -0
- package/dist/utilities/replaceUrlParam.d.ts +1 -0
- package/dist/utilities/replaceUrlParam.js +1 -0
- package/dist/utilities/storeMsisdn.d.ts +3 -0
- package/dist/utilities/storeMsisdn.js +1 -0
- package/package.json +1 -1
- package/dist/app/store.js +0 -20
- package/dist/features/strategies/categories/askMobileNumber.js +0 -388
- package/dist/features/strategies/categories/askOperator.js +0 -313
- package/dist/features/strategies/categories/detectOperatorByIp.js +0 -599
- package/dist/features/strategies/categories/headerEnrichment.js +0 -665
- package/dist/features/strategies/categories/singleFlows/pin.js +0 -1
- package/dist/features/strategies/identifySlice.js +0 -355
- package/dist/features/strategies/pinFlowSlice.js +0 -338
- package/dist/flows/tpayHeFlow.js +0 -23
- package/dist/mockServer/browser.js +0 -48
- package/dist/mockServer/handlers.js +0 -22
- package/dist/mockServer/server.js +0 -48
- package/dist/reducers/tpayHeFlow/ITpayHeConstants.js +0 -1
- package/dist/reducers/tpayHeFlow/TpayHeTypes.js +0 -1
- package/dist/reducers/tpayHeFlow/index.js +0 -331
- package/dist/reducers/tpayHeFlow/utils.js +0 -510
- package/dist/test/setup.js +0 -24
- package/dist/test/test-utils.js +0 -51
|
@@ -1,389 +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.string.iterator");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.weak-map");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/web.dom-collections.iterator");
|
|
24
|
-
|
|
25
|
-
Object.defineProperty(exports, "__esModule", {
|
|
26
|
-
value: true
|
|
27
|
-
});
|
|
28
|
-
exports.mockStrategyStateByUrlParam = mockStrategyStateByUrlParam;
|
|
29
|
-
exports.identifyStrategy = identifyStrategy;
|
|
30
|
-
exports.checkSubscriptionAction = checkSubscriptionAction;
|
|
31
|
-
exports.genericHandler = genericHandler;
|
|
32
|
-
exports.default = StrategyReducer;
|
|
33
|
-
exports.StrategyFlowActionMaps = void 0;
|
|
34
|
-
|
|
35
|
-
require("regenerator-runtime/runtime");
|
|
36
|
-
|
|
37
|
-
var _reactAddonsUpdate = _interopRequireDefault(require("react-addons-update"));
|
|
38
|
-
|
|
39
|
-
var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
|
|
40
|
-
|
|
41
|
-
var _click2smsFlow = require("../click2smsFlow");
|
|
42
|
-
|
|
43
|
-
var _ask_mobile_number = _interopRequireWildcard(require("./strategies/ask_mobile_number"));
|
|
44
|
-
|
|
45
|
-
var _ask_operator = _interopRequireWildcard(require("./strategies/ask_operator"));
|
|
46
|
-
|
|
47
|
-
var _detect_operator_by_ip = _interopRequireDefault(require("./strategies/detect_operator_by_ip"));
|
|
48
|
-
|
|
49
|
-
var _header_enrichment = _interopRequireDefault(require("./strategies/header_enrichment"));
|
|
50
|
-
|
|
51
|
-
var _utils = require("./utils");
|
|
52
|
-
|
|
53
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
54
|
-
|
|
55
|
-
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; }
|
|
56
|
-
|
|
57
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
58
|
-
|
|
59
|
-
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); } }
|
|
60
|
-
|
|
61
|
-
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); }); }; }
|
|
62
|
-
|
|
63
|
-
// export const tracker = mkTracker(typeof window !== 'undefined' ? window : null);
|
|
64
|
-
function mockStrategyStateByUrlParam() {
|
|
65
|
-
return function (dispatch) {
|
|
66
|
-
var search = (0, _utils.searchToObject)();
|
|
67
|
-
|
|
68
|
-
if (search['mock-flow'] !== undefined) {
|
|
69
|
-
switch (search['mock-flow']) {
|
|
70
|
-
case 'pin':
|
|
71
|
-
dispatch({
|
|
72
|
-
type: 'MOCK_STRATEGY_STATE',
|
|
73
|
-
payload: _utils.mockedPinFlow.currentState
|
|
74
|
-
});
|
|
75
|
-
dispatch(mockPinFlow(search['current-state']));
|
|
76
|
-
break;
|
|
77
|
-
|
|
78
|
-
case 'mo':
|
|
79
|
-
dispatch({
|
|
80
|
-
type: 'MOCK_STRATEGY_STATE',
|
|
81
|
-
payload: _utils.mockedMoFlow.currentState
|
|
82
|
-
});
|
|
83
|
-
dispatch(mockMoFlow(search['current-state']));
|
|
84
|
-
break;
|
|
85
|
-
|
|
86
|
-
case 'moredir':
|
|
87
|
-
dispatch({
|
|
88
|
-
type: 'MOCK_STRATEGY_STATE',
|
|
89
|
-
payload: _utils.mockedMoRdirFlow.currentState
|
|
90
|
-
});
|
|
91
|
-
dispatch(mockMoRedirFlow(search['current-state']));
|
|
92
|
-
break;
|
|
93
|
-
|
|
94
|
-
case 'oneclick':
|
|
95
|
-
dispatch({
|
|
96
|
-
type: 'MOCK_STRATEGY_STATE',
|
|
97
|
-
payload: _utils.mockedOneClickFlow.currentState
|
|
98
|
-
});
|
|
99
|
-
setTimeout(function () {
|
|
100
|
-
dispatch(mockOneClickFlow(search['current-state']));
|
|
101
|
-
}, 2000);
|
|
102
|
-
break;
|
|
103
|
-
|
|
104
|
-
case 'click2sms':
|
|
105
|
-
dispatch({
|
|
106
|
-
type: 'MOCK_STRATEGY_STATE',
|
|
107
|
-
payload: _utils.mockedClick2smsFlow.currentState
|
|
108
|
-
});
|
|
109
|
-
break;
|
|
110
|
-
|
|
111
|
-
case 'ussd':
|
|
112
|
-
dispatch({
|
|
113
|
-
type: 'MOCK_STRATEGY_STATE',
|
|
114
|
-
payload: _utils.mockedUssdFlow.currentState
|
|
115
|
-
});
|
|
116
|
-
dispatch(mockUssdFlow(search['current-state']));
|
|
117
|
-
break;
|
|
118
|
-
|
|
119
|
-
default:
|
|
120
|
-
throw 'Mock Flow not supported';
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function identifyStrategy(config) {
|
|
127
|
-
return /*#__PURE__*/function () {
|
|
128
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(dispatch) {
|
|
129
|
-
var _getConfig, strategy, strategyConfigs, search;
|
|
130
|
-
|
|
131
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
132
|
-
while (1) {
|
|
133
|
-
switch (_context.prev = _context.next) {
|
|
134
|
-
case 0:
|
|
135
|
-
_getConfig = (0, _utils.getConfig)(config), strategy = _getConfig.strategy, strategyConfigs = _getConfig.strategyConfigs;
|
|
136
|
-
search = (0, _utils.searchToObject)();
|
|
137
|
-
|
|
138
|
-
if (!(search['mock-flow'] !== undefined)) {
|
|
139
|
-
_context.next = 6;
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
dispatch(mockStrategyStateByUrlParam());
|
|
144
|
-
_context.next = 31;
|
|
145
|
-
break;
|
|
146
|
-
|
|
147
|
-
case 6:
|
|
148
|
-
_context.t0 = strategy;
|
|
149
|
-
_context.next = _context.t0 === 'pin-mo-ask-operator' ? 9 : _context.t0 === 'pin-mo-redir-ask-mobile-number' ? 10 : _context.t0 === 'pin-mo-ask-mobile-number' ? 10 : _context.t0 === 'pin-one-click-detect-operator-by-ip' ? 11 : _context.t0 === 'one-click-mo-pin-detect-operator-by-ip-or-msisdn' ? 11 : _context.t0 === 'mo-redir-one-click-detect-operator-by-ip' ? 11 : _context.t0 === 'mo-one-click-detect-operator-by-ip' ? 11 : _context.t0 === 'click2sms-one-click-detect-operator-by-ip' ? 11 : _context.t0 === 'pin-mo-detect-operator-by-ip' ? 11 : _context.t0 === 'pin-click2sms-ask-operator' ? 12 : _context.t0 === 'he-pin-one-click-ask-operator' ? 12 : _context.t0 === 'click2sms-one-click-ask-operator' ? 12 : _context.t0 === 'pin-one-click-ask-operator' ? 12 : _context.t0 === 'pin-header-enrichment' ? 13 : _context.t0 === 'he-pin-mo-redir-header-enrichment' ? 13 : _context.t0 === 'he-pin-one-click-header-enrichment' ? 13 : _context.t0 === 'he-mo-redir-one-click-header-enrichment' ? 13 : _context.t0 === 'pin' ? 14 : _context.t0 === 'mo' ? 16 : _context.t0 === 'mo-redir' ? 18 : _context.t0 === 'one-click' ? 20 : _context.t0 === 'tallyman-one-click' ? 22 : _context.t0 === 'click2sms' ? 24 : _context.t0 === 'ussd' ? 26 : _context.t0 === 'tpay-he' ? 28 : 30;
|
|
150
|
-
break;
|
|
151
|
-
|
|
152
|
-
case 9:
|
|
153
|
-
return _context.abrupt("return", dispatch((0, _ask_operator.default)()));
|
|
154
|
-
|
|
155
|
-
case 10:
|
|
156
|
-
return _context.abrupt("return", dispatch((0, _ask_mobile_number.default)()));
|
|
157
|
-
|
|
158
|
-
case 11:
|
|
159
|
-
return _context.abrupt("return", dispatch((0, _detect_operator_by_ip.default)()));
|
|
160
|
-
|
|
161
|
-
case 12:
|
|
162
|
-
return _context.abrupt("return", dispatch((0, _ask_operator.default)()));
|
|
163
|
-
|
|
164
|
-
case 13:
|
|
165
|
-
return _context.abrupt("return", dispatch((0, _header_enrichment.default)()));
|
|
166
|
-
|
|
167
|
-
case 14:
|
|
168
|
-
tracker.sendOptInFlowEvent('Pin');
|
|
169
|
-
return _context.abrupt("return", dispatch({
|
|
170
|
-
type: 'IDENTIFY_STRATEGY',
|
|
171
|
-
payload: {
|
|
172
|
-
type: 'PIN',
|
|
173
|
-
result: {
|
|
174
|
-
nextAction: 'submitMSISDNAction',
|
|
175
|
-
config: strategyConfigs.default.flowConfig
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}));
|
|
179
|
-
|
|
180
|
-
case 16:
|
|
181
|
-
tracker.sendOptInFlowEvent('Msisdn to sms');
|
|
182
|
-
return _context.abrupt("return", dispatch({
|
|
183
|
-
type: 'IDENTIFY_STRATEGY',
|
|
184
|
-
payload: {
|
|
185
|
-
type: 'MO',
|
|
186
|
-
result: {
|
|
187
|
-
nextAction: 'submitMSISDNAction',
|
|
188
|
-
config: strategyConfigs.default.flowConfig
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}));
|
|
192
|
-
|
|
193
|
-
case 18:
|
|
194
|
-
tracker.sendOptInFlowEvent('Redirect');
|
|
195
|
-
return _context.abrupt("return", dispatch({
|
|
196
|
-
type: 'IDENTIFY_STRATEGY',
|
|
197
|
-
payload: {
|
|
198
|
-
type: 'MO_REDIR',
|
|
199
|
-
result: {
|
|
200
|
-
nextAction: 'submitMSISDNAction',
|
|
201
|
-
config: strategyConfigs.default.flowConfig
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}));
|
|
205
|
-
|
|
206
|
-
case 20:
|
|
207
|
-
tracker.sendOptInFlowEvent('3G click');
|
|
208
|
-
return _context.abrupt("return", dispatch({
|
|
209
|
-
type: 'IDENTIFY_STRATEGY',
|
|
210
|
-
payload: {
|
|
211
|
-
type: 'ONE_CLICK',
|
|
212
|
-
result: {
|
|
213
|
-
nextAction: 'getRedirectUrlAction',
|
|
214
|
-
config: strategyConfigs.default.flowConfig
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}));
|
|
218
|
-
|
|
219
|
-
case 22:
|
|
220
|
-
tracker.sendOptInFlowEvent('3G click');
|
|
221
|
-
return _context.abrupt("return", dispatch({
|
|
222
|
-
type: 'IDENTIFY_STRATEGY',
|
|
223
|
-
payload: {
|
|
224
|
-
type: 'TALLYMAN_ONE_CLICK',
|
|
225
|
-
result: {
|
|
226
|
-
nextAction: 'getRedirectUrlAction',
|
|
227
|
-
config: strategyConfigs.default.flowConfig
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}));
|
|
231
|
-
|
|
232
|
-
case 24:
|
|
233
|
-
tracker.sendOptInFlowEvent('Click to sms');
|
|
234
|
-
return _context.abrupt("return", dispatch({
|
|
235
|
-
type: 'IDENTIFY_STRATEGY',
|
|
236
|
-
payload: {
|
|
237
|
-
type: 'CLICK2SMS',
|
|
238
|
-
result: {
|
|
239
|
-
nextAction: 'loadOc2sms',
|
|
240
|
-
config: strategyConfigs.default.flowConfig
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}));
|
|
244
|
-
|
|
245
|
-
case 26:
|
|
246
|
-
tracker.sendOptInFlowEvent('Msisdn to sms');
|
|
247
|
-
return _context.abrupt("return", dispatch({
|
|
248
|
-
type: 'IDENTIFY_STRATEGY',
|
|
249
|
-
payload: {
|
|
250
|
-
type: 'USSD',
|
|
251
|
-
result: {
|
|
252
|
-
nextAction: 'submitMSISDNAction',
|
|
253
|
-
config: strategyConfigs.default.flowConfig
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}));
|
|
257
|
-
|
|
258
|
-
case 28:
|
|
259
|
-
tracker.sendOptInFlowEvent('Hybrid Pin');
|
|
260
|
-
return _context.abrupt("return", dispatch({
|
|
261
|
-
type: 'IDENTIFY_STRATEGY',
|
|
262
|
-
payload: {
|
|
263
|
-
type: 'TPAY_HE',
|
|
264
|
-
result: {
|
|
265
|
-
nextAction: 'loadTpayAction',
|
|
266
|
-
config: strategyConfigs.default.flowConfig
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}));
|
|
270
|
-
|
|
271
|
-
case 30:
|
|
272
|
-
throw 'Strategy not supported';
|
|
273
|
-
|
|
274
|
-
case 31:
|
|
275
|
-
case "end":
|
|
276
|
-
return _context.stop();
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}, _callee);
|
|
280
|
-
}));
|
|
281
|
-
|
|
282
|
-
return function (_x) {
|
|
283
|
-
return _ref.apply(this, arguments);
|
|
284
|
-
};
|
|
285
|
-
}();
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
function checkSubscriptionAction(trackingArgs) {
|
|
289
|
-
return /*#__PURE__*/function () {
|
|
290
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(dispatch, store) {
|
|
291
|
-
var currentState, maybeConfig;
|
|
292
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
293
|
-
while (1) {
|
|
294
|
-
switch (_context2.prev = _context2.next) {
|
|
295
|
-
case 0:
|
|
296
|
-
currentState = store().strategy.currentState; // @ts-ignore
|
|
297
|
-
|
|
298
|
-
maybeConfig = currentState.result.config;
|
|
299
|
-
|
|
300
|
-
try {
|
|
301
|
-
dispatch({
|
|
302
|
-
type: 'CHECK_SUBSCRIPTION'
|
|
303
|
-
});
|
|
304
|
-
checkSubscription(window, maybeConfig).then(function (product_url) {
|
|
305
|
-
tracker.advancedInFlow(trackingArgs.flow, trackingArgs.action, trackingArgs.args);
|
|
306
|
-
setTimeout(function () {
|
|
307
|
-
window.location.href = product_url;
|
|
308
|
-
}, 1000);
|
|
309
|
-
});
|
|
310
|
-
} catch (ex) {
|
|
311
|
-
console.warn(ex);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
case 3:
|
|
315
|
-
case "end":
|
|
316
|
-
return _context2.stop();
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}, _callee2);
|
|
320
|
-
}));
|
|
321
|
-
|
|
322
|
-
return function (_x2, _x3) {
|
|
323
|
-
return _ref2.apply(this, arguments);
|
|
324
|
-
};
|
|
325
|
-
}();
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
function genericHandler(state, payload) {
|
|
329
|
-
return (0, _reactAddonsUpdate.default)(state, {
|
|
330
|
-
currentState: {
|
|
331
|
-
$set: payload
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
var initialState = {
|
|
337
|
-
currentState: {
|
|
338
|
-
type: 'IDENTIFY_STRATEGY',
|
|
339
|
-
result: RDS.NothingYet()
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
var StrategyFlowActionMaps = {
|
|
343
|
-
selectOperator: _ask_operator.selectOperator,
|
|
344
|
-
submitMSISDNAction: _ask_mobile_number.submitMSISDNAction,
|
|
345
|
-
loadOc2sms: _click2smsFlow.loadOc2sms
|
|
346
|
-
};
|
|
347
|
-
exports.StrategyFlowActionMaps = StrategyFlowActionMaps;
|
|
348
|
-
|
|
349
|
-
function StrategyReducer() {
|
|
350
|
-
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
|
|
351
|
-
var action = arguments.length > 1 ? arguments[1] : undefined;
|
|
352
|
-
|
|
353
|
-
switch (action.type) {
|
|
354
|
-
case 'IDENTIFY_STRATEGY':
|
|
355
|
-
return genericHandler(state, action.payload);
|
|
356
|
-
|
|
357
|
-
case 'IDENTIFY_FLOW_BY_OPERATOR_SELECT':
|
|
358
|
-
return genericHandler(state, action.payload);
|
|
359
|
-
|
|
360
|
-
case 'OPERATOR_SELECT':
|
|
361
|
-
return genericHandler(state, action.payload);
|
|
362
|
-
|
|
363
|
-
case 'IDENTIFY_FLOW_BY_MSISDN':
|
|
364
|
-
return genericHandler(state, action.payload);
|
|
365
|
-
|
|
366
|
-
case 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT':
|
|
367
|
-
return genericHandler(state, action.payload);
|
|
368
|
-
|
|
369
|
-
case 'IDENTIFY_FLOW_BY_IP':
|
|
370
|
-
return genericHandler(state, action.payload);
|
|
371
|
-
|
|
372
|
-
case 'IDENTIFY_FLOW_BY_IP_OPERATOR':
|
|
373
|
-
return genericHandler(state, action.payload);
|
|
374
|
-
|
|
375
|
-
case 'IDENTIFY_FLOW_BY_HE':
|
|
376
|
-
return genericHandler(state, action.payload);
|
|
377
|
-
|
|
378
|
-
case 'HE_IDENTIFY':
|
|
379
|
-
// @ts-ignore
|
|
380
|
-
return genericHandler(state, action.payload);
|
|
381
|
-
|
|
382
|
-
case 'MOCK_STRATEGY_STATE':
|
|
383
|
-
// @ts-ignore
|
|
384
|
-
return genericHandler(state, action.payload);
|
|
385
|
-
|
|
386
|
-
default:
|
|
387
|
-
return state;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
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.object.keys.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.weak-map.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.StrategyFlowActionMaps=void 0,exports.checkSubscriptionAction=checkSubscriptionAction,exports.default=StrategyReducer,exports.genericHandler=genericHandler,exports.identifyStrategy=identifyStrategy,exports.mockStrategyStateByUrlParam=mockStrategyStateByUrlParam,exports.tracker=void 0,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js");var _immutabilityHelper=_interopRequireDefault(require("immutability-helper")),RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_pacman=_interopRequireDefault(require("../../pacman")),_utilities=require("../../utilities"),_click2smsFlow=require("../click2smsFlow"),_utils=require("../click2smsFlow/utils"),_creditCardFlow=require("../creditCardFlow"),_moFlow=require("../moFlow"),_moRedirFlow=require("../moRedirFlow"),_oneClickFlow=require("../oneClickFlow"),_pinFlow=require("../pinFlow"),_ussdFlow=require("../ussdFlow"),_ask_mobile_number=_interopRequireWildcard(require("./strategies/ask_mobile_number")),_ask_operator=_interopRequireWildcard(require("./strategies/ask_operator")),_detect_operator_by_ip=_interopRequireDefault(require("./strategies/detect_operator_by_ip")),_header_enrichment=_interopRequireDefault(require("./strategies/header_enrichment")),_injectHeaderEnrichmentScript=_interopRequireDefault(require("./strategies/injectHeaderEnrichmentScript")),_utils2=require("./utils");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 _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}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}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)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}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}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)})}}var tracker=(0,_pacman.default)("undefined"==typeof window?null:window);exports.tracker=tracker;function mockStrategyStateByUrlParam(){return function(dispatch){var search=(0,_utils2.searchToObject)();if(void 0!==search["mock-flow"])switch(void 0!==search.operator&&(window.operator=search.operator),search["mock-flow"]){case"pin":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedPinFlow.currentState}),dispatch((0,_pinFlow.mockPinFlow)(search["current-state"]));break;case"mo":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedMoFlow.currentState}),dispatch((0,_moFlow.mockMoFlow)(search["current-state"]));break;case"moredir":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedMoRdirFlow.currentState}),dispatch((0,_moRedirFlow.mockMoRedirFlow)(search["current-state"]));break;case"oneclick":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedOneClickFlow.currentState}),setTimeout(function(){dispatch((0,_oneClickFlow.mockOneClickFlow)(search["current-state"]))},2e3);break;case"click2sms":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedClick2smsFlow.currentState});break;case"ussd":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedUssdFlow.currentState}),dispatch((0,_ussdFlow.mockUssdFlow)(search["current-state"]));break;case"creditcard":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedCreditCardFlow.currentState}),dispatch((0,_creditCardFlow.mockCreditCardFlow)(search["current-state"]));break;default:throw new Error("(mockStrategyStateByUrlParam) Strategy Mock Flow not supported");}}}function identifyStrategy(){return function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(dispatch){var _getConfig,strategy,strategyConfigs,isUseMsisdnPrefix,search,_strategyConfigs$defa,flowObj;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(_getConfig=(0,_utils2.getConfig)(),strategy=_getConfig.strategy,strategyConfigs=_getConfig.strategyConfigs,isUseMsisdnPrefix=strategyConfigs.isUseMsisdnPrefix,search=(0,_utils2.searchToObject)(),dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"IDENTIFY_STRATEGY",result:RDS.Loading()}}),void 0===search["mock-flow"]){_context.next=8;break}dispatch(mockStrategyStateByUrlParam()),_context.next=40;break;case 8:if(!(search["show-pin-entry"]&&"1"===search["show-pin-entry"]||search["show-thank-you"]&&"1"===search["show-thank-you"])){_context.next=13;break}flowObj=(0,_utils2.determineFlowByOperator)(search.operator),dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:(null===flowObj||void 0===flowObj?void 0:flowObj.flowConfig)||(null===strategyConfigs||void 0===strategyConfigs||null===(_strategyConfigs$defa=strategyConfigs.default)||void 0===_strategyConfigs$defa?void 0:_strategyConfigs$defa.flowConfig),isUseMsisdnPrefix:isUseMsisdnPrefix}}}),_context.next=40;break;case 13:_context.t0=strategy,_context.next="pin-mo-ask-operator"===_context.t0?16:"pin-mo-redir-ask-mobile-number"===_context.t0?17:"pin-mo-ask-mobile-number"===_context.t0?17:"pin-combo-ask-mobile-number"===_context.t0?17:"pin-mo-mo-redir-ask-mobile-number"===_context.t0?17:"pin-one-click-detect-operator-by-ip"===_context.t0?18:"one-click-mo-pin-detect-operator-by-ip-or-msisdn"===_context.t0?18:"mo-redir-one-click-detect-operator-by-ip"===_context.t0?18:"mo-one-click-detect-operator-by-ip"===_context.t0?18:"click2sms-one-click-detect-operator-by-ip"===_context.t0?18:"pin-mo-detect-operator-by-ip"===_context.t0?18:"mo-redir-mo-click2sms-one-click-detect-operator-by-ip-or-msisdn"===_context.t0?18:"pin-click2sms-ask-operator"===_context.t0?19:"he-pin-one-click-ask-operator"===_context.t0?19:"click2sms-one-click-ask-operator"===_context.t0?19:"pin-one-click-ask-operator"===_context.t0?19:"pin-header-enrichment"===_context.t0?20:"he-pin-mo-redir-header-enrichment"===_context.t0?20:"he-pin-one-click-header-enrichment"===_context.t0?20:"he-mo-redir-one-click-header-enrichment"===_context.t0?20:"header-enrichment-script"===_context.t0?21:"pin"===_context.t0?22:"mo"===_context.t0?26:"mo-redir"===_context.t0?28:"one-click"===_context.t0?30:"click2sms"===_context.t0?32:"ussd"===_context.t0?34:"tpay-he"===_context.t0?36:"credit-card"===_context.t0?38:39;break;case 16:return _context.abrupt("return",dispatch((0,_ask_operator.default)()));case 17:return _context.abrupt("return",dispatch((0,_ask_mobile_number.default)()));case 18:return _context.abrupt("return",dispatch((0,_detect_operator_by_ip.default)()));case 19:return _context.abrupt("return",dispatch((0,_ask_operator.default)()));case 20:return _context.abrupt("return",dispatch((0,_header_enrichment.default)()));case 21:return _context.abrupt("return",dispatch((0,_injectHeaderEnrichmentScript.default)()));case 22:return tracker.sendOptInFlowEvent("Pin"),search.msisdn&&tracker.customEvent("Flow","advance-auto","msisdn-detected-url-param",{msisdn:search.msisdn}),!0===window.isLoading&&dispatch((0,_pinFlow.checkLoadingAction)()),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig,isUseMsisdnPrefix:isUseMsisdnPrefix,msisdn:search.msisdn,isHeaderEnrichmentSuccess:(0,_utilities.isCookieExists)("OMEU")&&"ES"===strategyConfigs.default.flowConfig.country||search.msisdn}}}));case 26:return tracker.sendOptInFlowEvent("Msisdn to sms"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"MO",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}}));case 28:return tracker.sendOptInFlowEvent("Redirect"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"MO_REDIR",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}}));case 30:return tracker.sendOptInFlowEvent("3G click"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"ONE_CLICK",result:{nextAction:"getRedirectUrlAction",config:strategyConfigs.default.flowConfig}}}));case 32:return tracker.sendOptInFlowEvent("Click to sms"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"CLICK2SMS",result:{nextAction:"loadOc2sms",config:strategyConfigs.default.flowConfig}}}));case 34:return tracker.sendOptInFlowEvent("Msisdn to sms"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"USSD",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}}));case 36:return tracker.sendOptInFlowEvent("Hybrid Pin"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"TPAY_HE",result:{nextAction:"loadTpayAction",config:strategyConfigs.default.flowConfig}}}));case 38:return _context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"CREDIT_CARD",result:{config:strategyConfigs.default.flowConfig,isUseMsisdnPrefix:isUseMsisdnPrefix}}}));case 39:throw new Error("Strategy not supported");case 40:case"end":return _context.stop();}},_callee)}));return function(_x){return _ref.apply(this,arguments)}}()}function checkSubscriptionAction(trackingArgs){return function(){var _ref2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(dispatch,store){var currentState,maybeConfig;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:currentState=store().strategy.currentState,maybeConfig=currentState.result.config;try{dispatch({type:"CHECK_SUBSCRIPTION"}),(0,_utils.checkSubscription)(window,maybeConfig).then(function(product_url){product_url&&""!==product_url&&(tracker.advancedInFlow(trackingArgs.flow,trackingArgs.action,_objectSpread(_objectSpread({},trackingArgs.args),{},{url:product_url})),setTimeout(function(){window.location.href=product_url},1e3))})}catch(ex){console.warn(ex)}case 3:case"end":return _context2.stop();}},_callee2)}));return function(_x2,_x3){return _ref2.apply(this,arguments)}}()}function genericHandler(state,payload){return(0,_immutabilityHelper.default)(state,{currentState:{$set:payload}})}var search=(0,_utils2.searchToObject)(),isPinEntryStep=search["show-pin-entry"]&&"1"===search["show-pin-entry"],configs=(0,_utils2.getConfig)(),defaultFlowConfig=configs.strategyConfigs.default,initialStateDefault={currentState:{type:"IDENTIFY_STRATEGY",result:RDS.NothingYet()}},initalPinEntryState={currentState:{type:"IDENTIFY_STRATEGY",result:RDS.Success({type:"PIN",result:{nextAction:"submitMSISDNAction",config:defaultFlowConfig.flowConfig}})}},initialState=isPinEntryStep?initalPinEntryState:initialStateDefault,StrategyFlowActionMaps={selectOperator:_ask_operator.selectOperator,submitMSISDNAction:_ask_mobile_number.submitMSISDNAction,loadOc2sms:_click2smsFlow.loadOc2sms};exports.StrategyFlowActionMaps=StrategyFlowActionMaps;function StrategyReducer(){var state=0<arguments.length&&arguments[0]!==void 0?arguments[0]:initialState,action=1<arguments.length?arguments[1]:void 0;switch(action.type){case"IDENTIFY_STRATEGY":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_OPERATOR_SELECT":return genericHandler(state,action.payload);case"OPERATOR_SELECT":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_MSISDN":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_MSISDN_SUBMIT":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_IP":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_IP_OPERATOR":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_HE":return genericHandler(state,action.payload);case"HE_IDENTIFY":return genericHandler(state,action.payload);case"MOCK_STRATEGY_STATE":return genericHandler(state,action.payload);default:return state;}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AppThunk } from '../../../common-types/AppThunk';
|
|
2
|
+
import { IFlow } from '../StrategyTypes';
|
|
3
|
+
export default function ask_mobile_number(payload?: {
|
|
4
|
+
msisdn: string;
|
|
5
|
+
operator: string;
|
|
6
|
+
isHeaderEnrichmentSuccess: boolean;
|
|
7
|
+
}): AppThunk;
|
|
8
|
+
export declare function submitMSISDNAction(internationalMSISDN: string, isHeSuccess?: boolean): AppThunk;
|
|
9
|
+
export declare const header_enrichment_script: (flowObj: IFlow, msisdn: string, isHeaderEnrichmentSuccess: boolean) => AppThunk;
|
|
10
|
+
export declare const pin_mo_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
|
|
11
|
+
export declare const pin_combo_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
|
|
12
|
+
export declare const pin_mo_redir_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
|
|
13
|
+
export declare const pin_mo_mo_redir_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
|
|
14
|
+
export declare const one_click_mo_pin_detect_operator_by_ip_or_msisdn: (flowObj: IFlow, msisdn: string) => AppThunk;
|
|
15
|
+
export declare const mo_redir_mo_click2sms_one_click_detect_operator_by_ip_or_msisdn: (flowObj: IFlow, msisdn: string) => AppThunk;
|