@krak-stack/auth 0.2.1 → 0.2.2

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.
@@ -9,6 +9,7 @@ import { QRCode } from "react-qr-code";
9
9
  import { createContext, useContext, useRef, useState, } from "react";
10
10
  import { DataTable, } from "@krak-stack/registry/data-table";
11
11
  import { AppBrand } from "@krak-stack/registry/app-brand";
12
+ import { EditingLocaleSwitcher } from "@krak-stack/registry/editing-locale-switcher";
12
13
  import { effectFormMessages, ImageField, SubmitButton, SubmitError, TextAreaField, TextField, } from "@krak-stack/registry/effect-form";
13
14
  import { Badge } from "@/components/ui/badge";
14
15
  import { Button } from "@/components/ui/button";
@@ -29,6 +30,8 @@ import { ExtraUploadedAsset } from "../extra/schema.js";
29
30
  import { assetPath, assetUrl } from "./utils.js";
30
31
  import { AdminOrganizationsTable } from "./admin-organizations.js";
31
32
  import { AdminUsersTable } from "./admin-users.js";
33
+ import { ContactEmailsField, ContactPhonesField, ContactSocialsField, ContactWebsitesField, } from "./contact-fields.js";
34
+ import { decodeUserMetadata, ContactLocale, SocialPlatform, USER_CONTACT_LIMIT, UserMetadata, } from "../schema.js";
32
35
  const messages = {
33
36
  en: {
34
37
  table_empty: "No results.",
@@ -118,6 +121,22 @@ const messages = {
118
121
  user_form_title: "Account",
119
122
  user_form_update_error: "Unable to update your account.",
120
123
  user_loading: "Loading...",
124
+ user_contact_add_email: "Add email",
125
+ user_contact_add_phone: "Add phone",
126
+ user_contact_add_social: "Add social profile",
127
+ user_contact_add_website: "Add website",
128
+ user_contact_description: "Add up to 8 public contacts of each type, separately from the email used to sign in.",
129
+ user_contact_email_type: "Email",
130
+ user_contact_extension: "Extension",
131
+ user_contact_label: "Label",
132
+ user_contact_phone_type: "Phone",
133
+ user_contact_platform: "Platform",
134
+ user_contact_remove: "Remove contact method",
135
+ user_contact_social_type: "Social",
136
+ user_contact_title: "Contact methods",
137
+ user_contact_url: "URL",
138
+ user_contact_validation_error: "Review your contact methods and keep the total metadata below 2 KB.",
139
+ user_contact_website_type: "Website",
121
140
  user_profile_description: "Update your public profile details.",
122
141
  user_profile_image_upload_error: "Could not upload your profile photo.",
123
142
  user_profile_photo_upload_label: "Profile photo",
@@ -227,6 +246,22 @@ const messages = {
227
246
  user_form_title: "Compte",
228
247
  user_form_update_error: "Impossible de mettre à jour votre compte.",
229
248
  user_loading: "Chargement...",
249
+ user_contact_add_email: "Ajouter un courriel",
250
+ user_contact_add_phone: "Ajouter un téléphone",
251
+ user_contact_add_social: "Ajouter un profil social",
252
+ user_contact_add_website: "Ajouter un site Web",
253
+ user_contact_description: "Ajoutez jusqu’à 8 coordonnées publiques de chaque type, distinctes du courriel utilisé pour vous connecter.",
254
+ user_contact_email_type: "Courriel",
255
+ user_contact_extension: "Poste",
256
+ user_contact_label: "Libellé",
257
+ user_contact_phone_type: "Téléphone",
258
+ user_contact_platform: "Plateforme",
259
+ user_contact_remove: "Supprimer le moyen de contact",
260
+ user_contact_social_type: "Réseau social",
261
+ user_contact_title: "Moyens de contact",
262
+ user_contact_url: "URL",
263
+ user_contact_validation_error: "Vérifiez vos moyens de contact et limitez les métadonnées totales à 2 Ko.",
264
+ user_contact_website_type: "Site Web",
230
265
  user_profile_description: "Mettez à jour les informations de votre profil public.",
231
266
  user_profile_image_upload_error: "Impossible de téléverser votre photo de profil.",
232
267
  user_profile_photo_upload_label: "Photo de profil",
@@ -274,6 +309,19 @@ const userButtonMessageFns = (labels) => {
274
309
  };
275
310
  const UserButtonMessagesContext = createContext(userButtonMessageFns(userButtonMessages()));
276
311
  const useUserButtonMessages = () => useContext(UserButtonMessagesContext);
312
+ const userContactFieldMessages = (m) => ({
313
+ addEmail: m.user_contact_add_email(),
314
+ addPhone: m.user_contact_add_phone(),
315
+ addSocial: m.user_contact_add_social(),
316
+ addWebsite: m.user_contact_add_website(),
317
+ email: m.user_contact_email_type(),
318
+ extension: m.user_contact_extension(),
319
+ label: m.user_contact_label(),
320
+ phone: m.user_contact_phone_type(),
321
+ platform: m.user_contact_platform(),
322
+ remove: m.user_contact_remove(),
323
+ url: m.user_contact_url(),
324
+ });
277
325
  const UserRole = Schema.Struct({ role: Schema.String });
278
326
  const hasRole = (role, roles) => {
279
327
  const decoded = Schema.decodeUnknownOption(Schema.String)(role);
@@ -290,9 +338,87 @@ const changePasswordFormBuilder = FormBuilder.empty
290
338
  .addField("currentPassword", Schema.NonEmptyString)
291
339
  .addField("newPassword", Schema.NonEmptyString);
292
340
  const passwordFormBuilder = (required) => FormBuilder.empty.addField("password", required ? Schema.NonEmptyString : Schema.String);
341
+ const ContactFormTranslation = Schema.Struct({
342
+ locale: ContactLocale,
343
+ label: Schema.String,
344
+ }).annotate({ identifier: "ContactFormTranslation" });
345
+ const ContactFormTranslations = Schema.Array(ContactFormTranslation).annotate({
346
+ identifier: "ContactFormTranslations",
347
+ });
348
+ export const UserContactEmailsForm = Schema.Array(Schema.Struct({
349
+ email: Schema.String,
350
+ translations: ContactFormTranslations,
351
+ }).annotate({ identifier: "UserContactEmailForm" }))
352
+ .check(Schema.isMaxLength(USER_CONTACT_LIMIT))
353
+ .annotate({ identifier: "UserContactEmailsForm" });
354
+ export const UserContactPhonesForm = Schema.Array(Schema.Struct({
355
+ number: Schema.String,
356
+ extension: Schema.optional(Schema.String),
357
+ translations: ContactFormTranslations,
358
+ }).annotate({ identifier: "UserContactPhoneForm" }))
359
+ .check(Schema.isMaxLength(USER_CONTACT_LIMIT))
360
+ .annotate({ identifier: "UserContactPhonesForm" });
361
+ export const UserContactWebsitesForm = Schema.Array(Schema.Struct({
362
+ url: Schema.String,
363
+ translations: ContactFormTranslations,
364
+ }).annotate({ identifier: "UserContactWebsiteForm" }))
365
+ .check(Schema.isMaxLength(USER_CONTACT_LIMIT))
366
+ .annotate({ identifier: "UserContactWebsitesForm" });
367
+ export const UserContactSocialsForm = Schema.Array(Schema.Struct({
368
+ platform: SocialPlatform,
369
+ url: Schema.String,
370
+ translations: ContactFormTranslations,
371
+ }).annotate({ identifier: "UserContactSocialForm" }))
372
+ .check(Schema.isMaxLength(USER_CONTACT_LIMIT))
373
+ .annotate({ identifier: "UserContactSocialsForm" });
293
374
  const userFormBuilder = FormBuilder.empty
294
375
  .addField("name", Schema.NonEmptyString)
295
- .addField("image", Schema.UndefinedOr(Schema.NullOr(Schema.Union([Schema.String, Schema.instanceOf(File)]))));
376
+ .addField("image", Schema.UndefinedOr(Schema.NullOr(Schema.Union([Schema.String, Schema.instanceOf(File)]))))
377
+ .addField("emails", UserContactEmailsForm)
378
+ .addField("phones", UserContactPhonesForm)
379
+ .addField("websites", UserContactWebsitesForm)
380
+ .addField("socials", UserContactSocialsForm);
381
+ const decodeUserMetadataForm = Schema.decodeUnknownSync(UserMetadata);
382
+ export const userMetadataFromForm = (value) => {
383
+ const localized = (translations) => (translations ?? []).flatMap((translation) => {
384
+ const label = translation.label.trim();
385
+ return label ? [{ ...translation, label }] : [];
386
+ });
387
+ const emails = value.emails.flatMap((email) => {
388
+ const address = email.email.trim();
389
+ return address
390
+ ? [{ email: address, translations: localized(email.translations) }]
391
+ : [];
392
+ });
393
+ const phones = value.phones.flatMap((phone) => {
394
+ const number = phone.number.trim();
395
+ if (!number)
396
+ return [];
397
+ const normalized = {
398
+ number,
399
+ translations: localized(phone.translations),
400
+ };
401
+ const extension = phone.extension?.trim();
402
+ return extension ? [{ ...normalized, extension }] : [normalized];
403
+ });
404
+ const websites = value.websites.flatMap((website) => {
405
+ const url = website.url.trim();
406
+ return url ? [{ url, translations: localized(website.translations) }] : [];
407
+ });
408
+ const socials = value.socials.flatMap((social) => {
409
+ const url = social.url.trim();
410
+ return url
411
+ ? [
412
+ {
413
+ platform: social.platform,
414
+ url,
415
+ translations: localized(social.translations),
416
+ },
417
+ ]
418
+ : [];
419
+ });
420
+ return decodeUserMetadataForm({ emails, phones, websites, socials });
421
+ };
296
422
  const totpCodeFormBuilder = FormBuilder.empty.addField("code", Schema.NonEmptyString);
297
423
  const apiKeyFormBuilder = FormBuilder.empty
298
424
  .addField("name", Schema.NonEmptyString)
@@ -389,6 +515,7 @@ export const UserButton = ({ baseUrl, signOutRedirect = "/", side = "bottom", de
389
515
  const displayName = session.user.name.trim();
390
516
  const displayEmail = session.user.email.trim();
391
517
  const displayImage = assetUrl(session.user.image, resolvedBaseUrl);
518
+ const metadata = decodeUserMetadata(session.user.metadata);
392
519
  const isImpersonating = Boolean(session.session.impersonatedBy);
393
520
  const isOrganizationImpersonating = Boolean(session.session.impersonatedByOrganizationId);
394
521
  const canManageUserSettings = !isOrganizationImpersonating;
@@ -409,8 +536,16 @@ export const UserButton = ({ baseUrl, signOutRedirect = "/", side = "bottom", de
409
536
  }, children: _jsxs(DialogContent, { className: "max-h-[85vh] min-w-0 overflow-x-hidden overflow-y-auto sm:max-w-3xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: m.user_form_title() }), _jsx(DialogDescription, { children: m.user_form_description() })] }), _jsx(Separator, {}), isPending ? (_jsx("p", { className: "text-muted-foreground text-sm", children: m.user_loading() })) : (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsx(UserForm, { defaultValues: {
410
537
  name: displayName ?? "",
411
538
  image: displayImage || null,
539
+ emails: Array.from(metadata.emails ?? []),
540
+ phones: Array.from(metadata.phones ?? []),
541
+ websites: Array.from(metadata.websites ?? []),
542
+ socials: Array.from(metadata.socials ?? []),
412
543
  }, error: formError, onSubmit: (values) => Effect.gen(function* () {
413
544
  setFormError(null);
545
+ const metadata = yield* Effect.try({
546
+ try: () => userMetadataFromForm(values),
547
+ catch: () => new Error(m.user_contact_validation_error()),
548
+ });
414
549
  const imageFile = isFile(values.image)
415
550
  ? values.image
416
551
  : null;
@@ -424,6 +559,7 @@ export const UserButton = ({ baseUrl, signOutRedirect = "/", side = "bottom", de
424
559
  payload: {
425
560
  name: values.name.trim(),
426
561
  image: image?.trim() ?? "",
562
+ metadata,
427
563
  },
428
564
  });
429
565
  notifyAuthChange();
@@ -607,8 +743,16 @@ const providerName = (providerId, m) => {
607
743
  };
608
744
  const UserForm = ({ defaultValues, error, onSubmit, }) => {
609
745
  const m = useUserButtonMessages();
746
+ const [editingLocale, setEditingLocale] = useState(getLocale());
610
747
  const [form] = useState(() => FormReact.make(userFormBuilder, {
611
- fields: { name: TextField, image: ImageField },
748
+ fields: {
749
+ name: TextField,
750
+ image: ImageField,
751
+ emails: ContactEmailsField,
752
+ phones: ContactPhonesField,
753
+ websites: ContactWebsitesField,
754
+ socials: ContactSocialsField,
755
+ },
612
756
  mode: { validation: "onSubmit" },
613
757
  onSubmit: (_, { decoded }) => onSubmit({ ...decoded, image: decoded.image ?? null }).pipe(Effect.mapError((cause) => cause instanceof Error
614
758
  ? cause
@@ -624,8 +768,9 @@ const UserForm = ({ defaultValues, error, onSubmit, }) => {
624
768
  height: 96,
625
769
  suggestedWidth: 512,
626
770
  suggestedHeight: 512,
627
- } }), _jsx(form.name, { label: m.user_form_name_label(), autoComplete: "name", required: true }), error && (_jsx("p", { role: "alert", className: "text-destructive text-sm", children: error })), _jsx(SubmitButton, { form: form })] }) })] }));
771
+ } }), _jsx(form.name, { label: m.user_form_name_label(), autoComplete: "name", required: true }), _jsx(Separator, {}), _jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("h3", { className: "text-sm leading-none font-medium", children: m.user_contact_title() }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.user_contact_description() })] }), _jsx(EditingLocaleSwitcher, { value: editingLocale, onValueChange: setEditingLocale })] }), _jsx(UserContactGroup, { title: m.user_contact_email_type(), children: _jsx(form.emails, { locale: editingLocale, maxItems: USER_CONTACT_LIMIT, messages: userContactFieldMessages(m) }) }), _jsx(UserContactGroup, { title: m.user_contact_phone_type(), children: _jsx(form.phones, { locale: editingLocale, maxItems: USER_CONTACT_LIMIT, messages: userContactFieldMessages(m) }) }), _jsx(UserContactGroup, { title: m.user_contact_website_type(), children: _jsx(form.websites, { locale: editingLocale, maxItems: USER_CONTACT_LIMIT, messages: userContactFieldMessages(m) }) }), _jsx(UserContactGroup, { title: m.user_contact_social_type(), children: _jsx(form.socials, { locale: editingLocale, maxItems: USER_CONTACT_LIMIT, messages: userContactFieldMessages(m) }) })] }), error && (_jsx("p", { role: "alert", className: "text-destructive text-sm", children: error })), _jsx(SubmitButton, { form: form })] }) })] }));
628
772
  };
