ouisys-engine 2.1.17 → 2.1.21

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.
@@ -7,7 +7,7 @@ import { ITpayConsentResult } from "../reducers/TpayHeFlow/TpayHeTypes";
7
7
  export interface ITallyman {
8
8
  identify: (host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string) => Promise<IIdentifyResult>;
9
9
  triggerPin: (host: string, country: string, slug: string, device: string, offer: number, msisdn: string, rockmanId: string, extraParamsQs: string, search: string, uniqid?: string) => Promise<IMSISDNSubmissionResult>;
10
- verifyPin: (host: string, country: string, slug: string, device: string, offer: number, rockmanId: string, pin: string, extraParamsQs: string, uniqid: string) => Promise<IPINSubmissionResult>;
10
+ verifyPin: (host: string, country: string, slug: string, device: string, offer: number, rockmanId: string, pin: string, extraParamsQs: string, uniqid: string, evinaTid: string) => Promise<IPINSubmissionResult>;
11
11
  checkSubscriptionByRockmanIdOnly: (host: string, rockmanId: string) => Promise<ICheckSubscriptionResult>;
12
12
  checkSubscription: (host: string, country: string, slug: string, device: string, offer: number, rockmanId: string, pin: string, extraParamsQs: string) => Promise<ICheckSubscriptionResult>;
13
13
  triggerMessage: (host: string, slug: string, country: string, msisdn: string, device: string, offer: number, rockmanId: string, search: string, extraParamsQs: string) => Promise<IMoMSISDNSubmissionResult>;
package/dist/api/index.js CHANGED
@@ -61,7 +61,7 @@ var MockTallyman = {
61
61
  return identify;
62
62
  }(),
63
63
  triggerPin: function () {
64
- var _triggerPin = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(host, country, slug, device, offer, msisdn, rockmanId, extraParamsQs, search, uniqid) {
64
+ var _triggerPin = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(host, country, slug, device, offer, msisdn, rockmanId, extraParamsQs, search, uniqid, evinaTid) {
65
65
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
66
66
  while (1) {
67
67
  switch (_context2.prev = _context2.next) {
@@ -84,7 +84,7 @@ var MockTallyman = {
84
84
  }, _callee2);
85
85
  }));
86
86
 
87
- function triggerPin(_x8, _x9, _x10, _x11, _x12, _x13, _x14, _x15, _x16, _x17) {
87
+ function triggerPin(_x8, _x9, _x10, _x11, _x12, _x13, _x14, _x15, _x16, _x17, _x18) {
88
88
  return _triggerPin.apply(this, arguments);
89
89
  }
90
90
 
@@ -113,7 +113,7 @@ var MockTallyman = {
113
113
  }, _callee3);
114
114
  }));
115
115
 
116
- function verifyPin(_x18, _x19, _x20, _x21, _x22, _x23, _x24, _x25, _x26) {
116
+ function verifyPin(_x19, _x20, _x21, _x22, _x23, _x24, _x25, _x26, _x27) {
117
117
  return _verifyPin.apply(this, arguments);
118
118
  }
119
119
 
@@ -142,7 +142,7 @@ var MockTallyman = {
142
142
  }, _callee4);
143
143
  }));
144
144
 
145
- function checkSubscription(_x27, _x28, _x29, _x30, _x31, _x32, _x33, _x34) {
145
+ function checkSubscription(_x28, _x29, _x30, _x31, _x32, _x33, _x34, _x35) {
146
146
  return _checkSubscription.apply(this, arguments);
147
147
  }
148
148
 
@@ -171,7 +171,7 @@ var MockTallyman = {
171
171
  }, _callee5);
172
172
  }));
173
173
 
174
- function checkSubscriptionByRockmanIdOnly(_x35, _x36) {
174
+ function checkSubscriptionByRockmanIdOnly(_x36, _x37) {
175
175
  return _checkSubscriptionByRockmanIdOnly.apply(this, arguments);
176
176
  }
177
177
 
@@ -199,7 +199,7 @@ var MockTallyman = {
199
199
  }, _callee6);
200
200
  }));
201
201
 
202
- function redirect(_x37, _x38, _x39, _x40, _x41, _x42, _x43, _x44, _x45, _x46) {
202
+ function redirect(_x38, _x39, _x40, _x41, _x42, _x43, _x44, _x45, _x46, _x47) {
203
203
  return _redirect.apply(this, arguments);
204
204
  }
205
205
 
@@ -228,7 +228,7 @@ var MockTallyman = {
228
228
  }, _callee7);
229
229
  }));
230
230
 
