ouisys-engine 3.0.14 → 3.0.16

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.
package/dist/api/index.js CHANGED
@@ -49,11 +49,13 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
49
49
 
50
50
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
51
51
 
52
- /* eslint-disable camelcase */
53
-
54
- /* eslint-disable no-console */
55
52
  var bupperizeCountry = function bupperizeCountry(c) {
56
53
  return c === 'gb' ? 'uk' : c;
54
+ }; // eslint-disable-next-line no-console
55
+
56
+
57
+ var logMockTallyman = function logMockTallyman(mock) {
58
+ return console.log(mock);
57
59
  };
58
60
 
59
61
  var checkIsCleanTraffic = function checkIsCleanTraffic(country) {
@@ -84,7 +86,7 @@ var MockTallyman = {
84
86
  while (1) {
85
87
  switch (_context.prev = _context.next) {
86
88
  case 0:
87
- console.log('MockTallyman');
89
+ logMockTallyman('MockTallyman');
88
90
  sleep(2000);
89
91
  return _context.abrupt("return", {
90
92
  operator: '',
@@ -113,7 +115,7 @@ var MockTallyman = {
113
115
  while (1) {
114
116
  switch (_context2.prev = _context2.next) {
115
117
  case 0:
116
- console.log('MockTallyman');
118
+ logMockTallyman('MockTallyman');
117
119
  sleep(2000);
118
120
  return _context2.abrupt("return", {
119
121
  success: true,
@@ -143,7 +145,7 @@ var MockTallyman = {
143
145
  while (1) {
144
146
  switch (_context3.prev = _context3.next) {
145
147
  case 0:
146
- console.log('MockTallyman');
148
+ logMockTallyman('MockTallyman');
147
149
  sleep(2000);
148
150
  return _context3.abrupt("return", {
149
151
  success: true,
@@ -172,7 +174,7 @@ var MockTallyman = {
172
174
  while (1) {
173
175
  switch (_context4.prev = _context4.next) {
174
176
  case 0:
175
- console.log('MockTallyman');
177
+ logMockTallyman('MockTallyman');
176
178
  sleep(2000);
177
179
  return _context4.abrupt("return", {
178
180
  success: true,
@@ -201,7 +203,7 @@ var MockTallyman = {
201
203
  while (1) {
202
204
  switch (_context5.prev = _context5.next) {
203
205
  case 0:
204
- console.log('MockTallyman');
206
+ logMockTallyman('MockTallyman');
205
207
  sleep(2000);
206
208
  return _context5.abrupt("return", {
207
209
  success: true,
@@ -230,7 +232,7 @@ var MockTallyman = {
230
232
  while (1) {
231
233
  switch (_context6.prev = _context6.next) {
232
234
  case 0:
233
- console.log('MockTallyman');
235
+ logMockTallyman('MockTallyman');
234
236
  sleep(2000);
235
237
  return _context6.abrupt("return", {
236
238
  success: true,
@@ -258,7 +260,7 @@ var MockTallyman = {
258
260
  while (1) {
259
261
  switch (_context7.prev = _context7.next) {
260
262
  case 0:
261
- console.log('MockTallyman');
263
+ logMockTallyman('MockTallyman');
262
264
  sleep(2000);
263
265
  return _context7.abrupt("return", {
264
266
  success: true,
@@ -287,7 +289,7 @@ var MockTallyman = {
287
289
  while (1) {
288
290
  switch (_context8.prev = _context8.next) {
289
291
  case 0:
290
- console.log('MockTallyman');
292
+ logMockTallyman('MockTallyman');
291
293
  sleep(2000);
292
294
  return _context8.abrupt("return", {
293
295
  success: true,
@@ -316,7 +318,7 @@ var MockTallyman = {
316
318
  while (1) {
317
319
  switch (_context9.prev = _context9.next) {
318
320
  case 0:
319
- console.log('MockTallyman');
321
+ logMockTallyman('MockTallyman');
320
322
  sleep(2000);
321
323
  return _context9.abrupt("return", {
322
324
  success: true,
@@ -346,7 +348,7 @@ var MockTallyman = {
346
348
  while (1) {
347
349
  switch (_context10.prev = _context10.next) {
348
350
  case 0:
349
- console.log('MockTallyman');
351
+ logMockTallyman('MockTallyman');
350
352
  sleep(2000);
351
353
  return _context10.abrupt("return", {
352
354
  source: '**********some very long text**********',
@@ -430,14 +432,13 @@ var RealTallyman = {
430
432
  while (1) {
431
433
  switch (_context13.prev = _context13.next) {
432
434
  case 0:
433
- console.log('RealTallyman');
434
435
  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);
435
436
  newHost = isDMB ? 'de.tallymans.com' : host;
436
437
  return _context13.abrupt("return", fetch("https://".concat(newHost, "/tallyman/v1/?action=identify&slug=").concat(slug, "&country=").concat(country, "&msisdn=").concat(msisdn, "&device=").concat(device, "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId)).then(function (x) {
437
438
  return x.json();
438
439
  }));
439
440
 
440
- case 4:
441
+ case 3:
441
442
  case "end":
442
443
  return _context13.stop();
443
444
  }
@@ -458,7 +459,6 @@ var RealTallyman = {
458
459
  while (1) {
459
460
  switch (_context14.prev = _context14.next) {
460
461
  case 0:
461
- console.log('RealTallyman');
462
462
  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);
463
463
  newHost = isDMB ? 'de.tallymans.com' : host;
464
464
  isCleanTraffic = checkIsCleanTraffic(country);
@@ -466,7 +466,7 @@ var RealTallyman = {
466
466
  return x.json();
467
467
  }));
468
468
 
469
- case 5:
469
+ case 4:
470
470
  case "end":
471
471
  return _context14.stop();
472
472
  }
@@ -487,7 +487,6 @@ var RealTallyman = {
487
487
  while (1) {
488
488
  switch (_context15.prev = _context15.next) {
489
489
  case 0:
490
- console.log('RealTallyman');
491
490
  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);
492
491
  newHost = isDMB ? 'de.tallymans.com' : host;
493
492
  isCleanTraffic = checkIsCleanTraffic(country);
@@ -495,7 +494,7 @@ var RealTallyman = {
495
494
  return x.json();
496
495
  }));
497
496
 
498
- case 5:
497
+ case 4:
499
498
  case "end":
500
499
  return _context15.stop();
501
500
  }
@@ -516,14 +515,13 @@ var RealTallyman = {
516
515
  while (1) {
517
516
  switch (_context16.prev = _context16.next) {
518
517
  case 0:
519
- console.log('RealTallyman');
520
518
  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);
521
519
  newHost = isDMB ? 'de.tallymans.com' : host;
522
520
  return _context16.abrupt("return", fetch("https://".concat(newHost, "/tallyman/v1/?action=check-subscription&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=").concat(device, "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId)).then(function (x) {
523
521
  return x.json();
524
522
  }));
525
523
 
526
- case 4:
524
+ case 3:
527
525
  case "end":
528
526
  return _context16.stop();
529
527
  }
@@ -544,14 +542,13 @@ var RealTallyman = {
544
542
  while (1) {
545
543
  switch (_context17.prev = _context17.next) {
546
544
  case 0:
547
- console.log('RealTallyman');
548
545
  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);
549
546
  newHost = isDMB ? 'de.tallymans.com' : host;
550
547
  return _context17.abrupt("return", fetch("https://".concat(newHost, "/tallyman/v1/?action=check-subscription&rockman_id=").concat(rockmanId)).then(function (x) {
551
548
  return x.json();
552
549
  }));
553
550
 
554
- case 4:
551
+ case 3:
555
552
  case "end":
556
553
  return _context17.stop();
557
554
  }
@@ -572,7 +569,6 @@ var RealTallyman = {
572
569
  while (1) {
573
570
  switch (_context18.prev = _context18.next) {
574
571
  case 0:
575
- console.log('RealTallyman');
576
572
  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);
577
573
  newHost = isDMB ? 'de.tallymans.com' : host;
578
574
  evinaTi = country.toLowerCase() === 'a2' ? "&evinaTi=".concat(rockmanId) : '';
@@ -580,7 +576,7 @@ var RealTallyman = {
580
576
  return x.json();
581
577
  }));
582
578
 
583
- case 5:
579
+ case 4:
584
580
  case "end":
585
581
  return _context18.stop();
586
582
  }
@@ -601,7 +597,6 @@ var RealTallyman = {
601
597
  while (1) {
602
598
  switch (_context19.prev = _context19.next) {
603
599
  case 0:
604
- console.log('RealTallyman');
605
600
  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);
606
601
  newHost = isDMB ? 'de.tallymans.com' : host;
607
602
  samGtoken = window.reCaptchaToken ? "sam-g-token=".concat(window.reCaptchaToken) : '';
@@ -609,7 +604,7 @@ var RealTallyman = {
609
604
  return x.json();
610
605
  }));
611
606
 
612
- case 5:
607
+ case 4:
613
608
  case "end":
614
609
  return _context19.stop();
615
610
  }
@@ -630,14 +625,13 @@ var RealTallyman = {
630
625
  while (1) {
631
626
  switch (_context20.prev = _context20.next) {
632
627
  case 0:
633
- console.log('RealTallyman');
634
628
  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);
635
629
  newHost = isDMB ? 'de.tallymans.com' : host;
636
630
  return _context20.abrupt("return", fetch("https://".concat(newHost, "/tallyman/v1/?action=ussd&slug=").concat(slug, "&country=").concat(country, "&msisdn=").concat(msisdn, "&device=").concat(device, "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId, "&").concat(search).concat(extraParamsQs)).then(function (x) {
637
631
  return x.json();
638
632
  }));
639
633
 
640
- case 4:
634
+ case 3:
641
635
  case "end":
642
636
  return _context20.stop();
643
637
  }
@@ -658,14 +652,13 @@ var RealTallyman = {
658
652
  while (1) {
659
653
  switch (_context21.prev = _context21.next) {
660
654
  case 0:
661
- console.log('RealTallyman');
662
655
  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);
663
656
  newHost = isDMB ? 'de.tallymans.com' : host;
664
657
  return _context21.abrupt("return", fetch("https://".concat(newHost, "/tallyman/v1/?action=oc2sms&country=").concat(country, "&slug=").concat(slug, "&offerId=").concat(offer).concat(keyword ? "&keyword=".concat(keyword) : '', "&device=smart&rockman_id=").concat(rockmanId).concat(operator ? "&operator=".concat(operator) : '', "&").concat(search)).then(function (x) {
665
658
  return x.json();
666
659
  }));
667
660
 
668
- case 4:
661
+ case 3:
669
662
  case "end":
670
663
  return _context21.stop();
671
664
  }
@@ -686,7 +679,6 @@ var RealTallyman = {
686
679
  while (1) {
687
680
  switch (_context22.prev = _context22.next) {
688
681
  case 0:
689
- console.log('RealTallyman');
690
682
  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);
691
683
  newHost = isDMB ? 'de.tallymans.com' : host;
692
684
  pageUrl = window.location.href;
@@ -696,7 +688,7 @@ var RealTallyman = {
696
688
  return x.json();
697
689
  }));
698
690
 
699
- case 7:
691
+ case 6:
700
692
  case "end":
701
693
  return _context22.stop();
702
694
  }
@@ -5,9 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- /* eslint-disable consistent-return */
9
-
10
- /* eslint-disable default-case */
11
8
  function strategy(_ref) {
12
9
  var identifyFlowByOperatorSelect = _ref.identifyFlowByOperatorSelect,
13
10
  identifyFlowByMsisdn = _ref.identifyFlowByMsisdn,
@@ -17,7 +14,9 @@ function strategy(_ref) {
17
14
  oneClickFlow = _ref.oneClickFlow,
18
15
  click2smsFlow = _ref.click2smsFlow,
19
16
  ussdFlow = _ref.ussdFlow;
17
+ // eslint-disable-next-line consistent-return
20
18
  return function (state) {
19
+ // eslint-disable-next-line default-case
21
20
  switch (state.type) {
22
21
  case 'IDENTIFY_FLOW_BY_OPERATOR_SELECT':
23
22
  return identifyFlowByOperatorSelect(state.result);
@@ -70,7 +70,8 @@ var _default = function _default(window, country, page) {
70
70
 
71
71
  if (!window.pac_analytics) {
72
72
  var rockmanId = (0, _v.default)().replace(/-/g, '');
73
- var campaignId = parseInt((0, _queryString2.default)(window.location.search, 'cid')) || 2;
73
+ var campaignId = parseInt((0, _queryString2.default)(window.location.search, 'cid'), 10) || 2; // eslint-disable-next-line no-param-reassign
74
+
74
75
  window.pac_analytics = {
75
76
  visitor: {
76
77
  rockmanId: rockmanId,
@@ -80,7 +81,7 @@ var _default = function _default(window, country, page) {
80
81
  page: page,
81
82
  xaid: (0, _queryString2.default)(window.location.search, 'xaid'),
82
83
  cid: campaignId,
83
- offer: parseInt((0, _queryString2.default)(window.location.search, 'offer')) || 1 // default to 1 offer id
84
+ offer: parseInt((0, _queryString2.default)(window.location.search, 'offer'), 10) || 1 // default to 1 offer id
84
85
 
85
86
  },
86
87
  startTime: new Date().valueOf(),
@@ -21,7 +21,7 @@ require("core-js/modules/es.string.match.js");
21
21
  require("core-js/modules/es.array.concat.js");
22
22
 
23
23
  var _default = function _default(url, paramName) {
24
- var name = paramName.replace(/[\[\]]/g, '\\$&');
24
+ var name = paramName.replace(/[\]]/g, '\\$&');
25
25
  var regex = new RegExp("[?&]".concat(name, "(=([^&#]*)|&|#|$)"), 'i');
26
26
  var results = regex.exec(url);
27
27
  if (!results) return null;
@@ -35,15 +35,16 @@ function updateUrlParameter(uri, key, value) {
35
35
  // remove the hash part before operating on the uri
36
36
  var i = uri.indexOf('#');
37
37
  var hash = i === -1 ? '' : uri.substr(i);
38
- uri = i === -1 ? uri : uri.substr(0, i);
38
+ var newUri = uri;
39
+ newUri = i === -1 ? newUri : newUri.substr(0, i);
39
40
  var re = new RegExp("([?&])".concat(key, "=.*?(&|$)"), 'i');
40
- var separator = uri.indexOf('?') !== -1 ? '&' : '?';
41
+ var separator = newUri.indexOf('?') !== -1 ? '&' : '?';
41
42
 
42
- if (uri.match(re)) {
43
- uri = uri.replace(re, "$1".concat(key, "=").concat(value, "$2"));
43
+ if (newUri.match(re)) {
44
+ newUri = newUri.replace(re, "$1".concat(key, "=").concat(value, "$2"));
44
45
  } else {
45
- uri = "".concat(uri + separator + key, "=").concat(value);
46
+ newUri = "".concat(newUri + separator + key, "=").concat(value);
46
47
  }
47
48
 
48
- return uri + hash; // finally append the hash as well
49
+ return newUri + hash; // finally append the hash as well
49
50
  }
@@ -48,7 +48,7 @@ export declare type IStrategy = {
48
48
  country: string;
49
49
  strategyConfigs: StrategyConfig;
50
50
  };
51
- export declare type IStrategyNames = 'pin' | 'mo' | 'mo-redir' | 'click2sms' | 'one-click' | 'ussd' | 'tpay-he' | 'tallyman-one-click' | 'pin-mo-ask-operator' | 'pin-mo-ask-mobile-number' | 'pin-one-click-ask-operator' | 'pin-one-click-detect-operator-by-ip' | 'one-click-mo-pin-detect-operator-by-ip-or-msisdn' | 'pin-click2sms-ask-operator' | 'mo-redir-one-click-detect-operator-by-ip' | 'pin-mo-redir-ask-mobile-number' | 'pin-click2sms-ask-mobile-number' | 'mo-one-click-detect-operator-by-ip' | 'click2sms-one-click-detect-operator-by-ip' | 'pin-header-enrichment' | 'pin-msisdn-fowarding-pin-header-enrichment' | 'he-pin-mo-redir-header-enrichment' | 'he-pin-one-click-header-enrichment' | 'he-pin-one-click-ask-operator' | 'click2sms-one-click-ask-operator' | 'pin-mo-detect-operator-by-ip' | 'he-mo-redir-one-click-header-enrichment' | 'pin-combo-ask-mobile-number';
51
+ export declare type IStrategyNames = 'pin' | 'mo' | 'mo-redir' | 'click2sms' | 'one-click' | 'ussd' | 'tpay-he' | 'tallyman-one-click' | 'pin-mo-ask-operator' | 'pin-mo-ask-mobile-number' | 'pin-one-click-ask-operator' | 'pin-one-click-detect-operator-by-ip' | 'one-click-mo-pin-detect-operator-by-ip-or-msisdn' | 'pin-click2sms-ask-operator' | 'mo-redir-one-click-detect-operator-by-ip' | 'pin-mo-redir-ask-mobile-number' | 'pin-click2sms-ask-mobile-number' | 'mo-one-click-detect-operator-by-ip' | 'click2sms-one-click-detect-operator-by-ip' | 'pin-header-enrichment' | 'pin-msisdn-fowarding-pin-header-enrichment' | 'he-pin-mo-redir-header-enrichment' | 'he-pin-one-click-header-enrichment' | 'he-pin-one-click-ask-operator' | 'click2sms-one-click-ask-operator' | 'pin-mo-detect-operator-by-ip' | 'he-mo-redir-one-click-header-enrichment' | 'pin-combo-ask-mobile-number' | 'header-enrichment-script';
52
52
  export interface IHash {
53
53
  [key: string]: string;
54
54
  }
@@ -114,6 +114,8 @@ export declare type IIdentfyFlowByOperatorNextAction = 'submitMSISDNAction' | 'l
114
114
  export declare type IIdentfyFlowByIPOperatorNextAction = 'getRedirectUrlAction' | 'submitMSISDNAction';
115
115
  export declare type IIdenyifyFlowByMsisdnSumbitNextData = {
116
116
  nextAction: IIdentfyFlowByMsisdnNextAction;
117
+ msisdn?: string;
118
+ operator?: string;
117
119
  };
118
120
  export declare type IIdenyifyFlowByMsisdnPayload = {
119
121
  type: 'IDENTIFY_FLOW_BY_MSISDN';
@@ -228,3 +230,9 @@ export interface IMockFlowParams<T> {
228
230
  'mock-flow': IMockFlows;
229
231
  'current-state': T;
230
232
  }
233
+ export interface IScriptHeaderEnrichmentSuccess extends CustomEvent {
234
+ detail: {
235
+ msisdn: string;
236
+ operator_code: string;
237
+ };
238
+ }
@@ -79,6 +79,8 @@ var _detect_operator_by_ip = _interopRequireDefault(require("./strategies/detect
79
79
 
80
80
  var _header_enrichment = _interopRequireDefault(require("./strategies/header_enrichment"));
81
81
 
82
+ var _injectHeaderEnrichmentScript = _interopRequireDefault(require("./strategies/injectHeaderEnrichmentScript"));
83
+
82
84
  var _utils2 = require("./utils");
83
85
 
84
86
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -177,12 +179,12 @@ function identifyStrategy() {
177
179
  }
178
180
 
179
181
  dispatch(mockStrategyStateByUrlParam());
180
- _context.next = 32;
182
+ _context.next = 31;
181
183
  break;
182
184
 
183
185
  case 7:
184
186
  _context.t0 = strategy;
185
- _context.next = _context.t0 === 'pin-mo-ask-operator' ? 10 : _context.t0 === 'pin-mo-redir-ask-mobile-number' ? 11 : _context.t0 === 'pin-mo-ask-mobile-number' ? 11 : _context.t0 === 'pin-combo-ask-mobile-number' ? 11 : _context.t0 === 'pin-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'one-click-mo-pin-detect-operator-by-ip-or-msisdn' ? 12 : _context.t0 === 'mo-redir-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'mo-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'click2sms-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'pin-mo-detect-operator-by-ip' ? 12 : _context.t0 === 'pin-click2sms-ask-operator' ? 13 : _context.t0 === 'he-pin-one-click-ask-operator' ? 13 : _context.t0 === 'click2sms-one-click-ask-operator' ? 13 : _context.t0 === 'pin-one-click-ask-operator' ? 13 : _context.t0 === 'pin-header-enrichment' ? 14 : _context.t0 === 'he-pin-mo-redir-header-enrichment' ? 14 : _context.t0 === 'he-pin-one-click-header-enrichment' ? 14 : _context.t0 === 'he-mo-redir-one-click-header-enrichment' ? 14 : _context.t0 === 'pin' ? 15 : _context.t0 === 'mo' ? 17 : _context.t0 === 'mo-redir' ? 19 : _context.t0 === 'one-click' ? 21 : _context.t0 === 'tallyman-one-click' ? 23 : _context.t0 === 'click2sms' ? 25 : _context.t0 === 'ussd' ? 27 : _context.t0 === 'tpay-he' ? 29 : 31;
187
+ _context.next = _context.t0 === 'pin-mo-ask-operator' ? 10 : _context.t0 === 'pin-mo-redir-ask-mobile-number' ? 11 : _context.t0 === 'pin-mo-ask-mobile-number' ? 11 : _context.t0 === 'pin-combo-ask-mobile-number' ? 11 : _context.t0 === 'pin-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'one-click-mo-pin-detect-operator-by-ip-or-msisdn' ? 12 : _context.t0 === 'mo-redir-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'mo-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'click2sms-one-click-detect-operator-by-ip' ? 12 : _context.t0 === 'pin-mo-detect-operator-by-ip' ? 12 : _context.t0 === 'pin-click2sms-ask-operator' ? 13 : _context.t0 === 'he-pin-one-click-ask-operator' ? 13 : _context.t0 === 'click2sms-one-click-ask-operator' ? 13 : _context.t0 === 'pin-one-click-ask-operator' ? 13 : _context.t0 === 'pin-header-enrichment' ? 14 : _context.t0 === 'he-pin-mo-redir-header-enrichment' ? 14 : _context.t0 === 'he-pin-one-click-header-enrichment' ? 14 : _context.t0 === 'he-mo-redir-one-click-header-enrichment' ? 14 : _context.t0 === 'header-enrichment-script' ? 15 : _context.t0 === 'pin' ? 16 : _context.t0 === 'mo' ? 18 : _context.t0 === 'mo-redir' ? 20 : _context.t0 === 'one-click' ? 22 : _context.t0 === 'click2sms' ? 24 : _context.t0 === 'ussd' ? 26 : _context.t0 === 'tpay-he' ? 28 : 30;
186
188
  break;
187
189
 
188
190
  case 10:
@@ -201,6 +203,9 @@ function identifyStrategy() {
201
203
  return _context.abrupt("return", dispatch((0, _header_enrichment.default)()));
202
204
 
203
205
  case 15:
206
+ return _context.abrupt("return", dispatch((0, _injectHeaderEnrichmentScript.default)()));
207
+
208
+ case 16:
204
209
  tracker.sendOptInFlowEvent('Pin');
205
210
  return _context.abrupt("return", dispatch({
206
211
  type: 'IDENTIFY_STRATEGY',
@@ -214,7 +219,7 @@ function identifyStrategy() {
214
219
  }
215
220
  }));
216
221
 
217
- case 17:
222
+ case 18:
218
223
  tracker.sendOptInFlowEvent('Msisdn to sms');
219
224
  return _context.abrupt("return", dispatch({
220
225
  type: 'IDENTIFY_STRATEGY',
@@ -227,7 +232,7 @@ function identifyStrategy() {
227
232
  }
228
233
  }));
229
234
 
230
- case 19:
235
+ case 20:
231
236
  tracker.sendOptInFlowEvent('Redirect');
232
237
  return _context.abrupt("return", dispatch({
233
238
  type: 'IDENTIFY_STRATEGY',
@@ -240,7 +245,7 @@ function identifyStrategy() {
240
245
  }
241
246
  }));
242
247
 
243
- case 21:
248
+ case 22:
244
249
  tracker.sendOptInFlowEvent('3G click');
245
250
  return _context.abrupt("return", dispatch({
246
251
  type: 'IDENTIFY_STRATEGY',
@@ -253,20 +258,7 @@ function identifyStrategy() {
253
258
  }
254
259
  }));
255
260
 
256
- case 23:
257
- tracker.sendOptInFlowEvent('3G click');
258
- return _context.abrupt("return", dispatch({
259
- type: 'IDENTIFY_STRATEGY',
260
- payload: {
261
- type: 'TALLYMAN_ONE_CLICK',
262
- result: {
263
- nextAction: 'getRedirectUrlAction',
264
- config: strategyConfigs.default.flowConfig
265
- }
266
- }
267
- }));
268
-
269
- case 25:
261
+ case 24:
270
262
  tracker.sendOptInFlowEvent('Click to sms');
271
263
  return _context.abrupt("return", dispatch({
272
264
  type: 'IDENTIFY_STRATEGY',
@@ -279,7 +271,7 @@ function identifyStrategy() {
279
271
  }
280
272
  }));
281
273
 
282
- case 27:
274
+ case 26:
283
275
  tracker.sendOptInFlowEvent('Msisdn to sms');
284
276
  return _context.abrupt("return", dispatch({
285
277
  type: 'IDENTIFY_STRATEGY',
@@ -292,7 +284,7 @@ function identifyStrategy() {
292
284
  }
293
285
  }));
294
286
 
295
- case 29:
287
+ case 28:
296
288
  tracker.sendOptInFlowEvent('Hybrid Pin');
297
289
  return _context.abrupt("return", dispatch({
298
290
  type: 'IDENTIFY_STRATEGY',
@@ -305,10 +297,10 @@ function identifyStrategy() {
305
297
  }
306
298
  }));
307
299
 
308
- case 31:
300
+ case 30:
309
301
  throw new Error('Strategy not supported');
310
302
 
311
- case 32:
303
+ case 31:
312
304
  case "end":
313
305
  return _context.stop();
314
306
  }
@@ -1,7 +1,11 @@
1
1
  import { AppThunk } from '../../../common-types/AppThunk';
2
2
  import { IFlow } from '../StrategyTypes';
3
- export default function ask_mobile_number(): AppThunk;
3
+ export default function ask_mobile_number(payload?: {
4
+ msisdn: string;
5
+ operator: string;
6
+ }): AppThunk;
4
7
  export declare function submitMSISDNAction(internationalMSISDN: string): AppThunk;
8
+ export declare const header_enrichment_script: (flowObj: IFlow, msisdn: string) => AppThunk;
5
9
  export declare const pin_mo_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
6
10
  export declare const pin_combo_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
7
11
  export declare const pin_mo_redir_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
@@ -46,7 +46,7 @@ Object.defineProperty(exports, "__esModule", {
46
46
  value: true
47
47
  });
48
48
  exports.default = ask_mobile_number;
49
- exports.pin_mo_redir_ask_mobile_number = exports.pin_mo_ask_mobile_number = exports.pin_combo_ask_mobile_number = exports.one_click_mo_pin_detect_operator_by_ip_or_msisdn = void 0;
49
+ exports.pin_mo_redir_ask_mobile_number = exports.pin_mo_ask_mobile_number = exports.pin_combo_ask_mobile_number = exports.one_click_mo_pin_detect_operator_by_ip_or_msisdn = exports.header_enrichment_script = void 0;
50
50
  exports.submitMSISDNAction = submitMSISDNAction;
51
51
 
52
52
  require("core-js/modules/es.object.to-string.js");
@@ -75,7 +75,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
75
75
 
76
76
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
77
77
 
78
- function ask_mobile_number() {
78
+ function ask_mobile_number(payload) {
79
79
  return function (dispatch) {
80
80
  try {
81
81
  dispatch({
@@ -84,7 +84,9 @@ function ask_mobile_number() {
84
84
  type: 'IDENTIFY_FLOW_BY_MSISDN',
85
85
  result: RDS.NothingYet(),
86
86
  nextData: {
87
- nextAction: 'submitMSISDNAction'
87
+ nextAction: 'submitMSISDNAction',
88
+ msisdn: payload === null || payload === void 0 ? void 0 : payload.msisdn,
89
+ operator: payload === null || payload === void 0 ? void 0 : payload.operator
88
90
  }
89
91
  }
90
92
  });
@@ -126,7 +128,6 @@ function submitMSISDNAction(internationalMSISDN) {
126
128
 
127
129
  case 5:
128
130
  flowObj = _context.sent;
129
- console.log('flowObj', flowObj);
130
131
  dispatch({
131
132
  type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT',
132
133
  payload: {
@@ -140,18 +141,21 @@ function submitMSISDNAction(internationalMSISDN) {
140
141
  }
141
142
  });
142
143
  _context.t0 = strategy;
143
- _context.next = _context.t0 === 'pin-mo-redir-ask-mobile-number' ? 11 : _context.t0 === 'pin-mo-ask-mobile-number' ? 12 : _context.t0 === 'pin-combo-ask-mobile-number' ? 13 : 14;
144
+ _context.next = _context.t0 === 'pin-mo-redir-ask-mobile-number' ? 10 : _context.t0 === 'pin-mo-ask-mobile-number' ? 11 : _context.t0 === 'pin-combo-ask-mobile-number' ? 12 : _context.t0 === 'header-enrichment-script' ? 13 : 14;
144
145
  break;
145
146
 
146
- case 11:
147
+ case 10:
147
148
  return _context.abrupt("return", dispatch(pin_mo_redir_ask_mobile_number(flowObj, internationalMSISDN)));
148
149
 
149
- case 12:
150
+ case 11:
150
151
  return _context.abrupt("return", dispatch(pin_mo_ask_mobile_number(flowObj, internationalMSISDN)));
151
152
 
152
- case 13:
153
+ case 12:
153
154
  return _context.abrupt("return", dispatch(pin_combo_ask_mobile_number(flowObj, internationalMSISDN)));
154
155
 
156
+ case 13:
157
+ return _context.abrupt("return", dispatch(header_enrichment_script(flowObj, internationalMSISDN)));
158
+
155
159
  case 14:
156
160
  _context.next = 21;
157
161
  break;
@@ -186,6 +190,94 @@ function submitMSISDNAction(internationalMSISDN) {
186
190
  }();
187
191
  }
188
192
 
193
+ var header_enrichment_script = function header_enrichment_script(flowObj, msisdn) {
194
+ return function (dispatch) {
195
+ switch (flowObj.flow) {
196
+ case 'pin':
197
+ _.tracker.sendOptInFlowEvent('Pin');
198
+
199
+ dispatch({
200
+ type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT',
201
+ payload: {
202
+ type: 'IDENTIFY_FLOW_BY_MSISDN',
203
+ result: RDS.Loading(),
204
+ nextData: _objectSpread({
205
+ nextAction: 'submitMSISDNAction'
206
+ }, flowObj.operator && {
207
+ operator: flowObj.operator
208
+ })
209
+ }
210
+ });
211
+ return dispatch({
212
+ type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT',
213
+ payload: {
214
+ type: 'PIN',
215
+ result: _objectSpread({
216
+ nextAction: 'submitMSISDNAction',
217
+ config: flowObj.flowConfig,
218
+ msisdn: msisdn
219
+ }, flowObj.operator && {
220
+ operator: flowObj.operator
221
+ })
222
+ }
223
+ });
224
+
225
+ case 'mo':
226
+ _.tracker.sendOptInFlowEvent('Msisdn to sms');
227
+
228
+ return dispatch({
229
+ type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT',
230
+ payload: {
231
+ type: 'MO',
232
+ result: _objectSpread({
233
+ nextAction: 'submitMSISDNAction',
234
+ config: flowObj.flowConfig,
235
+ msisdn: msisdn,
236
+ rockman_id: flowObj.rockman_id
237
+ }, flowObj.operator && {
238
+ operator: flowObj.operator
239
+ })
240
+ }
241
+ });
242
+
243
+ case 'moRedir':
244
+ _.tracker.sendOptInFlowEvent('Redirect');
245
+
246
+ return dispatch({
247
+ type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT',
248
+ payload: {
249
+ type: 'MO_REDIR',
250
+ result: {
251
+ nextAction: 'submitMSISDNAction',
252
+ config: flowObj.flowConfig,
253
+ msisdn: msisdn,
254
+ rockman_id: flowObj.rockman_id
255
+ }
256
+ }
257
+ });
258
+
259
+ default:
260
+ _.tracker.sendOptInFlowEvent('Pin');
261
+
262
+ return dispatch({
263
+ type: 'IDENTIFY_FLOW_BY_MSISDN_SUBMIT',
264
+ payload: {
265
+ type: 'PIN',
266
+ result: _objectSpread({
267
+ nextAction: 'submitMSISDNAction',
268
+ config: flowObj.flowConfig,
269
+ rockman_id: flowObj.rockman_id
270
+ }, flowObj.operator && {
271
+ operator: flowObj.operator
272
+ })
273
+ }
274
+ });
275
+ }
276
+ };
277
+ };
278
+
279
+ exports.header_enrichment_script = header_enrichment_script;
280
+
189
281
  var pin_mo_ask_mobile_number = function pin_mo_ask_mobile_number(flowObj, msisdn) {
190
282
  return function (dispatch) {
191
283
  switch (flowObj.flow) {
@@ -0,0 +1,2 @@
1
+ import { AppThunk } from '../../../common-types/AppThunk';
2
+ export default function injectHeaderEnrichmentScript(): AppThunk;
@@ -35,13 +35,21 @@ require("core-js/modules/es.array.slice.js");
35
35
  Object.defineProperty(exports, "__esModule", {
36
36
  value: true
37
37
  });
38
- exports.storeEmail = void 0;
38
+ exports.default = injectHeaderEnrichmentScript;
39
39
 
40
40
  require("core-js/modules/es.object.to-string.js");
41
41
 
42
+ require("core-js/modules/es.regexp.to-string.js");
43
+
42
44
  require("core-js/modules/es.promise.js");
43
45
 
44
- require("core-js/modules/es.array.concat.js");
46
+ var _ = require("..");
47
+
48
+ var _loadScriptSrc = _interopRequireDefault(require("../../../utilities/loadScriptSrc"));
49
+
50
+ var _ask_mobile_number = _interopRequireDefault(require("./ask_mobile_number"));
51
+
52
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
45
53
 
46
54
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
47
55
 
@@ -49,30 +57,61 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
49
57
 
50
58
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
51
59
 
52
- var storeEmail = /*#__PURE__*/function () {
53
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(host, slug, service, rockmanId, email) {
54
- var isDMB, newHost;
55
- return _regeneratorRuntime().wrap(function _callee$(_context) {
56
- while (1) {
57
- switch (_context.prev = _context.next) {
58
- case 0:
59
- 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);
60
- newHost = isDMB ? 'de.tallymans.com' : host;
61
- return _context.abrupt("return", fetch("https://".concat(newHost, "/tallyman/helper/?action=store-email&slug=").concat(slug, "&rockman_id=").concat(rockmanId, "&email=").concat(email, "&product_identifier=").concat(service)).then(function (x) {
62
- return x.json();
63
- }));
64
-
65
- case 3:
66
- case "end":
67
- return _context.stop();
60
+ function injectHeaderEnrichmentScript() {
61
+ return /*#__PURE__*/function () {
62
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch) {
63
+ var _window, _window$pac_analytics, _window$pac_analytics2, url;
64
+
65
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
66
+ while (1) {
67
+ switch (_context.prev = _context.next) {
68
+ case 0:
69
+ try {
70
+ url = "http://de-he.tallymans.com/tallyman/he?rockman_id=".concat((_window = window) === null || _window === void 0 ? void 0 : (_window$pac_analytics = _window.pac_analytics) === null || _window$pac_analytics === void 0 ? void 0 : (_window$pac_analytics2 = _window$pac_analytics.visitor) === null || _window$pac_analytics2 === void 0 ? void 0 : _window$pac_analytics2.rockmanId);
71
+ (0, _loadScriptSrc.default)({
72
+ url: url
73
+ });
74
+ window.addEventListener('he-success', function (event) {
75
+ var _ref2 = event,
76
+ detail = _ref2.detail;
77
+
78
+ _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {
79
+ msisdn: detail === null || detail === void 0 ? void 0 : detail.msisdn
80
+ });
81
+
82
+ dispatch((0, _ask_mobile_number.default)({
83
+ msisdn: detail === null || detail === void 0 ? void 0 : detail.msisdn,
84
+ operator: detail === null || detail === void 0 ? void 0 : detail.operator_code
85
+ }));
86
+ });
87
+ window.addEventListener('he-fail', function (event) {
88
+ var _ref3 = event,
89
+ detail = _ref3.detail;
90
+
91
+ _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {
92
+ errorType: detail.toString()
93
+ });
94
+
95
+ dispatch((0, _ask_mobile_number.default)());
96
+ });
97
+ } catch (err) {
98
+ _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {
99
+ errorType: err.toString()
100
+ });
101
+
102
+ dispatch((0, _ask_mobile_number.default)());
103
+ }
104
+
105
+ case 1:
106
+ case "end":
107
+ return _context.stop();
108
+ }
68
109
  }
69
- }
70
- }, _callee);
71
- }));
72
-
73
- return function storeEmail(_x, _x2, _x3, _x4, _x5) {
74
- return _ref.apply(this, arguments);
75
- };
76
- }();
77
-
78
- exports.storeEmail = storeEmail;
110
+ }, _callee);
111
+ }));
112
+
113
+ return function (_x) {
114
+ return _ref.apply(this, arguments);
115
+ };
116
+ }();
117
+ }
@@ -224,7 +224,7 @@ function determineFlowByMsidn(_x5) {
224
224
 
225
225
  function _determineFlowByMsidn() {
226
226
  _determineFlowByMsidn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(internationalMSISDN) {
227
- var submissionError, msisdn, indentifyFlow, theResult, flow, cannotDetect, hlrError, _submissionError, flowObj, _flowObj, _submissionError2;
227
+ var submissionError, msisdn, indentifyFlow, theResult, mapAgencyOperator, flow, cannotDetect, hlrError, _submissionError, flowObj, _flowObj, _submissionError2;
228
228
 
229
229
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
230
230
  while (1) {
@@ -278,12 +278,31 @@ function _determineFlowByMsidn() {
278
278
 
279
279
  case 8:
280
280
  theResult = _context5.sent;
281
- flow = operatorsConfig[theResult.operator] ? operatorsConfig[theResult.operator] : null;
281
+ mapAgencyOperator = {
282
+ SA_STC: 'S2_STC',
283
+ SA_MOBILY: 'S2_MOBILY',
284
+ SA_ZAIN: 'S2_ZAIN',
285
+ KW_ZAIN: 'K2_ZAIN',
286
+ KW_OOREDOO: 'K2_OOREDOO',
287
+ KW_VIVA: 'K2_VIVA',
288
+ AE_DU: 'A2_DU',
289
+ AE_ETISALAT: 'A2_ETISALAT',
290
+ CA_SUNRISE: 'C2_SUNRISE',
291
+ CA_TELE2: 'C2_TELE2',
292
+ CA_SWISSCOM: 'C2_SWISSCOM',
293
+ CA_SALT: 'C2_SALT',
294
+ OM_OOREDOO: 'O2_OOREDOO',
295
+ OM_OMANTEL: 'O2_OMANTEL',
296
+ RS_TELEKOM: 'R2_TELEKOM',
297
+ RS_VIP: 'R2_VIP',
298
+ RS_TELIM: 'R2_TELIM'
299
+ };
300
+ flow = operatorsConfig[theResult.operator] || operatorsConfig[mapAgencyOperator[theResult.operator]] ? operatorsConfig[theResult.operator] || operatorsConfig[mapAgencyOperator[theResult.operator]] : null;
282
301
  cannotDetect = theResult.success === false && theResult.message === 'Operator could not be found for the given MSISDN';
283
302
  hlrError = theResult.success === false && theResult.message.indexOf('HLR did not find the operator for given MSISDN') !== -1;
284
303
 
285
304
  if (!(cannotDetect || hlrError)) {
286
- _context5.next = 19;
305
+ _context5.next = 20;
287
306
  break;
288
307
  }
289
308
 
@@ -292,9 +311,9 @@ function _determineFlowByMsidn() {
292
311
  _submissionError.msisdn = msisdn;
293
312
  throw _submissionError;
294
313
 
295
- case 19:
314
+ case 20:
296
315
  if (!(flow !== null)) {
297
- _context5.next = 24;
316
+ _context5.next = 25;
298
317
  break;
299
318
  }
300
319
 
@@ -304,9 +323,9 @@ function _determineFlowByMsidn() {
304
323
  }, flow);
305
324
  return _context5.abrupt("return", flowObj);
306
325
 
307
- case 24:
326
+ case 25:
308
327
  if (!(flow === null)) {
309
- _context5.next = 29;
328
+ _context5.next = 30;
310
329
  break;
311
330
  }
312
331
 
@@ -315,12 +334,12 @@ function _determineFlowByMsidn() {
315
334
  }, defaultFlowConfig);
316
335
  return _context5.abrupt("return", _flowObj);
317
336
 
318
- case 29:
337
+ case 30:
319
338
  _submissionError2 = new Error("Error in submitMSISDN() trigger-pin action");
320
339
  _submissionError2.type = 'SEInvalidMSISDN';
321
340
  throw _submissionError2;
322
341
 
323
- case 32:
342
+ case 33:
324
343
  case "end":
325
344
  return _context5.stop();
326
345
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "3.0.14",
3
+ "version": "3.0.16",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",
@@ -61,7 +61,7 @@
61
61
  "core-js": "3.23.4",
62
62
  "eslint": "^7.16.0",
63
63
  "eslint-config-airbnb": "^18.2.1",
64
- "eslint-config-ouisys": "^0.0.6",
64
+ "eslint-config-ouisys": "^0.0.9",
65
65
  "eslint-config-prettier": "^7.1.0",
66
66
  "eslint-plugin-import": "^2.22.1",
67
67
  "eslint-plugin-jest": "^24.1.3",
@@ -1,3 +0,0 @@
1
- import { IStoreEmailResult } from '../api';
2
- declare const storeEmail: (host: string, slug: string, service: string, rockmanId: string, email: string) => Promise<IStoreEmailResult>;
3
- export { storeEmail };