ouisys-engine 3.0.21 → 3.0.22

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.
@@ -33,8 +33,6 @@ require("core-js/modules/es.string.replace.js");
33
33
 
34
34
  var _pacmanClient = _interopRequireDefault(require("pacman-client"));
35
35
 
36
- var _uuid = require("uuid");
37
-
38
36
  var _queryString2 = _interopRequireDefault(require("./queryString"));
39
37
 
40
38
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -45,6 +43,9 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
45
43
 
46
44
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
47
45
 
46
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
47
+ var uuid = require('uuid').v1;
48
+
48
49
  var _default = function _default(window, country, page) {
49
50
  if (!window) {
50
51
  return {
@@ -69,7 +70,7 @@ var _default = function _default(window, country, page) {
69
70
  var url = window.pac_analytics ? window.pac_analytics.url : (0, _queryString2.default)(window.location.search, 'pacman-server') || '/analytics';
70
71
 
71
72
  if (!window.pac_analytics) {
72
- var rockmanId = (0, _uuid.v1)().replace(/-/g, '');
73
+ var rockmanId = uuid().replace(/-/g, '');
73
74
  var campaignId = parseInt((0, _queryString2.default)(window.location.search, 'cid'), 10) || 2; // eslint-disable-next-line no-param-reassign
74
75
 
75
76
  window.pac_analytics = {
@@ -190,7 +190,7 @@ function submitMSISDNOnce(_x7, _x8, _x9, _x10) {
190
190
 
191
191
  function _submitMSISDNOnce() {
192
192
  _submitMSISDNOnce = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(window, config, internationalMSISDN, extraParams) {
193
- var submissionError, msisdn, rockmanId, supportedSlugs, identifiedUser, slug, country, device, offer, host, search, extraParamsQs, uniqid, result, error, kwCodesWithMcpShied, mcpShieldResult;
193
+ var submissionError, newExtraParams, isSkipValidation, searchObj, msisdn, rockmanId, supportedSlugs, identifiedUser, slug, country, device, offer, host, search, extraParamsQs, uniqid, result, error, kwCodesWithMcpShied, mcpShieldResult;
194
194
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
195
195
  while (1) {
196
196
  switch (_context3.prev = _context3.next) {
@@ -205,8 +205,17 @@ function _submitMSISDNOnce() {
205
205
  throw submissionError;
206
206
 
207
207
  case 4:
208
- msisdn = !!extraParams && extraParams['skip-validation'] === '1' // Special case Digital Virgo sents encrypted msisdn we dont need to validate is
209
- ? internationalMSISDN : internationalMSISDN.match(/\d+/gi).join(''); // tallyman API expects international msisdn without any special character
208
+ newExtraParams = extraParams || {};
209
+ isSkipValidation = false;
210
+ searchObj = (0, _utils.searchToObject)();
211
+
212
+ if ((searchObj === null || searchObj === void 0 ? void 0 : searchObj.success) === 'true' && searchObj['msisdn-alias'] === '1') {
213
+ // Search param is set to 1 for header enrichment when the msisdn is masked
214
+ newExtraParams['skip-validation'] = '1';
215
+ isSkipValidation = true;
216
+ }
217
+
218
+ msisdn = isSkipValidation ? internationalMSISDN : internationalMSISDN.match(/\d+/gi).join(''); // tallyman API expects international msisdn without any special character
210
219
 
211
220
  rockmanId = window.pac_analytics.visitor.rockmanId; // HARDCODING This for now if the concerpt works we move this to configs
212
221
 
@@ -216,14 +225,14 @@ function _submitMSISDNOnce() {
216
225
  };
217
226
 
218
227
  if (!(config.country.toLowerCase() === 'k2' && supportedSlugs[config.slug])) {
219
- _context3.next = 12;
228
+ _context3.next = 16;
220
229
  break;
221
230
  }
222
231
 
223
- _context3.next = 10;
232
+ _context3.next = 14;
224
233
  return window.tallymanApi.identify(config.host, config.slug, config.country, msisdn, config.device, config.offer, rockmanId);
225
234
 
226
- case 10:
235
+ case 14:
227
236
  identifiedUser = _context3.sent;
228
237
 
229
238
  if (identifiedUser.operator && identifiedUser.operator === 'K2_ZAIN') {
@@ -233,21 +242,21 @@ function _submitMSISDNOnce() {
233
242
  config.slug = window.hostSlug;
234
243
  }
235
244
 
236
- case 12:
245
+ case 16:
237
246
  slug = config.slug, country = config.country, device = config.device, offer = config.offer, host = config.host;
238
247
  search = window.location.search.indexOf('redirect-back=1') === -1 ? window.location.search.substr(1) || '' : '';
239
- extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
240
- return "".concat(k, "=").concat(extraParams[k]);
248
+ extraParamsQs = "&".concat(Object.keys(newExtraParams).map(function (k) {
249
+ return "".concat(k, "=").concat(newExtraParams[k]);
241
250
  }).join('&'));
242
251
  uniqid = !!uniqidResult && uniqidResult !== '' ? "&mcpUniqid=".concat(uniqidResult) : '';
243
- _context3.next = 18;
252
+ _context3.next = 22;
244
253
  return window.tallymanApi.triggerPin(host, country, slug, device, offer, msisdn, rockmanId, extraParamsQs, search, uniqid);
245
254
 
246
- case 18:
255
+ case 22:
247
256
  result = _context3.sent;
248
257
 
249
258
  if (!(result.success === false)) {
250
- _context3.next = 27;
259
+ _context3.next = 31;
251
260
  break;
252
261
  }
253
262
 
@@ -257,7 +266,7 @@ function _submitMSISDNOnce() {
257
266
  console.error(error);
258
267
  throw error;
259
268
 
260
- case 27:
269
+ case 31:
261
270
  kwCodesWithMcpShied = {
262
271
  kw: {
263
272
  kw_viva: 'kw_viva'
@@ -268,15 +277,15 @@ function _submitMSISDNOnce() {
268
277
  };
269
278
 
270
279
  if (!(country && result.operator && (kwCodesWithMcpShied[country.toLowerCase()] && kwCodesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()] || country.toLowerCase() === 'iq'))) {
271
- _context3.next = 39;
280
+ _context3.next = 43;
272
281
  break;
273
282
  }
274
283
 
275
- _context3.prev = 29;
276
- _context3.next = 32;
284
+ _context3.prev = 33;
285
+ _context3.next = 36;
277
286
  return window.tallymanApi.mcpShield(host, country, slug, device, offer, rockmanId, result.operator, uniqid);
278
287
 
279
- case 32:
288
+ case 36:
280
289
  mcpShieldResult = _context3.sent;
281
290
 
282
291
  if (mcpShieldResult.success === false) {
@@ -286,15 +295,15 @@ function _submitMSISDNOnce() {
286
295
  uniqidResult = mcpShieldResult.uniqid;
287
296
  }
288
297
 
289
- _context3.next = 39;
298
+ _context3.next = 43;
290
299
  break;
291
300
 
292
- case 36:
293
- _context3.prev = 36;
294
- _context3.t0 = _context3["catch"](29);
301
+ case 40:
302
+ _context3.prev = 40;
303
+ _context3.t0 = _context3["catch"](33);
295
304
  console.warn(_context3.t0);
296
305
 
297
- case 39:
306
+ case 43:
298
307
  return _context3.abrupt("return", {
299
308
  type: 'SingleMSISDNSubmissionResult',
300
309
  pin: result.pin,
@@ -302,12 +311,12 @@ function _submitMSISDNOnce() {
302
311
  operator: result.operator
303
312
  });
304
313
 
305
- case 40:
314
+ case 44:
306
315
  case "end":
307
316
  return _context3.stop();
308
317
  }
309
318
  }
310
- }, _callee3, null, [[29, 36]]);
319
+ }, _callee3, null, [[33, 40]]);
311
320
  }));
312
321
  return _submitMSISDNOnce.apply(this, arguments);
313
322
  }
@@ -212,15 +212,16 @@ export declare type IStrategyActionMaps = {
212
212
  loadOc2sms: () => AppThunk;
213
213
  };
214
214
  export declare type IStrategyIDentifyUserResult = {
215
- success: true;
215
+ success: 'true';
216
216
  rockman_id: string;
217
217
  msisdn: string;
218
218
  operator?: string;
219
219
  subscription_url?: string;
220
220
  redirect_url?: string;
221
221
  'redirect-back'?: string;
222
+ 'msisdn-alias'?: string;
222
223
  } | {
223
- success: false;
224
+ success: 'false';
224
225
  rockman_id: string;
225
226
  message: string;
226
227
  'redirect-back'?: string;
@@ -457,7 +457,7 @@ var identifyUser = /*#__PURE__*/function () {
457
457
  newHost = isDMB ? 'de.tallymans.com' : host;
458
458
  searchObj = searchToObject();
459
459
 
460
- if (!(!!searchObj['redirect-back'] && searchObj['redirect-back'] === '1' && !!searchObj.success)) {
460
+ if (!(!!searchObj['redirect-back'] && searchObj['redirect-back'] === '1' && (searchObj === null || searchObj === void 0 ? void 0 : searchObj.success) === 'true')) {
461
461
  _context2.next = 50;
462
462
  break;
463
463
  }
@@ -498,14 +498,14 @@ var identifyUser = /*#__PURE__*/function () {
498
498
  });
499
499
 
500
500
  case 31:
501
- if (!searchObj.redirect_url) {
501
+ if (!(searchObj !== null && searchObj !== void 0 && searchObj.redirect_url)) {
502
502
  _context2.next = 42;
503
503
  break;
504
504
  }
505
505
 
506
506
  url2 = "https://de.tallymans.com/tallyman/v1/?action=redirect&country=".concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", 'smart', "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId, "&auto-redirect=1&").concat(extraParamsQs); // const result2 = await fetch(url2).then(x => x.json())
507
507
 
508
- redirect_url = window.atob(searchObj.redirect_url);
508
+ redirect_url = window.atob(searchObj === null || searchObj === void 0 ? void 0 : searchObj.redirect_url);
509
509
  _newUrl2 = new URL(redirect_url);
510
510
  _newQueryString2 = _newUrl2.search;
511
511
  _urlParams2 = new URLSearchParams(_newQueryString2);
@@ -553,7 +553,7 @@ var identifyUser = /*#__PURE__*/function () {
553
553
  case 53:
554
554
  result = _context2.sent;
555
555
 
556
- if (!(result.success === false)) {
556
+ if (!(result.success === 'false')) {
557
557
  _context2.next = 60;
558
558
  break;
559
559
  }
@@ -47,16 +47,15 @@ var handleFormSubmit = function handleFormSubmit(_ref2) {
47
47
  var pn = new _awesomePhonenumber.default("+".concat(internationalNumber), process.env.country.toUpperCase());
48
48
  var countryCode = pn.getCountryCode();
49
49
  var networkType = isHeaderEnrichmentSuccess ? 'mobile_data' : 'wifi';
50
+ var searchObj = (0, _utils.searchToObject)();
50
51
 
51
- if (isHeaderEnrichmentSuccess === true && process.env.country === 'kw' && internationalNumber != '' && !pn.isValid()) {
52
+ if (isHeaderEnrichmentSuccess === true && process.env.country === 'kw' && internationalNumber !== '' && !pn.isValid()) {
52
53
  setInternationalNumber(countryCode + internationalNumber);
53
54
  var newNumber = countryCode + internationalNumber;
54
55
  onEnd(newNumber.match(/\d+/gi).join(''));
55
- } else if (isHeaderEnrichmentSuccess === true && process.env.country === 'ci') {
56
+ } else if (isHeaderEnrichmentSuccess === true && (searchObj === null || searchObj === void 0 ? void 0 : searchObj.success) === 'true' && searchObj['msisdn-alias'] === '1') {
56
57
  // Special case Digital Virgo sents encrypted msisdn we dont need to validate is
57
- var searchObj = (0, _utils.searchToObject)();
58
-
59
- if (searchObj.success && searchObj.msisdn) {
58
+ if (searchObj !== null && searchObj !== void 0 && searchObj.msisdn) {
60
59
  var encryptedMsisdn = searchObj.msisdn;
61
60
  onEnd(encryptedMsisdn, {
62
61
  network_type: networkType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "3.0.21",
3
+ "version": "3.0.22",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",
@@ -18,78 +18,78 @@
18
18
  "author": "",
19
19
  "license": "ISC",
20
20
  "dependencies": {
21
- "awesome-phonenumber": "^3.2.0",
22
- "immutability-helper": "^3.1.1",
23
- "pacman-client": "^1.5.6",
24
- "react-addons-update": "^15.6.3",
25
- "react-redux": "^8.0.2",
26
- "redux": "^4.2.0",
27
- "redux-logger": "^3.0.6",
28
- "redux-thunk": "^2.4.1",
29
- "rxjs": "^7.5.5",
30
- "rxjs-compat": "^6.6.7",
21
+ "awesome-phonenumber": "3.2.0",
22
+ "immutability-helper": "3.1.1",
23
+ "pacman-client": "1.5.6",
24
+ "react-addons-update": "15.6.3",
25
+ "react-redux": "8.0.2",
26
+ "redux": "4.2.0",
27
+ "redux-logger": "3.0.6",
28
+ "redux-thunk": "2.4.1",
29
+ "rxjs": "7.5.5",
30
+ "rxjs-compat": "6.6.7",
31
31
  "typescript": "4.7.4",
32
- "uuid": "^9.0.0"
32
+ "uuid": "9.0.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@babel/cli": "7.18.6",
36
36
  "@babel/core": "7.18.6",
37
37
  "@babel/plugin-proposal-class-properties": "7.18.6",
38
- "@babel/plugin-transform-member-expression-literals": "^7.18.6",
38
+ "@babel/plugin-transform-member-expression-literals": "7.18.6",
39
39
  "@babel/preset-env": "7.18.6",
40
40
  "@babel/preset-typescript": "7.18.6",
41
41
  "@babel/runtime": "7.18.6",
42
42
  "@reduxjs/toolkit": "1.8.3",
43
- "@types/chai": "^4.3.1",
44
- "@types/crypto-js": "^4.1.1",
45
- "@types/fs-extra": "^9.0.13",
46
- "@types/inquirer": "^8.2.1",
47
- "@types/mocha": "^9.1.1",
48
- "@types/node": "^18.0.3",
49
- "@types/node-fetch": "^2.6.2",
43
+ "@types/chai": "4.3.1",
44
+ "@types/crypto-js": "4.1.1",
45
+ "@types/fs-extra": "9.0.13",
46
+ "@types/inquirer": "8.2.1",
47
+ "@types/mocha": "9.1.1",
48
+ "@types/node": "18.0.3",
49
+ "@types/node-fetch": "2.6.2",
50
50
  "@types/ramda": "0.28.15",
51
- "@types/react": "^18.0.15",
52
- "@types/react-dom": "^18.0.6",
53
- "@types/react-redux": "^7.1.24",
54
- "@types/react-test-renderer": "^18.0.0",
55
- "@types/redux-logger": "^3.0.9",
56
- "@types/redux-mock-store": "^1.0.3",
57
- "@types/uuid": "^8.3.4",
58
- "@typescript-eslint/eslint-plugin": "^4.19.0",
59
- "@typescript-eslint/parser": "^4.19.0",
60
- "chai": "^4.3.6",
51
+ "@types/react": "18.0.15",
52
+ "@types/react-dom": "18.0.6",
53
+ "@types/react-redux": "7.1.24",
54
+ "@types/react-test-renderer": "18.0.0",
55
+ "@types/redux-logger": "3.0.9",
56
+ "@types/redux-mock-store": "1.0.3",
57
+ "@types/uuid": "8.3.4",
58
+ "@typescript-eslint/eslint-plugin": "4.19.0",
59
+ "@typescript-eslint/parser": "4.19.0",
60
+ "chai": "4.3.6",
61
61
  "core-js": "3.23.4",
62
- "eslint": "^7.16.0",
63
- "eslint-config-airbnb": "^18.2.1",
64
- "eslint-config-ouisys": "^0.0.9",
65
- "eslint-config-prettier": "^7.1.0",
66
- "eslint-plugin-import": "^2.22.1",
67
- "eslint-plugin-jest": "^24.1.3",
68
- "eslint-plugin-jsx-a11y": "^6.4.1",
69
- "eslint-plugin-prettier": "^3.3.0",
70
- "eslint-plugin-react": "^7.21.5",
71
- "eslint-plugin-react-hooks": "^4.2.0",
72
- "eslint-plugin-testing-library": "^3.10.1",
73
- "eslint-webpack-plugin": "^3.2.0",
74
- "husky": "^8.0.1",
75
- "jest": "^28.1.3",
76
- "jsdom": "^20.0.0",
77
- "jsdom-global": "^3.0.2",
78
- "lint-staged": "^13.0.3",
79
- "msw": "^0.43.1",
80
- "prettier": "^2.2.1",
81
- "prettier-config-ouisys": "^0.0.1",
82
- "prettier-plugin-organize-imports": "^1.1.1",
83
- "react-test-renderer": "^18.2.0",
84
- "redux-cli-logger": "^2.1.0",
85
- "redux-mock-store": "^1.5.4",
86
- "ts-node": "^10.8.2"
62
+ "eslint": "7.16.0",
63
+ "eslint-config-airbnb": "18.2.1",
64
+ "eslint-config-ouisys": "0.0.9",
65
+ "eslint-config-prettier": "7.1.0",
66
+ "eslint-plugin-import": "2.22.1",
67
+ "eslint-plugin-jest": "24.1.3",
68
+ "eslint-plugin-jsx-a11y": "6.4.1",
69
+ "eslint-plugin-prettier": "3.3.0",
70
+ "eslint-plugin-react": "7.21.5",
71
+ "eslint-plugin-react-hooks": "4.2.0",
72
+ "eslint-plugin-testing-library": "3.10.1",
73
+ "eslint-webpack-plugin": "3.2.0",
74
+ "husky": "8.0.1",
75
+ "jest": "28.1.3",
76
+ "jsdom": "20.0.0",
77
+ "jsdom-global": "3.0.2",
78
+ "lint-staged": "13.0.3",
79
+ "msw": "0.43.1",
80
+ "prettier": "2.2.1",
81
+ "prettier-config-ouisys": "0.0.1",
82
+ "prettier-plugin-organize-imports": "1.1.1",
83
+ "react-test-renderer": "18.2.0",
84
+ "redux-cli-logger": "2.1.0",
85
+ "redux-mock-store": "1.5.4",
86
+ "ts-node": "10.8.2"
87
87
  },
88
88
  "resolutions": {
89
- "@types/react": "^18.0.14",
90
- "@types/react-dom": "^18.0.5",
91
- "react": "^18.2.0",
92
- "react-dom": "^18.2.0"
89
+ "@types/react": "18.0.14",
90
+ "@types/react-dom": "18.0.5",
91
+ "react": "18.2.0",
92
+ "react-dom": "18.2.0"
93
93
  },
94
94
  "proxy": "http://localhost:3030/",
95
95
  "husky": {