@open-mercato/core 0.4.5-develop-636d33c995 → 0.4.5-develop-811deeb983

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 (136) hide show
  1. package/dist/modules/catalog/backend/catalog/categories/[id]/edit/page.js +17 -2
  2. package/dist/modules/catalog/backend/catalog/categories/[id]/edit/page.js.map +2 -2
  3. package/dist/modules/catalog/backend/catalog/products/[id]/page.js +15 -0
  4. package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
  5. package/dist/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.js +30 -0
  6. package/dist/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.js.map +2 -2
  7. package/dist/modules/catalog/lib/messageObjectPreviews.js +146 -0
  8. package/dist/modules/catalog/lib/messageObjectPreviews.js.map +7 -0
  9. package/dist/modules/catalog/message-objects.js +95 -0
  10. package/dist/modules/catalog/message-objects.js.map +7 -0
  11. package/dist/modules/currencies/backend/currencies/[id]/page.js +21 -0
  12. package/dist/modules/currencies/backend/currencies/[id]/page.js.map +2 -2
  13. package/dist/modules/currencies/lib/messageObjectPreviews.js +51 -0
  14. package/dist/modules/currencies/lib/messageObjectPreviews.js.map +7 -0
  15. package/dist/modules/currencies/message-objects.js +41 -0
  16. package/dist/modules/currencies/message-objects.js.map +7 -0
  17. package/dist/modules/customers/backend/customers/companies/[id]/page.js +20 -0
  18. package/dist/modules/customers/backend/customers/companies/[id]/page.js.map +2 -2
  19. package/dist/modules/customers/backend/customers/deals/[id]/page.js +12 -1
  20. package/dist/modules/customers/backend/customers/deals/[id]/page.js.map +2 -2
  21. package/dist/modules/customers/backend/customers/people/[id]/page.js +20 -0
  22. package/dist/modules/customers/backend/customers/people/[id]/page.js.map +2 -2
  23. package/dist/modules/customers/components/detail/CompanyHighlights.js +18 -14
  24. package/dist/modules/customers/components/detail/CompanyHighlights.js.map +2 -2
  25. package/dist/modules/customers/components/detail/PersonHighlights.js +18 -14
  26. package/dist/modules/customers/components/detail/PersonHighlights.js.map +2 -2
  27. package/dist/modules/customers/lib/messageObjectPreviews.js +41 -5
  28. package/dist/modules/customers/lib/messageObjectPreviews.js.map +2 -2
  29. package/dist/modules/customers/message-objects.js +31 -11
  30. package/dist/modules/customers/message-objects.js.map +2 -2
  31. package/dist/modules/messages/commands/messages.js +3 -0
  32. package/dist/modules/messages/commands/messages.js.map +2 -2
  33. package/dist/modules/messages/components/message-detail/panels/objects-panel.js +6 -1
  34. package/dist/modules/messages/components/message-detail/panels/objects-panel.js.map +2 -2
  35. package/dist/modules/messages/components/message-detail/panels/thread-panel.js +4 -1
  36. package/dist/modules/messages/components/message-detail/panels/thread-panel.js.map +2 -2
  37. package/dist/modules/messages/frontend/messages/view/[token]/page.js +1 -0
  38. package/dist/modules/messages/frontend/messages/view/[token]/page.js.map +2 -2
  39. package/dist/modules/resources/backend/resources/resources/[id]/page.js +24 -7
  40. package/dist/modules/resources/backend/resources/resources/[id]/page.js.map +2 -2
  41. package/dist/modules/resources/lib/messageObjectPreviews.js +43 -0
  42. package/dist/modules/resources/lib/messageObjectPreviews.js.map +7 -0
  43. package/dist/modules/resources/message-objects.js +37 -0
  44. package/dist/modules/resources/message-objects.js.map +7 -0
  45. package/dist/modules/sales/backend/sales/channels/[channelId]/edit/page.js +19 -0
  46. package/dist/modules/sales/backend/sales/channels/[channelId]/edit/page.js.map +2 -2
  47. package/dist/modules/sales/backend/sales/documents/[id]/page.js +23 -2
  48. package/dist/modules/sales/backend/sales/documents/[id]/page.js.map +2 -2
  49. package/dist/modules/sales/backend/sales/quotes/[id]/page.js +1 -1
  50. package/dist/modules/sales/backend/sales/quotes/[id]/page.js.map +2 -2
  51. package/dist/modules/sales/lib/messageObjectPreviews.js +49 -4
  52. package/dist/modules/sales/lib/messageObjectPreviews.js.map +2 -2
  53. package/dist/modules/sales/message-objects.js +44 -2
  54. package/dist/modules/sales/message-objects.js.map +2 -2
  55. package/dist/modules/sales/widgets/messages/SalesDocumentMessageDetail.js +59 -30
  56. package/dist/modules/sales/widgets/messages/SalesDocumentMessageDetail.js.map +2 -2
  57. package/dist/modules/sales/widgets/messages/SalesDocumentMessagePreview.js +1 -1
  58. package/dist/modules/sales/widgets/messages/SalesDocumentMessagePreview.js.map +1 -1
  59. package/dist/modules/staff/backend/staff/leave-requests/[id]/page.js +8 -30
  60. package/dist/modules/staff/backend/staff/leave-requests/[id]/page.js.map +2 -2
  61. package/dist/modules/staff/backend/staff/my-availability/page.js +13 -0
  62. package/dist/modules/staff/backend/staff/my-availability/page.js.map +2 -2
  63. package/dist/modules/staff/backend/staff/my-leave-requests/[id]/page.js +8 -31
  64. package/dist/modules/staff/backend/staff/my-leave-requests/[id]/page.js.map +2 -2
  65. package/dist/modules/staff/backend/staff/team-members/[id]/page.js +32 -10
  66. package/dist/modules/staff/backend/staff/team-members/[id]/page.js.map +2 -2
  67. package/dist/modules/staff/backend/staff/team-roles/[id]/edit/page.js +14 -1
  68. package/dist/modules/staff/backend/staff/team-roles/[id]/edit/page.js.map +2 -2
  69. package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js +14 -1
  70. package/dist/modules/staff/backend/staff/teams/[id]/edit/page.js.map +2 -2
  71. package/dist/modules/staff/components/TeamForm.js +4 -2
  72. package/dist/modules/staff/components/TeamForm.js.map +2 -2
  73. package/dist/modules/staff/components/TeamRoleForm.js +4 -2
  74. package/dist/modules/staff/components/TeamRoleForm.js.map +2 -2
  75. package/dist/modules/staff/lib/messageObjectPreviews.js +111 -2
  76. package/dist/modules/staff/lib/messageObjectPreviews.js.map +2 -2
  77. package/dist/modules/staff/message-objects.js +79 -8
  78. package/dist/modules/staff/message-objects.js.map +2 -2
  79. package/package.json +2 -2
  80. package/src/modules/catalog/backend/catalog/categories/[id]/edit/page.tsx +19 -5
  81. package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +14 -0
  82. package/src/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.tsx +40 -0
  83. package/src/modules/catalog/lib/messageObjectPreviews.ts +176 -0
  84. package/src/modules/catalog/message-objects.ts +102 -0
  85. package/src/modules/currencies/backend/currencies/[id]/page.tsx +20 -0
  86. package/src/modules/currencies/lib/messageObjectPreviews.ts +65 -0
  87. package/src/modules/currencies/message-objects.ts +40 -0
  88. package/src/modules/customers/backend/customers/companies/[id]/page.tsx +19 -0
  89. package/src/modules/customers/backend/customers/deals/[id]/page.tsx +13 -0
  90. package/src/modules/customers/backend/customers/people/[id]/page.tsx +19 -0
  91. package/src/modules/customers/components/detail/CompanyHighlights.tsx +14 -9
  92. package/src/modules/customers/components/detail/PersonHighlights.tsx +14 -9
  93. package/src/modules/customers/lib/messageObjectPreviews.ts +43 -3
  94. package/src/modules/customers/message-objects.ts +31 -11
  95. package/src/modules/messages/commands/messages.ts +4 -0
  96. package/src/modules/messages/components/message-detail/panels/objects-panel.tsx +8 -1
  97. package/src/modules/messages/components/message-detail/panels/thread-panel.tsx +3 -0
  98. package/src/modules/messages/frontend/messages/view/[token]/page.tsx +1 -0
  99. package/src/modules/resources/backend/resources/resources/[id]/page.tsx +20 -4
  100. package/src/modules/resources/lib/messageObjectPreviews.ts +55 -0
  101. package/src/modules/resources/message-objects.ts +36 -0
  102. package/src/modules/sales/backend/sales/channels/[channelId]/edit/page.tsx +18 -0
  103. package/src/modules/sales/backend/sales/documents/[id]/page.tsx +23 -0
  104. package/src/modules/sales/backend/sales/quotes/[id]/page.tsx +1 -1
  105. package/src/modules/sales/lib/messageObjectPreviews.ts +54 -4
  106. package/src/modules/sales/message-objects.ts +44 -2
  107. package/src/modules/sales/widgets/messages/SalesDocumentMessageDetail.tsx +72 -34
  108. package/src/modules/sales/widgets/messages/SalesDocumentMessagePreview.tsx +1 -1
  109. package/src/modules/staff/backend/staff/leave-requests/[id]/page.tsx +7 -29
  110. package/src/modules/staff/backend/staff/my-availability/page.tsx +14 -0
  111. package/src/modules/staff/backend/staff/my-leave-requests/[id]/page.tsx +8 -30
  112. package/src/modules/staff/backend/staff/team-members/[id]/page.tsx +28 -7
  113. package/src/modules/staff/backend/staff/team-roles/[id]/edit/page.tsx +12 -0
  114. package/src/modules/staff/backend/staff/teams/[id]/edit/page.tsx +12 -0
  115. package/src/modules/staff/components/TeamForm.tsx +3 -0
  116. package/src/modules/staff/components/TeamRoleForm.tsx +3 -0
  117. package/src/modules/staff/lib/messageObjectPreviews.ts +133 -2
  118. package/src/modules/staff/message-objects.ts +79 -8
  119. package/dist/modules/customers/widgets/messages/CustomerMessageObjectDetail.js +0 -51
  120. package/dist/modules/customers/widgets/messages/CustomerMessageObjectDetail.js.map +0 -7
  121. package/dist/modules/customers/widgets/messages/CustomerMessageObjectPreview.js +0 -35
  122. package/dist/modules/customers/widgets/messages/CustomerMessageObjectPreview.js.map +0 -7
  123. package/dist/modules/customers/widgets/messages/index.js +0 -7
  124. package/dist/modules/customers/widgets/messages/index.js.map +0 -7
  125. package/dist/modules/staff/widgets/messages/StaffMessageObjectDetail.js +0 -51
  126. package/dist/modules/staff/widgets/messages/StaffMessageObjectDetail.js.map +0 -7
  127. package/dist/modules/staff/widgets/messages/StaffMessageObjectPreview.js +0 -34
  128. package/dist/modules/staff/widgets/messages/StaffMessageObjectPreview.js.map +0 -7
  129. package/dist/modules/staff/widgets/messages/index.js +0 -7
  130. package/dist/modules/staff/widgets/messages/index.js.map +0 -7
  131. package/src/modules/customers/widgets/messages/CustomerMessageObjectDetail.tsx +0 -57
  132. package/src/modules/customers/widgets/messages/CustomerMessageObjectPreview.tsx +0 -49
  133. package/src/modules/customers/widgets/messages/index.ts +0 -2
  134. package/src/modules/staff/widgets/messages/StaffMessageObjectDetail.tsx +0 -57
  135. package/src/modules/staff/widgets/messages/StaffMessageObjectPreview.tsx +0 -44
  136. package/src/modules/staff/widgets/messages/index.ts +0 -2
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { Page, PageBody } from "@open-mercato/ui/backend/Page";
5
5
  import { CrudForm } from "@open-mercato/ui/backend/CrudForm";
