@tap-payments/auth-jsconnect 1.0.44 → 1.0.47

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 (47) hide show
  1. package/build/@types/app.d.ts +7 -0
  2. package/build/@types/form.d.ts +2 -1
  3. package/build/@types/redux.d.ts +0 -1
  4. package/build/api/auth.d.ts +0 -2
  5. package/build/api/lead.d.ts +3 -2
  6. package/build/assets/locales/ar.json +3 -1
  7. package/build/assets/locales/en.json +3 -1
  8. package/build/components/AnimationFlow/BottomSheet.js +3 -3
  9. package/build/components/Footer/Footer.js +5 -5
  10. package/build/constants/app.js +2 -2
  11. package/build/constants/dummy.d.ts +14 -0
  12. package/build/constants/dummy.js +29 -0
  13. package/build/constants/validation.d.ts +1 -0
  14. package/build/constants/validation.js +1 -0
  15. package/build/features/app/business/businessStore.d.ts +3 -3
  16. package/build/features/app/business/businessStore.js +45 -52
  17. package/build/features/app/connect/connectStore.d.ts +35 -13
  18. package/build/features/app/connect/connectStore.js +160 -185
  19. package/build/features/bank/Bank.js +1 -1
  20. package/build/features/business/Business.js +2 -15
  21. package/build/features/connect/screens/Individual/Email.d.ts +3 -1
  22. package/build/features/connect/screens/Individual/Email.js +53 -5
  23. package/build/features/connect/screens/Individual/Individual.js +13 -9
  24. package/build/features/connect/screens/Individual/validation.d.ts +1 -1
  25. package/build/features/connect/screens/Individual/validation.js +7 -3
  26. package/build/features/connect/screens/Merchant/BrandList.d.ts +12 -0
  27. package/build/features/connect/screens/Merchant/BrandList.js +118 -0
  28. package/build/features/connect/screens/Merchant/BrandName.d.ts +4 -1
  29. package/build/features/connect/screens/Merchant/BrandName.js +56 -5
  30. package/build/features/connect/screens/Merchant/Merchant.js +14 -7
  31. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +4 -1
  32. package/build/features/connect/screens/Merchant/SocialMedia.js +4 -3
  33. package/build/features/connect/screens/Merchant/TAC.d.ts +2 -1
  34. package/build/features/connect/screens/Merchant/TAC.js +2 -1
  35. package/build/features/connect/screens/Merchant/validation.d.ts +4 -4
  36. package/build/features/connect/screens/Merchant/validation.js +60 -56
  37. package/build/features/connect/screens/Mobile/Mobile.js +6 -1
  38. package/build/features/connect/screens/Mobile/validation.d.ts +1 -1
  39. package/build/features/connect/screens/Mobile/validation.js +7 -2
  40. package/build/features/connect/screens/Password/Password.js +5 -3
  41. package/build/features/individual/Individual.js +1 -1
  42. package/build/features/password/Password.js +1 -1
  43. package/build/features/shared/Button/Button.js +1 -1
  44. package/build/features/tax/Tax.js +2 -2
  45. package/package.json +1 -1
  46. package/build/hooks/useElementSizeById.d.ts +0 -6
  47. package/build/hooks/useElementSizeById.js +0 -12
@@ -1,59 +1,63 @@
1
1
  import { REGEX_WEBSITE } from '../../../../constants';
2
2
  import * as yup from 'yup';
