ouisys-engine 3.0.12 → 3.0.15

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
  }
@@ -1,4 +1,4 @@
1
- declare type IVisitor = {
1
+ export declare type IVisitor = {
2
2
  country: string;
3
3
  rockmanId: string;
4
4
  impressionNumber: number;
@@ -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);
@@ -1,2 +1,2 @@
1
- import IVisitor from '../common-types/IVisitor';
1
+ import { IVisitor } from '../common-types/IVisitor';
2
2
  export default function tryGetIPRangeName(visitor: IVisitor): Promise<string>;
@@ -53,6 +53,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
53
53
 
54
54
  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); }); }; }
55
55
 
56
+ // eslint-disable-next-line consistent-return
56
57
  function tryGetIPRangeName(_x) {
57
58
  return _tryGetIPRangeName.apply(this, arguments);
58
59
  }
@@ -64,7 +65,8 @@ function _tryGetIPRangeName() {
64
65
  while (1) {
65
66
  switch (_context.prev = _context.next) {
66
67
  case 0:
67
- mockip = (0, _queryString.default)(window.location.href, 'mock-ip') || process.env.mock_ip;
68
+ mockip = (0, _queryString.default)(window.location.href, 'mock-ip') || process.env.mock_ip; // eslint-disable-next-line no-console
69
+
68
70
  console.log('mockip', mockip);
69
71
 
70
72
  if (!(!visitor.ip && typeof window !== 'undefined')) {
@@ -113,7 +113,7 @@ function identify_user() {
113
113
  var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
114
114
  return /*#__PURE__*/function () {
115
115
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch) {
116
- var ipRangeName, heResult, flowObj, msisdn, operator;
116
+ var ipRangeName, heResult, flowObj, msisdn;
117
117
  return _regeneratorRuntime().wrap(function _callee$(_context) {
118
118
  while (1) {
119
119
  switch (_context.prev = _context.next) {
@@ -124,10 +124,9 @@ var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
124
124
 
125
125
  case 3:
126
126
  ipRangeName = _context.sent;
127
- console.log('ipRangeName', ipRangeName);
128
127
 
129
- if (!(ipRangeName == null)) {
130
- _context.next = 8;
128
+ if (!(ipRangeName === null)) {
129
+ _context.next = 7;
131
130
  break;
132
131
  }
133
132
 
@@ -144,21 +143,20 @@ var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
144
143
  }
145
144
  }));
146
145
 
147
- case 8:
148
- _context.next = 10;
146
+ case 7:
147
+ _context.next = 9;
149
148
  return (0, _utils.identifyUser)();
150
149
 
151
- case 10:
150
+ case 9:
152
151
  heResult = _context.sent;
153
152
  flowObj = defaultFlow;
154
153
 
155
154
  if (!(heResult.msisdn !== undefined && heResult.msisdn !== '')) {
156
- _context.next = 18;
155
+ _context.next = 16;
157
156
  break;
158
157
  }
159
158
 
160
- msisdn = heResult.msisdn;
161
- operator = heResult.operator;
159
+ msisdn = heResult.msisdn; // const { operator } = heResult;
162
160
 
163
161
  _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {
164
162
  msisdn: msisdn
@@ -180,7 +178,7 @@ var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
180
178
  }
181
179
  }));
182
180
 
183
- case 18:
181
+ case 16:
184
182
  _.tracker.sendOptInFlowEvent('Pin');
185
183
 
186
184
  return _context.abrupt("return", dispatch({
@@ -194,8 +192,8 @@ var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
194
192
  }
195
193
  }));
196
194
 
197
- case 22:
198
- _context.prev = 22;
195
+ case 20:
196
+ _context.prev = 20;
199
197
  _context.t0 = _context["catch"](0);
200
198
  console.warn(_context.t0);
201
199
 
@@ -216,12 +214,12 @@ var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
216
214
  }
217
215
  });
218
216
 
219
- case 28:
217
+ case 26:
220
218
  case "end":
221
219
  return _context.stop();
222
220
  }
223
221
  }
224
- }, _callee, null, [[0, 22]]);
222
+ }, _callee, null, [[0, 20]]);
225
223
  }));
226
224
 
