@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.
Files changed (55) hide show
  1. package/dist/{Radio-Dyvlywnk.d.mts → Radio-BPHTeDMz.d.mts} +8 -7
  2. package/dist/{Radio-DlPwVCG4.d.ts → Radio-cRcIH8_L.d.ts} +8 -7
  3. package/dist/blocks/auth/index.d.mts +34 -17
  4. package/dist/blocks/auth/index.d.ts +34 -17
  5. package/dist/blocks/auth/index.js +1008 -430
  6. package/dist/blocks/auth/index.mjs +427 -297
  7. package/dist/blocks/feedback/index.d.mts +1 -1
  8. package/dist/blocks/feedback/index.d.ts +1 -1
  9. package/dist/blocks/feedback/index.js +68 -79
  10. package/dist/blocks/feedback/index.mjs +1 -1
  11. package/dist/blocks/index.d.mts +28 -11
  12. package/dist/blocks/index.d.ts +28 -11
  13. package/dist/blocks/index.js +2340 -2233
  14. package/dist/blocks/index.mjs +407 -269
  15. package/dist/blocks/misc/index.d.mts +1 -1
  16. package/dist/blocks/misc/index.d.ts +1 -1
  17. package/dist/blocks/misc/index.js +68 -79
  18. package/dist/blocks/misc/index.mjs +50 -367
  19. package/dist/blocks/pricing/index.d.mts +1 -1
  20. package/dist/blocks/pricing/index.d.ts +1 -1
  21. package/dist/blocks/pricing/index.mjs +1 -1
  22. package/dist/{chunk-6TG2PHZK.mjs → chunk-AWJSHOYU.mjs} +68 -79
  23. package/dist/{chunk-5CTMGPEF.mjs → chunk-GBLWUEYN.mjs} +650 -674
  24. package/dist/chunk-JFWD2ICY.mjs +511 -0
  25. package/dist/elements/index.d.mts +2 -2
  26. package/dist/elements/index.d.ts +2 -2
  27. package/dist/elements/index.js +81 -105
  28. package/dist/elements/index.mjs +1 -1
  29. package/dist/index.css +7 -0
  30. package/dist/index.d.mts +36 -17
  31. package/dist/index.d.ts +36 -17
  32. package/dist/index.js +482 -373
  33. package/dist/index.mjs +487 -373
  34. package/dist/phoneInput/index.d.mts +7 -7
  35. package/dist/phoneInput/index.d.ts +7 -7
  36. package/dist/phoneInput/index.js +78 -85
  37. package/dist/phoneInput/index.js.map +1 -1
  38. package/dist/phoneInput/index.mjs +78 -85
  39. package/dist/phoneInput/index.mjs.map +1 -1
  40. package/dist/pinInput/index.js +3 -20
  41. package/dist/pinInput/index.js.map +1 -1
  42. package/dist/pinInput/index.mjs +3 -20
  43. package/dist/pinInput/index.mjs.map +1 -1
  44. package/dist/select/index.d.mts +1 -0
  45. package/dist/select/index.d.ts +1 -0
  46. package/dist/select/index.js +68 -79
  47. package/dist/select/index.js.map +1 -1
  48. package/dist/select/index.mjs +68 -79
  49. package/dist/select/index.mjs.map +1 -1
  50. package/dist/{textTypes-DXLtO2fL.d.mts → textTypes-CYQYIsFt.d.mts} +1 -0
  51. package/dist/{textTypes-DXLtO2fL.d.ts → textTypes-CYQYIsFt.d.ts} +1 -0
  52. package/dist/types/index.d.mts +1 -0
  53. package/dist/types/index.d.ts +1 -0
  54. package/package.json +1 -1
  55. 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
