@tap-payments/auth-jsconnect 2.9.14-development → 2.9.15-development

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.
@@ -79,7 +79,8 @@ var CloseIconStyled = styled(Icon)(function (_a) {
79
79
  var theme = _a.theme;
80
80
  return ({
81
81
  width: theme.spacing(3.75),
82
- height: theme.spacing(3.75)
82
+ height: theme.spacing(3.75),
83
+ cursor: 'pointer'
83
84
  });
84
85
  });
85
86
  var CloseBox = styled(Box)(function (_a) {
@@ -89,7 +90,6 @@ var CloseBox = styled(Box)(function (_a) {
89
90
  justifyContent: 'end',
90
91
  marginBlockStart: theme.spacing(2),
91
92
  marginInlineEnd: theme.spacing(2),
92
- cursor: 'pointer',
93
93
  direction: theme.direction,
94
94
  position: 'absolute',
95
95
  right: 0,
@@ -134,6 +134,6 @@ var BottomSheetComponent = function (_a) {
134
134
  return (_jsxs(BottomSheetStyled, __assign({ languageBarHeight: getLanguageBarHeight(), dialogEdgeFormat: dialogEdgeFormat, sibling: hideFooter ? (_jsx(_Fragment, {})) : (open && (_jsx(LanguageFooterStyled, { children: _jsx(CustomFooter, {}) }))), isMaturityExpress: isMaturityExpress, showPoweredBy: !hidePoweredBy, sx: { pointerEvents: pointerEvents }, ref: sheetRef, open: open, snapPoints: function (_a) {
135
135
  var maxHeight = _a.maxHeight;
136
136
  return [getMinHeight(maxHeight), maxHeight * 0.95];
137
- } }, rest, { children: [isMaturityExpress && !hideMerchantLogo && (_jsx(LogoBadge, { src: isMaturityExpress ? logo || ICONS_NAMES.LOGO_ICON : ICONS_NAMES.LOGO_ICON })), onClose && (_jsx(CloseBox, __assign({ id: 'close-container', onClick: handleOnCloseButton }, { children: _jsx(CloseIconStyled, { src: ICONS_NAMES.CLOSE_ICON }) }))), children, isMaturityExpress && !hidePoweredBy && (_jsx(FooterStyled, { children: _jsx(PoweredByFooter, { id: 'bottom-sheet-powered_by_footer', sx: { margin: '0px' }, textSx: { color: 'rgba(63, 66, 77, 0.6)' }, icon: isAr ? ICONS_NAMES.LOGO_WITH_NAME_DARK_AR_ICON : ICONS_NAMES.LOGO_WITH_NAME_DARK_EN_ICON }) }))] })));
137
+ } }, rest, { children: [isMaturityExpress && !hideMerchantLogo && (_jsx(LogoBadge, { src: isMaturityExpress ? logo || ICONS_NAMES.LOGO_ICON : ICONS_NAMES.LOGO_ICON })), onClose && (_jsx(CloseBox, __assign({ id: 'close-container' }, { children: _jsx(CloseIconStyled, { src: ICONS_NAMES.CLOSE_ICON, onClick: handleOnCloseButton }) }))), children, isMaturityExpress && !hidePoweredBy && (_jsx(FooterStyled, { children: _jsx(PoweredByFooter, { id: 'bottom-sheet-powered_by_footer', sx: { margin: '0px' }, textSx: { color: 'rgba(63, 66, 77, 0.6)' }, icon: isAr ? ICONS_NAMES.LOGO_WITH_NAME_DARK_AR_ICON : ICONS_NAMES.LOGO_WITH_NAME_DARK_EN_ICON }) }))] })));
138
138
  };
139
139
  export default React.memo(BottomSheetComponent);
@@ -71,7 +71,7 @@ import { handleCurrentActiveScreen, handleNextScreenStep, handleSetCountryByIso2
71
71
  import { COLLECT_DOB_INFO_NAFATH, CONNECT_STEP_NAMES, defaultCountry, IDENTIFICATION_TYPE, NAFATH_VERIFICATION_FAILED, OTHER_BRAND } from '../../../constants';
72
72
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
73
73
  import { AuthForType, FlowsTypes } from '../../../@types';
74
- import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep, sendCustomEventToGTM, isOtherThanKWOrSA, isKW, findCountryByIso2, getMetaData, isSA } from '../../../utils';
74
+ import { capitalizeTheFirstLetterOfEachWord, concatenateObjectValues, findCountryByIddPrefix, fixBrandList, isTwitter, getIndividualName, isWebsite, sleep, sendCustomEventToGTM, isOtherThanKWOrSA, isKW, findCountryByIso2, getMetaData, isSA, isNetworkError } from '../../../utils';
75
75
  export var updateBusinessCountry = createAsyncThunk('connect/updateBusinessCountry', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
76
76
  var connect, payload, data;
77
77
  return __generator(this, function (_a) {
@@ -363,7 +363,7 @@ export var verifyPACI = createAsyncThunk('connect/verifyPACI', function (params,
363
363
  });
364
364
  }); });