227
225
  return function (_x) {
@@ -240,17 +238,13 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
240
238
  while (1) {
241
239
  switch (_context2.prev = _context2.next) {
242
240
  case 0:
243
- console.log('here');
244
-
245
241
  switchState = function switchState(_ref3) {
246
242
  var flowObj = _ref3.flowObj,
247
243
  msisdn = _ref3.msisdn,
248
244
  operator = _ref3.operator,
249
245
  subscription_url = _ref3.subscription_url,
250
246
  redirect_url = _ref3.redirect_url;
251
- var isHeaderEnrichmentSuccess = !!(msisdn !== undefined && msisdn !== ''); // eslint-disable-next-line no-console
252
-
253
- console.log('isHeaderEnrichmentSuccess', isHeaderEnrichmentSuccess);
247
+ var isHeaderEnrichmentSuccess = !!(msisdn !== undefined && msisdn !== '');
254
248
 
255
249
  switch (flowObj.flow) {
256
250
  case 'oneClick':
@@ -271,7 +265,7 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
271
265
  });
272
266
 
273
267
  case 'pin':
274
- if (isHeaderEnrichmentSuccess == true) {
268
+ if (isHeaderEnrichmentSuccess === true) {
275
269
  _.tracker.sendOptInFlowEvent('Hybrid Pin');
276
270
  } else {
277
271
  _.tracker.sendOptInFlowEvent('Pin');
@@ -309,14 +303,14 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
309
303
  }
310
304
  };
311
305
 
312
- _context2.next = 4;
306
+ _context2.next = 3;
313
307
  return (0, _tryGetIPRangeName.default)(window.pac_analytics.visitor);
314
308
 
315
- case 4:
309
+ case 3:
316
310
  ipRangeName = _context2.sent;
317
311
 
318
- if (!(ipRangeName == null)) {
319
- _context2.next = 8;
312
+ if (!(ipRangeName === null)) {
313
+ _context2.next = 7;
320
314
  break;
321
315
  }
322
316
 
@@ -334,26 +328,24 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
334
328
  }
335
329
  }));
336
330
 
337
- case 8:
338
- _context2.prev = 8;
331
+ case 7:
332
+ _context2.prev = 7;
339
333
  mapIpRangeToAgency = {
340
334
  om_ooredoo: 'o2_ooredoo'
341
335
  };
342
- flowObj = (0, _utils.determineFlowByOperator)(mapIpRangeToAgency[ipRangeName.toUpperCase()]); // eslint-disable-next-line no-console
343
-
344
- console.log('flowObj', flowObj);
336
+ flowObj = (0, _utils.determineFlowByOperator)(mapIpRangeToAgency[ipRangeName]);
345
337
 
346
338
  if (!(flowObj.flow === 'oneClick')) {
347
- _context2.next = 21;
339
+ _context2.next = 19;
348
340
  break;
349
341
  }
350
342
 
351
- _context2.next = 15;
343
+ _context2.next = 13;
352
344
  return (0, _utils.identifyUser)({
353
345
  operator: ipRangeName
354
346
  });
355
347
 
356
- case 15:
348
+ case 13:
357
349
  heResult = _context2.sent;
358
350
  msisdn = heResult.msisdn, subscription_url = heResult.subscription_url, redirect_url = heResult.redirect_url;
359
351
  operator = heResult.operator ? heResult.operator.toUpperCase() : ipRangeName.toUpperCase();
@@ -379,10 +371,10 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
379
371
  });
380
372
  }
381
373
 
382
- _context2.next = 23;
374
+ _context2.next = 21;
383
375
  break;
384
376
 
385
- case 21:
377
+ case 19:
386
378
  _.tracker.sendOptInFlowEvent('Pin');
387
379
 
388
380
  return _context2.abrupt("return", dispatch({
@@ -397,13 +389,13 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
397
389
  }
398
390
  }));
399
391
 
400
- case 23:
401
- _context2.next = 31;
392
+ case 21:
393
+ _context2.next = 29;
402
394
  break;
403
395
 
404
- case 25:
405
- _context2.prev = 25;
406
- _context2.t0 = _context2["catch"](8);
396
+ case 23:
397
+ _context2.prev = 23;
398
+ _context2.t0 = _context2["catch"](7);
407
399
  console.warn(_context2.t0);
408
400
 
409
401
  _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {
@@ -423,12 +415,12 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
423
415
  }
424
416
  });
425
417
 
426
- case 31:
418
+ case 29:
427
419
  case "end":
428
420
  return _context2.stop();
429
421
  }
430
422
  }
431
- }, _callee2, null, [[8, 25]]);
423
+ }, _callee2, null, [[7, 23]]);
432
424
  }));
433
425
 
