ouisys-engine 2.1.18 → 2.1.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.
Files changed (55) hide show
  1. package/dist/api/click2sms.js +357 -0
  2. package/dist/api/index.d.ts +1 -1
  3. package/dist/api/index.js +27 -27
  4. package/dist/api/mo.js +274 -0
  5. package/dist/api/moRedir.js +186 -0
  6. package/dist/api/oneClick.js +366 -0
  7. package/dist/api/pin.js +493 -0
  8. package/dist/api/strategies.js +704 -0
  9. package/dist/api/ussd.js +1 -0
  10. package/dist/app/store.js +35 -0
  11. package/dist/features/strategies/categories/askMobileNumber.js +395 -0
  12. package/dist/features/strategies/categories/askOperator.js +311 -0
  13. package/dist/features/strategies/categories/detectOperatorByIp.js +606 -0
  14. package/dist/features/strategies/categories/headerEnrichment.js +670 -0
  15. package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +12 -0
  16. package/dist/features/strategies/categories/typings/identifySliceTypes.js +22 -0
  17. package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +22 -0
  18. package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +21 -0
  19. package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +13 -0
  20. package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +13 -0
  21. package/dist/features/strategies/click2smsFlowSlice.js +172 -0
  22. package/dist/features/strategies/identifySlice.js +455 -0
  23. package/dist/features/strategies/moFlowSlice.js +196 -0
  24. package/dist/features/strategies/moRedirFlowSlice.js +190 -0
  25. package/dist/features/strategies/oneClickFlowSlice.js +277 -0
  26. package/dist/features/strategies/pinFlowSlice.js +313 -0
  27. package/dist/features/strategies/ussdFlowSlice.js +1 -0
  28. package/dist/ips/tryGetIPRangeName.js +14 -13
  29. package/dist/mockServer/browser.js +48 -0
  30. package/dist/mockServer/handlers.js +22 -0
  31. package/dist/mockServer/server.js +48 -0
  32. package/dist/pacman/index.js +0 -1
  33. package/dist/reducers/click2smsFlow/utils.js +1 -3
  34. package/dist/reducers/oneClickFlow/utils.js +8 -7
  35. package/dist/reducers/pinFlow/utils.js +65 -34
  36. package/dist/reducers/strategy/strategies/header_enrichment.js +31 -25
  37. package/dist/reducers/strategy/utils.js +11 -12
  38. package/dist/reducers/tpayHeFlow/utils.js +1 -1
  39. package/dist/test/test-utils.js +51 -0
  40. package/package.json +1 -1
  41. package/src/@types/window.d.ts +3 -0
  42. package/src/api/index.ts +7 -7
  43. package/src/ips/tryGetIPRangeName.ts +3 -2
  44. package/src/pacman/index.ts +1 -1
  45. package/src/reducers/click2smsFlow/utils.ts +0 -3
  46. package/src/reducers/oneClickFlow/utils.ts +3 -2
  47. package/src/reducers/pinFlow/utils.ts +34 -4
  48. package/src/reducers/strategy/strategies/header_enrichment.ts +14 -11
  49. package/src/reducers/strategy/utils.ts +1 -2
  50. package/src/reducers/tpayHeFlow/utils.ts +1 -1
  51. package/dist/reducers/strategy/__tests__/strategy.spec.d.ts +0 -1
  52. package/dist/reducers/strategy/__tests__/strategy.spec.js +0 -33
  53. package/dist/test/renderWithRouterAndUserMock.d.ts +0 -21
  54. package/dist/test/renderWithRouterAndUserMock.js +0 -40
  55. package/dist/test/setup.d.ts +0 -1
