ouisys-engine 3.0.11 → 3.0.12

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
@@ -148,7 +148,7 @@ var MockTallyman = {
148
148
  return _context3.abrupt("return", {
149
149
  success: true,
150
150
  rockman_id: '000',
151
- product_url: '/mock-product-url',
151
+ product_url: 'https://google.com',
152
152
  async: false
153
153
  });
154
154
 
@@ -177,7 +177,7 @@ var MockTallyman = {
177
177
  return _context4.abrupt("return", {
178
178
  success: true,
179
179
  rockman_id: '000',
180
- product_url: '/mock-product-url',
180
+ product_url: 'https://google.com',
181
181
  msisdn: '000'
182
182
  });
183
183
 
@@ -206,7 +206,7 @@ var MockTallyman = {
206
206
  return _context5.abrupt("return", {
207
207
  success: true,
208
208
  rockman_id: '000',
209
- product_url: '/mock-product-url',
209
+ product_url: 'https://google.com',
210
210
  msisdn: '000'
211
211
  });
212
212
 
@@ -235,7 +235,7 @@ var MockTallyman = {
235
235
  return _context6.abrupt("return", {
236
236
  success: true,
237
237
  rockman_id: '000',
238
- redirect_url: '/mock-product-url'
238
+ redirect_url: 'https://google.com'
239
239
  });
240
240
 
241
241
  case 3:
@@ -5,6 +5,9 @@ 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 */
8
11
  function strategy(_ref) {
9
12
  var identifyFlowByOperatorSelect = _ref.identifyFlowByOperatorSelect,
10
13
  identifyFlowByMsisdn = _ref.identifyFlowByMsisdn,
@@ -39,12 +42,6 @@ function strategy(_ref) {
39
42
 
40
43
  case 'USSD':
41
44
  return ussdFlow(state.result);
42
-
43
- default:
44
- // TODO - this should be an error or something
45
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
46
- // @ts-ignore
47
- return identifyFlowByOperatorSelect(state.result);
48
45
  }
49
46
  };
50
47
  }
@@ -223,7 +223,7 @@ var mockedMSISDNEntrySuccess = {
223
223
  currentState: {
224
224
  type: 'MSISDNEntry',
225
225
  result: RDS.Success({
226
- href: '/mock-product-url'
226
+ href: 'https://google.com'
227
227
  })
228
228
  }
229
229
  };
@@ -395,7 +395,7 @@ var mockedRedirectUrlSuccessState = {
395
395
  type: 'GET_REDIRECT_URL',
396
396
  // @ts-ignore
397
397
  result: RDS.Success({
398
- redirectUrl: '/mock-product-url'
398
+ redirectUrl: 'https://google.com'
399
399
  })
400
400
  }
401
401
  };
@@ -523,7 +523,7 @@ var mockedCompletedState = {
523
523
  currentState: {
524
524
  type: 'PINEntry',
525
525
  result: RDS.Success({
526
- finalUrl: '/mock-product-url'
526
+ finalUrl: 'https://google.com'
527
527
  }),
528
528
  data: {
529
529
  actualPIN: '',
@@ -152,7 +152,7 @@ function mockStrategyStateByUrlParam() {
152
152
  break;
153
153
 
154
154
  default:
155
- throw 'Mock Flow not supported';
155
+ throw new Error('Mock Flow not supported');
156
156
  }
157
157
  }
158
158
  };
@@ -306,7 +306,7 @@ function identifyStrategy() {
306
306
  }));
307
307
 
308
308
  case 31:
309
- throw 'Strategy not supported';
309
+ throw new Error('Strategy not supported');
310
310
 
311
311
  case 32:
312
312
  case "end":
@@ -235,19 +235,22 @@ exports.pin_header_enrichment = pin_header_enrichment;
235
235
  var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrichment(defaultFlow) {
236
236
  return /*#__PURE__*/function () {
237
237
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(dispatch) {
238
- var switchState, ipRangeName, flowObj, heResult, msisdn, subscription_url, redirect_url, operator, _flowObj, _flowObj2;
239
-
238
+ var switchState, ipRangeName, mapIpRangeToAgency, flowObj, heResult, msisdn, subscription_url, redirect_url, operator;
240
239
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
241
240
  while (1) {
242
241
  switch (_context2.prev = _context2.next) {
243
242
  case 0:
243
+ console.log('here');
244
+
244
245
  switchState = function switchState(_ref3) {
245
246
  var flowObj = _ref3.flowObj,
246
247
  msisdn = _ref3.msisdn,
247
248
  operator = _ref3.operator,
248
249
  subscription_url = _ref3.subscription_url,
249
250
  redirect_url = _ref3.redirect_url;
250
- var isHeaderEnrichmentSuccess = !!(msisdn !== undefined && msisdn !== '');
251
+ var isHeaderEnrichmentSuccess = !!(msisdn !== undefined && msisdn !== ''); // eslint-disable-next-line no-console
252
+
253
+ console.log('isHeaderEnrichmentSuccess', isHeaderEnrichmentSuccess);
251
254
 
252
255
  switch (flowObj.flow) {
253
256
  case 'oneClick':
@@ -306,14 +309,14 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
306
309
  }
307
310
  };
308
311
 
309
- _context2.next = 3;
312
+ _context2.next = 4;
310
313
  return (0, _tryGetIPRangeName.default)(window.pac_analytics.visitor);
311
314
 
312
- case 3:
315
+ case 4:
313
316
  ipRangeName = _context2.sent;
314
317
 
315
318
  if (!(ipRangeName == null)) {
316
- _context2.next = 7;
319
+ _context2.next = 8;
317
320
  break;
318
321
  }
319
322
 
@@ -331,21 +334,26 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
331
334
  }
332
335
  }));
333
336
 
334
- case 7:
335
- _context2.prev = 7;
336
- flowObj = (0, _utils.determineFlowByOperator)(ipRangeName.toUpperCase());
337
+ case 8:
338
+ _context2.prev = 8;
339
+ mapIpRangeToAgency = {
340
+ om_ooredoo: 'o2_ooredoo'
341
+ };
342
+ flowObj = (0, _utils.determineFlowByOperator)(mapIpRangeToAgency[ipRangeName.toUpperCase()]); // eslint-disable-next-line no-console
337
343
 
338
- if (!(flowObj.flow == 'oneClick')) {
339
- _context2.next = 18;
344
+ console.log('flowObj', flowObj);
345
+
346
+ if (!(flowObj.flow === 'oneClick')) {
347
+ _context2.next = 21;
340
348
  break;
341
349
  }
342
350
 
343
- _context2.next = 12;
351
+ _context2.next = 15;
344
352
  return (0, _utils.identifyUser)({
345
353
  operator: ipRangeName
346
354
  });
347
355
 
348
- case 12:
356
+ case 15:
349
357
  heResult = _context2.sent;
350
358
  msisdn = heResult.msisdn, subscription_url = heResult.subscription_url, redirect_url = heResult.redirect_url;
351
359
  operator = heResult.operator ? heResult.operator.toUpperCase() : ipRangeName.toUpperCase();
@@ -355,28 +363,26 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
355
363
  msisdn: msisdn
356
364
  });
357
365
 
358
- _flowObj = (0, _utils.determineFlowByOperator)(operator);
359
366
  switchState({
360
- flowObj: _flowObj,
367
+ flowObj: flowObj,
361
368
  msisdn: msisdn,
362
369
  operator: operator,
363
370
  subscription_url: subscription_url,
364
371
  redirect_url: redirect_url
365
372
  });
366
373
  } else {
367
- _flowObj2 = (0, _utils.determineFlowByOperator)(operator);
368
374
  switchState({
369
- flowObj: _flowObj2,
375
+ flowObj: flowObj,
370
376
  redirect_url: redirect_url,
371
377
  subscription_url: subscription_url,
372
378
  operator: operator
373
379
  });
374
380
  }
