@tap-payments/auth-jsconnect 2.11.21-development → 2.11.22-development
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/features/auth/screens/AuthenticationList/AuthenticationList.js +10 -7
- package/build/features/auth/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
- package/build/features/auth/screens/AuthenticationList/EntityLicenseType.js +6 -4
- package/build/features/auth/screens/AuthenticationList/EntityList.js +9 -1
- package/build/features/business/screens/BusinessType/BusinessType.js +2 -3
- package/build/features/business/screens/BusinessType/LicenseList.js +5 -5
- package/build/features/connectExpress/screens/AuthenticationList/AuthenticationList.js +10 -10
- package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.d.ts +4 -1
- package/build/features/connectExpress/screens/AuthenticationList/EntityLicenseType.js +6 -4
- package/build/features/connectExpress/screens/AuthenticationList/EntityList.js +9 -1
- package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +6 -11
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ import Collapse from '@mui/material/Collapse';
|
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
18
|
import { useAppDispatch, useAppSelector, useLanguage } from '../../../../hooks';
|
|
19
19
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
20
|
-
import { deepCopy, sendCustomEventToGTM } from '../../../../utils';
|
|
20
|
+
import { deepCopy, isSA, sendCustomEventToGTM } from '../../../../utils';
|
|
21
21
|
import Form from '../../../../components/Form';
|
|
22
22
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
23
23
|
import Button from '../../../shared/Button';
|
|
@@ -27,19 +27,22 @@ import BrandList from './BrandList';
|
|
|
27
27
|
import EntityList from './EntityList';
|
|
28
28
|
import EntityLegalName from './EntityLegalName';
|
|
29
29
|
import LicenseNumber from './LicenseNumber';
|
|
30
|
-
import
|
|
30
|
+
import EntityLicenseType from './EntityLicenseType';
|
|
31
31
|
var ListType;
|
|
32
32
|
(function (ListType) {
|
|
33
33
|
ListType["BrandList"] = "BrandList";
|
|
34
34
|
ListType["EntityList"] = "EntityList";
|
|
35
35
|
})(ListType || (ListType = {}));
|
|
36
36
|
var AuthenticationList = function (_a) {
|
|
37
|
+
var _b;
|
|
37
38
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
39
|
+
var _c = useAppSelector(authSelector), data = _c.data, loading = _c.loading, error = _c.error;
|
|
40
|
+
var _d = data.authenticationData, brandInfo = _d.brandInfo, entityInfo = _d.entityInfo;
|
|
41
|
+
var _e = React.useState(), listActive = _e[0], setListActive = _e[1];
|
|
41
42
|
var brandList = (data.responseData || {}).brandList;
|
|
42
|
-
var
|
|
43
|
+
var _f = React.useState(false), isAddEntity = _f[0], setIsAddEntity = _f[1];
|
|
44
|
+
var code = (_b = settingsData.businessCountry) === null || _b === void 0 ? void 0 : _b.iso2;
|
|
45
|
+
var isSACountry = React.useMemo(function () { return isSA(code); }, [code]);
|
|
43
46
|
React.useEffect(function () {
|
|
44
47
|
sendCustomEventToGTM({
|
|
45
48
|
event: 'Send Event',
|
|
@@ -91,6 +94,6 @@ var AuthenticationList = function (_a) {
|
|
|
91
94
|
};
|
|
92
95
|
var isBrandList = listActive === ListType.BrandList;
|
|
93
96
|
var isEntityList = listActive === ListType.EntityList;
|
|
94
|
-
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(
|
|
97
|
+
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(EntityLicenseType, { show: isSACountry }), _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') })) }))] })) })) }));
|
|
95
98
|
};
|
|
96
99
|
export default React.memo(AuthenticationList);
|
|
@@ -27,5 +27,8 @@ export declare const InfoOutlinedIconStyled: import("@emotion/styled").StyledCom
|
|
|
27
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
28
|
ref?: ((instance: SVGSVGElement | null) => void) | React.RefObject<SVGSVGElement> | null | undefined;
|
|
29
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
|
|
30
|
+
declare type TypeProps = {
|
|
31
|
+
show: boolean;
|
|
32
|
+
};
|
|
33
|
+
declare const Type: ({ show }: TypeProps) => JSX.Element;
|
|
31
34
|
export default Type;
|
|
@@ -26,6 +26,7 @@ import Tooltip from '../../../../components/Tooltip';
|
|
|
26
26
|
import Radio from '../../../../components/Radio';
|
|
27
27
|
import { clearError, authSelector } from '../../../app/auth/authStore';
|
|
28
28
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
29
|
+
import Collapse from '../../../../components/Collapse';
|
|
29
30
|
var LabelTextStyled = styled(Text)(function (_a) {
|
|
30
31
|
var theme = _a.theme;
|
|
31
32
|
return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), marginBlockEnd: theme.spacing(0.625) }));
|
|
@@ -70,12 +71,13 @@ export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
|
|
|
70
71
|
display: 'inline-flex'
|
|
71
72
|
});
|
|
72
73
|
});
|
|
73
|
-
var Type = function () {
|
|
74
|
+
var Type = function (_a) {
|
|
75
|
+
var show = _a.show;
|
|
74
76
|
var t = useTranslation().t;
|
|
75
77
|
var control = useFormContext().control;
|
|
76
78
|
var error = useAppSelector(authSelector).error;
|
|
77
|
-
var
|
|
78
|
-
var
|
|
79
|
+
var _b = React.useState(false), isCRHovered = _b[0], setIsCRHovered = _b[1];
|
|
80
|
+
var _c = React.useState(false), isFLHovered = _c[0], setIsFLHovered = _c[1];
|
|
79
81
|
var typeControl = useController({ control: control, name: 'licenseType' });
|
|
80
82
|
var dispatch = useAppDispatch();
|
|
81
83
|
var handleOnChange = function (_a) {
|
|
@@ -85,6 +87,6 @@ var Type = function () {
|
|
|
85
87
|
typeControl.field.onChange(target.value);
|
|
86
88
|
};
|
|
87
89
|
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 }) })] }))] })));
|
|
90
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _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
91
|
};
|
|
90
92
|
export default Type;
|
|
@@ -43,9 +43,12 @@ import SimpleList from '../../../../components/SimpleList';
|
|
|
43
43
|
import Text from '../../../../components/Text';
|
|
44
44
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
45
45
|
import Collapse from '../../../../components/Collapse';
|
|
46
|
+
import { LicenseType } from '../../../../@types';
|
|
46
47
|
import Icon from '../../../../components/Icon';
|
|
47
48
|
import { authSelector } from '../../../app/auth/authStore';
|
|
48
49
|
import { ADD_ENTITY } from '../../../../constants';
|
|
50
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
51
|
+
import { isSA } from '../../../../utils';
|
|
49
52
|
var EntityContainer = styled(Box)(function () { return ({
|
|
50
53
|
display: 'flex',
|
|
51
54
|
alignItems: 'center'
|
|
@@ -74,6 +77,8 @@ var EntityList = function (_a) {
|
|
|
74
77
|
var entityList = ((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.entityList) || [];
|
|
75
78
|
var selectedEntityControl = useController({ control: control, name: 'entityInfo' });
|
|
76
79
|
var selectedEntity = selectedEntityControl.field.value;
|
|
80
|
+
var businessCountry = useAppSelector(settingsSelector).data.businessCountry;
|
|
81
|
+
var isSACountry = React.useMemo(function () { return isSA(businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.iso2); }, [businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.iso2]);
|
|
77
82
|
React.useEffect(function () {
|
|
78
83
|
if (entityList.length > 0) {
|
|
79
84
|
var filteredEntityList = entityList.filter(function (entity) { return (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) && entity.business_id === brandInfo.business_id; }) || [];
|
|
@@ -121,8 +126,11 @@ var EntityList = function (_a) {
|
|
|
121
126
|
};
|
|
122
127
|
var onSelectItem = function (entity) {
|
|
123
128
|
selectedEntityControl.field.onChange(entity);
|
|
124
|
-
if (entity.id === ADD_ENTITY)
|
|
129
|
+
if (entity.id === ADD_ENTITY) {
|
|
130
|
+
if (!isSACountry)
|
|
131
|
+
setValue('licenseType', LicenseType.CR);
|
|
125
132
|
handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(true);
|
|
133
|
+
}
|
|
126
134
|
else {
|
|
127
135
|
setValue('licenseNumber', '');
|
|
128
136
|
setValue('legalName', '');
|
|
@@ -23,7 +23,7 @@ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
|
|
|
23
23
|
import { businessSelector, clearError, updateLeadBusinessType } from '../../../app/business/businessStore';
|
|
24
24
|
import { BusinessType as Type } from '../../../../@types';
|
|
25
25
|
import Button from '../../../shared/Button';
|
|
26
|
-
import { deepCopy, isKW, isOtherLicense,
|
|
26
|
+
import { deepCopy, isKW, isOtherLicense, isSA, sendCustomEventToGTM } from '../../../../utils';
|
|
27
27
|
import { KWLicenseValidationSchema, LicenseValidationSchema, OtherCountryLicenseValidationSchema } from './validation';
|
|
28
28
|
import LicenseList from './LicenseList';
|
|
29
29
|
import LicenseCertificate from './LicenseCertificate';
|
|
@@ -60,7 +60,6 @@ var BusinessType = function (_a) {
|
|
|
60
60
|
};
|
|
61
61
|
var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
62
62
|
var isKWCountry = React.useMemo(function () { return isKW(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
63
|
-
var isOtherCountry = React.useMemo(function () { return isOtherThanKWOrSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
|
|
64
63
|
var getSchema = function () {
|
|
65
64
|
if (isSACountry)
|
|
66
65
|
return LicenseValidationSchema;
|
|
@@ -116,7 +115,7 @@ var BusinessType = function (_a) {
|
|
|
116
115
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === Type.CR;
|
|
117
116
|
var isFL = (selected === null || selected === void 0 ? void 0 : selected.type) === Type.FL;
|
|
118
117
|
var hasEntityList = !!(entityLicenseList === null || entityLicenseList === void 0 ? void 0 : entityLicenseList.length);
|
|
119
|
-
var showLicenseList = hasEntityList ?
|
|
118
|
+
var showLicenseList = hasEntityList ? isSACountry && isOtherLicense(selectedLicenseEntity) : isSACountry;
|
|
120
119
|
var showEntityList = isKWCountry ? hasEntityList && !isLicenseListActive && isCR : hasEntityList && !isLicenseListActive;
|
|
121
120
|
var disabled = !methods.formState.isValid || uploading || uploadingArticle;
|
|
122
121
|
var disableBack = !data.otpData.isNID;
|
|
@@ -37,7 +37,7 @@ import Text from '../../../../components/Text';
|
|
|
37
37
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
38
38
|
import Collapse from '../../../../components/Collapse';
|
|
39
39
|
import { isKW, isOtherLicense, isSA } from '../../../../utils';
|
|
40
|
-
import { OTHER_CR_LICENSE
|
|
40
|
+
import { OTHER_CR_LICENSE } from '../../../../constants';
|
|
41
41
|
import { settingsSelector } from '../../../../app/settings';
|
|
42
42
|
var InputStyled = styled(InputSelect)(function (_a) {
|
|
43
43
|
var theme = _a.theme;
|
|
@@ -91,10 +91,10 @@ var LicenseList = function (_a) {
|
|
|
91
91
|
}, [licenseList, selectedLicense]);
|
|
92
92
|
React.useEffect(function () {
|
|
93
93
|
if (!!country_code) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
if (!isSA(country_code)) {
|
|
95
|
+
setValue('selectedLicense', OTHER_CR_LICENSE, { shouldValidate: true });
|
|
96
|
+
}
|
|
97
|
+
if (isKW(country_code)) {
|
|
98
98
|
setValue('entityLegalName', entityLegalName, { shouldValidate: true });
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -17,7 +17,7 @@ import Collapse from '@mui/material/Collapse';
|
|
|
17
17
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
18
18
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
19
19
|
import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
|
|
20
|
-
import { deepCopy, isKW, sendCustomEventToGTM } from '../../../../utils';
|
|
20
|
+
import { deepCopy, isKW, isSA, sendCustomEventToGTM } from '../../../../utils';
|
|
21
21
|
import { AuthForType } from '../../../../@types';
|
|
22
22
|
import Form from '../../../../components/Form';
|
|
23
23
|
import { ScreenContainer } from '../../../shared/Containers';
|
|
@@ -29,20 +29,20 @@ import BrandList from './BrandList';
|
|
|
29
29
|
import EntityList from './EntityList';
|
|
30
30
|
import LicenseNumber from './LicenseNumber';
|
|
31
31
|
import EntityLegalName from './EntityLegalName';
|
|
32
|
-
import
|
|
32
|
+
import EntityLicenseType from './EntityLicenseType';
|
|
33
33
|
var ListType;
|
|
34
34
|
(function (ListType) {
|
|
35
35
|
ListType["BrandList"] = "BrandList";
|
|
36
36
|
ListType["EntityList"] = "EntityList";
|
|
37
37
|
})(ListType || (ListType = {}));
|
|
38
38
|
var AuthenticationList = function (_a) {
|
|
39
|
-
var _b;
|
|
39
|
+
var _b, _c;
|
|
40
40
|
var settingsData = useAppSelector(settingsSelector).data;
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
var
|
|
41
|
+
var _d = useAppSelector(connectExpressSelector), data = _d.data, loading = _d.loading, error = _d.error;
|
|
42
|
+
var _e = data.authenticationData, brandInfo = _e.brandInfo, entityInfo = _e.entityInfo;
|
|
43
|
+
var _f = React.useState(), listActive = _f[0], setListActive = _f[1];
|
|
44
44
|
var brandList = (((_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authenticationData) || {}).brandList;
|
|
45
|
-
var
|
|
45
|
+
var _g = React.useState(false), isAddEntity = _g[0], setIsAddEntity = _g[1];
|
|
46
46
|
var otpData = data.otpData;
|
|
47
47
|
var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
|
|
48
48
|
React.useEffect(function () {
|
|
@@ -63,6 +63,8 @@ var AuthenticationList = function (_a) {
|
|
|
63
63
|
var t = useTranslation().t;
|
|
64
64
|
var isAr = useLanguage().isAr;
|
|
65
65
|
var dispatch = useAppDispatch();
|
|
66
|
+
var code = (_c = settingsData.businessCountry) === null || _c === void 0 ? void 0 : _c.iso2;
|
|
67
|
+
var isSACountry = React.useMemo(function () { return isSA(code); }, [code]);
|
|
66
68
|
var onSubmit = function (formData) {
|
|
67
69
|
if (isAddEntity) {
|
|
68
70
|
var licenseNumber = formData.licenseNumber, legalName = formData.legalName, brandInfo_1 = formData.brandInfo, licenseType = formData.licenseType;
|
|
@@ -73,7 +75,6 @@ var AuthenticationList = function (_a) {
|
|
|
73
75
|
dispatch(getMerchantListAsync(deepCopy(formData)));
|
|
74
76
|
};
|
|
75
77
|
var onBack = function () {
|
|
76
|
-
var _a;
|
|
77
78
|
if (isAddEntity) {
|
|
78
79
|
setIsAddEntity(false);
|
|
79
80
|
methods.setValue('licenseNumber', '');
|
|
@@ -82,7 +83,6 @@ var AuthenticationList = function (_a) {
|
|
|
82
83
|
methods.setValue('entityInfo', undefined, { shouldValidate: true });
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
85
|
-
var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
|
|
86
86
|
var screen = startWithNID ? (isKW(code) ? 'CONNECT_EXPRESS_CIVIL_ID_STEP' : 'CONNECT_EXPRESS_NID_STEP') : 'CONNECT_EXPRESS_MOBILE_STEP';
|
|
87
87
|
dispatch(resetAuthenticationScreen());
|
|
88
88
|
dispatch(handlePrevScreenStep(screen));
|
|
@@ -99,6 +99,6 @@ var AuthenticationList = function (_a) {
|
|
|
99
99
|
};
|
|
100
100
|
var isBrandList = listActive === ListType.BrandList;
|
|
101
101
|
var isEntityList = listActive === ListType.EntityList;
|
|
102
|
-
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, handleAddEntity: function (flag) { return setIsAddEntity(flag); }, onListOpen: function () { return handleMenuClick(ListType.EntityList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: isAddEntity && !isBrandList && !isEntityList }, { children: [_jsx(EntityLegalName, {}), _jsx(
|
|
102
|
+
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, handleAddEntity: function (flag) { return setIsAddEntity(flag); }, onListOpen: function () { return handleMenuClick(ListType.EntityList); }, onListClose: function () { return handleMenuClick(); } }), _jsxs(Collapse, __assign({ in: isAddEntity && !isBrandList && !isEntityList }, { children: [_jsx(EntityLegalName, {}), _jsx(EntityLicenseType, { show: isSACountry }), _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') })) }))] })) })) }));
|
|
103
103
|
};
|
|
104
104
|
export default React.memo(AuthenticationList);
|
|
@@ -27,5 +27,8 @@ export declare const InfoOutlinedIconStyled: import("@emotion/styled").StyledCom
|
|
|
27
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
28
|
ref?: ((instance: SVGSVGElement | null) => void) | React.RefObject<SVGSVGElement> | null | undefined;
|
|
29
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
|
|
30
|
+
declare type TypeProps = {
|
|
31
|
+
show: boolean;
|
|
32
|
+
};
|
|
33
|
+
declare const Type: ({ show }: TypeProps) => JSX.Element;
|
|
31
34
|
export default Type;
|
|
@@ -26,6 +26,7 @@ import Tooltip from '../../../../components/Tooltip';
|
|
|
26
26
|
import Radio from '../../../../components/Radio';
|
|
27
27
|
import { clearError, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
|
|
28
28
|
import { useAppDispatch, useAppSelector } from '../../../../hooks';
|
|
29
|
+
import Collapse from '../../../../components/Collapse';
|
|
29
30
|
var LabelTextStyled = styled(Text)(function (_a) {
|
|
30
31
|
var theme = _a.theme;
|
|
31
32
|
return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), marginBlockEnd: theme.spacing(0.625) }));
|
|
@@ -70,12 +71,13 @@ export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
|
|
|
70
71
|
display: 'inline-flex'
|
|
71
72
|
});
|
|
72
73
|
});
|
|
73
|
-
var Type = function () {
|
|
74
|
+
var Type = function (_a) {
|
|
75
|
+
var show = _a.show;
|
|
74
76
|
var t = useTranslation().t;
|
|
75
77
|
var control = useFormContext().control;
|
|
76
78
|
var error = useAppSelector(connectExpressSelector).error;
|
|
77
|
-
var
|
|
78
|
-
var
|
|
79
|
+
var _b = React.useState(false), isCRHovered = _b[0], setIsCRHovered = _b[1];
|
|
80
|
+
var _c = React.useState(false), isFLHovered = _c[0], setIsFLHovered = _c[1];
|
|
79
81
|
var typeControl = useController({ control: control, name: 'licenseType' });
|
|
80
82
|
var dispatch = useAppDispatch();
|
|
81
83
|
var handleOnChange = function (_a) {
|
|
@@ -85,6 +87,6 @@ var Type = function () {
|
|
|
85
87
|
typeControl.field.onChange(target.value);
|
|
86
88
|
};
|
|
87
89
|
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 }) })] }))] })));
|
|
90
|
+
return (_jsx(Collapse, __assign({ in: show }, { children: _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
91
|
};
|
|
90
92
|
export default Type;
|
|
@@ -43,9 +43,12 @@ import SimpleList from '../../../../components/SimpleList';
|
|
|
43
43
|
import Text from '../../../../components/Text';
|
|
44
44
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
45
45
|
import Collapse from '../../../../components/Collapse';
|
|
46
|
+
import { LicenseType } from '../../../../@types';
|
|
46
47
|
import Icon from '../../../../components/Icon';
|
|
47
48
|
import { connectExpressSelector } from '../../../../features/app/connectExpress/connectExpressStore';
|
|
48
49
|
import { ADD_ENTITY } from '../../../../constants';
|
|
50
|
+
import { isSA } from '../../../../utils';
|
|
51
|
+
import { settingsSelector } from '../../../../app/settings';
|
|
49
52
|
var EntityContainer = styled(Box)(function () { return ({
|
|
50
53
|
display: 'flex',
|
|
51
54
|
alignItems: 'center'
|
|
@@ -70,9 +73,11 @@ var EntityList = function (_a) {
|
|
|
70
73
|
var isAr = useLanguage().isAr;
|
|
71
74
|
var _f = useFormContext(), control = _f.control, watch = _f.watch, setValue = _f.setValue, getValues = _f.getValues;
|
|
72
75
|
var data = useAppSelector(connectExpressSelector).data;
|
|
76
|
+
var businessCountry = useAppSelector(settingsSelector).data.businessCountry;
|
|
73
77
|
var brandInfo = watch('brandInfo');
|
|
74
78
|
var entityList = ((_c = (_b = data.responseData) === null || _b === void 0 ? void 0 : _b.authenticationData) === null || _c === void 0 ? void 0 : _c.entityList) || [];
|
|
75
79
|
var selectedEntityControl = useController({ control: control, name: 'entityInfo' });
|
|
80
|
+
var isSACountry = React.useMemo(function () { return isSA(businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.iso2); }, [businessCountry === null || businessCountry === void 0 ? void 0 : businessCountry.iso2]);
|
|
76
81
|
React.useEffect(function () {
|
|
77
82
|
if (entityList.length > 0) {
|
|
78
83
|
var filteredEntityList = entityList.filter(function (entity) { return (brandInfo === null || brandInfo === void 0 ? void 0 : brandInfo.business_id) && entity.business_id === brandInfo.business_id; }) || [];
|
|
@@ -120,8 +125,11 @@ var EntityList = function (_a) {
|
|
|
120
125
|
};
|
|
121
126
|
var onSelectItem = function (entity) {
|
|
122
127
|
selectedEntityControl.field.onChange(entity);
|
|
123
|
-
if (entity.id === ADD_ENTITY)
|
|
128
|
+
if (entity.id === ADD_ENTITY) {
|
|
129
|
+
if (!isSACountry)
|
|
130
|
+
setValue('licenseType', LicenseType.CR);
|
|
124
131
|
handleAddEntity === null || handleAddEntity === void 0 ? void 0 : handleAddEntity(true);
|
|
132
|
+
}
|
|
125
133
|
else {
|
|
126
134
|
setValue('licenseNumber', '');
|
|
127
135
|
setValue('legalName', '');
|
|
@@ -28,9 +28,9 @@ import Box from '@mui/material/Box';
|
|
|
28
28
|
import { styled } from '@mui/material/styles';
|
|
29
29
|
import { useAppDispatch, useLanguage, useAppSelector } from '../../../../hooks';
|
|
30
30
|
import { BusinessType } from '../../../../@types';
|
|
31
|
-
import { isKW, isOtherLicense,
|
|
31
|
+
import { isKW, isOtherLicense, isSA } from '../../../../utils';
|
|
32
32
|
import { settingsSelector } from '../../../../app/settings';
|
|
33
|
-
import { OTHER_CR_LICENSE
|
|
33
|
+
import { OTHER_CR_LICENSE } from '../../../../constants';
|
|
34
34
|
import SimpleList from '../../../../components/SimpleList';
|
|
35
35
|
import Text from '../../../../components/Text';
|
|
36
36
|
import ExpandIcon from '../../../../components/ExpandIcon';
|
|
@@ -40,7 +40,6 @@ import InputSelect from '../../../shared/InputSelect';
|
|
|
40
40
|
import CheckIcon from '../../../shared/CheckIcon';
|
|
41
41
|
import { connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
|
|
42
42
|
import LicenseNumber from './LicenseNumber';
|
|
43
|
-
import LicenseType from './LicenseType';
|
|
44
43
|
import UnifiedNumber from './UnifiedNumber';
|
|
45
44
|
var InputStyled = styled(InputSelect)(function (_a) {
|
|
46
45
|
var theme = _a.theme;
|
|
@@ -81,7 +80,6 @@ var LicenseList = function (_a) {
|
|
|
81
80
|
setAnchorEl(null);
|
|
82
81
|
(_a = rest.onListClose) === null || _a === void 0 ? void 0 : _a.call(rest);
|
|
83
82
|
};
|
|
84
|
-
var isOtherThanKWOrSACountry = React.useMemo(function () { return isOtherThanKWOrSA(country_code); }, [country_code]);
|
|
85
83
|
var isKWCountry = React.useMemo(function () { return isKW(country_code); }, [country_code]);
|
|
86
84
|
var isSACountry = React.useMemo(function () { return isSA(country_code); }, [country_code]);
|
|
87
85
|
React.useEffect(function () {
|
|
@@ -97,11 +95,8 @@ var LicenseList = function (_a) {
|
|
|
97
95
|
}
|
|
98
96
|
}, [licenseList, selectedLicense]);
|
|
99
97
|
React.useEffect(function () {
|
|
100
|
-
if (!!country_code) {
|
|
101
|
-
|
|
102
|
-
var license = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR ? OTHER_CR_LICENSE : OTHER_FL_LICENSE;
|
|
103
|
-
setValue('selectedLicense', license, { shouldValidate: true });
|
|
104
|
-
}
|
|
98
|
+
if (!!country_code && !isSACountry) {
|
|
99
|
+
setValue('selectedLicense', OTHER_CR_LICENSE, { shouldValidate: true });
|
|
105
100
|
}
|
|
106
101
|
}, [country_code]);
|
|
107
102
|
var getLicenseNumber = function (item) {
|
|
@@ -149,8 +144,8 @@ var LicenseList = function (_a) {
|
|
|
149
144
|
var isCR = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.CR;
|
|
150
145
|
var isFL = (selected === null || selected === void 0 ? void 0 : selected.type) === BusinessType.FL;
|
|
151
146
|
var flValue = isOtherLicense(selected) ? t(getLicenseName(selected)) : getLicenseNumber(selected);
|
|
152
|
-
return (_jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: isSACountry
|
|
147
|
+
return (_jsxs(ScreenContainer, { children: [_jsxs(Collapse, __assign({ in: isSACountry }, { children: [_jsx(InputStyled, { label: t('choose_any_license'), readOnly: readOnly, onClick: !!anchorEl ? function () { return onCloseLicenseList(); } : onOpenLicenseList, endAdornment: _jsx(ExpandIcon, { anchorEl: !!anchorEl }), placeholder: t('choose_license_cr'), value: (isCR ? t(getLicenseName(selected)) : flValue) || '' }), _jsx(Collapse, __assign({ in: !!anchorEl }, { children: _jsx(SimpleList, { searchKeyPath: 'legal_name?.en', list: licenseList || [], onSelectItem: onSelectItem, renderItem: function (item) {
|
|
153
148
|
return (_jsxs(_Fragment, { children: [_jsx(LicenseContainer, { children: _jsx(LicenseNameText, __assign({ isSelected: getLicenseNumber(item) === getLicenseNumber(selected) }, { children: isOtherLicense(item) ? t(getLicenseName(item)) : getLicenseFullName(item) })) }), getLicenseNumber(item) === getLicenseNumber(selected) && _jsx(CheckIcon, {})] }));
|
|
154
|
-
} }) }))] })), _jsx(
|
|
149
|
+
} }) }))] })), _jsx(LicenseNumber, { show: showLicenseNumber(), readOnly: licenseReadonly }), _jsx(UnifiedNumber, { show: isSACountry && isCR && show, readOnly: licenseReadonly })] }));
|
|
155
150
|
};
|
|
156
151
|
export default React.memo(LicenseList);
|