@tap-payments/auth-jsconnect 2.1.9-test → 2.1.11-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.
Files changed (74) hide show
  1. package/build/@types/form.d.ts +4 -3
  2. package/build/api/board.d.ts +1 -0
  3. package/build/api/board.js +8 -1
  4. package/build/api/entity.d.ts +1 -1
  5. package/build/api/index.d.ts +1 -0
  6. package/build/assets/locales/ar.json +7 -0
  7. package/build/assets/locales/en.json +7 -0
  8. package/build/components/FileInput/DragAndDrop.d.ts +3 -2
  9. package/build/components/FileInput/DragAndDrop.js +4 -4
  10. package/build/components/Lottie/Lottie.d.ts +2924 -127
  11. package/build/components/Lottie/Lottie.js +8 -4
  12. package/build/components/Lottie/files/error.json +692 -0
  13. package/build/components/Lottie/files/start_loading.json +1140 -0
  14. package/build/components/Lottie/files/still_loading.json +1140 -0
  15. package/build/constants/validation.d.ts +1 -0
  16. package/build/constants/validation.js +1 -0
  17. package/build/features/app/bank/bankStore.js +13 -10
  18. package/build/features/app/business/businessStore.d.ts +8 -1
  19. package/build/features/app/business/businessStore.js +123 -66
  20. package/build/features/app/connect/connectStore.d.ts +1 -1
  21. package/build/features/app/connect/connectStore.js +47 -38
  22. package/build/features/app/entity/entityStore.js +37 -42
  23. package/build/features/app/individual/individualStore.js +47 -38
  24. package/build/features/app/password/passwordStore.js +19 -20
  25. package/build/features/app/tax/taxStore.js +13 -10
  26. package/build/features/bank/screens/BankDetails/BankDetails.js +13 -6
  27. package/build/features/bank/screens/BankDetails/BankStatement.js +14 -11
  28. package/build/features/bank/screens/BankDetails/validation.d.ts +22 -0
  29. package/build/features/bank/screens/BankDetails/validation.js +29 -2
  30. package/build/features/business/screens/BusinessType/Article.d.ts +6 -0
  31. package/build/features/business/screens/BusinessType/Article.js +89 -0
  32. package/build/features/business/screens/BusinessType/BusinessType.js +16 -10
  33. package/build/features/business/screens/BusinessType/EntityName.js +1 -1
  34. package/build/features/business/screens/BusinessType/LicenseCertificate.js +14 -9
  35. package/build/features/business/screens/BusinessType/LicenseList.js +3 -2
  36. package/build/features/business/screens/BusinessType/LicenseType.js +3 -3
  37. package/build/features/business/screens/BusinessType/validation.js +17 -8
  38. package/build/features/business/screens/VerifyPACI/VerifyPACI.d.ts +1 -1
  39. package/build/features/business/screens/VerifyPACI/VerifyPACI.js +9 -134
  40. package/build/features/connect/screens/Merchant/Merchant.js +4 -24
  41. package/build/features/connect/screens/Merchant/SalesChannels.d.ts +2 -5
  42. package/build/features/connect/screens/Merchant/SalesChannels.js +29 -99
  43. package/build/features/connect/screens/VerifyPACI/VerifyPACI.d.ts +1 -1
  44. package/build/features/connect/screens/VerifyPACI/VerifyPACI.js +9 -73
  45. package/build/features/entity/screens/EntityInfoConfirm/Article.js +14 -11
  46. package/build/features/shared/PaciVerification/PaciVerification.d.ts +12 -0
  47. package/build/features/shared/PaciVerification/PaciVerification.js +91 -0
  48. package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACILoading.d.ts +1 -0
  49. package/build/features/shared/PaciVerification/VerifyPACILoading.js +13 -0
  50. package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACISuccess.d.ts +0 -0
  51. package/build/features/{business/screens/VerifyPACI → shared/PaciVerification}/VerifyPACISuccess.js +1 -1
  52. package/build/features/shared/PaciVerification/index.d.ts +2 -0
  53. package/build/features/shared/PaciVerification/index.js +2 -0
  54. package/build/features/shared/SalesChannels/SaleChannelIconsInput.d.ts +11 -0
  55. package/build/features/shared/SalesChannels/SaleChannelIconsInput.js +100 -0
  56. package/build/features/shared/SalesChannels/SalesChannel.d.ts +10 -0
  57. package/build/features/shared/SalesChannels/SalesChannel.js +132 -0
  58. package/build/features/shared/SalesChannels/index.d.ts +2 -0
  59. package/build/features/shared/SalesChannels/index.js +2 -0
  60. package/build/features/shared/UploadFile/UploadFile.d.ts +3 -2
  61. package/build/features/shared/UploadFile/UploadFile.js +13 -13
  62. package/build/hooks/index.d.ts +1 -0
  63. package/build/hooks/index.js +1 -0
  64. package/build/hooks/useCountUp.d.ts +9 -0
  65. package/build/hooks/useCountUp.js +17 -0
  66. package/package.json +1 -1
  67. package/build/components/Lottie/files/pulsating_circle_waves.json +0 -236
  68. package/build/features/business/screens/VerifyPACI/VerifyPACILoading.js +0 -23
  69. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +0 -8
  70. package/build/features/connect/screens/Merchant/SocialMedia.js +0 -156
  71. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.d.ts +0 -6
  72. package/build/features/connect/screens/VerifyPACI/VerifyPACILoading.js +0 -23
  73. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.d.ts +0 -5
  74. package/build/features/connect/screens/VerifyPACI/VerifyPACISuccess.js +0 -8
