@tap-payments/auth-jsconnect 1.0.45 → 1.0.48

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 (53) hide show
  1. package/build/@types/app.d.ts +8 -1
  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/entity.d.ts +2 -1
  6. package/build/api/entity.js +5 -1
  7. package/build/api/index.d.ts +1 -0
  8. package/build/api/lead.d.ts +3 -2
  9. package/build/assets/locales/ar.json +3 -1
  10. package/build/assets/locales/en.json +3 -1
  11. package/build/components/Footer/Footer.js +5 -5
  12. package/build/constants/app.d.ts +2 -0
  13. package/build/constants/app.js +4 -2
  14. package/build/constants/dummy.d.ts +14 -0
  15. package/build/constants/dummy.js +29 -0
  16. package/build/constants/validation.d.ts +1 -0
  17. package/build/constants/validation.js +1 -0
  18. package/build/features/app/business/businessStore.d.ts +3 -3
  19. package/build/features/app/business/businessStore.js +52 -58
  20. package/build/features/app/connect/connectStore.d.ts +35 -13
  21. package/build/features/app/connect/connectStore.js +163 -186
  22. package/build/features/bank/Bank.js +1 -1
  23. package/build/features/business/Business.js +2 -15
  24. package/build/features/business/screens/Customers/CustomerLocations.js +1 -1
  25. package/build/features/business/screens/Customers/ExpectedCustomers.js +2 -2
  26. package/build/features/business/screens/Customers/ExpectedSalesRange.js +1 -1
  27. package/build/features/connect/screens/Individual/Email.d.ts +3 -1
  28. package/build/features/connect/screens/Individual/Email.js +53 -5
  29. package/build/features/connect/screens/Individual/Individual.js +13 -9
  30. package/build/features/connect/screens/Individual/validation.d.ts +1 -1
  31. package/build/features/connect/screens/Individual/validation.js +7 -3
  32. package/build/features/connect/screens/Merchant/BrandList.d.ts +12 -0
  33. package/build/features/connect/screens/Merchant/BrandList.js +118 -0
  34. package/build/features/connect/screens/Merchant/BrandName.d.ts +4 -1
  35. package/build/features/connect/screens/Merchant/BrandName.js +56 -5
  36. package/build/features/connect/screens/Merchant/Merchant.js +14 -7
  37. package/build/features/connect/screens/Merchant/SocialMedia.d.ts +4 -1
  38. package/build/features/connect/screens/Merchant/SocialMedia.js +4 -3
  39. package/build/features/connect/screens/Merchant/TAC.d.ts +2 -1
  40. package/build/features/connect/screens/Merchant/TAC.js +2 -1
  41. package/build/features/connect/screens/Merchant/validation.d.ts +4 -4
  42. package/build/features/connect/screens/Merchant/validation.js +60 -56
  43. package/build/features/connect/screens/Mobile/Mobile.js +6 -1
  44. package/build/features/connect/screens/Mobile/validation.d.ts +1 -1
  45. package/build/features/connect/screens/Mobile/validation.js +7 -2
  46. package/build/features/connect/screens/Password/Password.js +5 -3
  47. package/build/features/individual/Individual.js +1 -1
  48. package/build/features/password/Password.js +1 -1
  49. package/build/features/shared/Button/Button.js +1 -1
  50. package/build/features/tax/Tax.js +2 -2
  51. package/package.json +1 -1
  52. package/build/hooks/useElementSizeById.d.ts +0 -6
  53. package/build/hooks/useElementSizeById.js +0 -12
@@ -78,7 +78,7 @@ var ExpectedSalesRange = function (_a) {
78
78
  };
79
79
  var expectedSalesRangeValue = expectedSalesRangeControl.field.value || expectedSalesRangeList;
80
80
  var expectedSalesRangeSelected = expectedSalesRangeValue;
