ouisys-engine 2.1.70 → 2.1.73

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.
@@ -116,7 +116,6 @@ var bupperizeCountry = function bupperizeCountry(c) {
116
116
  };
117
117
 
118
118
  var uniqidResult = "";
119
- var uniqidOnLoadResult = "";
120
119
 
121
120
  function loadMcpShield(_x5, _x6) {
122
121
  return _loadMcpShield.apply(this, arguments);
@@ -150,7 +149,7 @@ function _loadMcpShield() {
150
149
 
151
150
  case 11:
152
151
  (0, _loadScriptInnerHtml.default)(mcpShieldResult.source);
153
- uniqidOnLoadResult = mcpShieldResult.uniqid;
152
+ uniqidResult = mcpShieldResult.uniqid;
154
153
  return _context2.abrupt("return", mcpShieldResult);
155
154
 
156
155
  case 14:
@@ -178,7 +177,7 @@ function submitMSISDNOnce(_x7, _x8, _x9, _x10) {
178
177
 
179
178
  function _submitMSISDNOnce() {
180
179
  _submitMSISDNOnce = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(window, config, internationalMSISDN, extraParams) {
181
- var submissionError, msisdn, rockmanId, supportedSlugs, identifiedUser, slug, country, device, offer, host, search, extraParamsQs, uniqid, result, error, codesWithMcpShied, mcpShieldResult;
180
+ var submissionError, msisdn, rockmanId, supportedSlugs, identifiedUser, slug, country, device, offer, host, search, extraParamsQs, uniqid, result, error, kwCodesWithMcpShied, mcpShieldResult;
182
181
  return regeneratorRuntime.wrap(function _callee3$(_context3) {
183
182
  while (1) {
184
183
  switch (_context3.prev = _context3.next) {
@@ -227,7 +226,7 @@ function _submitMSISDNOnce() {
227
226
  extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(function (k) {
228
227
  return "".concat(k, "=").concat(extraParams[k]);
229
228
  }).join('&');
230
- uniqid = uniqidOnLoadResult != "" && country.toLowerCase() == "iq" ? "&mcpUniqid=".concat(uniqidOnLoadResult) : '';
229
+ uniqid = !!uniqidResult && uniqidResult != "" ? "&mcpUniqid=".concat(uniqidResult) : '';
231
230
  _context3.next = 18;
232
231
  return window.tallymanApi.triggerPin(host, country, slug, device, offer, msisdn, rockmanId, extraParamsQs, search, uniqid);
233
232
 
@@ -246,22 +245,16 @@ function _submitMSISDNOnce() {
246
245
  throw error;
247
246
 
248
247
  case 27:
249
- codesWithMcpShied = {
248
+ kwCodesWithMcpShied = {
250
249
  kw: {
251
250
  kw_viva: "kw_viva"
252
251
  },
253
252
  k2: {
254
253
  k2_viva: "k2_viva"
255
- },
256
- sa: {
257
- sa_zain: "sa_zain",
258
- sa_mobily: "sa_mobily",
259
- sa_virgin: "sa_virgin",
260
- sa_stc: "sa_stc"
261
254
  }
262
255
  };
263
256
 
264
- if (!(country && result.operator && (codesWithMcpShied[country.toLowerCase()] && codesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()] || country.toLowerCase() == "iq"))) {
257
+ if (!(country && result.operator && (kwCodesWithMcpShied[country.toLowerCase()] && kwCodesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()] || country.toLowerCase() == "iq"))) {
265
258
  _context3.next = 39;
266
259
  break;
267
260
  }
@@ -475,7 +468,7 @@ function _submitPIN() {
475
468
 
476
469
  isAlreadySubscribed = pinResult.message == "ALREADY SUBSCRIBED" ? true : false;
477
470
  return _context6.abrupt("return", {
478
- productUrl: pinResult.product_url || null,
471
+ productUrl: checkResult.product_url || null,
479
472
  isAlreadySubscribed: isAlreadySubscribed
480
473
  });
481
474
 
@@ -9,6 +9,8 @@ var _utils = require("../reducers/moFlow/utils");
9
9
 
10
10
  var _utils2 = require("../reducers/moRedirFlow/utils");
11
11
 
12
+ var _utils3 = require("../reducers/pinFlow/utils");
13
+
12
14
  var isDMBCheck = function isDMBCheck() {
13
15
  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
16
  };
@@ -24,12 +26,18 @@ var getHost = function getHost(_ref) {
24
26
  exports.getHost = getHost;
25
27
 
26
28
  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);
29
+ if (typeof window != "undefined") {
30
+ if (process.env.country.toLowerCase() === "cz") {
31
+ (0, _utils.getGoogleReCaptchaConfig)(config);
32
+ }
33
+
34
+ if (process.env.country.toLowerCase() === "a2" && process.env.NODE_ENV === "production") {
35
+ (0, _utils2.startEvinaAgency)(config);
36
+ }
37
+
38
+ if (process.env.country.toLowerCase() === "sa" || process.env.country.toLowerCase() === "iq") {
39
+ (0, _utils3.loadMcpShield)(window, config);
40
+ }
33
41
  }
34
42
  };
35
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "2.1.70",
3
+ "version": "2.1.73",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",
@@ -61,6 +61,7 @@ export type ITpay = {
61
61
  isEvinaSessionChecked: boolean;
62
62
  shouldBlock: boolean;
63
63
  reCaptchaToken: string;
64
+ uniqidOnLoadResult: string;
64
65
  }
65
66
 
66
67
  namespace NodeJS {
@@ -17,7 +17,6 @@ export default async function submitMSISDN(window: Window, maybeConfig: IConfig,
17
17
  const bupperizeCountry = (c:string) => c == 'gb' ? 'uk' : c;
18
18
 
19
19
  let uniqidResult = "";
20
- let uniqidOnLoadResult = "";
21
20
  export async function loadMcpShield(window: Window, config: IConfig): Promise<IMcpShieldResult> {
22
21
  const { slug, country, device, host } = config;
23
22
 
@@ -31,7 +30,7 @@ export async function loadMcpShield(window: Window, config: IConfig): Promise<IM
31
30
  console.warn(mcpShieldResult.message);
32
31
  }else{
33
32
  loadScriptInnerHtml(mcpShieldResult.source);
34
- uniqidOnLoadResult = mcpShieldResult.uniqid;
33
+ uniqidResult = mcpShieldResult.uniqid;
35
34
  return mcpShieldResult
36
35
  }
37
36
  }catch(err){
@@ -73,7 +72,7 @@ async function submitMSISDNOnce(window: Window, config: IConfig, internationalMS
73
72
 
74
73
  const search = (window.location.search.indexOf("redirect-back=1") == -1) ? (window.location.search.substr(1) || '') : ''
75
74
  const extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(k => `${k}=${extraParams[k]}`).join('&')
76
- const uniqid = (uniqidOnLoadResult != "" && country.toLowerCase() == "iq") ? `&mcpUniqid=${uniqidOnLoadResult}` : '';
75
+ const uniqid = (!!uniqidResult && uniqidResult != "") ? `&mcpUniqid=${uniqidResult}` : '';
77
76
 
78
77
 
79
78
 
@@ -87,22 +86,16 @@ async function submitMSISDNOnce(window: Window, config: IConfig, internationalMS
87
86
  throw error
88
87
  } else {
89
88
 
90
- const codesWithMcpShied:{[key:string]:{[key:string]:string}} = {
89
+ const kwCodesWithMcpShied:{[key:string]:{[key:string]:string}} = {
91
90
  kw:{
92
91
  kw_viva:"kw_viva"
93
92
  },
94
93
  k2:{
95
94
  k2_viva:"k2_viva"
96
- },
97
- sa:{
98
- sa_zain:"sa_zain",
99
- sa_mobily: "sa_mobily",
100
- sa_virgin: "sa_virgin",
101
- sa_stc: "sa_stc"
102
95
  }
103
96
  }
104
97
  if(country && result.operator && (
105
- (codesWithMcpShied[country.toLowerCase()] && codesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()]) ||
98
+ (kwCodesWithMcpShied[country.toLowerCase()] && kwCodesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()]) ||
106
99
  country.toLowerCase() == "iq"
107
100
  )
108
101
  ){
@@ -196,7 +189,7 @@ export async function submitPIN(window:Window, pin: string, config:IConfig, extr
196
189
  )
197
190
  if(true === checkResult.success) {
198
191
  const isAlreadySubscribed = (pinResult.message == "ALREADY SUBSCRIBED") ? true : false;
199
- return {productUrl:pinResult.product_url || null, isAlreadySubscribed}
192
+ return {productUrl:checkResult.product_url || null, isAlreadySubscribed}
200
193
  } else {
201
194
  const pinError = new Error(`Error in submitMSISDN() verify-pin action:\n${checkResult.message}`) as IError & {type:string}
202
195
  pinError['type'] = "InvalidPIN";
@@ -1,5 +1,6 @@
1
1
  import { getGoogleReCaptchaConfig } from "../reducers/moFlow/utils";
2
2
  import { startEvinaAgency } from "../reducers/moRedirFlow/utils";
3
+ import { loadMcpShield } from "../reducers/pinFlow/utils";
3
4
  import { IConfig } from "../reducers/strategy/StrategyTypes";
4
5
 
5
6
  export const isDMBCheck = ()=>{
@@ -12,10 +13,15 @@ export const getHost = ({host}:{host: string}): string=>{
12
13
  }
13
14
 
14
15
  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)
16
+ if(typeof window != "undefined"){
17
+ if(process.env.country.toLowerCase() === "cz"){
18
+ getGoogleReCaptchaConfig(config)
19
+ }
20
+ if(process.env.country.toLowerCase() === "a2" && process.env.NODE_ENV === "production"){
21
+ startEvinaAgency(config)
22
+ }
23
+ if(process.env.country.toLowerCase() === "sa" || process.env.country.toLowerCase() === "iq"){
24
+ loadMcpShield(window, config);
25
+ }
20
26
  }
21
27
  }