231
- function triggerMessage(_x47, _x48, _x49, _x50, _x51, _x52, _x53, _x54, _x55) {
231
+ function triggerMessage(_x48, _x49, _x50, _x51, _x52, _x53, _x54, _x55, _x56) {
232
232
  return _triggerMessage.apply(this, arguments);
233
233
  }
234
234
 
@@ -257,7 +257,7 @@ var MockTallyman = {
257
257
  }, _callee8);
258
258
  }));
259
259
 
260
- function ussd(_x56, _x57, _x58, _x59, _x60, _x61, _x62, _x63, _x64) {
260
+ function ussd(_x57, _x58, _x59, _x60, _x61, _x62, _x63, _x64, _x65) {
261
261
  return _ussd.apply(this, arguments);
262
262
  }
263
263
 
@@ -287,7 +287,7 @@ var MockTallyman = {
287
287
  }, _callee9);
288
288
  }));
289
289
 
290
- function oc2sms(_x65, _x66, _x67, _x68, _x69, _x70, _x71, _x72) {
290
+ function oc2sms(_x66, _x67, _x68, _x69, _x70, _x71, _x72, _x73) {
291
291
  return _oc2sms.apply(this, arguments);
292
292
  }
293
293
 
@@ -331,7 +331,7 @@ var MockTallyman = {
331
331
  }, _callee10);
332
332
  }));
333
333
 
334
- function tpayConsentConfig(_x73, _x74, _x75, _x76, _x77, _x78, _x79) {
334
+ function tpayConsentConfig(_x74, _x75, _x76, _x77, _x78, _x79, _x80) {
335
335
  return _tpayConsentConfig.apply(this, arguments);
336
336
  }
337
337
 
@@ -360,7 +360,7 @@ var MockTallyman = {
360
360
  }, _callee11);
361
361
  }));
362
362
 
363
- function mcpShield(_x80, _x81, _x82, _x83, _x84, _x85, _x86) {
363
+ function mcpShield(_x81, _x82, _x83, _x84, _x85, _x86, _x87) {
364
364
  return _mcpShield.apply(this, arguments);
365
365
  }
366
366
 
@@ -395,7 +395,7 @@ var RealTallyman = {
395
395
  }, _callee12);
396
396
  }));
397
397
 
398
- function identify(_x87, _x88, _x89, _x90, _x91, _x92, _x93) {
398
+ function identify(_x88, _x89, _x90, _x91, _x92, _x93, _x94) {
399
399
  return _identify2.apply(this, arguments);
400
400
  }
401
401
 
@@ -427,14 +427,14 @@ var RealTallyman = {
427
427
  }, _callee13);
428
428
  }));
429
429
 
430
- function triggerPin(_x94, _x95, _x96, _x97, _x98, _x99, _x100, _x101, _x102, _x103) {
430
+ function triggerPin(_x95, _x96, _x97, _x98, _x99, _x100, _x101, _x102, _x103, _x104) {
431
431
  return _triggerPin2.apply(this, arguments);
432
432
  }
433
433
 
434
434
  return triggerPin;
435
435
  }(),
436
436
  verifyPin: function () {
437
- var _verifyPin2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14(host, country, slug, device, offer, rockmanId, pin, extraParamsQs, uniqid) {
437
+ var _verifyPin2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14(host, country, slug, device, offer, rockmanId, pin, extraParamsQs, uniqid, evinaTid) {
438
438
  var isDMB, newHost;
439
439
  return regeneratorRuntime.wrap(function _callee14$(_context14) {
440
440
  while (1) {
@@ -444,7 +444,7 @@ var RealTallyman = {
444
444
  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;
445
445
  newHost = isDMB ? "de.tallymans.com" : host;
446
446
  _context14.next = 5;
447
- return fetch("https://".concat(newHost, "/tallyman/v1/?action=verify-pin&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=").concat(device, "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId, "&pin=").concat(pin).concat(uniqid).concat(extraParamsQs)).then(function (x) {
447
+ return fetch("https://".concat(newHost, "/tallyman/v1/?action=verify-pin&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=").concat(device, "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId, "&pin=").concat(pin).concat(uniqid, "&sam_evina_tid=").concat(evinaTid).concat(extraParamsQs)).then(function (x) {
448
448
  return x.json();
449
449
  });
450
450
 
@@ -459,7 +459,7 @@ var RealTallyman = {
459
459
  }, _callee14);
460
460
  }));
461
461
 
462
- function verifyPin(_x104, _x105, _x106, _x107, _x108, _x109, _x110, _x111, _x112) {
462
+ function verifyPin(_x105, _x106, _x107, _x108, _x109, _x110, _x111, _x112, _x113, _x114) {
463
463
  return _verifyPin2.apply(this, arguments);
464
464
  }
465
465
 
@@ -491,7 +491,7 @@ var RealTallyman = {
491
491
  }, _callee15);
492
492
  }));
493
493
 
494
- function checkSubscription(_x113, _x114, _x115, _x116, _x117, _x118, _x119, _x120) {
494
+ function checkSubscription(_x115, _x116, _x117, _x118, _x119, _x120, _x121, _x122) {
495
495
  return _checkSubscription2.apply(this, arguments);
496
496
  }
497
497
 
@@ -523,7 +523,7 @@ var RealTallyman = {
523
523
  }, _callee16);
524
524
  }));
