ouisys-engine 3.0.11 → 3.0.14

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:
@@ -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,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
  }
@@ -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')) {
@@ -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":
@@ -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) {
@@ -235,8 +233,7 @@ exports.pin_header_enrichment = pin_header_enrichment;
235
233
  var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrichment(defaultFlow) {
236
234
  return /*#__PURE__*/function () {
237
235
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(dispatch) {
238
- var switchState, ipRangeName, flowObj, heResult, msisdn, subscription_url, redirect_url, operator, _flowObj, _flowObj2;
239
-
236
+ var switchState, ipRangeName, mapIpRangeToAgency, flowObj, heResult, msisdn, subscription_url, redirect_url, operator;
240
237
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
241
238
  while (1) {
242
239
  switch (_context2.prev = _context2.next) {
@@ -268,7 +265,7 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
268
265
  });
269
266
 
270
267
  case 'pin':
271
- if (isHeaderEnrichmentSuccess == true) {
268
+ if (isHeaderEnrichmentSuccess === true) {
272
269
  _.tracker.sendOptInFlowEvent('Hybrid Pin');
273
270
  } else {
274
271
  _.tracker.sendOptInFlowEvent('Pin');
@@ -312,7 +309,7 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
312
309
  case 3:
313
310
  ipRangeName = _context2.sent;
314
311
 
315
- if (!(ipRangeName == null)) {
312
+ if (!(ipRangeName === null)) {
316
313
  _context2.next = 7;
317
314
  break;
318
315
  }
@@ -333,19 +330,22 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
333
330
 
334
331
  case 7:
335
332
  _context2.prev = 7;
336
- flowObj = (0, _utils.determineFlowByOperator)(ipRangeName.toUpperCase());
333
+ mapIpRangeToAgency = {
334
+ om_ooredoo: 'o2_ooredoo'
335
+ };
336
+ flowObj = (0, _utils.determineFlowByOperator)(mapIpRangeToAgency[ipRangeName]);
337
337
 
338
- if (!(flowObj.flow == 'oneClick')) {
339
- _context2.next = 18;
338
+ if (!(flowObj.flow === 'oneClick')) {
339
+ _context2.next = 19;
340
340
  break;
341
341
  }
342
342
 
343
- _context2.next = 12;
343
+ _context2.next = 13;
344
344
  return (0, _utils.identifyUser)({
345
345
  operator: ipRangeName
346
346
  });
347
347
 
348
- case 12:
348
+ case 13:
349
349
  heResult = _context2.sent;
350
350
  msisdn = heResult.msisdn, subscription_url = heResult.subscription_url, redirect_url = heResult.redirect_url;
351
351
  operator = heResult.operator ? heResult.operator.toUpperCase() : ipRangeName.toUpperCase();
@@ -355,28 +355,26 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
355
355
  msisdn: msisdn
356
356
  });
357
357
 
358
- _flowObj = (0, _utils.determineFlowByOperator)(operator);
359
358
  switchState({
360
- flowObj: _flowObj,
359
+ flowObj: flowObj,
361
360
  msisdn: msisdn,
362
361
  operator: operator,
363
362
  subscription_url: subscription_url,
364
363
  redirect_url: redirect_url
365
364
  });
366
365
  } else {
367
- _flowObj2 = (0, _utils.determineFlowByOperator)(operator);
368
366
  switchState({
369
- flowObj: _flowObj2,
367
+ flowObj: flowObj,
370
368
  redirect_url: redirect_url,
371
369
  subscription_url: subscription_url,
372
370
  operator: operator
373
371
  });
374
372
  }
375
373
 
376
- _context2.next = 20;
374
+ _context2.next = 21;
377
375
  break;
378
376
 
379
- case 18:
377
+ case 19:
380
378
  _.tracker.sendOptInFlowEvent('Pin');
381
379
 
382
380
  return _context2.abrupt("return", dispatch({
@@ -391,12 +389,12 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
391
389
  }
392
390
  }));
393
391
 
394
- case 20:
395
- _context2.next = 28;
392
+ case 21:
393
+ _context2.next = 29;
396
394
  break;
397
395
 
398
- case 22:
399
- _context2.prev = 22;
396
+ case 23:
397
+ _context2.prev = 23;
400
398
  _context2.t0 = _context2["catch"](7);
401
399
  console.warn(_context2.t0);
402
400
 
@@ -417,12 +415,12 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
417
415
  }
418
416
  });
419
417
 
420
- case 28:
418
+ case 29:
421
419
  case "end":
422
420
  return _context2.stop();
423
421
  }
424
422
  }
425
- }, _callee2, null, [[7, 22]]);
423
+ }, _callee2, null, [[7, 23]]);
426
424
  }));
427
425
 