81
- return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_yearly') }), _jsx(InputStyled, { readOnly: true, value: isAr ? expectedSalesRangeSelected === null || expectedSalesRangeSelected === void 0 ? void 0 : expectedSalesRangeSelected.nameAR : expectedSalesRangeSelected === null || expectedSalesRangeSelected === void 0 ? void 0 : expectedSalesRangeSelected.name, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: expectedSalesRangeList, onSelectItem: onSelectItem, renderItem: function (item) {
81
+ return (_jsx(Collapse, __assign({ in: rest.show }, { children: _jsxs(ScreenContainer, { children: [_jsx(InputLabelStyled, { children: t('expected_sales_yearly') }), _jsx(InputStyled, { readOnly: true, value: isAr ? expectedSalesRangeSelected === null || expectedSalesRangeSelected === void 0 ? void 0 : expectedSalesRangeSelected.titleAr : expectedSalesRangeSelected === null || expectedSalesRangeSelected === void 0 ? void 0 : expectedSalesRangeSelected.title, onClick: !!anchorEl ? function () { return onCloseList(); } : onOpenList, placeholder: t('choose_expected_sales'), endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl, timeout: 300 }, { children: _jsx(SimpleListStyled, { searchKeyPath: 'name', list: expectedSalesRangeList, onSelectItem: onSelectItem, renderItem: function (item) {
82
82
  return (_jsxs(_Fragment, { children: [_jsx(ListItemContainer, { children: _jsx(NameContainer, __assign({ isSelected: (item === null || item === void 0 ? void 0 : item.id) === (expectedSalesRangeValue === null || expectedSalesRangeValue === void 0 ? void 0 : expectedSalesRangeValue.id) }, { children: isAr ? item.titleAr : item.title })) }), item.id === (expectedSalesRangeSelected === null || expectedSalesRangeSelected === void 0 ? void 0 : expectedSalesRangeSelected.id) && _jsx(CheckIconStyled, {})] }));
83
83
  } }) }))] }) })));
84
84
  };
@@ -1,6 +1,8 @@
1
1
  import * as React from 'react';
2
2
  export interface EmailProps {
3
3
  show: boolean;
4
+ fetchingEmail: (flag: boolean) => void;
5
+ emailChecking: boolean;
4
6
  }
5
- declare const _default: React.MemoExoticComponent<({ show }: EmailProps) => JSX.Element>;
7
+ declare const _default: React.MemoExoticComponent<({ show, fetchingEmail, emailChecking }: EmailProps) => JSX.Element>;
6
8
  export default _default;
@@ -9,9 +9,46 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
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
+ };
12
48
  import { jsx as _jsx } from "react/jsx-runtime";
13
49
  import * as React from 'react';
14
50
  import { useTranslation } from 'react-i18next';
51
+ import axios from 'axios';
15
52
  import { ScreenContainer } from '../../../shared/Containers';
16
53
  import Input from '../../../shared/Input';
17
54
  import { useController, useFormContext } from 'react-hook-form';
@@ -30,30 +67,41 @@ var InputStyled = styled(Input)(function (_a) {
30
67
  }
31
68
  });
32
69
  });
70
+ var cancelToken = null;
33
71
  var Email = function (_a) {
34
72
  var _b;
35
- var show = _a.show;
73
+ var show = _a.show, fetchingEmail = _a.fetchingEmail, emailChecking = _a.emailChecking;
36
74
  var dispatch = useAppDispatch();
37
75
  var t = useTranslation().t;
38
76
  var control = useFormContext().control;
39
77
  var emailControl = useController({ name: 'email', control: control });
40
78
  var emailValue = emailControl.field.value;
41
79
  var error = (_b = emailControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
42
- var checkEmail = debounce(function (value) {
43
- dispatch(checkEmailAvailability(value));
44
- }, 500);
80
+ var checkEmail = debounce(function (value) { return __awaiter(void 0, void 0, void 0, function () {
81
+ var onSuccess;
82
+ return __generator(this, function (_a) {
83
+ if (cancelToken) {
84
+ cancelToken.cancel('Aborted');
85
+ }
86
+ cancelToken = axios.CancelToken.source();
87
+ onSuccess = function () { return fetchingEmail(false); };
88
+ dispatch(checkEmailAvailability({ email: value, cancelToken: cancelToken.token, onSuccess: onSuccess }));
89
+ return [2];
90
+ });
91
+ }); }, 500);
45
92
  var handleEmailChange = function (event) {
46
93
  emailControl.field.onChange(event.target.value);
47
94
  };
48
95
  React.useEffect(function () {
49
96
  var isValid = emailValue && !error && emailValue.length > 3;
50
97
  if (isValid) {
98
+ fetchingEmail(true);
51
99
  checkEmail(emailValue);
52
100
  }
53
101
  }, [emailValue, error]);
54
102
  var clearNumber = function () {
55
103
  emailControl.field.onChange('');
56
104
  };
57
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('signup_email_lable'), value: emailValue, onEnterPressed: function (e) { return e.preventDefault(); }, onChange: handleEmailChange, type: 'email', placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && emailValue ? _jsx(CheckIcon, {}) : emailValue && _jsx(ClearIcon, { onClick: clearNumber }) }) }) })));
105
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('signup_email_lable'), value: emailValue, onEnterPressed: function (e) { return e.preventDefault(); }, onChange: handleEmailChange, type: 'email', placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: emailChecking ? t('checking...') : error && t(error), endAdornment: !error && emailValue ? _jsx(CheckIcon, {}) : emailValue && _jsx(ClearIcon, { onClick: clearNumber }) }) }) })));
58
106
  };
59
107
  export default React.memo(Email);