525
525
 
526
- function checkSubscriptionByRockmanIdOnly(_x121, _x122) {
526
+ function checkSubscriptionByRockmanIdOnly(_x123, _x124) {
527
527
  return _checkSubscriptionByRockmanIdOnly2.apply(this, arguments);
528
528
  }
529
529
 
@@ -555,7 +555,7 @@ var RealTallyman = {
555
555
  }, _callee17);
556
556
  }));
557
557
 
558
- function redirect(_x123, _x124, _x125, _x126, _x127, _x128, _x129, _x130, _x131, _x132) {
558
+ function redirect(_x125, _x126, _x127, _x128, _x129, _x130, _x131, _x132, _x133, _x134) {
559
559
  return _redirect2.apply(this, arguments);
560
560
  }
561
561
 
@@ -587,7 +587,7 @@ var RealTallyman = {
587
587
  }, _callee18);
588
588
  }));
589
589
 
590
- function triggerMessage(_x133, _x134, _x135, _x136, _x137, _x138, _x139, _x140, _x141) {
590
+ function triggerMessage(_x135, _x136, _x137, _x138, _x139, _x140, _x141, _x142, _x143) {
591
591
  return _triggerMessage2.apply(this, arguments);
592
592
  }
593
593
 
@@ -619,7 +619,7 @@ var RealTallyman = {
619
619
  }, _callee19);
620
620
  }));
621
621
 
622
- function ussd(_x142, _x143, _x144, _x145, _x146, _x147, _x148, _x149, _x150) {
622
+ function ussd(_x144, _x145, _x146, _x147, _x148, _x149, _x150, _x151, _x152) {
623
623
  return _ussd2.apply(this, arguments);
624
624
  }
625
625
 
@@ -651,7 +651,7 @@ var RealTallyman = {
651
651
  }, _callee20);
652
652
  }));
653
653
 
654
- function oc2sms(_x151, _x152, _x153, _x154, _x155, _x156, _x157, _x158) {
654
+ function oc2sms(_x153, _x154, _x155, _x156, _x157, _x158, _x159, _x160) {
655
655
  return _oc2sms2.apply(this, arguments);
656
656
  }
657
657
 
@@ -683,7 +683,7 @@ var RealTallyman = {
683
683
  }, _callee21);
684
684
  }));
685
685
 
686
- function tpayConsentConfig(_x159, _x160, _x161, _x162, _x163, _x164, _x165) {
686
+ function tpayConsentConfig(_x161, _x162, _x163, _x164, _x165, _x166, _x167) {
687
687
  return _tpayConsentConfig2.apply(this, arguments);
688
688
  }
689
689
 
@@ -718,7 +718,7 @@ var RealTallyman = {
718
718
  }, _callee22);
719
719
  }));
720
720
 
