ouisys-engine 2.1.20 → 2.1.25

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 (66) hide show
  1. package/dist/api/click2sms.js +357 -0
  2. package/dist/api/index.d.ts +1 -3
  3. package/dist/api/index.js +97 -173
  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/common-types/AppThunk.d.ts +1 -2
  12. package/dist/features/strategies/categories/askMobileNumber.js +395 -0
  13. package/dist/features/strategies/categories/askOperator.js +311 -0
  14. package/dist/features/strategies/categories/detectOperatorByIp.js +606 -0
  15. package/dist/features/strategies/categories/headerEnrichment.js +670 -0
  16. package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +12 -0
  17. package/dist/features/strategies/categories/typings/identifySliceTypes.js +22 -0
  18. package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +22 -0
  19. package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +21 -0
  20. package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +13 -0
  21. package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +13 -0
  22. package/dist/features/strategies/click2smsFlowSlice.js +172 -0
  23. package/dist/features/strategies/identifySlice.js +455 -0
  24. package/dist/features/strategies/moFlowSlice.js +196 -0
  25. package/dist/features/strategies/moRedirFlowSlice.js +190 -0
  26. package/dist/features/strategies/oneClickFlowSlice.js +277 -0
  27. package/dist/features/strategies/pinFlowSlice.js +313 -0
  28. package/dist/features/strategies/ussdFlowSlice.js +1 -0
  29. package/dist/flows/strategy.d.ts +1 -2
  30. package/dist/flows/strategy.js +1 -5
  31. package/dist/ips/tryGetIPRangeName.js +14 -13
  32. package/dist/mockServer/browser.js +48 -0
  33. package/dist/mockServer/handlers.js +22 -0
  34. package/dist/mockServer/server.js +48 -0
  35. package/dist/pacman/index.js +0 -1
  36. package/dist/reducers/click2smsFlow/utils.js +1 -3
  37. package/dist/reducers/moRedirFlow/utils.js +1 -1
  38. package/dist/reducers/oneClickFlow/utils.js +9 -8
  39. package/dist/reducers/pinFlow/utils.js +17 -16
  40. package/dist/reducers/strategy/utils.js +12 -13
  41. package/dist/reducers/tpayHeFlow/utils.js +1 -1
  42. package/dist/store/index.d.ts +1 -2
  43. package/dist/store/reducers.d.ts +0 -2
  44. package/dist/store/reducers.js +1 -4
  45. package/dist/test/setup.js +24 -0
  46. package/dist/test/test-utils.js +51 -0
  47. package/package.json +1 -1
  48. package/src/@types/window.d.ts +1 -0
  49. package/src/api/index.ts +8 -41
  50. package/src/common-types/AppThunk.ts +1 -2
  51. package/src/flows/strategy.ts +1 -5
  52. package/src/ips/tryGetIPRangeName.ts +3 -2
  53. package/src/pacman/index.ts +1 -1
  54. package/src/reducers/click2smsFlow/utils.ts +0 -3
  55. package/src/reducers/moRedirFlow/utils.ts +1 -1
  56. package/src/reducers/oneClickFlow/utils.ts +4 -3
  57. package/src/reducers/pinFlow/utils.ts +4 -2
  58. package/src/reducers/strategy/utils.ts +2 -3
  59. package/src/store/index.ts +1 -2
  60. package/src/store/reducers.ts +1 -5
  61. package/yarn.lock +5204 -0
  62. package/src/flows/tpayHeFlow.ts +0 -20
  63. package/src/reducers/tpayHeFlow/ITpayHeConstants.ts +0 -7
  64. package/src/reducers/tpayHeFlow/TpayHeTypes.ts +0 -135
  65. package/src/reducers/tpayHeFlow/index.ts +0 -207
  66. package/src/reducers/tpayHeFlow/utils.ts +0 -311