@@ -35,31 +35,32 @@ var FormStyled = styled(Form)(function () { return ({
35
35
  }); });
36
36
  var Individual = function (_a) {
37
37
  var _b, _c, _d;
38
- var _e = React.useState(false), listActive = _e[0], setListActive = _e[1];
39
- var _f = useSelector(connectSelector), data = _f.data, loading = _f.loading, error = _f.error, searchActive = _f.searchActive;
40
- var _g = React.useState(data.individualData.countryCode.digits), mobileLength = _g[0], setMobileLength = _g[1];
38
+ var _e = React.useState(false), isSA = _e[0], setIsSA = _e[1];
39
+ var _f = React.useState(false), listActive = _f[0], setListActive = _f[1];
40
+ var _g = React.useState(false), emailChecking = _g[0], setEmailChecking = _g[1];
41
+ var _h = useSelector(connectSelector), data = _h.data, loading = _h.loading, error = _h.error;
42
+ var _j = React.useState(data.individualData.countryCode.digits), mobileLength = _j[0], setMobileLength = _j[1];
41
43
  var dispatch = useAppDispatch();
42
44
  var t = useTranslation().t;
43
45
  var isAr = useLanguage().isAr;
44
46
  var isAbsher = (_b = data.otpData) === null || _b === void 0 ? void 0 : _b.isAbsher;
45
47
  var individualData = data.individualData;
46
48
  var methods = useForm({
47
- resolver: yupResolver(isAbsher ? IndividualMobileValidation(mobileLength) : IndividualValidation()),
49
+ resolver: yupResolver(isAbsher ? IndividualMobileValidation(mobileLength, isSA) : IndividualValidation()),
48
50
  defaultValues: data.individualData,
49
51
  mode: 'onChange'
50
52
  });
53
+ var countryCodeSA = methods.getValues('countryCode').iso2 === 'SA';
51
54
  var onSubmit = function (formData) {
52
55
  dispatch(updateLeadIndividual(formData));
53
56
  };
54
57
  var onBack = function () {
58
+ dispatch(resetIndividualScreen());
55
59
  dispatch(handlePrevScreenStep(isAbsher ? 'CONNECT_NID_STEP' : 'CONNECT_MOBILE_STEP'));
56
60
  };
57
61
  React.useEffect(function () {
58
62
  if (error)
59
63
  dispatch(clearError());
60
- return function () {
61
- dispatch(resetIndividualScreen());
62
- };
63
64
  }, [methods.formState.isValid]);
64
65
  React.useEffect(function () {
65
66
  var name = individualData.name, email = individualData.email, mobile = individualData.mobile, countryCode = individualData.countryCode;
@@ -80,8 +81,11 @@ var Individual = function (_a) {
80
81
  if (((_b = (_a = data.individualData) === null || _a === void 0 ? void 0 : _a.responseBody) === null || _b === void 0 ? void 0 : _b.is_available) === false)
81
82
  methods.setError('email', { message: 'tap_js_email_already_exist' });
82
83
  }, [(_c = data.individualData) === null || _c === void 0 ? void 0 : _c.responseBody]);
84
+ React.useEffect(function () {
85
+ setIsSA(countryCodeSA);
86
+ }, [countryCodeSA]);
83
87
  var emailErrChecks = !methods.formState.isValid || !!methods.formState.errors.email || !!error;
84
- var disabled = emailErrChecks || searchActive || !((_d = data.individualData.responseBody) === null || _d === void 0 ? void 0 : _d.is_available);
85
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Name, { show: !listActive }), _jsx(MobileNumber, { setMobileLength: setMobileLength, show: isAbsher, onListOpen: function () { return handleMenuListClick(); }, onListClose: function () { return handleMenuListClick(); }, countries: countriesCode }), _jsx(Email, { show: !listActive }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
88
+ var disabled = emailErrChecks || emailChecking || !((_d = data.individualData.responseBody) === null || _d === void 0 ? void 0 : _d.is_available);
89
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Name, { show: !listActive }), _jsx(MobileNumber, { setMobileLength: setMobileLength, show: isAbsher, onListOpen: function () { return handleMenuListClick(); }, onListClose: function () { return handleMenuListClick(); }, countries: countriesCode }), _jsx(Email, { show: !listActive, fetchingEmail: function (v) { return setEmailChecking(v); }, emailChecking: emailChecking }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
86
90
  };
87
91
  export default React.memo(Individual);
@@ -9,7 +9,7 @@ export declare const IndividualValidation: () => yup.ObjectSchema<import("yup/li
9
9
  name: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
10
10
  email: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
11
11
  }>>>;
12
- export declare const IndividualMobileValidation: (length: number) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
12
+ export declare const IndividualMobileValidation: (length: number, isSA: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
13
13
  name: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
14
  email: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
15
15
  mobile: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
@@ -1,4 +1,4 @@
1
- import { REGEX_FULL_NAME } from '../../../../constants';
1
+ import { REGEX_FULL_NAME, REGEX_SAUDI_NUMBER } from '../../../../constants';
2
2
  import * as yup from 'yup';
3
3
  export var IndividualValidation = function () {
4
4
  return yup.object().shape({
@@ -9,13 +9,17 @@ export var IndividualValidation = function () {
9
9
  email: yup.string().email('email_not_valid').required('email_not_valid')
10
10
  });
11
11
  };
12
- export var IndividualMobileValidation = function (length) {
12
+ export var IndividualMobileValidation = function (length, isSA) {
13
13
  return yup.object().shape({
14
14
  name: yup
15
15
  .string()
16
16
  .matches(REGEX_FULL_NAME, 'please write your first and last name')
17
17
  .required('please write your first and last name'),
18
18
  email: yup.string().email('email_not_valid').required('email_not_valid'),
19
- mobile: yup.string().length(length, 'enter_valid_mobile_number').required('mobile_number_error')
19
+ mobile: yup
20
+ .string()
21
+ .length(length, 'enter_valid_mobile_number')
22
+ .matches(isSA ? REGEX_SAUDI_NUMBER : /^[0-9]/g, 'start_with_number')
23
+ .required('mobile_number_error')
20
24
  });
21
25
  };
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import { BrandInfo } from '../../../../@types';
3
+ interface BrandListProps {
4
+ show: boolean;
5
+ list: Array<BrandInfo>;
6
+ onListOpen?: () => void;
7
+ onListClose?: () => void;
8
+ showTerms?: () => void;
9
+ hideTerms?: () => void;
10
+ }
11
+ declare const _default: React.MemoExoticComponent<({ show, list, ...rest }: BrandListProps) => JSX.Element>;
12
+ export default _default;
@@ -0,0 +1,118 @@
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 __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
+ };
23
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
24
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
25
+ if (ar || !(i in from)) {
26
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
27
+ ar[i] = from[i];
28
+ }
29
+ }
30
+ return to.concat(ar || Array.prototype.slice.call(from));
31
+ };
32
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
33
+ import * as React from 'react';
34
+ import { useTranslation } from 'react-i18next';
35
+ import { useFormContext } from 'react-hook-form';
36
+ import Box from '@mui/material/Box';
37
+ import { styled } from '@mui/material/styles';
38
+ import { useLanguage } from '../../../../hooks';
39
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
40
+ import Input from '../../../shared/Input';
41
+ import CheckIcon from '../../../shared/CheckIcon';
42
+ import SimpleList from '../../../../components/SimpleList';
43
+ import Text from '../../../../components/Text';
44
+ import ExpandIcon from '../../../../components/ExpandIcon';
45
+ import Collapse from '../../../../components/Collapse';
46
+ import { OTHER_BRAND } from '../../../../constants';
47
+ var InputStyled = styled(Input)(function () { return ({
48
+ '& .MuiInputBase-input': {
49
+ cursor: 'pointer'
50
+ }
51
+ }); });
52
+ var BrandContainer = styled(Box)(function () { return ({
53
+ display: 'flex'
54
+ }); });
55
+ var BrandNameText = styled(Text, { shouldForwardProp: function (prop) { return prop !== 'isSelected'; } })(function (_a) {
56
+ var theme = _a.theme, isSelected = _a.isSelected;
57
+ return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
58
+ });
59
+ var BrandList = function (_a) {
60
+ var show = _a.show, list = _a.list, rest = __rest(_a, ["show", "list"]);
61
+ var _b = React.useState(list), brandList = _b[0], setBrandList = _b[1];
62
+ var _c = React.useState(), selectedBrand = _c[0], setSelectedBrand = _c[1];
63
+ var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
64
+ var t = useTranslation().t;
65
+ var isAr = useLanguage().isAr;
66
+ var setValue = useFormContext().setValue;
67
+ var onOpenBrandList = function (event) {
68
+ var _a;
69
+ setAnchorEl(event.currentTarget);
70
+ (_a = rest.onListOpen) === null || _a === void 0 ? void 0 : _a.call(rest);
71
+ };
72
+ var onCloseBrandList = function () {
73
+ var _a;
74
+ setAnchorEl(null);
75
+ (_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
76
+ };
77
+ React.useEffect(function () {
78
+ var array = list;
79
+ if ((array === null || array === void 0 ? void 0 : array.length) > 0) {
80
+ var hasOther = array === null || array === void 0 ? void 0 : array.find(function (item) { return isOtherLicense(item); });
81
+ var first = array[0];
82
+ if (first) {
83
+ setSelectedBrand(first);
84
+ setValue('brandName', getBrandName(first), { shouldValidate: true });
85
+ if (!hasOther)
86
+ array = __spreadArray(__spreadArray([], array, true), [OTHER_BRAND], false);
87
+ setBrandList(array);
88
+ }
89
+ }
90
+ }, [show, list]);
91
+ var getBrandName = function (item) {
92
+ var _a, _b;
93
+ return (isAr ? (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.ar : (_b = item === null || item === void 0 ? void 0 : item.name) === null || _b === void 0 ? void 0 : _b.en) || '';
94
+ };
95
+ var getBrandId = function (item) {
96
+ return (item === null || item === void 0 ? void 0 : item.id) || '';
97
+ };
98
+ var isOtherLicense = function (item) {
99
+ return (item === null || item === void 0 ? void 0 : item.id) === 'other';
100
+ };
101
+ var onSelectItem = function (brand) {
102
+ var _a, _b;
103
+ setSelectedBrand(brand);
104
+ onCloseBrandList();
105
+ if (isOtherLicense(brand)) {
106
+ setValue('brandName', '', { shouldValidate: true });
107
+ (_a = rest.showTerms) === null || _a === void 0 ? void 0 : _a.call(rest);
108
+ return;
109
+ }
110
+ setValue('brandName', getBrandName(brand), { shouldValidate: true });
111
+ (_b = rest.hideTerms) === null || _b === void 0 ? void 0 : _b.call(rest);
112
+ };
113
+ var hasList = (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0;
114
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsxs(Collapse, __assign({ in: hasList }, { children: [_jsx(InputStyled, { label: t('select_brand_label'), readOnly: true, onClick: !!anchorEl ? function () { return onCloseBrandList(); } : onOpenBrandList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_brand'), value: t(getBrandName(selectedBrand)) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'id', list: brandList, onSelectItem: onSelectItem, renderItem: function (item) {
115
+ return (_jsxs(_Fragment, { children: [_jsx(BrandContainer, { children: _jsx(BrandNameText, __assign({ isSelected: getBrandId(item) === getBrandId(selectedBrand) }, { children: isOtherLicense(item) ? t(getBrandName(item)) : getBrandName(item) })) }), getBrandId(item) === getBrandId(selectedBrand) && _jsx(CheckIcon, {})] }));
116
+ } }) }))] })) }) })));
117
+ };
118
+ export default React.memo(BrandList);
@@ -1,5 +1,8 @@
1
1
  import * as React from 'react';
