@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.mjs
CHANGED
@@ -5546,6 +5546,7 @@ import clsx3 from "clsx";
|
|
5546
5546
|
var Select = ({
|
5547
5547
|
labelProps,
|
5548
5548
|
labelKey = "label",
|
5549
|
+
valueKey = "value",
|
5549
5550
|
...props
|
5550
5551
|
}) => {
|
5551
5552
|
const NoOption = () => {
|
@@ -5565,13 +5566,7 @@ var Select = ({
|
|
5565
5566
|
children
|
5566
5567
|
);
|
5567
5568
|
};
|
5568
|
-
const Option = ({
|
5569
|
-
children,
|
5570
|
-
innerProps,
|
5571
|
-
innerRef,
|
5572
|
-
isFocused,
|
5573
|
-
isSelected
|
5574
|
-
}) => {
|
5569
|
+
const Option = ({ children, innerProps, innerRef, isFocused, isSelected }) => {
|
5575
5570
|
return /* @__PURE__ */ React43.createElement(
|
5576
5571
|
"div",
|
5577
5572
|
{
|
@@ -5586,14 +5581,7 @@ var Select = ({
|
|
5586
5581
|
children
|
5587
5582
|
);
|
5588
5583
|
};
|
5589
|
-
const Menu2 = ({
|
5590
|
-
cx,
|
5591
|
-
children,
|
5592
|
-
getStyles,
|
5593
|
-
innerProps,
|
5594
|
-
innerRef,
|
5595
|
-
...menuProps
|
5596
|
-
}) => {
|
5584
|
+
const Menu2 = ({ cx, children, getStyles, innerProps, innerRef, ...menuProps }) => {
|
5597
5585
|
const menuOpen = menuProps.selectProps.menuIsOpen;
|
5598
5586
|
return /* @__PURE__ */ React43.createElement(
|
5599
5587
|
"div",
|
@@ -5622,71 +5610,72 @@ var Select = ({
|
|
5622
5610
|
)
|
5623
5611
|
},
|
5624
5612
|
props.label && /* @__PURE__ */ React43.createElement(Label2, { ...labelProps }, props.label),
|
5625
|
-
props.isLoading ? /* @__PURE__ */ React43.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" }) : !props.isCreatable ? (
|
5626
|
-
|
5627
|
-
|
5628
|
-
|
5629
|
-
{
|
5630
|
-
|
5631
|
-
|
5632
|
-
|
5633
|
-
|
5634
|
-
|
5635
|
-
|
5636
|
-
|
5637
|
-
|
5638
|
-
|
5639
|
-
|
5640
|
-
|
5641
|
-
|
5642
|
-
|
5643
|
-
|
5644
|
-
|
5645
|
-
|
5646
|
-
|
5647
|
-
|
5648
|
-
|
5649
|
-
|
5650
|
-
|
5651
|
-
props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
|
5652
|
-
props.disabled && "hawa-opacity-30"
|
5653
|
-
)
|
5654
|
-
},
|
5655
|
-
unstyled: true,
|
5656
|
-
autoFocus: false,
|
5657
|
-
components: props.hideIndicator ? { Option, Menu: Menu2, IndicatorsContainer: () => null } : {
|
5613
|
+
props.isLoading ? /* @__PURE__ */ React43.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" }) : !props.isCreatable ? /* @__PURE__ */ React43.createElement(
|
5614
|
+
ReactSelect,
|
5615
|
+
{
|
5616
|
+
noOptionsMessage: NoOption,
|
5617
|
+
classNames: {
|
5618
|
+
control: () => cn(props.phoneCode && "hawa-rounded-r-none", props.controlClassNames),
|
5619
|
+
container: () => cn(
|
5620
|
+
selectContainerStyles,
|
5621
|
+
props.phoneCode && phoneCodeStyles,
|
5622
|
+
props.isMulti && "hawa-ps-0 "
|
5623
|
+
),
|
5624
|
+
placeholder: () => cn(selectPlaceholderStyles, props.disabled && "hawa-text-muted-foreground"),
|
5625
|
+
valueContainer: () => "hawa-text-foreground hawa-px-1",
|
5626
|
+
singleValue: () => cn(
|
5627
|
+
props.disabled ? "hawa-text-muted-foreground hawa-opacity-30" : "hawa-text-foreground"
|
5628
|
+
),
|
5629
|
+
indicatorsContainer: () => cn(
|
5630
|
+
selectIndicatorContainerStyles,
|
5631
|
+
props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
|
5632
|
+
props.disabled && "hawa-opacity-30"
|
5633
|
+
)
|
5634
|
+
},
|
5635
|
+
unstyled: true,
|
5636
|
+
autoFocus: false,
|
5637
|
+
components: props.hideIndicator ? {
|
5638
|
+
Option: (optionProps) => /* @__PURE__ */ React43.createElement(
|
5658
5639
|
Option,
|
5659
|
-
|
5660
|
-
|
5661
|
-
|
5662
|
-
|
5663
|
-
|
5664
|
-
|
5665
|
-
|
5666
|
-
|
5667
|
-
|
5668
|
-
|
5669
|
-
|
5670
|
-
|
5671
|
-
|
5672
|
-
|
5673
|
-
className
|
5674
|
-
|
5675
|
-
|
5676
|
-
|
5677
|
-
|
5678
|
-
|
5679
|
-
|
5680
|
-
|
5681
|
-
|
5682
|
-
|
5683
|
-
|
5684
|
-
|
5685
|
-
|
5686
|
-
|
5687
|
-
|
5688
|
-
|
5689
|
-
|
5640
|
+
{
|
5641
|
+
...optionProps,
|
5642
|
+
isSelected: optionProps.data[valueKey] === props.value[valueKey]
|
5643
|
+
}
|
5644
|
+
),
|
5645
|
+
Menu: Menu2,
|
5646
|
+
IndicatorsContainer: () => null
|
5647
|
+
} : {
|
5648
|
+
Option,
|
5649
|
+
Menu: Menu2,
|
5650
|
+
ValueContainer: (e) => /* @__PURE__ */ React43.createElement(
|
5651
|
+
"div",
|
5652
|
+
{
|
5653
|
+
className: cn(
|
5654
|
+
e.className,
|
5655
|
+
"hawa-gap-1 hawa-flex hawa-flex-row hawa-flex-wrap hawa-p-2 hawa-w-full hawa-cursor-pointer"
|
5656
|
+
),
|
5657
|
+
...e
|
5658
|
+
}
|
5659
|
+
),
|
5660
|
+
MultiValueContainer: (e) => /* @__PURE__ */ React43.createElement(
|
5661
|
+
"div",
|
5662
|
+
{
|
5663
|
+
className: "hawa-rounded hawa-border hawa-p-1 hawa-px-2 hawa-flex hawa-flex-row",
|
5664
|
+
...e
|
5665
|
+
}
|
5666
|
+
)
|
5667
|
+
},
|
5668
|
+
onChange: (newValue, action) => props.onChange(newValue, action),
|
5669
|
+
options: props.options,
|
5670
|
+
getOptionLabel: props.getOptionLabel,
|
5671
|
+
defaultValue: props.defaultValue,
|
5672
|
+
value: props.value,
|
5673
|
+
placeholder: props.placeholder,
|
5674
|
+
isDisabled: props.disabled,
|
5675
|
+
isClearable: props.isClearable,
|
5676
|
+
isMulti: props.isMulti,
|
5677
|
+
isSearchable: props.isSearchable
|
5678
|
+
}
|
5690
5679
|
) : /* @__PURE__ */ React43.createElement(
|
5691
5680
|
CreatableSelect,
|
5692
5681
|
{
|
@@ -7676,11 +7665,13 @@ var PhoneInput = ({
|
|
7676
7665
|
countryCodes,
|
7677
7666
|
...props
|
7678
7667
|
}) => {
|
7668
|
+
var _a;
|
7679
7669
|
const [phoneNumber, setPhoneNumber] = useState29("");
|
7680
|
-
const [countryCode, setCountryCode] = useState29(
|
7670
|
+
const [countryCode, setCountryCode] = useState29(
|
7671
|
+
props.preferredCountry || { label: "+966" }
|
7672
|
+
);
|
7681
7673
|
const inputRef = useRef17(null);
|
7682
7674
|
const handleInputChange = (e) => {
|
7683
|
-
console.log("test e ", e.target.value);
|
7684
7675
|
const validChars = /^[0-9-()]+$/;
|
7685
7676
|
const input = e.target.value;
|
7686
7677
|
if (input === "" || validChars.test(input)) {
|
@@ -7702,11 +7693,13 @@ var PhoneInput = ({
|
|
7702
7693
|
isMulti: false,
|
7703
7694
|
isSearchable: true,
|
7704
7695
|
isClearable: false,
|
7705
|
-
placeholder:
|
7696
|
+
placeholder: (_a = props.preferredCountry) == null ? void 0 : _a.label,
|
7706
7697
|
options: countryCodes || countries_default,
|
7707
|
-
onChange: setCountryCode,
|
7708
|
-
|
7709
|
-
|
7698
|
+
onChange: (e) => setCountryCode({ label: e.label, value: e.label }),
|
7699
|
+
valueKey: "label",
|
7700
|
+
labelKey: "label",
|
7701
|
+
value: { label: countryCode == null ? void 0 : countryCode.label, value: countryCode == null ? void 0 : countryCode.label },
|
7702
|
+
defaultValue: { label: countryCode == null ? void 0 : countryCode.label, value: countryCode == null ? void 0 : countryCode.label }
|
7710
7703
|
}
|
7711
7704
|
), /* @__PURE__ */ React49.createElement("div", { className: "hawa-relative hawa-flex hawa-h-fit hawa-w-full hawa-flex-col hawa-justify-center hawa-gap-0" }, /* @__PURE__ */ React49.createElement(
|
7712
7705
|
"input",
|
@@ -7819,14 +7812,7 @@ var PinInputRoot = React50.forwardRef(({ className, containerClassName, ...props
|
|
7819
7812
|
}
|
7820
7813
|
));
|
7821
7814
|
PinInputRoot.displayName = "PinInputRoot";
|
7822
|
-
var PinInputGroup = React50.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React50.createElement(
|
7823
|
-
"div",
|
7824
|
-
{
|
7825
|
-
ref,
|
7826
|
-
className: cn("hawa-flex hawa-items-center", className),
|
7827
|
-
...props
|
7828
|
-
}
|
7829
|
-
));
|
7815
|
+
var PinInputGroup = React50.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React50.createElement("div", { ref, className: cn("hawa-flex hawa-items-center", className), ...props }));
|
7830
7816
|
PinInputGroup.displayName = "PinInputGroup";
|
7831
7817
|
var PinInputSlot = React50.forwardRef(({ index, className, ...props }, ref) => {
|
7832
7818
|
const pinInputContext = React50.useContext(OTPInputContext);
|
@@ -7849,22 +7835,12 @@ var PinInputSlot = React50.forwardRef(({ index, className, ...props }, ref) => {
|
|
7849
7835
|
PinInputSlot.displayName = "PinInputSlot";
|
7850
7836
|
var PinInputSeperator = React50.forwardRef(({ ...props }, ref) => /* @__PURE__ */ React50.createElement("div", { ref, role: "separator", ...props }, /* @__PURE__ */ React50.createElement(Dot, null)));
|
7851
7837
|
PinInputSeperator.displayName = "PinInputSeperator";
|
7852
|
-
var PinInput = ({
|
7853
|
-
separatorPosition = 0,
|
7854
|
-
...props
|
7855
|
-
}) => {
|
7838
|
+
var PinInput = ({ separatorPosition = 0, ...props }) => {
|
7856
7839
|
const maxLength = props.maxLength || 6;
|
7857
7840
|
const clampedSeparatorPosition = Math.min(separatorPosition, maxLength);
|
7858
7841
|
const firstGroupLength = clampedSeparatorPosition > 0 ? clampedSeparatorPosition : 0;
|
7859
7842
|
const secondGroupLength = maxLength - firstGroupLength;
|
7860
|
-
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(
|
7861
|
-
PinInputSlot,
|
7862
|
-
{
|
7863
|
-
key: index,
|
7864
|
-
index,
|
7865
|
-
className: "hawa-w-full hawa-border"
|
7866
|
-
}
|
7867
|
-
))), 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(
|
7843
|
+
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(
|
7868
7844
|
PinInputSlot,
|
7869
7845
|
{
|
7870
7846
|
key: index + firstGroupLength,
|
@@ -11088,14 +11064,7 @@ var LoginForm = ({
|
|
11088
11064
|
(texts == null ? void 0 : texts.loginText) || "Login"
|
11089
11065
|
),
|
11090
11066
|
props.additionalButtons && props.additionalButtons,
|
11091
|
-
props.allowRegister && /* @__PURE__ */ React82.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__ */ React82.createElement(
|
11092
|
-
"span",
|
11093
|
-
{
|
11094
|
-
onClick: props.onRouteToRegister,
|
11095
|
-
className: "clickable-link"
|
11096
|
-
},
|
11097
|
-
(texts == null ? void 0 : texts.createAccount) || "Create Account"
|
11098
|
-
))
|
11067
|
+
props.allowRegister && /* @__PURE__ */ React82.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__ */ React82.createElement("span", { onClick: props.onRouteToRegister, className: "clickable-link" }, (texts == null ? void 0 : texts.createAccount) || "Create Account"))
|
11099
11068
|
)),
|
11100
11069
|
props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React82.createElement(
|
11101
11070
|
CardFooter,
|
@@ -11128,6 +11097,12 @@ var LoginForm = ({
|
|
11128
11097
|
import React83, { useState as useState42 } from "react";
|
11129
11098
|
import { Controller as Controller2, FormProvider, useForm as useForm2 } from "react-hook-form";
|
11130
11099
|
import { zodResolver as zodResolver2 } from "@hookform/resolvers/zod";
|
11100
|
+
import {
|
11101
|
+
isPossiblePhoneNumber as isPossiblePhoneNumber2,
|
11102
|
+
isValidPhoneNumber as isValidPhoneNumber2,
|
11103
|
+
parsePhoneNumber as parsePhoneNumber2,
|
11104
|
+
validatePhoneNumberLength as validatePhoneNumberLength2
|
11105
|
+
} from "libphonenumber-js";
|
11131
11106
|
import * as z2 from "zod";
|
11132
11107
|
var RegisterForm = ({
|
11133
11108
|
texts,
|
@@ -11135,10 +11110,15 @@ var RegisterForm = ({
|
|
11135
11110
|
minPasswordLength = 8,
|
11136
11111
|
showTermsOption = false,
|
11137
11112
|
showNewsletterOption = false,
|
11113
|
+
registerTypes,
|
11138
11114
|
...props
|
11139
11115
|
}) => {
|
11140
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
11116
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
11141
11117
|
const [passwordVisible, setPasswordVisible] = useState42(false);
|
11118
|
+
const [selectedRegisterType, setSelectedRegisterType] = useState42({
|
11119
|
+
value: ((_a = registerTypes == null ? void 0 : registerTypes[0]) == null ? void 0 : _a.value) || "password",
|
11120
|
+
label: ((_b = registerTypes == null ? void 0 : registerTypes[0]) == null ? void 0 : _b.label) || "Password"
|
11121
|
+
});
|
11142
11122
|
const thirdPartyAuthTexts = {
|
11143
11123
|
continueWithGoogle: texts == null ? void 0 : texts.continueWithGoogle,
|
11144
11124
|
continueWithTwitter: texts == null ? void 0 : texts.continueWithTwitter,
|
@@ -11150,8 +11130,12 @@ var RegisterForm = ({
|
|
11150
11130
|
};
|
11151
11131
|
const methods = useForm2();
|
11152
11132
|
let fieldSchemas = {};
|
11133
|
+
const hasPhoneType = registerTypes == null ? void 0 : registerTypes.some((type) => type.value === "phone");
|
11134
|
+
if (hasPhoneType && selectedRegisterType.value === "phone") {
|
11135
|
+
registerFields = ["phone"];
|
11136
|
+
}
|
11153
11137
|
registerFields.forEach((field) => {
|
11154
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
11138
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
11155
11139
|
switch (field) {
|
11156
11140
|
case "fullname":
|
11157
11141
|
fieldSchemas["fullName"] = z2.string().optional();
|
@@ -11176,55 +11160,85 @@ var RegisterForm = ({
|
|
11176
11160
|
{ message: ((_g2 = texts == null ? void 0 : texts.username) == null ? void 0 : _g2.invalid) || "Invalid username" }
|
11177
11161
|
);
|
11178
11162
|
break;
|
11163
|
+
case "phone":
|
11164
|
+
fieldSchemas["phone"] = z2.string({
|
11165
|
+
required_error: ((_h2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _h2.required) || "Phone Number Required"
|
11166
|
+
}).refine(
|
11167
|
+
(value) => {
|
11168
|
+
let isPhoneValid = isPossiblePhoneNumber2(value) && isValidPhoneNumber2(value) && validatePhoneNumberLength2(value) === void 0;
|
11169
|
+
return isPhoneValid;
|
11170
|
+
},
|
11171
|
+
{ message: ((_i2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _i2.invalid) || "Phone Number Invalid" }
|
11172
|
+
);
|
11173
|
+
break;
|
11179
11174
|
}
|
11180
11175
|
});
|
11181
|
-
|
11182
|
-
|
11183
|
-
|
11184
|
-
|
11185
|
-
|
11186
|
-
|
11187
|
-
|
11188
|
-
|
11189
|
-
|
11190
|
-
|
11191
|
-
|
11192
|
-
|
11193
|
-
|
11194
|
-
|
11195
|
-
|
11196
|
-
|
11197
|
-
|
11198
|
-
|
11199
|
-
|
11200
|
-
|
11201
|
-
|
11202
|
-
|
11203
|
-
|
11204
|
-
|
11205
|
-
|
11206
|
-
|
11176
|
+
let formSchema;
|
11177
|
+
if (selectedRegisterType.value === "phone") {
|
11178
|
+
formSchema = z2.object({
|
11179
|
+
phone: z2.string({
|
11180
|
+
required_error: ((_c = texts == null ? void 0 : texts.phone) == null ? void 0 : _c.required) || "Phone Number Required"
|
11181
|
+
}).refine(
|
11182
|
+
(value) => {
|
11183
|
+
let isPhoneValid = isPossiblePhoneNumber2(value) && isValidPhoneNumber2(value) && validatePhoneNumberLength2(value) === void 0;
|
11184
|
+
return isPhoneValid;
|
11185
|
+
},
|
11186
|
+
{ message: ((_d = texts == null ? void 0 : texts.phone) == null ? void 0 : _d.invalid) || "Phone Number Invalid" }
|
11187
|
+
),
|
11188
|
+
refCode: z2.string().optional(),
|
11189
|
+
reference: z2.string().optional(),
|
11190
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
11191
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
11192
|
+
}),
|
11193
|
+
newsletter_accepted: z2.boolean().optional()
|
11194
|
+
});
|
11195
|
+
} else {
|
11196
|
+
formSchema = z2.object({
|
11197
|
+
...fieldSchemas,
|
11198
|
+
password: z2.string({
|
11199
|
+
required_error: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Password is required"
|
11200
|
+
}).min(minPasswordLength, {
|
11201
|
+
message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort) || "Password is too short"
|
11202
|
+
}).refine((value) => value !== "", {
|
11203
|
+
message: ((_g = texts == null ? void 0 : texts.password) == null ? void 0 : _g.required) || "Password is required"
|
11204
|
+
}),
|
11205
|
+
confirm_password: z2.string({
|
11206
|
+
required_error: ((_h = texts == null ? void 0 : texts.confirm) == null ? void 0 : _h.required) || "Confirm password required"
|
11207
|
+
}).min(minPasswordLength, {
|
11208
|
+
message: ((_i = texts == null ? void 0 : texts.password) == null ? void 0 : _i.tooShort) || "Password is too short"
|
11209
|
+
}).refine((value) => value !== "", {
|
11210
|
+
message: ((_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required) || "Confirm password is required"
|
11211
|
+
}),
|
11212
|
+
refCode: z2.string().optional(),
|
11213
|
+
reference: z2.string().optional(),
|
11214
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
11215
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
11216
|
+
}),
|
11217
|
+
newsletter_accepted: z2.boolean().optional()
|
11218
|
+
}).refine((data) => data.password === data.confirm_password, {
|
11219
|
+
message: ((_k = texts == null ? void 0 : texts.confirm) == null ? void 0 : _k.dontMatch) || "Passwords don't match",
|
11220
|
+
path: ["confirm_password"]
|
11221
|
+
});
|
11222
|
+
}
|
11207
11223
|
const { handleSubmit, control, formState } = useForm2({
|
11208
11224
|
resolver: zodResolver2(formSchema)
|
11209
11225
|
});
|
11210
|
-
return /* @__PURE__ */ React83.createElement(
|
11211
|
-
|
11226
|
+
return /* @__PURE__ */ React83.createElement("div", { className: cn("hawa-flex hawa-flex-col", (_l = props.classNames) == null ? void 0 : _l.root) }, /* @__PURE__ */ React83.createElement(
|
11227
|
+
Card,
|
11212
11228
|
{
|
11229
|
+
dir: props.direction,
|
11213
11230
|
className: cn(
|
11214
|
-
|
11215
|
-
|
11231
|
+
(_m = props.classNames) == null ? void 0 : _m.card,
|
11232
|
+
props.cardless && "hawa-border-none hawa-bg-transparent !hawa-shadow-none !hawa-drop-shadow-none"
|
11216
11233
|
)
|
11217
11234
|
},
|
11218
11235
|
/* @__PURE__ */ React83.createElement(
|
11219
|
-
|
11236
|
+
CardContent,
|
11220
11237
|
{
|
11221
|
-
|
11222
|
-
|
11223
|
-
(_i = props.classNames) == null ? void 0 : _i.card,
|
11224
|
-
props.cardless && "hawa-border-none hawa-bg-transparent !hawa-shadow-none !hawa-drop-shadow-none"
|
11225
|
-
)
|
11238
|
+
headless: registerTypes ? registerTypes.length <= 1 : true,
|
11239
|
+
noPadding: props.cardless
|
11226
11240
|
},
|
11227
|
-
/* @__PURE__ */ React83.createElement(
|
11241
|
+
/* @__PURE__ */ React83.createElement("div", null, props.showError && /* @__PURE__ */ React83.createElement(
|
11228
11242
|
Alert,
|
11229
11243
|
{
|
11230
11244
|
direction: props.direction,
|
@@ -11245,240 +11259,352 @@ var RegisterForm = ({
|
|
11245
11259
|
if (props.onRegister) {
|
11246
11260
|
return props.onRegister(e);
|
11247
11261
|
} else {
|
11248
|
-
console.log(
|
11249
|
-
"Form is submitted but onRegister prop is missing"
|
11250
|
-
);
|
11262
|
+
console.log("Form is submitted but onRegister prop is missing");
|
11251
11263
|
}
|
11252
11264
|
}),
|
11253
11265
|
className: "hawa-flex hawa-flex-col hawa-gap-4"
|
11254
11266
|
},
|
11255
|
-
/* @__PURE__ */ React83.createElement(
|
11256
|
-
|
11257
|
-
|
11267
|
+
/* @__PURE__ */ React83.createElement(
|
11268
|
+
Tabs2,
|
11269
|
+
{
|
11270
|
+
dir: props.direction,
|
11271
|
+
value: selectedRegisterType.value,
|
11272
|
+
onValueChange: (e) => setSelectedRegisterType(
|
11273
|
+
(registerTypes == null ? void 0 : registerTypes.find((r) => r.value === e)) || registerTypes && registerTypes[0] || {
|
11274
|
+
label: "Password",
|
11275
|
+
value: "password"
|
11276
|
+
}
|
11277
|
+
)
|
11278
|
+
},
|
11279
|
+
registerTypes && registerTypes.length > 1 && /* @__PURE__ */ React83.createElement(CardHeader, { className: "hawa-w-full hawa-px-0 hawa-py-0 hawa-my-4 hawa-mt-6" }, /* @__PURE__ */ React83.createElement(TabsList2, { className: "hawa-w-full" }, registerTypes.map((registerType) => /* @__PURE__ */ React83.createElement(TabsTrigger2, { value: registerType.value }, registerType.label)))),
|
11280
|
+
/* @__PURE__ */ React83.createElement(
|
11281
|
+
TabsContent,
|
11282
|
+
{
|
11283
|
+
value: "password",
|
11284
|
+
className: cn(
|
11285
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
11286
|
+
selectedRegisterType.value === "password" ? "hawa-block" : "hawa-hidden"
|
11287
|
+
),
|
11288
|
+
dir: props.direction
|
11289
|
+
},
|
11290
|
+
/* @__PURE__ */ React83.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4" }, registerFields.map((fld, i) => {
|
11291
|
+
if (fld === "fullname") {
|
11292
|
+
return /* @__PURE__ */ React83.createElement(
|
11293
|
+
Controller2,
|
11294
|
+
{
|
11295
|
+
key: i,
|
11296
|
+
control,
|
11297
|
+
name: "fullName",
|
11298
|
+
render: ({ field }) => {
|
11299
|
+
var _a2, _b2, _c2;
|
11300
|
+
return /* @__PURE__ */ React83.createElement(
|
11301
|
+
Input,
|
11302
|
+
{
|
11303
|
+
width: "full",
|
11304
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
11305
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
11306
|
+
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
11307
|
+
...field
|
11308
|
+
}
|
11309
|
+
);
|
11310
|
+
}
|
11311
|
+
}
|
11312
|
+
);
|
11313
|
+
}
|
11314
|
+
if (fld === "email") {
|
11315
|
+
return /* @__PURE__ */ React83.createElement(
|
11316
|
+
Controller2,
|
11317
|
+
{
|
11318
|
+
key: i,
|
11319
|
+
control,
|
11320
|
+
name: "email",
|
11321
|
+
render: ({ field }) => {
|
11322
|
+
var _a2, _b2, _c2;
|
11323
|
+
return /* @__PURE__ */ React83.createElement(
|
11324
|
+
Input,
|
11325
|
+
{
|
11326
|
+
dir: "ltr",
|
11327
|
+
inputProps: {
|
11328
|
+
className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
|
11329
|
+
},
|
11330
|
+
width: "full",
|
11331
|
+
autoComplete: "email",
|
11332
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
11333
|
+
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
11334
|
+
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
11335
|
+
...field,
|
11336
|
+
onChange: (e) => {
|
11337
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
11338
|
+
}
|
11339
|
+
}
|
11340
|
+
);
|
11341
|
+
}
|
11342
|
+
}
|
11343
|
+
);
|
11344
|
+
}
|
11345
|
+
if (fld === "username") {
|
11346
|
+
return /* @__PURE__ */ React83.createElement(
|
11347
|
+
Controller2,
|
11348
|
+
{
|
11349
|
+
key: i,
|
11350
|
+
control,
|
11351
|
+
name: "username",
|
11352
|
+
render: ({ field }) => {
|
11353
|
+
var _a2, _b2, _c2, _d2;
|
11354
|
+
return /* @__PURE__ */ React83.createElement(
|
11355
|
+
Input,
|
11356
|
+
{
|
11357
|
+
width: "full",
|
11358
|
+
autoComplete: "username",
|
11359
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
11360
|
+
labelProps: {
|
11361
|
+
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
11362
|
+
},
|
11363
|
+
helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
|
11364
|
+
placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
|
11365
|
+
...field
|
11366
|
+
}
|
11367
|
+
);
|
11368
|
+
}
|
11369
|
+
}
|
11370
|
+
);
|
11371
|
+
}
|
11372
|
+
})),
|
11373
|
+
/* @__PURE__ */ React83.createElement(
|
11258
11374
|
Controller2,
|
11259
11375
|
{
|
11260
|
-
key: i,
|
11261
11376
|
control,
|
11262
|
-
name: "
|
11377
|
+
name: "password",
|
11263
11378
|
render: ({ field }) => {
|
11264
11379
|
var _a2, _b2, _c2;
|
11265
11380
|
return /* @__PURE__ */ React83.createElement(
|
11266
11381
|
Input,
|
11267
11382
|
{
|
11268
11383
|
width: "full",
|
11269
|
-
|
11270
|
-
|
11271
|
-
|
11384
|
+
type: passwordVisible ? "text" : "password",
|
11385
|
+
autoComplete: "new-password",
|
11386
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
11387
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
11388
|
+
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
11389
|
+
endIcon: /* @__PURE__ */ React83.createElement(
|
11390
|
+
"div",
|
11391
|
+
{
|
11392
|
+
className: "hawa-cursor-pointer",
|
11393
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
11394
|
+
},
|
11395
|
+
passwordVisible ? /* @__PURE__ */ React83.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ React83.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
11396
|
+
" "
|
11397
|
+
),
|
11272
11398
|
...field
|
11273
11399
|
}
|
11274
11400
|
);
|
11275
11401
|
}
|
11276
11402
|
}
|
11277
|
-
)
|
11278
|
-
|
11279
|
-
if (fld === "email") {
|
11280
|
-
return /* @__PURE__ */ React83.createElement(
|
11403
|
+
),
|
11404
|
+
/* @__PURE__ */ React83.createElement(
|
11281
11405
|
Controller2,
|
11282
11406
|
{
|
11283
|
-
key: i,
|
11284
11407
|
control,
|
11285
|
-
name: "
|
11408
|
+
name: "confirm_password",
|
11286
11409
|
render: ({ field }) => {
|
11287
11410
|
var _a2, _b2, _c2;
|
11288
11411
|
return /* @__PURE__ */ React83.createElement(
|
11289
11412
|
Input,
|
11290
11413
|
{
|
11291
|
-
dir: "ltr",
|
11292
|
-
inputProps: {
|
11293
|
-
className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
|
11294
|
-
},
|
11295
11414
|
width: "full",
|
11296
|
-
|
11297
|
-
|
11298
|
-
|
11299
|
-
placeholder: ((
|
11300
|
-
|
11301
|
-
|
11302
|
-
|
11303
|
-
|
11304
|
-
|
11305
|
-
|
11415
|
+
type: passwordVisible ? "text" : "password",
|
11416
|
+
autoComplete: "new-password",
|
11417
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
11418
|
+
placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
|
11419
|
+
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
11420
|
+
endIcon: /* @__PURE__ */ React83.createElement(
|
11421
|
+
"div",
|
11422
|
+
{
|
11423
|
+
className: "hawa-cursor-pointer",
|
11424
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
11425
|
+
},
|
11426
|
+
passwordVisible ? /* @__PURE__ */ React83.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ React83.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
11427
|
+
" "
|
11428
|
+
),
|
11429
|
+
...field
|
11306
11430
|
}
|
11307
11431
|
);
|
11308
11432
|
}
|
11309
11433
|
}
|
11310
|
-
)
|
11311
|
-
|
11312
|
-
|
11313
|
-
return /* @__PURE__ */ React83.createElement(
|
11434
|
+
),
|
11435
|
+
props.additionalInputs,
|
11436
|
+
props.showRefCode && /* @__PURE__ */ React83.createElement(
|
11314
11437
|
Controller2,
|
11315
11438
|
{
|
11316
|
-
key: i,
|
11317
11439
|
control,
|
11318
|
-
name: "
|
11440
|
+
name: "refCode",
|
11319
11441
|
render: ({ field }) => {
|
11320
|
-
var _a2
|
11442
|
+
var _a2;
|
11321
11443
|
return /* @__PURE__ */ React83.createElement(
|
11322
11444
|
Input,
|
11323
11445
|
{
|
11324
11446
|
width: "full",
|
11325
|
-
|
11326
|
-
|
11327
|
-
|
11328
|
-
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
11329
|
-
},
|
11330
|
-
helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
|
11331
|
-
placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
|
11447
|
+
label: texts == null ? void 0 : texts.refCode,
|
11448
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
11449
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
11332
11450
|
...field
|
11333
11451
|
}
|
11334
11452
|
);
|
11335
11453
|
}
|
11336
11454
|
}
|
11337
|
-
)
|
11338
|
-
|
11339
|
-
|
11340
|
-
|
11341
|
-
|
11342
|
-
|
11343
|
-
|
11344
|
-
|
11345
|
-
|
11346
|
-
|
11347
|
-
return /* @__PURE__ */ React83.createElement(
|
11348
|
-
Input,
|
11349
|
-
{
|
11350
|
-
width: "full",
|
11351
|
-
type: passwordVisible ? "text" : "password",
|
11352
|
-
endIcon: /* @__PURE__ */ React83.createElement(
|
11353
|
-
"div",
|
11455
|
+
),
|
11456
|
+
props.showUserSource && /* @__PURE__ */ React83.createElement(
|
11457
|
+
Controller2,
|
11458
|
+
{
|
11459
|
+
control,
|
11460
|
+
name: "reference",
|
11461
|
+
render: ({ field }) => {
|
11462
|
+
var _a2, _b2;
|
11463
|
+
return /* @__PURE__ */ React83.createElement(
|
11464
|
+
Select,
|
11354
11465
|
{
|
11355
|
-
|
11356
|
-
|
11357
|
-
|
11358
|
-
|
11359
|
-
|
11360
|
-
|
11361
|
-
|
11362
|
-
|
11363
|
-
|
11364
|
-
|
11365
|
-
...field
|
11466
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
11467
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
11468
|
+
isCreatable: false,
|
11469
|
+
isMulti: false,
|
11470
|
+
isSearchable: false,
|
11471
|
+
isClearable: false,
|
11472
|
+
options: props.userReferenceOptions || [],
|
11473
|
+
onChange: (e) => field.onChange(e)
|
11474
|
+
}
|
11475
|
+
);
|
11366
11476
|
}
|
11367
|
-
|
11368
|
-
|
11369
|
-
|
11370
|
-
|
11371
|
-
|
11372
|
-
|
11373
|
-
|
11374
|
-
|
11375
|
-
|
11376
|
-
|
11377
|
-
|
11378
|
-
|
11379
|
-
|
11380
|
-
|
11381
|
-
|
11382
|
-
|
11383
|
-
|
11384
|
-
|
11385
|
-
|
11386
|
-
|
11387
|
-
|
11477
|
+
}
|
11478
|
+
)
|
11479
|
+
),
|
11480
|
+
/* @__PURE__ */ React83.createElement(
|
11481
|
+
TabsContent,
|
11482
|
+
{
|
11483
|
+
value: "phone",
|
11484
|
+
className: cn(
|
11485
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
11486
|
+
selectedRegisterType.value === "phone" ? "hawa-block" : "hawa-hidden"
|
11487
|
+
),
|
11488
|
+
dir: props.direction
|
11489
|
+
},
|
11490
|
+
/* @__PURE__ */ React83.createElement(
|
11491
|
+
Controller2,
|
11492
|
+
{
|
11493
|
+
control,
|
11494
|
+
name: "phone",
|
11495
|
+
render: ({ field }) => {
|
11496
|
+
var _a2, _b2;
|
11497
|
+
return /* @__PURE__ */ React83.createElement(
|
11498
|
+
PhoneInput,
|
11499
|
+
{
|
11500
|
+
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
11501
|
+
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
11502
|
+
preferredCountry: { label: "+966" },
|
11503
|
+
...props.phoneInputProps,
|
11504
|
+
handleChange: (e) => {
|
11505
|
+
if (isValidPhoneNumber2(e) && isPossiblePhoneNumber2(e) && validatePhoneNumberLength2(e) === void 0) {
|
11506
|
+
let parsed = parsePhoneNumber2(e);
|
11507
|
+
field.onChange(parsed.number);
|
11508
|
+
} else {
|
11509
|
+
field.onChange(e);
|
11510
|
+
}
|
11511
|
+
}
|
11512
|
+
}
|
11513
|
+
);
|
11388
11514
|
}
|
11389
|
-
|
11390
|
-
|
11391
|
-
|
11392
|
-
|
11393
|
-
|
11394
|
-
|
11395
|
-
|
11396
|
-
|
11397
|
-
|
11398
|
-
|
11399
|
-
|
11400
|
-
|
11401
|
-
|
11402
|
-
|
11403
|
-
|
11404
|
-
|
11405
|
-
|
11406
|
-
|
11407
|
-
|
11408
|
-
|
11515
|
+
}
|
11516
|
+
),
|
11517
|
+
props.additionalInputs,
|
11518
|
+
props.showRefCode && /* @__PURE__ */ React83.createElement(
|
11519
|
+
Controller2,
|
11520
|
+
{
|
11521
|
+
control,
|
11522
|
+
name: "refCode",
|
11523
|
+
render: ({ field }) => {
|
11524
|
+
var _a2;
|
11525
|
+
return /* @__PURE__ */ React83.createElement(
|
11526
|
+
Input,
|
11527
|
+
{
|
11528
|
+
width: "full",
|
11529
|
+
label: texts == null ? void 0 : texts.refCode,
|
11530
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
11531
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
11532
|
+
...field
|
11533
|
+
}
|
11534
|
+
);
|
11409
11535
|
}
|
11410
|
-
|
11411
|
-
|
11412
|
-
|
11413
|
-
|
11414
|
-
|
11415
|
-
|
11416
|
-
|
11417
|
-
|
11418
|
-
|
11419
|
-
|
11420
|
-
|
11421
|
-
|
11422
|
-
|
11423
|
-
|
11424
|
-
|
11425
|
-
|
11426
|
-
|
11427
|
-
|
11428
|
-
|
11429
|
-
|
11430
|
-
|
11431
|
-
|
11536
|
+
}
|
11537
|
+
),
|
11538
|
+
props.showUserSource && /* @__PURE__ */ React83.createElement(
|
11539
|
+
Controller2,
|
11540
|
+
{
|
11541
|
+
control,
|
11542
|
+
name: "reference",
|
11543
|
+
render: ({ field }) => {
|
11544
|
+
var _a2, _b2;
|
11545
|
+
return /* @__PURE__ */ React83.createElement(
|
11546
|
+
Select,
|
11547
|
+
{
|
11548
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
11549
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
11550
|
+
isCreatable: false,
|
11551
|
+
isMulti: false,
|
11552
|
+
isSearchable: false,
|
11553
|
+
isClearable: false,
|
11554
|
+
options: props.userReferenceOptions || [],
|
11555
|
+
onChange: (e) => field.onChange(e)
|
11556
|
+
}
|
11557
|
+
);
|
11432
11558
|
}
|
11433
|
-
|
11559
|
+
}
|
11560
|
+
)
|
11561
|
+
),
|
11562
|
+
showTermsOption || showNewsletterOption ? /* @__PURE__ */ React83.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ React83.createElement(
|
11563
|
+
Controller2,
|
11564
|
+
{
|
11565
|
+
control,
|
11566
|
+
name: "terms_accepted",
|
11567
|
+
render: ({ field }) => {
|
11568
|
+
var _a2, _b2;
|
11569
|
+
return /* @__PURE__ */ React83.createElement(
|
11570
|
+
Checkbox,
|
11571
|
+
{
|
11572
|
+
id: "terms_accepted",
|
11573
|
+
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
11574
|
+
onCheckedChange: (e) => field.onChange(e),
|
11575
|
+
label: /* @__PURE__ */ React83.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__ */ React83.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React83.createElement(
|
11576
|
+
"span",
|
11577
|
+
{
|
11578
|
+
onClick: (e) => {
|
11579
|
+
e.preventDefault();
|
11580
|
+
if (props.onRouteToTOS) {
|
11581
|
+
props.onRouteToTOS();
|
11582
|
+
}
|
11583
|
+
},
|
11584
|
+
className: "clickable-link"
|
11585
|
+
},
|
11586
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
11587
|
+
)))
|
11588
|
+
}
|
11589
|
+
);
|
11590
|
+
}
|
11434
11591
|
}
|
11435
|
-
|
11436
|
-
|
11437
|
-
|
11438
|
-
|
11439
|
-
|
11440
|
-
|
11441
|
-
name: "terms_accepted",
|
11442
|
-
render: ({ field }) => {
|
11443
|
-
var _a2, _b2;
|
11444
|
-
return /* @__PURE__ */ React83.createElement(
|
11592
|
+
), showNewsletterOption && /* @__PURE__ */ React83.createElement(
|
11593
|
+
Controller2,
|
11594
|
+
{
|
11595
|
+
control,
|
11596
|
+
name: "newsletter_accepted",
|
11597
|
+
render: ({ field }) => /* @__PURE__ */ React83.createElement(
|
11445
11598
|
Checkbox,
|
11446
11599
|
{
|
11447
|
-
id: "
|
11448
|
-
|
11449
|
-
onCheckedChange:
|
11450
|
-
label: /* @__PURE__ */ React83.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__ */ React83.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React83.createElement(
|
11451
|
-
"span",
|
11452
|
-
{
|
11453
|
-
onClick: (e) => {
|
11454
|
-
e.preventDefault();
|
11455
|
-
if (props.onRouteToTOS) {
|
11456
|
-
props.onRouteToTOS();
|
11457
|
-
}
|
11458
|
-
},
|
11459
|
-
className: "clickable-link"
|
11460
|
-
},
|
11461
|
-
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
11462
|
-
)))
|
11600
|
+
id: "newsletter_accepted",
|
11601
|
+
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
11602
|
+
onCheckedChange: field.onChange
|
11463
11603
|
}
|
11464
|
-
)
|
11604
|
+
)
|
11465
11605
|
}
|
11466
|
-
|
11467
|
-
),
|
11468
|
-
Controller2,
|
11469
|
-
{
|
11470
|
-
control,
|
11471
|
-
name: "newsletter_accepted",
|
11472
|
-
render: ({ field }) => /* @__PURE__ */ React83.createElement(
|
11473
|
-
Checkbox,
|
11474
|
-
{
|
11475
|
-
id: "newsletter_accepted",
|
11476
|
-
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
11477
|
-
onCheckedChange: field.onChange
|
11478
|
-
}
|
11479
|
-
)
|
11480
|
-
}
|
11481
|
-
)) : null,
|
11606
|
+
)) : null
|
11607
|
+
),
|
11482
11608
|
/* @__PURE__ */ React83.createElement(
|
11483
11609
|
Button,
|
11484
11610
|
{
|
@@ -11490,33 +11616,33 @@ var RegisterForm = ({
|
|
11490
11616
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
11491
11617
|
),
|
11492
11618
|
props.additionalButtons
|
11493
|
-
)), props.onRouteToLogin && /* @__PURE__ */ React83.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__ */ React83.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ React83.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))
|
11494
|
-
|
11495
|
-
|
11496
|
-
|
11497
|
-
|
11498
|
-
|
11499
|
-
|
11500
|
-
|
11501
|
-
},
|
11502
|
-
/* @__PURE__ */ React83.createElement(
|
11503
|
-
AuthButtons,
|
11504
|
-
{
|
11505
|
-
texts: thirdPartyAuthTexts,
|
11506
|
-
viaGoogle: props.viaGoogle,
|
11507
|
-
viaGithub: props.viaGithub,
|
11508
|
-
viaTwitter: props.viaTwitter,
|
11509
|
-
isGoogleLoading: props.isGoogleLoading,
|
11510
|
-
isGithubLoading: props.isGithubLoading,
|
11511
|
-
isTwitterLoading: props.isTwitterLoading,
|
11512
|
-
handleGoogle: props.onGoogleRegister,
|
11513
|
-
handleGithub: props.onGithubRegister,
|
11514
|
-
handleTwitter: props.onTwitterRegister
|
11515
|
-
}
|
11619
|
+
)), props.onRouteToLogin && /* @__PURE__ */ React83.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__ */ React83.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ React83.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))
|
11620
|
+
),
|
11621
|
+
props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React83.createElement(
|
11622
|
+
CardFooter,
|
11623
|
+
{
|
11624
|
+
noPadding: props.cardless,
|
11625
|
+
className: cn(
|
11626
|
+
props.logosOnly ? "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-2" : "hawa-grid hawa-grid-cols-1 hawa-gap-2"
|
11516
11627
|
)
|
11517
|
-
|
11518
|
-
|
11519
|
-
|
11628
|
+
},
|
11629
|
+
/* @__PURE__ */ React83.createElement(
|
11630
|
+
AuthButtons,
|
11631
|
+
{
|
11632
|
+
texts: thirdPartyAuthTexts,
|
11633
|
+
viaGoogle: props.viaGoogle,
|
11634
|
+
viaGithub: props.viaGithub,
|
11635
|
+
viaTwitter: props.viaTwitter,
|
11636
|
+
isGoogleLoading: props.isGoogleLoading,
|
11637
|
+
isGithubLoading: props.isGithubLoading,
|
11638
|
+
isTwitterLoading: props.isTwitterLoading,
|
11639
|
+
handleGoogle: props.onGoogleRegister,
|
11640
|
+
handleGithub: props.onGithubRegister,
|
11641
|
+
handleTwitter: props.onTwitterRegister
|
11642
|
+
}
|
11643
|
+
)
|
11644
|
+
) : null
|
11645
|
+
));
|
11520
11646
|
};
|
11521
11647
|
|
11522
11648
|
// blocks/auth/AppLanding.tsx
|
@@ -11765,10 +11891,7 @@ import React88, { useEffect as useEffect34, useState as useState43 } from "react
|
|
11765
11891
|
import { Controller as Controller5, useForm as useForm5 } from "react-hook-form";
|
11766
11892
|
import { zodResolver as zodResolver5 } from "@hookform/resolvers/zod";
|
11767
11893
|
import * as z5 from "zod";
|
11768
|
-
var CodeConfirmation = ({
|
11769
|
-
codeLength = 6,
|
11770
|
-
...props
|
11771
|
-
}) => {
|
11894
|
+
var CodeConfirmation = ({ codeLength = 6, ...props }) => {
|
11772
11895
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
11773
11896
|
const formSchema = z5.object({
|
11774
11897
|
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 })
|
@@ -11807,14 +11930,7 @@ var CodeConfirmation = ({
|
|
11807
11930
|
}
|
11808
11931
|
};
|
11809
11932
|
}, []);
|
11810
|
-
return /* @__PURE__ */ React88.createElement(Card, null, /* @__PURE__ */ React88.createElement(CardContent, { headless: true }, props.showError && /* @__PURE__ */ React88.createElement(
|
11811
|
-
Alert,
|
11812
|
-
{
|
11813
|
-
title: props.errorTitle,
|
11814
|
-
text: props.errorText,
|
11815
|
-
severity: "error"
|
11816
|
-
}
|
11817
|
-
), /* @__PURE__ */ React88.createElement("div", { className: "hawa-mb-4 dark:hawa-text-white" }, /* @__PURE__ */ React88.createElement("div", { className: "hawa-text-lg hawa-font-bold" }, ((_c = props.texts) == null ? void 0 : _c.checkYourPhone) || "Please check your phone"), /* @__PURE__ */ React88.createElement("div", { className: "hawa-text-muted-foreground" }, /* @__PURE__ */ React88.createElement("span", null, ((_d = props.texts) == null ? void 0 : _d.weSentCode) || "We've sent a code to "), /* @__PURE__ */ React88.createElement("span", null, props.phoneNumber))), /* @__PURE__ */ React88.createElement(
|
11933
|
+
return /* @__PURE__ */ React88.createElement(Card, null, /* @__PURE__ */ React88.createElement(CardContent, { headless: true }, props.showError && /* @__PURE__ */ React88.createElement(Alert, { title: props.errorTitle, text: props.errorText, severity: "error" }), /* @__PURE__ */ React88.createElement("div", { className: "hawa-mb-4 dark:hawa-text-white" }, /* @__PURE__ */ React88.createElement("div", { className: "hawa-text-lg hawa-font-bold" }, ((_c = props.texts) == null ? void 0 : _c.checkYourIdentifier) || "Please check your phone"), /* @__PURE__ */ React88.createElement("div", { className: "hawa-text-muted-foreground" }, /* @__PURE__ */ React88.createElement("span", null, ((_d = props.texts) == null ? void 0 : _d.weSentCode) || "We've sent a code to "), /* @__PURE__ */ React88.createElement("span", null, props.identifier))), /* @__PURE__ */ React88.createElement(
|
11818
11934
|
"form",
|
11819
11935
|
{
|
11820
11936
|
noValidate: true,
|
@@ -11863,9 +11979,7 @@ var CodeConfirmation = ({
|
|
11863
11979
|
if (props.onCancel) {
|
11864
11980
|
return props.onCancel();
|
11865
11981
|
} else {
|
11866
|
-
console.log(
|
11867
|
-
"Cancel button clicked but onCancel prop is missing"
|
11868
|
-
);
|
11982
|
+
console.log("Cancel button clicked but onCancel prop is missing");
|
11869
11983
|
}
|
11870
11984
|
},
|
11871
11985
|
variant: "outline"
|