@tap-payments/auth-jsconnect 2.6.59-test → 2.6.60-test

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.
@@ -431,5 +431,6 @@
431
431
  "close_and_complete_later": "اغلق الان و اكمل لاحقا",
432
432
  "country_list_title": "الرجاء تحديد بلدك",
433
433
  "Choose_any_country": "بحث عن البلد ...",
434
- "operator_is_invalid": "المشغل غير مصرح له"
434
+ "operator_is_invalid": "المشغل غير مصرح له",
435
+ "account_not_available": "Account is not available"
435
436
  }
@@ -461,5 +461,6 @@
461
461
  "close_and_complete_later": "Close and Complete Later",
462
462
  "country_list_title": "Please select your country",
463
463
  "choose_any_country": "Search Country...",
464
- "operator_is_invalid": "Operator is invalid"
464
+ "operator_is_invalid": "Operator is invalid",
465
+ "account_not_available": "Account is not available"
465
466
  }
@@ -9,6 +9,7 @@ export declare const LOCAL_STORAGE_KEYS: {
9
9
  languageMode: string;
10
10
  };
11
11
  export declare const SCOPE_AUTH = "auth";
12
+ export declare const ACCOUNT_NOT_AVAILABLE = "account_not_available";
12
13
  export declare const EXTERNAL_LINKS: {
13
14
  TOS_EN: string;
14
15
  TOS_AR: string;
@@ -9,6 +9,7 @@ export var LOCAL_STORAGE_KEYS = {
9
9
  languageMode: 'languageMode'
10
10
  };
11
11
  export var SCOPE_AUTH = 'auth';
12
+ export var ACCOUNT_NOT_AVAILABLE = 'account_not_available';
12
13
  export var EXTERNAL_LINKS = {
13
14
  TOS_EN: '/en/terms-conditions',
14
15
  TOS_AR: '/ar/terms-conditions',
@@ -48,10 +48,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
48
48
  var _a;
49
49
  import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
50
50
  import { AuthForType, FlowsTypes } from '../../../@types';
51
- import { AUTH_STEP_NAMES, IDENTIFICATION_TYPE, defaultCountry } from '../../../constants';
51
+ import { ACCOUNT_NOT_AVAILABLE, AUTH_STEP_NAMES, IDENTIFICATION_TYPE, defaultCountry } from '../../../constants';
52
52
  import API from '../../../api';
53
53
  import { handleCurrentActiveScreen, handleNextScreenStep, handleOpen, handleSetCountryByIso2 } from '../../../app/settings';
54
- import { findCountryByIddPrefix, isSA, openConnect, sleep } from '../../../utils';
54
+ import { findCountryByIddPrefix, isSA, sleep } from '../../../utils';
55
55
  export var updateBusinessCountry = createAsyncThunk('auth/updateBusinessCountry', function (countryCode, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
56
56
  var auth, payload, data;
57
57
  return __generator(this, function (_a) {
@@ -210,8 +210,7 @@ export var verifyMobileOtp = createAsyncThunk('auth/verifyMobileOtp', function (
210
210
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_AUTHENTICATION_LIST_STEP')); });
211
211
  return [2, { data: data, brandList: brandList, entityList: entityList }];
212
212
  }
213
- openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
214
- return [2, { data: data, brandList: brandList, entityList: entityList }];
213
+ throw new Error(ACCOUNT_NOT_AVAILABLE);
215
214
  }
216
215
  });
217
216
  }); });
@@ -340,8 +339,7 @@ export var verifyNIDOtp = createAsyncThunk('auth/verifyNIDOtp', function (params
340
339
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_AUTHENTICATION_LIST_STEP')); });
341
340
  return [2, { data: data, brandList: brandList, entityList: entityList }];
342
341
  }
343
- openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
344
- return [2, { data: data, brandList: brandList, entityList: entityList }];
342
+ throw new Error(ACCOUNT_NOT_AVAILABLE);
345
343
  }
346
344
  });
347
345
  }); });