@@ -183,7 +183,7 @@ function submitMSISDNOnce(_x7, _x8, _x9, _x10) {
183
183
 
184
184
  function _submitMSISDNOnce() {
185
185
  _submitMSISDNOnce = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(window, config, internationalMSISDN, extraParams) {
186
- var submissionError, msisdn, slug, country, device, offer, host, search, extraParamsQs, rockmanId, uniqid, result, error, kwCodesWithMcpShied, mcpShieldResult;
186
+ var submissionError, msisdn, rockmanId, supportedSlugs, identifiedUser, slug, country, device, offer, host, search, extraParamsQs, uniqid, result, error, kwCodesWithMcpShied, mcpShieldResult;
187
187
  return regeneratorRuntime.wrap(function _callee3$(_context3) {
188
188
  while (1) {
189
189
  switch (_context3.prev = _context3.next) {
@@ -200,21 +200,46 @@ function _submitMSISDNOnce() {
200
200
  case 4:
201
201
  msisdn = internationalMSISDN.match(/\d+/gi).join(''); // tallyman API expects international msisdn without any special character
202
202
 
203
+ rockmanId = window.pac_analytics.visitor.rockmanId; // HARDCODING This for now if the concerpt works we move this to configs
204
+
205
+ supportedSlugs = {
206
+ "kuwait-agency-mix-gamezone-puzzle1": "kuwait-agency-mix-gamezone-puzzle1",
207
+ "kuwait-agency-mix-yourspot-riddles": "kuwait-agency-mix-yourspot-riddles"
208
+ };
209
+
210
+ if (!(config.country.toLowerCase() == "k2" && supportedSlugs[config.slug])) {
211
+ _context3.next = 12;
212
+ break;
213
+ }
214
+
215
+ _context3.next = 10;
216
+ return window.tallymanApi.identify(config.host, config.slug, config.country, msisdn, config.device, config.offer, rockmanId);
217
+
218
+ case 10:
219
+ identifiedUser = _context3.sent;
220
+
221
+ if (identifiedUser.operator && identifiedUser.operator == "K2_ZAIN") {
222
+ window.hostCountry = "KW";
223
+ window.hostSlug = "kw-mt2-hosted-flow-mobfun";
224
+ config.country = window.hostCountry;
225
+ config.slug = window.hostSlug;
226
+ }
227
+
228
+ case 12:
203
229
  slug = config.slug, country = config.country, device = config.device, offer = config.offer, host = config.host;
204
230
  search = window.location.search.indexOf("redirect-back=1") == -1 ? window.location.search.substr(1) || '' : '';
205
231
  extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(function (k) {
206
232
  return "".concat(k, "=").concat(extraParams[k]);
207
233
  }).join('&');
208
- rockmanId = window.pac_analytics.visitor.rockmanId;
209
234
  uniqid = uniqidOnLoadResult != "" && country.toLowerCase() == "iq" ? "&mcpUniqid=".concat(uniqidOnLoadResult) : '';
210
- _context3.next = 12;
235
+ _context3.next = 18;
211
236
  return window.tallymanApi.triggerPin(host, country, slug, device, offer, msisdn, rockmanId, extraParamsQs, search, uniqid);
212
237
 
213
- case 12:
238
+ case 18:
214
239
  result = _context3.sent;
215
240
 
216
241
  if (!(false === result.success)) {
217
- _context3.next = 21;
242
+ _context3.next = 27;
218
243
  break;
219
244
  }
220
245
 
@@ -224,7 +249,7 @@ function _submitMSISDNOnce() {
224
249
  console.error(error);
225
250
  throw error;
226
251
 
227
- case 21:
252
+ case 27:
228
253
  kwCodesWithMcpShied = {
229
254
  kw: {
230
255
  kw_viva: "kw_viva"
@@ -235,15 +260,15 @@ function _submitMSISDNOnce() {
235
260
  };
236
261
 
237
262
  if (!(country && result.operator && (kwCodesWithMcpShied[country.toLowerCase()] && kwCodesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()] || country.toLowerCase() == "iq"))) {
238
- _context3.next = 33;
263
+ _context3.next = 39;
239
264
  break;
240
265
  }
241
266
 
242
- _context3.prev = 23;
243
- _context3.next = 26;
267
+ _context3.prev = 29;
268
+ _context3.next = 32;
244
269
  return window.tallymanApi.mcpShield(host, country, slug, device, offer, rockmanId, result.operator, uniqid);
245
270
 
246
- case 26:
271
+ case 32:
247
272
  mcpShieldResult = _context3.sent;
248
273
 
249
274
  if (false == mcpShieldResult.success) {
@@ -253,15 +278,15 @@ function _submitMSISDNOnce() {
253
278
  uniqidResult = mcpShieldResult.uniqid;
254
279
  }
255
280
 
256
- _context3.next = 33;
281
+ _context3.next = 39;
257
282
  break;
258
283
 
259
- case 30:
260
- _context3.prev = 30;
261
- _context3.t0 = _context3["catch"](23);
284
+ case 36:
285
+ _context3.prev = 36;
286
+ _context3.t0 = _context3["catch"](29);
262
287
  console.warn(_context3.t0);
263
288
 
264
- case 33:
289
+ case 39:
265
290
  return _context3.abrupt("return", {
266
291
  type: "SingleMSISDNSubmissionResult",
267
292
  pin: result.pin,
@@ -269,12 +294,12 @@ function _submitMSISDNOnce() {
269
294
  operator: result.operator
270
295
  });
271
296
 
272
- case 34:
297
+ case 40:
273
298
  case "end":
274
299
  return _context3.stop();
275
300
  }
276
301
  }
277
- }, _callee3, null, [[23, 30]]);
302
+ }, _callee3, null, [[29, 36]]);
278
303
  }));
279
304
  return _submitMSISDNOnce.apply(this, arguments);
280
305
  }
@@ -373,12 +398,17 @@ function submitPIN(_x16, _x17, _x18, _x19) {
373
398
 
374
399
  function _submitPIN() {
375
400
  _submitPIN = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(window, pin, config, extraParams) {
376
- var slug, country, device, host, offer, extraParamsQs, rockmanId, emptyPinError, uniqid, pinResult, pinError, check, checkResult, isAlreadySubscribed, _pinError, _isAlreadySubscribed;
401
+ var slug, country, device, host, offer, extraParamsQs, rockmanId, emptyPinError, uniqid, evinaTid, pinResult, pinError, check, checkResult, isAlreadySubscribed, _pinError, _isAlreadySubscribed;
377
402
 
378
403
  return regeneratorRuntime.wrap(function _callee6$(_context6) {
379
404
  while (1) {
380
405
  switch (_context6.prev = _context6.next) {
381
406
  case 0:
407
+ if (window.hostCountry && window.hostSlug) {
408
+ config.country = window.hostCountry;
409
+ config.slug = window.hostSlug;
410
+ }
411
+
382
412
  slug = config.slug, country = config.country, device = config.device, host = config.host;
383
413
  offer = window.pac_analytics.visitor.offer;
384
414
  extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(function (k) {
@@ -387,7 +417,7 @@ function _submitPIN() {
387
417
  rockmanId = window.pac_analytics.visitor.rockmanId;
388
418
 
389
419
  if (pin) {
390
- _context6.next = 8;
420
+ _context6.next = 9;
391
421
  break;
392
422
  }
393
423
 
@@ -395,16 +425,17 @@ function _submitPIN() {
395
425
  emptyPinError['type'] = "InvalidPIN";
396
426
  throw emptyPinError;
397
427
 
398
- case 8:
428
+ case 9:
399
429
  uniqid = uniqidResult != "" ? "&mcpUniqid=".concat(uniqidResult) : '';
400
- _context6.next = 11;
401
- return window.tallymanApi.verifyPin(host, country, slug, device, offer, rockmanId, pin, extraParamsQs, uniqid);
430
+ evinaTid = typeof window != "undefined" && window.tid ? window.tid : "";
431
+ _context6.next = 13;
432
+ return window.tallymanApi.verifyPin(host, country, slug, device, offer, rockmanId, pin, extraParamsQs, uniqid, evinaTid);
402
433
 
403
- case 11:
434
+ case 13:
404
435
  pinResult = _context6.sent;
405
436
 
406
437
  if (!(false === pinResult.success)) {
407
- _context6.next = 18;
438
+ _context6.next = 20;
408
439
  break;
409
440
  }
410
441
 
@@ -412,9 +443,9 @@ function _submitPIN() {
412
443
  pinError['type'] = "InvalidPIN";
413
444
  throw pinError;
414
445
 
415
- case 18:
446
+ case 20:
416
447
  if (!(true === pinResult.async)) {
417
- _context6.next = 33;
448
+ _context6.next = 35;
418
449
  break;
419
450
  }
420
451
 
@@ -422,16 +453,16 @@ function _submitPIN() {
422
453
  return window.tallymanApi.checkSubscription(host, country, slug, device, offer, rockmanId, pin, extraParamsQs);
423
454
  };
424
455
 
425
- _context6.next = 22;
456
+ _context6.next = 24;
426
457
  return (0, _utils.loop)(check, 30, function (r) {
427
458
  return r.success;
428
459
  }, 0);
429
460
 
430
- case 22:
461
+ case 24:
431
462
  checkResult = _context6.sent;
432
463
 
433
464
  if (!(true === checkResult.success)) {
434
- _context6.next = 28;
465
+ _context6.next = 30;
435
466
  break;
436
467
  }
437
468
 
@@ -441,23 +472,23 @@ function _submitPIN() {
441
472
  isAlreadySubscribed: isAlreadySubscribed
442
473
  });
443
474
 
444
- case 28:
475
+ case 30:
445
476
  _pinError = new Error("Error in submitMSISDN() verify-pin action:\n".concat(checkResult.message));
446
477
  _pinError['type'] = "InvalidPIN";
447
478
  throw _pinError;
448
479
 
449
- case 31:
450
- _context6.next = 35;
480
+ case 33:
481
+ _context6.next = 37;
451
482
  break;
452
483
 
453
- case 33:
484
+ case 35:
454
485
  _isAlreadySubscribed = pinResult.message == "ALREADY SUBSCRIBED" ? true : false;
455
486
  return _context6.abrupt("return", {
456
487
  productUrl: pinResult.product_url || null,
457
488
  isAlreadySubscribed: _isAlreadySubscribed
458
489
  });
459
490
 
460
- case 35:
491
+ case 37:
461
492
  case "end":
462
493
  return _context6.stop();
463
494
  }
@@ -142,7 +142,7 @@ var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
142
142
  msisdn = heResult.msisdn;
143
143
  operator = heResult.operator;
144
144
 
145
- _.tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-detected', {
145
+ _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {
146
146
  msisdn: msisdn
147
147
  });
148
148
 
@@ -185,7 +185,7 @@ var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
185
185
  _context.t0 = _context["catch"](0);
186
186
  console.warn(_context.t0);
187
187
 
188
- _.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-detection-failure', {
188
+ _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {
189
189
  errorType: _context.t0.toString()
190
190
  });
191
191
 
@@ -297,13 +297,14 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
297
297
 
298
298
  case 3:
299
299
  ipRangeName = _context2.sent;
300
- console.log("IP ipRangeName", ipRangeName);
301
300
 
302
301
  if (!(ipRangeName == null)) {
303
302
  _context2.next = 7;
304
303
  break;
305
304
  }
306
305
 
306
+ _.tracker.sendOptInFlowEvent("Pin");
307
+
307
308
  return _context2.abrupt("return", dispatch({
308
309
  type: "IDENTIFY_FLOW_BY_HE",
309
310
  payload: {
@@ -336,7 +337,7 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
336
337
  operator = heResult.operator ? heResult.operator.toUpperCase() : ipRangeName.toUpperCase();
337
338
 
338
339
  if (msisdn && msisdn !== "") {
339
- _.tracker.advancedInFlow('identify-user', 'msisdn-detected', {
340
+ _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {
340
341
  msisdn: msisdn
341
342
  });
342
343
 
@@ -358,10 +359,12 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
358
359
  });
359
360
  }
360
361
 
361
- _context2.next = 19;
362
+ _context2.next = 20;
362
363
  break;
363
364
 
364
365
  case 18:
366
+ _.tracker.sendOptInFlowEvent("Pin");
367
+
365
368
  return _context2.abrupt("return", dispatch({
366
369
  type: "IDENTIFY_FLOW_BY_HE",
367
370
  payload: {
@@ -374,16 +377,16 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
374
377
  }
375
378
  }));
376
379
 
377
- case 19:
378
- _context2.next = 27;
380
+ case 20:
381
+ _context2.next = 28;
379
382
  break;
380
383
 
381
- case 21:
382
- _context2.prev = 21;
384
+ case 22:
385
+ _context2.prev = 22;
383
386
  _context2.t0 = _context2["catch"](7);
384
387
  console.warn(_context2.t0);
385
388
 
386
- _.tracker.recedeInFlow('identify-user', 'msisdn-detection-failure', {
389
+ _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {
387
390
  errorType: _context2.t0.toString()
388
391
  });
389
392
 
@@ -400,12 +403,12 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
400
403
  }
401
404
  });
402
405
 
403
- case 27:
406
+ case 28:
404
407
  case "end":
405
408
  return _context2.stop();
406
409
  }
407
410
  }
408
- }, _callee2, null, [[7, 21]]);
411
+ }, _callee2, null, [[7, 22]]);
409
412
  }));
410
413
 
411
414
  return function (_x2) {
@@ -491,13 +494,14 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
491
494
 
492
495
  case 3:
493
496
  ipRangeName = _context3.sent;
494
- console.log("IP ipRangeName", ipRangeName);
495
497
 
496
498
  if (!(ipRangeName == null)) {
497
499
  _context3.next = 7;
498
500
  break;
499
501
  }
500
502
 
503
+ _.tracker.sendOptInFlowEvent("Redirect");
504
+
501
505
  return _context3.abrupt("return", dispatch({
502
506
  type: "IDENTIFY_FLOW_BY_HE",
503
507
  payload: {
@@ -530,7 +534,7 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
530
534
  operator = heResult.operator ? heResult.operator.toUpperCase() : ipRangeName.toUpperCase();
531
535
 
532
536
  if (msisdn && msisdn !== "") {
533
- _.tracker.advancedInFlow('identify-user', 'msisdn-detected', {
537
+ _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {
534
538
  msisdn: msisdn
535
539
  });
536
540
 
@@ -552,10 +556,12 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
552
556
  });
553
557
  }
554
558
 
555
- _context3.next = 19;
559
+ _context3.next = 20;
556
560
  break;
557
561
 
558
562
  case 18:
563
+ _.tracker.sendOptInFlowEvent("Redirect");
564
+
559
565
  return _context3.abrupt("return", dispatch({
560
566
  type: "IDENTIFY_FLOW_BY_HE",
561
567
  payload: {
@@ -568,20 +574,20 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
568
574
  }
569
575
  }));
570
576
 
571
- case 19:
572
- _context3.next = 27;
577
+ case 20:
578
+ _context3.next = 28;
573
579
  break;
574
580
 
575
- case 21:
576
- _context3.prev = 21;
581
+ case 22:
582
+ _context3.prev = 22;
577
583
  _context3.t0 = _context3["catch"](7);
578
584
  console.warn(_context3.t0);
579
585
 
580
- _.tracker.recedeInFlow('identify-user', 'msisdn-detection-failure', {
586
+ _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {
581
587
  errorType: _context3.t0.toString()
582
588
  });
583
589
 
584
- _.tracker.sendOptInFlowEvent("Pin");
590
+ _.tracker.sendOptInFlowEvent("Redirect");
585
591
 
586
592
  dispatch({
587
593
  type: "IDENTIFY_FLOW_BY_HE",
@@ -594,12 +600,12 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
594
600
  }
595
601
  });
596
602
 
597
- case 27:
603
+ case 28:
598
604
  case "end":
599
605
  return _context3.stop();
600
606
  }
601
607
  }
602
- }, _callee3, null, [[7, 21]]);
608
+ }, _callee3, null, [[7, 22]]);
603
609
  }));
