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.
- package/.babelrc +9 -1
- package/dist/@types/window.d.js +1 -5
- package/dist/api/index.js +1 -760
- package/dist/common-types/AppThunk.js +1 -5
- package/dist/common-types/Either.js +1 -5
- package/dist/common-types/IError.js +1 -5
- package/dist/common-types/ITracker.js +1 -5
- package/dist/common-types/IVisitor.js +1 -5
- package/dist/common-types/RemoteDataState.js +1 -138
- package/dist/custom-hooks/useStrategyConfig.js +1 -24
- package/dist/flows/click2smsFlow.js +1 -23
- package/dist/flows/moFlow.js +1 -23
- package/dist/flows/moRedirFlow.js +1 -23
- package/dist/flows/oneClickFlow.js +1 -29
- package/dist/flows/pinFlow.js +1 -25
- package/dist/flows/strategy.js +1 -49
- package/dist/flows/ussdFlow.js +1 -22
- package/dist/index.js +0 -2
- package/dist/ips/tryGetIPRangeName.js +1 -111
- package/dist/pacman/index.js +1 -111
- package/dist/pacman/queryString.js +1 -50
- package/dist/reducers/click2smsFlow/Click2smsTypes.js +1 -5
- package/dist/reducers/click2smsFlow/IClick2smsConstants.js +1 -5
- package/dist/reducers/click2smsFlow/index.js +1 -199
- package/dist/reducers/click2smsFlow/utils.js +1 -372
- package/dist/reducers/moFlow/IMoConstants.js +1 -5
- package/dist/reducers/moFlow/MoTypes.js +1 -5
- package/dist/reducers/moFlow/index.js +1 -257
- package/dist/reducers/moFlow/utils.js +1 -340
- package/dist/reducers/moRedirFlow/IMoRedirConstants.js +1 -5
- package/dist/reducers/moRedirFlow/MoRedirTypes.js +1 -5
- package/dist/reducers/moRedirFlow/index.js +1 -243
- package/dist/reducers/moRedirFlow/utils.js +1 -240
- package/dist/reducers/oneClickFlow/IOneClickConstants.js +1 -5
- package/dist/reducers/oneClickFlow/OneClickTypes.js +1 -5
- package/dist/reducers/oneClickFlow/index.js +1 -458
- package/dist/reducers/oneClickFlow/utils.js +1 -410
- package/dist/reducers/pinFlow/IPinConstants.js +1 -5
- package/dist/reducers/pinFlow/PinTypes.js +1 -5
- package/dist/reducers/pinFlow/index.js +1 -543
- package/dist/reducers/pinFlow/utils.js +1 -554
- package/dist/reducers/strategy/IStategyActionContants.js +1 -5
- package/dist/reducers/strategy/StrategyTypes.js +1 -5
- package/dist/reducers/strategy/index.js +1 -419
- package/dist/reducers/strategy/strategies/ask_mobile_number.js +1 -581
- package/dist/reducers/strategy/strategies/ask_operator.js +1 -317
- package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +1 -1
- package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +1 -692
- package/dist/reducers/strategy/strategies/header_enrichment.js +1 -804
- package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.js +1 -118
- package/dist/reducers/strategy/utils.js +1 -710
- package/dist/reducers/ussdFlow/IUssdConstants.js +1 -5
- package/dist/reducers/ussdFlow/UssdTypes.js +1 -5
- package/dist/reducers/ussdFlow/index.js +1 -267
- package/dist/reducers/ussdFlow/utils.js +1 -247
- package/dist/store/index.js +1 -177
- package/dist/store/reducers.js +1 -38
- package/dist/utilities/handleSubmitNumber.js +1 -76
- package/dist/utilities/index.js +1 -68
- package/dist/utilities/loadScriptInnerHtml.js +1 -22
- package/dist/utilities/loadScriptSrc.js +1 -32
- package/package.json +3 -2
|
@@ -1,554 +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.array.filter.js");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.symbol.description.js");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.symbol.iterator.js");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.symbol.async-iterator.js");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.symbol.to-string-tag.js");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.json.to-string-tag.js");
|
|
24
|
-
|
|
25
|
-
require("core-js/modules/es.math.to-string-tag.js");
|
|
26
|
-
|
|
27
|
-
require("core-js/modules/es.object.get-prototype-of.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
|
-
Object.defineProperty(exports, "__esModule", {
|
|
38
|
-
value: true
|
|
39
|
-
});
|
|
40
|
-
exports.default = submitMSISDN;
|
|
41
|
-
exports.loadMcpShield = loadMcpShield;
|
|
42
|
-
exports.mockedPINState = exports.mockedMSISDNEntryFailure = exports.mockedCompletedState = void 0;
|
|
43
|
-
exports.submitPIN = submitPIN;
|
|
44
|
-
|
|
45
|
-
require("core-js/modules/es.object.to-string.js");
|
|
46
|
-
|
|
47
|
-
require("core-js/modules/es.promise.js");
|
|
48
|
-
|
|
49
|
-
require("core-js/modules/es.array.join.js");
|
|
50
|
-
|
|
51
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
52
|
-
|
|
53
|
-
require("core-js/modules/es.string.match.js");
|
|
54
|
-
|
|
55
|
-
require("core-js/modules/es.string.search.js");
|
|
56
|
-
|
|
57
|
-
require("core-js/modules/es.array.map.js");
|
|
58
|
-
|
|
59
|
-
require("core-js/modules/es.object.keys.js");
|
|
60
|
-
|
|
61
|
-
require("core-js/modules/es.array.concat.js");
|
|
62
|
-
|
|
63
|
-
require("core-js/modules/es.array.iterator.js");
|
|
64
|
-
|
|
65
|
-
require("core-js/modules/es.string.iterator.js");
|
|
66
|
-
|
|
67
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
68
|
-
|
|
69
|
-
require("core-js/modules/es.array.find.js");
|
|
70
|
-
|
|
71
|
-
var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
|
|
72
|
-
|
|
73
|
-
var _loadScriptInnerHtml = _interopRequireDefault(require("../../utilities/loadScriptInnerHtml"));
|
|
74
|
-
|
|
75
|
-
var _utils = require("../strategy/utils");
|
|
76
|
-
|
|
77
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
78
|
-
|
|
79
|
-
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); }
|
|
80
|
-
|
|
81
|
-
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; }
|
|
82
|
-
|
|
83
|
-
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; }
|
|
84
|
-
|
|
85
|
-
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; }
|
|
86
|
-
|
|
87
|
-
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; }
|
|
88
|
-
|
|
89
|
-
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; }
|
|
90
|
-
|
|
91
|
-
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); } }
|
|
92
|
-
|
|
93
|
-
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); }); }; }
|
|
94
|
-
|
|
95
|
-
function submitMSISDN(_x, _x2, _x3, _x4) {
|
|
96
|
-
return _submitMSISDN.apply(this, arguments);
|
|
97
|
-
} // const bupperizeCountry = (c: string) => (c === 'gb' ? 'uk' : c);
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
function _submitMSISDN() {
|
|
101
|
-
_submitMSISDN = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(window, maybeConfig, internationalMSISDN, extraParams) {
|
|
102
|
-
var config;
|
|
103
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
104
|
-
while (1) {
|
|
105
|
-
switch (_context.prev = _context.next) {
|
|
106
|
-
case 0:
|
|
107
|
-
config = _objectSpread({
|
|
108
|
-
offer: window.pac_analytics.visitor.offer
|
|
109
|
-
}, maybeConfig || {});
|
|
110
|
-
|
|
111
|
-
if (!(config.automaticallySubmitAllOperators === true && !!config.operators && config.operators.length > 0)) {
|
|
112
|
-
_context.next = 3;
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return _context.abrupt("return", submitMSISDNForMultipleOperators(window, config, internationalMSISDN, config.operators, extraParams));
|
|
117
|
-
|
|
118
|
-
case 3:
|
|
119
|
-
return _context.abrupt("return", submitMSISDNOnce(window, config, internationalMSISDN, extraParams));
|
|
120
|
-
|
|
121
|
-
case 4:
|
|
122
|
-
case "end":
|
|
123
|
-
return _context.stop();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}, _callee);
|
|
127
|
-
}));
|
|
128
|
-
return _submitMSISDN.apply(this, arguments);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
var uniqidResult = ''; // eslint-disable-next-line consistent-return
|
|
132
|
-
|
|
133
|
-
function loadMcpShield(_x5, _x6) {
|
|
134
|
-
return _loadMcpShield.apply(this, arguments);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function _loadMcpShield() {
|
|
138
|
-
_loadMcpShield = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(window, config) {
|
|
139
|
-
var slug, country, device, host, offer, rockmanId, mcpShieldResult;
|
|
140
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
141
|
-
while (1) {
|
|
142
|
-
switch (_context2.prev = _context2.next) {
|
|
143
|
-
case 0:
|
|
144
|
-
slug = config.slug, country = config.country, device = config.device, host = config.host;
|
|
145
|
-
offer = window.pac_analytics.visitor.offer;
|
|
146
|
-
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
147
|
-
_context2.prev = 3;
|
|
148
|
-
_context2.next = 6;
|
|
149
|
-
return window.tallymanApi.mcpShield(host, country, slug, device, offer, rockmanId);
|
|
150
|
-
|
|
151
|
-
case 6:
|
|
152
|
-
mcpShieldResult = _context2.sent;
|
|
153
|
-
|
|
154
|
-
if (!(mcpShieldResult.success === false)) {
|
|
155
|
-
_context2.next = 11;
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
console.warn(mcpShieldResult.message);
|
|
160
|
-
_context2.next = 14;
|
|
161
|
-
break;
|
|
162
|
-
|
|
163
|
-
case 11:
|
|
164
|
-
(0, _loadScriptInnerHtml.default)(mcpShieldResult.source);
|
|
165
|
-
uniqidResult = mcpShieldResult.uniqid;
|
|
166
|
-
return _context2.abrupt("return", mcpShieldResult);
|
|
167
|
-
|
|
168
|
-
case 14:
|
|
169
|
-
_context2.next = 19;
|
|
170
|
-
break;
|
|
171
|
-
|
|
172
|
-
case 16:
|
|
173
|
-
_context2.prev = 16;
|
|
174
|
-
_context2.t0 = _context2["catch"](3);
|
|
175
|
-
console.warn(_context2.t0);
|
|
176
|
-
|
|
177
|
-
case 19:
|
|
178
|
-
case "end":
|
|
179
|
-
return _context2.stop();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}, _callee2, null, [[3, 16]]);
|
|
183
|
-
}));
|
|
184
|
-
return _loadMcpShield.apply(this, arguments);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function submitMSISDNOnce(_x7, _x8, _x9, _x10) {
|
|
188
|
-
return _submitMSISDNOnce.apply(this, arguments);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function _submitMSISDNOnce() {
|
|
192
|
-
_submitMSISDNOnce = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(window, config, internationalMSISDN, extraParams) {
|
|
193
|
-
var submissionError, newExtraParams, isSkipValidation, searchObj, msisdn, rockmanId, supportedSlugs, identifiedUser, slug, country, device, offer, host, search, extraParamsQs, uniqid, result, error, kwCodesWithMcpShied, mcpShieldResult;
|
|
194
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
195
|
-
while (1) {
|
|
196
|
-
switch (_context3.prev = _context3.next) {
|
|
197
|
-
case 0:
|
|
198
|
-
if (internationalMSISDN) {
|
|
199
|
-
_context3.next = 4;
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
submissionError = new Error("Error in submitMSISDN() trigger-pin action");
|
|
204
|
-
submissionError.type = 'InvalidMSISDN';
|
|
205
|
-
throw submissionError;
|
|
206
|
-
|
|
207
|
-
case 4:
|
|
208
|
-
newExtraParams = extraParams || {};
|
|
209
|
-
isSkipValidation = false;
|
|
210
|
-
searchObj = (0, _utils.searchToObject)();
|
|
211
|
-
|
|
212
|
-
if ((searchObj === null || searchObj === void 0 ? void 0 : searchObj.success) === 'true' && searchObj['msisdn-alias'] === '1') {
|
|
213
|
-
// Search param is set to 1 for header enrichment when the msisdn is masked
|
|
214
|
-
newExtraParams['skip-validation'] = '1';
|
|
215
|
-
isSkipValidation = true;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
msisdn = isSkipValidation ? internationalMSISDN : internationalMSISDN.match(/\d+/gi).join(''); // tallyman API expects international msisdn without any special character
|
|
219
|
-
|
|
220
|
-
rockmanId = window.pac_analytics.visitor.rockmanId; // HARDCODING This for now if the concerpt works we move this to configs
|
|
221
|
-
|
|
222
|
-
supportedSlugs = {
|
|
223
|
-
'kuwait-agency-mix-gamezone-puzzle1': 'kuwait-agency-mix-gamezone-puzzle1',
|
|
224
|
-
'kuwait-agency-mix-yourspot-riddles': 'kuwait-agency-mix-yourspot-riddles'
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
if (!(config.country.toLowerCase() === 'k2' && supportedSlugs[config.slug])) {
|
|
228
|
-
_context3.next = 16;
|
|
229
|
-
break;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
_context3.next = 14;
|
|
233
|
-
return window.tallymanApi.identify(config.host, config.slug, config.country, msisdn, config.device, config.offer, rockmanId);
|
|
234
|
-
|
|
235
|
-
case 14:
|
|
236
|
-
identifiedUser = _context3.sent;
|
|
237
|
-
|
|
238
|
-
if (identifiedUser.operator && identifiedUser.operator === 'K2_ZAIN') {
|
|
239
|
-
window.hostCountry = 'KW';
|
|
240
|
-
window.hostSlug = 'kw-mt2-hosted-flow-mobfun';
|
|
241
|
-
config.country = window.hostCountry;
|
|
242
|
-
config.slug = window.hostSlug;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
case 16:
|
|
246
|
-
slug = config.slug, country = config.country, device = config.device, offer = config.offer, host = config.host;
|
|
247
|
-
search = window.location.search.indexOf('redirect-back=1') === -1 ? window.location.search.substr(1) || '' : '';
|
|
248
|
-
extraParamsQs = "&".concat(Object.keys(newExtraParams).map(function (k) {
|
|
249
|
-
return "".concat(k, "=").concat(newExtraParams[k]);
|
|
250
|
-
}).join('&'));
|
|
251
|
-
uniqid = !!uniqidResult && uniqidResult !== '' ? "&mcpUniqid=".concat(uniqidResult) : '';
|
|
252
|
-
_context3.next = 22;
|
|
253
|
-
return window.tallymanApi.triggerPin(host, country, slug, device, offer, msisdn, rockmanId, extraParamsQs, search, uniqid);
|
|
254
|
-
|
|
255
|
-
case 22:
|
|
256
|
-
result = _context3.sent;
|
|
257
|
-
|
|
258
|
-
if (!(result.success === false)) {
|
|
259
|
-
_context3.next = 31;
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
error = new Error("Error in submitMSISDN() trigger-pin action:\n".concat(result.message));
|
|
264
|
-
error.type = result.message === 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'InvalidMSISDN';
|
|
265
|
-
error.productUrl = result.product_url ? result.product_url : '';
|
|
266
|
-
console.error(error);
|
|
267
|
-
throw error;
|
|
268
|
-
|
|
269
|
-
case 31:
|
|
270
|
-
kwCodesWithMcpShied = {
|
|
271
|
-
kw: {
|
|
272
|
-
kw_viva: 'kw_viva'
|
|
273
|
-
},
|
|
274
|
-
k2: {
|
|
275
|
-
k2_viva: 'k2_viva'
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
if (!(country && result.operator && (kwCodesWithMcpShied[country.toLowerCase()] && kwCodesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()] || country.toLowerCase() === 'iq'))) {
|
|
280
|
-
_context3.next = 43;
|
|
281
|
-
break;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
_context3.prev = 33;
|
|
285
|
-
_context3.next = 36;
|
|
286
|
-
return window.tallymanApi.mcpShield(host, country, slug, device, offer, rockmanId, result.operator, uniqid);
|
|
287
|
-
|
|
288
|
-
case 36:
|
|
289
|
-
mcpShieldResult = _context3.sent;
|
|
290
|
-
|
|
291
|
-
if (mcpShieldResult.success === false) {
|
|
292
|
-
console.warn(mcpShieldResult.message);
|
|
293
|
-
} else {
|
|
294
|
-
(0, _loadScriptInnerHtml.default)(mcpShieldResult.source);
|
|
295
|
-
uniqidResult = mcpShieldResult.uniqid;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
_context3.next = 43;
|
|
299
|
-
break;
|
|
300
|
-
|
|
301
|
-
case 40:
|
|
302
|
-
_context3.prev = 40;
|
|
303
|
-
_context3.t0 = _context3["catch"](33);
|
|
304
|
-
console.warn(_context3.t0);
|
|
305
|
-
|
|
306
|
-
case 43:
|
|
307
|
-
return _context3.abrupt("return", {
|
|
308
|
-
type: 'SingleMSISDNSubmissionResult',
|
|
309
|
-
pin: result.pin,
|
|
310
|
-
uniqidResult: uniqidResult,
|
|
311
|
-
operator: result.operator
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
case 44:
|
|
315
|
-
case "end":
|
|
316
|
-
return _context3.stop();
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}, _callee3, null, [[33, 40]]);
|
|
320
|
-
}));
|
|
321
|
-
return _submitMSISDNOnce.apply(this, arguments);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
function submitMSISDNForMultipleOperators(_x11, _x12, _x13, _x14, _x15) {
|
|
325
|
-
return _submitMSISDNForMultipleOperators.apply(this, arguments);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
function _submitMSISDNForMultipleOperators() {
|
|
329
|
-
_submitMSISDNForMultipleOperators = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(window, config, internationalMSISDN, operators, extraParams) {
|
|
330
|
-
var results, alreadySubscribed;
|
|
331
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
332
|
-
while (1) {
|
|
333
|
-
switch (_context5.prev = _context5.next) {
|
|
334
|
-
case 0:
|
|
335
|
-
_context5.next = 2;
|
|
336
|
-
return Promise.all(operators.map( /*#__PURE__*/function () {
|
|
337
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(o) {
|
|
338
|
-
var singleResult;
|
|
339
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
340
|
-
while (1) {
|
|
341
|
-
switch (_context4.prev = _context4.next) {
|
|
342
|
-
case 0:
|
|
343
|
-
_context4.prev = 0;
|
|
344
|
-
_context4.next = 3;
|
|
345
|
-
return submitMSISDNOnce(window, config, internationalMSISDN, _objectSpread(_objectSpread({}, extraParams), {}, {
|
|
346
|
-
operator: o
|
|
347
|
-
}));
|
|
348
|
-
|
|
349
|
-
case 3:
|
|
350
|
-
singleResult = _context4.sent;
|
|
351
|
-
return _context4.abrupt("return", (0, _utils.right)(_objectSpread(_objectSpread({}, singleResult), {}, {
|
|
352
|
-
operator: o
|
|
353
|
-
})));
|
|
354
|
-
|
|
355
|
-
case 7:
|
|
356
|
-
_context4.prev = 7;
|
|
357
|
-
_context4.t0 = _context4["catch"](0);
|
|
358
|
-
return _context4.abrupt("return", (0, _utils.left)(_context4.t0));
|
|
359
|
-
|
|
360
|
-
case 10:
|
|
361
|
-
case "end":
|
|
362
|
-
return _context4.stop();
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}, _callee4, null, [[0, 7]]);
|
|
366
|
-
}));
|
|
367
|
-
|
|
368
|
-
return function (_x20) {
|
|
369
|
-
return _ref.apply(this, arguments);
|
|
370
|
-
};
|
|
371
|
-
}()));
|
|
372
|
-
|
|
373
|
-
case 2:
|
|
374
|
-
results = _context5.sent;
|
|
375
|
-
// @ts-ignore
|
|
376
|
-
alreadySubscribed = results.find(function (r) {
|
|
377
|
-
return r.type === 'left' && r.value.type === 'AlreadySubscribed';
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
if (!results.every(function (r) {
|
|
381
|
-
return r.type === 'left';
|
|
382
|
-
})) {
|
|
383
|
-
_context5.next = 8;
|
|
384
|
-
break;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
throw results[0].value;
|
|
388
|
-
|
|
389
|
-
case 8:
|
|
390
|
-
if (!alreadySubscribed) {
|
|
391
|
-
_context5.next = 12;
|
|
392
|
-
break;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
throw alreadySubscribed.value;
|
|
396
|
-
|
|
397
|
-
case 12:
|
|
398
|
-
return _context5.abrupt("return", {
|
|
399
|
-
type: 'MultiOperatorMSISDNSubmissionResult'
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
case 13:
|
|
403
|
-
case "end":
|
|
404
|
-
return _context5.stop();
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}, _callee5);
|
|
408
|
-
}));
|
|
409
|
-
return _submitMSISDNForMultipleOperators.apply(this, arguments);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
function submitPIN(_x16, _x17, _x18, _x19) {
|
|
413
|
-
return _submitPIN.apply(this, arguments);
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
function _submitPIN() {
|
|
417
|
-
_submitPIN = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(window, pin, config, extraParams) {
|
|
418
|
-
var slug, country, device, host, offer, extraParamsQs, rockmanId, emptyPinError, uniqid, evinaTid, pinResult, pinErrorTypeMap, errorMessage, pinError, check, checkResult, isAlreadySubscribed, _pinError, _isAlreadySubscribed;
|
|
419
|
-
|
|
420
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
421
|
-
while (1) {
|
|
422
|
-
switch (_context6.prev = _context6.next) {
|
|
423
|
-
case 0:
|
|
424
|
-
if (window.hostCountry && window.hostSlug) {
|
|
425
|
-
config.country = window.hostCountry;
|
|
426
|
-
config.slug = window.hostSlug;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
slug = config.slug, country = config.country, device = config.device, host = config.host;
|
|
430
|
-
offer = window.pac_analytics.visitor.offer;
|
|
431
|
-
extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
|
|
432
|
-
return "".concat(k, "=").concat(extraParams[k]);
|
|
433
|
-
}).join('&'));
|
|
434
|
-
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
435
|
-
|
|
436
|
-
if (pin) {
|
|
437
|
-
_context6.next = 9;
|
|
438
|
-
break;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
emptyPinError = new Error("Error in submitMSISDN() verify-pin action:\n Pin Cannot Be Empty");
|
|
442
|
-
emptyPinError.type = 'InvalidPIN';
|
|
443
|
-
throw emptyPinError;
|
|
444
|
-
|
|
445
|
-
case 9:
|
|
446
|
-
uniqid = uniqidResult !== '' ? "&mcpUniqid=".concat(uniqidResult) : '';
|
|
447
|
-
evinaTid = typeof window !== 'undefined' && window.tid ? window.tid : '';
|
|
448
|
-
_context6.next = 13;
|
|
449
|
-
return window.tallymanApi.verifyPin(host, country, slug, device, offer, rockmanId, pin, extraParamsQs, uniqid, evinaTid);
|
|
450
|
-
|
|
451
|
-
case 13:
|
|
452
|
-
pinResult = _context6.sent;
|
|
453
|
-
|
|
454
|
-
if (!(pinResult.success === false)) {
|
|
455
|
-
_context6.next = 22;
|
|
456
|
-
break;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
pinErrorTypeMap = {
|
|
460
|
-
'pin does not match': 'InvalidPIN',
|
|
461
|
-
'mcp blocked': 'SessionBlocked'
|
|
462
|
-
};
|
|
463
|
-
errorMessage = pinErrorTypeMap[pinResult.message];
|
|
464
|
-
pinError = new Error("Error in submitMSISDN() verify-pin action:\n".concat(errorMessage));
|
|
465
|
-
pinError.type = errorMessage || 'InvalidPIN';
|
|
466
|
-
throw pinError;
|
|
467
|
-
|
|
468
|
-
case 22:
|
|
469
|
-
if (!(pinResult.async === true)) {
|
|
470
|
-
_context6.next = 35;
|
|
471
|
-
break;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
check = function check() {
|
|
475
|
-
return window.tallymanApi.checkSubscription(host, country, slug, device, offer, rockmanId, pin, extraParamsQs);
|
|
476
|
-
};
|
|
477
|
-
|
|
478
|
-
_context6.next = 26;
|
|
479
|
-
return (0, _utils.loop)(check, 30, function (r) {
|
|
480
|
-
return r.success;
|
|
481
|
-
}, 0);
|
|
482
|
-
|
|
483
|
-
case 26:
|
|
484
|
-
checkResult = _context6.sent;
|
|
485
|
-
|
|
486
|
-
if (!(checkResult.success === true)) {
|
|
487
|
-
_context6.next = 30;
|
|
488
|
-
break;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
isAlreadySubscribed = pinResult.message === 'ALREADY SUBSCRIBED';
|
|
492
|
-
return _context6.abrupt("return", {
|
|
493
|
-
productUrl: checkResult.product_url || null,
|
|
494
|
-
isAlreadySubscribed: isAlreadySubscribed
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
case 30:
|
|
498
|
-
_pinError = new Error("Error in submitMSISDN() verify-pin action:\n".concat(checkResult.message));
|
|
499
|
-
_pinError.type = 'InvalidPIN';
|
|
500
|
-
throw _pinError;
|
|
501
|
-
|
|
502
|
-
case 35:
|
|
503
|
-
_isAlreadySubscribed = pinResult.message === 'ALREADY SUBSCRIBED';
|
|
504
|
-
return _context6.abrupt("return", {
|
|
505
|
-
productUrl: pinResult.product_url || null,
|
|
506
|
-
isAlreadySubscribed: _isAlreadySubscribed
|
|
507
|
-
});
|
|
508
|
-
|
|
509
|
-
case 37:
|
|
510
|
-
case "end":
|
|
511
|
-
return _context6.stop();
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
}, _callee6);
|
|
515
|
-
}));
|
|
516
|
-
return _submitPIN.apply(this, arguments);
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
var mockedPINState = {
|
|
520
|
-
currentState: {
|
|
521
|
-
type: 'PINEntry',
|
|
522
|
-
result: RDS.NothingYet(),
|
|
523
|
-
data: {
|
|
524
|
-
actualPIN: '',
|
|
525
|
-
nextAction: 'submitPinAction',
|
|
526
|
-
msisdn: ''
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
};
|
|
530
|
-
exports.mockedPINState = mockedPINState;
|
|
531
|
-
var mockedCompletedState = {
|
|
532
|
-
currentState: {
|
|
533
|
-
type: 'PINEntry',
|
|
534
|
-
result: RDS.Success({
|
|
535
|
-
finalUrl: 'https://google.com'
|
|
536
|
-
}),
|
|
537
|
-
data: {
|
|
538
|
-
actualPIN: '',
|
|
539
|
-
nextAction: 'submitPinAction',
|
|
540
|
-
msisdn: ''
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
};
|
|
544
|
-
exports.mockedCompletedState = mockedCompletedState;
|
|
545
|
-
var mockedMSISDNEntryFailure = {
|
|
546
|
-
currentState: {
|
|
547
|
-
type: 'MSISDNEntry',
|
|
548
|
-
result: RDS.Failure({
|
|
549
|
-
errorType: 'InvalidMSISDN',
|
|
550
|
-
error: 'Invalid Mobile Number'
|
|
551
|
-
})
|
|
552
|
-
}
|
|
553
|
-
};
|
|
554
|
-
exports.mockedMSISDNEntryFailure = mockedMSISDNEntryFailure;
|
|
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.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.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.default=submitMSISDN,exports.loadMcpShield=loadMcpShield,exports.mockedPINState=exports.mockedMSISDNEntryFailure=exports.mockedCompletedState=void 0,exports.submitPIN=submitPIN,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.match.js"),require("core-js/modules/es.string.search.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.array.find.js");var RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_loadScriptInnerHtml=_interopRequireDefault(require("../../utilities/loadScriptInnerHtml")),_utils=require("../strategy/utils");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}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)})}}function submitMSISDN(){return _submitMSISDN.apply(this,arguments)}function _submitMSISDN(){return _submitMSISDN=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(window,maybeConfig,internationalMSISDN,extraParams){var config;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig||{}),!0!==config.automaticallySubmitAllOperators||!config.operators||!(0<config.operators.length)){_context.next=3;break}return _context.abrupt("return",submitMSISDNForMultipleOperators(window,config,internationalMSISDN,config.operators,extraParams));case 3:return _context.abrupt("return",submitMSISDNOnce(window,config,internationalMSISDN,extraParams));case 4:case"end":return _context.stop();}},_callee)})),_submitMSISDN.apply(this,arguments)}var uniqidResult="";function loadMcpShield(_x5,_x6){return _loadMcpShield.apply(this,arguments)}function _loadMcpShield(){return _loadMcpShield=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(window,config){var slug,country,device,host,offer,rockmanId,mcpShieldResult;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:return slug=config.slug,country=config.country,device=config.device,host=config.host,offer=window.pac_analytics.visitor.offer,rockmanId=window.pac_analytics.visitor.rockmanId,_context2.prev=3,_context2.next=6,window.tallymanApi.mcpShield(host,country,slug,device,offer,rockmanId);case 6:if(mcpShieldResult=_context2.sent,!1!==mcpShieldResult.success){_context2.next=11;break}console.warn(mcpShieldResult.message),_context2.next=14;break;case 11:return(0,_loadScriptInnerHtml.default)(mcpShieldResult.source),uniqidResult=mcpShieldResult.uniqid,_context2.abrupt("return",mcpShieldResult);case 14:_context2.next=19;break;case 16:_context2.prev=16,_context2.t0=_context2["catch"](3),console.warn(_context2.t0);case 19:case"end":return _context2.stop();}},_callee2,null,[[3,16]])})),_loadMcpShield.apply(this,arguments)}function submitMSISDNOnce(_x7,_x8,_x9,_x10){return _submitMSISDNOnce.apply(this,arguments)}function _submitMSISDNOnce(){return _submitMSISDNOnce=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(window,config,internationalMSISDN,extraParams){var submissionError,newExtraParams,isSkipValidation,searchObj,msisdn,rockmanId,supportedSlugs,identifiedUser,slug,country,device,offer,host,search,extraParamsQs,uniqid,result,error,kwCodesWithMcpShied,mcpShieldResult;return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:if(internationalMSISDN){_context3.next=4;break}throw submissionError=new Error("Error in submitMSISDN() trigger-pin action"),submissionError.type="InvalidMSISDN",submissionError;case 4:if(newExtraParams=extraParams||{},isSkipValidation=!1,searchObj=(0,_utils.searchToObject)(),"true"===(null===searchObj||void 0===searchObj?void 0:searchObj.success)&&"1"===searchObj["msisdn-alias"]&&(newExtraParams["skip-validation"]="1",isSkipValidation=!0),msisdn=isSkipValidation?internationalMSISDN:internationalMSISDN.match(/\d+/gi).join(""),rockmanId=window.pac_analytics.visitor.rockmanId,supportedSlugs={"kuwait-agency-mix-gamezone-puzzle1":"kuwait-agency-mix-gamezone-puzzle1","kuwait-agency-mix-yourspot-riddles":"kuwait-agency-mix-yourspot-riddles"},!("k2"===config.country.toLowerCase()&&supportedSlugs[config.slug])){_context3.next=16;break}return _context3.next=14,window.tallymanApi.identify(config.host,config.slug,config.country,msisdn,config.device,config.offer,rockmanId);case 14:identifiedUser=_context3.sent,identifiedUser.operator&&"K2_ZAIN"===identifiedUser.operator&&(window.hostCountry="KW",window.hostSlug="kw-mt2-hosted-flow-mobfun",config.country=window.hostCountry,config.slug=window.hostSlug);case 16:return slug=config.slug,country=config.country,device=config.device,offer=config.offer,host=config.host,search=-1===window.location.search.indexOf("redirect-back=1")?window.location.search.substr(1)||"":"",extraParamsQs="&".concat(Object.keys(newExtraParams).map(function(k){return"".concat(k,"=").concat(newExtraParams[k])}).join("&")),uniqid=uniqidResult&&""!==uniqidResult?"&mcpUniqid=".concat(uniqidResult):"",_context3.next=22,window.tallymanApi.triggerPin(host,country,slug,device,offer,msisdn,rockmanId,extraParamsQs,search,uniqid);case 22:if(result=_context3.sent,!1!==result.success){_context3.next=31;break}throw error=new Error("Error in submitMSISDN() trigger-pin action:\n".concat(result.message)),error.type="ALREADY SUBSCRIBED"===result.message?"AlreadySubscribed":"InvalidMSISDN",error.productUrl=result.product_url?result.product_url:"",console.error(error),error;case 31:if(kwCodesWithMcpShied={kw:{kw_viva:"kw_viva"},k2:{k2_viva:"k2_viva"}},!(country&&result.operator&&(kwCodesWithMcpShied[country.toLowerCase()]&&kwCodesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()]||"iq"===country.toLowerCase()))){_context3.next=43;break}return _context3.prev=33,_context3.next=36,window.tallymanApi.mcpShield(host,country,slug,device,offer,rockmanId,result.operator,uniqid);case 36:mcpShieldResult=_context3.sent,!1===mcpShieldResult.success?console.warn(mcpShieldResult.message):((0,_loadScriptInnerHtml.default)(mcpShieldResult.source),uniqidResult=mcpShieldResult.uniqid),_context3.next=43;break;case 40:_context3.prev=40,_context3.t0=_context3["catch"](33),console.warn(_context3.t0);case 43:return _context3.abrupt("return",{type:"SingleMSISDNSubmissionResult",pin:result.pin,uniqidResult:uniqidResult,operator:result.operator});case 44:case"end":return _context3.stop();}},_callee3,null,[[33,40]])})),_submitMSISDNOnce.apply(this,arguments)}function submitMSISDNForMultipleOperators(_x11,_x12,_x13,_x14,_x15){return _submitMSISDNForMultipleOperators.apply(this,arguments)}function _submitMSISDNForMultipleOperators(){return _submitMSISDNForMultipleOperators=_asyncToGenerator(_regeneratorRuntime().mark(function _callee5(window,config,internationalMSISDN,operators,extraParams){var results,alreadySubscribed;return _regeneratorRuntime().wrap(function _callee5$(_context5){for(;1;)switch(_context5.prev=_context5.next){case 0:return _context5.next=2,Promise.all(operators.map(function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(o){var singleResult;return _regeneratorRuntime().wrap(function _callee4$(_context4){for(;1;)switch(_context4.prev=_context4.next){case 0:return _context4.prev=0,_context4.next=3,submitMSISDNOnce(window,config,internationalMSISDN,_objectSpread(_objectSpread({},extraParams),{},{operator:o}));case 3:return singleResult=_context4.sent,_context4.abrupt("return",(0,_utils.right)(_objectSpread(_objectSpread({},singleResult),{},{operator:o})));case 7:return _context4.prev=7,_context4.t0=_context4["catch"](0),_context4.abrupt("return",(0,_utils.left)(_context4.t0));case 10:case"end":return _context4.stop();}},_callee4,null,[[0,7]])}));return function(_x20){return _ref.apply(this,arguments)}}()));case 2:if(results=_context5.sent,alreadySubscribed=results.find(function(r){return"left"===r.type&&"AlreadySubscribed"===r.value.type}),!results.every(function(r){return"left"===r.type})){_context5.next=8;break}throw results[0].value;case 8:if(!alreadySubscribed){_context5.next=12;break}throw alreadySubscribed.value;case 12:return _context5.abrupt("return",{type:"MultiOperatorMSISDNSubmissionResult"});case 13:case"end":return _context5.stop();}},_callee5)})),_submitMSISDNForMultipleOperators.apply(this,arguments)}function submitPIN(_x16,_x17,_x18,_x19){return _submitPIN.apply(this,arguments)}function _submitPIN(){return _submitPIN=_asyncToGenerator(_regeneratorRuntime().mark(function _callee6(window,pin,config,extraParams){var slug,country,device,host,offer,extraParamsQs,rockmanId,emptyPinError,uniqid,evinaTid,pinResult,pinErrorTypeMap,errorMessage,pinError,check,checkResult,isAlreadySubscribed,_pinError,_isAlreadySubscribed;return _regeneratorRuntime().wrap(function _callee6$(_context6){for(;1;)switch(_context6.prev=_context6.next){case 0:if(window.hostCountry&&window.hostSlug&&(config.country=window.hostCountry,config.slug=window.hostSlug),slug=config.slug,country=config.country,device=config.device,host=config.host,offer=window.pac_analytics.visitor.offer,extraParamsQs=extraParams?"&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")):"",rockmanId=window.pac_analytics.visitor.rockmanId,pin){_context6.next=9;break}throw emptyPinError=new Error("Error in submitMSISDN() verify-pin action:\n Pin Cannot Be Empty"),emptyPinError.type="InvalidPIN",emptyPinError;case 9:return uniqid=""===uniqidResult?"":"&mcpUniqid=".concat(uniqidResult),evinaTid="undefined"!=typeof window&&window.tid?window.tid:"",_context6.next=13,window.tallymanApi.verifyPin(host,country,slug,device,offer,rockmanId,pin,extraParamsQs,uniqid,evinaTid);case 13:if(pinResult=_context6.sent,!1!==pinResult.success){_context6.next=22;break}throw pinErrorTypeMap={"pin does not match":"InvalidPIN","mcp blocked":"SessionBlocked"},errorMessage=pinErrorTypeMap[pinResult.message],pinError=new Error("Error in submitMSISDN() verify-pin action:\n".concat(errorMessage)),pinError.type=errorMessage||"InvalidPIN",pinError;case 22:if(!0!==pinResult.async){_context6.next=35;break}return check=function check(){return window.tallymanApi.checkSubscription(host,country,slug,device,offer,rockmanId,pin,extraParamsQs)},_context6.next=26,(0,_utils.loop)(check,30,function(r){return r.success},0);case 26:if(checkResult=_context6.sent,!0!==checkResult.success){_context6.next=30;break}return isAlreadySubscribed="ALREADY SUBSCRIBED"===pinResult.message,_context6.abrupt("return",{productUrl:checkResult.product_url||null,isAlreadySubscribed:isAlreadySubscribed});case 30:throw _pinError=new Error("Error in submitMSISDN() verify-pin action:\n".concat(checkResult.message)),_pinError.type="InvalidPIN",_pinError;case 35:return _isAlreadySubscribed="ALREADY SUBSCRIBED"===pinResult.message,_context6.abrupt("return",{productUrl:pinResult.product_url||null,isAlreadySubscribed:_isAlreadySubscribed});case 37:case"end":return _context6.stop();}},_callee6)})),_submitPIN.apply(this,arguments)}var mockedPINState={currentState:{type:"PINEntry",result:RDS.NothingYet(),data:{actualPIN:"",nextAction:"submitPinAction",msisdn:""}}};exports.mockedPINState=mockedPINState;var mockedCompletedState={currentState:{type:"PINEntry",result:RDS.Success({finalUrl:"https://google.com"}),data:{actualPIN:"",nextAction:"submitPinAction",msisdn:""}}};exports.mockedCompletedState=mockedCompletedState;var mockedMSISDNEntryFailure={currentState:{type:"MSISDNEntry",result:RDS.Failure({errorType:"InvalidMSISDN",error:"Invalid Mobile Number"})}};exports.mockedMSISDNEntryFailure=mockedMSISDNEntryFailure;
|