@tap-payments/auth-jsconnect 2.1.3-test → 2.1.6-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 (39) hide show
  1. package/build/@types/form.d.ts +1 -0
  2. package/build/api/entity.d.ts +1 -1
  3. package/build/constants/app.d.ts +1 -0
  4. package/build/constants/app.js +11 -4
  5. package/build/features/app/bank/bankStore.js +3 -3
  6. package/build/features/app/business/businessStore.js +2 -2
  7. package/build/features/app/entity/entityStore.d.ts +13 -1
  8. package/build/features/app/entity/entityStore.js +189 -33
  9. package/build/features/app/individual/individualStore.js +5 -5
  10. package/build/features/app/password/passwordStore.d.ts +1 -7
  11. package/build/features/app/password/passwordStore.js +30 -19
  12. package/build/features/app/tax/taxStore.js +3 -3
  13. package/build/features/business/screens/BusinessType/LicenseList.js +4 -2
  14. package/build/features/business/screens/BusinessType/LicenseNumber.js +6 -6
  15. package/build/features/business/screens/BusinessType/LicenseType.js +12 -1
  16. package/build/features/entity/screens/Customers/CustomerLocations.d.ts +118 -0
  17. package/build/features/entity/screens/Customers/CustomerLocations.js +171 -0
  18. package/build/features/entity/screens/Customers/Customers.d.ts +5 -0
  19. package/build/features/entity/screens/Customers/Customers.js +90 -0
  20. package/build/features/entity/screens/Customers/ExpectedCustomers.d.ts +8 -0
  21. package/build/features/entity/screens/Customers/ExpectedCustomers.js +98 -0
  22. package/build/features/entity/screens/Customers/ExpectedSalesRange.d.ts +8 -0
  23. package/build/features/entity/screens/Customers/ExpectedSalesRange.js +127 -0
  24. package/build/features/entity/screens/Customers/RefundPolicy.d.ts +36 -0
  25. package/build/features/entity/screens/Customers/RefundPolicy.js +84 -0
  26. package/build/features/entity/screens/Customers/TransactionPolicy.d.ts +3 -0
  27. package/build/features/entity/screens/Customers/TransactionPolicy.js +44 -0
  28. package/build/features/entity/screens/Customers/index.d.ts +3 -0
  29. package/build/features/entity/screens/Customers/index.js +2 -0
  30. package/build/features/entity/screens/Customers/validation.d.ts +20 -0
  31. package/build/features/entity/screens/Customers/validation.js +13 -0
  32. package/build/features/entity/screens/EntityInfoConfirm/EntityInfo.js +14 -5
  33. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.d.ts +2 -1
  34. package/build/features/entity/screens/EntityInfoConfirm/LicenseNumber.js +15 -7
  35. package/build/features/entity/screens/EntityInfoConfirm/validation.d.ts +73 -0
  36. package/build/features/entity/screens/EntityInfoConfirm/validation.js +61 -2
  37. package/build/features/featuresScreens.js +5 -0
  38. package/build/features/password/screens/Success/Success.js +7 -3
  39. package/package.json +1 -1
