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,702 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.symbol");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.symbol.description");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.symbol.iterator");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.array.concat");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.array.filter");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.array.from");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.array.iterator");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.array.join");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.array.map");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.array.reduce");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.array.slice");
|
|
24
|
-
|
|
25
|
-
require("core-js/modules/es.function.name");
|
|
26
|
-
|
|
27
|
-
require("core-js/modules/es.object.get-own-property-descriptor");
|
|
28
|
-
|
|
29
|
-
require("core-js/modules/es.object.get-own-property-descriptors");
|
|
30
|
-
|
|
31
|
-
require("core-js/modules/es.object.keys");
|
|
32
|
-
|
|
33
|
-
require("core-js/modules/es.object.to-string");
|
|
34
|
-
|
|
35
|
-
require("core-js/modules/es.promise");
|
|
36
|
-
|
|
37
|
-
require("core-js/modules/es.regexp.exec");
|
|
38
|
-
|
|
39
|
-
require("core-js/modules/es.regexp.to-string");
|
|
40
|
-
|
|
41
|
-
require("core-js/modules/es.string.iterator");
|
|
42
|
-
|
|
43
|
-
require("core-js/modules/es.string.match");
|
|
44
|
-
|
|
45
|
-
require("core-js/modules/es.string.replace");
|
|
46
|
-
|
|
47
|
-
require("core-js/modules/es.string.search");
|
|
48
|
-
|
|
49
|
-
require("core-js/modules/es.string.split");
|
|
50
|
-
|
|
51
|
-
require("core-js/modules/web.dom-collections.for-each");
|
|
52
|
-
|
|
53
|
-
require("core-js/modules/web.dom-collections.iterator");
|
|
54
|
-
|
|
55
|
-
require("core-js/modules/web.url");
|
|
56
|
-
|
|
57
|
-
Object.defineProperty(exports, "__esModule", {
|
|
58
|
-
value: true
|
|
59
|
-
});
|
|
60
|
-
exports.right = right;
|
|
61
|
-
exports.left = left;
|
|
62
|
-
exports.determineFlowByMsidn = determineFlowByMsidn;
|
|
63
|
-
exports.determineFlowByOperator = determineFlowByOperator;
|
|
64
|
-
exports.determineFlowByOperatorFromIp = determineFlowByOperatorFromIp;
|
|
65
|
-
exports.getOperators = getOperators;
|
|
66
|
-
exports.mockConfig = mockConfig;
|
|
67
|
-
exports.default = exports.subscribe = exports.identifyUser = exports.searchToObject = exports.getConfig = exports.loop = exports.wait = void 0;
|
|
68
|
-
|
|
69
|
-
require("regenerator-runtime/runtime");
|
|
70
|
-
|
|
71
|
-
var _tryGetIPRangeName = _interopRequireDefault(require("../../ips/tryGetIPRangeName"));
|
|
72
|
-
|
|
73
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
74
|
-
|
|
75
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
76
|
-
|
|
77
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
78
|
-
|
|
79
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
80
|
-
|
|
81
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
82
|
-
|
|
83
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
84
|
-
|
|
85
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
86
|
-
|
|
87
|
-
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; }
|
|
88
|
-
|
|
89
|
-
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; }
|
|
90
|
-
|
|
91
|
-
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; }
|
|
92
|
-
|
|
93
|
-
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); } }
|
|
94
|
-
|
|
95
|
-
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); }); }; }
|
|
96
|
-
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
98
|
-
// @ts-ignore
|
|
99
|
-
var wait = function wait(ms) {
|
|
100
|
-
return new Promise(function (resolve) {
|
|
101
|
-
return setTimeout(function () {
|
|
102
|
-
return resolve();
|
|
103
|
-
}, ms);
|
|
104
|
-
});
|
|
105
|
-
}; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
106
|
-
// @ts-ignore
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
exports.wait = wait;
|
|
110
|
-
|
|
111
|
-
var loop = /*#__PURE__*/function () {
|
|
112
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(f, max, stop, i) {
|
|
113
|
-
var r;
|
|
114
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
115
|
-
while (1) {
|
|
116
|
-
switch (_context.prev = _context.next) {
|
|
117
|
-
case 0:
|
|
118
|
-
_context.next = 2;
|
|
119
|
-
return f();
|
|
120
|
-
|
|
121
|
-
case 2:
|
|
122
|
-
r = _context.sent;
|
|
123
|
-
|
|
124
|
-
if (!(stop(r) || i >= max)) {
|
|
125
|
-
_context.next = 5;
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return _context.abrupt("return", r);
|
|
130
|
-
|
|
131
|
-
case 5:
|
|
132
|
-
_context.next = 7;
|
|
133
|
-
return wait(1000);
|
|
134
|
-
|
|
135
|
-
case 7:
|
|
136
|
-
return _context.abrupt("return", loop(f, max, stop, i + 1));
|
|
137
|
-
|
|
138
|
-
case 8:
|
|
139
|
-
case "end":
|
|
140
|
-
return _context.stop();
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}, _callee);
|
|
144
|
-
}));
|
|
145
|
-
|
|
146
|
-
return function loop(_x, _x2, _x3, _x4) {
|
|
147
|
-
return _ref.apply(this, arguments);
|
|
148
|
-
};
|
|
149
|
-
}();
|
|
150
|
-
|
|
151
|
-
exports.loop = loop;
|
|
152
|
-
|
|
153
|
-
function right(r) {
|
|
154
|
-
return {
|
|
155
|
-
type: 'right',
|
|
156
|
-
value: r
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function left(l) {
|
|
161
|
-
return {
|
|
162
|
-
type: 'left',
|
|
163
|
-
value: l
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
var getConfig = function getConfig(configs) {
|
|
168
|
-
if (configs) {
|
|
169
|
-
return configs;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (process.env.NODE_ENV === 'test') {
|
|
173
|
-
// eslint-disable-next-line import/no-unresolved
|
|
174
|
-
var pageConfigs = require('../../../mockData/config.json');
|
|
175
|
-
|
|
176
|
-
return pageConfigs || null;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
try {
|
|
180
|
-
// eslint-disable-next-line import/no-unresolved
|
|
181
|
-
var _pageConfigs = require('../../../../../config.json');
|
|
182
|
-
|
|
183
|
-
return _pageConfigs || null;
|
|
184
|
-
} catch (err) {
|
|
185
|
-
return null;
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
exports.getConfig = getConfig;
|
|
190
|
-
|
|
191
|
-
var searchToObject = function searchToObject() {
|
|
192
|
-
if (typeof window !== 'undefined') {
|
|
193
|
-
return window.location.search.substring(1).split('&').filter(function (x) {
|
|
194
|
-
return !!x && x.length > 0;
|
|
195
|
-
}).map(function (kv) {
|
|
196
|
-
return kv.split('=');
|
|
197
|
-
}).reduce(function (a, b) {
|
|
198
|
-
return _objectSpread(_objectSpread({}, a), {}, _defineProperty({}, b[0], b[1]));
|
|
199
|
-
}, {});
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return {};
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
exports.searchToObject = searchToObject;
|
|
206
|
-
|
|
207
|
-
function determineFlowByMsidn(_x5) {
|
|
208
|
-
return _determineFlowByMsidn.apply(this, arguments);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function _determineFlowByMsidn() {
|
|
212
|
-
_determineFlowByMsidn = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(_ref2) {
|
|
213
|
-
var internationalMSISDN, configs, defaultFlowConfig, operatorsConfig, submissionError, msisdn, indentifyFlow, theResult, flow, cannotDetect, hlrError, _submissionError, flowObj, _flowObj, _submissionError2;
|
|
214
|
-
|
|
215
|
-
return regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
216
|
-
while (1) {
|
|
217
|
-
switch (_context5.prev = _context5.next) {
|
|
218
|
-
case 0:
|
|
219
|
-
internationalMSISDN = _ref2.internationalMSISDN, configs = _ref2.configs;
|
|
220
|
-
defaultFlowConfig = configs.strategyConfigs.default;
|
|
221
|
-
operatorsConfig = configs.strategyConfigs.operators;
|
|
222
|
-
|
|
223
|
-
if (internationalMSISDN) {
|
|
224
|
-
_context5.next = 7;
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
submissionError = new Error("Error in submitMSISDN() trigger-pin action");
|
|
229
|
-
submissionError.type = 'SEInvalidMSISDN';
|
|
230
|
-
throw submissionError;
|
|
231
|
-
|
|
232
|
-
case 7:
|
|
233
|
-
msisdn = internationalMSISDN.match(/\d+/gi).join(''); // tallyman API expects international msisdn without any special character
|
|
234
|
-
|
|
235
|
-
indentifyFlow = /*#__PURE__*/function () {
|
|
236
|
-
var _ref12 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
237
|
-
var config, slug, country, device, host, rockmanId, offer, flowOperatorResult;
|
|
238
|
-
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
239
|
-
while (1) {
|
|
240
|
-
switch (_context4.prev = _context4.next) {
|
|
241
|
-
case 0:
|
|
242
|
-
config = defaultFlowConfig.flowConfig;
|
|
243
|
-
slug = config.slug, country = config.country, device = config.device, host = config.host;
|
|
244
|
-
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
245
|
-
offer = window.pac_analytics.visitor.offer;
|
|
246
|
-
_context4.next = 6;
|
|
247
|
-
return window.tallymanApi.identify(host, slug, country, msisdn, device, offer, rockmanId);
|
|
248
|
-
|
|
249
|
-
case 6:
|
|
250
|
-
flowOperatorResult = _context4.sent;
|
|
251
|
-
return _context4.abrupt("return", flowOperatorResult);
|
|
252
|
-
|
|
253
|
-
case 8:
|
|
254
|
-
case "end":
|
|
255
|
-
return _context4.stop();
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}, _callee4);
|
|
259
|
-
}));
|
|
260
|
-
|
|
261
|
-
return function indentifyFlow() {
|
|
262
|
-
return _ref12.apply(this, arguments);
|
|
263
|
-
};
|
|
264
|
-
}();
|
|
265
|
-
|
|
266
|
-
_context5.next = 11;
|
|
267
|
-
return indentifyFlow();
|
|
268
|
-
|
|
269
|
-
case 11:
|
|
270
|
-
theResult = _context5.sent;
|
|
271
|
-
flow = operatorsConfig[theResult.operator] ? operatorsConfig[theResult.operator] : null;
|
|
272
|
-
cannotDetect = theResult.success === false && theResult.message === 'Operator could not be found for the given MSISDN';
|
|
273
|
-
hlrError = theResult.success === false && theResult.message.indexOf('HLR did not find the operator for given MSISDN') !== -1;
|
|
274
|
-
|
|
275
|
-
if (!(cannotDetect || hlrError)) {
|
|
276
|
-
_context5.next = 22;
|
|
277
|
-
break;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
_submissionError = new Error("Error in submitMSISDN() identify flow");
|
|
281
|
-
_submissionError.type = 'FlowDetectFailed';
|
|
282
|
-
_submissionError.msisdn = msisdn;
|
|
283
|
-
throw _submissionError;
|
|
284
|
-
|
|
285
|
-
case 22:
|
|
286
|
-
if (!(flow !== null)) {
|
|
287
|
-
_context5.next = 27;
|
|
288
|
-
break;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
flowObj = _objectSpread({
|
|
292
|
-
operator: theResult.operator,
|
|
293
|
-
default: defaultFlowConfig
|
|
294
|
-
}, flow);
|
|
295
|
-
return _context5.abrupt("return", flowObj);
|
|
296
|
-
|
|
297
|
-
case 27:
|
|
298
|
-
if (!(flow === null)) {
|
|
299
|
-
_context5.next = 32;
|
|
300
|
-
break;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
_flowObj = _objectSpread({
|
|
304
|
-
operator: theResult.operator
|
|
305
|
-
}, defaultFlowConfig);
|
|
306
|
-
return _context5.abrupt("return", _flowObj);
|
|
307
|
-
|
|
308
|
-
case 32:
|
|
309
|
-
_submissionError2 = new Error("Error in submitMSISDN() trigger-pin action");
|
|
310
|
-
_submissionError2.type = 'SEInvalidMSISDN';
|
|
311
|
-
throw _submissionError2;
|
|
312
|
-
|
|
313
|
-
case 35:
|
|
314
|
-
case "end":
|
|
315
|
-
return _context5.stop();
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}, _callee5);
|
|
319
|
-
}));
|
|
320
|
-
return _determineFlowByMsidn.apply(this, arguments);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
function determineFlowByOperator(_ref3) {
|
|
324
|
-
var operator = _ref3.operator,
|
|
325
|
-
configs = _ref3.configs;
|
|
326
|
-
var defaultFlowConfig = configs.strategyConfigs.default;
|
|
327
|
-
var operatorsConfig = configs.strategyConfigs.operators;
|
|
328
|
-
|
|
329
|
-
var flowObj = _objectSpread({
|
|
330
|
-
operator: operator,
|
|
331
|
-
default: defaultFlowConfig
|
|
332
|
-
}, operatorsConfig[operator]);
|
|
333
|
-
|
|
334
|
-
return flowObj;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
function determineFlowByOperatorFromIp(_x6) {
|
|
338
|
-
return _determineFlowByOperatorFromIp.apply(this, arguments);
|
|
339
|
-
} // if operator from server
|
|
340
|
-
// no need for this
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
function _determineFlowByOperatorFromIp() {
|
|
344
|
-
_determineFlowByOperatorFromIp = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(_ref4) {
|
|
345
|
-
var configs, operator, flowObj;
|
|
346
|
-
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
347
|
-
while (1) {
|
|
348
|
-
switch (_context6.prev = _context6.next) {
|
|
349
|
-
case 0:
|
|
350
|
-
configs = _ref4.configs;
|
|
351
|
-
_context6.next = 3;
|
|
352
|
-
return (0, _tryGetIPRangeName.default)(window.pac_analytics.visitor);
|
|
353
|
-
|
|
354
|
-
case 3:
|
|
355
|
-
operator = _context6.sent;
|
|
356
|
-
flowObj = determineFlowByOperator({
|
|
357
|
-
operator: operator ? operator.toUpperCase() : '',
|
|
358
|
-
configs: configs
|
|
359
|
-
});
|
|
360
|
-
return _context6.abrupt("return", flowObj);
|
|
361
|
-
|
|
362
|
-
case 6:
|
|
363
|
-
case "end":
|
|
364
|
-
return _context6.stop();
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}, _callee6);
|
|
368
|
-
}));
|
|
369
|
-
return _determineFlowByOperatorFromIp.apply(this, arguments);
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
function getOperators(_ref5) {
|
|
373
|
-
var configs = _ref5.configs;
|
|
374
|
-
var operatorsConfig = configs.strategyConfigs.operators;
|
|
375
|
-
var operators = Object.keys(operatorsConfig);
|
|
376
|
-
return operators;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
var fetchJsonp = function fetchJsonp(_url) {
|
|
380
|
-
var url = _url;
|
|
381
|
-
var ouisysCallbackFunction = "ouisys_callback_function".concat(Math.floor(Math.random() * 10000));
|
|
382
|
-
return new Promise(function (resolve, reject) {
|
|
383
|
-
// @ts-ignore
|
|
384
|
-
window[ouisys_callback_function] = function (arg) {
|
|
385
|
-
resolve(arg);
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
url += url.indexOf('?') === -1 ? '?' : '&';
|
|
389
|
-
url += "jsonp=".concat(ouisysCallbackFunction);
|
|
390
|
-
var script = document.createElement('script');
|
|
391
|
-
script.src = url;
|
|
392
|
-
script.id = ouisysCallbackFunction;
|
|
393
|
-
document.body.appendChild(script); // Caught if got 404/500
|
|
394
|
-
|
|
395
|
-
script.onerror = function () {
|
|
396
|
-
reject(new Error("JSONP request to ".concat(_url, " failed")));
|
|
397
|
-
};
|
|
398
|
-
});
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
var identifyUser = /*#__PURE__*/function () {
|
|
402
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref6) {
|
|
403
|
-
var configs, extraParams, defaultFlowConfig, config, host, country, slug, queryString, device, bupperizeCountry, offer, rockmanId, s, search, extraParamsQs, isDMB, newHost, searchObj, isSuccess, identifyError, subscriptionUrl, _newUrl, _queryString2, _urlParams, _msisdn, _operator, url2, redirectUrl, _newUrl2, _queryString3, _urlParams2, _msisdn2, _operator2, newUrl, _queryString, urlParams, msisdn, operator, _url2, result, _identifyError;
|
|
404
|
-
|
|
405
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
406
|
-
while (1) {
|
|
407
|
-
switch (_context2.prev = _context2.next) {
|
|
408
|
-
case 0:
|
|
409
|
-
configs = _ref6.configs, extraParams = _ref6.extraParams;
|
|
410
|
-
defaultFlowConfig = configs.strategyConfigs.default;
|
|
411
|
-
|
|
412
|
-
if (!(typeof window === 'undefined')) {
|
|
413
|
-
_context2.next = 6;
|
|
414
|
-
break;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
throw "javascript: console.error('SSR'); void 6";
|
|
418
|
-
|
|
419
|
-
case 6:
|
|
420
|
-
config = defaultFlowConfig.flowConfig;
|
|
421
|
-
host = config.host, country = config.country, slug = config.slug, queryString = config.queryString, device = config.device;
|
|
422
|
-
|
|
423
|
-
bupperizeCountry = function bupperizeCountry(c) {
|
|
424
|
-
return c == 'gb' ? 'uk' : c;
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
offer = window.pac_analytics.visitor.offer;
|
|
428
|
-
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
429
|
-
s = window.location.search.substr(1);
|
|
430
|
-
search = (!!s && s.length > 0 ? [s] : []).concat((queryString || []).map(function (_ref8) {
|
|
431
|
-
var _ref9 = _slicedToArray(_ref8, 2),
|
|
432
|
-
k = _ref9[0],
|
|
433
|
-
v = _ref9[1];
|
|
434
|
-
|
|
435
|
-
return "".concat(k, "=").concat(v);
|
|
436
|
-
})).join('&');
|
|
437
|
-
extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
|
|
438
|
-
return "".concat(k, "=").concat(extraParams[k]);
|
|
439
|
-
}).join('&'));
|
|
440
|
-
isDMB = !!(window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf('dmb') != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf('amb')) != -1);
|
|
441
|
-
newHost = isDMB ? 'de.tallymans.com' : host;
|
|
442
|
-
searchObj = searchToObject();
|
|
443
|
-
|
|
444
|
-
if (!(!!searchObj['redirect-back'] && searchObj['redirect-back'] == '1' && !!searchObj.success)) {
|
|
445
|
-
_context2.next = 52;
|
|
446
|
-
break;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
isSuccess = searchObj.success == 'true';
|
|
450
|
-
|
|
451
|
-
if (!(isSuccess == false)) {
|
|
452
|
-
_context2.next = 25;
|
|
453
|
-
break;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
457
|
-
// @ts-ignore
|
|
458
|
-
identifyError = new Error( // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
459
|
-
// @ts-ignore
|
|
460
|
-
"Error in getRedirectUrl() identify-user action:\n".concat(searchObj.message || 'NotOn3g') // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
461
|
-
// @ts-ignore
|
|
462
|
-
);
|
|
463
|
-
identifyError.type = 'NotOn3g'; // identifyError['next_action'] = result.next_action;
|
|
464
|
-
|
|
465
|
-
throw identifyError;
|
|
466
|
-
|
|
467
|
-
case 25:
|
|
468
|
-
if (!searchObj.subscription_url) {
|
|
469
|
-
_context2.next = 33;
|
|
470
|
-
break;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
// eslint-disable-next-line camelcase
|
|
474
|
-
subscriptionUrl = window.atob(searchObj.subscription_url);
|
|
475
|
-
_newUrl = new URL(subscriptionUrl);
|
|
476
|
-
_queryString2 = _newUrl.search;
|
|
477
|
-
_urlParams = new URLSearchParams(_queryString2);
|
|
478
|
-
_msisdn = _urlParams.get('msisdn') || null;
|
|
479
|
-
_operator = _urlParams.get('operator') || null;
|
|
480
|
-
return _context2.abrupt("return", {
|
|
481
|
-
subscriptionUrl: subscriptionUrl,
|
|
482
|
-
action: function action() {
|
|
483
|
-
return subscribe(subscriptionUrl);
|
|
484
|
-
},
|
|
485
|
-
msisdn: _msisdn,
|
|
486
|
-
operator: _operator
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
case 33:
|
|
490
|
-
if (!searchObj.redirect_url) {
|
|
491
|
-
_context2.next = 44;
|
|
492
|
-
break;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
url2 = "https://de.tallymans.com/tallyman/v1/?action=redirect&country=".concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", 'smart', "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId, "&auto-redirect=1&").concat(extraParamsQs); // const result2 = await fetch(url2).then(x => x.json())
|
|
496
|
-
// eslint-disable-next-line camelcase
|
|
497
|
-
|
|
498
|
-
redirectUrl = window.atob(searchObj.redirect_url);
|
|
499
|
-
_newUrl2 = new URL(redirectUrl);
|
|
500
|
-
_queryString3 = _newUrl2.search;
|
|
501
|
-
_urlParams2 = new URLSearchParams(_queryString3);
|
|
502
|
-
_msisdn2 = _urlParams2.get('msisdn') || null;
|
|
503
|
-
_operator2 = _urlParams2.get('operator') || null;
|
|
504
|
-
|
|
505
|
-
if (!(_msisdn2 != null)) {
|
|
506
|
-
_context2.next = 43;
|
|
507
|
-
break;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
return _context2.abrupt("return", {
|
|
511
|
-
subscriptionUrl: url2,
|
|
512
|
-
msisdn: _msisdn2,
|
|
513
|
-
operator: _operator2
|
|
514
|
-
});
|
|
515
|
-
|
|
516
|
-
case 43:
|
|
517
|
-
return _context2.abrupt("return", {
|
|
518
|
-
redirectUrl: redirectUrl,
|
|
519
|
-
msisdn: _msisdn2,
|
|
520
|
-
operator: _operator2
|
|
521
|
-
});
|
|
522
|
-
|
|
523
|
-
case 44:
|
|
524
|
-
newUrl = new URL(window.location.href); // eslint-disable-next-line @typescript-eslint/no-shadow
|
|
525
|
-
|
|
526
|
-
_queryString = newUrl.search;
|
|
527
|
-
urlParams = new URLSearchParams(_queryString);
|
|
528
|
-
msisdn = urlParams.get('msisdn') || null;
|
|
529
|
-
operator = urlParams.get('operator') || null;
|
|
530
|
-
return _context2.abrupt("return", {
|
|
531
|
-
msisdn: msisdn,
|
|
532
|
-
operator: operator
|
|
533
|
-
});
|
|
534
|
-
|
|
535
|
-
case 50:
|
|
536
|
-
_context2.next = 63;
|
|
537
|
-
break;
|
|
538
|
-
|
|
539
|
-
case 52:
|
|
540
|
-
_url2 = "https://".concat(newHost, "/tallyman/v1/?action=identify-user&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=").concat(device, "&offerId=").concat(offer, "&page=").concat(window.location.href, "&pixel_url=").concat(encodeURIComponent("http://c1.ouisys.com/pixels?xcid=".concat(window.location.pathname.replace('/', ''), "&xaid=").concat(window.pac_analytics.visitor.xaid, "&country=").concat(bupperizeCountry(country))), "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
|
|
541
|
-
_context2.next = 55;
|
|
542
|
-
return fetchJsonp(_url2);
|
|
543
|
-
|
|
544
|
-
case 55:
|
|
545
|
-
result = _context2.sent;
|
|
546
|
-
|
|
547
|
-
if (!(result.success === false)) {
|
|
548
|
-
_context2.next = 62;
|
|
549
|
-
break;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
_identifyError = new Error("Error in getRedirectUrl() identify-user action:\n".concat(result.message));
|
|
553
|
-
_identifyError.type = 'NotOn3g'; // identifyError['next_action'] = result.next_action;
|
|
554
|
-
|
|
555
|
-
throw _identifyError;
|
|
556
|
-
|
|
557
|
-
case 62:
|
|
558
|
-
return _context2.abrupt("return", {
|
|
559
|
-
subscriptionUrl: result.subscription_url || result.redirect_url,
|
|
560
|
-
action: function action() {
|
|
561
|
-
return subscribe(result.subscription_url);
|
|
562
|
-
},
|
|
563
|
-
msisdn: result.msisdn,
|
|
564
|
-
operator: result.operator
|
|
565
|
-
});
|
|
566
|
-
|
|
567
|
-
case 63:
|
|
568
|
-
case "end":
|
|
569
|
-
return _context2.stop();
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
}, _callee2);
|
|
573
|
-
}));
|
|
574
|
-
|
|
575
|
-
return function identifyUser(_x7) {
|
|
576
|
-
return _ref7.apply(this, arguments);
|
|
577
|
-
};
|
|
578
|
-
}();
|
|
579
|
-
|
|
580
|
-
exports.identifyUser = identifyUser;
|
|
581
|
-
|
|
582
|
-
var subscribe = /*#__PURE__*/function () {
|
|
583
|
-
var _ref10 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(url) {
|
|
584
|
-
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
585
|
-
while (1) {
|
|
586
|
-
switch (_context3.prev = _context3.next) {
|
|
587
|
-
case 0:
|
|
588
|
-
return _context3.abrupt("return", // const result:ISubscribeResult = await fetch(url + "&operator=kw_viva").then((x)=>x.json())
|
|
589
|
-
// if(false === result.success){
|
|
590
|
-
// const subscribeError = new Error(`Error in subscribe() one-click-subscribe action:\n${result.message}`) as IError & {type:string;}
|
|
591
|
-
// subscribeError['type'] = "SubscriptionError";
|
|
592
|
-
// throw subscribeError
|
|
593
|
-
// }else{
|
|
594
|
-
'www.yahoo.com');
|
|
595
|
-
|
|
596
|
-
case 1:
|
|
597
|
-
case "end":
|
|
598
|
-
return _context3.stop();
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
}, _callee3);
|
|
602
|
-
}));
|
|
603
|
-
|
|
604
|
-
return function subscribe(_x8) {
|
|
605
|
-
return _ref10.apply(this, arguments);
|
|
606
|
-
};
|
|
607
|
-
}(); // }
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
exports.subscribe = subscribe;
|
|
611
|
-
|
|
612
|
-
function mockConfig(_ref11) {
|
|
613
|
-
var flow = _ref11.flow,
|
|
614
|
-
configs = _ref11.configs;
|
|
615
|
-
var defaultFlowConfig = configs.strategyConfigs.default;
|
|
616
|
-
var operatorsConfig = configs.strategyConfigs.operators;
|
|
617
|
-
var opArr = Object.keys(operatorsConfig);
|
|
618
|
-
var r = opArr.filter(function (o) {
|
|
619
|
-
return operatorsConfig[o].flow === flow;
|
|
620
|
-
});
|
|
621
|
-
var operator = r[0];
|
|
622
|
-
|
|
623
|
-
var flowObj = _objectSpread({
|
|
624
|
-
offer: 1,
|
|
625
|
-
operator: operator,
|
|
626
|
-
default: defaultFlowConfig
|
|
627
|
-
}, operatorsConfig[operator]);
|
|
628
|
-
|
|
629
|
-
return flowObj;
|
|
630
|
-
} // export const mockedPinFlow: IStrategyReducerState = {
|
|
631
|
-
// currentState: {
|
|
632
|
-
// type: 'PIN',
|
|
633
|
-
// result: {
|
|
634
|
-
// nextAction: 'submitMSISDNAction',
|
|
635
|
-
// config: mockConfig('pin')
|
|
636
|
-
// }
|
|
637
|
-
// }
|
|
638
|
-
// };
|
|
639
|
-
// export const mockedMoFlow: IStrategyReducerState = {
|
|
640
|
-
// currentState: {
|
|
641
|
-
// type: 'MO',
|
|
642
|
-
// result: {
|
|
643
|
-
// nextAction: 'submitMSISDNAction',
|
|
644
|
-
// config: mockConfig('mo')
|
|
645
|
-
// }
|
|
646
|
-
// }
|
|
647
|
-
// };
|
|
648
|
-
// export const mockedUssdFlow: IStrategyReducerState = {
|
|
649
|
-
// currentState: {
|
|
650
|
-
// type: 'USSD',
|
|
651
|
-
// result: {
|
|
652
|
-
// nextAction: 'submitMSISDNAction',
|
|
653
|
-
// config: mockConfig('ussd')
|
|
654
|
-
// }
|
|
655
|
-
// }
|
|
656
|
-
// };
|
|
657
|
-
// export const mockedMoRdirFlow: IStrategyReducerState = {
|
|
658
|
-
// currentState: {
|
|
659
|
-
// type: 'MO_REDIR',
|
|
660
|
-
// result: {
|
|
661
|
-
// nextAction: 'submitMSISDNAction',
|
|
662
|
-
// config: mockConfig('moRedir')
|
|
663
|
-
// }
|
|
664
|
-
// }
|
|
665
|
-
// };
|
|
666
|
-
// export const mockedClick2smsFlow: IStrategyReducerState = {
|
|
667
|
-
// currentState: {
|
|
668
|
-
// type: 'CLICK2SMS',
|
|
669
|
-
// result: {
|
|
670
|
-
// nextAction: 'loadOc2sms',
|
|
671
|
-
// config: mockConfig('click2sms')
|
|
672
|
-
// }
|
|
673
|
-
// }
|
|
674
|
-
// };
|
|
675
|
-
// export const mockedOneClickFlow: IStrategyReducerState = {
|
|
676
|
-
// currentState: {
|
|
677
|
-
// type: 'ONE_CLICK',
|
|
678
|
-
// result: {
|
|
679
|
-
// nextAction: 'getRedirectUrlAction',
|
|
680
|
-
// config: mockConfig('oneClick')
|
|
681
|
-
// }
|
|
682
|
-
// }
|
|
683
|
-
// };
|
|
684
|
-
// export const mockedTPayFlow: IStrategyReducerState = {
|
|
685
|
-
// currentState: {
|
|
686
|
-
// type: 'TPAY_HE',
|
|
687
|
-
// result: {
|
|
688
|
-
// nextAction: 'loadTpayAction',
|
|
689
|
-
// config: mockConfig('tpayHe')
|
|
690
|
-
// }
|
|
691
|
-
// }
|
|
692
|
-
// };
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
var _default = {
|
|
696
|
-
getConfig: getConfig
|
|
697
|
-
}; // export const mockedMOFlow : State = { type: "MO", result:moFlow(mockTracker, mockConfig("mo"))}
|
|
698
|
-
// export const mockedOneClickFlow : State = { type: "ONECLICK", result:oneClickFlow(mockTracker, mockConfig("oneClick"), {"testextraparams":"1"})}
|
|
699
|
-
// export const mockedClick2smsFlow : State = { type: "CLICK2SMS", result:click2smsFlow(mockTracker, mockConfig("click2sms"))}
|
|
700
|
-
// export const mockedMORedirFlow : State = { type: "MOREDIR", result:moRedirFlow(mockTracker, mockConfig("moRedir"))}
|
|
701
|
-
|
|
702
|
-
exports.default = _default;
|
|
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.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.object.get-own-property-descriptor.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.array.from.js"),require("core-js/modules/es.regexp.test.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.determineFlowByMsidn=determineFlowByMsidn,exports.determineFlowByOperator=determineFlowByOperator,exports.determineFlowByOperatorFromIp=determineFlowByOperatorFromIp,exports.getConfig=void 0,exports.getOperators=getOperators,exports.identifyUser=void 0,exports.left=left,exports.loop=void 0,exports.mockConfig=mockConfig,exports.mockedUssdFlow=exports.mockedTPayFlow=exports.mockedPinFlow=exports.mockedOneClickFlow=exports.mockedMoRdirFlow=exports.mockedMoFlow=exports.mockedCreditCardFlow=exports.mockedClick2smsFlow=void 0,exports.right=right,exports.wait=exports.subscribe=exports.searchToObject=void 0,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.split.js"),require("core-js/modules/es.string.search.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.array.concat.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/web.url.js"),require("core-js/modules/web.url-search-params.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.string.replace.js"),require("core-js/modules/es.string.match.js");var _awesomePhonenumber=_interopRequireDefault(require("awesome-phonenumber")),_tryGetIPRangeName=_interopRequireDefault(require("../../ips/tryGetIPRangeName")),_utilities=require("../../utilities");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_arr=[],_n=!0,_d=!1;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!(i&&_arr.length===i));_n=!0);}catch(err){_d=!0,_e=err}finally{try{_n||null==_i["return"]||_i["return"]()}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}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 wait=function(ms){return new Promise(function(resolve){return setTimeout(function(){return resolve()},ms)})};exports.wait=wait;var loop=function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(f,max,stop,i){var r;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:return _context.next=2,f();case 2:if(r=_context.sent,!(stop(r)||i>=max)){_context.next=5;break}return _context.abrupt("return",r);case 5:return _context.next=7,wait(1e3);case 7:return _context.abrupt("return",loop(f,max,stop,i+1));case 8:case"end":return _context.stop();}},_callee)}));return function loop(_x,_x2,_x3,_x4){return _ref.apply(this,arguments)}}();exports.loop=loop;function right(r){return{type:"right",value:r}}function left(l){return{type:"left",value:l}}var getConfig=function getConfig(){try{if("true"===process.env.testing){var _configs2=require("../../../mockData/config.json");return _configs2}var _configs=require("../../../../../config.json");return _configs}catch(ex){throw new Error("config.json not found")}};exports.getConfig=getConfig;var configs=getConfig(),defaultFlowConfig=configs.strategyConfigs.default,operatorsConfig=configs.strategyConfigs.operators,searchToObject=function searchToObject(){return"undefined"==typeof window?{}:window.location.search.substring(1).split("&").filter(function(x){return!!x&&0<x.length}).map(function(kv){return kv.split("=")}).reduce(function(a,b){return _objectSpread(_objectSpread({},a),{},_defineProperty({},b[0],b[1]))},{})};exports.searchToObject=searchToObject;function determineFlowByMsidn(_x5){return _determineFlowByMsidn.apply(this,arguments)}function _determineFlowByMsidn(){return _determineFlowByMsidn=_asyncToGenerator(_regeneratorRuntime().mark(function _callee5(internationalMSISDN){var submissionError,msisdn,indentifyFlow,theResult,flow,cannotDetect,hlrError,_submissionError,flowObj,_flowObj,_submissionError2;return _regeneratorRuntime().wrap(function _callee5$(_context5){for(;1;)switch(_context5.prev=_context5.next){case 0:if(internationalMSISDN){_context5.next=4;break}throw submissionError=new Error("Error in submitMSISDN() trigger-pin action"),submissionError.type="SEInvalidMSISDN",submissionError;case 4:return msisdn=internationalMSISDN.match(/\d+/gi).join(""),indentifyFlow=function(){var _ref6=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(){var config,slug,country,device,host,rockmanId,offer,flowOperatorResult;return _regeneratorRuntime().wrap(function _callee4$(_context4){for(;1;)switch(_context4.prev=_context4.next){case 0:return config=defaultFlowConfig.flowConfig,slug=config.slug,country=config.country,device=config.device,host=config.host,rockmanId=window.pac_analytics.visitor.rockmanId,offer=window.pac_analytics.visitor.offer,_context4.next=6,window.tallymanApi.identify(host,slug,country,msisdn,device,offer,rockmanId);case 6:return flowOperatorResult=_context4.sent,_context4.abrupt("return",flowOperatorResult);case 8:case"end":return _context4.stop();}},_callee4)}));return function indentifyFlow(){return _ref6.apply(this,arguments)}}(),_context5.next=8,indentifyFlow();case 8:if(theResult=_context5.sent,flow=operatorsConfig[theResult.operator]||operatorsConfig[_utilities.mapAgencyOperator[theResult.operator]]?operatorsConfig[theResult.operator]||operatorsConfig[_utilities.mapAgencyOperator[theResult.operator]]:null,cannotDetect=!1===theResult.success&&"Operator could not be found for the given MSISDN"===theResult.message,hlrError=!1===theResult.success&&-1!==theResult.message.indexOf("HLR did not find the operator for given MSISDN"),!(cannotDetect||hlrError)){_context5.next=19;break}throw _submissionError=new Error("Error in submitMSISDN() identify flow"),_submissionError.type="FlowDetectFailed",_submissionError.msisdn=msisdn,_submissionError;case 19:if(null===flow){_context5.next=24;break}return flowObj=_objectSpread({operator:theResult.operator,default:defaultFlowConfig},flow),_context5.abrupt("return",flowObj);case 24:if(null!==flow){_context5.next=29;break}return _flowObj=_objectSpread({operator:theResult.operator},defaultFlowConfig),_context5.abrupt("return",_flowObj);case 29:throw _submissionError2=new Error("Error in submitMSISDN() trigger-pin action"),_submissionError2.type="SEInvalidMSISDN",_submissionError2;case 32:case"end":return _context5.stop();}},_callee5)})),_determineFlowByMsidn.apply(this,arguments)}function determineFlowByOperator(operator){var flowObj=_objectSpread({operator:null===operator||void 0===operator?void 0:operator.toUpperCase(),default:defaultFlowConfig},operatorsConfig[null===operator||void 0===operator?void 0:operator.toUpperCase()]);return flowObj}function determineFlowByOperatorFromIp(){return _determineFlowByOperatorFromIp.apply(this,arguments)}function _determineFlowByOperatorFromIp(){return _determineFlowByOperatorFromIp=_asyncToGenerator(_regeneratorRuntime().mark(function _callee6(){var operator,flowObj;return _regeneratorRuntime().wrap(function _callee6$(_context6){for(;1;)switch(_context6.prev=_context6.next){case 0:return _context6.next=2,(0,_tryGetIPRangeName.default)(window.pac_analytics.visitor);case 2:return operator=_context6.sent,flowObj=determineFlowByOperator(operator?operator.toUpperCase():""),_context6.abrupt("return",flowObj);case 5:case"end":return _context6.stop();}},_callee6)})),_determineFlowByOperatorFromIp.apply(this,arguments)}function getOperators(){var operators=Object.keys(operatorsConfig);return operators}var fetchJsonp=function fetchJsonp(_url){var url=_url,ouisys_callback_function="ouisys_callback_function".concat(Math.floor(1e4*Math.random()));return new Promise(function(resolve,reject){window[ouisys_callback_function]=function(arg){resolve(arg)},url+=-1===url.indexOf("?")?"?":"&",url+="jsonp=".concat(ouisys_callback_function);var script=document.createElement("script");script.src=url,script.id=ouisys_callback_function,document.body.appendChild(script),script.onerror=function(){reject(new Error("JSONP request to ".concat(_url," failed")))}})},identifyUser=function(){var _ref2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(extraParams){var config,country,slug,queryString,device,bupperizeCountry,offer,rockmanId,s,search,extraParamsQs,searchObj,identifyError,subscription_url,_newUrl,_newQueryString,_urlParams,_msisdn,_operator,_window,_window$pac_analytics,_window$pac_analytics2,pn,internationalMsisdn,redirect_url,_newUrl2,_newQueryString2,_urlParams2,_msisdn2,_operator2,_window2,_window2$pac_analytic,_window2$pac_analytic2,_pn,_internationalMsisdn,newUrl,newQueryString,urlParams,msisdn,operator,_window3,_window3$pac_analytic,_window3$pac_analytic2,_pn2,_internationalMsisdn2,url,result,_identifyError,_msisdn3,_window4,_window4$pac_analytic,_window4$pac_analytic2,_pn3,_internationalMsisdn3;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:if("undefined"!=typeof window){_context2.next=4;break}throw new Error("Error");case 4:if(config=defaultFlowConfig.flowConfig,country=config.country,slug=config.slug,queryString=config.queryString,device=config.device,bupperizeCountry=function bupperizeCountry(c){return"gb"===c?"uk":c},offer=window.pac_analytics.visitor.offer,rockmanId=window.pac_analytics.visitor.rockmanId,s=window.location.search.substr(1),search=(!!s&&0<s.length?[s]:[]).concat((queryString||[]).map(function(_ref3){var _ref4=_slicedToArray(_ref3,2),k=_ref4[0],v=_ref4[1];return"".concat(k,"=").concat(v)})).join("&"),extraParamsQs=extraParams?"&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")):"",searchObj=searchToObject(),!searchObj["redirect-back"]){_context2.next=47;break}if("false"!==(null===searchObj||void 0===searchObj?void 0:searchObj.success)){_context2.next=20;break}throw identifyError=new Error("Error in getRedirectUrl() identify-user action:\n".concat((null===searchObj||void 0===searchObj?void 0:searchObj.message)||"NotOn3g")),identifyError.type="NotOn3g",identifyError;case 20:if(!searchObj.subscription_url){_context2.next=29;break}return subscription_url=window.atob(searchObj.subscription_url),_newUrl=new URL(subscription_url),_newQueryString=_newUrl.search,_urlParams=new URLSearchParams(_newQueryString),_msisdn=_urlParams.get("msisdn")||(null===searchObj||void 0===searchObj?void 0:searchObj.msisdn)||null,_operator=_urlParams.get("operator")||(null===searchObj||void 0===searchObj?void 0:searchObj.operator)||null,_msisdn&&(pn=new _awesomePhonenumber.default(_msisdn,null===(_window=window)||void 0===_window||null===(_window$pac_analytics=_window.pac_analytics)||void 0===_window$pac_analytics||null===(_window$pac_analytics2=_window$pac_analytics.visitor)||void 0===_window$pac_analytics2?void 0:_window$pac_analytics2.country),internationalMsisdn=pn.getNumber("e164"),_msisdn=internationalMsisdn.slice(1)),_context2.abrupt("return",{subscription_url:subscription_url,action:function action(){return subscribe(subscription_url)},msisdn:_msisdn,operator:_operator});case 29:if(!(null!==searchObj&&void 0!==searchObj&&searchObj.redirect_url)){_context2.next=38;break}return redirect_url=window.atob(null===searchObj||void 0===searchObj?void 0:searchObj.redirect_url),_newUrl2=new URL(redirect_url),_newQueryString2=_newUrl2.search,_urlParams2=new URLSearchParams(_newQueryString2),_msisdn2=_urlParams2.get("msisdn")||(null===searchObj||void 0===searchObj?void 0:searchObj.msisdn)||null,_operator2=_urlParams2.get("operator")||(null===searchObj||void 0===searchObj?void 0:searchObj.operator)||null,_msisdn2&&(_pn=new _awesomePhonenumber.default(_msisdn2,null===(_window2=window)||void 0===_window2||null===(_window2$pac_analytic=_window2.pac_analytics)||void 0===_window2$pac_analytic||null===(_window2$pac_analytic2=_window2$pac_analytic.visitor)||void 0===_window2$pac_analytic2?void 0:_window2$pac_analytic2.country),_internationalMsisdn=_pn.getNumber("e164"),_msisdn2=_internationalMsisdn.slice(1)),_context2.abrupt("return",{redirect_url:redirect_url,msisdn:_msisdn2,operator:_operator2});case 38:return newUrl=new URL(window.location.href),newQueryString=newUrl.search,urlParams=new URLSearchParams(newQueryString),msisdn=urlParams.get("msisdn")||(null===searchObj||void 0===searchObj?void 0:searchObj.msisdn)||null,operator=urlParams.get("operator")||(null===searchObj||void 0===searchObj?void 0:searchObj.operator)||null,msisdn&&(_pn2=new _awesomePhonenumber.default(msisdn,null===(_window3=window)||void 0===_window3||null===(_window3$pac_analytic=_window3.pac_analytics)||void 0===_window3$pac_analytic||null===(_window3$pac_analytic2=_window3$pac_analytic.visitor)||void 0===_window3$pac_analytic2?void 0:_window3$pac_analytic2.country),_internationalMsisdn2=_pn2.getNumber("e164"),msisdn=_internationalMsisdn2.slice(1)),_context2.abrupt("return",{msisdn:msisdn,operator:operator});case 45:_context2.next=59;break;case 47:return url="/tallyman/v1/?action=identify-user&country=".concat(bupperizeCountry(country),"&slug=").concat(slug,"&device=").concat(device,"&offerId=").concat(offer,"&page=").concat(window.location.href,"&pixel_url=").concat(encodeURIComponent("http://".concat(window.location.host,"/pixels?xcid=").concat(window.location.pathname.replace("/",""),"&xaid=").concat(window.pac_analytics.visitor.xaid,"&country=").concat(bupperizeCountry(country))),"&rockman_id=").concat(rockmanId).concat(extraParamsQs,"&").concat(search),_context2.next=50,fetchJsonp(url);case 50:if(result=_context2.sent,"false"!==result.success){_context2.next=57;break}throw _identifyError=new Error("Error in getRedirectUrl() identify-user action:\n".concat(result.message)),_identifyError.type="NotOn3g",_identifyError;case 57:return result.msisdn&&(_pn3=new _awesomePhonenumber.default(result.msisdn,null===(_window4=window)||void 0===_window4||null===(_window4$pac_analytic=_window4.pac_analytics)||void 0===_window4$pac_analytic||null===(_window4$pac_analytic2=_window4$pac_analytic.visitor)||void 0===_window4$pac_analytic2?void 0:_window4$pac_analytic2.country),_internationalMsisdn3=_pn3.getNumber("e164"),_msisdn3=_internationalMsisdn3.slice(1)),_context2.abrupt("return",{subscription_url:result.subscription_url||result.redirect_url,action:function action(){return subscribe(result.subscription_url)},msisdn:_msisdn3,operator:result.operator});case 59:case"end":return _context2.stop();}},_callee2)}));return function identifyUser(_x6){return _ref2.apply(this,arguments)}}();exports.identifyUser=identifyUser;var subscribe=function(){var _ref5=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(_url){return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:return _context3.abrupt("return","/product");case 1:case"end":return _context3.stop();}},_callee3)}));return function subscribe(_x7){return _ref5.apply(this,arguments)}}();exports.subscribe=subscribe;function mockConfig(flow){var opArr=Object.keys(operatorsConfig),r=opArr.filter(function(o){return operatorsConfig[o].flow===flow}),operator=r[0],flowObj=_objectSpread({offer:1,operator:operator,default:defaultFlowConfig},operatorsConfig[operator]);return flowObj}var mockedPinFlow={currentState:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:mockConfig("pin")}}};exports.mockedPinFlow=mockedPinFlow;var mockedMoFlow={currentState:{type:"MO",result:{nextAction:"submitMSISDNAction",config:mockConfig("mo")}}};exports.mockedMoFlow=mockedMoFlow;var mockedUssdFlow={currentState:{type:"USSD",result:{nextAction:"submitMSISDNAction",config:mockConfig("ussd")}}};exports.mockedUssdFlow=mockedUssdFlow;var mockedMoRdirFlow={currentState:{type:"MO_REDIR",result:{nextAction:"submitMSISDNAction",config:mockConfig("moRedir")}}};exports.mockedMoRdirFlow=mockedMoRdirFlow;var mockedClick2smsFlow={currentState:{type:"CLICK2SMS",result:{nextAction:"loadOc2sms",config:mockConfig("click2sms")}}};exports.mockedClick2smsFlow=mockedClick2smsFlow;var mockedOneClickFlow={currentState:{type:"ONE_CLICK",result:{nextAction:"getRedirectUrlAction",config:mockConfig("oneClick")}}};exports.mockedOneClickFlow=mockedOneClickFlow;var mockedTPayFlow={currentState:{type:"TPAY_HE",result:{nextAction:"loadTpayAction",config:mockConfig("tpayHe")}}};exports.mockedTPayFlow=mockedTPayFlow;var mockedCreditCardFlow={currentState:{type:"CREDIT_CARD",result:{config:mockConfig("creditCard")}}};exports.mockedCreditCardFlow=mockedCreditCardFlow;
|