ouisys-engine 3.0.22 → 3.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/.babelrc +9 -1
  2. package/dist/@types/window.d.js +1 -5
  3. package/dist/api/index.js +1 -760
  4. package/dist/common-types/AppThunk.js +1 -5
  5. package/dist/common-types/Either.js +1 -5
  6. package/dist/common-types/IError.js +1 -5
  7. package/dist/common-types/ITracker.js +1 -5
  8. package/dist/common-types/IVisitor.js +1 -5
  9. package/dist/common-types/RemoteDataState.js +1 -138
  10. package/dist/custom-hooks/useStrategyConfig.js +1 -24
  11. package/dist/flows/click2smsFlow.js +1 -23
  12. package/dist/flows/moFlow.js +1 -23
  13. package/dist/flows/moRedirFlow.js +1 -23
  14. package/dist/flows/oneClickFlow.js +1 -29
  15. package/dist/flows/pinFlow.js +1 -25
  16. package/dist/flows/strategy.js +1 -49
  17. package/dist/flows/ussdFlow.js +1 -22
  18. package/dist/index.js +0 -2
  19. package/dist/ips/tryGetIPRangeName.js +1 -111
  20. package/dist/pacman/index.js +1 -111
  21. package/dist/pacman/queryString.js +1 -50
  22. package/dist/reducers/click2smsFlow/Click2smsTypes.js +1 -5
  23. package/dist/reducers/click2smsFlow/IClick2smsConstants.js +1 -5
  24. package/dist/reducers/click2smsFlow/index.js +1 -199
  25. package/dist/reducers/click2smsFlow/utils.js +1 -372
  26. package/dist/reducers/moFlow/IMoConstants.js +1 -5
  27. package/dist/reducers/moFlow/MoTypes.js +1 -5
  28. package/dist/reducers/moFlow/index.js +1 -257
  29. package/dist/reducers/moFlow/utils.js +1 -340
  30. package/dist/reducers/moRedirFlow/IMoRedirConstants.js +1 -5
  31. package/dist/reducers/moRedirFlow/MoRedirTypes.js +1 -5
  32. package/dist/reducers/moRedirFlow/index.js +1 -243
  33. package/dist/reducers/moRedirFlow/utils.js +1 -240
  34. package/dist/reducers/oneClickFlow/IOneClickConstants.js +1 -5
  35. package/dist/reducers/oneClickFlow/OneClickTypes.js +1 -5
  36. package/dist/reducers/oneClickFlow/index.js +1 -458
  37. package/dist/reducers/oneClickFlow/utils.js +1 -410
  38. package/dist/reducers/pinFlow/IPinConstants.js +1 -5
  39. package/dist/reducers/pinFlow/PinTypes.js +1 -5
  40. package/dist/reducers/pinFlow/index.js +1 -543
  41. package/dist/reducers/pinFlow/utils.js +1 -554
  42. package/dist/reducers/strategy/IStategyActionContants.js +1 -5
  43. package/dist/reducers/strategy/StrategyTypes.js +1 -5
  44. package/dist/reducers/strategy/index.js +1 -419
  45. package/dist/reducers/strategy/strategies/ask_mobile_number.js +1 -581
  46. package/dist/reducers/strategy/strategies/ask_operator.js +1 -317
  47. package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +1 -1
  48. package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +1 -692
  49. package/dist/reducers/strategy/strategies/header_enrichment.js +1 -804
  50. package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.js +1 -118
  51. package/dist/reducers/strategy/utils.js +1 -710
  52. package/dist/reducers/ussdFlow/IUssdConstants.js +1 -5
  53. package/dist/reducers/ussdFlow/UssdTypes.js +1 -5
  54. package/dist/reducers/ussdFlow/index.js +1 -267
  55. package/dist/reducers/ussdFlow/utils.js +1 -247
  56. package/dist/store/index.js +1 -177
  57. package/dist/store/reducers.js +1 -38
  58. package/dist/utilities/handleSubmitNumber.js +1 -76
  59. package/dist/utilities/index.js +1 -68
  60. package/dist/utilities/loadScriptInnerHtml.js +1 -22
  61. package/dist/utilities/loadScriptSrc.js +1 -32
  62. package/package.json +3 -2
