@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/blocks/index.mjs
CHANGED
@@ -17,7 +17,7 @@ import {
|
|
17
17
|
TabsList,
|
18
18
|
TabsTrigger,
|
19
19
|
Textarea
|
20
|
-
} from "../chunk-
|
20
|
+
} from "../chunk-GBLWUEYN.mjs";
|
21
21
|
import {
|
22
22
|
getHotkeyHandler
|
23
23
|
} from "../chunk-WL7C2A5D.mjs";
|
@@ -450,14 +450,7 @@ var LoginForm = ({
|
|
450
450
|
(texts == null ? void 0 : texts.loginText) || "Login"
|
451
451
|
),
|
452
452
|
props.additionalButtons && props.additionalButtons,
|
453
|
-
props.allowRegister && /* @__PURE__ */ React2.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__ */ React2.createElement(
|
454
|
-
"span",
|
455
|
-
{
|
456
|
-
onClick: props.onRouteToRegister,
|
457
|
-
className: "clickable-link"
|
458
|
-
},
|
459
|
-
(texts == null ? void 0 : texts.createAccount) || "Create Account"
|
460
|
-
))
|
453
|
+
props.allowRegister && /* @__PURE__ */ React2.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__ */ React2.createElement("span", { onClick: props.onRouteToRegister, className: "clickable-link" }, (texts == null ? void 0 : texts.createAccount) || "Create Account"))
|
461
454
|
)),
|
462
455
|
props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React2.createElement(
|
463
456
|
CardFooter,
|
@@ -490,6 +483,12 @@ var LoginForm = ({
|
|
490
483
|
import React3, { useState as useState2 } from "react";
|
491
484
|
import { Controller as Controller2, FormProvider, useForm as useForm2 } from "react-hook-form";
|
492
485
|
import { zodResolver as zodResolver2 } from "@hookform/resolvers/zod";
|
486
|
+
import {
|
487
|
+
isPossiblePhoneNumber as isPossiblePhoneNumber2,
|
488
|
+
isValidPhoneNumber as isValidPhoneNumber2,
|
489
|
+
parsePhoneNumber as parsePhoneNumber2,
|
490
|
+
validatePhoneNumberLength as validatePhoneNumberLength2
|
491
|
+
} from "libphonenumber-js";
|
493
492
|
import * as z2 from "zod";
|
494
493
|
var RegisterForm = ({
|
495
494
|
texts,
|
@@ -497,10 +496,15 @@ var RegisterForm = ({
|
|
497
496
|
minPasswordLength = 8,
|
498
497
|
showTermsOption = false,
|
499
498
|
showNewsletterOption = false,
|
499
|
+
registerTypes,
|
500
500
|
...props
|
501
501
|
}) => {
|
502
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
502
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
503
503
|
const [passwordVisible, setPasswordVisible] = useState2(false);
|
504
|
+
const [selectedRegisterType, setSelectedRegisterType] = useState2({
|
505
|
+
value: ((_a = registerTypes == null ? void 0 : registerTypes[0]) == null ? void 0 : _a.value) || "password",
|
506
|
+
label: ((_b = registerTypes == null ? void 0 : registerTypes[0]) == null ? void 0 : _b.label) || "Password"
|
507
|
+
});
|
504
508
|
const thirdPartyAuthTexts = {
|
505
509
|
continueWithGoogle: texts == null ? void 0 : texts.continueWithGoogle,
|
506
510
|
continueWithTwitter: texts == null ? void 0 : texts.continueWithTwitter,
|
@@ -512,8 +516,12 @@ var RegisterForm = ({
|
|
512
516
|
};
|
513
517
|
const methods = useForm2();
|
514
518
|
let fieldSchemas = {};
|
519
|
+
const hasPhoneType = registerTypes == null ? void 0 : registerTypes.some((type) => type.value === "phone");
|
520
|
+
if (hasPhoneType && selectedRegisterType.value === "phone") {
|
521
|
+
registerFields = ["phone"];
|
522
|
+
}
|
515
523
|
registerFields.forEach((field) => {
|
516
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
524
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
517
525
|
switch (field) {
|
518
526
|
case "fullname":
|
519
527
|
fieldSchemas["fullName"] = z2.string().optional();
|
@@ -538,55 +546,85 @@ var RegisterForm = ({
|
|
538
546
|
{ message: ((_g2 = texts == null ? void 0 : texts.username) == null ? void 0 : _g2.invalid) || "Invalid username" }
|
539
547
|
);
|
540
548
|
break;
|
549
|
+
case "phone":
|
550
|
+
fieldSchemas["phone"] = z2.string({
|
551
|
+
required_error: ((_h2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _h2.required) || "Phone Number Required"
|
552
|
+
}).refine(
|
553
|
+
(value) => {
|
554
|
+
let isPhoneValid = isPossiblePhoneNumber2(value) && isValidPhoneNumber2(value) && validatePhoneNumberLength2(value) === void 0;
|
555
|
+
return isPhoneValid;
|
556
|
+
},
|
557
|
+
{ message: ((_i2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _i2.invalid) || "Phone Number Invalid" }
|
558
|
+
);
|
559
|
+
break;
|
541
560
|
}
|
542
561
|
});
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
562
|
+
let formSchema;
|
563
|
+
if (selectedRegisterType.value === "phone") {
|
564
|
+
formSchema = z2.object({
|
565
|
+
phone: z2.string({
|
566
|
+
required_error: ((_c = texts == null ? void 0 : texts.phone) == null ? void 0 : _c.required) || "Phone Number Required"
|
567
|
+
}).refine(
|
568
|
+
(value) => {
|
569
|
+
let isPhoneValid = isPossiblePhoneNumber2(value) && isValidPhoneNumber2(value) && validatePhoneNumberLength2(value) === void 0;
|
570
|
+
return isPhoneValid;
|
571
|
+
},
|
572
|
+
{ message: ((_d = texts == null ? void 0 : texts.phone) == null ? void 0 : _d.invalid) || "Phone Number Invalid" }
|
573
|
+
),
|
574
|
+
refCode: z2.string().optional(),
|
575
|
+
reference: z2.string().optional(),
|
576
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
577
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
578
|
+
}),
|
579
|
+
newsletter_accepted: z2.boolean().optional()
|
580
|
+
});
|
581
|
+
} else {
|
582
|
+
formSchema = z2.object({
|
583
|
+
...fieldSchemas,
|
584
|
+
password: z2.string({
|
585
|
+
required_error: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Password is required"
|
586
|
+
}).min(minPasswordLength, {
|
587
|
+
message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort) || "Password is too short"
|
588
|
+
}).refine((value) => value !== "", {
|
589
|
+
message: ((_g = texts == null ? void 0 : texts.password) == null ? void 0 : _g.required) || "Password is required"
|
590
|
+
}),
|
591
|
+
confirm_password: z2.string({
|
592
|
+
required_error: ((_h = texts == null ? void 0 : texts.confirm) == null ? void 0 : _h.required) || "Confirm password required"
|
593
|
+
}).min(minPasswordLength, {
|
594
|
+
message: ((_i = texts == null ? void 0 : texts.password) == null ? void 0 : _i.tooShort) || "Password is too short"
|
595
|
+
}).refine((value) => value !== "", {
|
596
|
+
message: ((_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required) || "Confirm password is required"
|
597
|
+
}),
|
598
|
+
refCode: z2.string().optional(),
|
599
|
+
reference: z2.string().optional(),
|
600
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
601
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
602
|
+
}),
|
603
|
+
newsletter_accepted: z2.boolean().optional()
|
604
|
+
}).refine((data) => data.password === data.confirm_password, {
|
605
|
+
message: ((_k = texts == null ? void 0 : texts.confirm) == null ? void 0 : _k.dontMatch) || "Passwords don't match",
|
606
|
+
path: ["confirm_password"]
|
607
|
+
});
|
608
|
+
}
|
569
609
|
const { handleSubmit, control, formState } = useForm2({
|
570
610
|
resolver: zodResolver2(formSchema)
|
571
611
|
});
|
572
|
-
return /* @__PURE__ */ React3.createElement(
|
573
|
-
|
612
|
+
return /* @__PURE__ */ React3.createElement("div", { className: cn("hawa-flex hawa-flex-col", (_l = props.classNames) == null ? void 0 : _l.root) }, /* @__PURE__ */ React3.createElement(
|
613
|
+
Card,
|
574
614
|
{
|
615
|
+
dir: props.direction,
|
575
616
|
className: cn(
|
576
|
-
|
577
|
-
|
617
|
+
(_m = props.classNames) == null ? void 0 : _m.card,
|
618
|
+
props.cardless && "hawa-border-none hawa-bg-transparent !hawa-shadow-none !hawa-drop-shadow-none"
|
578
619
|
)
|
579
620
|
},
|
580
621
|
/* @__PURE__ */ React3.createElement(
|
581
|
-
|
622
|
+
CardContent,
|
582
623
|
{
|
583
|
-
|
584
|
-
|
585
|
-
(_i = props.classNames) == null ? void 0 : _i.card,
|
586
|
-
props.cardless && "hawa-border-none hawa-bg-transparent !hawa-shadow-none !hawa-drop-shadow-none"
|
587
|
-
)
|
624
|
+
headless: registerTypes ? registerTypes.length <= 1 : true,
|
625
|
+
noPadding: props.cardless
|
588
626
|
},
|
589
|
-
/* @__PURE__ */ React3.createElement(
|
627
|
+
/* @__PURE__ */ React3.createElement("div", null, props.showError && /* @__PURE__ */ React3.createElement(
|
590
628
|
Alert,
|
591
629
|
{
|
592
630
|
direction: props.direction,
|
@@ -607,240 +645,352 @@ var RegisterForm = ({
|
|
607
645
|
if (props.onRegister) {
|
608
646
|
return props.onRegister(e);
|
609
647
|
} else {
|
610
|
-
console.log(
|
611
|
-
"Form is submitted but onRegister prop is missing"
|
612
|
-
);
|
648
|
+
console.log("Form is submitted but onRegister prop is missing");
|
613
649
|
}
|
614
650
|
}),
|
615
651
|
className: "hawa-flex hawa-flex-col hawa-gap-4"
|
616
652
|
},
|
617
|
-
/* @__PURE__ */ React3.createElement(
|
618
|
-
|
619
|
-
|
653
|
+
/* @__PURE__ */ React3.createElement(
|
654
|
+
Tabs,
|
655
|
+
{
|
656
|
+
dir: props.direction,
|
657
|
+
value: selectedRegisterType.value,
|
658
|
+
onValueChange: (e) => setSelectedRegisterType(
|
659
|
+
(registerTypes == null ? void 0 : registerTypes.find((r) => r.value === e)) || registerTypes && registerTypes[0] || {
|
660
|
+
label: "Password",
|
661
|
+
value: "password"
|
662
|
+
}
|
663
|
+
)
|
664
|
+
},
|
665
|
+
registerTypes && registerTypes.length > 1 && /* @__PURE__ */ React3.createElement(CardHeader, { className: "hawa-w-full hawa-px-0 hawa-py-0 hawa-my-4 hawa-mt-6" }, /* @__PURE__ */ React3.createElement(TabsList, { className: "hawa-w-full" }, registerTypes.map((registerType) => /* @__PURE__ */ React3.createElement(TabsTrigger, { value: registerType.value }, registerType.label)))),
|
666
|
+
/* @__PURE__ */ React3.createElement(
|
667
|
+
TabsContent,
|
668
|
+
{
|
669
|
+
value: "password",
|
670
|
+
className: cn(
|
671
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
672
|
+
selectedRegisterType.value === "password" ? "hawa-block" : "hawa-hidden"
|
673
|
+
),
|
674
|
+
dir: props.direction
|
675
|
+
},
|
676
|
+
/* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4" }, registerFields.map((fld, i) => {
|
677
|
+
if (fld === "fullname") {
|
678
|
+
return /* @__PURE__ */ React3.createElement(
|
679
|
+
Controller2,
|
680
|
+
{
|
681
|
+
key: i,
|
682
|
+
control,
|
683
|
+
name: "fullName",
|
684
|
+
render: ({ field }) => {
|
685
|
+
var _a2, _b2, _c2;
|
686
|
+
return /* @__PURE__ */ React3.createElement(
|
687
|
+
Input,
|
688
|
+
{
|
689
|
+
width: "full",
|
690
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
691
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
692
|
+
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
693
|
+
...field
|
694
|
+
}
|
695
|
+
);
|
696
|
+
}
|
697
|
+
}
|
698
|
+
);
|
699
|
+
}
|
700
|
+
if (fld === "email") {
|
701
|
+
return /* @__PURE__ */ React3.createElement(
|
702
|
+
Controller2,
|
703
|
+
{
|
704
|
+
key: i,
|
705
|
+
control,
|
706
|
+
name: "email",
|
707
|
+
render: ({ field }) => {
|
708
|
+
var _a2, _b2, _c2;
|
709
|
+
return /* @__PURE__ */ React3.createElement(
|
710
|
+
Input,
|
711
|
+
{
|
712
|
+
dir: "ltr",
|
713
|
+
inputProps: {
|
714
|
+
className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
|
715
|
+
},
|
716
|
+
width: "full",
|
717
|
+
autoComplete: "email",
|
718
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
719
|
+
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
720
|
+
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
721
|
+
...field,
|
722
|
+
onChange: (e) => {
|
723
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
724
|
+
}
|
725
|
+
}
|
726
|
+
);
|
727
|
+
}
|
728
|
+
}
|
729
|
+
);
|
730
|
+
}
|
731
|
+
if (fld === "username") {
|
732
|
+
return /* @__PURE__ */ React3.createElement(
|
733
|
+
Controller2,
|
734
|
+
{
|
735
|
+
key: i,
|
736
|
+
control,
|
737
|
+
name: "username",
|
738
|
+
render: ({ field }) => {
|
739
|
+
var _a2, _b2, _c2, _d2;
|
740
|
+
return /* @__PURE__ */ React3.createElement(
|
741
|
+
Input,
|
742
|
+
{
|
743
|
+
width: "full",
|
744
|
+
autoComplete: "username",
|
745
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
746
|
+
labelProps: {
|
747
|
+
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
748
|
+
},
|
749
|
+
helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
|
750
|
+
placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
|
751
|
+
...field
|
752
|
+
}
|
753
|
+
);
|
754
|
+
}
|
755
|
+
}
|
756
|
+
);
|
757
|
+
}
|
758
|
+
})),
|
759
|
+
/* @__PURE__ */ React3.createElement(
|
620
760
|
Controller2,
|
621
761
|
{
|
622
|
-
key: i,
|
623
762
|
control,
|
624
|
-
name: "
|
763
|
+
name: "password",
|
625
764
|
render: ({ field }) => {
|
626
765
|
var _a2, _b2, _c2;
|
627
766
|
return /* @__PURE__ */ React3.createElement(
|
628
767
|
Input,
|
629
768
|
{
|
630
769
|
width: "full",
|
631
|
-
|
632
|
-
|
633
|
-
|
770
|
+
type: passwordVisible ? "text" : "password",
|
771
|
+
autoComplete: "new-password",
|
772
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
773
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
774
|
+
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
775
|
+
endIcon: /* @__PURE__ */ React3.createElement(
|
776
|
+
"div",
|
777
|
+
{
|
778
|
+
className: "hawa-cursor-pointer",
|
779
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
780
|
+
},
|
781
|
+
passwordVisible ? /* @__PURE__ */ React3.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ React3.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
782
|
+
" "
|
783
|
+
),
|
634
784
|
...field
|
635
785
|
}
|
636
786
|
);
|
637
787
|
}
|
638
788
|
}
|
639
|
-
)
|
640
|
-
|
641
|
-
if (fld === "email") {
|
642
|
-
return /* @__PURE__ */ React3.createElement(
|
789
|
+
),
|
790
|
+
/* @__PURE__ */ React3.createElement(
|
643
791
|
Controller2,
|
644
792
|
{
|
645
|
-
key: i,
|
646
793
|
control,
|
647
|
-
name: "
|
794
|
+
name: "confirm_password",
|
648
795
|
render: ({ field }) => {
|
649
796
|
var _a2, _b2, _c2;
|
650
797
|
return /* @__PURE__ */ React3.createElement(
|
651
798
|
Input,
|
652
799
|
{
|
653
|
-
dir: "ltr",
|
654
|
-
inputProps: {
|
655
|
-
className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
|
656
|
-
},
|
657
800
|
width: "full",
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
placeholder: ((
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
801
|
+
type: passwordVisible ? "text" : "password",
|
802
|
+
autoComplete: "new-password",
|
803
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
804
|
+
placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
|
805
|
+
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
806
|
+
endIcon: /* @__PURE__ */ React3.createElement(
|
807
|
+
"div",
|
808
|
+
{
|
809
|
+
className: "hawa-cursor-pointer",
|
810
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
811
|
+
},
|
812
|
+
passwordVisible ? /* @__PURE__ */ React3.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ React3.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
813
|
+
" "
|
814
|
+
),
|
815
|
+
...field
|
668
816
|
}
|
669
817
|
);
|
670
818
|
}
|
671
819
|
}
|
672
|
-
)
|
673
|
-
|
674
|
-
|
675
|
-
return /* @__PURE__ */ React3.createElement(
|
820
|
+
),
|
821
|
+
props.additionalInputs,
|
822
|
+
props.showRefCode && /* @__PURE__ */ React3.createElement(
|
676
823
|
Controller2,
|
677
824
|
{
|
678
|
-
key: i,
|
679
825
|
control,
|
680
|
-
name: "
|
826
|
+
name: "refCode",
|
681
827
|
render: ({ field }) => {
|
682
|
-
var _a2
|
828
|
+
var _a2;
|
683
829
|
return /* @__PURE__ */ React3.createElement(
|
684
830
|
Input,
|
685
831
|
{
|
686
832
|
width: "full",
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
691
|
-
},
|
692
|
-
helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
|
693
|
-
placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
|
833
|
+
label: texts == null ? void 0 : texts.refCode,
|
834
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
835
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
694
836
|
...field
|
695
837
|
}
|
696
838
|
);
|
697
839
|
}
|
698
840
|
}
|
699
|
-
)
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
return /* @__PURE__ */ React3.createElement(
|
710
|
-
Input,
|
711
|
-
{
|
712
|
-
width: "full",
|
713
|
-
type: passwordVisible ? "text" : "password",
|
714
|
-
endIcon: /* @__PURE__ */ React3.createElement(
|
715
|
-
"div",
|
841
|
+
),
|
842
|
+
props.showUserSource && /* @__PURE__ */ React3.createElement(
|
843
|
+
Controller2,
|
844
|
+
{
|
845
|
+
control,
|
846
|
+
name: "reference",
|
847
|
+
render: ({ field }) => {
|
848
|
+
var _a2, _b2;
|
849
|
+
return /* @__PURE__ */ React3.createElement(
|
850
|
+
Select,
|
716
851
|
{
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
...field
|
852
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
853
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
854
|
+
isCreatable: false,
|
855
|
+
isMulti: false,
|
856
|
+
isSearchable: false,
|
857
|
+
isClearable: false,
|
858
|
+
options: props.userReferenceOptions || [],
|
859
|
+
onChange: (e) => field.onChange(e)
|
860
|
+
}
|
861
|
+
);
|
728
862
|
}
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
863
|
+
}
|
864
|
+
)
|
865
|
+
),
|
866
|
+
/* @__PURE__ */ React3.createElement(
|
867
|
+
TabsContent,
|
868
|
+
{
|
869
|
+
value: "phone",
|
870
|
+
className: cn(
|
871
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
872
|
+
selectedRegisterType.value === "phone" ? "hawa-block" : "hawa-hidden"
|
873
|
+
),
|
874
|
+
dir: props.direction
|
875
|
+
},
|
876
|
+
/* @__PURE__ */ React3.createElement(
|
877
|
+
Controller2,
|
878
|
+
{
|
879
|
+
control,
|
880
|
+
name: "phone",
|
881
|
+
render: ({ field }) => {
|
882
|
+
var _a2, _b2;
|
883
|
+
return /* @__PURE__ */ React3.createElement(
|
884
|
+
PhoneInput,
|
885
|
+
{
|
886
|
+
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
887
|
+
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
888
|
+
preferredCountry: { label: "+966" },
|
889
|
+
...props.phoneInputProps,
|
890
|
+
handleChange: (e) => {
|
891
|
+
if (isValidPhoneNumber2(e) && isPossiblePhoneNumber2(e) && validatePhoneNumberLength2(e) === void 0) {
|
892
|
+
let parsed = parsePhoneNumber2(e);
|
893
|
+
field.onChange(parsed.number);
|
894
|
+
} else {
|
895
|
+
field.onChange(e);
|
896
|
+
}
|
897
|
+
}
|
898
|
+
}
|
899
|
+
);
|
750
900
|
}
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
901
|
+
}
|
902
|
+
),
|
903
|
+
props.additionalInputs,
|
904
|
+
props.showRefCode && /* @__PURE__ */ React3.createElement(
|
905
|
+
Controller2,
|
906
|
+
{
|
907
|
+
control,
|
908
|
+
name: "refCode",
|
909
|
+
render: ({ field }) => {
|
910
|
+
var _a2;
|
911
|
+
return /* @__PURE__ */ React3.createElement(
|
912
|
+
Input,
|
913
|
+
{
|
914
|
+
width: "full",
|
915
|
+
label: texts == null ? void 0 : texts.refCode,
|
916
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
917
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
918
|
+
...field
|
919
|
+
}
|
920
|
+
);
|
771
921
|
}
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
922
|
+
}
|
923
|
+
),
|
924
|
+
props.showUserSource && /* @__PURE__ */ React3.createElement(
|
925
|
+
Controller2,
|
926
|
+
{
|
927
|
+
control,
|
928
|
+
name: "reference",
|
929
|
+
render: ({ field }) => {
|
930
|
+
var _a2, _b2;
|
931
|
+
return /* @__PURE__ */ React3.createElement(
|
932
|
+
Select,
|
933
|
+
{
|
934
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
935
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
936
|
+
isCreatable: false,
|
937
|
+
isMulti: false,
|
938
|
+
isSearchable: false,
|
939
|
+
isClearable: false,
|
940
|
+
options: props.userReferenceOptions || [],
|
941
|
+
onChange: (e) => field.onChange(e)
|
942
|
+
}
|
943
|
+
);
|
794
944
|
}
|
795
|
-
|
945
|
+
}
|
946
|
+
)
|
947
|
+
),
|
948
|
+
showTermsOption || showNewsletterOption ? /* @__PURE__ */ React3.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ React3.createElement(
|
949
|
+
Controller2,
|
950
|
+
{
|
951
|
+
control,
|
952
|
+
name: "terms_accepted",
|
953
|
+
render: ({ field }) => {
|
954
|
+
var _a2, _b2;
|
955
|
+
return /* @__PURE__ */ React3.createElement(
|
956
|
+
Checkbox,
|
957
|
+
{
|
958
|
+
id: "terms_accepted",
|
959
|
+
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
960
|
+
onCheckedChange: (e) => field.onChange(e),
|
961
|
+
label: /* @__PURE__ */ React3.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__ */ React3.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React3.createElement(
|
962
|
+
"span",
|
963
|
+
{
|
964
|
+
onClick: (e) => {
|
965
|
+
e.preventDefault();
|
966
|
+
if (props.onRouteToTOS) {
|
967
|
+
props.onRouteToTOS();
|
968
|
+
}
|
969
|
+
},
|
970
|
+
className: "clickable-link"
|
971
|
+
},
|
972
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
973
|
+
)))
|
974
|
+
}
|
975
|
+
);
|
976
|
+
}
|
796
977
|
}
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
name: "terms_accepted",
|
804
|
-
render: ({ field }) => {
|
805
|
-
var _a2, _b2;
|
806
|
-
return /* @__PURE__ */ React3.createElement(
|
978
|
+
), showNewsletterOption && /* @__PURE__ */ React3.createElement(
|
979
|
+
Controller2,
|
980
|
+
{
|
981
|
+
control,
|
982
|
+
name: "newsletter_accepted",
|
983
|
+
render: ({ field }) => /* @__PURE__ */ React3.createElement(
|
807
984
|
Checkbox,
|
808
985
|
{
|
809
|
-
id: "
|
810
|
-
|
811
|
-
onCheckedChange:
|
812
|
-
label: /* @__PURE__ */ React3.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__ */ React3.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React3.createElement(
|
813
|
-
"span",
|
814
|
-
{
|
815
|
-
onClick: (e) => {
|
816
|
-
e.preventDefault();
|
817
|
-
if (props.onRouteToTOS) {
|
818
|
-
props.onRouteToTOS();
|
819
|
-
}
|
820
|
-
},
|
821
|
-
className: "clickable-link"
|
822
|
-
},
|
823
|
-
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
824
|
-
)))
|
986
|
+
id: "newsletter_accepted",
|
987
|
+
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
988
|
+
onCheckedChange: field.onChange
|
825
989
|
}
|
826
|
-
)
|
990
|
+
)
|
827
991
|
}
|
828
|
-
|
829
|
-
),
|
830
|
-
Controller2,
|
831
|
-
{
|
832
|
-
control,
|
833
|
-
name: "newsletter_accepted",
|
834
|
-
render: ({ field }) => /* @__PURE__ */ React3.createElement(
|
835
|
-
Checkbox,
|
836
|
-
{
|
837
|
-
id: "newsletter_accepted",
|
838
|
-
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
839
|
-
onCheckedChange: field.onChange
|
840
|
-
}
|
841
|
-
)
|
842
|
-
}
|
843
|
-
)) : null,
|
992
|
+
)) : null
|
993
|
+
),
|
844
994
|
/* @__PURE__ */ React3.createElement(
|
845
995
|
Button,
|
846
996
|
{
|
@@ -852,33 +1002,33 @@ var RegisterForm = ({
|
|
852
1002
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
853
1003
|
),
|
854
1004
|
props.additionalButtons
|
855
|
-
)), props.onRouteToLogin && /* @__PURE__ */ React3.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__ */ React3.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ React3.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
},
|
864
|
-
/* @__PURE__ */ React3.createElement(
|
865
|
-
AuthButtons,
|
866
|
-
{
|
867
|
-
texts: thirdPartyAuthTexts,
|
868
|
-
viaGoogle: props.viaGoogle,
|
869
|
-
viaGithub: props.viaGithub,
|
870
|
-
viaTwitter: props.viaTwitter,
|
871
|
-
isGoogleLoading: props.isGoogleLoading,
|
872
|
-
isGithubLoading: props.isGithubLoading,
|
873
|
-
isTwitterLoading: props.isTwitterLoading,
|
874
|
-
handleGoogle: props.onGoogleRegister,
|
875
|
-
handleGithub: props.onGithubRegister,
|
876
|
-
handleTwitter: props.onTwitterRegister
|
877
|
-
}
|
1005
|
+
)), props.onRouteToLogin && /* @__PURE__ */ React3.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__ */ React3.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ React3.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))
|
1006
|
+
),
|
1007
|
+
props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React3.createElement(
|
1008
|
+
CardFooter,
|
1009
|
+
{
|
1010
|
+
noPadding: props.cardless,
|
1011
|
+
className: cn(
|
1012
|
+
props.logosOnly ? "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-2" : "hawa-grid hawa-grid-cols-1 hawa-gap-2"
|
878
1013
|
)
|
879
|
-
|
880
|
-
|
881
|
-
|
1014
|
+
},
|
1015
|
+
/* @__PURE__ */ React3.createElement(
|
1016
|
+
AuthButtons,
|
1017
|
+
{
|
1018
|
+
texts: thirdPartyAuthTexts,
|
1019
|
+
viaGoogle: props.viaGoogle,
|
1020
|
+
viaGithub: props.viaGithub,
|
1021
|
+
viaTwitter: props.viaTwitter,
|
1022
|
+
isGoogleLoading: props.isGoogleLoading,
|
1023
|
+
isGithubLoading: props.isGithubLoading,
|
1024
|
+
isTwitterLoading: props.isTwitterLoading,
|
1025
|
+
handleGoogle: props.onGoogleRegister,
|
1026
|
+
handleGithub: props.onGithubRegister,
|
1027
|
+
handleTwitter: props.onTwitterRegister
|
1028
|
+
}
|
1029
|
+
)
|
1030
|
+
) : null
|
1031
|
+
));
|
882
1032
|
};
|
883
1033
|
|
884
1034
|
// blocks/auth/AppLanding.tsx
|
@@ -1127,10 +1277,7 @@ import React8, { useEffect, useState as useState3 } from "react";
|
|
1127
1277
|
import { Controller as Controller5, useForm as useForm5 } from "react-hook-form";
|
1128
1278
|
import { zodResolver as zodResolver5 } from "@hookform/resolvers/zod";
|
1129
1279
|
import * as z5 from "zod";
|
1130
|
-
var CodeConfirmation = ({
|
1131
|
-
codeLength = 6,
|
1132
|
-
...props
|
1133
|
-
}) => {
|
1280
|
+
var CodeConfirmation = ({ codeLength = 6, ...props }) => {
|
1134
1281
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
1135
1282
|
const formSchema = z5.object({
|
1136
1283
|
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 })
|
@@ -1169,14 +1316,7 @@ var CodeConfirmation = ({
|
|
1169
1316
|
}
|
1170
1317
|
};
|
1171
1318
|
}, []);
|
1172
|
-
return /* @__PURE__ */ React8.createElement(Card, null, /* @__PURE__ */ React8.createElement(CardContent, { headless: true }, props.showError && /* @__PURE__ */ React8.createElement(
|
1173
|
-
Alert,
|
1174
|
-
{
|
1175
|
-
title: props.errorTitle,
|
1176
|
-
text: props.errorText,
|
1177
|
-
severity: "error"
|
1178
|
-
}
|
1179
|
-
), /* @__PURE__ */ React8.createElement("div", { className: "hawa-mb-4 dark:hawa-text-white" }, /* @__PURE__ */ React8.createElement("div", { className: "hawa-text-lg hawa-font-bold" }, ((_c = props.texts) == null ? void 0 : _c.checkYourPhone) || "Please check your phone"), /* @__PURE__ */ React8.createElement("div", { className: "hawa-text-muted-foreground" }, /* @__PURE__ */ React8.createElement("span", null, ((_d = props.texts) == null ? void 0 : _d.weSentCode) || "We've sent a code to "), /* @__PURE__ */ React8.createElement("span", null, props.phoneNumber))), /* @__PURE__ */ React8.createElement(
|
1319
|
+
return /* @__PURE__ */ React8.createElement(Card, null, /* @__PURE__ */ React8.createElement(CardContent, { headless: true }, props.showError && /* @__PURE__ */ React8.createElement(Alert, { title: props.errorTitle, text: props.errorText, severity: "error" }), /* @__PURE__ */ React8.createElement("div", { className: "hawa-mb-4 dark:hawa-text-white" }, /* @__PURE__ */ React8.createElement("div", { className: "hawa-text-lg hawa-font-bold" }, ((_c = props.texts) == null ? void 0 : _c.checkYourIdentifier) || "Please check your phone"), /* @__PURE__ */ React8.createElement("div", { className: "hawa-text-muted-foreground" }, /* @__PURE__ */ React8.createElement("span", null, ((_d = props.texts) == null ? void 0 : _d.weSentCode) || "We've sent a code to "), /* @__PURE__ */ React8.createElement("span", null, props.identifier))), /* @__PURE__ */ React8.createElement(
|
1180
1320
|
"form",
|
1181
1321
|
{
|
1182
1322
|
noValidate: true,
|
@@ -1225,9 +1365,7 @@ var CodeConfirmation = ({
|
|
1225
1365
|
if (props.onCancel) {
|
1226
1366
|
return props.onCancel();
|
1227
1367
|
} else {
|
1228
|
-
console.log(
|
1229
|
-
"Cancel button clicked but onCancel prop is missing"
|
1230
|
-
);
|
1368
|
+
console.log("Cancel button clicked but onCancel prop is missing");
|
1231
1369
|
}
|
1232
1370
|
},
|
1233
1371
|
variant: "outline"
|