428
426
  return function (_x2) {
@@ -436,8 +434,7 @@ exports.he_pin_one_click_header_enrichment = he_pin_one_click_header_enrichment;
436
434
  var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_header_enrichment(defaultFlow) {
437
435
  return /*#__PURE__*/function () {
438
436
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(dispatch) {
439
- var switchState, ipRangeName, flowObj, heResult, msisdn, subscription_url, redirect_url, operator, _flowObj3, _flowObj4;
440
-
437
+ var switchState, ipRangeName, flowObj, heResult, msisdn, subscription_url, redirect_url, operator;
441
438
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
442
439
  while (1) {
443
440
  switch (_context3.prev = _context3.next) {
@@ -509,7 +506,7 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
509
506
  case 3:
510
507
  ipRangeName = _context3.sent;
511
508
 
512
- if (!(ipRangeName == null)) {
509
+ if (!ipRangeName) {
513
510
  _context3.next = 7;
514
511
  break;
515
512
  }
@@ -532,7 +529,7 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
532
529
  _context3.prev = 7;
533
530
  flowObj = (0, _utils.determineFlowByOperator)(ipRangeName.toUpperCase());
534
531
 
535
- if (!(flowObj.flow == 'oneClick')) {
532
+ if (!(flowObj.flow === 'oneClick')) {
536
533
  _context3.next = 18;
537
534
  break;
538
535
  }
@@ -550,20 +547,20 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
550
547
  if (msisdn && msisdn !== '') {
551
548
  _.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {
552
549
  msisdn: msisdn
553
- });
550
+ }); // const flowObj = determineFlowByOperator(operator);
551
+
554
552
 
555
- _flowObj3 = (0, _utils.determineFlowByOperator)(operator);
556
553
  switchState({
557
- flowObj: _flowObj3,
554
+ flowObj: flowObj,
558
555
  msisdn: msisdn,
559
556
  operator: operator,
560
557
  subscription_url: subscription_url,
561
558
  redirect_url: redirect_url
562
559
  });
563
560
  } else {
564
- _flowObj4 = (0, _utils.determineFlowByOperator)(operator);
561
+ // const flowObj = determineFlowByOperator(operator);
565
562
  switchState({
566
- flowObj: _flowObj4,
563
+ flowObj: flowObj,
567
564
  redirect_url: redirect_url,
568
565
  subscription_url: subscription_url,
569
566
  operator: operator
@@ -633,7 +630,7 @@ exports.he_mo_redir_one_click_header_enrichment = he_mo_redir_one_click_header_e
633
630
  var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichment(defaultFlow) {
634
631
  return /*#__PURE__*/function () {
635
632
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(dispatch) {
636
- var switchState, heResult, msisdn, operator, flowObj, _flowObj5, _flowObj6, _flowObj7;
633
+ var switchState, heResult, msisdn, operator, flowObj, _flowObj, _flowObj2, _flowObj3;
637
634
 
638
635
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
639
636
  while (1) {
@@ -662,7 +659,7 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
662
659
  });
663
660
 
664
661
  case 'pin':
665
- if (isHeaderEnrichmentSuccess == true) {
662
+ if (isHeaderEnrichmentSuccess === true) {
666
663
  _.tracker.sendOptInFlowEvent('Hybrid Pin');
667
664
  } else {
668
665
  _.tracker.sendOptInFlowEvent('Pin');
@@ -734,8 +731,8 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
734
731
  return (0, _utils.determineFlowByOperatorFromIp)();
735
732
 
736
733
  case 16:
737
- _flowObj5 = _context4.sent;
738
- switchState(_flowObj5, msisdn);
734
+ _flowObj = _context4.sent;
735
+ switchState(_flowObj, msisdn);
739
736
 
740
737
  case 18:
741
738
  _context4.next = 24;
@@ -746,8 +743,8 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
746
743
  return (0, _utils.determineFlowByOperatorFromIp)();
747
744
 
748
745
  case 22:
749
- _flowObj6 = _context4.sent;
750
- switchState(_flowObj6);
746
+ _flowObj2 = _context4.sent;
747
+ switchState(_flowObj2);
751
748
 
752
749
  case 24:
753
750
  _context4.next = 42;
@@ -767,8 +764,8 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
767
764
  return (0, _utils.determineFlowByOperatorFromIp)();
768
765
 
769
766
  case 33:
770
- _flowObj7 = _context4.sent;
771
- switchState(_flowObj7);
767
+ _flowObj3 = _context4.sent;
768
+ switchState(_flowObj3);
772
769
  _context4.next = 42;
773
770
  break;
774
771
 
@@ -332,9 +332,9 @@ function _determineFlowByMsidn() {
332
332
 
333
333
  function determineFlowByOperator(operator) {
334
334
  var flowObj = _objectSpread({
335
- operator: operator,
335
+ operator: operator === null || operator === void 0 ? void 0 : operator.toUpperCase(),
336
336
  default: defaultFlowConfig
337
- }, operatorsConfig[operator]);
337
+ }, operatorsConfig[operator === null || operator === void 0 ? void 0 : operator.toUpperCase()]);
338
338
 
339
339
  return flowObj;
340
340
  }
@@ -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.14",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",