@@ -1,9 +1,9 @@
1
- import { MAX_FILE_SIZE, VALID_FILE_FORMATS, REGEX_ALPHANUMERIC } from '../../../../constants';
1
+ import { MAX_FILE_SIZE, VALID_FILE_FORMATS, REGEX_ALPHANUMERIC, REGEX_IBAN } from '../../../../constants';
2
2
  import * as yup from 'yup';
3
3
  export var BankValidation = yup.object().shape({
4
4
  iban: yup
5
5
  .string()
6
- .matches(/^[a-zA-Z]{2}[a-zA-Z0-9]{13,34}$/g, 'invalid_iban_format')
6
+ .matches(REGEX_IBAN, 'invalid_iban_format')
7
7
  .min(15, 'invalid_iban_format')
8
8
  .max(34, 'invalid_iban_format')
9
9
  .required('alert_iban'),
@@ -27,3 +27,30 @@ export var BankValidation = yup.object().shape({
27
27
  .optional(),
28
28
  confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
29
29
  });
30
+ export var BankKWFLValidation = yup.object().shape({
31
+ iban: yup
32
+ .string()
33
+ .matches(REGEX_IBAN, 'invalid_iban_format')
34
+ .min(15, 'invalid_iban_format')
35
+ .max(34, 'invalid_iban_format')
36
+ .required('alert_iban'),
37
+ bankName: yup.string().optional(),
38
+ beneficiaryName: yup
39
+ .string()
40
+ .matches(REGEX_ALPHANUMERIC, 'beneficiary_name_invalid')
41
+ .required('beneficiary_name_required'),
42
+ bankStatementId: yup.string().optional(),
43
+ bankStatementFile: yup
44
+ .mixed()
45
+ .test({
46
+ test: function (value) {
47
+ if (!!value)
48
+ return VALID_FILE_FORMATS.includes(value === null || value === void 0 ? void 0 : value.type) && (value === null || value === void 0 ? void 0 : value.size) < MAX_FILE_SIZE
49
+ ? true
50
+ : this.createError({ message: 'alert_file_upload' });
51
+ return true;
52
+ }
53
+ })
54
+ .required(),
55
+ confirmPolicy: yup.boolean().required('alert_bank_confirm').isTrue('alert_bank_confirm')
56
+ });
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare type ArticleProps = {
3
+ show: boolean;
4
+ };
5
+ declare const Article: ({ show }: ArticleProps) => JSX.Element;
6
+ export default Article;
@@ -0,0 +1,89 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import React from 'react';
14
+ import { styled } from '@mui/material/styles';
15
+ import { ScreenContainer } from '../../../shared/Containers';
16
+ import { useTranslation } from 'react-i18next';
17
+ import { useController, useFormContext } from 'react-hook-form';
18
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
19
+ import { businessSelector, uploadArticle } from '../../../app/business/businessStore';
20
+ import UploadFile from '../../../shared/UploadFile';
21
+ import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
22
+ import { maskFileName } from '../../../../utils';
23
+ import Collapse from '../../../../components/Collapse';
24
+ var FeatureStyled = styled(ScreenContainer)(function (_a) {
25
+ var theme = _a.theme;
26
+ return ({
27
+ marginBlockStart: theme.spacing(3)
28
+ });
29
+ });
30
+ var Article = function (_a) {
31
+ var _b, _c;
32
+ var show = _a.show;
33
+ var _d = React.useState(0), progress = _d[0], setProgress = _d[1];
34
+ var t = useTranslation().t;
35
+ var _e = useFormContext(), control = _e.control, setError = _e.setError, clearErrors = _e.clearErrors, setValue = _e.setValue;
36
+ var articleFileControl = useController({ name: 'articleFile', control: control });
37
+ var articleIdControl = useController({ name: 'articleId', control: control });
38
+ var _f = useAppSelector(businessSelector), loading = _f.loading, uploadingArticle = _f.uploadingArticle, sysError = _f.error, data = _f.data;
39
+ var dispatch = useAppDispatch();
40
+ var articleValue = articleFileControl.field.value;
41
+ var error = ((_b = articleFileControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message) || ((_c = articleIdControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message);
42
+ var businessTypeData = data.businessTypeData;
43
+ var articleFile = businessTypeData.articleFile, articleId = businessTypeData.articleId;
44
+ React.useEffect(function () {
45
+ if (!articleValue) {
46
+ setValue('articleFile', articleFile);
47
+ setValue('articleId', articleId);
48
+ }
49
+ }, [articleFile, articleId]);
50
+ var handleArticleChange = function (files) {
51
+ var file = files === null || files === void 0 ? void 0 : files[0];
52
+ if (!file)
53
+ return;
54
+ if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
55
+ setError('articleFile', { message: 'file_not_supported_alert' });
56
+ return;
57
+ }
58
+ if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
59
+ setError('articleFile', { message: 'file_size_alert' });
60
+ return;
61
+ }
62
+ articleFileControl.field.onChange(file);
63
+ dispatch(uploadArticle({
64
+ file: file,
65
+ onProgress: function (value) {
66
+ setProgress(value);
67
+ }
68
+ }));
69
+ };
70
+ var handleReset = function () {
71
+ articleFileControl.field.onChange(null);
72
+ articleIdControl.field.onChange('');
73
+ setProgress(0);
74
+ };
75
+ React.useEffect(function () {
76
+ if (sysError === 'file_upload_error') {
77
+ setError('articleId', { message: sysError });
78
+ articleFileControl.field.onChange(null);
79
+ setProgress(0);
80
+ }
81
+ }, [sysError]);
82
+ React.useEffect(function () {
83
+ if ((articleFileControl.formState.isValid || !!articleValue) && error != 'file_upload_error')
84
+ clearErrors();
85
+ }, [articleFileControl.formState.isValid, articleValue]);
86
+ var fileName = articleValue ? maskFileName(articleValue === null || articleValue === void 0 ? void 0 : articleValue.name) : '';
87
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadFile, { label: t('title_article'), title: t('drag_and_drop'), subTitle: t('subtitle_drop'), dragDescription: t('article_of_association'), uploadingTitle: t('file_uploading_title'), successTitle: t('success_upload_bank_statement'), onFileUploaded: handleArticleChange, isFileUploaded: !uploadingArticle && !!articleValue, isSubmitting: loading, isUploading: uploadingArticle, progress: progress, onReset: handleReset, error: error && t(error), initialFileName: fileName }) }) })));
88
+ };
89
+ export default Article;
@@ -9,12 +9,23 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
12
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
24
  import * as React from 'react';