375
381
 
376
- _context2.next = 20;
382
+ _context2.next = 23;
377
383
  break;
378
384
 
379
- case 18:
385
+ case 21:
380
386
  _.tracker.sendOptInFlowEvent('Pin');
381
387
 
382
388
  return _context2.abrupt("return", dispatch({
@@ -391,13 +397,13 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
391
397
  }
392
398
  }));
393
399
 
394
- case 20:
395
- _context2.next = 28;
400
+ case 23:
401
+ _context2.next = 31;
396
402
  break;
397
403
 
398
- case 22:
399
- _context2.prev = 22;
400
- _context2.t0 = _context2["catch"](7);
404
+ case 25:
405
+ _context2.prev = 25;
406
+ _context2.t0 = _context2["catch"](8);
401
407
  console.warn(_context2.t0);
402
408
 
403
409
  _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detection-failure', {
@@ -417,12 +423,12 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
417
423
  }
418
424
  });
419
425
 
420
- case 28:
426
+ case 31:
421
427
  case "end":
422
428
  return _context2.stop();
423
429
  }
424
430
  }
425
- }, _callee2, null, [[7, 22]]);
431
+ }, _callee2, null, [[8, 25]]);
426
432
  }));
427
433
 
428
434
  return function (_x2) {
@@ -436,7 +442,7 @@ exports.he_pin_one_click_header_enrichment = he_pin_one_click_header_enrichment;
436
442
  var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_header_enrichment(defaultFlow) {
437
443
  return /*#__PURE__*/function () {
438
444
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(dispatch) {
439
- var switchState, ipRangeName, flowObj, heResult, msisdn, subscription_url, redirect_url, operator, _flowObj3, _flowObj4;
445
+ var switchState, ipRangeName, flowObj, heResult, msisdn, subscription_url, redirect_url, operator, _flowObj, _flowObj2;
440
446
 
441
447
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
442
448
  while (1) {
@@ -552,18 +558,18 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
552
558
  msisdn: msisdn
553
559
  });
554
560
 
555
- _flowObj3 = (0, _utils.determineFlowByOperator)(operator);
561
+ _flowObj = (0, _utils.determineFlowByOperator)(operator);
556
562
  switchState({
557
- flowObj: _flowObj3,
563
+ flowObj: _flowObj,
558
564
  msisdn: msisdn,
559
565
  operator: operator,
560
566
  subscription_url: subscription_url,
561
567
  redirect_url: redirect_url
562
568
  });
563
569
  } else {
564
- _flowObj4 = (0, _utils.determineFlowByOperator)(operator);
570
+ _flowObj2 = (0, _utils.determineFlowByOperator)(operator);
565
571
  switchState({
566
- flowObj: _flowObj4,
572
+ flowObj: _flowObj2,
567
573
  redirect_url: redirect_url,
568
574
  subscription_url: subscription_url,
569
575
  operator: operator
@@ -633,7 +639,7 @@ exports.he_mo_redir_one_click_header_enrichment = he_mo_redir_one_click_header_e
633
639
  var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichment(defaultFlow) {
634
640
  return /*#__PURE__*/function () {
635
641
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(dispatch) {
636
- var switchState, heResult, msisdn, operator, flowObj, _flowObj5, _flowObj6, _flowObj7;
642
+ var switchState, heResult, msisdn, operator, flowObj, _flowObj3, _flowObj4, _flowObj5;
637
643
 
638
644
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
639
645
  while (1) {
@@ -734,8 +740,8 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
734
740
  return (0, _utils.determineFlowByOperatorFromIp)();
735
741
 
736
742
  case 16:
737
- _flowObj5 = _context4.sent;
738
- switchState(_flowObj5, msisdn);
743
+ _flowObj3 = _context4.sent;
744
+ switchState(_flowObj3, msisdn);
739
745
 
740
746
  case 18:
741
747
  _context4.next = 24;
@@ -746,8 +752,8 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
746
752
  return (0, _utils.determineFlowByOperatorFromIp)();
747
753
 
748
754
  case 22:
749
- _flowObj6 = _context4.sent;
750
- switchState(_flowObj6);
755
+ _flowObj4 = _context4.sent;
756
+ switchState(_flowObj4);
751
757
 
752
758
  case 24:
753
759
  _context4.next = 42;
@@ -767,8 +773,8 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
767
773
  return (0, _utils.determineFlowByOperatorFromIp)();
768
774
 
769
775
  case 33:
770
- _flowObj7 = _context4.sent;
771
- switchState(_flowObj7);
776
+ _flowObj5 = _context4.sent;
777
+ switchState(_flowObj5);
772
778
  _context4.next = 42;
773
779
  break;
774
780
 
@@ -581,7 +581,7 @@ var subscribe = /*#__PURE__*/function () {
581
581
  // subscribeError['type'] = "SubscriptionError";
582
582
  // throw subscribeError
583
583
  // }else{
584
- '/mock-product-url');
584
+ 'https://google.com');
585
585
 
586
586
  case 1:
587
587
  case "end":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "3.0.11",
3
+ "version": "3.0.12",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",