@@ -0,0 +1,84 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import Box from '@mui/material/Box';
14
+ import { styled, alpha } from '@mui/material/styles';
15
+ import CheckBox from '../../../../components/CheckBox';
16
+ import Collapse from '../../../../components/Collapse';
17
+ import { useTranslation } from 'react-i18next';
18
+ import { useLanguage } from '../../../../hooks';
19
+ import { useController, useFormContext } from 'react-hook-form';
20
+ import Text from '../../../../components/Text';
21
+ import Link from '@mui/material/Link';
22
+ import Warning from '../../../../components/Warning';
23
+ import { EXTERNAL_LINKS, TAP_WEBSITE } from '../../../../constants';
24
+ import { ScreenContainer } from '../../../shared/Containers';
25
+ import { settingsSelector } from '../../../../app/settings';
26
+ import { useAppSelector } from '../../../../hooks';
27
+ export var ContainerStyled = styled(Box)(function (_a) {
28
+ var theme = _a.theme;
29
+ return ({
30
+ display: 'flex',
31
+ flexDirection: 'row',
32
+ alignItems: 'center',
33
+ padding: theme.spacing(0, 2.5, 1.5, 2.5)
34
+ });
35
+ });
36
+ export var CheckboxStyled = styled(CheckBox)(function (_a) {
37
+ var theme = _a.theme;
38
+ return ({
39
+ margin: theme.spacing(0),
40
+ padding: theme.spacing(0),
41
+ marginInlineEnd: theme.spacing(1),
42
+ color: theme.palette.primary.main,
43
+ '& .MuiSvgIcon-root': {
44
+ fontSize: 30
45
+ },
46
+ '&.Mui-checked': {
47
+ color: theme.palette.text.primary,
48
+ borderRadius: theme.spacing(2.5)
49
+ }
50
+ });
51
+ });
52
+ var CollapseStyled = styled(Collapse)(function () { return ({
53
+ width: '100%'
54
+ }); });
55
+ export var TextStyled = styled(Text)(function (_a) {
56
+ var theme = _a.theme;
57
+ return (__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre' }, theme.typography.body2));
58
+ });
59
+ export var LinkStyled = styled(Link)(function (_a) {
60
+ var theme = _a.theme;
61
+ return ({
62
+ color: theme.palette.primary.main,
63
+ fontWeight: theme.typography.fontWeightMedium,
64
+ letterSpacing: theme.spacing(0)
65
+ });
66
+ });
67
+ var RefundPolicy = function () {
68
+ var _a;
69
+ var t = useTranslation().t;
70
+ var isAr = useLanguage().isAr;
71
+ var control = useFormContext().control;
72
+ var settingsData = useAppSelector(settingsSelector).data;
73
+ var refundControl = useController({ control: control, name: 'refundPolicy' });
74
+ var refundChecked = refundControl.field.value;
75
+ var warningMessage = (_a = refundControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
76
+ var countryCode = settingsData.businessCountry.iso2.toLowerCase();
77
+ var handleRefundCheckedChange = function (event, checked) {
78
+ refundControl.field.onChange(checked);
79
+ };
80
+ return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.75 } }, { children: [_jsxs(ContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: refundChecked, onChange: handleRefundCheckedChange }), _jsxs(TextStyled, { children: [t('agree_on_refund_policy'), _jsx(LinkStyled, __assign({ href: isAr
81
+ ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.REFUND_AR
82
+ : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.REFUND_EN, target: '_blank', underline: 'always' }, { children: t('refund_policy_compliance') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] })));
83
+ };
84
+ export default RefundPolicy;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const TransactionPolicy: () => JSX.Element;
3
+ export default TransactionPolicy;
@@ -0,0 +1,44 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { styled } from '@mui/material/styles';
14
+ import Collapse from '../../../../components/Collapse';
15
+ import { useTranslation } from 'react-i18next';
16
+ import { useLanguage } from '../../../../hooks';
17
+ import { useController, useFormContext } from 'react-hook-form';
18
+ import Warning from '../../../../components/Warning';
19
+ import { EXTERNAL_LINKS, TAP_WEBSITE } from '../../../../constants';
20
+ import { ContainerStyled, CheckboxStyled, TextStyled, LinkStyled } from './RefundPolicy';
21
+ import { ScreenContainer } from '../../../shared/Containers';
22
+ import { settingsSelector } from '../../../../app/settings';
23
+ import { useAppSelector } from '../../../../hooks';
24
+ var CollapseStyled = styled(Collapse)(function () { return ({
25
+ width: '100%'
26
+ }); });
27
+ var TransactionPolicy = function () {
28
+ var _a;
29
+ var t = useTranslation().t;
30
+ var isAr = useLanguage().isAr;
31
+ var control = useFormContext().control;
32
+ var settingsData = useAppSelector(settingsSelector).data;
33
+ var transactionControl = useController({ control: control, name: 'transactionPolicy' });
34
+ var transactionChecked = transactionControl.field.value;
35
+ var warningMessage = (_a = transactionControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
36
+ var countryCode = settingsData.businessCountry.iso2.toLowerCase();
37
+ var handleTransactionCheckedChange = function (event, checked) {
38
+ transactionControl.field.onChange(checked);
39
+ };
40
+ return (_jsxs(ScreenContainer, { children: [_jsxs(ContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: transactionChecked, onChange: handleTransactionCheckedChange }), _jsxs(TextStyled, { children: [t('agree_on_chargeback_policy'), _jsx(LinkStyled, __assign({ href: isAr
41
+ ? TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TRANSACTION_AR
42
+ : TAP_WEBSITE + countryCode + EXTERNAL_LINKS.TRANSACTION_EN, target: '_blank', underline: 'always' }, { children: t('chargeback_policy') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }));
43
+ };
44
+ export default TransactionPolicy;
@@ -0,0 +1,3 @@
1
+ import Customers, { CustomersProps } from './Customers';
2
+ export type { CustomersProps };
3
+ export default Customers;
@@ -0,0 +1,2 @@
1
+ import Customers from './Customers';
2
+ export default Customers;
@@ -0,0 +1,20 @@
1
+ import * as yup from 'yup';
2
+ export declare const CustomerInfoValidation: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ customerLocations: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
4
+ expectedCustomers: any;
5
+ expectedSalesRange: any;
6
+ refundPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
7
+ transactionPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
8
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
9
+ customerLocations: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
10
+ expectedCustomers: any;
11
+ expectedSalesRange: any;
12
+ refundPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
13
+ transactionPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
14
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
15
+ customerLocations: import("yup/lib/array").RequiredArraySchema<yup.AnySchema<any, any, any>, import("yup/lib/types").AnyObject, any[] | undefined>;
16
+ expectedCustomers: any;
17
+ expectedSalesRange: any;
18
+ refundPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
19
+ transactionPolicy: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
20
+ }>>>;
@@ -0,0 +1,13 @@
1
+ import * as yup from 'yup';
2
+ var objectElements = {
3
+ id: yup.number(),
4
+ name_ar: yup.string(),
5
+ name_en: yup.string()
6
+ };
7
+ export var CustomerInfoValidation = yup.object().shape({
8
+ customerLocations: yup.array().required('please_choose_base'),
9
+ expectedCustomers: yup.object().shape(objectElements).required('select_expected_customers_serve'),
10
+ expectedSalesRange: yup.object().shape(objectElements).required('select_expected_sales'),
11
+ refundPolicy: yup.boolean().required().isTrue('refund_policy_error'),
12
+ transactionPolicy: yup.boolean().required().isTrue('transaction_policy_error')
13
+ });
@@ -30,15 +30,17 @@ import { useAppDispatch, useAppSelector, useLanguage, useSetFromDefaultValues }
30
30
  import { entitySelector, updateEntity } from '../../../app/entity/entityStore';
31
31
  import { FormProvider, useForm } from 'react-hook-form';
32
32
  import { yupResolver } from '@hookform/resolvers/yup';
33
- import { handlePrevScreenStep } from '../../../../app/settings';
33
+ import { BusinessType } from '../../../../@types';
34
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
34
35
  import { styled } from '@mui/system';
35
- import { EntityInfoValidationSchema } from './validation';
36
+ import { EntityInfoValidationSchema, EntityInfoKWValidationSchema } from './validation';
36
37
  import Form from '../../../../components/Form';
37
38
  import Collapse from '../../../../components/Collapse';
38
39
  import Button from '../../../shared/Button';
39
40
  import { useTranslation } from 'react-i18next';
40
41
  import OperationStartDate from './OperationStartDate';
41
42
  import Article from './Article';
43
+ import { isKW } from '../../../../utils';
42
44
  var FormStyled = styled(Form)(function () { return ({
43
45
  display: 'flex',
44
46
  flexDirection: 'column'
@@ -47,12 +49,17 @@ var EntityInfo = function (_a) {
47
49
  var _b = React.useState(false), anchorEl = _b[0], setAnchorEl = _b[1];
48
50
  var _c = React.useState(false), collapse = _c[0], setCollapse = _c[1];
49
51
  var _d = useAppSelector(entitySelector), data = _d.data, loading = _d.loading, error = _d.error, uploading = _d.uploading;
52
+ var settingsData = useAppSelector(settingsSelector).data;
50
53
  var isAr = useLanguage().isAr;
51
54
  var t = useTranslation().t;
52
55
  var dispatch = useAppDispatch();
53
- var _e = data.entityData, responseBody = _e.responseBody, defaultValues = __rest(_e, ["responseBody"]);
56
+ var defaultValues = __rest(data.entityData, []);
57
+ var country_code = settingsData.businessCountry.iso2;
58
+ var licenseType = defaultValues.licenseType;
59
+ var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
60
+ var isCR = React.useMemo(function () { return licenseType === BusinessType.CR; }, [licenseType]);
54
61
  var methods = useForm({
55
- resolver: yupResolver(EntityInfoValidationSchema),
62
+ resolver: yupResolver(isKWCountry ? EntityInfoKWValidationSchema : EntityInfoValidationSchema),
56
63
  defaultValues: defaultValues,
57
64
  mode: 'onChange'
58
65
  });
@@ -70,6 +77,8 @@ var EntityInfo = function (_a) {
70
77
  anchorEl ? setAnchorEl(false) : setAnchorEl(true);
71
78
  };
72
79
  var disabled = !methods.formState.isValid || !!error || uploading;
73
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse && !anchorEl }, { children: [_jsx(LicenseName, {}), _jsx(LicenseNumber, {})] })), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Article, {}) })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
80
+ var showLicenseNumber = isKWCountry ? isCR : true;
81
+ var showCertificate = isCR;
82
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsxs(Collapse, __assign({ in: !collapse && !anchorEl }, { children: [_jsx(LicenseName, {}), _jsx(LicenseNumber, { show: showLicenseNumber })] })), _jsx(Collapse, __assign({ in: !collapse }, { children: _jsx(ActivitiesList, { onListOpen: function () { return handleMenuClick(); }, onListClose: function () { return handleMenuClick(); } }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl && showCertificate }, { children: _jsx(Article, {}) })), _jsx(Collapse, __assign({ in: !anchorEl }, { children: _jsx(OperationStartDate, { onDateClicked: handleCollapseOpenClose }) })), _jsx(Collapse, __assign({ in: !collapse && !anchorEl }, { children: _jsx(Button, __assign({ disableBack: true, onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
74
83
  };
75
84
  export default EntityInfo;
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  interface LicenseNumberProps {
3
+ show: boolean;
3
4
  }
4
- declare const _default: React.MemoExoticComponent<({}: LicenseNumberProps) => JSX.Element>;
5
+ declare const _default: React.MemoExoticComponent<({ show }: LicenseNumberProps) => JSX.Element>;
5
6
  export default _default;
@@ -17,20 +17,26 @@ import { ScreenContainer } from '../../../shared/Containers';
17
17
  import Input from '../../../shared/Input';
18
18
  import { useAppSelector } from '../../../../hooks';
19
19
  import { entitySelector } from '../../../app/entity/entityStore';
20
- import { removeAllOtherThanCharsAndNumber } from '../../../../utils';
20
+ import { isSA, removeAllOtherThanCharsAndNumber } from '../../../../utils';
21
21
  import { BusinessType } from '../../../../@types';
22
- import { CR_NUMBER_LENGTH, FL_NUMBER_LENGTH } from '../../../../constants';
22
+ import { CR_NUMBER_LENGTH, FL_NUMBER_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
23
+ import Collapse from '../../../../components/Collapse';
24
+ import { settingsSelector } from '../../../../app/settings';
23
25
  var LicenseNumber = function (_a) {
24
- var _b, _c;
26
+ var _b, _c, _d, _e;
27
+ var show = _a.show;
25
28
  var t = useTranslation().t;
26
29
  var data = useAppSelector(entitySelector).data;
27
- var _d = useFormContext(), control = _d.control, setValue = _d.setValue;
30
+ var settingsData = useAppSelector(settingsSelector).data;
31
+ var _f = useFormContext(), control = _f.control, setValue = _f.setValue;
28
32
  var entity = (data.verify.responseBody || {}).entity;
29
33
  var licenseType = (_b = entity === null || entity === void 0 ? void 0 : entity.license) === null || _b === void 0 ? void 0 : _b.type;
30
34
  var type = licenseType === 'freelance' ? BusinessType.FL : BusinessType.CR;
31
35
  var isLicensedTrue = entity === null || entity === void 0 ? void 0 : entity.is_licensed;
32
36
  var hasLicenseNumber = (_c = entity === null || entity === void 0 ? void 0 : entity.license) === null || _c === void 0 ? void 0 : _c.number;
37
+ var resLicenseNumber = (_d = entity === null || entity === void 0 ? void 0 : entity.license) === null || _d === void 0 ? void 0 : _d.number;
33
38
  var licenseNumber = data.entityData.licenseNumber;
39
+ var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
34
40
  React.useEffect(function () {
35
41
  setValue('licenseNumber', licenseNumber, { shouldValidate: true });
36
42
  }, [licenseNumber]);
@@ -41,9 +47,11 @@ var LicenseNumber = function (_a) {
41
47
  };
42
48
  var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
43
49
  var licenseNumberValue = licenseNumberControl.field.value;
50
+ var error = (_e = licenseNumberControl.fieldState.error) === null || _e === void 0 ? void 0 : _e.message;
44
51
  var isCR = type === BusinessType.CR;
45
- var length = isCR ? CR_NUMBER_LENGTH : FL_NUMBER_LENGTH;
46
- var disabled = hasLicenseNumber && isLicensedTrue;
47
- return (_jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('license_number_label'), onChange: handleChange, disabled: disabled, inputProps: { maxLength: length }, value: licenseNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } } }) })));
52
+ var length = !isSACountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_LENGTH : FL_NUMBER_LENGTH;
53
+ var minLength = !isSACountry ? KW_MIN_LICENSE_LENGTH : length;
54
+ var disabled = hasLicenseNumber && isLicensedTrue && (resLicenseNumber === null || resLicenseNumber === void 0 ? void 0 : resLicenseNumber.length) >= minLength;
55
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('license_number_label'), onChange: handleChange, disabled: disabled, inputProps: { maxLength: length }, value: licenseNumberValue, sx: { '& .MuiInputBase-input': { cursor: 'auto' } }, placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) })) })));
48
56
  };