@@ -398,7 +398,7 @@ function submitPIN(_x16, _x17, _x18, _x19) {
398
398
 
399
399
  function _submitPIN() {
400
400
  _submitPIN = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(window, pin, config, extraParams) {
401
- 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;
402
402
 
403
403
  return regeneratorRuntime.wrap(function _callee6$(_context6) {
404
404
  while (1) {
@@ -427,14 +427,15 @@ function _submitPIN() {
427
427
 
428
428
  case 9:
429
429
  uniqid = uniqidResult != "" ? "&mcpUniqid=".concat(uniqidResult) : '';
430
- _context6.next = 12;
431
- 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);
432
433
 
433
- case 12:
434
+ case 13:
434
435
  pinResult = _context6.sent;
435
436
 
436
437
  if (!(false === pinResult.success)) {
437
- _context6.next = 19;
438
+ _context6.next = 20;
438
439
  break;
439
440
  }
440
441
 
@@ -442,9 +443,9 @@ function _submitPIN() {
442
443
  pinError['type'] = "InvalidPIN";
443
444
  throw pinError;
444
445
 
445
- case 19:
446
+ case 20:
446
447
  if (!(true === pinResult.async)) {
447
- _context6.next = 34;
448
+ _context6.next = 35;
448
449
  break;
449
450
  }
450
451
 
@@ -452,16 +453,16 @@ function _submitPIN() {
452
453
  return window.tallymanApi.checkSubscription(host, country, slug, device, offer, rockmanId, pin, extraParamsQs);
453
454
  };
454
455
 
455
- _context6.next = 23;
456
+ _context6.next = 24;
456
457
  return (0, _utils.loop)(check, 30, function (r) {
457
458
  return r.success;
458
459
  }, 0);
459
460
 
460
- case 23:
461
+ case 24:
461
462
  checkResult = _context6.sent;
462
463
 
463
464
  if (!(true === checkResult.success)) {
464
- _context6.next = 29;
465
+ _context6.next = 30;
465
466
  break;
466
467
  }
467
468
 
@@ -471,23 +472,23 @@ function _submitPIN() {
471
472
  isAlreadySubscribed: isAlreadySubscribed
472
473
  });
473
474
 
474
- case 29:
475
+ case 30:
475
476
  _pinError = new Error("Error in submitMSISDN() verify-pin action:\n".concat(checkResult.message));
476
477
  _pinError['type'] = "InvalidPIN";
477
478
  throw _pinError;
478
479
 
479
- case 32:
480
- _context6.next = 36;
480
+ case 33:
481
+ _context6.next = 37;
481
482
  break;
482
483
 
483
- case 34:
484
+ case 35:
484
485
  _isAlreadySubscribed = pinResult.message == "ALREADY SUBSCRIBED" ? true : false;
485
486
  return _context6.abrupt("return", {
486
487
  productUrl: pinResult.product_url || null,
487
488
  isAlreadySubscribed: _isAlreadySubscribed
488
489
  });
489
490
 
490
- case 36:
491
+ case 37:
491
492
  case "end":
492
493
  return _context6.stop();
493
494
  }
@@ -515,7 +516,7 @@ var mockedCompletedState = {
515
516
  currentState: {
516
517
  type: "PINEntry",
517
518
  result: RDS.Success({
518
- finalUrl: "https://www.yahoo.com/"
519
+ finalUrl: "/mock-product-url"
519
520
  }),
520
521
  data: {
521
522
  actualPIN: "",
@@ -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
  }
@@ -571,7 +570,7 @@ var subscribe = /*#__PURE__*/function () {
571
570
  while (1) {
572
571
  switch (_context3.prev = _context3.next) {
573
572
  case 0:
574
- return _context3.abrupt("return", "www.yahoo.com");
573
+ return _context3.abrupt("return", "/mock-product-url");
575
574
 
576
575
  case 1:
577
576
  case "end":
@@ -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
  }
@@ -6,8 +6,7 @@ import { IUssdActions } from "../reducers/ussdFlow/UssdTypes";
6
6
  import { IMoRedirActions } from "../reducers/moRedirFlow/MoRedirTypes";
7
7
  import { IOneClickActions } from "../reducers/oneClickFlow/OneClickTypes";
8
8
  import { IClick2SmsActions } from "../reducers/click2smsFlow/Click2smsTypes";
9
- import { ITpayHeActions } from "../reducers/tpayHeFlow/TpayHeTypes";
10
- export declare type IApplicationActions = IStrategyActions | IPinActions | IMoActions | IMoRedirActions | IOneClickActions | IClick2SmsActions | IUssdActions | ITpayHeActions;
9
+ export declare type IApplicationActions = IStrategyActions | IPinActions | IMoActions | IMoRedirActions | IOneClickActions | IClick2SmsActions | IUssdActions;
11
10
  declare const store: import("redux").Store<import("redux").EmptyObject & IApplicationState, import("redux").AnyAction> & {
12
11
  dispatch: import("redux-thunk").ThunkDispatch<IApplicationState, undefined, IApplicationActions>;
13
12
  };
@@ -5,7 +5,6 @@ import { IMoRedirFlowReducerState } from "../reducers/moRedirFlow/MoRedirTypes";
5
5
  import { IOneClickFlowReducerState } from "../reducers/oneClickFlow/OneClickTypes";
6
6
  import { IClick2smsFlowReducerState } from "../reducers/click2smsFlow/Click2smsTypes";
7
7
  import { IUssdFlowReducerState } from "../reducers/ussdFlow/UssdTypes";
8
- import { ITpayHeFlowReducerState } from "../reducers/tpayHeFlow/TpayHeTypes";
9
8
  export interface IApplicationState {
10
9
  strategy: IStrategyReducerState;
11
10
  pinFlow: IPinFlowReducerState;
@@ -14,7 +13,6 @@ export interface IApplicationState {
14
13
  oneClickFlow: IOneClickFlowReducerState;
15
14
  click2smsFlow: IClick2smsFlowReducerState;
16
15
  ussdFlow: IUssdFlowReducerState;
17
- tpayHeFlow: ITpayHeFlowReducerState;
18
16
  }
19
17
  declare const _default: () => import("redux").Reducer<import("redux").CombinedState<IApplicationState>, import("redux").AnyAction>;
20
18
  export default _default;
@@ -21,8 +21,6 @@ var _click2smsFlow = _interopRequireDefault(require("../reducers/click2smsFlow")
21
21
 
22
22
  var _ussdFlow = _interopRequireDefault(require("../reducers/ussdFlow"));
23
23
 
24
- var _tpayHeFlow = _interopRequireDefault(require("../reducers/tpayHeFlow"));
25
-
26
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
25
 
28
26
  var _default = function _default() {
@@ -33,8 +31,7 @@ var _default = function _default() {
33
31
  moRedirFlow: _moRedirFlow.default,
34
32
  oneClickFlow: _oneClickFlow.default,
35
33
  click2smsFlow: _click2smsFlow.default,
36
- ussdFlow: _ussdFlow.default,
37
- tpayHeFlow: _tpayHeFlow.default
34
+ ussdFlow: _ussdFlow.default
38
35
  });
39
36
  };
40
37
 
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.array.includes");
4
+
5
+ require("core-js/modules/es.string.includes");
6
+
7
+ require("whatwg-fetch");
8
+
9
+ // Jenkins seems to have installed a custom certificate which causes the logs to be poluted
10
+ // This little hack fixes that
11
+ var logErr = console.error; // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+
13
+ console.error = function (message) {
14
+ if (message && message.includes('ERR_TLS_CERT_ALTNAME_INVALID')) return;
15
+
16
+ for (var _len = arguments.length, optionalParams = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
17
+ optionalParams[_key - 1] = arguments[_key];
18
+ }
19
+
20
+ logErr(message, optionalParams);
21
+ };
22
+
23
+ jest.mock('../auth/authHandler');
24
+ global.scrollTo = jest.fn();
@@ -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.20",
3
+ "version": "2.1.25",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",
@@ -56,6 +56,7 @@ export type ITpay = {
56
56
  tPayhash:string;
57
57
  hostCountry?:string;
58
58
  hostSlug?:string;
59
+ tid:string;
59
60
  }
60
61
 
61
62
  namespace NodeJS {
package/src/api/index.ts CHANGED
@@ -6,21 +6,19 @@ import { IMSISDNSubmissionResult as IMoMSISDNSubmissionResult } from "../reducer
6
6
  import IError from "../common-types/IError";
7
7
  import { IIdentifyResult } from "../reducers/strategy/StrategyTypes";
8
8
  import { IFetchResult } from "../reducers/click2smsFlow/Click2smsTypes";
9
- import { ITpayConsentResult } from "../reducers/TpayHeFlow/TpayHeTypes";
10
9
 
11
10
  const bupperizeCountry = (c:string) => c == 'gb' ? 'uk' : c;
12
11
 
13
12
  export interface ITallyman {
14
13
  identify:(host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string)=>Promise<IIdentifyResult>
15
14
  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>;
15
+ verifyPin:(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string, uniqid:string, evinaTid:string)=>Promise<IPINSubmissionResult>;
17
16
  checkSubscriptionByRockmanIdOnly:(host:string, rockmanId:string)=>Promise<ICheckSubscriptionResult>;
18
17
  checkSubscription:(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string)=>Promise<ICheckSubscriptionResult>;
19
18
  triggerMessage:(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, search:string, extraParamsQs:string)=>Promise<IMoMSISDNSubmissionResult>;
20
19
  redirect:(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, ip_range_name:string, search:string, extraParamsQs:string)=>Promise<IMoRedirMSISDNSubmissionResult>;
21
20
  ussd:(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, search:string, extraParamsQs:string)=>Promise<IMoMSISDNSubmissionResult>;
22
21
  oc2sms:(host: string, country:string, slug:string, offer:number, rockmanId:string, keyword:string, operator:string, search:string)=>Promise<IFetchResult>;
23
- tpayConsentConfig:(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, search: string)=>Promise<ITpayConsentResult>;
24
22
  mcpShield:(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, operator?:string, uniqid?:string)=>Promise<IMcpShieldResult>;
25
23
  }
26
24
 
@@ -44,7 +42,7 @@ export const MockTallyman:ITallyman = {
44
42
  rockman_id: ""
45
43
  }
46
44
  },
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> =>{
45
+ 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
46
  console.log("MockTallyman")
49
47
  sleep(2000);
50
48
  return {
@@ -61,7 +59,7 @@ export const MockTallyman:ITallyman = {
61
59
  return {
62
60
  success: true,
63
61
  rockman_id: "000",
64
- product_url: "https://www.yahoo.com/",
62
+ product_url: "/mock-product-url",
65
63
  async: false
66
64
  }
67
65
  },
@@ -71,7 +69,7 @@ export const MockTallyman:ITallyman = {
71
69
  return {
72
70
  success: true,
73
71
  rockman_id: "000",
74
- product_url: "https://www.yahoo.com/",
72
+ product_url: "/mock-product-url",
75
73
  msisdn:"000"
76
74
  }
77
75
  },
@@ -81,7 +79,7 @@ export const MockTallyman:ITallyman = {
81
79
  return {
82
80
  success: true,
83
81
  rockman_id: "000",
84
- product_url: "https://www.yahoo.com/",
82
+ product_url: "/mock-product-url",
85
83
  msisdn:"000"
86
84
  }
87
85
  },
@@ -91,7 +89,7 @@ export const MockTallyman:ITallyman = {
91
89
  return {
92
90
  success: true,
93
91
  rockman_id: "000",
94
- redirect_url: "https://www.yahoo.com/"
92
+ redirect_url: "/mock-product-url"
95
93
  }
96
94
  },
97
95
  triggerMessage:async(host:string, slug:string, country:string, msisdn:string, device:string, offer:number, rockmanId:string, search:string, extraParamsQs:string): Promise<IMoMSISDNSubmissionResult> =>{
@@ -125,31 +123,6 @@ export const MockTallyman:ITallyman = {
125
123
  shortcode: '666'
126
124
  }
127
125
  },
128
- tpayConsentConfig:async(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, search: string): Promise<ITpayConsentResult>=> {
129
- console.log("MockTallyman")
130
- sleep(2000);
131
- return {
132
- "prodSku": "gamelords",
133
- "lang": "ar",
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&",
136
- "config": {
137
- "product_url": "http:\/\/eg.game-lords.com\/#\/?uid=fdf098fcc6",
138
- "subscription_plan_id": 829,
139
- "public": "HFyenUyCJCxl1QTgtVCA",
140
- "private": "vazlmVhGFyxKLOav6DvW",
141
- "flow": "consent",
142
- "catalog_name": {
143
- "60201": "gamelords_org",
144
- "60202": "gamelords_vdf",
145
- "60203": "gamelords_etst"
146
- }
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",
149
- "rid": "957ad26679cd47a09d4efe28d4a4af72",
150
- "success": true
151
- }
152
- },
153
126
  mcpShield:async(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, operator?:string,): Promise<IMcpShieldResult>=> {
154
127
  console.log("MockTallyman")
155
128
  sleep(2000);
@@ -176,11 +149,11 @@ export const RealTallyman:ITallyman = {
176
149
  const newHost = isDMB ? "de.tallymans.com" : host;
177
150
  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
151
  },
179
- verifyPin:async(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string, uniqid:string): Promise<IPINSubmissionResult> =>{
152
+ 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
153
  console.log("RealTallyman")
181
154
  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
155
  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())
156
+ 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
157
  },
185
158
  checkSubscription:async(host:string, country:string, slug:string, device:string, offer:number, rockmanId:string, pin:string, extraParamsQs:string): Promise<ICheckSubscriptionResult> =>{
186
159
  console.log("RealTallyman")
@@ -218,12 +191,6 @@ export const RealTallyman:ITallyman = {
218
191
  const newHost = isDMB ? "de.tallymans.com" : host;
219
192
  return await fetch(`https://${newHost}/tallyman/v1/?action=oc2sms&country=${country}&slug=${slug}&offerId=${offer}${!!keyword ? '&keyword=' + keyword : ''}&device=smart&rockman_id=${rockmanId}${!!operator ? '&operator=' + operator : ''}&${search}`).then(x => x.json())
220
193
  },
221
- tpayConsentConfig:async(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, search: string): Promise<ITpayConsentResult>=> {
222
- console.log("RealTallyman")
223
- 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;
224
- const newHost = isDMB ? "de.tallymans.com" : host;
225
- return await fetch(`https://${newHost}/tallyman/helper/?action=tpay-consent-config&country=${country}&slug=${slug}&device=${device}&offerId=${offer}&device=smart&rockman_id=${rockmanId}&${search}`).then(x => x.json())
226
- },
227
194
  mcpShield:async(host: string, country: string, slug: string, device:string, offer: number, rockmanId: string, operator?:string, uniqid?:string): Promise<IMcpShieldResult>=> {
228
195
  console.log("RealTallyman")
229
196
  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;
@@ -8,9 +8,8 @@ import IMoRedirConstants from "../reducers/moRedirFlow/IMoRedirConstants";
8
8
  import IOneClickConstants from "../reducers/oneClickFlow/IOneClickConstants";
9
9
  import IClick2smsConstants from "../reducers/click2smsFlow/IClick2smsConstants";
10
10
  import IUssdConstants from "../reducers/ussdFlow/IUssdConstants";
11
- import ITpayHeConstants from "../reducers/tpayHeFlow/ITpayHeConstants";
12
11
 
13
- type IAllActionConstants = IStategyActionContants | IPinConstants | IMoConstants | IMoRedirConstants | IOneClickConstants | IClick2smsConstants | IUssdConstants | ITpayHeConstants;
12
+ type IAllActionConstants = IStategyActionContants | IPinConstants | IMoConstants | IMoRedirConstants | IOneClickConstants | IClick2smsConstants | IUssdConstants;
14
13
 
15
14
  export type AppThunk<ReturnType = void> = ThunkAction<
16
15
  ReturnType,
@@ -12,8 +12,7 @@ function strategy<R>(
12
12
  moRedirFlow,
13
13
  oneClickFlow,
14
14
  click2smsFlow,
15
- ussdFlow,
16
- tpayHeFlow
15
+ ussdFlow
17
16
  }:
18
17
  {
19
18
  identifyFlowByOperatorSelect: (data: OPERATORSelectFlowIdentifySuccess) => R,
@@ -24,7 +23,6 @@ function strategy<R>(
24
23
  oneClickFlow: (data: IdentifyFlowOptionsResult<"getRedirectUrlAction">) => R
25
24
  click2smsFlow: (data: IdentifyFlowOptionsResult<"loadOc2sms">) => R,
26
25
  ussdFlow: (data: IdentifyFlowOptionsResult<"submitMSISDNAction">) => R,
27
- tpayHeFlow: (data: IdentifyFlowOptionsResult<"loadTpayAction">) => R,
28
26
  }): (state: IStrategyCurrentState) => R {
29
27
 
30
28
 
@@ -46,8 +44,6 @@ function strategy<R>(
46
44
  return click2smsFlow(state.result);
47
45
  case 'USSD':
48
46
  return ussdFlow(state.result);
49
- case 'TPAY_HE':
50
- return tpayHeFlow(state.result);
51
47
  }
52
48
  }
53
49
  }
@@ -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"
@@ -39,7 +39,7 @@ export const mockedMSISDNEntrySuccess : IMoRedirFlowReducerState = {
39
39
  currentState:{
40
40
  type: "MSISDNEntry",
41
41
  result: RDS.Success<MSISDNEntryFailure, MSISDNEntrySuccess>({
42
- href: 'https://www.yahoo.com/'
42
+ href: '/mock-product-url'
43
43
  })
44
44
  }
45
45
  }
@@ -95,10 +95,11 @@ export const getRedirectUrl = async(window:Window, maybeConfig: IConfig, extraP
95
95
 
96
96
 
97
97
  export const subscribe:(url:string, extraParams?:IHash)=>Promise<string> = async(url:string, extraParams?:IHash)=>{
98
-
98
+ const evinaTid = (typeof window != "undefined" && window.tid) ? window.tid : "";
99
99
  const extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(k => `${k}=${extraParams[k]}`).join('&')
100
100
 
101
- const result:ISubscribeResult = await fetch(url + extraParamsQs).then((x)=>x.json())
101
+
102
+ const result:ISubscribeResult = await fetch(`${url}&sam_evina_tid=${evinaTid}${extraParamsQs}`).then((x)=>x.json())
102
103
 
103
104
  if(false === result.success){
104
105
  const subscribeError = new Error(`Error in subscribe() one-click-subscribe action:\n${result.message}`) as {productUrl:string} & IError;
@@ -136,7 +137,7 @@ export const mockedRedirectUrlSuccessState : IOneClickFlowReducerState = {
136
137
  currentState:{
137
138
  type: "GET_REDIRECT_URL",
138
139
  //@ts-ignore
139
- result: RDS.Success<IGETREDIRECTURLFailure, IGETREDIRECTURLSuccess>({redirectUrl: 'https://www.yahoo.com/'})
140
+ result: RDS.Success<IGETREDIRECTURLFailure, IGETREDIRECTURLSuccess>({redirectUrl: '/mock-product-url'})
140
141
  }
141
142
  }
142
143
 
@@ -171,7 +171,9 @@ export async function submitPIN(window:Window, pin: string, config:IConfig, extr
171
171
  throw emptyPinError
172
172
  }
173
173
  const uniqid = uniqidResult != "" ? `&mcpUniqid=${uniqidResult}` : '';
174
- const pinResult: IPINSubmissionResult = await window.tallymanApi.verifyPin(host, country, slug, device, offer, rockmanId, pin, extraParamsQs, uniqid)
174
+ const evinaTid = (typeof window != "undefined" && window.tid) ? window.tid : "";
175
+
176
+ const pinResult: IPINSubmissionResult = await window.tallymanApi.verifyPin(host, country, slug, device, offer, rockmanId, pin, extraParamsQs, uniqid, evinaTid)
175
177
  if (false === pinResult.success) {
176
178
  const pinError = new Error(`Error in submitMSISDN() verify-pin action:\n${pinResult.message}`) as IError & {type:string}
177
179
  pinError['type'] = "InvalidPIN";
@@ -216,7 +218,7 @@ export const mockedPINState : IPinFlowReducerState = {
216
218
  export const mockedCompletedState : IPinFlowReducerState = {
217
219
  currentState:{
218
220
  type: "PINEntry",
219
- result: RDS.Success<PINEntryFailure, PINEntrySuccess>({finalUrl:"https://www.yahoo.com/"}),
221
+ result: RDS.Success<PINEntryFailure, PINEntrySuccess>({finalUrl:"/mock-product-url"}),
220
222
  data:{
221
223
  actualPIN: "",
222
224
  nextAction: "submitPinAction",
@@ -225,7 +225,6 @@ export const identifyUser = async(extraParams?:ILinkExtraParams):
225
225
  return {redirect_url, msisdn:msisdn, operator:operator}
226
226
  }
227
227
  }else{
228
- console.log("newUrl",window.location.href)
229
228
  const newUrl = new URL(window.location.href);
230
229
  const queryString = newUrl.search;
231
230
  const urlParams = new URLSearchParams(queryString);
@@ -237,7 +236,7 @@ export const identifyUser = async(extraParams?:ILinkExtraParams):
237
236
 
238
237
  }
239
238
  }else{
240
- const url = `https://${newHost}/tallyman/v1/?action=identify-user&country=${bupperizeCountry(country)}&slug=${slug}&device=${device}&offerId=${offer}&page=${window.location.href}&pixel_url=${encodeURIComponent(`http://c1.ouisys.com/pixels?xcid=${window.location.pathname.replace("/", "")}&xaid=${window.pac_analytics.visitor.xaid}&country=${bupperizeCountry(country)}`)}&rockman_id=${rockmanId}${extraParamsQs}&${search}`
239
+ const url = `https://${newHost}/tallyman/v1/?action=identify-user&country=${bupperizeCountry(country)}&slug=${slug}&device=${device}&offerId=${offer}&page=${window.location.href}&pixel_url=${encodeURIComponent(`http://${window.location.host}/pixels?xcid=${window.location.pathname.replace("/", "")}&xaid=${window.pac_analytics.visitor.xaid}&country=${bupperizeCountry(country)}`)}&rockman_id=${rockmanId}${extraParamsQs}&${search}`
241
240
 
242
241
  const result = await fetchJsonp<IStrategyIDentifyUserResult>(url);
243
242
  if(false === result.success){
@@ -261,7 +260,7 @@ export const subscribe:(url:string)=>Promise<string> = async(url:string)=>{
261
260
  // subscribeError['type'] = "SubscriptionError";
262
261
  // throw subscribeError
263
262
  // }else{
264
- return "www.yahoo.com"
263
+ return "/mock-product-url"
265
264
  //}
266
265
 
267
266
  }
@@ -13,10 +13,9 @@ import { IMoRedirActions } from "../reducers/moRedirFlow/MoRedirTypes";
13
13
  import { IOneClickActions } from "../reducers/oneClickFlow/OneClickTypes";
14
14
  import { RealTallyman, MockTallyman } from "../api";
15
15
  import { IClick2SmsActions } from "../reducers/click2smsFlow/Click2smsTypes";
16
- import { ITpayHeActions } from "../reducers/tpayHeFlow/TpayHeTypes";
17
16
  import { getConfig, getOperators } from "../reducers/strategy/utils";
18
17
 
19
- export type IApplicationActions = IStrategyActions | IPinActions | IMoActions | IMoRedirActions | IOneClickActions | IClick2SmsActions | IUssdActions | ITpayHeActions;
18
+ export type IApplicationActions = IStrategyActions | IPinActions | IMoActions | IMoRedirActions | IOneClickActions | IClick2SmsActions | IUssdActions;
20
19
 
21
20
  const log = createLogger({ diff: true, collapsed: true });
22
21