ouisys-engine 4.3.0-alpha.0 → 4.5.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@types/window.d.js +1 -1
- package/dist/api/index.d.ts +43 -0
- package/dist/api/index.js +1 -728
- package/dist/common-types/AppThunk.d.ts +13 -0
- package/dist/common-types/AppThunk.js +1 -1
- package/dist/common-types/Either.d.ts +8 -0
- package/dist/common-types/Either.js +1 -1
- package/dist/common-types/IError.d.ts +3 -0
- package/dist/common-types/IError.js +1 -1
- package/dist/common-types/IOptInFlowName.d.ts +1 -0
- package/dist/common-types/ITracker.d.ts +9 -0
- package/dist/common-types/ITracker.js +1 -3
- package/dist/common-types/IVisitor.d.ts +14 -0
- package/dist/common-types/IVisitor.js +1 -1
- package/dist/common-types/RemoteDataState.d.ts +38 -0
- package/dist/common-types/RemoteDataState.js +1 -135
- package/dist/custom-hooks/useOneClickRedirectUrl.d.ts +3 -0
- package/dist/custom-hooks/useOneClickRedirectUrl.js +1 -0
- package/dist/custom-hooks/usePinEntryState.d.ts +8 -0
- package/dist/custom-hooks/usePinEntryState.js +1 -0
- package/dist/custom-hooks/useStrategyConfig.d.ts +4 -0
- package/dist/custom-hooks/useStrategyConfig.js +1 -0
- package/dist/flows/click2smsFlow.d.ts +6 -0
- package/dist/flows/click2smsFlow.js +1 -19
- package/dist/flows/creditCardFlow.d.ts +6 -0
- package/dist/flows/creditCardFlow.js +1 -0
- package/dist/flows/moFlow.d.ts +6 -0
- package/dist/flows/moFlow.js +1 -19
- package/dist/flows/moRedirFlow.d.ts +6 -0
- package/dist/flows/moRedirFlow.js +1 -19
- package/dist/flows/oneClickFlow.d.ts +7 -0
- package/dist/flows/oneClickFlow.js +1 -23
- package/dist/flows/pinFlow.d.ts +7 -0
- package/dist/flows/pinFlow.js +1 -23
- package/dist/flows/strategy.d.ts +14 -0
- package/dist/flows/strategy.js +1 -53
- package/dist/flows/ussdFlow.d.ts +6 -0
- package/dist/flows/ussdFlow.js +1 -19
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -2
- package/dist/ips/tryGetIPRangeName.d.ts +2 -0
- package/dist/ips/tryGetIPRangeName.js +1 -74
- package/dist/jest.config.js +194 -0
- package/dist/pacman/index.d.ts +6 -0
- package/dist/pacman/index.js +1 -108
- package/dist/pacman/queryString.d.ts +3 -0
- package/dist/pacman/queryString.js +1 -45
- package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +76 -0
- package/dist/reducers/click2smsFlow/Click2smsTypes.js +1 -1
- package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +2 -0
- package/dist/reducers/click2smsFlow/IClick2smsConstants.js +1 -1
- package/dist/reducers/click2smsFlow/index.d.ts +5 -0
- package/dist/reducers/click2smsFlow/index.js +1 -183
- package/dist/reducers/click2smsFlow/utils.d.ts +4 -0
- package/dist/reducers/click2smsFlow/utils.js +1 -357
- package/dist/reducers/creditCardFlow/CreditCardTypes.d.ts +79 -0
- package/dist/reducers/creditCardFlow/CreditCardTypes.js +1 -0
- package/dist/reducers/creditCardFlow/ICreditCardConstants.d.ts +2 -0
- package/dist/reducers/creditCardFlow/ICreditCardConstants.js +1 -0
- package/dist/reducers/creditCardFlow/index.d.ts +5 -0
- package/dist/reducers/creditCardFlow/index.js +1 -0
- package/dist/reducers/creditCardFlow/utils.d.ts +8 -0
- package/dist/reducers/creditCardFlow/utils.js +1 -0
- package/dist/reducers/moFlow/IMoConstants.d.ts +2 -0
- package/dist/reducers/moFlow/IMoConstants.js +1 -1
- package/dist/reducers/moFlow/MoTypes.d.ts +88 -0
- package/dist/reducers/moFlow/MoTypes.js +1 -1
- package/dist/reducers/moFlow/index.d.ts +16 -0
- package/dist/reducers/moFlow/index.js +1 -251
- package/dist/reducers/moFlow/utils.d.ts +12 -0
- package/dist/reducers/moFlow/utils.js +1 -284
- package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +2 -0
- package/dist/reducers/moRedirFlow/IMoRedirConstants.js +1 -1
- package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +64 -0
- package/dist/reducers/moRedirFlow/MoRedirTypes.js +1 -1
- package/dist/reducers/moRedirFlow/index.d.ts +14 -0
- package/dist/reducers/moRedirFlow/index.js +1 -226
- package/dist/reducers/moRedirFlow/utils.d.ts +10 -0
- package/dist/reducers/moRedirFlow/utils.js +1 -186
- package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +2 -0
- package/dist/reducers/oneClickFlow/IOneClickConstants.js +1 -1
- package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +85 -0
- package/dist/reducers/oneClickFlow/OneClickTypes.js +1 -1
- package/dist/reducers/oneClickFlow/index.d.ts +13 -0
- package/dist/reducers/oneClickFlow/index.js +1 -409
- package/dist/reducers/oneClickFlow/utils.d.ts +16 -0
- package/dist/reducers/oneClickFlow/utils.js +1 -366
- package/dist/reducers/pinFlow/IPinConstants.d.ts +2 -0
- package/dist/reducers/pinFlow/IPinConstants.js +1 -1
- package/dist/reducers/pinFlow/PinTypes.d.ts +156 -0
- package/dist/reducers/pinFlow/PinTypes.js +1 -1
- package/dist/reducers/pinFlow/index.d.ts +19 -0
- package/dist/reducers/pinFlow/index.js +1 -514
- package/dist/reducers/pinFlow/utils.d.ts +11 -0
- package/dist/reducers/pinFlow/utils.js +1 -494
- package/dist/reducers/strategy/IStategyActionContants.d.ts +2 -0
- package/dist/reducers/strategy/IStategyActionContants.js +1 -1
- package/dist/reducers/strategy/StrategyTypes.d.ts +248 -0
- package/dist/reducers/strategy/StrategyTypes.js +1 -1
- package/dist/reducers/strategy/index.d.ts +13 -0
- package/dist/reducers/strategy/index.js +1 -389
- package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +15 -0
- package/dist/reducers/strategy/strategies/ask_mobile_number.js +1 -403
- package/dist/reducers/strategy/strategies/ask_operator.d.ts +5 -0
- package/dist/reducers/strategy/strategies/ask_operator.js +1 -305
- package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +10 -0
- package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +1 -459
- package/dist/reducers/strategy/strategies/header_enrichment.d.ts +7 -0
- package/dist/reducers/strategy/strategies/header_enrichment.js +1 -783
- package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.d.ts +2 -0
- package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.js +1 -0
- package/dist/reducers/strategy/utils.d.ts +30 -0
- package/dist/reducers/strategy/utils.js +1 -702
- package/dist/reducers/ussdFlow/IUssdConstants.d.ts +2 -0
- package/dist/reducers/ussdFlow/IUssdConstants.js +1 -1
- package/dist/reducers/ussdFlow/UssdTypes.d.ts +77 -0
- package/dist/reducers/ussdFlow/UssdTypes.js +1 -1
- package/dist/reducers/ussdFlow/index.d.ts +14 -0
- package/dist/reducers/ussdFlow/index.js +1 -251
- package/dist/reducers/ussdFlow/utils.d.ts +11 -0
- package/dist/reducers/ussdFlow/utils.js +1 -225
- package/dist/store/index.d.ts +14 -0
- package/dist/store/index.js +1 -177
- package/dist/store/reducers.d.ts +20 -0
- package/dist/store/reducers.js +1 -41
- package/dist/utilities/addEmpelloToken.d.ts +4 -0
- package/dist/utilities/addEmpelloToken.js +1 -0
- package/dist/utilities/handleSubmitNumber.d.ts +21 -0
- package/dist/utilities/handleSubmitNumber.js +1 -59
- package/dist/utilities/index.d.ts +14 -0
- package/dist/utilities/index.js +1 -0
- package/dist/utilities/loadScriptInnerHtml.d.ts +2 -0
- package/dist/utilities/loadScriptInnerHtml.js +1 -0
- package/dist/utilities/loadScriptSrc.d.ts +8 -0
- package/dist/utilities/loadScriptSrc.js +1 -0
- package/dist/utilities/replaceUrlParam.d.ts +1 -0
- package/dist/utilities/replaceUrlParam.js +1 -0
- package/dist/utilities/storeMsisdn.d.ts +3 -0
- package/dist/utilities/storeMsisdn.js +1 -0
- package/package.json +1 -1
- package/dist/app/store.js +0 -20
- package/dist/features/strategies/categories/askMobileNumber.js +0 -388
- package/dist/features/strategies/categories/askOperator.js +0 -313
- package/dist/features/strategies/categories/detectOperatorByIp.js +0 -599
- package/dist/features/strategies/categories/headerEnrichment.js +0 -665
- package/dist/features/strategies/categories/singleFlows/pin.js +0 -1
- package/dist/features/strategies/identifySlice.js +0 -355
- package/dist/features/strategies/pinFlowSlice.js +0 -338
- package/dist/flows/tpayHeFlow.js +0 -23
- package/dist/mockServer/browser.js +0 -48
- package/dist/mockServer/handlers.js +0 -22
- package/dist/mockServer/server.js +0 -48
- package/dist/reducers/tpayHeFlow/ITpayHeConstants.js +0 -1
- package/dist/reducers/tpayHeFlow/TpayHeTypes.js +0 -1
- package/dist/reducers/tpayHeFlow/index.js +0 -331
- package/dist/reducers/tpayHeFlow/utils.js +0 -510
- package/dist/test/setup.js +0 -24
- package/dist/test/test-utils.js +0 -51
|
@@ -1,510 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.symbol");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.symbol.description");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.symbol.iterator");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.array.concat");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.array.from");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.array.iterator");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.array.join");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.array.map");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.array.slice");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.function.name");
|
|
24
|
-
|
|
25
|
-
require("core-js/modules/es.object.get-own-property-descriptor");
|
|
26
|
-
|
|
27
|
-
require("core-js/modules/es.object.to-string");
|
|
28
|
-
|
|
29
|
-
require("core-js/modules/es.promise");
|
|
30
|
-
|
|
31
|
-
require("core-js/modules/es.regexp.exec");
|
|
32
|
-
|
|
33
|
-
require("core-js/modules/es.regexp.to-string");
|
|
34
|
-
|
|
35
|
-
require("core-js/modules/es.string.iterator");
|
|
36
|
-
|
|
37
|
-
require("core-js/modules/es.string.replace");
|
|
38
|
-
|
|
39
|
-
require("core-js/modules/es.string.search");
|
|
40
|
-
|
|
41
|
-
require("core-js/modules/es.weak-map");
|
|
42
|
-
|
|
43
|
-
require("core-js/modules/web.dom-collections.iterator");
|
|
44
|
-
|
|
45
|
-
Object.defineProperty(exports, "__esModule", {
|
|
46
|
-
value: true
|
|
47
|
-
});
|
|
48
|
-
exports.mockedConfirmState = exports.confirmTPay = exports.confirmTPayCheck = exports.getTpayConfig = exports.default = exports.additionalQueryString = void 0;
|
|
49
|
-
|
|
50
|
-
require("regenerator-runtime/runtime");
|
|
51
|
-
|
|
52
|
-
var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
|
|
53
|
-
|
|
54
|
-
var _utils = require("../strategy/utils");
|
|
55
|
-
|
|
56
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
57
|
-
|
|
58
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
|
|
59
|
-
|
|
60
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
61
|
-
|
|
62
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
63
|
-
|
|
64
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
65
|
-
|
|
66
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
67
|
-
|
|
68
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
69
|
-
|
|
70
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
71
|
-
|
|
72
|
-
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); } }
|
|
73
|
-
|
|
74
|
-
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); }); }; }
|
|
75
|
-
|
|
76
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
77
|
-
|
|
78
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
79
|
-
|
|
80
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
81
|
-
|
|
82
|
-
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; }
|
|
83
|
-
|
|
84
|
-
var additionalQueryString = "msisdnSubmitted=Y&legalCheckbox=Y&incentivizedCheckbox=Y&op_confirmCheckbox=N";
|
|
85
|
-
exports.additionalQueryString = additionalQueryString;
|
|
86
|
-
|
|
87
|
-
var ScriptLoader = /*#__PURE__*/function () {
|
|
88
|
-
function ScriptLoader(options) {
|
|
89
|
-
_classCallCheck(this, ScriptLoader);
|
|
90
|
-
|
|
91
|
-
_defineProperty(this, "src", void 0);
|
|
92
|
-
|
|
93
|
-
_defineProperty(this, "global", void 0);
|
|
94
|
-
|
|
95
|
-
_defineProperty(this, "protocol", void 0);
|
|
96
|
-
|
|
97
|
-
_defineProperty(this, "isLoaded", void 0);
|
|
98
|
-
|
|
99
|
-
var src = options.src,
|
|
100
|
-
global = options.global,
|
|
101
|
-
_options$protocol = options.protocol,
|
|
102
|
-
protocol = _options$protocol === void 0 ? document.location.protocol : _options$protocol;
|
|
103
|
-
this.src = src;
|
|
104
|
-
this.global = global;
|
|
105
|
-
this.protocol = protocol;
|
|
106
|
-
this.isLoaded = false;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
_createClass(ScriptLoader, [{
|
|
110
|
-
key: "loadScript",
|
|
111
|
-
value: function loadScript() {
|
|
112
|
-
var _this = this;
|
|
113
|
-
|
|
114
|
-
return new Promise(function (resolve, reject) {
|
|
115
|
-
// Create script element and set attributes
|
|
116
|
-
var script = document.createElement('script');
|
|
117
|
-
script.type = 'text/javascript';
|
|
118
|
-
script.async = true;
|
|
119
|
-
script.src = "".concat(_this.protocol, "//").concat(_this.src); // Append the script to the DOM
|
|
120
|
-
|
|
121
|
-
var el = document.getElementsByTagName('script')[0];
|
|
122
|
-
el.parentNode.insertBefore(script, el); // Resolve the promise once the script is loaded
|
|
123
|
-
|
|
124
|
-
script.addEventListener('load', function () {
|
|
125
|
-
_this.isLoaded = true;
|
|
126
|
-
resolve(script);
|
|
127
|
-
}); // Catch any errors while loading the script
|
|
128
|
-
|
|
129
|
-
script.addEventListener('error', function () {
|
|
130
|
-
reject(new Error("".concat(_this.src, " failed to load.")));
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}, {
|
|
135
|
-
key: "load",
|
|
136
|
-
value: function load() {
|
|
137
|
-
var _this2 = this;
|
|
138
|
-
|
|
139
|
-
return new Promise( /*#__PURE__*/function () {
|
|
140
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(resolve, reject) {
|
|
141
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
142
|
-
while (1) {
|
|
143
|
-
switch (_context.prev = _context.next) {
|
|
144
|
-
case 0:
|
|
145
|
-
if (_this2.isLoaded) {
|
|
146
|
-
_context.next = 12;
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
_context.prev = 1;
|
|
151
|
-
_context.next = 4;
|
|
152
|
-
return _this2.loadScript();
|
|
153
|
-
|
|
154
|
-
case 4:
|
|
155
|
-
//@ts-ignore
|
|
156
|
-
resolve(window[_this2.global]);
|
|
157
|
-
_context.next = 10;
|
|
158
|
-
break;
|
|
159
|
-
|
|
160
|
-
case 7:
|
|
161
|
-
_context.prev = 7;
|
|
162
|
-
_context.t0 = _context["catch"](1);
|
|
163
|
-
reject(_context.t0);
|
|
164
|
-
|
|
165
|
-
case 10:
|
|
166
|
-
_context.next = 13;
|
|
167
|
-
break;
|
|
168
|
-
|
|
169
|
-
case 12:
|
|
170
|
-
//@ts-ignore
|
|
171
|
-
resolve(window[_this2.global]);
|
|
172
|
-
|
|
173
|
-
case 13:
|
|
174
|
-
case "end":
|
|
175
|
-
return _context.stop();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}, _callee, null, [[1, 7]]);
|
|
179
|
-
}));
|
|
180
|
-
|
|
181
|
-
return function (_x, _x2) {
|
|
182
|
-
return _ref.apply(this, arguments);
|
|
183
|
-
};
|
|
184
|
-
}());
|
|
185
|
-
}
|
|
186
|
-
}]);
|
|
187
|
-
|
|
188
|
-
return ScriptLoader;
|
|
189
|
-
}();
|
|
190
|
-
|
|
191
|
-
exports.default = ScriptLoader;
|
|
192
|
-
|
|
193
|
-
var getTpayConfig = /*#__PURE__*/function () {
|
|
194
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(window, maybeConfig) {
|
|
195
|
-
var host, country, slug, queryString, device, offer, s, search, rockmanId, result, error;
|
|
196
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
197
|
-
while (1) {
|
|
198
|
-
switch (_context2.prev = _context2.next) {
|
|
199
|
-
case 0:
|
|
200
|
-
if (!(typeof window == "undefined")) {
|
|
201
|
-
_context2.next = 4;
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
throw "javascript: console.error('SSR'); void 6";
|
|
206
|
-
|
|
207
|
-
case 4:
|
|
208
|
-
host = maybeConfig.host, country = maybeConfig.country, slug = maybeConfig.slug, queryString = maybeConfig.queryString, device = maybeConfig.device;
|
|
209
|
-
offer = window.pac_analytics.visitor.offer;
|
|
210
|
-
s = window.location.search.substr(1);
|
|
211
|
-
search = (!!s && s.length > 0 ? [s] : []).concat((queryString || []).map(function (_ref3) {
|
|
212
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
213
|
-
k = _ref4[0],
|
|
214
|
-
v = _ref4[1];
|
|
215
|
-
|
|
216
|
-
return "".concat(k, "=").concat(v);
|
|
217
|
-
})).join('&');
|
|
218
|
-
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
219
|
-
_context2.next = 11;
|
|
220
|
-
return window.tallymanApi.tpayConsentConfig(host, country, slug, device, offer, rockmanId, search);
|
|
221
|
-
|
|
222
|
-
case 11:
|
|
223
|
-
result = _context2.sent;
|
|
224
|
-
|
|
225
|
-
if (!(false == result.success)) {
|
|
226
|
-
_context2.next = 19;
|
|
227
|
-
break;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
error = new Error("Error in getTpayConfig() tpay-consent-config action:\n".concat(result.message));
|
|
231
|
-
error['type'] = result.message == 'ALREADY SUBSCRIBED' ? "AlreadySubscribed" : "NotSupported";
|
|
232
|
-
console.error(error);
|
|
233
|
-
throw error;
|
|
234
|
-
|
|
235
|
-
case 19:
|
|
236
|
-
return _context2.abrupt("return", result);
|
|
237
|
-
|
|
238
|
-
case 20:
|
|
239
|
-
case "end":
|
|
240
|
-
return _context2.stop();
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}, _callee2);
|
|
244
|
-
}));
|
|
245
|
-
|
|
246
|
-
return function getTpayConfig(_x3, _x4) {
|
|
247
|
-
return _ref2.apply(this, arguments);
|
|
248
|
-
};
|
|
249
|
-
}(); // export const addLookUpTpay = async(tpayConfig:ITpayConsentResult, theme?:string, locale?:string):Promise<boolean>=>{
|
|
250
|
-
// if(tpayConfig.success != false){
|
|
251
|
-
// const { config } = tpayConfig;
|
|
252
|
-
// const s = document.createElement("script");
|
|
253
|
-
// const currentDate = moment().utc().format()
|
|
254
|
-
// const digest = ()=>{
|
|
255
|
-
// const d = currentDate + locale + theme;
|
|
256
|
-
// const hash = HmacSHA256(d, config.private);
|
|
257
|
-
// window.tPayhash = hash.toString();
|
|
258
|
-
// const base64 = config.public + ":" + hash.toString();
|
|
259
|
-
// return base64
|
|
260
|
-
// }
|
|
261
|
-
// try{
|
|
262
|
-
// const loader = new ScriptLoader({
|
|
263
|
-
// src: `lookup.tpay.me/idxml.ashx/js?date=${currentDate}&lang=${locale}&theme=${theme}&digest=${digest()}`,
|
|
264
|
-
// global: 'TPay'
|
|
265
|
-
// });
|
|
266
|
-
// await loader.load();
|
|
267
|
-
// const operatorCode = window.TPay.HeaderEnrichment.operatorCode();
|
|
268
|
-
// console.log("operatorCode", operatorCode)
|
|
269
|
-
// if(operatorCode != ""){
|
|
270
|
-
// return true;
|
|
271
|
-
// }else{
|
|
272
|
-
// const error = new Error(`Error in addLookUpTpay() :\n MSISDN Not Detected!`) as IError & {type:string;}
|
|
273
|
-
// error['type'] = "3GConnectionError";
|
|
274
|
-
// console.error(error)
|
|
275
|
-
// throw error
|
|
276
|
-
// }
|
|
277
|
-
// }catch(err){
|
|
278
|
-
// const error = new Error(`Error in addLookUpTpay() :\n Failed To Load Script ${JSON.stringify(err)}`) as IError & {type:string;}
|
|
279
|
-
// error['type'] = "InvalidConfig";
|
|
280
|
-
// console.error(error)
|
|
281
|
-
// throw error
|
|
282
|
-
// }
|
|
283
|
-
// }else{
|
|
284
|
-
// return false;
|
|
285
|
-
// }
|
|
286
|
-
// }
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
exports.getTpayConfig = getTpayConfig;
|
|
290
|
-
|
|
291
|
-
var subscribe = /*#__PURE__*/function () {
|
|
292
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(url) {
|
|
293
|
-
var result, subscribeError;
|
|
294
|
-
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
295
|
-
while (1) {
|
|
296
|
-
switch (_context3.prev = _context3.next) {
|
|
297
|
-
case 0:
|
|
298
|
-
_context3.next = 2;
|
|
299
|
-
return fetch(url).then(function (x) {
|
|
300
|
-
return x.json();
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
case 2:
|
|
304
|
-
result = _context3.sent;
|
|
305
|
-
|
|
306
|
-
if (!(false === result.success)) {
|
|
307
|
-
_context3.next = 9;
|
|
308
|
-
break;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
subscribeError = new Error("Error in subscribe() one-click-subscribe action:\n".concat(result.message));
|
|
312
|
-
subscribeError['type'] = "SubscriptionError";
|
|
313
|
-
throw subscribeError;
|
|
314
|
-
|
|
315
|
-
case 9:
|
|
316
|
-
return _context3.abrupt("return", result.product_url);
|
|
317
|
-
|
|
318
|
-
case 10:
|
|
319
|
-
case "end":
|
|
320
|
-
return _context3.stop();
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}, _callee3);
|
|
324
|
-
}));
|
|
325
|
-
|
|
326
|
-
return function subscribe(_x5) {
|
|
327
|
-
return _ref5.apply(this, arguments);
|
|
328
|
-
};
|
|
329
|
-
}();
|
|
330
|
-
|
|
331
|
-
var confirmTPayCheck = /*#__PURE__*/function () {
|
|
332
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
333
|
-
var search, Msisdn, SessionToken, ReferenceCode, Status, Details, subscription_url, _url, product_url, error;
|
|
334
|
-
|
|
335
|
-
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
336
|
-
while (1) {
|
|
337
|
-
switch (_context4.prev = _context4.next) {
|
|
338
|
-
case 0:
|
|
339
|
-
search = (0, _utils.searchToObject)();
|
|
340
|
-
_context4.prev = 1;
|
|
341
|
-
|
|
342
|
-
if (!search) {
|
|
343
|
-
_context4.next = 12;
|
|
344
|
-
break;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
if (!(search["Status"] == "Error")) {
|
|
348
|
-
_context4.next = 5;
|
|
349
|
-
break;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
throw search["Details"];
|
|
353
|
-
|
|
354
|
-
case 5:
|
|
355
|
-
if (!(search["Status"] == "Success")) {
|
|
356
|
-
_context4.next = 12;
|
|
357
|
-
break;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
Msisdn = search.Msisdn, SessionToken = search.SessionToken, ReferenceCode = search.ReferenceCode, Status = search.Status, Details = search.Details, subscription_url = search.subscription_url;
|
|
361
|
-
_url = "".concat(decodeURIComponent(subscription_url), "&msisdn=").concat(Msisdn, "&tpaySessionToken=").concat(SessionToken, "&heReferenceCode=").concat(ReferenceCode, "&heStatus=").concat(Status, "&heErrorDetails=").concat(Details);
|
|
362
|
-
_context4.next = 10;
|
|
363
|
-
return subscribe(_url);
|
|
364
|
-
|
|
365
|
-
case 10:
|
|
366
|
-
product_url = _context4.sent;
|
|
367
|
-
return _context4.abrupt("return", product_url.replace('<%LANG%>', search.language_code));
|
|
368
|
-
|
|
369
|
-
case 12:
|
|
370
|
-
return _context4.abrupt("return", null);
|
|
371
|
-
|
|
372
|
-
case 15:
|
|
373
|
-
_context4.prev = 15;
|
|
374
|
-
_context4.t0 = _context4["catch"](1);
|
|
375
|
-
error = new Error("Error in confirmTPayCheck() :\n ".concat(JSON.stringify(search)));
|
|
376
|
-
error['type'] = "SubscriptionFailed";
|
|
377
|
-
console.error(error);
|
|
378
|
-
throw error;
|
|
379
|
-
|
|
380
|
-
case 21:
|
|
381
|
-
case "end":
|
|
382
|
-
return _context4.stop();
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}, _callee4, null, [[1, 15]]);
|
|
386
|
-
}));
|
|
387
|
-
|
|
388
|
-
return function confirmTPayCheck() {
|
|
389
|
-
return _ref6.apply(this, arguments);
|
|
390
|
-
};
|
|
391
|
-
}();
|
|
392
|
-
|
|
393
|
-
exports.confirmTPayCheck = confirmTPayCheck;
|
|
394
|
-
|
|
395
|
-
var confirmTPay = function confirmTPay(window, tpayConfig, locale, redirectUrl) {
|
|
396
|
-
//@ts-ignore
|
|
397
|
-
if (typeof window.browser == "undefined") {
|
|
398
|
-
//@ts-ignore
|
|
399
|
-
window.browser = window.chrome;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
if (tpayConfig == null || tpayConfig.success != true) {
|
|
403
|
-
var error = new Error("Error in confirmTPay() TPay.HeaderEnrichment");
|
|
404
|
-
error['type'] = "InvalidConfig";
|
|
405
|
-
console.error(error);
|
|
406
|
-
throw error;
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
var config = tpayConfig.config,
|
|
410
|
-
prodSku = tpayConfig.prodSku;
|
|
411
|
-
var operatorCode = window.TPay.HeaderEnrichment.operatorCode();
|
|
412
|
-
var sessionId = window.TPay.HeaderEnrichment.sessionId();
|
|
413
|
-
var catName = config["catalog_name"][operatorCode];
|
|
414
|
-
var subscriptionPlanId = config["subscription_plan_id"];
|
|
415
|
-
var lang = locale;
|
|
416
|
-
var rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
417
|
-
var operatorFQN = 'EG_ORANGE';
|
|
418
|
-
|
|
419
|
-
if (operatorCode == 60202) {
|
|
420
|
-
operatorFQN = 'EG_VODAFONE';
|
|
421
|
-
} else if (operatorCode == 60303) {
|
|
422
|
-
operatorFQN = 'DZ_OOREDOO';
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
console.log("operatorFQN", operatorFQN);
|
|
426
|
-
var availableRdrl = redirectUrl ? redirectUrl : window.location.origin + window.location.pathname;
|
|
427
|
-
var rUrl = "".concat(availableRdrl, "?subscription_url=").concat(encodeURIComponent("".concat(tpayConfig.subscription_url, "operator=").concat(operatorFQN, "&language_code=").concat(locale)), "&rockman_id=").concat(rockmanId, "&language_code=").concat(locale, "&");
|
|
428
|
-
console.log("Redirect url", rUrl);
|
|
429
|
-
var hash = window.tPayhash;
|
|
430
|
-
console.log("Operator Code: " + operatorCode);
|
|
431
|
-
console.log("Session Id: " + sessionId);
|
|
432
|
-
console.log("Product Catalog: " + catName);
|
|
433
|
-
console.log("Subscription Plan :" + subscriptionPlanId);
|
|
434
|
-
window.TPay.HeaderEnrichment.hasSubscription(prodSku, function (hasSub, subId) {
|
|
435
|
-
if (hasSub) {
|
|
436
|
-
console.log("hasSubscription"); // User has already a subscription, go to returnSubscription
|
|
437
|
-
|
|
438
|
-
console.log('User is already subscribed');
|
|
439
|
-
var productUrl = config['product_url'];
|
|
440
|
-
|
|
441
|
-
if (config["replace_uid"] != undefined && config['replace_uid'] == true) {
|
|
442
|
-
console.log('sub id ' + subId);
|
|
443
|
-
productUrl = config['product_full_access'];
|
|
444
|
-
fetch("http://de-mcb-api.sam-media.com/api/v2/validate-access/?domain=".concat(config.domain, "&sub_id=").concat(subId, "&country=").concat(tpayConfig.country, "&gateway=tpay")).then(function (response) {
|
|
445
|
-
if (response.payload.token) {
|
|
446
|
-
productUrl = config['product_url'].replace('<%UID%>', response.payload.token);
|
|
447
|
-
}
|
|
448
|
-
}).catch(function (err) {
|
|
449
|
-
console.warn('validate-access' + err);
|
|
450
|
-
});
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
console.log("productUrl", productUrl);
|
|
454
|
-
setTimeout(function () {
|
|
455
|
-
window.location.href = productUrl;
|
|
456
|
-
}, 1000);
|
|
457
|
-
console.log("productUrl", productUrl);
|
|
458
|
-
|
|
459
|
-
var _error = new Error("Error in confirmTPay() TPay.HeaderEnrichment.hasSubscription action:\n".concat('ALREADY SUBSCRIBED'));
|
|
460
|
-
|
|
461
|
-
_error['type'] = "AlreadySubscribed";
|
|
462
|
-
_error['productUrl'] = productUrl;
|
|
463
|
-
console.error(_error);
|
|
464
|
-
throw _error;
|
|
465
|
-
} else {
|
|
466
|
-
console.log("NOT ACTIVE");
|
|
467
|
-
|
|
468
|
-
if (config.flow != "consent") {
|
|
469
|
-
try {
|
|
470
|
-
//@ts-ignore
|
|
471
|
-
window.TPay.HeaderEnrichment.confirm(subscriptionPlanId, catName, prodSku, sessionId, rUrl, rockmanId, lang, hash);
|
|
472
|
-
} catch (err) {
|
|
473
|
-
var _error2 = new Error("Error in confirmTPay() TPay.HeaderEnrichment.confirm action:\n".concat(JSON.stringify(err)));
|
|
474
|
-
|
|
475
|
-
_error2['type'] = "ConfirmError";
|
|
476
|
-
console.error(_error2);
|
|
477
|
-
}
|
|
478
|
-
} else {
|
|
479
|
-
// user is not active subscriber, proceed with subscription(redirect to tpay pin page)
|
|
480
|
-
try {
|
|
481
|
-
window.TPay.HeaderEnrichment.consent(subscriptionPlanId, catName, prodSku, sessionId, rUrl, rockmanId, lang, hash);
|
|
482
|
-
} catch (err) {
|
|
483
|
-
var _error3 = new Error("Error in confirmTPay() TPay.HeaderEnrichment.consent action:\n".concat(JSON.stringify(err)));
|
|
484
|
-
|
|
485
|
-
_error3['type'] = "ConfirmError";
|
|
486
|
-
console.error(_error3);
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
});
|
|
491
|
-
}; // export const mockedSuccessState : IOneClickCurrentState = {
|
|
492
|
-
// type: "LOAD_TPAY_HE",
|
|
493
|
-
// result: RDS.Success<ILOADTPAYFailure, ILOADTPAYSuccess>({
|
|
494
|
-
// redirectUrl: 'https://www.yahoo.com/',
|
|
495
|
-
// nextAction:"getRedirectUrlAction"
|
|
496
|
-
// })
|
|
497
|
-
// }
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
exports.confirmTPay = confirmTPay;
|
|
501
|
-
var mockedConfirmState = {
|
|
502
|
-
currentState: {
|
|
503
|
-
type: "LOAD_TPAY_HE",
|
|
504
|
-
//@ts-ignore
|
|
505
|
-
result: RDS.Success({}),
|
|
506
|
-
//@ts-ignore
|
|
507
|
-
tpayConfig: {}
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
exports.mockedConfirmState = mockedConfirmState;
|
package/dist/test/setup.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.array.includes");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.string.includes");
|
|
6
|
-
|
|
7
|
-
require("whatwg-fetch");
|
|
8
|
-
|
|
9
|
-
// Jenkins seems to have installed a custom certificate which causes the logs to be poluted
|
|
10
|
-
// This little hack fixes that
|
|
11
|
-
var logErr = console.error; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
|
|
13
|
-
console.error = function (message) {
|
|
14
|
-
if (message && message.includes('ERR_TLS_CERT_ALTNAME_INVALID')) return;
|
|
15
|
-
|
|
16
|
-
for (var _len = arguments.length, optionalParams = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
17
|
-
optionalParams[_key - 1] = arguments[_key];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
logErr(message, optionalParams);
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
jest.mock('../auth/authHandler');
|
|
24
|
-
global.scrollTo = jest.fn();
|
package/dist/test/test-utils.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.object.keys");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/web.dom-collections.for-each");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
var _exportNames = {
|
|
11
|
-
server: true
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "server", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function get() {
|
|
16
|
-
return _server.server;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
require("whatwg-fetch");
|
|
21
|
-
|
|
22
|
-
var _server = require("../mockServer/server");
|
|
23
|
-
|
|
24
|
-
var _msw = require("msw");
|
|
25
|
-
|
|
26
|
-
Object.keys(_msw).forEach(function (key) {
|
|
27
|
-
if (key === "default" || key === "__esModule") return;
|
|
28
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
29
|
-
if (key in exports && exports[key] === _msw[key]) return;
|
|
30
|
-
Object.defineProperty(exports, key, {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _msw[key];
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Generic functions for the tests.
|
|
40
|
-
*/
|
|
41
|
-
beforeAll(function () {
|
|
42
|
-
_server.server.listen();
|
|
43
|
-
});
|
|
44
|
-
afterEach(function () {
|
|
45
|
-
_server.server.resetHandlers();
|
|
46
|
-
|
|
47
|
-
_server.server.restoreHandlers();
|
|
48
|
-
});
|
|
49
|
-
afterAll(function () {
|
|
50
|
-
_server.server.close();
|
|
51
|
-
}); // re-export everything
|