@tap-payments/auth-jsconnect 2.3.40-test → 2.3.43-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 (38) hide show
  1. package/build/@types/form.d.ts +0 -3
  2. package/build/api/entity.d.ts +0 -1
  3. package/build/api/index.d.ts +0 -3
  4. package/build/api/index.js +1 -3
  5. package/build/assets/locales/ar.json +0 -1
  6. package/build/assets/locales/en.json +0 -1
  7. package/build/constants/app.js +4 -10
  8. package/build/features/app/bank/bankStore.d.ts +0 -1
  9. package/build/features/app/bank/bankStore.js +21 -37
  10. package/build/features/app/entity/entityStore.d.ts +1 -9
  11. package/build/features/app/entity/entityStore.js +48 -119
  12. package/build/features/app/individual/individualStore.d.ts +0 -2
  13. package/build/features/app/individual/individualStore.js +71 -91
  14. package/build/features/app/tax/taxStore.js +18 -36
  15. package/build/features/bank/screens/Verify/OTPInput.js +5 -3
  16. package/build/features/brand/screens/BrandInfo/BrandInfo.js +2 -2
  17. package/build/features/brand/screens/Verify/OTPInput.js +5 -3
  18. package/build/features/business/screens/Verify/OTPInput.js +5 -3
  19. package/build/features/entity/screens/EntityCapital/EntityCapital.js +2 -2
  20. package/build/features/entity/screens/Verify/OTPInput.js +5 -3
  21. package/build/features/featuresScreens.js +0 -5
  22. package/build/features/individual/screens/Verify/OTPInput.js +5 -3
  23. package/build/features/password/screens/Verify/OTPInput.js +5 -3
  24. package/build/features/shared/Address/Address.js +13 -20
  25. package/build/features/shared/Address/CountryList.js +3 -3
  26. package/build/features/shared/Button/FlowsButtons.js +14 -19
  27. package/build/features/shared/OTP/OTP.d.ts +2 -1
  28. package/build/features/shared/OTP/OTP.js +2 -2
  29. package/build/features/tax/screens/Verify/OTPInput.js +5 -3
  30. package/build/utils/error.d.ts +1 -0
  31. package/build/utils/error.js +3 -0
  32. package/package.json +1 -1
  33. package/build/api/address.d.ts +0 -4
  34. package/build/api/address.js +0 -12
  35. package/build/features/entity/screens/EntityAddress/EntityAddress.d.ts +0 -5
  36. package/build/features/entity/screens/EntityAddress/EntityAddress.js +0 -42
  37. package/build/features/entity/screens/EntityAddress/index.d.ts +0 -2
  38. package/build/features/entity/screens/EntityAddress/index.js +0 -2
@@ -22,7 +22,7 @@ import InputText from './InputText';
22
22
  import { Button } from '../Button';
23
23
  export default function Address(_a) {
24
24
  var format = _a.format, countryList = _a.countryList, onAddressChange = _a.onAddressChange, defaultValues = _a.defaultValues, disableCountry = _a.disableCountry, loading = _a.loading, error = _a.error, onBack = _a.onBack, showSubmitButton = _a.showSubmitButton, isEditable = _a.isEditable;
25
- var _b = useForm({ defaultValues: defaultValues, mode: 'onChange' }), watch = _b.watch, control = _b.control, formState = _b.formState, getValues = _b.getValues, handleSubmit = _b.handleSubmit;
25
+ var _b = useForm({ defaultValues: defaultValues, mode: 'onChange' }), watch = _b.watch, control = _b.control, formState = _b.formState, getValues = _b.getValues;
26
26
  var values = getValues();
27
27
  var t = useTranslation().t;
28
28
  var isAr = useLanguage().isAr;
@@ -32,49 +32,42 @@ export default function Address(_a) {
32
32
  }, [values, formState.isValid]);
33
33
  var countryIso2 = useMemo(function () {
34
34
  var _a;
35
- var index = countryList.findIndex(function (item) { return item.iso2 === watch('country'); });
35
+ var index = countryList.findIndex(function (item) { return item.countryId === watch('country'); });
36
36
  return (_a = countryList[index]) === null || _a === void 0 ? void 0 : _a.iso2;
37
37
  }, [watch('country')]);
