ouisys-engine 2.1.55 → 2.1.58

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 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
- _context17.next = 5;
528
- 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(extraParamsQs)).then(function (x) {
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 5:
533
+ case 6:
533
534
  return _context17.abrupt("return", _context17.sent);
534
535
 
535
- case 6:
536
+ case 7:
536
537
  case "end":
537
538
  return _context17.stop();
538
539
  }
@@ -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; }
@@ -165,6 +169,19 @@ function _submitMSISDNWithConfig() {
165
169
  return _submitMSISDNWithConfig.apply(this, arguments);
166
170
  }
167
171
 
172
+ var startEvinaAgency = function startEvinaAgency(config) {
173
+ var host = config.host;
174
+ var newHost = (0, _utilities.getHost)({
175
+ host: host
176
+ });
177
+ var rockmanId = window.pac_analytics.visitor.rockmanId;
178
+ var url = "https://".concat(newHost, "/tallyman/helper/?action=mi-agency&process=a2-du-evina-start&rockman_id=").concat(rockmanId);
179
+ (0, _loadScriptSrc.default)({
180
+ url: url
181
+ });
182
+ };
183
+
184
+ exports.startEvinaAgency = startEvinaAgency;
168
185
  var mockedMSISDNEntrySuccess = {
169
186
  currentState: {
170
187
  type: "MSISDNEntry",
@@ -127,7 +127,7 @@ function getRedirectUrlAction(_ref) {
127
127
  window.location.href = redirectUrl;
128
128
  }, 0);
129
129
  }
130
- }, 500);
130
+ }, 100);
131
131
  } else {
132
132
  _strategy.tracker.advancedInFlow('tallyman.v1-one-click', 'click-redirect-url', {
133
133
  redirect_url: redirectUrl
@@ -135,7 +135,7 @@ function getRedirectUrlAction(_ref) {
135
135
 
136
136
  setTimeout(function () {
137
137
  window.location.href = redirectUrl;
138
- }, 1000);
138
+ }, 0);
139
139
  }
140
140
  } else {
141
141
  dispatch({
@@ -207,7 +207,7 @@ function getRedirectUrlAction(_ref) {
207
207
 
208
208
  setTimeout(function () {
209
209
  window.location.href = _redirect_url;
210
- }, 3000);
210
+ }, 0);
211
211
  } else {
212
212
  dispatch({
213
213
  type: "GET_REDIRECT_URL",
@@ -0,0 +1,6 @@
1
+ import { IConfig } from "../reducers/strategy/StrategyTypes";
2
+ export declare const isDMBCheck: () => boolean;
3
+ export declare const getHost: ({ host }: {
4
+ host: string;
5
+ }) => string;
6
+ export declare const setOnLoadUtilities: (config: IConfig) => void;
@@ -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;
@@ -1,5 +1,6 @@
1
- declare const loadScriptSrc: ({ url, key }: {
1
+ declare const loadScriptSrc: ({ url, key, isRecaptcha }: {
2
2
  url: string;
3
- key: string;
3
+ key?: string;
4
+ isRecaptcha?: boolean;
4
5
  }) => void;
5
6
  export default loadScriptSrc;
@@ -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
- script.onload = function () {
22
- 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 ");
23
- (0, _loadScriptInnerHtml.default)(scriptInner, true);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "2.1.55",
3
+ "version": "2.1.58",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",
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
- 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}${extraParamsQs}`).then(x => x.json())
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")
@@ -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> {
@@ -11,7 +13,7 @@ export default async function submitMSISDN(window: Window, maybeConfig: IConfig,
11
13
 
12
14
  export async function submitMSISDNWithConfig(window: Window, config: IConfig, internationalMSISDN: string, extraParams?: { [key: string]: string }): Promise<string> {
13
15
  const { slug, country, device, offer, host } = config
14
- const search = window.location.search.substr(1) || ''
16
+ const search = window.location.search.substr(1) || '';
15
17
  const extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(k => `${k}=${extraParams[k]}`).join('&')
16
18
  const msisdn = internationalMSISDN.match(/\d+/gi).join('')
17
19
  const visitor = window.pac_analytics.visitor;
@@ -33,7 +35,13 @@ export async function submitMSISDNWithConfig(window: Window, config: IConfig, in
33
35
  }
34
36
  }
35
37
 
36
-
38
+ export const startEvinaAgency = (config: IConfig)=>{
39
+ const { host } = config
40
+ const newHost = getHost({host});
41
+ const rockmanId = window.pac_analytics.visitor.rockmanId
42
+ const url = `https://${newHost}/tallyman/helper/?action=mi-agency&process=a2-du-evina-start&rockman_id=${rockmanId}`;
43
+ loadScriptSrc({url});
44
+ }
37
45
 
38
46
  export const mockedMSISDNEntrySuccess : IMoRedirFlowReducerState = {
39
47
  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:string})=>{
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
- script.onload = () => {
10
- const scriptInner = `
11
- grecaptcha.ready(function() {
12
- grecaptcha.execute("${key}", {action: 'submit'}).then(function(token) {
13
- // To be used by tallyman
14
- window.reCaptchaToken = token;
15
- console.log("-------" + token);
16
- });
17
- });
18
- `;
19
- loadScriptInnerHtml(scriptInner, true);
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;