604
610
 
605
611
  return function (_x3) {
@@ -695,7 +701,7 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
695
701
  msisdn = heResult.msisdn;
696
702
  operator = heResult.operator;
697
703
 
698
- _.tracker.advancedInFlow('identify-user', 'msisdn-detected', {
704
+ _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {
699
705
  msisdn: msisdn
700
706
  });
701
707
 
@@ -738,7 +744,7 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
738
744
  _context4.t0 = _context4["catch"](1);
739
745
  console.warn(_context4.t0);
740
746
 
741
- _.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-detection-failure', {
747
+ _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {
742
748
  errorType: _context4.t0.toString()
743
749
  });
744
750
 
@@ -431,7 +431,7 @@ var identifyUser = /*#__PURE__*/function () {
431
431
  searchObj = searchToObject();
432
432
 
433
433
  if (!(!!searchObj["redirect-back"] && searchObj["redirect-back"] == "1" && !!searchObj.success)) {
434
- _context2.next = 57;
434
+ _context2.next = 56;
435
435
  break;
436
436
  }
437
437
 
@@ -503,11 +503,10 @@ var identifyUser = /*#__PURE__*/function () {
503
503
  });
504
504
 
505
505
  case 46:
506
- _context2.next = 55;
506
+ _context2.next = 54;
507
507
  break;
508
508
 
509
509
  case 48:
510
- console.log("newUrl", window.location.href);
511
510
  _newUrl2 = new URL(window.location.href);
512
511
  _queryString3 = _newUrl2.search;
513
512
  _urlParams2 = new URLSearchParams(_queryString3);
@@ -518,20 +517,20 @@ var identifyUser = /*#__PURE__*/function () {
518
517
  operator: _operator2
519
518
  });
