@fluid-app/portal-sdk 0.1.322 → 0.1.324

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.
Files changed (59) hide show
  1. package/dist/{AddressAutocompleteInput-BpbBARKk.mjs → AddressAutocompleteInput-CYWqjVql.mjs} +2 -2
  2. package/dist/{AddressAutocompleteInput-BpbBARKk.mjs.map → AddressAutocompleteInput-CYWqjVql.mjs.map} +1 -1
  3. package/dist/{AddressAutocompleteInput-DkFs_leA.cjs → AddressAutocompleteInput-DfwaaK0l.cjs} +2 -2
  4. package/dist/{AddressAutocompleteInput-DkFs_leA.cjs.map → AddressAutocompleteInput-DfwaaK0l.cjs.map} +1 -1
  5. package/dist/{ContactsScreen-DiGrOlwx.cjs → ContactsScreen-BYrRJ55W.cjs} +2 -2
  6. package/dist/{ContactsScreen-FELUSAZ_.mjs → ContactsScreen-D3_LQj6x.mjs} +2 -2
  7. package/dist/{ContactsScreen-FELUSAZ_.mjs.map → ContactsScreen-D3_LQj6x.mjs.map} +1 -1
  8. package/dist/{ContactsScreen-Cf0ShCew.cjs → ContactsScreen-Dm8b4SyY.cjs} +2 -2
  9. package/dist/{ContactsScreen-Cf0ShCew.cjs.map → ContactsScreen-Dm8b4SyY.cjs.map} +1 -1
  10. package/dist/{FluidProvider-BIeO1i4r.cjs → FluidProvider-BQjPCP_2.cjs} +4 -4
  11. package/dist/{FluidProvider-BIeO1i4r.cjs.map → FluidProvider-BQjPCP_2.cjs.map} +1 -1
  12. package/dist/{FluidProvider-LqejfvZ-.mjs → FluidProvider-DU-sFsZV.mjs} +4 -4
  13. package/dist/{FluidProvider-LqejfvZ-.mjs.map → FluidProvider-DU-sFsZV.mjs.map} +1 -1
  14. package/dist/{MessagingScreen-CQNNI4RN.cjs → MessagingScreen-CqxyLDp0.cjs} +4 -4
  15. package/dist/{MessagingScreen-BRcAo9ux.mjs → MessagingScreen-D33O66bU.mjs} +2 -2
  16. package/dist/{MessagingScreen-BRcAo9ux.mjs.map → MessagingScreen-D33O66bU.mjs.map} +1 -1
  17. package/dist/{MessagingScreen-BBkqLkcx.cjs → MessagingScreen-XtYpo1RQ.cjs} +2 -2
  18. package/dist/{MessagingScreen-BBkqLkcx.cjs.map → MessagingScreen-XtYpo1RQ.cjs.map} +1 -1
  19. package/dist/{MessagingScreen-y3AG96Gi.mjs → MessagingScreen-a58Uccvz.mjs} +4 -4
  20. package/dist/{OrdersScreen-BgcQi5Re.cjs → OrdersScreen-BAvQ38bA.cjs} +4 -4
  21. package/dist/{OrdersScreen-Do7YtBiu.mjs → OrdersScreen-BIjN8-_y.mjs} +2 -2
  22. package/dist/{OrdersScreen-Do7YtBiu.mjs.map → OrdersScreen-BIjN8-_y.mjs.map} +1 -1
  23. package/dist/{OrdersScreen-DISwVljS.mjs → OrdersScreen-BmwgXoqb.mjs} +4 -4
  24. package/dist/{OrdersScreen-CZIlrF_M.cjs → OrdersScreen-CgYMIsbc.cjs} +2 -2
  25. package/dist/{OrdersScreen-CZIlrF_M.cjs.map → OrdersScreen-CgYMIsbc.cjs.map} +1 -1
  26. package/dist/{ProfileScreen-Chk8YkMW.mjs → ProfileScreen--fDK5YsG.mjs} +3 -3
  27. package/dist/{ProfileScreen-Chk8YkMW.mjs.map → ProfileScreen--fDK5YsG.mjs.map} +1 -1
  28. package/dist/{ProfileScreen-DZFMc4E9.mjs → ProfileScreen-BIb54IBH.mjs} +5 -5
  29. package/dist/{ProfileScreen-C3zOvEhX.cjs → ProfileScreen-Bhl7VJj1.cjs} +3 -3
  30. package/dist/{ProfileScreen-C3zOvEhX.cjs.map → ProfileScreen-Bhl7VJj1.cjs.map} +1 -1
  31. package/dist/{ProfileScreen-CxOJ1D3H.cjs → ProfileScreen-DsYyPXQj.cjs} +5 -5
  32. package/dist/{ShopScreen-uOMi-jFD.mjs → ShopScreen-B4_2T5Nd.mjs} +2 -2
  33. package/dist/{ShopScreen-uOMi-jFD.mjs.map → ShopScreen-B4_2T5Nd.mjs.map} +1 -1
  34. package/dist/{ShopScreen-CjrEStJc.cjs → ShopScreen-CPTXTr7p.cjs} +2 -2
  35. package/dist/{ShopScreen-CjrEStJc.cjs.map → ShopScreen-CPTXTr7p.cjs.map} +1 -1
  36. package/dist/{ShopScreen-C4vXayCp.mjs → ShopScreen-CvZGzOUd.mjs} +4 -4
  37. package/dist/{ShopScreen-DM9jxl3w.cjs → ShopScreen-DVLxDFpf.cjs} +4 -4
  38. package/dist/{SubscriptionsScreen-CyL91O4w.cjs → SubscriptionsScreen-7ZH1s3eK.cjs} +21 -20
  39. package/dist/SubscriptionsScreen-7ZH1s3eK.cjs.map +1 -0
  40. package/dist/{SubscriptionsScreen-u_q5j115.mjs → SubscriptionsScreen-BcIUZf50.mjs} +21 -20
  41. package/dist/SubscriptionsScreen-BcIUZf50.mjs.map +1 -0
  42. package/dist/{SubscriptionsScreen-93eTwtFE.cjs → SubscriptionsScreen-CVHJ08si.cjs} +5 -5
  43. package/dist/{SubscriptionsScreen-8cPR9vpX.mjs → SubscriptionsScreen-CwseYMy5.mjs} +5 -5
  44. package/dist/{ToDoWidget-sLWwJJ_g.mjs → ToDoWidget-CShnzkw4.mjs} +3 -3
  45. package/dist/ToDoWidget-CShnzkw4.mjs.map +1 -0
  46. package/dist/{ToDoWidget-C9qX7raE.cjs → ToDoWidget-CevskOb8.cjs} +2 -2
  47. package/dist/{ToDoWidget-CImAWF3O.cjs → ToDoWidget-DA_kLqvP.cjs} +3 -3
  48. package/dist/ToDoWidget-DA_kLqvP.cjs.map +1 -0
  49. package/dist/index.cjs +22 -22
  50. package/dist/index.mjs +22 -22
  51. package/dist/{task-composer-form-ChwUNk1I.mjs → task-composer-form-CHyQZUCo.mjs} +3 -2
  52. package/dist/{task-composer-form-ChwUNk1I.mjs.map → task-composer-form-CHyQZUCo.mjs.map} +1 -1
  53. package/dist/{task-composer-form-DnRjQmkv.cjs → task-composer-form-D9KhWUI1.cjs} +3 -2
  54. package/dist/{task-composer-form-DnRjQmkv.cjs.map → task-composer-form-D9KhWUI1.cjs.map} +1 -1
  55. package/package.json +14 -14
  56. package/dist/SubscriptionsScreen-CyL91O4w.cjs.map +0 -1
  57. package/dist/SubscriptionsScreen-u_q5j115.mjs.map +0 -1
  58. package/dist/ToDoWidget-CImAWF3O.cjs.map +0 -1
  59. package/dist/ToDoWidget-sLWwJJ_g.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"task-composer-form-ChwUNk1I.mjs","names":[],"sources":["../../../platform/api-client-core/src/parse-api-errors.ts","../../../contacts/core/src/contacts-api-context.ts","../../../contacts/core/src/translation-api-context.ts","../../../contacts/core/src/parse-task-body.ts","../../../contacts/core/src/query-keys.ts","../../../contacts/core/src/hooks/use-infinite-contacts.ts","../../../contacts/core/src/iso-date.ts","../../../contacts/ui/src/portal/hooks/contacts/use-create-contact-task.ts","../../../contacts/ui/src/portal/components/tasks/task-composer-form.tsx"],"sourcesContent":["/**\n * Framework-agnostic API error parsing utilities.\n *\n * Extracts structured field-level errors from API responses and formats\n * them into human-readable messages. Works with ApiError from this package\n * as well as any error object that has `status`, `data`, and optional `message`.\n */\n\n/**\n * Converts snake_case or camelCase field names to Title Case\n */\nexport function formatFieldName(field: string): string {\n return field\n .replace(/_/g, \" \")\n .replace(/([A-Z])/g, \" $1\")\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(\" \")\n .trim();\n}\n\nexport interface ParsedFieldError {\n field: string;\n messages: string[];\n}\n\n/**\n * Type guard to check if an error looks like an API error\n */\nexport function isApiLikeError(\n error: unknown,\n): error is { message: string | undefined; status: number; data: unknown } {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n\n const err = error as Record<string, unknown>;\n return (\n typeof err.status === \"number\" &&\n \"data\" in err &&\n (typeof err.message === \"string\" || err.message === undefined)\n );\n}\n\n/**\n * Extracts field-level errors from API error data\n */\nexport function extractFieldErrors(data: unknown): ParsedFieldError[] {\n const errors: ParsedFieldError[] = [];\n\n if (!data || typeof data !== \"object\") {\n return errors;\n }\n\n const errorObj = data as Record<string, unknown>;\n\n for (const [key, value] of Object.entries(errorObj)) {\n if (Array.isArray(value) && value.length > 0) {\n errors.push({\n field: formatFieldName(key),\n messages: value.map((item) =>\n typeof item === \"string\" ? item : JSON.stringify(item),\n ),\n });\n } else if (typeof value === \"string\" && value.length > 0) {\n errors.push({\n field: formatFieldName(key),\n messages: [value],\n });\n } else if (value && typeof value === \"object\" && !Array.isArray(value)) {\n const nestedErrors = extractFieldErrors(value);\n nestedErrors.forEach((nestedError) => {\n errors.push({\n field: `${formatFieldName(key)} → ${nestedError.field}`,\n messages: nestedError.messages,\n });\n });\n }\n }\n\n return errors;\n}\n\n/**\n * Formats field errors into a readable description string\n */\nexport function formatErrorDescription(errors: ParsedFieldError[]): string {\n if (errors.length === 0) {\n return \"\";\n }\n\n if (errors.length === 1) {\n const err = errors[0];\n if (!err) return \"\";\n const message = err.messages[0] || \"is invalid\";\n return `${err.field} ${message}`;\n }\n\n if (errors.length <= 3) {\n return errors\n .map((e) => `${e.field} ${e.messages[0] || \"is invalid\"}`)\n .join(\"\\n\");\n }\n\n const shown = errors\n .slice(0, 3)\n .map((e) => `${e.field} ${e.messages[0] || \"is invalid\"}`)\n .join(\"\\n\");\n const remaining = errors.length - 3;\n return `${shown}\\n...and ${remaining} more ${remaining === 1 ? \"error\" : \"errors\"}`;\n}\n\n/**\n * Parses an error and returns a human-readable description string.\n *\n * Handles:\n * - API-like errors with structured field-level data\n * - API-like errors with a top-level message\n * - Standard Error instances\n * - Falls back to the provided fallback string\n *\n * @param error - The error to parse (ApiError, Error, or unknown)\n * @param fallback - Optional fallback description if error cannot be parsed\n * @returns A human-readable error description, or undefined if nothing could be extracted\n */\nexport function parseApiErrors(\n error: unknown,\n fallback?: string,\n): string | undefined {\n if (isApiLikeError(error)) {\n if (error.data) {\n const fieldErrors = extractFieldErrors(error.data);\n if (fieldErrors.length > 0) {\n return formatErrorDescription(fieldErrors);\n }\n }\n\n if (error.message) {\n return error.message;\n }\n } else if (error instanceof Error) {\n return error.message;\n }\n\n return fallback;\n}\n","import { createContext, useContext } from \"react\";\nimport type { ContactsApi } from \"./contacts-api\";\nimport type { NotesApi } from \"./notes-api\";\nimport type { TasksApi } from \"./tasks-api\";\nimport type { GroupsApi } from \"./groups-api\";\n\nexport interface ContactsDomainApi {\n contacts: ContactsApi;\n notes: NotesApi;\n tasks: TasksApi;\n groups?: GroupsApi;\n}\n\nconst ContactsApiContext = createContext<ContactsDomainApi | null>(null);\n\nexport const ContactsApiProvider = ContactsApiContext.Provider;\n\nexport function useContactsDomainApi(): ContactsDomainApi {\n const api = useContext(ContactsApiContext);\n if (!api) {\n throw new Error(\n \"useContactsDomainApi must be used within a ContactsApiProvider\",\n );\n }\n return api;\n}\n\nexport function useContactsCrud(): ContactsApi {\n return useContactsDomainApi().contacts;\n}\n\nexport function useNotesApi(): NotesApi {\n return useContactsDomainApi().notes;\n}\n\nexport function useTasksApi(): TasksApi {\n return useContactsDomainApi().tasks;\n}\n\n/** Returns GroupsApi if the provider supplies one, otherwise null. */\nexport function useGroupsApi(): GroupsApi | null {\n return useContactsDomainApi().groups ?? null;\n}\n","import type { Provider } from \"react\";\nimport { createTranslationContext } from \"@fluid-app/i18n/translation-api-context-factory\";\nimport type { TranslationApi } from \"@fluid-app/i18n/translation-api\";\nimport type { ContactsDict } from \"./translation-dictionary\";\n\nconst { Provider: ContactsProvider, useTranslation } =\n createTranslationContext<ContactsDict>(\"Contacts\");\n\nexport const ContactsTranslationProvider: Provider<TranslationApi<ContactsDict> | null> =\n ContactsProvider;\nexport const useContactsTranslation = useTranslation;\n","/**\n * Tasks store both a title (first line) and an optional body separated by a\n * blank line. This is the canonical convention used by the task editor and\n * by every consumer that displays tasks (contacts UI list, portal todo\n * widget). Drift across consumers would mean some surfaces show \"Title\\n\\n\n * body details\" verbatim while others split correctly — keep the delimiter\n * convention in one place.\n */\nexport function parseTaskBody(raw: string): { title: string; body: string } {\n const split = raw.indexOf(\"\\n\\n\");\n if (split >= 0) {\n return {\n title: raw.slice(0, split),\n body: raw.slice(split + 2),\n };\n }\n return { title: raw, body: \"\" };\n}\n","export const CONTACTS_QUERY_KEYS = {\n all: (prefix: string) => [prefix] as const,\n list: (prefix: string) =>\n [...CONTACTS_QUERY_KEYS.all(prefix), \"list\"] as const,\n detail: (prefix: string, id: string) =>\n [...CONTACTS_QUERY_KEYS.all(prefix), \"detail\", id] as const,\n} as const;\n\nexport const contactsKeys = {\n activities: (contactId: string) =>\n [\"portal-contacts\", \"activities\", contactId] as const,\n tasks: (contactId: string) =>\n [\"portal-contacts\", \"tasks\", contactId] as const,\n notes: (contactId: string) =>\n [\"portal-contacts\", \"notes\", contactId] as const,\n orders: (contactId: string) => [\"rep-contacts\", \"orders\", contactId] as const,\n subscriptionOrders: (contactId: string) =>\n [\"rep-contacts\", \"subscription-orders\", contactId] as const,\n groups: () => [\"portal-contacts\", \"groups\"] as const,\n} as const;\n","import { useInfiniteQuery } from \"@tanstack/react-query\";\nimport { useContactsCrud } from \"../contacts-api-context\";\nimport { CONTACTS_QUERY_KEYS } from \"../query-keys\";\n\nexport interface UseInfiniteContactsParams {\n search_query?: string;\n status?: string;\n sort_by?: string;\n sort_direction?: string;\n per_page?: number;\n tags?: string[];\n}\n\nexport function useInfiniteContacts(params: UseInfiniteContactsParams) {\n const api = useContactsCrud();\n return useInfiniteQuery({\n queryKey: [...CONTACTS_QUERY_KEYS.list(\"contacts\"), params],\n queryFn: ({ pageParam }) =>\n api.listContacts({\n ...params,\n page: pageParam,\n }),\n getNextPageParam: (lastPage) => {\n const currentPage = lastPage.meta.current_page;\n // Contacts API is page-number based; next_cursor and total_pages\n // are both used as \"has-next-page\" signals.\n if (currentPage == null) return undefined;\n if (lastPage.meta.next_cursor) return currentPage + 1;\n if (\n lastPage.meta.total_pages != null &&\n currentPage < lastPage.meta.total_pages\n ) {\n return currentPage + 1;\n }\n return undefined;\n },\n initialPageParam: 1,\n });\n}\n","/**\n * Format a date as YYYY-MM-DD in the renderer's local timezone, optionally\n * shifted by `offsetDays`. Use this for due-date inputs where \"today\" must\n * resolve to the user's local calendar date — never `toISOString().slice(0, 10)`,\n * which returns the UTC date and silently rolls over a day for users east/west\n * of UTC at the wrong hours.\n */\nexport function isoDate(offsetDays: number, now: Date = new Date()): string {\n const d = new Date(now);\n d.setDate(d.getDate() + offsetDays);\n const yyyy = d.getFullYear();\n const mm = String(d.getMonth() + 1).padStart(2, \"0\");\n const dd = String(d.getDate()).padStart(2, \"0\");\n return `${yyyy}-${mm}-${dd}`;\n}\n\n/**\n * Return a Date pinned to local midnight of the calendar day represented by\n * `input`. Use this whenever you need to compare two due dates by calendar day\n * (overdue / today / tomorrow / future).\n *\n * Why not just `new Date(input)`? `new Date(\"YYYY-MM-DD\")` parses the string\n * as UTC midnight, which lands on the *previous* calendar day in any UTC−\n * timezone — a task due \"May 1\" then reads as April 30 for a user in the\n * Americas, classifying it as \"Overdue\" all day. Parse the date components\n * directly so the calendar-day intent of the string is preserved.\n */\nexport function startOfLocalDay(input: Date | string): Date {\n if (typeof input === \"string\") {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})/.exec(input);\n if (match?.[1] && match[2] && match[3]) {\n return new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n }\n }\n const d = typeof input === \"string\" ? new Date(input) : input;\n return new Date(d.getFullYear(), d.getMonth(), d.getDate());\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { fluidToast } from \"@fluid-app/ui-primitives\";\nimport { parseApiErrors } from \"@fluid-app/api-client-core\";\nimport { useTasksApi } from \"@fluid-app/contacts-core/contacts-api-context\";\nimport { contactsKeys } from \"@fluid-app/contacts-core/query-keys\";\nimport type { CreateTaskInput } from \"@fluid-app/contacts-core/types\";\n\nexport type { CreateTaskInput };\n\nexport function useCreateContactTask(\n contactId: string,\n options?: { onSuccess?: () => void },\n) {\n const queryClient = useQueryClient();\n const api = useTasksApi();\n\n return useMutation({\n mutationFn: (input: CreateTaskInput) => api.createTask(contactId, input),\n onSuccess: () => {\n fluidToast({ title: \"Task created\", type: \"success\" });\n queryClient.invalidateQueries({\n queryKey: contactsKeys.tasks(contactId),\n });\n options?.onSuccess?.();\n },\n onError: (error) => {\n fluidToast({\n title: \"Failed to create task\",\n type: \"error\",\n description: parseApiErrors(error),\n });\n },\n });\n}\n","\"use client\";\n\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"@fluid-app/ui-primitives\";\nimport { useContactsTranslation } from \"@fluid-app/contacts-core/translation-api-context\";\nimport { isoDate } from \"@fluid-app/contacts-core/iso-date\";\nimport { useCreateContactTask } from \"../../hooks/contacts/use-create-contact-task\";\n\nconst QUICK_DATES = [\n { key: \"today\", offsetDays: 0 },\n { key: \"tomorrow\", offsetDays: 1 },\n { key: \"next_week\", offsetDays: 7 },\n] as const;\n\nexport interface TaskComposerFormProps {\n contactId: string;\n /** Called after a successful create. */\n onDone?: () => void;\n /** When provided, an X button is rendered and Escape closes the form. */\n onClose?: () => void;\n /** Focus the body input on mount. Default true. */\n autoFocus?: boolean;\n}\n\nexport function TaskComposerForm({\n contactId,\n onDone,\n onClose,\n autoFocus = true,\n}: TaskComposerFormProps): React.JSX.Element {\n const { t } = useContactsTranslation();\n const [body, setBody] = useState(\"\");\n const [dueDate, setDueDate] = useState<string | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const createTask = useCreateContactTask(contactId, {\n onSuccess: () => {\n setBody(\"\");\n setDueDate(null);\n onDone?.();\n },\n });\n\n useEffect(() => {\n if (autoFocus) inputRef.current?.focus();\n }, [autoFocus]);\n\n // Compute the date strings once per mount. Re-running on every render would\n // re-evaluate `new Date()` and could flip \"today\" if the form happens to be\n // open across midnight — acceptable but unnecessary churn.\n const quickDates = useMemo(\n () =>\n QUICK_DATES.map((q) => ({\n key: q.key,\n iso: isoDate(q.offsetDays),\n })),\n [],\n );\n\n const quickLabels: Record<(typeof QUICK_DATES)[number][\"key\"], string> = {\n today: t(\"quick_today\"),\n tomorrow: t(\"quick_tomorrow\"),\n next_week: t(\"quick_next_week\"),\n };\n\n const submit = () => {\n const trimmed = body.trim();\n if (!trimmed || createTask.isPending) return;\n createTask.mutate({ body: trimmed, due_at: dueDate });\n };\n\n const canSubmit = body.trim().length > 0 && !createTask.isPending;\n\n return (\n <div className=\"border-border/50 focus-within:border-foreground/30 rounded-xl border p-3 transition-colors\">\n <div className=\"flex items-start gap-3\">\n <div\n className=\"border-muted-foreground/50 mt-1.5 size-5 shrink-0 rounded-full border-2\"\n aria-hidden=\"true\"\n />\n <input\n ref={inputRef}\n value={body}\n onChange={(e) => setBody(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n submit();\n } else if (e.key === \"Escape\" && onClose) {\n e.preventDefault();\n onClose();\n }\n }}\n placeholder={t(\"task_describe_placeholder\")}\n aria-label={t(\"task_description_aria\")}\n className=\"placeholder:text-muted-foreground/80 text-foreground flex-1 border-0 bg-transparent text-sm font-medium outline-none\"\n />\n {onClose && (\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={t(\"task_discard_aria\")}\n className=\"text-muted-foreground hover:bg-muted hover:text-foreground -mt-0.5 -mr-0.5 flex size-7 shrink-0 items-center justify-center rounded-md transition-colors\"\n >\n <X className=\"size-4\" />\n </button>\n )}\n </div>\n\n <div className=\"mt-3 flex items-center gap-1.5 pl-8\">\n {quickDates.map((q) => {\n const isActive = dueDate === q.iso;\n return (\n <button\n key={q.key}\n type=\"button\"\n onClick={() => setDueDate(isActive ? null : q.iso)}\n aria-pressed={isActive}\n className={cn(\n \"shrink-0 rounded-full px-3 py-1 text-xs font-medium transition-colors\",\n isActive\n ? \"bg-primary text-primary-foreground\"\n : \"bg-muted text-muted-foreground hover:bg-muted/70\",\n )}\n >\n {quickLabels[q.key]}\n </button>\n );\n })}\n <div className=\"ml-auto\" />\n <button\n type=\"button\"\n onClick={submit}\n disabled={!canSubmit}\n className=\"bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground inline-flex shrink-0 items-center gap-1.5 rounded-full px-4 py-1.5 text-xs font-semibold transition-colors disabled:cursor-not-allowed\"\n >\n {createTask.isPending ? t(\"adding\") : t(\"add_task\")}\n </button>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAWA,SAAgB,gBAAgB,OAAuB;AACrD,QAAO,MACJ,QAAQ,MAAM,IAAI,CAClB,QAAQ,YAAY,MAAM,CAC1B,MAAM,IAAI,CACV,KAAK,SAAS,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE,CAAC,aAAa,CAAC,CACzE,KAAK,IAAI,CACT,MAAM;;;;;AAWX,SAAgB,eACd,OACyE;AACzE,KAAI,CAAC,SAAS,OAAO,UAAU,SAC7B,QAAO;CAGT,MAAM,MAAM;AACZ,QACE,OAAO,IAAI,WAAW,YACtB,UAAU,QACT,OAAO,IAAI,YAAY,YAAY,IAAI,YAAY,KAAA;;;;;AAOxD,SAAgB,mBAAmB,MAAmC;CACpE,MAAM,SAA6B,EAAE;AAErC,KAAI,CAAC,QAAQ,OAAO,SAAS,SAC3B,QAAO;CAGT,MAAM,WAAW;AAEjB,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,SAAS,CACjD,KAAI,MAAM,QAAQ,MAAM,IAAI,MAAM,SAAS,EACzC,QAAO,KAAK;EACV,OAAO,gBAAgB,IAAI;EAC3B,UAAU,MAAM,KAAK,SACnB,OAAO,SAAS,WAAW,OAAO,KAAK,UAAU,KAAK,CACvD;EACF,CAAC;UACO,OAAO,UAAU,YAAY,MAAM,SAAS,EACrD,QAAO,KAAK;EACV,OAAO,gBAAgB,IAAI;EAC3B,UAAU,CAAC,MAAM;EAClB,CAAC;UACO,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,MAAM,CAC/C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,WAAW,CAAC,EAAE,UAAU;AACpC,SAAE,gBAAgB;AAClB,eAAQ;iBACC,EAAE,QAAQ,YAAY,SAAS;AACxC,SAAE,gBAAgB;AAClB,gBAAS;;;KAGb,aAAa,EAAE,4BAA4B;KAC3C,cAAY,EAAE,wBAAwB;KACtC,WAAU;KACV,CAAA;IACD,WACC,oBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,cAAY,EAAE,oBAAoB;KAClC,WAAU;eAEV,oBAAC,GAAD,EAAG,WAAU,UAAW,CAAA;KACjB,CAAA;IAEP;MAEN,qBAAC,OAAD;GAAK,WAAU;aAAf;IACG,WAAW,KAAK,MAAM;KACrB,MAAM,WAAW,YAAY,EAAE;AAC/B,YACE,oBAAC,UAAD;MAEE,MAAK;MACL,eAAe,WAAW,WAAW,OAAO,EAAE,IAAI;MAClD,gBAAc;MACd,WAAW,GACT,yEACA,WACI,uCACA,mDACL;gBAEA,YAAY,EAAE;MACR,EAZF,EAAE,IAYA;MAEX;IACF,oBAAC,OAAD,EAAK,WAAU,WAAY,CAAA;IAC3B,oBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,UAAU,CAAC;KACX,WAAU;eAET,WAAW,YAAY,EAAE,SAAS,GAAG,EAAE,WAAW;KAC5C,CAAA;IACL;KACF"}