38
- var getName = function (item) {
39
- return (isAr ? item.name.ar : item.name.en) || '';
40
- };
41
- var getRequiredValue = function (item) {
42
- return "".concat(getName(item), " ").concat(t('is_required'));
43
- };
44
- var onSubmit = function (values) {
45
- console.log(values);
46
- onAddressChange(values, formState.isValid);
47
- };
48
- return (_jsxs(Box, __assign({ component: 'form', onSubmit: handleSubmit(onSubmit) }, { children: [format.map(function (item) {
38
+ return (_jsxs(Box, __assign({ component: 'form' }, { children: [format.map(function (item) {
49
39
  var isCountry = item.code === 'country';
50
40
  var isSelect = item.type === 'select';
51
41
  if (isCountry) {
52
42
  return (_jsx(Controller, { render: function (_a) {
53
43
  var _b;
54
44
  var field = _a.field, fieldState = _a.fieldState;
55
- return (_jsx(CountryListComponent, { label: getName(item), placeholder: getName(item), list: countryList, onSelect: function (value) {
45
+ return (_jsx(CountryListComponent, { label: "address_".concat(item.code, "_label"), placeholder: "address_".concat(item.code, "_placeholder"), list: countryList, onSelect: function (value) {
56
46
  console.log('value', value);
57
47
  field.onChange(value);
58
48
  }, value: field.value, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, disabled: isEditable ? !!disableCountry : false, isRequired: item.required }));
59
49
  }, rules: {
60
- required: item.required && getRequiredValue(item)
50
+ required: item.required && "address_".concat(item.code, "_required")
61
51
  }, control: control, name: item.code }, item.code));
62
52
  }
63
53
  if (isSelect) {
64
54
  return (_jsx(Controller, { render: function (_a) {
65
55
  var _b;
66
56
  var field = _a.field, fieldState = _a.fieldState;
67
- return (_jsx(InputSelect, { label: getName(item), placeholder: getName(item), countryIso2: countryIso2, fetchURL: item.retrieve_uri, onSelect: function (value) { return field.onChange(value); }, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, isRequired: item.required, value: field.value || '', disabled: isEditable ? !countryIso2 : false }));
57
+ return (_jsx(InputSelect, { label: "address_".concat(item.code, "_label"), placeholder: "address_".concat(item.code, "_placeholder"), countryIso2: countryIso2, fetchURL: item.retrieve_uri, onSelect: function (value) { return field.onChange(value); }, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, isRequired: item.required, value: field.value || '', disabled: isEditable ? !countryIso2 : false }));
68
58
  }, rules: {
69
- required: item.required && getRequiredValue(item)
59
+ required: item.required && "address_".concat(item.code, "_required")
70
60
  }, control: control, name: item.code }, item.code));
71
61
  }
72
62
  return (_jsx(Controller, { render: function (_a) {
73
63
  var _b;
74
64
  var field = _a.field, fieldState = _a.fieldState;
75
- return (_jsx(InputText, { label: getName(item), placeholder: getName(item), onChange: function (value) { return field.onChange(value); }, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, isRequired: item.required, disabled: !isEditable, value: field.value || '' }));
65
+ return (_jsx(InputText, { label: "address_".concat(item.code, "_label"), placeholder: "address_".concat(item.code, "_placeholder"), onChange: function (value) { return field.onChange(value); }, error: (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message, isRequired: item.required, disabled: !isEditable, value: field.value || '' }));
76
66
  }, rules: {
77
- required: item.required && getRequiredValue(item)
67
+ required: item.required && "address_".concat(item.code, "_required")
78
68
  }, control: control, name: item.code }, item.code));
79
- }), _jsx(Collapse, __assign({ in: showSubmitButton }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack === null || onBack === void 0 ? void 0 : onBack(); }, isAr: isAr, disabled: !formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })));
69
+ }), _jsx(Collapse, __assign({ in: showSubmitButton }, { children: _jsx(Button, __assign({ onClick: function (e) {
70
+ e.preventDefault();
71
+ onAddressChange(values, formState.isValid);
72
+ }, onBackClicked: function () { return onBack === null || onBack === void 0 ? void 0 : onBack(); }, isAr: isAr, disabled: !formState.isValid, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })));
80
73
  }
@@ -72,17 +72,17 @@ function CountryList(_a) {
72
72
  };
73
73
  var handleValueChange = function (value) {
74
74
  setAnchorEl(null);
75
- onSelect(value.iso2);
75
+ onSelect(value.countryId);
76
76
  };
77
77
  var nameValue = React.useMemo(function () {
78
- var item = list.find(function (item) { return item.iso2 === value; });
78
+ var item = list.find(function (item) { return item.countryId === value; });
79
79
  if (!item)
80
80
  return '';
81
81
  return isAr ? item.name.arabic : item.name.english;
82
82
  }, [isAr, list, value]);
83
83
  return (_jsxs(Box, { children: [_jsx(LabelContainerStyled, { children: _jsxs(InputLabelStyled, { children: [t(label), " ", isRequired && _jsx(MandatoryStyled, { children: "*" })] }) }), _jsxs(Box, { children: [_jsx(InputStyled, { readOnly: true, value: nameValue, placeholder: placeholder, onClick: handleListOpenClose, endAdornment: !disabled && _jsx(ExpandIcon, { anchorEl: !!anchorEl }) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleListStyled, { searchValuePath: ['name.english', 'name.arabic'], searchKeyPath: 'name.english', list: list, onSelectItem: handleValueChange, renderItem: function (item) {
84
84
  var _a, _b;
85
- var isChecked = item.iso2 === value;
85
+ var isChecked = item.countryId === value;
86
86
  return (_jsxs(_Fragment, { children: [_jsx(Box, __assign({ display: 'flex' }, { children: _jsx(NameContainer, __assign({ isSelected: isChecked }, { children: isAr ? (_a = item.name) === null || _a === void 0 ? void 0 : _a.arabic : (_b = item.name) === null || _b === void 0 ? void 0 : _b.english })) })), isChecked && _jsx(CheckIconStyled, {})] }));
87
87
  } }) })), _jsx(Collapse, __assign({ in: !!error && !anchorEl, timeout: 400 }, { children: _jsx(Warning, __assign({ warningType: 'hint' }, { children: t(error || '') })) }))] })] }));
88
88
  }
@@ -79,36 +79,31 @@ var ButtonBoxStyled = styled(Box)(function (_a) {
79
79
  _b);
80
80
  });
81
81
  var ButtonStyled = styled(Button, {
82
- shouldForwardProp: function (prop) { return prop !== 'isCompleted'; }
82
+ shouldForwardProp: function (prop) { return prop !== 'isCompleted' && prop !== 'hasUrl'; }
83
83
  })(function (_a) {
84
84
  var _b;
85
- var theme = _a.theme, isCompleted = _a.isCompleted;
85
+ var theme = _a.theme, isCompleted = _a.isCompleted, hasUrl = _a.hasUrl;
86
86
  return ({
87
87
  '&.MuiButton-outlined': __assign(__assign({}, (isCompleted && {
88
88
  paddingInlineEnd: theme.spacing(1.625),
89
89
  color: theme.palette.success.main,
90
90
  border: "1px solid ".concat(theme.palette.success.main)
91
- })), (_b = { '&:hover': __assign({}, (isCompleted && {
92
- backgroundColor: theme.palette.common.white,
93
- border: "1px solid ".concat(theme.palette.success.main),
94
- color: theme.palette.success.main,
95
- cursor: 'initial',
96
- img: {
91
+ })), (_b = { '&:hover': __assign({}, (isCompleted && __assign({ backgroundColor: hasUrl ? theme.palette.success.main : theme.palette.common.white, border: "1px solid ".concat(theme.palette.success.main), color: hasUrl ? theme.palette.common.white : theme.palette.success.main, cursor: hasUrl ? 'pointer' : 'initial', img: {
97
92
  filter: 'none'
93
+ } }, (hasUrl && {
94
+ svg: {
95
+ filter: 'brightness(3)'
98
96
  }
99
- })) }, _b[theme.breakpoints.down('sm')] = {
97
+ })))) }, _b[theme.breakpoints.down('sm')] = {
100
98
  '&:hover': __assign({ backgroundColor: theme.palette.common.white, border: "1px solid ".concat(theme.palette.primary.main), img: {
101
99
  filter: 'none'
102
- }, color: theme.palette.primary.main }, (isCompleted && {
103
- backgroundColor: theme.palette.common.white,
104
- border: "1px solid ".concat(theme.palette.success.main),
105
- paddingInlineEnd: theme.spacing(1.625),
106
- color: theme.palette.success.main,
107
- cursor: 'initial',
108
- img: {
100
+ }, color: theme.palette.primary.main }, (isCompleted && __assign({ backgroundColor: hasUrl ? theme.palette.success.main : theme.palette.common.white, border: "1px solid ".concat(theme.palette.success.main), paddingInlineEnd: theme.spacing(1.625), color: hasUrl ? theme.palette.common.white : theme.palette.success.main, cursor: hasUrl ? 'pointer' : 'initial', img: {
109
101
  filter: 'none'
102
+ } }, (hasUrl && {
103
+ svg: {
104
+ filter: 'brightness(3)'
110
105
  }
111
- }))
106
+ }))))
112
107
  }, _b['&:disabled'] = {
113
108
  backgroundColor: theme.palette.common.white,
114
109
  color: alpha(theme.palette.primary.main, 0.3)
@@ -153,7 +148,7 @@ export default function FlowsButtons(_a) {
153
148
  var _b = useState(false), loading = _b[0], setLoading = _b[1];
154
149
  var isAr = useLanguage().isAr;
155
150
  var onRedirect = function (item) {
156
- if (item.isCompleted)
151
+ if (!item.href)
157
152
  return;
158
153
  if (flowName === item.name && item.name !== 'password') {
159
154
  dispatch(handleCurrentActiveScreen(getScreenNameBasedOnFlow(item.name, isAuthorizedUser)));
@@ -221,6 +216,6 @@ export default function FlowsButtons(_a) {
221
216
  onResetPassword();
222
217
  else
223
218
  onRedirect({ title: title, href: href, src: src, hoverSrc: hoverSrc, isCompleted: isCompleted, name: name, status: status, token: token });
224
- } }, { children: _jsx(ButtonStyled, __assign({ variant: 'outlined', disabled: isResetPassword(name, status) && loading, isCompleted: isCompleted, sx: __assign({ mb: isLast ? 2.5 : 1.8 }, sx), endIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsx(Image, { sx: { height: 15, transform: isAr ? 'scale(-1)' : 'scale(1)' }, src: ICONS_NAMES.Arrow_filled_right_icon })), startIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isBrand(name) ? (_jsx(_Fragment, { children: _jsx(BrandImage, { children: _jsx(BrandNameStyled, { children: brandName }) }) })) : (_jsx(Image, { src: src, alt: title })), type: 'button' }, { children: title })) }), idx));
219
+ } }, { children: _jsx(ButtonStyled, __assign({ variant: 'outlined', disabled: isResetPassword(name, status) && loading, isCompleted: isCompleted, hasUrl: !!href, sx: __assign({ mb: isLast ? 2.5 : 1.8 }, sx), endIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isCompleted ? (_jsx(CheckIconStyled, {})) : (_jsx(Image, { sx: { height: 15, transform: isAr ? 'scale(-1)' : 'scale(1)' }, src: ICONS_NAMES.Arrow_filled_right_icon })), startIcon: isResetPassword(name, status) && loading ? (_jsx(_Fragment, {})) : isBrand(name) ? (_jsx(_Fragment, { children: _jsx(BrandImage, { children: _jsx(BrandNameStyled, { children: brandName }) }) })) : (_jsx(Image, { src: src, alt: title })), type: 'button' }, { children: title })) }), idx));
225
220
  }) }));
226
221
  }
@@ -5,6 +5,7 @@ interface OTPProps extends OTPFieldProps {
5
5
  onResetClick?: () => void;
6
6
  timeEndLabel?: string;
7
7
  loading?: boolean;
8
+ hasError?: boolean;
8
9
  }
9
- declare const _default: React.MemoExoticComponent<({ timeEndLabel, loading, timerInSeconds, onResetClick, ...props }: OTPProps) => JSX.Element>;
10
+ declare const _default: React.MemoExoticComponent<({ timeEndLabel, loading, timerInSeconds, onResetClick, hasError, ...props }: OTPProps) => JSX.Element>;
10
11
  export default _default;
@@ -80,7 +80,7 @@ var LoaderBoxStyled = styled(OTPBox)(function (_a) {
80
80
  });
81
81
  });
