ouisys-engine 2.1.26 → 2.1.30

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.
@@ -1,7 +1,11 @@
1
1
  import { IOneClickFlowReducerState, IOneClickActions, IOneClickFlowActionMaps, ILinkExtraParams, IMockOneClickFlowStates } from "./OneClickTypes";
2
2
  import { AppThunk } from "../../common-types/AppThunk";
3
3
  import { IHash } from "../strategy/StrategyTypes";
4
- export declare function getRedirectUrlAction(extraParams?: ILinkExtraParams, autoRedirect?: boolean, isGetRedirectBupperWay?: boolean): AppThunk;
4
+ export declare function getRedirectUrlAction({ extraParams, autoRedirect, isGetRedirectBupperWay }: {
5
+ extraParams?: ILinkExtraParams;
6
+ autoRedirect?: boolean;
7
+ isGetRedirectBupperWay?: boolean;
8
+ }): AppThunk;
5
9
  export declare function subscribeUrlAction(autoRedirect?: boolean, extraParams?: IHash): AppThunk;
6
10
  export declare function mockOneClickFlow(mockState: IMockOneClickFlowStates): AppThunk;
7
11
  export declare const OneClickFlowActionMaps: IOneClickFlowActionMaps;
@@ -64,9 +64,14 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
64
64
  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); }); }; }
65
65
 
66
66
  //ACTION CREATORS