1
+ {"version":3,"file":"task-composer-form-CHyQZUCo.mjs","names":[],"sources":["../../../platform/api-client-core/src/parse-api-errors.ts","../../../contacts/core/src/contacts-api-context.ts","../../../contacts/core/src/translation-api-context.ts","../../../contacts/core/src/parse-task-body.ts","../../../contacts/core/src/query-keys.ts","../../../contacts/core/src/hooks/use-infinite-contacts.ts","../../../contacts/core/src/iso-date.ts","../../../contacts/ui/src/portal/hooks/contacts/use-create-contact-task.ts","../../../contacts/ui/src/portal/components/tasks/task-composer-form.tsx"],"sourcesContent":["/**\n * Framework-agnostic API error parsing utilities.\n *\n * Extracts structured field-level errors from API responses and formats\n * them into human-readable messages. Works with ApiError from this package\n * as well as any error object that has `status`, `data`, and optional `message`.\n */\n\n/**\n * Converts snake_case or camelCase field names to Title Case\n */\nexport function formatFieldName(field: string): string {\n return field\n .replace(/_/g, \" \")\n .replace(/([A-Z])/g, \" $1\")\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(\" \")\n .trim();\n}\n\nexport interface ParsedFieldError {\n field: string;\n messages: string[];\n}\n\n/**\n * Type guard to check if an error looks like an API error\n */\nexport function isApiLikeError(\n error: unknown,\n): error is { message: string | undefined; status: number; data: unknown } {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n\n const err = error as Record<string, unknown>;\n return (\n typeof err.status === \"number\" &&\n \"data\" in err &&\n (typeof err.message === \"string\" || err.message === undefined)\n );\n}\n\n/**\n * Extracts field-level errors from API error data\n */\nexport function extractFieldErrors(data: unknown): ParsedFieldError[] {\n const errors: ParsedFieldError[] = [];\n\n if (!data || typeof data !== \"object\") {\n return errors;\n }\n\n const errorObj = data as Record<string, unknown>;\n\n for (const [key, value] of Object.entries(errorObj)) {\n if (Array.isArray(value) && value.length > 0) {\n errors.push({\n field: formatFieldName(key),\n messages: value.map((item) =>\n typeof item === \"string\" ? item : JSON.stringify(item),\n ),\n });\n } else if (typeof value === \"string\" && value.length > 0) {\n errors.push({\n field: formatFieldName(key),\n messages: [value],\n });\n } else if (value && typeof value === \"object\" && !Array.isArray(value)) {\n const nestedErrors = extractFieldErrors(value);\n nestedErrors.forEach((nestedError) => {\n errors.push({\n field: `${formatFieldName(key)} → ${nestedError.field}`,\n messages: nestedError.messages,\n });\n });\n }\n }\n\n return errors;\n}\n\n/**\n * Formats field errors into a readable description string\n */\nexport function formatErrorDescription(errors: ParsedFieldError[]): string {\n if (errors.length === 0) {\n return \"\";\n }\n\n if (errors.length === 1) {\n const err = errors[0];\n if (!err) return \"\";\n const message = err.messages[0] || \"is invalid\";\n return `${err.field} ${message}`;\n }\n\n if (errors.length <= 3) {\n return errors\n .map((e) => `${e.field} ${e.messages[0] || \"is invalid\"}`)\n .join(\"\\n\");\n }\n\n const shown = errors\n .slice(0, 3)\n .map((e) => `${e.field} ${e.messages[0] || \"is invalid\"}`)\n .join(\"\\n\");\n const remaining = errors.length - 3;\n return `${shown}\\n...and ${remaining} more ${remaining === 1 ? \"error\" : \"errors\"}`;\n}\n\n/**\n * Parses an error and returns a human-readable description string.\n *\n * Handles:\n * - API-like errors with structured field-level data\n * - API-like errors with a top-level message\n * - Standard Error instances\n * - Falls back to the provided fallback string\n *\n * @param error - The error to parse (ApiError, Error, or unknown)\n * @param fallback - Optional fallback description if error cannot be parsed\n * @returns A human-readable error description, or undefined if nothing could be extracted\n */\nexport function parseApiErrors(\n error: unknown,\n fallback?: string,\n): string | undefined {\n if (isApiLikeError(error)) {\n if (error.data) {\n const fieldErrors = extractFieldErrors(error.data);\n if (fieldErrors.length > 0) {\n return formatErrorDescription(fieldErrors);\n }\n }\n\n if (error.message) {\n return error.message;\n }\n } else if (error instanceof Error) {\n return error.message;\n }\n\n return fallback;\n}\n","import { createContext, useContext } from \"react\";\nimport type { ContactsApi } from \"./contacts-api\";\nimport type { NotesApi } from \"./notes-api\";\nimport type { TasksApi } from \"./tasks-api\";\nimport type { GroupsApi } from \"./groups-api\";\n\nexport interface ContactsDomainApi {\n contacts: ContactsApi;\n notes: NotesApi;\n tasks: TasksApi;\n groups?: GroupsApi;\n}\n\nconst ContactsApiContext = createContext<ContactsDomainApi | null>(null);\n\nexport const ContactsApiProvider = ContactsApiContext.Provider;\n\nexport function useContactsDomainApi(): ContactsDomainApi {\n const api = useContext(ContactsApiContext);\n if (!api) {\n throw new Error(\n \"useContactsDomainApi must be used within a ContactsApiProvider\",\n );\n }\n return api;\n}\n\nexport function useContactsCrud(): ContactsApi {\n return useContactsDomainApi().contacts;\n}\n\nexport function useNotesApi(): NotesApi {\n return useContactsDomainApi().notes;\n}\n\nexport function useTasksApi(): TasksApi {\n return useContactsDomainApi().tasks;\n}\n\n/** Returns GroupsApi if the provider supplies one, otherwise null. */\nexport function useGroupsApi(): GroupsApi | null {\n return useContactsDomainApi().groups ?? null;\n}\n","import type { Provider } from \"react\";\nimport { createTranslationContext } from \"@fluid-app/i18n/translation-api-context-factory\";\nimport type { TranslationApi } from \"@fluid-app/i18n/translation-api\";\nimport type { ContactsDict } from \"./translation-dictionary\";\n\nconst { Provider: ContactsProvider, useTranslation } =\n createTranslationContext<ContactsDict>(\"Contacts\");\n\nexport const ContactsTranslationProvider: Provider<TranslationApi<ContactsDict> | null> =\n ContactsProvider;\nexport const useContactsTranslation = useTranslation;\n","/**\n * Tasks store both a title (first line) and an optional body separated by a\n * blank line. This is the canonical convention used by the task editor and\n * by every consumer that displays tasks (contacts UI list, portal todo\n * widget). Drift across consumers would mean some surfaces show \"Title\\n\\n\n * body details\" verbatim while others split correctly — keep the delimiter\n * convention in one place.\n */\nexport function parseTaskBody(raw: string): { title: string; body: string } {\n const split = raw.indexOf(\"\\n\\n\");\n if (split >= 0) {\n return {\n title: raw.slice(0, split),\n body: raw.slice(split + 2),\n };\n }\n return { title: raw, body: \"\" };\n}\n","export const CONTACTS_QUERY_KEYS = {\n all: (prefix: string) => [prefix] as const,\n list: (prefix: string) =>\n [...CONTACTS_QUERY_KEYS.all(prefix), \"list\"] as const,\n detail: (prefix: string, id: string) =>\n [...CONTACTS_QUERY_KEYS.all(prefix), \"detail\", id] as const,\n} as const;\n\nexport const contactsKeys = {\n activities: (contactId: string) =>\n [\"portal-contacts\", \"activities\", contactId] as const,\n tasks: (contactId: string) =>\n [\"portal-contacts\", \"tasks\", contactId] as const,\n notes: (contactId: string) =>\n [\"portal-contacts\", \"notes\", contactId] as const,\n orders: (contactId: string) => [\"rep-contacts\", \"orders\", contactId] as const,\n subscriptionOrders: (contactId: string) =>\n [\"rep-contacts\", \"subscription-orders\", contactId] as const,\n groups: () => [\"portal-contacts\", \"groups\"] as const,\n} as const;\n","import { useInfiniteQuery } from \"@tanstack/react-query\";\nimport { useContactsCrud } from \"../contacts-api-context\";\nimport { CONTACTS_QUERY_KEYS } from \"../query-keys\";\n\nexport interface UseInfiniteContactsParams {\n search_query?: string;\n status?: string;\n sort_by?: string;\n sort_direction?: string;\n per_page?: number;\n tags?: string[];\n}\n\nexport function useInfiniteContacts(params: UseInfiniteContactsParams) {\n const api = useContactsCrud();\n return useInfiniteQuery({\n queryKey: [...CONTACTS_QUERY_KEYS.list(\"contacts\"), params],\n queryFn: ({ pageParam }) =>\n api.listContacts({\n ...params,\n page: pageParam,\n }),\n getNextPageParam: (lastPage) => {\n const currentPage = lastPage.meta.current_page;\n // Contacts API is page-number based; next_cursor and total_pages\n // are both used as \"has-next-page\" signals.\n if (currentPage == null) return undefined;\n if (lastPage.meta.next_cursor) return currentPage + 1;\n if (\n lastPage.meta.total_pages != null &&\n currentPage < lastPage.meta.total_pages\n ) {\n return currentPage + 1;\n }\n return undefined;\n },\n initialPageParam: 1,\n });\n}\n","/**\n * Format a date as YYYY-MM-DD in the renderer's local timezone, optionally\n * shifted by `offsetDays`. Use this for due-date inputs where \"today\" must\n * resolve to the user's local calendar date — never `toISOString().slice(0, 10)`,\n * which returns the UTC date and silently rolls over a day for users east/west\n * of UTC at the wrong hours.\n */\nexport function isoDate(offsetDays: number, now: Date = new Date()): string {\n const d = new Date(now);\n d.setDate(d.getDate() + offsetDays);\n const yyyy = d.getFullYear();\n const mm = String(d.getMonth() + 1).padStart(2, \"0\");\n const dd = String(d.getDate()).padStart(2, \"0\");\n return `${yyyy}-${mm}-${dd}`;\n}\n\n/**\n * Return a Date pinned to local midnight of the calendar day represented by\n * `input`. Use this whenever you need to compare two due dates by calendar day\n * (overdue / today / tomorrow / future).\n *\n * Why not just `new Date(input)`? `new Date(\"YYYY-MM-DD\")` parses the string\n * as UTC midnight, which lands on the *previous* calendar day in any UTC−\n * timezone — a task due \"May 1\" then reads as April 30 for a user in the\n * Americas, classifying it as \"Overdue\" all day. Parse the date components\n * directly so the calendar-day intent of the string is preserved.\n */\nexport function startOfLocalDay(input: Date | string): Date {\n if (typeof input === \"string\") {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})/.exec(input);\n if (match?.[1] && match[2] && match[3]) {\n return new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n }\n }\n const d = typeof input === \"string\" ? new Date(input) : input;\n return new Date(d.getFullYear(), d.getMonth(), d.getDate());\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { fluidToast } from \"@fluid-app/ui-primitives\";\nimport { parseApiErrors } from \"@fluid-app/api-client-core\";\nimport { useTasksApi } from \"@fluid-app/contacts-core/contacts-api-context\";\nimport { contactsKeys } from \"@fluid-app/contacts-core/query-keys\";\nimport type { CreateTaskInput } from \"@fluid-app/contacts-core/types\";\n\nexport type { CreateTaskInput };\n\nexport function useCreateContactTask(\n contactId: string,\n options?: { onSuccess?: () => void },\n) {\n const queryClient = useQueryClient();\n const api = useTasksApi();\n\n return useMutation({\n mutationFn: (input: CreateTaskInput) => api.createTask(contactId, input),\n onSuccess: () => {\n fluidToast({ title: \"Task created\", type: \"success\" });\n queryClient.invalidateQueries({\n queryKey: contactsKeys.tasks(contactId),\n });\n options?.onSuccess?.();\n },\n onError: (error) => {\n const description = parseApiErrors(error);\n fluidToast({\n title: \"Failed to create task\",\n type: \"error\",\n ...(description ? { description } : {}),\n });\n },\n });\n}\n","\"use client\";\n\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"@fluid-app/ui-primitives\";\nimport { useContactsTranslation } from \"@fluid-app/contacts-core/translation-api-context\";\nimport { isoDate } from \"@fluid-app/contacts-core/iso-date\";\nimport { useCreateContactTask } from \"../../hooks/contacts/use-create-contact-task\";\n\nconst QUICK_DATES = [\n { key: \"today\", offsetDays: 0 },\n { key: \"tomorrow\", offsetDays: 1 },\n { key: \"next_week\", offsetDays: 7 },\n] as const;\n\nexport interface TaskComposerFormProps {\n contactId: string;\n /** Called after a successful create. */\n onDone?: () => void;\n /** When provided, an X button is rendered and Escape closes the form. */\n onClose?: () => void;\n /** Focus the body input on mount. Default true. */\n autoFocus?: boolean;\n}\n\nexport function TaskComposerForm({\n contactId,\n onDone,\n onClose,\n autoFocus = true,\n}: TaskComposerFormProps): React.JSX.Element {\n const { t } = useContactsTranslation();\n const [body, setBody] = useState(\"\");\n const [dueDate, setDueDate] = useState<string | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const createTask = useCreateContactTask(contactId, {\n onSuccess: () => {\n setBody(\"\");\n setDueDate(null);\n onDone?.();\n },\n });\n\n useEffect(() => {\n if (autoFocus) inputRef.current?.focus();\n }, [autoFocus]);\n\n // Compute the date strings once per mount. Re-running on every render would\n // re-evaluate `new Date()` and could flip \"today\" if the form happens to be\n // open across midnight — acceptable but unnecessary churn.\n const quickDates = useMemo(\n () =>\n QUICK_DATES.map((q) => ({\n key: q.key,\n iso: isoDate(q.offsetDays),\n })),\n [],\n );\n\n const quickLabels: Record<(typeof QUICK_DATES)[number][\"key\"], string> = {\n today: t(\"quick_today\"),\n tomorrow: t(\"quick_tomorrow\"),\n next_week: t(\"quick_next_week\"),\n };\n\n const submit = () => {\n const trimmed = body.trim();\n if (!trimmed || createTask.isPending) return;\n createTask.mutate({ body: trimmed, due_at: dueDate });\n };\n\n const canSubmit = body.trim().length > 0 && !createTask.isPending;\n\n return (\n <div className=\"border-border/50 focus-within:border-foreground/30 rounded-xl border p-3 transition-colors\">\n <div className=\"flex items-start gap-3\">\n <div\n className=\"border-muted-foreground/50 mt-1.5 size-5 shrink-0 rounded-full border-2\"\n aria-hidden=\"true\"\n />\n <input\n ref={inputRef}\n value={body}\n onChange={(e) => setBody(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n submit();\n } else if (e.key === \"Escape\" && onClose) {\n e.preventDefault();\n onClose();\n }\n }}\n placeholder={t(\"task_describe_placeholder\")}\n aria-label={t(\"task_description_aria\")}\n className=\"placeholder:text-muted-foreground/80 text-foreground flex-1 border-0 bg-transparent text-sm font-medium outline-none\"\n />\n {onClose && (\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={t(\"task_discard_aria\")}\n className=\"text-muted-foreground hover:bg-muted hover:text-foreground -mt-0.5 -mr-0.5 flex size-7 shrink-0 items-center justify-center rounded-md transition-colors\"\n >\n <X className=\"size-4\" />\n </button>\n )}\n </div>\n\n <div className=\"mt-3 flex items-center gap-1.5 pl-8\">\n {quickDates.map((q) => {\n const isActive = dueDate === q.iso;\n return (\n <button\n key={q.key}\n type=\"button\"\n onClick={() => setDueDate(isActive ? null : q.iso)}\n aria-pressed={isActive}\n className={cn(\n \"shrink-0 rounded-full px-3 py-1 text-xs font-medium transition-colors\",\n isActive\n ? \"bg-primary text-primary-foreground\"\n : \"bg-muted text-muted-foreground hover:bg-muted/70\",\n )}\n >\n {quickLabels[q.key]}\n </button>\n );\n })}\n <div className=\"ml-auto\" />\n <button\n type=\"button\"\n onClick={submit}\n disabled={!canSubmit}\n className=\"bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground inline-flex shrink-0 items-center gap-1.5 rounded-full px-4 py-1.5 text-xs font-semibold transition-colors disabled:cursor-not-allowed\"\n >\n {createTask.isPending ? t(\"adding\") : t(\"add_task\")}\n </button>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAWA,SAAgB,gBAAgB,OAAuB;AACrD,QAAO,MACJ,QAAQ,MAAM,IAAI,CAClB,QAAQ,YAAY,MAAM,CAC1B,MAAM,IAAI,CACV,KAAK,SAAS,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE,CAAC,aAAa,CAAC,CACzE,KAAK,IAAI,CACT,MAAM;;;;;AAWX,SAAgB,eACd,OACyE;AACzE,KAAI,CAAC,SAAS,OAAO,UAAU,SAC7B,QAAO;CAGT,MAAM,MAAM;AACZ,QACE,OAAO,IAAI,WAAW,YACtB,UAAU,QACT,OAAO,IAAI,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AEX;IACF,oBAAC,OAAD,EAAK,WAAU,WAAY,CAAA;IAC3B,oBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,UAAU,CAAC;KACX,WAAU;eAET,WAAW,YAAY,EAAE,SAAS,GAAG,EAAE,WAAW;KAC5C,CAAA;IACL;KACF"}
@@ -245,10 +245,11 @@ function useCreateContactTask(contactId, options) {
245
245
  options?.onSuccess?.();
246
246
  },
247
247
  onError: (error) => {
248
+ const description = parseApiErrors(error);
248
249
  require_src.fluidToast({
249
250
  title: "Failed to create task",
250
251
  type: "error",
251
- description: parseApiErrors(error)
252
+ ...description ? { description } : {}
252
253
  });
253
254
  }
254
255
  });