- // TODO: enable keyboard to go to the next item in the list
5871
- /* @__PURE__ */ import_react35.default.createElement(
5872
- import_react_select.default,
5873
- {
5874
- noOptionsMessage: NoOption,
5875
- classNames: {
5876
- control: () => cn(
5877
- props.phoneCode && "hawa-rounded-r-none",
5878
- props.controlClassNames
5879
- ),
5880
- container: () => cn(
5881
- selectContainerStyles,
5882
- props.phoneCode && phoneCodeStyles,
5883
- props.isMulti && "hawa-ps-0 "
5884
- ),
5885
- placeholder: () => cn(
5886
- selectPlaceholderStyles,
5887
- props.disabled && "hawa-text-muted-foreground"
5888
- ),
5889
- valueContainer: () => "hawa-text-foreground hawa-px-1 ",
5890
- singleValue: () => cn(
5891
- props.disabled ? "hawa-text-muted-foreground hawa-opacity-30" : "hawa-text-foreground"
5892
- ),
5893
- indicatorsContainer: () => cn(
5894
- selectIndicatorContainerStyles,
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
- Menu: Menu2,
5904
- ValueContainer: (e) => /* @__PURE__ */ import_react35.default.createElement(
5905
- "div",
5906
- {
5907
- className: cn(
5908
- e.className,
5909
- "hawa-gap-1 hawa-flex hawa-flex-row hawa-flex-wrap hawa-p-1"
5910
- ),
5911
- ...e
5912
- }
5913
- ),
5914
- MultiValueContainer: (e) => /* @__PURE__ */ import_react35.default.createElement(
5915
- "div",
5916
- {
5917
- className: "hawa-rounded hawa-border hawa-p-1 hawa-px-2 hawa-flex hawa-flex-row",
5918
- ...e
5919
- }
5920
- )
5921
- },
5922
- onChange: (newValue, action) => props.onChange(newValue, action),
5923
- options: props.options,
5924
- getOptionLabel: props.getOptionLabel,
5925
- defaultValue: props.defaultValue,
5926
- value: props.value,
5927
- placeholder: props.placeholder,
5928
- isDisabled: props.disabled,
5929
- isClearable: props.isClearable,
5930
- isMulti: props.isMulti,
5931
- isSearchable: props.isSearchable
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)(props.preferredCountry);
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: "Code",
7940
+ placeholder: (_a = props.preferredCountry) == null ? void 0 : _a.label,
7950
7941
  options: countryCodes || countries_default,
7951
- onChange: setCountryCode,
7952
- value: countryCode == null ? void 0 : countryCode.label,
7953
- defaultValue: props.preferredCountry
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
- const formSchema = z2.object({
11414
- ...fieldSchemas,
11415
- password: z2.string({
11416
- required_error: ((_a = texts == null ? void 0 : texts.password) == null ? void 0 : _a.required) || "Password is required"
11417
- }).min(minPasswordLength, {
11418
- message: ((_b = texts == null ? void 0 : texts.password) == null ? void 0 : _b.tooShort) || "Password is too short"
11419
- }).refine((value) => value !== "", {
11420
- message: ((_c = texts == null ? void 0 : texts.password) == null ? void 0 : _c.required) || "Password is required"
11421
- }),
11422
- confirm_password: z2.string({
11423
- required_error: ((_d = texts == null ? void 0 : texts.confirm) == null ? void 0 : _d.required) || "Confirm password required"
11424
- }).min(minPasswordLength, {
11425
- message: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.tooShort) || "Password is too short"
11426
- }).refine((value) => value !== "", {
11427
- message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.required) || "Confirm password is required"
11428
- }),
11429
- refCode: z2.string().optional(),
11430
- reference: z2.string().optional(),
11431
- terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
11432
- message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
11433
- }),
11434
- newsletter_accepted: z2.boolean().optional()
11435
- }).refine((data) => data.password === data.confirm_password, {
11436
- message: ((_g = texts == null ? void 0 : texts.confirm) == null ? void 0 : _g.dontMatch) || "Passwords don't match",
11437
- path: ["confirm_password"]
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
- "div",
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
- "hawa-flex hawa-flex-col hawa-gap-4",
11447
- (_h = props.classNames) == null ? void 0 : _h.root
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
- Card,
11463
+ CardContent,
11452
11464
  {
11453
- dir: props.direction,
11454
- className: cn(
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(CardContent, { headless: true, noPadding: props.cardless }, /* @__PURE__ */ import_react69.default.createElement("div", null, props.showError && /* @__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("div", { className: "hawa-flex hawa-flex-col hawa-gap-4" }, registerFields.map((fld, i) => {
11488
- if (fld === "fullname") {
11489
- return /* @__PURE__ */ import_react69.default.createElement(
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: "fullName",
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
- label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
11502
- placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
11503
- helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
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: "email",
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
- autoComplete: "email",
11529
- label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
11530
- helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
11531
- placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
11532
- ...field,
11533
- onChange: (e) => {
11534
- field.onChange(
11535
- e.target.value.toLowerCase().trim()
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
- if (fld === "username") {
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: "username",
11667
+ name: "refCode",
11551
11668
  render: ({ field }) => {
11552
- var _a2, _b2, _c2, _d2;
11669
+ var _a2;
11553
11670
  return /* @__PURE__ */ import_react69.default.createElement(
11554
11671
  Input,
11555
11672
  {
11556
11673
  width: "full",
11557
- autoComplete: "username",
11558
- label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
11559
- labelProps: {
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
- /* @__PURE__ */ import_react69.default.createElement(
11573
- import_react_hook_form2.Controller,
11574
- {
11575
- control,
11576
- name: "password",
11577
- render: ({ field }) => {
11578
- var _a2, _b2, _c2;
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
- className: "hawa-cursor-pointer",
11588
- onClick: () => setPasswordVisible(!passwordVisible)
11589
- },
11590
- passwordVisible ? /* @__PURE__ */ import_react69.default.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ import_react69.default.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
11591
- " "
11592
- ),
11593
- autoComplete: "new-password",
11594
- label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
11595
- placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
11596
- helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
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
- /* @__PURE__ */ import_react69.default.createElement(
11604
- import_react_hook_form2.Controller,
11605
- {
11606
- control,
11607
- name: "confirm_password",
11608
- render: ({ field }) => {
11609
- var _a2, _b2, _c2;
11610
- return /* @__PURE__ */ import_react69.default.createElement(
11611
- Input,
11612
- {
11613
- width: "full",
11614
- type: "password",
11615
- autoComplete: "new-password",
11616
- label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
11617
- placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
11618
- helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
11619
- ...field
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
- props.additionalInputs,
11626
- props.showRefCode && /* @__PURE__ */ import_react69.default.createElement(
11627
- import_react_hook_form2.Controller,
11628
- {
11629
- control,
11630
- name: "refCode",
11631
- render: ({ field }) => {
11632
- var _a2;
11633
- return /* @__PURE__ */ import_react69.default.createElement(
11634
- Input,
11635
- {
11636
- width: "full",
11637
- label: texts == null ? void 0 : texts.refCode,
11638
- placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
11639
- helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
11640
- ...field
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
- props.showUserSource && /* @__PURE__ */ import_react69.default.createElement(
11647
- import_react_hook_form2.Controller,
11648
- {
11649
- control,
11650
- name: "reference",
11651
- render: ({ field }) => {
11652
- var _a2, _b2;
11653
- return /* @__PURE__ */ import_react69.default.createElement(
11654
- Select,
11655
- {
11656
- label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
11657
- placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
11658
- isCreatable: false,
11659
- isMulti: false,
11660
- isSearchable: false,
11661
- isClearable: false,
11662
- options: props.userReferenceOptions || [],
11663
- onChange: (e) => field.onChange(e)
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
- 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(
11670
- import_react_hook_form2.Controller,
11671
- {
11672
- control,
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: "terms_accepted",
11680
- helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
11681
- onCheckedChange: (e) => field.onChange(e),
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
- ), showNewsletterOption && /* @__PURE__ */ import_react69.default.createElement(
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
- props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ import_react69.default.createElement(
11727
- CardFooter,
11728
- {
11729
- noPadding: props.cardless,
11730
- className: cn(
11731
- props.logosOnly ? "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-2" : "hawa-grid hawa-grid-cols-1 hawa-gap-2"
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
- ) : null
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"