@@ -11,6 +11,7 @@ import { useT } from "@open-mercato/shared/lib/i18n/context";
11
11
  import { E } from "../../../../../../../generated/entities.ids.generated.js";
12
12
  import { CategorySelect } from "../../../../../components/categories/CategorySelect.js";
13
13
  import { CategorySlugFieldSync } from "../../../../../components/categories/CategorySlugFieldSync.js";
14
+ import { SendObjectMessageDialog } from "@open-mercato/ui/backend/messages";
14
15
  async function submitCategoryUpdate(categoryId, values, t) {
15
16
  const resolvedId = typeof values.id === "string" && values.id.length ? values.id : categoryId;
16
17
  if (!resolvedId) {
@@ -163,7 +164,21 @@ function EditCatalogCategoryPage({ params }) {
163
164
  submitLabel: t("catalog.categories.form.action.save", "Save"),
164
165
  cancelHref: "/backend/catalog/categories",
165
166
  successRedirect: `/backend/catalog/categories?flash=${encodeURIComponent(t("catalog.categories.flash.updated", "Category updated"))}&type=success`,
166
- extraActions: pathLabel ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: t("catalog.categories.form.pathLabel", { path: pathLabel }) }) : null,
167
+ extraActions: /* @__PURE__ */ jsxs(Fragment, { children: [
168
+ /* @__PURE__ */ jsx(
169
+ SendObjectMessageDialog,
170
+ {
171
+ object: {
172
+ entityModule: "catalog",
173
+ entityType: "category",
174
+ entityId: categoryId,
175
+ previewData: { title: initialValues?.name ?? categoryId }
176
+ },
177
+ viewHref: `/backend/catalog/categories/${categoryId}/edit`
178
+ }
179
+ ),
180
+ pathLabel ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: t("catalog.categories.form.pathLabel", { path: pathLabel }) }) : null
181
+ ] }),
167
182
  onSubmit: async (values) => {
168
183
  await submitCategoryUpdate(categoryId, values, t);
169
184
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../../src/modules/catalog/backend/catalog/categories/%5Bid%5D/edit/page.tsx"],
4
- "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { CrudForm, type CrudField, type CrudFormGroup } from '@open-mercato/ui/backend/CrudForm'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { updateCrud, deleteCrud } from '@open-mercato/ui/backend/utils/crud'\nimport { createCrudFormError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { collectCustomFieldValues } from '@open-mercato/ui/backend/utils/customFieldValues'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { E } from '#generated/entities.ids.generated'\nimport { CategorySelect } from '../../../../../components/categories/CategorySelect'\nimport { CategorySlugFieldSync } from '../../../../../components/categories/CategorySlugFieldSync'\n\ntype CategoryRow = {\n id: string\n name: string\n slug: string | null\n description: string | null\n parentId: string | null\n isActive: boolean\n pathLabel?: string\n}\n\ntype CategoryResponse = {\n items?: CategoryRow[]\n}\n\ntype CategoryFormValues = {\n id?: string\n name: string\n slug?: string\n description?: string\n parentId?: string | null\n isActive?: boolean\n}\n\nasync function submitCategoryUpdate(\n categoryId: string,\n values: CategoryFormValues,\n t: (key: string, fallback?: string) => string,\n) {\n const resolvedId = typeof values.id === 'string' && values.id.length ? values.id : categoryId\n if (!resolvedId) {\n const message = t('catalog.categories.form.errors.idRequired', 'Category identifier is required.')\n throw createCrudFormError(message, { id: message })\n }\n const name = typeof values.name === 'string' ? values.name.trim() : ''\n if (!name) {\n const message = t('catalog.categories.form.errors.name', 'Provide the category name.')\n throw createCrudFormError(message, { name: message })\n }\n const slug = typeof values.slug === 'string' && values.slug.trim().length ? values.slug.trim() : undefined\n const description =\n typeof values.description === 'string' && values.description.trim().length\n ? values.description.trim()\n : undefined\n const parentId =\n typeof values.parentId === 'string' && values.parentId.trim().length\n ? values.parentId.trim()\n : null\n const customFields = collectCustomFieldValues(values as Record<string, unknown>)\n const payload: Record<string, unknown> = {\n id: resolvedId,\n name,\n slug,\n description,\n parentId,\n isActive: values.isActive !== false,\n }\n if (Object.keys(customFields).length > 0) payload.customFields = customFields\n await updateCrud('catalog/categories', payload)\n}\n\nexport default function EditCatalogCategoryPage({ params }: { params?: { id?: string } }) {\n const categoryId = params?.id ?? ''\n const t = useT()\n const [initialValues, setInitialValues] = React.useState<CategoryFormValues | null>(null)\n const [pathLabel, setPathLabel] = React.useState<string>('')\n const [loading, setLoading] = React.useState<boolean>(true)\n const [error, setError] = React.useState<string | null>(null)\n\n React.useEffect(() => {\n if (!categoryId) return\n let cancelled = false\n async function load() {\n setLoading(true)\n setError(null)\n try {\n const { ok, result } = await apiCall<CategoryResponse>(\n `/api/catalog/categories?view=manage&ids=${encodeURIComponent(categoryId)}&status=all&page=1&pageSize=1`,\n )\n if (!ok) throw new Error(t('catalog.categories.form.errors.load', 'Failed to load category'))\n const record = Array.isArray(result?.items) ? result.items?.[0] : null\n if (!record) throw new Error(t('catalog.categories.form.errors.notFound', 'Category not found'))\n if (cancelled) return\n const customValues: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(record as Record<string, unknown>)) {\n if (key.startsWith('cf_')) customValues[key] = value\n else if (key.startsWith('cf:')) customValues[`cf_${key.slice(3)}`] = value\n }\n setInitialValues({\n id: record.id,\n name: record.name,\n slug: record.slug ?? '',\n description: record.description ?? '',\n parentId: record.parentId ?? '',\n isActive: record.isActive,\n ...customValues,\n })\n setPathLabel(record.pathLabel ?? '')\n } catch (err) {\n if (!cancelled) {\n const fallback = t('catalog.categories.form.errors.load', 'Failed to load category')\n const message = err instanceof Error ? err.message : fallback\n setError(message)\n }\n } finally {\n if (!cancelled) setLoading(false)\n }\n }\n load()\n return () => {\n cancelled = true\n }\n }, [categoryId, t])\n\n const fields = React.useMemo<CrudField[]>(() => [\n {\n id: 'name',\n label: t('catalog.categories.form.field.name', 'Name'),\n type: 'text',\n required: true,\n placeholder: t('catalog.categories.form.field.namePlaceholder', 'e.g., Footwear'),\n },\n {\n id: 'slug',\n label: t('catalog.categories.form.field.slug', 'Slug'),\n type: 'text',\n description: t('catalog.categories.form.field.slugHelp', 'Lowercase identifier for URLs or imports.'),\n },\n {\n id: 'description',\n label: t('catalog.categories.form.field.description', 'Description'),\n type: 'textarea',\n },\n {\n id: 'parentId',\n label: t('catalog.categories.form.field.parent', 'Parent'),\n type: 'custom',\n component: ({ id, value, setValue }) => (\n <CategorySelect\n id={id}\n value={typeof value === 'string' ? value : null}\n onChange={(next) => setValue(next ?? '')}\n includeEmptyOption\n className=\"w-full h-9 rounded border px-2 text-sm\"\n />\n ),\n },\n {\n id: 'isActive',\n label: t('catalog.categories.form.field.isActive', 'Active'),\n type: 'checkbox',\n },\n ], [t])\n\n const groups = React.useMemo<CrudFormGroup[]>(() => [\n {\n id: 'details',\n title: t('catalog.categories.form.group.details', 'Details'),\n column: 1,\n fields: ['name', 'slug', 'description', 'parentId', 'isActive'],\n component: (ctx) => <CategorySlugFieldSync {...ctx} />,\n },\n {\n id: 'custom',\n title: t('catalog.categories.form.group.custom', 'Custom data'),\n column: 2,\n kind: 'customFields',\n },\n ], [t])\n\n if (!categoryId) {\n return (\n <Page>\n <PageBody>\n <p className=\"text-sm text-destructive\">\n {t('catalog.categories.form.errors.idRequired', 'Category identifier is required.')}\n </p>\n </PageBody>\n </Page>\n )\n }\n\n return (\n <Page>\n <PageBody>\n {error ? (\n <div className=\"mb-4 rounded border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive\">\n {error}\n </div>\n ) : null}\n <CrudForm<CategoryFormValues>\n title={t('catalog.categories.form.editTitle', 'Edit category')}\n backHref=\"/backend/catalog/categories\"\n versionHistory={{ resourceKind: 'catalog.category', resourceId: categoryId ? String(categoryId) : '' }}\n fields={fields}\n groups={groups}\n entityId={E.catalog.catalog_product_category}\n initialValues={initialValues ?? { id: categoryId, name: '', slug: '', description: '', parentId: '', isActive: true }}\n isLoading={loading}\n loadingMessage={t('catalog.categories.form.loading', 'Loading category...')}\n submitLabel={t('catalog.categories.form.action.save', 'Save')}\n cancelHref=\"/backend/catalog/categories\"\n successRedirect={`/backend/catalog/categories?flash=${encodeURIComponent(t('catalog.categories.flash.updated', 'Category updated'))}&type=success`}\n extraActions={pathLabel ? (\n <span className=\"text-xs text-muted-foreground\">\n {t('catalog.categories.form.pathLabel', { path: pathLabel })}\n </span>\n ) : null}\n onSubmit={async (values) => {\n await submitCategoryUpdate(categoryId, values, t)\n }}\n onDelete={async () => {\n await deleteCrud('catalog/categories', categoryId, {\n errorMessage: t('catalog.categories.form.errors.delete', 'Failed to delete category'),\n })\n }}\n deleteRedirect={`/backend/catalog/categories?flash=${encodeURIComponent(t('catalog.categories.flash.deleted', 'Category archived'))}&type=success`}\n />\n </PageBody>\n </Page>\n )\n}\n"],
5
- "mappings": ";AAuJQ,cA8CF,YA9CE;AArJR,YAAY,WAAW;AACvB,SAAS,MAAM,gBAAgB;AAC/B,SAAS,gBAAoD;AAC7D,SAAS,eAAe;AACxB,SAAS,YAAY,kBAAkB;AACvC,SAAS,2BAA2B;AACpC,SAAS,gCAAgC;AACzC,SAAS,YAAY;AACrB,SAAS,SAAS;AAClB,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AAyBtC,eAAe,qBACb,YACA,QACA,GACA;AACA,QAAM,aAAa,OAAO,OAAO,OAAO,YAAY,OAAO,GAAG,SAAS,OAAO,KAAK;AACnF,MAAI,CAAC,YAAY;AACf,UAAM,UAAU,EAAE,6CAA6C,kCAAkC;AACjG,UAAM,oBAAoB,SAAS,EAAE,IAAI,QAAQ,CAAC;AAAA,EACpD;AACA,QAAM,OAAO,OAAO,OAAO,SAAS,WAAW,OAAO,KAAK,KAAK,IAAI;AACpE,MAAI,CAAC,MAAM;AACT,UAAM,UAAU,EAAE,uCAAuC,4BAA4B;AACrF,UAAM,oBAAoB,SAAS,EAAE,MAAM,QAAQ,CAAC;AAAA,EACtD;AACA,QAAM,OAAO,OAAO,OAAO,SAAS,YAAY,OAAO,KAAK,KAAK,EAAE,SAAS,OAAO,KAAK,KAAK,IA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Aa,OAAO,UAAU,IAAI,GAAG;AAAA,QACrG;AAAA,QACA;AAAA,QACA,UAAU,EAAE,QAAQ;AAAA,QACpB,eAAe,iBAAiB,EAAE,IAAI,YAAY,MAAM,IAAI,MAAM,IAAI,aAAa,IAAI,UAAU,IAAI,UAAU,KAAK;AAAA,QACpH,WAAW;AAAA,QACX,gBAAgB,EAAE,mCAAmC,qBAAqB;AAAA,QAC1E,aAAa,EAAE,uCAAuC,MAAM;AAAA,QAC5D,YAAW;AAAA,QACX,iBAAiB,qCAAqC,mBAAmB,EAAE,oCAAoC,kBAAkB,CAAC,CAAC;AAAA,QACnI,cAAc,YACZ,oBAAC,UAAK,WAAU,iCACb,YAAE,qCAAqC,EAAE,MAAM,UAAU,CAAC,GAC7D,IACE;AAAA,QACJ,UAAU,OAAO,WAAW;AAC1B,gBAAM,qBAAqB,YAAY,QAAQ,CAAC;AAAA,QAClD;AAAA,QACA,UAAU,YAAY;AACpB,gBAAM,WAAW,sBAAsB,YAAY;AAAA,YACjD,cAAc,EAAE,yCAAyC,2BAA2B;AAAA,UACtF,CAAC;AAAA,QACH;AAAA,QACA,gBAAgB,qCAAqC,mBAAmB,EAAE,oCAAoC,mBAAmB,CAAC,CAAC;AAAA;AAAA,IACrI;AAAA,KACF,GACF;AAEJ;",
4
+ "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { CrudForm, type CrudField, type CrudFormGroup } from '@open-mercato/ui/backend/CrudForm'\nimport { apiCall } from '@open-mercato/ui/backend/utils/apiCall'\nimport { updateCrud, deleteCrud } from '@open-mercato/ui/backend/utils/crud'\nimport { createCrudFormError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { collectCustomFieldValues } from '@open-mercato/ui/backend/utils/customFieldValues'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { E } from '#generated/entities.ids.generated'\nimport { CategorySelect } from '../../../../../components/categories/CategorySelect'\nimport { CategorySlugFieldSync } from '../../../../../components/categories/CategorySlugFieldSync'\nimport { SendObjectMessageDialog } from '@open-mercato/ui/backend/messages'\n\ntype CategoryRow = {\n id: string\n name: string\n slug: string | null\n description: string | null\n parentId: string | null\n isActive: boolean\n pathLabel?: string\n}\n\ntype CategoryResponse = {\n items?: CategoryRow[]\n}\n\ntype CategoryFormValues = {\n id?: string\n name: string\n slug?: string\n description?: string\n parentId?: string | null\n isActive?: boolean\n}\n\nasync function submitCategoryUpdate(\n categoryId: string,\n values: CategoryFormValues,\n t: (key: string, fallback?: string) => string,\n) {\n const resolvedId = typeof values.id === 'string' && values.id.length ? values.id : categoryId\n if (!resolvedId) {\n const message = t('catalog.categories.form.errors.idRequired', 'Category identifier is required.')\n throw createCrudFormError(message, { id: message })\n }\n const name = typeof values.name === 'string' ? values.name.trim() : ''\n if (!name) {\n const message = t('catalog.categories.form.errors.name', 'Provide the category name.')\n throw createCrudFormError(message, { name: message })\n }\n const slug = typeof values.slug === 'string' && values.slug.trim().length ? values.slug.trim() : undefined\n const description =\n typeof values.description === 'string' && values.description.trim().length\n ? values.description.trim()\n : undefined\n const parentId =\n typeof values.parentId === 'string' && values.parentId.trim().length\n ? values.parentId.trim()\n : null\n const customFields = collectCustomFieldValues(values as Record<string, unknown>)\n const payload: Record<string, unknown> = {\n id: resolvedId,\n name,\n slug,\n description,\n parentId,\n isActive: values.isActive !== false,\n }\n if (Object.keys(customFields).length > 0) payload.customFields = customFields\n await updateCrud('catalog/categories', payload)\n}\n\nexport default function EditCatalogCategoryPage({ params }: { params?: { id?: string } }) {\n const categoryId = params?.id ?? ''\n const t = useT()\n const [initialValues, setInitialValues] = React.useState<CategoryFormValues | null>(null)\n const [pathLabel, setPathLabel] = React.useState<string>('')\n const [loading, setLoading] = React.useState<boolean>(true)\n const [error, setError] = React.useState<string | null>(null)\n\n React.useEffect(() => {\n if (!categoryId) return\n let cancelled = false\n async function load() {\n setLoading(true)\n setError(null)\n try {\n const { ok, result } = await apiCall<CategoryResponse>(\n `/api/catalog/categories?view=manage&ids=${encodeURIComponent(categoryId)}&status=all&page=1&pageSize=1`,\n )\n if (!ok) throw new Error(t('catalog.categories.form.errors.load', 'Failed to load category'))\n const record = Array.isArray(result?.items) ? result.items?.[0] : null\n if (!record) throw new Error(t('catalog.categories.form.errors.notFound', 'Category not found'))\n if (cancelled) return\n const customValues: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(record as Record<string, unknown>)) {\n if (key.startsWith('cf_')) customValues[key] = value\n else if (key.startsWith('cf:')) customValues[`cf_${key.slice(3)}`] = value\n }\n setInitialValues({\n id: record.id,\n name: record.name,\n slug: record.slug ?? '',\n description: record.description ?? '',\n parentId: record.parentId ?? '',\n isActive: record.isActive,\n ...customValues,\n })\n setPathLabel(record.pathLabel ?? '')\n } catch (err) {\n if (!cancelled) {\n const fallback = t('catalog.categories.form.errors.load', 'Failed to load category')\n const message = err instanceof Error ? err.message : fallback\n setError(message)\n }\n } finally {\n if (!cancelled) setLoading(false)\n }\n }\n load()\n return () => {\n cancelled = true\n }\n }, [categoryId, t])\n\n const fields = React.useMemo<CrudField[]>(() => [\n {\n id: 'name',\n label: t('catalog.categories.form.field.name', 'Name'),\n type: 'text',\n required: true,\n placeholder: t('catalog.categories.form.field.namePlaceholder', 'e.g., Footwear'),\n },\n {\n id: 'slug',\n label: t('catalog.categories.form.field.slug', 'Slug'),\n type: 'text',\n description: t('catalog.categories.form.field.slugHelp', 'Lowercase identifier for URLs or imports.'),\n },\n {\n id: 'description',\n label: t('catalog.categories.form.field.description', 'Description'),\n type: 'textarea',\n },\n {\n id: 'parentId',\n label: t('catalog.categories.form.field.parent', 'Parent'),\n type: 'custom',\n component: ({ id, value, setValue }) => (\n <CategorySelect\n id={id}\n value={typeof value === 'string' ? value : null}\n onChange={(next) => setValue(next ?? '')}\n includeEmptyOption\n className=\"w-full h-9 rounded border px-2 text-sm\"\n />\n ),\n },\n {\n id: 'isActive',\n label: t('catalog.categories.form.field.isActive', 'Active'),\n type: 'checkbox',\n },\n ], [t])\n\n const groups = React.useMemo<CrudFormGroup[]>(() => [\n {\n id: 'details',\n title: t('catalog.categories.form.group.details', 'Details'),\n column: 1,\n fields: ['name', 'slug', 'description', 'parentId', 'isActive'],\n component: (ctx) => <CategorySlugFieldSync {...ctx} />,\n },\n {\n id: 'custom',\n title: t('catalog.categories.form.group.custom', 'Custom data'),\n column: 2,\n kind: 'customFields',\n },\n ], [t])\n\n if (!categoryId) {\n return (\n <Page>\n <PageBody>\n <p className=\"text-sm text-destructive\">\n {t('catalog.categories.form.errors.idRequired', 'Category identifier is required.')}\n </p>\n </PageBody>\n </Page>\n )\n }\n\n return (\n <Page>\n <PageBody>\n {error ? (\n <div className=\"mb-4 rounded border border-destructive/50 bg-destructive/10 px-3 py-2 text-sm text-destructive\">\n {error}\n </div>\n ) : null}\n <CrudForm<CategoryFormValues>\n title={t('catalog.categories.form.editTitle', 'Edit category')}\n backHref=\"/backend/catalog/categories\"\n versionHistory={{ resourceKind: 'catalog.category', resourceId: categoryId ? String(categoryId) : '' }}\n fields={fields}\n groups={groups}\n entityId={E.catalog.catalog_product_category}\n initialValues={initialValues ?? { id: categoryId, name: '', slug: '', description: '', parentId: '', isActive: true }}\n isLoading={loading}\n loadingMessage={t('catalog.categories.form.loading', 'Loading category...')}\n submitLabel={t('catalog.categories.form.action.save', 'Save')}\n cancelHref=\"/backend/catalog/categories\"\n successRedirect={`/backend/catalog/categories?flash=${encodeURIComponent(t('catalog.categories.flash.updated', 'Category updated'))}&type=success`}\n extraActions={(\n <>\n <SendObjectMessageDialog\n object={{\n entityModule: 'catalog',\n entityType: 'category',\n entityId: categoryId,\n previewData: { title: initialValues?.name ?? categoryId },\n }}\n viewHref={`/backend/catalog/categories/${categoryId}/edit`}\n />\n {pathLabel ? (\n <span className=\"text-xs text-muted-foreground\">\n {t('catalog.categories.form.pathLabel', { path: pathLabel })}\n </span>\n ) : null}\n </>\n )}\n onSubmit={async (values) => {\n await submitCategoryUpdate(categoryId, values, t)\n }}\n onDelete={async () => {\n await deleteCrud('catalog/categories', categoryId, {\n errorMessage: t('catalog.categories.form.errors.delete', 'Failed to delete category'),\n })\n }}\n deleteRedirect={`/backend/catalog/categories?flash=${encodeURIComponent(t('catalog.categories.flash.deleted', 'Category archived'))}&type=success`}\n />\n </PageBody>\n </Page>\n )\n}\n"],
5
+ "mappings": ";AAwJQ,SAkEI,UAlEJ,KAkEI,YAlEJ;AAtJR,YAAY,WAAW;AACvB,SAAS,MAAM,gBAAgB;AAC/B,SAAS,gBAAoD;AAC7D,SAAS,eAAe;AACxB,SAAS,YAAY,kBAAkB;AACvC,SAAS,2BAA2B;AACpC,SAAS,gCAAgC;AACzC,SAAS,YAAY;AACrB,SAAS,SAAS;AAClB,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AACtC,SAAS,+BAA+B;AAyBxC,eAAe,qBACb,YACA,QACA,GACA;AACA,QAAM,aAAa,OAAO,OAAO,OAAO,YAAY,OAAO,GAAG,SAAS,OAAO,KAAK;AACnF,MAAI,CAAC,YAAY;AACf,UAAM,UAAU,EAAE,6CAA6C,kCAAkC;AACjG,UAAM,oBAAoB,SAAS,EAAE,IAAI,QAAQ,CAAC;AAAA,EACpD;AACA,QAAM,OAAO,OAAO,OAAO,SAAS,WAAW,OAAO,KAAK,KAAK,IAAI;AACpE,MAAI,CAAC,MAAM;AACT,UAAM,UAAU,EAAE,uCAAuC,4BAA4B;AACrF,UAAM,oBAAoB,SAAS,EAAE,MAAM,QAAQ,CAAC;AAAA,EACtD;AACA,QAAM,OAAO,OAAO,OAAO,SAAS,YAAY,OAAO,KAAK,KAAK,EAAE,SAAS,OAAO,KAAK,KAAK,IAAI;AACjG,QAAM,cACJ,OAAO,OAAO,gBAAgB,YAAY,OAAO,YAAY,KAAK,EAAE,SAChE,OAAO,YAAY,KAAK,IACxB;AACN,QAAM,WACJ,OAAO,OAAO,aAAa,YAAY,OAAO,SAAS,KAAK,EAAE,SAC1D,OAAO,SAAS,KAAK,IACrB;AAC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W;AAAA,QACX,gBAAgB,EAAE,mCAAmC,qBAAqB;AAAA,QAC1E,aAAa,EAAE,uCAAuC,MAAM;AAAA,QAC5D,YAAW;AAAA,QACX,iBAAiB,qCAAqC,mBAAmB,EAAE,oCAAoC,kBAAkB,CAAC,CAAC;AAAA,QACnI,cACE,iCACE;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,QAAQ;AAAA,gBACN,cAAc;AAAA,gBACd,YAAY;AAAA,gBACZ,UAAU;AAAA,gBACV,aAAa,EAAE,OAAO,eAAe,QAAQ,WAAW;AAAA,cAC1D;AAAA,cACA,UAAU,+BAA+B,UAAU;AAAA;AAAA,UACrD;AAAA,UACC,YACC,oBAAC,UAAK,WAAU,iCACb,YAAE,qCAAqC,EAAE,MAAM,UAAU,CAAC,GAC7D,IACE;AAAA,WACN;AAAA,QAEF,UAAU,OAAO,WAAW;AAC1B,gBAAM,qBAAqB,YAAY,QAAQ,CAAC;AAAA,QAClD;AAAA,QACA,UAAU,YAAY;AACpB,gBAAM,WAAW,sBAAsB,YAAY;AAAA,YACjD,cAAc,EAAE,yCAAyC,2BAA2B;AAAA,UACtF,CAAC;AAAA,QACH;AAAA,QACA,gBAAgB,qCAAqC,mBAAmB,EAAE,oCAAoC,mBAAmB,CAAC,CAAC;AAAA;AAAA,IACrI;AAAA,KACF,GACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -87,6 +87,7 @@ import {
87
87
  DialogHeader,