2
2
  interface BrandNameProps {
3
+ show: boolean;
4
+ fetchingBrandName: (flag: boolean) => void;
5
+ brandNameChecking: boolean;
3
6
  }
4
- declare const _default: React.MemoExoticComponent<({}: BrandNameProps) => JSX.Element>;
7
+ declare const _default: React.MemoExoticComponent<({ show, brandNameChecking, fetchingBrandName }: BrandNameProps) => JSX.Element>;
5
8
  export default _default;
@@ -9,12 +9,49 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
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
+ };
12
48
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
49
  import * as React from 'react';
14
50
  import { useSelector } from 'react-redux';
15
51
  import { useTranslation } from 'react-i18next';
16
52
  import { useController, useFormContext } from 'react-hook-form';
17
53
  import Box from '@mui/material/Box';
54
+ import axios from 'axios';
18
55
  import { styled, alpha } from '@mui/material/styles';
19
56
  import InfoIcon from '@mui/icons-material/Info';
20
57
  import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
@@ -23,6 +60,7 @@ import Text from '../../../../components/Text';
23
60
  import Input from '../../../shared/Input';
24
61
  import ClearIcon from '../../../shared/ClearIcon';
25
62
  import Tooltip from '../../../../components/Tooltip';
63
+ import Collapse from '../../../../components/Collapse';
26
64
  import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