82
82
  var OTPInput = function (_a) {
83
- var timeEndLabel = _a.timeEndLabel, loading = _a.loading, timerInSeconds = _a.timerInSeconds, onResetClick = _a.onResetClick, props = __rest(_a, ["timeEndLabel", "loading", "timerInSeconds", "onResetClick"]);
83
+ var timeEndLabel = _a.timeEndLabel, loading = _a.loading, timerInSeconds = _a.timerInSeconds, onResetClick = _a.onResetClick, hasError = _a.hasError, props = __rest(_a, ["timeEndLabel", "loading", "timerInSeconds", "onResetClick", "hasError"]);
84
84
  var otpRef = React.useRef(null);
85
85
  var width = useContainerDimensions(otpRef).width;
86
86
  React.useEffect(function () {
@@ -88,6 +88,6 @@ var OTPInput = function (_a) {
88
88
  if (el)
89
89
  el.className = 'middle-input-element';
90
90
  }, [props.value]);
91
- return (_jsxs(_Fragment, { children: [_jsx(OTPBox, __assign({ id: 'otp-container', ref: otpRef }, { children: _jsx(OTPStyled, __assign({}, props, { parentWidth: width })) })), typeof timerInSeconds != 'undefined' && (_jsx(BoxStyled, { children: loading ? (_jsx(LoaderBoxStyled, { children: _jsx(CircularProgress, { size: 20, thickness: 5 }) })) : (_jsx(OTPTimer, { timeEndLabel: timeEndLabel || '', timeInSeconds: timerInSeconds, onResetClick: onResetClick })) }))] }));
91
+ return (_jsxs(_Fragment, { children: [_jsx(OTPBox, __assign({ id: 'otp-container', ref: otpRef }, { children: _jsx(OTPStyled, __assign({}, props, { parentWidth: width })) })), typeof timerInSeconds != 'undefined' && (_jsx(BoxStyled, { children: loading ? (_jsx(LoaderBoxStyled, { children: _jsx(CircularProgress, { size: 20, thickness: 5 }) })) : hasError ? (_jsx(_Fragment, {})) : (_jsx(OTPTimer, { timeEndLabel: timeEndLabel || '', timeInSeconds: timerInSeconds, onResetClick: onResetClick })) }))] }));
92
92
  };
93
93
  export default React.memo(OTPInput);
@@ -11,14 +11,15 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
- import { useAppDispatch } from '../../../../hooks';
14
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
15
15
  import Box from '@mui/material/Box/Box';
16
16
  import { styled } from '@mui/material/styles';
17
17
  import OTPField from '../../../shared/OTP';
18
18
  import { useController, useFormContext } from 'react-hook-form';
19
19
  import { useTranslation } from 'react-i18next';
20
20
  import { DEFAULT_TIMER_VALUE } from '../../../../constants';
21
- import { resendOTP } from '../../../app/tax/taxStore';
21
+ import { isTokenExpired } from '../../../../utils';
22
+ import { resendOTP, taxSelector } from '../../../app/tax/taxStore';
22
23
  var BoxStyled = styled(Box)(function (_a) {
23
24
  var theme = _a.theme;
24
25
  return ({
@@ -33,6 +34,7 @@ var OTPInput = function (_a) {
33
34
  var t = useTranslation().t;
34
35
  var otpControl = useController({ name: 'otp', control: control });
35
36
  var dispatch = useAppDispatch();
37
+ var error = useAppSelector(taxSelector).error;
36
38
  var handleOnOTPChange = function (otp) {
37
39
  otpControl.field.onChange(otp);
38
40
  };
@@ -42,6 +44,6 @@ var OTPInput = function (_a) {
42
44
  dispatch(resendOTP());
43
45
  };
44
46
  var otpValue = otpControl.field.value;
45
- return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
47
+ return (_jsx(BoxStyled, __assign({ dir: 'ltr' }, { children: _jsx(OTPField, { loading: loading, timeEndLabel: t('ide_otp_resend_label'), timerInSeconds: DEFAULT_TIMER_VALUE, onResetClick: handleOnResendOTP, value: otpValue, hasError: isTokenExpired(error), onChange: function (number) { return handleOnOTPChange(number.toString()); } }) })));
46
48
  };
47
49
  export default React.memo(OTPInput);
@@ -1 +1,2 @@
1
1
  export declare const isNetworkError: (error: string | null) => boolean;
2
+ export declare const isTokenExpired: (error: string | null) => boolean;
@@ -1,3 +1,6 @@
1
1
  export var isNetworkError = function (error) {
2
2
  return ['network error', 'network request failed'].includes((error || '').trim().toLowerCase());
3
3
  };
4
+ export var isTokenExpired = function (error) {
5
+ return ['token expired'].includes((error || '').trim().toLowerCase());
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.3.40-test",
3
+ "version": "2.3.43-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",
@@ -1,4 +0,0 @@
1
- declare const addressService: {
2
- retrieveAddressFormat: (countryCode: string) => Promise<any>;
3
- };
4
- export { addressService };
@@ -1,12 +0,0 @@
1
- import { httpClient } from './axios';
2
- import { ENDPOINT_PATHS } from '../constants';
3
- var retrieveAddressFormat = function (countryCode) {
4
- return httpClient({
5
- method: 'get',
6
- url: "".concat(ENDPOINT_PATHS.ADDRESS_PATH, "/").concat(countryCode)
7
- });
8
- };
9
- var addressService = {
10
- retrieveAddressFormat: retrieveAddressFormat
11
- };
12
- export { addressService };
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- export interface EntityAddressProps {
3
- }
4
- declare const EntityAddress: ({}: EntityAddressProps) => JSX.Element;
5
- export default EntityAddress;
@@ -1,42 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { useTranslation } from 'react-i18next';
14
- import { useAppDispatch, useAppSelector } from '../../../../hooks';
15
- import { entitySelector, updateEntityAddress } from '../../../app/entity/entityStore';
16
- import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
17
- import { ScreenContainer } from '../../../shared/Containers';
18
- import Address from '../../../shared/Address';
19
- var EntityAddress = function (_a) {
20
- var settings = useAppSelector(settingsSelector).data;
21
- var _b = useAppSelector(entitySelector), data = _b.data, loading = _b.loading, error = _b.error;
22
- var t = useTranslation().t;
23
- var dispatch = useAppDispatch();
24
- var _c = data.verify.responseBody || {}, addressFormat = _c.addressFormat, entity = _c.entity;
25
- var billingAddress = data.entityAddressData.billingAddress;
26
- var isNonEditable = false;
27
- var countries = settings.countries;
28
- var onAddressChange = function (_a, isValid) {
29
- var country = _a.country, address = __rest(_a, ["country"]);
30
- if (isValid) {
31
- var data_1 = {
32
- billingAddress: address
33
- };
34
- dispatch(updateEntityAddress(data_1));
35
- }
36
- };
37
- var onBack = function () {
38
- dispatch(handlePrevScreenStep());
39
- };
40
- return (_jsx(ScreenContainer, { children: _jsx(Address, { defaultValues: billingAddress, countryList: countries, format: addressFormat || [], disableCountry: true, onAddressChange: onAddressChange, isEditable: !isNonEditable, showSubmitButton: true, loading: loading, error: t(error || ''), onBack: function () { return onBack(); } }) }));
41
- };
42
- export default EntityAddress;
@@ -1,2 +0,0 @@
1
- import EntityAddress from './EntityAddress';
2
- export default EntityAddress;
@@ -1,2 +0,0 @@
1
- import EntityAddress from './EntityAddress';
2
- export default EntityAddress;