@sikka/hawa 0.46.4-next → 0.48.0-next
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/dist/{Radio-Dyvlywnk.d.mts → Radio-BPHTeDMz.d.mts} +8 -7
- package/dist/{Radio-DlPwVCG4.d.ts → Radio-cRcIH8_L.d.ts} +8 -7
- package/dist/blocks/auth/index.d.mts +34 -17
- package/dist/blocks/auth/index.d.ts +34 -17
- package/dist/blocks/auth/index.js +1008 -430
- package/dist/blocks/auth/index.mjs +427 -297
- package/dist/blocks/feedback/index.d.mts +1 -1
- package/dist/blocks/feedback/index.d.ts +1 -1
- package/dist/blocks/feedback/index.js +68 -79
- package/dist/blocks/feedback/index.mjs +1 -1
- package/dist/blocks/index.d.mts +28 -11
- package/dist/blocks/index.d.ts +28 -11
- package/dist/blocks/index.js +2340 -2233
- package/dist/blocks/index.mjs +407 -269
- package/dist/blocks/misc/index.d.mts +1 -1
- package/dist/blocks/misc/index.d.ts +1 -1
- package/dist/blocks/misc/index.js +68 -79
- package/dist/blocks/misc/index.mjs +50 -367
- package/dist/blocks/pricing/index.d.mts +1 -1
- package/dist/blocks/pricing/index.d.ts +1 -1
- package/dist/blocks/pricing/index.mjs +1 -1
- package/dist/{chunk-6TG2PHZK.mjs → chunk-AWJSHOYU.mjs} +68 -79
- package/dist/{chunk-5CTMGPEF.mjs → chunk-GBLWUEYN.mjs} +650 -674
- package/dist/chunk-JFWD2ICY.mjs +511 -0
- package/dist/elements/index.d.mts +2 -2
- package/dist/elements/index.d.ts +2 -2
- package/dist/elements/index.js +81 -105
- package/dist/elements/index.mjs +1 -1
- package/dist/index.css +7 -0
- package/dist/index.d.mts +36 -17
- package/dist/index.d.ts +36 -17
- package/dist/index.js +482 -373
- package/dist/index.mjs +487 -373
- package/dist/phoneInput/index.d.mts +7 -7
- package/dist/phoneInput/index.d.ts +7 -7
- package/dist/phoneInput/index.js +78 -85
- package/dist/phoneInput/index.js.map +1 -1
- package/dist/phoneInput/index.mjs +78 -85
- package/dist/phoneInput/index.mjs.map +1 -1
- package/dist/pinInput/index.js +3 -20
- package/dist/pinInput/index.js.map +1 -1
- package/dist/pinInput/index.mjs +3 -20
- package/dist/pinInput/index.mjs.map +1 -1
- package/dist/select/index.d.mts +1 -0
- package/dist/select/index.d.ts +1 -0
- package/dist/select/index.js +68 -79
- package/dist/select/index.js.map +1 -1
- package/dist/select/index.mjs +68 -79
- package/dist/select/index.mjs.map +1 -1
- package/dist/{textTypes-DXLtO2fL.d.mts → textTypes-CYQYIsFt.d.mts} +1 -0
- package/dist/{textTypes-DXLtO2fL.d.ts → textTypes-CYQYIsFt.d.ts} +1 -0
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/chunk-EOH6A3GR.mjs +0 -183
package/dist/index.js
CHANGED
@@ -5790,6 +5790,7 @@ var import_clsx3 = __toESM(require("clsx"));
|
|
5790
5790
|
var Select = ({
|
5791
5791
|
labelProps,
|
5792
5792
|
labelKey = "label",
|
5793
|
+
valueKey = "value",
|
5793
5794
|
...props
|
5794
5795
|
}) => {
|
5795
5796
|
const NoOption = () => {
|
@@ -5809,13 +5810,7 @@ var Select = ({
|
|
5809
5810
|
children
|
5810
5811
|
);
|
5811
5812
|
};
|
5812
|
-
const Option = ({
|
5813
|
-
children,
|
5814
|
-
innerProps,
|
5815
|
-
innerRef,
|
5816
|
-
isFocused,
|
5817
|
-
isSelected
|
5818
|
-
}) => {
|
5813
|
+
const Option = ({ children, innerProps, innerRef, isFocused, isSelected }) => {
|
5819
5814
|
return /* @__PURE__ */ import_react35.default.createElement(
|
5820
5815
|
"div",
|
5821
5816
|
{
|
@@ -5830,14 +5825,7 @@ var Select = ({
|
|
5830
5825
|
children
|
5831
5826
|
);
|
5832
5827
|
};
|
5833
|
-
const Menu2 = ({
|
5834
|
-
cx,
|
5835
|
-
children,
|
5836
|
-
getStyles,
|
5837
|
-
innerProps,
|
5838
|
-
innerRef,
|
5839
|
-
...menuProps
|
5840
|
-
}) => {
|
5828
|
+
const Menu2 = ({ cx, children, getStyles, innerProps, innerRef, ...menuProps }) => {
|
5841
5829
|
const menuOpen = menuProps.selectProps.menuIsOpen;
|
5842
5830
|
return /* @__PURE__ */ import_react35.default.createElement(
|
5843
5831
|
"div",
|
@@ -5866,71 +5854,72 @@ var Select = ({
|
|
5866
5854
|
)
|
5867
5855
|
},
|
5868
5856
|
props.label && /* @__PURE__ */ import_react35.default.createElement(Label2, { ...labelProps }, props.label),
|
5869
|
-
props.isLoading ? /* @__PURE__ */ import_react35.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" }) : !props.isCreatable ? (
|
5870
|
-
|
5871
|
-
|
5872
|
-
|
5873
|
-
{
|
5874
|
-
|
5875
|
-
|
5876
|
-
|
5877
|
-
|
5878
|
-
|
5879
|
-
|
5880
|
-
|
5881
|
-
|
5882
|
-
|
5883
|
-
|
5884
|
-
|
5885
|
-
|
5886
|
-
|
5887
|
-
|
5888
|
-
|
5889
|
-
|
5890
|
-
|
5891
|
-
|
5892
|
-
|
5893
|
-
|
5894
|
-
|
5895
|
-
props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
|
5896
|
-
props.disabled && "hawa-opacity-30"
|
5897
|
-
)
|
5898
|
-
},
|
5899
|
-
unstyled: true,
|
5900
|
-
autoFocus: false,
|
5901
|
-
components: props.hideIndicator ? { Option, Menu: Menu2, IndicatorsContainer: () => null } : {
|
5857
|
+
props.isLoading ? /* @__PURE__ */ import_react35.default.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" }) : !props.isCreatable ? /* @__PURE__ */ import_react35.default.createElement(
|
5858
|
+
import_react_select.default,
|
5859
|
+
{
|
5860
|
+
noOptionsMessage: NoOption,
|
5861
|
+
classNames: {
|
5862
|
+
control: () => cn(props.phoneCode && "hawa-rounded-r-none", props.controlClassNames),
|
5863
|
+
container: () => cn(
|
5864
|
+
selectContainerStyles,
|
5865
|
+
props.phoneCode && phoneCodeStyles,
|
5866
|
+
props.isMulti && "hawa-ps-0 "
|
5867
|
+
),
|
5868
|
+
placeholder: () => cn(selectPlaceholderStyles, props.disabled && "hawa-text-muted-foreground"),
|
5869
|
+
valueContainer: () => "hawa-text-foreground hawa-px-1",
|
5870
|
+
singleValue: () => cn(
|
5871
|
+
props.disabled ? "hawa-text-muted-foreground hawa-opacity-30" : "hawa-text-foreground"
|
5872
|
+
),
|
5873
|
+
indicatorsContainer: () => cn(
|
5874
|
+
selectIndicatorContainerStyles,
|
5875
|
+
props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
|
5876
|
+
props.disabled && "hawa-opacity-30"
|
5877
|
+
)
|
5878
|
+
},
|
5879
|
+
unstyled: true,
|
5880
|
+
autoFocus: false,
|
5881
|
+
components: props.hideIndicator ? {
|
5882
|
+
Option: (optionProps) => /* @__PURE__ */ import_react35.default.createElement(
|
5902
5883
|
Option,
|
5903
|
-
|
5904
|
-
|
5905
|
-
|
5906
|
-
|
5907
|
-
|
5908
|
-
|
5909
|
-
|
5910
|
-
|
5911
|
-
|
5912
|
-
|
5913
|
-
|
5914
|
-
|
5915
|
-
|
5916
|
-
|
5917
|
-
className
|
5918
|
-
|
5919
|
-
|
5920
|
-
|
5921
|
-
|
5922
|
-
|
5923
|
-
|
5924
|
-
|
5925
|
-
|
5926
|
-
|
5927
|
-
|
5928
|
-
|
5929
|
-
|
5930
|
-
|
5931
|
-
|
5932
|
-
|
5933
|
-
|
5884
|
+
{
|
5885
|
+
...optionProps,
|
5886
|
+
isSelected: optionProps.data[valueKey] === props.value[valueKey]
|
5887
|
+
}
|
5888
|
+
),
|
5889
|
+
Menu: Menu2,
|
5890
|
+
IndicatorsContainer: () => null
|
5891
|
+
} : {
|
5892
|
+
Option,
|
5893
|
+
Menu: Menu2,
|
5894
|
+
ValueContainer: (e) => /* @__PURE__ */ import_react35.default.createElement(
|
5895
|
+
"div",
|
5896
|
+
{
|
5897
|
+
className: cn(
|
5898
|
+
e.className,
|
5899
|
+
"hawa-gap-1 hawa-flex hawa-flex-row hawa-flex-wrap hawa-p-2 hawa-w-full hawa-cursor-pointer"
|
5900
|
+
),
|
5901
|
+
...e
|
5902
|
+
}
|
5903
|
+
),
|
5904
|
+
MultiValueContainer: (e) => /* @__PURE__ */ import_react35.default.createElement(
|
5905
|
+
"div",
|
5906
|
+
{
|
5907
|
+
className: "hawa-rounded hawa-border hawa-p-1 hawa-px-2 hawa-flex hawa-flex-row",
|
5908
|
+
...e
|
5909
|
+
}
|
5910
|
+
)
|
5911
|
+
},
|
5912
|
+
onChange: (newValue, action) => props.onChange(newValue, action),
|
5913
|
+
options: props.options,
|
5914
|
+
getOptionLabel: props.getOptionLabel,
|
5915
|
+
defaultValue: props.defaultValue,
|
5916
|
+
value: props.value,
|
5917
|
+
placeholder: props.placeholder,
|
5918
|
+
isDisabled: props.disabled,
|
5919
|
+
isClearable: props.isClearable,
|
5920
|
+
isMulti: props.isMulti,
|
5921
|
+
isSearchable: props.isSearchable
|
5922
|
+
}
|
5934
5923
|
) : /* @__PURE__ */ import_react35.default.createElement(
|
5935
5924
|
import_creatable.default,
|
5936
5925
|
{
|
@@ -7920,11 +7909,13 @@ var PhoneInput = ({
|
|
7920
7909
|
countryCodes,
|
7921
7910
|
...props
|
7922
7911
|
}) => {
|
7912
|
+
var _a;
|
7923
7913
|
const [phoneNumber, setPhoneNumber] = (0, import_react39.useState)("");
|
7924
|
-
const [countryCode, setCountryCode] = (0, import_react39.useState)(
|
7914
|
+
const [countryCode, setCountryCode] = (0, import_react39.useState)(
|
7915
|
+
props.preferredCountry || { label: "+966" }
|
7916
|
+
);
|
7925
7917
|
const inputRef = (0, import_react39.useRef)(null);
|
7926
7918
|
const handleInputChange = (e) => {
|
7927
|
-
console.log("test e ", e.target.value);
|
7928
7919
|
const validChars = /^[0-9-()]+$/;
|
7929
7920
|
const input = e.target.value;
|
7930
7921
|
if (input === "" || validChars.test(input)) {
|
@@ -7946,11 +7937,13 @@ var PhoneInput = ({
|
|
7946
7937
|
isMulti: false,
|
7947
7938
|
isSearchable: true,
|
7948
7939
|
isClearable: false,
|
7949
|
-
placeholder:
|
7940
|
+
placeholder: (_a = props.preferredCountry) == null ? void 0 : _a.label,
|
7950
7941
|
options: countryCodes || countries_default,
|
7951
|
-
onChange: setCountryCode,
|
7952
|
-
|
7953
|
-
|
7942
|
+
onChange: (e) => setCountryCode({ label: e.label, value: e.label }),
|
7943
|
+
valueKey: "label",
|
7944
|
+
labelKey: "label",
|
7945
|
+
value: { label: countryCode == null ? void 0 : countryCode.label, value: countryCode == null ? void 0 : countryCode.label },
|
7946
|
+
defaultValue: { label: countryCode == null ? void 0 : countryCode.label, value: countryCode == null ? void 0 : countryCode.label }
|
7954
7947
|
}
|
7955
7948
|
), /* @__PURE__ */ import_react39.default.createElement("div", { className: "hawa-relative hawa-flex hawa-h-fit hawa-w-full hawa-flex-col hawa-justify-center hawa-gap-0" }, /* @__PURE__ */ import_react39.default.createElement(
|
7956
7949
|
"input",
|
@@ -8063,14 +8056,7 @@ var PinInputRoot = React50.forwardRef(({ className, containerClassName, ...props
|
|
8063
8056
|
}
|
8064
8057
|
));
|
8065
8058
|
PinInputRoot.displayName = "PinInputRoot";
|
8066
|
-
var PinInputGroup = React50.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React50.createElement(
|
8067
|
-
"div",
|
8068
|
-
{
|
8069
|
-
ref,
|
8070
|
-
className: cn("hawa-flex hawa-items-center", className),
|
8071
|
-
...props
|
8072
|
-
}
|
8073
|
-
));
|
8059
|
+
var PinInputGroup = React50.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React50.createElement("div", { ref, className: cn("hawa-flex hawa-items-center", className), ...props }));
|
8074
8060
|
PinInputGroup.displayName = "PinInputGroup";
|
8075
8061
|
var PinInputSlot = React50.forwardRef(({ index, className, ...props }, ref) => {
|
8076
8062
|
const pinInputContext = React50.useContext(import_input_otp.OTPInputContext);
|
@@ -8093,22 +8079,12 @@ var PinInputSlot = React50.forwardRef(({ index, className, ...props }, ref) => {
|
|
8093
8079
|
PinInputSlot.displayName = "PinInputSlot";
|
8094
8080
|
var PinInputSeperator = React50.forwardRef(({ ...props }, ref) => /* @__PURE__ */ React50.createElement("div", { ref, role: "separator", ...props }, /* @__PURE__ */ React50.createElement(Dot, null)));
|
8095
8081
|
PinInputSeperator.displayName = "PinInputSeperator";
|
8096
|
-
var PinInput = ({
|
8097
|
-
separatorPosition = 0,
|
8098
|
-
...props
|
8099
|
-
}) => {
|
8082
|
+
var PinInput = ({ separatorPosition = 0, ...props }) => {
|
8100
8083
|
const maxLength = props.maxLength || 6;
|
8101
8084
|
const clampedSeparatorPosition = Math.min(separatorPosition, maxLength);
|
8102
8085
|
const firstGroupLength = clampedSeparatorPosition > 0 ? clampedSeparatorPosition : 0;
|
8103
8086
|
const secondGroupLength = maxLength - firstGroupLength;
|
8104
|
-
return /* @__PURE__ */ React50.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, /* @__PURE__ */ React50.createElement(PinInputRoot, { ...props }, firstGroupLength > 0 && /* @__PURE__ */ React50.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(firstGroupLength)].map((_, index) => /* @__PURE__ */ React50.createElement(
|
8105
|
-
PinInputSlot,
|
8106
|
-
{
|
8107
|
-
key: index,
|
8108
|
-
index,
|
8109
|
-
className: "hawa-w-full hawa-border"
|
8110
|
-
}
|
8111
|
-
))), separatorPosition > 0 && separatorPosition < props.maxLength && /* @__PURE__ */ React50.createElement(PinInputSeperator, null), secondGroupLength > 0 && /* @__PURE__ */ React50.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(secondGroupLength)].map((_, index) => /* @__PURE__ */ React50.createElement(
|
8087
|
+
return /* @__PURE__ */ React50.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2", dir: "ltr" }, /* @__PURE__ */ React50.createElement(PinInputRoot, { ...props }, firstGroupLength > 0 && /* @__PURE__ */ React50.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(firstGroupLength)].map((_, index) => /* @__PURE__ */ React50.createElement(PinInputSlot, { key: index, index, className: "hawa-w-full hawa-border" }))), separatorPosition > 0 && separatorPosition < props.maxLength && /* @__PURE__ */ React50.createElement(PinInputSeperator, null), secondGroupLength > 0 && /* @__PURE__ */ React50.createElement(PinInputGroup, { className: "hawa-w-full hawa-gap-2" }, [...Array(secondGroupLength)].map((_, index) => /* @__PURE__ */ React50.createElement(
|
8112
8088
|
PinInputSlot,
|
8113
8089
|
{
|
8114
8090
|
key: index + firstGroupLength,
|
@@ -11320,14 +11296,7 @@ var LoginForm = ({
|
|
11320
11296
|
(texts == null ? void 0 : texts.loginText) || "Login"
|
11321
11297
|
),
|
11322
11298
|
props.additionalButtons && props.additionalButtons,
|
11323
|
-
props.allowRegister && /* @__PURE__ */ import_react67.default.createElement("div", { className: "hawa-select-none hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-gray-300" }, (texts == null ? void 0 : texts.newUserText) || "New user?", " ", /* @__PURE__ */ import_react67.default.createElement(
|
11324
|
-
"span",
|
11325
|
-
{
|
11326
|
-
onClick: props.onRouteToRegister,
|
11327
|
-
className: "clickable-link"
|
11328
|
-
},
|
11329
|
-
(texts == null ? void 0 : texts.createAccount) || "Create Account"
|
11330
|
-
))
|
11299
|
+
props.allowRegister && /* @__PURE__ */ import_react67.default.createElement("div", { className: "hawa-select-none hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-gray-300" }, (texts == null ? void 0 : texts.newUserText) || "New user?", " ", /* @__PURE__ */ import_react67.default.createElement("span", { onClick: props.onRouteToRegister, className: "clickable-link" }, (texts == null ? void 0 : texts.createAccount) || "Create Account"))
|
11331
11300
|
)),
|
11332
11301
|
props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react67.default.createElement(
|
11333
11302
|
CardFooter,
|
@@ -11360,6 +11329,7 @@ var LoginForm = ({
|
|
11360
11329
|
var import_react69 = __toESM(require("react"));
|
11361
11330
|
var import_react_hook_form2 = require("react-hook-form");
|
11362
11331
|
var import_zod2 = require("@hookform/resolvers/zod");
|
11332
|
+
var import_libphonenumber_js2 = require("libphonenumber-js");
|
11363
11333
|
var z2 = __toESM(require("zod"));
|
11364
11334
|
var RegisterForm = ({
|
11365
11335
|
texts,
|
@@ -11367,10 +11337,15 @@ var RegisterForm = ({
|
|
11367
11337
|
minPasswordLength = 8,
|
11368
11338
|
showTermsOption = false,
|
11369
11339
|
showNewsletterOption = false,
|
11340
|
+
registerTypes,
|
11370
11341
|
...props
|
11371
11342
|
}) => {
|
11372
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
11343
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
11373
11344
|
const [passwordVisible, setPasswordVisible] = (0, import_react69.useState)(false);
|
11345
|
+
const [selectedRegisterType, setSelectedRegisterType] = (0, import_react69.useState)({
|
11346
|
+
value: ((_a = registerTypes == null ? void 0 : registerTypes[0]) == null ? void 0 : _a.value) || "password",
|
11347
|
+
label: ((_b = registerTypes == null ? void 0 : registerTypes[0]) == null ? void 0 : _b.label) || "Password"
|
11348
|
+
});
|
11374
11349
|
const thirdPartyAuthTexts = {
|
11375
11350
|
continueWithGoogle: texts == null ? void 0 : texts.continueWithGoogle,
|
11376
11351
|
continueWithTwitter: texts == null ? void 0 : texts.continueWithTwitter,
|
@@ -11382,8 +11357,12 @@ var RegisterForm = ({
|
|
11382
11357
|
};
|
11383
11358
|
const methods = (0, import_react_hook_form2.useForm)();
|
11384
11359
|
let fieldSchemas = {};
|
11360
|
+
const hasPhoneType = registerTypes == null ? void 0 : registerTypes.some((type) => type.value === "phone");
|
11361
|
+
if (hasPhoneType && selectedRegisterType.value === "phone") {
|
11362
|
+
registerFields = ["phone"];
|
11363
|
+
}
|
11385
11364
|
registerFields.forEach((field) => {
|
11386
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
11365
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
11387
11366
|
switch (field) {
|
11388
11367
|
case "fullname":
|
11389
11368
|
fieldSchemas["fullName"] = z2.string().optional();
|
@@ -11408,55 +11387,85 @@ var RegisterForm = ({
|
|
11408
11387
|
{ message: ((_g2 = texts == null ? void 0 : texts.username) == null ? void 0 : _g2.invalid) || "Invalid username" }
|
11409
11388
|
);
|
11410
11389
|
break;
|
11390
|
+
case "phone":
|
11391
|
+
fieldSchemas["phone"] = z2.string({
|
11392
|
+
required_error: ((_h2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _h2.required) || "Phone Number Required"
|
11393
|
+
}).refine(
|
11394
|
+
(value) => {
|
11395
|
+
let isPhoneValid = (0, import_libphonenumber_js2.isPossiblePhoneNumber)(value) && (0, import_libphonenumber_js2.isValidPhoneNumber)(value) && (0, import_libphonenumber_js2.validatePhoneNumberLength)(value) === void 0;
|
11396
|
+
return isPhoneValid;
|
11397
|
+
},
|
11398
|
+
{ message: ((_i2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _i2.invalid) || "Phone Number Invalid" }
|
11399
|
+
);
|
11400
|
+
break;
|
11411
11401
|
}
|
11412
11402
|
});
|
11413
|
-
|
11414
|
-
|
11415
|
-
|
11416
|
-
|
11417
|
-
|
11418
|
-
|
11419
|
-
|
11420
|
-
|
11421
|
-
|
11422
|
-
|
11423
|
-
|
11424
|
-
|
11425
|
-
|
11426
|
-
|
11427
|
-
|
11428
|
-
|
11429
|
-
|
11430
|
-
|
11431
|
-
|
11432
|
-
|
11433
|
-
|
11434
|
-
|
11435
|
-
|
11436
|
-
|
11437
|
-
|
11438
|
-
|
11403
|
+
let formSchema;
|
11404
|
+
if (selectedRegisterType.value === "phone") {
|
11405
|
+
formSchema = z2.object({
|
11406
|
+
phone: z2.string({
|
11407
|
+
required_error: ((_c = texts == null ? void 0 : texts.phone) == null ? void 0 : _c.required) || "Phone Number Required"
|
11408
|
+
}).refine(
|
11409
|
+
(value) => {
|
11410
|
+
let isPhoneValid = (0, import_libphonenumber_js2.isPossiblePhoneNumber)(value) && (0, import_libphonenumber_js2.isValidPhoneNumber)(value) && (0, import_libphonenumber_js2.validatePhoneNumberLength)(value) === void 0;
|
11411
|
+
return isPhoneValid;
|
11412
|
+
},
|
11413
|
+
{ message: ((_d = texts == null ? void 0 : texts.phone) == null ? void 0 : _d.invalid) || "Phone Number Invalid" }
|
11414
|
+
),
|
11415
|
+
refCode: z2.string().optional(),
|
11416
|
+
reference: z2.string().optional(),
|
11417
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
11418
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
11419
|
+
}),
|
11420
|
+
newsletter_accepted: z2.boolean().optional()
|
11421
|
+
});
|
11422
|
+
} else {
|
11423
|
+
formSchema = z2.object({
|
11424
|
+
...fieldSchemas,
|
11425
|
+
password: z2.string({
|
11426
|
+
required_error: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Password is required"
|
11427
|
+
}).min(minPasswordLength, {
|
11428
|
+
message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort) || "Password is too short"
|
11429
|
+
}).refine((value) => value !== "", {
|
11430
|
+
message: ((_g = texts == null ? void 0 : texts.password) == null ? void 0 : _g.required) || "Password is required"
|
11431
|
+
}),
|
11432
|
+
confirm_password: z2.string({
|
11433
|
+
required_error: ((_h = texts == null ? void 0 : texts.confirm) == null ? void 0 : _h.required) || "Confirm password required"
|
11434
|
+
}).min(minPasswordLength, {
|
11435
|
+
message: ((_i = texts == null ? void 0 : texts.password) == null ? void 0 : _i.tooShort) || "Password is too short"
|
11436
|
+
}).refine((value) => value !== "", {
|
11437
|
+
message: ((_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required) || "Confirm password is required"
|
11438
|
+
}),
|
11439
|
+
refCode: z2.string().optional(),
|
11440
|
+
reference: z2.string().optional(),
|
11441
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
11442
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
11443
|
+
}),
|
11444
|
+
newsletter_accepted: z2.boolean().optional()
|
11445
|
+
}).refine((data) => data.password === data.confirm_password, {
|
11446
|
+
message: ((_k = texts == null ? void 0 : texts.confirm) == null ? void 0 : _k.dontMatch) || "Passwords don't match",
|
11447
|
+
path: ["confirm_password"]
|
11448
|
+
});
|
11449
|
+
}
|
11439
11450
|
const { handleSubmit, control, formState } = (0, import_react_hook_form2.useForm)({
|
11440
11451
|
resolver: (0, import_zod2.zodResolver)(formSchema)
|
11441
11452
|
});
|
11442
|
-
return /* @__PURE__ */ import_react69.default.createElement(
|
11443
|
-
|
11453
|
+
return /* @__PURE__ */ import_react69.default.createElement("div", { className: cn("hawa-flex hawa-flex-col", (_l = props.classNames) == null ? void 0 : _l.root) }, /* @__PURE__ */ import_react69.default.createElement(
|
11454
|
+
Card,
|
11444
11455
|
{
|
11456
|
+
dir: props.direction,
|
11445
11457
|
className: cn(
|
11446
|
-
|
11447
|
-
|
11458
|
+
(_m = props.classNames) == null ? void 0 : _m.card,
|
11459
|
+
props.cardless && "hawa-border-none hawa-bg-transparent !hawa-shadow-none !hawa-drop-shadow-none"
|
11448
11460
|
)
|
11449
11461
|
},
|
11450
11462
|
/* @__PURE__ */ import_react69.default.createElement(
|
11451
|
-
|
11463
|
+
CardContent,
|
11452
11464
|
{
|
11453
|
-
|
11454
|
-
|
11455
|
-
(_i = props.classNames) == null ? void 0 : _i.card,
|
11456
|
-
props.cardless && "hawa-border-none hawa-bg-transparent !hawa-shadow-none !hawa-drop-shadow-none"
|
11457
|
-
)
|
11465
|
+
headless: registerTypes ? registerTypes.length <= 1 : true,
|
11466
|
+
noPadding: props.cardless
|
11458
11467
|
},
|
11459
|
-
/* @__PURE__ */ import_react69.default.createElement(
|
11468
|
+
/* @__PURE__ */ import_react69.default.createElement("div", null, props.showError && /* @__PURE__ */ import_react69.default.createElement(
|
11460
11469
|
Alert,
|
11461
11470
|
{
|
11462
11471
|
direction: props.direction,
|
@@ -11477,240 +11486,352 @@ var RegisterForm = ({
|
|
11477
11486
|
if (props.onRegister) {
|
11478
11487
|
return props.onRegister(e);
|
11479
11488
|
} else {
|
11480
|
-
console.log(
|
11481
|
-
"Form is submitted but onRegister prop is missing"
|
11482
|
-
);
|
11489
|
+
console.log("Form is submitted but onRegister prop is missing");
|
11483
11490
|
}
|
11484
11491
|
}),
|
11485
11492
|
className: "hawa-flex hawa-flex-col hawa-gap-4"
|
11486
11493
|
},
|
11487
|
-
/* @__PURE__ */ import_react69.default.createElement(
|
11488
|
-
|
11489
|
-
|
11494
|
+
/* @__PURE__ */ import_react69.default.createElement(
|
11495
|
+
Tabs2,
|
11496
|
+
{
|
11497
|
+
dir: props.direction,
|
11498
|
+
value: selectedRegisterType.value,
|
11499
|
+
onValueChange: (e) => setSelectedRegisterType(
|
11500
|
+
(registerTypes == null ? void 0 : registerTypes.find((r) => r.value === e)) || registerTypes && registerTypes[0] || {
|
11501
|
+
label: "Password",
|
11502
|
+
value: "password"
|
11503
|
+
}
|
11504
|
+
)
|
11505
|
+
},
|
11506
|
+
registerTypes && registerTypes.length > 1 && /* @__PURE__ */ import_react69.default.createElement(CardHeader, { className: "hawa-w-full hawa-px-0 hawa-py-0 hawa-my-4 hawa-mt-6" }, /* @__PURE__ */ import_react69.default.createElement(TabsList2, { className: "hawa-w-full" }, registerTypes.map((registerType) => /* @__PURE__ */ import_react69.default.createElement(TabsTrigger2, { value: registerType.value }, registerType.label)))),
|
11507
|
+
/* @__PURE__ */ import_react69.default.createElement(
|
11508
|
+
TabsContent,
|
11509
|
+
{
|
11510
|
+
value: "password",
|
11511
|
+
className: cn(
|
11512
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
11513
|
+
selectedRegisterType.value === "password" ? "hawa-block" : "hawa-hidden"
|
11514
|
+
),
|
11515
|
+
dir: props.direction
|
11516
|
+
},
|
11517
|
+
/* @__PURE__ */ import_react69.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4" }, registerFields.map((fld, i) => {
|
11518
|
+
if (fld === "fullname") {
|
11519
|
+
return /* @__PURE__ */ import_react69.default.createElement(
|
11520
|
+
import_react_hook_form2.Controller,
|
11521
|
+
{
|
11522
|
+
key: i,
|
11523
|
+
control,
|
11524
|
+
name: "fullName",
|
11525
|
+
render: ({ field }) => {
|
11526
|
+
var _a2, _b2, _c2;
|
11527
|
+
return /* @__PURE__ */ import_react69.default.createElement(
|
11528
|
+
Input,
|
11529
|
+
{
|
11530
|
+
width: "full",
|
11531
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
11532
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
11533
|
+
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
11534
|
+
...field
|
11535
|
+
}
|
11536
|
+
);
|
11537
|
+
}
|
11538
|
+
}
|
11539
|
+
);
|
11540
|
+
}
|
11541
|
+
if (fld === "email") {
|
11542
|
+
return /* @__PURE__ */ import_react69.default.createElement(
|
11543
|
+
import_react_hook_form2.Controller,
|
11544
|
+
{
|
11545
|
+
key: i,
|
11546
|
+
control,
|
11547
|
+
name: "email",
|
11548
|
+
render: ({ field }) => {
|
11549
|
+
var _a2, _b2, _c2;
|
11550
|
+
return /* @__PURE__ */ import_react69.default.createElement(
|
11551
|
+
Input,
|
11552
|
+
{
|
11553
|
+
dir: "ltr",
|
11554
|
+
inputProps: {
|
11555
|
+
className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
|
11556
|
+
},
|
11557
|
+
width: "full",
|
11558
|
+
autoComplete: "email",
|
11559
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
11560
|
+
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
11561
|
+
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
11562
|
+
...field,
|
11563
|
+
onChange: (e) => {
|
11564
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
11565
|
+
}
|
11566
|
+
}
|
11567
|
+
);
|
11568
|
+
}
|
11569
|
+
}
|
11570
|
+
);
|
11571
|
+
}
|
11572
|
+
if (fld === "username") {
|
11573
|
+
return /* @__PURE__ */ import_react69.default.createElement(
|
11574
|
+
import_react_hook_form2.Controller,
|
11575
|
+
{
|
11576
|
+
key: i,
|
11577
|
+
control,
|
11578
|
+
name: "username",
|
11579
|
+
render: ({ field }) => {
|
11580
|
+
var _a2, _b2, _c2, _d2;
|
11581
|
+
return /* @__PURE__ */ import_react69.default.createElement(
|
11582
|
+
Input,
|
11583
|
+
{
|
11584
|
+
width: "full",
|
11585
|
+
autoComplete: "username",
|
11586
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
11587
|
+
labelProps: {
|
11588
|
+
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
11589
|
+
},
|
11590
|
+
helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
|
11591
|
+
placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
|
11592
|
+
...field
|
11593
|
+
}
|
11594
|
+
);
|
11595
|
+
}
|
11596
|
+
}
|
11597
|
+
);
|
11598
|
+
}
|
11599
|
+
})),
|
11600
|
+
/* @__PURE__ */ import_react69.default.createElement(
|
11490
11601
|
import_react_hook_form2.Controller,
|
11491
11602
|
{
|
11492
|
-
key: i,
|
11493
11603
|
control,
|
11494
|
-
name: "
|
11604
|
+
name: "password",
|
11495
11605
|
render: ({ field }) => {
|
11496
11606
|
var _a2, _b2, _c2;
|
11497
11607
|
return /* @__PURE__ */ import_react69.default.createElement(
|
11498
11608
|
Input,
|
11499
11609
|
{
|
11500
11610
|
width: "full",
|
11501
|
-
|
11502
|
-
|
11503
|
-
|
11611
|
+
type: passwordVisible ? "text" : "password",
|
11612
|
+
autoComplete: "new-password",
|
11613
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
11614
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
11615
|
+
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
11616
|
+
endIcon: /* @__PURE__ */ import_react69.default.createElement(
|
11617
|
+
"div",
|
11618
|
+
{
|
11619
|
+
className: "hawa-cursor-pointer",
|
11620
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
11621
|
+
},
|
11622
|
+
passwordVisible ? /* @__PURE__ */ import_react69.default.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ import_react69.default.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
11623
|
+
" "
|
11624
|
+
),
|
11504
11625
|
...field
|
11505
11626
|
}
|
11506
11627
|
);
|
11507
11628
|
}
|
11508
11629
|
}
|
11509
|
-
)
|
11510
|
-
|
11511
|
-
if (fld === "email") {
|
11512
|
-
return /* @__PURE__ */ import_react69.default.createElement(
|
11630
|
+
),
|
11631
|
+
/* @__PURE__ */ import_react69.default.createElement(
|
11513
11632
|
import_react_hook_form2.Controller,
|
11514
11633
|
{
|
11515
|
-
key: i,
|
11516
11634
|
control,
|
11517
|
-
name: "
|
11635
|
+
name: "confirm_password",
|
11518
11636
|
render: ({ field }) => {
|
11519
11637
|
var _a2, _b2, _c2;
|
11520
11638
|
return /* @__PURE__ */ import_react69.default.createElement(
|
11521
11639
|
Input,
|
11522
11640
|
{
|
11523
|
-
dir: "ltr",
|
11524
|
-
inputProps: {
|
11525
|
-
className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
|
11526
|
-
},
|
11527
11641
|
width: "full",
|
11528
|
-
|
11529
|
-
|
11530
|
-
|
11531
|
-
placeholder: ((
|
11532
|
-
|
11533
|
-
|
11534
|
-
|
11535
|
-
|
11536
|
-
|
11537
|
-
|
11642
|
+
type: passwordVisible ? "text" : "password",
|
11643
|
+
autoComplete: "new-password",
|
11644
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
11645
|
+
placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
|
11646
|
+
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
11647
|
+
endIcon: /* @__PURE__ */ import_react69.default.createElement(
|
11648
|
+
"div",
|
11649
|
+
{
|
11650
|
+
className: "hawa-cursor-pointer",
|
11651
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
11652
|
+
},
|
11653
|
+
passwordVisible ? /* @__PURE__ */ import_react69.default.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ import_react69.default.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
11654
|
+
" "
|
11655
|
+
),
|
11656
|
+
...field
|
11538
11657
|
}
|
11539
11658
|
);
|
11540
11659
|
}
|
11541
11660
|
}
|
11542
|
-
)
|
11543
|
-
|
11544
|
-
|
11545
|
-
return /* @__PURE__ */ import_react69.default.createElement(
|
11661
|
+
),
|
11662
|
+
props.additionalInputs,
|
11663
|
+
props.showRefCode && /* @__PURE__ */ import_react69.default.createElement(
|
11546
11664
|
import_react_hook_form2.Controller,
|
11547
11665
|
{
|
11548
|
-
key: i,
|
11549
11666
|
control,
|
11550
|
-
name: "
|
11667
|
+
name: "refCode",
|
11551
11668
|
render: ({ field }) => {
|
11552
|
-
var _a2
|
11669
|
+
var _a2;
|
11553
11670
|
return /* @__PURE__ */ import_react69.default.createElement(
|
11554
11671
|
Input,
|
11555
11672
|
{
|
11556
11673
|
width: "full",
|
11557
|
-
|
11558
|
-
|
11559
|
-
|
11560
|
-
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
11561
|
-
},
|
11562
|
-
helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
|
11563
|
-
placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
|
11674
|
+
label: texts == null ? void 0 : texts.refCode,
|
11675
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
11676
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
11564
11677
|
...field
|
11565
11678
|
}
|
11566
11679
|
);
|
11567
11680
|
}
|
11568
11681
|
}
|
11569
|
-
)
|
11570
|
-
|
11571
|
-
|
11572
|
-
|
11573
|
-
|
11574
|
-
|
11575
|
-
|
11576
|
-
|
11577
|
-
|
11578
|
-
|
11579
|
-
return /* @__PURE__ */ import_react69.default.createElement(
|
11580
|
-
Input,
|
11581
|
-
{
|
11582
|
-
width: "full",
|
11583
|
-
type: passwordVisible ? "text" : "password",
|
11584
|
-
endIcon: /* @__PURE__ */ import_react69.default.createElement(
|
11585
|
-
"div",
|
11682
|
+
),
|
11683
|
+
props.showUserSource && /* @__PURE__ */ import_react69.default.createElement(
|
11684
|
+
import_react_hook_form2.Controller,
|
11685
|
+
{
|
11686
|
+
control,
|
11687
|
+
name: "reference",
|
11688
|
+
render: ({ field }) => {
|
11689
|
+
var _a2, _b2;
|
11690
|
+
return /* @__PURE__ */ import_react69.default.createElement(
|
11691
|
+
Select,
|
11586
11692
|
{
|
11587
|
-
|
11588
|
-
|
11589
|
-
|
11590
|
-
|
11591
|
-
|
11592
|
-
|
11593
|
-
|
11594
|
-
|
11595
|
-
|
11596
|
-
|
11597
|
-
...field
|
11693
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
11694
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
11695
|
+
isCreatable: false,
|
11696
|
+
isMulti: false,
|
11697
|
+
isSearchable: false,
|
11698
|
+
isClearable: false,
|
11699
|
+
options: props.userReferenceOptions || [],
|
11700
|
+
onChange: (e) => field.onChange(e)
|
11701
|
+
}
|
11702
|
+
);
|
11598
11703
|
}
|
11599
|
-
|
11600
|
-
|
11601
|
-
|
11602
|
-
|
11603
|
-
|
11604
|
-
|
11605
|
-
|
11606
|
-
|
11607
|
-
|
11608
|
-
|
11609
|
-
|
11610
|
-
|
11611
|
-
|
11612
|
-
|
11613
|
-
|
11614
|
-
|
11615
|
-
|
11616
|
-
|
11617
|
-
|
11618
|
-
|
11619
|
-
|
11704
|
+
}
|
11705
|
+
)
|
11706
|
+
),
|
11707
|
+
/* @__PURE__ */ import_react69.default.createElement(
|
11708
|
+
TabsContent,
|
11709
|
+
{
|
11710
|
+
value: "phone",
|
11711
|
+
className: cn(
|
11712
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
11713
|
+
selectedRegisterType.value === "phone" ? "hawa-block" : "hawa-hidden"
|
11714
|
+
),
|
11715
|
+
dir: props.direction
|
11716
|
+
},
|
11717
|
+
/* @__PURE__ */ import_react69.default.createElement(
|
11718
|
+
import_react_hook_form2.Controller,
|
11719
|
+
{
|
11720
|
+
control,
|
11721
|
+
name: "phone",
|
11722
|
+
render: ({ field }) => {
|
11723
|
+
var _a2, _b2;
|
11724
|
+
return /* @__PURE__ */ import_react69.default.createElement(
|
11725
|
+
PhoneInput,
|
11726
|
+
{
|
11727
|
+
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
11728
|
+
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
11729
|
+
preferredCountry: { label: "+966" },
|
11730
|
+
...props.phoneInputProps,
|
11731
|
+
handleChange: (e) => {
|
11732
|
+
if ((0, import_libphonenumber_js2.isValidPhoneNumber)(e) && (0, import_libphonenumber_js2.isPossiblePhoneNumber)(e) && (0, import_libphonenumber_js2.validatePhoneNumberLength)(e) === void 0) {
|
11733
|
+
let parsed = (0, import_libphonenumber_js2.parsePhoneNumber)(e);
|
11734
|
+
field.onChange(parsed.number);
|
11735
|
+
} else {
|
11736
|
+
field.onChange(e);
|
11737
|
+
}
|
11738
|
+
}
|
11739
|
+
}
|
11740
|
+
);
|
11620
11741
|
}
|
11621
|
-
|
11622
|
-
|
11623
|
-
|
11624
|
-
|
11625
|
-
|
11626
|
-
|
11627
|
-
|
11628
|
-
|
11629
|
-
|
11630
|
-
|
11631
|
-
|
11632
|
-
|
11633
|
-
|
11634
|
-
|
11635
|
-
|
11636
|
-
|
11637
|
-
|
11638
|
-
|
11639
|
-
|
11640
|
-
|
11742
|
+
}
|
11743
|
+
),
|
11744
|
+
props.additionalInputs,
|
11745
|
+
props.showRefCode && /* @__PURE__ */ import_react69.default.createElement(
|
11746
|
+
import_react_hook_form2.Controller,
|
11747
|
+
{
|
11748
|
+
control,
|
11749
|
+
name: "refCode",
|
11750
|
+
render: ({ field }) => {
|
11751
|
+
var _a2;
|
11752
|
+
return /* @__PURE__ */ import_react69.default.createElement(
|
11753
|
+
Input,
|
11754
|
+
{
|
11755
|
+
width: "full",
|
11756
|
+
label: texts == null ? void 0 : texts.refCode,
|
11757
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
11758
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
11759
|
+
...field
|
11760
|
+
}
|
11761
|
+
);
|
11641
11762
|
}
|
11642
|
-
|
11643
|
-
|
11644
|
-
|
11645
|
-
|
11646
|
-
|
11647
|
-
|
11648
|
-
|
11649
|
-
|
11650
|
-
|
11651
|
-
|
11652
|
-
|
11653
|
-
|
11654
|
-
|
11655
|
-
|
11656
|
-
|
11657
|
-
|
11658
|
-
|
11659
|
-
|
11660
|
-
|
11661
|
-
|
11662
|
-
|
11663
|
-
|
11763
|
+
}
|
11764
|
+
),
|
11765
|
+
props.showUserSource && /* @__PURE__ */ import_react69.default.createElement(
|
11766
|
+
import_react_hook_form2.Controller,
|
11767
|
+
{
|
11768
|
+
control,
|
11769
|
+
name: "reference",
|
11770
|
+
render: ({ field }) => {
|
11771
|
+
var _a2, _b2;
|
11772
|
+
return /* @__PURE__ */ import_react69.default.createElement(
|
11773
|
+
Select,
|
11774
|
+
{
|
11775
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
11776
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
11777
|
+
isCreatable: false,
|
11778
|
+
isMulti: false,
|
11779
|
+
isSearchable: false,
|
11780
|
+
isClearable: false,
|
11781
|
+
options: props.userReferenceOptions || [],
|
11782
|
+
onChange: (e) => field.onChange(e)
|
11783
|
+
}
|
11784
|
+
);
|
11664
11785
|
}
|
11665
|
-
|
11786
|
+
}
|
11787
|
+
)
|
11788
|
+
),
|
11789
|
+
showTermsOption || showNewsletterOption ? /* @__PURE__ */ import_react69.default.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ import_react69.default.createElement(
|
11790
|
+
import_react_hook_form2.Controller,
|
11791
|
+
{
|
11792
|
+
control,
|
11793
|
+
name: "terms_accepted",
|
11794
|
+
render: ({ field }) => {
|
11795
|
+
var _a2, _b2;
|
11796
|
+
return /* @__PURE__ */ import_react69.default.createElement(
|
11797
|
+
Checkbox,
|
11798
|
+
{
|
11799
|
+
id: "terms_accepted",
|
11800
|
+
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
11801
|
+
onCheckedChange: (e) => field.onChange(e),
|
11802
|
+
label: /* @__PURE__ */ import_react69.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5 hawa-whitespace-nowrap hawa-flex-wrap" }, (texts == null ? void 0 : texts.iAcceptText) || "I accept the", " ", /* @__PURE__ */ import_react69.default.createElement(StopPropagationWrapper, null, /* @__PURE__ */ import_react69.default.createElement(
|
11803
|
+
"span",
|
11804
|
+
{
|
11805
|
+
onClick: (e) => {
|
11806
|
+
e.preventDefault();
|
11807
|
+
if (props.onRouteToTOS) {
|
11808
|
+
props.onRouteToTOS();
|
11809
|
+
}
|
11810
|
+
},
|
11811
|
+
className: "clickable-link"
|
11812
|
+
},
|
11813
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
11814
|
+
)))
|
11815
|
+
}
|
11816
|
+
);
|
11817
|
+
}
|
11666
11818
|
}
|
11667
|
-
|
11668
|
-
|
11669
|
-
|
11670
|
-
|
11671
|
-
|
11672
|
-
|
11673
|
-
name: "terms_accepted",
|
11674
|
-
render: ({ field }) => {
|
11675
|
-
var _a2, _b2;
|
11676
|
-
return /* @__PURE__ */ import_react69.default.createElement(
|
11819
|
+
), showNewsletterOption && /* @__PURE__ */ import_react69.default.createElement(
|
11820
|
+
import_react_hook_form2.Controller,
|
11821
|
+
{
|
11822
|
+
control,
|
11823
|
+
name: "newsletter_accepted",
|
11824
|
+
render: ({ field }) => /* @__PURE__ */ import_react69.default.createElement(
|
11677
11825
|
Checkbox,
|
11678
11826
|
{
|
11679
|
-
id: "
|
11680
|
-
|
11681
|
-
onCheckedChange:
|
11682
|
-
label: /* @__PURE__ */ import_react69.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5 hawa-whitespace-nowrap hawa-flex-wrap" }, (texts == null ? void 0 : texts.iAcceptText) || "I accept the", " ", /* @__PURE__ */ import_react69.default.createElement(StopPropagationWrapper, null, /* @__PURE__ */ import_react69.default.createElement(
|
11683
|
-
"span",
|
11684
|
-
{
|
11685
|
-
onClick: (e) => {
|
11686
|
-
e.preventDefault();
|
11687
|
-
if (props.onRouteToTOS) {
|
11688
|
-
props.onRouteToTOS();
|
11689
|
-
}
|
11690
|
-
},
|
11691
|
-
className: "clickable-link"
|
11692
|
-
},
|
11693
|
-
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
11694
|
-
)))
|
11827
|
+
id: "newsletter_accepted",
|
11828
|
+
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
11829
|
+
onCheckedChange: field.onChange
|
11695
11830
|
}
|
11696
|
-
)
|
11831
|
+
)
|
11697
11832
|
}
|
11698
|
-
|
11699
|
-
),
|
11700
|
-
import_react_hook_form2.Controller,
|
11701
|
-
{
|
11702
|
-
control,
|
11703
|
-
name: "newsletter_accepted",
|
11704
|
-
render: ({ field }) => /* @__PURE__ */ import_react69.default.createElement(
|
11705
|
-
Checkbox,
|
11706
|
-
{
|
11707
|
-
id: "newsletter_accepted",
|
11708
|
-
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
11709
|
-
onCheckedChange: field.onChange
|
11710
|
-
}
|
11711
|
-
)
|
11712
|
-
}
|
11713
|
-
)) : null,
|
11833
|
+
)) : null
|
11834
|
+
),
|
11714
11835
|
/* @__PURE__ */ import_react69.default.createElement(
|
11715
11836
|
Button,
|
11716
11837
|
{
|
@@ -11722,33 +11843,33 @@ var RegisterForm = ({
|
|
11722
11843
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
11723
11844
|
),
|
11724
11845
|
props.additionalButtons
|
11725
|
-
)), props.onRouteToLogin && /* @__PURE__ */ import_react69.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ import_react69.default.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ import_react69.default.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))
|
11726
|
-
|
11727
|
-
|
11728
|
-
|
11729
|
-
|
11730
|
-
|
11731
|
-
|
11732
|
-
|
11733
|
-
},
|
11734
|
-
/* @__PURE__ */ import_react69.default.createElement(
|
11735
|
-
AuthButtons,
|
11736
|
-
{
|
11737
|
-
texts: thirdPartyAuthTexts,
|
11738
|
-
viaGoogle: props.viaGoogle,
|
11739
|
-
viaGithub: props.viaGithub,
|
11740
|
-
viaTwitter: props.viaTwitter,
|
11741
|
-
isGoogleLoading: props.isGoogleLoading,
|
11742
|
-
isGithubLoading: props.isGithubLoading,
|
11743
|
-
isTwitterLoading: props.isTwitterLoading,
|
11744
|
-
handleGoogle: props.onGoogleRegister,
|
11745
|
-
handleGithub: props.onGithubRegister,
|
11746
|
-
handleTwitter: props.onTwitterRegister
|
11747
|
-
}
|
11846
|
+
)), props.onRouteToLogin && /* @__PURE__ */ import_react69.default.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ import_react69.default.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ import_react69.default.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))
|
11847
|
+
),
|
11848
|
+
props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react69.default.createElement(
|
11849
|
+
CardFooter,
|
11850
|
+
{
|
11851
|
+
noPadding: props.cardless,
|
11852
|
+
className: cn(
|
11853
|
+
props.logosOnly ? "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-2" : "hawa-grid hawa-grid-cols-1 hawa-gap-2"
|
11748
11854
|
)
|
11749
|
-
|
11750
|
-
|
11751
|
-
|
11855
|
+
},
|
11856
|
+
/* @__PURE__ */ import_react69.default.createElement(
|
11857
|
+
AuthButtons,
|
11858
|
+
{
|
11859
|
+
texts: thirdPartyAuthTexts,
|
11860
|
+
viaGoogle: props.viaGoogle,
|
11861
|
+
viaGithub: props.viaGithub,
|
11862
|
+
viaTwitter: props.viaTwitter,
|
11863
|
+
isGoogleLoading: props.isGoogleLoading,
|
11864
|
+
isGithubLoading: props.isGithubLoading,
|
11865
|
+
isTwitterLoading: props.isTwitterLoading,
|
11866
|
+
handleGoogle: props.onGoogleRegister,
|
11867
|
+
handleGithub: props.onGithubRegister,
|
11868
|
+
handleTwitter: props.onTwitterRegister
|
11869
|
+
}
|
11870
|
+
)
|
11871
|
+
) : null
|
11872
|
+
));
|
11752
11873
|
};
|
11753
11874
|
|
11754
11875
|
// blocks/auth/AppLanding.tsx
|
@@ -11997,10 +12118,7 @@ var import_react74 = __toESM(require("react"));
|
|
11997
12118
|
var import_react_hook_form5 = require("react-hook-form");
|
11998
12119
|
var import_zod5 = require("@hookform/resolvers/zod");
|
11999
12120
|
var z5 = __toESM(require("zod"));
|
12000
|
-
var CodeConfirmation = ({
|
12001
|
-
codeLength = 6,
|
12002
|
-
...props
|
12003
|
-
}) => {
|
12121
|
+
var CodeConfirmation = ({ codeLength = 6, ...props }) => {
|
12004
12122
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
12005
12123
|
const formSchema = z5.object({
|
12006
12124
|
otp_code: z5.string({ required_error: (_a = props.texts) == null ? void 0 : _a.codeRequiredText }).min(codeLength, { message: (_b = props.texts) == null ? void 0 : _b.codeTooShort })
|
@@ -12039,14 +12157,7 @@ var CodeConfirmation = ({
|
|
12039
12157
|
}
|
12040
12158
|
};
|
12041
12159
|
}, []);
|
12042
|
-
return /* @__PURE__ */ import_react74.default.createElement(Card, null, /* @__PURE__ */ import_react74.default.createElement(CardContent, { headless: true }, props.showError && /* @__PURE__ */ import_react74.default.createElement(
|
12043
|
-
Alert,
|
12044
|
-
{
|
12045
|
-
title: props.errorTitle,
|
12046
|
-
text: props.errorText,
|
12047
|
-
severity: "error"
|
12048
|
-
}
|
12049
|
-
), /* @__PURE__ */ import_react74.default.createElement("div", { className: "hawa-mb-4 dark:hawa-text-white" }, /* @__PURE__ */ import_react74.default.createElement("div", { className: "hawa-text-lg hawa-font-bold" }, ((_c = props.texts) == null ? void 0 : _c.checkYourPhone) || "Please check your phone"), /* @__PURE__ */ import_react74.default.createElement("div", { className: "hawa-text-muted-foreground" }, /* @__PURE__ */ import_react74.default.createElement("span", null, ((_d = props.texts) == null ? void 0 : _d.weSentCode) || "We've sent a code to "), /* @__PURE__ */ import_react74.default.createElement("span", null, props.phoneNumber))), /* @__PURE__ */ import_react74.default.createElement(
|
12160
|
+
return /* @__PURE__ */ import_react74.default.createElement(Card, null, /* @__PURE__ */ import_react74.default.createElement(CardContent, { headless: true }, props.showError && /* @__PURE__ */ import_react74.default.createElement(Alert, { title: props.errorTitle, text: props.errorText, severity: "error" }), /* @__PURE__ */ import_react74.default.createElement("div", { className: "hawa-mb-4 dark:hawa-text-white" }, /* @__PURE__ */ import_react74.default.createElement("div", { className: "hawa-text-lg hawa-font-bold" }, ((_c = props.texts) == null ? void 0 : _c.checkYourIdentifier) || "Please check your phone"), /* @__PURE__ */ import_react74.default.createElement("div", { className: "hawa-text-muted-foreground" }, /* @__PURE__ */ import_react74.default.createElement("span", null, ((_d = props.texts) == null ? void 0 : _d.weSentCode) || "We've sent a code to "), /* @__PURE__ */ import_react74.default.createElement("span", null, props.identifier))), /* @__PURE__ */ import_react74.default.createElement(
|
12050
12161
|
"form",
|
12051
12162
|
{
|
12052
12163
|
noValidate: true,
|
@@ -12095,9 +12206,7 @@ var CodeConfirmation = ({
|
|
12095
12206
|
if (props.onCancel) {
|
12096
12207
|
return props.onCancel();
|
12097
12208
|
} else {
|
12098
|
-
console.log(
|
12099
|
-
"Cancel button clicked but onCancel prop is missing"
|
12100
|
-
);
|
12209
|
+
console.log("Cancel button clicked but onCancel prop is missing");
|
12101
12210
|
}
|
12102
12211
|
},
|
12103
12212
|
variant: "outline"
|