@tap-payments/auth-jsconnect 2.6.98-test → 2.6.101-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.
- package/build/@types/form.d.ts +0 -1
- package/build/app/settings.d.ts +3 -4
- package/build/app/settings.js +6 -9
- package/build/constants/app.js +13 -1
- package/build/features/app/auth/authStore.d.ts +14 -9
- package/build/features/app/auth/authStore.js +99 -25
- package/build/features/app/connectExpress/connectExpressStore.d.ts +1 -1
- package/build/features/auth/screens/AccountCreatedLoader/AccountCreatedLoader.d.ts +5 -0
- package/build/features/auth/screens/AccountCreatedLoader/AccountCreatedLoader.js +36 -0
- package/build/features/auth/screens/AccountCreatedLoader/index.d.ts +2 -0
- package/build/features/auth/screens/AccountCreatedLoader/index.js +2 -0
- package/build/features/auth/screens/AuthMerchant/AuthMerchant.d.ts +5 -0
- package/build/features/auth/screens/AuthMerchant/AuthMerchant.js +73 -0
- package/build/features/auth/screens/{AuthenticationList → AuthMerchant}/MerchantList.d.ts +2 -1
- package/build/features/auth/screens/AuthMerchant/MerchantList.js +64 -0
- package/build/features/auth/screens/AuthMerchant/index.d.ts +2 -0
- package/build/features/auth/screens/AuthMerchant/index.js +2 -0
- package/build/features/auth/screens/AuthMerchant/validation.d.ts +8 -0
- package/build/features/auth/screens/AuthMerchant/validation.js +4 -0
- package/build/features/auth/screens/AuthenticationList/AuthenticationList.js +28 -17
- package/build/features/auth/screens/AuthenticationList/EntityLegalName.d.ts +3 -0
- package/build/features/auth/screens/AuthenticationList/EntityLegalName.js +48 -0
- package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +31 -0
- package/build/features/auth/screens/AuthenticationList/EntityLicenseType.js +90 -0
- package/build/features/auth/screens/AuthenticationList/EntityList.d.ts +3 -3
- package/build/features/auth/screens/AuthenticationList/EntityList.js +51 -9
- package/build/features/auth/screens/AuthenticationList/LicenseNumber.d.ts +3 -0
- package/build/features/auth/screens/AuthenticationList/LicenseNumber.js +36 -0
- package/build/features/auth/screens/AuthenticationList/validation.d.ts +13 -7
- package/build/features/auth/screens/AuthenticationList/validation.js +66 -6
- package/build/features/bank/Bank.js +3 -3
- package/build/features/brand/Brand.js +3 -3
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +1 -0
- package/build/features/entity/Entity.js +3 -3
- package/build/features/featuresScreens.js +10 -0
- package/build/features/individual/Individual.js +3 -3
- package/build/features/password/Password.js +1 -1
- package/build/features/tax/Tax.js +3 -3
- package/build/hooks/useAppConfig.js +2 -3
- package/build/utils/locale.js +2 -1
- package/package.json +1 -1
- package/build/features/auth/screens/AuthenticationList/MerchantList.js +0 -110
|
@@ -22,23 +22,25 @@ import { AuthForType } from '../../../../@types';
|
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
24
24
|
import Button from '../../../shared/Button';
|
|
25
|
-
import { clearError, authSelector,
|
|
25
|
+
import { clearError, authSelector, createEntity, resetAuthenticationScreen, getMerchantList } from '../../../app/auth/authStore';
|
|
26
26
|
import { AuthenticationListValidationSchema } from './validation';
|
|
27
27
|
import BrandList from './BrandList';
|
|
28
28
|
import EntityList from './EntityList';
|
|
29
|
-
import
|
|
29
|
+
import EntityLegalName from './EntityLegalName';
|
|
30
|
+
import LicenseNumber from './LicenseNumber';
|
|
31
|
+
import LicenseType from './EntityLicenseType';
|
|
30
32
|
var ListType;
|
|
31
33
|
(function (ListType) {
|
|
32
34
|
ListType["BrandList"] = "BrandList";
|
|
33
35
|
ListType["EntityList"] = "EntityList";
|
|
34
|
-
ListType["MerchantList"] = "MerchantList";
|
|
35
36
|
})(ListType || (ListType = {}));
|
|
36
37
|
var AuthenticationList = function (_a) {
|
|
37
38
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
38
|
-
var _b = useAppSelector(authSelector), data = _b.data, loading = _b.loading, error = _b.error
|
|
39
|
-
var _c = data.authenticationData, brandInfo = _c.brandInfo, entityInfo = _c.entityInfo
|
|
39
|
+
var _b = useAppSelector(authSelector), data = _b.data, loading = _b.loading, error = _b.error;
|
|
40
|
+
var _c = data.authenticationData, brandInfo = _c.brandInfo, entityInfo = _c.entityInfo;
|
|
40
41
|
var _d = React.useState(), listActive = _d[0], setListActive = _d[1];
|
|
41
|
-
var
|
|
42
|
+
var brandList = (data.responseData || {}).brandList;
|
|
43
|
+
var _e = React.useState(false), isAddEntity = _e[0], setIsAddEntity = _e[1];
|
|
42
44
|
var otpData = data.otpData;
|
|
43
45
|
var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
|
|
44
46
|
React.useEffect(function () {
|
|
@@ -49,11 +51,10 @@ var AuthenticationList = function (_a) {
|
|
|
49
51
|
});
|
|
50
52
|
}, []);
|
|
51
53
|
var methods = useForm({
|
|
52
|
-
resolver: yupResolver(AuthenticationListValidationSchema
|
|
54
|
+
resolver: yupResolver(AuthenticationListValidationSchema),
|
|
53
55
|
defaultValues: {
|
|
54
56
|
brandInfo: brandInfo,
|
|
55
|
-
entityInfo: entityInfo
|
|
56
|
-
merchantInfo: merchantInfo
|
|
57
|
+
entityInfo: entityInfo
|
|
57
58
|
},
|
|
58
59
|
mode: 'onChange'
|
|
59
60
|
});
|
|
@@ -61,23 +62,34 @@ var AuthenticationList = function (_a) {
|
|
|
61
62
|
var isAr = useLanguage().isAr;
|
|
62
63
|
var dispatch = useAppDispatch();
|
|
63
64
|
var onSubmit = function (formData) {
|
|
64
|
-
|
|
65
|
+
if (isAddEntity) {
|
|
66
|
+
var licenseNumber = formData.licenseNumber, legalName = formData.legalName, brandInfo_1 = formData.brandInfo, licenseType = formData.licenseType;
|
|
67
|
+
var data_1 = { licenseNumber: licenseNumber, legalName: legalName, brandInfo: brandInfo_1, licenseType: licenseType };
|
|
68
|
+
dispatch(createEntity(deepCopy(data_1)));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
dispatch(getMerchantList(deepCopy(formData)));
|
|
65
72
|
};
|
|
66
73
|
var onBack = function () {
|
|
67
74
|
var _a;
|
|
75
|
+
if (isAddEntity) {
|
|
76
|
+
setIsAddEntity(false);
|
|
77
|
+
methods.setValue('licenseNumber', '');
|
|
78
|
+
methods.setValue('legalName', '');
|
|
79
|
+
methods.setValue('licenseType', '');
|
|
80
|
+
methods.setValue('entityInfo', undefined, { shouldValidate: true });
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
68
83
|
var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
|
|
69
84
|
var screen = startWithNID ? (isKW(code) ? 'AUTH_CIVIL_ID_STEP' : 'AUTH_NID_STEP') : 'AUTH_MOBILE_STEP';
|
|
85
|
+
dispatch(resetAuthenticationScreen());
|
|
70
86
|
dispatch(handlePrevScreenStep(screen));
|
|
71
87
|
};
|
|
72
|
-
React.useEffect(function () {
|
|
73
|
-
if (merchantInfo && !methods.getValues('merchantInfo'))
|
|
74
|
-
methods.setValue('merchantInfo', merchantInfo, { shouldValidate: true });
|
|
75
|
-
}, [merchantInfo]);
|
|
76
88
|
React.useEffect(function () {
|
|
77
89
|
if (error)
|
|
78
90
|
dispatch(clearError());
|
|
79
91
|
}, [methods.formState.isValid]);
|
|
80
|
-
var disabled = !methods.formState.isValid
|
|
92
|
+
var disabled = !methods.formState.isValid;
|
|
81
93
|
var handleMenuClick = function (flag) {
|
|
82
94
|
if (error)
|
|
83
95
|
dispatch(clearError());
|
|
@@ -85,7 +97,6 @@ var AuthenticationList = function (_a) {
|
|
|
85
97
|
};
|
|
86
98
|
var isBrandList = listActive === ListType.BrandList;
|
|
87
99
|
var isEntityList = listActive === ListType.EntityList;
|
|
88
|
-
|
|
89
|
-
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { list: brandList || [], show: !isEntityList && !isMerchantList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EntityList, { list: entityList || [], countryList: settingsData.countries || [], show: !isBrandList && !isMerchantList, onListOpen: function () { return handleMenuClick(ListType.EntityList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(MerchantList, { show: !isBrandList && !isEntityList, onListOpen: function () { return handleMenuClick(ListType.MerchantList); }, onListClose: function () { return handleMenuClick(); } }), _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') })) }))] })) })) }));
|
|
100
|
+
return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { list: brandList || [], show: !isAddEntity && !isEntityList, onListOpen: function () { return handleMenuClick(ListType.BrandList); }, onListClose: function () { return handleMenuClick(); } }), _jsx(EntityList, { countryList: settingsData.countries || [], show: !isBrandList, onListOpen: function () { return handleMenuClick(ListType.EntityList); }, onListClose: function () { return handleMenuClick(); }, handleAddEntity: function (flag) { return setIsAddEntity(flag); } }), _jsxs(Collapse, __assign({ in: isAddEntity && !isBrandList && !isEntityList }, { children: [_jsx(EntityLegalName, {}), _jsx(LicenseType, {}), _jsx(LicenseNumber, {})] })), _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: isAddEntity ? t('create_new_entity') : t('next') })) }))] })) })) }));
|
|
90
101
|
};
|
|
91
102
|
export default React.memo(AuthenticationList);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import Box from '@mui/material/Box';
|
|
17
|
+
import { removeAllOtherThanCharsNumbersAndSpace } from '../../../../utils';
|
|
18
|
+
import Input from '../../../shared/Input';
|
|
19
|
+
import { EndAdornment } from '../../../shared/EndAdornment';
|
|
20
|
+
var BoxStyled = styled(Box)(function (_a) {
|
|
21
|
+
var theme = _a.theme;
|
|
22
|
+
return ({
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
direction: theme.direction,
|
|
26
|
+
fontFamily: theme.typography.fontFamily,
|
|
27
|
+
overflow: 'hidden',
|
|
28
|
+
paddingBlockEnd: theme.spacing(2.5)
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
var EntityLegalName = function () {
|
|
32
|
+
var _a;
|
|
33
|
+
var t = useTranslation().t;
|
|
34
|
+
var control = useFormContext().control;
|
|
35
|
+
var entityNameControl = useController({ control: control, name: 'legalName' });
|
|
36
|
+
var entityNameValue = entityNameControl.field.value;
|
|
37
|
+
var error = (_a = entityNameControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
38
|
+
var handleChange = function (_a) {
|
|
39
|
+
var target = _a.target;
|
|
40
|
+
var value = removeAllOtherThanCharsNumbersAndSpace(target.value);
|
|
41
|
+
entityNameControl.field.onChange(value);
|
|
42
|
+
};
|
|
43
|
+
var clearEntityLegalName = function () {
|
|
44
|
+
entityNameControl.field.onChange('');
|
|
45
|
+
};
|
|
46
|
+
return (_jsx(BoxStyled, __assign({ sx: { mt: 2.5 } }, { children: _jsx(Input, { label: t('license_name_label'), onChange: handleChange, required: true, value: entityNameValue || '', endAdornment: _jsx(EndAdornment, { value: entityNameValue, error: error, onClear: clearEntityLegalName }), placeholder: t('license_name_hint'), warningType: 'alert', warningMessage: error && t(error) }) })));
|
|
47
|
+
};
|
|
48
|
+
export default EntityLegalName;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const InfoIconStyled: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
5
|
+
color?: "inherit" | "disabled" | "error" | "info" | "success" | "action" | "primary" | "secondary" | "warning" | undefined;
|
|
6
|
+
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
7
|
+
htmlColor?: string | undefined;
|
|
8
|
+
inheritViewBox?: boolean | undefined;
|
|
9
|
+
shapeRendering?: string | undefined;
|
|
10
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
11
|
+
titleAccess?: string | undefined;
|
|
12
|
+
viewBox?: string | undefined;
|
|
13
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.SVGProps<SVGSVGElement>, "string" | "name" | "type" | "version" | "fr" | "in" | "className" | "style" | "display" | "overflow" | "visibility" | "order" | "color" | "width" | "height" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "clipPath" | "cursor" | "direction" | "filter" | "fontSizeAdjust" | "fontStretch" | "fontVariant" | "imageRendering" | "opacity" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "wordSpacing" | "writingMode" | "mask" | "offset" | "textDecoration" | "azimuth" | "clip" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fill" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "path" | "children" | "key" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "mode" | "end" | "values" | "local" | "x" | "y" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "origin" | "method" | "operator" | "spacing" | "elevation" | "max" | "href" | "orientation" | "media" | "target" | "min" | "viewBox" | "crossOrigin" | "accentHeight" | "accumulate" | "additive" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "numOctaves" | "orient" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan"> & {
|
|
14
|
+
ref?: ((instance: SVGSVGElement | null) => void) | React.RefObject<SVGSVGElement> | null | undefined;
|
|
15
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "fontSize" | "shapeRendering" | "children" | "sx" | "htmlColor" | "inheritViewBox" | "titleAccess" | "viewBox"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
16
|
+
export declare const InfoOutlinedIconStyled: import("@emotion/styled").StyledComponent<{
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
classes?: Partial<import("@mui/material").SvgIconClasses> | undefined;
|
|
19
|
+
color?: "inherit" | "disabled" | "error" | "info" | "success" | "action" | "primary" | "secondary" | "warning" | undefined;
|
|
20
|
+
fontSize?: "small" | "inherit" | "medium" | "large" | undefined;
|
|
21
|
+
htmlColor?: string | undefined;
|
|
22
|
+
inheritViewBox?: boolean | undefined;
|
|
23
|
+
shapeRendering?: string | undefined;
|
|
24
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
25
|
+
titleAccess?: string | undefined;
|
|
26
|
+
viewBox?: string | undefined;
|
|
27
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.SVGProps<SVGSVGElement>, "string" | "name" | "type" | "version" | "fr" | "in" | "className" | "style" | "display" | "overflow" | "visibility" | "order" | "color" | "width" | "height" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "clipPath" | "cursor" | "direction" | "filter" | "fontSizeAdjust" | "fontStretch" | "fontVariant" | "imageRendering" | "opacity" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "unicodeBidi" | "wordSpacing" | "writingMode" | "mask" | "offset" | "textDecoration" | "azimuth" | "clip" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fill" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "path" | "children" | "key" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "mode" | "end" | "values" | "local" | "x" | "y" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "origin" | "method" | "operator" | "spacing" | "elevation" | "max" | "href" | "orientation" | "media" | "target" | "min" | "viewBox" | "crossOrigin" | "accentHeight" | "accumulate" | "additive" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "numOctaves" | "orient" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan"> & {
|
|
28
|
+
ref?: ((instance: SVGSVGElement | null) => void) | React.RefObject<SVGSVGElement> | null | undefined;
|
|
29
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "fontSize" | "shapeRendering" | "children" | "sx" | "htmlColor" | "inheritViewBox" | "titleAccess" | "viewBox"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
30
|
+
declare const Type: () => JSX.Element;
|
|
31
|
+
export default Type;
|
|
@@ -0,0 +1,90 @@
|
|
|
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 * as React from 'react';
|
|
14
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
15
|
+
import InfoIcon from '@mui/icons-material/Info';
|
|
16
|
+
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
17
|
+
import { useTranslation } from 'react-i18next';
|
|
18
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
19
|
+
import Text from '../../../../components/Text';
|
|
20
|
+
import { ScreenContainer } from '../../../shared/Containers';
|
|
21
|
+
import Mandatory from '../../../shared/Mandatory';
|
|
22
|
+
import RadioLabel from '../../../../components/RadioLabel';
|
|
23
|
+
import { LicenseType } from '../../../../@types';
|
|
24
|
+
import RadioGroup from '../../../../components/RadioGroup';
|
|
25
|
+
import Tooltip from '../../../../components/Tooltip';
|
|
26
|
+
import Radio from '../../../../components/Radio';
|
|
27
|
+
import { clearError, authSelector } from '../../../app/auth/authStore';
|
|
28
|
+
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
29
|
+
var LabelTextStyled = styled(Text)(function (_a) {
|
|
30
|
+
var theme = _a.theme;
|
|
31
|
+
return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), marginBlockEnd: theme.spacing(0.625) }));
|
|
32
|
+
});
|
|
33
|
+
var RadioGroupStyled = styled(RadioGroup)(function (_a) {
|
|
34
|
+
var theme = _a.theme;
|
|
35
|
+
return ({
|
|
36
|
+
marginInlineStart: theme.spacing(0.25)
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
var RadioStyled = styled(Radio)(function (_a) {
|
|
40
|
+
var theme = _a.theme;
|
|
41
|
+
return ({
|
|
42
|
+
'& .MuiSvgIcon-root': {
|
|
43
|
+
fontSize: theme.spacing(2.25),
|
|
44
|
+
width: theme.spacing(2.25),
|
|
45
|
+
height: theme.spacing(2.25)
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
var LabelStyled = styled('span')(function () { return ({
|
|
50
|
+
display: 'inline-flex',
|
|
51
|
+
alignItems: 'center'
|
|
52
|
+
}); });
|
|
53
|
+
export var InfoIconStyled = styled(InfoIcon)(function (_a) {
|
|
54
|
+
var theme = _a.theme;
|
|
55
|
+
return ({
|
|
56
|
+
width: theme.spacing(2.75),
|
|
57
|
+
height: theme.spacing(2.125),
|
|
58
|
+
cursor: 'pointer',
|
|
59
|
+
color: alpha(theme.palette.text.primary, 0.4),
|
|
60
|
+
display: 'inline-flex'
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
|
|
64
|
+
var theme = _a.theme;
|
|
65
|
+
return ({
|
|
66
|
+
width: theme.spacing(2.75),
|
|
67
|
+
height: theme.spacing(2.125),
|
|
68
|
+
cursor: 'pointer',
|
|
69
|
+
color: alpha(theme.palette.text.primary, 0.4),
|
|
70
|
+
display: 'inline-flex'
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
var Type = function () {
|
|
74
|
+
var t = useTranslation().t;
|
|
75
|
+
var control = useFormContext().control;
|
|
76
|
+
var error = useAppSelector(authSelector).error;
|
|
77
|
+
var _a = React.useState(false), isCRHovered = _a[0], setIsCRHovered = _a[1];
|
|
78
|
+
var _b = React.useState(false), isFLHovered = _b[0], setIsFLHovered = _b[1];
|
|
79
|
+
var typeControl = useController({ control: control, name: 'licenseType' });
|
|
80
|
+
var dispatch = useAppDispatch();
|
|
81
|
+
var handleOnChange = function (_a) {
|
|
82
|
+
var target = _a.target;
|
|
83
|
+
if (error)
|
|
84
|
+
dispatch(clearError());
|
|
85
|
+
typeControl.field.onChange(target.value);
|
|
86
|
+
};
|
|
87
|
+
var typeValue = typeControl.field.value;
|
|
88
|
+
return (_jsxs(ScreenContainer, __assign({ sx: { pb: 1.5, pl: 2.5, pr: 2.5 } }, { children: [_jsxs(LabelTextStyled, { children: [t('signup_business_type_label'), _jsx(Mandatory, {})] }), _jsxs(RadioGroupStyled, __assign({ value: typeValue ? (typeValue === LicenseType.FL ? LicenseType.FL : LicenseType.CR) : false, onChange: handleOnChange }, { children: [_jsx(RadioLabel, { value: LicenseType.FL, label: _jsxs(LabelStyled, { children: [t('homemaker_reg'), _jsx(Tooltip, __assign({ title: t('homemaker_reg_hint'), onMouseOver: function () { return setIsFLHovered(true); }, onMouseLeave: function () { return setIsFLHovered(false); }, onTouchStartCapture: function () { return setIsFLHovered(true); } }, { children: isFLHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), control: _jsx(RadioStyled, { color: 'primary', disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, focusRipple: false }) }), _jsx(RadioLabel, { value: LicenseType.CR, sx: { marginInlineEnd: '0px' }, label: _jsxs(LabelStyled, { children: [t('commercial_reg'), _jsx(Tooltip, __assign({ title: t('commercial_reg_hint'), onMouseOver: function () { return setIsCRHovered(true); }, onMouseLeave: function () { return setIsCRHovered(false); }, onTouchStartCapture: function () { return setIsCRHovered(true); } }, { children: isCRHovered ? _jsx(InfoIconStyled, {}) : _jsx(InfoOutlinedIconStyled, {}) }))] }), control: _jsx(RadioStyled, { color: 'primary', disableFocusRipple: true, disableRipple: true, disableTouchRipple: true, focusRipple: false }) })] }))] })));
|
|
89
|
+
};
|
|
90
|
+
export default Type;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { CountryCode
|
|
2
|
+
import { CountryCode } from '../../../../@types';
|
|
3
3
|
interface EntityListProps {
|
|
4
4
|
show: boolean;
|
|
5
|
-
list: Array<EntityLicenseAuth>;
|
|
6
5
|
countryList: Array<CountryCode>;
|
|
7
6
|
onListOpen?: () => void;
|
|
8
7
|
onListClose?: () => void;
|
|
8
|
+
handleAddEntity?: (flag: boolean) => void;
|
|
9
9
|
}
|
|
10
|
-
declare const _default: React.MemoExoticComponent<({ show,
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ show, countryList, handleAddEntity, ...rest }: EntityListProps) => JSX.Element>;
|
|
11
11
|
export default _default;
|
|
@@ -20,13 +20,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
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
|
+
};
|
|
23
32
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
33
|
import * as React from 'react';
|
|
25
34
|
import { useTranslation } from 'react-i18next';
|
|
26
35
|
import { useFormContext, useController } from 'react-hook-form';
|
|
27
36
|
import Box from '@mui/material/Box';
|
|
28
37
|
import { styled } from '@mui/material/styles';
|
|
29
|
-
import { useLanguage } from '../../../../hooks';
|
|
38
|
+
import { useAppSelector, useLanguage } from '../../../../hooks';
|
|
30
39
|
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
31
40
|
import InputSelect from '../../../shared/InputSelect';
|
|
32
41
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
@@ -35,6 +44,8 @@ import Text from '../../../../components/Text';
|
|
|
35
44
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
36
45
|
import Collapse from '../../../../components/Collapse';
|
|
37
46
|
import Icon from '../../../../components/Icon';
|
|
47
|
+
import { authSelector } from '../../../app/auth/authStore';
|
|
48
|
+
import { ADD_ENTITY } from '../../../../constants';
|
|
38
49
|
var EntityContainer = styled(Box)(function () { return ({
|
|
39
50
|
display: 'flex',
|
|
40
51
|
alignItems: 'center'
|
|
@@ -51,13 +62,36 @@ var EntityNameText = styled(Text, { shouldForwardProp: function (prop) { return
|
|
|
51
62
|
return (__assign(__assign({ color: theme.palette.text.primary }, theme.typography.body2), { fontWeight: isSelected ? theme.typography.fontWeightMedium : theme.typography.fontWeightLight }));
|
|
52
63
|
});
|
|
53
64
|
var EntityList = function (_a) {
|
|
54
|
-
var
|
|
55
|
-
var
|
|
65
|
+
var _b;
|
|
66
|
+
var show = _a.show, countryList = _a.countryList, handleAddEntity = _a.handleAddEntity, rest = __rest(_a, ["show", "countryList", "handleAddEntity"]);
|
|
67
|
+
var _c = React.useState([]), list = _c[0], setList = _c[1];
|
|
68
|
+
var _d = React.useState(null), anchorEl = _d[0], setAnchorEl = _d[1];
|
|
56
69
|
var t = useTranslation().t;
|
|
57
70
|
var isAr = useLanguage().isAr;
|
|
58
|
-
var
|
|
71
|
+
var _e = useFormContext(), control = _e.control, watch = _e.watch, setValue = _e.setValue, getValues = _e.getValues;
|
|
72
|
+
var data = useAppSelector(authSelector).data;
|
|
73
|
+
var brandInfo = watch('brandInfo');
|
|
74
|
+
var entityList = ((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.entityList) || [];
|
|
59
75
|
var selectedEntityControl = useController({ control: control, name: 'entityInfo' });
|
|
60
76
|
var selectedEntity = selectedEntityControl.field.value;
|
|
77
|
+
React.useEffect(function () {
|
|
78
|
+
if (entityList.length > 0) {
|
|
79
|
+
var filteredEntityList = entityList.filter(function (entity) { return (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) && entity.business_id === brandInfo.business_id; });
|
|
80
|
+
var list_1 = __spreadArray(__spreadArray([], filteredEntityList, true), [entityList[entityList.length - 1]], false) || [];
|
|
81
|
+
setList(list_1);
|
|
82
|
+
if (filteredEntityList.length) {
|
|
83
|
+
setValue('entityInfo', filteredEntityList[0], { shouldValidate: true });
|
|
84
|
+
setValue('licenseNumber', '');
|
|
85
|
+
setValue('licenseType', '');
|
|
86
|
+
setValue('legalName', '');
|
|
87
|
+
handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(false);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
setValue('merchantInfo', undefined);
|
|
91
|
+
setValue('entityInfo', undefined);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}, [entityList, brandInfo]);
|
|
61
95
|
var onOpenEntityList = function (event) {
|
|
62
96
|
var _a;
|
|
63
97
|
setAnchorEl(event.currentTarget);
|
|
@@ -72,7 +106,7 @@ var EntityList = function (_a) {
|
|
|
72
106
|
var _a, _b;
|
|
73
107
|
if (!entity)
|
|
74
108
|
return '';
|
|
75
|
-
return (isAr ? (_a = entity.legal_name) === null || _a === void 0 ? void 0 : _a.ar : (_b = entity.legal_name) === null || _b === void 0 ? void 0 : _b.en) || '';
|
|
109
|
+
return (isAr ? t((_a = entity.legal_name) === null || _a === void 0 ? void 0 : _a.ar) : t((_b = entity.legal_name) === null || _b === void 0 ? void 0 : _b.en)) || '';
|
|
76
110
|
};
|
|
77
111
|
var getEntityId = function (entity) {
|
|
78
112
|
if (!entity)
|
|
@@ -85,12 +119,20 @@ var EntityList = function (_a) {
|
|
|
85
119
|
return '';
|
|
86
120
|
return ((_a = countryList.find(function (country) { return country.iso2.toLocaleLowerCase() === entity.country.toLocaleLowerCase(); })) === null || _a === void 0 ? void 0 : _a.logo) || '';
|
|
87
121
|
};
|
|
88
|
-
var onSelectItem = function (
|
|
89
|
-
selectedEntityControl.field.onChange(
|
|
122
|
+
var onSelectItem = function (entity) {
|
|
123
|
+
selectedEntityControl.field.onChange(entity);
|
|
124
|
+
if (entity.id === ADD_ENTITY)
|
|
125
|
+
handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(true);
|
|
126
|
+
else {
|
|
127
|
+
setValue('licenseNumber', '');
|
|
128
|
+
setValue('legalName', '');
|
|
129
|
+
setValue('licenseType', '');
|
|
130
|
+
handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(false);
|
|
131
|
+
}
|
|
90
132
|
onCloseEntityList();
|
|
91
133
|
};
|
|
92
|
-
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsx(InputSelect, { label: t('select_entity_label'), onClick: !!anchorEl ? onCloseEntityList : onOpenEntityList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('select_entity_placeholder'), value:
|
|
93
|
-
return (_jsxs(_Fragment, { children: [_jsxs(EntityContainer, { children: [_jsx(EntityCountryFlag, { src: getCountryFlag(entity) }), _jsx(EntityNameText, __assign({ isSelected: getEntityId(entity) === getEntityId(selectedEntity) }, { children: t(getLegalName(entity)) }))] }), getEntityId(entity) === getEntityId(selectedEntity) && _jsx(CheckIcon, {})] }));
|
|
134
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { mt: 2.5 } }, { children: [_jsx(InputSelect, { label: t('select_entity_label'), onClick: !!anchorEl ? onCloseEntityList : onOpenEntityList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('select_entity_placeholder'), value: getLegalName(getValues('entityInfo')) }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { space: 140, list: list, onSelectItem: onSelectItem, renderItem: function (entity) {
|
|
135
|
+
return (_jsxs(_Fragment, { children: [_jsxs(EntityContainer, { children: [(entity === null || entity === void 0 ? void 0 : entity.country) && _jsx(EntityCountryFlag, { src: getCountryFlag(entity) }), _jsx(EntityNameText, __assign({ isSelected: getEntityId(entity) === getEntityId(selectedEntity) }, { children: t(getLegalName(entity)) }))] }), getEntityId(entity) === getEntityId(selectedEntity) && _jsx(CheckIcon, {})] }));
|
|
94
136
|
} }) }))] })) })));
|
|
95
137
|
};
|
|
96
138
|
export default React.memo(EntityList);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
5
|
+
import { KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH, LICENSE_NUMBER_MAX_LENGTH, LICENSE_NUMBER_MIN_LENGTH } from '../../../../constants';
|
|
6
|
+
import { removeAllOtherThanCharsAndNumber, isSA } from '../../../../utils';
|
|
7
|
+
import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
8
|
+
import ClearIcon from '../../../shared/ClearIcon';
|
|
9
|
+
import CheckIcon from '../../../shared/CheckIcon';
|
|
10
|
+
import Input from '../../../shared/Input';
|
|
11
|
+
import { useAppSelector } from '../../../../hooks';
|
|
12
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
13
|
+
var LicenseNumber = function () {
|
|
14
|
+
var _a;
|
|
15
|
+
var t = useTranslation().t;
|
|
16
|
+
var control = useFormContext().control;
|
|
17
|
+
var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
|
|
18
|
+
var settingsData = useAppSelector(settingsSelector).data;
|
|
19
|
+
var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
20
|
+
var handleFLNumberChange = function (_a) {
|
|
21
|
+
var target = _a.target;
|
|
22
|
+
var value = removeAllOtherThanCharsAndNumber(target.value);
|
|
23
|
+
licenseNumberControl.field.onChange(value);
|
|
24
|
+
};
|
|
25
|
+
var clearLicenseNumber = function () {
|
|
26
|
+
licenseNumberControl.field.onChange('');
|
|
27
|
+
};
|
|
28
|
+
var licenseNumberValue = licenseNumberControl.field.value;
|
|
29
|
+
var error = (_a = licenseNumberControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
|
|
30
|
+
var length = !isSACountry ? KW_MAX_LICENSE_LENGTH : LICENSE_NUMBER_MAX_LENGTH;
|
|
31
|
+
var minLength = !isSACountry ? KW_MIN_LICENSE_LENGTH : LICENSE_NUMBER_MIN_LENGTH;
|
|
32
|
+
var label = 'license_number';
|
|
33
|
+
var showCheckIcon = (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) >= minLength;
|
|
34
|
+
return (_jsx(ScreenContainer, { children: _jsx(Input, { label: t(label), required: true, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue || '', endAdornment: showCheckIcon ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: t('license_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) }));
|
|
35
|
+
};
|
|
36
|
+
export default React.memo(LicenseNumber);
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
export declare const AuthenticationListValidationSchema:
|
|
2
|
+
export declare const AuthenticationListValidationSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
3
3
|
brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
4
|
-
entityInfo:
|
|
5
|
-
|
|
4
|
+
entityInfo: any;
|
|
5
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
|
+
licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
7
|
+
legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
6
8
|
}>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
7
9
|
brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
8
|
-
entityInfo:
|
|
9
|
-
|
|
10
|
+
entityInfo: any;
|
|
11
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
12
|
+
licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
13
|
+
legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
10
14
|
}>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
|
|
11
15
|
brandInfo: import("yup/lib/object").RequiredObjectSchema<import("yup/lib/object").ObjectShape, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").ObjectShape>>;
|
|
12
|
-
entityInfo:
|
|
13
|
-
|
|
16
|
+
entityInfo: any;
|
|
17
|
+
licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
18
|
+
licenseType: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
19
|
+
legalName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
|
|
14
20
|
}>>>;
|
|
@@ -1,8 +1,68 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import { ADD_ENTITY, LICENSE_NUMBER_MIN_LENGTH, REGEX_LEGAL_NAME } from '../../../../constants';
|
|
3
|
+
var objectElements = {
|
|
4
|
+
id: yup.string().required(),
|
|
5
|
+
business_id: yup.string(),
|
|
6
|
+
legal_name: yup.object().shape({
|
|
7
|
+
ar: yup.string(),
|
|
8
|
+
en: yup.string()
|
|
9
|
+
}),
|
|
10
|
+
license: yup.object().shape({
|
|
11
|
+
number: yup.string()
|
|
12
|
+
})
|
|
8
13
|
};
|
|
14
|
+
export var AuthenticationListValidationSchema = yup.object().shape({
|
|
15
|
+
brandInfo: yup.object().required('auth_brand_required'),
|
|
16
|
+
entityInfo: yup.object().shape(objectElements).required('auth_entity_required'),
|
|
17
|
+
licenseNumber: yup
|
|
18
|
+
.string()
|
|
19
|
+
.when('entityInfo', function (entityInfo) {
|
|
20
|
+
var isAddEntity = (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) === ADD_ENTITY;
|
|
21
|
+
if (!isAddEntity) {
|
|
22
|
+
return yup.string().optional();
|
|
23
|
+
}
|
|
24
|
+
return yup
|
|
25
|
+
.string()
|
|
26
|
+
.test({
|
|
27
|
+
test: function (value) {
|
|
28
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
29
|
+
if (length === 0)
|
|
30
|
+
return true;
|
|
31
|
+
return length >= LICENSE_NUMBER_MIN_LENGTH ? true : this.createError({ message: 'enter_license_number' });
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
.required('');
|
|
35
|
+
})
|
|
36
|
+
.required(''),
|
|
37
|
+
licenseType: yup
|
|
38
|
+
.string()
|
|
39
|
+
.when('entityInfo', function (entityInfo) {
|
|
40
|
+
var isAddEntity = (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) === ADD_ENTITY;
|
|
41
|
+
if (!isAddEntity) {
|
|
42
|
+
return yup.string().optional();
|
|
43
|
+
}
|
|
44
|
+
return yup.string().required('choose_license_type');
|
|
45
|
+
})
|
|
46
|
+
.required(''),
|
|
47
|
+
legalName: yup
|
|
48
|
+
.string()
|
|
49
|
+
.when('entityInfo', function (entityInfo) {
|
|
50
|
+
var isAddEntity = (entityInfo === null || entityInfo === void 0 ? void 0 : entityInfo.id) === ADD_ENTITY;
|
|
51
|
+
if (!isAddEntity) {
|
|
52
|
+
return yup.string().optional();
|
|
53
|
+
}
|
|
54
|
+
return yup
|
|
55
|
+
.string()
|
|
56
|
+
.required('')
|
|
57
|
+
.test({
|
|
58
|
+
test: function (value) {
|
|
59
|
+
var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
|
|
60
|
+
if (length === 0)
|
|
61
|
+
return true;
|
|
62
|
+
return (value === null || value === void 0 ? void 0 : value.match(REGEX_LEGAL_NAME)) && length >= 3 ? true : this.createError({ message: 'enter_valid_legal_name' });
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
.required('');
|
|
66
|
+
})
|
|
67
|
+
.required('')
|
|
68
|
+
});
|