@tap-payments/auth-jsconnect 2.12.13-development → 2.12.13

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.
Files changed (40) hide show
  1. package/README.md +30 -0
  2. package/build/@types/app.d.ts +2 -0
  3. package/build/@types/app.js +1 -0
  4. package/build/@types/form.d.ts +1 -0
  5. package/build/api/document.d.ts +1 -1
  6. package/build/assets/locales/ar.json +13 -10
  7. package/build/assets/locales/en.json +9 -6
  8. package/build/components/Tooltip/Tooltip.js +1 -1
  9. package/build/constants/api.d.ts +2 -2
  10. package/build/constants/api.js +10 -2
  11. package/build/constants/app.d.ts +2 -0
  12. package/build/constants/app.js +2 -0
  13. package/build/features/app/connectExpress/connectExpressStore.js +19 -16
  14. package/build/features/app/entity/entityStore.js +56 -35
  15. package/build/features/app/individual/individualStore.js +1 -0
  16. package/build/features/bank/screens/BankDetails/BankDetails.js +1 -1
  17. package/build/features/connectExpress/ConnectExpress.js +4 -4
  18. package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +9 -9
  19. package/build/features/connectExpress/screens/BusinessCountry/BusinessCountry.js +7 -6
  20. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +8 -8
  21. package/build/features/connectExpress/screens/NIDMissed/NID.js +5 -6
  22. package/build/features/connectExpress/screens/OTP/OTP.js +7 -8
  23. package/build/features/connectExpress/screens/OTP/OTPInput.js +5 -8
  24. package/build/features/entity/screens/EntityName/EntityDocumentUpload.d.ts +12 -0
  25. package/build/features/entity/screens/EntityName/{LicenseCertificate.js → EntityDocumentUpload.js} +10 -15
  26. package/build/features/entity/screens/EntityName/EntityName.js +10 -4
  27. package/build/features/entity/screens/EntityName/validation.d.ts +9 -0
  28. package/build/features/entity/screens/EntityName/validation.js +3 -0
  29. package/build/hooks/index.d.ts +1 -0
  30. package/build/hooks/index.js +1 -0
  31. package/build/hooks/useAppConfig.js +1 -1
  32. package/build/hooks/useIsEmailAuth.d.ts +1 -0
  33. package/build/hooks/useIsEmailAuth.js +11 -0
  34. package/build/utils/array.d.ts +1 -1
  35. package/build/utils/array.js +3 -2
  36. package/build/utils/common.js +6 -7
  37. package/build/utils/string.d.ts +1 -1
  38. package/build/utils/string.js +3 -1
  39. package/package.json +2 -2
  40. package/build/features/entity/screens/EntityName/LicenseCertificate.d.ts +0 -9
@@ -15,9 +15,9 @@ import { useForm, FormProvider } from 'react-hook-form';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import Collapse from '@mui/material/Collapse';
17
17
  import { yupResolver } from '@hookform/resolvers/yup';
18
- import { useAppDispatch, useAppSelector } from '../../../../hooks';
18
+ import { useAppDispatch, useAppSelector, useIsEmailAuth } from '../../../../hooks';
19
19
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
20
- import { deepCopy, isKW, isSA, isQA, sendCustomEventToGTM } from '../../../../utils';
20
+ import { deepCopy, isKW, isSA, sendCustomEventToGTM } from '../../../../utils';
21
21
  import { AuthForType } from '../../../../@types';
22
22
  import Form from '../../../../components/Form';
23
23
  import { ScreenContainer } from '../../../shared/Containers';
@@ -36,16 +36,16 @@ var ListType;
36
36
  ListType["EntityList"] = "EntityList";
37
37
  })(ListType || (ListType = {}));
