@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
package/dist/index.mjs
CHANGED
@@ -11097,6 +11097,12 @@ var LoginForm = ({
|
|
11097
11097
|
import React83, { useState as useState42 } from "react";
|
11098
11098
|
import { Controller as Controller2, FormProvider, useForm as useForm2 } from "react-hook-form";
|
11099
11099
|
import { zodResolver as zodResolver2 } from "@hookform/resolvers/zod";
|
11100
|
+
import {
|
11101
|
+
isPossiblePhoneNumber as isPossiblePhoneNumber2,
|
11102
|
+
isValidPhoneNumber as isValidPhoneNumber2,
|
11103
|
+
parsePhoneNumber as parsePhoneNumber2,
|
11104
|
+
validatePhoneNumberLength as validatePhoneNumberLength2
|
11105
|
+
} from "libphonenumber-js";
|
11100
11106
|
import * as z2 from "zod";
|
11101
11107
|
var RegisterForm = ({
|
11102
11108
|
texts,
|
@@ -11104,10 +11110,15 @@ var RegisterForm = ({
|
|
11104
11110
|
minPasswordLength = 8,
|
11105
11111
|
showTermsOption = false,
|
11106
11112
|
showNewsletterOption = false,
|
11113
|
+
registerTypes,
|
11107
11114
|
...props
|
11108
11115
|
}) => {
|
11109
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
11116
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
11110
11117
|
const [passwordVisible, setPasswordVisible] = useState42(false);
|
11118
|
+
const [selectedRegisterType, setSelectedRegisterType] = useState42({
|
11119
|
+
value: ((_a = registerTypes == null ? void 0 : registerTypes[0]) == null ? void 0 : _a.value) || "password",
|
11120
|
+
label: ((_b = registerTypes == null ? void 0 : registerTypes[0]) == null ? void 0 : _b.label) || "Password"
|
11121
|
+
});
|
11111
11122
|
const thirdPartyAuthTexts = {
|
11112
11123
|
continueWithGoogle: texts == null ? void 0 : texts.continueWithGoogle,
|
11113
11124
|
continueWithTwitter: texts == null ? void 0 : texts.continueWithTwitter,
|
@@ -11119,8 +11130,12 @@ var RegisterForm = ({
|
|
11119
11130
|
};
|
11120
11131
|
const methods = useForm2();
|
11121
11132
|
let fieldSchemas = {};
|
11133
|
+
const hasPhoneType = registerTypes == null ? void 0 : registerTypes.some((type) => type.value === "phone");
|
11134
|
+
if (hasPhoneType && selectedRegisterType.value === "phone") {
|
11135
|
+
registerFields = ["phone"];
|
11136
|
+
}
|
11122
11137
|
registerFields.forEach((field) => {
|
11123
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
11138
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
11124
11139
|
switch (field) {
|
11125
11140
|
case "fullname":
|
11126
11141
|
fieldSchemas["fullName"] = z2.string().optional();
|
@@ -11145,347 +11160,502 @@ var RegisterForm = ({
|
|
11145
11160
|
{ message: ((_g2 = texts == null ? void 0 : texts.username) == null ? void 0 : _g2.invalid) || "Invalid username" }
|
11146
11161
|
);
|
11147
11162
|
break;
|
11163
|
+
case "phone":
|
11164
|
+
fieldSchemas["phone"] = z2.string({
|
11165
|
+
required_error: ((_h2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _h2.required) || "Phone Number Required"
|
11166
|
+
}).refine(
|
11167
|
+
(value) => {
|
11168
|
+
let isPhoneValid = isPossiblePhoneNumber2(value) && isValidPhoneNumber2(value) && validatePhoneNumberLength2(value) === void 0;
|
11169
|
+
return isPhoneValid;
|
11170
|
+
},
|
11171
|
+
{ message: ((_i2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _i2.invalid) || "Phone Number Invalid" }
|
11172
|
+
);
|
11173
|
+
break;
|
11148
11174
|
}
|
11149
11175
|
});
|
11150
|
-
|
11151
|
-
|
11152
|
-
|
11153
|
-
|
11154
|
-
|
11155
|
-
|
11156
|
-
|
11157
|
-
|
11158
|
-
|
11159
|
-
|
11160
|
-
|
11161
|
-
|
11162
|
-
|
11163
|
-
|
11164
|
-
|
11165
|
-
|
11166
|
-
|
11167
|
-
|
11168
|
-
|
11169
|
-
|
11170
|
-
|
11171
|
-
|
11172
|
-
|
11173
|
-
|
11174
|
-
|
11175
|
-
|
11176
|
+
let formSchema;
|
11177
|
+
if (selectedRegisterType.value === "phone") {
|
11178
|
+
formSchema = z2.object({
|
11179
|
+
phone: z2.string({
|
11180
|
+
required_error: ((_c = texts == null ? void 0 : texts.phone) == null ? void 0 : _c.required) || "Phone Number Required"
|
11181
|
+
}).refine(
|
11182
|
+
(value) => {
|
11183
|
+
let isPhoneValid = isPossiblePhoneNumber2(value) && isValidPhoneNumber2(value) && validatePhoneNumberLength2(value) === void 0;
|
11184
|
+
return isPhoneValid;
|
11185
|
+
},
|
11186
|
+
{ message: ((_d = texts == null ? void 0 : texts.phone) == null ? void 0 : _d.invalid) || "Phone Number Invalid" }
|
11187
|
+
),
|
11188
|
+
refCode: z2.string().optional(),
|
11189
|
+
reference: z2.string().optional(),
|
11190
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
11191
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
11192
|
+
}),
|
11193
|
+
newsletter_accepted: z2.boolean().optional()
|
11194
|
+
});
|
11195
|
+
} else {
|
11196
|
+
formSchema = z2.object({
|
11197
|
+
...fieldSchemas,
|
11198
|
+
password: z2.string({
|
11199
|
+
required_error: ((_e = texts == null ? void 0 : texts.password) == null ? void 0 : _e.required) || "Password is required"
|
11200
|
+
}).min(minPasswordLength, {
|
11201
|
+
message: ((_f = texts == null ? void 0 : texts.password) == null ? void 0 : _f.tooShort) || "Password is too short"
|
11202
|
+
}).refine((value) => value !== "", {
|
11203
|
+
message: ((_g = texts == null ? void 0 : texts.password) == null ? void 0 : _g.required) || "Password is required"
|
11204
|
+
}),
|
11205
|
+
confirm_password: z2.string({
|
11206
|
+
required_error: ((_h = texts == null ? void 0 : texts.confirm) == null ? void 0 : _h.required) || "Confirm password required"
|
11207
|
+
}).min(minPasswordLength, {
|
11208
|
+
message: ((_i = texts == null ? void 0 : texts.password) == null ? void 0 : _i.tooShort) || "Password is too short"
|
11209
|
+
}).refine((value) => value !== "", {
|
11210
|
+
message: ((_j = texts == null ? void 0 : texts.password) == null ? void 0 : _j.required) || "Confirm password is required"
|
11211
|
+
}),
|
11212
|
+
refCode: z2.string().optional(),
|
11213
|
+
reference: z2.string().optional(),
|
11214
|
+
terms_accepted: z2.boolean({ required_error: (texts == null ? void 0 : texts.termsRequired) || "Terms required" }).refine((value) => value, {
|
11215
|
+
message: (texts == null ? void 0 : texts.termsRequired) || "Terms required"
|
11216
|
+
}),
|
11217
|
+
newsletter_accepted: z2.boolean().optional()
|
11218
|
+
}).refine((data) => data.password === data.confirm_password, {
|
11219
|
+
message: ((_k = texts == null ? void 0 : texts.confirm) == null ? void 0 : _k.dontMatch) || "Passwords don't match",
|
11220
|
+
path: ["confirm_password"]
|
11221
|
+
});
|
11222
|
+
}
|
11176
11223
|
const { handleSubmit, control, formState } = useForm2({
|
11177
11224
|
resolver: zodResolver2(formSchema)
|
11178
11225
|
});
|
11179
|
-
return /* @__PURE__ */ React83.createElement(
|
11180
|
-
|
11226
|
+
return /* @__PURE__ */ React83.createElement("div", { className: cn("hawa-flex hawa-flex-col", (_l = props.classNames) == null ? void 0 : _l.root) }, /* @__PURE__ */ React83.createElement(
|
11227
|
+
Card,
|
11181
11228
|
{
|
11229
|
+
dir: props.direction,
|
11182
11230
|
className: cn(
|
11183
|
-
|
11184
|
-
|
11231
|
+
(_m = props.classNames) == null ? void 0 : _m.card,
|
11232
|
+
props.cardless && "hawa-border-none hawa-bg-transparent !hawa-shadow-none !hawa-drop-shadow-none"
|
11185
11233
|
)
|
11186
11234
|
},
|
11187
11235
|
/* @__PURE__ */ React83.createElement(
|
11188
|
-
|
11236
|
+
CardContent,
|
11189
11237
|
{
|
11190
|
-
|
11191
|
-
|
11192
|
-
(_i = props.classNames) == null ? void 0 : _i.card,
|
11193
|
-
props.cardless && "hawa-border-none hawa-bg-transparent !hawa-shadow-none !hawa-drop-shadow-none"
|
11194
|
-
)
|
11238
|
+
headless: registerTypes ? registerTypes.length <= 1 : true,
|
11239
|
+
noPadding: props.cardless
|
11195
11240
|
},
|
11196
|
-
/* @__PURE__ */ React83.createElement(
|
11197
|
-
|
11241
|
+
/* @__PURE__ */ React83.createElement(
|
11242
|
+
"div",
|
11198
11243
|
{
|
11199
|
-
|
11200
|
-
|
11201
|
-
|
11202
|
-
|
11203
|
-
|
11204
|
-
|
11205
|
-
|
11244
|
+
className: cn(registerTypes && registerTypes.length > 1 ? "hawa-mt-6 hawa-mb-0" : "")
|
11245
|
+
},
|
11246
|
+
props.showError && /* @__PURE__ */ React83.createElement(
|
11247
|
+
Alert,
|
11248
|
+
{
|
11249
|
+
direction: props.direction,
|
11250
|
+
title: props.errorTitle,
|
11251
|
+
text: props.errorText,
|
11252
|
+
severity: "error",
|
11253
|
+
onAlertClosed: () => {
|
11254
|
+
if (props.onErrorDismissed) {
|
11255
|
+
props.onErrorDismissed();
|
11256
|
+
}
|
11206
11257
|
}
|
11207
11258
|
}
|
11208
|
-
|
11209
|
-
|
11210
|
-
|
11211
|
-
|
11212
|
-
|
11213
|
-
|
11214
|
-
|
11215
|
-
|
11216
|
-
|
11217
|
-
|
11218
|
-
|
11219
|
-
|
11220
|
-
|
11221
|
-
}
|
11222
|
-
|
11223
|
-
|
11224
|
-
|
11225
|
-
|
11226
|
-
|
11227
|
-
|
11259
|
+
),
|
11260
|
+
/* @__PURE__ */ React83.createElement(FormProvider, { ...methods }, /* @__PURE__ */ React83.createElement(
|
11261
|
+
"form",
|
11262
|
+
{
|
11263
|
+
noValidate: true,
|
11264
|
+
onSubmit: handleSubmit((e) => {
|
11265
|
+
if (props.onRegister) {
|
11266
|
+
return props.onRegister(e);
|
11267
|
+
} else {
|
11268
|
+
console.log("Form is submitted but onRegister prop is missing");
|
11269
|
+
}
|
11270
|
+
}),
|
11271
|
+
className: "hawa-flex hawa-flex-col hawa-gap-4"
|
11272
|
+
},
|
11273
|
+
/* @__PURE__ */ React83.createElement(
|
11274
|
+
Tabs2,
|
11275
|
+
{
|
11276
|
+
dir: props.direction,
|
11277
|
+
value: selectedRegisterType.value,
|
11278
|
+
onValueChange: (e) => {
|
11279
|
+
if (props.onRegisterTypeChange) {
|
11280
|
+
props.onRegisterTypeChange(e);
|
11281
|
+
}
|
11282
|
+
setSelectedRegisterType(
|
11283
|
+
(registerTypes == null ? void 0 : registerTypes.find((r) => r.value === e)) || registerTypes && registerTypes[0] || {
|
11284
|
+
label: "Password",
|
11285
|
+
value: "password"
|
11286
|
+
}
|
11287
|
+
);
|
11288
|
+
}
|
11289
|
+
},
|
11290
|
+
registerTypes && registerTypes.length > 1 && /* @__PURE__ */ React83.createElement(CardHeader, { className: "hawa-w-full hawa-px-0 hawa-py-0 hawa-mb-4" }, /* @__PURE__ */ React83.createElement(TabsList2, { className: "hawa-w-full" }, registerTypes.map((registerType) => /* @__PURE__ */ React83.createElement(TabsTrigger2, { value: registerType.value }, registerType.label)))),
|
11291
|
+
/* @__PURE__ */ React83.createElement(
|
11292
|
+
TabsContent,
|
11228
11293
|
{
|
11229
|
-
|
11230
|
-
|
11231
|
-
|
11232
|
-
|
11233
|
-
|
11294
|
+
value: "password",
|
11295
|
+
className: cn(
|
11296
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
11297
|
+
selectedRegisterType.value === "password" ? "hawa-block" : "hawa-hidden"
|
11298
|
+
),
|
11299
|
+
dir: props.direction
|
11300
|
+
},
|
11301
|
+
/* @__PURE__ */ React83.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4" }, registerFields.map((fld, i) => {
|
11302
|
+
if (fld === "fullname") {
|
11234
11303
|
return /* @__PURE__ */ React83.createElement(
|
11235
|
-
|
11304
|
+
Controller2,
|
11236
11305
|
{
|
11237
|
-
|
11238
|
-
|
11239
|
-
|
11240
|
-
|
11241
|
-
|
11306
|
+
key: i,
|
11307
|
+
control,
|
11308
|
+
name: "fullName",
|
11309
|
+
render: ({ field }) => {
|
11310
|
+
var _a2, _b2, _c2;
|
11311
|
+
return /* @__PURE__ */ React83.createElement(
|
11312
|
+
Input,
|
11313
|
+
{
|
11314
|
+
width: "full",
|
11315
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
11316
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
11317
|
+
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
11318
|
+
...field
|
11319
|
+
}
|
11320
|
+
);
|
11321
|
+
}
|
11242
11322
|
}
|
11243
11323
|
);
|
11244
11324
|
}
|
11245
|
-
|
11246
|
-
);
|
11247
|
-
}
|
11248
|
-
if (fld === "email") {
|
11249
|
-
return /* @__PURE__ */ React83.createElement(
|
11250
|
-
Controller2,
|
11251
|
-
{
|
11252
|
-
key: i,
|
11253
|
-
control,
|
11254
|
-
name: "email",
|
11255
|
-
render: ({ field }) => {
|
11256
|
-
var _a2, _b2, _c2;
|
11325
|
+
if (fld === "email") {
|
11257
11326
|
return /* @__PURE__ */ React83.createElement(
|
11258
|
-
|
11327
|
+
Controller2,
|
11259
11328
|
{
|
11260
|
-
|
11261
|
-
|
11262
|
-
|
11263
|
-
}
|
11264
|
-
|
11265
|
-
|
11266
|
-
|
11267
|
-
|
11268
|
-
|
11269
|
-
|
11270
|
-
|
11271
|
-
|
11272
|
-
|
11329
|
+
key: i,
|
11330
|
+
control,
|
11331
|
+
name: "email",
|
11332
|
+
render: ({ field }) => {
|
11333
|
+
var _a2, _b2, _c2;
|
11334
|
+
return /* @__PURE__ */ React83.createElement(
|
11335
|
+
Input,
|
11336
|
+
{
|
11337
|
+
dir: "ltr",
|
11338
|
+
inputProps: {
|
11339
|
+
className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
|
11340
|
+
},
|
11341
|
+
width: "full",
|
11342
|
+
autoComplete: "email",
|
11343
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
11344
|
+
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
11345
|
+
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
11346
|
+
...field,
|
11347
|
+
onChange: (e) => {
|
11348
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
11349
|
+
}
|
11350
|
+
}
|
11273
11351
|
);
|
11274
11352
|
}
|
11275
11353
|
}
|
11276
11354
|
);
|
11277
11355
|
}
|
11278
|
-
|
11279
|
-
);
|
11280
|
-
}
|
11281
|
-
if (fld === "username") {
|
11282
|
-
return /* @__PURE__ */ React83.createElement(
|
11283
|
-
Controller2,
|
11284
|
-
{
|
11285
|
-
key: i,
|
11286
|
-
control,
|
11287
|
-
name: "username",
|
11288
|
-
render: ({ field }) => {
|
11289
|
-
var _a2, _b2, _c2, _d2;
|
11356
|
+
if (fld === "username") {
|
11290
11357
|
return /* @__PURE__ */ React83.createElement(
|
11291
|
-
|
11358
|
+
Controller2,
|
11292
11359
|
{
|
11293
|
-
|
11294
|
-
|
11295
|
-
|
11296
|
-
|
11297
|
-
|
11298
|
-
|
11299
|
-
|
11300
|
-
|
11301
|
-
|
11360
|
+
key: i,
|
11361
|
+
control,
|
11362
|
+
name: "username",
|
11363
|
+
render: ({ field }) => {
|
11364
|
+
var _a2, _b2, _c2, _d2;
|
11365
|
+
return /* @__PURE__ */ React83.createElement(
|
11366
|
+
Input,
|
11367
|
+
{
|
11368
|
+
width: "full",
|
11369
|
+
autoComplete: "username",
|
11370
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
11371
|
+
labelProps: {
|
11372
|
+
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
11373
|
+
},
|
11374
|
+
helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
|
11375
|
+
placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
|
11376
|
+
...field
|
11377
|
+
}
|
11378
|
+
);
|
11379
|
+
}
|
11302
11380
|
}
|
11303
11381
|
);
|
11304
11382
|
}
|
11305
|
-
}
|
11306
|
-
|
11307
|
-
|
11308
|
-
})),
|
11309
|
-
/* @__PURE__ */ React83.createElement(
|
11310
|
-
Controller2,
|
11311
|
-
{
|
11312
|
-
control,
|
11313
|
-
name: "password",
|
11314
|
-
render: ({ field }) => {
|
11315
|
-
var _a2, _b2, _c2;
|
11316
|
-
return /* @__PURE__ */ React83.createElement(
|
11317
|
-
Input,
|
11383
|
+
})),
|
11384
|
+
/* @__PURE__ */ React83.createElement(
|
11385
|
+
Controller2,
|
11318
11386
|
{
|
11319
|
-
|
11320
|
-
|
11321
|
-
|
11322
|
-
|
11323
|
-
|
11324
|
-
|
11325
|
-
|
11326
|
-
|
11327
|
-
|
11328
|
-
|
11329
|
-
|
11330
|
-
|
11331
|
-
|
11332
|
-
|
11333
|
-
|
11334
|
-
|
11387
|
+
control,
|
11388
|
+
name: "password",
|
11389
|
+
render: ({ field }) => {
|
11390
|
+
var _a2, _b2, _c2;
|
11391
|
+
return /* @__PURE__ */ React83.createElement(
|
11392
|
+
Input,
|
11393
|
+
{
|
11394
|
+
width: "full",
|
11395
|
+
type: passwordVisible ? "text" : "password",
|
11396
|
+
autoComplete: "new-password",
|
11397
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
11398
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
11399
|
+
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
11400
|
+
endIcon: /* @__PURE__ */ React83.createElement(
|
11401
|
+
"div",
|
11402
|
+
{
|
11403
|
+
className: "hawa-cursor-pointer",
|
11404
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
11405
|
+
},
|
11406
|
+
passwordVisible ? /* @__PURE__ */ React83.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ React83.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
11407
|
+
" "
|
11408
|
+
),
|
11409
|
+
...field
|
11410
|
+
}
|
11411
|
+
);
|
11412
|
+
}
|
11335
11413
|
}
|
11336
|
-
)
|
11337
|
-
|
11338
|
-
|
11339
|
-
),
|
11340
|
-
/* @__PURE__ */ React83.createElement(
|
11341
|
-
Controller2,
|
11342
|
-
{
|
11343
|
-
control,
|
11344
|
-
name: "confirm_password",
|
11345
|
-
render: ({ field }) => {
|
11346
|
-
var _a2, _b2, _c2;
|
11347
|
-
return /* @__PURE__ */ React83.createElement(
|
11348
|
-
Input,
|
11414
|
+
),
|
11415
|
+
/* @__PURE__ */ React83.createElement(
|
11416
|
+
Controller2,
|
11349
11417
|
{
|
11350
|
-
|
11351
|
-
|
11352
|
-
|
11353
|
-
|
11354
|
-
|
11355
|
-
|
11356
|
-
|
11418
|
+
control,
|
11419
|
+
name: "confirm_password",
|
11420
|
+
render: ({ field }) => {
|
11421
|
+
var _a2, _b2, _c2;
|
11422
|
+
return /* @__PURE__ */ React83.createElement(
|
11423
|
+
Input,
|
11424
|
+
{
|
11425
|
+
width: "full",
|
11426
|
+
type: passwordVisible ? "text" : "password",
|
11427
|
+
autoComplete: "new-password",
|
11428
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
11429
|
+
placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
|
11430
|
+
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
11431
|
+
endIcon: /* @__PURE__ */ React83.createElement(
|
11432
|
+
"div",
|
11433
|
+
{
|
11434
|
+
className: "hawa-cursor-pointer",
|
11435
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
11436
|
+
},
|
11437
|
+
passwordVisible ? /* @__PURE__ */ React83.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ React83.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
11438
|
+
" "
|
11439
|
+
),
|
11440
|
+
...field
|
11441
|
+
}
|
11442
|
+
);
|
11443
|
+
}
|
11357
11444
|
}
|
11358
|
-
)
|
11359
|
-
|
11360
|
-
|
11361
|
-
|
11362
|
-
props.additionalInputs,
|
11363
|
-
props.showRefCode && /* @__PURE__ */ React83.createElement(
|
11364
|
-
Controller2,
|
11365
|
-
{
|
11366
|
-
control,
|
11367
|
-
name: "refCode",
|
11368
|
-
render: ({ field }) => {
|
11369
|
-
var _a2;
|
11370
|
-
return /* @__PURE__ */ React83.createElement(
|
11371
|
-
Input,
|
11445
|
+
),
|
11446
|
+
props.additionalInputs,
|
11447
|
+
props.showRefCode && /* @__PURE__ */ React83.createElement(
|
11448
|
+
Controller2,
|
11372
11449
|
{
|
11373
|
-
|
11374
|
-
|
11375
|
-
|
11376
|
-
|
11377
|
-
|
11450
|
+
control,
|
11451
|
+
name: "refCode",
|
11452
|
+
render: ({ field }) => {
|
11453
|
+
var _a2;
|
11454
|
+
return /* @__PURE__ */ React83.createElement(
|
11455
|
+
Input,
|
11456
|
+
{
|
11457
|
+
width: "full",
|
11458
|
+
label: texts == null ? void 0 : texts.refCode,
|
11459
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
11460
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
11461
|
+
...field
|
11462
|
+
}
|
11463
|
+
);
|
11464
|
+
}
|
11378
11465
|
}
|
11379
|
-
)
|
11380
|
-
|
11381
|
-
|
11382
|
-
),
|
11383
|
-
props.showUserSource && /* @__PURE__ */ React83.createElement(
|
11384
|
-
Controller2,
|
11385
|
-
{
|
11386
|
-
control,
|
11387
|
-
name: "reference",
|
11388
|
-
render: ({ field }) => {
|
11389
|
-
var _a2, _b2;
|
11390
|
-
return /* @__PURE__ */ React83.createElement(
|
11391
|
-
Select,
|
11466
|
+
),
|
11467
|
+
props.showUserSource && /* @__PURE__ */ React83.createElement(
|
11468
|
+
Controller2,
|
11392
11469
|
{
|
11393
|
-
|
11394
|
-
|
11395
|
-
|
11396
|
-
|
11397
|
-
|
11398
|
-
|
11399
|
-
|
11400
|
-
|
11470
|
+
control,
|
11471
|
+
name: "reference",
|
11472
|
+
render: ({ field }) => {
|
11473
|
+
var _a2, _b2;
|
11474
|
+
return /* @__PURE__ */ React83.createElement(
|
11475
|
+
Select,
|
11476
|
+
{
|
11477
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
11478
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
11479
|
+
isCreatable: false,
|
11480
|
+
isMulti: false,
|
11481
|
+
isSearchable: false,
|
11482
|
+
isClearable: false,
|
11483
|
+
options: props.userReferenceOptions || [],
|
11484
|
+
onChange: (e) => field.onChange(e)
|
11485
|
+
}
|
11486
|
+
);
|
11487
|
+
}
|
11401
11488
|
}
|
11402
|
-
)
|
11403
|
-
|
11404
|
-
|
11405
|
-
|
11406
|
-
|
11407
|
-
|
11408
|
-
|
11409
|
-
|
11410
|
-
|
11411
|
-
|
11412
|
-
|
11413
|
-
|
11414
|
-
|
11489
|
+
)
|
11490
|
+
),
|
11491
|
+
/* @__PURE__ */ React83.createElement(
|
11492
|
+
TabsContent,
|
11493
|
+
{
|
11494
|
+
value: "phone",
|
11495
|
+
className: cn(
|
11496
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
11497
|
+
selectedRegisterType.value === "phone" ? "hawa-block" : "hawa-hidden"
|
11498
|
+
),
|
11499
|
+
dir: props.direction
|
11500
|
+
},
|
11501
|
+
/* @__PURE__ */ React83.createElement(
|
11502
|
+
Controller2,
|
11415
11503
|
{
|
11416
|
-
|
11417
|
-
|
11418
|
-
|
11419
|
-
|
11420
|
-
|
11421
|
-
|
11422
|
-
|
11423
|
-
|
11424
|
-
|
11425
|
-
|
11504
|
+
control,
|
11505
|
+
name: "phone",
|
11506
|
+
render: ({ field }) => {
|
11507
|
+
var _a2, _b2;
|
11508
|
+
return /* @__PURE__ */ React83.createElement(
|
11509
|
+
PhoneInput,
|
11510
|
+
{
|
11511
|
+
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
11512
|
+
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
11513
|
+
preferredCountry: { label: "+966" },
|
11514
|
+
...props.phoneInputProps,
|
11515
|
+
handleChange: (e) => {
|
11516
|
+
if (isValidPhoneNumber2(e) && isPossiblePhoneNumber2(e) && validatePhoneNumberLength2(e) === void 0) {
|
11517
|
+
let parsed = parsePhoneNumber2(e);
|
11518
|
+
field.onChange(parsed.number);
|
11519
|
+
} else {
|
11520
|
+
field.onChange(e);
|
11521
|
+
}
|
11426
11522
|
}
|
11427
|
-
}
|
11428
|
-
|
11429
|
-
|
11430
|
-
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
11431
|
-
)))
|
11523
|
+
}
|
11524
|
+
);
|
11525
|
+
}
|
11432
11526
|
}
|
11433
|
-
)
|
11434
|
-
|
11435
|
-
|
11436
|
-
|
11437
|
-
|
11438
|
-
|
11439
|
-
|
11440
|
-
|
11441
|
-
|
11442
|
-
|
11527
|
+
),
|
11528
|
+
props.additionalInputs,
|
11529
|
+
props.showRefCode && /* @__PURE__ */ React83.createElement(
|
11530
|
+
Controller2,
|
11531
|
+
{
|
11532
|
+
control,
|
11533
|
+
name: "refCode",
|
11534
|
+
render: ({ field }) => {
|
11535
|
+
var _a2;
|
11536
|
+
return /* @__PURE__ */ React83.createElement(
|
11537
|
+
Input,
|
11538
|
+
{
|
11539
|
+
width: "full",
|
11540
|
+
label: texts == null ? void 0 : texts.refCode,
|
11541
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
11542
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
11543
|
+
...field
|
11544
|
+
}
|
11545
|
+
);
|
11546
|
+
}
|
11547
|
+
}
|
11548
|
+
),
|
11549
|
+
props.showUserSource && /* @__PURE__ */ React83.createElement(
|
11550
|
+
Controller2,
|
11551
|
+
{
|
11552
|
+
control,
|
11553
|
+
name: "reference",
|
11554
|
+
render: ({ field }) => {
|
11555
|
+
var _a2, _b2;
|
11556
|
+
return /* @__PURE__ */ React83.createElement(
|
11557
|
+
Select,
|
11558
|
+
{
|
11559
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
11560
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
11561
|
+
isCreatable: false,
|
11562
|
+
isMulti: false,
|
11563
|
+
isSearchable: false,
|
11564
|
+
isClearable: false,
|
11565
|
+
options: props.userReferenceOptions || [],
|
11566
|
+
onChange: (e) => field.onChange(e)
|
11567
|
+
}
|
11568
|
+
);
|
11569
|
+
}
|
11570
|
+
}
|
11571
|
+
)
|
11572
|
+
),
|
11573
|
+
showTermsOption || showNewsletterOption ? /* @__PURE__ */ React83.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ React83.createElement(
|
11574
|
+
Controller2,
|
11443
11575
|
{
|
11444
|
-
|
11445
|
-
|
11446
|
-
|
11576
|
+
control,
|
11577
|
+
name: "terms_accepted",
|
11578
|
+
render: ({ field }) => {
|
11579
|
+
var _a2, _b2;
|
11580
|
+
return /* @__PURE__ */ React83.createElement(
|
11581
|
+
Checkbox,
|
11582
|
+
{
|
11583
|
+
id: "terms_accepted",
|
11584
|
+
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
11585
|
+
onCheckedChange: (e) => field.onChange(e),
|
11586
|
+
label: /* @__PURE__ */ React83.createElement("div", { className: "hawa-flex hawa-flex-row hawa-gap-0.5 hawa-whitespace-nowrap hawa-flex-wrap" }, (texts == null ? void 0 : texts.iAcceptText) || "I accept the", " ", /* @__PURE__ */ React83.createElement(StopPropagationWrapper, null, /* @__PURE__ */ React83.createElement(
|
11587
|
+
"span",
|
11588
|
+
{
|
11589
|
+
onClick: (e) => {
|
11590
|
+
e.preventDefault();
|
11591
|
+
if (props.onRouteToTOS) {
|
11592
|
+
props.onRouteToTOS();
|
11593
|
+
}
|
11594
|
+
},
|
11595
|
+
className: "clickable-link"
|
11596
|
+
},
|
11597
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
11598
|
+
)))
|
11599
|
+
}
|
11600
|
+
);
|
11601
|
+
}
|
11447
11602
|
}
|
11448
|
-
)
|
11449
|
-
|
11450
|
-
|
11451
|
-
|
11452
|
-
|
11453
|
-
|
11454
|
-
|
11455
|
-
|
11456
|
-
|
11457
|
-
|
11458
|
-
|
11459
|
-
|
11460
|
-
|
11461
|
-
|
11462
|
-
|
11463
|
-
|
11464
|
-
|
11465
|
-
|
11466
|
-
|
11467
|
-
|
11468
|
-
|
11469
|
-
|
11470
|
-
|
11471
|
-
|
11472
|
-
|
11473
|
-
|
11474
|
-
|
11475
|
-
|
11476
|
-
|
11477
|
-
|
11478
|
-
|
11479
|
-
|
11480
|
-
|
11481
|
-
|
11482
|
-
|
11483
|
-
|
11484
|
-
|
11603
|
+
), showNewsletterOption && /* @__PURE__ */ React83.createElement(
|
11604
|
+
Controller2,
|
11605
|
+
{
|
11606
|
+
control,
|
11607
|
+
name: "newsletter_accepted",
|
11608
|
+
render: ({ field }) => /* @__PURE__ */ React83.createElement(
|
11609
|
+
Checkbox,
|
11610
|
+
{
|
11611
|
+
id: "newsletter_accepted",
|
11612
|
+
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
11613
|
+
onCheckedChange: field.onChange
|
11614
|
+
}
|
11615
|
+
)
|
11616
|
+
}
|
11617
|
+
)) : null
|
11618
|
+
),
|
11619
|
+
/* @__PURE__ */ React83.createElement(
|
11620
|
+
Button,
|
11621
|
+
{
|
11622
|
+
className: "hawa-w-full",
|
11623
|
+
type: "submit",
|
11624
|
+
isLoading: props.isLoading,
|
11625
|
+
disabled: props.isLoading
|
11626
|
+
},
|
11627
|
+
(texts == null ? void 0 : texts.registerText) || "Register"
|
11628
|
+
),
|
11629
|
+
props.additionalButtons
|
11630
|
+
)),
|
11631
|
+
props.onRouteToLogin && /* @__PURE__ */ React83.createElement("div", { className: "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-1 hawa-p-3 hawa-text-center hawa-text-sm hawa-font-normal dark:hawa-text-white" }, /* @__PURE__ */ React83.createElement("span", null, (texts == null ? void 0 : texts.existingUserText) || "Already have an account?"), /* @__PURE__ */ React83.createElement("span", { onClick: props.onRouteToLogin, className: "clickable-link" }, (texts == null ? void 0 : texts.loginText) || "Login"))
|
11632
|
+
)
|
11633
|
+
),
|
11634
|
+
props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React83.createElement(
|
11635
|
+
CardFooter,
|
11636
|
+
{
|
11637
|
+
noPadding: props.cardless,
|
11638
|
+
className: cn(
|
11639
|
+
props.logosOnly ? "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-2" : "hawa-grid hawa-grid-cols-1 hawa-gap-2"
|
11485
11640
|
)
|
11486
|
-
|
11487
|
-
|
11488
|
-
|
11641
|
+
},
|
11642
|
+
/* @__PURE__ */ React83.createElement(
|
11643
|
+
AuthButtons,
|
11644
|
+
{
|
11645
|
+
texts: thirdPartyAuthTexts,
|
11646
|
+
viaGoogle: props.viaGoogle,
|
11647
|
+
viaGithub: props.viaGithub,
|
11648
|
+
viaTwitter: props.viaTwitter,
|
11649
|
+
isGoogleLoading: props.isGoogleLoading,
|
11650
|
+
isGithubLoading: props.isGithubLoading,
|
11651
|
+
isTwitterLoading: props.isTwitterLoading,
|
11652
|
+
handleGoogle: props.onGoogleRegister,
|
11653
|
+
handleGithub: props.onGithubRegister,
|
11654
|
+
handleTwitter: props.onTwitterRegister
|
11655
|
+
}
|
11656
|
+
)
|
11657
|
+
) : null
|
11658
|
+
));
|
11489
11659
|
};
|
11490
11660
|
|
11491
11661
|
// blocks/auth/AppLanding.tsx
|