@burdenoff/microfe-eventfullymanaged 2026.1110.1 → 2026.1110.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.
@@ -16,21 +16,23 @@ var h = e`
16
16
  }
17
17
  }
18
18
  `;
19
- function g({ folderPath: e, value: g, onUploaded: _, label: v, hint: y, className: b, disabled: x = !1 }) {
20
- let S = t(), C = o(null), w = a(), [T, E] = s(!1), D = async (t) => {
19
+ function g({ folderPath: e, value: g, onUploaded: _, onUploadingChange: v, label: y, hint: b, className: x, disabled: S = !1 }) {
20
+ let C = t(), w = o(null), T = a(), [E, D] = s(!1), O = (e) => {
21
+ D(e), v?.(e);
22
+ }, k = async (t) => {
21
23
  let i = t.target.files?.[0];
22
24
  if (t.target.value = "", i) {
23
25
  if (!i.type.startsWith("image/")) r.error("Unsupported file", "Please choose an image file.");
24
26
  else {
25
- E(!0);
27
+ O(!0);
26
28
  try {
27
- let t = await S.mutate({
29
+ let t = await C.mutate({
28
30
  mutation: h,
29
31
  variables: { path: e }
30
32
  }), a = t.data?.ensureFolderByPath?.id;
31
33
  if (!a) throw Error(t.error?.message ?? "Could not resolve the upload folder.");
32
34
  let o = await m({
33
- client: S,
35
+ client: C,
34
36
  blob: i,
35
37
  filename: i.name,
36
38
  mimeType: i.type || "application/octet-stream",
@@ -40,18 +42,18 @@ function g({ folderPath: e, value: g, onUploaded: _, label: v, hint: y, classNam
40
42
  } catch (e) {
41
43
  r.error("Upload failed", e instanceof Error ? e.message : "Please try again.");
42
44
  } finally {
43
- E(!1);
45
+ O(!1);
44
46
  }
45
47
  }
46
48
  }
47
49
  };
48
50
  return /* @__PURE__ */ l("div", {
49
- className: b,
51
+ className: x,
50
52
  children: [/* @__PURE__ */ l("div", {
51
53
  className: "flex items-center gap-4",
52
54
  children: [/* @__PURE__ */ c(i, {
53
55
  value: g,
54
- alt: v,
56
+ alt: y,
55
57
  className: "h-16 w-16 shrink-0 rounded-card border border-border-seam object-cover",
56
58
  fallback: /* @__PURE__ */ c("div", {
57
59
  className: "flex h-16 w-16 shrink-0 items-center justify-center rounded-card border border-dashed border-border-default bg-bg-surface text-text-secondary",
@@ -63,22 +65,22 @@ function g({ folderPath: e, value: g, onUploaded: _, label: v, hint: y, classNam
63
65
  type: "button",
64
66
  variant: "secondary",
65
67
  size: "sm",
66
- disabled: x || T,
67
- onClick: () => C.current?.click(),
68
- children: [T ? /* @__PURE__ */ c(d, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ c(f, { className: "h-4 w-4" }), T ? "Uploading..." : g ? "Replace image" : v]
69
- }), y ? /* @__PURE__ */ c("p", {
68
+ disabled: S || E,
69
+ onClick: () => w.current?.click(),
70
+ children: [E ? /* @__PURE__ */ c(d, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ c(f, { className: "h-4 w-4" }), E ? "Uploading..." : g ? "Replace image" : y]
71
+ }), b ? /* @__PURE__ */ c("p", {
70
72
  className: "text-xs text-text-secondary",
71
- children: y
73
+ children: b
72
74
  }) : null]
73
75
  })]
74
76
  }), /* @__PURE__ */ c("input", {
75
- ref: C,
76
- id: w,
77
+ ref: w,
78
+ id: T,
77
79
  type: "file",
78
80
  accept: "image/*",
79
81
  className: "sr-only",
80
- "aria-label": v,
81
- onChange: (e) => void D(e)
82
+ "aria-label": y,
83
+ onChange: (e) => void k(e)
82
84
  })]
83
85
  });
84
86
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ImageUploadField.js","names":["ENSURE_FOLDER","ImageUploadField","client","useApolloClient","inputRef","useRef","inputId","useId","uploading","setUploading","useState","handleSelect","file","event","folderResult","folderPath","folderId","uploaded","uploadBlobToFiles","onUploaded","toFileRef","notify","error","ResolvedImage","label","ImagePlus","Button","disabled","Loader2","Upload","value","hint"],"sources":["../../../src/eventfullymanaged/components/ImageUploadField.tsx"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { useApolloClient } from '@apollo/client/react';\nimport { uploadBlobToFiles } from '@burdenoff/fe-libs/storage';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { ImagePlus, Loader2, Upload } from 'lucide-react';\nimport { useId, useRef, useState } from 'react';\n\nimport { toFileRef } from '../lib/fileRef';\nimport { notify } from '../lib/toast';\nimport { ResolvedImage } from './ResolvedImage';\n\n// wspace-files requires a real folder id (File.folderId FK) — resolve/create the\n// destination folder by path before uploading.\nconst ENSURE_FOLDER = gql`\n mutation EventfullymanagedEnsureFolder($path: String!) {\n ensureFolderByPath(path: $path) {\n id\n }\n }\n`;\n\ninterface EnsureFolderResponse {\n ensureFolderByPath?: { id: string } | null;\n}\n\ninterface ImageUploadFieldProps {\n /** Files-svc folder path the upload is stored under, e.g. \"/EventfullyManaged/FloorPlans\". */\n folderPath: string;\n /** Current persisted image value (a `files:<id>` reference or a URL), rendered as a preview. */\n value?: string | null;\n /** Called with the stored `files:<id>` reference once the upload completes. */\n onUploaded: (ref: string) => void | Promise<void>;\n /** Accessible label for the control. */\n label: string;\n /** Optional helper text shown under the control. */\n hint?: string;\n className?: string;\n disabled?: boolean;\n}\n\n/**\n * Reusable image upload control backed by wspace-files-svc via the shared\n * `uploadBlobToFiles` storage helper (presigned 3-step upload). It never keeps a\n * local blob store — on select it ensures the destination folder, uploads the\n * blob, and hands a stable `files:<fileId>` reference back to the caller to\n * persist through the entity's own mutation. Presigned URLs are never stored:\n * S3 caps them at 7 days, so the UI resolves the reference at render time\n * (see `lib/fileRef` and `ResolvedImage`).\n */\nexport function ImageUploadField({\n folderPath,\n value,\n onUploaded,\n label,\n hint,\n className,\n disabled = false,\n}: ImageUploadFieldProps) {\n const client = useApolloClient();\n const inputRef = useRef<HTMLInputElement | null>(null);\n const inputId = useId();\n const [uploading, setUploading] = useState(false);\n\n const handleSelect = async (event: React.ChangeEvent<HTMLInputElement>) => {\n const file = event.target.files?.[0];\n // Reset the input so selecting the same file again re-triggers change.\n event.target.value = '';\n if (!file) {\n return;\n }\n if (!file.type.startsWith('image/')) {\n notify.error('Unsupported file', 'Please choose an image file.');\n return;\n }\n\n setUploading(true);\n try {\n const folderResult = await client.mutate<EnsureFolderResponse>({\n mutation: ENSURE_FOLDER,\n variables: { path: folderPath },\n });\n const folderId = folderResult.data?.ensureFolderByPath?.id;\n if (!folderId) {\n throw new Error(folderResult.error?.message ?? 'Could not resolve the upload folder.');\n }\n\n const uploaded = await uploadBlobToFiles({\n client,\n blob: file,\n filename: file.name,\n mimeType: file.type || 'application/octet-stream',\n folderId,\n });\n\n await onUploaded(toFileRef(uploaded.id));\n notify.success('Image uploaded');\n } catch (error) {\n notify.error('Upload failed', error instanceof Error ? error.message : 'Please try again.');\n } finally {\n setUploading(false);\n }\n };\n\n return (\n <div className={className}>\n <div className=\"flex items-center gap-4\">\n <ResolvedImage\n value={value}\n alt={label}\n className=\"h-16 w-16 shrink-0 rounded-card border border-border-seam object-cover\"\n fallback={\n <div className=\"flex h-16 w-16 shrink-0 items-center justify-center rounded-card border border-dashed border-border-default bg-bg-surface text-text-secondary\">\n <ImagePlus className=\"h-5 w-5\" />\n </div>\n }\n />\n <div className=\"space-y-1\">\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n disabled={disabled || uploading}\n onClick={() => inputRef.current?.click()}\n >\n {uploading ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : <Upload className=\"h-4 w-4\" />}\n {uploading ? 'Uploading...' : value ? 'Replace image' : label}\n </Button>\n {hint ? <p className=\"text-xs text-text-secondary\">{hint}</p> : null}\n </div>\n </div>\n <input\n ref={inputRef}\n id={inputId}\n type=\"file\"\n accept=\"image/*\"\n className=\"sr-only\"\n aria-label={label}\n onChange={(event) => void handleSelect(event)}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAaA,IAAMA,IAAgB,CAAG;;;;;;;AAoCzB,SAAgBC,EAAiB,EAC/B,eACA,UACA,eACA,UACA,SACA,cACA,cAAW,MACa;CACxB,IAAMC,IAASC,EAAgB,GACzBC,IAAWC,EAAgC,IAAI,GAC/CC,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AwB,CAAA,IAAI,kBAACC,GAAD,EAAQ,WAAU,UAAW,CAAA,GACxFrB,IAAY,iBAAiBsB,IAAQ,kBAAkBN,CAClD;IACP,CAAA,GAAAO,IAAO,kBAAC,KAAD;KAAG,WAAU;KAA+B,UAAAA;IAAQ,CAAA,IAAI,IAC7D;GACF,CAAA,CAAA;EACL,CAAA,GAAA,kBAAC,SAAD;GACE,KAAK3B;GACL,IAAIE;GACJ,MAAK;GACL,QAAO;GACP,WAAU;GACV,cAAYkB;GACZ,WAAW,MAAU,KAAKb,EAAaE,CAAK;EAC7C,CAAA,CACE;;AAET"}
1
+ {"version":3,"file":"ImageUploadField.js","names":["ENSURE_FOLDER","ImageUploadField","client","useApolloClient","inputRef","useRef","inputId","useId","uploading","setUploading","useState","setUploadingState","next","onUploadingChange","handleSelect","file","event","folderResult","folderPath","folderId","uploaded","uploadBlobToFiles","onUploaded","toFileRef","notify","error","ResolvedImage","label","ImagePlus","Button","disabled","Loader2","Upload","value","hint"],"sources":["../../../src/eventfullymanaged/components/ImageUploadField.tsx"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { useApolloClient } from '@apollo/client/react';\nimport { uploadBlobToFiles } from '@burdenoff/fe-libs/storage';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { ImagePlus, Loader2, Upload } from 'lucide-react';\nimport { useId, useRef, useState } from 'react';\n\nimport { toFileRef } from '../lib/fileRef';\nimport { notify } from '../lib/toast';\nimport { ResolvedImage } from './ResolvedImage';\n\n// wspace-files requires a real folder id (File.folderId FK) — resolve/create the\n// destination folder by path before uploading.\nconst ENSURE_FOLDER = gql`\n mutation EventfullymanagedEnsureFolder($path: String!) {\n ensureFolderByPath(path: $path) {\n id\n }\n }\n`;\n\ninterface EnsureFolderResponse {\n ensureFolderByPath?: { id: string } | null;\n}\n\ninterface ImageUploadFieldProps {\n /** Files-svc folder path the upload is stored under, e.g. \"/EventfullyManaged/FloorPlans\". */\n folderPath: string;\n /** Current persisted image value (a `files:<id>` reference or a URL), rendered as a preview. */\n value?: string | null;\n /** Called with the stored `files:<id>` reference once the upload completes. */\n onUploaded: (ref: string) => void | Promise<void>;\n /**\n * Reports upload-in-progress state so the parent form can disable its own\n * Save/Create button — otherwise saving while an upload is still running\n * persists the entity without the new image, and the upload's own\n * completion update lands on a form the user has already left (BOFF-11231).\n */\n onUploadingChange?: (uploading: boolean) => void;\n /** Accessible label for the control. */\n label: string;\n /** Optional helper text shown under the control. */\n hint?: string;\n className?: string;\n disabled?: boolean;\n}\n\n/**\n * Reusable image upload control backed by wspace-files-svc via the shared\n * `uploadBlobToFiles` storage helper (presigned 3-step upload). It never keeps a\n * local blob store — on select it ensures the destination folder, uploads the\n * blob, and hands a stable `files:<fileId>` reference back to the caller to\n * persist through the entity's own mutation. Presigned URLs are never stored:\n * S3 caps them at 7 days, so the UI resolves the reference at render time\n * (see `lib/fileRef` and `ResolvedImage`).\n */\nexport function ImageUploadField({\n folderPath,\n value,\n onUploaded,\n onUploadingChange,\n label,\n hint,\n className,\n disabled = false,\n}: ImageUploadFieldProps) {\n const client = useApolloClient();\n const inputRef = useRef<HTMLInputElement | null>(null);\n const inputId = useId();\n const [uploading, setUploading] = useState(false);\n\n const setUploadingState = (next: boolean) => {\n setUploading(next);\n onUploadingChange?.(next);\n };\n\n const handleSelect = async (event: React.ChangeEvent<HTMLInputElement>) => {\n const file = event.target.files?.[0];\n // Reset the input so selecting the same file again re-triggers change.\n event.target.value = '';\n if (!file) {\n return;\n }\n if (!file.type.startsWith('image/')) {\n notify.error('Unsupported file', 'Please choose an image file.');\n return;\n }\n\n setUploadingState(true);\n try {\n const folderResult = await client.mutate<EnsureFolderResponse>({\n mutation: ENSURE_FOLDER,\n variables: { path: folderPath },\n });\n const folderId = folderResult.data?.ensureFolderByPath?.id;\n if (!folderId) {\n throw new Error(folderResult.error?.message ?? 'Could not resolve the upload folder.');\n }\n\n const uploaded = await uploadBlobToFiles({\n client,\n blob: file,\n filename: file.name,\n mimeType: file.type || 'application/octet-stream',\n folderId,\n });\n\n await onUploaded(toFileRef(uploaded.id));\n notify.success('Image uploaded');\n } catch (error) {\n notify.error('Upload failed', error instanceof Error ? error.message : 'Please try again.');\n } finally {\n setUploadingState(false);\n }\n };\n\n return (\n <div className={className}>\n <div className=\"flex items-center gap-4\">\n <ResolvedImage\n value={value}\n alt={label}\n className=\"h-16 w-16 shrink-0 rounded-card border border-border-seam object-cover\"\n fallback={\n <div className=\"flex h-16 w-16 shrink-0 items-center justify-center rounded-card border border-dashed border-border-default bg-bg-surface text-text-secondary\">\n <ImagePlus className=\"h-5 w-5\" />\n </div>\n }\n />\n <div className=\"space-y-1\">\n <Button\n type=\"button\"\n variant=\"secondary\"\n size=\"sm\"\n disabled={disabled || uploading}\n onClick={() => inputRef.current?.click()}\n >\n {uploading ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : <Upload className=\"h-4 w-4\" />}\n {uploading ? 'Uploading...' : value ? 'Replace image' : label}\n </Button>\n {hint ? <p className=\"text-xs text-text-secondary\">{hint}</p> : null}\n </div>\n </div>\n <input\n ref={inputRef}\n id={inputId}\n type=\"file\"\n accept=\"image/*\"\n className=\"sr-only\"\n aria-label={label}\n onChange={(event) => void handleSelect(event)}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAaA,IAAMA,IAAgB,CAAG;;;;;;;AA2CzB,SAAgBC,EAAiB,EAC/B,eACA,UACA,eACA,sBACA,UACA,SACA,cACA,cAAW,MACa;CACxB,IAAMC,IAASC,EAAgB,GACzBC,IAAWC,EAAgC,IAAI,GAC/CC,IAAUC,EAAM,GAChB,CAACC,GAAWC,KAAgBC,EAAS,EAAK,GAE1CC,KAAqB,MAAkB;EAE3C,AADAF,EAAaG,CAAI,GACjBC,IAAoBD,CAAI;CAC1B,GAEME,IAAe,OAAO,MAA+C;EACzE,IAAMC,IAAOC,EAAM,OAAO,QAAQ;EAGlC,IADA,EAAM,OAAO,QAAQ,IAChBD,GAGL;OAAI,CAACA,EAAK,KAAK,W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C7D;GACF,CAAA,CAAA;EACL,CAAA,GAAA,kBAAC,SAAD;GACE,KAAK9B;GACL,IAAIE;GACJ,MAAK;GACL,QAAO;GACP,WAAU;GACV,cAAYqB;GACZ,WAAW,MAAU,KAAKb,EAAaE,CAAK;EAC7C,CAAA,CACE;;AAET"}
@@ -1,37 +1,18 @@
1
- import { gql as e } from "../../../node_modules/graphql-tag/lib/index.js";
2
- import { useQuery as t } from "../../../node_modules/@apollo/client/react/hooks/useQuery.js";
3
- import { useCreateSpeakerMutation as n, useUpdateSpeakerMutation as r } from "../../api/eventApi.js";
4
- import { EntityFormShell as i } from "../../components/EntityFormShell.js";
5
- import { EntityTagsField as a } from "../../components/EntityTagsField.js";
6
- import { ImageUploadField as o } from "../../components/ImageUploadField.js";
7
- import { safeUrl as s } from "../../components/SafeLink.js";
8
- import { useEventfullyManaged as c } from "../../context/EventfullyManagedContext.js";
9
- import { describeError as l, mutationSucceeded as u } from "../../lib/mutationResult.js";
10
- import { notify as d } from "../../lib/toast.js";
11
- import { registerBreadcrumbName as f, unregisterBreadcrumbName as p } from "../../utils/breadcrumbRegistry.js";
12
- import { useEffect as m, useMemo as h, useState as g } from "react";
13
- import { useParams as _ } from "react-router";
14
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
15
- import { Input as b, Textarea as x } from "@burdenoff/fe-libs/ui";
1
+ import { useCreateSpeakerMutation as e, useSpeakerQuery as t, useUpdateSpeakerMutation as n } from "../../api/eventApi.js";
2
+ import { EntityFormShell as r } from "../../components/EntityFormShell.js";
3
+ import { EntityTagsField as i } from "../../components/EntityTagsField.js";
4
+ import { ImageUploadField as a } from "../../components/ImageUploadField.js";
5
+ import { safeUrl as o } from "../../components/SafeLink.js";
6
+ import { useEventfullyManaged as s } from "../../context/EventfullyManagedContext.js";
7
+ import { describeError as c, mutationSucceeded as l } from "../../lib/mutationResult.js";
8
+ import { notify as u } from "../../lib/toast.js";
9
+ import { registerBreadcrumbName as d, unregisterBreadcrumbName as f } from "../../utils/breadcrumbRegistry.js";
10
+ import { useEffect as p, useMemo as m, useState as h } from "react";
11
+ import { useParams as g } from "react-router";
12
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
13
+ import { Input as y, Textarea as b } from "@burdenoff/fe-libs/ui";
16
14
  // src/eventfullymanaged/pages/speakers/SpeakerFormPage.tsx
17
- var S = e`
18
- query EventfullymanagedSpeakerFormSpeakers($limit: Int, $offset: Int) {
19
- speakers: eventfullyManagedSpeakers(limit: $limit, offset: $offset) {
20
- total
21
- items {
22
- id
23
- fullName
24
- title
25
- organization
26
- bio
27
- avatarUrl
28
- email
29
- phone
30
- socialLinks
31
- }
32
- }
33
- }
34
- `, C = {
15
+ var x = {
35
16
  fullName: "",
36
17
  title: "",
37
18
  organization: "",
@@ -41,184 +22,194 @@ var S = e`
41
22
  avatarUrl: "",
42
23
  website: ""
43
24
  };
44
- function w(e) {
25
+ function S(e) {
45
26
  return e && typeof e.website == "string" ? e.website : "";
46
27
  }
47
- function T() {
48
- let { id: e = "" } = _(), T = h(() => !!e, [e]), { navigate: E } = c(), { data: D } = t(S, {
49
- variables: {
50
- limit: 100,
51
- offset: 0
52
- },
53
- skip: !e
54
- }), [O, { loading: k }] = n(), [A, { loading: j }] = r(), [M, N] = g(C), P = h(() => (D?.speakers?.items ?? []).find((t) => t.id === e), [D, e]);
55
- m(() => (f(e, P?.fullName), () => p(e)), [e, P?.fullName]), m(() => {
56
- T && P && N({
57
- fullName: P.fullName ?? "",
58
- title: P.title ?? "",
59
- organization: P.organization ?? "",
60
- email: P.email ?? "",
61
- phone: P.phone ?? "",
62
- bio: P.bio ?? "",
63
- avatarUrl: P.avatarUrl ?? "",
64
- website: w(P.socialLinks)
28
+ function C() {
29
+ let { id: C = "" } = g(), w = m(() => !!C, [C]), { navigate: T } = s(), { data: E } = t(C), [D, { loading: O }] = e(), [k, { loading: A }] = n(), [j, M] = h(x), [N, P] = h(!1), F = E?.speaker ?? null;
30
+ p(() => (d(C, F?.fullName), () => f(C)), [C, F?.fullName]), p(() => {
31
+ w && F && M({
32
+ fullName: F.fullName ?? "",
33
+ title: F.title ?? "",
34
+ organization: F.organization ?? "",
35
+ email: F.email ?? "",
36
+ phone: F.phone ?? "",
37
+ bio: F.bio ?? "",
38
+ avatarUrl: F.avatarUrl ?? "",
39
+ website: S(F.socialLinks)
65
40
  });
66
- }, [P, T]);
67
- let F = (e, t) => {
68
- N((n) => ({
41
+ }, [F, w]);
42
+ let I = (e, t) => {
43
+ M((n) => ({
69
44
  ...n,
70
45
  [e]: t
71
46
  }));
72
47
  };
73
- return /* @__PURE__ */ y(i, {
74
- title: T ? "Edit Speaker" : "Add Speaker",
48
+ return /* @__PURE__ */ v(r, {
49
+ title: w ? "Edit Speaker" : "Add Speaker",
75
50
  description: "A person who presents sessions at your events.",
76
51
  purpose: "A speaker profile is what you attach to sessions and show to attendees. Capture who they are, where they work, and a short bio or talk abstract so the agenda tells a compelling story. The headshot appears anywhere the speaker is listed.",
77
52
  backLabel: "Back to Speakers",
78
- onBack: () => E("/speakers"),
79
- onSubmit: async (t) => {
80
- if (t.preventDefault(), !M.fullName.trim()) {
81
- d.error("Name required", "Give the speaker a name before saving.");
53
+ onBack: () => T("/speakers"),
54
+ onSubmit: async (e) => {
55
+ if (e.preventDefault(), !j.fullName.trim()) {
56
+ u.error("Name required", "Give the speaker a name before saving.");
57
+ return;
58
+ }
59
+ let t = j.email.trim();
60
+ if (t && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)) {
61
+ u.error("Invalid email", "Enter a valid email address, or leave it blank.");
82
62
  return;
83
63
  }
84
- let n = s(M.website);
85
- if (M.website.trim() && !n) {
86
- d.error("Invalid website", "Enter a valid http(s) URL, or leave it blank.");
64
+ let n = j.phone.trim();
65
+ if (n && ((n.match(/\d/g) ?? []).length < 7 || !/^[\d+() .-]+$/.test(n))) {
66
+ u.error("Invalid phone", "Enter a valid phone number, or leave it blank.");
87
67
  return;
88
68
  }
89
- let r = {
90
- fullName: M.fullName.trim(),
91
- title: M.title || null,
92
- organization: M.organization || null,
93
- email: M.email || null,
94
- phone: M.phone || null,
95
- bio: M.bio || null,
96
- avatarUrl: M.avatarUrl || null,
97
- socialLinks: n ? { website: n } : {}
69
+ let r = o(j.website);
70
+ if (j.website.trim() && !r) {
71
+ u.error("Invalid website", "Enter a valid http(s) URL, or leave it blank.");
72
+ return;
73
+ }
74
+ let i = {
75
+ fullName: j.fullName.trim(),
76
+ title: j.title || null,
77
+ organization: j.organization || null,
78
+ email: j.email || null,
79
+ phone: j.phone || null,
80
+ bio: j.bio || null,
81
+ avatarUrl: j.avatarUrl || null,
82
+ socialLinks: r ? { website: r } : {}
98
83
  };
99
84
  try {
100
- if (T) {
101
- let t = await A({ variables: {
102
- id: e,
103
- input: r
85
+ if (w) {
86
+ let e = await k({ variables: {
87
+ id: C,
88
+ input: i
104
89
  } });
105
- if (!u(t, t.data?.updateSpeaker?.id, "Could not update speaker")) return;
106
- d.success("Speaker updated"), E("/speakers");
90
+ if (!l(e, e.data?.updateSpeaker?.id, "Could not update speaker")) return;
91
+ u.success("Speaker updated"), T("/speakers");
107
92
  return;
108
93
  }
109
- let t = await O({ variables: { input: r } });
110
- if (!u(t, t.data?.createSpeaker?.id, "Could not create speaker")) return;
111
- d.success("Speaker created"), E("/speakers");
94
+ let e = await D({ variables: { input: i } });
95
+ if (!l(e, e.data?.createSpeaker?.id, "Could not create speaker")) return;
96
+ u.success("Speaker created"), T("/speakers");
112
97
  } catch (e) {
113
- d.error("Could not save speaker", l(e));
98
+ u.error("Could not save speaker", c(e));
114
99
  }
115
100
  },
116
- submitLabel: "Save Speaker",
117
- saving: k || j,
101
+ submitLabel: N ? "Uploading headshot..." : "Save Speaker",
102
+ saving: O || A,
103
+ submitDisabled: N,
118
104
  children: [
119
- /* @__PURE__ */ y("div", {
105
+ /* @__PURE__ */ v("div", {
120
106
  className: "grid grid-cols-1 gap-4 md:grid-cols-2",
121
- children: [/* @__PURE__ */ y("label", {
107
+ children: [/* @__PURE__ */ v("label", {
122
108
  className: "space-y-1 text-sm",
123
109
  children: [/* @__PURE__ */ v("span", {
124
110
  className: "font-medium text-text-primary",
125
- children: "Full name"
126
- }), /* @__PURE__ */ v(b, {
127
- value: M.fullName,
128
- onChange: (e) => F("fullName", e.target.value),
111
+ children: ["Full name", /* @__PURE__ */ v("span", {
112
+ "aria-hidden": "true",
113
+ className: "text-status-danger-text",
114
+ children: [" ", "*"]
115
+ })]
116
+ }), /* @__PURE__ */ _(y, {
117
+ value: j.fullName,
118
+ onChange: (e) => I("fullName", e.target.value),
129
119
  required: !0
130
120
  })]
131
- }), /* @__PURE__ */ y("label", {
121
+ }), /* @__PURE__ */ v("label", {
132
122
  className: "space-y-1 text-sm",
133
- children: [/* @__PURE__ */ v("span", {
123
+ children: [/* @__PURE__ */ _("span", {
134
124
  className: "font-medium text-text-primary",
135
125
  children: "Title"
136
- }), /* @__PURE__ */ v(b, {
137
- value: M.title,
138
- onChange: (e) => F("title", e.target.value),
126
+ }), /* @__PURE__ */ _(y, {
127
+ value: j.title,
128
+ onChange: (e) => I("title", e.target.value),
139
129
  placeholder: "Head of Product"
140
130
  })]
141
131
  })]
142
132
  }),
143
- /* @__PURE__ */ y("div", {
133
+ /* @__PURE__ */ v("div", {
144
134
  className: "grid grid-cols-1 gap-4 md:grid-cols-3",
145
135
  children: [
146
- /* @__PURE__ */ y("label", {
136
+ /* @__PURE__ */ v("label", {
147
137
  className: "space-y-1 text-sm",
148
- children: [/* @__PURE__ */ v("span", {
138
+ children: [/* @__PURE__ */ _("span", {
149
139
  className: "font-medium text-text-primary",
150
140
  children: "Company"
151
- }), /* @__PURE__ */ v(b, {
152
- value: M.organization,
153
- onChange: (e) => F("organization", e.target.value)
141
+ }), /* @__PURE__ */ _(y, {
142
+ value: j.organization,
143
+ onChange: (e) => I("organization", e.target.value)
154
144
  })]
155
145
  }),
156
- /* @__PURE__ */ y("label", {
146
+ /* @__PURE__ */ v("label", {
157
147
  className: "space-y-1 text-sm",
158
- children: [/* @__PURE__ */ v("span", {
148
+ children: [/* @__PURE__ */ _("span", {
159
149
  className: "font-medium text-text-primary",
160
150
  children: "Email"
161
- }), /* @__PURE__ */ v(b, {
151
+ }), /* @__PURE__ */ _(y, {
162
152
  type: "email",
163
- value: M.email,
164
- onChange: (e) => F("email", e.target.value)
153
+ value: j.email,
154
+ onChange: (e) => I("email", e.target.value)
165
155
  })]
166
156
  }),
167
- /* @__PURE__ */ y("label", {
157
+ /* @__PURE__ */ v("label", {
168
158
  className: "space-y-1 text-sm",
169
- children: [/* @__PURE__ */ v("span", {
159
+ children: [/* @__PURE__ */ _("span", {
170
160
  className: "font-medium text-text-primary",
171
161
  children: "Phone"
172
- }), /* @__PURE__ */ v(b, {
173
- value: M.phone,
174
- onChange: (e) => F("phone", e.target.value)
162
+ }), /* @__PURE__ */ _(y, {
163
+ value: j.phone,
164
+ onChange: (e) => I("phone", e.target.value)
175
165
  })]
176
166
  })
177
167
  ]
178
168
  }),
179
- /* @__PURE__ */ y("div", {
169
+ /* @__PURE__ */ v("div", {
180
170
  className: "space-y-1 text-sm",
181
- children: [/* @__PURE__ */ v("span", {
171
+ children: [/* @__PURE__ */ _("span", {
182
172
  className: "font-medium text-text-primary",
183
173
  children: "Headshot"
184
- }), /* @__PURE__ */ v(o, {
174
+ }), /* @__PURE__ */ _(a, {
185
175
  label: "Upload headshot",
186
176
  folderPath: "/EventfullyManaged/Speakers",
187
- value: M.avatarUrl || null,
188
- onUploaded: (e) => F("avatarUrl", e),
177
+ value: j.avatarUrl || null,
178
+ onUploaded: (e) => I("avatarUrl", e),
179
+ onUploadingChange: P,
189
180
  hint: "Stored securely in Files. Shown wherever the speaker is listed."
190
181
  })]
191
182
  }),
192
- /* @__PURE__ */ y("label", {
183
+ /* @__PURE__ */ v("label", {
193
184
  className: "block space-y-1 text-sm",
194
- children: [/* @__PURE__ */ v("span", {
185
+ children: [/* @__PURE__ */ _("span", {
195
186
  className: "font-medium text-text-primary",
196
187
  children: "Bio & talk abstract"
197
- }), /* @__PURE__ */ v(x, {
198
- value: M.bio,
199
- onChange: (e) => F("bio", e.target.value),
188
+ }), /* @__PURE__ */ _(b, {
189
+ value: j.bio,
190
+ onChange: (e) => I("bio", e.target.value),
200
191
  rows: 5,
201
192
  placeholder: "Short professional bio and a summary of the talk they will give."
202
193
  })]
203
194
  }),
204
- /* @__PURE__ */ y("label", {
195
+ /* @__PURE__ */ v("label", {
205
196
  className: "block space-y-1 text-sm",
206
- children: [/* @__PURE__ */ v("span", {
197
+ children: [/* @__PURE__ */ _("span", {
207
198
  className: "font-medium text-text-primary",
208
199
  children: "Website / profile URL"
209
- }), /* @__PURE__ */ v(b, {
210
- value: M.website,
211
- onChange: (e) => F("website", e.target.value),
200
+ }), /* @__PURE__ */ _(y, {
201
+ value: j.website,
202
+ onChange: (e) => I("website", e.target.value),
212
203
  placeholder: "https://…"
213
204
  })]
214
205
  }),
215
- T ? /* @__PURE__ */ v(a, {
206
+ w ? /* @__PURE__ */ _(i, {
216
207
  entityType: "EVENTFULLYMANAGED_SPEAKER",
217
- entityId: e
208
+ entityId: C
218
209
  }) : null
219
210
  ]
220
211
  });
221
212
  }
222
- export { T as default };
213
+ export { C as default };
223
214
 
224
215
  //# sourceMappingURL=SpeakerFormPage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpeakerFormPage.js","names":["FULL_SPEAKERS_QUERY","initialState","readWebsite","socialLinks","SpeakerFormPage","useParams","isEdit","useMemo","id","useEventfullyManaged","useQuery","createSpeaker","creating","useCreateSpeakerMutation","updateSpeaker","updating","useUpdateSpeakerMutation","form","setForm","useState","existingSpeaker","data","item","useEffect","registerBreadcrumbName","unregisterBreadcrumbName","onChange","prev","field","value","EntityFormShell","navigate","event","normalizedWebsite","safeUrl","input","response","mutationSucceeded","notify","error","describeError","Input","ImageUploadField","url","Textarea","EntityTagsField"],"sources":["../../../../src/eventfullymanaged/pages/speakers/SpeakerFormPage.tsx"],"sourcesContent":["/* eslint-disable react-hooks/set-state-in-effect */\nimport { gql } from '@apollo/client';\nimport { useQuery } from '@apollo/client/react';\nimport { Input, Textarea } from '@burdenoff/fe-libs/ui';\nimport { useEffect, useMemo, useState } from 'react';\nimport { useParams } from 'react-router';\n\nimport { useCreateSpeakerMutation, useUpdateSpeakerMutation } from '../../api/eventApi';\nimport { EntityFormShell } from '../../components/EntityFormShell';\nimport { EntityTagsField } from '../../components/EntityTagsField';\nimport { ImageUploadField } from '../../components/ImageUploadField';\nimport { safeUrl } from '../../components/SafeLink';\nimport { useEventfullyManaged } from '../../context/EventfullyManagedContext';\nimport { describeError, mutationSucceeded } from '../../lib/mutationResult';\nimport { notify } from '../../lib/toast';\nimport { registerBreadcrumbName, unregisterBreadcrumbName } from '../../utils/breadcrumbRegistry';\n\n// The backend `updateSpeaker` resolver is a FULL replace and there is no by-id\n// speaker resolver, so this fuller list query — selecting every editable field,\n// not just the columns the foundation SPEAKERS_QUERY lists — is the edit-hydration\n// source. The form finds its row by id client-side. Without the full selection an\n// edit would blank bio / avatar / phone / socialLinks.\nconst FULL_SPEAKERS_QUERY = gql`\n query EventfullymanagedSpeakerFormSpeakers($limit: Int, $offset: Int) {\n speakers: eventfullyManagedSpeakers(limit: $limit, offset: $offset) {\n total\n items {\n id\n fullName\n title\n organization\n bio\n avatarUrl\n email\n phone\n socialLinks\n }\n }\n }\n`;\n\ntype SpeakerRecord = {\n id: string;\n fullName: string;\n title?: string | null;\n organization?: string | null;\n bio?: string | null;\n avatarUrl?: string | null;\n email?: string | null;\n phone?: string | null;\n socialLinks?: Record<string, unknown> | null;\n};\n\ntype FullSpeakersResponse = { speakers: { total: number; items: SpeakerRecord[] } };\n\ntype SpeakerFormState = {\n fullName: string;\n title: string;\n organization: string;\n email: string;\n phone: string;\n bio: string;\n avatarUrl: string;\n website: string;\n};\n\nconst initialState: SpeakerFormState = {\n fullName: '',\n title: '',\n organization: '',\n email: '',\n phone: '',\n bio: '',\n avatarUrl: '',\n website: '',\n};\n\nfunction readWebsite(socialLinks: Record<string, unknown> | null | undefined): string {\n if (socialLinks && typeof socialLinks.website === 'string') {\n return socialLinks.website;\n }\n return '';\n}\n\nexport default function SpeakerFormPage() {\n const { id = '' } = useParams<{ id: string }>();\n const isEdit = useMemo(() => Boolean(id), [id]);\n const { navigate } = useEventfullyManaged();\n\n const { data } = useQuery<FullSpeakersResponse, { limit?: number; offset?: number }>(FULL_SPEAKERS_QUERY, {\n variables: { limit: 100, offset: 0 },\n skip: !id,\n });\n const [createSpeaker, { loading: creating }] = useCreateSpeakerMutation();\n const [updateSpeaker, { loading: updating }] = useUpdateSpeakerMutation();\n const [form, setForm] = useState<SpeakerFormState>(initialState);\n\n const existingSpeaker = useMemo(() => (data?.speakers?.items ?? []).find((item) => item.id === id), [data, id]);\n\n useEffect(() => {\n registerBreadcrumbName(id, existingSpeaker?.fullName);\n return () => unregisterBreadcrumbName(id);\n }, [id, existingSpeaker?.fullName]);\n\n useEffect(() => {\n if (!isEdit || !existingSpeaker) {\n return;\n }\n setForm({\n fullName: existingSpeaker.fullName ?? '',\n title: existingSpeaker.title ?? '',\n organization: existingSpeaker.organization ?? '',\n email: existingSpeaker.email ?? '',\n phone: existingSpeaker.phone ?? '',\n bio: existingSpeaker.bio ?? '',\n avatarUrl: existingSpeaker.avatarUrl ?? '',\n website: readWebsite(existingSpeaker.socialLinks),\n });\n }, [existingSpeaker, isEdit]);\n\n const onChange = (field: keyof SpeakerFormState, value: string) => {\n setForm((prev) => ({ ...prev, [field]: value }));\n };\n\n const onSubmit = async (event: React.FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n\n if (!form.fullName.trim()) {\n notify.error('Name required', 'Give the speaker a name before saving.');\n return;\n }\n\n const normalizedWebsite = safeUrl(form.website);\n if (form.website.trim() && !normalizedWebsite) {\n notify.error('Invalid website', 'Enter a valid http(s) URL, or leave it blank.');\n return;\n }\n\n const input = {\n fullName: form.fullName.trim(),\n title: form.title || null,\n organization: form.organization || null,\n email: form.email || null,\n phone: form.phone || null,\n bio: form.bio || null,\n avatarUrl: form.avatarUrl || null,\n socialLinks: normalizedWebsite ? { website: normalizedWebsite } : {},\n };\n\n try {\n if (isEdit) {\n const response = await updateSpeaker({ variables: { id, input } });\n if (!mutationSucceeded(response, response.data?.updateSpeaker?.id, 'Could not update speaker')) {\n return;\n }\n notify.success('Speaker updated');\n navigate('/speakers');\n return;\n }\n const response = await createSpeaker({ variables: { input } });\n if (!mutationSucceeded(response, response.data?.createSpeaker?.id, 'Could not create speaker')) {\n return;\n }\n notify.success('Speaker created');\n navigate('/speakers');\n } catch (error) {\n notify.error('Could not save speaker', describeError(error));\n }\n };\n\n const saving = creating || updating;\n\n return (\n <EntityFormShell\n title={isEdit ? 'Edit Speaker' : 'Add Speaker'}\n description=\"A person who presents sessions at your events.\"\n purpose=\"A speaker profile is what you attach to sessions and show to attendees. Capture who they are, where they work, and a short bio or talk abstract so the agenda tells a compelling story. The headshot appears anywhere the speaker is listed.\"\n backLabel=\"Back to Speakers\"\n onBack={() => navigate('/speakers')}\n onSubmit={onSubmit}\n submitLabel=\"Save Speaker\"\n saving={saving}\n >\n <div className=\"grid grid-cols-1 gap-4 md:grid-cols-2\">\n <label className=\"space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Full name</span>\n <Input value={form.fullName} onChange={(e) => onChange('fullName', e.target.value)} required />\n </label>\n <label className=\"space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Title</span>\n <Input value={form.title} onChange={(e) => onChange('title', e.target.value)} placeholder=\"Head of Product\" />\n </label>\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 md:grid-cols-3\">\n <label className=\"space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Company</span>\n <Input value={form.organization} onChange={(e) => onChange('organization', e.target.value)} />\n </label>\n <label className=\"space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Email</span>\n <Input type=\"email\" value={form.email} onChange={(e) => onChange('email', e.target.value)} />\n </label>\n <label className=\"space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Phone</span>\n <Input value={form.phone} onChange={(e) => onChange('phone', e.target.value)} />\n </label>\n </div>\n\n <div className=\"space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Headshot</span>\n <ImageUploadField\n label=\"Upload headshot\"\n folderPath=\"/EventfullyManaged/Speakers\"\n value={form.avatarUrl || null}\n onUploaded={(url) => onChange('avatarUrl', url)}\n hint=\"Stored securely in Files. Shown wherever the speaker is listed.\"\n />\n </div>\n\n <label className=\"block space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Bio &amp; talk abstract</span>\n <Textarea\n value={form.bio}\n onChange={(e) => onChange('bio', e.target.value)}\n rows={5}\n placeholder=\"Short professional bio and a summary of the talk they will give.\"\n />\n </label>\n\n <label className=\"block space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Website / profile URL</span>\n <Input value={form.website} onChange={(e) => onChange('website', e.target.value)} placeholder=\"https://…\" />\n </label>\n\n {isEdit ? <EntityTagsField entityType=\"EVENTFULLYMANAGED_SPEAKER\" entityId={id} /> : null}\n </EntityFormShell>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,IAAMA,IAAsB,CAAG;;;;;;;;;;;;;;;;;GA4CzBC,IAAiC;CACrC,UAAU;CACV,OAAO;CACP,cAAc;CACd,OAAO;CACP,OAAO;CACP,KAAK;CACL,WAAW;CACX,SAAS;AACX;AAEA,SAASC,EAAY,GAAiE;CAIpF,OAHIC,KAAe,OAAOA,EAAY,WAAY,WACzCA,EAAY,UAEd;AACT;AAEA,SAAwBC,IAAkB;CACxC,IAAM,EAAE,QAAK,OAAOC,EAA0B,GACxCC,IAASC,QAAc,EAAQC,GAAK,CAACA,CAAE,CAAC,GACxC,EAAE,gBAAaC,EAAqB,GAEpC,EAAE,YAASC,EAAoEV,GAAqB;EACxG,WAAW;GAAE,OAAO;GAAK,QAAQ;EAAE;EACnC,MAAM,CAACQ;CACT,CAAC,GACK,CAACG,GAAe,EAAE,SAASC,O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jB,UAAA,CACE,kBAAC,QAAD;KAAM,WAAU;KAAgC,UAAA;IAA2B,CAAA,GAC3E,kBAACe,GAAD;KAAO,OAAOxB,EAAK;KAAS,WAAW,MAAMS,EAAS,WAAW,EAAE,OAAO,KAAK;KAAG,aAAY;IAAa,CAAA,CACtG;;GAENpB,IAAS,kBAACuC,GAAD;IAAiB,YAAW;IAA4B,UAAUrC;GAAK,CAAA,IAAI;EACtE;;AAErB"}
1
+ {"version":3,"file":"SpeakerFormPage.js","names":["initialState","readWebsite","socialLinks","SpeakerFormPage","useParams","isEdit","useMemo","id","useEventfullyManaged","useSpeakerQuery","createSpeaker","creating","useCreateSpeakerMutation","updateSpeaker","updating","useUpdateSpeakerMutation","form","setForm","useState","headshotUploading","setHeadshotUploading","existingSpeaker","data","useEffect","registerBreadcrumbName","unregisterBreadcrumbName","onChange","prev","field","value","EntityFormShell","navigate","event","email","phone","normalizedWebsite","safeUrl","input","response","mutationSucceeded","notify","error","describeError","Input","ImageUploadField","url","Textarea","EntityTagsField"],"sources":["../../../../src/eventfullymanaged/pages/speakers/SpeakerFormPage.tsx"],"sourcesContent":["/* eslint-disable react-hooks/set-state-in-effect */\nimport { Input, Textarea } from '@burdenoff/fe-libs/ui';\nimport { useEffect, useMemo, useState } from 'react';\nimport { useParams } from 'react-router';\n\nimport { useCreateSpeakerMutation, useSpeakerQuery, useUpdateSpeakerMutation } from '../../api/eventApi';\nimport { EntityFormShell } from '../../components/EntityFormShell';\nimport { EntityTagsField } from '../../components/EntityTagsField';\nimport { ImageUploadField } from '../../components/ImageUploadField';\nimport { safeUrl } from '../../components/SafeLink';\nimport { useEventfullyManaged } from '../../context/EventfullyManagedContext';\nimport { describeError, mutationSucceeded } from '../../lib/mutationResult';\nimport { notify } from '../../lib/toast';\nimport { registerBreadcrumbName, unregisterBreadcrumbName } from '../../utils/breadcrumbRegistry';\n\ntype SpeakerFormState = {\n fullName: string;\n title: string;\n organization: string;\n email: string;\n phone: string;\n bio: string;\n avatarUrl: string;\n website: string;\n};\n\nconst initialState: SpeakerFormState = {\n fullName: '',\n title: '',\n organization: '',\n email: '',\n phone: '',\n bio: '',\n avatarUrl: '',\n website: '',\n};\n\nfunction readWebsite(socialLinks: Record<string, unknown> | null | undefined): string {\n if (socialLinks && typeof socialLinks.website === 'string') {\n return socialLinks.website;\n }\n return '';\n}\n\nexport default function SpeakerFormPage() {\n const { id = '' } = useParams<{ id: string }>();\n const isEdit = useMemo(() => Boolean(id), [id]);\n const { navigate } = useEventfullyManaged();\n\n const { data } = useSpeakerQuery(id);\n const [createSpeaker, { loading: creating }] = useCreateSpeakerMutation();\n const [updateSpeaker, { loading: updating }] = useUpdateSpeakerMutation();\n const [form, setForm] = useState<SpeakerFormState>(initialState);\n const [headshotUploading, setHeadshotUploading] = useState(false);\n\n const existingSpeaker = data?.speaker ?? null;\n\n useEffect(() => {\n registerBreadcrumbName(id, existingSpeaker?.fullName);\n return () => unregisterBreadcrumbName(id);\n }, [id, existingSpeaker?.fullName]);\n\n useEffect(() => {\n if (!isEdit || !existingSpeaker) {\n return;\n }\n setForm({\n fullName: existingSpeaker.fullName ?? '',\n title: existingSpeaker.title ?? '',\n organization: existingSpeaker.organization ?? '',\n email: existingSpeaker.email ?? '',\n phone: existingSpeaker.phone ?? '',\n bio: existingSpeaker.bio ?? '',\n avatarUrl: existingSpeaker.avatarUrl ?? '',\n website: readWebsite(existingSpeaker.socialLinks),\n });\n }, [existingSpeaker, isEdit]);\n\n const onChange = (field: keyof SpeakerFormState, value: string) => {\n setForm((prev) => ({ ...prev, [field]: value }));\n };\n\n const onSubmit = async (event: React.FormEvent<HTMLFormElement>) => {\n event.preventDefault();\n\n if (!form.fullName.trim()) {\n notify.error('Name required', 'Give the speaker a name before saving.');\n return;\n }\n\n const email = form.email.trim();\n if (email && !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email)) {\n notify.error('Invalid email', 'Enter a valid email address, or leave it blank.');\n return;\n }\n\n const phone = form.phone.trim();\n if (phone) {\n const digitCount = (phone.match(/\\d/g) ?? []).length;\n if (digitCount < 7 || !/^[\\d+() .-]+$/.test(phone)) {\n notify.error('Invalid phone', 'Enter a valid phone number, or leave it blank.');\n return;\n }\n }\n\n const normalizedWebsite = safeUrl(form.website);\n if (form.website.trim() && !normalizedWebsite) {\n notify.error('Invalid website', 'Enter a valid http(s) URL, or leave it blank.');\n return;\n }\n\n const input = {\n fullName: form.fullName.trim(),\n title: form.title || null,\n organization: form.organization || null,\n email: form.email || null,\n phone: form.phone || null,\n bio: form.bio || null,\n avatarUrl: form.avatarUrl || null,\n socialLinks: normalizedWebsite ? { website: normalizedWebsite } : {},\n };\n\n try {\n if (isEdit) {\n const response = await updateSpeaker({ variables: { id, input } });\n if (!mutationSucceeded(response, response.data?.updateSpeaker?.id, 'Could not update speaker')) {\n return;\n }\n notify.success('Speaker updated');\n navigate('/speakers');\n return;\n }\n const response = await createSpeaker({ variables: { input } });\n if (!mutationSucceeded(response, response.data?.createSpeaker?.id, 'Could not create speaker')) {\n return;\n }\n notify.success('Speaker created');\n navigate('/speakers');\n } catch (error) {\n notify.error('Could not save speaker', describeError(error));\n }\n };\n\n const saving = creating || updating;\n\n return (\n <EntityFormShell\n title={isEdit ? 'Edit Speaker' : 'Add Speaker'}\n description=\"A person who presents sessions at your events.\"\n purpose=\"A speaker profile is what you attach to sessions and show to attendees. Capture who they are, where they work, and a short bio or talk abstract so the agenda tells a compelling story. The headshot appears anywhere the speaker is listed.\"\n backLabel=\"Back to Speakers\"\n onBack={() => navigate('/speakers')}\n onSubmit={onSubmit}\n submitLabel={headshotUploading ? 'Uploading headshot...' : 'Save Speaker'}\n saving={saving}\n submitDisabled={headshotUploading}\n >\n <div className=\"grid grid-cols-1 gap-4 md:grid-cols-2\">\n <label className=\"space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">\n Full name\n <span aria-hidden=\"true\" className=\"text-status-danger-text\">\n {' '}\n *\n </span>\n </span>\n <Input value={form.fullName} onChange={(e) => onChange('fullName', e.target.value)} required />\n </label>\n <label className=\"space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Title</span>\n <Input value={form.title} onChange={(e) => onChange('title', e.target.value)} placeholder=\"Head of Product\" />\n </label>\n </div>\n\n <div className=\"grid grid-cols-1 gap-4 md:grid-cols-3\">\n <label className=\"space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Company</span>\n <Input value={form.organization} onChange={(e) => onChange('organization', e.target.value)} />\n </label>\n <label className=\"space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Email</span>\n <Input type=\"email\" value={form.email} onChange={(e) => onChange('email', e.target.value)} />\n </label>\n <label className=\"space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Phone</span>\n <Input value={form.phone} onChange={(e) => onChange('phone', e.target.value)} />\n </label>\n </div>\n\n <div className=\"space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Headshot</span>\n <ImageUploadField\n label=\"Upload headshot\"\n folderPath=\"/EventfullyManaged/Speakers\"\n value={form.avatarUrl || null}\n onUploaded={(url) => onChange('avatarUrl', url)}\n onUploadingChange={setHeadshotUploading}\n hint=\"Stored securely in Files. Shown wherever the speaker is listed.\"\n />\n </div>\n\n <label className=\"block space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Bio &amp; talk abstract</span>\n <Textarea\n value={form.bio}\n onChange={(e) => onChange('bio', e.target.value)}\n rows={5}\n placeholder=\"Short professional bio and a summary of the talk they will give.\"\n />\n </label>\n\n <label className=\"block space-y-1 text-sm\">\n <span className=\"font-medium text-text-primary\">Website / profile URL</span>\n <Input value={form.website} onChange={(e) => onChange('website', e.target.value)} placeholder=\"https://…\" />\n </label>\n\n {isEdit ? <EntityTagsField entityType=\"EVENTFULLYMANAGED_SPEAKER\" entityId={id} /> : null}\n </EntityFormShell>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA0BA,IAAMA,IAAiC;CACrC,UAAU;CACV,OAAO;CACP,cAAc;CACd,OAAO;CACP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AS,EAAE,OAAO,KAAK;MAAI,CAAA,CACvF;;KACP,kBAAC,SAAD;MAAO,WAAU;MAAjB,UAAA,CACE,kBAAC,QAAD;OAAM,WAAU;OAAgC,UAAA;MAAW,CAAA,GAC3D,kBAACiB,GAAD;OAAO,OAAO3B,EAAK;OAAO,WAAW,MAAMU,EAAS,SAAS,EAAE,OAAO,KAAK;MAAI,CAAA,CAC1E;;IACJ;;GAEL,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAAC,QAAD;KAAM,WAAU;KAAgC,UAAA;IAAc,CAAA,GAC9D,kBAACkB,GAAD;KACE,OAAM;KACN,YAAW;KACX,OAAO5B,EAAK,aAAa;KACzB,aAAa,MAAQU,EAAS,aAAamB,CAAG;KAC9C,mBAAmBzB;KACnB,MAAK;IACN,CAAA,CACE;;GAEL,kBAAC,SAAD;IAAO,WAAU;IAAjB,UAAA,CACE,kBAAC,QAAD;KAAM,WAAU;KAAgC,UAAA;IAA6B,CAAA,GAC7E,kBAAC0B,GAAD;KACE,OAAO9B,EAAK;KACZ,WAAW,MAAMU,EAAS,OAAO,EAAE,OAAO,KAAK;KAC/C,MAAM;KACN,aAAY;IACb,CAAA,CACI;;GAEP,kBAAC,SAAD;IAAO,WAAU;IAAjB,UAAA,CACE,kBAAC,QAAD;KAAM,WAAU;KAAgC,UAAA;IAA2B,CAAA,GAC3E,kBAACiB,GAAD;KAAO,OAAO3B,EAAK;KAAS,WAAW,MAAMU,EAAS,WAAW,EAAE,OAAO,KAAK;KAAG,aAAY;IAAa,CAAA,CACtG;;GAENrB,IAAS,kBAAC0C,GAAD;IAAiB,YAAW;IAA4B,UAAUxC;GAAK,CAAA,IAAI;EACtE;;AAErB"}
@@ -101,7 +101,7 @@ function O() {
101
101
  } catch (e) {
102
102
  l.error("Could not save sponsor", s(e));
103
103
  }
104
- }, H = F || L, U = j?.events?.items ?? [];
104
+ }, [H, U] = f(!1), W = F || L, G = j?.events?.items ?? [];
105
105
  return /* @__PURE__ */ h("div", {
106
106
  className: "space-y-6 p-6",
107
107
  children: [
@@ -133,7 +133,7 @@ function O() {
133
133
  children: [/* @__PURE__ */ m(T, {
134
134
  "aria-label": "Event",
135
135
  children: /* @__PURE__ */ m(E, { placeholder: "Select Event" })
136
- }), /* @__PURE__ */ m(C, { children: U.map((e) => /* @__PURE__ */ m(w, {
136
+ }), /* @__PURE__ */ m(C, { children: G.map((e) => /* @__PURE__ */ m(w, {
137
137
  value: e.id,
138
138
  children: e.name
139
139
  }, e.id)) })]
@@ -234,6 +234,7 @@ function O() {
234
234
  folderPath: "/EventfullyManaged/Sponsors",
235
235
  value: R.logoUrl || null,
236
236
  onUploaded: (e) => B("logoUrl", e),
237
+ onUploadingChange: U,
237
238
  hint: "Stored securely in Files. Shown across sponsor listings and detail pages."
238
239
  })]
239
240
  }),
@@ -277,8 +278,8 @@ function O() {
277
278
  className: "flex justify-end",
278
279
  children: /* @__PURE__ */ h(v, {
279
280
  type: "submit",
280
- disabled: H,
281
- children: [/* @__PURE__ */ m(_, { className: "h-4 w-4" }), H ? "Saving..." : "Save Sponsor"]
281
+ disabled: W || H,
282
+ children: [/* @__PURE__ */ m(_, { className: "h-4 w-4" }), H ? "Uploading logo..." : W ? "Saving..." : "Save Sponsor"]
282
283
  })
283
284
  })
284
285
  ]