3
- export var MerchantValidationSchema = yup.object().shape({
4
- brandName: yup
5
- .string()
6
- .min(3, 'enter_brand_name_english_chars_numbers_space')
7
- .max(250, 'enter_brand_name_english_chars_numbers_space')
8
- .required('enter_valid_brand_name'),
9
- termAndConditionChecked: yup.boolean().required().isTrue('check_terms_cond'),
10
- links: yup.object().shape({
11
- website: yup.string().when(['instagram', 'twitter'], function (instagram, twitter) {
12
- if (!instagram && !twitter) {
13
- return yup
14
- .string()
15
- .matches(REGEX_WEBSITE, 'ide_not_valid_url')
16
- .transform(function (value) { return (!!value ? value : null); })
17
- .nullable()
18
- .required('enter_at_least_one');
19
- }
20
- else {
21
- return yup
22
- .string()
23
- .matches(REGEX_WEBSITE, 'ide_not_valid_url')
24
- .transform(function (value) { return (!!value ? value : null); })
25
- .nullable()
26
- .optional();
27
- }
28
- }),
29
- instagram: yup
3
+ export var MerchantValidationSchema = function (termsIsRequired) {
4
+ return yup.object().shape({
5
+ brandName: yup
30
6
  .string()
31
- .nullable()
32
- .transform(function (value) { return (!!value ? value : null); })
33
- .when(['twitter', 'website'], function (twitter, website) {
34
- if (!website && !twitter) {
35
- return yup.string().min(2, 'enter_at_least_one').required('enter_at_least_one');
36
- }
37
- else {
38
- return yup.string().optional();
39
- }
40
- }),
41
- twitter: yup
42
- .string()
43
- .nullable()
44
- .transform(function (value) { return (!!value ? value : null); })
45
- .min(2, 'enter_at_least_one')
46
- .when(['website', 'instagram'], function (website, instagram) {
47
- if (!website && !instagram) {
48
- return yup.string().min(2, 'enter_at_least_one').required('enter_at_least_one');
49
- }
50
- else {
51
- return yup.string().optional();
52
- }
53
- })
54
- }, [
55
- ['instagram', 'website'],
56
- ['twitter', 'website'],
57
- ['instagram', 'twitter']
58
- ])
59
- });
7
+ .min(3, 'enter_brand_name_english_chars_numbers_space')
8
+ .max(250, 'enter_brand_name_english_chars_numbers_space')
9
+ .required('enter_valid_brand_name'),
10
+ termAndConditionChecked: termsIsRequired
11
+ ? yup.boolean().required().isTrue('check_terms_cond')
12
+ : yup.boolean().optional(),
13
+ links: yup.object().shape({
14
+ website: yup.string().when(['instagram', 'twitter'], function (instagram, twitter) {
15
+ if (!instagram && !twitter) {
16
+ return yup
17
+ .string()
18
+ .matches(REGEX_WEBSITE, 'ide_not_valid_url')
19
+ .transform(function (value) { return (!!value ? value : null); })
20
+ .nullable()
21
+ .required('enter_at_least_one');
22
+ }
23
+ else {
24
+ return yup
25
+ .string()
26
+ .matches(REGEX_WEBSITE, 'ide_not_valid_url')
27
+ .transform(function (value) { return (!!value ? value : null); })
28
+ .nullable()
29
+ .optional();
30
+ }
31
+ }),
32
+ instagram: yup
33
+ .string()
34
+ .nullable()
35
+ .transform(function (value) { return (!!value ? value : null); })
36
+ .when(['twitter', 'website'], function (twitter, website) {
37
+ if (!website && !twitter) {
38
+ return yup.string().min(2, 'enter_at_least_one').required('enter_at_least_one');
39
+ }
40
+ else {
41
+ return yup.string().optional();
42
+ }
43
+ }),
44
+ twitter: yup
45
+ .string()
46
+ .nullable()
47
+ .transform(function (value) { return (!!value ? value : null); })
48
+ .min(2, 'enter_at_least_one')
49
+ .when(['website', 'instagram'], function (website, instagram) {
50
+ if (!website && !instagram) {
51
+ return yup.string().min(2, 'enter_at_least_one').required('enter_at_least_one');
52
+ }
53
+ else {
54
+ return yup.string().optional();
55
+ }
56
+ })
57
+ }, [
58
+ ['instagram', 'website'],
59
+ ['twitter', 'website'],
60
+ ['instagram', 'twitter']
61
+ ])
62
+ });
63
+ };
@@ -77,14 +77,16 @@ var Mobile = function (_a) {
77
77
  var _b = useSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
78
78
  var _c = React.useState(data.mobileData.countryCode.digits), mobileLength = _c[0], setMobileLength = _c[1];
79
79
  var _d = React.useState(), listType = _d[0], setListType = _d[1];
80
+ var _e = React.useState(false), isSA = _e[0], setIsSA = _e[1];
80
81
  var dispatch = useAppDispatch();
81
82
  var methods = useForm({
82
- resolver: yupResolver(PhoneValidationSchema(mobileLength)),
83
+ resolver: yupResolver(PhoneValidationSchema(mobileLength, isSA)),
83
84
  defaultValues: data.mobileData,
84
85
  mode: 'onChange'
85
86
  });
86
87
  var t = useTranslation().t;
87
88
  var isAr = useLanguage().isAr;
89
+ var countryCodeSA = methods.getValues('countryCode').iso2 === 'SA';
88
90
  var handleMenuListClick = function (flag) {
89
91
  setListType(flag);
90
92
  };
@@ -93,6 +95,9 @@ var Mobile = function (_a) {
93
95
  methods.setValue('countryCode', data.mobileData.countryCode);
94
96
  }
95
97
  }, [data.mobileData]);