520
519
 
521
- case 55:
522
- _context2.next = 68;
520
+ case 54:
521
+ _context2.next = 67;
523
522
  break;
524
523
 
525
- case 57:
526
- _url2 = "https://".concat(newHost, "/tallyman/v1/?action=identify-user&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=").concat(device, "&offerId=").concat(offer, "&page=").concat(window.location.href, "&pixel_url=").concat(encodeURIComponent("http://c1.ouisys.com/pixels?xcid=".concat(window.location.pathname.replace("/", ""), "&xaid=").concat(window.pac_analytics.visitor.xaid, "&country=").concat(bupperizeCountry(country))), "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
527
- _context2.next = 60;
524
+ case 56:
525
+ _url2 = "https://".concat(newHost, "/tallyman/v1/?action=identify-user&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=").concat(device, "&offerId=").concat(offer, "&page=").concat(window.location.href, "&pixel_url=").concat(encodeURIComponent("http://".concat(window.location.host, "/pixels?xcid=").concat(window.location.pathname.replace("/", ""), "&xaid=").concat(window.pac_analytics.visitor.xaid, "&country=").concat(bupperizeCountry(country))), "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
526
+ _context2.next = 59;
528
527
  return fetchJsonp(_url2);
529
528
 
530
- case 60:
529
+ case 59:
531
530
  result = _context2.sent;
532
531
 
533
532
  if (!(false === result.success)) {
534
- _context2.next = 67;
533
+ _context2.next = 66;
535
534
  break;
536
535
  }
537
536
 
@@ -540,7 +539,7 @@ var identifyUser = /*#__PURE__*/function () {
540
539
 
541
540
  throw _identifyError;
542
541
 
543
- case 67:
542
+ case 66:
544
543
  return _context2.abrupt("return", {
545
544
  subscription_url: result.subscription_url || result.redirect_url,
546
545
  action: function action() {
@@ -550,7 +549,7 @@ var identifyUser = /*#__PURE__*/function () {
550
549
  operator: result.operator
551
550
  });
552
551
 
553
- case 68:
552
+ case 67:
554
553
  case "end":
555
554
  return _context2.stop();
556
555
  }
@@ -441,7 +441,7 @@ var confirmTPay = function confirmTPay(window, tpayConfig, locale, redirectUrl)
441
441
  if (config["replace_uid"] != undefined && config['replace_uid'] == true) {
442
442
  console.log('sub id ' + subId);
443
443
  productUrl = config['product_full_access'];
444
- fetch("http://de-mcb-api.sam-media.com/api/v2/validate-access/?domain=".concat(config.domain, "&sub_id=").concat(subId, "&country=").concat(tpayConfig.country, "&gateway=tpay")).then(function (response) {
444
+ fetch("http://de.tallymans.com/api/v2/validate-access/?domain=".concat(config.domain, "&sub_id=").concat(subId, "&country=").concat(tpayConfig.country, "&gateway=tpay")).then(function (response) {
445
445
  if (response.payload.token) {
446
446
  productUrl = config['product_url'].replace('<%UID%>', response.payload.token);
447
447
  }
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.keys");
4
+
5
+ require("core-js/modules/web.dom-collections.for-each");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ var _exportNames = {
11
+ server: true
12
+ };
13
+ Object.defineProperty(exports, "server", {
14
+ enumerable: true,
15
+ get: function get() {
16
+ return _server.server;
17
+ }
18
+ });
19
+
20
+ require("whatwg-fetch");
21
+
22
+ var _server = require("../mockServer/server");
23
+
24
+ var _msw = require("msw");
25
+
26
+ Object.keys(_msw).forEach(function (key) {
27
+ if (key === "default" || key === "__esModule") return;
28
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
29
+ if (key in exports && exports[key] === _msw[key]) return;
30
+ Object.defineProperty(exports, key, {
31
+ enumerable: true,
32
+ get: function get() {
33
+ return _msw[key];
34
+ }
35
+ });
36
+ });
37
+
38
+ /**
39
+ * Generic functions for the tests.
40
+ */
41
+ beforeAll(function () {
42
+ _server.server.listen();
43
+ });
44
+ afterEach(function () {
45
+ _server.server.resetHandlers();
46
+
47
+ _server.server.restoreHandlers();
48
+ });
49
+ afterAll(function () {
50
+ _server.server.close();
51
+ }); // re-export everything
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "2.1.18",
3
+ "version": "2.1.22",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",
@@ -54,6 +54,9 @@ export type ITpay = {
54
54
  tallymanApi:ITallyman;
55
55
  TPay:ITpay;
56
56
  tPayhash:string;
57
+ hostCountry?:string;
58
+ hostSlug?:string;
59
+ tid:string;
57
60
  }
58
61
 
59
62
  namespace NodeJS {
package/src/api/index.ts CHANGED
@@ -13,7 +13,7 @@ const bupperizeCountry = (c:string) => c == 'gb' ? 'uk' : c;
13
13
  export interface ITallyman {
14
14
  identify:(host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string)=>Promise<IIdentifyResult>
15
15
  triggerPin:(host: string, country: string, slug: string, device: string, offer: number, msisdn: string, rockmanId: string, extraParamsQs: string, search: string,uniqid?:string)=>Promise<IMSISDNSubmissionResult>;
16
- verifyPin:(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string, uniqid:string)=>Promise<IPINSubmissionResult>;
16
+ verifyPin:(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string, uniqid:string, evinaTid:string)=>Promise<IPINSubmissionResult>;
17
17
  checkSubscriptionByRockmanIdOnly:(host:string, rockmanId:string)=>Promise<ICheckSubscriptionResult>;
18
18
  checkSubscription:(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string)=>Promise<ICheckSubscriptionResult>;
19
19
  triggerMessage:(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, search:string, extraParamsQs:string)=>Promise<IMoMSISDNSubmissionResult>;
@@ -44,7 +44,7 @@ export const MockTallyman:ITallyman = {
44
44
  rockman_id: ""
45
45
  }
46
46
  },
47
- triggerPin:async(host: string, country: string, slug: string, device: string, offer: number, msisdn: string, rockmanId: string, extraParamsQs: string, search: string,uniqid?:string): Promise<IMSISDNSubmissionResult> =>{
47
+ triggerPin:async(host: string, country: string, slug: string, device: string, offer: number, msisdn: string, rockmanId: string, extraParamsQs: string, search: string,uniqid?:string, evinaTid?:string): Promise<IMSISDNSubmissionResult> =>{
48
48
  console.log("MockTallyman")
49
49
  sleep(2000);
50
50
  return {
@@ -132,9 +132,9 @@ export const MockTallyman:ITallyman = {
132
132
  "prodSku": "gamelords",
133
133
  "lang": "ar",
134
134
  "country": "eg",
135
- "subscription_url": "http:\/\/n.vidflixz.com\/tallyman\/v1\/?action=one-click-subscribe&device=smart&slug=tpay-he-vidflixz&country=eg&offerId=1&rockman_id=13643b4780fb40bb8adf2feb2a400d7f&",
135
+ "subscription_url": "http:\/\/de.tallymans.com\/tallyman\/v1\/?action=one-click-subscribe&device=smart&slug=tpay-he-vidflixz&country=eg&offerId=1&rockman_id=13643b4780fb40bb8adf2feb2a400d7f&",
136
136
  "config": {
137
- "product_url": "http:\/\/eg.game-lords.com\/#\/?uid=fdf098fcc6",
137
+ "product_url": "http:\/\/de.tallymans.com\/#\/?uid=fdf098fcc6",
138
138
  "subscription_plan_id": 829,
139
139
  "public": "HFyenUyCJCxl1QTgtVCA",
140
140
  "private": "vazlmVhGFyxKLOav6DvW",
@@ -145,7 +145,7 @@ export const MockTallyman:ITallyman = {
145
145
  "60203": "gamelords_etst"
146
146
  }
147
147
  },
148
- "redirectUrl": "http:\/\/n.game-lords.com\/eg\/animal-game?country=eg&handle=animal-game&offer=1&device=smart&_extracted=957ad26679cd47a09d4efe28d4a4af72&operator=#operator#&msisdnSubmitted=Y&network_type=mobile_data&atmobirun=true&force_mcb_page=true&skipTrigger=true",
148
+ "redirectUrl": "http:\/\/de.tallymans.com\/eg\/animal-game?country=eg&handle=animal-game&offer=1&device=smart&_extracted=957ad26679cd47a09d4efe28d4a4af72&operator=#operator#&msisdnSubmitted=Y&network_type=mobile_data&atmobirun=true&force_mcb_page=true&skipTrigger=true",
149
149
  "rid": "957ad26679cd47a09d4efe28d4a4af72",
150
150
  "success": true
151
151
  }
@@ -176,11 +176,11 @@ export const RealTallyman:ITallyman = {
176
176
  const newHost = isDMB ? "de.tallymans.com" : host;
177
177
  return await fetch(`https://${newHost}/tallyman/v1/?action=trigger-pin&country=${bupperizeCountry(country)}&slug=${slug}&device=${device}&offerId=${offer}&msisdn=${msisdn}&rockman_id=${rockmanId}${uniqid}${extraParamsQs}&${search}`).then(x => x.json());
178
178
  },
179
- verifyPin:async(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string, uniqid:string): Promise<IPINSubmissionResult> =>{
179
+ verifyPin:async(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string, uniqid:string, evinaTid:string): Promise<IPINSubmissionResult> =>{
180
180
  console.log("RealTallyman")
181
181
  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;
182
182
  const newHost = isDMB ? "de.tallymans.com" : host;
183
- return await fetch(`https://${newHost}/tallyman/v1/?action=verify-pin&country=${bupperizeCountry(country)}&slug=${slug}&device=${device}&offerId=${offer}&rockman_id=${rockmanId}&pin=${pin}${uniqid}${extraParamsQs}`).then(x => x.json())
183
+ return await fetch(`https://${newHost}/tallyman/v1/?action=verify-pin&country=${bupperizeCountry(country)}&slug=${slug}&device=${device}&offerId=${offer}&rockman_id=${rockmanId}&pin=${pin}${uniqid}&sam_evina_tid=${evinaTid}${extraParamsQs}`).then(x => x.json())
184
184
  },
185
185
  checkSubscription:async(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string): Promise<ICheckSubscriptionResult> =>{
186
186
  console.log("RealTallyman")
@@ -5,9 +5,10 @@ export default async function tryGetIPRangeName(visitor: IVisitor): Promise<stri
5
5
 
6
6
  const mockip = queryString(window.location.href, "mock-ip") || process.env.mock_ip;
7
7
  console.log("mockip", mockip)
8
- if (!visitor.ip) {
8
+ if (!visitor.ip && typeof window != "undefined") {
9
9
  try {
10
- const res = await fetch('https://c1.ouisys.com/api/v1/ip' + (!!mockip ? `?mock-ip=${mockip}` : "")).then(x => x.json())
10
+ const host = window.location.host
11
+ const res = await fetch(`https://${host}/api/v1/ip` + (!!mockip ? `?mock-ip=${mockip}` : "")).then(x => x.json())
11
12
  // return isIPInRange('37.200.146.28')
12
13
  visitor.ip = res.ip
13
14
  visitor.ip_range_name = res.ip_range_name
@@ -56,7 +56,7 @@ export default (window: Window, country?: string, page?: string): ITrackerFlowEv
56
56
 
57
57
  const pacmanClient = mkPacmanClient({
58
58
  rockmanId: window.pac_analytics.visitor.rockmanId,
59
- serverUrl: process.env.pacman_server, // check webpack.config.common.js //"https://de-pacman.sam-media.com/api/v2/mstore",
59
+ serverUrl: process.env.pacman_server,
60
60
  impressionNumber: 1,
61
61
  signalInterval: 1000 // in milliseconds
62
62
  });
@@ -124,6 +124,3 @@ export async function checkSubscription(window: Window, maybeConfig: IConfig): P
124
124
  throw error
125
125
  }
126
126
  }
127
-
128
- // {"success":true,"uid":"*5QADM","shortcode":"1901","keyword":"TIPS"}%
129
- // curl "http://w1.mozzi.com/spa-api/?country=gh&device=smart&slug=18plus-oc2sms&action=oc2sms"