365
365
  export var verifyNafath = createAsyncThunk('connect/verifyNafath', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
366
- var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, isSuccess, isFailed, countryCode, lead_id, leadResponse, channels, brand, err_5, brands, err_6, phone, isNextScreenDob, stepName;
366
+ var _a, settings, connect, responseBody, expiry, interval, maxCalls, count, authResponse, error_1, isSuccess, isFailed, countryCode, lead_id, leadResponse, channels, brand, err_5, brands, err_6, phone, isNextScreenDob, stepName;
367
367
  var _b, _c, _d, _e, _f, _g, _h;
368
368
  return __generator(this, function (_j) {
369
369
  switch (_j.label) {
@@ -376,58 +376,70 @@ export var verifyNafath = createAsyncThunk('connect/verifyNafath', function (par
376
376
  count = 1;
377
377
  _j.label = 1;
378
378
  case 1:
379
- if (!(count <= maxCalls)) return [3, 16];
379
+ if (!(count <= maxCalls)) return [3, 19];
380
380
  if (thunkApi.signal.aborted) {
381
- return [3, 16];
381
+ return [3, 19];
382
382
  }
383
- return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
383
+ authResponse = void 0;
384
+ _j.label = 2;
384
385
  case 2:
386
+ _j.trys.push([2, 4, , 5]);
387
+ return [4, API.authService.getVerifyAuth(responseBody === null || responseBody === void 0 ? void 0 : responseBody.auth_token)];
388
+ case 3:
385
389
  authResponse = _j.sent();
386
- isSuccess = ((_b = authResponse.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
390
+ return [3, 5];
391
+ case 4:
392
+ error_1 = _j.sent();
393
+ if (!isNetworkError(error_1.message)) {
394
+ throw new Error(error_1);
395
+ }
396
+ return [3, 5];
397
+ case 5:
398
+ isSuccess = ((_b = authResponse === null || authResponse === void 0 ? void 0 : authResponse.status) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'success';
387
399
  isFailed = ((_c = authResponse === null || authResponse === void 0 ? void 0 : authResponse.status) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === 'failed';
388
400
  countryCode = settings.data.businessCountry;
389
401
  if (isFailed) {
390
402
  (_d = params.onFailure) === null || _d === void 0 ? void 0 : _d.call(params);
391
403
  return [2, { authResponse: authResponse, countryCode: countryCode }];
392
404
  }
393
- if (!isSuccess) return [3, 13];
405
+ if (!isSuccess) return [3, 16];
394
406
  lead_id = authResponse.lead_id;
395
407
  if (!lead_id)
396
408
  throw new Error('Lead id is missing');
397
409
  return [4, API.leadService.retrieveLead(lead_id)];
398
- case 3:
410
+ case 6:
399
411
  leadResponse = (_j.sent()).data;
400
412
  if ((_e = leadResponse.errors) === null || _e === void 0 ? void 0 : _e.length)
401
413
  throw new Error(leadResponse.errors[0].description);
402
414
  return [4, API.dataService.getChannelsOfServices({ page: 0 })];
403
- case 4:
415
+ case 7:
404
416
  channels = (_j.sent()).list;
405
417
  leadResponse.channel_list = channels;
406
- _j.label = 5;
407
- case 5:
408
- _j.trys.push([5, 7, , 8]);
418
+ _j.label = 8;
419
+ case 8:
420
+ _j.trys.push([8, 10, , 11]);
409
421
  return [4, API.brandService.retrieveBrand(leadResponse.brand.id)];
410
- case 6:
422
+ case 9:
411
423
  brand = (_j.sent()).brand;
412
424
  leadResponse.brand = __assign(__assign({}, leadResponse.brand), brand);
413
- return [3, 8];
414
- case 7:
425
+ return [3, 11];
426
+ case 10:
415
427
  err_5 = _j.sent();
416
- return [3, 8];
417
- case 8:
418
- _j.trys.push([8, 10, , 11]);
428
+ return [3, 11];
429
+ case 11:
430
+ _j.trys.push([11, 13, , 14]);
419
431
  return [4, API.brandService.getBrandList({ individual_id: leadResponse.individual_id })];
420
- case 9:
432
+ case 12:
421
433
  brands = (_j.sent()).brands;
422
434
  leadResponse.brand_list = fixBrandList(brands, channels);
423
- return [3, 11];
424
- case 10:
435
+ return [3, 14];
436
+ case 13:
425
437
  err_6 = _j.sent();
426
- return [3, 11];
427
- case 11:
438
+ return [3, 14];
439
+ case 14:
428
440
  (_f = params.onSuccess) === null || _f === void 0 ? void 0 : _f.call(params);
429
441
  return [4, sleep(3000)];
430
- case 12:
442
+ case 15:
431
443
  _j.sent();
432
444
  phone = (leadResponse.contact || {}).phone;
433
445
  if (phone === null || phone === void 0 ? void 0 : phone.country_code)
@@ -437,14 +449,14 @@ export var verifyNafath = createAsyncThunk('connect/verifyNafath', function (par
437
449
  stepName = isNextScreenDob ? 'CONNECT_DOB_STEP' : 'CONNECT_INDIVIDUAL_STEP';
438
450
  thunkApi.dispatch(handleNextScreenStep(stepName));
439
451
  return [2, { authResponse: authResponse, leadResponse: leadResponse, countryCode: countryCode, isNextScreenDob: isNextScreenDob }];
440
- case 13: return [4, sleep(interval * 1000)];
441
- case 14:
452
+ case 16: return [4, sleep(interval * 1000)];
453
+ case 17:
442
454
  _j.sent();
443
- _j.label = 15;
444
- case 15:
455
+ _j.label = 18;
456
+ case 18:
445
457
  count++;
446
458
  return [3, 1];
447
- case 16: throw new Error(NAFATH_VERIFICATION_FAILED);
459
+ case 19: throw new Error(NAFATH_VERIFICATION_FAILED);
448
460
  }
449
461
  });
450
462
  }); });
@@ -21,7 +21,8 @@ var CloseIconStyled = styled(Icon)(function (_a) {
21
21
  var theme = _a.theme;
22
22
  return ({
23
23
  width: theme.spacing(3.75),
24
- height: theme.spacing(3.75)
24
+ height: theme.spacing(3.75),
25
+ cursor: 'pointer'
25
26
  });
26
27
  });
27
28
  var CloseBox = styled(Box, { shouldForwardProp: function (prop) { return prop !== 'isTapOrigin'; } })(function (_a) {
@@ -31,7 +32,6 @@ var CloseBox = styled(Box, { shouldForwardProp: function (prop) { return prop !=
31
32
  justifyContent: 'end',
32
33
  marginBlockStart: theme.spacing(2),
33
34
  marginInlineEnd: theme.spacing(2),
34
- cursor: 'pointer',
35
35
  direction: theme.direction,
36
36
  position: isTapOrigin ? 'initial' : 'absolute',
37
37
  right: 0,
@@ -53,5 +53,5 @@ export default function Dialog(_a) {
53
53
  var handleOnCancel = function () {
54
54
  setOpen(false);
55
55
  };
56
- return (_jsxs(_Fragment, { children: [onClose && (_jsx(CloseBox, __assign({ isTapOrigin: isTapOrigin, id: 'close-container', onClick: handleOnCloseButton }, { children: _jsx(CloseIconStyled, { src: ICONS_NAMES.CLOSE_ICON }) }))), children, onClose && (_jsx(CloseDialog, { message: t('confirm_close_flow_title'), confirmTitle: t('confirm_close_flow_yes'), closeTitle: t('confirm_close_flow_no'), open: open, onConfirm: handleOnConfirm, onCancel: handleOnCancel }))] }));
56
+ return (_jsxs(_Fragment, { children: [onClose && (_jsx(CloseBox, __assign({ isTapOrigin: isTapOrigin, id: 'close-container' }, { children: _jsx(CloseIconStyled, { src: ICONS_NAMES.CLOSE_ICON, onClick: handleOnCloseButton }) }))), children, onClose && (_jsx(CloseDialog, { message: t('confirm_close_flow_title'), confirmTitle: t('confirm_close_flow_yes'), closeTitle: t('confirm_close_flow_no'), open: open, onConfirm: handleOnConfirm, onCancel: handleOnCancel }))] }));
57
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.9.14-development",
3
+ "version": "2.9.15-development",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",