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,543 +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.object.keys.js");
6
-
7
- require("core-js/modules/es.symbol.js");
8
-
9
- require("core-js/modules/es.array.filter.js");
10
-
11
- require("core-js/modules/es.object.get-own-property-descriptor.js");
12
-
13
- require("core-js/modules/web.dom-collections.for-each.js");
14
-
15
- require("core-js/modules/es.object.get-own-property-descriptors.js");
16
-
17
- require("core-js/modules/es.symbol.description.js");
18
-
19
- require("core-js/modules/es.symbol.iterator.js");
20
-
21
- require("core-js/modules/es.array.iterator.js");
22
-
23
- require("core-js/modules/es.string.iterator.js");
24
-
25
- require("core-js/modules/web.dom-collections.iterator.js");
26
-
27
- require("core-js/modules/es.symbol.async-iterator.js");
28
-
29
- require("core-js/modules/es.symbol.to-string-tag.js");
30
-
31
- require("core-js/modules/es.json.to-string-tag.js");
32
-
33
- require("core-js/modules/es.math.to-string-tag.js");
34
-
35
- require("core-js/modules/es.object.get-prototype-of.js");
36
-
37
- require("core-js/modules/es.function.name.js");
38
-
39
- require("core-js/modules/es.object.set-prototype-of.js");
40
-
41
- require("core-js/modules/es.array.slice.js");
42
-
43
- require("core-js/modules/es.weak-map.js");
44
-
45
- Object.defineProperty(exports, "__esModule", {
46
- value: true
47
- });
48
- exports.PinFlowActionMaps = void 0;
49
- exports.backToStart = backToStart;
50
- exports.default = PinFlowReducer;
51
- exports.mockPinFlow = mockPinFlow;
52
- exports.reSubmitMSISDNAction = reSubmitMSISDNAction;
53
- exports.submitMSISDNAction = submitMSISDNAction;
54
- exports.submitPinAction = submitPinAction;
55
-
56
- require("core-js/modules/es.object.to-string.js");
57
-
58
- require("core-js/modules/es.promise.js");
59
-
60
- var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
61
-
62
- var _utilities = require("../../utilities");
63
-
64
- var _strategy = require("../strategy");
65
-
66
- var _utils = require("../strategy/utils");
67
-
68
- var _utils2 = _interopRequireWildcard(require("./utils"));
69
-
70
- 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); }
71
-
72
- 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; }
73
-
74
- 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; }
75
-
76
- 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; }
77
-
78
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
79
-
80
- 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; }
81
-
82
- 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); } }
83
-
84
- 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); }); }; }
85
-
86
- var getConfigByMsisdnPrefix = function getConfigByMsisdnPrefix(msisdn) {
87
- var operatorByPrefix = (0, _utilities.getSAOperatorByMsisdnPrefix)(msisdn);
88
- var flowObj = (0, _utils.determineFlowByOperator)(operatorByPrefix);
89
- return flowObj.flowConfig;
90
- }; // ACTION CREATORS
91
-
92
-
93
- function submitMSISDNAction(msisdn, extraParams) {
94
- return /*#__PURE__*/function () {
95
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch, store) {
96
- var currentState, pinFlowCurrentState, _currentState$result, configByStrategy, isUseMsisdnPrefix, config, pinMaxLengthByOp, msisdnSubmissionResult, operator, errorType;
97
-
98
- return _regeneratorRuntime().wrap(function _callee$(_context) {
99
- while (1) {
100
- switch (_context.prev = _context.next) {
101
- case 0:
102
- currentState = store().strategy.currentState;
103
- pinFlowCurrentState = store().pinFlow.currentState;
104
-
105
- if (!(currentState.type === 'PIN')) {
106
- _context.next = 26;
107
- break;
108
- }
109
-
110
- _currentState$result = currentState.result, configByStrategy = _currentState$result.config, isUseMsisdnPrefix = _currentState$result.isUseMsisdnPrefix;
111
- config = isUseMsisdnPrefix ? getConfigByMsisdnPrefix(msisdn) : configByStrategy;
112
- pinMaxLengthByOp = {
113
- SA_MOBILY: 6,
114
- SA_STC: 4,
115
- SA_ZAIN: 6
116
- };
117
- _context.prev = 6;
118
- dispatch({
119
- type: 'PIN_FLOW_MSISDN_SUBMIT',
120
- payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
121
- type: 'MSISDNEntry',
122
- result: RDS.Loading()
123
- })
124
- });
125
-
126
- _strategy.tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-submitted', {
127
- msisdn: msisdn
128
- });
129
-
130
- _context.next = 11;
131
- return (0, _utils2.default)(window, config, msisdn, extraParams);
132
-
133
- case 11:
134
- msisdnSubmissionResult = _context.sent;
135
- operator = msisdnSubmissionResult.type === 'SingleMSISDNSubmissionResult' ? msisdnSubmissionResult.operator : '';
136
- dispatch({
137
- type: 'PIN_FLOW_MSISDN_SUBMIT',
138
- payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
139
- type: 'MSISDNEntry',
140
- result: RDS.Success({})
141
- })
142
- });
143
-
144
- _strategy.tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-submission-success', {
145
- msisdn: msisdn
146
- });
147
-
148
- dispatch({
149
- type: 'PIN_FLOW_MSISDN_SUBMIT',
150
- payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
151
- type: 'PINEntry',
152
- result: RDS.NothingYet(),
153
- data: {
154
- actualPIN: msisdnSubmissionResult.type === 'SingleMSISDNSubmissionResult' ? msisdnSubmissionResult.pin : null,
155
- nextAction: 'submitPinAction',
156
- msisdn: msisdn,
157
- operator: operator,
158
- pinMaxLength: operator !== '' && pinMaxLengthByOp[operator] ? pinMaxLengthByOp[operator] : null
159
- }
160
- })
161
- });
162
- _context.next = 24;
163
- break;
164
-
165
- case 18:
166
- _context.prev = 18;
167
- _context.t0 = _context["catch"](6);
168
- console.warn(_context.t0);
169
- errorType = // eslint-disable-next-line no-nested-ternary
170
- _context.t0.type === 'AlreadySubscribed' ? 'AlreadySubscribed' : _context.t0.type === 'InvalidMSISDN' ? 'InvalidMSISDN' : 'UnknownError';
171
-
172
- _strategy.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-submission-failure', {
173
- msisdn: msisdn,
174
- errorType: errorType || 'UnknownError'
175
- });
176
-
177
- dispatch({
178
- type: 'PIN_FLOW_MSISDN_SUBMIT_ERROR',
179
- payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
180
- type: 'MSISDNEntry',
181
- result: RDS.Failure({
182
- errorType: errorType,
183
- error: _context.t0,
184
- productUrl: _context.t0.productUrl
185
- })
186
- })
187
- });
188
-
189
- case 24:
190
- _context.next = 29;
191
- break;
192
-
193
- case 26:
194
- dispatch({
195
- type: 'PIN_FLOW_MSISDN_SUBMIT_ERROR',
196
- payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
197
- type: 'MSISDNEntry',
198
- result: RDS.Failure({
199
- errorType: 'UnknownError',
200
- error: null
201
- })
202
- })
203
- });
204
-
205
- _strategy.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-submission-failure', {
206
- msisdn: msisdn,
207
- errorType: 'UnexpectedState'
208
- });
209
-
210
- throw new Error('Unexpected state');
211
-
212
- case 29:
213
- case "end":
214
- return _context.stop();
215
- }
216
- }
217
- }, _callee, null, [[6, 18]]);
218
- }));
219
-
220
- return function (_x, _x2) {
221
- return _ref.apply(this, arguments);
222
- };
223
- }();
224
- }
225
-
226
- function reSubmitMSISDNAction(msisdn, extraParams) {
227
- return /*#__PURE__*/function () {
228
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(dispatch, store) {
229
- var currentState, pinFlowCurrentState, config, msisdnSubmissionResult, errorType;
230
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
231
- while (1) {
232
- switch (_context2.prev = _context2.next) {
233
- case 0:
234
- currentState = store().strategy.currentState;
235
- pinFlowCurrentState = store().pinFlow.currentState;
236
-
237
- if (!(currentState.type === 'PIN')) {
238
- _context2.next = 23;
239
- break;
240
- }
241
-
242
- config = currentState.result.config;
243
- _context2.prev = 4;
244
-
245
- // dispatch({
246
- // type: "PIN_FLOW_MSISDN_SUBMIT",
247
- // payload:{
248
- // type: "MSISDNEntry",
249
- // result: RDS.Loading()
250
- // }
251
- // });
252
- _strategy.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-resubmission', {
253
- msisdn: msisdn
254
- });
255
-
256
- _strategy.tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-submitted', {
257
- msisdn: msisdn
258
- });
259
-
260
- _context2.next = 9;
261
- return (0, _utils2.default)(window, config, msisdn, extraParams);
262
-
263
- case 9:
264
- msisdnSubmissionResult = _context2.sent;
265
- dispatch({
266
- type: 'PIN_FLOW_MSISDN_SUBMIT',
267
- payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
268
- type: 'MSISDNEntry',
269
- result: RDS.Success({})
270
- })
271
- });
272
-
273
- _strategy.tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-submission-success', {
274
- msisdn: msisdn
275
- });
276
-
277
- dispatch({
278
- type: 'PIN_FLOW_MSISDN_SUBMIT',
279
- payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
280
- type: 'PINEntry',
281
- result: RDS.NothingYet(),
282
- data: {
283
- actualPIN: msisdnSubmissionResult.type === 'SingleMSISDNSubmissionResult' ? msisdnSubmissionResult.pin : null,
284
- nextAction: 'submitPinAction',
285
- msisdn: msisdn
286
- }
287
- })
288
- });
289
- _context2.next = 21;
290
- break;
291
-
292
- case 15:
293
- _context2.prev = 15;
294
- _context2.t0 = _context2["catch"](4);
295
- console.warn(_context2.t0);
296
- errorType = _context2.t0.type === 'AlreadySubscribed' ? 'AlreadySubscribed' : _context2.t0.type === 'InvalidMSISDN' ? 'InvalidMSISDN' : 'UnknownError';
297
-
298
- _strategy.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-submission-failure', {
299
- msisdn: msisdn,
300
- errorType: errorType || 'UnknownError'
301
- });
302
-
303
- dispatch({
304
- type: 'PIN_FLOW_MSISDN_SUBMIT_ERROR',
305
- payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
306
- type: 'MSISDNEntry',
307
- result: RDS.Failure({
308
- errorType: errorType,
309
- error: _context2.t0,
310
- productUrl: _context2.t0.productUrl
311
- })
312
- })
313
- });
314
-
315
- case 21:
316
- _context2.next = 26;
317
- break;
318
-
319
- case 23:
320
- dispatch({
321
- type: 'PIN_FLOW_MSISDN_SUBMIT_ERROR',
322
- payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
323
- type: 'MSISDNEntry',
324
- result: RDS.Failure({
325
- errorType: 'UnknownError',
326
- error: null
327
- })
328
- })
329
- });
330
-
331
- _strategy.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-submission-failure', {
332
- msisdn: msisdn,
333
- errorType: 'UnexpectedState'
334
- });
335
-
336
- throw new Error('Unexpected state');
337
-
338
- case 26:
339
- case "end":
340
- return _context2.stop();
341
- }
342
- }
343
- }, _callee2, null, [[4, 15]]);
344
- }));
345
-
346
- return function (_x3, _x4) {
347
- return _ref2.apply(this, arguments);
348
- };
349
- }();
350
- }
351
-
352
- function submitPinAction(msisdn, pin, extraParams) {
353
- return /*#__PURE__*/function () {
354
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(dispatch, store) {
355
- var currentState, pinFlowCurrentState, config, result, errorType;
356
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
357
- while (1) {
358
- switch (_context3.prev = _context3.next) {
359
- case 0:
360
- currentState = store().strategy.currentState;
361
- pinFlowCurrentState = store().pinFlow.currentState;
362
- _context3.prev = 2;
363
- dispatch({
364
- type: 'PIN_SUBMIT',
365
- payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
366
- type: 'PINEntry',
367
- result: RDS.Loading()
368
- })
369
- });
370
-
371
- _strategy.tracker.advancedInFlow('tallyman.v1-pin', 'pin-submitted', {
372
- msisdn: msisdn,
373
- pin: pin
374
- });
375
-
376
- if (!(currentState.type === 'PIN')) {
377
- _context3.next = 14;
378
- break;
379
- }
380
-
381
- config = currentState.result.config;
382
- _context3.next = 9;
383
- return (0, _utils2.submitPIN)(window, pin, config, extraParams);
384
-
385
- case 9:
386
- result = _context3.sent;
387
-
388
- _strategy.tracker.advancedInFlow('tallyman.v1-pin', 'pin-submission-success', {
389
- msisdn: msisdn,
390
- pin: pin,
391
- finalUrl: result
392
- });
393
-
394
- dispatch({
395
- type: 'PIN_SUBMIT',
396
- payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
397
- type: 'PINEntry',
398
- result: RDS.Success({
399
- finalUrl: result.productUrl,
400
- isAlreadySubscribed: result.isAlreadySubscribed || false
401
- })
402
- })
403
- });
404
- _context3.next = 17;
405
- break;
406
-
407
- case 14:
408
- _strategy.tracker.recedeInFlow('tallyman.v1-pin', 'pin-submission-failure', {
409
- msisdn: msisdn,
410
- pin: pin
411
- });
412
-
413
- dispatch({
414
- type: 'PIN_SUBMIT_ERROR',
415
- payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
416
- type: 'PINEntry',
417
- result: RDS.Failure({
418
- errorType: 'UnexpectedState'
419
- })
420
- })
421
- });
422
- throw new Error('Unexpected state');
423
-
424
- case 17:
425
- _context3.next = 25;
426
- break;
427
-
428
- case 19:
429
- _context3.prev = 19;
430
- _context3.t0 = _context3["catch"](2);
431
- console.error(_context3.t0);
432
- errorType = _context3.t0.type || 'UnknownError';
433
-
434
- _strategy.tracker.recedeInFlow('tallyman.v1-pin', 'pin-submission-failure', {
435
- msisdn: msisdn,
436
- pin: pin
437
- });
438
-
439
- dispatch({
440
- type: 'PIN_SUBMIT_ERROR',
441
- payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
442
- type: 'PINEntry',
443
- result: RDS.Failure({
444
- errorType: errorType
445
- })
446
- })
447
- });
448
-
449
- case 25:
450
- case "end":
451
- return _context3.stop();
452
- }
453
- }
454
- }, _callee3, null, [[2, 19]]);
455
- }));
456
-
457
- return function (_x5, _x6) {
458
- return _ref3.apply(this, arguments);
459
- };
460
- }();
461
- }
462
-
463
- function mockPinFlow(mockState) {
464
- return function (dispatch) {
465
- if (mockState !== undefined) {
466
- switch (mockState) {
467
- case 'msisdn-failure-state':
468
- return dispatch({
469
- type: 'MOCK_PIN_FLOW_STATE',
470
- payload: _utils2.mockedMSISDNEntryFailure.currentState
471
- });
472
-
473
- case 'pin-state':
474
- return dispatch({
475
- type: 'MOCK_PIN_FLOW_STATE',
476
- payload: _utils2.mockedPINState.currentState
477
- });
478
-
479
- case 'completed-state':
480
- return dispatch({
481
- type: 'MOCK_PIN_FLOW_STATE',
482
- payload: _utils2.mockedCompletedState.currentState
483
- });
484
-
485
- default:
486
- throw new Error('Mock Flow not supported');
487
- }
488
- }
489
- };
490
- }
491
-
492
- function backToStart() {
493
- _strategy.tracker.recedeInFlow('tallyman.v1-pin', 'pin-submission-backtostart', 'requested to change phone number');
494
-
495
- return {
496
- type: 'BACK_TO_START',
497
- payload: {
498
- type: 'MSISDNEntry',
499
- result: RDS.NothingYet()
500
- }
501
- };
502
- }
503
-
504
- var initialState = {
505
- currentState: {
506
- type: 'MSISDNEntry',
507
- result: RDS.NothingYet()
508
- }
509
- };
510
- var PinFlowActionMaps = {
511
- submitMSISDNAction: submitMSISDNAction,
512
- submitPinAction: submitPinAction
513
- };
514
- exports.PinFlowActionMaps = PinFlowActionMaps;
515
-
516
- function PinFlowReducer() {
517
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
518
- var action = arguments.length > 1 ? arguments[1] : undefined;
519
-
520
- switch (action.type) {
521
- case 'PIN_FLOW_MSISDN_SUBMIT':
522
- return (0, _strategy.genericHandler)(state, action.payload);
523
-
524
- case 'PIN_FLOW_MSISDN_SUBMIT_ERROR':
525
- return (0, _strategy.genericHandler)(state, action.payload);
526
-
527
- case 'PIN_SUBMIT':
528
- return (0, _strategy.genericHandler)(state, action.payload);
529
-
530
- case 'BACK_TO_START':
531
- return (0, _strategy.genericHandler)(state, action.payload);
532
-
533
- case 'PIN_SUBMIT_ERROR':
534
- return (0, _strategy.genericHandler)(state, action.payload);
535
-
536
- case 'MOCK_PIN_FLOW_STATE':
537
- // @ts-ignore
538
- return (0, _strategy.genericHandler)(state, action.payload);
539
-
540
- default:
541
- return state;
542
- }
543
- }
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.object.keys.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.get-own-property-descriptors.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/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"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.PinFlowActionMaps=void 0,exports.backToStart=backToStart,exports.default=PinFlowReducer,exports.mockPinFlow=mockPinFlow,exports.reSubmitMSISDNAction=reSubmitMSISDNAction,exports.submitMSISDNAction=submitMSISDNAction,exports.submitPinAction=submitPinAction,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js");var RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_utilities=require("../../utilities"),_strategy=require("../strategy"),_utils=require("../strategy/utils"),_utils2=_interopRequireWildcard(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 _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 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 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 getConfigByMsisdnPrefix=function(msisdn){var operatorByPrefix=(0,_utilities.getSAOperatorByMsisdnPrefix)(msisdn),flowObj=(0,_utils.determineFlowByOperator)(operatorByPrefix);return flowObj.flowConfig};function submitMSISDNAction(msisdn,extraParams){return function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(dispatch,store){var currentState,pinFlowCurrentState,_currentState$result,configByStrategy,isUseMsisdnPrefix,config,pinMaxLengthByOp,msisdnSubmissionResult,operator,errorType;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(currentState=store().strategy.currentState,pinFlowCurrentState=store().pinFlow.currentState,"PIN"!==currentState.type){_context.next=26;break}return _currentState$result=currentState.result,configByStrategy=_currentState$result.config,isUseMsisdnPrefix=_currentState$result.isUseMsisdnPrefix,config=isUseMsisdnPrefix?getConfigByMsisdnPrefix(msisdn):configByStrategy,pinMaxLengthByOp={SA_MOBILY:6,SA_STC:4,SA_ZAIN:6},_context.prev=6,dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Loading()})}),_strategy.tracker.advancedInFlow("tallyman.v1-pin","msisdn-submitted",{msisdn:msisdn}),_context.next=11,(0,_utils2.default)(window,config,msisdn,extraParams);case 11:msisdnSubmissionResult=_context.sent,operator="SingleMSISDNSubmissionResult"===msisdnSubmissionResult.type?msisdnSubmissionResult.operator:"",dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Success({})})}),_strategy.tracker.advancedInFlow("tallyman.v1-pin","msisdn-submission-success",{msisdn:msisdn}),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.NothingYet(),data:{actualPIN:"SingleMSISDNSubmissionResult"===msisdnSubmissionResult.type?msisdnSubmissionResult.pin:null,nextAction:"submitPinAction",msisdn:msisdn,operator:operator,pinMaxLength:""!==operator&&pinMaxLengthByOp[operator]?pinMaxLengthByOp[operator]:null}})}),_context.next=24;break;case 18:_context.prev=18,_context.t0=_context["catch"](6),console.warn(_context.t0),errorType="AlreadySubscribed"===_context.t0.type?"AlreadySubscribed":"InvalidMSISDN"===_context.t0.type?"InvalidMSISDN":"UnknownError",_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:msisdn,errorType:errorType||"UnknownError"}),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Failure({errorType:errorType,error:_context.t0,productUrl:_context.t0.productUrl})})});case 24:_context.next=29;break;case 26:throw dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Failure({errorType:"UnknownError",error:null})})}),_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:msisdn,errorType:"UnexpectedState"}),new Error("Unexpected state");case 29:case"end":return _context.stop();}},_callee,null,[[6,18]])}));return function(_x,_x2){return _ref.apply(this,arguments)}}()}function reSubmitMSISDNAction(msisdn,extraParams){return function(){var _ref2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(dispatch,store){var currentState,pinFlowCurrentState,config,msisdnSubmissionResult,errorType;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:if(currentState=store().strategy.currentState,pinFlowCurrentState=store().pinFlow.currentState,"PIN"!==currentState.type){_context2.next=23;break}return config=currentState.result.config,_context2.prev=4,_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-resubmission",{msisdn:msisdn}),_strategy.tracker.advancedInFlow("tallyman.v1-pin","msisdn-submitted",{msisdn:msisdn}),_context2.next=9,(0,_utils2.default)(window,config,msisdn,extraParams);case 9:msisdnSubmissionResult=_context2.sent,dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Success({})})}),_strategy.tracker.advancedInFlow("tallyman.v1-pin","msisdn-submission-success",{msisdn:msisdn}),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.NothingYet(),data:{actualPIN:"SingleMSISDNSubmissionResult"===msisdnSubmissionResult.type?msisdnSubmissionResult.pin:null,nextAction:"submitPinAction",msisdn:msisdn}})}),_context2.next=21;break;case 15:_context2.prev=15,_context2.t0=_context2["catch"](4),console.warn(_context2.t0),errorType="AlreadySubscribed"===_context2.t0.type?"AlreadySubscribed":"InvalidMSISDN"===_context2.t0.type?"InvalidMSISDN":"UnknownError",_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:msisdn,errorType:errorType||"UnknownError"}),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Failure({errorType:errorType,error:_context2.t0,productUrl:_context2.t0.productUrl})})});case 21:_context2.next=26;break;case 23:throw dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Failure({errorType:"UnknownError",error:null})})}),_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:msisdn,errorType:"UnexpectedState"}),new Error("Unexpected state");case 26:case"end":return _context2.stop();}},_callee2,null,[[4,15]])}));return function(_x3,_x4){return _ref2.apply(this,arguments)}}()}function submitPinAction(msisdn,pin,extraParams){return function(){var _ref3=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(dispatch,store){var currentState,pinFlowCurrentState,config,result,errorType;return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:if(currentState=store().strategy.currentState,pinFlowCurrentState=store().pinFlow.currentState,_context3.prev=2,dispatch({type:"PIN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.Loading()})}),_strategy.tracker.advancedInFlow("tallyman.v1-pin","pin-submitted",{msisdn:msisdn,pin:pin}),"PIN"!==currentState.type){_context3.next=14;break}return config=currentState.result.config,_context3.next=9,(0,_utils2.submitPIN)(window,pin,config,extraParams);case 9:result=_context3.sent,_strategy.tracker.advancedInFlow("tallyman.v1-pin","pin-submission-success",{msisdn:msisdn,pin:pin,finalUrl:result}),dispatch({type:"PIN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.Success({finalUrl:result.productUrl,isAlreadySubscribed:result.isAlreadySubscribed||!1})})}),_context3.next=17;break;case 14:throw _strategy.tracker.recedeInFlow("tallyman.v1-pin","pin-submission-failure",{msisdn:msisdn,pin:pin}),dispatch({type:"PIN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.Failure({errorType:"UnexpectedState"})})}),new Error("Unexpected state");case 17:_context3.next=25;break;case 19:_context3.prev=19,_context3.t0=_context3["catch"](2),console.error(_context3.t0),errorType=_context3.t0.type||"UnknownError",_strategy.tracker.recedeInFlow("tallyman.v1-pin","pin-submission-failure",{msisdn:msisdn,pin:pin}),dispatch({type:"PIN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.Failure({errorType:errorType})})});case 25:case"end":return _context3.stop();}},_callee3,null,[[2,19]])}));return function(_x5,_x6){return _ref3.apply(this,arguments)}}()}function mockPinFlow(mockState){return function(dispatch){if(mockState!==void 0)switch(mockState){case"msisdn-failure-state":return dispatch({type:"MOCK_PIN_FLOW_STATE",payload:_utils2.mockedMSISDNEntryFailure.currentState});case"pin-state":return dispatch({type:"MOCK_PIN_FLOW_STATE",payload:_utils2.mockedPINState.currentState});case"completed-state":return dispatch({type:"MOCK_PIN_FLOW_STATE",payload:_utils2.mockedCompletedState.currentState});default:throw new Error("Mock Flow not supported");}}}function backToStart(){return _strategy.tracker.recedeInFlow("tallyman.v1-pin","pin-submission-backtostart","requested to change phone number"),{type:"BACK_TO_START",payload:{type:"MSISDNEntry",result:RDS.NothingYet()}}}var initialState={currentState:{type:"MSISDNEntry",result:RDS.NothingYet()}},PinFlowActionMaps={submitMSISDNAction:submitMSISDNAction,submitPinAction:submitPinAction};exports.PinFlowActionMaps=PinFlowActionMaps;function PinFlowReducer(){var state=0<arguments.length&&arguments[0]!==void 0?arguments[0]:initialState,action=1<arguments.length?arguments[1]:void 0;switch(action.type){case"PIN_FLOW_MSISDN_SUBMIT":return(0,_strategy.genericHandler)(state,action.payload);case"PIN_FLOW_MSISDN_SUBMIT_ERROR":return(0,_strategy.genericHandler)(state,action.payload);case"PIN_SUBMIT":return(0,_strategy.genericHandler)(state,action.payload);case"BACK_TO_START":return(0,_strategy.genericHandler)(state,action.payload);case"PIN_SUBMIT_ERROR":return(0,_strategy.genericHandler)(state,action.payload);case"MOCK_PIN_FLOW_STATE":return(0,_strategy.genericHandler)(state,action.payload);default:return state;}}