ouisys-engine 2.1.21 → 2.1.26
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/api/click2sms.js +357 -0
- package/dist/api/index.d.ts +0 -2
- package/dist/api/index.js +88 -164
- package/dist/api/mo.js +274 -0
- package/dist/api/moRedir.js +186 -0
- package/dist/api/oneClick.js +366 -0
- package/dist/api/pin.js +493 -0
- package/dist/api/strategies.js +704 -0
- package/dist/api/ussd.js +1 -0
- package/dist/app/store.js +35 -0
- package/dist/common-types/AppThunk.d.ts +1 -2
- package/dist/features/strategies/categories/askMobileNumber.js +395 -0
- package/dist/features/strategies/categories/askOperator.js +311 -0
- package/dist/features/strategies/categories/detectOperatorByIp.js +606 -0
- package/dist/features/strategies/categories/headerEnrichment.js +670 -0
- package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +12 -0
- package/dist/features/strategies/categories/typings/identifySliceTypes.js +22 -0
- package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +22 -0
- package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +21 -0
- package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +13 -0
- package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +13 -0
- package/dist/features/strategies/click2smsFlowSlice.js +172 -0
- package/dist/features/strategies/identifySlice.js +455 -0
- package/dist/features/strategies/moFlowSlice.js +196 -0
- package/dist/features/strategies/moRedirFlowSlice.js +190 -0
- package/dist/features/strategies/oneClickFlowSlice.js +277 -0
- package/dist/features/strategies/pinFlowSlice.js +313 -0
- package/dist/features/strategies/ussdFlowSlice.js +1 -0
- package/dist/flows/strategy.d.ts +1 -2
- package/dist/flows/strategy.js +1 -5
- package/dist/ips/tryGetIPRangeName.js +14 -13
- package/dist/mockServer/browser.js +48 -0
- package/dist/mockServer/handlers.js +22 -0
- package/dist/mockServer/server.js +48 -0
- package/dist/pacman/index.js +0 -1
- package/dist/reducers/click2smsFlow/utils.js +1 -3
- package/dist/reducers/moRedirFlow/utils.js +1 -1
- package/dist/reducers/oneClickFlow/utils.js +47 -19
- package/dist/reducers/pinFlow/utils.js +7 -12
- package/dist/reducers/strategy/utils.js +12 -13
- package/dist/reducers/tpayHeFlow/utils.js +1 -1
- package/dist/store/index.d.ts +1 -2
- package/dist/store/reducers.d.ts +0 -2
- package/dist/store/reducers.js +1 -4
- package/dist/test/setup.js +24 -0
- package/dist/test/test-utils.js +51 -0
- package/dist/utilities/loadScriptInnerHtml.d.ts +2 -0
- package/dist/utilities/loadScriptInnerHtml.js +18 -0
- package/package.json +1 -1
- package/src/api/index.ts +4 -37
- package/src/common-types/AppThunk.ts +1 -2
- package/src/flows/strategy.ts +1 -5
- package/src/ips/tryGetIPRangeName.ts +3 -2
- package/src/pacman/index.ts +1 -1
- package/src/reducers/click2smsFlow/utils.ts +0 -3
- package/src/reducers/moRedirFlow/utils.ts +1 -1
- package/src/reducers/oneClickFlow/utils.ts +77 -11
- package/src/reducers/pinFlow/utils.ts +2 -9
- package/src/reducers/strategy/utils.ts +2 -3
- package/src/store/index.ts +1 -2
- package/src/store/reducers.ts +1 -5
- package/src/utilities/loadScriptInnerHtml.ts +10 -0
- package/yarn.lock +5204 -0
- package/src/flows/tpayHeFlow.ts +0 -20
- package/src/reducers/tpayHeFlow/ITpayHeConstants.ts +0 -7
- package/src/reducers/tpayHeFlow/TpayHeTypes.ts +0 -135
- package/src/reducers/tpayHeFlow/index.ts +0 -207
- package/src/reducers/tpayHeFlow/utils.ts +0 -311
|
@@ -53,6 +53,10 @@ require("regenerator-runtime/runtime");
|
|
|
53
53
|
|
|
54
54
|
var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
|
|
55
55
|
|
|
56
|
+
var _loadScriptInnerHtml = _interopRequireDefault(require("../../utilities/loadScriptInnerHtml"));
|
|
57
|
+
|
|
58
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
59
|
+
|
|
56
60
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
57
61
|
|
|
58
62
|
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; }
|
|
@@ -98,17 +102,11 @@ var fetchJsonp = function fetchJsonp(_url) {
|
|
|
98
102
|
});
|
|
99
103
|
};
|
|
100
104
|
|
|
101
|
-
var
|
|
102
|
-
var script = document.createElement('script');
|
|
103
|
-
script.type = 'text/javascript';
|
|
104
|
-
script.innerHTML = innerHTML;
|
|
105
|
-
document.body.appendChild(script);
|
|
106
|
-
console.log('loadScript');
|
|
107
|
-
};
|
|
105
|
+
var uniqidResult;
|
|
108
106
|
|
|
109
107
|
var getRedirectUrl = /*#__PURE__*/function () {
|
|
110
108
|
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(window, maybeConfig, extraParams) {
|
|
111
|
-
var host, country, slug, queryString, apiAction, bupperizeCountry, offer, s, search, extraParamsQs, rockmanId, _url2, result, identifyError, _url3, _result, _identifyError, _url4, _result2, _identifyError2;
|
|
109
|
+
var host, country, slug, queryString, device, apiAction, bupperizeCountry, offer, s, search, extraParamsQs, rockmanId, _url2, result, identifyError, _url3, _result, _identifyError, mcpShieldResult, mcpSessionCheckWithBlock, _url4, _result2, _identifyError2;
|
|
112
110
|
|
|
113
111
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
114
112
|
while (1) {
|
|
@@ -122,7 +120,7 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
122
120
|
throw "javascript: console.error('SSR'); void 6";
|
|
123
121
|
|
|
124
122
|
case 4:
|
|
125
|
-
host = maybeConfig.host, country = maybeConfig.country, slug = maybeConfig.slug, queryString = maybeConfig.queryString, apiAction = maybeConfig.apiAction;
|
|
123
|
+
host = maybeConfig.host, country = maybeConfig.country, slug = maybeConfig.slug, queryString = maybeConfig.queryString, device = maybeConfig.device, apiAction = maybeConfig.apiAction;
|
|
126
124
|
|
|
127
125
|
bupperizeCountry = function bupperizeCountry(c) {
|
|
128
126
|
return c == 'gb' ? 'uk' : c;
|
|
@@ -172,7 +170,7 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
172
170
|
});
|
|
173
171
|
|
|
174
172
|
case 23:
|
|
175
|
-
_context.next =
|
|
173
|
+
_context.next = 62;
|
|
176
174
|
break;
|
|
177
175
|
|
|
178
176
|
case 25:
|
|
@@ -200,27 +198,57 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
200
198
|
throw _identifyError;
|
|
201
199
|
|
|
202
200
|
case 36:
|
|
203
|
-
|
|
201
|
+
(0, _loadScriptInnerHtml.default)(_result.source);
|
|
204
202
|
return _context.abrupt("return", {
|
|
205
203
|
redirect_url: _result.redirectUrlWithReplacedUniqid
|
|
206
204
|
});
|
|
207
205
|
|
|
208
206
|
case 38:
|
|
209
|
-
_context.next =
|
|
207
|
+
_context.next = 62;
|
|
210
208
|
break;
|
|
211
209
|
|
|
212
210
|
case 40:
|
|
211
|
+
if (!(country.toLowerCase() === "za")) {
|
|
212
|
+
_context.next = 51;
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
_context.prev = 41;
|
|
217
|
+
_context.next = 44;
|
|
218
|
+
return window.tallymanApi.mcpShield(host, country, slug, device, offer, rockmanId);
|
|
219
|
+
|
|
220
|
+
case 44:
|
|
221
|
+
mcpShieldResult = _context.sent;
|
|
222
|
+
|
|
223
|
+
if (false == mcpShieldResult.success) {
|
|
224
|
+
console.warn(mcpShieldResult.message);
|
|
225
|
+
} else {
|
|
226
|
+
(0, _loadScriptInnerHtml.default)(mcpShieldResult.source);
|
|
227
|
+
uniqidResult = mcpShieldResult.uniqid;
|
|
228
|
+
mcpSessionCheckWithBlock = "\n \n document.addEventListener('click', function (event) {\n \n event.preventDefault();\n try{\n if (!event.target.matches('.mcp')) return;\n if (!window.isMcpSessionChecked) {\n \n var url = \"https://de-ads.tallymans.com/tallyman/v1/?action=mcp-session-check&slug=".concat(slug, "&country=").concat(country, "&device=").concat(device, "&rockman_id=").concat(rockmanId, "&mcpUniqid=").concat(uniqidResult, "\";\n \n fetch(url).then(function(res) {\n return res.json()\n }).then(function(resJson) {\n window.isMcpSessionChecked = true;\n console.log('MCP');\n \n if (resJson[\"should-block\"] == true) {\n document.body.innerHTML = \"\"\n \n var div = document.createElement(\"div\");\n div.setAttribute(\"id\", \"page_blocked\")\n div.style.width = \"100%\";\n div.style.height = \"100%\";\n div.style.background = \"#fff\";\n div.style.color = \"#000\";\n div.style.position = \"fixed\";\n div.style.display = \"flex\";\n div.style.justifyContent = \"center\";\n div.style.alignItems = \"center\";\n div.style.fontSize = \"40px\";\n div.style.top = \"0\";\n div.style.bottom = \"0\";\n div.style.left = \"0\";\n div.style.right = \"0\";\n div.innerHTML = \"Offer Expired\";\n document.body.appendChild(div);\n }else{\n const target = event.target || event.srcElement;\n\n while (target) {\n if (target instanceof HTMLAnchorElement) {\n console.log(target.getAttribute('href'));\n window.location.href = target.getAttribute('href')\n break;\n }\n \n target = target.parentNode;\n }\n }\n });\n }\n }catch(err){\n console.error(err);\n }\n },false)\n ");
|
|
229
|
+
(0, _loadScriptInnerHtml.default)(mcpSessionCheckWithBlock);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
_context.next = 51;
|
|
233
|
+
break;
|
|
234
|
+
|
|
235
|
+
case 48:
|
|
236
|
+
_context.prev = 48;
|
|
237
|
+
_context.t0 = _context["catch"](41);
|
|
238
|
+
console.warn(_context.t0);
|
|
239
|
+
|
|
240
|
+
case 51:
|
|
213
241
|
_url4 = "https://de.tallymans.com/tallyman/v1/?action=redirect&country=".concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", "smart", "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
|
|
214
|
-
_context.next =
|
|
242
|
+
_context.next = 54;
|
|
215
243
|
return fetch(_url4).then(function (x) {
|
|
216
244
|
return x.json();
|
|
217
245
|
});
|
|
218
246
|
|
|
219
|
-
case
|
|
247
|
+
case 54:
|
|
220
248
|
_result2 = _context.sent;
|
|
221
249
|
|
|
222
250
|
if (!(false === _result2.success)) {
|
|
223
|
-
_context.next =
|
|
251
|
+
_context.next = 61;
|
|
224
252
|
break;
|
|
225
253
|
}
|
|
226
254
|
|
|
@@ -228,17 +256,17 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
228
256
|
_identifyError2['type'] = "NotOn3g";
|
|
229
257
|
throw _identifyError2;
|
|
230
258
|
|
|
231
|
-
case
|
|
259
|
+
case 61:
|
|
232
260
|
return _context.abrupt("return", {
|
|
233
261
|
redirect_url: _result2.redirect_url
|
|
234
262
|
});
|
|
235
263
|
|
|
236
|
-
case
|
|
264
|
+
case 62:
|
|
237
265
|
case "end":
|
|
238
266
|
return _context.stop();
|
|
239
267
|
}
|
|
240
268
|
}
|
|
241
|
-
}, _callee);
|
|
269
|
+
}, _callee, null, [[41, 48]]);
|
|
242
270
|
}));
|
|
243
271
|
|
|
244
272
|
return function getRedirectUrl(_x, _x2, _x3) {
|
|
@@ -352,7 +380,7 @@ var mockedRedirectUrlSuccessState = {
|
|
|
352
380
|
type: "GET_REDIRECT_URL",
|
|
353
381
|
//@ts-ignore
|
|
354
382
|
result: RDS.Success({
|
|
355
|
-
redirectUrl: '
|
|
383
|
+
redirectUrl: '/mock-product-url'
|
|
356
384
|
})
|
|
357
385
|
}
|
|
358
386
|
};
|
|
@@ -58,6 +58,10 @@ var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"))
|
|
|
58
58
|
|
|
59
59
|
var _utils = require("../strategy/utils");
|
|
60
60
|
|
|
61
|
+
var _loadScriptInnerHtml = _interopRequireDefault(require("../../utilities/loadScriptInnerHtml"));
|
|
62
|
+
|
|
63
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
64
|
+
|
|
61
65
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
62
66
|
|
|
63
67
|
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; }
|
|
@@ -72,15 +76,6 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
72
76
|
|
|
73
77
|
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); }); }; }
|
|
74
78
|
|
|
75
|
-
var loadScriptInnerHtml = function loadScriptInnerHtml(innerHTML) {
|
|
76
|
-
var script = document.createElement('script');
|
|
77
|
-
script.type = 'text/javascript';
|
|
78
|
-
script.innerHTML = innerHTML;
|
|
79
|
-
var headElem = document.getElementsByTagName('head')[0];
|
|
80
|
-
headElem.insertBefore(script, headElem.firstChild);
|
|
81
|
-
console.log('loadScript');
|
|
82
|
-
};
|
|
83
|
-
|
|
84
79
|
function submitMSISDN(_x, _x2, _x3, _x4) {
|
|
85
80
|
return _submitMSISDN.apply(this, arguments);
|
|
86
81
|
}
|
|
@@ -154,7 +149,7 @@ function _loadMcpShield() {
|
|
|
154
149
|
break;
|
|
155
150
|
|
|
156
151
|
case 11:
|
|
157
|
-
|
|
152
|
+
(0, _loadScriptInnerHtml.default)(mcpShieldResult.source);
|
|
158
153
|
uniqidOnLoadResult = mcpShieldResult.uniqid;
|
|
159
154
|
return _context2.abrupt("return", mcpShieldResult);
|
|
160
155
|
|
|
@@ -274,7 +269,7 @@ function _submitMSISDNOnce() {
|
|
|
274
269
|
if (false == mcpShieldResult.success) {
|
|
275
270
|
console.warn(mcpShieldResult.message);
|
|
276
271
|
} else {
|
|
277
|
-
|
|
272
|
+
(0, _loadScriptInnerHtml.default)(mcpShieldResult.source);
|
|
278
273
|
uniqidResult = mcpShieldResult.uniqid;
|
|
279
274
|
}
|
|
280
275
|
|
|
@@ -516,7 +511,7 @@ var mockedCompletedState = {
|
|
|
516
511
|
currentState: {
|
|
517
512
|
type: "PINEntry",
|
|
518
513
|
result: RDS.Success({
|
|
519
|
-
finalUrl: "
|
|
514
|
+
finalUrl: "/mock-product-url"
|
|
520
515
|
}),
|
|
521
516
|
data: {
|
|
522
517
|
actualPIN: "",
|
|
@@ -431,7 +431,7 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
431
431
|
searchObj = searchToObject();
|
|
432
432
|
|
|
433
433
|
if (!(!!searchObj["redirect-back"] && searchObj["redirect-back"] == "1" && !!searchObj.success)) {
|
|
434
|
-
_context2.next =
|
|
434
|
+
_context2.next = 56;
|
|
435
435
|
break;
|
|
436
436
|
}
|
|
437
437
|
|
|
@@ -503,11 +503,10 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
503
503
|
});
|
|
504
504
|
|
|
505
505
|
case 46:
|
|
506
|
-
_context2.next =
|
|
506
|
+
_context2.next = 54;
|
|
507
507
|
break;
|
|
508
508
|
|
|
509
509
|
case 48:
|
|
510
|
-
console.log("newUrl", window.location.href);
|
|
511
510
|
_newUrl2 = new URL(window.location.href);
|
|
512
511
|
_queryString3 = _newUrl2.search;
|
|
513
512
|
_urlParams2 = new URLSearchParams(_queryString3);
|
|
@@ -518,20 +517,20 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
518
517
|
operator: _operator2
|
|
519
518
|
});
|
|
520
519
|
|
|
521
|
-
case
|
|
522
|
-
_context2.next =
|
|
520
|
+
case 54:
|
|
521
|
+
_context2.next = 67;
|
|
523
522
|
break;
|
|
524
523
|
|
|
525
|
-
case
|
|
526
|
-
_url2 = "https://".concat(newHost, "/tallyman/v1/?action=identify-user&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=").concat(device, "&offerId=").concat(offer, "&page=").concat(window.location.href, "&pixel_url=").concat(encodeURIComponent("http://
|
|
527
|
-
_context2.next =
|
|
524
|
+
case 56:
|
|
525
|
+
_url2 = "https://".concat(newHost, "/tallyman/v1/?action=identify-user&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=").concat(device, "&offerId=").concat(offer, "&page=").concat(window.location.href, "&pixel_url=").concat(encodeURIComponent("http://".concat(window.location.host, "/pixels?xcid=").concat(window.location.pathname.replace("/", ""), "&xaid=").concat(window.pac_analytics.visitor.xaid, "&country=").concat(bupperizeCountry(country))), "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
|
|
526
|
+
_context2.next = 59;
|
|
528
527
|
return fetchJsonp(_url2);
|
|
529
528
|
|
|
530
|
-
case
|
|
529
|
+
case 59:
|
|
531
530
|
result = _context2.sent;
|
|
532
531
|
|
|
533
532
|
if (!(false === result.success)) {
|
|
534
|
-
_context2.next =
|
|
533
|
+
_context2.next = 66;
|
|
535
534
|
break;
|
|
536
535
|
}
|
|
537
536
|
|
|
@@ -540,7 +539,7 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
540
539
|
|
|
541
540
|
throw _identifyError;
|
|
542
541
|
|
|
543
|
-
case
|
|
542
|
+
case 66:
|
|
544
543
|
return _context2.abrupt("return", {
|
|
545
544
|
subscription_url: result.subscription_url || result.redirect_url,
|
|
546
545
|
action: function action() {
|
|
@@ -550,7 +549,7 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
550
549
|
operator: result.operator
|
|
551
550
|
});
|
|
552
551
|
|
|
553
|
-
case
|
|
552
|
+
case 67:
|
|
554
553
|
case "end":
|
|
555
554
|
return _context2.stop();
|
|
556
555
|
}
|
|
@@ -571,7 +570,7 @@ var subscribe = /*#__PURE__*/function () {
|
|
|
571
570
|
while (1) {
|
|
572
571
|
switch (_context3.prev = _context3.next) {
|
|
573
572
|
case 0:
|
|
574
|
-
return _context3.abrupt("return", "
|
|
573
|
+
return _context3.abrupt("return", "/mock-product-url");
|
|
575
574
|
|
|
576
575
|
case 1:
|
|
577
576
|
case "end":
|
|
@@ -441,7 +441,7 @@ var confirmTPay = function confirmTPay(window, tpayConfig, locale, redirectUrl)
|
|
|
441
441
|
if (config["replace_uid"] != undefined && config['replace_uid'] == true) {
|
|
442
442
|
console.log('sub id ' + subId);
|
|
443
443
|
productUrl = config['product_full_access'];
|
|
444
|
-
fetch("http://de
|
|
444
|
+
fetch("http://de.tallymans.com/api/v2/validate-access/?domain=".concat(config.domain, "&sub_id=").concat(subId, "&country=").concat(tpayConfig.country, "&gateway=tpay")).then(function (response) {
|
|
445
445
|
if (response.payload.token) {
|
|
446
446
|
productUrl = config['product_url'].replace('<%UID%>', response.payload.token);
|
|
447
447
|
}
|
package/dist/store/index.d.ts
CHANGED
|
@@ -6,8 +6,7 @@ import { IUssdActions } from "../reducers/ussdFlow/UssdTypes";
|
|
|
6
6
|
import { IMoRedirActions } from "../reducers/moRedirFlow/MoRedirTypes";
|
|
7
7
|
import { IOneClickActions } from "../reducers/oneClickFlow/OneClickTypes";
|
|
8
8
|
import { IClick2SmsActions } from "../reducers/click2smsFlow/Click2smsTypes";
|
|
9
|
-
|
|
10
|
-
export declare type IApplicationActions = IStrategyActions | IPinActions | IMoActions | IMoRedirActions | IOneClickActions | IClick2SmsActions | IUssdActions | ITpayHeActions;
|
|
9
|
+
export declare type IApplicationActions = IStrategyActions | IPinActions | IMoActions | IMoRedirActions | IOneClickActions | IClick2SmsActions | IUssdActions;
|
|
11
10
|
declare const store: import("redux").Store<import("redux").EmptyObject & IApplicationState, import("redux").AnyAction> & {
|
|
12
11
|
dispatch: import("redux-thunk").ThunkDispatch<IApplicationState, undefined, IApplicationActions>;
|
|
13
12
|
};
|
package/dist/store/reducers.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import { IMoRedirFlowReducerState } from "../reducers/moRedirFlow/MoRedirTypes";
|
|
|
5
5
|
import { IOneClickFlowReducerState } from "../reducers/oneClickFlow/OneClickTypes";
|
|
6
6
|
import { IClick2smsFlowReducerState } from "../reducers/click2smsFlow/Click2smsTypes";
|
|
7
7
|
import { IUssdFlowReducerState } from "../reducers/ussdFlow/UssdTypes";
|
|
8
|
-
import { ITpayHeFlowReducerState } from "../reducers/tpayHeFlow/TpayHeTypes";
|
|
9
8
|
export interface IApplicationState {
|
|
10
9
|
strategy: IStrategyReducerState;
|
|
11
10
|
pinFlow: IPinFlowReducerState;
|
|
@@ -14,7 +13,6 @@ export interface IApplicationState {
|
|
|
14
13
|
oneClickFlow: IOneClickFlowReducerState;
|
|
15
14
|
click2smsFlow: IClick2smsFlowReducerState;
|
|
16
15
|
ussdFlow: IUssdFlowReducerState;
|
|
17
|
-
tpayHeFlow: ITpayHeFlowReducerState;
|
|
18
16
|
}
|
|
19
17
|
declare const _default: () => import("redux").Reducer<import("redux").CombinedState<IApplicationState>, import("redux").AnyAction>;
|
|
20
18
|
export default _default;
|
package/dist/store/reducers.js
CHANGED
|
@@ -21,8 +21,6 @@ var _click2smsFlow = _interopRequireDefault(require("../reducers/click2smsFlow")
|
|
|
21
21
|
|
|
22
22
|
var _ussdFlow = _interopRequireDefault(require("../reducers/ussdFlow"));
|
|
23
23
|
|
|
24
|
-
var _tpayHeFlow = _interopRequireDefault(require("../reducers/tpayHeFlow"));
|
|
25
|
-
|
|
26
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
25
|
|
|
28
26
|
var _default = function _default() {
|
|
@@ -33,8 +31,7 @@ var _default = function _default() {
|
|
|
33
31
|
moRedirFlow: _moRedirFlow.default,
|
|
34
32
|
oneClickFlow: _oneClickFlow.default,
|
|
35
33
|
click2smsFlow: _click2smsFlow.default,
|
|
36
|
-
ussdFlow: _ussdFlow.default
|
|
37
|
-
tpayHeFlow: _tpayHeFlow.default
|
|
34
|
+
ussdFlow: _ussdFlow.default
|
|
38
35
|
});
|
|
39
36
|
};
|
|
40
37
|
|
|
@@ -0,0 +1,24 @@
|
|
|
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();
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var loadScriptInnerHtml = function loadScriptInnerHtml(innerHTML) {
|
|
9
|
+
var script = document.createElement('script');
|
|
10
|
+
script.type = 'text/javascript';
|
|
11
|
+
script.innerHTML = innerHTML;
|
|
12
|
+
var headElem = document.getElementsByTagName('head')[0];
|
|
13
|
+
headElem.insertBefore(script, headElem.firstChild);
|
|
14
|
+
console.log('loadScript');
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var _default = loadScriptInnerHtml;
|
|
18
|
+
exports.default = _default;
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { IMSISDNSubmissionResult as IMoMSISDNSubmissionResult } from "../reducer
|
|
|
6
6
|
import IError from "../common-types/IError";
|
|
7
7
|
import { IIdentifyResult } from "../reducers/strategy/StrategyTypes";
|
|
8
8
|
import { IFetchResult } from "../reducers/click2smsFlow/Click2smsTypes";
|
|
9
|
-
import { ITpayConsentResult } from "../reducers/TpayHeFlow/TpayHeTypes";
|
|
10
9
|
|
|
11
10
|
const bupperizeCountry = (c:string) => c == 'gb' ? 'uk' : c;
|
|
12
11
|
|
|
@@ -20,7 +19,6 @@ export interface ITallyman {
|
|
|
20
19
|
redirect:(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, ip_range_name:string, search:string, extraParamsQs:string)=>Promise<IMoRedirMSISDNSubmissionResult>;
|
|
21
20
|
ussd:(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, search:string, extraParamsQs:string)=>Promise<IMoMSISDNSubmissionResult>;
|
|
22
21
|
oc2sms:(host: string, country:string, slug:string, offer:number, rockmanId:string, keyword:string, operator:string, search:string)=>Promise<IFetchResult>;
|
|
23
|
-
tpayConsentConfig:(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, search: string)=>Promise<ITpayConsentResult>;
|
|
24
22
|
mcpShield:(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, operator?:string, uniqid?:string)=>Promise<IMcpShieldResult>;
|
|
25
23
|
}
|
|
26
24
|
|
|
@@ -61,7 +59,7 @@ export const MockTallyman:ITallyman = {
|
|
|
61
59
|
return {
|
|
62
60
|
success: true,
|
|
63
61
|
rockman_id: "000",
|
|
64
|
-
product_url: "
|
|
62
|
+
product_url: "/mock-product-url",
|
|
65
63
|
async: false
|
|
66
64
|
}
|
|
67
65
|
},
|
|
@@ -71,7 +69,7 @@ export const MockTallyman:ITallyman = {
|
|
|
71
69
|
return {
|
|
72
70
|
success: true,
|
|
73
71
|
rockman_id: "000",
|
|
74
|
-
product_url: "
|
|
72
|
+
product_url: "/mock-product-url",
|
|
75
73
|
msisdn:"000"
|
|
76
74
|
}
|
|
77
75
|
},
|
|
@@ -81,7 +79,7 @@ export const MockTallyman:ITallyman = {
|
|
|
81
79
|
return {
|
|
82
80
|
success: true,
|
|
83
81
|
rockman_id: "000",
|
|
84
|
-
product_url: "
|
|
82
|
+
product_url: "/mock-product-url",
|
|
85
83
|
msisdn:"000"
|
|
86
84
|
}
|
|
87
85
|
},
|
|
@@ -91,7 +89,7 @@ export const MockTallyman:ITallyman = {
|
|
|
91
89
|
return {
|
|
92
90
|
success: true,
|
|
93
91
|
rockman_id: "000",
|
|
94
|
-
redirect_url: "
|
|
92
|
+
redirect_url: "/mock-product-url"
|
|
95
93
|
}
|
|
96
94
|
},
|
|
97
95
|
triggerMessage:async(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, search:string, extraParamsQs:string): Promise<IMoMSISDNSubmissionResult> =>{
|
|
@@ -125,31 +123,6 @@ export const MockTallyman:ITallyman = {
|
|
|
125
123
|
shortcode: '666'
|
|
126
124
|
}
|
|
127
125
|
},
|
|
128
|
-
tpayConsentConfig:async(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, search: string): Promise<ITpayConsentResult>=> {
|
|
129
|
-
console.log("MockTallyman")
|
|
130
|
-
sleep(2000);
|
|
131
|
-
return {
|
|
132
|
-
"prodSku": "gamelords",
|
|
133
|
-
"lang": "ar",
|
|
134
|
-
"country": "eg",
|
|
135
|
-
"subscription_url": "http:\/\/n.vidflixz.com\/tallyman\/v1\/?action=one-click-subscribe&device=smart&slug=tpay-he-vidflixz&country=eg&offerId=1&rockman_id=13643b4780fb40bb8adf2feb2a400d7f&",
|
|
136
|
-
"config": {
|
|
137
|
-
"product_url": "http:\/\/eg.game-lords.com\/#\/?uid=fdf098fcc6",
|
|
138
|
-
"subscription_plan_id": 829,
|
|
139
|
-
"public": "HFyenUyCJCxl1QTgtVCA",
|
|
140
|
-
"private": "vazlmVhGFyxKLOav6DvW",
|
|
141
|
-
"flow": "consent",
|
|
142
|
-
"catalog_name": {
|
|
143
|
-
"60201": "gamelords_org",
|
|
144
|
-
"60202": "gamelords_vdf",
|
|
145
|
-
"60203": "gamelords_etst"
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
"redirectUrl": "http:\/\/n.game-lords.com\/eg\/animal-game?country=eg&handle=animal-game&offer=1&device=smart&_extracted=957ad26679cd47a09d4efe28d4a4af72&operator=#operator#&msisdnSubmitted=Y&network_type=mobile_data&atmobirun=true&force_mcb_page=true&skipTrigger=true",
|
|
149
|
-
"rid": "957ad26679cd47a09d4efe28d4a4af72",
|
|
150
|
-
"success": true
|
|
151
|
-
}
|
|
152
|
-
},
|
|
153
126
|
mcpShield:async(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, operator?:string,): Promise<IMcpShieldResult>=> {
|
|
154
127
|
console.log("MockTallyman")
|
|
155
128
|
sleep(2000);
|
|
@@ -218,12 +191,6 @@ export const RealTallyman:ITallyman = {
|
|
|
218
191
|
const newHost = isDMB ? "de.tallymans.com" : host;
|
|
219
192
|
return await fetch(`https://${newHost}/tallyman/v1/?action=oc2sms&country=${country}&slug=${slug}&offerId=${offer}${!!keyword ? '&keyword=' + keyword : ''}&device=smart&rockman_id=${rockmanId}${!!operator ? '&operator=' + operator : ''}&${search}`).then(x => x.json())
|
|
220
193
|
},
|
|
221
|
-
tpayConsentConfig:async(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, search: string): Promise<ITpayConsentResult>=> {
|
|
222
|
-
console.log("RealTallyman")
|
|
223
|
-
const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
|
|
224
|
-
const newHost = isDMB ? "de.tallymans.com" : host;
|
|
225
|
-
return await fetch(`https://${newHost}/tallyman/helper/?action=tpay-consent-config&country=${country}&slug=${slug}&device=${device}&offerId=${offer}&device=smart&rockman_id=${rockmanId}&${search}`).then(x => x.json())
|
|
226
|
-
},
|
|
227
194
|
mcpShield:async(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, operator?:string, uniqid?:string): Promise<IMcpShieldResult>=> {
|
|
228
195
|
console.log("RealTallyman")
|
|
229
196
|
const isDMB = (window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf("dmb") != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf("amb")) != -1) ? true : false;
|
|
@@ -8,9 +8,8 @@ import IMoRedirConstants from "../reducers/moRedirFlow/IMoRedirConstants";
|
|
|
8
8
|
import IOneClickConstants from "../reducers/oneClickFlow/IOneClickConstants";
|
|
9
9
|
import IClick2smsConstants from "../reducers/click2smsFlow/IClick2smsConstants";
|
|
10
10
|
import IUssdConstants from "../reducers/ussdFlow/IUssdConstants";
|
|
11
|
-
import ITpayHeConstants from "../reducers/tpayHeFlow/ITpayHeConstants";
|
|
12
11
|
|
|
13
|
-
type IAllActionConstants = IStategyActionContants | IPinConstants | IMoConstants | IMoRedirConstants | IOneClickConstants | IClick2smsConstants | IUssdConstants
|
|
12
|
+
type IAllActionConstants = IStategyActionContants | IPinConstants | IMoConstants | IMoRedirConstants | IOneClickConstants | IClick2smsConstants | IUssdConstants;
|
|
14
13
|
|
|
15
14
|
export type AppThunk<ReturnType = void> = ThunkAction<
|
|
16
15
|
ReturnType,
|
package/src/flows/strategy.ts
CHANGED
|
@@ -12,8 +12,7 @@ function strategy<R>(
|
|
|
12
12
|
moRedirFlow,
|
|
13
13
|
oneClickFlow,
|
|
14
14
|
click2smsFlow,
|
|
15
|
-
ussdFlow
|
|
16
|
-
tpayHeFlow
|
|
15
|
+
ussdFlow
|
|
17
16
|
}:
|
|
18
17
|
{
|
|
19
18
|
identifyFlowByOperatorSelect: (data: OPERATORSelectFlowIdentifySuccess) => R,
|
|
@@ -24,7 +23,6 @@ function strategy<R>(
|
|
|
24
23
|
oneClickFlow: (data: IdentifyFlowOptionsResult<"getRedirectUrlAction">) => R
|
|
25
24
|
click2smsFlow: (data: IdentifyFlowOptionsResult<"loadOc2sms">) => R,
|
|
26
25
|
ussdFlow: (data: IdentifyFlowOptionsResult<"submitMSISDNAction">) => R,
|
|
27
|
-
tpayHeFlow: (data: IdentifyFlowOptionsResult<"loadTpayAction">) => R,
|
|
28
26
|
}): (state: IStrategyCurrentState) => R {
|
|
29
27
|
|
|
30
28
|
|
|
@@ -46,8 +44,6 @@ function strategy<R>(
|
|
|
46
44
|
return click2smsFlow(state.result);
|
|
47
45
|
case 'USSD':
|
|
48
46
|
return ussdFlow(state.result);
|
|
49
|
-
case 'TPAY_HE':
|
|
50
|
-
return tpayHeFlow(state.result);
|
|
51
47
|
}
|
|
52
48
|
}
|
|
53
49
|
}
|
|
@@ -5,9 +5,10 @@ export default async function tryGetIPRangeName(visitor: IVisitor): Promise<stri
|
|
|
5
5
|
|
|
6
6
|
const mockip = queryString(window.location.href, "mock-ip") || process.env.mock_ip;
|
|
7
7
|
console.log("mockip", mockip)
|
|
8
|
-
if (!visitor.ip) {
|
|
8
|
+
if (!visitor.ip && typeof window != "undefined") {
|
|
9
9
|
try {
|
|
10
|
-
const
|
|
10
|
+
const host = window.location.host
|
|
11
|
+
const res = await fetch(`https://${host}/api/v1/ip` + (!!mockip ? `?mock-ip=${mockip}` : "")).then(x => x.json())
|
|
11
12
|
// return isIPInRange('37.200.146.28')
|
|
12
13
|
visitor.ip = res.ip
|
|
13
14
|
visitor.ip_range_name = res.ip_range_name
|
package/src/pacman/index.ts
CHANGED
|
@@ -56,7 +56,7 @@ export default (window: Window, country?: string, page?: string): ITrackerFlowEv
|
|
|
56
56
|
|
|
57
57
|
const pacmanClient = mkPacmanClient({
|
|
58
58
|
rockmanId: window.pac_analytics.visitor.rockmanId,
|
|
59
|
-
serverUrl: process.env.pacman_server,
|
|
59
|
+
serverUrl: process.env.pacman_server,
|
|
60
60
|
impressionNumber: 1,
|
|
61
61
|
signalInterval: 1000 // in milliseconds
|
|
62
62
|
});
|
|
@@ -124,6 +124,3 @@ export async function checkSubscription(window: Window, maybeConfig: IConfig): P
|
|
|
124
124
|
throw error
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
// {"success":true,"uid":"*5QADM","shortcode":"1901","keyword":"TIPS"}%
|
|
129
|
-
// curl "http://w1.mozzi.com/spa-api/?country=gh&device=smart&slug=18plus-oc2sms&action=oc2sms"
|