98
+ React.useEffect(function () {
99
+ setIsSA(countryCodeSA);
100
+ }, [countryCodeSA]);
96
101
  React.useEffect(function () {
97
102
  if (error)
98
103
  dispatch(clearError());
@@ -1,5 +1,5 @@
1
1
  import * as yup from 'yup';
2
- export declare const PhoneValidationSchema: (length: number) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
2
+ export declare const PhoneValidationSchema: (length: number, isSA: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
3
  mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
4
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
5
5
  mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
@@ -1,6 +1,11 @@
1
+ import { REGEX_SAUDI_NUMBER } from '../../../../constants';
1
2
  import * as yup from 'yup';
2
- export var PhoneValidationSchema = function (length) {
3
+ export var PhoneValidationSchema = function (length, isSA) {
3
4
  return yup.object().shape({
4
- mobile: yup.string().length(length, 'enter_valid_mobile_number').required('mobile_number_error')
5
+ mobile: yup
6
+ .string()
7
+ .matches(isSA ? REGEX_SAUDI_NUMBER : /^[0-9]/g, 'start_with_number')
8
+ .length(length, 'enter_valid_mobile_number')
9
+ .required('mobile_number_error')
5
10
  });
6
11
  };
@@ -18,7 +18,7 @@ import { useTranslation } from 'react-i18next';
18
18
  import { yupResolver } from '@hookform/resolvers/yup';
19
19
  import { styled } from '@mui/material/styles';
20
20
  import { handlePrevScreenStep } from '../../../../app/settings';
21
- import { clearError, connectSelector, createVerifyAuthPassword } from '../../../app/connect/connectStore';
21
+ import { clearError, connectSelector } from '../../../app/connect/connectStore';
22
22
  import Form from '../../../../components/Form';
23
23
  import Button from '../../../shared/Button';
24
24
  import { ScreenContainer } from '../../../shared/Containers';
@@ -36,7 +36,9 @@ var Password = function (_a) {
36
36
  var _b = useSelector(connectSelector), data = _b.data, loading = _b.loading, error = _b.error;
37
37
  var methods = useForm({
38
38
  resolver: yupResolver(PasswordValidationSchema),
39
- defaultValues: data.passwordData,
39
+ defaultValues: {
40
+ password: ''
41
+ },
40
42
  mode: 'onChange'
41
43
  });
42
44
  var t = useTranslation().t;
@@ -47,7 +49,7 @@ var Password = function (_a) {
47
49
  dispatch(clearError());
48
50
  }, [methods.formState.isValid]);
49
51
  var onSubmit = function (formData) {
50
- dispatch(createVerifyAuthPassword(formData));
52
+ console.log(formData);
51
53
  };
52
54
  var onBack = function () {
53
55
  dispatch(handlePrevScreenStep(isAbsher ? 'CONNECT_NID_STEP' : 'CONNECT_MOBILE_STEP'));
@@ -19,10 +19,10 @@ import { store } from '../../app/store';
19
19
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
20
20
  import Collapse from '../../components/Collapse';
21
21
  import { reactElement } from '../../utils';
22
+ import { FeatureContainer } from '../shared/Containers';
22
23
  import { INDIVIDUAL_SCREENS_NAVIGATION } from '../../constants';
23
24
  import { individualFeatureScreens } from '../featuresScreens';
24
25
  import CustomFooter from '../shared/Footer';
25
- import { FeatureContainer } from '../shared/Containers';
26
26
  var Individual = memo(function (props) {
27
27
  var open = React.useState(true)[0];
28
28
  var t = useTranslation().t;
@@ -18,11 +18,11 @@ import AnimationFlow from '../../components/AnimationFlow';
18
18
  import { store } from '../../app/store';
19
19
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
20
20
  import Collapse from '../../components/Collapse';
21
+ import { FeatureContainer } from '../shared/Containers';
21
22
  import { reactElement } from '../../utils';
22
23
  import { PASSWORD_SCREENS_NAVIGATION } from '../../constants';
23
24
  import { passwordFeatureScreens } from '../featuresScreens';
24
25
  import CustomFooter from '../shared/Footer';
25
- import { FeatureContainer } from '../shared/Containers';
26
26
  var Password = memo(function (props) {
27
27
  var open = React.useState(true)[0];
28
28
  var t = useTranslation().t;
@@ -79,7 +79,7 @@ var BackButtonStyled = styled(Button, { shouldForwardProp: function (prop) { ret
79
79
  paddingInlineStart: theme.spacing(2.5),
80
80
  width: '10%',
81
81
  zIndex: 1,
82
- borderRadius: isAr ? theme.spacing(0, 4.75, 4.75, 0) : theme.spacing(4.75, 0, 0, 4.75)
82
+ borderRadius: isAr ? theme.spacing(0, 4.1, 4.1, 0) : theme.spacing(4.1, 0, 0, 4.1)
83
83
  });
84
84
  });
85
85
  export default function CustomButton(_a) {
@@ -19,10 +19,10 @@ import { store } from '../../app/store';
19
19
  import { ReduxProvider, ThemeProvider } from '../../components/Providers';
20
20
  import Collapse from '../../components/Collapse';
21
21
  import { reactElement } from '../../utils';
22
+ import { FeatureContainer } from '../shared/Containers';
22
23
  import { TAX_SCREENS_NAVIGATION } from '../../constants';
23
24
  import { taxFeatureScreens } from '../featuresScreens';
24
25
  import CustomFooter from '../shared/Footer';
25
- import { FeatureContainer } from '../shared/Containers';
26
26
  var Tax = memo(function (props) {
27
27
  var open = React.useState(true)[0];
28
28
  var t = useTranslation().t;
@@ -36,7 +36,7 @@ var Tax = memo(function (props) {
36
36
  return (_jsx(ThemeProvider, __assign({ theme: theme }, { children: _jsx(AnimationFlow, __assign({ open: open, breakpoint: 'sm', footer: _jsx(CustomFooter, {}) }, { children: _jsx(FeatureContainer, { children: taxFeatureScreens.map(function (_a, index) {
37
37
  var Element = _a.element, name = _a.name;
38
38
  var isActive = activeScreen.name === name;
39
- return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 300, appear: 300, exit: 400 } }, { children: _jsx(Element, {}) }), index));
39
+ return (_jsx(Collapse, __assign({ in: isActive, timeout: { enter: 1000, exit: 800 } }, { children: _jsx(Element, {}) }), index));
40
40
  }) }) })) })));
41
41
  });
42
42
  export function TaxLib(props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "1.0.44",
3
+ "version": "1.0.47",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -1,6 +0,0 @@
1
- interface ElementSize {
2
- width: number;
3
- height: number;
4
- }
5
- export declare const useElementSizeById: (id: string) => ElementSize;
6
- export {};
@@ -1,12 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- export var useElementSizeById = function (id) {
3
- var _a = useState({ width: 0, height: 0 }), size = _a[0], setSize = _a[1];
4
- var element = document.getElementById(id);
5
- useEffect(function () {
6
- if (element) {
7
- var _a = element.getBoundingClientRect(), width = _a.width, height = _a.height;
8
- setSize({ width: width, height: height });
9
- }
10
- }, [element]);
11
- return size;
12
- };