@@ -418,8 +416,7 @@ export var verifyPACI = createAsyncThunk('auth/verifyPACI', function (params, th
418
416
  sleep(100).then(function () { return thunkApi.dispatch(handleNextScreenStep('AUTH_AUTHENTICATION_LIST_STEP')); });
419
417
  return [2, { data: data, brandList: brandList, entityList: entityList }];
420
418
  }
421
- openConnect(settings.data.appConfig.publicKey, settings.data.businessCountry.iso2);
422
- return [2, { data: data, brandList: brandList, entityList: entityList }];
419
+ throw new Error(ACCOUNT_NOT_AVAILABLE);
423
420
  case 6: return [4, sleep(interval * 1000)];
424
421
  case 7:
425
422
  _d.sent();
@@ -1,6 +1,7 @@
1
1
  import { LibConfig } from '../../@types';
2
2
  export interface AuthLibProps extends Pick<LibConfig, 'open' | 'mode' | 'scope' | 'merchantDomain' | 'publicKey' | 'redirectUrl' | 'data' | 'postURL' | 'appInfo' | 'businessCountryCode' | 'language' | 'onFlowCompleted' | 'onError' | 'onStepCompleted' | 'onReady' | 'onClose' | 'onStepStarted'> {
3
3
  leadId?: string;
4
+ hideOverlay?: boolean;
4
5
  }
5
6
  export declare function AuthElement(props: AuthLibProps): import("react/jsx-runtime").JSX.Element;
6
7
  export declare function renderAuthLib(config: AuthLibProps, elementId: string): {
@@ -36,7 +36,7 @@ import { FeatureContainer } from '../shared/Containers';
36
36
  import { authSelector, setMobileCountryCode, setLeadId, retrieveLeadIdentityByIdAsync } from '../app/auth/authStore';
37
37
  import { authFeatureScreens } from '../featuresScreens';
38
38
  var Auth = memo(function (_a) {
39
- var leadId = _a.leadId, postURL = _a.postURL, props = __rest(_a, ["leadId", "postURL"]);
39
+ var leadId = _a.leadId, postURL = _a.postURL, hideOverlay = _a.hideOverlay, props = __rest(_a, ["leadId", "postURL", "hideOverlay"]);
40
40
  var theme = useAppTheme().theme;
41
41
  var dispatch = useAppDispatch();
42
42
  var _b = useAppSelector(settingsSelector), settingData = _b.data, error = _b.error, settingLoading = _b.loading;
@@ -75,7 +75,7 @@ var Auth = memo(function (_a) {
75
75
  dispatch(setMobileCountryCode(settingData.businessCountry));
76
76
  }
77
77
  }, [settingData.businessCountry]);
78
- return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: !isTapOrigin }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: true }, { children: authFeatureScreens.map(function (_a, index) {
78
+ return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(Background, __assign({ hideOverlay: hideOverlay, open: open, isTapOrigin: isTapOrigin, loading: settingLoading || customLoading }, { children: _jsx(AnimationFlow, __assign({ pointerEvents: loading ? 'none' : 'auto', isTapOrigin: isTapOrigin, loading: settingLoading || customLoading, error: error, open: open, screenId: activeScreen.name, merchantInfo: merchant, isMaturityExpress: !isTapOrigin }, { children: _jsx(FeatureContainer, __assign({ isMaturityExpress: true }, { children: authFeatureScreens.map(function (_a, index) {
79
79
  var Element = _a.element, name = _a.name;
80
80
  var isActive = activeScreen.name === name;
81
81
  return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
@@ -25,6 +25,7 @@ import { AuthForType } from '../../../../@types';
25
25
  import { yupResolver } from '@hookform/resolvers/yup';
26
26
  import Form from '../../../../components/Form';
27
27
  import { maskPhone, maskID, deepCopy } from '../../../../utils';
28
+ import { ACCOUNT_NOT_AVAILABLE } from '../../../../constants';
28
29
  import { OTPValidation } from './validation';
29
30
  import OTPInput from './OTPInput';
30
31
  var OTPTitleContainerStyled = styled(Box)(function (_a) {
@@ -59,7 +60,7 @@ var OTP = function () {
59
60
  });
60
61
  var isNidAuth = data.otpData.authFor === AuthForType.NATIONAL_ID;
61
62
  React.useEffect(function () {
62
- if (error)
63
+ if (error && error !== ACCOUNT_NOT_AVAILABLE)
63
64
  dispatch(clearError());
64
65
  }, [methods.formState.isValid]);
65
66
  React.useEffect(function () {
@@ -78,7 +79,7 @@ var OTP = function () {
78
79
  var screen = isNidAuth ? 'AUTH_NID_STEP' : 'AUTH_MOBILE_STEP';
79
80
  dispatch(handlePrevScreenStep(screen));
80
81
  };
81
- var disabled = !methods.formState.isValid;
82
+ var disabled = !methods.formState.isValid || error === ACCOUNT_NOT_AVAILABLE;
82
83
  var phone = ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + (data.mobileData.mobile || '');
83
84
  var idNumber = data.nidData.nid;
84
85
  var title = isNidAuth ? t('opt_nid_sent_title', { provider: 'ABSHER' }) : t('ide_opt_sent_title');
@@ -7,6 +7,7 @@ interface BackgroundProps {
7
7
  sx?: SxProps<Theme>;
8
8
  open: boolean;
9
9
  isTapOrigin: boolean;
10
+ hideOverlay?: boolean;
10
11
  }
11
- declare const _default: React.MemoExoticComponent<({ children, isTapOrigin, loading, hideLogo, sx, open }: BackgroundProps) => import("react/jsx-runtime").JSX.Element>;
12
+ declare const _default: React.MemoExoticComponent<({ children, isTapOrigin, loading, hideLogo, sx, open, hideOverlay }: BackgroundProps) => import("react/jsx-runtime").JSX.Element>;
12
13
  export default _default;
@@ -17,21 +17,21 @@ import LogoBackground from './LogoBackground';
17
17
  import { BACKGROUND_ID } from '../../../constants';
18
18
  import { useScreen } from '../../../hooks';
19
19
  var BackgroundStyled = styled(Box, {
20
- shouldForwardProp: function (prop) { return !['isTapOrigin', 'open', 'isSmall'].includes(prop); }
20
+ shouldForwardProp: function (prop) { return !['isTapOrigin', 'open', 'isSmall', 'hideOverlay'].includes(prop); }
21
21
  })(function (_a) {
22
- var isTapOrigin = _a.isTapOrigin, open = _a.open, isSmall = _a.isSmall;
22
+ var isTapOrigin = _a.isTapOrigin, open = _a.open, isSmall = _a.isSmall, hideOverlay = _a.hideOverlay;
23
23
  return ({
24
24
  width: '100vw',
25
25
  height: '100vh',
26
26
  zIndex: isSmall ? 'auto' : 999,
27
27
  position: 'absolute',
28
- background: !open ? 'inherit' : isTapOrigin ? 'linear-gradient(180deg, #98ABAF 0%, #D9D6CC 100%)' : 'rgba(0, 0, 0, 0.5)'
28
+ background: !open || hideOverlay ? 'inherit' : isTapOrigin ? 'linear-gradient(180deg, #98ABAF 0%, #D9D6CC 100%)' : 'rgba(0, 0, 0, 0.5)'
29
29
  });
30
30
  });
31
31
  var Background = function (_a) {
32
- var children = _a.children, isTapOrigin = _a.isTapOrigin, loading = _a.loading, hideLogo = _a.hideLogo, sx = _a.sx, open = _a.open;
32
+ var children = _a.children, isTapOrigin = _a.isTapOrigin, loading = _a.loading, hideLogo = _a.hideLogo, sx = _a.sx, open = _a.open, hideOverlay = _a.hideOverlay;
33
33
  var showLogo = !loading && isTapOrigin;
34
34
  var small = useScreen().small;
35
- return (_jsxs(BackgroundStyled, __assign({ id: BACKGROUND_ID, isSmall: small, isTapOrigin: isTapOrigin, sx: sx, open: open }, { children: [showLogo && !hideLogo && _jsx(LogoBackground, {}), children] })));
35
+ return (_jsxs(BackgroundStyled, __assign({ id: BACKGROUND_ID, hideOverlay: hideOverlay, isSmall: small, isTapOrigin: isTapOrigin, sx: sx, open: open }, { children: [showLogo && !hideLogo && _jsx(LogoBackground, {}), children] })));
36
36
  };
37
37
  export default memo(Background);
@@ -41,7 +41,8 @@ export var keepLettersAndSpace = function (str) {
41
41
  return str.replace(/[^a-zA-Z] /g, '');
42
42
  };
43
43
  export var isTapDomain = function (domain) {
44
- return domain.includes('tap.company');
44
+ var regex = /^(connect(?:\..+)?\.tap\.company)$/;
45
+ return regex.test(domain);
45
46
  };
46
47
  export var removeArabicWords = function (str) {
47
48
  return str.replace(/[\u0600-\u06FF]/g, '').trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.6.59-test",
3
+ "version": "2.6.60-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",