ouisys-engine 2.1.22 → 2.1.27
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/index.d.ts +0 -2
- package/dist/api/index.js +88 -164
- package/dist/common-types/AppThunk.d.ts +1 -2
- package/dist/flows/strategy.d.ts +1 -2
- package/dist/flows/strategy.js +1 -5
- package/dist/reducers/moRedirFlow/utils.js +1 -1
- package/dist/reducers/oneClickFlow/index.d.ts +5 -1
- package/dist/reducers/oneClickFlow/index.js +10 -5
- package/dist/reducers/oneClickFlow/utils.js +47 -19
- package/dist/reducers/pinFlow/utils.js +7 -12
- package/dist/reducers/strategy/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/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/reducers/moRedirFlow/utils.ts +1 -1
- package/src/reducers/oneClickFlow/index.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 +1 -1
- 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: "",
|
|
@@ -570,7 +570,7 @@ var subscribe = /*#__PURE__*/function () {
|
|
|
570
570
|
while (1) {
|
|
571
571
|
switch (_context3.prev = _context3.next) {
|
|
572
572
|
case 0:
|
|
573
|
-
return _context3.abrupt("return", "
|
|
573
|
+
return _context3.abrupt("return", "/mock-product-url");
|
|
574
574
|
|
|
575
575
|
case 1:
|
|
576
576
|
case "end":
|
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,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:\/\/de.tallymans.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:\/\/de.tallymans.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:\/\/de.tallymans.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
|
}
|
|
@@ -11,7 +11,7 @@ import { IHash } from "../strategy/StrategyTypes";
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
//ACTION CREATORS
|
|
14
|
-
export function getRedirectUrlAction(extraParams?:ILinkExtraParams, autoRedirect?:boolean, isGetRedirectBupperWay?:boolean):AppThunk{
|
|
14
|
+
export function getRedirectUrlAction({extraParams, autoRedirect = false, isGetRedirectBupperWay = false}:{extraParams?:ILinkExtraParams, autoRedirect?:boolean, isGetRedirectBupperWay?:boolean}):AppThunk{
|
|
15
15
|
|
|
16
16
|
return async (dispatch, store)=>{
|
|
17
17
|
const {currentState} = store().strategy
|
|
@@ -3,6 +3,8 @@ import { IConfig, ILinkExtraParams, IGETREDIRECTURLFailure, IGETREDIRECTURLSucce
|
|
|
3
3
|
import * as RDS from "../../common-types/RemoteDataState";
|
|
4
4
|
import IError from "../../common-types/IError";
|
|
5
5
|
import { IHash } from "../strategy/StrategyTypes";
|
|
6
|
+
import loadScriptInnerHtml from "../../utilities/loadScriptInnerHtml";
|
|
7
|
+
import { IMcpShieldResult } from "../pinFlow/PinTypes";
|
|
6
8
|
|
|
7
9
|
export const additionalQueryString = `msisdnSubmitted=Y&legalCheckbox=Y&incentivizedCheckbox=Y&op_confirmCheckbox=N`
|
|
8
10
|
|
|
@@ -30,15 +32,8 @@ const fetchJsonp: <T>(_url:string)=>Promise<T> = (_url:string)=>{
|
|
|
30
32
|
});
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
script.type = 'text/javascript';
|
|
36
|
-
script.innerHTML = innerHTML
|
|
37
|
-
document.body.appendChild(script);
|
|
38
|
-
console.log('loadScript');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const getRedirectUrl = async(window:Window, maybeConfig: IConfig, extraParams?:ILinkExtraParams): Promise<{
|
|
35
|
+
let uniqidResult;
|
|
36
|
+
export const getRedirectUrl = async(window:Window, maybeConfig: IConfig, extraParams?:ILinkExtraParams): Promise<{
|
|
42
37
|
subscription_url?:string;
|
|
43
38
|
redirect_url?:string;
|
|
44
39
|
action?:()=>Promise<string>;
|
|
@@ -46,7 +41,7 @@ export const getRedirectUrl = async(window:Window, maybeConfig: IConfig, extraP
|
|
|
46
41
|
if (typeof window == "undefined") {
|
|
47
42
|
throw "javascript: console.error('SSR'); void 6"
|
|
48
43
|
} else {
|
|
49
|
-
const { host, country, slug, queryString, apiAction} = maybeConfig
|
|
44
|
+
const { host, country, slug, queryString, device, apiAction} = maybeConfig
|
|
50
45
|
const bupperizeCountry = (c:string) => c == 'gb' ? 'uk' : c;
|
|
51
46
|
const offer = window.pac_analytics.visitor.offer
|
|
52
47
|
const s = window.location.search.substr(1)
|
|
@@ -78,6 +73,77 @@ export const getRedirectUrl = async(window:Window, maybeConfig: IConfig, extraP
|
|
|
78
73
|
return {redirect_url:result.redirectUrlWithReplacedUniqid}
|
|
79
74
|
}
|
|
80
75
|
}else{
|
|
76
|
+
if(country.toLowerCase() === "za"){
|
|
77
|
+
try{
|
|
78
|
+
const mcpShieldResult: IMcpShieldResult = await window.tallymanApi.mcpShield(host, country, slug, device, offer, rockmanId)
|
|
79
|
+
if(false == mcpShieldResult.success){
|
|
80
|
+
console.warn(mcpShieldResult.message);
|
|
81
|
+
}else{
|
|
82
|
+
loadScriptInnerHtml(mcpShieldResult.source);
|
|
83
|
+
uniqidResult = mcpShieldResult.uniqid;
|
|
84
|
+
const mcpSessionCheckWithBlock = `
|
|
85
|
+
|
|
86
|
+
document.addEventListener('click', function (event) {
|
|
87
|
+
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
try{
|
|
90
|
+
if (!event.target.matches('.mcp')) return;
|
|
91
|
+
if (!window.isMcpSessionChecked) {
|
|
92
|
+
|
|
93
|
+
var url = "https://de-ads.tallymans.com/tallyman/v1/?action=mcp-session-check&slug=${slug}&country=${country}&device=${device}&rockman_id=${rockmanId}&mcpUniqid=${uniqidResult}";
|
|
94
|
+
|
|
95
|
+
fetch(url).then(function(res) {
|
|
96
|
+
return res.json()
|
|
97
|
+
}).then(function(resJson) {
|
|
98
|
+
window.isMcpSessionChecked = true;
|
|
99
|
+
console.log('MCP');
|
|
100
|
+
|
|
101
|
+
if (resJson["should-block"] == true) {
|
|
102
|
+
document.body.innerHTML = ""
|
|
103
|
+
|
|
104
|
+
var div = document.createElement("div");
|
|
105
|
+
div.setAttribute("id", "page_blocked")
|
|
106
|
+
div.style.width = "100%";
|
|
107
|
+
div.style.height = "100%";
|
|
108
|
+
div.style.background = "#fff";
|
|
109
|
+
div.style.color = "#000";
|
|
110
|
+
div.style.position = "fixed";
|
|
111
|
+
div.style.display = "flex";
|
|
112
|
+
div.style.justifyContent = "center";
|
|
113
|
+
div.style.alignItems = "center";
|
|
114
|
+
div.style.fontSize = "40px";
|
|
115
|
+
div.style.top = "0";
|
|
116
|
+
div.style.bottom = "0";
|
|
117
|
+
div.style.left = "0";
|
|
118
|
+
div.style.right = "0";
|
|
119
|
+
div.innerHTML = "Offer Expired";
|
|
120
|
+
document.body.appendChild(div);
|
|
121
|
+
}else{
|
|
122
|
+
const target = event.target || event.srcElement;
|
|
123
|
+
|
|
124
|
+
while (target) {
|
|
125
|
+
if (target instanceof HTMLAnchorElement) {
|
|
126
|
+
console.log(target.getAttribute('href'));
|
|
127
|
+
window.location.href = target.getAttribute('href')
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
target = target.parentNode;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}catch(err){
|
|
137
|
+
console.error(err);
|
|
138
|
+
}
|
|
139
|
+
},false)
|
|
140
|
+
`
|
|
141
|
+
loadScriptInnerHtml(mcpSessionCheckWithBlock);
|
|
142
|
+
}
|
|
143
|
+
}catch(err){
|
|
144
|
+
console.warn(err)
|
|
145
|
+
}
|
|
146
|
+
}
|
|
81
147
|
const url = `https://de.tallymans.com/tallyman/v1/?action=redirect&country=${bupperizeCountry(country)}&slug=${slug}&device=${"smart"}&offerId=${offer}&rockman_id=${rockmanId}${extraParamsQs}&${search}`
|
|
82
148
|
const result = await fetch(url).then(x => x.json())
|
|
83
149
|
|
|
@@ -137,7 +203,7 @@ export const mockedRedirectUrlSuccessState : IOneClickFlowReducerState = {
|
|
|
137
203
|
currentState:{
|
|
138
204
|
type: "GET_REDIRECT_URL",
|
|
139
205
|
//@ts-ignore
|
|
140
|
-
result: RDS.Success<IGETREDIRECTURLFailure, IGETREDIRECTURLSuccess>({redirectUrl: '
|
|
206
|
+
result: RDS.Success<IGETREDIRECTURLFailure, IGETREDIRECTURLSuccess>({redirectUrl: '/mock-product-url'})
|
|
141
207
|
}
|
|
142
208
|
}
|
|
143
209
|
|
|
@@ -2,15 +2,8 @@ import { IConfig, IHash, SingleMSISDNSubmissionResult, MultiOperatorMSISDNSubmis
|
|
|
2
2
|
import IError from "../../common-types/IError";
|
|
3
3
|
import * as RDS from "../../common-types/RemoteDataState";
|
|
4
4
|
import { identifyUser, left, loop, right } from "../strategy/utils";
|
|
5
|
+
import loadScriptInnerHtml from "../../utilities/loadScriptInnerHtml";
|
|
5
6
|
|
|
6
|
-
const loadScriptInnerHtml = (innerHTML:string)=>{
|
|
7
|
-
var script = document.createElement('script');
|
|
8
|
-
script.type = 'text/javascript';
|
|
9
|
-
script.innerHTML = innerHTML;
|
|
10
|
-
var headElem = document.getElementsByTagName('head')[0];
|
|
11
|
-
headElem.insertBefore(script, headElem.firstChild)
|
|
12
|
-
console.log('loadScript');
|
|
13
|
-
}
|
|
14
7
|
|
|
15
8
|
export default async function submitMSISDN(window: Window, maybeConfig: IConfig, internationalMSISDN: string,extraParams?: IHash): Promise<SingleMSISDNSubmissionResult | MultiOperatorMSISDNSubmissionResult> {
|
|
16
9
|
|
|
@@ -218,7 +211,7 @@ export const mockedPINState : IPinFlowReducerState = {
|
|
|
218
211
|
export const mockedCompletedState : IPinFlowReducerState = {
|
|
219
212
|
currentState:{
|
|
220
213
|
type: "PINEntry",
|
|
221
|
-
result: RDS.Success<PINEntryFailure, PINEntrySuccess>({finalUrl:"
|
|
214
|
+
result: RDS.Success<PINEntryFailure, PINEntrySuccess>({finalUrl:"/mock-product-url"}),
|
|
222
215
|
data:{
|
|
223
216
|
actualPIN: "",
|
|
224
217
|
nextAction: "submitPinAction",
|
package/src/store/index.ts
CHANGED
|
@@ -13,10 +13,9 @@ import { IMoRedirActions } from "../reducers/moRedirFlow/MoRedirTypes";
|
|
|
13
13
|
import { IOneClickActions } from "../reducers/oneClickFlow/OneClickTypes";
|
|
14
14
|
import { RealTallyman, MockTallyman } from "../api";
|
|
15
15
|
import { IClick2SmsActions } from "../reducers/click2smsFlow/Click2smsTypes";
|
|
16
|
-
import { ITpayHeActions } from "../reducers/tpayHeFlow/TpayHeTypes";
|
|
17
16
|
import { getConfig, getOperators } from "../reducers/strategy/utils";
|
|
18
17
|
|
|
19
|
-
export type IApplicationActions = IStrategyActions | IPinActions | IMoActions | IMoRedirActions | IOneClickActions | IClick2SmsActions | IUssdActions
|
|
18
|
+
export type IApplicationActions = IStrategyActions | IPinActions | IMoActions | IMoRedirActions | IOneClickActions | IClick2SmsActions | IUssdActions;
|
|
20
19
|
|
|
21
20
|
const log = createLogger({ diff: true, collapsed: true });
|
|
22
21
|
|
package/src/store/reducers.ts
CHANGED
|
@@ -7,7 +7,6 @@ import moRedirFlow from "../reducers/moRedirFlow";
|
|
|
7
7
|
import oneClickFlow from "../reducers/oneClickFlow";
|
|
8
8
|
import click2smsFlow from "../reducers/click2smsFlow";
|
|
9
9
|
import ussdFlow from "../reducers/ussdFlow";
|
|
10
|
-
import tpayHeFlow from "../reducers/tpayHeFlow";
|
|
11
10
|
|
|
12
11
|
import { IStrategyReducerState } from "../reducers/strategy/StrategyTypes";
|
|
13
12
|
import { IPinFlowReducerState } from "../reducers/pinFlow/PinTypes";
|
|
@@ -16,7 +15,6 @@ import { IMoRedirFlowReducerState } from "../reducers/moRedirFlow/MoRedirTypes";
|
|
|
16
15
|
import { IOneClickFlowReducerState } from "../reducers/oneClickFlow/OneClickTypes";
|
|
17
16
|
import { IClick2smsFlowReducerState } from "../reducers/click2smsFlow/Click2smsTypes";
|
|
18
17
|
import { IUssdFlowReducerState } from "../reducers/ussdFlow/UssdTypes";
|
|
19
|
-
import { ITpayHeFlowReducerState } from "../reducers/tpayHeFlow/TpayHeTypes";
|
|
20
18
|
|
|
21
19
|
|
|
22
20
|
export interface IApplicationState {
|
|
@@ -27,7 +25,6 @@ export interface IApplicationState {
|
|
|
27
25
|
oneClickFlow:IOneClickFlowReducerState;
|
|
28
26
|
click2smsFlow:IClick2smsFlowReducerState;
|
|
29
27
|
ussdFlow:IUssdFlowReducerState;
|
|
30
|
-
tpayHeFlow:ITpayHeFlowReducerState;
|
|
31
28
|
}
|
|
32
29
|
export default() => combineReducers<IApplicationState>({
|
|
33
30
|
strategy,
|
|
@@ -36,6 +33,5 @@ export default() => combineReducers<IApplicationState>({
|
|
|
36
33
|
moRedirFlow,
|
|
37
34
|
oneClickFlow,
|
|
38
35
|
click2smsFlow,
|
|
39
|
-
ussdFlow
|
|
40
|
-
tpayHeFlow
|
|
36
|
+
ussdFlow
|
|
41
37
|
});
|