434
426
  return function (_x2) {
@@ -442,8 +434,7 @@ exports.he_pin_one_click_header_enrichment = he_pin_one_click_header_enrichment;
442
434
  var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_header_enrichment(defaultFlow) {
443
435
  return /*#__PURE__*/function () {
444
436
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(dispatch) {
445
- var switchState, ipRangeName, flowObj, heResult, msisdn, subscription_url, redirect_url, operator, _flowObj, _flowObj2;
446
-
437
+ var switchState, ipRangeName, flowObj, heResult, msisdn, subscription_url, redirect_url, operator;
447
438
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
448
439
  while (1) {
449
440
  switch (_context3.prev = _context3.next) {
@@ -515,7 +506,7 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
515
506
  case 3:
516
507
  ipRangeName = _context3.sent;
517
508
 
518
- if (!(ipRangeName == null)) {
509
+ if (!ipRangeName) {
519
510
  _context3.next = 7;
520
511
  break;
521
512
  }
@@ -538,7 +529,7 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
538
529
  _context3.prev = 7;
539
530
  flowObj = (0, _utils.determineFlowByOperator)(ipRangeName.toUpperCase());
540
531
 
541
- if (!(flowObj.flow == 'oneClick')) {
532
+ if (!(flowObj.flow === 'oneClick')) {
542
533
  _context3.next = 18;
543
534
  break;
544
535
  }
@@ -556,20 +547,20 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
556
547
  if (msisdn && msisdn !== '') {
557
548
  _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {
558
549
  msisdn: msisdn
559
- });
550
+ }); // const flowObj = determineFlowByOperator(operator);
551
+
560
552
 
561
- _flowObj = (0, _utils.determineFlowByOperator)(operator);
562
553
  switchState({
563
- flowObj: _flowObj,
554
+ flowObj: flowObj,
564
555
  msisdn: msisdn,
565
556
  operator: operator,
566
557
  subscription_url: subscription_url,
567
558
  redirect_url: redirect_url
568
559
  });
569
560
  } else {
570
- _flowObj2 = (0, _utils.determineFlowByOperator)(operator);
561
+ // const flowObj = determineFlowByOperator(operator);
571
562
  switchState({
572
- flowObj: _flowObj2,
563
+ flowObj: flowObj,
573
564
  redirect_url: redirect_url,
574
565
  subscription_url: subscription_url,
575
566
  operator: operator
@@ -639,7 +630,7 @@ exports.he_mo_redir_one_click_header_enrichment = he_mo_redir_one_click_header_e
639
630
  var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichment(defaultFlow) {
640
631
  return /*#__PURE__*/function () {
641
632
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(dispatch) {
642
- var switchState, heResult, msisdn, operator, flowObj, _flowObj3, _flowObj4, _flowObj5;
633
+ var switchState, heResult, msisdn, operator, flowObj, _flowObj, _flowObj2, _flowObj3;
643
634
 
644
635
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
645
636
  while (1) {
@@ -668,7 +659,7 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
668
659
  });
669
660
 
670
661
  case 'pin':
671
- if (isHeaderEnrichmentSuccess == true) {
662
+ if (isHeaderEnrichmentSuccess === true) {
672
663
  _.tracker.sendOptInFlowEvent('Hybrid Pin');
673
664
  } else {
674
665
  _.tracker.sendOptInFlowEvent('Pin');
@@ -740,8 +731,8 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
740
731
  return (0, _utils.determineFlowByOperatorFromIp)();
741
732
 
742
733
  case 16:
743
- _flowObj3 = _context4.sent;
744
- switchState(_flowObj3, msisdn);
734
+ _flowObj = _context4.sent;
735
+ switchState(_flowObj, msisdn);
745
736
 
746
737
  case 18:
747
738
  _context4.next = 24;
@@ -752,8 +743,8 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
752
743
  return (0, _utils.determineFlowByOperatorFromIp)();
753
744
 
754
745
  case 22:
755
- _flowObj4 = _context4.sent;
756
- switchState(_flowObj4);
746
+ _flowObj2 = _context4.sent;
747
+ switchState(_flowObj2);
757
748
 
758
749
  case 24:
759
750
  _context4.next = 42;
@@ -773,8 +764,8 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
773
764
  return (0, _utils.determineFlowByOperatorFromIp)();
774
765
 
775
766
  case 33:
776
- _flowObj5 = _context4.sent;
777
- switchState(_flowObj5);
767
+ _flowObj3 = _context4.sent;
768
+ switchState(_flowObj3);
778
769
  _context4.next = 42;
779
770
  break;
780
771
 
@@ -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
  }
@@ -332,9 +351,9 @@ function _determineFlowByMsidn() {
332
351
 
333
352
  function determineFlowByOperator(operator) {
334
353
  var flowObj = _objectSpread({
335
- operator: operator,
354
+ operator: operator === null || operator === void 0 ? void 0 : operator.toUpperCase(),
336
355
  default: defaultFlowConfig
337
- }, operatorsConfig[operator]);
356
+ }, operatorsConfig[operator === null || operator === void 0 ? void 0 : operator.toUpperCase()]);
338
357
 
339
358
  return flowObj;
340
359
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "3.0.12",
3
+ "version": "3.0.15",
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.7",
65
65
  "eslint-config-prettier": "^7.1.0",
66
66
  "eslint-plugin-import": "^2.22.1",
67
67
  "eslint-plugin-jest": "^24.1.3",