@@ -445,4 +446,4 @@ Object.defineProperty(exports, "useTasksApi", {
445
446
  }
446
447
  });
447
448
 
448
- //# sourceMappingURL=task-composer-form-DnRjQmkv.cjs.map
449
+ //# sourceMappingURL=task-composer-form-D9KhWUI1.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"task-composer-form-DnRjQmkv.cjs","names":["createTranslationContext","X","cn"],"sources":["../../../platform/api-client-core/src/parse-api-errors.ts","../../../contacts/core/src/contacts-api-context.ts","../../../contacts/core/src/translation-api-context.ts","../../../contacts/core/src/parse-task-body.ts","../../../contacts/core/src/query-keys.ts","../../../contacts/core/src/hooks/use-infinite-contacts.ts","../../../contacts/core/src/iso-date.ts","../../../contacts/ui/src/portal/hooks/contacts/use-create-contact-task.ts","../../../contacts/ui/src/portal/components/tasks/task-composer-form.tsx"],"sourcesContent":["/**\n * Framework-agnostic API error parsing utilities.\n *\n * Extracts structured field-level errors from API responses and formats\n * them into human-readable messages. Works with ApiError from this package\n * as well as any error object that has `status`, `data`, and optional `message`.\n */\n\n/**\n * Converts snake_case or camelCase field names to Title Case\n */\nexport function formatFieldName(field: string): string {\n return field\n .replace(/_/g, \" \")\n .replace(/([A-Z])/g, \" $1\")\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(\" \")\n .trim();\n}\n\nexport interface ParsedFieldError {\n field: string;\n messages: string[];\n}\n\n/**\n * Type guard to check if an error looks like an API error\n */\nexport function isApiLikeError(\n error: unknown,\n): error is { message: string | undefined; status: number; data: unknown } {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n\n const err = error as Record<string, unknown>;\n return (\n typeof err.status === \"number\" &&\n \"data\" in err &&\n (typeof err.message === \"string\" || err.message === undefined)\n );\n}\n\n/**\n * Extracts field-level errors from API error data\n */\nexport function extractFieldErrors(data: unknown): ParsedFieldError[] {\n const errors: ParsedFieldError[] = [];\n\n if (!data || typeof data !== \"object\") {\n return errors;\n }\n\n const errorObj = data as Record<string, unknown>;\n\n for (const [key, value] of Object.entries(errorObj)) {\n if (Array.isArray(value) && value.length > 0) {\n errors.push({\n field: formatFieldName(key),\n messages: value.map((item) =>\n typeof item === \"string\" ? item : JSON.stringify(item),\n ),\n });\n } else if (typeof value === \"string\" && value.length > 0) {\n errors.push({\n field: formatFieldName(key),\n messages: [value],\n });\n } else if (value && typeof value === \"object\" && !Array.isArray(value)) {\n const nestedErrors = extractFieldErrors(value);\n nestedErrors.forEach((nestedError) => {\n errors.push({\n field: `${formatFieldName(key)} → ${nestedError.field}`,\n messages: nestedError.messages,\n });\n });\n }\n }\n\n return errors;\n}\n\n/**\n * Formats field errors into a readable description string\n */\nexport function formatErrorDescription(errors: ParsedFieldError[]): string {\n if (errors.length === 0) {\n return \"\";\n }\n\n if (errors.length === 1) {\n const err = errors[0];\n if (!err) return \"\";\n const message = err.messages[0] || \"is invalid\";\n return `${err.field} ${message}`;\n }\n\n if (errors.length <= 3) {\n return errors\n .map((e) => `${e.field} ${e.messages[0] || \"is invalid\"}`)\n .join(\"\\n\");\n }\n\n const shown = errors\n .slice(0, 3)\n .map((e) => `${e.field} ${e.messages[0] || \"is invalid\"}`)\n .join(\"\\n\");\n const remaining = errors.length - 3;\n return `${shown}\\n...and ${remaining} more ${remaining === 1 ? \"error\" : \"errors\"}`;\n}\n\n/**\n * Parses an error and returns a human-readable description string.\n *\n * Handles:\n * - API-like errors with structured field-level data\n * - API-like errors with a top-level message\n * - Standard Error instances\n * - Falls back to the provided fallback string\n *\n * @param error - The error to parse (ApiError, Error, or unknown)\n * @param fallback - Optional fallback description if error cannot be parsed\n * @returns A human-readable error description, or undefined if nothing could be extracted\n */\nexport function parseApiErrors(\n error: unknown,\n fallback?: string,\n): string | undefined {\n if (isApiLikeError(error)) {\n if (error.data) {\n const fieldErrors = extractFieldErrors(error.data);\n if (fieldErrors.length > 0) {\n return formatErrorDescription(fieldErrors);\n }\n }\n\n if (error.message) {\n return error.message;\n }\n } else if (error instanceof Error) {\n return error.message;\n }\n\n return fallback;\n}\n","import { createContext, useContext } from \"react\";\nimport type { ContactsApi } from \"./contacts-api\";\nimport type { NotesApi } from \"./notes-api\";\nimport type { TasksApi } from \"./tasks-api\";\nimport type { GroupsApi } from \"./groups-api\";\n\nexport interface ContactsDomainApi {\n contacts: ContactsApi;\n notes: NotesApi;\n tasks: TasksApi;\n groups?: GroupsApi;\n}\n\nconst ContactsApiContext = createContext<ContactsDomainApi | null>(null);\n\nexport const ContactsApiProvider = ContactsApiContext.Provider;\n\nexport function useContactsDomainApi(): ContactsDomainApi {\n const api = useContext(ContactsApiContext);\n if (!api) {\n throw new Error(\n \"useContactsDomainApi must be used within a ContactsApiProvider\",\n );\n }\n return api;\n}\n\nexport function useContactsCrud(): ContactsApi {\n return useContactsDomainApi().contacts;\n}\n\nexport function useNotesApi(): NotesApi {\n return useContactsDomainApi().notes;\n}\n\nexport function useTasksApi(): TasksApi {\n return useContactsDomainApi().tasks;\n}\n\n/** Returns GroupsApi if the provider supplies one, otherwise null. */\nexport function useGroupsApi(): GroupsApi | null {\n return useContactsDomainApi().groups ?? null;\n}\n","import type { Provider } from \"react\";\nimport { createTranslationContext } from \"@fluid-app/i18n/translation-api-context-factory\";\nimport type { TranslationApi } from \"@fluid-app/i18n/translation-api\";\nimport type { ContactsDict } from \"./translation-dictionary\";\n\nconst { Provider: ContactsProvider, useTranslation } =\n createTranslationContext<ContactsDict>(\"Contacts\");\n\nexport const ContactsTranslationProvider: Provider<TranslationApi<ContactsDict> | null> =\n ContactsProvider;\nexport const useContactsTranslation = useTranslation;\n","/**\n * Tasks store both a title (first line) and an optional body separated by a\n * blank line. This is the canonical convention used by the task editor and\n * by every consumer that displays tasks (contacts UI list, portal todo\n * widget). Drift across consumers would mean some surfaces show \"Title\\n\\n\n * body details\" verbatim while others split correctly — keep the delimiter\n * convention in one place.\n */\nexport function parseTaskBody(raw: string): { title: string; body: string } {\n const split = raw.indexOf(\"\\n\\n\");\n if (split >= 0) {\n return {\n title: raw.slice(0, split),\n body: raw.slice(split + 2),\n };\n }\n return { title: raw, body: \"\" };\n}\n","export const CONTACTS_QUERY_KEYS = {\n all: (prefix: string) => [prefix] as const,\n list: (prefix: string) =>\n [...CONTACTS_QUERY_KEYS.all(prefix), \"list\"] as const,\n detail: (prefix: string, id: string) =>\n [...CONTACTS_QUERY_KEYS.all(prefix), \"detail\", id] as const,\n} as const;\n\nexport const contactsKeys = {\n activities: (contactId: string) =>\n [\"portal-contacts\", \"activities\", contactId] as const,\n tasks: (contactId: string) =>\n [\"portal-contacts\", \"tasks\", contactId] as const,\n notes: (contactId: string) =>\n [\"portal-contacts\", \"notes\", contactId] as const,\n orders: (contactId: string) => [\"rep-contacts\", \"orders\", contactId] as const,\n subscriptionOrders: (contactId: string) =>\n [\"rep-contacts\", \"subscription-orders\", contactId] as const,\n groups: () => [\"portal-contacts\", \"groups\"] as const,\n} as const;\n","import { useInfiniteQuery } from \"@tanstack/react-query\";\nimport { useContactsCrud } from \"../contacts-api-context\";\nimport { CONTACTS_QUERY_KEYS } from \"../query-keys\";\n\nexport interface UseInfiniteContactsParams {\n search_query?: string;\n status?: string;\n sort_by?: string;\n sort_direction?: string;\n per_page?: number;\n tags?: string[];\n}\n\nexport function useInfiniteContacts(params: UseInfiniteContactsParams) {\n const api = useContactsCrud();\n return useInfiniteQuery({\n queryKey: [...CONTACTS_QUERY_KEYS.list(\"contacts\"), params],\n queryFn: ({ pageParam }) =>\n api.listContacts({\n ...params,\n page: pageParam,\n }),\n getNextPageParam: (lastPage) => {\n const currentPage = lastPage.meta.current_page;\n // Contacts API is page-number based; next_cursor and total_pages\n // are both used as \"has-next-page\" signals.\n if (currentPage == null) return undefined;\n if (lastPage.meta.next_cursor) return currentPage + 1;\n if (\n lastPage.meta.total_pages != null &&\n currentPage < lastPage.meta.total_pages\n ) {\n return currentPage + 1;\n }\n return undefined;\n },\n initialPageParam: 1,\n });\n}\n","/**\n * Format a date as YYYY-MM-DD in the renderer's local timezone, optionally\n * shifted by `offsetDays`. Use this for due-date inputs where \"today\" must\n * resolve to the user's local calendar date — never `toISOString().slice(0, 10)`,\n * which returns the UTC date and silently rolls over a day for users east/west\n * of UTC at the wrong hours.\n */\nexport function isoDate(offsetDays: number, now: Date = new Date()): string {\n const d = new Date(now);\n d.setDate(d.getDate() + offsetDays);\n const yyyy = d.getFullYear();\n const mm = String(d.getMonth() + 1).padStart(2, \"0\");\n const dd = String(d.getDate()).padStart(2, \"0\");\n return `${yyyy}-${mm}-${dd}`;\n}\n\n/**\n * Return a Date pinned to local midnight of the calendar day represented by\n * `input`. Use this whenever you need to compare two due dates by calendar day\n * (overdue / today / tomorrow / future).\n *\n * Why not just `new Date(input)`? `new Date(\"YYYY-MM-DD\")` parses the string\n * as UTC midnight, which lands on the *previous* calendar day in any UTC−\n * timezone — a task due \"May 1\" then reads as April 30 for a user in the\n * Americas, classifying it as \"Overdue\" all day. Parse the date components\n * directly so the calendar-day intent of the string is preserved.\n */\nexport function startOfLocalDay(input: Date | string): Date {\n if (typeof input === \"string\") {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})/.exec(input);\n if (match?.[1] && match[2] && match[3]) {\n return new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n }\n }\n const d = typeof input === \"string\" ? new Date(input) : input;\n return new Date(d.getFullYear(), d.getMonth(), d.getDate());\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { fluidToast } from \"@fluid-app/ui-primitives\";\nimport { parseApiErrors } from \"@fluid-app/api-client-core\";\nimport { useTasksApi } from \"@fluid-app/contacts-core/contacts-api-context\";\nimport { contactsKeys } from \"@fluid-app/contacts-core/query-keys\";\nimport type { CreateTaskInput } from \"@fluid-app/contacts-core/types\";\n\nexport type { CreateTaskInput };\n\nexport function useCreateContactTask(\n contactId: string,\n options?: { onSuccess?: () => void },\n) {\n const queryClient = useQueryClient();\n const api = useTasksApi();\n\n return useMutation({\n mutationFn: (input: CreateTaskInput) => api.createTask(contactId, input),\n onSuccess: () => {\n fluidToast({ title: \"Task created\", type: \"success\" });\n queryClient.invalidateQueries({\n queryKey: contactsKeys.tasks(contactId),\n });\n options?.onSuccess?.();\n },\n onError: (error) => {\n fluidToast({\n title: \"Failed to create task\",\n type: \"error\",\n description: parseApiErrors(error),\n });\n },\n });\n}\n","\"use client\";\n\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"@fluid-app/ui-primitives\";\nimport { useContactsTranslation } from \"@fluid-app/contacts-core/translation-api-context\";\nimport { isoDate } from \"@fluid-app/contacts-core/iso-date\";\nimport { useCreateContactTask } from \"../../hooks/contacts/use-create-contact-task\";\n\nconst QUICK_DATES = [\n { key: \"today\", offsetDays: 0 },\n { key: \"tomorrow\", offsetDays: 1 },\n { key: \"next_week\", offsetDays: 7 },\n] as const;\n\nexport interface TaskComposerFormProps {\n contactId: string;\n /** Called after a successful create. */\n onDone?: () => void;\n /** When provided, an X button is rendered and Escape closes the form. */\n onClose?: () => void;\n /** Focus the body input on mount. Default true. */\n autoFocus?: boolean;\n}\n\nexport function TaskComposerForm({\n contactId,\n onDone,\n onClose,\n autoFocus = true,\n}: TaskComposerFormProps): React.JSX.Element {\n const { t } = useContactsTranslation();\n const [body, setBody] = useState(\"\");\n const [dueDate, setDueDate] = useState<string | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const createTask = useCreateContactTask(contactId, {\n onSuccess: () => {\n setBody(\"\");\n setDueDate(null);\n onDone?.();\n },\n });\n\n useEffect(() => {\n if (autoFocus) inputRef.current?.focus();\n }, [autoFocus]);\n\n // Compute the date strings once per mount. Re-running on every render would\n // re-evaluate `new Date()` and could flip \"today\" if the form happens to be\n // open across midnight — acceptable but unnecessary churn.\n const quickDates = useMemo(\n () =>\n QUICK_DATES.map((q) => ({\n key: q.key,\n iso: isoDate(q.offsetDays),\n })),\n [],\n );\n\n const quickLabels: Record<(typeof QUICK_DATES)[number][\"key\"], string> = {\n today: t(\"quick_today\"),\n tomorrow: t(\"quick_tomorrow\"),\n next_week: t(\"quick_next_week\"),\n };\n\n const submit = () => {\n const trimmed = body.trim();\n if (!trimmed || createTask.isPending) return;\n createTask.mutate({ body: trimmed, due_at: dueDate });\n };\n\n const canSubmit = body.trim().length > 0 && !createTask.isPending;\n\n return (\n <div className=\"border-border/50 focus-within:border-foreground/30 rounded-xl border p-3 transition-colors\">\n <div className=\"flex items-start gap-3\">\n <div\n className=\"border-muted-foreground/50 mt-1.5 size-5 shrink-0 rounded-full border-2\"\n aria-hidden=\"true\"\n />\n <input\n ref={inputRef}\n value={body}\n onChange={(e) => setBody(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n submit();\n } else if (e.key === \"Escape\" && onClose) {\n e.preventDefault();\n onClose();\n }\n }}\n placeholder={t(\"task_describe_placeholder\")}\n aria-label={t(\"task_description_aria\")}\n className=\"placeholder:text-muted-foreground/80 text-foreground flex-1 border-0 bg-transparent text-sm font-medium outline-none\"\n />\n {onClose && (\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={t(\"task_discard_aria\")}\n className=\"text-muted-foreground hover:bg-muted hover:text-foreground -mt-0.5 -mr-0.5 flex size-7 shrink-0 items-center justify-center rounded-md transition-colors\"\n >\n <X className=\"size-4\" />\n </button>\n )}\n </div>\n\n <div className=\"mt-3 flex items-center gap-1.5 pl-8\">\n {quickDates.map((q) => {\n const isActive = dueDate === q.iso;\n return (\n <button\n key={q.key}\n type=\"button\"\n onClick={() => setDueDate(isActive ? null : q.iso)}\n aria-pressed={isActive}\n className={cn(\n \"shrink-0 rounded-full px-3 py-1 text-xs font-medium transition-colors\",\n isActive\n ? \"bg-primary text-primary-foreground\"\n : \"bg-muted text-muted-foreground hover:bg-muted/70\",\n )}\n >\n {quickLabels[q.key]}\n </button>\n );\n })}\n <div className=\"ml-auto\" />\n <button\n type=\"button\"\n onClick={submit}\n disabled={!canSubmit}\n className=\"bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground inline-flex shrink-0 items-center gap-1.5 rounded-full px-4 py-1.5 text-xs font-semibold transition-colors disabled:cursor-not-allowed\"\n >\n {createTask.isPending ? t(\"adding\") : t(\"add_task\")}\n </button>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAWA,SAAgB,gBAAgB,OAAuB;AACrD,QAAO,MACJ,QAAQ,MAAM,IAAI,CAClB,QAAQ,YAAY,MAAM,CAC1B,MAAM,IAAI,CACV,KAAK,SAAS,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE,CAAC,aAAa,CAAC,CACzE,KAAK,IAAI,CACT,MAAM;;;;;AAWX,SAAgB,eACd,OACyE;AACzE,KAAI,CAAC,SAAS,OAAO,UAAU,SAC7B,QAAO;CAGT,MAAM,MAAM;AACZ,QACE,OAAO,IAAI,WAAW,YACtB,UAAU,QACT,OAAO,IAAI,YAAY,YAAY,IAAI,YAAY,KAAA;;;;;AAOxD,SAAgB,mBAAmB,MAAmC;CACpE,MAAM,SAA6B,EAAE;AAErC,KAAI,CAAC,QAAQ,OAAO,SAAS,SAC3B,QAAO;CAGT,MAAM,WAAW;AAEjB,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,SAAS,C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ACI,uCACA,mDACL;gBAEA,YAAY,EAAE;MACR,EAZF,EAAE,IAYA;MAEX;IACF,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAK,WAAU,WAAY,CAAA;IAC3B,iBAAA,GAAA,kBAAA,KAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,UAAU,CAAC;KACX,WAAU;eAET,WAAW,YAAY,EAAE,SAAS,GAAG,EAAE,WAAW;KAC5C,CAAA;IACL;KACF"}
1
+ {"version":3,"file":"task-composer-form-D9KhWUI1.cjs","names":["createTranslationContext","X","cn"],"sources":["../../../platform/api-client-core/src/parse-api-errors.ts","../../../contacts/core/src/contacts-api-context.ts","../../../contacts/core/src/translation-api-context.ts","../../../contacts/core/src/parse-task-body.ts","../../../contacts/core/src/query-keys.ts","../../../contacts/core/src/hooks/use-infinite-contacts.ts","../../../contacts/core/src/iso-date.ts","../../../contacts/ui/src/portal/hooks/contacts/use-create-contact-task.ts","../../../contacts/ui/src/portal/components/tasks/task-composer-form.tsx"],"sourcesContent":["/**\n * Framework-agnostic API error parsing utilities.\n *\n * Extracts structured field-level errors from API responses and formats\n * them into human-readable messages. Works with ApiError from this package\n * as well as any error object that has `status`, `data`, and optional `message`.\n */\n\n/**\n * Converts snake_case or camelCase field names to Title Case\n */\nexport function formatFieldName(field: string): string {\n return field\n .replace(/_/g, \" \")\n .replace(/([A-Z])/g, \" $1\")\n .split(\" \")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(\" \")\n .trim();\n}\n\nexport interface ParsedFieldError {\n field: string;\n messages: string[];\n}\n\n/**\n * Type guard to check if an error looks like an API error\n */\nexport function isApiLikeError(\n error: unknown,\n): error is { message: string | undefined; status: number; data: unknown } {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n\n const err = error as Record<string, unknown>;\n return (\n typeof err.status === \"number\" &&\n \"data\" in err &&\n (typeof err.message === \"string\" || err.message === undefined)\n );\n}\n\n/**\n * Extracts field-level errors from API error data\n */\nexport function extractFieldErrors(data: unknown): ParsedFieldError[] {\n const errors: ParsedFieldError[] = [];\n\n if (!data || typeof data !== \"object\") {\n return errors;\n }\n\n const errorObj = data as Record<string, unknown>;\n\n for (const [key, value] of Object.entries(errorObj)) {\n if (Array.isArray(value) && value.length > 0) {\n errors.push({\n field: formatFieldName(key),\n messages: value.map((item) =>\n typeof item === \"string\" ? item : JSON.stringify(item),\n ),\n });\n } else if (typeof value === \"string\" && value.length > 0) {\n errors.push({\n field: formatFieldName(key),\n messages: [value],\n });\n } else if (value && typeof value === \"object\" && !Array.isArray(value)) {\n const nestedErrors = extractFieldErrors(value);\n nestedErrors.forEach((nestedError) => {\n errors.push({\n field: `${formatFieldName(key)} → ${nestedError.field}`,\n messages: nestedError.messages,\n });\n });\n }\n }\n\n return errors;\n}\n\n/**\n * Formats field errors into a readable description string\n */\nexport function formatErrorDescription(errors: ParsedFieldError[]): string {\n if (errors.length === 0) {\n return \"\";\n }\n\n if (errors.length === 1) {\n const err = errors[0];\n if (!err) return \"\";\n const message = err.messages[0] || \"is invalid\";\n return `${err.field} ${message}`;\n }\n\n if (errors.length <= 3) {\n return errors\n .map((e) => `${e.field} ${e.messages[0] || \"is invalid\"}`)\n .join(\"\\n\");\n }\n\n const shown = errors\n .slice(0, 3)\n .map((e) => `${e.field} ${e.messages[0] || \"is invalid\"}`)\n .join(\"\\n\");\n const remaining = errors.length - 3;\n return `${shown}\\n...and ${remaining} more ${remaining === 1 ? \"error\" : \"errors\"}`;\n}\n\n/**\n * Parses an error and returns a human-readable description string.\n *\n * Handles:\n * - API-like errors with structured field-level data\n * - API-like errors with a top-level message\n * - Standard Error instances\n * - Falls back to the provided fallback string\n *\n * @param error - The error to parse (ApiError, Error, or unknown)\n * @param fallback - Optional fallback description if error cannot be parsed\n * @returns A human-readable error description, or undefined if nothing could be extracted\n */\nexport function parseApiErrors(\n error: unknown,\n fallback?: string,\n): string | undefined {\n if (isApiLikeError(error)) {\n if (error.data) {\n const fieldErrors = extractFieldErrors(error.data);\n if (fieldErrors.length > 0) {\n return formatErrorDescription(fieldErrors);\n }\n }\n\n if (error.message) {\n return error.message;\n }\n } else if (error instanceof Error) {\n return error.message;\n }\n\n return fallback;\n}\n","import { createContext, useContext } from \"react\";\nimport type { ContactsApi } from \"./contacts-api\";\nimport type { NotesApi } from \"./notes-api\";\nimport type { TasksApi } from \"./tasks-api\";\nimport type { GroupsApi } from \"./groups-api\";\n\nexport interface ContactsDomainApi {\n contacts: ContactsApi;\n notes: NotesApi;\n tasks: TasksApi;\n groups?: GroupsApi;\n}\n\nconst ContactsApiContext = createContext<ContactsDomainApi | null>(null);\n\nexport const ContactsApiProvider = ContactsApiContext.Provider;\n\nexport function useContactsDomainApi(): ContactsDomainApi {\n const api = useContext(ContactsApiContext);\n if (!api) {\n throw new Error(\n \"useContactsDomainApi must be used within a ContactsApiProvider\",\n );\n }\n return api;\n}\n\nexport function useContactsCrud(): ContactsApi {\n return useContactsDomainApi().contacts;\n}\n\nexport function useNotesApi(): NotesApi {\n return useContactsDomainApi().notes;\n}\n\nexport function useTasksApi(): TasksApi {\n return useContactsDomainApi().tasks;\n}\n\n/** Returns GroupsApi if the provider supplies one, otherwise null. */\nexport function useGroupsApi(): GroupsApi | null {\n return useContactsDomainApi().groups ?? null;\n}\n","import type { Provider } from \"react\";\nimport { createTranslationContext } from \"@fluid-app/i18n/translation-api-context-factory\";\nimport type { TranslationApi } from \"@fluid-app/i18n/translation-api\";\nimport type { ContactsDict } from \"./translation-dictionary\";\n\nconst { Provider: ContactsProvider, useTranslation } =\n createTranslationContext<ContactsDict>(\"Contacts\");\n\nexport const ContactsTranslationProvider: Provider<TranslationApi<ContactsDict> | null> =\n ContactsProvider;\nexport const useContactsTranslation = useTranslation;\n","/**\n * Tasks store both a title (first line) and an optional body separated by a\n * blank line. This is the canonical convention used by the task editor and\n * by every consumer that displays tasks (contacts UI list, portal todo\n * widget). Drift across consumers would mean some surfaces show \"Title\\n\\n\n * body details\" verbatim while others split correctly — keep the delimiter\n * convention in one place.\n */\nexport function parseTaskBody(raw: string): { title: string; body: string } {\n const split = raw.indexOf(\"\\n\\n\");\n if (split >= 0) {\n return {\n title: raw.slice(0, split),\n body: raw.slice(split + 2),\n };\n }\n return { title: raw, body: \"\" };\n}\n","export const CONTACTS_QUERY_KEYS = {\n all: (prefix: string) => [prefix] as const,\n list: (prefix: string) =>\n [...CONTACTS_QUERY_KEYS.all(prefix), \"list\"] as const,\n detail: (prefix: string, id: string) =>\n [...CONTACTS_QUERY_KEYS.all(prefix), \"detail\", id] as const,\n} as const;\n\nexport const contactsKeys = {\n activities: (contactId: string) =>\n [\"portal-contacts\", \"activities\", contactId] as const,\n tasks: (contactId: string) =>\n [\"portal-contacts\", \"tasks\", contactId] as const,\n notes: (contactId: string) =>\n [\"portal-contacts\", \"notes\", contactId] as const,\n orders: (contactId: string) => [\"rep-contacts\", \"orders\", contactId] as const,\n subscriptionOrders: (contactId: string) =>\n [\"rep-contacts\", \"subscription-orders\", contactId] as const,\n groups: () => [\"portal-contacts\", \"groups\"] as const,\n} as const;\n","import { useInfiniteQuery } from \"@tanstack/react-query\";\nimport { useContactsCrud } from \"../contacts-api-context\";\nimport { CONTACTS_QUERY_KEYS } from \"../query-keys\";\n\nexport interface UseInfiniteContactsParams {\n search_query?: string;\n status?: string;\n sort_by?: string;\n sort_direction?: string;\n per_page?: number;\n tags?: string[];\n}\n\nexport function useInfiniteContacts(params: UseInfiniteContactsParams) {\n const api = useContactsCrud();\n return useInfiniteQuery({\n queryKey: [...CONTACTS_QUERY_KEYS.list(\"contacts\"), params],\n queryFn: ({ pageParam }) =>\n api.listContacts({\n ...params,\n page: pageParam,\n }),\n getNextPageParam: (lastPage) => {\n const currentPage = lastPage.meta.current_page;\n // Contacts API is page-number based; next_cursor and total_pages\n // are both used as \"has-next-page\" signals.\n if (currentPage == null) return undefined;\n if (lastPage.meta.next_cursor) return currentPage + 1;\n if (\n lastPage.meta.total_pages != null &&\n currentPage < lastPage.meta.total_pages\n ) {\n return currentPage + 1;\n }\n return undefined;\n },\n initialPageParam: 1,\n });\n}\n","/**\n * Format a date as YYYY-MM-DD in the renderer's local timezone, optionally\n * shifted by `offsetDays`. Use this for due-date inputs where \"today\" must\n * resolve to the user's local calendar date — never `toISOString().slice(0, 10)`,\n * which returns the UTC date and silently rolls over a day for users east/west\n * of UTC at the wrong hours.\n */\nexport function isoDate(offsetDays: number, now: Date = new Date()): string {\n const d = new Date(now);\n d.setDate(d.getDate() + offsetDays);\n const yyyy = d.getFullYear();\n const mm = String(d.getMonth() + 1).padStart(2, \"0\");\n const dd = String(d.getDate()).padStart(2, \"0\");\n return `${yyyy}-${mm}-${dd}`;\n}\n\n/**\n * Return a Date pinned to local midnight of the calendar day represented by\n * `input`. Use this whenever you need to compare two due dates by calendar day\n * (overdue / today / tomorrow / future).\n *\n * Why not just `new Date(input)`? `new Date(\"YYYY-MM-DD\")` parses the string\n * as UTC midnight, which lands on the *previous* calendar day in any UTC−\n * timezone — a task due \"May 1\" then reads as April 30 for a user in the\n * Americas, classifying it as \"Overdue\" all day. Parse the date components\n * directly so the calendar-day intent of the string is preserved.\n */\nexport function startOfLocalDay(input: Date | string): Date {\n if (typeof input === \"string\") {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})/.exec(input);\n if (match?.[1] && match[2] && match[3]) {\n return new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));\n }\n }\n const d = typeof input === \"string\" ? new Date(input) : input;\n return new Date(d.getFullYear(), d.getMonth(), d.getDate());\n}\n","\"use client\";\n\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { fluidToast } from \"@fluid-app/ui-primitives\";\nimport { parseApiErrors } from \"@fluid-app/api-client-core\";\nimport { useTasksApi } from \"@fluid-app/contacts-core/contacts-api-context\";\nimport { contactsKeys } from \"@fluid-app/contacts-core/query-keys\";\nimport type { CreateTaskInput } from \"@fluid-app/contacts-core/types\";\n\nexport type { CreateTaskInput };\n\nexport function useCreateContactTask(\n contactId: string,\n options?: { onSuccess?: () => void },\n) {\n const queryClient = useQueryClient();\n const api = useTasksApi();\n\n return useMutation({\n mutationFn: (input: CreateTaskInput) => api.createTask(contactId, input),\n onSuccess: () => {\n fluidToast({ title: \"Task created\", type: \"success\" });\n queryClient.invalidateQueries({\n queryKey: contactsKeys.tasks(contactId),\n });\n options?.onSuccess?.();\n },\n onError: (error) => {\n const description = parseApiErrors(error);\n fluidToast({\n title: \"Failed to create task\",\n type: \"error\",\n ...(description ? { description } : {}),\n });\n },\n });\n}\n","\"use client\";\n\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport { X } from \"lucide-react\";\nimport { cn } from \"@fluid-app/ui-primitives\";\nimport { useContactsTranslation } from \"@fluid-app/contacts-core/translation-api-context\";\nimport { isoDate } from \"@fluid-app/contacts-core/iso-date\";\nimport { useCreateContactTask } from \"../../hooks/contacts/use-create-contact-task\";\n\nconst QUICK_DATES = [\n { key: \"today\", offsetDays: 0 },\n { key: \"tomorrow\", offsetDays: 1 },\n { key: \"next_week\", offsetDays: 7 },\n] as const;\n\nexport interface TaskComposerFormProps {\n contactId: string;\n /** Called after a successful create. */\n onDone?: () => void;\n /** When provided, an X button is rendered and Escape closes the form. */\n onClose?: () => void;\n /** Focus the body input on mount. Default true. */\n autoFocus?: boolean;\n}\n\nexport function TaskComposerForm({\n contactId,\n onDone,\n onClose,\n autoFocus = true,\n}: TaskComposerFormProps): React.JSX.Element {\n const { t } = useContactsTranslation();\n const [body, setBody] = useState(\"\");\n const [dueDate, setDueDate] = useState<string | null>(null);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const createTask = useCreateContactTask(contactId, {\n onSuccess: () => {\n setBody(\"\");\n setDueDate(null);\n onDone?.();\n },\n });\n\n useEffect(() => {\n if (autoFocus) inputRef.current?.focus();\n }, [autoFocus]);\n\n // Compute the date strings once per mount. Re-running on every render would\n // re-evaluate `new Date()` and could flip \"today\" if the form happens to be\n // open across midnight — acceptable but unnecessary churn.\n const quickDates = useMemo(\n () =>\n QUICK_DATES.map((q) => ({\n key: q.key,\n iso: isoDate(q.offsetDays),\n })),\n [],\n );\n\n const quickLabels: Record<(typeof QUICK_DATES)[number][\"key\"], string> = {\n today: t(\"quick_today\"),\n tomorrow: t(\"quick_tomorrow\"),\n next_week: t(\"quick_next_week\"),\n };\n\n const submit = () => {\n const trimmed = body.trim();\n if (!trimmed || createTask.isPending) return;\n createTask.mutate({ body: trimmed, due_at: dueDate });\n };\n\n const canSubmit = body.trim().length > 0 && !createTask.isPending;\n\n return (\n <div className=\"border-border/50 focus-within:border-foreground/30 rounded-xl border p-3 transition-colors\">\n <div className=\"flex items-start gap-3\">\n <div\n className=\"border-muted-foreground/50 mt-1.5 size-5 shrink-0 rounded-full border-2\"\n aria-hidden=\"true\"\n />\n <input\n ref={inputRef}\n value={body}\n onChange={(e) => setBody(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && !e.shiftKey) {\n e.preventDefault();\n submit();\n } else if (e.key === \"Escape\" && onClose) {\n e.preventDefault();\n onClose();\n }\n }}\n placeholder={t(\"task_describe_placeholder\")}\n aria-label={t(\"task_description_aria\")}\n className=\"placeholder:text-muted-foreground/80 text-foreground flex-1 border-0 bg-transparent text-sm font-medium outline-none\"\n />\n {onClose && (\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={t(\"task_discard_aria\")}\n className=\"text-muted-foreground hover:bg-muted hover:text-foreground -mt-0.5 -mr-0.5 flex size-7 shrink-0 items-center justify-center rounded-md transition-colors\"\n >\n <X className=\"size-4\" />\n </button>\n )}\n </div>\n\n <div className=\"mt-3 flex items-center gap-1.5 pl-8\">\n {quickDates.map((q) => {\n const isActive = dueDate === q.iso;\n return (\n <button\n key={q.key}\n type=\"button\"\n onClick={() => setDueDate(isActive ? null : q.iso)}\n aria-pressed={isActive}\n className={cn(\n \"shrink-0 rounded-full px-3 py-1 text-xs font-medium transition-colors\",\n isActive\n ? \"bg-primary text-primary-foreground\"\n : \"bg-muted text-muted-foreground hover:bg-muted/70\",\n )}\n >\n {quickLabels[q.key]}\n </button>\n );\n })}\n <div className=\"ml-auto\" />\n <button\n type=\"button\"\n onClick={submit}\n disabled={!canSubmit}\n className=\"bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground inline-flex shrink-0 items-center gap-1.5 rounded-full px-4 py-1.5 text-xs font-semibold transition-colors disabled:cursor-not-allowed\"\n >\n {createTask.isPending ? t(\"adding\") : t(\"add_task\")}\n </button>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAWA,SAAgB,gBAAgB,OAAuB;AACrD,QAAO,MACJ,QAAQ,MAAM,IAAI,CAClB,QAAQ,YAAY,MAAM,CAC1B,MAAM,IAAI,CACV,KAAK,SAAS,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE,CAAC,aAAa,CAAC,CACzE,KAAK,IAAI,CACT,MAAM;;;;;AAWX,SAAgB,eACd,OACyE;AACzE,KAAI,CAAC,SAAS,OAAO,UAAU,SAC7B,QAAO;CAGT,MAAM,MAAM;AACZ,QACE,OAAO,IAAI,WAAW,YACtB,UAAU,QACT,OAAO,IAAI,YAAY,YAAY,IAAI,YAAY,KAAA;;;;;AAOxD,SAAgB,mBAAmB,MAAmC;CACpE,MAAM,SAA6B,EAAE;AAErC,KAAI,CAAC,QAAQ,OAAO,SAAS,SAC3B,QAAO;CAGT,MAAM,WAAW;AAEjB,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,SAAS,CACjD,KAAI,MAAM,QAAQ,MAAM,IAAI,MAAM,SAAS,EACzC,QAAO,KAAK;EACV,OAAO,gBAAgB,IAAI;EAC3B,UAAU,MAAM,KAAK,SACnB,OAAO,SAAS,WAAW,OAAO,KAAK,UAAU,KAAK,CACvD;EACF,CAAC;UACO,OAAO,UAAU,YAAY,MAAM,SAAS,EACrD,QAAO,KAAK;EACV,OAAO,gBAAgB,IAAI;EAC3B,UAAU,CAAC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,EAAE,SAAS,GAAG,EAAE,WAAW;KAC5C,CAAA;IACL;KACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-app/portal-sdk",
3
- "version": "0.1.322",
3
+ "version": "0.1.324",
4
4
  "description": "SDK for building custom Fluid portals",
5
5
  "files": [
6
6
  "dist",
@@ -71,51 +71,51 @@
71
71
  "tsdown": "^0.21.0",
72
72
  "typescript": "^5",
73
73
  "zod": "4.3.5",
74
- "@fluid-app/address-autocomplete": "0.1.0",
75
74
  "@fluid-app/api-client-core": "0.1.0",
76
75
  "@fluid-app/auth": "0.1.0",
77
76
  "@fluid-app/cart-ui": "0.1.22",
77
+ "@fluid-app/address-autocomplete": "0.1.0",
78
78
  "@fluid-app/company-switcher-core": "0.1.0",
79
79
  "@fluid-app/company-switcher-ui": "0.1.0",
80
- "@fluid-app/contacts-core": "0.1.0",
81
- "@fluid-app/contacts-ui": "0.1.0",
82
80
  "@fluid-app/file-picker-api-client": "0.1.0",
83
- "@fluid-app/file-picker-core": "0.1.0",
81
+ "@fluid-app/contacts-ui": "0.1.0",
82
+ "@fluid-app/contacts-core": "0.1.0",
84
83
  "@fluid-app/fluid-pay-core": "0.1.0",
85
84
  "@fluid-app/fluid-pay-ui": "0.1.0",
86
85
  "@fluid-app/fluidos-api-client": "0.1.0",
87
86
  "@fluid-app/i18n": "0.1.0",
87
+ "@fluid-app/file-picker-core": "0.1.0",
88
88
  "@fluid-app/messaging-api-client": "0.1.0",
89
89
  "@fluid-app/messaging-core": "0.1.0",
90
- "@fluid-app/mysite-ui": "0.1.0",
91
90
  "@fluid-app/messaging-ui": "0.1.0",
92
91
  "@fluid-app/mysite-core": "0.1.0",
92
+ "@fluid-app/mysite-ui": "0.1.0",
93
93
  "@fluid-app/orders-core": "0.1.0",
94
- "@fluid-app/orders-ui": "0.1.0",
95
94
  "@fluid-app/permissions": "0.1.0",
95
+ "@fluid-app/orders-ui": "0.1.0",
96
96
  "@fluid-app/portal-app-download-ui": "0.1.0",
97
+ "@fluid-app/portal-core": "0.1.23",
97
98
  "@fluid-app/portal-preview": "0.1.0",
98
99
  "@fluid-app/portal-pro-upgrade-ui": "0.1.0",
99
100
  "@fluid-app/portal-react": "0.1.0",
100
- "@fluid-app/portal-core": "0.1.23",
101
101
  "@fluid-app/portal-tenant-api-client": "0.1.0",
102
- "@fluid-app/portal-tenant-mysite-api-client": "0.1.0",
103
- "@fluid-app/portal-tenant-content-api-client": "0.1.0",
104
102
  "@fluid-app/portal-tenant-contacts-api-client": "0.1.0",
105
- "@fluid-app/portal-tenant-pay-api-client": "0.1.0",
103
+ "@fluid-app/portal-tenant-content-api-client": "0.1.0",
104
+ "@fluid-app/portal-tenant-mysite-api-client": "0.1.0",
106
105
  "@fluid-app/portal-tenant-store-api-client": "0.1.0",
107
- "@fluid-app/products-core": "0.1.0",
108
106
  "@fluid-app/portal-widgets": "0.1.22",
109
- "@fluid-app/profile-core": "0.1.0",
107
+ "@fluid-app/portal-tenant-pay-api-client": "0.1.0",
110
108
  "@fluid-app/products-api-client": "0.1.0",
109
+ "@fluid-app/products-core": "0.1.0",
110
+ "@fluid-app/profile-core": "0.1.0",
111
111
  "@fluid-app/profile-ui": "0.1.0",
112
112
  "@fluid-app/query-persister": "0.1.0",
113
113
  "@fluid-app/shareables-core": "0.1.0",
114
114
  "@fluid-app/shareables-ui": "0.1.0",
115
115
  "@fluid-app/shop-core": "0.1.0",
116
116
  "@fluid-app/shop-ui": "0.1.0",
117
- "@fluid-app/store-core": "0.1.0",
118
117
  "@fluid-app/store-api-client": "0.1.0",
118
+ "@fluid-app/store-core": "0.1.0",
119
119
  "@fluid-app/subscriptions-core": "0.1.0",
120
120
  "@fluid-app/subscriptions-ui": "0.1.0",
121
121
  "@fluid-app/typescript-config": "0.0.0",