14
25
  import { useForm, FormProvider } from 'react-hook-form';
15
26
  import { useTranslation } from 'react-i18next';
16
27
  import { yupResolver } from '@hookform/resolvers/yup';
17
- import { useAppDispatch, useAppSelector } from '../../../../hooks';
28
+ import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
18
29
  import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
19
30
  import Form from '../../../../components/Form';
20
31
  import Collapse from '../../../../components/Collapse';
@@ -28,23 +39,18 @@ import LicenseList from './LicenseList';
28
39
  var BusinessType = function (_a) {
29
40
  var _b = useAppSelector(businessSelector), data = _b.data, loading = _b.loading, error = _b.error, uploading = _b.uploading;
30
41
  var settingsData = useAppSelector(settingsSelector).data;
31
- var businessTypeData = data.businessTypeData;
42
+ var _c = data.businessTypeData, responseBody = _c.responseBody, defaultValues = __rest(_c, ["responseBody"]);
32
43
  var t = useTranslation().t;
33
44
  var isAr = useLanguage().isAr;
34
45
  var dispatch = useAppDispatch();
35
- var _c = React.useState(false), listActive = _c[0], setListActive = _c[1];
46
+ var _d = React.useState(false), listActive = _d[0], setListActive = _d[1];
36
47
  var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
37
48
  var methods = useForm({
38
49
  resolver: yupResolver(!isSACountry ? KWLicenseValidationSchema : LicenseValidationSchema),
39
- defaultValues: {
40
- selectedLicense: businessTypeData.selectedLicense,
41
- licenseNumber: businessTypeData.licenseNumber,
42
- entityLegalName: businessTypeData.entityLegalName,
43
- certificateId: businessTypeData.certificateId,
44
- certificateFile: businessTypeData.certificateFile
45
- },
50
+ defaultValues: defaultValues,
46
51
  mode: 'onChange'
47
52
  });
53
+ useSetFromDefaultValues(methods, defaultValues);
48
54
  React.useEffect(function () {
49
55
  if (error)
50
56
  dispatch(clearError());
@@ -51,6 +51,6 @@ var EntityName = function (_a) {
51
51
  var clearEntityName = function () {
52
52
  entityNameControl.field.onChange('');
53
53
  };
54
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(BoxStyled, { children: _jsx(Input, { label: t('entity_legal_name_title'), onChange: handleChange, value: entityNameValue, required: !isSACountry, endAdornment: (entityNameValue === null || entityNameValue === void 0 ? void 0 : entityNameValue.length) >= 3 ? _jsx(CheckIcon, {}) : entityNameValue && _jsx(ClearIcon, { onClick: clearEntityName }), placeholder: t('entity_legal_name_placeholder'), warningType: 'alert', warningMessage: error && t(error) }) }) })));
54
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(BoxStyled, { children: _jsx(Input, { label: t('entity_legal_name_title'), onChange: handleChange, value: entityNameValue, required: !isSACountry, endAdornment: !error && entityNameValue ? _jsx(CheckIcon, {}) : entityNameValue && _jsx(ClearIcon, { onClick: clearEntityName }), placeholder: t('entity_legal_name_placeholder'), warningType: 'alert', warningMessage: error && t(error) }) }) })));
55
55
  };
