@tap-payments/auth-jsconnect 2.1.44-test → 2.1.45-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/build/@types/form.d.ts +8 -5
  2. package/build/api/account.d.ts +5 -0
  3. package/build/api/account.js +9 -1
  4. package/build/api/auth.d.ts +8 -4
  5. package/build/api/auth.js +18 -2
  6. package/build/api/index.d.ts +6 -2
  7. package/build/api/lead.d.ts +1 -0
  8. package/build/api/lead.js +10 -1
  9. package/build/assets/locales/ar.json +2 -0
  10. package/build/assets/locales/en.json +2 -0
  11. package/build/components/Lottie/Lottie.d.ts +320 -0
  12. package/build/components/Lottie/Lottie.js +3 -1
  13. package/build/components/Lottie/files/account_creating.json +732 -0
  14. package/build/constants/api.d.ts +3 -0
  15. package/build/constants/api.js +8 -2
  16. package/build/constants/app.d.ts +5 -2
  17. package/build/constants/app.js +60 -4
  18. package/build/features/app/auth/authStore.d.ts +3 -3
  19. package/build/features/app/business/businessStore.d.ts +1 -0
  20. package/build/features/app/connect/connectStore.d.ts +1 -0
  21. package/build/features/app/connect/connectStore.js +3 -2
  22. package/build/features/app/connectExpress/connectExpressStore.d.ts +61 -6
  23. package/build/features/app/connectExpress/connectExpressStore.js +614 -66
  24. package/build/features/connect/screens/Merchant/Merchant.js +12 -10
  25. package/build/features/connectExpress/ConnectExpress.js +1 -1
  26. package/build/features/connectExpress/screens/CivilID/CivilID.js +3 -3
  27. package/build/features/connectExpress/screens/CivilIDMissed/CivilID.d.ts +5 -0
  28. package/build/features/connectExpress/screens/CivilIDMissed/CivilID.js +53 -0
  29. package/build/features/connectExpress/screens/CivilIDMissed/IDNumber.d.ts +7 -0
  30. package/build/features/connectExpress/screens/CivilIDMissed/IDNumber.js +55 -0
  31. package/build/features/connectExpress/screens/CivilIDMissed/index.d.ts +3 -0
  32. package/build/features/connectExpress/screens/CivilIDMissed/index.js +2 -0
  33. package/build/features/connectExpress/screens/CivilIDMissed/validation.d.ts +8 -0
  34. package/build/features/connectExpress/screens/CivilIDMissed/validation.js +4 -0
  35. package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.d.ts +8 -0
  36. package/build/features/connectExpress/screens/CollectBusinessInfo/BrandName.js +142 -0
  37. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.d.ts +5 -0
  38. package/build/features/connectExpress/screens/CollectBusinessInfo/CollectBusinessInfo.js +77 -0
  39. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.d.ts +8 -0
  40. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseList.js +144 -0
  41. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.d.ts +7 -0
  42. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseNumber.js +52 -0
  43. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.d.ts +34 -0
  44. package/build/features/connectExpress/screens/CollectBusinessInfo/LicenseType.js +94 -0
  45. package/build/features/connectExpress/screens/CollectBusinessInfo/index.d.ts +3 -0
  46. package/build/features/connectExpress/screens/CollectBusinessInfo/index.js +2 -0
  47. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.d.ts +27 -0
  48. package/build/features/connectExpress/screens/CollectBusinessInfo/validation.js +79 -0
  49. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.d.ts +5 -0
  50. package/build/features/connectExpress/screens/CollectIndividualInfo/CollectIndividualInfo.js +89 -0
  51. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.d.ts +8 -0
  52. package/build/features/connectExpress/screens/CollectIndividualInfo/Email.js +113 -0
  53. package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.d.ts +10 -0
  54. package/build/features/connectExpress/screens/CollectIndividualInfo/MobileNumber.js +149 -0
  55. package/build/features/connectExpress/screens/CollectIndividualInfo/Name.d.ts +6 -0
  56. package/build/features/connectExpress/screens/CollectIndividualInfo/Name.js +45 -0
  57. package/build/features/connectExpress/screens/CollectIndividualInfo/index.d.ts +3 -0
  58. package/build/features/connectExpress/screens/CollectIndividualInfo/index.js +2 -0
  59. package/build/features/connectExpress/screens/CollectIndividualInfo/validation.d.ts +14 -0
  60. package/build/features/connectExpress/screens/CollectIndividualInfo/validation.js +31 -0
  61. package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.d.ts +5 -0
  62. package/build/features/connectExpress/screens/CreateAccountLoader/CreateAccountLoader.js +61 -0
  63. package/build/features/connectExpress/screens/CreateAccountLoader/index.d.ts +2 -0
  64. package/build/features/connectExpress/screens/CreateAccountLoader/index.js +2 -0
  65. package/build/features/connectExpress/screens/IdentityOTP/OTP.d.ts +5 -0
  66. package/build/features/connectExpress/screens/IdentityOTP/OTP.js +87 -0
  67. package/build/features/connectExpress/screens/IdentityOTP/OTPInput.d.ts +5 -0
  68. package/build/features/connectExpress/screens/IdentityOTP/OTPInput.js +52 -0
  69. package/build/features/connectExpress/screens/IdentityOTP/index.d.ts +3 -0
  70. package/build/features/connectExpress/screens/IdentityOTP/index.js +2 -0
  71. package/build/features/connectExpress/screens/IdentityOTP/validation.d.ts +8 -0
  72. package/build/features/connectExpress/screens/IdentityOTP/validation.js +4 -0
  73. package/build/features/connectExpress/screens/IdentityVerifyPACI/VerifyPACI.d.ts +5 -0
  74. package/build/features/connectExpress/screens/IdentityVerifyPACI/VerifyPACI.js +34 -0
  75. package/build/features/connectExpress/screens/IdentityVerifyPACI/index.d.ts +3 -0
  76. package/build/features/connectExpress/screens/IdentityVerifyPACI/index.js +2 -0
  77. package/build/features/connectExpress/screens/Mobile/Mobile.js +0 -3
  78. package/build/features/connectExpress/screens/NID/NID.js +7 -6
  79. package/build/features/connectExpress/screens/NIDMissed/DOB.d.ts +6 -0
  80. package/build/features/connectExpress/screens/NIDMissed/DOB.js +47 -0
  81. package/build/features/connectExpress/screens/NIDMissed/IDNumber.d.ts +6 -0
  82. package/build/features/connectExpress/screens/NIDMissed/IDNumber.js +60 -0
  83. package/build/features/connectExpress/screens/NIDMissed/NID.d.ts +5 -0
  84. package/build/features/connectExpress/screens/NIDMissed/NID.js +59 -0
  85. package/build/features/connectExpress/screens/NIDMissed/index.d.ts +3 -0
  86. package/build/features/connectExpress/screens/NIDMissed/index.js +2 -0
  87. package/build/features/connectExpress/screens/NIDMissed/validation.d.ts +11 -0
  88. package/build/features/connectExpress/screens/NIDMissed/validation.js +9 -0
  89. package/build/features/connectExpress/screens/OTP/OTP.js +10 -6
  90. package/build/features/connectExpress/screens/OTP/OTPInput.js +7 -6
  91. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.d.ts +3 -0
  92. package/build/features/connectExpress/screens/SuccessWithFlowButtons/SuccessWithFlowButtons.js +119 -0
  93. package/build/features/connectExpress/screens/SuccessWithFlowButtons/index.d.ts +2 -0
  94. package/build/features/connectExpress/screens/SuccessWithFlowButtons/index.js +2 -0
  95. package/build/features/connectExpress/screens/VerifyPACI/VerifyPACI.js +7 -68
  96. package/build/features/featuresScreens.js +40 -0
  97. package/build/features/shared/FlowButtons/FlowButtons.d.ts +4 -0
  98. package/build/features/shared/FlowButtons/FlowButtons.js +6 -0
  99. package/build/features/shared/FlowButtons/index.d.ts +2 -0
  100. package/build/features/shared/FlowButtons/index.js +2 -0
  101. package/package.json +1 -1