773
+ const UserContactGroup = ({ children, title, }) => (_jsxs("div", { className: "flex flex-col gap-3", children: [_jsx("h4", { className: "text-sm font-medium", children: title }), children] }));
629
774
  function AccountSecuritySettings({ baseUrl, accountCache, }) {
630
775
  const m = useUserButtonMessages();
631
776
  const sessionAtom = authSessionAtom(baseUrl);
package/dist/schema.d.ts CHANGED
@@ -1,16 +1,4 @@
1
1
  import { Schema } from "effect";
2
- export declare const User: Schema.Struct<{
3
- readonly id: Schema.String;
4
- readonly name: Schema.String;
5
- readonly email: Schema.String;
6
- readonly emailVerified: Schema.Boolean;
7
- readonly image: Schema.NullOr<Schema.String>;
8
- readonly role: Schema.NullOr<Schema.String>;
9
- readonly banned: Schema.NullOr<Schema.Boolean>;
10
- readonly lastLoginMethod: Schema.optional<Schema.NullOr<Schema.String>>;
11
- readonly createdAt: Schema.Date;
12
- readonly updatedAt: Schema.Date;
13
- }>;
14
2
  export declare const Session: Schema.Struct<{
15
3
  readonly id: Schema.String;
16
4
  readonly expiresAt: Schema.Date;
@@ -24,15 +12,27 @@ export declare const Session: Schema.Struct<{
24
12
  readonly impersonatedByOrganizationId: Schema.optional<Schema.NullOr<Schema.String>>;
25
13
  readonly activeOrganizationId: Schema.optional<Schema.NullOr<Schema.String>>;
26
14
  }>;
15
+ export declare const ContactLocale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
27
16
  export declare const OrganizationLocale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
28
17
  export declare const EmailAddress: Schema.NonEmptyString;
29
18
  export declare const PhoneNumber: Schema.NonEmptyString;
30
19
  export declare const WebsiteUrl: Schema.NonEmptyString;
31
20
  export declare const SocialPlatform: Schema.Literals<readonly ["facebook", "github", "instagram", "linkedin", "tiktok", "x", "youtube"]>;
21
+ export declare const ContactTranslation: Schema.Struct<{
22
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
23
+ readonly label: Schema.NonEmptyString;
24
+ }>;
32
25
  export declare const OrganizationContactTranslation: Schema.Struct<{
33
26
  readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
34
27
  readonly label: Schema.NonEmptyString;
35
28
  }>;
29
+ export declare const ContactEmail: Schema.Struct<{
30
+ readonly email: Schema.NonEmptyString;
31
+ readonly translations: Schema.$Array<Schema.Struct<{
32
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
33
+ readonly label: Schema.NonEmptyString;
34
+ }>>;
35
+ }>;
36
36
  export declare const OrganizationEmail: Schema.Struct<{
37
37
  readonly email: Schema.NonEmptyString;
38
38
  readonly translations: Schema.$Array<Schema.Struct<{
@@ -40,6 +40,14 @@ export declare const OrganizationEmail: Schema.Struct<{
40
40
  readonly label: Schema.NonEmptyString;
41
41
  }>>;
42
42
  }>;
43
+ export declare const ContactPhone: Schema.Struct<{
44
+ readonly number: Schema.NonEmptyString;
45
+ readonly extension: Schema.optional<Schema.String>;
46
+ readonly translations: Schema.$Array<Schema.Struct<{
47
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
48
+ readonly label: Schema.NonEmptyString;
49
+ }>>;
50
+ }>;
43
51
  export declare const OrganizationPhone: Schema.Struct<{
44
52
  readonly number: Schema.NonEmptyString;
45
53
  readonly extension: Schema.optional<Schema.String>;
@@ -48,6 +56,13 @@ export declare const OrganizationPhone: Schema.Struct<{
48
56
  readonly label: Schema.NonEmptyString;
49
57
  }>>;
50
58
  }>;
59
+ export declare const ContactWebsite: Schema.Struct<{
60
+ readonly url: Schema.NonEmptyString;
61
+ readonly translations: Schema.$Array<Schema.Struct<{
62
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
63
+ readonly label: Schema.NonEmptyString;
64
+ }>>;
65
+ }>;
51
66
  export declare const OrganizationWebsite: Schema.Struct<{
52
67
  readonly url: Schema.NonEmptyString;
53
68
  readonly translations: Schema.$Array<Schema.Struct<{
@@ -55,6 +70,14 @@ export declare const OrganizationWebsite: Schema.Struct<{
55
70
  readonly label: Schema.NonEmptyString;
56
71
  }>>;
57
72
  }>;
73
+ export declare const ContactSocial: Schema.Struct<{
74
+ readonly platform: Schema.Literals<readonly ["facebook", "github", "instagram", "linkedin", "tiktok", "x", "youtube"]>;
75
+ readonly url: Schema.NonEmptyString;
76
+ readonly translations: Schema.$Array<Schema.Struct<{
77
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
78
+ readonly label: Schema.NonEmptyString;
79
+ }>>;
80
+ }>;
58
81
  export declare const OrganizationSocial: Schema.Struct<{
59
82
  readonly platform: Schema.Literals<readonly ["facebook", "github", "instagram", "linkedin", "tiktok", "x", "youtube"]>;
60
83
  readonly url: Schema.NonEmptyString;
@@ -63,6 +86,210 @@ export declare const OrganizationSocial: Schema.Struct<{
63
86
  readonly label: Schema.NonEmptyString;
64
87
  }>>;
65
88
  }>;
89
+ export declare const USER_CONTACT_LIMIT = 8;
90
+ export declare const UserContactEmails: Schema.$Array<Schema.Struct<{
91
+ readonly email: Schema.NonEmptyString;
92
+ readonly translations: Schema.$Array<Schema.Struct<{
93
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
94
+ readonly label: Schema.NonEmptyString;
95
+ }>>;
96
+ }>>;
97
+ export declare const UserContactPhones: Schema.$Array<Schema.Struct<{
98
+ readonly number: Schema.NonEmptyString;
99
+ readonly extension: Schema.optional<Schema.String>;
100
+ readonly translations: Schema.$Array<Schema.Struct<{
101
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
102
+ readonly label: Schema.NonEmptyString;
103
+ }>>;
104
+ }>>;
105
+ export declare const UserContactWebsites: Schema.$Array<Schema.Struct<{
106
+ readonly url: Schema.NonEmptyString;
107
+ readonly translations: Schema.$Array<Schema.Struct<{
108
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
109
+ readonly label: Schema.NonEmptyString;
110
+ }>>;
111
+ }>>;
112
+ export declare const UserContactSocials: Schema.$Array<Schema.Struct<{
113
+ readonly platform: Schema.Literals<readonly ["facebook", "github", "instagram", "linkedin", "tiktok", "x", "youtube"]>;
114
+ readonly url: Schema.NonEmptyString;
115
+ readonly translations: Schema.$Array<Schema.Struct<{
116
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
117
+ readonly label: Schema.NonEmptyString;
118
+ }>>;
119
+ }>>;
120
+ export declare const UserMetadata: Schema.Struct<{
121
+ readonly emails: Schema.optional<Schema.$Array<Schema.Struct<{
122
+ readonly email: Schema.NonEmptyString;
123
+ readonly translations: Schema.$Array<Schema.Struct<{
124
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
125
+ readonly label: Schema.NonEmptyString;
126
+ }>>;
127
+ }>>>;
128
+ readonly phones: Schema.optional<Schema.$Array<Schema.Struct<{
129
+ readonly number: Schema.NonEmptyString;
130
+ readonly extension: Schema.optional<Schema.String>;
131
+ readonly translations: Schema.$Array<Schema.Struct<{
132
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
133
+ readonly label: Schema.NonEmptyString;
134
+ }>>;
135
+ }>>>;
136
+ readonly websites: Schema.optional<Schema.$Array<Schema.Struct<{
137
+ readonly url: Schema.NonEmptyString;
138
+ readonly translations: Schema.$Array<Schema.Struct<{
139
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
140
+ readonly label: Schema.NonEmptyString;
141
+ }>>;
142
+ }>>>;
143
+ readonly socials: Schema.optional<Schema.$Array<Schema.Struct<{
144
+ readonly platform: Schema.Literals<readonly ["facebook", "github", "instagram", "linkedin", "tiktok", "x", "youtube"]>;
145
+ readonly url: Schema.NonEmptyString;
146
+ readonly translations: Schema.$Array<Schema.Struct<{
147
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
148
+ readonly label: Schema.NonEmptyString;
149
+ }>>;
150
+ }>>>;
151
+ }>;
152
+ declare const MetadataRecord: Schema.$Record<Schema.String, Schema.Unknown>;
153
+ type MetadataRecord = typeof MetadataRecord.Type;
154
+ export declare const decodeUserMetadata: (metadata: MetadataRecord | null | undefined) => UserMetadata;
155
+ export declare const UserMetadataStandard: import("effect/StandardSchema").StandardSchemaV1<{
156
+ readonly emails?: readonly {
157
+ readonly email: string;
158
+ readonly translations: readonly {
159
+ readonly locale: "en" | "fr";
160
+ readonly label: string;
161
+ }[];
162
+ }[] | undefined;
163
+ readonly phones?: readonly {
164
+ readonly number: string;
165
+ readonly extension?: string | undefined;
166
+ readonly translations: readonly {
167
+ readonly locale: "en" | "fr";
168
+ readonly label: string;
169
+ }[];
170
+ }[] | undefined;
171
+ readonly websites?: readonly {
172
+ readonly url: string;
173
+ readonly translations: readonly {
174
+ readonly locale: "en" | "fr";
175
+ readonly label: string;
176
+ }[];
177
+ }[] | undefined;
178
+ readonly socials?: readonly {
179
+ readonly platform: "facebook" | "github" | "instagram" | "linkedin" | "tiktok" | "x" | "youtube";
180
+ readonly url: string;
181
+ readonly translations: readonly {
182
+ readonly locale: "en" | "fr";
183
+ readonly label: string;
184
+ }[];
185
+ }[] | undefined;
186
+ }, {
187
+ readonly emails?: readonly {
188
+ readonly email: string;
189
+ readonly translations: readonly {
190
+ readonly locale: "en" | "fr";
191
+ readonly label: string;
192
+ }[];
193
+ }[] | undefined;
194
+ readonly phones?: readonly {
195
+ readonly number: string;
196
+ readonly extension?: string | undefined;
197
+ readonly translations: readonly {
198
+ readonly locale: "en" | "fr";
199
+ readonly label: string;
200
+ }[];
201
+ }[] | undefined;
202
+ readonly websites?: readonly {
203
+ readonly url: string;
204
+ readonly translations: readonly {
205
+ readonly locale: "en" | "fr";
206
+ readonly label: string;
207
+ }[];
208
+ }[] | undefined;
209
+ readonly socials?: readonly {
210
+ readonly platform: "facebook" | "github" | "instagram" | "linkedin" | "tiktok" | "x" | "youtube";
211
+ readonly url: string;
212
+ readonly translations: readonly {
213
+ readonly locale: "en" | "fr";
214
+ readonly label: string;
215
+ }[];
216
+ }[] | undefined;
217
+ }> & Schema.Struct<{
218
+ readonly emails: Schema.optional<Schema.$Array<Schema.Struct<{
219
+ readonly email: Schema.NonEmptyString;
220
+ readonly translations: Schema.$Array<Schema.Struct<{
221
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
222
+ readonly label: Schema.NonEmptyString;
223
+ }>>;
224
+ }>>>;
225
+ readonly phones: Schema.optional<Schema.$Array<Schema.Struct<{
226
+ readonly number: Schema.NonEmptyString;
227
+ readonly extension: Schema.optional<Schema.String>;
228
+ readonly translations: Schema.$Array<Schema.Struct<{
229
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
230
+ readonly label: Schema.NonEmptyString;
231
+ }>>;
232
+ }>>>;
233
+ readonly websites: Schema.optional<Schema.$Array<Schema.Struct<{
234
+ readonly url: Schema.NonEmptyString;
235
+ readonly translations: Schema.$Array<Schema.Struct<{
236
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
237
+ readonly label: Schema.NonEmptyString;
238
+ }>>;
239
+ }>>>;
240
+ readonly socials: Schema.optional<Schema.$Array<Schema.Struct<{
241
+ readonly platform: Schema.Literals<readonly ["facebook", "github", "instagram", "linkedin", "tiktok", "x", "youtube"]>;
242
+ readonly url: Schema.NonEmptyString;
243
+ readonly translations: Schema.$Array<Schema.Struct<{
244
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
245
+ readonly label: Schema.NonEmptyString;
246
+ }>>;
247
+ }>>>;
248
+ }>;
249
+ export declare const User: Schema.Struct<{
250
+ readonly id: Schema.String;
251
+ readonly name: Schema.String;
252
+ readonly email: Schema.String;
253
+ readonly emailVerified: Schema.Boolean;
254
+ readonly image: Schema.NullOr<Schema.String>;
255
+ readonly metadata: Schema.optional<Schema.NullOr<Schema.decodeTo<Schema.Struct<{
256
+ readonly emails: Schema.optional<Schema.$Array<Schema.Struct<{
257
+ readonly email: Schema.NonEmptyString;
258
+ readonly translations: Schema.$Array<Schema.Struct<{
259
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
260
+ readonly label: Schema.NonEmptyString;
261
+ }>>;
262
+ }>>>;
263
+ readonly phones: Schema.optional<Schema.$Array<Schema.Struct<{
264
+ readonly number: Schema.NonEmptyString;
265
+ readonly extension: Schema.optional<Schema.String>;
266
+ readonly translations: Schema.$Array<Schema.Struct<{
267
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
268
+ readonly label: Schema.NonEmptyString;
269
+ }>>;
270
+ }>>>;
271
+ readonly websites: Schema.optional<Schema.$Array<Schema.Struct<{
272
+ readonly url: Schema.NonEmptyString;
273
+ readonly translations: Schema.$Array<Schema.Struct<{
274
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
275
+ readonly label: Schema.NonEmptyString;
276
+ }>>;
277
+ }>>>;
278
+ readonly socials: Schema.optional<Schema.$Array<Schema.Struct<{
279
+ readonly platform: Schema.Literals<readonly ["facebook", "github", "instagram", "linkedin", "tiktok", "x", "youtube"]>;
280
+ readonly url: Schema.NonEmptyString;
281
+ readonly translations: Schema.$Array<Schema.Struct<{
282
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
283
+ readonly label: Schema.NonEmptyString;
284
+ }>>;
285
+ }>>>;
286
+ }>, Schema.Unknown, never, never>>>;
287
+ readonly role: Schema.NullOr<Schema.String>;
288
+ readonly banned: Schema.NullOr<Schema.Boolean>;
289
+ readonly lastLoginMethod: Schema.optional<Schema.NullOr<Schema.String>>;
290
+ readonly createdAt: Schema.Date;
291
+ readonly updatedAt: Schema.Date;
292
+ }>;
66
293
  export declare const PostalAddress: Schema.Struct<{
67
294
  readonly streetAddress: Schema.optional<Schema.String>;
68
295
  readonly locality: Schema.optional<Schema.String>;
@@ -224,6 +451,38 @@ export declare const Member: Schema.Struct<{
224
451
  readonly email: Schema.String;
225
452
  readonly emailVerified: Schema.Boolean;
226
453
  readonly image: Schema.NullOr<Schema.String>;
454
+ readonly metadata: Schema.optional<Schema.NullOr<Schema.decodeTo<Schema.Struct<{
455
+ readonly emails: Schema.optional<Schema.$Array<Schema.Struct<{
456
+ readonly email: Schema.NonEmptyString;
457
+ readonly translations: Schema.$Array<Schema.Struct<{
458
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
459
+ readonly label: Schema.NonEmptyString;
460
+ }>>;
461
+ }>>>;
462
+ readonly phones: Schema.optional<Schema.$Array<Schema.Struct<{
463
+ readonly number: Schema.NonEmptyString;
464
+ readonly extension: Schema.optional<Schema.String>;
465
+ readonly translations: Schema.$Array<Schema.Struct<{
466
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
467
+ readonly label: Schema.NonEmptyString;
468
+ }>>;
469
+ }>>>;
470
+ readonly websites: Schema.optional<Schema.$Array<Schema.Struct<{
471
+ readonly url: Schema.NonEmptyString;
472
+ readonly translations: Schema.$Array<Schema.Struct<{
473
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
474
+ readonly label: Schema.NonEmptyString;
475
+ }>>;
476
+ }>>>;
477
+ readonly socials: Schema.optional<Schema.$Array<Schema.Struct<{
478
+ readonly platform: Schema.Literals<readonly ["facebook", "github", "instagram", "linkedin", "tiktok", "x", "youtube"]>;
479
+ readonly url: Schema.NonEmptyString;
480
+ readonly translations: Schema.$Array<Schema.Struct<{
481
+ readonly locale: Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>;
482
+ readonly label: Schema.NonEmptyString;
483
+ }>>;
484
+ }>>>;
485
+ }>, Schema.Unknown, never, never>>>;
227
486
  readonly role: Schema.NullOr<Schema.String>;
228
487
  readonly banned: Schema.NullOr<Schema.Boolean>;
229
488
  readonly lastLoginMethod: Schema.optional<Schema.NullOr<Schema.String>>;
@@ -233,6 +492,13 @@ export declare const Member: Schema.Struct<{
233
492
  }>;
234
493
  export type User = typeof User.Type;
235
494
  export type Session = typeof Session.Type;
495
+ export type ContactLocale = typeof ContactLocale.Type;
496
+ export type ContactTranslation = typeof ContactTranslation.Type;
497
+ export type ContactEmail = typeof ContactEmail.Type;
498
+ export type ContactPhone = typeof ContactPhone.Type;
499
+ export type ContactWebsite = typeof ContactWebsite.Type;
500
+ export type ContactSocial = typeof ContactSocial.Type;
501
+ export type UserMetadata = typeof UserMetadata.Type;
236
502
  export type OrganizationLocale = typeof OrganizationLocale.Type;
237
503
  export type EmailAddress = typeof EmailAddress.Type;
238
504
  export type PhoneNumber = typeof PhoneNumber.Type;
@@ -250,3 +516,4 @@ export type OrganizationTranslation = typeof OrganizationTranslation.Type;
250
516
  export type OrganizationMetadata = typeof OrganizationMetadata.Type;
251
517
  export type Organization = typeof Organization.Type;
252
518
  export type Member = typeof Member.Type;
519
+ export {};