@sikka/hawa 0.47.0-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/blocks/auth/index.d.mts +26 -9
- package/dist/blocks/auth/index.d.ts +26 -9
- package/dist/blocks/auth/index.js +926 -305
- package/dist/blocks/auth/index.mjs +409 -247
- package/dist/blocks/feedback/index.d.mts +1 -1
- package/dist/blocks/feedback/index.d.ts +1 -1
- package/dist/blocks/index.d.mts +25 -8
- package/dist/blocks/index.d.ts +25 -8
- package/dist/blocks/index.js +2264 -2114
- package/dist/blocks/index.mjs +403 -246
- package/dist/blocks/misc/index.d.mts +1 -1
- package/dist/blocks/misc/index.d.ts +1 -1
- package/dist/blocks/misc/index.mjs +49 -366
- 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-342KIV4R.mjs → chunk-GBLWUEYN.mjs} +471 -471
- package/dist/chunk-JFWD2ICY.mjs +511 -0
- package/dist/elements/index.mjs +1 -1
- package/dist/index.css +7 -0
- package/dist/index.d.mts +26 -8
- package/dist/index.d.ts +26 -8
- package/dist/index.js +397 -245
- package/dist/index.mjs +402 -245
- 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
@@ -1,10 +1,15 @@
|
|
1
1
|
"use client";
|
2
2
|
import {
|
3
|
-
Input
|
4
|
-
|
3
|
+
Input,
|
4
|
+
Tabs,
|
5
|
+
TabsContent,
|
6
|
+
TabsList,
|
7
|
+
TabsTrigger
|
8
|
+
} from "../../chunk-JFWD2ICY.mjs";
|
5
9
|
import {
|
6
10
|
StopPropagationWrapper
|
7
11
|
} from "../../chunk-47APBDKK.mjs";
|
12
|
+
import "../../chunk-C2UOOH4X.mjs";
|
8
13
|
import {
|
9
14
|
Select
|
10
15
|
} from "../../chunk-AWJSHOYU.mjs";
|
@@ -2899,6 +2904,12 @@ var LoginForm = ({
|
|
2899
2904
|
import React7, { useState as useState4 } from "react";
|
2900
2905
|
import { Controller as Controller2, FormProvider, useForm as useForm2 } from "react-hook-form";
|
2901
2906
|
import { zodResolver as zodResolver2 } from "@hookform/resolvers/zod";
|
2907
|
+
import {
|
2908
|
+
isPossiblePhoneNumber as isPossiblePhoneNumber2,
|
2909
|
+
isValidPhoneNumber as isValidPhoneNumber2,
|
2910
|
+
parsePhoneNumber as parsePhoneNumber2,
|
2911
|
+
validatePhoneNumberLength as validatePhoneNumberLength2
|
2912
|
+
} from "libphonenumber-js";
|
2902
2913
|
import * as z2 from "zod";
|
2903
2914
|
|
2904
2915
|
// elements/checkbox/Checkbox.tsx
|
@@ -3044,10 +3055,15 @@ var RegisterForm = ({
|
|
3044
3055
|
minPasswordLength = 8,
|
3045
3056
|
showTermsOption = false,
|
3046
3057
|
showNewsletterOption = false,
|
3058
|
+
registerTypes,
|
3047
3059
|
...props
|
3048
3060
|
}) => {
|
3049
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
3061
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
3050
3062
|
const [passwordVisible, setPasswordVisible] = useState4(false);
|
3063
|
+
const [selectedRegisterType, setSelectedRegisterType] = useState4({
|
3064
|
+
value: ((_a = registerTypes == null ? void 0 : registerTypes[0]) == null ? void 0 : _a.value) || "password",
|
3065
|
+
label: ((_b = registerTypes == null ? void 0 : registerTypes[0]) == null ? void 0 : _b.label) || "Password"
|
3066
|
+
});
|
3051
3067
|
const thirdPartyAuthTexts = {
|
3052
3068
|
continueWithGoogle: texts == null ? void 0 : texts.continueWithGoogle,
|
3053
3069
|
continueWithTwitter: texts == null ? void 0 : texts.continueWithTwitter,
|
@@ -3059,8 +3075,12 @@ var RegisterForm = ({
|
|
3059
3075
|
};
|
3060
3076
|
const methods = useForm2();
|
3061
3077
|
let fieldSchemas = {};
|
3078
|
+
const hasPhoneType = registerTypes == null ? void 0 : registerTypes.some((type) => type.value === "phone");
|
3079
|
+
if (hasPhoneType && selectedRegisterType.value === "phone") {
|
3080
|
+
registerFields = ["phone"];
|
3081
|
+
}
|
3062
3082
|
registerFields.forEach((field) => {
|
3063
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
3083
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
3064
3084
|
switch (field) {
|
3065
3085
|
case "fullname":
|
3066
3086
|
fieldSchemas["fullName"] = z2.string().optional();
|
@@ -3085,55 +3105,85 @@ var RegisterForm = ({
|
|
3085
3105
|
{ message: ((_g2 = texts == null ? void 0 : texts.username) == null ? void 0 : _g2.invalid) || "Invalid username" }
|
3086
3106
|
);
|
3087
3107
|
break;
|
3108
|
+
case "phone":
|
3109
|
+
fieldSchemas["phone"] = z2.string({
|
3110
|
+
required_error: ((_h2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _h2.required) || "Phone Number Required"
|
3111
|
+
}).refine(
|
3112
|
+
(value) => {
|
3113
|
+
let isPhoneValid = isPossiblePhoneNumber2(value) && isValidPhoneNumber2(value) && validatePhoneNumberLength2(value) === void 0;
|
3114
|
+
return isPhoneValid;
|
3115
|
+
},
|
3116
|
+
{ message: ((_i2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _i2.invalid) || "Phone Number Invalid" }
|
3117
|
+
);
|
3118
|
+
break;
|
3088
3119
|
}
|
3089
3120
|
});
|
3090
|
-
|
3091
|
-
|
3092
|
-
|
3093
|
-
|
3094
|
-
|
3095
|
-
|
3096
|
-
|
3097
|
-
|
3098
|
-
|
3099
|
-
|
3100
|
-
|
3101
|
-
|
3102
|
-
|
3103
|
-
|
3104
|
-
|
3105
|
-
|
3106
|
-
|
3107
|
-
|
3108
|
-
|
3109
|
-
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3121
|
+
let formSchema;
|
3122
|
+
if (selectedRegisterType.value === "phone") {
|
3123
|
+
formSchema = z2.object({
|
3124
|
+
phone: z2.string({
|
3125
|
+
required_error: ((_c = texts == null ? void 0 : texts.phone) == null ? void 0 : _c.required) || "Phone Number Required"
|
3126
|
+
}).refine(
|
3127
|
+
(value) => {
|
3128
|
+
let isPhoneValid = isPossiblePhoneNumber2(value) && isValidPhoneNumber2(value) && validatePhoneNumberLength2(value) === void 0;
|
3129
|
+
return isPhoneValid;
|
3130
|
+
},
|
3131
|
+
{ message: ((_d = texts == null ? void 0 : texts.phone) == null ? void 0 : _d.invalid) || "Phone Number Invalid" }
|
3132
|
+
),
|
3133
|
+
refCode: z2.string().optional(),
|
3134
|
+
reference: z2.string().optional(),
|
3135
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
3136
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
3137
|
+
}),
|
3138
|
+
newsletter_accepted: z2.boolean().optional()
|
3139
|
+
});
|
3140
|
+
} else {
|
3141
|
+
formSchema = z2.object({
|
3142
|
+
...fieldSchemas,
|
3143
|
+
password: z2.string({
|
3144
|
+
required_error: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Password is required"
|
3145
|
+
}).min(minPasswordLength, {
|
3146
|
+
message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort) || "Password is too short"
|
3147
|
+
}).refine((value) => value !== "", {
|
3148
|
+
message: ((_g = texts == null ? void 0 : texts.password) == null ? void 0 : _g.required) || "Password is required"
|
3149
|
+
}),
|
3150
|
+
confirm_password: z2.string({
|
3151
|
+
required_error: ((_h = texts == null ? void 0 : texts.confirm) == null ? void 0 : _h.required) || "Confirm password required"
|
3152
|
+
}).min(minPasswordLength, {
|
3153
|
+
message: ((_i = texts == null ? void 0 : texts.password) == null ? void 0 : _i.tooShort) || "Password is too short"
|
3154
|
+
}).refine((value) => value !== "", {
|
3155
|
+
message: ((_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required) || "Confirm password is required"
|
3156
|
+
}),
|
3157
|
+
refCode: z2.string().optional(),
|
3158
|
+
reference: z2.string().optional(),
|
3159
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
3160
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
3161
|
+
}),
|
3162
|
+
newsletter_accepted: z2.boolean().optional()
|
3163
|
+
}).refine((data) => data.password === data.confirm_password, {
|
3164
|
+
message: ((_k = texts == null ? void 0 : texts.confirm) == null ? void 0 : _k.dontMatch) || "Passwords don't match",
|
3165
|
+
path: ["confirm_password"]
|
3166
|
+
});
|
3167
|
+
}
|
3116
3168
|
const { handleSubmit, control, formState } = useForm2({
|
3117
3169
|
resolver: zodResolver2(formSchema)
|
3118
3170
|
});
|
3119
|
-
return /* @__PURE__ */ React7.createElement(
|
3120
|
-
|
3171
|
+
return /* @__PURE__ */ React7.createElement("div", { className: cn("hawa-flex hawa-flex-col", (_l = props.classNames) == null ? void 0 : _l.root) }, /* @__PURE__ */ React7.createElement(
|
3172
|
+
Card,
|
3121
3173
|
{
|
3174
|
+
dir: props.direction,
|
3122
3175
|
className: cn(
|
3123
|
-
|
3124
|
-
|
3176
|
+
(_m = props.classNames) == null ? void 0 : _m.card,
|
3177
|
+
props.cardless && "hawa-border-none hawa-bg-transparent !hawa-shadow-none !hawa-drop-shadow-none"
|
3125
3178
|
)
|
3126
3179
|
},
|
3127
3180
|
/* @__PURE__ */ React7.createElement(
|
3128
|
-
|
3181
|
+
CardContent,
|
3129
3182
|
{
|
3130
|
-
|
3131
|
-
|
3132
|
-
(_i = props.classNames) == null ? void 0 : _i.card,
|
3133
|
-
props.cardless && "hawa-border-none hawa-bg-transparent !hawa-shadow-none !hawa-drop-shadow-none"
|
3134
|
-
)
|
3183
|
+
headless: registerTypes ? registerTypes.length <= 1 : true,
|
3184
|
+
noPadding: props.cardless
|
3135
3185
|
},
|
3136
|
-
/* @__PURE__ */ React7.createElement(
|
3186
|
+
/* @__PURE__ */ React7.createElement("div", null, props.showError && /* @__PURE__ */ React7.createElement(
|
3137
3187
|
Alert,
|
3138
3188
|
{
|
3139
3189
|
direction: props.direction,
|
@@ -3154,240 +3204,352 @@ var RegisterForm = ({
|
|
3154
3204
|
if (props.onRegister) {
|
3155
3205
|
return props.onRegister(e);
|
3156
3206
|
} else {
|
3157
|
-
console.log(
|
3158
|
-
"Form is submitted but onRegister prop is missing"
|
3159
|
-
);
|
3207
|
+
console.log("Form is submitted but onRegister prop is missing");
|
3160
3208
|
}
|
3161
3209
|
}),
|
3162
3210
|
className: "hawa-flex hawa-flex-col hawa-gap-4"
|
3163
3211
|
},
|
3164
|
-
/* @__PURE__ */ React7.createElement(
|
3165
|
-
|
3166
|
-
|
3212
|
+
/* @__PURE__ */ React7.createElement(
|
3213
|
+
Tabs,
|
3214
|
+
{
|
3215
|
+
dir: props.direction,
|
3216
|
+
value: selectedRegisterType.value,
|
3217
|
+
onValueChange: (e) => setSelectedRegisterType(
|
3218
|
+
(registerTypes == null ? void 0 : registerTypes.find((r) => r.value === e)) || registerTypes && registerTypes[0] || {
|
3219
|
+
label: "Password",
|
3220
|
+
value: "password"
|
3221
|
+
}
|
3222
|
+
)
|
3223
|
+
},
|
3224
|
+
registerTypes && registerTypes.length > 1 && /* @__PURE__ */ React7.createElement(CardHeader, { className: "hawa-w-full hawa-px-0 hawa-py-0 hawa-my-4 hawa-mt-6" }, /* @__PURE__ */ React7.createElement(TabsList, { className: "hawa-w-full" }, registerTypes.map((registerType) => /* @__PURE__ */ React7.createElement(TabsTrigger, { value: registerType.value }, registerType.label)))),
|
3225
|
+
/* @__PURE__ */ React7.createElement(
|
3226
|
+
TabsContent,
|
3227
|
+
{
|
3228
|
+
value: "password",
|
3229
|
+
className: cn(
|
3230
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
3231
|
+
selectedRegisterType.value === "password" ? "hawa-block" : "hawa-hidden"
|
3232
|
+
),
|
3233
|
+
dir: props.direction
|
3234
|
+
},
|
3235
|
+
/* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4" }, registerFields.map((fld, i) => {
|
3236
|
+
if (fld === "fullname") {
|
3237
|
+
return /* @__PURE__ */ React7.createElement(
|
3238
|
+
Controller2,
|
3239
|
+
{
|
3240
|
+
key: i,
|
3241
|
+
control,
|
3242
|
+
name: "fullName",
|
3243
|
+
render: ({ field }) => {
|
3244
|
+
var _a2, _b2, _c2;
|
3245
|
+
return /* @__PURE__ */ React7.createElement(
|
3246
|
+
Input,
|
3247
|
+
{
|
3248
|
+
width: "full",
|
3249
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
3250
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
3251
|
+
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
3252
|
+
...field
|
3253
|
+
}
|
3254
|
+
);
|
3255
|
+
}
|
3256
|
+
}
|
3257
|
+
);
|
3258
|
+
}
|
3259
|
+
if (fld === "email") {
|
3260
|
+
return /* @__PURE__ */ React7.createElement(
|
3261
|
+
Controller2,
|
3262
|
+
{
|
3263
|
+
key: i,
|
3264
|
+
control,
|
3265
|
+
name: "email",
|
3266
|
+
render: ({ field }) => {
|
3267
|
+
var _a2, _b2, _c2;
|
3268
|
+
return /* @__PURE__ */ React7.createElement(
|
3269
|
+
Input,
|
3270
|
+
{
|
3271
|
+
dir: "ltr",
|
3272
|
+
inputProps: {
|
3273
|
+
className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
|
3274
|
+
},
|
3275
|
+
width: "full",
|
3276
|
+
autoComplete: "email",
|
3277
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
3278
|
+
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
3279
|
+
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
3280
|
+
...field,
|
3281
|
+
onChange: (e) => {
|
3282
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
3283
|
+
}
|
3284
|
+
}
|
3285
|
+
);
|
3286
|
+
}
|
3287
|
+
}
|
3288
|
+
);
|
3289
|
+
}
|
3290
|
+
if (fld === "username") {
|
3291
|
+
return /* @__PURE__ */ React7.createElement(
|
3292
|
+
Controller2,
|
3293
|
+
{
|
3294
|
+
key: i,
|
3295
|
+
control,
|
3296
|
+
name: "username",
|
3297
|
+
render: ({ field }) => {
|
3298
|
+
var _a2, _b2, _c2, _d2;
|
3299
|
+
return /* @__PURE__ */ React7.createElement(
|
3300
|
+
Input,
|
3301
|
+
{
|
3302
|
+
width: "full",
|
3303
|
+
autoComplete: "username",
|
3304
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
3305
|
+
labelProps: {
|
3306
|
+
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
3307
|
+
},
|
3308
|
+
helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
|
3309
|
+
placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
|
3310
|
+
...field
|
3311
|
+
}
|
3312
|
+
);
|
3313
|
+
}
|
3314
|
+
}
|
3315
|
+
);
|
3316
|
+
}
|
3317
|
+
})),
|
3318
|
+
/* @__PURE__ */ React7.createElement(
|
3167
3319
|
Controller2,
|
3168
3320
|
{
|
3169
|
-
key: i,
|
3170
3321
|
control,
|
3171
|
-
name: "
|
3322
|
+
name: "password",
|
3172
3323
|
render: ({ field }) => {
|
3173
3324
|
var _a2, _b2, _c2;
|
3174
3325
|
return /* @__PURE__ */ React7.createElement(
|
3175
3326
|
Input,
|
3176
3327
|
{
|
3177
3328
|
width: "full",
|
3178
|
-
|
3179
|
-
|
3180
|
-
|
3329
|
+
type: passwordVisible ? "text" : "password",
|
3330
|
+
autoComplete: "new-password",
|
3331
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
3332
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
3333
|
+
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
3334
|
+
endIcon: /* @__PURE__ */ React7.createElement(
|
3335
|
+
"div",
|
3336
|
+
{
|
3337
|
+
className: "hawa-cursor-pointer",
|
3338
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
3339
|
+
},
|
3340
|
+
passwordVisible ? /* @__PURE__ */ React7.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ React7.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
3341
|
+
" "
|
3342
|
+
),
|
3181
3343
|
...field
|
3182
3344
|
}
|
3183
3345
|
);
|
3184
3346
|
}
|
3185
3347
|
}
|
3186
|
-
)
|
3187
|
-
|
3188
|
-
if (fld === "email") {
|
3189
|
-
return /* @__PURE__ */ React7.createElement(
|
3348
|
+
),
|
3349
|
+
/* @__PURE__ */ React7.createElement(
|
3190
3350
|
Controller2,
|
3191
3351
|
{
|
3192
|
-
key: i,
|
3193
3352
|
control,
|
3194
|
-
name: "
|
3353
|
+
name: "confirm_password",
|
3195
3354
|
render: ({ field }) => {
|
3196
3355
|
var _a2, _b2, _c2;
|
3197
3356
|
return /* @__PURE__ */ React7.createElement(
|
3198
3357
|
Input,
|
3199
3358
|
{
|
3200
|
-
dir: "ltr",
|
3201
|
-
inputProps: {
|
3202
|
-
className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
|
3203
|
-
},
|
3204
3359
|
width: "full",
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
placeholder: ((
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3360
|
+
type: passwordVisible ? "text" : "password",
|
3361
|
+
autoComplete: "new-password",
|
3362
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
3363
|
+
placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
|
3364
|
+
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
3365
|
+
endIcon: /* @__PURE__ */ React7.createElement(
|
3366
|
+
"div",
|
3367
|
+
{
|
3368
|
+
className: "hawa-cursor-pointer",
|
3369
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
3370
|
+
},
|
3371
|
+
passwordVisible ? /* @__PURE__ */ React7.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ React7.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
3372
|
+
" "
|
3373
|
+
),
|
3374
|
+
...field
|
3215
3375
|
}
|
3216
3376
|
);
|
3217
3377
|
}
|
3218
3378
|
}
|
3219
|
-
)
|
3220
|
-
|
3221
|
-
|
3222
|
-
return /* @__PURE__ */ React7.createElement(
|
3379
|
+
),
|
3380
|
+
props.additionalInputs,
|
3381
|
+
props.showRefCode && /* @__PURE__ */ React7.createElement(
|
3223
3382
|
Controller2,
|
3224
3383
|
{
|
3225
|
-
key: i,
|
3226
3384
|
control,
|
3227
|
-
name: "
|
3385
|
+
name: "refCode",
|
3228
3386
|
render: ({ field }) => {
|
3229
|
-
var _a2
|
3387
|
+
var _a2;
|
3230
3388
|
return /* @__PURE__ */ React7.createElement(
|
3231
3389
|
Input,
|
3232
3390
|
{
|
3233
3391
|
width: "full",
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
3238
|
-
},
|
3239
|
-
helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
|
3240
|
-
placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
|
3392
|
+
label: texts == null ? void 0 : texts.refCode,
|
3393
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
3394
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
3241
3395
|
...field
|
3242
3396
|
}
|
3243
3397
|
);
|
3244
3398
|
}
|
3245
3399
|
}
|
3246
|
-
)
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
|
3255
|
-
|
3256
|
-
return /* @__PURE__ */ React7.createElement(
|
3257
|
-
Input,
|
3258
|
-
{
|
3259
|
-
width: "full",
|
3260
|
-
type: passwordVisible ? "text" : "password",
|
3261
|
-
endIcon: /* @__PURE__ */ React7.createElement(
|
3262
|
-
"div",
|
3400
|
+
),
|
3401
|
+
props.showUserSource && /* @__PURE__ */ React7.createElement(
|
3402
|
+
Controller2,
|
3403
|
+
{
|
3404
|
+
control,
|
3405
|
+
name: "reference",
|
3406
|
+
render: ({ field }) => {
|
3407
|
+
var _a2, _b2;
|
3408
|
+
return /* @__PURE__ */ React7.createElement(
|
3409
|
+
Select,
|
3263
3410
|
{
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
...field
|
3411
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
3412
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
3413
|
+
isCreatable: false,
|
3414
|
+
isMulti: false,
|
3415
|
+
isSearchable: false,
|
3416
|
+
isClearable: false,
|
3417
|
+
options: props.userReferenceOptions || [],
|
3418
|
+
onChange: (e) => field.onChange(e)
|
3419
|
+
}
|
3420
|
+
);
|
3275
3421
|
}
|
3276
|
-
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
|
3283
|
-
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3287
|
-
|
3288
|
-
|
3289
|
-
|
3290
|
-
|
3291
|
-
|
3292
|
-
|
3293
|
-
|
3294
|
-
|
3295
|
-
|
3296
|
-
|
3422
|
+
}
|
3423
|
+
)
|
3424
|
+
),
|
3425
|
+
/* @__PURE__ */ React7.createElement(
|
3426
|
+
TabsContent,
|
3427
|
+
{
|
3428
|
+
value: "phone",
|
3429
|
+
className: cn(
|
3430
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
3431
|
+
selectedRegisterType.value === "phone" ? "hawa-block" : "hawa-hidden"
|
3432
|
+
),
|
3433
|
+
dir: props.direction
|
3434
|
+
},
|
3435
|
+
/* @__PURE__ */ React7.createElement(
|
3436
|
+
Controller2,
|
3437
|
+
{
|
3438
|
+
control,
|
3439
|
+
name: "phone",
|
3440
|
+
render: ({ field }) => {
|
3441
|
+
var _a2, _b2;
|
3442
|
+
return /* @__PURE__ */ React7.createElement(
|
3443
|
+
PhoneInput,
|
3444
|
+
{
|
3445
|
+
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
3446
|
+
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
3447
|
+
preferredCountry: { label: "+966" },
|
3448
|
+
...props.phoneInputProps,
|
3449
|
+
handleChange: (e) => {
|
3450
|
+
if (isValidPhoneNumber2(e) && isPossiblePhoneNumber2(e) && validatePhoneNumberLength2(e) === void 0) {
|
3451
|
+
let parsed = parsePhoneNumber2(e);
|
3452
|
+
field.onChange(parsed.number);
|
3453
|
+
} else {
|
3454
|
+
field.onChange(e);
|
3455
|
+
}
|
3456
|
+
}
|
3457
|
+
}
|
3458
|
+
);
|
3297
3459
|
}
|
3298
|
-
|
3299
|
-
|
3300
|
-
|
3301
|
-
|
3302
|
-
|
3303
|
-
|
3304
|
-
|
3305
|
-
|
3306
|
-
|
3307
|
-
|
3308
|
-
|
3309
|
-
|
3310
|
-
|
3311
|
-
|
3312
|
-
|
3313
|
-
|
3314
|
-
|
3315
|
-
|
3316
|
-
|
3317
|
-
|
3460
|
+
}
|
3461
|
+
),
|
3462
|
+
props.additionalInputs,
|
3463
|
+
props.showRefCode && /* @__PURE__ */ React7.createElement(
|
3464
|
+
Controller2,
|
3465
|
+
{
|
3466
|
+
control,
|
3467
|
+
name: "refCode",
|
3468
|
+
render: ({ field }) => {
|
3469
|
+
var _a2;
|
3470
|
+
return /* @__PURE__ */ React7.createElement(
|
3471
|
+
Input,
|
3472
|
+
{
|
3473
|
+
width: "full",
|
3474
|
+
label: texts == null ? void 0 : texts.refCode,
|
3475
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
3476
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
3477
|
+
...field
|
3478
|
+
}
|
3479
|
+
);
|
3318
3480
|
}
|
3319
|
-
|
3320
|
-
|
3321
|
-
|
3322
|
-
|
3323
|
-
|
3324
|
-
|
3325
|
-
|
3326
|
-
|
3327
|
-
|
3328
|
-
|
3329
|
-
|
3330
|
-
|
3331
|
-
|
3332
|
-
|
3333
|
-
|
3334
|
-
|
3335
|
-
|
3336
|
-
|
3337
|
-
|
3338
|
-
|
3339
|
-
|
3340
|
-
|
3481
|
+
}
|
3482
|
+
),
|
3483
|
+
props.showUserSource && /* @__PURE__ */ React7.createElement(
|
3484
|
+
Controller2,
|
3485
|
+
{
|
3486
|
+
control,
|
3487
|
+
name: "reference",
|
3488
|
+
render: ({ field }) => {
|
3489
|
+
var _a2, _b2;
|
3490
|
+
return /* @__PURE__ */ React7.createElement(
|
3491
|
+
Select,
|
3492
|
+
{
|
3493
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
3494
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
3495
|
+
isCreatable: false,
|
3496
|
+
isMulti: false,
|
3497
|
+
isSearchable: false,
|
3498
|
+
isClearable: false,
|
3499
|
+
options: props.userReferenceOptions || [],
|
3500
|
+
onChange: (e) => field.onChange(e)
|
3501
|
+
}
|
3502
|
+
);
|
3341
3503
|
}
|
3342
|
-
|
3504
|
+
}
|
3505
|
+
)
|
3506
|
+
),
|
3507
|
+
showTermsOption || showNewsletterOption ? /* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ React7.createElement(
|
3508
|
+
Controller2,
|
3509
|
+
{
|
3510
|
+
control,
|
3511
|
+
name: "terms_accepted",
|
3512
|
+
render: ({ field }) => {
|
3513
|
+
var _a2, _b2;
|
3514
|
+
return /* @__PURE__ */ React7.createElement(
|
3515
|
+
Checkbox,
|
3516
|
+
{
|
3517
|
+
id: "terms_accepted",
|
3518
|
+
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
3519
|
+
onCheckedChange: (e) => field.onChange(e),
|
3520
|
+
label: /* @__PURE__ */ React7.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__ */ React7.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React7.createElement(
|
3521
|
+
"span",
|
3522
|
+
{
|
3523
|
+
onClick: (e) => {
|
3524
|
+
e.preventDefault();
|
3525
|
+
if (props.onRouteToTOS) {
|
3526
|
+
props.onRouteToTOS();
|
3527
|
+
}
|
3528
|
+
},
|
3529
|
+
className: "clickable-link"
|
3530
|
+
},
|
3531
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
3532
|
+
)))
|
3533
|
+
}
|
3534
|
+
);
|
3535
|
+
}
|
3343
3536
|
}
|
3344
|
-
|
3345
|
-
|
3346
|
-
|
3347
|
-
|
3348
|
-
|
3349
|
-
|
3350
|
-
name: "terms_accepted",
|
3351
|
-
render: ({ field }) => {
|
3352
|
-
var _a2, _b2;
|
3353
|
-
return /* @__PURE__ */ React7.createElement(
|
3537
|
+
), showNewsletterOption && /* @__PURE__ */ React7.createElement(
|
3538
|
+
Controller2,
|
3539
|
+
{
|
3540
|
+
control,
|
3541
|
+
name: "newsletter_accepted",
|
3542
|
+
render: ({ field }) => /* @__PURE__ */ React7.createElement(
|
3354
3543
|
Checkbox,
|
3355
3544
|
{
|
3356
|
-
id: "
|
3357
|
-
|
3358
|
-
onCheckedChange:
|
3359
|
-
label: /* @__PURE__ */ React7.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__ */ React7.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React7.createElement(
|
3360
|
-
"span",
|
3361
|
-
{
|
3362
|
-
onClick: (e) => {
|
3363
|
-
e.preventDefault();
|
3364
|
-
if (props.onRouteToTOS) {
|
3365
|
-
props.onRouteToTOS();
|
3366
|
-
}
|
3367
|
-
},
|
3368
|
-
className: "clickable-link"
|
3369
|
-
},
|
3370
|
-
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
3371
|
-
)))
|
3545
|
+
id: "newsletter_accepted",
|
3546
|
+
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
3547
|
+
onCheckedChange: field.onChange
|
3372
3548
|
}
|
3373
|
-
)
|
3549
|
+
)
|
3374
3550
|
}
|
3375
|
-
|
3376
|
-
),
|
3377
|
-
Controller2,
|
3378
|
-
{
|
3379
|
-
control,
|
3380
|
-
name: "newsletter_accepted",
|
3381
|
-
render: ({ field }) => /* @__PURE__ */ React7.createElement(
|
3382
|
-
Checkbox,
|
3383
|
-
{
|
3384
|
-
id: "newsletter_accepted",
|
3385
|
-
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
3386
|
-
onCheckedChange: field.onChange
|
3387
|
-
}
|
3388
|
-
)
|
3389
|
-
}
|
3390
|
-
)) : null,
|
3551
|
+
)) : null
|
3552
|
+
),
|
3391
3553
|
/* @__PURE__ */ React7.createElement(
|
3392
3554
|
Button,
|
3393
3555
|
{
|
@@ -3399,33 +3561,33 @@ var RegisterForm = ({
|
|
3399
3561
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
3400
3562
|
),
|
3401
3563
|
props.additionalButtons
|
3402
|
-
)), props.onRouteToLogin && /* @__PURE__ */ React7.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__ */ React7.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ React7.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))
|
3403
|
-
|
3404
|
-
|
3405
|
-
|
3406
|
-
|
3407
|
-
|
3408
|
-
|
3409
|
-
|
3410
|
-
},
|
3411
|
-
/* @__PURE__ */ React7.createElement(
|
3412
|
-
AuthButtons,
|
3413
|
-
{
|
3414
|
-
texts: thirdPartyAuthTexts,
|
3415
|
-
viaGoogle: props.viaGoogle,
|
3416
|
-
viaGithub: props.viaGithub,
|
3417
|
-
viaTwitter: props.viaTwitter,
|
3418
|
-
isGoogleLoading: props.isGoogleLoading,
|
3419
|
-
isGithubLoading: props.isGithubLoading,
|
3420
|
-
isTwitterLoading: props.isTwitterLoading,
|
3421
|
-
handleGoogle: props.onGoogleRegister,
|
3422
|
-
handleGithub: props.onGithubRegister,
|
3423
|
-
handleTwitter: props.onTwitterRegister
|
3424
|
-
}
|
3564
|
+
)), props.onRouteToLogin && /* @__PURE__ */ React7.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__ */ React7.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ React7.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login")))
|
3565
|
+
),
|
3566
|
+
props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React7.createElement(
|
3567
|
+
CardFooter,
|
3568
|
+
{
|
3569
|
+
noPadding: props.cardless,
|
3570
|
+
className: cn(
|
3571
|
+
props.logosOnly ? "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-2" : "hawa-grid hawa-grid-cols-1 hawa-gap-2"
|
3425
3572
|
)
|
3426
|
-
|
3427
|
-
|
3428
|
-
|
3573
|
+
},
|
3574
|
+
/* @__PURE__ */ React7.createElement(
|
3575
|
+
AuthButtons,
|
3576
|
+
{
|
3577
|
+
texts: thirdPartyAuthTexts,
|
3578
|
+
viaGoogle: props.viaGoogle,
|
3579
|
+
viaGithub: props.viaGithub,
|
3580
|
+
viaTwitter: props.viaTwitter,
|
3581
|
+
isGoogleLoading: props.isGoogleLoading,
|
3582
|
+
isGithubLoading: props.isGithubLoading,
|
3583
|
+
isTwitterLoading: props.isTwitterLoading,
|
3584
|
+
handleGoogle: props.onGoogleRegister,
|
3585
|
+
handleGithub: props.onGithubRegister,
|
3586
|
+
handleTwitter: props.onTwitterRegister
|
3587
|
+
}
|
3588
|
+
)
|
3589
|
+
) : null
|
3590
|
+
));
|
3429
3591
|
};
|
3430
3592
|
|
3431
3593
|
// blocks/auth/AppLanding.tsx
|