ouisys-engine 2.1.56 → 2.1.57
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/reducers/moFlow/utils.js +2 -1
- package/dist/reducers/moRedirFlow/utils.d.ts +1 -0
- package/dist/reducers/moRedirFlow/utils.js +37 -15
- package/dist/utilities/index.d.ts +6 -0
- package/dist/utilities/index.js +36 -0
- package/dist/utilities/loadScriptSrc.d.ts +3 -2
- package/dist/utilities/loadScriptSrc.js +9 -5
- package/package.json +1 -1
- package/src/reducers/moFlow/utils.ts +1 -1
- package/src/reducers/moRedirFlow/utils.ts +18 -5
- package/src/utilities/index.ts +21 -0
- package/src/utilities/loadScriptSrc.ts +17 -14
|
@@ -177,7 +177,8 @@ var getGoogleReCaptchaConfig = /*#__PURE__*/function () {
|
|
|
177
177
|
srcUrl = "https://www.google.com/recaptcha/api.js?render=".concat(result.site_key);
|
|
178
178
|
(0, _loadScriptSrc.default)({
|
|
179
179
|
url: srcUrl,
|
|
180
|
-
key: result.site_key
|
|
180
|
+
key: result.site_key,
|
|
181
|
+
isRecaptcha: true
|
|
181
182
|
});
|
|
182
183
|
}
|
|
183
184
|
|
|
@@ -5,5 +5,6 @@ export default function submitMSISDN(window: Window, maybeConfig: IConfig, inter
|
|
|
5
5
|
export declare function submitMSISDNWithConfig(window: Window, config: IConfig, internationalMSISDN: string, extraParams?: {
|
|
6
6
|
[key: string]: string;
|
|
7
7
|
}): Promise<string>;
|
|
8
|
+
export declare const startEvinaAgency: (config: IConfig) => void;
|
|
8
9
|
export declare const mockedMSISDNEntrySuccess: IMoRedirFlowReducerState;
|
|
9
10
|
export declare const mockedMSISDNEntryFailure: IMoRedirFlowReducerState;
|
|
@@ -47,7 +47,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
47
47
|
});
|
|
48
48
|
exports.default = submitMSISDN;
|
|
49
49
|
exports.submitMSISDNWithConfig = submitMSISDNWithConfig;
|
|
50
|
-
exports.mockedMSISDNEntryFailure = exports.mockedMSISDNEntrySuccess = void 0;
|
|
50
|
+
exports.mockedMSISDNEntryFailure = exports.mockedMSISDNEntrySuccess = exports.startEvinaAgency = void 0;
|
|
51
51
|
|
|
52
52
|
require("regenerator-runtime/runtime");
|
|
53
53
|
|
|
@@ -55,6 +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
|
+
var _utilities = require("../../utilities");
|
|
61
|
+
|
|
58
62
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
59
63
|
|
|
60
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; }
|
|
@@ -103,46 +107,51 @@ function submitMSISDNWithConfig(_x5, _x6, _x7, _x8) {
|
|
|
103
107
|
|
|
104
108
|
function _submitMSISDNWithConfig() {
|
|
105
109
|
_submitMSISDNWithConfig = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(window, config, internationalMSISDN, extraParams) {
|
|
106
|
-
var slug, country, device, offer, host,
|
|
110
|
+
var slug, country, device, offer, host, visitor, rockmanId, search, extraParamsQs, msisdn, ip_range_name, result, type, error;
|
|
107
111
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
108
112
|
while (1) {
|
|
109
113
|
switch (_context2.prev = _context2.next) {
|
|
110
114
|
case 0:
|
|
111
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;
|
|
112
118
|
search = window.location.search.substr(1) || '';
|
|
119
|
+
|
|
120
|
+
if (country.toLowerCase() === "a2") {
|
|
121
|
+
extraParams.evinaTi = rockmanId;
|
|
122
|
+
}
|
|
123
|
+
|
|
113
124
|
extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(function (k) {
|
|
114
125
|
return "".concat(k, "=").concat(extraParams[k]);
|
|
115
126
|
}).join('&');
|
|
116
127
|
msisdn = internationalMSISDN.match(/\d+/gi).join('');
|
|
117
|
-
visitor = window.pac_analytics.visitor;
|
|
118
|
-
rockmanId = visitor.rockmanId;
|
|
119
128
|
|
|
120
129
|
if (!(country == "ci")) {
|
|
121
|
-
_context2.next =
|
|
130
|
+
_context2.next = 13;
|
|
122
131
|
break;
|
|
123
132
|
}
|
|
124
133
|
|
|
125
|
-
_context2.next =
|
|
134
|
+
_context2.next = 10;
|
|
126
135
|
return (0, _tryGetIPRangeName.default)(visitor);
|
|
127
136
|
|
|
128
|
-
case
|
|
137
|
+
case 10:
|
|
129
138
|
_context2.t0 = _context2.sent;
|
|
130
|
-
_context2.next =
|
|
139
|
+
_context2.next = 14;
|
|
131
140
|
break;
|
|
132
141
|
|
|
133
|
-
case
|
|
142
|
+
case 13:
|
|
134
143
|
_context2.t0 = null;
|
|
135
144
|
|
|
136
|
-
case
|
|
145
|
+
case 14:
|
|
137
146
|
ip_range_name = _context2.t0;
|
|
138
|
-
_context2.next =
|
|
147
|
+
_context2.next = 17;
|
|
139
148
|
return window.tallymanApi.redirect(host, slug, country, msisdn, device, offer, rockmanId, ip_range_name, search, extraParamsQs);
|
|
140
149
|
|
|
141
|
-
case
|
|
150
|
+
case 17:
|
|
142
151
|
result = _context2.sent;
|
|
143
152
|
|
|
144
153
|
if (!(false === result.success)) {
|
|
145
|
-
_context2.next =
|
|
154
|
+
_context2.next = 26;
|
|
146
155
|
break;
|
|
147
156
|
}
|
|
148
157
|
|
|
@@ -152,10 +161,10 @@ function _submitMSISDNWithConfig() {
|
|
|
152
161
|
console.error(error);
|
|
153
162
|
throw error;
|
|
154
163
|
|
|
155
|
-
case
|
|
164
|
+
case 26:
|
|
156
165
|
return _context2.abrupt("return", result.redirect_url);
|
|
157
166
|
|
|
158
|
-
case
|
|
167
|
+
case 27:
|
|
159
168
|
case "end":
|
|
160
169
|
return _context2.stop();
|
|
161
170
|
}
|
|
@@ -165,6 +174,19 @@ function _submitMSISDNWithConfig() {
|
|
|
165
174
|
return _submitMSISDNWithConfig.apply(this, arguments);
|
|
166
175
|
}
|
|
167
176
|
|
|
177
|
+
var startEvinaAgency = function startEvinaAgency(config) {
|
|
178
|
+
var host = config.host;
|
|
179
|
+
var newHost = (0, _utilities.getHost)({
|
|
180
|
+
host: host
|
|
181
|
+
});
|
|
182
|
+
var rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
183
|
+
var url = "https://".concat(newHost, "/tallyman/helper/?action=mi-agency&process=a2-du-evina-start&rockman_id=").concat(rockmanId);
|
|
184
|
+
(0, _loadScriptSrc.default)({
|
|
185
|
+
url: url
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
exports.startEvinaAgency = startEvinaAgency;
|
|
168
190
|
var mockedMSISDNEntrySuccess = {
|
|
169
191
|
currentState: {
|
|
170
192
|
type: "MSISDNEntry",
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.setOnLoadUtilities = exports.getHost = exports.isDMBCheck = void 0;
|
|
7
|
+
|
|
8
|
+
var _utils = require("../reducers/moFlow/utils");
|
|
9
|
+
|
|
10
|
+
var _utils2 = require("../reducers/moRedirFlow/utils");
|
|
11
|
+
|
|
12
|
+
var isDMBCheck = function isDMBCheck() {
|
|
13
|
+
return 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;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.isDMBCheck = isDMBCheck;
|
|
17
|
+
|
|
18
|
+
var getHost = function getHost(_ref) {
|
|
19
|
+
var host = _ref.host;
|
|
20
|
+
var newHost = isDMBCheck() ? "de.tallymans.com" : host;
|
|
21
|
+
return newHost;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.getHost = getHost;
|
|
25
|
+
|
|
26
|
+
var setOnLoadUtilities = function setOnLoadUtilities(config) {
|
|
27
|
+
if (process.env.country.toLowerCase() === "cz") {
|
|
28
|
+
(0, _utils.getGoogleReCaptchaConfig)(config);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (process.env.country.toLowerCase() === "a2" && process.env.NODE_ENV === "production") {
|
|
32
|
+
(0, _utils2.startEvinaAgency)(config);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.setOnLoadUtilities = setOnLoadUtilities;
|
|
@@ -11,17 +11,21 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
11
11
|
|
|
12
12
|
var loadScriptSrc = function loadScriptSrc(_ref) {
|
|
13
13
|
var url = _ref.url,
|
|
14
|
-
key = _ref.key
|
|
14
|
+
key = _ref.key,
|
|
15
|
+
_ref$isRecaptcha = _ref.isRecaptcha,
|
|
16
|
+
isRecaptcha = _ref$isRecaptcha === void 0 ? false : _ref$isRecaptcha;
|
|
15
17
|
var script = document.createElement('script');
|
|
16
18
|
script.type = 'text/javascript';
|
|
17
19
|
script.src = url;
|
|
18
20
|
var headElem = document.getElementsByTagName('head')[0];
|
|
19
21
|
headElem.insertBefore(script, headElem.firstChild);
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
if (isRecaptcha) {
|
|
24
|
+
script.onload = function () {
|
|
25
|
+
var scriptInner = "\n grecaptcha.ready(function() {\n grecaptcha.execute(\"".concat(key, "\", {action: 'submit'}).then(function(token) {\n // To be used by tallyman\n window.reCaptchaToken = token;\n console.log(\"-------\" + token);\n });\n });\n ");
|
|
26
|
+
(0, _loadScriptInnerHtml.default)(scriptInner, true);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
25
29
|
};
|
|
26
30
|
|
|
27
31
|
var _default = loadScriptSrc;
|
package/package.json
CHANGED
|
@@ -48,7 +48,7 @@ export const getGoogleReCaptchaConfig = async ({ slug, country, device, host }:I
|
|
|
48
48
|
const result: IGoogleReCaptcha = await window.tallymanApi.getGoogleCaptcha(host, country, slug, device, domain);
|
|
49
49
|
if(result.success === true){
|
|
50
50
|
const srcUrl = `https://www.google.com/recaptcha/api.js?render=${result.site_key}`;
|
|
51
|
-
loadScriptSrc({url:srcUrl, key: result.site_key});
|
|
51
|
+
loadScriptSrc({url:srcUrl, key: result.site_key, isRecaptcha: true});
|
|
52
52
|
}
|
|
53
53
|
return result;
|
|
54
54
|
}
|
|
@@ -2,6 +2,8 @@ import { IConfig, IMSISDNSubmissionResult, MSISDNEntryFailure, MSISDNEntrySucces
|
|
|
2
2
|
import IError from "../../common-types/IError";
|
|
3
3
|
import tryGetIPRangeName from "../../ips/tryGetIPRangeName";
|
|
4
4
|
import * as RDS from "../../common-types/RemoteDataState";
|
|
5
|
+
import loadScriptSrc from "../../utilities/loadScriptSrc";
|
|
6
|
+
import { getHost, isDMBCheck } from "../../utilities";
|
|
5
7
|
|
|
6
8
|
|
|
7
9
|
export default async function submitMSISDN(window: Window, maybeConfig: IConfig, internationalMSISDN: string, extraParams?: {[key: string]: string}): Promise<string> {
|
|
@@ -10,13 +12,18 @@ export default async function submitMSISDN(window: Window, maybeConfig: IConfig,
|
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
export async function submitMSISDNWithConfig(window: Window, config: IConfig, internationalMSISDN: string, extraParams?: { [key: string]: string }): Promise<string> {
|
|
13
|
-
const { slug, country, device, offer, host } = config
|
|
14
|
-
const search = window.location.search.substr(1) || ''
|
|
15
|
-
const extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(k => `${k}=${extraParams[k]}`).join('&')
|
|
16
|
-
const msisdn = internationalMSISDN.match(/\d+/gi).join('')
|
|
15
|
+
const { slug, country, device, offer, host } = config;
|
|
17
16
|
const visitor = window.pac_analytics.visitor;
|
|
18
17
|
const rockmanId = visitor.rockmanId;
|
|
19
18
|
|
|
19
|
+
const search = window.location.search.substr(1) || '';
|
|
20
|
+
if(country.toLowerCase() === "a2"){
|
|
21
|
+
extraParams.evinaTi = rockmanId;
|
|
22
|
+
}
|
|
23
|
+
const extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(k => `${k}=${extraParams[k]}`).join('&')
|
|
24
|
+
const msisdn = internationalMSISDN.match(/\d+/gi).join('')
|
|
25
|
+
|
|
26
|
+
|
|
20
27
|
const ip_range_name = country == "ci" ? await tryGetIPRangeName(visitor) : null;
|
|
21
28
|
|
|
22
29
|
const result: IMSISDNSubmissionResult = await window.tallymanApi.redirect(host, slug, country, msisdn, device, offer, rockmanId, ip_range_name, search, extraParamsQs)
|
|
@@ -33,7 +40,13 @@ export async function submitMSISDNWithConfig(window: Window, config: IConfig, in
|
|
|
33
40
|
}
|
|
34
41
|
}
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
export const startEvinaAgency = (config: IConfig)=>{
|
|
44
|
+
const { host } = config
|
|
45
|
+
const newHost = getHost({host});
|
|
46
|
+
const rockmanId = window.pac_analytics.visitor.rockmanId
|
|
47
|
+
const url = `https://${newHost}/tallyman/helper/?action=mi-agency&process=a2-du-evina-start&rockman_id=${rockmanId}`;
|
|
48
|
+
loadScriptSrc({url});
|
|
49
|
+
}
|
|
37
50
|
|
|
38
51
|
export const mockedMSISDNEntrySuccess : IMoRedirFlowReducerState = {
|
|
39
52
|
currentState:{
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getGoogleReCaptchaConfig } from "../reducers/moFlow/utils";
|
|
2
|
+
import { startEvinaAgency } from "../reducers/moRedirFlow/utils";
|
|
3
|
+
import { IConfig } from "../reducers/strategy/StrategyTypes";
|
|
4
|
+
|
|
5
|
+
export const isDMBCheck = ()=>{
|
|
6
|
+
return (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;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const getHost = ({host}:{host: string}): string=>{
|
|
10
|
+
const newHost = isDMBCheck() ? "de.tallymans.com" : host;
|
|
11
|
+
return newHost
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const setOnLoadUtilities = (config:IConfig)=>{
|
|
15
|
+
if(process.env.country.toLowerCase() === "cz"){
|
|
16
|
+
getGoogleReCaptchaConfig(config)
|
|
17
|
+
}
|
|
18
|
+
if(process.env.country.toLowerCase() === "a2" && process.env.NODE_ENV === "production"){
|
|
19
|
+
startEvinaAgency(config)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import loadScriptInnerHtml from "./loadScriptInnerHtml";
|
|
2
2
|
|
|
3
|
-
const loadScriptSrc = ({url, key}:{url:string, key
|
|
3
|
+
const loadScriptSrc = ({url, key, isRecaptcha = false}:{url:string, key?:string, isRecaptcha?: boolean})=>{
|
|
4
4
|
var script = document.createElement('script');
|
|
5
5
|
script.type = 'text/javascript';
|
|
6
6
|
script.src = url;
|
|
7
7
|
var headElem = document.getElementsByTagName('head')[0];
|
|
8
|
-
headElem.insertBefore(script, headElem.firstChild)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
headElem.insertBefore(script, headElem.firstChild);
|
|
9
|
+
|
|
10
|
+
if(isRecaptcha){
|
|
11
|
+
script.onload = () => {
|
|
12
|
+
const scriptInner = `
|
|
13
|
+
grecaptcha.ready(function() {
|
|
14
|
+
grecaptcha.execute("${key}", {action: 'submit'}).then(function(token) {
|
|
15
|
+
// To be used by tallyman
|
|
16
|
+
window.reCaptchaToken = token;
|
|
17
|
+
console.log("-------" + token);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
`;
|
|
21
|
+
loadScriptInnerHtml(scriptInner, true);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
export default loadScriptSrc;
|