@@ -1,419 +1 @@
1
- "use strict";
2
-
3
- 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); }
4
-
5
- require("core-js/modules/es.symbol.js");
6
-
7
- require("core-js/modules/es.symbol.description.js");
8
-
9
- require("core-js/modules/es.symbol.iterator.js");
10
-
11
- require("core-js/modules/es.array.iterator.js");
12
-
13
- require("core-js/modules/es.string.iterator.js");
14
-
15
- require("core-js/modules/web.dom-collections.iterator.js");
16
-
17
- require("core-js/modules/es.symbol.async-iterator.js");
18
-
19
- require("core-js/modules/es.symbol.to-string-tag.js");
20
-
21
- require("core-js/modules/es.json.to-string-tag.js");
22
-
23
- require("core-js/modules/es.math.to-string-tag.js");
24
-
25
- require("core-js/modules/es.object.get-prototype-of.js");
26
-
27
- require("core-js/modules/web.dom-collections.for-each.js");
28
-
29
- require("core-js/modules/es.function.name.js");
30
-
31
- require("core-js/modules/es.object.set-prototype-of.js");
32
-
33
- require("core-js/modules/es.array.slice.js");
34
-
35
- require("core-js/modules/es.weak-map.js");
36
-
37
- require("core-js/modules/es.object.get-own-property-descriptor.js");
38
-
39
- Object.defineProperty(exports, "__esModule", {
40
- value: true
41
- });
42
- exports.StrategyFlowActionMaps = void 0;
43
- exports.checkSubscriptionAction = checkSubscriptionAction;
44
- exports.default = StrategyReducer;
45
- exports.genericHandler = genericHandler;
46
- exports.identifyStrategy = identifyStrategy;
47
- exports.mockStrategyStateByUrlParam = mockStrategyStateByUrlParam;
48
- exports.tracker = void 0;
49
-
50
- require("core-js/modules/es.object.to-string.js");
51
-
52
- require("core-js/modules/es.promise.js");
53
-
54
- var _immutabilityHelper = _interopRequireDefault(require("immutability-helper"));
55
-
56
- var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
57
-
58
- var _pacman = _interopRequireDefault(require("../../pacman"));
59
-
60
- var _click2smsFlow = require("../click2smsFlow");
61
-
62
- var _utils = require("../click2smsFlow/utils");
63
-
64
- var _moFlow = require("../moFlow");
65
-
66
- var _moRedirFlow = require("../moRedirFlow");
67
-
68
- var _oneClickFlow = require("../oneClickFlow");
69
-
70
- var _pinFlow = require("../pinFlow");
71
-
72
- var _ussdFlow = require("../ussdFlow");
73
-
74
- var _ask_mobile_number = _interopRequireWildcard(require("./strategies/ask_mobile_number"));
75
-
76
- var _ask_operator = _interopRequireWildcard(require("./strategies/ask_operator"));
77
-
78
- var _detect_operator_by_ip = _interopRequireDefault(require("./strategies/detect_operator_by_ip"));
79
-
80
- var _header_enrichment = _interopRequireDefault(require("./strategies/header_enrichment"));
81
-
82
- var _injectHeaderEnrichmentScript = _interopRequireDefault(require("./strategies/injectHeaderEnrichmentScript"));
83
-
84
- var _utils2 = require("./utils");
85
-
86
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
87
-
88
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
89
-
90
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
91
-
92
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { 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"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } 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 }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var 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); 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 (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, 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 = undefined), 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 = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } 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 = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, 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) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --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 (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (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 i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (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 = undefined), ContinueSentinel; } }, exports; }
93
-
94
- 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); } }
95
-
96
- 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); }); }; }
97
-
98
- var tracker = (0, _pacman.default)(typeof window !== 'undefined' ? window : null);
99
- exports.tracker = tracker;
100
-
101
- function mockStrategyStateByUrlParam() {
102
- return function (dispatch) {
103
- var search = (0, _utils2.searchToObject)();
104
-
105
- if (search['mock-flow'] !== undefined) {
106
- switch (search['mock-flow']) {
107
- case 'pin':
108
- dispatch({
109
- type: 'MOCK_STRATEGY_STATE',
110
- payload: _utils2.mockedPinFlow.currentState
111
- });
112
- dispatch((0, _pinFlow.mockPinFlow)(search['current-state']));
113
- break;
114
-
115
- case 'mo':
116
- dispatch({
117
- type: 'MOCK_STRATEGY_STATE',
118
- payload: _utils2.mockedMoFlow.currentState
119
- });
120
- dispatch((0, _moFlow.mockMoFlow)(search['current-state']));
121
- break;
122
-
123
- case 'moredir':
124
- dispatch({
125
- type: 'MOCK_STRATEGY_STATE',
126
- payload: _utils2.mockedMoRdirFlow.currentState
127
- });
128
- dispatch((0, _moRedirFlow.mockMoRedirFlow)(search['current-state']));
129
- break;
130
-
131
- case 'oneclick':
132
- dispatch({
133
- type: 'MOCK_STRATEGY_STATE',
134
- payload: _utils2.mockedOneClickFlow.currentState
135
- });
136
- setTimeout(function () {
137
- dispatch((0, _oneClickFlow.mockOneClickFlow)(search['current-state']));
138
- }, 2000);
139
- break;
140
-
141
- case 'click2sms':
142
- dispatch({
143
- type: 'MOCK_STRATEGY_STATE',
144
- payload: _utils2.mockedClick2smsFlow.currentState
145
- });
146
- break;
147
-
148
- case 'ussd':
149
- dispatch({
150
- type: 'MOCK_STRATEGY_STATE',
151
- payload: _utils2.mockedUssdFlow.currentState
152
- });
153
- dispatch((0, _ussdFlow.mockUssdFlow)(search['current-state']));
154
- break;
155
-
156
- default:
157
- throw new Error('Mock Flow not supported');
158
- }
159
- }
160
- };
161
- }
162
-
163
- function identifyStrategy() {
164
- return /*#__PURE__*/function () {
165
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch) {
166
- var _getConfig, strategy, strategyConfigs, isUseMsisdnPrefix, search;
167
-
168
- return _regeneratorRuntime().wrap(function _callee$(_context) {
169
- while (1) {
170
- switch (_context.prev = _context.next) {
171
- case 0:
172
- _getConfig = (0, _utils2.getConfig)(), strategy = _getConfig.strategy, strategyConfigs = _getConfig.strategyConfigs;
173
- isUseMsisdnPrefix = strategyConfigs.isUseMsisdnPrefix;
174
- search = (0, _utils2.searchToObject)();
175
-
176
- if (!(search['mock-flow'] !== undefined)) {
177
- _context.next = 7;
178
- break;
179
- }
180
-
181
- dispatch(mockStrategyStateByUrlParam());
182
- _context.next = 31;
183
- break;
184
-
185
- case 7:
186
- _context.t0 = strategy;
187
- _context.next = _context.t0 === 'pin-mo-ask-operator' ? 10 : _context.t0 === 'pin-mo-redir-ask-mobile-number' ? 11 : _context.t0 === 'pin-mo-ask-mobile-number' ? 11 : _context.t0 === 'pin-combo-ask-mobile-number' ? 11 : _context.t0 === 'pin-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'one-click-mo-pin-detect-operator-by-ip-or-msisdn' ? 12 : _context.t0 === 'mo-redir-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'mo-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'click2sms-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'pin-mo-detect-operator-by-ip' ? 12 : _context.t0 === 'pin-click2sms-ask-operator' ? 13 : _context.t0 === 'he-pin-one-click-ask-operator' ? 13 : _context.t0 === 'click2sms-one-click-ask-operator' ? 13 : _context.t0 === 'pin-one-click-ask-operator' ? 13 : _context.t0 === 'pin-header-enrichment' ? 14 : _context.t0 === 'he-pin-mo-redir-header-enrichment' ? 14 : _context.t0 === 'he-pin-one-click-header-enrichment' ? 14 : _context.t0 === 'he-mo-redir-one-click-header-enrichment' ? 14 : _context.t0 === 'header-enrichment-script' ? 15 : _context.t0 === 'pin' ? 16 : _context.t0 === 'mo' ? 18 : _context.t0 === 'mo-redir' ? 20 : _context.t0 === 'one-click' ? 22 : _context.t0 === 'click2sms' ? 24 : _context.t0 === 'ussd' ? 26 : _context.t0 === 'tpay-he' ? 28 : 30;
188
- break;
189
-
190
- case 10:
191
- return _context.abrupt("return", dispatch((0, _ask_operator.default)()));
192
-
193
- case 11:
194
- return _context.abrupt("return", dispatch((0, _ask_mobile_number.default)()));
195
-
196
- case 12:
197
- return _context.abrupt("return", dispatch((0, _detect_operator_by_ip.default)()));
198
-
199
- case 13:
200
- return _context.abrupt("return", dispatch((0, _ask_operator.default)()));
201
-
202
- case 14:
203
- return _context.abrupt("return", dispatch((0, _header_enrichment.default)()));
204
-
205
- case 15:
206
- return _context.abrupt("return", dispatch((0, _injectHeaderEnrichmentScript.default)()));
207
-
208
- case 16:
209
- tracker.sendOptInFlowEvent('Pin');
210
- return _context.abrupt("return", dispatch({
211
- type: 'IDENTIFY_STRATEGY',
212
- payload: {
213
- type: 'PIN',
214
- result: {
215
- nextAction: 'submitMSISDNAction',
216
- config: strategyConfigs.default.flowConfig,
217
- isUseMsisdnPrefix: isUseMsisdnPrefix
218
- }
219
- }
220
- }));
221
-
222
- case 18:
223
- tracker.sendOptInFlowEvent('Msisdn to sms');
224
- return _context.abrupt("return", dispatch({
225
- type: 'IDENTIFY_STRATEGY',
226
- payload: {
227
- type: 'MO',
228
- result: {
229
- nextAction: 'submitMSISDNAction',
230
- config: strategyConfigs.default.flowConfig
231
- }
232
- }
233
- }));
234
-
235
- case 20:
236
- tracker.sendOptInFlowEvent('Redirect');
237
- return _context.abrupt("return", dispatch({
238
- type: 'IDENTIFY_STRATEGY',
239
- payload: {
240
- type: 'MO_REDIR',
241
- result: {
242
- nextAction: 'submitMSISDNAction',
243
- config: strategyConfigs.default.flowConfig
244
- }
245
- }
246
- }));
247
-
248
- case 22:
249
- tracker.sendOptInFlowEvent('3G click');
250
- return _context.abrupt("return", dispatch({
251
- type: 'IDENTIFY_STRATEGY',
252
- payload: {
253
- type: 'ONE_CLICK',
254
- result: {
255
- nextAction: 'getRedirectUrlAction',
256
- config: strategyConfigs.default.flowConfig
257
- }
258
- }
259
- }));
260
-
261
- case 24:
262
- tracker.sendOptInFlowEvent('Click to sms');
263
- return _context.abrupt("return", dispatch({
264
- type: 'IDENTIFY_STRATEGY',
265
- payload: {
266
- type: 'CLICK2SMS',
267
- result: {
268
- nextAction: 'loadOc2sms',
269
- config: strategyConfigs.default.flowConfig
270
- }
271
- }
272
- }));
273
-
274
- case 26:
275
- tracker.sendOptInFlowEvent('Msisdn to sms');
276
- return _context.abrupt("return", dispatch({
277
- type: 'IDENTIFY_STRATEGY',
278
- payload: {
279
- type: 'USSD',
280
- result: {
281
- nextAction: 'submitMSISDNAction',
282
- config: strategyConfigs.default.flowConfig
283
- }
284
- }
285
- }));
286
-
287
- case 28:
288
- tracker.sendOptInFlowEvent('Hybrid Pin');
289
- return _context.abrupt("return", dispatch({
290
- type: 'IDENTIFY_STRATEGY',
291
- payload: {
292
- type: 'TPAY_HE',
293
- result: {
294
- nextAction: 'loadTpayAction',
295
- config: strategyConfigs.default.flowConfig
296
- }
297
- }
298
- }));
299
-
300
- case 30:
301
- throw new Error('Strategy not supported');
302
-
303
- case 31:
304
- case "end":
305
- return _context.stop();
306
- }
307
- }
308
- }, _callee);
309
- }));
310
-
311
- return function (_x) {
312
- return _ref.apply(this, arguments);
313
- };
314
- }();
315
- }
316
-
317
- function checkSubscriptionAction(trackingArgs) {
318
- return /*#__PURE__*/function () {
319
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(dispatch, store) {
320
- var currentState, maybeConfig;
321
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
322
- while (1) {
323
- switch (_context2.prev = _context2.next) {
324
- case 0:
325
- currentState = store().strategy.currentState; // @ts-ignore
326
-
327
- maybeConfig = currentState.result.config;
328
-
329
- try {
330
- dispatch({
331
- type: 'CHECK_SUBSCRIPTION'
332
- });
333
- (0, _utils.checkSubscription)(window, maybeConfig).then(function (product_url) {
334
- tracker.advancedInFlow(trackingArgs.flow, trackingArgs.action, trackingArgs.args);
335
- setTimeout(function () {
336
- window.location.href = product_url;
337
- }, 1000);
338
- });
339
- } catch (ex) {
340
- console.warn(ex);
341
- }
342
-
343
- case 3:
344
- case "end":
345
- return _context2.stop();
346
- }
347
- }
348
- }, _callee2);
349
- }));
350
-
351
- return function (_x2, _x3) {
352
- return _ref2.apply(this, arguments);
353
- };
354
- }();
355
- }
356
-
357
- function genericHandler(state, payload) {
358
- return (0, _immutabilityHelper.default)(state, {
359
- // @ts-ignore
360
- currentState: {
361
- $set: payload
362
- }
363
- });
364
- }
365
-
366
- var initialState = {
367
- currentState: {
368
- type: 'IDENTIFY_STRATEGY',
369
- result: RDS.NothingYet()
370
- }
371
- };
372
- var StrategyFlowActionMaps = {
373
- selectOperator: _ask_operator.selectOperator,
374
- submitMSISDNAction: _ask_mobile_number.submitMSISDNAction,
375
- loadOc2sms: _click2smsFlow.loadOc2sms
376
- };
377
- exports.StrategyFlowActionMaps = StrategyFlowActionMaps;
378
-
379
- function StrategyReducer() {
380
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
381
- var action = arguments.length > 1 ? arguments[1] : undefined;
382
-
383
- switch (action.type) {
384
- case 'IDENTIFY_STRATEGY':
385
- return genericHandler(state, action.payload);
386
-
387
- case 'IDENTIFY_FLOW_BY_OPERATOR_SELECT':
388
- return genericHandler(state, action.payload);
389
-
390
- case 'OPERATOR_SELECT':
391
- return genericHandler(state, action.payload);
392
-
393
- case 'IDENTIFY_FLOW_BY_MSISDN':
394
- return genericHandler(state, action.payload);
395
-
396
- case 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT':
397
- return genericHandler(state, action.payload);
398
-
399
- case 'IDENTIFY_FLOW_BY_IP':
400
- return genericHandler(state, action.payload);
401
-
402
- case 'IDENTIFY_FLOW_BY_IP_OPERATOR':
403
- return genericHandler(state, action.payload);
404
-
405
- case 'IDENTIFY_FLOW_BY_HE':
406
- return genericHandler(state, action.payload);
407
-
408
- case 'HE_IDENTIFY':
409
- // @ts-ignore
410
- return genericHandler(state, action.payload);
411
-
412
- case 'MOCK_STRATEGY_STATE':
413
- // @ts-ignore
414
- return genericHandler(state, action.payload);
415
-
416
- default:
417
- return state;
418
- }
419
- }
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.weak-map.js"),require("core-js/modules/es.object.get-own-property-descriptor.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")),_click2smsFlow=require("../click2smsFlow"),_utils=require("../click2smsFlow/utils"),_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 _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(search["mock-flow"]!==void 0)switch(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;default:throw new Error("Mock Flow not supported");}}}function identifyStrategy(){return function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(dispatch){var _getConfig,strategy,strategyConfigs,isUseMsisdnPrefix,search;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)(),void 0===search["mock-flow"]){_context.next=7;break}dispatch(mockStrategyStateByUrlParam()),_context.next=31;break;case 7:_context.t0=strategy,_context.next="pin-mo-ask-operator"===_context.t0?10:"pin-mo-redir-ask-mobile-number"===_context.t0?11:"pin-mo-ask-mobile-number"===_context.t0?11:"pin-combo-ask-mobile-number"===_context.t0?11:"pin-one-click-detect-operator-by-ip"===_context.t0?12:"one-click-mo-pin-detect-operator-by-ip-or-msisdn"===_context.t0?12:"mo-redir-one-click-detect-operator-by-ip"===_context.t0?12:"mo-one-click-detect-operator-by-ip"===_context.t0?12:"click2sms-one-click-detect-operator-by-ip"===_context.t0?12:"pin-mo-detect-operator-by-ip"===_context.t0?12:"pin-click2sms-ask-operator"===_context.t0?13:"he-pin-one-click-ask-operator"===_context.t0?13:"click2sms-one-click-ask-operator"===_context.t0?13:"pin-one-click-ask-operator"===_context.t0?13:"pin-header-enrichment"===_context.t0?14:"he-pin-mo-redir-header-enrichment"===_context.t0?14:"he-pin-one-click-header-enrichment"===_context.t0?14:"he-mo-redir-one-click-header-enrichment"===_context.t0?14:"header-enrichment-script"===_context.t0?15:"pin"===_context.t0?16:"mo"===_context.t0?18:"mo-redir"===_context.t0?20:"one-click"===_context.t0?22:"click2sms"===_context.t0?24:"ussd"===_context.t0?26:"tpay-he"===_context.t0?28:30;break;case 10:return _context.abrupt("return",dispatch((0,_ask_operator.default)()));case 11:return _context.abrupt("return",dispatch((0,_ask_mobile_number.default)()));case 12:return _context.abrupt("return",dispatch((0,_detect_operator_by_ip.default)()));case 13:return _context.abrupt("return",dispatch((0,_ask_operator.default)()));case 14:return _context.abrupt("return",dispatch((0,_header_enrichment.default)()));case 15:return _context.abrupt("return",dispatch((0,_injectHeaderEnrichmentScript.default)()));case 16:return tracker.sendOptInFlowEvent("Pin"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig,isUseMsisdnPrefix:isUseMsisdnPrefix}}}));case 18:return tracker.sendOptInFlowEvent("Msisdn to sms"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"MO",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}}));case 20:return tracker.sendOptInFlowEvent("Redirect"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"MO_REDIR",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}}));case 22:return tracker.sendOptInFlowEvent("3G click"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"ONE_CLICK",result:{nextAction:"getRedirectUrlAction",config:strategyConfigs.default.flowConfig}}}));case 24:return tracker.sendOptInFlowEvent("Click to sms"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"CLICK2SMS",result:{nextAction:"loadOc2sms",config:strategyConfigs.default.flowConfig}}}));case 26:return tracker.sendOptInFlowEvent("Msisdn to sms"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"USSD",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}}));case 28:return tracker.sendOptInFlowEvent("Hybrid Pin"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"TPAY_HE",result:{nextAction:"loadTpayAction",config:strategyConfigs.default.flowConfig}}}));case 30:throw new Error("Strategy not supported");case 31: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){tracker.advancedInFlow(trackingArgs.flow,trackingArgs.action,trackingArgs.args),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 initialState={currentState:{type:"IDENTIFY_STRATEGY",result:RDS.NothingYet()}},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;}}