@sikka/hawa 0.47.0-next → 0.48.1-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 +27 -9
- package/dist/blocks/auth/index.d.ts +27 -9
- package/dist/blocks/auth/index.js +988 -354
- package/dist/blocks/auth/index.mjs +473 -298
- package/dist/blocks/feedback/index.d.mts +1 -1
- package/dist/blocks/feedback/index.d.ts +1 -1
- package/dist/blocks/index.d.mts +26 -8
- package/dist/blocks/index.d.ts +26 -8
- package/dist/blocks/index.js +2290 -2127
- package/dist/blocks/index.mjs +467 -297
- 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 +3 -0
- package/dist/index.d.mts +27 -8
- package/dist/index.d.ts +27 -8
- package/dist/index.js +461 -296
- package/dist/index.mjs +466 -296
- 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,347 +3105,502 @@ 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(
|
3137
|
-
|
3186
|
+
/* @__PURE__ */ React7.createElement(
|
3187
|
+
"div",
|
3138
3188
|
{
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
|
3143
|
-
|
3144
|
-
|
3145
|
-
|
3189
|
+
className: cn(registerTypes && registerTypes.length > 1 ? "hawa-mt-6 hawa-mb-0" : "")
|
3190
|
+
},
|
3191
|
+
props.showError && /* @__PURE__ */ React7.createElement(
|
3192
|
+
Alert,
|
3193
|
+
{
|
3194
|
+
direction: props.direction,
|
3195
|
+
title: props.errorTitle,
|
3196
|
+
text: props.errorText,
|
3197
|
+
severity: "error",
|
3198
|
+
onAlertClosed: () => {
|
3199
|
+
if (props.onErrorDismissed) {
|
3200
|
+
props.onErrorDismissed();
|
3201
|
+
}
|
3146
3202
|
}
|
3147
3203
|
}
|
3148
|
-
|
3149
|
-
|
3150
|
-
|
3151
|
-
|
3152
|
-
|
3153
|
-
|
3154
|
-
|
3155
|
-
|
3156
|
-
|
3157
|
-
|
3158
|
-
|
3159
|
-
|
3160
|
-
|
3161
|
-
}
|
3162
|
-
|
3163
|
-
|
3164
|
-
|
3165
|
-
|
3166
|
-
|
3167
|
-
|
3204
|
+
),
|
3205
|
+
/* @__PURE__ */ React7.createElement(FormProvider, { ...methods }, /* @__PURE__ */ React7.createElement(
|
3206
|
+
"form",
|
3207
|
+
{
|
3208
|
+
noValidate: true,
|
3209
|
+
onSubmit: handleSubmit((e) => {
|
3210
|
+
if (props.onRegister) {
|
3211
|
+
return props.onRegister(e);
|
3212
|
+
} else {
|
3213
|
+
console.log("Form is submitted but onRegister prop is missing");
|
3214
|
+
}
|
3215
|
+
}),
|
3216
|
+
className: "hawa-flex hawa-flex-col hawa-gap-4"
|
3217
|
+
},
|
3218
|
+
/* @__PURE__ */ React7.createElement(
|
3219
|
+
Tabs,
|
3220
|
+
{
|
3221
|
+
dir: props.direction,
|
3222
|
+
value: selectedRegisterType.value,
|
3223
|
+
onValueChange: (e) => {
|
3224
|
+
if (props.onRegisterTypeChange) {
|
3225
|
+
props.onRegisterTypeChange(e);
|
3226
|
+
}
|
3227
|
+
setSelectedRegisterType(
|
3228
|
+
(registerTypes == null ? void 0 : registerTypes.find((r) => r.value === e)) || registerTypes && registerTypes[0] || {
|
3229
|
+
label: "Password",
|
3230
|
+
value: "password"
|
3231
|
+
}
|
3232
|
+
);
|
3233
|
+
}
|
3234
|
+
},
|
3235
|
+
registerTypes && registerTypes.length > 1 && /* @__PURE__ */ React7.createElement(CardHeader, { className: "hawa-w-full hawa-px-0 hawa-py-0 hawa-mb-4" }, /* @__PURE__ */ React7.createElement(TabsList, { className: "hawa-w-full" }, registerTypes.map((registerType) => /* @__PURE__ */ React7.createElement(TabsTrigger, { value: registerType.value }, registerType.label)))),
|
3236
|
+
/* @__PURE__ */ React7.createElement(
|
3237
|
+
TabsContent,
|
3168
3238
|
{
|
3169
|
-
|
3170
|
-
|
3171
|
-
|
3172
|
-
|
3173
|
-
|
3239
|
+
value: "password",
|
3240
|
+
className: cn(
|
3241
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
3242
|
+
selectedRegisterType.value === "password" ? "hawa-block" : "hawa-hidden"
|
3243
|
+
),
|
3244
|
+
dir: props.direction
|
3245
|
+
},
|
3246
|
+
/* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4" }, registerFields.map((fld, i) => {
|
3247
|
+
if (fld === "fullname") {
|
3174
3248
|
return /* @__PURE__ */ React7.createElement(
|
3175
|
-
|
3249
|
+
Controller2,
|
3176
3250
|
{
|
3177
|
-
|
3178
|
-
|
3179
|
-
|
3180
|
-
|
3181
|
-
|
3251
|
+
key: i,
|
3252
|
+
control,
|
3253
|
+
name: "fullName",
|
3254
|
+
render: ({ field }) => {
|
3255
|
+
var _a2, _b2, _c2;
|
3256
|
+
return /* @__PURE__ */ React7.createElement(
|
3257
|
+
Input,
|
3258
|
+
{
|
3259
|
+
width: "full",
|
3260
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
3261
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
3262
|
+
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
3263
|
+
...field
|
3264
|
+
}
|
3265
|
+
);
|
3266
|
+
}
|
3182
3267
|
}
|
3183
3268
|
);
|
3184
3269
|
}
|
3185
|
-
|
3186
|
-
);
|
3187
|
-
}
|
3188
|
-
if (fld === "email") {
|
3189
|
-
return /* @__PURE__ */ React7.createElement(
|
3190
|
-
Controller2,
|
3191
|
-
{
|
3192
|
-
key: i,
|
3193
|
-
control,
|
3194
|
-
name: "email",
|
3195
|
-
render: ({ field }) => {
|
3196
|
-
var _a2, _b2, _c2;
|
3270
|
+
if (fld === "email") {
|
3197
3271
|
return /* @__PURE__ */ React7.createElement(
|
3198
|
-
|
3272
|
+
Controller2,
|
3199
3273
|
{
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
}
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3274
|
+
key: i,
|
3275
|
+
control,
|
3276
|
+
name: "email",
|
3277
|
+
render: ({ field }) => {
|
3278
|
+
var _a2, _b2, _c2;
|
3279
|
+
return /* @__PURE__ */ React7.createElement(
|
3280
|
+
Input,
|
3281
|
+
{
|
3282
|
+
dir: "ltr",
|
3283
|
+
inputProps: {
|
3284
|
+
className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
|
3285
|
+
},
|
3286
|
+
width: "full",
|
3287
|
+
autoComplete: "email",
|
3288
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
3289
|
+
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
3290
|
+
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
3291
|
+
...field,
|
3292
|
+
onChange: (e) => {
|
3293
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
3294
|
+
}
|
3295
|
+
}
|
3213
3296
|
);
|
3214
3297
|
}
|
3215
3298
|
}
|
3216
3299
|
);
|
3217
3300
|
}
|
3218
|
-
|
3219
|
-
);
|
3220
|
-
}
|
3221
|
-
if (fld === "username") {
|
3222
|
-
return /* @__PURE__ */ React7.createElement(
|
3223
|
-
Controller2,
|
3224
|
-
{
|
3225
|
-
key: i,
|
3226
|
-
control,
|
3227
|
-
name: "username",
|
3228
|
-
render: ({ field }) => {
|
3229
|
-
var _a2, _b2, _c2, _d2;
|
3301
|
+
if (fld === "username") {
|
3230
3302
|
return /* @__PURE__ */ React7.createElement(
|
3231
|
-
|
3303
|
+
Controller2,
|
3232
3304
|
{
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3305
|
+
key: i,
|
3306
|
+
control,
|
3307
|
+
name: "username",
|
3308
|
+
render: ({ field }) => {
|
3309
|
+
var _a2, _b2, _c2, _d2;
|
3310
|
+
return /* @__PURE__ */ React7.createElement(
|
3311
|
+
Input,
|
3312
|
+
{
|
3313
|
+
width: "full",
|
3314
|
+
autoComplete: "username",
|
3315
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
3316
|
+
labelProps: {
|
3317
|
+
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
3318
|
+
},
|
3319
|
+
helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
|
3320
|
+
placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
|
3321
|
+
...field
|
3322
|
+
}
|
3323
|
+
);
|
3324
|
+
}
|
3242
3325
|
}
|
3243
3326
|
);
|
3244
3327
|
}
|
3245
|
-
}
|
3246
|
-
|
3247
|
-
|
3248
|
-
})),
|
3249
|
-
/* @__PURE__ */ React7.createElement(
|
3250
|
-
Controller2,
|
3251
|
-
{
|
3252
|
-
control,
|
3253
|
-
name: "password",
|
3254
|
-
render: ({ field }) => {
|
3255
|
-
var _a2, _b2, _c2;
|
3256
|
-
return /* @__PURE__ */ React7.createElement(
|
3257
|
-
Input,
|
3328
|
+
})),
|
3329
|
+
/* @__PURE__ */ React7.createElement(
|
3330
|
+
Controller2,
|
3258
3331
|
{
|
3259
|
-
|
3260
|
-
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3332
|
+
control,
|
3333
|
+
name: "password",
|
3334
|
+
render: ({ field }) => {
|
3335
|
+
var _a2, _b2, _c2;
|
3336
|
+
return /* @__PURE__ */ React7.createElement(
|
3337
|
+
Input,
|
3338
|
+
{
|
3339
|
+
width: "full",
|
3340
|
+
type: passwordVisible ? "text" : "password",
|
3341
|
+
autoComplete: "new-password",
|
3342
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
3343
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
3344
|
+
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
3345
|
+
endIcon: /* @__PURE__ */ React7.createElement(
|
3346
|
+
"div",
|
3347
|
+
{
|
3348
|
+
className: "hawa-cursor-pointer",
|
3349
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
3350
|
+
},
|
3351
|
+
passwordVisible ? /* @__PURE__ */ React7.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ React7.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
3352
|
+
" "
|
3353
|
+
),
|
3354
|
+
...field
|
3355
|
+
}
|
3356
|
+
);
|
3357
|
+
}
|
3275
3358
|
}
|
3276
|
-
)
|
3277
|
-
|
3278
|
-
|
3279
|
-
),
|
3280
|
-
/* @__PURE__ */ React7.createElement(
|
3281
|
-
Controller2,
|
3282
|
-
{
|
3283
|
-
control,
|
3284
|
-
name: "confirm_password",
|
3285
|
-
render: ({ field }) => {
|
3286
|
-
var _a2, _b2, _c2;
|
3287
|
-
return /* @__PURE__ */ React7.createElement(
|
3288
|
-
Input,
|
3359
|
+
),
|
3360
|
+
/* @__PURE__ */ React7.createElement(
|
3361
|
+
Controller2,
|
3289
3362
|
{
|
3290
|
-
|
3291
|
-
|
3292
|
-
|
3293
|
-
|
3294
|
-
|
3295
|
-
|
3296
|
-
|
3363
|
+
control,
|
3364
|
+
name: "confirm_password",
|
3365
|
+
render: ({ field }) => {
|
3366
|
+
var _a2, _b2, _c2;
|
3367
|
+
return /* @__PURE__ */ React7.createElement(
|
3368
|
+
Input,
|
3369
|
+
{
|
3370
|
+
width: "full",
|
3371
|
+
type: passwordVisible ? "text" : "password",
|
3372
|
+
autoComplete: "new-password",
|
3373
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
3374
|
+
placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
|
3375
|
+
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
3376
|
+
endIcon: /* @__PURE__ */ React7.createElement(
|
3377
|
+
"div",
|
3378
|
+
{
|
3379
|
+
className: "hawa-cursor-pointer",
|
3380
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
3381
|
+
},
|
3382
|
+
passwordVisible ? /* @__PURE__ */ React7.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ React7.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
3383
|
+
" "
|
3384
|
+
),
|
3385
|
+
...field
|
3386
|
+
}
|
3387
|
+
);
|
3388
|
+
}
|
3297
3389
|
}
|
3298
|
-
)
|
3299
|
-
|
3300
|
-
|
3301
|
-
|
3302
|
-
props.additionalInputs,
|
3303
|
-
props.showRefCode && /* @__PURE__ */ React7.createElement(
|
3304
|
-
Controller2,
|
3305
|
-
{
|
3306
|
-
control,
|
3307
|
-
name: "refCode",
|
3308
|
-
render: ({ field }) => {
|
3309
|
-
var _a2;
|
3310
|
-
return /* @__PURE__ */ React7.createElement(
|
3311
|
-
Input,
|
3390
|
+
),
|
3391
|
+
props.additionalInputs,
|
3392
|
+
props.showRefCode && /* @__PURE__ */ React7.createElement(
|
3393
|
+
Controller2,
|
3312
3394
|
{
|
3313
|
-
|
3314
|
-
|
3315
|
-
|
3316
|
-
|
3317
|
-
|
3395
|
+
control,
|
3396
|
+
name: "refCode",
|
3397
|
+
render: ({ field }) => {
|
3398
|
+
var _a2;
|
3399
|
+
return /* @__PURE__ */ React7.createElement(
|
3400
|
+
Input,
|
3401
|
+
{
|
3402
|
+
width: "full",
|
3403
|
+
label: texts == null ? void 0 : texts.refCode,
|
3404
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
3405
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
3406
|
+
...field
|
3407
|
+
}
|
3408
|
+
);
|
3409
|
+
}
|
3318
3410
|
}
|
3319
|
-
)
|
3320
|
-
|
3321
|
-
|
3322
|
-
),
|
3323
|
-
props.showUserSource && /* @__PURE__ */ React7.createElement(
|
3324
|
-
Controller2,
|
3325
|
-
{
|
3326
|
-
control,
|
3327
|
-
name: "reference",
|
3328
|
-
render: ({ field }) => {
|
3329
|
-
var _a2, _b2;
|
3330
|
-
return /* @__PURE__ */ React7.createElement(
|
3331
|
-
Select,
|
3411
|
+
),
|
3412
|
+
props.showUserSource && /* @__PURE__ */ React7.createElement(
|
3413
|
+
Controller2,
|
3332
3414
|
{
|
3333
|
-
|
3334
|
-
|
3335
|
-
|
3336
|
-
|
3337
|
-
|
3338
|
-
|
3339
|
-
|
3340
|
-
|
3415
|
+
control,
|
3416
|
+
name: "reference",
|
3417
|
+
render: ({ field }) => {
|
3418
|
+
var _a2, _b2;
|
3419
|
+
return /* @__PURE__ */ React7.createElement(
|
3420
|
+
Select,
|
3421
|
+
{
|
3422
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
3423
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
3424
|
+
isCreatable: false,
|
3425
|
+
isMulti: false,
|
3426
|
+
isSearchable: false,
|
3427
|
+
isClearable: false,
|
3428
|
+
options: props.userReferenceOptions || [],
|
3429
|
+
onChange: (e) => field.onChange(e)
|
3430
|
+
}
|
3431
|
+
);
|
3432
|
+
}
|
3341
3433
|
}
|
3342
|
-
)
|
3343
|
-
|
3344
|
-
|
3345
|
-
|
3346
|
-
|
3347
|
-
|
3348
|
-
|
3349
|
-
|
3350
|
-
|
3351
|
-
|
3352
|
-
|
3353
|
-
|
3354
|
-
|
3434
|
+
)
|
3435
|
+
),
|
3436
|
+
/* @__PURE__ */ React7.createElement(
|
3437
|
+
TabsContent,
|
3438
|
+
{
|
3439
|
+
value: "phone",
|
3440
|
+
className: cn(
|
3441
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
3442
|
+
selectedRegisterType.value === "phone" ? "hawa-block" : "hawa-hidden"
|
3443
|
+
),
|
3444
|
+
dir: props.direction
|
3445
|
+
},
|
3446
|
+
/* @__PURE__ */ React7.createElement(
|
3447
|
+
Controller2,
|
3355
3448
|
{
|
3356
|
-
|
3357
|
-
|
3358
|
-
|
3359
|
-
|
3360
|
-
|
3361
|
-
|
3362
|
-
|
3363
|
-
|
3364
|
-
|
3365
|
-
|
3449
|
+
control,
|
3450
|
+
name: "phone",
|
3451
|
+
render: ({ field }) => {
|
3452
|
+
var _a2, _b2;
|
3453
|
+
return /* @__PURE__ */ React7.createElement(
|
3454
|
+
PhoneInput,
|
3455
|
+
{
|
3456
|
+
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
3457
|
+
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
3458
|
+
preferredCountry: { label: "+966" },
|
3459
|
+
...props.phoneInputProps,
|
3460
|
+
handleChange: (e) => {
|
3461
|
+
if (isValidPhoneNumber2(e) && isPossiblePhoneNumber2(e) && validatePhoneNumberLength2(e) === void 0) {
|
3462
|
+
let parsed = parsePhoneNumber2(e);
|
3463
|
+
field.onChange(parsed.number);
|
3464
|
+
} else {
|
3465
|
+
field.onChange(e);
|
3466
|
+
}
|
3366
3467
|
}
|
3367
|
-
}
|
3368
|
-
|
3369
|
-
|
3370
|
-
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
3371
|
-
)))
|
3468
|
+
}
|
3469
|
+
);
|
3470
|
+
}
|
3372
3471
|
}
|
3373
|
-
)
|
3374
|
-
|
3375
|
-
|
3376
|
-
|
3377
|
-
|
3378
|
-
|
3379
|
-
|
3380
|
-
|
3381
|
-
|
3382
|
-
|
3472
|
+
),
|
3473
|
+
props.additionalInputs,
|
3474
|
+
props.showRefCode && /* @__PURE__ */ React7.createElement(
|
3475
|
+
Controller2,
|
3476
|
+
{
|
3477
|
+
control,
|
3478
|
+
name: "refCode",
|
3479
|
+
render: ({ field }) => {
|
3480
|
+
var _a2;
|
3481
|
+
return /* @__PURE__ */ React7.createElement(
|
3482
|
+
Input,
|
3483
|
+
{
|
3484
|
+
width: "full",
|
3485
|
+
label: texts == null ? void 0 : texts.refCode,
|
3486
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
3487
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
3488
|
+
...field
|
3489
|
+
}
|
3490
|
+
);
|
3491
|
+
}
|
3492
|
+
}
|
3493
|
+
),
|
3494
|
+
props.showUserSource && /* @__PURE__ */ React7.createElement(
|
3495
|
+
Controller2,
|
3496
|
+
{
|
3497
|
+
control,
|
3498
|
+
name: "reference",
|
3499
|
+
render: ({ field }) => {
|
3500
|
+
var _a2, _b2;
|
3501
|
+
return /* @__PURE__ */ React7.createElement(
|
3502
|
+
Select,
|
3503
|
+
{
|
3504
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
3505
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
3506
|
+
isCreatable: false,
|
3507
|
+
isMulti: false,
|
3508
|
+
isSearchable: false,
|
3509
|
+
isClearable: false,
|
3510
|
+
options: props.userReferenceOptions || [],
|
3511
|
+
onChange: (e) => field.onChange(e)
|
3512
|
+
}
|
3513
|
+
);
|
3514
|
+
}
|
3515
|
+
}
|
3516
|
+
)
|
3517
|
+
),
|
3518
|
+
showTermsOption || showNewsletterOption ? /* @__PURE__ */ React7.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ React7.createElement(
|
3519
|
+
Controller2,
|
3383
3520
|
{
|
3384
|
-
|
3385
|
-
|
3386
|
-
|
3521
|
+
control,
|
3522
|
+
name: "terms_accepted",
|
3523
|
+
render: ({ field }) => {
|
3524
|
+
var _a2, _b2;
|
3525
|
+
return /* @__PURE__ */ React7.createElement(
|
3526
|
+
Checkbox,
|
3527
|
+
{
|
3528
|
+
id: "terms_accepted",
|
3529
|
+
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
3530
|
+
onCheckedChange: (e) => field.onChange(e),
|
3531
|
+
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(
|
3532
|
+
"span",
|
3533
|
+
{
|
3534
|
+
onClick: (e) => {
|
3535
|
+
e.preventDefault();
|
3536
|
+
if (props.onRouteToTOS) {
|
3537
|
+
props.onRouteToTOS();
|
3538
|
+
}
|
3539
|
+
},
|
3540
|
+
className: "clickable-link"
|
3541
|
+
},
|
3542
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
3543
|
+
)))
|
3544
|
+
}
|
3545
|
+
);
|
3546
|
+
}
|
3387
3547
|
}
|
3388
|
-
)
|
3389
|
-
|
3390
|
-
|
3391
|
-
|
3392
|
-
|
3393
|
-
|
3394
|
-
|
3395
|
-
|
3396
|
-
|
3397
|
-
|
3398
|
-
|
3399
|
-
|
3400
|
-
|
3401
|
-
|
3402
|
-
|
3403
|
-
|
3404
|
-
|
3405
|
-
|
3406
|
-
|
3407
|
-
|
3408
|
-
|
3409
|
-
|
3410
|
-
|
3411
|
-
|
3412
|
-
|
3413
|
-
|
3414
|
-
|
3415
|
-
|
3416
|
-
|
3417
|
-
|
3418
|
-
|
3419
|
-
|
3420
|
-
|
3421
|
-
|
3422
|
-
|
3423
|
-
|
3424
|
-
|
3548
|
+
), showNewsletterOption && /* @__PURE__ */ React7.createElement(
|
3549
|
+
Controller2,
|
3550
|
+
{
|
3551
|
+
control,
|
3552
|
+
name: "newsletter_accepted",
|
3553
|
+
render: ({ field }) => /* @__PURE__ */ React7.createElement(
|
3554
|
+
Checkbox,
|
3555
|
+
{
|
3556
|
+
id: "newsletter_accepted",
|
3557
|
+
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
3558
|
+
onCheckedChange: field.onChange
|
3559
|
+
}
|
3560
|
+
)
|
3561
|
+
}
|
3562
|
+
)) : null
|
3563
|
+
),
|
3564
|
+
/* @__PURE__ */ React7.createElement(
|
3565
|
+
Button,
|
3566
|
+
{
|
3567
|
+
className: "hawa-w-full",
|
3568
|
+
type: "submit",
|
3569
|
+
isLoading: props.isLoading,
|
3570
|
+
disabled: props.isLoading
|
3571
|
+
},
|
3572
|
+
(texts == null ? void 0 : texts.registerText) || "Register"
|
3573
|
+
),
|
3574
|
+
props.additionalButtons
|
3575
|
+
)),
|
3576
|
+
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"))
|
3577
|
+
)
|
3578
|
+
),
|
3579
|
+
props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React7.createElement(
|
3580
|
+
CardFooter,
|
3581
|
+
{
|
3582
|
+
noPadding: props.cardless,
|
3583
|
+
className: cn(
|
3584
|
+
props.logosOnly ? "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-2" : "hawa-grid hawa-grid-cols-1 hawa-gap-2"
|
3425
3585
|
)
|
3426
|
-
|
3427
|
-
|
3428
|
-
|
3586
|
+
},
|
3587
|
+
/* @__PURE__ */ React7.createElement(
|
3588
|
+
AuthButtons,
|
3589
|
+
{
|
3590
|
+
texts: thirdPartyAuthTexts,
|
3591
|
+
viaGoogle: props.viaGoogle,
|
3592
|
+
viaGithub: props.viaGithub,
|
3593
|
+
viaTwitter: props.viaTwitter,
|
3594
|
+
isGoogleLoading: props.isGoogleLoading,
|
3595
|
+
isGithubLoading: props.isGithubLoading,
|
3596
|
+
isTwitterLoading: props.isTwitterLoading,
|
3597
|
+
handleGoogle: props.onGoogleRegister,
|
3598
|
+
handleGithub: props.onGithubRegister,
|
3599
|
+
handleTwitter: props.onTwitterRegister
|
3600
|
+
}
|
3601
|
+
)
|
3602
|
+
) : null
|
3603
|
+
));
|
3429
3604
|
};
|
3430
3605
|
|
3431
3606
|
// blocks/auth/AppLanding.tsx
|