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,247 +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.array.iterator.js");
20
-
21
- require("core-js/modules/es.string.iterator.js");
22
-
23
- require("core-js/modules/web.dom-collections.iterator.js");
24
-
25
- require("core-js/modules/es.symbol.async-iterator.js");
26
-
27
- require("core-js/modules/es.symbol.to-string-tag.js");
28
-
29
- require("core-js/modules/es.json.to-string-tag.js");
30
-
31
- require("core-js/modules/es.math.to-string-tag.js");
32
-
33
- require("core-js/modules/es.object.get-prototype-of.js");
34
-
35
- require("core-js/modules/es.function.name.js");
36
-
37
- require("core-js/modules/es.object.set-prototype-of.js");
38
-
39
- require("core-js/modules/es.array.slice.js");
40
-
41
- require("core-js/modules/es.weak-map.js");
42
-
43
- Object.defineProperty(exports, "__esModule", {
44
- value: true
45
- });
46
- exports.checkSubscription = checkSubscription;
47
- exports.default = submitMSISDN;
48
- exports.mockedMSISDNEntrySuccess = exports.mockedMSISDNEntryFailure = exports.formatSMSLink = void 0;
49
- exports.submitMSISDNWithConfig = submitMSISDNWithConfig;
50
-
51
- require("core-js/modules/es.array.concat.js");
52
-
53
- require("core-js/modules/es.regexp.exec.js");
54
-
55
- require("core-js/modules/es.regexp.test.js");
56
-
57
- require("core-js/modules/es.object.to-string.js");
58
-
59
- require("core-js/modules/es.promise.js");
60
-
61
- require("core-js/modules/es.string.search.js");
62
-
63
- require("core-js/modules/es.array.join.js");
64
-
65
- require("core-js/modules/es.array.map.js");
66
-
67
- require("core-js/modules/es.object.keys.js");
68
-
69
- require("core-js/modules/es.string.match.js");
70
-
71
- var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
72
-
73
- var _utils = require("../strategy/utils");
74
-
75
- 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); }
76
-
77
- 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; }
78
-
79
- 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; }
80
-
81
- 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; }
82
-
83
- 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; }
84
-
85
- 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; }
86
-
87
- 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); } }
88
-
89
- 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); }); }; }
90
-
91
- function submitMSISDN(_x, _x2, _x3, _x4) {
92
- return _submitMSISDN.apply(this, arguments);
93
- }
94
-
95
- function _submitMSISDN() {
96
- _submitMSISDN = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(window, maybeConfig, internationalMSISDN, extraParams) {
97
- var config;
98
- return _regeneratorRuntime().wrap(function _callee$(_context) {
99
- while (1) {
100
- switch (_context.prev = _context.next) {
101
- case 0:
102
- config = _objectSpread({
103
- offer: window.pac_analytics.visitor.offer
104
- }, maybeConfig || {});
105
- return _context.abrupt("return", submitMSISDNWithConfig(window, config, internationalMSISDN, extraParams));
106
-
107
- case 2:
108
- case "end":
109
- return _context.stop();
110
- }
111
- }
112
- }, _callee);
113
- }));
114
- return _submitMSISDN.apply(this, arguments);
115
- }
116
-
117
- function submitMSISDNWithConfig(_x5, _x6, _x7, _x8) {
118
- return _submitMSISDNWithConfig.apply(this, arguments);
119
- }
120
-
121
- function _submitMSISDNWithConfig() {
122
- _submitMSISDNWithConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(window, config, internationalMSISDN, extraParams) {
123
- var slug, country, device, offer, host, search, extraParamsQs, msisdn, rockmanId, result, type, error;
124
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
125
- while (1) {
126
- switch (_context2.prev = _context2.next) {
127
- case 0:
128
- slug = config.slug, country = config.country, device = config.device, offer = config.offer, host = config.host;
129
- search = window.location.search.substr(1) || '';
130
- extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
131
- return "".concat(k, "=").concat(extraParams[k]);
132
- }).join('&'));
133
- msisdn = internationalMSISDN.match(/\d+/gi).join('');
134
- rockmanId = window.pac_analytics.visitor.rockmanId;
135
- _context2.next = 7;
136
- return window.tallymanApi.ussd(host, slug, country, msisdn, device, offer, rockmanId, search, extraParamsQs);
137
-
138
- case 7:
139
- result = _context2.sent;
140
-
141
- if (!(result.success === false)) {
142
- _context2.next = 16;
143
- break;
144
- }
145
-
146
- type = result.message === 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'InvalidMSISDN';
147
- error = new Error("".concat(type, ":\n").concat(result.message));
148
- error.type = type;
149
- console.error(error);
150
- throw error;
151
-
152
- case 16:
153
- return _context2.abrupt("return", result);
154
-
155
- case 17:
156
- case "end":
157
- return _context2.stop();
158
- }
159
- }
160
- }, _callee2);
161
- }));
162
- return _submitMSISDNWithConfig.apply(this, arguments);
163
- }
164
-
165
- function checkSubscription(_x9, _x10) {
166
- return _checkSubscription.apply(this, arguments);
167
- }
168
-
169
- function _checkSubscription() {
170
- _checkSubscription = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(window, maybeConfig) {
171
- var config, host, rockmanId, check, checkResult, error;
172
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
173
- while (1) {
174
- switch (_context3.prev = _context3.next) {
175
- case 0:
176
- config = _objectSpread({
177
- offer: window.pac_analytics.visitor.offer
178
- }, maybeConfig || {});
179
- host = config.host;
180
- rockmanId = window.pac_analytics.visitor.rockmanId;
181
-
182
- check = function check() {
183
- return window.tallymanApi.checkSubscriptionByRockmanIdOnly(host, rockmanId);
184
- };
185
-
186
- _context3.next = 6;
187
- return (0, _utils.loop)(check, 60, function (r) {
188
- return r.success;
189
- }, 0);
190
-
191
- case 6:
192
- checkResult = _context3.sent;
193
-
194
- if (!(checkResult.success === true)) {
195
- _context3.next = 10;
196
- break;
197
- }
198
-
199
- // eslint-disable-next-line no-param-reassign
200
- window.location.href = checkResult.product_url;
201
- return _context3.abrupt("return", checkResult.product_url || null);
202
-
203
- case 10:
204
- error = new Error('SubscriptionFailed'.concat(":\n", checkResult.message));
205
- error.type = 'SubscriptionFailed';
206
- throw error;
207
-
208
- case 13:
209
- case "end":
210
- return _context3.stop();
211
- }
212
- }
213
- }, _callee3);
214
- }));
215
- return _checkSubscription.apply(this, arguments);
216
- }
217
-
218
- var formatSMSLink = function formatSMSLink(keywordAndShortcode) {
219
- return (// @ts-ignore
220
- // eslint-disable-next-line no-nested-ternary
221
- !!window.pac_analytics.visitor['x-requested-with'] && // @ts-ignore
222
- window.pac_analytics.visitor['x-requested-with'] !== null && // @ts-ignore
223
- window.pac_analytics.visitor['x-requested-with'].indexOf('com.facebook') !== -1 ? "sms://".concat(keywordAndShortcode.shortcode, "?body=").concat(keywordAndShortcode.keyword) : typeof navigator !== 'undefined' && (/iPhone/i.test(navigator.userAgent) || /Mac OS/i.test(navigator.userAgent)) ? "sms:".concat(keywordAndShortcode.shortcode, "&body=").concat(keywordAndShortcode.keyword) : "sms:".concat(keywordAndShortcode.shortcode, "?body=").concat(keywordAndShortcode.keyword)
224
- );
225
- };
226
-
227
- exports.formatSMSLink = formatSMSLink;
228
- var mockedMSISDNEntrySuccess = {
229
- currentState: {
230
- type: 'MSISDNEntry',
231
- result: RDS.Success({
232
- keyword: 'TEST OK',
233
- shortcode: '777'
234
- })
235
- }
236
- };
237
- exports.mockedMSISDNEntrySuccess = mockedMSISDNEntrySuccess;
238
- var mockedMSISDNEntryFailure = {
239
- currentState: {
240
- type: 'MSISDNEntry',
241
- result: RDS.Failure({
242
- errorType: 'InvalidMSISDN',
243
- error: 'Invalid Mobile Number'
244
- })
245
- }
246
- };
247
- 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.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.checkSubscription=checkSubscription,exports.default=submitMSISDN,exports.mockedMSISDNEntrySuccess=exports.mockedMSISDNEntryFailure=exports.formatSMSLink=void 0,exports.submitMSISDNWithConfig=submitMSISDNWithConfig,require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.regexp.test.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.string.search.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.string.match.js");var RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_utils=require("../strategy/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)})}}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:return config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig||{}),_context.abrupt("return",submitMSISDNWithConfig(window,config,internationalMSISDN,extraParams));case 2:case"end":return _context.stop();}},_callee)})),_submitMSISDN.apply(this,arguments)}function submitMSISDNWithConfig(_x5,_x6,_x7,_x8){return _submitMSISDNWithConfig.apply(this,arguments)}function _submitMSISDNWithConfig(){return _submitMSISDNWithConfig=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(window,config,internationalMSISDN,extraParams){var slug,country,device,offer,host,search,extraParamsQs,msisdn,rockmanId,result,type,error;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,offer=config.offer,host=config.host,search=window.location.search.substr(1)||"",extraParamsQs=extraParams?"&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")):"",msisdn=internationalMSISDN.match(/\d+/gi).join(""),rockmanId=window.pac_analytics.visitor.rockmanId,_context2.next=7,window.tallymanApi.ussd(host,slug,country,msisdn,device,offer,rockmanId,search,extraParamsQs);case 7:if(result=_context2.sent,!1!==result.success){_context2.next=16;break}throw type="ALREADY SUBSCRIBED"===result.message?"AlreadySubscribed":"InvalidMSISDN",error=new Error("".concat(type,":\n").concat(result.message)),error.type=type,console.error(error),error;case 16:return _context2.abrupt("return",result);case 17:case"end":return _context2.stop();}},_callee2)})),_submitMSISDNWithConfig.apply(this,arguments)}function checkSubscription(_x9,_x10){return _checkSubscription.apply(this,arguments)}function _checkSubscription(){return _checkSubscription=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(window,maybeConfig){var config,host,rockmanId,check,checkResult,error;return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:return config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig||{}),host=config.host,rockmanId=window.pac_analytics.visitor.rockmanId,check=function check(){return window.tallymanApi.checkSubscriptionByRockmanIdOnly(host,rockmanId)},_context3.next=6,(0,_utils.loop)(check,60,function(r){return r.success},0);case 6:if(checkResult=_context3.sent,!0!==checkResult.success){_context3.next=10;break}return window.location.href=checkResult.product_url,_context3.abrupt("return",checkResult.product_url||null);case 10:throw error=new Error("SubscriptionFailed".concat(":\n",checkResult.message)),error.type="SubscriptionFailed",error;case 13:case"end":return _context3.stop();}},_callee3)})),_checkSubscription.apply(this,arguments)}var formatSMSLink=function formatSMSLink(keywordAndShortcode){return!window.pac_analytics.visitor["x-requested-with"]||null===window.pac_analytics.visitor["x-requested-with"]||-1===window.pac_analytics.visitor["x-requested-with"].indexOf("com.facebook")?"undefined"!=typeof navigator&&(/iPhone/i.test(navigator.userAgent)||/Mac OS/i.test(navigator.userAgent))?"sms:".concat(keywordAndShortcode.shortcode,"&body=").concat(keywordAndShortcode.keyword):"sms:".concat(keywordAndShortcode.shortcode,"?body=").concat(keywordAndShortcode.keyword):"sms://".concat(keywordAndShortcode.shortcode,"?body=").concat(keywordAndShortcode.keyword)};exports.formatSMSLink=formatSMSLink;var mockedMSISDNEntrySuccess={currentState:{type:"MSISDNEntry",result:RDS.Success({keyword:"TEST OK",shortcode:"777"})}};exports.mockedMSISDNEntrySuccess=mockedMSISDNEntrySuccess;var mockedMSISDNEntryFailure={currentState:{type:"MSISDNEntry",result:RDS.Failure({errorType:"InvalidMSISDN",error:"Invalid Mobile Number"})}};exports.mockedMSISDNEntryFailure=mockedMSISDNEntryFailure;
@@ -1,177 +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.array.iterator.js");
6
-
7
- require("core-js/modules/es.object.to-string.js");
8
-
9
- require("core-js/modules/es.string.iterator.js");
10
-
11
- require("core-js/modules/es.weak-map.js");
12
-
13
- require("core-js/modules/web.dom-collections.iterator.js");
14
-
15
- require("core-js/modules/es.object.get-own-property-descriptor.js");
16
-
17
- require("core-js/modules/es.symbol.js");
18
-
19
- require("core-js/modules/es.symbol.description.js");
20
-
21
- require("core-js/modules/es.symbol.iterator.js");
22
-
23
- Object.defineProperty(exports, "__esModule", {
24
- value: true
25
- });
26
- exports.default = void 0;
27
-
28
- require("core-js/modules/es.array.includes.js");
29
-
30
- require("core-js/modules/es.string.includes.js");
31
-
32
- var _redux = require("redux");
33
-
34
- var _reduxLogger = require("redux-logger");
35
-
36
- var _reduxThunk = _interopRequireDefault(require("redux-thunk"));
37
-
38
- var RDS = _interopRequireWildcard(require("../common-types/RemoteDataState"));
39
-
40
- var _utils = require("../reducers/strategy/utils");
41
-
42
- var _reducers = _interopRequireDefault(require("./reducers"));
43
-
44
- 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); }
45
-
46
- 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; }
47
-
48
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
49
-
50
- var log = (0, _reduxLogger.createLogger)({
51
- diff: true,
52
- collapsed: true
53
- }); // ======================================================
54
- // Store Enhancers
55
- // ======================================================
56
- // const enhancers = [];
57
- // ======================================================
58
- // Store Instantiation
59
- // ======================================================
60
-
61
- var strategyBasedInitialState = function strategyBasedInitialState() {
62
- var _getConfig = (0, _utils.getConfig)(),
63
- strategy = _getConfig.strategy,
64
- strategyConfigs = _getConfig.strategyConfigs;
65
-
66
- if (strategy.includes('ask-operator')) {
67
- var operators = (0, _utils.getOperators)();
68
- return {
69
- type: 'IDENTIFY_FLOW_BY_OPERATOR_SELECT',
70
- result: {
71
- operators: operators,
72
- nextAction: 'selectOperator'
73
- }
74
- };
75
- }
76
-
77
- if (strategy.includes('ask-mobile-number') || strategy.includes('header-enrichment')) {
78
- return {
79
- type: 'IDENTIFY_FLOW_BY_MSISDN',
80
- result: RDS.NothingYet(),
81
- nextData: {
82
- nextAction: 'submitMSISDNAction'
83
- }
84
- };
85
- }
86
-
87
- if (strategy.includes('detect-operator-by-ip')) {
88
- return {
89
- type: 'DETECT_OPERATOR_BY_IP',
90
- result: RDS.Loading()
91
- };
92
- }
93
-
94
- switch (strategy) {
95
- case 'pin':
96
- return {
97
- type: 'PIN',
98
- result: {
99
- nextAction: 'submitMSISDNAction',
100
- config: strategyConfigs.default.flowConfig
101
- }
102
- };
103
-
104
- case 'mo':
105
- return {
106
- type: 'MO',
107
- result: {
108
- nextAction: 'submitMSISDNAction',
109
- config: strategyConfigs.default.flowConfig
110
- }
111
- };
112
-
113
- case 'mo-redir':
114
- return {
115
- type: 'MO_REDIR',
116
- result: {
117
- nextAction: 'submitMSISDNAction',
118
- config: strategyConfigs.default.flowConfig
119
- }
120
- };
121
-
122
- case 'one-click':
123
- return {
124
- type: 'ONE_CLICK',
125
- result: {
126
- nextAction: 'getRedirectUrlAction',
127
- config: strategyConfigs.default.flowConfig
128
- }
129
- };
130
-
131
- case 'click2sms':
132
- return {
133
- type: 'CLICK2SMS',
134
- result: {
135
- nextAction: 'loadOc2sms',
136
- config: strategyConfigs.default.flowConfig
137
- }
138
- };
139
-
140
- case 'ussd':
141
- return {
142
- type: 'USSD',
143
- result: {
144
- nextAction: 'submitMSISDNAction',
145
- config: strategyConfigs.default.flowConfig
146
- }
147
- };
148
-
149
- default:
150
- return {
151
- type: 'IDENTIFY_STRATEGY',
152
- result: RDS.Loading()
153
- };
154
- }
155
- };
156
-
157
- console.log('NODE_ENV', process.env.NODE_ENV);
158
- var store = (0, _redux.createStore)((0, _reducers.default)(), {
159
- strategy: {
160
- currentState: strategyBasedInitialState()
161
- },
162
- oneClickFlow: {
163
- currentState: {
164
- type: 'GET_REDIRECT_URL',
165
- result: {
166
- type: 'Success',
167
- data: {
168
- redirectUrl: '',
169
- nextAction: 'getRedirectUrlAction'
170
- }
171
- }
172
- }
173
- }
174
- }, (0, _redux.compose)(process.env.NODE_ENV == 'development' ? (0, _redux.applyMiddleware)(_reduxThunk.default, log) : (0, _redux.applyMiddleware)(_reduxThunk.default) // ...enhancers
175
- ));
176
- var _default = store;
177
- exports.default = _default;
1
+ "use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.string.includes.js");var _redux=require("redux"),_reduxLogger=require("redux-logger"),_reduxThunk=_interopRequireDefault(require("redux-thunk")),RDS=_interopRequireWildcard(require("../common-types/RemoteDataState")),_utils=require("../reducers/strategy/utils"),_reducers=_interopRequireDefault(require("./reducers"));function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!=key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var log=(0,_reduxLogger.createLogger)({diff:!0,collapsed:!0}),strategyBasedInitialState=function(){var _getConfig=(0,_utils.getConfig)(),strategy=_getConfig.strategy,strategyConfigs=_getConfig.strategyConfigs;if(strategy.includes("ask-operator")){var operators=(0,_utils.getOperators)();return{type:"IDENTIFY_FLOW_BY_OPERATOR_SELECT",result:{operators:operators,nextAction:"selectOperator"}}}if(strategy.includes("ask-mobile-number")||strategy.includes("header-enrichment"))return{type:"IDENTIFY_FLOW_BY_MSISDN",result:RDS.NothingYet(),nextData:{nextAction:"submitMSISDNAction"}};if(strategy.includes("detect-operator-by-ip"))return{type:"DETECT_OPERATOR_BY_IP",result:RDS.Loading()};return"pin"===strategy?{type:"PIN",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}:"mo"===strategy?{type:"MO",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}:"mo-redir"===strategy?{type:"MO_REDIR",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}:"one-click"===strategy?{type:"ONE_CLICK",result:{nextAction:"getRedirectUrlAction",config:strategyConfigs.default.flowConfig}}:"click2sms"===strategy?{type:"CLICK2SMS",result:{nextAction:"loadOc2sms",config:strategyConfigs.default.flowConfig}}:"ussd"===strategy?{type:"USSD",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}:{type:"IDENTIFY_STRATEGY",result:RDS.Loading()}};console.log("NODE_ENV",process.env.NODE_ENV);var store=(0,_redux.createStore)((0,_reducers.default)(),{strategy:{currentState:strategyBasedInitialState()},oneClickFlow:{currentState:{type:"GET_REDIRECT_URL",result:{type:"Success",data:{redirectUrl:"",nextAction:"getRedirectUrlAction"}}}}},(0,_redux.compose)("development"==process.env.NODE_ENV?(0,_redux.applyMiddleware)(_reduxThunk.default,log):(0,_redux.applyMiddleware)(_reduxThunk.default))),_default=store;exports.default=_default;
@@ -1,38 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _redux = require("redux");
9
-
10
- var _click2smsFlow = _interopRequireDefault(require("../reducers/click2smsFlow"));
11
-
12
- var _moFlow = _interopRequireDefault(require("../reducers/moFlow"));
13
-
14
- var _moRedirFlow = _interopRequireDefault(require("../reducers/moRedirFlow"));
15
-
16
- var _oneClickFlow = _interopRequireDefault(require("../reducers/oneClickFlow"));
17
-
18
- var _pinFlow = _interopRequireDefault(require("../reducers/pinFlow"));
19
-
20
- var _strategy = _interopRequireDefault(require("../reducers/strategy"));
21
-
22
- var _ussdFlow = _interopRequireDefault(require("../reducers/ussdFlow"));
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
- var _default = function _default() {
27
- return (0, _redux.combineReducers)({
28
- strategy: _strategy.default,
29
- pinFlow: _pinFlow.default,
30
- moFlow: _moFlow.default,
31
- moRedirFlow: _moRedirFlow.default,
32
- oneClickFlow: _oneClickFlow.default,
33
- click2smsFlow: _click2smsFlow.default,
34
- ussdFlow: _ussdFlow.default
35
- });
36
- };
37
-
38
- exports.default = _default;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _redux=require("redux"),_click2smsFlow=_interopRequireDefault(require("../reducers/click2smsFlow")),_moFlow=_interopRequireDefault(require("../reducers/moFlow")),_moRedirFlow=_interopRequireDefault(require("../reducers/moRedirFlow")),_oneClickFlow=_interopRequireDefault(require("../reducers/oneClickFlow")),_pinFlow=_interopRequireDefault(require("../reducers/pinFlow")),_strategy=_interopRequireDefault(require("../reducers/strategy")),_ussdFlow=_interopRequireDefault(require("../reducers/ussdFlow"));function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var _default=function(){return(0,_redux.combineReducers)({strategy:_strategy.default,pinFlow:_pinFlow.default,moFlow:_moFlow.default,moRedirFlow:_moRedirFlow.default,oneClickFlow:_oneClickFlow.default,click2smsFlow:_click2smsFlow.default,ussdFlow:_ussdFlow.default})};exports.default=_default;
@@ -1,76 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.handleFormSubmit = exports.handleAutoSubmitMsisdn = void 0;
7
-
8
- require("core-js/modules/es.array.join.js");
9
-
10
- require("core-js/modules/es.regexp.exec.js");
11
-
12
- require("core-js/modules/es.string.match.js");
13
-
14
- var _awesomePhonenumber = _interopRequireDefault(require("awesome-phonenumber"));
15
-
16
- var _utils = require("../reducers/strategy/utils");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- var handleAutoSubmitMsisdn = function handleAutoSubmitMsisdn(_ref) {
21
- var msisdnValue = _ref.msisdnValue,
22
- dispatch = _ref.dispatch,
23
- submitMSISDNAction = _ref.submitMSISDNAction,
24
- isHeaderEnrichmentSuccess = _ref.isHeaderEnrichmentSuccess,
25
- setMsisdnValue = _ref.setMsisdnValue,
26
- isHeaderEnrichmentAutoSubmit = _ref.isHeaderEnrichmentAutoSubmit;
27
-
28
- if (msisdnValue && msisdnValue.length > 3 && (isHeaderEnrichmentSuccess === false || isHeaderEnrichmentSuccess === true && isHeaderEnrichmentAutoSubmit === true)) {
29
- var pn = new _awesomePhonenumber.default("+".concat(msisdnValue), process.env.country.toUpperCase());
30
-
31
- if (pn.isValid()) {
32
- dispatch(submitMSISDNAction(msisdnValue));
33
- } else {
34
- setMsisdnValue(pn.getCountryCode() + msisdnValue);
35
- dispatch(submitMSISDNAction(pn.getCountryCode() + msisdnValue));
36
- }
37
- }
38
- };
39
-
40
- exports.handleAutoSubmitMsisdn = handleAutoSubmitMsisdn;
41
-
42
- var handleFormSubmit = function handleFormSubmit(_ref2) {
43
- var isHeaderEnrichmentSuccess = _ref2.isHeaderEnrichmentSuccess,
44
- setInternationalNumber = _ref2.setInternationalNumber,
45
- onEnd = _ref2.onEnd,
46
- internationalNumber = _ref2.internationalNumber;
47
- var pn = new _awesomePhonenumber.default("+".concat(internationalNumber), process.env.country.toUpperCase());
48
- var countryCode = pn.getCountryCode();
49
- var networkType = isHeaderEnrichmentSuccess ? 'mobile_data' : 'wifi';
50
- var searchObj = (0, _utils.searchToObject)();
51
-
52
- if (isHeaderEnrichmentSuccess === true && process.env.country === 'kw' && internationalNumber !== '' && !pn.isValid()) {
53
- setInternationalNumber(countryCode + internationalNumber);
54
- var newNumber = countryCode + internationalNumber;
55
- onEnd(newNumber.match(/\d+/gi).join(''));
56
- } else if (isHeaderEnrichmentSuccess === true && (searchObj === null || searchObj === void 0 ? void 0 : searchObj.success) === 'true' && searchObj['msisdn-alias'] === '1') {
57
- // Special case Digital Virgo sents encrypted msisdn we dont need to validate is
58
- if (searchObj !== null && searchObj !== void 0 && searchObj.msisdn) {
59
- var encryptedMsisdn = searchObj.msisdn;
60
- onEnd(encryptedMsisdn, {
61
- network_type: networkType,
62
- 'skip-validation': '1'
63
- });
64
- }
65
- } else if (internationalNumber) {
66
- if (process.env.country === 'ci') {
67
- onEnd(internationalNumber.match(/\d+/gi).join(''), {
68
- network_type: networkType
69
- });
70
- } else {
71
- onEnd(internationalNumber.match(/\d+/gi).join(''));
72
- }
73
- }
74
- };
75
-
76
- exports.handleFormSubmit = handleFormSubmit;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.handleFormSubmit=exports.handleAutoSubmitMsisdn=void 0,require("core-js/modules/es.array.join.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.match.js");var _awesomePhonenumber=_interopRequireDefault(require("awesome-phonenumber")),_utils=require("../reducers/strategy/utils");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var handleAutoSubmitMsisdn=function(_ref){var msisdnValue=_ref.msisdnValue,dispatch=_ref.dispatch,submitMSISDNAction=_ref.submitMSISDNAction,isHeaderEnrichmentSuccess=_ref.isHeaderEnrichmentSuccess,setMsisdnValue=_ref.setMsisdnValue,isHeaderEnrichmentAutoSubmit=_ref.isHeaderEnrichmentAutoSubmit;if(msisdnValue&&3<msisdnValue.length&&(!1===isHeaderEnrichmentSuccess||!0===isHeaderEnrichmentSuccess&&!0===isHeaderEnrichmentAutoSubmit)){var pn=new _awesomePhonenumber.default("+".concat(msisdnValue),process.env.country.toUpperCase());pn.isValid()?dispatch(submitMSISDNAction(msisdnValue)):(setMsisdnValue(pn.getCountryCode()+msisdnValue),dispatch(submitMSISDNAction(pn.getCountryCode()+msisdnValue)))}};exports.handleAutoSubmitMsisdn=handleAutoSubmitMsisdn;var handleFormSubmit=function(_ref2){var isHeaderEnrichmentSuccess=_ref2.isHeaderEnrichmentSuccess,setInternationalNumber=_ref2.setInternationalNumber,onEnd=_ref2.onEnd,internationalNumber=_ref2.internationalNumber,pn=new _awesomePhonenumber.default("+".concat(internationalNumber),process.env.country.toUpperCase()),countryCode=pn.getCountryCode(),networkType=isHeaderEnrichmentSuccess?"mobile_data":"wifi",searchObj=(0,_utils.searchToObject)();if(!0===isHeaderEnrichmentSuccess&&"kw"===process.env.country&&""!==internationalNumber&&!pn.isValid()){setInternationalNumber(countryCode+internationalNumber);onEnd((countryCode+internationalNumber).match(/\d+/gi).join(""))}else if(!(!0===isHeaderEnrichmentSuccess&&"true"===(null===searchObj||void 0===searchObj?void 0:searchObj.success)&&"1"===searchObj["msisdn-alias"]))internationalNumber&&("ci"===process.env.country?onEnd(internationalNumber.match(/\d+/gi).join(""),{network_type:networkType}):onEnd(internationalNumber.match(/\d+/gi).join("")));else if(null!==searchObj&&void 0!==searchObj&&searchObj.msisdn){var encryptedMsisdn=searchObj.msisdn;onEnd(encryptedMsisdn,{network_type:networkType,"skip-validation":"1"})}};exports.handleFormSubmit=handleFormSubmit;