@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
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,55 +11160,85 @@ 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(
|
11241
|
+
/* @__PURE__ */ React83.createElement("div", null, props.showError && /* @__PURE__ */ React83.createElement(
|
11197
11242
|
Alert,
|
11198
11243
|
{
|
11199
11244
|
direction: props.direction,
|
@@ -11214,240 +11259,352 @@ var RegisterForm = ({
|
|
11214
11259
|
if (props.onRegister) {
|
11215
11260
|
return props.onRegister(e);
|
11216
11261
|
} else {
|
11217
|
-
console.log(
|
11218
|
-
"Form is submitted but onRegister prop is missing"
|
11219
|
-
);
|
11262
|
+
console.log("Form is submitted but onRegister prop is missing");
|
11220
11263
|
}
|
11221
11264
|
}),
|
11222
11265
|
className: "hawa-flex hawa-flex-col hawa-gap-4"
|
11223
11266
|
},
|
11224
|
-
/* @__PURE__ */ React83.createElement(
|
11225
|
-
|
11226
|
-
|
11267
|
+
/* @__PURE__ */ React83.createElement(
|
11268
|
+
Tabs2,
|
11269
|
+
{
|
11270
|
+
dir: props.direction,
|
11271
|
+
value: selectedRegisterType.value,
|
11272
|
+
onValueChange: (e) => setSelectedRegisterType(
|
11273
|
+
(registerTypes == null ? void 0 : registerTypes.find((r) => r.value === e)) || registerTypes && registerTypes[0] || {
|
11274
|
+
label: "Password",
|
11275
|
+
value: "password"
|
11276
|
+
}
|
11277
|
+
)
|
11278
|
+
},
|
11279
|
+
registerTypes && registerTypes.length > 1 && /* @__PURE__ */ React83.createElement(CardHeader, { className: "hawa-w-full hawa-px-0 hawa-py-0 hawa-my-4 hawa-mt-6" }, /* @__PURE__ */ React83.createElement(TabsList2, { className: "hawa-w-full" }, registerTypes.map((registerType) => /* @__PURE__ */ React83.createElement(TabsTrigger2, { value: registerType.value }, registerType.label)))),
|
11280
|
+
/* @__PURE__ */ React83.createElement(
|
11281
|
+
TabsContent,
|
11282
|
+
{
|
11283
|
+
value: "password",
|
11284
|
+
className: cn(
|
11285
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
11286
|
+
selectedRegisterType.value === "password" ? "hawa-block" : "hawa-hidden"
|
11287
|
+
),
|
11288
|
+
dir: props.direction
|
11289
|
+
},
|
11290
|
+
/* @__PURE__ */ React83.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-4" }, registerFields.map((fld, i) => {
|
11291
|
+
if (fld === "fullname") {
|
11292
|
+
return /* @__PURE__ */ React83.createElement(
|
11293
|
+
Controller2,
|
11294
|
+
{
|
11295
|
+
key: i,
|
11296
|
+
control,
|
11297
|
+
name: "fullName",
|
11298
|
+
render: ({ field }) => {
|
11299
|
+
var _a2, _b2, _c2;
|
11300
|
+
return /* @__PURE__ */ React83.createElement(
|
11301
|
+
Input,
|
11302
|
+
{
|
11303
|
+
width: "full",
|
11304
|
+
label: ((_a2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _a2.label) || "Full Name",
|
11305
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.fullName) == null ? void 0 : _b2.placeholder,
|
11306
|
+
helperText: (_c2 = formState.errors.fullName) == null ? void 0 : _c2.message,
|
11307
|
+
...field
|
11308
|
+
}
|
11309
|
+
);
|
11310
|
+
}
|
11311
|
+
}
|
11312
|
+
);
|
11313
|
+
}
|
11314
|
+
if (fld === "email") {
|
11315
|
+
return /* @__PURE__ */ React83.createElement(
|
11316
|
+
Controller2,
|
11317
|
+
{
|
11318
|
+
key: i,
|
11319
|
+
control,
|
11320
|
+
name: "email",
|
11321
|
+
render: ({ field }) => {
|
11322
|
+
var _a2, _b2, _c2;
|
11323
|
+
return /* @__PURE__ */ React83.createElement(
|
11324
|
+
Input,
|
11325
|
+
{
|
11326
|
+
dir: "ltr",
|
11327
|
+
inputProps: {
|
11328
|
+
className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
|
11329
|
+
},
|
11330
|
+
width: "full",
|
11331
|
+
autoComplete: "email",
|
11332
|
+
label: ((_a2 = texts == null ? void 0 : texts.email) == null ? void 0 : _a2.label) || "Email",
|
11333
|
+
helperText: (_b2 = formState.errors.email) == null ? void 0 : _b2.message,
|
11334
|
+
placeholder: ((_c2 = texts == null ? void 0 : texts.email) == null ? void 0 : _c2.placeholder) || "Enter your email",
|
11335
|
+
...field,
|
11336
|
+
onChange: (e) => {
|
11337
|
+
field.onChange(e.target.value.toLowerCase().trim());
|
11338
|
+
}
|
11339
|
+
}
|
11340
|
+
);
|
11341
|
+
}
|
11342
|
+
}
|
11343
|
+
);
|
11344
|
+
}
|
11345
|
+
if (fld === "username") {
|
11346
|
+
return /* @__PURE__ */ React83.createElement(
|
11347
|
+
Controller2,
|
11348
|
+
{
|
11349
|
+
key: i,
|
11350
|
+
control,
|
11351
|
+
name: "username",
|
11352
|
+
render: ({ field }) => {
|
11353
|
+
var _a2, _b2, _c2, _d2;
|
11354
|
+
return /* @__PURE__ */ React83.createElement(
|
11355
|
+
Input,
|
11356
|
+
{
|
11357
|
+
width: "full",
|
11358
|
+
autoComplete: "username",
|
11359
|
+
label: ((_a2 = texts == null ? void 0 : texts.username) == null ? void 0 : _a2.label) || "Username",
|
11360
|
+
labelProps: {
|
11361
|
+
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
11362
|
+
},
|
11363
|
+
helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
|
11364
|
+
placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
|
11365
|
+
...field
|
11366
|
+
}
|
11367
|
+
);
|
11368
|
+
}
|
11369
|
+
}
|
11370
|
+
);
|
11371
|
+
}
|
11372
|
+
})),
|
11373
|
+
/* @__PURE__ */ React83.createElement(
|
11227
11374
|
Controller2,
|
11228
11375
|
{
|
11229
|
-
key: i,
|
11230
11376
|
control,
|
11231
|
-
name: "
|
11377
|
+
name: "password",
|
11232
11378
|
render: ({ field }) => {
|
11233
11379
|
var _a2, _b2, _c2;
|
11234
11380
|
return /* @__PURE__ */ React83.createElement(
|
11235
11381
|
Input,
|
11236
11382
|
{
|
11237
11383
|
width: "full",
|
11238
|
-
|
11239
|
-
|
11240
|
-
|
11384
|
+
type: passwordVisible ? "text" : "password",
|
11385
|
+
autoComplete: "new-password",
|
11386
|
+
label: ((_a2 = texts == null ? void 0 : texts.password) == null ? void 0 : _a2.label) || "Password",
|
11387
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.password) == null ? void 0 : _b2.placeholder,
|
11388
|
+
helperText: (_c2 = formState.errors.password) == null ? void 0 : _c2.message,
|
11389
|
+
endIcon: /* @__PURE__ */ React83.createElement(
|
11390
|
+
"div",
|
11391
|
+
{
|
11392
|
+
className: "hawa-cursor-pointer",
|
11393
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
11394
|
+
},
|
11395
|
+
passwordVisible ? /* @__PURE__ */ React83.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ React83.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
11396
|
+
" "
|
11397
|
+
),
|
11241
11398
|
...field
|
11242
11399
|
}
|
11243
11400
|
);
|
11244
11401
|
}
|
11245
11402
|
}
|
11246
|
-
)
|
11247
|
-
|
11248
|
-
if (fld === "email") {
|
11249
|
-
return /* @__PURE__ */ React83.createElement(
|
11403
|
+
),
|
11404
|
+
/* @__PURE__ */ React83.createElement(
|
11250
11405
|
Controller2,
|
11251
11406
|
{
|
11252
|
-
key: i,
|
11253
11407
|
control,
|
11254
|
-
name: "
|
11408
|
+
name: "confirm_password",
|
11255
11409
|
render: ({ field }) => {
|
11256
11410
|
var _a2, _b2, _c2;
|
11257
11411
|
return /* @__PURE__ */ React83.createElement(
|
11258
11412
|
Input,
|
11259
11413
|
{
|
11260
|
-
dir: "ltr",
|
11261
|
-
inputProps: {
|
11262
|
-
className: props.direction === "rtl" ? "hawa-text-right" : "hawa-text-left"
|
11263
|
-
},
|
11264
11414
|
width: "full",
|
11265
|
-
|
11266
|
-
|
11267
|
-
|
11268
|
-
placeholder: ((
|
11269
|
-
|
11270
|
-
|
11271
|
-
|
11272
|
-
|
11273
|
-
|
11274
|
-
|
11415
|
+
type: passwordVisible ? "text" : "password",
|
11416
|
+
autoComplete: "new-password",
|
11417
|
+
label: ((_a2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _a2.label) || "Confirm Password",
|
11418
|
+
placeholder: ((_b2 = texts == null ? void 0 : texts.confirm) == null ? void 0 : _b2.placeholder) || "Confirm your Password",
|
11419
|
+
helperText: (_c2 = formState.errors.confirm_password) == null ? void 0 : _c2.message,
|
11420
|
+
endIcon: /* @__PURE__ */ React83.createElement(
|
11421
|
+
"div",
|
11422
|
+
{
|
11423
|
+
className: "hawa-cursor-pointer",
|
11424
|
+
onClick: () => setPasswordVisible(!passwordVisible)
|
11425
|
+
},
|
11426
|
+
passwordVisible ? /* @__PURE__ */ React83.createElement(EyeIcon, { className: "hawa-text-gray-500" }) : /* @__PURE__ */ React83.createElement(HiddenEyeIcon, { className: "hawa-text-gray-500" }),
|
11427
|
+
" "
|
11428
|
+
),
|
11429
|
+
...field
|
11275
11430
|
}
|
11276
11431
|
);
|
11277
11432
|
}
|
11278
11433
|
}
|
11279
|
-
)
|
11280
|
-
|
11281
|
-
|
11282
|
-
return /* @__PURE__ */ React83.createElement(
|
11434
|
+
),
|
11435
|
+
props.additionalInputs,
|
11436
|
+
props.showRefCode && /* @__PURE__ */ React83.createElement(
|
11283
11437
|
Controller2,
|
11284
11438
|
{
|
11285
|
-
key: i,
|
11286
11439
|
control,
|
11287
|
-
name: "
|
11440
|
+
name: "refCode",
|
11288
11441
|
render: ({ field }) => {
|
11289
|
-
var _a2
|
11442
|
+
var _a2;
|
11290
11443
|
return /* @__PURE__ */ React83.createElement(
|
11291
11444
|
Input,
|
11292
11445
|
{
|
11293
11446
|
width: "full",
|
11294
|
-
|
11295
|
-
|
11296
|
-
|
11297
|
-
...(_b2 = props.usernameOptions) == null ? void 0 : _b2.label
|
11298
|
-
},
|
11299
|
-
helperText: (_c2 = formState.errors.username) == null ? void 0 : _c2.message,
|
11300
|
-
placeholder: (_d2 = texts == null ? void 0 : texts.username) == null ? void 0 : _d2.placeholder,
|
11447
|
+
label: texts == null ? void 0 : texts.refCode,
|
11448
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
11449
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
11301
11450
|
...field
|
11302
11451
|
}
|
11303
11452
|
);
|
11304
11453
|
}
|
11305
11454
|
}
|
11306
|
-
)
|
11307
|
-
|
11308
|
-
|
11309
|
-
|
11310
|
-
|
11311
|
-
|
11312
|
-
|
11313
|
-
|
11314
|
-
|
11315
|
-
|
11316
|
-
return /* @__PURE__ */ React83.createElement(
|
11317
|
-
Input,
|
11318
|
-
{
|
11319
|
-
width: "full",
|
11320
|
-
type: passwordVisible ? "text" : "password",
|
11321
|
-
endIcon: /* @__PURE__ */ React83.createElement(
|
11322
|
-
"div",
|
11455
|
+
),
|
11456
|
+
props.showUserSource && /* @__PURE__ */ React83.createElement(
|
11457
|
+
Controller2,
|
11458
|
+
{
|
11459
|
+
control,
|
11460
|
+
name: "reference",
|
11461
|
+
render: ({ field }) => {
|
11462
|
+
var _a2, _b2;
|
11463
|
+
return /* @__PURE__ */ React83.createElement(
|
11464
|
+
Select,
|
11323
11465
|
{
|
11324
|
-
|
11325
|
-
|
11326
|
-
|
11327
|
-
|
11328
|
-
|
11329
|
-
|
11330
|
-
|
11331
|
-
|
11332
|
-
|
11333
|
-
|
11334
|
-
...field
|
11466
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
11467
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
11468
|
+
isCreatable: false,
|
11469
|
+
isMulti: false,
|
11470
|
+
isSearchable: false,
|
11471
|
+
isClearable: false,
|
11472
|
+
options: props.userReferenceOptions || [],
|
11473
|
+
onChange: (e) => field.onChange(e)
|
11474
|
+
}
|
11475
|
+
);
|
11335
11476
|
}
|
11336
|
-
|
11337
|
-
|
11338
|
-
|
11339
|
-
|
11340
|
-
|
11341
|
-
|
11342
|
-
|
11343
|
-
|
11344
|
-
|
11345
|
-
|
11346
|
-
|
11347
|
-
|
11348
|
-
|
11349
|
-
|
11350
|
-
|
11351
|
-
|
11352
|
-
|
11353
|
-
|
11354
|
-
|
11355
|
-
|
11356
|
-
|
11477
|
+
}
|
11478
|
+
)
|
11479
|
+
),
|
11480
|
+
/* @__PURE__ */ React83.createElement(
|
11481
|
+
TabsContent,
|
11482
|
+
{
|
11483
|
+
value: "phone",
|
11484
|
+
className: cn(
|
11485
|
+
"hawa-flex hawa-flex-col hawa-gap-4",
|
11486
|
+
selectedRegisterType.value === "phone" ? "hawa-block" : "hawa-hidden"
|
11487
|
+
),
|
11488
|
+
dir: props.direction
|
11489
|
+
},
|
11490
|
+
/* @__PURE__ */ React83.createElement(
|
11491
|
+
Controller2,
|
11492
|
+
{
|
11493
|
+
control,
|
11494
|
+
name: "phone",
|
11495
|
+
render: ({ field }) => {
|
11496
|
+
var _a2, _b2;
|
11497
|
+
return /* @__PURE__ */ React83.createElement(
|
11498
|
+
PhoneInput,
|
11499
|
+
{
|
11500
|
+
label: ((_a2 = texts == null ? void 0 : texts.phone) == null ? void 0 : _a2.label) || "Phone Number",
|
11501
|
+
helperText: (_b2 = formState.errors.phone) == null ? void 0 : _b2.message,
|
11502
|
+
preferredCountry: { label: "+966" },
|
11503
|
+
...props.phoneInputProps,
|
11504
|
+
handleChange: (e) => {
|
11505
|
+
if (isValidPhoneNumber2(e) && isPossiblePhoneNumber2(e) && validatePhoneNumberLength2(e) === void 0) {
|
11506
|
+
let parsed = parsePhoneNumber2(e);
|
11507
|
+
field.onChange(parsed.number);
|
11508
|
+
} else {
|
11509
|
+
field.onChange(e);
|
11510
|
+
}
|
11511
|
+
}
|
11512
|
+
}
|
11513
|
+
);
|
11357
11514
|
}
|
11358
|
-
|
11359
|
-
|
11360
|
-
|
11361
|
-
|
11362
|
-
|
11363
|
-
|
11364
|
-
|
11365
|
-
|
11366
|
-
|
11367
|
-
|
11368
|
-
|
11369
|
-
|
11370
|
-
|
11371
|
-
|
11372
|
-
|
11373
|
-
|
11374
|
-
|
11375
|
-
|
11376
|
-
|
11377
|
-
|
11515
|
+
}
|
11516
|
+
),
|
11517
|
+
props.additionalInputs,
|
11518
|
+
props.showRefCode && /* @__PURE__ */ React83.createElement(
|
11519
|
+
Controller2,
|
11520
|
+
{
|
11521
|
+
control,
|
11522
|
+
name: "refCode",
|
11523
|
+
render: ({ field }) => {
|
11524
|
+
var _a2;
|
11525
|
+
return /* @__PURE__ */ React83.createElement(
|
11526
|
+
Input,
|
11527
|
+
{
|
11528
|
+
width: "full",
|
11529
|
+
label: texts == null ? void 0 : texts.refCode,
|
11530
|
+
placeholder: (texts == null ? void 0 : texts.refCodePlaceholder) || "Enter the referral code",
|
11531
|
+
helperText: (_a2 = formState.errors.refCode) == null ? void 0 : _a2.message,
|
11532
|
+
...field
|
11533
|
+
}
|
11534
|
+
);
|
11378
11535
|
}
|
11379
|
-
|
11380
|
-
|
11381
|
-
|
11382
|
-
|
11383
|
-
|
11384
|
-
|
11385
|
-
|
11386
|
-
|
11387
|
-
|
11388
|
-
|
11389
|
-
|
11390
|
-
|
11391
|
-
|
11392
|
-
|
11393
|
-
|
11394
|
-
|
11395
|
-
|
11396
|
-
|
11397
|
-
|
11398
|
-
|
11399
|
-
|
11400
|
-
|
11536
|
+
}
|
11537
|
+
),
|
11538
|
+
props.showUserSource && /* @__PURE__ */ React83.createElement(
|
11539
|
+
Controller2,
|
11540
|
+
{
|
11541
|
+
control,
|
11542
|
+
name: "reference",
|
11543
|
+
render: ({ field }) => {
|
11544
|
+
var _a2, _b2;
|
11545
|
+
return /* @__PURE__ */ React83.createElement(
|
11546
|
+
Select,
|
11547
|
+
{
|
11548
|
+
label: ((_a2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _a2.label) || "How did you learn about us?",
|
11549
|
+
placeholder: (_b2 = texts == null ? void 0 : texts.userReference) == null ? void 0 : _b2.placeholder,
|
11550
|
+
isCreatable: false,
|
11551
|
+
isMulti: false,
|
11552
|
+
isSearchable: false,
|
11553
|
+
isClearable: false,
|
11554
|
+
options: props.userReferenceOptions || [],
|
11555
|
+
onChange: (e) => field.onChange(e)
|
11556
|
+
}
|
11557
|
+
);
|
11401
11558
|
}
|
11402
|
-
|
11559
|
+
}
|
11560
|
+
)
|
11561
|
+
),
|
11562
|
+
showTermsOption || showNewsletterOption ? /* @__PURE__ */ React83.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-3 hawa-mb-2" }, showTermsOption && /* @__PURE__ */ React83.createElement(
|
11563
|
+
Controller2,
|
11564
|
+
{
|
11565
|
+
control,
|
11566
|
+
name: "terms_accepted",
|
11567
|
+
render: ({ field }) => {
|
11568
|
+
var _a2, _b2;
|
11569
|
+
return /* @__PURE__ */ React83.createElement(
|
11570
|
+
Checkbox,
|
11571
|
+
{
|
11572
|
+
id: "terms_accepted",
|
11573
|
+
helperText: (_b2 = (_a2 = formState.errors.terms_accepted) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString(),
|
11574
|
+
onCheckedChange: (e) => field.onChange(e),
|
11575
|
+
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(
|
11576
|
+
"span",
|
11577
|
+
{
|
11578
|
+
onClick: (e) => {
|
11579
|
+
e.preventDefault();
|
11580
|
+
if (props.onRouteToTOS) {
|
11581
|
+
props.onRouteToTOS();
|
11582
|
+
}
|
11583
|
+
},
|
11584
|
+
className: "clickable-link"
|
11585
|
+
},
|
11586
|
+
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
11587
|
+
)))
|
11588
|
+
}
|
11589
|
+
);
|
11590
|
+
}
|
11403
11591
|
}
|
11404
|
-
|
11405
|
-
|
11406
|
-
|
11407
|
-
|
11408
|
-
|
11409
|
-
|
11410
|
-
name: "terms_accepted",
|
11411
|
-
render: ({ field }) => {
|
11412
|
-
var _a2, _b2;
|
11413
|
-
return /* @__PURE__ */ React83.createElement(
|
11592
|
+
), showNewsletterOption && /* @__PURE__ */ React83.createElement(
|
11593
|
+
Controller2,
|
11594
|
+
{
|
11595
|
+
control,
|
11596
|
+
name: "newsletter_accepted",
|
11597
|
+
render: ({ field }) => /* @__PURE__ */ React83.createElement(
|
11414
11598
|
Checkbox,
|
11415
11599
|
{
|
11416
|
-
id: "
|
11417
|
-
|
11418
|
-
onCheckedChange:
|
11419
|
-
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(
|
11420
|
-
"span",
|
11421
|
-
{
|
11422
|
-
onClick: (e) => {
|
11423
|
-
e.preventDefault();
|
11424
|
-
if (props.onRouteToTOS) {
|
11425
|
-
props.onRouteToTOS();
|
11426
|
-
}
|
11427
|
-
},
|
11428
|
-
className: "clickable-link"
|
11429
|
-
},
|
11430
|
-
(texts == null ? void 0 : texts.termsText) || "Terms of Service"
|
11431
|
-
)))
|
11600
|
+
id: "newsletter_accepted",
|
11601
|
+
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
11602
|
+
onCheckedChange: field.onChange
|
11432
11603
|
}
|
11433
|
-
)
|
11604
|
+
)
|
11434
11605
|
}
|
11435
|
-
|
11436
|
-
),
|
11437
|
-
Controller2,
|
11438
|
-
{
|
11439
|
-
control,
|
11440
|
-
name: "newsletter_accepted",
|
11441
|
-
render: ({ field }) => /* @__PURE__ */ React83.createElement(
|
11442
|
-
Checkbox,
|
11443
|
-
{
|
11444
|
-
id: "newsletter_accepted",
|
11445
|
-
label: (texts == null ? void 0 : texts.subscribeToNewsletter) || "Subscribe to our newsletter",
|
11446
|
-
onCheckedChange: field.onChange
|
11447
|
-
}
|
11448
|
-
)
|
11449
|
-
}
|
11450
|
-
)) : null,
|
11606
|
+
)) : null
|
11607
|
+
),
|
11451
11608
|
/* @__PURE__ */ React83.createElement(
|
11452
11609
|
Button,
|
11453
11610
|
{
|
@@ -11459,33 +11616,33 @@ var RegisterForm = ({
|
|
11459
11616
|
(texts == null ? void 0 : texts.registerText) || "Register"
|
11460
11617
|
),
|
11461
11618
|
props.additionalButtons
|
11462
|
-
)), 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")))
|
11463
|
-
|
11464
|
-
|
11465
|
-
|
11466
|
-
|
11467
|
-
|
11468
|
-
|
11469
|
-
|
11470
|
-
},
|
11471
|
-
/* @__PURE__ */ React83.createElement(
|
11472
|
-
AuthButtons,
|
11473
|
-
{
|
11474
|
-
texts: thirdPartyAuthTexts,
|
11475
|
-
viaGoogle: props.viaGoogle,
|
11476
|
-
viaGithub: props.viaGithub,
|
11477
|
-
viaTwitter: props.viaTwitter,
|
11478
|
-
isGoogleLoading: props.isGoogleLoading,
|
11479
|
-
isGithubLoading: props.isGithubLoading,
|
11480
|
-
isTwitterLoading: props.isTwitterLoading,
|
11481
|
-
handleGoogle: props.onGoogleRegister,
|
11482
|
-
handleGithub: props.onGithubRegister,
|
11483
|
-
handleTwitter: props.onTwitterRegister
|
11484
|
-
}
|
11619
|
+
)), 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")))
|
11620
|
+
),
|
11621
|
+
props.viaGithub || props.viaGoogle || props.viaTwitter ? /* @__PURE__ */ React83.createElement(
|
11622
|
+
CardFooter,
|
11623
|
+
{
|
11624
|
+
noPadding: props.cardless,
|
11625
|
+
className: cn(
|
11626
|
+
props.logosOnly ? "hawa-flex hawa-flex-row hawa-justify-center hawa-gap-2" : "hawa-grid hawa-grid-cols-1 hawa-gap-2"
|
11485
11627
|
)
|
11486
|
-
|
11487
|
-
|
11488
|
-
|
11628
|
+
},
|
11629
|
+
/* @__PURE__ */ React83.createElement(
|
11630
|
+
AuthButtons,
|
11631
|
+
{
|
11632
|
+
texts: thirdPartyAuthTexts,
|
11633
|
+
viaGoogle: props.viaGoogle,
|
11634
|
+
viaGithub: props.viaGithub,
|
11635
|
+
viaTwitter: props.viaTwitter,
|
11636
|
+
isGoogleLoading: props.isGoogleLoading,
|
11637
|
+
isGithubLoading: props.isGithubLoading,
|
11638
|
+
isTwitterLoading: props.isTwitterLoading,
|
11639
|
+
handleGoogle: props.onGoogleRegister,
|
11640
|
+
handleGithub: props.onGithubRegister,
|
11641
|
+
handleTwitter: props.onTwitterRegister
|
11642
|
+
}
|
11643
|
+
)
|
11644
|
+
) : null
|
11645
|
+
));
|
11489
11646
|
};
|
11490
11647
|
|
11491
11648
|
// blocks/auth/AppLanding.tsx
|