@@ -0,0 +1,52 @@
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 * as React from 'react';
14
+ import { useTranslation } from 'react-i18next';
15
+ import { useController, useFormContext } from 'react-hook-form';
16
+ import { CR_NUMBER_LENGTH, FL_NUMBER_LENGTH, KW_MAX_LICENSE_LENGTH, KW_MIN_LICENSE_LENGTH } from '../../../../constants';
17
+ import { removeAllOtherThanCharsAndNumber, isSA } from '../../../../utils';
18
+ import ScreenContainer from '../../../shared/Containers/ScreenContainer';
19
+ import ClearIcon from '../../../shared/ClearIcon';
20
+ import CheckIcon from '../../../shared/CheckIcon';
21
+ import Input from '../../../shared/Input';
22
+ import Collapse from '../../../../components/Collapse';
23
+ import { BusinessType } from '../../../../@types';
24
+ import { useAppSelector } from '../../../../hooks';
25
+ import { settingsSelector } from '../../../../app/settings';
26
+ var LicenseNumber = function (_a) {
27
+ var _b;
28
+ var show = _a.show, readOnly = _a.readOnly;
29
+ var t = useTranslation().t;
30
+ var _c = useFormContext(), control = _c.control, watch = _c.watch, getValues = _c.getValues;
31
+ var licenseNumberControl = useController({ control: control, name: 'licenseNumber' });
32
+ var settingsData = useAppSelector(settingsSelector).data;
33
+ var isSACountry = React.useMemo(function () { return isSA(settingsData.businessCountry.iso2); }, [settingsData.businessCountry.iso2]);
34
+ var selectedLicense = !isSACountry ? watch('selectedLicense') : getValues('selectedLicense');
35
+ var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
36
+ var handleFLNumberChange = function (_a) {
37
+ var target = _a.target;
38
+ var value = removeAllOtherThanCharsAndNumber(target.value);
39
+ licenseNumberControl.field.onChange(value);
40
+ };
41
+ var clearLicenseNumber = function () {
42
+ licenseNumberControl.field.onChange('');
43
+ };
44
+ var licenseNumberValue = licenseNumberControl.field.value;
45
+ var error = (_b = licenseNumberControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
46
+ var length = !isSACountry ? KW_MAX_LICENSE_LENGTH : isCR ? CR_NUMBER_LENGTH : FL_NUMBER_LENGTH;
47
+ var minLength = !isSACountry ? KW_MIN_LICENSE_LENGTH : length;
48
+ var label = isCR ? 'cr_number' : 'fl_number';
49
+ var showCheckIcon = !isSACountry ? (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) >= minLength : (licenseNumberValue === null || licenseNumberValue === void 0 ? void 0 : licenseNumberValue.length) === length;
50
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(Input, { readOnly: readOnly, label: t(label), required: !isSACountry, onChange: handleFLNumberChange, inputProps: { maxLength: length }, value: licenseNumberValue, endAdornment: showCheckIcon ? _jsx(CheckIcon, {}) : licenseNumberValue && _jsx(ClearIcon, { onClick: clearLicenseNumber }), placeholder: isCR ? t('cr_number_hint') : t('fl_number_hint'), warningType: 'alert', warningMessage: error && t(error, { length: minLength }) }) }) })));
51
+ };
52
+ export default React.memo(LicenseNumber);
@@ -0,0 +1,34 @@
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" | "success" | "info" | "primary" | "secondary" | "action" | "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" | "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" | "key" | "id" | "lang" | "tabIndex" | "role" | "children" | "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" | "end" | "values" | "local" | "x" | "y" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "origin" | "method" | "spacing" | "elevation" | "in" | "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" | "fr" | "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" | "mode" | "numOctaves" | "operator" | "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" | "success" | "info" | "primary" | "secondary" | "action" | "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" | "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" | "key" | "id" | "lang" | "tabIndex" | "role" | "children" | "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" | "end" | "values" | "local" | "x" | "y" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "origin" | "method" | "spacing" | "elevation" | "in" | "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" | "fr" | "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" | "mode" | "numOctaves" | "operator" | "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 type LicenseTypeProps = {
31
+ show: boolean;
32
+ };
33
+ declare const LicenseType: ({ show }: LicenseTypeProps) => JSX.Element;
34
+ export default LicenseType;
@@ -0,0 +1,94 @@
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 Collapse from '../../../../components/Collapse';
18
+ import { useTranslation } from 'react-i18next';
19
+ import { useController, useFormContext } from 'react-hook-form';
20
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
21
+ import { BusinessType } from '../../../../@types';
22
+ import { OTHER_CR_LICENSE, OTHER_FL_LICENSE } from '../../../../constants';
23
+ import Text from '../../../../components/Text';
24
+ import RadioGroup from '../../../../components/RadioGroup';
25
+ import RadioLabel from '../../../../components/RadioLabel';
26
+ import Tooltip from '../../../../components/Tooltip';
27
+ import Radio from '../../../../components/Radio';
28
+ import { ScreenContainer } from '../../../shared/Containers';
29
+ import Mandatory from '../../../shared/Mandatory';
30
+ import { connectExpressSelector, clearError } from '../../../app/connectExpress/connectExpressStore';
31
+ var LabelTextStyled = styled(Text)(function (_a) {
32
+ var theme = _a.theme;
33
+ return (__assign(__assign({}, theme.typography.caption), { color: alpha(theme.palette.text.primary, 0.6), marginBlockEnd: theme.spacing(0.625) }));
34
+ });
35
+ var RadioGroupStyled = styled(RadioGroup)(function (_a) {
36
+ var theme = _a.theme;
37
+ return ({
38
+ marginInlineStart: theme.spacing(0.25)
39
+ });
40
+ });
41
+ var RadioStyled = styled(Radio)(function (_a) {
42
+ var theme = _a.theme;
43
+ return ({
44
+ '& .MuiSvgIcon-root': {
45
+ fontSize: theme.spacing(2.25),
46
+ width: theme.spacing(2.25),
47
+ height: theme.spacing(2.25)
48
+ }
49
+ });
50
+ });
51
+ var LabelStyled = styled('span')(function () { return ({
52
+ display: 'inline-flex',
53
+ alignItems: 'center'
54
+ }); });
55
+ export var InfoIconStyled = styled(InfoIcon)(function (_a) {
56
+ var theme = _a.theme;
57
+ return ({
58
+ width: theme.spacing(2.75),
59
+ height: theme.spacing(2.125),
60
+ cursor: 'pointer',
61
+ color: alpha(theme.palette.text.primary, 0.4),
62
+ display: 'inline-flex'
63
+ });
64
+ });
65
+ export var InfoOutlinedIconStyled = styled(InfoOutlinedIcon)(function (_a) {
66
+ var theme = _a.theme;
67
+ return ({
68
+ width: theme.spacing(2.75),
69
+ height: theme.spacing(2.125),
70
+ cursor: 'pointer',
71
+ color: alpha(theme.palette.text.primary, 0.4),
72
+ display: 'inline-flex'
73
+ });
74
+ });
75
+ var LicenseType = function (_a) {
76
+ var show = _a.show;
77
+ var t = useTranslation().t;
78
+ var control = useFormContext().control;
79
+ var error = useAppSelector(connectExpressSelector).error;
80
+ var _b = React.useState(false), isCRHovered = _b[0], setIsCRHovered = _b[1];
81
+ var _c = React.useState(false), isFLHovered = _c[0], setIsFLHovered = _c[1];
82
+ var selectedLicenseControl = useController({ control: control, name: 'selectedLicense' });
83
+ var dispatch = useAppDispatch();
84
+ var handleOnChange = function (_a) {
85
+ var target = _a.target;
86
+ if (error)
87
+ dispatch(clearError());
88
+ selectedLicenseControl.field.onChange(target.value === BusinessType.FL ? OTHER_FL_LICENSE : OTHER_CR_LICENSE);
89
+ };
90
+ var selectedLicenseValue = selectedLicenseControl.field.value;
91
+ var isFL = (selectedLicenseValue === null || selectedLicenseValue === void 0 ? void 0 : selectedLicenseValue.type) === BusinessType.FL;
92
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: { pb: isFL ? 9.5 : 1.5, pl: 2.5, pr: 2.5 } }, { children: [_jsxs(LabelTextStyled, { children: [t('signup_business_type_label'), _jsx(Mandatory, {})] }), _jsxs(RadioGroupStyled, __assign({ value: selectedLicenseValue != null ? ((selectedLicenseValue === null || selectedLicenseValue === void 0 ? void 0 : selectedLicenseValue.type) === BusinessType.FL ? BusinessType.FL : BusinessType.CR) : false, onChange: handleOnChange }, { children: [_jsx(RadioLabel, { value: BusinessType.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: BusinessType.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 }) })] }))] })) })));
93
+ };
94
+ export default LicenseType;
@@ -0,0 +1,3 @@
1
+ import CollectBusinessInfo, { CollectBusinessInfoProps } from './CollectBusinessInfo';
2
+ export type { CollectBusinessInfoProps };
3
+ export default CollectBusinessInfo;
@@ -0,0 +1,2 @@
1
+ import CollectBusinessInfo from './CollectBusinessInfo';
2
+ export default CollectBusinessInfo;
@@ -0,0 +1,27 @@
1
+ import * as yup from 'yup';
2
+ export declare const BusinessDataSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
3
+ brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
4
+ selectedLicense: any;
5
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
6
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
7
+ brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
8
+ selectedLicense: any;
9
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
10
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
11
+ brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
12
+ selectedLicense: any;
13
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
14
+ }>>>;
15
+ export declare const KWBusinessDataSchema: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
16
+ brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
17
+ selectedLicense: any;
18
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
19
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
20
+ brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
21
+ selectedLicense: any;
22
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
23
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
24
+ brandName: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
25
+ selectedLicense: any;
26
+ licenseNumber: import("yup/lib/string").RequiredStringSchema<string | undefined, import("yup/lib/types").AnyObject>;
27
+ }>>>;
@@ -0,0 +1,79 @@
1
+ import * as yup from 'yup';
2
+ import { REGEX_BRAND_NAME, KW_MIN_LICENSE_LENGTH, FL_MIN_LICENSE_LENGTH, CR_MIN_LICENSE_LENGTH } from '../../../../constants';
3
+ import { BusinessType } from '../../../../@types';
4
+ var objectElements = {
5
+ legal_name: yup.object().shape({
6
+ ar: yup.string(),
7
+ en: yup.string()
8
+ }),
9
+ license: yup.object().shape({
10
+ number: yup.string()
11
+ }),
12
+ type: yup.string()
13
+ };
14
+ export var BusinessDataSchema = yup.object().shape({
15
+ brandName: yup
16
+ .string()
17
+ .test({
18
+ test: function (value) {
19
+ if ((value === null || value === void 0 ? void 0 : value.length) === 0)
20
+ return true;
21
+ if (value && value.length >= 3 && (value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME)))
22
+ return true;
23
+ return this.createError({ message: 'enter_brand_name_english_chars_numbers_space' });
24
+ }
25
+ })
26
+ .required('enter_brand_name_english_chars_numbers_space'),
27
+ selectedLicense: yup.object().shape(objectElements).required(''),
28
+ licenseNumber: yup
29
+ .string()
30
+ .test({
31
+ test: function (value) {
32
+ var selectedLicense = this.parent.selectedLicense;
33
+ var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
34
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
35
+ if (length === 0)
36
+ return true;
37
+ if (isCR) {
38
+ return length > CR_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_max_length' });
39
+ }
40
+ return length > FL_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'fl_max_length' });
41
+ }
42
+ })
43
+ .required('')
44
+ });
45
+ export var KWBusinessDataSchema = yup.object().shape({
46
+ brandName: yup
47
+ .string()
48
+ .test({
49
+ test: function (value) {
50
+ if ((value === null || value === void 0 ? void 0 : value.length) === 0)
51
+ return true;
52
+ if (value && value.length >= 3 && (value === null || value === void 0 ? void 0 : value.match(REGEX_BRAND_NAME)))
53
+ return true;
54
+ return this.createError({ message: 'enter_brand_name_english_chars_numbers_space' });
55
+ }
56
+ })
57
+ .required('enter_brand_name_english_chars_numbers_space'),
58
+ selectedLicense: yup.object().shape(objectElements).required(''),
59
+ licenseNumber: yup
60
+ .string()
61
+ .when('selectedLicense', function (selectedLicense) {
62
+ var isCR = (selectedLicense === null || selectedLicense === void 0 ? void 0 : selectedLicense.type) === BusinessType.CR;
63
+ if (!isCR) {
64
+ return yup.string().optional();
65
+ }
66
+ return yup
67
+ .string()
68
+ .required('')
69
+ .test({
70
+ test: function (value) {
71
+ var length = (value === null || value === void 0 ? void 0 : value.length) || 0;
72
+ if (length === 0)
73
+ return true;
74
+ return length >= KW_MIN_LICENSE_LENGTH ? true : this.createError({ message: 'cr_kw_max_length' });
75
+ }
76
+ });
77
+ })
78
+ .required('')
79
+ });
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface CollectIndividualInfoProps {
3
+ }
4
+ declare const _default: React.MemoExoticComponent<({}: CollectIndividualInfoProps) => JSX.Element>;
5
+ export default _default;
@@ -0,0 +1,89 @@
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 { useTranslation } from 'react-i18next';
15
+ import { useForm, FormProvider } from 'react-hook-form';
16
+ import { yupResolver } from '@hookform/resolvers/yup';
17
+ import { styled } from '@mui/material/styles';
18
+ import { useAppDispatch, useAppSelector, useSetFromDefaultValues } from '../../../../hooks';
19
+ import { AuthForType } from '../../../../@types';
20
+ import { useLanguage } from '../../../../hooks';
21
+ import { isKW } from '../../../../utils';
22
+ import { countriesCode } from '../../../../constants';
23
+ import { handlePrevScreenStep, settingsSelector } from '../../../../app/settings';
24
+ import Form from '../../../../components/Form';
25
+ import Collapse from '../../../../components/Collapse';
26
+ import Button from '../../../shared/Button';
27
+ import { ScreenContainer } from '../../../shared/Containers';
28
+ import { clearError, connectExpressSelector, resetIndividualScreen, updateLeadIndividualAsync } from '../../../app/connectExpress/connectExpressStore';
29
+ import MobileNumber from './MobileNumber';
30
+ import Email from './Email';
31
+ import Name from './Name';
32
+ import { CollectIndividualInfoValidation } from './validation';
33
+ var FormStyled = styled(Form)(function () { return ({
34
+ display: 'flex',
35
+ flexDirection: 'column',
36
+ minHeight: '240px',
37
+ justifyContent: 'space-between'
38
+ }); });
39
+ var CollectIndividualInfo = function (_a) {
40
+ var _b = React.useState(false), listActive = _b[0], setListActive = _b[1];
41
+ var _c = React.useState(false), emailChecking = _c[0], setEmailChecking = _c[1];
42
+ var settingsData = useAppSelector(settingsSelector).data;
43
+ var _d = useAppSelector(connectExpressSelector), data = _d.data, loading = _d.loading, error = _d.error;
44
+ var dispatch = useAppDispatch();
45
+ var t = useTranslation().t;
46
+ var isAr = useLanguage().isAr;
47
+ var individualData = data.individualData, otpData = data.otpData, responseData = data.responseData;
48
+ var startWithNID = otpData.authFor === AuthForType.NATIONAL_ID;
49
+ var contact = ((responseData === null || responseData === void 0 ? void 0 : responseData.leadData) || {}).contact;
50
+ var countryCode = individualData.countryCode;
51
+ var isEmailAvailable = (responseData || {}).isEmailAvailable;
52
+ var methods = useForm({
53
+ resolver: yupResolver(CollectIndividualInfoValidation),
54
+ defaultValues: individualData,
55
+ mode: 'onChange'
56
+ });
57
+ useSetFromDefaultValues(methods, individualData, true);
58
+ React.useEffect(function () {
59
+ if (countryCode.iso2 !== methods.getValues('countryCode.iso2'))
60
+ methods.setValue('countryCode', countryCode);
61
+ }, [countryCode]);
62
+ var onSubmit = function (formData) {
63
+ dispatch(updateLeadIndividualAsync(formData));
64
+ };
65
+ var onBack = function () {
66
+ var _a;
67
+ dispatch(resetIndividualScreen());
68
+ var code = (_a = settingsData.businessCountry) === null || _a === void 0 ? void 0 : _a.iso2;
69
+ var screen = startWithNID ? (isKW(code) ? 'CONNECT_EXPRESS_CIVIL_ID_STEP' : 'CONNECT_EXPRESS_NID_STEP') : 'CONNECT_EXPRESS_MOBILE_STEP';
70
+ dispatch(handlePrevScreenStep(screen));
71
+ };
72
+ React.useEffect(function () {
73
+ if (error)
74
+ dispatch(clearError());
75
+ }, [methods.formState.isValid]);
76
+ var handleMenuListClick = function () {
77
+ setListActive(!listActive);
78
+ };
79
+ React.useEffect(function () {
80
+ if (isEmailAvailable === false)
81
+ methods.setError('email', { message: 'tap_js_email_already_exist' });
82
+ }, [responseData]);
83
+ var isLeadEmailAvailable = (contact === null || contact === void 0 ? void 0 : contact.email) === methods.watch('email');
84
+ var isEmailValid = typeof isEmailAvailable === 'undefined' ? isLeadEmailAvailable : isEmailAvailable;
85
+ var emailErrChecks = !methods.formState.isValid || !!methods.formState.errors.email || !!error;
86
+ var disabled = emailErrChecks || emailChecking || !isEmailValid;
87
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(FormStyled, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(Name, { show: !listActive }), _jsx(MobileNumber, { show: true, onListOpen: function () { return handleMenuListClick(); }, onListClose: function () { return handleMenuListClick(); }, countries: countriesCode }), _jsx(Email, { show: !listActive, fetchingEmail: function (v) { return setEmailChecking(v); }, emailChecking: emailChecking }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, loading: loading, error: t(error || '') }, { children: t('next') })) }))] })) })) }));
88
+ };
89
+ export default React.memo(CollectIndividualInfo);
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ export interface EmailProps {
3
+ show: boolean;
4
+ fetchingEmail: (flag: boolean) => void;
5
+ emailChecking: boolean;
6
+ }
7
+ declare const _default: React.MemoExoticComponent<({ show, fetchingEmail, emailChecking }: EmailProps) => JSX.Element>;
8
+ export default _default;
@@ -0,0 +1,113 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { jsx as _jsx } from "react/jsx-runtime";
49
+ import * as React from 'react';
50
+ import { useTranslation } from 'react-i18next';
51
+ import { debounce } from 'lodash-es';
52
+ import { useController, useFormContext } from 'react-hook-form';
53
+ import axios from 'axios';
54
+ import { styled } from '@mui/material/styles';
55
+ import CircularProgress from '@mui/material/CircularProgress';
56
+ import { useAppDispatch, useAppSelector } from '../../../../hooks';
57
+ import Collapse from '../../../../components/Collapse';
58
+ import { ScreenContainer } from '../../../shared/Containers';
59
+ import Input from '../../../shared/Input';
60
+ import ClearIcon from '../../../shared/ClearIcon';
61
+ import CheckIcon from '../../../shared/CheckIcon';
62
+ import { checkEmailAvailabilityAsync, connectExpressSelector } from '../../../app/connectExpress/connectExpressStore';
63
+ var InputStyled = styled(Input)(function () { return ({
64
+ input: {
65
+ textTransform: 'lowercase'
66
+ }
67
+ }); });
68
+ var cancelToken = null;
69
+ var Email = function (_a) {
70
+ var _b;
71
+ var show = _a.show, fetchingEmail = _a.fetchingEmail, emailChecking = _a.emailChecking;
72
+ var _c = React.useState(''), storedEmail = _c[0], setStoredEmail = _c[1];
73
+ var dispatch = useAppDispatch();
74
+ var data = useAppSelector(connectExpressSelector).data;
75
+ var t = useTranslation().t;
76
+ var control = useFormContext().control;
77
+ var emailControl = useController({ name: 'email', control: control });
78
+ var emailValue = emailControl.field.value;
79
+ var error = (_b = emailControl.fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
80
+ var checkEmail = debounce(function (value) { return __awaiter(void 0, void 0, void 0, function () {
81
+ var onSuccess;
82
+ return __generator(this, function (_a) {
83
+ if (cancelToken) {
84
+ cancelToken.cancel('Aborted');
85
+ }
86
+ cancelToken = axios.CancelToken.source();
87
+ onSuccess = function () { return fetchingEmail(false); };
88
+ dispatch(checkEmailAvailabilityAsync({ email: value, cancelToken: cancelToken.token, onSuccess: onSuccess }));
89
+ return [2];
90
+ });
91
+ }); }, 500);
92
+ var handleEmailChange = function (event) {
93
+ emailControl.field.onChange(event.target.value);
94
+ };
95
+ React.useEffect(function () {
96
+ var _a, _b, _c;
97
+ var email = (_c = (_b = (_a = data.responseData) === null || _a === void 0 ? void 0 : _a.leadData) === null || _b === void 0 ? void 0 : _b.contact) === null || _c === void 0 ? void 0 : _c.email;
98
+ if (!!email)
99
+ setStoredEmail(email);
100
+ }, [data.responseData]);
101
+ React.useEffect(function () {
102
+ var isValid = emailValue && !error && emailValue.length > 3;
103
+ if (isValid && emailValue != storedEmail) {
104
+ fetchingEmail(true);
105
+ checkEmail(emailValue);
106
+ }
107
+ }, [emailValue, error]);
108
+ var clearNumber = function () {
109
+ emailControl.field.onChange('');
110
+ };
111
+ return (_jsx(Collapse, __assign({ in: show }, { children: _jsx(ScreenContainer, { children: _jsx(InputStyled, { label: t('signup_email_lable'), value: emailValue, onEnterPressed: function (e) { return e.preventDefault(); }, onChange: handleEmailChange, type: 'email', placeholder: t('signup_email_placeholder'), warningType: 'alert', warningMessage: error && t(error), endAdornment: emailChecking ? (_jsx(CircularProgress, { size: 25, thickness: 5, sx: { height: 'auto !important' } })) : !error && emailValue ? (_jsx(CheckIcon, {})) : (emailValue && _jsx(ClearIcon, { onClick: clearNumber })) }) }) })));
112
+ };
113
+ export default React.memo(Email);
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { CountryCode } from '../../../../@types';
3
+ interface MobileNumberProps {
4
+ countries: Array<CountryCode>;
5
+ show: boolean;
6
+ onListOpen?: () => void;
7
+ onListClose?: () => void;
8
+ }
9
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<MobileNumberProps & React.RefAttributes<unknown>>>;
10
+ export default _default;