ouisys-engine 2.1.57 → 2.1.60
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.js +6 -5
- package/dist/reducers/moRedirFlow/utils.js +30 -23
- package/dist/utilities/loadScriptInnerHtml.d.ts +1 -1
- package/dist/utilities/loadScriptInnerHtml.js +7 -1
- package/package.json +1 -1
- package/src/api/index.ts +3 -1
- package/src/reducers/moRedirFlow/utils.ts +13 -10
- package/src/utilities/loadScriptInnerHtml.ts +8 -1
package/dist/api/index.js
CHANGED
|
@@ -516,7 +516,7 @@ var RealTallyman = {
|
|
|
516
516
|
}(),
|
|
517
517
|
redirect: function () {
|
|
518
518
|
var _redirect2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17(host, slug, country, msisdn, device, offer, rockmanId, ip_range_name, search, extraParamsQs) {
|
|
519
|
-
var isDMB, newHost;
|
|
519
|
+
var isDMB, newHost, evinaTi;
|
|
520
520
|
return regeneratorRuntime.wrap(function _callee17$(_context17) {
|
|
521
521
|
while (1) {
|
|
522
522
|
switch (_context17.prev = _context17.next) {
|
|
@@ -524,15 +524,16 @@ var RealTallyman = {
|
|
|
524
524
|
console.log("RealTallyman");
|
|
525
525
|
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;
|
|
526
526
|
newHost = isDMB ? "de.tallymans.com" : host;
|
|
527
|
-
|
|
528
|
-
|
|
527
|
+
evinaTi = country.toLowerCase() === "a2" ? "&evinaTi=".concat(rockmanId) : '';
|
|
528
|
+
_context17.next = 6;
|
|
529
|
+
return fetch("https://".concat(newHost, "/tallyman/v1/?action=redirect&slug=").concat(slug, "&country=").concat(country, "&msisdn=").concat(msisdn, "&device=").concat(device, "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId, "&network_type=").concat(!ip_range_name ? "wifi" : "", "&").concat(search).concat(evinaTi).concat(extraParamsQs)).then(function (x) {
|
|
529
530
|
return x.json();
|
|
530
531
|
});
|
|
531
532
|
|
|
532
|
-
case
|
|
533
|
+
case 6:
|
|
533
534
|
return _context17.abrupt("return", _context17.sent);
|
|
534
535
|
|
|
535
|
-
case
|
|
536
|
+
case 7:
|
|
536
537
|
case "end":
|
|
537
538
|
return _context17.stop();
|
|
538
539
|
}
|
|
@@ -55,10 +55,10 @@ var _tryGetIPRangeName = _interopRequireDefault(require("../../ips/tryGetIPRange
|
|
|
55
55
|
|
|
56
56
|
var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
|
|
57
57
|
|
|
58
|
-
var _loadScriptSrc = _interopRequireDefault(require("../../utilities/loadScriptSrc"));
|
|
59
|
-
|
|
60
58
|
var _utilities = require("../../utilities");
|
|
61
59
|
|
|
60
|
+
var _loadScriptInnerHtml = _interopRequireDefault(require("../../utilities/loadScriptInnerHtml"));
|
|
61
|
+
|
|
62
62
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
63
63
|
|
|
64
64
|
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; }
|
|
@@ -107,51 +107,46 @@ function submitMSISDNWithConfig(_x5, _x6, _x7, _x8) {
|
|
|
107
107
|
|
|
108
108
|
function _submitMSISDNWithConfig() {
|
|
109
109
|
_submitMSISDNWithConfig = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(window, config, internationalMSISDN, extraParams) {
|
|
110
|
-
var slug, country, device, offer, host,
|
|
110
|
+
var slug, country, device, offer, host, search, extraParamsQs, msisdn, visitor, rockmanId, ip_range_name, result, type, error;
|
|
111
111
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
112
112
|
while (1) {
|
|
113
113
|
switch (_context2.prev = _context2.next) {
|
|
114
114
|
case 0:
|
|
115
115
|
slug = config.slug, country = config.country, device = config.device, offer = config.offer, host = config.host;
|
|
116
|
-
visitor = window.pac_analytics.visitor;
|
|
117
|
-
rockmanId = visitor.rockmanId;
|
|
118
116
|
search = window.location.search.substr(1) || '';
|
|
119
|
-
|
|
120
|
-
if (country.toLowerCase() === "a2") {
|
|
121
|
-
extraParams.evinaTi = rockmanId;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
117
|
extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(function (k) {
|
|
125
118
|
return "".concat(k, "=").concat(extraParams[k]);
|
|
126
119
|
}).join('&');
|
|
127
120
|
msisdn = internationalMSISDN.match(/\d+/gi).join('');
|
|
121
|
+
visitor = window.pac_analytics.visitor;
|
|
122
|
+
rockmanId = visitor.rockmanId;
|
|
128
123
|
|
|
129
124
|
if (!(country == "ci")) {
|
|
130
|
-
_context2.next =
|
|
125
|
+
_context2.next = 12;
|
|
131
126
|
break;
|
|
132
127
|
}
|
|
133
128
|
|
|
134
|
-
_context2.next =
|
|
129
|
+
_context2.next = 9;
|
|
135
130
|
return (0, _tryGetIPRangeName.default)(visitor);
|
|
136
131
|
|
|
137
|
-
case
|
|
132
|
+
case 9:
|
|
138
133
|
_context2.t0 = _context2.sent;
|
|
139
|
-
_context2.next =
|
|
134
|
+
_context2.next = 13;
|
|
140
135
|
break;
|
|
141
136
|
|
|
142
|
-
case
|
|
137
|
+
case 12:
|
|
143
138
|
_context2.t0 = null;
|
|
144
139
|
|
|
145
|
-
case
|
|
140
|
+
case 13:
|
|
146
141
|
ip_range_name = _context2.t0;
|
|
147
|
-
_context2.next =
|
|
142
|
+
_context2.next = 16;
|
|
148
143
|
return window.tallymanApi.redirect(host, slug, country, msisdn, device, offer, rockmanId, ip_range_name, search, extraParamsQs);
|
|
149
144
|
|
|
150
|
-
case
|
|
145
|
+
case 16:
|
|
151
146
|
result = _context2.sent;
|
|
152
147
|
|
|
153
148
|
if (!(false === result.success)) {
|
|
154
|
-
_context2.next =
|
|
149
|
+
_context2.next = 25;
|
|
155
150
|
break;
|
|
156
151
|
}
|
|
157
152
|
|
|
@@ -161,10 +156,10 @@ function _submitMSISDNWithConfig() {
|
|
|
161
156
|
console.error(error);
|
|
162
157
|
throw error;
|
|
163
158
|
|
|
164
|
-
case
|
|
159
|
+
case 25:
|
|
165
160
|
return _context2.abrupt("return", result.redirect_url);
|
|
166
161
|
|
|
167
|
-
case
|
|
162
|
+
case 26:
|
|
168
163
|
case "end":
|
|
169
164
|
return _context2.stop();
|
|
170
165
|
}
|
|
@@ -181,8 +176,20 @@ var startEvinaAgency = function startEvinaAgency(config) {
|
|
|
181
176
|
});
|
|
182
177
|
var rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
183
178
|
var url = "https://".concat(newHost, "/tallyman/helper/?action=mi-agency&process=a2-du-evina-start&rockman_id=").concat(rockmanId);
|
|
184
|
-
|
|
185
|
-
|
|
179
|
+
|
|
180
|
+
var callBack = function callBack() {
|
|
181
|
+
console.log('Ev ready');
|
|
182
|
+
var event = new Event('DCBProtectRun');
|
|
183
|
+
|
|
184
|
+
if (typeof window != "undefined") {
|
|
185
|
+
document.dispatchEvent(event);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
fetch(url).then(function (x) {
|
|
190
|
+
return x.text();
|
|
191
|
+
}).then(function (txt) {
|
|
192
|
+
return (0, _loadScriptInnerHtml.default)(txt, false);
|
|
186
193
|
});
|
|
187
194
|
};
|
|
188
195
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const loadScriptInnerHtml: (innerHTML: string, isBody?: boolean) => void;
|
|
1
|
+
declare const loadScriptInnerHtml: (innerHTML: string, isBody?: boolean, callback?: () => void) => void;
|
|
2
2
|
export default loadScriptInnerHtml;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var loadScriptInnerHtml = function loadScriptInnerHtml(innerHTML, isBody) {
|
|
8
|
+
var loadScriptInnerHtml = function loadScriptInnerHtml(innerHTML, isBody, callback) {
|
|
9
9
|
var script = document.createElement('script');
|
|
10
10
|
script.type = 'text/javascript';
|
|
11
11
|
script.innerHTML = innerHTML;
|
|
@@ -17,6 +17,12 @@ var loadScriptInnerHtml = function loadScriptInnerHtml(innerHTML, isBody) {
|
|
|
17
17
|
headElem.insertBefore(script, headElem.firstChild);
|
|
18
18
|
console.log('loadScript');
|
|
19
19
|
}
|
|
20
|
+
|
|
21
|
+
if (callback) {
|
|
22
|
+
script.onload = function () {
|
|
23
|
+
callback();
|
|
24
|
+
};
|
|
25
|
+
}
|
|
20
26
|
};
|
|
21
27
|
|
|
22
28
|
var _default = loadScriptInnerHtml;
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -183,7 +183,9 @@ export const RealTallyman:ITallyman = {
|
|
|
183
183
|
console.log("RealTallyman")
|
|
184
184
|
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;
|
|
185
185
|
const newHost = isDMB ? "de.tallymans.com" : host;
|
|
186
|
-
|
|
186
|
+
const evinaTi = (country.toLowerCase() === "a2") ? `&evinaTi=${rockmanId}` : '';
|
|
187
|
+
|
|
188
|
+
return await fetch(`https://${newHost}/tallyman/v1/?action=redirect&slug=${slug}&country=${country}&msisdn=${msisdn}&device=${device}&offerId=${offer}&rockman_id=${rockmanId}&network_type=${!ip_range_name ? "wifi":""}&${search}${evinaTi}${extraParamsQs}`).then(x => x.json())
|
|
187
189
|
},
|
|
188
190
|
triggerMessage:async(host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string, search: string, extraParamsQs: string): Promise<IMoMSISDNSubmissionResult> =>{
|
|
189
191
|
console.log("RealTallyman")
|
|
@@ -4,6 +4,7 @@ import tryGetIPRangeName from "../../ips/tryGetIPRangeName";
|
|
|
4
4
|
import * as RDS from "../../common-types/RemoteDataState";
|
|
5
5
|
import loadScriptSrc from "../../utilities/loadScriptSrc";
|
|
6
6
|
import { getHost, isDMBCheck } from "../../utilities";
|
|
7
|
+
import loadScriptInnerHtml from "../../utilities/loadScriptInnerHtml";
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
export default async function submitMSISDN(window: Window, maybeConfig: IConfig, internationalMSISDN: string, extraParams?: {[key: string]: string}): Promise<string> {
|
|
@@ -12,17 +13,12 @@ export default async function submitMSISDN(window: Window, maybeConfig: IConfig,
|
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export async function submitMSISDNWithConfig(window: Window, config: IConfig, internationalMSISDN: string, extraParams?: { [key: string]: string }): Promise<string> {
|
|
15
|
-
const { slug, country, device, offer, host } = config
|
|
16
|
-
const visitor = window.pac_analytics.visitor;
|
|
17
|
-
const rockmanId = visitor.rockmanId;
|
|
18
|
-
|
|
16
|
+
const { slug, country, device, offer, host } = config
|
|
19
17
|
const search = window.location.search.substr(1) || '';
|
|
20
|
-
if(country.toLowerCase() === "a2"){
|
|
21
|
-
extraParams.evinaTi = rockmanId;
|
|
22
|
-
}
|
|
23
18
|
const extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(k => `${k}=${extraParams[k]}`).join('&')
|
|
24
19
|
const msisdn = internationalMSISDN.match(/\d+/gi).join('')
|
|
25
|
-
|
|
20
|
+
const visitor = window.pac_analytics.visitor;
|
|
21
|
+
const rockmanId = visitor.rockmanId;
|
|
26
22
|
|
|
27
23
|
const ip_range_name = country == "ci" ? await tryGetIPRangeName(visitor) : null;
|
|
28
24
|
|
|
@@ -43,9 +39,16 @@ export async function submitMSISDNWithConfig(window: Window, config: IConfig, in
|
|
|
43
39
|
export const startEvinaAgency = (config: IConfig)=>{
|
|
44
40
|
const { host } = config
|
|
45
41
|
const newHost = getHost({host});
|
|
46
|
-
const rockmanId = window.pac_analytics.visitor.rockmanId
|
|
42
|
+
const rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
47
43
|
const url = `https://${newHost}/tallyman/helper/?action=mi-agency&process=a2-du-evina-start&rockman_id=${rockmanId}`;
|
|
48
|
-
|
|
44
|
+
const callBack = ()=>{
|
|
45
|
+
console.log('Ev ready');
|
|
46
|
+
let event = new Event('DCBProtectRun');
|
|
47
|
+
if(typeof window != "undefined"){
|
|
48
|
+
document.dispatchEvent(event);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
fetch(url).then((x)=>x.text()).then((txt)=>loadScriptInnerHtml(txt, false, ));
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
export const mockedMSISDNEntrySuccess : IMoRedirFlowReducerState = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const loadScriptInnerHtml = (innerHTML:string, isBody?:boolean)=>{
|
|
1
|
+
const loadScriptInnerHtml = (innerHTML:string, isBody?:boolean, callback?:()=>void)=>{
|
|
2
2
|
var script = document.createElement('script');
|
|
3
3
|
script.type = 'text/javascript';
|
|
4
4
|
script.innerHTML = innerHTML;
|
|
@@ -9,6 +9,13 @@ const loadScriptInnerHtml = (innerHTML:string, isBody?:boolean)=>{
|
|
|
9
9
|
headElem.insertBefore(script, headElem.firstChild)
|
|
10
10
|
console.log('loadScript');
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
if(callback){
|
|
14
|
+
script.onload = () => {
|
|
15
|
+
callback();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
}
|
|
13
20
|
|
|
14
21
|
export default loadScriptInnerHtml;
|