56
56
  export default EntityName;
@@ -38,14 +38,19 @@ var LicenseCertificate = function (_a) {
38
38
  var dispatch = useAppDispatch();
39
39
  var certificateValue = certificateFileControl.field.value;
40
40
  var error = ((_b = certificateFileControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message) || ((_c = certificateIdControl.fieldState.error) === null || _c === void 0 ? void 0 : _c.message);
41
- var handleLicenseCertificateChange = function (file) {
42
- if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
43
- setError('certificateFile', { message: 'file_not_supported_alert' });
44
- }
45
- else if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
46
- setError('certificateFile', { message: 'file_size_alert' });
47
- }
48
- else {
41
+ var handleLicenseCertificateChange = function (files) {
42
+ for (var index = 0; index < files.length; index++) {
43
+ var file = files === null || files === void 0 ? void 0 : files[index];
44
+ if (!file)
45
+ continue;
46
+ if (!VALID_FILE_FORMATS.includes(file === null || file === void 0 ? void 0 : file.type)) {
47
+ setError('certificateFile', { message: 'file_not_supported_alert' });
48
+ continue;
49
+ }
50
+ if ((file === null || file === void 0 ? void 0 : file.size) > MAX_FILE_SIZE) {
51
+ setError('certificateFile', { message: 'file_size_alert' });
52
+ continue;
53
+ }
49
54
  certificateFileControl.field.onChange(file);
50
55
  dispatch(uploadLicenseCertificate({
51
56
  file: file,
@@ -71,6 +76,6 @@ var LicenseCertificate = function (_a) {
71
76
  if ((certificateFileControl.formState.isValid || !!certificateValue) && error != 'file_upload_error')
72
77
  clearErrors();
73
78
  }, [certificateFileControl.formState.isValid, certificateValue]);
74
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadFile, { 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, isFileUploaded: !uploading && !!certificateValue, isSubmitting: loading, isUploading: uploading, progress: progress, onReset: handleReset, error: error && t(error) }) }) })));
79
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(FeatureStyled, { children: _jsx(UploadFile, { 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, isFileUploaded: !uploading && !!certificateValue, isSubmitting: loading, isUploading: uploading, progress: progress, onReset: handleReset, error: error && t(error), multiple: true }) }) })));
75
80
  };
76
81
  export default LicenseCertificate;
@@ -43,6 +43,7 @@ import LicenseType from './LicenseType';
43
43
  import { OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../../constants';
44
44
  import LicenseCertificate from './LicenseCertificate';
45
45
  import { settingsSelector } from '../../../../app/settings';
46
+ import Article from './Article';
46
47
  var InputStyled = styled(Input)(function (_a) {
47
48
  var theme = _a.theme;
48
49
  return ({
@@ -100,7 +101,7 @@ var LicenseList = function (_a) {
100
101
  if (!!country_code) {
101
102
  var isNonSA = !isSA(country_code);
102
103
  if (isNonSA) {
103
- var license = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.FL ? OTHER_FL_LICENSE : OTHER_CR_LICENSE;
104
+ var license = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR ? OTHER_CR_LICENSE : OTHER_FL_LICENSE;
104
105
  setValue('selectedLicense', license, { shouldValidate: true });
105
106
  setValue('entityLegalName', entityLegalName, { shouldValidate: true });
106
107
  }
@@ -142,6 +143,6 @@ var LicenseList = function (_a) {
142
143
  var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
143
144
  return (_jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: isSACountry }, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: isCR ? t(getLicenseName(selected)) : flValue }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
144
145
  return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
145
- } }) }))] })), _jsx(EntityName, { show: show && !isSACountry }), _jsx(LicenseType, { show: show && !isSACountry }), _jsx(LicenseNumber, { show: !isSACountry ? isCR : show, readOnly: licenseReadonly }), _jsx(LicenseCertificate, { show: show && !isSACountry && isCR })] }));
146
+ } }) }))] })), _jsx(LicenseType, { show: show && !isSACountry }), _jsx(EntityName, { show: show && !isSACountry && isCR }), _jsx(LicenseNumber, { show: !isSACountry ? isCR : show, readOnly: licenseReadonly }), _jsx(LicenseCertificate, { show: show && !isSACountry && isCR }), _jsx(Article, { show: show && !isSACountry && isCR })] }));
146
147
  };