27
65
  import CheckIcon from '../../../shared/CheckIcon';
28
66
  import { checkBrandNameAvailability, connectSelector } from '../../../app/connect/connectStore';
@@ -58,8 +96,10 @@ var InfoIconStyled = styled(InfoIcon)(function (_a) {
58
96
  color: alpha(theme.palette.text.primary, 0.4)
59
97
  });
60
98
  });
99
+ var cancelToken = null;
61
100
  var BrandName = function (_a) {
62
101
  var _b;
102
+ var show = _a.show, brandNameChecking = _a.brandNameChecking, fetchingBrandName = _a.fetchingBrandName;
63
103
  var dispatch = useAppDispatch();
64
104
  var _c = React.useState(false), isHovered = _c[0], setIsHovered = _c[1];
65
105
  var t = useTranslation().t;
@@ -68,9 +108,18 @@ var BrandName = function (_a) {
68
108
  var brandNameValue = brandControl.field.value;
69
109
  var error = (_b = brandControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
70
110
  var data = useSelector(connectSelector).data;
71
- var checkBrand = debounce(function (value) {
72
- dispatch(checkBrandNameAvailability(value));
73
- }, 500);
111
+ var checkBrand = debounce(function (value) { return __awaiter(void 0, void 0, void 0, function () {
112
+ var onSuccess;
113
+ return __generator(this, function (_a) {
114
+ if (cancelToken) {
115
+ cancelToken.cancel('Aborted');
116
+ }
117
+ cancelToken = axios.CancelToken.source();
118
+ onSuccess = function () { return fetchingBrandName(false); };
119
+ dispatch(checkBrandNameAvailability({ name: value, cancelToken: cancelToken.token, onSuccess: onSuccess }));
120
+ return [2];
121
+ });
122
+ }); }, 500);
74
123
  var handleBrandNameChange = function (_a) {
75
124
  var target = _a.target;
76
125
  var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
@@ -80,12 +129,14 @@ var BrandName = function (_a) {
80
129
  var _a;
81
130
  var isValid = brandNameValue && !error && brandNameValue.length > 2;
82
131
  var brandName = brandNameValue + ((_a = data.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2);
83
- if (isValid)
132
+ if (isValid) {
133
+ fetchingBrandName(true);
84
134
  checkBrand(brandName);
135
+ }
85
136
  }, [brandNameValue, error]);
86
137
  var clearBrandName = function () {
87
138
  brandControl.field.onChange('');
88
139
  };
89
- return (_jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 3 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { onChange: handleBrandNameChange, value: brandNameValue, placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: !error && brandNameValue ? _jsx(CheckIcon, {}) : brandNameValue && _jsx(ClearIcon, { onClick: clearBrandName }) })] })));
140
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5, mb: 3 } }, { children: [_jsxs(LabelContainerStyled, { children: [_jsx(InputLabelStyled, { children: t('signup_brand_name_label') }), _jsx(Tooltip, __assign({ title: t('brand_name_hint'), onMouseOver: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onTouchStartCapture: function () { return setIsHovered(true); } }, { children: isHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), _jsx(Input, { onChange: handleBrandNameChange, value: brandNameValue, placeholder: t('signup_brand_name_placeholder'), warningType: 'alert', warningMessage: brandNameChecking ? t('checking...') : error && t(error), endAdornment: !error && brandNameValue ? _jsx(CheckIcon, {}) : brandNameValue && _jsx(ClearIcon, { onClick: clearBrandName }) })] })) })));
90
141
  };