38
38
  var AuthenticationList = function (_a) {
39
- var _b, _c, _d;
39
+ var _b, _c;
40
40
  var settingsData = useAppSelector(settingsSelector).data;
41
- var _e = useAppSelector(connectExpressSelector), data = _e.data, loading = _e.loading, error = _e.error;
42
- var _f = data.authenticationData, brandInfo = _f.brandInfo, entityInfo = _f.entityInfo;
43
- var _g = React.useState(), listActive = _g[0], setListActive = _g[1];
41
+ var _d = useAppSelector(connectExpressSelector), data = _d.data, loading = _d.loading, error = _d.error;
42
+ var _e = data.authenticationData, brandInfo = _e.brandInfo, entityInfo = _e.entityInfo;
43
+ var _f = React.useState(), listActive = _f[0], setListActive = _f[1];
44
44
  var brandList = (((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authenticationData) || {}).brandList;
45
- var _h = React.useState(false), isAddEntity = _h[0], setIsAddEntity = _h[1];
45
+ var _g = React.useState(false), isAddEntity = _g[0], setIsAddEntity = _g[1];
46
46
  var otpData = data.otpData;
47
47
  var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
48
- var startWithEmail = isQA((_c = settingsData.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2);
48
+ var startWithEmail = useIsEmailAuth();
49
49
  React.useEffect(function () {
50
50
  sendCustomEventToGTM({
51
51
  event: 'Send Event',
@@ -64,7 +64,7 @@ var AuthenticationList = function (_a) {
64
64
  var t = useTranslation().t;
65
65
  var isAr = useLanguage().isAr;
66
66
  var dispatch = useAppDispatch();
67
- var code = (_d = settingsData.businessCountry) === null || _d === void 0 ? void 0 : _d.iso2;
67
+ var code = (_c = settingsData.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2;
68
68
  var isSACountry = React.useMemo(function () { return isSA(code); }, [code]);
69
69
  var onSubmit = function (formData) {
70
70
  if (isAddEntity) {
@@ -53,7 +53,7 @@ import { ScreenContainer } from '../../../shared/Containers';
53
53
  import BusinessCountry from '../../../shared/BusinessCountry';
54
54
  import Button from '../../../shared/Button';
55
55
  import Collapse from '../../../../components/Collapse';
56
- import { findCountryByIso2, isKW, isQA, isOtherThanKWOrSA, sendCustomEventToGTM } from '../../../../utils';
56
+ import { findCountryByIso2, isKW, isEmailAuthEnabled, isOtherThanKWOrSA, sendCustomEventToGTM } from '../../../../utils';
57
57
  import { handleNextScreenStep, handleSetCountryByIso2, settingsSelector } from '../../../../app/settings';
58
58
  import { clearError, connectExpressSelector, setDefaultCountryCode, storeIsStartFromBusinessCountry, updateBusinessCountryAsync } from '../../../app/connectExpress/connectExpressStore';
59
59
  var BusinessCountryScreen = function (_a) {
@@ -74,8 +74,9 @@ var BusinessCountryScreen = function (_a) {
74
74
  }, [settingsData.businessCountry, settingsData.ipCountry]);
75
75
  var onSelectCountry = function (iso2) { return __awaiter(void 0, void 0, void 0, function () {
76
76
  var countryCode;
77
- return __generator(this, function (_a) {
78
- switch (_a.label) {
77
+ var _a;
78
+ return __generator(this, function (_b) {
79
+ switch (_b.label) {
79
80
  case 0:
80
81
  if (!iso2)
81
82
  return [2];
@@ -90,12 +91,12 @@ var BusinessCountryScreen = function (_a) {
90
91
  if (!data.leadId) return [3, 2];
91
92
  return [4, dispatch(updateBusinessCountryAsync(iso2))];
92
93
  case 1:
93
- _a.sent();
94
- _a.label = 2;
94
+ _b.sent();
95
+ _b.label = 2;
95
96
  case 2:
96
97
  if (countryCode)
97
98
  dispatch(setDefaultCountryCode(countryCode));
98
- if (isQA(iso2)) {
99
+ if (isEmailAuthEnabled((_a = settingsData.appConfig.features) === null || _a === void 0 ? void 0 : _a.emailAuth, iso2)) {
99
100
  dispatch(handleNextScreenStep('CONNECT_EXPRESS_EMAIL_STEP'));
100
101
  return [2];
101
102
  }
@@ -17,8 +17,8 @@ import { yupResolver } from '@hookform/resolvers/yup';
17
17
  import { styled } from '@mui/material/styles';
18
18
  import { useAppDispatch, useAppSelector, useExcludeReadOnlyFelids, useFormErrorAndUpdateReadOnly, useFormReadOnly, useSetFromDefaultValues } from '../../../../hooks';
19
19
  import { AuthForType } from '../../../../@types';
20
- import { useLanguage } from '../../../../hooks';
21
- import { deepCopy, isKW, isQA, sendCustomEventToGTM } from '../../../../utils';
20
+ import { useLanguage, useIsEmailAuth } from '../../../../hooks';
21
+ import { deepCopy, isKW, sendCustomEventToGTM } from '../../../../utils';
22
22
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
23
23
  import Form from '../../../../components/Form';
24
24
  import Collapse from '../../../../components/Collapse';
@@ -36,16 +36,16 @@ var FormStyled = styled(Form)(function () { return ({
36
36
  justifyContent: 'space-between'
37
37
  }); });
38
38
  var CollectIndividualInfo = function (_a) {
39
- var _b, _c;
40
- var _d = React.useState(false), listActive = _d[0], setListActive = _d[1];
41
- var _e = React.useState(false), emailChecking = _e[0], setEmailChecking = _e[1];
39
+ var _b;
40
+ var _c = React.useState(false), listActive = _c[0], setListActive = _c[1];
41
+ var _d = React.useState(false), emailChecking = _d[0], setEmailChecking = _d[1];
42
42
  var settingsData = useAppSelector(settingsSelector).data;
43
- var _f = useAppSelector(connectExpressSelector), data = _f.data, loading = _f.loading, error = _f.error;
43
+ var _e = useAppSelector(connectExpressSelector), data = _e.data, loading = _e.loading, error = _e.error;
44
44
  var dispatch = useAppDispatch();
45
45
  var t = useTranslation().t;
46
46
  var isAr = useLanguage().isAr;
47
47
  var individualData = data.individualData, otpData = data.otpData, responseData = data.responseData;
48
- var startWithEmail = isQA((_b = settingsData.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2);
48
+ var startWithEmail = useIsEmailAuth();
49
49
  var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
50
50
  var startWithNIDMissed = otpData.authFor === AuthForType.NATIONAL_ID_MISSED;
51
51
  var contact = ((responseData === null || responseData === void 0 ? void 0 : responseData.leadData) || {}).contact;
@@ -119,7 +119,7 @@ var CollectIndividualInfo = function (_a) {
119
119
  var isEmailValid = typeof isEmailAvailable === 'undefined' ? isLeadEmailAvailable : isEmailAvailable;
120
120
  var emailErrChecks = !methods.formState.isValid || !!methods.formState.errors.email;
121
121
  var disabled = emailErrChecks || emailChecking || !isEmailValid;
122
- var emailReadOnly = readOnly['email'] && !((_c = methods.getFieldState('email').error) === null || _c === void 0 ? void 0 : _c.message) && !methods.getFieldState('email').isDirty;
122
+ var emailReadOnly = readOnly['email'] && !((_b = methods.getFieldState('email').error) === null || _b === void 0 ? void 0 : _b.message) && !methods.getFieldState('email').isDirty;
123
123
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Name, { readOnly: readOnly['name'], show: !listActive }), _jsx(MobileNumber, { readOnly: readOnly['mobile'], show: true, onListOpen: function () { return handleMenuListClick(); }, onListClose: function () { return handleMenuListClick(); }, countries: settingsData.countries }), _jsx(Email, { readOnly: emailReadOnly, show: !listActive, fetchingEmail: function (v) { return setEmailChecking(v); }, emailChecking: emailChecking }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
124
124
  };
125
125
  export default React.memo(CollectIndividualInfo);
@@ -16,7 +16,7 @@ import { styled } from '@mui/material/styles';
16
16
  import { useForm, FormProvider } from 'react-hook-form';
17
17
  import { yupResolver } from '@hookform/resolvers/yup';
18
18
  import { NIDOtherCountryValidationSchema, NIDValidationSchema } from './validation';
19
- import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
19
+ import { useAppDispatch, useLanguage, useAppSelector, useIsEmailAuth } from '../../../../hooks';
20
20
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
21
21
  import { clearError, connectExpressSelector, createNIDNafathAuthIdentityAsync } from '../../../app/connectExpress/connectExpressStore';
22
22
  import Form from '../../../../components/Form';
@@ -25,21 +25,20 @@ import { ScreenContainer } from '../../../shared/Containers';
25
25
  import Collapse from '../../../../components/Collapse';
26
26
  import IDNumber from './IDNumber';
27
27
  import DOB from './DOB';
28
- import { deepCopy, isOtherThanKWOrSA, isQA } from '../../../../utils';
28
+ import { deepCopy, isOtherThanKWOrSA } from '../../../../utils';
29
29
  var FormStyled = styled(Form)(function () { return ({
30
30
  display: 'flex',
31
31
  flexDirection: 'column'
32
32
  }); });
33
33
  var NID = function (_a) {
34
- var _b;
35
- var _c = React.useState(false), collapse = _c[0], setCollapse = _c[1];
34
+ var _b = React.useState(false), collapse = _b[0], setCollapse = _b[1];
36
35
  var isAr = useLanguage().isAr;
37
36
  var dispatch = useAppDispatch();
38
37
  var t = useTranslation().t;
39
38
  var settingsData = useAppSelector(settingsSelector).data;
40
- var _d = useAppSelector(connectExpressSelector), data = _d.data, loading = _d.loading, error = _d.error;
39
+ var _c = useAppSelector(connectExpressSelector), data = _c.data, loading = _c.loading, error = _c.error;
41
40
  var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
42
- var startWithEmail = isQA((_b = settingsData.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2);
41
+ var startWithEmail = useIsEmailAuth();
43
42
  var methods = useForm({
44
43
  resolver: yupResolver(isOtherCountry ? NIDOtherCountryValidationSchema : NIDValidationSchema),
45
44
  defaultValues: data.nidData,
@@ -17,13 +17,13 @@ import Text from '../../../../components/Text';
17
17
  import { clearError, connectExpressSelector, verifyMobileOtpAsync, verifyEmailOtpAsync, resetOTPValue } from '../../../app/connectExpress/connectExpressStore';
18
18
  import Button from '../../../shared/Button';
19
19
  import { ScreenContainer } from '../../../shared/Containers';
20
- import { useAppDispatch, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
21
- import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
20
+ import { useAppDispatch, useAppSelector, useSanitizedTranslation, useIsEmailAuth } from '../../../../hooks';
21
+ import { handlePrevScreenStep } from '../../../../app/settings';
22
22
  import { useLanguage } from '../../../../hooks';
23
23
  import { useForm, FormProvider } from 'react-hook-form';
24
24
  import { yupResolver } from '@hookform/resolvers/yup';
25
25
  import Form from '../../../../components/Form';
26
- import { maskPhone, deepCopy, sendCustomEventToGTM, maskEmail, isQA } from '../../../../utils';
26
+ import { maskPhone, deepCopy, sendCustomEventToGTM, maskEmail } from '../../../../utils';
27
27
  import { OTPValidation } from './validation';
28
28
  import OTPInput from './OTPInput';
29
29
  var OTPTitleContainerStyled = styled(Box)(function (_a) {
@@ -46,13 +46,12 @@ var FormStyled = styled(Form)(function () { return ({
46
46
  flexDirection: 'column'
47
47
  }); });
48
48
  var OTP = function () {
49
- var _a, _b;
49
+ var _a;
50
50
  var dispatch = useAppDispatch();
51
- var _c = useAppSelector(connectExpressSelector), data = _c.data, loading = _c.loading, error = _c.error;
52
- var settingsData = useAppSelector(settingsSelector).data;
51
+ var _b = useAppSelector(connectExpressSelector), data = _b.data, loading = _b.loading, error = _b.error;
53
52
  var st = useSanitizedTranslation();
54
53
  var isAr = useLanguage().isAr;
55
- var isEmailFlow = isQA((_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2);
54
+ var isEmailFlow = useIsEmailAuth();
56
55
  var methods = useForm({
57
56
  resolver: yupResolver(OTPValidation),
58
57
  defaultValues: data.otpData,
@@ -85,7 +84,7 @@ var OTP = function () {
85
84
  dispatch(handlePrevScreenStep(screen));
86
85
  };
87
86
  var disabled = !methods.formState.isValid;
88
- var phone = data.mobileData.mobile ? ((_b = data.mobileData.countryCode) === null || _b === void 0 ? void 0 : _b.idd_prefix) + data.mobileData.mobile : '';
87
+ var phone = data.mobileData.mobile ? ((_a = data.mobileData.countryCode) === null || _a === void 0 ? void 0 : _a.idd_prefix) + data.mobileData.mobile : '';
89
88
  var contactInfo = isEmailFlow ? maskEmail(data.emailData.email) : maskPhone(phone);
90
89
  var title = isEmailFlow ? st('otp_email_sent_title') : st('ide_opt_sent_title');
91
90
  return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(OTPTitleContainerStyled, { children: _jsxs(OTPTitleStyled, { children: [loading ? st('ide_otp_waiting_title') : title, !loading && _jsx("span", __assign({ dir: 'ltr' }, { children: contactInfo }))] }) }), _jsx(OTPInput, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: st(error || '') }, { children: st('next') }))] })) })) }));
@@ -18,9 +18,8 @@ import { styled } from '@mui/material/styles';
18
18
  import OTPField from '../../../shared/OTP';
19
19
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
20
20
  import { resendMobileAuthOTP, resendEmailAuthOTP, connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
21
- import { useAppDispatch, useAppSelector } from '../../../../hooks';
22
- import { sendCustomEventToGTM, isQA } from '../../../../utils';
23
- import { settingsSelector } from '../../../../app/settings';
21
+ import { useAppDispatch, useAppSelector, useIsEmailAuth } from '../../../../hooks';
22
+ import { sendCustomEventToGTM } from '../../../../utils';
24
23
  var BoxStyled = styled(Box)(function (_a) {
25
24
  var theme = _a.theme;
26
25
  return ({
@@ -30,15 +29,13 @@ var BoxStyled = styled(Box)(function (_a) {
30
29
  });
31
30
  });
32
31
  var OTPInput = function (_a) {
33
- var _b;
34
- var _c = useFormContext(), control = _c.control, setValue = _c.setValue;
32
+ var _b = useFormContext(), control = _b.control, setValue = _b.setValue;
35
33
  var t = useTranslation().t;
36
34
  var dispatch = useAppDispatch();
37
35
  var otpControl = useController({ name: 'otp', control: control });
38
- var _d = useAppSelector(connectExpressSelector), data = _d.data, error = _d.error;
39
- var settingsData = useAppSelector(settingsSelector).data;
36
+ var _c = useAppSelector(connectExpressSelector), data = _c.data, error = _c.error;
40
37
  var mobileData = data.mobileData, emailData = data.emailData;
41
- var isEmailFlow = isQA((_b = settingsData.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2);
38
+ var isEmailFlow = useIsEmailAuth();
42
39
  var sendEventAskAnotherOTP = function () {
43
40
  sendCustomEventToGTM({
44
41
  event: 'Send Event',
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { DocumentPurpose, FileDetails } from '../../../../@types';
3
+ interface EntityDocumentUploadProps {
4
+ name: string;
5
+ labelKey: string;
6
+ purpose: DocumentPurpose;
7
+ show: boolean;
8
+ readOnly?: boolean;
9
+ defaultFiles?: Array<FileDetails>;
10
+ }
11
+ declare const EntityDocumentUpload: ({ name, labelKey, purpose, show, readOnly, defaultFiles }: EntityDocumentUploadProps) => JSX.Element;
12
+ export default EntityDocumentUpload;
@@ -15,9 +15,8 @@ import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
16
16
  import { styled } from '@mui/material/styles';
17
17
  import Collapse from '../../../../components/Collapse';
18
- import { DocumentPurpose } from '../../../../@types';
19
18
  import { FileType } from '../../../../constants';
20
- import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
+ import { useAppDispatch, useAppSelector, useSanitizedTranslation } from '../../../../hooks';
21
20
  import { hasVerifiedValue } from '../../../../utils';
22
21
  import { ScreenContainer } from '../../../shared/Containers';
23
22
  import { clearError, entitySelector, uploadingStatus } from '../../../app/entity/entityStore';
@@ -28,27 +27,23 @@ var FeatureStyled = styled(ScreenContainer)(function (_a) {
28
27
  marginBlockStart: theme.spacing(3)
29
28
  });
30
29
  });
31
- var LicenseCertificate = function (_a) {
30
+ var EntityDocumentUpload = function (_a) {
32
31
  var _b;
33
- var show = _a.show, readOnly = _a.readOnly, defaultFiles = _a.defaultFiles;
32
+ var name = _a.name, labelKey = _a.labelKey, purpose = _a.purpose, show = _a.show, readOnly = _a.readOnly, defaultFiles = _a.defaultFiles;
34
33
  var t = useTranslation().t;
34
+ var st = useSanitizedTranslation();
35
35
  var control = useFormContext().control;
36
36
  var dispatch = useAppDispatch();
37
- var certificateIdControl = useController({ name: 'certificateId', control: control });
37
+ var fieldControl = useController({ name: name, control: control });
38
38
  var _c = useAppSelector(entitySelector), loading = _c.loading, error = _c.error, data = _c.data;
39
39
  var data_verification = (((_b = data.verify.responseBody) === null || _b === void 0 ? void 0 : _b.entity) || {}).data_verification;
40
- var uploadedIds = certificateIdControl.field.value;
40
+ var uploadedIds = fieldControl.field.value;
41
41
  var isDocumentVerified = React.useMemo(function () { var _a; return !!((_a = defaultFiles === null || defaultFiles === void 0 ? void 0 : defaultFiles[0]) === null || _a === void 0 ? void 0 : _a.docId) && hasVerifiedValue(data_verification, "documents.".concat(defaultFiles[0].docId)); }, [data_verification]);
42
- var handleLicenseCertificateChange = function (ids) {
42
+ var handleChange = function (ids) {
43
43
  if (error)
44
44
  dispatch(clearError());
45
- certificateIdControl.field.onChange(ids);
45
+ fieldControl.field.onChange(ids);
46
46
  };
47
- var handleReset = function (ids) {
48
- if (error)
49
- dispatch(clearError());
50
- certificateIdControl.field.onChange(ids);
51
- };
52
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { readOnly: readOnly, id: 'certificateId', control: control, label: t('title_license_certificate'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_certificate'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleLicenseCertificateChange, isSubmitting: loading, onDeleteFile: handleReset, maxLimit: 4, defaultFiles: defaultFiles, purpose: DocumentPurpose.CR, fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); }, fileType: FileType.IMAGES, isVerified: !(uploadedIds === null || uploadedIds === void 0 ? void 0 : uploadedIds.length) && isDocumentVerified }) }) })));
47
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadMultipleFile, { readOnly: readOnly, id: name, control: control, label: st(labelKey), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('desc_drag_and_drop_certificate'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleChange, isSubmitting: loading, onDeleteFile: handleChange, maxLimit: 4, defaultFiles: defaultFiles, purpose: purpose, fileUploadingStatus: function (uploading) { return dispatch(uploadingStatus(uploading)); }, fileType: FileType.IMAGES, isVerified: !(uploadedIds === null || uploadedIds === void 0 ? void 0 : uploadedIds.length) && isDocumentVerified }) }) })));
53
48
  };
54
- export default LicenseCertificate;
49
+ export default EntityDocumentUpload;
@@ -31,8 +31,8 @@ import IssuingDate from './IssuingDate';
31
31
  import ExpiryDate from './ExpiryDate';
32
32
  import EntityTypeList from './EntityTypeList';
33
33
  import UnifiedNumber from './UnifiedNumber';
34
- import LicenseCertificate from './LicenseCertificate';
35
34
  import Article from './Article';
35
+ import EntityDocumentUpload from './EntityDocumentUpload';
36
36
  var FormStyled = styled(Form)(function () { return ({
37
37
  display: 'flex',
38
38
  flexDirection: 'column'
@@ -47,7 +47,7 @@ var EntityName = function (_a) {
47
47
  var isAr = useLanguage().isAr;
48
48
  var t = useTranslation().t;
49
49
  var dispatch = useAppDispatch();
50
- var _j = data.entityNameData, legalName = _j.legalName, licenseNumber = _j.licenseNumber, licenseType = _j.licenseType, entityType = _j.entityType, issuingDate = _j.issuingDate, expiryDate = _j.expiryDate, unifiedNumber = _j.unifiedNumber, certificateId = _j.certificateId, articleId = _j.articleId;
50
+ var _j = data.entityNameData, legalName = _j.legalName, licenseNumber = _j.licenseNumber, licenseType = _j.licenseType, entityType = _j.entityType, issuingDate = _j.issuingDate, expiryDate = _j.expiryDate, unifiedNumber = _j.unifiedNumber, certificateId = _j.certificateId, commercialRegistrationExtractId = _j.commercialRegistrationExtractId, articleId = _j.articleId;
51
51
  var country_code = settingsData.businessCountry.iso2;
52
52
  var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
53
53
  var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
@@ -83,6 +83,7 @@ var EntityName = function (_a) {
83
83
  expiryDate: expiryDate,
84
84
  unifiedNumber: unifiedNumber,
85
85
  certificateId: certificateId,
86
+ commercialRegistrationExtractId: commercialRegistrationExtractId,
86
87
  articleId: articleId
87
88
  },
88
89
  mode: 'onChange'
@@ -91,6 +92,7 @@ var EntityName = function (_a) {
91
92
  var isEntityTypeFL = ((_b = watch('entityType')) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase()) === BusinessType.FL;
92
93
  useSetFromDefaultValues(methods, data.entityNameData, true);
93
94
  var defaultCertificateFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.CR); }, [documents]);
95
+ var defaultCommercialRegistrationExtractFiles = React.useMemo(function () { return getFileDetailsFromDocument(documents, DocumentPurpose.COMMERCIAL_REGISTRATION_EXTRACT); }, [documents]);
94
96
  var defaultArticleFile = React.useMemo(function () { return AOA_file && __assign(__assign({}, AOA_file), { docId: id }); }, [AOA_file]);
95
97
  var issueDateRes = (license === null || license === void 0 ? void 0 : license.issuing_date) && convertToEnglishDateFormat(new Date(license.issuing_date));
96
98
  var expDateRes = (license === null || license === void 0 ? void 0 : license.expiry_date) && convertToEnglishDateFormat(new Date(license.expiry_date));
@@ -104,7 +106,11 @@ var EntityName = function (_a) {
104
106
  unifiedNumber: (_c = license === null || license === void 0 ? void 0 : license.additional_info) === null || _c === void 0 ? void 0 : _c.unified_number,
105
107
  articleId: defaultArticleFile === null || defaultArticleFile === void 0 ? void 0 : defaultArticleFile.id
106
108
  }).isDirty;
107
- var originalReadOnly = useFormReadOnly(methods, { certificateId: defaultCertificateFiles, articleId: defaultArticleFile });
109
+ var originalReadOnly = useFormReadOnly(methods, {
110
+ certificateId: defaultCertificateFiles,
111
+ commercialRegistrationExtractId: defaultCommercialRegistrationExtractFiles,
112
+ articleId: defaultArticleFile
113
+ });
108
114
  var readOnly = useFormErrorAndUpdateReadOnly(methods, originalReadOnly, noneEditable);
109
115
  var getFelids = useExcludeReadOnlyFelids(methods, readOnly).getFelids;
110
116
  var dataVerified = useDataVerified(data_verification, [
@@ -159,6 +165,6 @@ var EntityName = function (_a) {
159
165
  var showExpiryDate = isSACountry ? !isCR : true;
160
166
  var showUnifiedNumber = isSACountry ? !isEntityTypeFL : false;
161
167
  var disableBack = settingsData.appConfig.mode === 'content';
162
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']), isVerified: isLegalNameVerified }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); }, isVerified: isEntityTypeVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(UnifiedNumber, { show: showUnifiedNumber, readOnly: readOnly['unifiedNumber'] || noneEditable['license.additional_info'], isVerified: isUnifiedNumberVerified }), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: readOnly['licenseNumber'] || noneEditable['license.number'], isVerified: isLicenseNumberVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose, readOnly: readOnly['issuingDate'] || noneEditable['license.issuing_date'], isVerified: isIssuingDateVerified }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl && showExpiryDate }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose, readOnly: readOnly['expiryDate'] || noneEditable['license.expiry_date'], isVerified: isExpiryDateVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(LicenseCertificate, { defaultFiles: defaultCertificateFiles, show: isSACountry ? false : !isKWCountry || isCR, readOnly: readOnly['certificateId'] || noneEditable['documents'] }), _jsx(Article, { defaultFile: defaultArticleFile, show: !isSACountry, readOnly: readOnly['articleId'] || noneEditable['AOA_file_id'], isVerified: isArticleIdVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ disableBack: disableBack, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
168
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(LegalName, { readOnly: readOnly['legalName'] || (noneEditable['legal_name.en'] && noneEditable['legal_name.ar']), isVerified: isLegalNameVerified }) })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl }, { children: _jsx(EntityTypeList, { readOnly: readOnly['entityType'] || noneEditable['type'], onListOpen: function () { return handleEntityOpenClose(true); }, onListClose: function () { return handleEntityOpenClose(false); }, isVerified: isEntityTypeVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(UnifiedNumber, { show: showUnifiedNumber, readOnly: readOnly['unifiedNumber'] || noneEditable['license.additional_info'], isVerified: isUnifiedNumberVerified }), _jsx(LicenseNumber, { show: showLicenseNumber, readOnly: readOnly['licenseNumber'] || noneEditable['license.number'], isVerified: isLicenseNumberVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !entityTypeAnchorEl }, { children: _jsx(IssuingDate, { onDateClicked: handleIssueDateOpenClose, readOnly: readOnly['issuingDate'] || noneEditable['license.issuing_date'], isVerified: isIssuingDateVerified }) })), _jsx(Collapse, __assign({ in: !issueAnchorEl && !entityTypeAnchorEl && showExpiryDate }, { children: _jsx(ExpiryDate, { onDateClicked: handleExpiryDateOpenClose, readOnly: readOnly['expiryDate'] || noneEditable['license.expiry_date'], isVerified: isExpiryDateVerified }) })), _jsxs(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: [_jsx(EntityDocumentUpload, { name: 'certificateId', labelKey: 'title_license_certificate', purpose: DocumentPurpose.CR, show: isSACountry ? false : !isKWCountry || isCR, readOnly: readOnly['certificateId'] || noneEditable['documents'], defaultFiles: defaultCertificateFiles }), _jsx(EntityDocumentUpload, { name: 'commercialRegistrationExtractId', labelKey: 'title_commercial_registration_extract', purpose: DocumentPurpose.COMMERCIAL_REGISTRATION_EXTRACT, show: isKWCountry, readOnly: readOnly['commercialRegistrationExtractId'] || noneEditable['documents'], defaultFiles: defaultCommercialRegistrationExtractFiles }), _jsx(Article, { defaultFile: defaultArticleFile, show: !isSACountry, readOnly: readOnly['articleId'] || noneEditable['AOA_file_id'], isVerified: isArticleIdVerified })] })), _jsx(Collapse, __assign({ in: !expiryAnchorEl && !issueAnchorEl && !entityTypeAnchorEl }, { children: _jsx(Button, __assign({ disableBack: disableBack, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
163
169
  };
164
170
  export default EntityName;
@@ -9,6 +9,7 @@ export declare const EntityNameValidationSchema: (noneEditable: NonEditableMap)
9
9
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
10
10
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
11
11
  certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
12
+ commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
12
13
  articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
13
14
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
14
15
  legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -19,6 +20,7 @@ export declare const EntityNameValidationSchema: (noneEditable: NonEditableMap)
19
20
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
20
21
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
21
22
  certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
23
+ commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
22
24
  articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
23
25
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
24
26
  legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -29,6 +31,7 @@ export declare const EntityNameValidationSchema: (noneEditable: NonEditableMap)
29
31
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
30
32
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
31
33
  certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
34
+ commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
32
35
  articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
33
36
  }>>>;
34
37
  export declare const EntityNameKWValidationSchema: (noneEditable: NonEditableMap) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
@@ -39,6 +42,7 @@ export declare const EntityNameKWValidationSchema: (noneEditable: NonEditableMap
39
42
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
40
43
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
41
44
  certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
45
+ commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
42
46
  articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
43
47
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
44
48
  legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -48,6 +52,7 @@ export declare const EntityNameKWValidationSchema: (noneEditable: NonEditableMap
48
52
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
49
53
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
50
54
  certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
55
+ commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
51
56
  articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
52
57
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
53
58
  legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -57,6 +62,7 @@ export declare const EntityNameKWValidationSchema: (noneEditable: NonEditableMap
57
62
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
58
63
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
59
64
  certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
65
+ commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
60
66
  articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
61
67
  }>>>;
62
68
  export declare const EntityNameOtherCountryValidationSchema: (noneEditable: NonEditableMap) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
@@ -67,6 +73,7 @@ export declare const EntityNameOtherCountryValidationSchema: (noneEditable: NonE
67
73
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
68
74
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
69
75
  certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
76
+ commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
70
77
  articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
71
78
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
72
79
  legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -76,6 +83,7 @@ export declare const EntityNameOtherCountryValidationSchema: (noneEditable: NonE
76
83
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
77
84
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
78
85
  certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
86
+ commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
79
87
  articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
80
88
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
81
89
  legalName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -85,6 +93,7 @@ export declare const EntityNameOtherCountryValidationSchema: (noneEditable: NonE
85
93
  issuingDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
86
94
  expiryDate: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
87
95
  certificateId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
96
+ commercialRegistrationExtractId: yup.ArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined, any[] | undefined>;
88
97
  articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
89
98
  }>>>;
90
99
  export {};
@@ -43,6 +43,7 @@ export var EntityNameValidationSchema = function (noneEditable) {
43
43
  issuingDate: noneEditable['license.issuing_date'] ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
44
44
  expiryDate: yup.string().optional(),
45
45
  certificateId: yup.array().optional(),
46
+ commercialRegistrationExtractId: yup.array().optional(),
46
47
  articleId: yup.string().optional()
47
48
  });
48
49
  };
@@ -88,6 +89,7 @@ export var EntityNameKWValidationSchema = function (noneEditable) {
88
89
  issuingDate: noneEditable['license.issuing_date'] ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
89
90
  expiryDate: noneEditable['license.expiry_date'] ? yup.string().optional() : yup.string().required('choose_any_expiry_date'),
90
91
  certificateId: yup.array().optional(),
92
+ commercialRegistrationExtractId: yup.array().optional(),
91
93
  articleId: yup.string().optional()
92
94
  });
93
95
  };
@@ -130,6 +132,7 @@ export var EntityNameOtherCountryValidationSchema = function (noneEditable) {
130
132
  issuingDate: noneEditable['license.issuing_date'] ? yup.string().optional() : yup.string().required('choose_any_issuing_date'),
131
133
  expiryDate: noneEditable['license.expiry_date'] ? yup.string().optional() : yup.string().required('choose_any_expiry_date'),
132
134
  certificateId: yup.array().optional(),
135
+ commercialRegistrationExtractId: yup.array().optional(),
133
136
  articleId: yup.string().optional()
134
137
  });
135
138
  };
@@ -15,6 +15,7 @@ export * from './useSetFromDefaultValues';
15
15
  export * from './useCountUp';
16
16
  export * from './useCountDown';
17
17
  export * from './useCountry';
18
+ export * from './useIsEmailAuth';
18
19
  export * from './useVerifyToken';
19
20
  export * from './useFormReadOnly';
20
21
  export * from './useDataNoneEditable';
@@ -15,6 +15,7 @@ export * from './useSetFromDefaultValues';
15
15
  export * from './useCountUp';
16
16
  export * from './useCountDown';
17
17
  export * from './useCountry';
18
+ export * from './useIsEmailAuth';
18
19
  export * from './useVerifyToken';
19
20
  export * from './useFormReadOnly';
20
21
  export * from './useDataNoneEditable';
@@ -31,7 +31,7 @@ export var useAppConfig = function (_a) {
31
31
  var data = useAppSelector(settingsSelector).data;
32
32
  var setAppConfig = function () {
33
33
  if (!disableSettingFetching) {
34
- dispatch(handleSetAppConfig(__assign({ appInfo: appInfo, publicKey: publicKey, scope: scope === null || scope === void 0 ? void 0 : scope.toLowerCase(), mode: mode !== null && mode !== void 0 ? mode : 'page', showBoard: showBoard !== null && showBoard !== void 0 ? showBoard : true, features: __assign({ merchantLogo: true, switchLanguage: true, overlay: true, loaderOverlay: true }, features) }, rest)));
34
+ dispatch(handleSetAppConfig(__assign({ appInfo: appInfo, publicKey: publicKey, scope: scope === null || scope === void 0 ? void 0 : scope.toLowerCase(), mode: mode !== null && mode !== void 0 ? mode : 'page', showBoard: showBoard !== null && showBoard !== void 0 ? showBoard : true, features: __assign({ merchantLogo: true, switchLanguage: true, overlay: true, loaderOverlay: true, emailAuth: true }, features) }, rest)));
35
35
  }
36
36
  dispatch(handleActiveFlowScreens(navigation));
37
37
  };
@@ -0,0 +1 @@
1
+ export declare const useIsEmailAuth: () => boolean | undefined;
@@ -0,0 +1,11 @@
1
+ import { useMemo } from 'react';
2
+ import { useAppSelector } from './useAppSelector';
3
+ import { settingsSelector } from '../app/settings';
4
+ import { isEmailAuthEnabled } from '../utils';
5
+ export var useIsEmailAuth = function () {
6
+ var _a, _b;
7
+ var settingsData = useAppSelector(settingsSelector).data;
8
+ var emailAuth = (_a = settingsData.appConfig.features) === null || _a === void 0 ? void 0 : _a.emailAuth;
9
+ var countryIso2 = (_b = settingsData.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2;
10
+ return useMemo(function () { return isEmailAuthEnabled(emailAuth, countryIso2); }, [emailAuth, countryIso2]);
11
+ };
@@ -62,7 +62,7 @@ export declare const fixBrandList: (items: Array<{
62
62
  }[];
63
63
  export declare const findFirstId: (items: Array<SaleChannel>) => string;
64
64
  export declare const sortActivitiesByName: (items: Array<ActivityParams>, path: string) => ActivityParams[];
65
- export declare const getFileDetailsFromDocument: (documents: Array<any>, purpose: string) => any;
65
+ export declare const getFileDetailsFromDocument: (documents: Array<any>, purpose: string | Array<string>) => any;
66
66
  export declare const getRecentDocumentBasedOnPurpose: (documents: Array<any>, purpose: string) => any;
67
67
  export declare const findInArrayOrSubArray: (items: Array<any>, value: string | number) => null;
68
68
  export declare const groupSectionWithSelectedActivitiesAtBeginning: (sections: Array<ActivitiesIsIc>, selectedActivities: Array<Activity>) => ActivitiesIsIc[];
@@ -191,8 +191,9 @@ export var sortActivitiesByName = function (items, path) {
191
191
  export var getFileDetailsFromDocument = function (documents, purpose) {
192
192
  if ((documents || []).length === 0)
193
193
  return [];
194
+ var purposes = Array.isArray(purpose) ? purpose : [purpose];
194
195
  return documents.reduce(function (acc, document) {
195
- var fileDetails = (document.file_details || []).filter(function (file) { return purpose.includes(file.purpose); });
196
+ var fileDetails = (document.file_details || []).filter(function (file) { return purposes.includes(file.purpose); });
196
197
  return acc.concat(fileDetails.map(function (f) { return (__assign(__assign({}, f), { docId: document.id })); }));
197
198
  }, []);
198
199
  };
@@ -200,7 +201,7 @@ export var getRecentDocumentBasedOnPurpose = function (documents, purpose) {
200
201
  if ((documents || []).length === 0)
201
202
  return [];
202
203
  var filteredByPurpose = documents.filter(function (doc) {
203
- return purpose.includes(doc.type);
204
+ return doc.type === purpose;
204
205
  });
205
206
  if ((filteredByPurpose || []).length > 0) {
206
207
  return filteredByPurpose.sort(function (a, b) { return b.created - a.created; })[0];
@@ -1,7 +1,6 @@
1
1
  import { axiosInstance } from '../api';
2
- import { ENDPOINT_PATHS, CONNECT_DEV_URL, CONNECT_PROD_URL } from '../constants';
2
+ import { ENDPOINT_PATHS, REGION_BASE_URLS, CONNECT_SANDBOX_URL, CONNECT_PROD_URL } from '../constants';
3
3
  import { objectHasValues } from './object';
4
- import { isDisasterRecoveryEnv, isSA } from './string';
5
4
  export var sleep = function (milliseconds) {
6
5
  if (milliseconds === void 0) { milliseconds = 1000; }
7
6
  return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
@@ -15,13 +14,13 @@ export var dangerousMessage = function (message, callBack) {
15
14
  export var setBaseUrl = function (publicKey, region) {
16
15
  if (region === void 0) { region = ''; }
17
16
  var isProd = publicKey.includes('pk_live');
18
- var _a = region.split('-'), country = _a[0], envType = _a[1];
19
17
  if (!isProd) {
20
- axiosInstance.defaults.baseURL = ENDPOINT_PATHS.DEV_BASE_URL;
18
+ axiosInstance.defaults.baseURL = ENDPOINT_PATHS.SANDBOX_BASE_URL;
21
19
  return;
22
20
  }
23
- if (isSA(country)) {
24
- axiosInstance.defaults.baseURL = isDisasterRecoveryEnv(envType) ? ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA_DR : ENDPOINT_PATHS.PRODUCTION_BASE_URL_SA;
21
+ var regionKey = (region || '').trim().toLowerCase();
22
+ if (Object.prototype.hasOwnProperty.call(REGION_BASE_URLS, regionKey)) {
23
+ axiosInstance.defaults.baseURL = REGION_BASE_URLS[regionKey];
25
24
  }
26
25
  else {
27
26
  axiosInstance.defaults.baseURL = ENDPOINT_PATHS.PRODUCTION_BASE_URL;
@@ -44,7 +43,7 @@ export var updateLocationUrlWithCountry = function (countryIso2) {
44
43
  window.history.replaceState({}, '', newUrl);
45
44
  };
46
45
  export var openConnect = function (pk, countryCode) {
47
- var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_DEV_URL);
46
+ var newUrl = new URL(pk.includes('pk_live') ? CONNECT_PROD_URL : CONNECT_SANDBOX_URL);
48
47
  if (countryCode) {
49
48
  newUrl.pathname = "/".concat(countryCode.toLowerCase());
50
49
  }
@@ -49,6 +49,7 @@ export declare const isKW: (flag: string) => boolean;
49
49
  export declare const isSA: (flag: string | undefined) => boolean;
50
50
  export declare const isOtherThanKWOrSA: (flag: string) => boolean;
51
51
  export declare const isQA: (flag: string | undefined) => boolean;
52
+ export declare const isEmailAuthEnabled: (emailAuth: boolean | undefined, countryIso2: string | undefined) => boolean | undefined;
52
53
  export declare const isKWOrSA: (flag: string) => boolean;
53
54
  export declare const isLinkedIn: (flag: string) => boolean;
54
55
  export declare const isTwitter: (flag: string) => boolean;
@@ -80,4 +81,3 @@ export declare const getCurrencyByCountryIso2: (countryCode?: string) => string;
80
81
  export declare const getMobileNumberLen: (initialLen: number, number: string) => number;
81
82
  export declare const getWebsiteLink: (isAr: boolean, countryCode: string, path: string) => string;
82
83
  export declare function formatCode(code: string, chunkSize?: number, delimiter?: string): string;
83
- export declare const isDisasterRecoveryEnv: (type?: string) => boolean;