147
148
  export default React.memo(LicenseList);
@@ -92,16 +92,16 @@ var LicenseType = function (_a) {
92
92
  dispatch(clearError());
93
93
  selectedLicenseControl.field.onChange(target.value === BusinessType.FL ? OTHER_FL_LICENSE : OTHER_CR_LICENSE);
94
94
  if (isKWCountry && target.value === BusinessType.FL) {
95
- setValue('licenseNumber', '', { shouldValidate: true });
96
95
  setValue('certificateFile', undefined, { shouldValidate: true });
97
96
  setValue('certificateId', undefined, { shouldValidate: true });
98
97
  }
99
98
  };
100
99
  var selectedLicenseValue = selectedLicenseControl.field.value;
101
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: 1.5, pl: 2.5, pr: 2.5 } }, { children: [_jsxs(LabelTextStyled, { children: [t('signup_business_type_label'), _jsx(Mandatory, {})] }), _jsxs(RadioGroupStyled, __assign({ value: selectedLicenseValue != null
100
+ var isFL = (selectedLicenseValue === null || selectedLicenseValue === void 0 ? void 0 : selectedLicenseValue.type) === BusinessType.FL;
101
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: isFL ? 9.5 : 1.5, pl: 2.5, pr: 2.5 } }, { children: [_jsxs(LabelTextStyled, { children: [t('signup_business_type_label'), _jsx(Mandatory, {})] }), _jsxs(RadioGroupStyled, __assign({ value: selectedLicenseValue != null
102
102
  ? (selectedLicenseValue === null || selectedLicenseValue === void 0 ? void 0 : selectedLicenseValue.type) === BusinessType.FL
103
103
  ? BusinessType.FL
104
104
  : BusinessType.CR
105
- : false, onChange: handleOnChange }, { children: [_jsx(RadioLabel, { value: BusinessType.CR, label: _jsxs(LabelStyled, { children: [t('commercial_reg'), _jsx(Tooltip, __assign({ title: t('commercial_reg_hint'), onMouseOver: function () { return setIsCRHovered(true); }, onMouseLeave: function () { return setIsCRHovered(false); }, onTouchStartCapture: function () { return setIsCRHovered(true); } }, { children: isCRHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), control: _jsx(RadioStyled, { color: 'primary', disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, focusRipple: false }) }), _jsx(RadioLabel, { sx: { marginInlineEnd: '0px' }, value: BusinessType.FL, label: _jsxs(LabelStyled, { children: [t('homemaker_reg'), _jsx(Tooltip, __assign({ title: t('homemaker_reg_hint'), onMouseOver: function () { return setIsFLHovered(true); }, onMouseLeave: function () { return setIsFLHovered(false); }, onTouchStartCapture: function () { return setIsFLHovered(true); } }, { children: isFLHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), control: _jsx(RadioStyled, { color: 'primary', disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, focusRipple: false }) })] }))] })) })));
105
+ : false, onChange: handleOnChange }, { children: [_jsx(RadioLabel, { value: BusinessType.FL, label: _jsxs(LabelStyled, { children: [t('homemaker_reg'), _jsx(Tooltip, __assign({ title: t('homemaker_reg_hint'), onMouseOver: function () { return setIsFLHovered(true); }, onMouseLeave: function () { return setIsFLHovered(false); }, onTouchStartCapture: function () { return setIsFLHovered(true); } }, { children: isFLHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), control: _jsx(RadioStyled, { color: 'primary', disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, focusRipple: false }) }), _jsx(RadioLabel, { value: BusinessType.CR, sx: { marginInlineEnd: '0px' }, label: _jsxs(LabelStyled, { children: [t('commercial_reg'), _jsx(Tooltip, __assign({ title: t('commercial_reg_hint'), onMouseOver: function () { return setIsCRHovered(true); }, onMouseLeave: function () { return setIsCRHovered(false); }, onTouchStartCapture: function () { return setIsCRHovered(true); } }, { children: isCRHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), control: _jsx(RadioStyled, { color: 'primary', disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, focusRipple: false }) })] }))] })) })));
106
106
  };
107
107
  export default LicenseType;
@@ -54,15 +54,24 @@ export var KWLicenseValidationSchema = yup.object().shape({
54
54
  .required(''),
55
55
  entityLegalName: yup
56
56
  .string()
57
- .test({
58
- test: function (value) {
59
- var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
60
- if (length === 0)
61
- return true;
62
- return !(value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME)) || (value === null || value === void 0 ? void 0 : value.length) < 3
63
- ? this.createError({ message: 'enter_entity_name_english_chars_numbers_space' })
64
- : true;
57
+ .when('selectedLicense', function (selectedLicense) {
58
+ var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
59
+ if (!isCR) {
60
+ return yup.string().optional();
65
61
  }
62
+ return yup
63
+ .string()
64
+ .required('')
65
+ .test({
66
+ test: function (value) {
67
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
68
+ if (length === 0)
69
+ return true;
70
+ return (value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME)) && length >= 3
71
+ ? true
72
+ : this.createError({ message: 'enter_entity_name_english_chars_numbers_space' });
73
+ }
74
+ });
66
75
  })
67
76
  .required(''),
68
77
  certificateId: yup.string().optional(),
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
2
  export interface VerifyPACIProps {
3
3
  }
4
- declare const _default: React.MemoExoticComponent<() => JSX.Element>;
4
+ declare const _default: React.MemoExoticComponent<() => JSX.Element | null>;
5
5
  export default _default;
@@ -1,159 +1,34 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
- var __generator = (this && this.__generator) || function (thisArg, body) {
22
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
- function verb(n) { return function (v) { return step([n, v]); }; }
25
- function step(op) {
26
- if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
28
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
- if (y = 0, t) op = [op[0] & 2, t.value];
30
- switch (op[0]) {
31
- case 0: case 1: t = op; break;
32
- case 4: _.label++; return { value: op[1], done: false };
33
- case 5: _.label++; y = op[1]; op = [0]; continue;
34
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
- default:
36
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
- if (t[2]) _.ops.pop();
41
- _.trys.pop(); continue;
42
- }
43
- op = body.call(thisArg, _);
44
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
- }
47
- };
48
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
49
2
  import * as React from 'react';
50
- import Box from '@mui/material/Box/Box';
51
- import { styled } from '@mui/material/styles';
52
- import { useTranslation } from 'react-i18next';
53
- import Text from '../../../../components/Text';
54
3
  import { businessSelector, verifyPACI as verifyPACIFun } from '../../../app/business/businessStore';
55
4
  import { handlePrevScreenStep } from '../../../../app/settings';
56
- import { ScreenContainer } from '../../../shared/Containers';
57
- import { MobileButton } from '../../../shared/Button';
58
5
  import { useAppDispatch, useAppSelector } from '../../../../hooks';
59
- import Collapse from '../../../../components/Collapse';
60
- import Warning from '../../../../components/Warning';
61
- import { mobileOS, sleep } from '../../../../utils';
62
- import VerifyPACILoading from './VerifyPACILoading';
63
- import VerifyPACISuccess from './VerifyPACISuccess';
64
- var VerifyPACITitleContainerStyled = styled(Box)(function (_a) {
65
- var theme = _a.theme;
66
- return ({
67
- direction: theme.direction,
68
- borderRadius: theme.spacing(0, 0, 1.25, 1.25),
69
- display: 'flex',
70
- flexDirection: 'column',
71
- alignItems: 'center',
72
- marginBottom: theme.spacing(2.5)
73
- });
74
- });
75
- var VerifyPACITitleStyled = styled(Text)(function (_a) {
76
- var theme = _a.theme;
77
- return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightBold, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line' }));
78
- });
79
- var VerifyPACISubTitleStyled = styled(Text)(function (_a) {
80
- var theme = _a.theme;
81
- return (__assign(__assign({}, theme.typography.body1), { color: theme.palette.text.primary, fontWeight: theme.typography.fontWeightMedium, marginBlock: theme.spacing(1.75), marginInline: theme.spacing(2.5), lineHeight: 1.75, whiteSpace: 'pre-line', textAlign: 'center' }));
82
- });
83
- var Container = styled(Box)(function (_a) {
84
- var theme = _a.theme;
85
- return ({
86
- position: 'relative',
87
- display: 'flex',
88
- justifyContent: 'center',
89
- alignItems: 'center',
90
- maxHeight: '300px'
91
- });
92
- });
93
- var BackButton = styled('button')(function (_a) {
94
- var theme = _a.theme;
95
- return ({
96
- cursor: 'pointer',
97
- height: 44,
98
- appearance: 'none',
99
- background: 'none',
100
- pointerEvents: 'auto',
101
- border: 'none',
102
- color: theme.palette.primary.main,
103
- fontSize: theme.typography.body1.fontSize,
104
- fontWeight: theme.typography.fontWeightMedium,
105
- textTransform: 'capitalize',
106
- '&:hover': {
107
- backgroundColor: 'transparent'
108
- }
109
- });
110
- });
6
+ import PaciVerification from '../../../shared/PaciVerification';
111
7
  var VerifyPACI = function () {
112
8
  var _a = React.useState(false), success = _a[0], setSuccess = _a[1];
113
9
  var _b = React.useState(false), isReady = _b[0], setIsReady = _b[1];
114
10
  var dispatch = useAppDispatch();
115
- var _c = useAppSelector(businessSelector), data = _c.data, error = _c.error;
11
+ var data = useAppSelector(businessSelector).data;
116
12
  var responseBody = data.civilIdData.responseBody;
117
- var t = useTranslation().t;
118
- var onSuccess = function () { return __awaiter(void 0, void 0, void 0, function () {
119
- return __generator(this, function (_a) {
120
- switch (_a.label) {
121
- case 0:
122
- setSuccess(true);
123
- return [4, sleep(2000)];
124
- case 1:
125
- _a.sent();
126
- return [2];
127
- }
128
- });
129
- }); };
13
+ var _c = responseBody || {}, expiry = _c.expiry, app_url_android = _c.app_url_android, app_url_ios = _c.app_url_ios;
130
14
  React.useEffect(function () {
131
- if (responseBody) {
15
+ if (responseBody && !isReady) {
132
16
  setIsReady(true);
133
17
  }
134
18
  }, [responseBody]);
135
19
  React.useEffect(function () {
136
20
  if (!isReady)
137
21
  return;
138
- var promise = dispatch(verifyPACIFun({ onSuccess: onSuccess }));
22
+ var promise = dispatch(verifyPACIFun({ onSuccess: function () { return setSuccess(true); } }));
139
23
  return function () {
140
24
  promise === null || promise === void 0 ? void 0 : promise.abort();
141
25
  };
142
26
  }, [isReady]);
143
- var onRedirect = React.useCallback(function () {
144
- if (os === 'Android') {
145
- window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_android, '_blank');
146
- }
147
- if (os === 'iOS') {
148
- window.open(responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios, '_blank');
149
- }
150
- }, [responseBody]);
151
27
  var onBack = React.useCallback(function () {
152
28
  dispatch(handlePrevScreenStep());
153
29
  }, []);
154
- var os = React.useMemo(function () { return mobileOS(); }, []);
155
- var isAndroid = React.useMemo(function () { return os === 'Android' && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios); }, [os, responseBody]);
156
- var isIOS = React.useMemo(function () { return os === 'iOS' && (responseBody === null || responseBody === void 0 ? void 0 : responseBody.app_url_ios); }, [os, responseBody]);
157
- return (_jsxs(ScreenContainer, __assign({ sx: { mb: 2.5 } }, { children: [_jsxs(VerifyPACITitleContainerStyled, { children: [_jsx(Container, { children: success ? _jsx(VerifyPACISuccess, {}) : _jsx(VerifyPACILoading, { loop: !error }) }), _jsx(VerifyPACITitleStyled, { children: t('authenticate_kuwait_mobile_title') }), _jsx(VerifyPACISubTitleStyled, { children: t('authenticate_kuwait_mobile_description') })] }), _jsx(Collapse, __assign({ in: !!error, sx: { width: '100%' } }, { children: _jsx(Warning, { children: t(error) }) })), (isAndroid || isIOS) && (_jsx(MobileButton, __assign({ onClick: onRedirect, hideIcon: true }, { children: t('Open Kuwait Mobile ID') }))), _jsx(BackButton, __assign({ onClick: onBack }, { children: t('back') }))] })));
30
+ if (!isReady)
31
+ return null;
32
+ return (_jsx(PaciVerification, { expiryInSeconds: expiry, success: success, urls: { android: app_url_android, ios: app_url_ios }, onFinish: function () { return onBack(); } }));
158
33
  };
159
34
  export default React.memo(VerifyPACI);
@@ -23,10 +23,9 @@ import Button from '../../../shared/Button';
23
23
  import { clearError, connectSelector, updateLeadBrand } from '../../../app/connect/connectStore';
24
24
  import { useLanguage } from '../../../../hooks';
25
25
  import { AuthForType } from '../../../../@types';
26
- import { findFirstId, isKW, mapSalesChannel } from '../../../../utils';
26
+ import { isKW } from '../../../../utils';
27
27
  import { MerchantValidationSchema } from './validation';
28
28
  import BrandName from './BrandName';
29
- import SocialMedia from './SocialMedia';
30
29
  import TAC from './TAC';
31
30
  import BrandList from './BrandList';
32
31
  import SalesChannels from './SalesChannels';
@@ -35,12 +34,11 @@ var Merchant = function (_a) {
35
34
  var _d = React.useState(false), brandNameChecking = _d[0], setBrandNameChecking = _d[1];
36
35
  var _e = React.useState(false), isBrandListOpen = _e[0], setIsBrandListOpen = _e[1];
37
36
  var _f = React.useState(false), isRequiredNewBrand = _f[0], setIsRequiredNewBrand = _f[1];
38
- var _g = React.useState(''), activeIconId = _g[0], setActiveIconId = _g[1];
39
- var _h = useAppSelector(connectSelector), data = _h.data, loading = _h.loading, error = _h.error;
37
+ var _g = useAppSelector(connectSelector), data = _g.data, loading = _g.loading, error = _g.error;
40
38
  var settingsData = useAppSelector(settingsSelector).data;
41
39
  var isNewIndividual = (_b = data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.is_new_individual;
42
40
  var startWithNID = data.otpData.authFor === AuthForType.NATIONAL_ID;
43
- var _j = data.brandData, brandName = _j.brandName, selectedBrandItem = _j.selectedBrandItem, termAndConditionChecked = _j.termAndConditionChecked, responseBody = _j.responseBody, salesChannels = _j.salesChannels;
41
+ var _h = data.brandData, brandName = _h.brandName, selectedBrandItem = _h.selectedBrandItem, termAndConditionChecked = _h.termAndConditionChecked, responseBody = _h.responseBody, salesChannels = _h.salesChannels;
44
42
  var brandList = (responseBody || {}).brand_list;
45
43
  var methods = useForm({
46
44
  resolver: yupResolver(MerchantValidationSchema(isRequiredNewBrand)),
@@ -77,24 +75,6 @@ var Merchant = function (_a) {
77
75
  if ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.response_code) === '5')
78
76
  methods.setError('brandName', { message: 'brand_name_already_exist' });
79
77
  }, [responseBody]);
80
- var onSaleIconChange = function (id) {
81
- setActiveIconId(id);
82
- };
83
- React.useEffect(function () {
84
- if (selectedBrandItem.id) {
85
- methods.setValue('selectedBrandItem', selectedBrandItem);
86
- var sales = mapSalesChannel(selectedBrandItem.channel_services || []);
87
- setActiveIconId(findFirstId(sales));
88
- methods.setValue('salesChannels', sales, { shouldValidate: true });
89
- }
90
- }, [selectedBrandItem]);
91
- React.useEffect(function () {
92
- if (salesChannels.length > 0) {
93
- var sales = mapSalesChannel(salesChannels);
94
- setActiveIconId(findFirstId(sales));
95
- methods.setValue('salesChannels', sales, { shouldValidate: true });
96
- }
97
- }, [salesChannels]);
98
78
  React.useEffect(function () {
99
79
  if (termAndConditionChecked === true)
100
80
  methods.setValue('termAndConditionChecked', termAndConditionChecked);
@@ -107,6 +87,6 @@ var Merchant = function (_a) {
107
87
  React.useEffect(function () {
108
88
  setIsRequiredNewBrand(isOtherBrand || isNewBrand);
109
89
  }, [isOtherBrand, isNewBrand]);
110
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: !(isOtherBrand || isNewBrand), list: brandList, onListOpen: function () { return setIsBrandListOpen(true); }, onListClose: function () { return setIsBrandListOpen(false); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Collapse, __assign({ in: !isBrandListOpen }, { children: _jsx(SalesChannels, { onSaleIconChange: onSaleIconChange }) })), _jsx(SocialMedia, { show: !isBrandListOpen, activeIconId: activeIconId, onSaleIconChange: onSaleIconChange }), _jsx(TAC, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen }), _jsx(Collapse, __assign({ in: !isBrandListOpen, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
90
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: !(isOtherBrand || isNewBrand), list: brandList, onListOpen: function () { return setIsBrandListOpen(true); }, onListClose: function () { return setIsBrandListOpen(false); } }), _jsx(BrandName, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Collapse, __assign({ in: !isBrandListOpen }, { children: _jsx(SalesChannels, {}) })), _jsx(TAC, { show: (isNewBrand || isOtherBrand) && !isBrandListOpen }), _jsx(Collapse, __assign({ in: !isBrandListOpen, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
111
91
  };
112
92
  export default React.memo(Merchant);
@@ -1,8 +1,5 @@
1
- import * as React from 'react';
2
- export declare const MandatoryStyled: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
3
- export declare const CollapseStyled: import("@emotion/styled").StyledComponent<import("../../../../components/Collapse").CollapseProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
1
+ /// <reference types="react" />
4
2
  interface SalesChannelsProps {
5
- onSaleIconChange: (id: string) => void;
6
3
  }
7
- declare const SalesChannels: ({ onSaleIconChange }: SalesChannelsProps) => JSX.Element;
4
+ declare const SalesChannels: ({}: SalesChannelsProps) => JSX.Element;
8
5
  export default SalesChannels;