91
142
  export default React.memo(BrandName);
@@ -14,6 +14,7 @@ import * as React from 'react';
14
14
  import { useSelector } from 'react-redux';
15
15
  import { useForm, FormProvider } from 'react-hook-form';
16
16
  import { useTranslation } from 'react-i18next';
17
+ import Collapse from '@mui/material/Collapse';
17
18
  import { yupResolver } from '@hookform/resolvers/yup';
18
19
  import { useAppDispatch } from '../../../../hooks';
19
20
  import { handlePrevScreenStep } from '../../../../app/settings';
@@ -26,18 +27,23 @@ import { MerchantValidationSchema } from './validation';
26
27
  import BrandName from './BrandName';
27
28
  import SocialMedia from './SocialMedia';
28
29
  import TAC from './TAC';
30
+ import BrandList from './BrandList';
29
31
  var Merchant = function (_a) {
30
- var _b, _c, _d, _e;
31
- var _f = useSelector(connectSelector), data = _f.data, loading = _f.loading, error = _f.error, searchActive = _f.searchActive;
32
+ var _b, _c, _d, _e, _f, _g, _h;
33
+ var _j = React.useState(false), brandNameChecking = _j[0], setBrandNameChecking = _j[1];
34
+ var _k = useSelector(connectSelector), data = _k.data, loading = _k.loading, error = _k.error;
35
+ var isNewUser = (_b = data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.new_user;
36
+ var _l = React.useState(isNewUser), showTermsCheck = _l[0], setShowTermsCheck = _l[1];
32
37
  var methods = useForm({
33
- resolver: yupResolver(MerchantValidationSchema),
38
+ resolver: yupResolver(MerchantValidationSchema(showTermsCheck)),
34
39
  defaultValues: data.brandData,
35
40
  mode: 'onChange'
36
41
  });
37
42
  var t = useTranslation().t;
38
43
  var isAr = useLanguage().isAr;
39
44
  var dispatch = useAppDispatch();
40
- var isNewUser = (_b = data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.new_user;
45
+ var isAbsher = data.otpData.isAbsher;
46
+ var _m = React.useState(false), listActive = _m[0], setListActive = _m[1];
41
47
  var onSubmit = function (formData) {
42
48
  dispatch(updateLeadBrand(formData));
43
49
  };
@@ -46,7 +52,7 @@ var Merchant = function (_a) {
46
52
  dispatch(handlePrevScreenStep('CONNECT_INDIVIDUAL_STEP'));
47
53
  return;
48
54
  }
49
- dispatch(handlePrevScreenStep('CONNECT_PASSWORD_STEP'));
55
+ dispatch(handlePrevScreenStep(isAbsher ? 'CONNECT_NID_STEP' : 'CONNECT_MOBILE_STEP'));
50
56
  };
51
57
  React.useEffect(function () {
52
58
  if (error)
@@ -58,7 +64,8 @@ var Merchant = function (_a) {
58
64
  methods.setError('brandName', { message: 'Profile Name already exists' });
59
65
  }, [(_c = data.brandData) === null || _c === void 0 ? void 0 : _c.responseBody]);
60
66
  var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
61
- var disabled = brandErrChecks || searchActive || ((_e = (_d = data.brandData) === null || _d === void 0 ? void 0 : _d.responseBody) === null || _e === void 0 ? void 0 : _e.response_code) === '5';
62
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandName, {}), _jsx(SocialMedia, {}), _jsx(TAC, {}), _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') }))] })) })) }));
67
+ var disabled = brandErrChecks || brandNameChecking || ((_e = (_d = data.brandData) === null || _d === void 0 ? void 0 : _d.responseBody) === null || _e === void 0 ? void 0 : _e.response_code) === '5';
68
+ var showBrandList = ((_g = (((_f = data.brandData) === null || _f === void 0 ? void 0 : _f.brandList) || [])) === null || _g === void 0 ? void 0 : _g.length) > 0 && !isNewUser;
69
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: showBrandList, list: ((_h = data.brandData) === null || _h === void 0 ? void 0 : _h.brandList) || [], onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); }, showTerms: function () { return setShowTermsCheck(true); }, hideTerms: function () { return setShowTermsCheck(false); } }), _jsx(BrandName, { show: !listActive, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(SocialMedia, { show: !listActive, sx: !showTermsCheck ? { mb: 0 } : {} }), _jsx(TAC, { show: !listActive && showTermsCheck }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
63
70
  };
64
71
  export default React.memo(Merchant);
@@ -1,5 +1,8 @@
1
1
  import * as React from 'react';
2
+ import { Theme, SxProps } from '@mui/material/styles';
2
3
  interface SocialMediaProps {
4
+ show: boolean;
5
+ sx?: SxProps<Theme>;
3
6
  }
4
- declare const _default: React.MemoExoticComponent<({}: SocialMediaProps) => JSX.Element>;
7
+ declare const _default: React.MemoExoticComponent<({ show, sx }: SocialMediaProps) => JSX.Element>;
5
8
  export default _default;
@@ -57,6 +57,7 @@ var ClearIconStyled = styled(ClearIcon)(function (_a) {
57
57
  });
58
58
  var SocialMedia = function (_a) {
59
59
  var _b, _c, _d;
60
+ var show = _a.show, sx = _a.sx;
60
61
  var _e = React.useState(SocialMediaTypes.WEB), socialMediaType = _e[0], setSocialMediaType = _e[1];
61
62
  var t = useTranslation().t;
62
63
  var control = useFormContext().control;
@@ -78,8 +79,8 @@ var SocialMedia = function (_a) {
78
79
  var websiteError = (_b = errors === null || errors === void 0 ? void 0 : errors.website) === null || _b === void 0 ? void 0 : _b.message;
79
80
  var twitterError = (_c = errors === null || errors === void 0 ? void 0 : errors.twitter) === null || _c === void 0 ? void 0 : _c.message;
80
81
  var instagramError = (_d = errors === null || errors === void 0 ? void 0 : errors.instagram) === null || _d === void 0 ? void 0 : _d.message;
81
- return (_jsxs(ScreenContainer, __assign({ sx: { mb: 3, direction: 'ltr' } }, { children: [_jsx(SocialMediaGroupStyled, { defaultValue: socialMediaType, exclusive: true, onChange: function (e, value) {
82
- setSocialMediaType(value);
83
- } }), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.WEB, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: websiteValue, startAdornment: _jsx(TextStyled, { children: "https://" }), placeholder: t('signup_website_placeholder'), warningType: 'alert', warningMessage: websiteError && t(websiteError), endAdornment: !websiteError && websiteValue ? _jsx(CheckIcon, {}) : websiteValue && _jsx(ClearIconStyled, { onClick: handleClear }) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.TWITTER, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: twitterValue, startAdornment: _jsx(TextStyled, { children: "@" }), placeholder: t('signup_twitter_placeholder'), warningType: 'alert', warningMessage: twitterError && t(twitterError), endAdornment: !twitterError && twitterValue ? _jsx(CheckIcon, {}) : twitterValue && _jsx(ClearIconStyled, { onClick: handleClear }) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.INSTAGRAM, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: instagramValue, startAdornment: _jsx(TextStyled, { children: "@" }), placeholder: t('signup_instagram_placeholder'), warningType: 'alert', warningMessage: instagramError && t(instagramError), endAdornment: !instagramError && instagramValue ? (_jsx(CheckIcon, {})) : (instagramValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) }))] })));
82
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: __assign({ mb: 3, direction: 'ltr' }, sx) }, { children: [_jsx(SocialMediaGroupStyled, { defaultValue: socialMediaType, exclusive: true, onChange: function (e, value) {
83
+ setSocialMediaType(value);
84
+ } }), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.WEB, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: websiteValue, startAdornment: _jsx(TextStyled, { children: "https://" }), placeholder: t('signup_website_placeholder'), warningType: 'alert', warningMessage: websiteError && t(websiteError), endAdornment: !websiteError && websiteValue ? _jsx(CheckIcon, {}) : websiteValue && _jsx(ClearIconStyled, { onClick: handleClear }) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.TWITTER, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: twitterValue, startAdornment: _jsx(TextStyled, { children: "@" }), placeholder: t('signup_twitter_placeholder'), warningType: 'alert', warningMessage: twitterError && t(twitterError), endAdornment: !twitterError && twitterValue ? _jsx(CheckIcon, {}) : twitterValue && _jsx(ClearIconStyled, { onClick: handleClear }) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.INSTAGRAM, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: instagramValue, startAdornment: _jsx(TextStyled, { children: "@" }), placeholder: t('signup_instagram_placeholder'), warningType: 'alert', warningMessage: instagramError && t(instagramError), endAdornment: !instagramError && instagramValue ? (_jsx(CheckIcon, {})) : (instagramValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) }))] })) })));
84
85
  };