49
57
  export default React.memo(LicenseNumber);
@@ -1,6 +1,7 @@
1
1
  import * as yup from 'yup';
2
2
  export declare const EntityInfoValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
3
  licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
5
  licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
5
6
  activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
6
7
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -23,6 +24,7 @@ export declare const EntityInfoValidationSchema: yup.ObjectSchema<import("yup/li
23
24
  articleFile: any;
24
25
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
25
26
  licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
27
+ licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
26
28
  licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
27
29
  activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
28
30
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -45,6 +47,77 @@ export declare const EntityInfoValidationSchema: yup.ObjectSchema<import("yup/li
45
47
  articleFile: any;
46
48
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
47
49
  licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
50
+ licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
51
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
52
+ activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
53
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
54
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
55
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
56
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
57
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
58
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
59
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
60
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
61
+ }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
62
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
63
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
64
+ }>>[] | undefined, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
65
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
66
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
67
+ }>>[] | undefined>;
68
+ operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
69
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
70
+ articleFile: any;
71
+ }>>>;
72
+ export declare const EntityInfoKWValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
73
+ licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
74
+ licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
75
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
76
+ activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
77
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
78
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
79
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
80
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
81
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
82
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
83
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
84
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
85
+ }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
86
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
87
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
88
+ }>>[] | undefined, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
89
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
90
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
91
+ }>>[] | undefined>;
92
+ operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
93
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
94
+ articleFile: any;
95
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
96
+ licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
97
+ licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
98
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
99
+ activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
100
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
101
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
102
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
103
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
104
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
105
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
106
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
107
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
108
+ }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
109
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
110
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
111
+ }>>[] | undefined, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
112
+ ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
113
+ en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
114
+ }>>[] | undefined>;
115
+ operationStartDate: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
116
+ articleId: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
117
+ articleFile: any;
118
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
119
+ licenseName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
120
+ licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
48
121
  licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
