ouisys-engine 3.0.14 → 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
  }
@@ -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);
@@ -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.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",