88
88
  DialogTitle
89
89
  } from "@open-mercato/ui/primitives/dialog";
90
+ import { SendObjectMessageDialog } from "@open-mercato/ui/backend/messages/SendObjectMessageDialog.tsx";
90
91
  const MarkdownEditor = dynamic(() => import("@uiw/react-md-editor"), {
91
92
  ssr: false,
92
93
  loading: () => /* @__PURE__ */ jsx("div", { className: "flex h-48 items-center justify-center text-sm text-muted-foreground", children: /* @__PURE__ */ jsx(Spinner, {}) })
@@ -911,6 +912,20 @@ function EditCatalogProductPage({
911
912
  resourceKind: "catalog.product",
912
913
  resourceId: productId ? String(productId) : ""
913
914
  },
915
+ extraActions: productId ? /* @__PURE__ */ jsx(
916
+ SendObjectMessageDialog,
917
+ {
918
+ object: {
919
+ entityModule: "catalog",
920
+ entityType: "product",
921
+ entityId: productId,
922
+ previewData: {
923
+ title: initialValues?.title ?? productId
924
+ }
925
+ },
926
+ viewHref: `/backend/catalog/products/${productId}/edit`
927
+ }
928
+ ) : void 0,
914
929
  fields: [],
915
930
  groups,
916
931
  injectionSpotId: "crud-form:catalog.product",