85
86
  export default React.memo(SocialMedia);
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  interface TACProps {
3
+ show: boolean;
3
4
  }
4
- declare const _default: React.MemoExoticComponent<({}: TACProps) => JSX.Element>;
5
+ declare const _default: React.MemoExoticComponent<({ show }: TACProps) => JSX.Element>;
5
6
  export default _default;
@@ -65,6 +65,7 @@ var CollapseStyled = styled(Collapse)(function () { return ({
65
65
  }); });
66
66
  var TAC = function (_a) {
67
67
  var _b;
68
+ var show = _a.show;
68
69
  var t = useTranslation().t;
69
70
  var isAr = useLanguage().isAr;
70
71
  var control = useFormContext().control;
@@ -74,6 +75,6 @@ var TAC = function (_a) {
74
75
  var handleTACCheckedChange = function (event, checked) {
75
76
  tacControl.field.onChange(checked);
76
77
  };
77
- return (_jsxs(ScreenContainer, __assign({ sx: { mb: 5 } }, { children: [_jsxs(TACContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? EXTERNAL_LINKS.TOS_AR : EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] })));
78
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, { children: [_jsxs(TACContainerStyled, { children: [_jsx(CheckboxStyled, { disableRipple: true, disableFocusRipple: true, focusRipple: false, checked: tacChecked, onChange: handleTACCheckedChange }), _jsxs(TextStyled, { children: [t('read_agree_terms_and_conditions_message'), _jsx(LinkStyled, __assign({ href: isAr ? EXTERNAL_LINKS.TOS_AR : EXTERNAL_LINKS.TOS_EN, target: '_blank', underline: 'always' }, { children: t('terms_and_conditions_link_title') }))] })] }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: warningMessage && t(warningMessage) })) }))] }) })));
78
79
  };
79
80
  export default React.memo(TAC);
@@ -1,7 +1,7 @@
1
1
  import * as yup from 'yup';
2
- export declare const MerchantValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
2
+ export declare const MerchantValidationSchema: (termsIsRequired: boolean) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
3
  brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
- termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
4
+ termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
5
5
  links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
6
6
  website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
7
7
  instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
@@ -17,7 +17,7 @@ export declare const MerchantValidationSchema: yup.ObjectSchema<import("yup/lib/
17
17
  }>>>;
18
18
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
19
19
  brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
20
- termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
20
+ termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
21
21
  links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
22
22
  website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
23
23
  instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
@@ -33,7 +33,7 @@ export declare const MerchantValidationSchema: yup.ObjectSchema<import("yup/lib/
33
33
  }>>>;
34
34
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
35
35
  brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
36
- termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, true>;
36
+ termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
37
37
  links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
38
38
  website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
39
39
  instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;