721
- function mcpShield(_x166, _x167, _x168, _x169, _x170, _x171, _x172, _x173) {
721
+ function mcpShield(_x168, _x169, _x170, _x171, _x172, _x173, _x174, _x175) {
722
722
  return _mcpShield2.apply(this, arguments);
723
723
  }
724
724
 
@@ -250,24 +250,25 @@ exports.getRedirectUrl = getRedirectUrl;
250
250
 
251
251
  var subscribe = /*#__PURE__*/function () {
252
252
  var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(url, extraParams) {
253
- var extraParamsQs, result, subscribeError;
253
+ var evinaTid, extraParamsQs, result, subscribeError;
254
254
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
255
255
  while (1) {
256
256
  switch (_context2.prev = _context2.next) {
257
257
  case 0:
258
+ evinaTid = typeof window != "undefined" && window.tid ? window.tid : "";
258
259
  extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(function (k) {
259
260
  return "".concat(k, "=").concat(extraParams[k]);
260
261
  }).join('&');
261
- _context2.next = 3;
262
- return fetch(url + extraParamsQs).then(function (x) {
262
+ _context2.next = 4;
263
+ return fetch("".concat(url, "&sam_evina_tid=").concat(evinaTid).concat(extraParamsQs)).then(function (x) {
263
264
  return x.json();
264
265
  });
265
266
 
266
- case 3:
267
+ case 4:
267
268
  result = _context2.sent;
268
269
 
269
270
  if (!(false === result.success)) {
270
- _context2.next = 11;
271
+ _context2.next = 12;
271
272
  break;
272
273
  }
273
274
 
@@ -276,10 +277,10 @@ var subscribe = /*#__PURE__*/function () {
276
277
  subscribeError['productUrl'] = result.product_url ? result.product_url : "";
277
278
  throw subscribeError;
278
279
 
279
- case 11:
280
+ case 12:
280
281
  return _context2.abrupt("return", result.product_url || result.redirect_url);
281
282
 
282
- case 12:
283
+ case 13:
283
284
  case "end":
284
285
  return _context2.stop();
285
286
  }
@@ -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,22 +249,26 @@ function _submitMSISDNOnce() {
224
249
  console.error(error);
225
250
  throw error;
226
251
 
227
- case 21:
252
+ case 27:
228
253
  kwCodesWithMcpShied = {
229
- kw: "kw",
230
- k2: "k2"
254
+ kw: {
255
+ kw_viva: "kw_viva"
256
+ },
257
+ k2: {
258
+ k2_viva: "k2_viva"
259
+ }
231
260
  };
232
261
 
233
- if (!(country && (kwCodesWithMcpShied[country.toLowerCase()] && result.operator == "KW_VIVA" || country.toLowerCase() == "iq"))) {
234
- _context3.next = 33;
262
+ if (!(country && result.operator && (kwCodesWithMcpShied[country.toLowerCase()] && kwCodesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()] || country.toLowerCase() == "iq"))) {
263
+ _context3.next = 39;
235
264
  break;
236
265
  }
237
266
 
238
- _context3.prev = 23;
239
- _context3.next = 26;
267
+ _context3.prev = 29;
268
+ _context3.next = 32;
240
269
  return window.tallymanApi.mcpShield(host, country, slug, device, offer, rockmanId, result.operator, uniqid);
241
270
 
242
- case 26:
271
+ case 32:
243
272
  mcpShieldResult = _context3.sent;
244
273
 
245
274
  if (false == mcpShieldResult.success) {
@@ -249,15 +278,15 @@ function _submitMSISDNOnce() {
249
278
  uniqidResult = mcpShieldResult.uniqid;
250
279
  }
251
280
 
252
- _context3.next = 33;
281
+ _context3.next = 39;
253
282
  break;
254
283
 
255
- case 30:
256
- _context3.prev = 30;
257
- _context3.t0 = _context3["catch"](23);
284
+ case 36:
285
+ _context3.prev = 36;
286
+ _context3.t0 = _context3["catch"](29);
258
287
  console.warn(_context3.t0);
259
288
 
260
- case 33:
289
+ case 39:
261
290
  return _context3.abrupt("return", {
262
291
  type: "SingleMSISDNSubmissionResult",
263
292
  pin: result.pin,
@@ -265,12 +294,12 @@ function _submitMSISDNOnce() {
265
294
  operator: result.operator
266
295
  });
267
296
 
268
- case 34:
297
+ case 40:
269
298
  case "end":
270
299
  return _context3.stop();
271
300
  }
272
301
  }
273
- }, _callee3, null, [[23, 30]]);
302
+ }, _callee3, null, [[29, 36]]);
274
303
  }));
275
304
  return _submitMSISDNOnce.apply(this, arguments);
276
305
  }