49
122
  activities: yup.ArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
50
123
  ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
@@ -1,8 +1,67 @@
1
- import { MAX_FILE_SIZE, VALID_FILE_FORMATS } from '../../../../constants';
1
+ import { KW_MIN_LICENSE_LENGTH, MAX_FILE_SIZE, VALID_FILE_FORMATS, CR_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH } from '../../../../constants';
2
+ import { BusinessType } from '../../../../@types';
2
3
  import * as yup from 'yup';
3
4
  export var EntityInfoValidationSchema = yup.object().shape({
4
5
  licenseName: yup.string().required(''),
5
- licenseNumber: yup.string().required(''),
6
+ licenseType: yup.string().required(''),
7
+ licenseNumber: yup
8
+ .string()
9
+ .test({
10
+ test: function (value) {
11
+ var type = this.parent.licenseType;
12
+ var isCR = type === BusinessType.CR;
13
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
14
+ if (length === 0)
15
+ return true;
16
+ if (isCR) {
17
+ return length > CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
18
+ }
19
+ return length > FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
20
+ }
21
+ })
22
+ .required(''),
23
+ activities: yup.array().of(yup.object().shape({
24
+ ar: yup.string(),
25
+ en: yup.string()
26
+ })),
27
+ operationStartDate: yup.string().required('choose_any_business_date'),
28
+ articleId: yup.string().optional(),
29
+ articleFile: yup
30
+ .mixed()
31
+ .test({
32
+ test: function (value) {
33
+ if (!!value)
34
+ 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
35
+ ? true
36
+ : this.createError({ message: 'alert_file_upload' });
37
+ return true;
38
+ }
39
+ })
40
+ .optional()
41
+ });
42
+ export var EntityInfoKWValidationSchema = yup.object().shape({
43
+ licenseName: yup.string().required(''),
44
+ licenseType: yup.string().required(''),
45
+ licenseNumber: yup
46
+ .string()
47
+ .when('licenseType', function (licenseType) {
48
+ var isCR = licenseType === BusinessType.CR;
49
+ if (!isCR) {
50
+ return yup.string().optional();
51
+ }
52
+ return yup
53
+ .string()
54
+ .required('')
55
+ .test({
56
+ test: function (value) {
57
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
58
+ if (length === 0)
59
+ return true;
60
+ return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_kw_max_length' });
61
+ }
62
+ });
63
+ })
64
+ .required(''),
6
65
  activities: yup.array().of(yup.object().shape({
7
66
  ar: yup.string(),
8
67
  en: yup.string()
@@ -44,6 +44,7 @@ import SignInOTPPage from './signIn/screens/OTP';
44
44
  import SignInPasswordPage from './signIn/screens/Password';
45
45
  import EntityVerifyPage from './entity/screens/Verify';
46
46
  import EntityInfoConfirmPage from './entity/screens/EntityInfoConfirm';
47
+ import EntityCustomersPage from './entity/screens/Customers';
47
48
  import EntitySuccessPage from './entity/screens/Success';
48
49
  import EntitySuccessWithFlowPage from './entity/screens/SuccessWithFlowButtons';
49
50
  import EntityResetPasswordSuccessPage from './entity/screens/ResetPasswordSuccess';
@@ -227,6 +228,10 @@ export var entityFeatureScreens = [
227
228
  name: 'ENTITY_INFO_STEP',
228
229
  element: EntityInfoConfirmPage
229
230
  },
231
+ {
232
+ name: 'ENTITY_CUSTOMERS_STEP',
233
+ element: EntityCustomersPage
234
+ },
230
235
  {
231
236
  name: 'ENTITY_DETAILS_SUCCESS_STEP',
232
237
  element: EntitySuccessPage
@@ -8,15 +8,19 @@ import { PASSWORD_OPERATION_TYPE } from '../../../../constants';
8
8
  var Success = function (_a) {
9
9
  var t = useTranslation().t;
10
10
  var dispatch = useAppDispatch();
11
- var _b = useAppSelector(passwordSelector), loading = _b.loading, error = _b.error, data = _b.data;
11
+ var _b = useAppSelector(passwordSelector), error = _b.error, loading = _b.loading, data = _b.data;
12
12
  var operationType = data.verify.operationType;
13
- var onSuccess = function () {
13
+ var _c = React.useState(false), clicked = _c[0], setClicked = _c[1];
14
+ React.useEffect(function () {
14
15
  if (operationType === PASSWORD_OPERATION_TYPE.RESET_PASSWORD) {
15
16
  dispatch(retrieveBoardResetPasswordSuccess());
16
17
  return;
17
18
  }
18
19
  dispatch(updateBoardSuccess());
20
+ }, []);
21
+ var onSuccess = function () {
22
+ setClicked(true);
19
23
  };
20
- return (_jsx(SuccessScreen, { title: t('password_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: loading, error: error || '' }));
24
+ return (_jsx(SuccessScreen, { title: t('password_success_title'), onSuccess: onSuccess, successTitle: t('continue'), loading: clicked && loading, error: error || '' }));
21
25
  };
22
26
  export default React.memo(Success);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.1.3-test",
3
+ "version": "2.1.6-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",