67
- function getRedirectUrlAction(extraParams, autoRedirect, isGetRedirectBupperWay) {
67
+ function getRedirectUrlAction(_ref) {
68
+ var extraParams = _ref.extraParams,
69
+ _ref$autoRedirect = _ref.autoRedirect,
70
+ autoRedirect = _ref$autoRedirect === void 0 ? false : _ref$autoRedirect,
71
+ _ref$isGetRedirectBup = _ref.isGetRedirectBupperWay,
72
+ isGetRedirectBupperWay = _ref$isGetRedirectBup === void 0 ? false : _ref$isGetRedirectBup;
68
73
  return /*#__PURE__*/function () {
69
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(dispatch, store) {
74
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(dispatch, store) {
70
75
  var currentState, _currentState$result, config, subscription_url, redirect_url, redirectUrl, _yield$getRedirectUrl, _redirect_url;
71
76
 
72
77
  return regeneratorRuntime.wrap(function _callee$(_context) {
@@ -241,14 +246,14 @@ function getRedirectUrlAction(extraParams, autoRedirect, isGetRedirectBupperWay)
241
246
  }));
242
247
 
243
248
  return function (_x, _x2) {
244
- return _ref.apply(this, arguments);
249
+ return _ref2.apply(this, arguments);
245
250
  };
246
251
  }();
247
252
  }
248
253
 
249
254
  function subscribeUrlAction(autoRedirect, extraParams) {
250
255
  return /*#__PURE__*/function () {
251
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(dispatch, store) {
256
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(dispatch, store) {
252
257
  var currentState, subscription_url, product_url, errorType;
253
258
  return regeneratorRuntime.wrap(function _callee2$(_context2) {
254
259
  while (1) {
@@ -356,7 +361,7 @@ function subscribeUrlAction(autoRedirect, extraParams) {
356
361
  }));
357
362
 
358
363
  return function (_x3, _x4) {
359
- return _ref2.apply(this, arguments);
364
+ return _ref3.apply(this, arguments);
360
365
  };
361
366
  }();
362
367
  }
@@ -393,7 +393,7 @@ function submitPIN(_x16, _x17, _x18, _x19) {
393
393
 
394
394
  function _submitPIN() {
395
395
  _submitPIN = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(window, pin, config, extraParams) {
396
- var slug, country, device, host, offer, extraParamsQs, rockmanId, emptyPinError, uniqid, evinaTid, pinResult, pinError, check, checkResult, isAlreadySubscribed, _pinError, _isAlreadySubscribed;
396
+ var slug, country, device, host, offer, extraParamsQs, rockmanId, emptyPinError, uniqid, evinaTid, pinResult, pinErrorTypeMap, errorMessage, pinError, check, checkResult, isAlreadySubscribed, _pinError, _isAlreadySubscribed;
397
397
 
398
398
  return regeneratorRuntime.wrap(function _callee6$(_context6) {
399
399
  while (1) {
@@ -430,17 +430,22 @@ function _submitPIN() {
430
430
  pinResult = _context6.sent;
431
431
 
432
432
  if (!(false === pinResult.success)) {
433
- _context6.next = 20;
433
+ _context6.next = 22;
434
434
  break;
435
435
  }
436
436
 
437
- pinError = new Error("Error in submitMSISDN() verify-pin action:\n".concat(pinResult.message));
438
- pinError['type'] = "InvalidPIN";
437
+ pinErrorTypeMap = {
438
+ "pin does not match": "InvalidPIN",
439
+ "mcp blocked": "SessionBlocked"
440
+ };
441
+ errorMessage = pinErrorTypeMap[pinResult.message];
442
+ pinError = new Error("Error in submitMSISDN() verify-pin action:\n".concat(errorMessage));
443
+ pinError['type'] = errorMessage ? errorMessage : "InvalidPIN";
439
444
  throw pinError;
440
445
 
441
- case 20:
446
+ case 22:
442
447
  if (!(true === pinResult.async)) {
443
- _context6.next = 35;
448
+ _context6.next = 37;
444
449
  break;
445
450
  }
446
451
 
@@ -448,16 +453,16 @@ function _submitPIN() {
448
453
  return window.tallymanApi.checkSubscription(host, country, slug, device, offer, rockmanId, pin, extraParamsQs);
449
454
  };
450
455
 
451
- _context6.next = 24;
456
+ _context6.next = 26;
452
457
  return (0, _utils.loop)(check, 30, function (r) {
453
458
  return r.success;
454
459
  }, 0);
455
460
 
456
- case 24:
461
+ case 26:
457
462
  checkResult = _context6.sent;
458
463
 
459
464
  if (!(true === checkResult.success)) {
460
- _context6.next = 30;
465
+ _context6.next = 32;
461
466
  break;
462
467
  }
463
468
 
@@ -467,23 +472,23 @@ function _submitPIN() {
467
472
  isAlreadySubscribed: isAlreadySubscribed
468
473
  });
469
474
 
470
- case 30:
475
+ case 32:
471
476
  _pinError = new Error("Error in submitMSISDN() verify-pin action:\n".concat(checkResult.message));
472
477
  _pinError['type'] = "InvalidPIN";
473
478
  throw _pinError;
474
479
 
475
- case 33:
476
- _context6.next = 37;
480
+ case 35:
481
+ _context6.next = 39;
477
482
  break;
478
483
 
479
- case 35:
484
+ case 37:
480
485
  _isAlreadySubscribed = pinResult.message == "ALREADY SUBSCRIBED" ? true : false;
481
486
  return _context6.abrupt("return", {
482
487
  productUrl: pinResult.product_url || null,
483
488
  isAlreadySubscribed: _isAlreadySubscribed
484
489
  });
485
490
 
486
- case 37:
491
+ case 39:
487
492
  case "end":
488
493
  return _context6.stop();
489
494
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "2.1.26",
3
+ "version": "2.1.30",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",
@@ -11,7 +11,7 @@ import { IHash } from "../strategy/StrategyTypes";
11
11
 
12
12
 
13
13
  //ACTION CREATORS
14
- export function getRedirectUrlAction(extraParams?:ILinkExtraParams, autoRedirect?:boolean, isGetRedirectBupperWay?:boolean):AppThunk{
14
+ export function getRedirectUrlAction({extraParams, autoRedirect = false, isGetRedirectBupperWay = false}:{extraParams?:ILinkExtraParams, autoRedirect?:boolean, isGetRedirectBupperWay?:boolean}):AppThunk{
15
15
 
16
16
  return async (dispatch, store)=>{
17
17
  const {currentState} = store().strategy
@@ -168,8 +168,13 @@ export async function submitPIN(window:Window, pin: string, config:IConfig, extr
168
168
 
169
169
  const pinResult: IPINSubmissionResult = await window.tallymanApi.verifyPin(host, country, slug, device, offer, rockmanId, pin, extraParamsQs, uniqid, evinaTid)
170
170
  if (false === pinResult.success) {
171
- const pinError = new Error(`Error in submitMSISDN() verify-pin action:\n${pinResult.message}`) as IError & {type:string}
172
- pinError['type'] = "InvalidPIN";
171
+ const pinErrorTypeMap:{[key:string]:string} = {
172
+ "pin does not match": "InvalidPIN",
173
+ "mcp blocked": "SessionBlocked"
174
+ }
175
+ const errorMessage = pinErrorTypeMap[pinResult.message as string]
176
+ const pinError = new Error(`Error in submitMSISDN() verify-pin action:\n${errorMessage}`) as IError & {type:string}
177
+ pinError['type'] = errorMessage ? errorMessage : "InvalidPIN";
173
178
  throw pinError
174
179
  } else {
175
180
  if(true === pinResult.async) {