@@ -369,12 +398,17 @@ function submitPIN(_x16, _x17, _x18, _x19) {
369
398
 
370
399
  function _submitPIN() {
371
400
  _submitPIN = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(window, pin, config, extraParams) {
372
- 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;
373
402
 
374
403
  return regeneratorRuntime.wrap(function _callee6$(_context6) {
375
404
  while (1) {
376
405
  switch (_context6.prev = _context6.next) {
377
406
  case 0:
407
+ if (window.hostCountry && window.hostSlug) {
408
+ config.country = window.hostCountry;
409
+ config.slug = window.hostSlug;
410
+ }
411
+
378
412
  slug = config.slug, country = config.country, device = config.device, host = config.host;
379
413
  offer = window.pac_analytics.visitor.offer;
380
414
  extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(function (k) {
@@ -383,7 +417,7 @@ function _submitPIN() {
383
417
  rockmanId = window.pac_analytics.visitor.rockmanId;
384
418
 
385
419
  if (pin) {
386
- _context6.next = 8;
420
+ _context6.next = 9;
387
421
  break;
388
422
  }
389
423
 
@@ -391,16 +425,17 @@ function _submitPIN() {
391
425
  emptyPinError['type'] = "InvalidPIN";
392
426
  throw emptyPinError;
393
427
 
394
- case 8:
428
+ case 9:
395
429
  uniqid = uniqidResult != "" ? "&mcpUniqid=".concat(uniqidResult) : '';
396
- _context6.next = 11;
397
- 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);
398
433
 
399
- case 11:
434
+ case 13:
400
435
  pinResult = _context6.sent;
401
436
 
402
437
  if (!(false === pinResult.success)) {
403
- _context6.next = 18;
438
+ _context6.next = 20;
404
439
  break;
405
440
  }
406
441
 
@@ -408,9 +443,9 @@ function _submitPIN() {
408
443
  pinError['type'] = "InvalidPIN";
409
444
  throw pinError;
410
445
 
411
- case 18:
446
+ case 20:
412
447
  if (!(true === pinResult.async)) {
413
- _context6.next = 33;
448
+ _context6.next = 35;
414
449
  break;
415
450
  }
416
451
 
@@ -418,16 +453,16 @@ function _submitPIN() {
418
453
  return window.tallymanApi.checkSubscription(host, country, slug, device, offer, rockmanId, pin, extraParamsQs);
419
454
  };
420
455
 
421
- _context6.next = 22;
456
+ _context6.next = 24;
422
457
  return (0, _utils.loop)(check, 30, function (r) {
423
458
  return r.success;
424
459
  }, 0);
425
460
 
426
- case 22:
461
+ case 24:
427
462
  checkResult = _context6.sent;
428
463
 
429
464
  if (!(true === checkResult.success)) {
430
- _context6.next = 28;
465
+ _context6.next = 30;
431
466
  break;
432
467
  }
433
468
 
@@ -437,23 +472,23 @@ function _submitPIN() {
437
472
  isAlreadySubscribed: isAlreadySubscribed
438
473
  });
439
474
 
440
- case 28:
475
+ case 30:
441
476
  _pinError = new Error("Error in submitMSISDN() verify-pin action:\n".concat(checkResult.message));
442
477
  _pinError['type'] = "InvalidPIN";
443
478
  throw _pinError;
444
479
 
445
- case 31:
446
- _context6.next = 35;
480
+ case 33:
481
+ _context6.next = 37;
447
482
  break;
448
483
 
449
- case 33:
484
+ case 35:
450
485
  _isAlreadySubscribed = pinResult.message == "ALREADY SUBSCRIBED" ? true : false;
451
486
  return _context6.abrupt("return", {
452
487
  productUrl: pinResult.product_url || null,
453
488
  isAlreadySubscribed: _isAlreadySubscribed
454
489
  });
455
490
 
456
- case 35:
491
+ case 37:
457
492
  case "end":
458
493
  return _context6.stop();
459
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "2.1.17",
3
+ "version": "2.1.21",
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 {
@@ -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")
@@ -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;
@@ -1,7 +1,7 @@
1
1
  import { IConfig, IHash, SingleMSISDNSubmissionResult, MultiOperatorMSISDNSubmissionResult, IMSISDNSubmissionResult, IPINSubmissionResult, ICheckSubscriptionResult, IPinFlowCurrentState, MSISDNEntryFailure, MSISDNEntrySuccess, PINEntryFailure, PINEntrySuccess, IPinFlowReducerState, IMcpShieldResult } from "./PinTypes";
2
2
  import IError from "../../common-types/IError";
3
3
  import * as RDS from "../../common-types/RemoteDataState";
4
- import { left, loop, right } from "../strategy/utils";
4
+ import { identifyUser, left, loop, right } from "../strategy/utils";
5
5
 
6
6
  const loadScriptInnerHtml = (innerHTML:string)=>{
7
7
  var script = document.createElement('script');
@@ -32,6 +32,7 @@ export async function loadMcpShield(window: Window, config: IConfig): Promise<IM
32
32
  const rockmanId = window.pac_analytics.visitor.rockmanId
33
33
 
34
34
  try{
35
+
35
36
  const mcpShieldResult: IMcpShieldResult = await window.tallymanApi.mcpShield(host, country, slug, device, offer, rockmanId)
36
37
  if(false == mcpShieldResult.success){
37
38
  console.warn(mcpShieldResult.message);
@@ -53,11 +54,34 @@ async function submitMSISDNOnce(window: Window, config: IConfig, internationalMS
53
54
  }
54
55
 
55
56
  const msisdn = internationalMSISDN.match(/\d+/gi).join('') // tallyman API expects international msisdn without any special character
56
- const { slug, country, device, offer, host } = config
57
+ const rockmanId = window.pac_analytics.visitor.rockmanId
58
+
59
+ // HARDCODING This for now if the concerpt works we move this to configs
60
+ const supportedSlugs:{[key:string]:string} = {
61
+ "kuwait-agency-mix-gamezone-puzzle1":"kuwait-agency-mix-gamezone-puzzle1",
62
+ "kuwait-agency-mix-yourspot-riddles":"kuwait-agency-mix-yourspot-riddles"
63
+ }
64
+
65
+ if(config.country.toLowerCase() == "k2" && supportedSlugs[config.slug]){
66
+ const identifiedUser = await window.tallymanApi.identify(config.host, config.slug, config.country, msisdn, config.device, config.offer, rockmanId);
67
+ if(identifiedUser.operator && identifiedUser.operator == "K2_ZAIN"){
68
+ window.hostCountry = "KW";
69
+ window.hostSlug = "kw-mt2-hosted-flow-mobfun";
70
+ config.country = window.hostCountry;
71
+ config.slug = window.hostSlug;
72
+ }
73
+ }
74
+
75
+ const { slug, country, device, offer, host } = config;
76
+
77
+
78
+
79
+
57
80
  const search = (window.location.search.indexOf("redirect-back=1") == -1) ? (window.location.search.substr(1) || '') : ''
58
81
  const extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(k => `${k}=${extraParams[k]}`).join('&')
59
- const rockmanId = window.pac_analytics.visitor.rockmanId
60
82
  const uniqid = (uniqidOnLoadResult != "" && country.toLowerCase() == "iq") ? `&mcpUniqid=${uniqidOnLoadResult}` : '';
83
+
84
+
61
85
 
62
86
  const result: IMSISDNSubmissionResult = await window.tallymanApi.triggerPin(host, country, slug, device, offer, msisdn, rockmanId, extraParamsQs, search, uniqid)
63
87
  if (false === result.success) {
@@ -69,14 +93,16 @@ async function submitMSISDNOnce(window: Window, config: IConfig, internationalMS
69
93
  throw error
70
94
  } else {
71
95
 
72
- const kwCodesWithMcpShied:{[key:string]:string} = {
73
- kw:"kw",
74
- k2:"k2"
96
+ const kwCodesWithMcpShied:{[key:string]:{[key:string]:string}} = {
97
+ kw:{
98
+ kw_viva:"kw_viva"
99
+ },
100
+ k2:{
101
+ k2_viva:"k2_viva"
102
+ }
75
103
  }
76
- if(country && (
77
- (
78
-
79
- kwCodesWithMcpShied[country.toLowerCase()] && result.operator == "KW_VIVA") ||
104
+ if(country && result.operator && (
105
+ (kwCodesWithMcpShied[country.toLowerCase()] && kwCodesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()]) ||
80
106
  country.toLowerCase() == "iq"
81
107
  )
82
108
  ){
@@ -131,6 +157,10 @@ async function submitMSISDNForMultipleOperators(window: Window, config: IConfig,
131
157
 
132
158
  export async function submitPIN(window:Window, pin: string, config:IConfig, extraParams:IHash): Promise<{productUrl:string; isAlreadySubscribed?:boolean;}> {
133
159
 
160
+ if(window.hostCountry && window.hostSlug){
161
+ config.country = window.hostCountry;
162
+ config.slug = window.hostSlug;
163
+ }
134
164
  const { slug, country, device, host } = config;
135
165
  const offer = window.pac_analytics.visitor.offer;
136
166
  const extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(k => `${k}=${extraParams[k]}`).join('&')
@@ -141,7 +171,9 @@ export async function submitPIN(window:Window, pin: string, config:IConfig, extr
141
171
  throw emptyPinError
142
172
  }
143
173
  const uniqid = uniqidResult != "" ? `&mcpUniqid=${uniqidResult}` : '';
144
- 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)
145
177
  if (false === pinResult.success) {
146
178
  const pinError = new Error(`Error in submitMSISDN() verify-pin action:\n${pinResult.message}`) as IError & {type:string}
147
179
  pinError['type'] = "InvalidPIN";
@@ -71,7 +71,8 @@ export const pin_header_enrichment = (defaultFlow:IFlow):AppThunk=>{
71
71
  if(heResult.msisdn !== undefined && heResult.msisdn !== ""){
72
72
  const msisdn = heResult.msisdn;
73
73
  const operator = heResult.operator;
74
- tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-detected',{msisdn})
74
+ tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {msisdn})
75
+
75
76
  tracker.sendOptInFlowEvent("Hybrid Pin")
76
77
  return dispatch({
77
78
  type:"IDENTIFY_FLOW_BY_HE",
@@ -101,7 +102,7 @@ export const pin_header_enrichment = (defaultFlow:IFlow):AppThunk=>{
101
102
  }
102
103
  }catch(err){
103
104
  console.warn(err)
104
- tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-detection-failure', {errorType: err.toString()})
105
+ tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {errorType: err.toString()})
105
106
  tracker.sendOptInFlowEvent("Pin")
106
107
 
107
108
  dispatch({
@@ -183,9 +184,9 @@ export const he_pin_one_click_header_enrichment = (defaultFlow:IFlow):AppThunk=>
183
184
  }
184
185
  }
185
186
  let ipRangeName = await tryGetIPRangeName(window.pac_analytics.visitor);
186
- console.log("IP ipRangeName", ipRangeName);
187
187
 
188
188
  if (ipRangeName == null) {
189
+ tracker.sendOptInFlowEvent("Pin")
189
190
  return dispatch({
190
191
  type:"IDENTIFY_FLOW_BY_HE",
191
192
  payload:{
@@ -209,7 +210,7 @@ export const he_pin_one_click_header_enrichment = (defaultFlow:IFlow):AppThunk=>
209
210
 
210
211
  const operator = heResult.operator ? heResult.operator.toUpperCase() : ipRangeName.toUpperCase()
211
212
  if(msisdn && msisdn !== ""){
212
- tracker.advancedInFlow('identify-user', 'msisdn-detected',{msisdn})
213
+ tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {msisdn})
213
214
  const flowObj = determineFlowByOperator(operator);
214
215
  switchState({flowObj, msisdn, operator, subscription_url, redirect_url})
215
216
  }else{
@@ -217,6 +218,7 @@ export const he_pin_one_click_header_enrichment = (defaultFlow:IFlow):AppThunk=>
217
218
  switchState({flowObj, redirect_url, subscription_url, operator})
218
219
  }
219
220
  }else{
221
+ tracker.sendOptInFlowEvent("Pin")
220
222
  return dispatch({
221
223
  type:"IDENTIFY_FLOW_BY_HE",
222
224
  payload:{
@@ -232,7 +234,7 @@ export const he_pin_one_click_header_enrichment = (defaultFlow:IFlow):AppThunk=>
232
234
 
233
235
  }catch(err){
234
236
  console.warn(err)
235
- tracker.recedeInFlow('identify-user', 'msisdn-detection-failure', {errorType: err.toString()})
237
+ tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {errorType: err.toString()})
236
238
  tracker.sendOptInFlowEvent("Pin")
237
239
  dispatch({
238
240
  type:"IDENTIFY_FLOW_BY_HE",
@@ -310,9 +312,9 @@ export const he_mo_redir_one_click_header_enrichment = (defaultFlow:IFlow):AppTh
310
312
  }
311
313
  }
312
314
  let ipRangeName = await tryGetIPRangeName(window.pac_analytics.visitor);
313
- console.log("IP ipRangeName", ipRangeName);
314
315
 
315
316
  if (ipRangeName == null) {
317
+ tracker.sendOptInFlowEvent("Redirect")
316
318
  return dispatch({
317
319
  type:"IDENTIFY_FLOW_BY_HE",
318
320
  payload:{
@@ -336,7 +338,7 @@ export const he_mo_redir_one_click_header_enrichment = (defaultFlow:IFlow):AppTh
336
338
 
337
339
  const operator = heResult.operator ? heResult.operator.toUpperCase() : ipRangeName.toUpperCase()
338
340
  if(msisdn && msisdn !== ""){
339
- tracker.advancedInFlow('identify-user', 'msisdn-detected',{msisdn})
341
+ tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {msisdn})
340
342
  const flowObj = determineFlowByOperator(operator);
341
343
  switchState({flowObj, msisdn, operator, subscription_url, redirect_url})
342
344
  }else{
@@ -344,6 +346,7 @@ export const he_mo_redir_one_click_header_enrichment = (defaultFlow:IFlow):AppTh
344
346
  switchState({flowObj, redirect_url, subscription_url, operator})
345
347
  }
346
348
  }else{
349
+ tracker.sendOptInFlowEvent("Redirect")
347
350
  return dispatch({
348
351
  type:"IDENTIFY_FLOW_BY_HE",
349
352
  payload:{
@@ -359,8 +362,8 @@ export const he_mo_redir_one_click_header_enrichment = (defaultFlow:IFlow):AppTh
359
362
 
360
363
  }catch(err){
361
364
  console.warn(err)
362
- tracker.recedeInFlow('identify-user', 'msisdn-detection-failure', {errorType: err.toString()})
363
- tracker.sendOptInFlowEvent("Pin")
365
+ tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {errorType: err.toString()})
366
+ tracker.sendOptInFlowEvent("Redirect")
364
367
  dispatch({
365
368
  type:"IDENTIFY_FLOW_BY_HE",
366
369
  payload:{
@@ -442,7 +445,7 @@ export const he_pin_mo_redir_header_enrichment = (defaultFlow:IFlow):AppThunk=>{
442
445
  const msisdn = heResult.msisdn;
443
446
  const operator = heResult.operator;
444
447
 
445
- tracker.advancedInFlow('identify-user', 'msisdn-detected',{msisdn})
448
+ tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {msisdn})
446
449
 
447
450
  if(!!operator && operator !== ""){
448
451
  const flowObj = determineFlowByOperator(operator);
@@ -458,7 +461,7 @@ export const he_pin_mo_redir_header_enrichment = (defaultFlow:IFlow):AppThunk=>{
458
461
  }
459
462
  }catch(err){
460
463
  console.warn(err)
461
- tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-detection-failure', {errorType: err.toString()})
464
+ tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {errorType: err.toString()})
462
465
 
463
466
  try{
464
467
  const flowObj = await determineFlowByOperatorFromIp()
@@ -1 +0,0 @@
1
- export {};
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- var _reduxMockStore = _interopRequireDefault(require("redux-mock-store"));
4
-
5
- var _reduxThunk = _interopRequireDefault(require("redux-thunk"));
6
-
7
- var _ = require("..");
8
-
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
- var middlewares = [_reduxThunk.default];
12
- var mockStore = (0, _reduxMockStore.default)(middlewares);
13
- var store = mockStore();
14
- describe('identify strategy action', function () {
15
- var expectedResult = [{
16
- "payload": {
17
- "nextData": {
18
- "nextAction": "submitMSISDNAction"
19
- },
20
- "result": {
21
- "type": "NothingYet"
22
- },
23
- "type": "IDENTIFY_FLOW_BY_MSISDN"
24
- },
25
- "type": "IDENTIFY_FLOW_BY_MSISDN"
26
- }];
27
- it('identifies flow as ', function () {
28
- return store //@ts-ignore
29
- .dispatch((0, _.identifyStrategy)()).then(function () {
30
- return expect(store.getActions()).toEqual(expectedResult);
31
- });
32
- });
33
- });
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import { UserConfig } from '../global/interfaces/user';
3
- interface NestedObjectWithStrings {
4
- [key: string]: string | NestedObjectWithStrings;
5
- }
6
- interface TranslationsItem {
7
- translations: {
8
- lang: string;
9
- entries: NestedObjectWithStrings;
10
- };
11
- }
12
- interface Translations {
13
- [key: string]: TranslationsItem;
14
- }
15
- interface UserMock {
16
- USER: {
17
- payload: Partial<UserConfig>;
18
- };
19
- }
20
- export declare const renderWithRouterAndUserMock: (children: React.ReactNode, userApiMock: UserMock, translations: Translations) => void;
21
- export {};
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.renderWithRouterAndUserMock = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _reactRouterDom = require("react-router-dom");
11
-
12
- var _testUtils = require("./test-utils");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
- var renderWithRouterAndUserMock = function renderWithRouterAndUserMock(children, userApiMock, translations) {
17
- (0, _testUtils.render)(<_reactRouterDom.MemoryRouter>{children}</_reactRouterDom.MemoryRouter>, {
18
- initialState: {
19
- api: userApiMock,
20
- distributor: {
21
- selectedOutlet: {
22
- eid: 'SEELENAMAR',
23
- salesOrg: '1010',
24
- name: 'Elena Martinez Sweden Bar',
25
- tradeChannel1Desc: 'On-trade',
26
- region: 'Khammuane',
27
- city: 'ນະຄອນຫລວງວຽງຈັນ',
28
- address: 'ວັດຈັນ ຈັນທະບູລີ ',
29
- selected: true
30
- }
31
- },
32
- user: {
33
- isLoggedIn: true
34
- }
35
- },
36
- translations: translations
37
- });
38
- };
39
-
40
- exports.renderWithRouterAndUserMock = renderWithRouterAndUserMock;
@@ -1 +0,0 @@
1
- import 'whatwg-fetch';
@@ -1,24 +0,0 @@
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();