@burdenoff/microfe-product 2026.522.1 → 2026.524.1

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 (43) hide show
  1. package/dist/generated/global-operations.js +36 -29
  2. package/dist/generated/global-operations.js.map +1 -1
  3. package/dist/product-management/modules/content-pages/pages/ContentPageCreatePage.d.ts.map +1 -1
  4. package/dist/product-management/modules/content-pages/pages/ContentPageCreatePage.js +9 -1
  5. package/dist/product-management/modules/content-pages/pages/ContentPageCreatePage.js.map +1 -1
  6. package/dist/product-management/modules/feature-flags/pages/FeatureFlagCreatePage.js +1 -1
  7. package/dist/product-management/modules/feature-flags/pages/FeatureFlagCreatePage.js.map +1 -1
  8. package/dist/product-management/modules/feature-flags/pages/FeatureFlagDetailPage.d.ts.map +1 -1
  9. package/dist/product-management/modules/feature-flags/pages/FeatureFlagDetailPage.js +64 -63
  10. package/dist/product-management/modules/feature-flags/pages/FeatureFlagDetailPage.js.map +1 -1
  11. package/dist/product-management/modules/feature-flags/pages/FeatureFlagEditPage.js +1 -1
  12. package/dist/product-management/modules/feature-flags/pages/FeatureFlagEditPage.js.map +1 -1
  13. package/dist/product-management/modules/feature-flags/pages/FeatureFlagsListPage.d.ts.map +1 -1
  14. package/dist/product-management/modules/feature-flags/pages/FeatureFlagsListPage.js +78 -77
  15. package/dist/product-management/modules/feature-flags/pages/FeatureFlagsListPage.js.map +1 -1
  16. package/dist/product-management/modules/press-kit/pages/PressKitCreatePage.d.ts.map +1 -1
  17. package/dist/product-management/modules/press-kit/pages/PressKitCreatePage.js +9 -1
  18. package/dist/product-management/modules/press-kit/pages/PressKitCreatePage.js.map +1 -1
  19. package/dist/product-management/modules/press-kit/pages/PressKitListPage.d.ts.map +1 -1
  20. package/dist/product-management/modules/press-kit/pages/PressKitListPage.js +4 -0
  21. package/dist/product-management/modules/press-kit/pages/PressKitListPage.js.map +1 -1
  22. package/dist/product-management/modules/press-kit/schemas/index.d.ts +2 -0
  23. package/dist/product-management/modules/press-kit/schemas/index.d.ts.map +1 -1
  24. package/dist/product-management/modules/press-kit/schemas/index.js +2 -1
  25. package/dist/product-management/modules/press-kit/schemas/index.js.map +1 -1
  26. package/dist/product-management/modules/press-kit/types/index.d.ts +1 -1
  27. package/dist/product-management/modules/press-kit/types/index.d.ts.map +1 -1
  28. package/dist/product-management/modules/press-kit/types/index.js +2 -1
  29. package/dist/product-management/modules/press-kit/types/index.js.map +1 -1
  30. package/dist/product-management/modules/products/hooks/useProducts.d.ts +18 -0
  31. package/dist/product-management/modules/products/hooks/useProducts.d.ts.map +1 -1
  32. package/dist/product-management/modules/products/hooks/useProducts.js +37 -17
  33. package/dist/product-management/modules/products/hooks/useProducts.js.map +1 -1
  34. package/dist/product-management/modules/products/pages/ProductCreatePage.d.ts.map +1 -1
  35. package/dist/product-management/modules/products/pages/ProductCreatePage.js +59 -39
  36. package/dist/product-management/modules/products/pages/ProductCreatePage.js.map +1 -1
  37. package/dist/product-management/modules/products/pages/ProductDetailPage.d.ts.map +1 -1
  38. package/dist/product-management/modules/products/pages/ProductDetailPage.js +3 -3
  39. package/dist/product-management/modules/products/pages/ProductDetailPage.js.map +1 -1
  40. package/dist/product-management/modules/shortcuts/pages/ShortcutCreatePage.d.ts.map +1 -1
  41. package/dist/product-management/modules/shortcuts/pages/ShortcutCreatePage.js +38 -27
  42. package/dist/product-management/modules/shortcuts/pages/ShortcutCreatePage.js.map +1 -1
  43. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"PressKitListPage.js","names":[],"sources":["../../../../../src/product-management/modules/press-kit/pages/PressKitListPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Download, FileText, Plus, Eye, SquarePen, Trash2, RefreshCw } from 'lucide-react';\nimport { PermissionGate } from '@burdenoff/fe-libs/shared/components';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { useProductConsole } from '../../../providers/ProductConsoleProvider';\nimport { usePressKitAssets, useDeletePressKitAsset } from '../hooks/usePressKitAssets';\nimport { SearchInput } from '../../../shared/components/input/SearchInput';\nimport { exportToCsv } from '../../../shared/utils/exportUtils';\nimport { LoadingState } from '../../../shared/components/feedback/LoadingState';\nimport { ErrorState } from '../../../shared/components/feedback/ErrorState';\nimport type { PressKitAssetFilterInput, PressKitAssetCategory } from '../types';\nimport { nativeConfirm, nativeImpact, nativeNotify } from '../../../../utils/nativeBridge';\n\n/** Category tabs — each filters the list server-side by category ('' = All). */\nconst CATEGORY_TABS: { label: string; category: string }[] = [\n { label: 'All', category: '' },\n { label: 'Logos', category: 'LOGO' },\n { label: 'Banners', category: 'BANNER' },\n { label: 'Screenshots', category: 'SCREENSHOT' },\n { label: 'Brochures', category: 'BROCHURE' },\n { label: 'Documents', category: 'DOCUMENT' },\n { label: 'Press Releases', category: 'PRESS_RELEASE' },\n { label: 'Brand Guides', category: 'BRAND_GUIDE' },\n];\n\nfunction formatBytes(bytes: number | null): string {\n if (!bytes) return '—';\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB`;\n return `${(bytes / 1024 / 1024).toFixed(1)} MB`;\n}\n\nexport function PressKitListPage() {\n const { navigate, basePath = '/products' } = useProductConsole();\n const pressKitBasePath = `${basePath}/press-kit`;\n const [searchQuery, setSearchQuery] = useState('');\n const tr = useTr();\n const [filter, setFilter] = useState<PressKitAssetFilterInput>({});\n\n const { assets, loading, error, refetch } = usePressKitAssets(\n undefined,\n { ...filter, search: searchQuery || undefined },\n { limit: 50 }\n );\n\n const { deletePressKitAsset, loading: deleteLoading } = useDeletePressKitAsset();\n\n const handleDelete = async (id: string) => {\n void nativeImpact('medium');\n const message = tr('pressKit.confirmDelete', 'Delete this press kit asset?');\n const native = await nativeConfirm({\n title: 'Delete press kit asset',\n message,\n okButtonTitle: 'Delete',\n cancelButtonTitle: 'Cancel',\n });\n const ok = native === null ? window.confirm(message) : native;\n if (!ok) return;\n\n try {\n // `deletePressKitAsset` returns `Boolean!`. A throw covers hard failures\n // (network, auth, validation); the explicit `false` branch covers\n // soft-failure cases where the resolver resolved but the asset wasn't\n // actually removed — so we don't show a misleading success toast.\n const result = await deletePressKitAsset(id);\n if (!result.data?.deletePressKitAsset) {\n void nativeNotify('error');\n console.error('Press kit asset delete returned false:', id);\n return;\n }\n void nativeNotify('success');\n refetch();\n } catch (err) {\n void nativeNotify('error');\n console.error('Failed to delete press kit asset:', err);\n }\n };\n\n const formatDate = (dateString: string | null) => {\n if (!dateString) return '—';\n return new Date(dateString).toLocaleDateString('en-US', {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n };\n\n if (loading) {\n return (\n <div className=\"min-h-full bg-[var(--color-bg-canvas)] p-6\">\n <LoadingState message={tr('pressKit.loadingAssets', 'Loading press kit assets...')} />\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"min-h-full bg-[var(--color-bg-canvas)] p-6\">\n <ErrorState\n message={error.message}\n action={{ label: tr('productCommon.retry', 'Retry'), onClick: () => refetch() }}\n />\n </div>\n );\n }\n\n return (\n <div className=\"min-h-full bg-[var(--color-bg-canvas)] p-6 animate-in fade-in duration-300\">\n <div className=\"mb-6\">\n <div className=\"flex items-center justify-between mb-4\">\n <div>\n <h1 className=\"text-3xl font-bold text-text-primary mb-2\">\n {tr('pressKit.title', 'Press Kit')}\n </h1>\n <p className=\"text-text-secondary\">\n {tr('pressKit.subtitle', 'Manage downloadable press & media assets')}\n </p>\n </div>\n\n <PermissionGate role=\"super_admin\">\n <button\n onClick={() => navigate(`${pressKitBasePath}/new`)}\n className=\"inline-flex items-center gap-2 px-4 py-2 bg-[var(--color-action-primary-bg)] text-[var(--color-action-primary-text)] rounded-lg hover:opacity-90 hover:scale-[1.02] transition-all duration-200 font-medium\"\n >\n <Plus size={20} />\n {tr('pressKit.newAsset', 'New Asset')}\n </button>\n </PermissionGate>\n </div>\n\n {/* Category tabs */}\n <div className=\"flex flex-wrap gap-1 border-b border-default pb-px\">\n {CATEGORY_TABS.map((t) => {\n const active = (filter.category ?? '') === t.category;\n return (\n <button\n key={t.label}\n type=\"button\"\n onClick={() =>\n setFilter({\n ...filter,\n category: (t.category || undefined) as PressKitAssetCategory | undefined,\n })\n }\n className={`px-4 py-2 rounded-t-lg text-sm font-medium transition-all border-b-2 ${\n active\n ? 'border-[var(--color-action-primary-bg)] text-text-primary'\n : 'border-transparent text-text-secondary hover:text-text-primary'\n }`}\n >\n {t.label}\n </button>\n );\n })}\n </div>\n\n <div className=\"flex gap-4\">\n <SearchInput\n value={searchQuery}\n onChange={setSearchQuery}\n placeholder={tr('pressKit.searchPlaceholder', 'Search press kit assets...')}\n className=\"flex-1\"\n />\n\n <button\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-4 py-2 bg-surface text-text-primary border border-default rounded-lg hover:bg-muted transition-all duration-200\"\n >\n <RefreshCw size={18} />\n </button>\n\n {assets.length > 0 && (\n <button\n onClick={() =>\n exportToCsv(\n 'press-kit-assets',\n assets.map((a) => ({\n id: a.id,\n slug: a.slug,\n title: a.title,\n category: a.category,\n fileUrl: a.fileUrl,\n mimeType: a.mimeType ?? '',\n visibility: a.visibility,\n sortOrder: a.sortOrder,\n productId: a.productId,\n updatedAt: a.updatedAt,\n }))\n )\n }\n className=\"inline-flex items-center gap-2 px-4 py-2 bg-surface text-text-primary border border-default rounded-lg hover:bg-muted transition-all duration-200\"\n title={tr('pressKit.exportCsv', 'Export as CSV')}\n >\n <Download size={18} />\n </button>\n )}\n </div>\n </div>\n\n {assets.length === 0 ? (\n <div className=\"bg-surface border border-default rounded-lg p-12 text-center animate-in fade-in duration-300\">\n <p className=\"text-text-secondary mb-4\">\n {tr('pressKit.noAssetsFound', 'No press kit assets found')}\n </p>\n <PermissionGate role=\"super_admin\">\n <button\n onClick={() => navigate(`${pressKitBasePath}/new`)}\n className=\"inline-flex items-center gap-2 px-4 py-2 bg-[var(--color-action-primary-bg)] text-[var(--color-action-primary-text)] rounded-lg hover:opacity-90 hover:scale-[1.02] transition-all duration-200 font-medium\"\n >\n <Plus size={20} />\n {tr('pressKit.newAsset', 'New Asset')}\n </button>\n </PermissionGate>\n </div>\n ) : (\n <div className=\"bg-surface border border-default rounded-lg shadow-[var(--shadow-elevation-1)] overflow-hidden\">\n <table className=\"w-full\">\n <thead className=\"bg-muted border-b border-default\">\n <tr>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('pressKit.columnAsset', 'Asset')}\n </th>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('pressKit.columnCategory', 'Category')}\n </th>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('pressKit.columnFile', 'File')}\n </th>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('pressKit.columnVisibility', 'Visibility')}\n </th>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('pressKit.columnUpdated', 'Updated')}\n </th>\n <th className=\"text-right px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('pressKit.columnActions', 'Actions')}\n </th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-[var(--color-border-default)]\">\n {assets.map((asset) => (\n <tr\n key={asset.id}\n className=\"hover:bg-muted transition-all duration-200 cursor-pointer\"\n onClick={() => navigate(`${pressKitBasePath}/${asset.id}`)}\n >\n <td className=\"px-6 py-4\">\n <div className=\"flex items-center gap-3\">\n <div className=\"w-10 h-10 rounded-lg bg-[var(--color-status-info-subtle)] flex items-center justify-center overflow-hidden\">\n {asset.thumbnailUrl ? (\n <img\n src={asset.thumbnailUrl}\n alt=\"\"\n className=\"w-full h-full object-cover\"\n />\n ) : (\n <FileText size={20} className=\"text-[var(--color-status-info)]\" />\n )}\n </div>\n <div>\n <p className=\"font-medium text-text-primary\">{asset.title}</p>\n <p className=\"text-xs text-text-tertiary font-mono\">/{asset.slug}</p>\n </div>\n </div>\n </td>\n <td className=\"px-6 py-4\">\n <span className=\"text-xs font-medium px-2 py-1 rounded-full bg-[var(--color-status-info-subtle)] text-[var(--color-status-info)]\">\n {asset.category.replace(/_/g, ' ')}\n </span>\n </td>\n <td className=\"px-6 py-4\">\n <span className=\"text-sm text-text-secondary\">\n {(asset.mimeType ?? 'file').split('/').pop()} · {formatBytes(asset.fileSize)}\n </span>\n </td>\n <td className=\"px-6 py-4\">\n <span className=\"text-sm text-text-secondary\">{asset.visibility}</span>\n </td>\n <td className=\"px-6 py-4\">\n <span className=\"text-sm text-text-secondary\">\n {formatDate(asset.updatedAt)}\n </span>\n </td>\n <td className=\"px-6 py-4\">\n <div\n className=\"flex items-center justify-end gap-2\"\n onClick={(e) => e.stopPropagation()}\n >\n <a\n href={asset.fileUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"p-2 rounded-lg text-text-secondary hover:bg-muted transition-all duration-200\"\n title={tr('pressKit.download', 'Download')}\n >\n <Download size={18} />\n </a>\n <button\n onClick={() => navigate(`${pressKitBasePath}/${asset.id}`)}\n className=\"p-2 rounded-lg text-text-secondary hover:bg-muted transition-all duration-200\"\n title={tr('pressKit.viewDetails', 'View details')}\n >\n <Eye size={18} />\n </button>\n <PermissionGate role=\"super_admin\">\n <button\n onClick={() => navigate(`${pressKitBasePath}/${asset.id}/edit`)}\n className=\"p-2 rounded-lg text-text-secondary hover:bg-muted transition-all duration-200\"\n title={tr('pressKit.edit', 'Edit')}\n >\n <SquarePen size={18} />\n </button>\n <button\n onClick={() => handleDelete(asset.id)}\n disabled={deleteLoading}\n className=\"p-2 rounded-lg text-[var(--color-status-error)] hover:bg-[var(--color-status-error-subtle)] transition-all duration-200 disabled:opacity-50\"\n title={tr('pressKit.delete', 'Delete')}\n >\n <Trash2 size={18} />\n </button>\n </PermissionGate>\n </div>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,IAAM,IAAuD;CAC3D;EAA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AAM;SAAkB,CAAA;QACpE,CAAA;OACL,kBAAC,MAAD;QAAI,WAAU;kBACZ,kBAAC,QAAD;SAAM,WAAU;mBACb,EAAW,EAAM,UAAU;SACvB,CAAA;QACJ,CAAA;OACL,kBAAC,MAAD;QAAI,WAAU;kBACZ,kBAAC,OAAD;SACE,WAAU;SACV,UAAU,MAAM,EAAE,iBAAiB;mBAFrC;UAIE,kBAAC,KAAD;WACE,MAAM,EAAM;WACZ,QAAO;WACP,KAAI;WACJ,WAAU;WACV,OAAO,EAAG,qBAAqB,WAAW;qBAE1C,kBAAC,GAAD,EAAU,MAAM,IAAM,CAAA;WACpB,CAAA;UACJ,kBAAC,UAAD;WACE,eAAe,EAAS,GAAG,EAAiB,GAAG,EAAM,KAAK;WAC1D,WAAU;WACV,OAAO,EAAG,wBAAwB,eAAe;qBAEjD,kBAAC,GAAD,EAAK,MAAM,IAAM,CAAA;WACV,CAAA;UACT,kBAAC,GAAD;WAAgB,MAAK;qBAArB,CACE,kBAAC,UAAD;YACE,eAAe,EAAS,GAAG,EAAiB,GAAG,EAAM,GAAG,OAAO;YAC/D,WAAU;YACV,OAAO,EAAG,iBAAiB,OAAO;sBAElC,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;YAChB,CAAA,EACT,kBAAC,UAAD;YACE,eAAe,EAAa,EAAM,GAAG;YACrC,UAAU;YACV,WAAU;YACV,OAAO,EAAG,mBAAmB,SAAS;sBAEtC,kBAAC,GAAD,EAAQ,MAAM,IAAM,CAAA;YACb,CAAA,CACM;;UACb;;QACH,CAAA;OACF;QAjFE,EAAM,GAiFR,CACL;KACI,CAAA,CACF;;GACJ,CAAA,CAEJ"}
1
+ {"version":3,"file":"PressKitListPage.js","names":[],"sources":["../../../../../src/product-management/modules/press-kit/pages/PressKitListPage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Download, FileText, Plus, Eye, SquarePen, Trash2, RefreshCw } from 'lucide-react';\nimport { PermissionGate } from '@burdenoff/fe-libs/shared/components';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { useProductConsole } from '../../../providers/ProductConsoleProvider';\nimport { usePressKitAssets, useDeletePressKitAsset } from '../hooks/usePressKitAssets';\nimport { SearchInput } from '../../../shared/components/input/SearchInput';\nimport { exportToCsv } from '../../../shared/utils/exportUtils';\nimport { LoadingState } from '../../../shared/components/feedback/LoadingState';\nimport { ErrorState } from '../../../shared/components/feedback/ErrorState';\nimport type { PressKitAssetFilterInput, PressKitAssetCategory } from '../types';\nimport { nativeConfirm, nativeImpact, nativeNotify } from '../../../../utils/nativeBridge';\n\n/** Category tabs — each filters the list server-side by category ('' = All). */\nconst CATEGORY_TABS: { label: string; category: PressKitAssetCategory | '' }[] = [\n { label: 'All', category: '' },\n { label: 'Logos', category: 'LOGO' },\n { label: 'Banners', category: 'BANNER' },\n { label: 'Screenshots', category: 'SCREENSHOT' },\n { label: 'Brochures', category: 'BROCHURE' },\n { label: 'Documents', category: 'DOCUMENT' },\n { label: 'Press Releases', category: 'PRESS_RELEASE' },\n { label: 'Brand Guides', category: 'BRAND_GUIDE' },\n { label: 'Contracts', category: 'CONTRACT' },\n];\n\nfunction formatBytes(bytes: number | null): string {\n if (!bytes) return '—';\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(0)} KB`;\n return `${(bytes / 1024 / 1024).toFixed(1)} MB`;\n}\n\nexport function PressKitListPage() {\n const { navigate, basePath = '/products' } = useProductConsole();\n const pressKitBasePath = `${basePath}/press-kit`;\n const [searchQuery, setSearchQuery] = useState('');\n const tr = useTr();\n const [filter, setFilter] = useState<PressKitAssetFilterInput>({});\n\n const { assets, loading, error, refetch } = usePressKitAssets(\n undefined,\n { ...filter, search: searchQuery || undefined },\n { limit: 50 }\n );\n\n const { deletePressKitAsset, loading: deleteLoading } = useDeletePressKitAsset();\n\n const handleDelete = async (id: string) => {\n void nativeImpact('medium');\n const message = tr('pressKit.confirmDelete', 'Delete this press kit asset?');\n const native = await nativeConfirm({\n title: 'Delete press kit asset',\n message,\n okButtonTitle: 'Delete',\n cancelButtonTitle: 'Cancel',\n });\n const ok = native === null ? window.confirm(message) : native;\n if (!ok) return;\n\n try {\n // `deletePressKitAsset` returns `Boolean!`. A throw covers hard failures\n // (network, auth, validation); the explicit `false` branch covers\n // soft-failure cases where the resolver resolved but the asset wasn't\n // actually removed — so we don't show a misleading success toast.\n const result = await deletePressKitAsset(id);\n if (!result.data?.deletePressKitAsset) {\n void nativeNotify('error');\n console.error('Press kit asset delete returned false:', id);\n return;\n }\n void nativeNotify('success');\n refetch();\n } catch (err) {\n void nativeNotify('error');\n console.error('Failed to delete press kit asset:', err);\n }\n };\n\n const formatDate = (dateString: string | null) => {\n if (!dateString) return '—';\n return new Date(dateString).toLocaleDateString('en-US', {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n });\n };\n\n if (loading) {\n return (\n <div className=\"min-h-full bg-[var(--color-bg-canvas)] p-6\">\n <LoadingState message={tr('pressKit.loadingAssets', 'Loading press kit assets...')} />\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"min-h-full bg-[var(--color-bg-canvas)] p-6\">\n <ErrorState\n message={error.message}\n action={{ label: tr('productCommon.retry', 'Retry'), onClick: () => refetch() }}\n />\n </div>\n );\n }\n\n return (\n <div className=\"min-h-full bg-[var(--color-bg-canvas)] p-6 animate-in fade-in duration-300\">\n <div className=\"mb-6\">\n <div className=\"flex items-center justify-between mb-4\">\n <div>\n <h1 className=\"text-3xl font-bold text-text-primary mb-2\">\n {tr('pressKit.title', 'Press Kit')}\n </h1>\n <p className=\"text-text-secondary\">\n {tr('pressKit.subtitle', 'Manage downloadable press & media assets')}\n </p>\n </div>\n\n <PermissionGate role=\"super_admin\">\n <button\n onClick={() => navigate(`${pressKitBasePath}/new`)}\n className=\"inline-flex items-center gap-2 px-4 py-2 bg-[var(--color-action-primary-bg)] text-[var(--color-action-primary-text)] rounded-lg hover:opacity-90 hover:scale-[1.02] transition-all duration-200 font-medium\"\n >\n <Plus size={20} />\n {tr('pressKit.newAsset', 'New Asset')}\n </button>\n </PermissionGate>\n </div>\n\n {/* Category tabs */}\n <div className=\"flex flex-wrap gap-1 border-b border-default pb-px\">\n {CATEGORY_TABS.map((t) => {\n const active = (filter.category ?? '') === t.category;\n return (\n <button\n key={t.label}\n type=\"button\"\n onClick={() =>\n setFilter({\n ...filter,\n category: (t.category || undefined) as PressKitAssetCategory | undefined,\n })\n }\n className={`px-4 py-2 rounded-t-lg text-sm font-medium transition-all border-b-2 ${\n active\n ? 'border-[var(--color-action-primary-bg)] text-text-primary'\n : 'border-transparent text-text-secondary hover:text-text-primary'\n }`}\n >\n {t.label}\n </button>\n );\n })}\n </div>\n\n <div className=\"flex gap-4\">\n <SearchInput\n value={searchQuery}\n onChange={setSearchQuery}\n placeholder={tr('pressKit.searchPlaceholder', 'Search press kit assets...')}\n className=\"flex-1\"\n />\n\n <button\n onClick={() => refetch()}\n className=\"inline-flex items-center gap-2 px-4 py-2 bg-surface text-text-primary border border-default rounded-lg hover:bg-muted transition-all duration-200\"\n >\n <RefreshCw size={18} />\n </button>\n\n {assets.length > 0 && (\n <button\n onClick={() =>\n exportToCsv(\n 'press-kit-assets',\n assets.map((a) => ({\n id: a.id,\n slug: a.slug,\n title: a.title,\n category: a.category,\n fileUrl: a.fileUrl,\n mimeType: a.mimeType ?? '',\n visibility: a.visibility,\n sortOrder: a.sortOrder,\n productId: a.productId,\n updatedAt: a.updatedAt,\n }))\n )\n }\n className=\"inline-flex items-center gap-2 px-4 py-2 bg-surface text-text-primary border border-default rounded-lg hover:bg-muted transition-all duration-200\"\n title={tr('pressKit.exportCsv', 'Export as CSV')}\n >\n <Download size={18} />\n </button>\n )}\n </div>\n </div>\n\n {assets.length === 0 ? (\n <div className=\"bg-surface border border-default rounded-lg p-12 text-center animate-in fade-in duration-300\">\n <p className=\"text-text-secondary mb-4\">\n {tr('pressKit.noAssetsFound', 'No press kit assets found')}\n </p>\n <PermissionGate role=\"super_admin\">\n <button\n onClick={() => navigate(`${pressKitBasePath}/new`)}\n className=\"inline-flex items-center gap-2 px-4 py-2 bg-[var(--color-action-primary-bg)] text-[var(--color-action-primary-text)] rounded-lg hover:opacity-90 hover:scale-[1.02] transition-all duration-200 font-medium\"\n >\n <Plus size={20} />\n {tr('pressKit.newAsset', 'New Asset')}\n </button>\n </PermissionGate>\n </div>\n ) : (\n <div className=\"bg-surface border border-default rounded-lg shadow-[var(--shadow-elevation-1)] overflow-hidden\">\n <table className=\"w-full\">\n <thead className=\"bg-muted border-b border-default\">\n <tr>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('pressKit.columnAsset', 'Asset')}\n </th>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('pressKit.columnCategory', 'Category')}\n </th>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('pressKit.columnFile', 'File')}\n </th>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('pressKit.columnVisibility', 'Visibility')}\n </th>\n <th className=\"text-left px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('pressKit.columnUpdated', 'Updated')}\n </th>\n <th className=\"text-right px-6 py-3 text-xs font-semibold text-text-secondary uppercase\">\n {tr('pressKit.columnActions', 'Actions')}\n </th>\n </tr>\n </thead>\n <tbody className=\"divide-y divide-[var(--color-border-default)]\">\n {assets.map((asset) => (\n <tr\n key={asset.id}\n className=\"hover:bg-muted transition-all duration-200 cursor-pointer\"\n onClick={() => navigate(`${pressKitBasePath}/${asset.id}`)}\n >\n <td className=\"px-6 py-4\">\n <div className=\"flex items-center gap-3\">\n <div className=\"w-10 h-10 rounded-lg bg-[var(--color-status-info-subtle)] flex items-center justify-center overflow-hidden\">\n {asset.thumbnailUrl ? (\n <img\n src={asset.thumbnailUrl}\n alt=\"\"\n className=\"w-full h-full object-cover\"\n />\n ) : (\n <FileText size={20} className=\"text-[var(--color-status-info)]\" />\n )}\n </div>\n <div>\n <p className=\"font-medium text-text-primary\">{asset.title}</p>\n <p className=\"text-xs text-text-tertiary font-mono\">/{asset.slug}</p>\n </div>\n </div>\n </td>\n <td className=\"px-6 py-4\">\n <span className=\"text-xs font-medium px-2 py-1 rounded-full bg-[var(--color-status-info-subtle)] text-[var(--color-status-info)]\">\n {asset.category.replace(/_/g, ' ')}\n </span>\n </td>\n <td className=\"px-6 py-4\">\n <span className=\"text-sm text-text-secondary\">\n {(asset.mimeType ?? 'file').split('/').pop()} · {formatBytes(asset.fileSize)}\n </span>\n </td>\n <td className=\"px-6 py-4\">\n <span className=\"text-sm text-text-secondary\">{asset.visibility}</span>\n </td>\n <td className=\"px-6 py-4\">\n <span className=\"text-sm text-text-secondary\">\n {formatDate(asset.updatedAt)}\n </span>\n </td>\n <td className=\"px-6 py-4\">\n <div\n className=\"flex items-center justify-end gap-2\"\n onClick={(e) => e.stopPropagation()}\n >\n <a\n href={asset.fileUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"p-2 rounded-lg text-text-secondary hover:bg-muted transition-all duration-200\"\n title={tr('pressKit.download', 'Download')}\n >\n <Download size={18} />\n </a>\n <button\n onClick={() => navigate(`${pressKitBasePath}/${asset.id}`)}\n className=\"p-2 rounded-lg text-text-secondary hover:bg-muted transition-all duration-200\"\n title={tr('pressKit.viewDetails', 'View details')}\n >\n <Eye size={18} />\n </button>\n <PermissionGate role=\"super_admin\">\n <button\n onClick={() => navigate(`${pressKitBasePath}/${asset.id}/edit`)}\n className=\"p-2 rounded-lg text-text-secondary hover:bg-muted transition-all duration-200\"\n title={tr('pressKit.edit', 'Edit')}\n >\n <SquarePen size={18} />\n </button>\n <button\n onClick={() => handleDelete(asset.id)}\n disabled={deleteLoading}\n className=\"p-2 rounded-lg text-[var(--color-status-error)] hover:bg-[var(--color-status-error-subtle)] transition-all duration-200 disabled:opacity-50\"\n title={tr('pressKit.delete', 'Delete')}\n >\n <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7 @@ export declare const createPressKitAssetSchema: z.ZodObject<{
9
9
  DOCUMENT: "DOCUMENT";
10
10
  PRESS_RELEASE: "PRESS_RELEASE";
11
11
  BRAND_GUIDE: "BRAND_GUIDE";
12
+ CONTRACT: "CONTRACT";
12
13
  }>;
13
14
  title: z.ZodString;
14
15
  slug: z.ZodString;
@@ -36,6 +37,7 @@ export declare const updatePressKitAssetSchema: z.ZodObject<{
36
37
  DOCUMENT: "DOCUMENT";
37
38
  PRESS_RELEASE: "PRESS_RELEASE";
38
39
  BRAND_GUIDE: "BRAND_GUIDE";
40
+ CONTRACT: "CONTRACT";
39
41
  }>>;
40
42
  title: z.ZodOptional<z.ZodString>;
41
43
  description: z.ZodOptional<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/product-management/modules/press-kit/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwBpC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;iBAapC,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACpF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/product-management/modules/press-kit/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAkBxB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwBpC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;iBAapC,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AACpF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -7,7 +7,8 @@ var o = e([
7
7
  "BROCHURE",
8
8
  "DOCUMENT",
9
9
  "PRESS_RELEASE",
10
- "BRAND_GUIDE"
10
+ "BRAND_GUIDE",
11
+ "CONTRACT"
11
12
  ]), s = i({
12
13
  productId: a().min(1, "Product is required"),
13
14
  category: o,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/product-management/modules/press-kit/schemas/index.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * Press Kit Asset Validation Schemas\n * Aligned with backend ProductPressKitAsset schema\n */\n\nconst categoryEnum = z.enum([\n 'LOGO',\n 'BANNER',\n 'SCREENSHOT',\n 'BROCHURE',\n 'DOCUMENT',\n 'PRESS_RELEASE',\n 'BRAND_GUIDE',\n]);\n\nexport const createPressKitAssetSchema = z.object({\n productId: z.string().min(1, 'Product is required'),\n category: categoryEnum,\n title: z\n .string()\n .min(2, 'Title must be at least 2 characters')\n .max(200, 'Title must not exceed 200 characters')\n .trim(),\n slug: z\n .string()\n .min(2, 'Slug must be at least 2 characters')\n .max(100, 'Slug must not exceed 100 characters')\n .regex(/^[a-z0-9-]+$/, 'Slug must contain only lowercase letters, numbers, and hyphens')\n .trim(),\n description: z.string().max(1000, 'Description must not exceed 1000 characters').optional(),\n fileUrl: z.string().url('Must be a valid URL'),\n fileName: z.string().max(255).optional(),\n fileSize: z.number().int().min(0).optional(),\n mimeType: z.string().max(120).optional(),\n thumbnailUrl: z.string().url('Must be a valid URL').or(z.literal('')).optional(),\n version: z.string().max(40).optional(),\n tags: z.array(z.string()).optional(),\n visibility: z.enum(['PUBLIC', 'AUTHENTICATED', 'INTERNAL']).optional(),\n sortOrder: z.number().int().min(0).optional(),\n});\n\nexport const updatePressKitAssetSchema = z.object({\n category: categoryEnum.optional(),\n title: z.string().min(2).max(200).trim().optional(),\n description: z.string().max(1000).optional(),\n fileUrl: z.string().url('Must be a valid URL').optional(),\n fileName: z.string().max(255).optional(),\n fileSize: z.number().int().min(0).optional(),\n mimeType: z.string().max(120).optional(),\n thumbnailUrl: z.string().url('Must be a valid URL').or(z.literal('')).optional(),\n version: z.string().max(40).optional(),\n tags: z.array(z.string()).optional(),\n visibility: z.enum(['PUBLIC', 'AUTHENTICATED', 'INTERNAL']).optional(),\n sortOrder: z.number().int().min(0).optional(),\n});\n\nexport type CreatePressKitAssetFormData = z.infer<typeof createPressKitAssetSchema>;\nexport type UpdatePressKitAssetFormData = z.infer<typeof updatePressKitAssetSchema>;\n"],"mappings":";;AAOA,IAAM,IAAe,EAAO;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC,EAEW,IAA4B,EAAS;CAChD,WAAW,GAAU,CAAC,IAAI,GAAG,sBAAsB;CACnD,UAAU;CACV,OAAO,GACI,CACR,IAAI,GAAG,sCAAsC,CAC7C,IAAI,KAAK,uCAAuC,CAChD,MAAM;CACT,MAAM,GACK,CACR,IAAI,GAAG,qCAAqC,CAC5C,IAAI,KAAK,sCAAsC,CAC/C,MAAM,gBAAgB,iEAAiE,CACvF,MAAM;CACT,aAAa,GAAU,CAAC,IAAI,KAAM,8CAA8C,CAAC,UAAU;CAC3F,SAAS,GAAU,CAAC,IAAI,sBAAsB;CAC9C,UAAU,GAAU,CAAC,IAAI,IAAI,CAAC,UAAU;CACxC,UAAU,GAAU,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU;CAC5C,UAAU,GAAU,CAAC,IAAI,IAAI,CAAC,UAAU;CACxC,cAAc,GAAU,CAAC,IAAI,sBAAsB,CAAC,GAAG,EAAU,GAAG,CAAC,CAAC,UAAU;CAChF,SAAS,GAAU,CAAC,IAAI,GAAG,CAAC,UAAU;CACtC,MAAM,EAAQ,GAAU,CAAC,CAAC,UAAU;CACpC,YAAY,EAAO;EAAC;EAAU;EAAiB;EAAW,CAAC,CAAC,UAAU;CACtE,WAAW,GAAU,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU;CAC9C,CAAC,EAEW,IAA4B,EAAS;CAChD,UAAU,EAAa,UAAU;CACjC,OAAO,GAAU,CAAC,IAAI,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU;CACnD,aAAa,GAAU,CAAC,IAAI,IAAK,CAAC,UAAU;CAC5C,SAAS,GAAU,CAAC,IAAI,sBAAsB,CAAC,UAAU;CACzD,UAAU,GAAU,CAAC,IAAI,IAAI,CAAC,UAAU;CACxC,UAAU,GAAU,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU;CAC5C,UAAU,GAAU,CAAC,IAAI,IAAI,CAAC,UAAU;CACxC,cAAc,GAAU,CAAC,IAAI,sBAAsB,CAAC,GAAG,EAAU,GAAG,CAAC,CAAC,UAAU;CAChF,SAAS,GAAU,CAAC,IAAI,GAAG,CAAC,UAAU;CACtC,MAAM,EAAQ,GAAU,CAAC,CAAC,UAAU;CACpC,YAAY,EAAO;EAAC;EAAU;EAAiB;EAAW,CAAC,CAAC,UAAU;CACtE,WAAW,GAAU,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU;CAC9C,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/product-management/modules/press-kit/schemas/index.ts"],"sourcesContent":["import { z } from 'zod';\n\n/**\n * Press Kit Asset Validation Schemas\n * Aligned with backend ProductPressKitAsset schema\n */\n\nconst categoryEnum = z.enum([\n 'LOGO',\n 'BANNER',\n 'SCREENSHOT',\n 'BROCHURE',\n 'DOCUMENT',\n 'PRESS_RELEASE',\n 'BRAND_GUIDE',\n 'CONTRACT',\n]);\n\nexport const createPressKitAssetSchema = z.object({\n productId: z.string().min(1, 'Product is required'),\n category: categoryEnum,\n title: z\n .string()\n .min(2, 'Title must be at least 2 characters')\n .max(200, 'Title must not exceed 200 characters')\n .trim(),\n slug: z\n .string()\n .min(2, 'Slug must be at least 2 characters')\n .max(100, 'Slug must not exceed 100 characters')\n .regex(/^[a-z0-9-]+$/, 'Slug must contain only lowercase letters, numbers, and hyphens')\n .trim(),\n description: z.string().max(1000, 'Description must not exceed 1000 characters').optional(),\n fileUrl: z.string().url('Must be a valid URL'),\n fileName: z.string().max(255).optional(),\n fileSize: z.number().int().min(0).optional(),\n mimeType: z.string().max(120).optional(),\n thumbnailUrl: z.string().url('Must be a valid URL').or(z.literal('')).optional(),\n version: z.string().max(40).optional(),\n tags: z.array(z.string()).optional(),\n visibility: z.enum(['PUBLIC', 'AUTHENTICATED', 'INTERNAL']).optional(),\n sortOrder: z.number().int().min(0).optional(),\n});\n\nexport const updatePressKitAssetSchema = z.object({\n category: categoryEnum.optional(),\n title: z.string().min(2).max(200).trim().optional(),\n description: z.string().max(1000).optional(),\n fileUrl: z.string().url('Must be a valid URL').optional(),\n fileName: z.string().max(255).optional(),\n fileSize: z.number().int().min(0).optional(),\n mimeType: z.string().max(120).optional(),\n thumbnailUrl: z.string().url('Must be a valid URL').or(z.literal('')).optional(),\n version: z.string().max(40).optional(),\n tags: z.array(z.string()).optional(),\n visibility: z.enum(['PUBLIC', 'AUTHENTICATED', 'INTERNAL']).optional(),\n sortOrder: z.number().int().min(0).optional(),\n});\n\nexport type CreatePressKitAssetFormData = z.infer<typeof createPressKitAssetSchema>;\nexport type UpdatePressKitAssetFormData = z.infer<typeof updatePressKitAssetSchema>;\n"],"mappings":";;AAOA,IAAM,IAAe,EAAO;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC,EAEW,IAA4B,EAAS;CAChD,WAAW,GAAU,CAAC,IAAI,GAAG,sBAAsB;CACnD,UAAU;CACV,OAAO,GACI,CACR,IAAI,GAAG,sCAAsC,CAC7C,IAAI,KAAK,uCAAuC,CAChD,MAAM;CACT,MAAM,GACK,CACR,IAAI,GAAG,qCAAqC,CAC5C,IAAI,KAAK,sCAAsC,CA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AAC,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU;CAC9C,CAAC"}
@@ -3,7 +3,7 @@
3
3
  * Aligned with backend ProductPressKitAsset schema
4
4
  */
5
5
  export type ContentVisibility = 'PUBLIC' | 'AUTHENTICATED' | 'INTERNAL';
6
- export type PressKitAssetCategory = 'LOGO' | 'BANNER' | 'SCREENSHOT' | 'BROCHURE' | 'DOCUMENT' | 'PRESS_RELEASE' | 'BRAND_GUIDE';
6
+ export type PressKitAssetCategory = 'LOGO' | 'BANNER' | 'SCREENSHOT' | 'BROCHURE' | 'DOCUMENT' | 'PRESS_RELEASE' | 'BRAND_GUIDE' | 'CONTRACT';
7
7
  export interface ProductPressKitAsset {
8
8
  id: string;
9
9
  productId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/product-management/modules/press-kit/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,eAAe,GAAG,UAAU,CAAC;AAExE,MAAM,MAAM,qBAAqB,GAC7B,MAAM,GACN,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,UAAU,GACV,eAAe,GACf,aAAa,CAAC;AAElB,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAA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O,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,oBAAoB,EAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,oBAAoB,EAAE,qBAAqB,EAQvD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/product-management/modules/press-kit/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,eAAe,GAAG,UAAU,CAAC;AAExE,MAAM,MAAM,qBAAqB,GAC7B,MAAM,GACN,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,UAAU,GACV,eAAe,GACf,aAAa,GACb,UAAU,CAAC;AAEf,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,qBAAqB,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,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AAC,EAAE,qBAAqB,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,oBAAoB,EAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,oBAAoB,EAAE,qBAAqB,EASvD,CAAC"}
@@ -6,7 +6,8 @@ var e = [
6
6
  "BROCHURE",
7
7
  "DOCUMENT",
8
8
  "PRESS_RELEASE",
9
- "BRAND_GUIDE"
9
+ "BRAND_GUIDE",
10
+ "CONTRACT"
10
11
  ];
11
12
  //#endregion
12
13
  export { e as PRESS_KIT_CATEGORIES };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/product-management/modules/press-kit/types/index.ts"],"sourcesContent":["/**\n * Press Kit Module Types\n * Aligned with backend ProductPressKitAsset schema\n */\n\nexport type ContentVisibility = 'PUBLIC' | 'AUTHENTICATED' | 'INTERNAL';\n\nexport type PressKitAssetCategory =\n | 'LOGO'\n | 'BANNER'\n | 'SCREENSHOT'\n | 'BROCHURE'\n | 'DOCUMENT'\n | 'PRESS_RELEASE'\n | 'BRAND_GUIDE';\n\nexport interface ProductPressKitAsset {\n id: string;\n productId: string;\n category: PressKitAssetCategory;\n title: string;\n slug: string;\n description: string | null;\n fileUrl: string;\n fileName: string | null;\n fileSize: number | null;\n mimeType: string | null;\n thumbnailUrl: string | null;\n version: string | null;\n tags: string[];\n visibility: ContentVisibility;\n sortOrder: number;\n createdAt: string;\n updatedAt: string;\n product?: { id: string; name: string; slug: string } | null;\n}\n\nexport interface PressKitAssetFilterInput {\n search?: string;\n category?: PressKitAssetCategory;\n visibility?: ContentVisibility;\n tag?: string;\n}\n\n// Nullable string fields accept `null` to match the GraphQL schema\n// (`String` without `!`). On Update, a `null` value explicitly clears\n// the field; on Create, `null` and absence are equivalent. Without\n// `null` in these types, callers cannot send an explicit clear from\n// the form's edit mode — see `PressKitAssetForm.handleSubmit`.\nexport interface CreatePressKitAssetInput {\n productId: string;\n category: PressKitAssetCategory;\n title: string;\n slug: string;\n description?: string | null;\n fileUrl: string;\n fileName?: string | null;\n fileSize?: number | null;\n mimeType?: string | null;\n thumbnailUrl?: string | null;\n version?: string | null;\n tags?: string[];\n visibility?: ContentVisibility;\n sortOrder?: number;\n}\n\nexport interface UpdatePressKitAssetInput {\n category?: PressKitAssetCategory;\n title?: string;\n description?: string | null;\n fileUrl?: string;\n fileName?: string | null;\n fileSize?: number | null;\n mimeType?: string | null;\n thumbnailUrl?: string | null;\n version?: string | null;\n tags?: string[];\n visibility?: ContentVisibility;\n sortOrder?: number;\n}\n\nexport interface PressKitAssetsConnection {\n items: ProductPressKitAsset[];\n total: number;\n hasMore: boolean;\n}\n\nexport const PRESS_KIT_CATEGORIES: PressKitAssetCategory[] = [\n 'LOGO',\n 'BANNER',\n 'SCREENSHOT',\n 'BROCHURE',\n 'DOCUMENT',\n 'PRESS_RELEASE',\n 'BRAND_GUIDE',\n];\n"],"mappings":";AAuFA,IAAa,IAAgD;CAC3D;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/product-management/modules/press-kit/types/index.ts"],"sourcesContent":["/**\n * Press Kit Module Types\n * Aligned with backend ProductPressKitAsset schema\n */\n\nexport type ContentVisibility = 'PUBLIC' | 'AUTHENTICATED' | 'INTERNAL';\n\nexport type PressKitAssetCategory =\n | 'LOGO'\n | 'BANNER'\n | 'SCREENSHOT'\n | 'BROCHURE'\n | 'DOCUMENT'\n | 'PRESS_RELEASE'\n | 'BRAND_GUIDE'\n | 'CONTRACT';\n\nexport interface ProductPressKitAsset {\n id: string;\n productId: string;\n category: PressKitAssetCategory;\n title: string;\n slug: string;\n description: string | null;\n fileUrl: string;\n fileName: string | null;\n fileSize: number | null;\n mimeType: string | null;\n thumbnailUrl: string | null;\n version: string | null;\n tags: string[];\n visibility: ContentVisibility;\n sortOrder: number;\n createdAt: string;\n updatedAt: string;\n product?: { id: string; name: string; slug: string } | null;\n}\n\nexport interface PressKitAssetFilterInput {\n search?: string;\n category?: PressKitAssetCategory;\n visibility?: ContentVisibility;\n tag?: string;\n}\n\n// Nullable string fields accept `null` to match the GraphQL schema\n// (`String` without `!`). On Update, a `null` value explicitly clears\n// the field; on Create, `null` and absence are equivalent. Without\n// `null` in these types, callers cannot send an explicit clear from\n// the form's edit mode — see `PressKitAssetForm.handleSubmit`.\nexport interface CreatePressKitAssetInput {\n productId: string;\n category: PressKitAssetCategory;\n title: string;\n slug: string;\n description?: string | null;\n fileUrl: string;\n fileName?: string | null;\n fileSize?: number | null;\n mimeType?: string | null;\n thumbnailUrl?: string | null;\n version?: string | null;\n tags?: string[];\n visibility?: ContentVisibility;\n sortOrder?: number;\n}\n\nexport interface UpdatePressKitAssetInput {\n category?: PressKitAssetCategory;\n title?: string;\n description?: string | null;\n fileUrl?: string;\n fileName?: string | null;\n fileSize?: number | null;\n mimeType?: string | null;\n thumbnailUrl?: string | null;\n version?: string | null;\n tags?: string[];\n visibility?: ContentVisibility;\n sortOrder?: number;\n}\n\nexport interface PressKitAssetsConnection {\n items: ProductPressKitAsset[];\n total: number;\n hasMore: boolean;\n}\n\nexport const PRESS_KIT_CATEGORIES: PressKitAssetCategory[] = [\n 'LOGO',\n 'BANNER',\n 'SCREENSHOT',\n 'BROCHURE',\n 'DOCUMENT',\n 'PRESS_RELEASE',\n 'BRAND_GUIDE',\n 'CONTRACT',\n];\n"],"mappings":";AAwFA,IAAa,IAAgD;CAC3D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD"}
@@ -37,6 +37,24 @@ export declare function useProductBySlug(slug: string): {
37
37
  error: import('@apollo/client').ApolloError | undefined;
38
38
  refetch: (variables?: any) => Promise<import('@apollo/client').ApolloQueryResult<Types.GetPlatformProductBySlugQuery>>;
39
39
  };
40
+ /**
41
+ * Hook to fetch a product by either ID (UUID) or slug. Routes like
42
+ * `/products/:id` historically receive only UUIDs, but users hand-type or
43
+ * follow external links to `/products/<slug>` and expect to land on the
44
+ * detail page (M22-B2). Detect the shape and pick the right query.
45
+ *
46
+ * Note: slugs are allowed to match the UUID format
47
+ * (lowercase letters/digits/hyphens), so a UUID-shaped slug would
48
+ * normally be treated as an ID and miss the bySlug resolver. To
49
+ * avoid that regression, when the ID query completes with no
50
+ * product, we fall back to the slug query.
51
+ */
52
+ export declare function useProductByIdOrSlug(idOrSlug: string): {
53
+ product: PlatformProduct | undefined;
54
+ loading: boolean;
55
+ error: import('@apollo/client').ApolloError | undefined;
56
+ refetch: () => Promise<void>;
57
+ };
40
58
  /**
41
59
  * Hook to create a new product. Emits `tenant.product.created` on success.
42
60
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useProducts.d.ts","sourceRoot":"","sources":["../../../../../src/product-management/modules/products/hooks/useProducts.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,wBAAgB,WAAW,CACzB,MAAM,CAAC,EAAE,kBAAkB,EAC3B,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;cAYQ,eAAe,EAAE;;;;;;;;;;;;EAQvE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM;aAQC,eAAe,GAAG,SAAS;;;;EAKhE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM;aAQD,eAAe,GAAG,SAAS;;;;EAKtE;AAED;;GAEG;AACH,wBAAgB,gBAAgB;2BAOC,kBAAkB;2BAYO,eAAe,GAAG,SAAS;UAC5C,eAAe,GAAG,SAAS;;;EAInE;AAED;;GAEG;AACH,wBAAgB,gBAAgB;wBAKF,MAAM,SAAS,kBAAkB;UAYtB,eAAe,GAAG,SAAS;;;EAInE;AAED;;GAEG;AACH,wBAAgB,gBAAgB;wBAOF,MAAM;;;;EAWnC;AAED;;GAEG;AACH,wBAAgB,kBAAkB;0BAIR,MAAM;;;EAI/B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB;yBAIR,MAAM;;;EAI9B"}
1
+ {"version":3,"file":"useProducts.d.ts","sourceRoot":"","sources":["../../../../../src/product-management/modules/products/hooks/useProducts.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,wBAAgB,WAAW,CACzB,MAAM,CAAC,EAAE,kBAAkB,EAC3B,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;cAYQ,eAAe,EAAE;;;;;;;;;;;;EAQvE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM;aAQC,eAAe,GAAG,SAAS;;;;EAKhE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM;aAQD,eAAe,GAAG,SAAS;;;;EAKtE;AAKD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM;;;;;EAgCpD;AAED;;GAEG;AACH,wBAAgB,gBAAgB;2BAOC,kBAAkB;2BAYO,eAAe,GAAG,SAAS;UAC5C,eAAe,GAAG,SAAS;;;EAInE;AAED;;GAEG;AACH,wBAAgB,gBAAgB;wBAKF,MAAM,SAAS,kBAAkB;UAYtB,eAAe,GAAG,SAAS;;;EAInE;AAED;;GAEG;AACH,wBAAgB,gBAAgB;wBAOF,MAAM;;;;EAWnC;AAED;;GAEG;AACH,wBAAgB,kBAAkB;0BAIR,MAAM;;;EAI/B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB;yBAIR,MAAM;;;EAI9B"}
@@ -1,8 +1,8 @@
1
- import { GetPlatformProductsDocument as e, useCreatePlatformProductMutation as t, useDeletePlatformProductMutation as n, useGetPlatformProductQuery as r, useGetPlatformProductsQuery as i, useUpdatePlatformProductMutation as a } from "../../../../generated/global-operations.js";
2
- import { useEventEmitter as o } from "@burdenoff/fe-libs/shared/events";
1
+ import { GetPlatformProductsDocument as e, useCreatePlatformProductMutation as t, useDeletePlatformProductMutation as n, useGetPlatformProductBySlugQuery as r, useGetPlatformProductQuery as i, useGetPlatformProductsQuery as a, useUpdatePlatformProductMutation as o } from "../../../../generated/global-operations.js";
2
+ import { useEventEmitter as s } from "@burdenoff/fe-libs/shared/events";
3
3
  //#region src/product-management/modules/products/hooks/useProducts.ts
4
- function s(e, t) {
5
- let { data: n, loading: r, error: a, refetch: o, fetchMore: s } = i({
4
+ function c(e, t) {
5
+ let { data: n, loading: r, error: i, refetch: o, fetchMore: s } = a({
6
6
  variables: {
7
7
  filter: e,
8
8
  limit: t?.limit || 50,
@@ -15,13 +15,13 @@ function s(e, t) {
15
15
  total: n?.platformProducts?.total || 0,
16
16
  hasMore: n?.platformProducts?.hasMore || !1,
17
17
  loading: r,
18
- error: a,
18
+ error: i,
19
19
  refetch: o,
20
20
  fetchMore: s
21
21
  };
22
22
  }
23
- function c(e) {
24
- let { data: t, loading: n, error: i, refetch: a } = r({
23
+ function l(e) {
24
+ let { data: t, loading: n, error: r, refetch: a } = i({
25
25
  variables: { id: e },
26
26
  skip: !e,
27
27
  fetchPolicy: "cache-and-network"
@@ -29,16 +29,36 @@ function c(e) {
29
29
  return {
30
30
  product: t?.platformProduct,
31
31
  loading: n,
32
- error: i,
32
+ error: r,
33
33
  refetch: a
34
34
  };
35
35
  }
36
- function l() {
37
- let [n, { data: r, loading: i, error: a }] = t({ refetchQueries: [e] }), s = o("tenant.product.created", { component: "microfe-product" });
36
+ var u = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
37
+ function d(e) {
38
+ let t = u.test(e), n = i({
39
+ variables: { id: e },
40
+ skip: !e || !t,
41
+ fetchPolicy: "cache-and-network"
42
+ }), a = t && !n.loading && !n.data?.platformProduct, o = r({
43
+ variables: { slug: e },
44
+ skip: !e || t && !a,
45
+ fetchPolicy: "cache-and-network"
46
+ }), s = n.data?.platformProduct, c = o.data?.platformProductBySlug;
47
+ return {
48
+ product: s ?? c,
49
+ loading: n.loading || o.loading,
50
+ error: s ? n.error : o.error ?? n.error,
51
+ refetch: async () => {
52
+ await Promise.all([n.refetch(), o.refetch()]);
53
+ }
54
+ };
55
+ }
56
+ function f() {
57
+ let [n, { data: r, loading: i, error: a }] = t({ refetchQueries: [e] }), o = s("tenant.product.created", { component: "microfe-product" });
38
58
  return {
39
59
  createProduct: async (e) => {
40
60
  let t = await n({ variables: { input: e } }), r = t.data?.createPlatformProduct;
41
- return r && s({
61
+ return r && o({
42
62
  resourceId: r.id,
43
63
  resourceSlug: r.slug,
44
64
  metadata: {
@@ -53,8 +73,8 @@ function l() {
53
73
  error: a
54
74
  };
55
75
  }
56
- function u() {
57
- let [e, { data: t, loading: n, error: r }] = a(), i = o("tenant.product.updated", { component: "microfe-product" });
76
+ function p() {
77
+ let [e, { data: t, loading: n, error: r }] = o(), i = s("tenant.product.updated", { component: "microfe-product" });
58
78
  return {
59
79
  updateProduct: async (t, n) => {
60
80
  let r = await e({ variables: {
@@ -75,12 +95,12 @@ function u() {
75
95
  error: r
76
96
  };
77
97
  }
78
- function d() {
79
- let [t, { data: r, loading: i, error: a }] = n({ refetchQueries: [e] }), s = o("tenant.product.deleted", { component: "microfe-product" });
98
+ function m() {
99
+ let [t, { data: r, loading: i, error: a }] = n({ refetchQueries: [e] }), o = s("tenant.product.deleted", { component: "microfe-product" });
80
100
  return {
81
101
  deleteProduct: async (e) => {
82
102
  let n = await t({ variables: { id: e } });
83
- return n.data?.deletePlatformProduct && s({ resourceId: e }), n;
103
+ return n.data?.deletePlatformProduct && o({ resourceId: e }), n;
84
104
  },
85
105
  data: r?.deletePlatformProduct,
86
106
  loading: i,
@@ -88,6 +108,6 @@ function d() {
88
108
  };
89
109
  }
90
110
  //#endregion
91
- export { l as useCreateProduct, d as useDeleteProduct, c as useProduct, s as useProducts, u as useUpdateProduct };
111
+ export { f as useCreateProduct, m as useDeleteProduct, l as useProduct, d as useProductByIdOrSlug, c as useProducts, p as useUpdateProduct };
92
112
 
93
113
  //# sourceMappingURL=useProducts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useProducts.js","names":[],"sources":["../../../../../src/product-management/modules/products/hooks/useProducts.ts"],"sourcesContent":["import { useEventEmitter } from '@burdenoff/fe-libs/shared/events';\n\nimport {\n useGetPlatformProductsQuery,\n useGetPlatformProductQuery,\n useGetPlatformProductBySlugQuery,\n useCreatePlatformProductMutation,\n useUpdatePlatformProductMutation,\n useDeletePlatformProductMutation,\n GetPlatformProductsDocument,\n} from '../../../../generated/global-operations';\nimport type {\n PlatformProduct,\n ProductFilterInput,\n CreateProductInput,\n UpdateProductInput,\n} from '../types';\n\n/**\n * Hook to fetch products with filtering and pagination\n */\nexport function useProducts(\n filter?: ProductFilterInput,\n options?: { limit?: number; offset?: number }\n) {\n const { data, loading, error, refetch, fetchMore } = useGetPlatformProductsQuery({\n variables: {\n filter,\n limit: options?.limit || 50,\n offset: options?.offset || 0,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n return {\n products: (data?.platformProducts?.items || []) as PlatformProduct[],\n total: data?.platformProducts?.total || 0,\n hasMore: data?.platformProducts?.hasMore || false,\n loading,\n error,\n refetch,\n fetchMore,\n };\n}\n\n/**\n * Hook to fetch a single product by ID\n */\nexport function useProduct(id: string) {\n const { data, loading, error, refetch } = useGetPlatformProductQuery({\n variables: { id },\n skip: !id,\n fetchPolicy: 'cache-and-network',\n });\n\n return {\n product: data?.platformProduct as PlatformProduct | undefined,\n loading,\n error,\n refetch,\n };\n}\n\n/**\n * Hook to fetch a product by slug\n */\nexport function useProductBySlug(slug: string) {\n const { data, loading, error, refetch } = useGetPlatformProductBySlugQuery({\n variables: { slug },\n skip: !slug,\n fetchPolicy: 'cache-and-network',\n });\n\n return {\n product: data?.platformProductBySlug as PlatformProduct | undefined,\n loading,\n error,\n refetch,\n };\n}\n\n/**\n * Hook to create a new product. Emits `tenant.product.created` on success.\n */\nexport function useCreateProduct() {\n const [createProductMutation, { data, loading, error }] = useCreatePlatformProductMutation({\n refetchQueries: [GetPlatformProductsDocument],\n });\n const emit = useEventEmitter('tenant.product.created', { component: 'microfe-product' });\n\n return {\n createProduct: async (input: CreateProductInput) => {\n const result = await createProductMutation({ variables: { input } });\n const product = result.data?.createPlatformProduct;\n if (product) {\n emit({\n resourceId: product.id,\n resourceSlug: product.slug,\n metadata: { name: product.name, status: product.status },\n });\n }\n return result;\n },\n createPlatformProduct: data?.createPlatformProduct as PlatformProduct | undefined,\n data: data?.createPlatformProduct as PlatformProduct | undefined,\n loading,\n error,\n };\n}\n\n/**\n * Hook to update a product. Emits `tenant.product.updated` on success.\n */\nexport function useUpdateProduct() {\n const [updateProductMutation, { data, loading, error }] = useUpdatePlatformProductMutation();\n const emit = useEventEmitter('tenant.product.updated', { component: 'microfe-product' });\n\n return {\n updateProduct: async (id: string, input: UpdateProductInput) => {\n const result = await updateProductMutation({ variables: { id, input } });\n const product = result.data?.updatePlatformProduct;\n if (product) {\n emit({\n resourceId: product.id,\n resourceSlug: product.slug,\n metadata: { name: product.name, status: product.status },\n });\n }\n return result;\n },\n data: data?.updatePlatformProduct as PlatformProduct | undefined,\n loading,\n error,\n };\n}\n\n/**\n * Hook to delete a product. Emits `tenant.product.deleted` on success.\n */\nexport function useDeleteProduct() {\n const [deleteProductMutation, { data, loading, error }] = useDeletePlatformProductMutation({\n refetchQueries: [GetPlatformProductsDocument],\n });\n const emit = useEventEmitter('tenant.product.deleted', { component: 'microfe-product' });\n\n return {\n deleteProduct: async (id: string) => {\n const result = await deleteProductMutation({ variables: { id } });\n if (result.data?.deletePlatformProduct) {\n emit({ resourceId: id });\n }\n return result;\n },\n data: data?.deletePlatformProduct,\n loading,\n error,\n };\n}\n\n/**\n * Hook to update product status to ACTIVE\n */\nexport function useActivateProduct() {\n const { updateProduct, loading, error } = useUpdateProduct();\n\n return {\n activateProduct: (id: string) => updateProduct(id, { status: 'ACTIVE' }),\n loading,\n error,\n };\n}\n\n/**\n * Hook to archive a product by setting it to DRAFT.\n * Backend schema does not expose a DEPRECATED status; DRAFT is used to hide a product from public listings.\n */\nexport function useArchiveProduct() {\n const { updateProduct, loading, error } = useUpdateProduct();\n\n return {\n archiveProduct: (id: string) => updateProduct(id, { status: 'DRAFT' }),\n loading,\n error,\n };\n}\n"],"mappings":";;;AAqBA,SAAgB,EACd,GACA,GACA;CACA,IAAM,EAAE,SAAM,YAAS,UAAO,YAAS,iBAAc,EAA4B;EAC/E,WAAW;GACT;GACA,OAAO,GAAS,SAAS;GACzB,QAAQ,GAAS,UAAU;GAC5B;EACD,aAAa;EACd,CAAC;AAEF,QAAO;EACL,UAAW,GAAM,kBAAkB,SAAS,EAAE;EAC9C,OAAO,GAAM,kBAAkB,SAAS;EACxC,SAAS,GAAM,kBAAkB,WAAW;EAC5C;EACA;EACA;EACA;EACD;;AAMH,SAAgB,EAAW,GAAY;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O,EAAgB,0BAA0B,EAAE,WAAW,mBAAmB,CAAC;AAExF,QAAO;EACL,eAAe,OAAO,MAAe;GACnC,IAAM,IAAS,MAAM,EAAsB,EAAE,WAAW,EAAE,OAAI,EAAE,CAAC;AAIjE,UAHI,EAAO,MAAM,yBACf,EAAK,EAAE,YAAY,GAAI,CAAC,EAEnB;;EAET,MAAM,GAAM;EACZ;EACA;EACD"}
1
+ {"version":3,"file":"useProducts.js","names":[],"sources":["../../../../../src/product-management/modules/products/hooks/useProducts.ts"],"sourcesContent":["import { useEventEmitter } from '@burdenoff/fe-libs/shared/events';\n\nimport {\n useGetPlatformProductsQuery,\n useGetPlatformProductQuery,\n useGetPlatformProductBySlugQuery,\n useCreatePlatformProductMutation,\n useUpdatePlatformProductMutation,\n useDeletePlatformProductMutation,\n GetPlatformProductsDocument,\n} from '../../../../generated/global-operations';\nimport type {\n PlatformProduct,\n ProductFilterInput,\n CreateProductInput,\n UpdateProductInput,\n} from '../types';\n\n/**\n * Hook to fetch products with filtering and pagination\n */\nexport function useProducts(\n filter?: ProductFilterInput,\n options?: { limit?: number; offset?: number }\n) {\n const { data, loading, error, refetch, fetchMore } = useGetPlatformProductsQuery({\n variables: {\n filter,\n limit: options?.limit || 50,\n offset: options?.offset || 0,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n return {\n products: (data?.platformProducts?.items || []) as PlatformProduct[],\n total: data?.platformProducts?.total || 0,\n hasMore: data?.platformProducts?.hasMore || false,\n loading,\n error,\n refetch,\n fetchMore,\n };\n}\n\n/**\n * Hook to fetch a single product by ID\n */\nexport function useProduct(id: string) {\n const { data, loading, error, refetch } = useGetPlatformProductQuery({\n variables: { id },\n skip: !id,\n fetchPolicy: 'cache-and-network',\n });\n\n return {\n product: data?.platformProduct as PlatformProduct | undefined,\n loading,\n error,\n refetch,\n };\n}\n\n/**\n * Hook to fetch a product by slug\n */\nexport function useProductBySlug(slug: string) {\n const { data, loading, error, refetch } = useGetPlatformProductBySlugQuery({\n variables: { slug },\n skip: !slug,\n fetchPolicy: 'cache-and-network',\n });\n\n return {\n product: data?.platformProductBySlug as PlatformProduct | undefined,\n loading,\n error,\n refetch,\n };\n}\n\n/** Match the canonical UUID-v4 shape (8-4-4-4-12 hex). */\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\n/**\n * Hook to fetch a product by either ID (UUID) or slug. Routes like\n * `/products/:id` historically receive only UUIDs, but users hand-type or\n * follow external links to `/products/<slug>` and expect to land on the\n * detail page (M22-B2). Detect the shape and pick the right query.\n *\n * Note: slugs are allowed to match the UUID format\n * (lowercase letters/digits/hyphens), so a UUID-shaped slug would\n * normally be treated as an ID and miss the bySlug resolver. To\n * avoid that regression, when the ID query completes with no\n * product, we fall back to the slug query.\n */\nexport function useProductByIdOrSlug(idOrSlug: string) {\n const isUuid = UUID_RE.test(idOrSlug);\n\n const byId = useGetPlatformProductQuery({\n variables: { id: idOrSlug },\n skip: !idOrSlug || !isUuid,\n fetchPolicy: 'cache-and-network',\n });\n\n // UUID-shaped param: only fall back to slug after the ID query finishes\n // and returns no product. Non-UUID param: always query by slug.\n const idQueryReturnedNothing = isUuid && !byId.loading && !byId.data?.platformProduct;\n\n const bySlug = useGetPlatformProductBySlugQuery({\n variables: { slug: idOrSlug },\n skip: !idOrSlug || (isUuid && !idQueryReturnedNothing),\n fetchPolicy: 'cache-and-network',\n });\n\n const byIdProduct = byId.data?.platformProduct as PlatformProduct | undefined;\n const bySlugProduct = bySlug.data?.platformProductBySlug as PlatformProduct | undefined;\n\n // Prefer the ID match; fall back to slug when ID lookup misses.\n const product = byIdProduct ?? bySlugProduct;\n const loading = byId.loading || bySlug.loading;\n const error = byIdProduct ? byId.error : (bySlug.error ?? byId.error);\n // refetch both so a manual retry covers either query.\n const refetch = async () => {\n await Promise.all([byId.refetch(), bySlug.refetch()]);\n };\n\n return { product, loading, error, refetch };\n}\n\n/**\n * Hook to create a new product. Emits `tenant.product.created` on success.\n */\nexport function useCreateProduct() {\n const [createProductMutation, { data, loading, error }] = useCreatePlatformProductMutation({\n refetchQueries: [GetPlatformProductsDocument],\n });\n const emit = useEventEmitter('tenant.product.created', { component: 'microfe-product' });\n\n return {\n createProduct: async (input: CreateProductInput) => {\n const result = await createProductMutation({ variables: { input } });\n const product = result.data?.createPlatformProduct;\n if (product) {\n emit({\n resourceId: product.id,\n resourceSlug: product.slug,\n metadata: { name: product.name, status: product.status },\n });\n }\n return result;\n },\n createPlatformProduct: data?.createPlatformProduct as PlatformProduct | undefined,\n data: data?.createPlatformProduct as PlatformProduct | undefined,\n loading,\n error,\n };\n}\n\n/**\n * Hook to update a product. Emits `tenant.product.updated` on success.\n */\nexport function useUpdateProduct() {\n const [updateProductMutation, { data, loading, error }] = useUpdatePlatformProductMutation();\n const emit = useEventEmitter('tenant.product.updated', { component: 'microfe-product' });\n\n return {\n updateProduct: async (id: string, input: UpdateProductInput) => {\n const result = await updateProductMutation({ variables: { id, input } });\n const product = result.data?.updatePlatformProduct;\n if (product) {\n emit({\n resourceId: product.id,\n resourceSlug: product.slug,\n metadata: { name: product.name, status: product.status },\n });\n }\n return result;\n },\n data: data?.updatePlatformProduct as PlatformProduct | undefined,\n loading,\n error,\n };\n}\n\n/**\n * Hook to delete a product. Emits `tenant.product.deleted` on success.\n */\nexport function useDeleteProduct() {\n const [deleteProductMutation, { data, loading, error }] = useDeletePlatformProductMutation({\n refetchQueries: [GetPlatformProductsDocument],\n });\n const emit = useEventEmitter('tenant.product.deleted', { component: 'microfe-product' });\n\n return {\n deleteProduct: async (id: string) => {\n const result = await deleteProductMutation({ variables: { id } });\n if (result.data?.deletePlatformProduct) {\n emit({ resourceId: id });\n }\n return result;\n },\n data: data?.deletePlatformProduct,\n loading,\n error,\n };\n}\n\n/**\n * Hook to update product status to ACTIVE\n */\nexport function useActivateProduct() {\n const { updateProduct, loading, error } = useUpdateProduct();\n\n return {\n activateProduct: (id: string) => updateProduct(id, { status: 'ACTIVE' }),\n loading,\n error,\n };\n}\n\n/**\n * Hook to archive a product by setting it to DRAFT.\n * Backend schema does not expose a DEPRECATED status; DRAFT is used to hide a product from public listings.\n */\nexport function useArchiveProduct() {\n const { updateProduct, loading, error } = useUpdateProduct();\n\n return {\n archiveProduct: (id: string) => updateProduct(id, { status: 'DRAFT' }),\n loading,\n error,\n };\n}\n"],"mappings":";;;AAqBA,SAAgB,EACd,GACA,GACA;CACA,IAAM,EAAE,SAAM,YAAS,UAAO,YAAS,iBAAc,EAA4B;EAC/E,WAAW;GACT;GACA,OAAO,GAAS,SAAS;GACzB,QAAQ,GAAS,UAAU;GAC5B;EACD,aAAa;EACd,CAAC;AAEF,QAAO;EACL,UAAW,GAAM,kBAAkB,SAAS,EAAE;EAC9C,OAAO,GAAM,kBAAkB,SAAS;EACxC,SAAS,GAAM,kBAAkB,WAAW;EAC5C;EACA;EACA;EACA;EACD;;AAMH,SAAgB,EAAW,GAAY;CACrC,IAAM,EAAE,SAAM,YAAS,UAAO,eAAY,EAA2B;EACnE,WAAW,EAAE,OAAI;EACjB,MAAM,CAAC;EACP,aAAa;EACd,CAAC;AAEF,QAAO;EACL,SAAS,GAAM;EACf;EACA;EACA;EACD;;AAsBH,IAAM,IAAU;AAchB,SAAgB,EAAqB,GAAkB;CACrD,IAAM,IAAS,EAAQ,KAAK,EAAS,EAE/B,IAAO,EAA2B;EACtC,WAAW,EAAE,IAAI,GAAU;EAC3B,MAAM,CAAC,KAAY,CAAC;EACpB,aAAa;EACd,CAAC,EAII,IAAyB,KAAU,CAAC,EAAK,WAAW,CAAC,EAAK,MAAM,iBAEhE,IAAS,EAAiC;EAC9C,WAAW,EAAE,MAAM,GAAU;EAC7B,MAAM,CAAC,KAAa,KAAU,CAAC;EAC/B,aAAa;EACd,CAAC,EAEI,IAAc,EAAK,MAAM,iBACzB,IAAgB,EAAO,MAAM;AAWnC,QAAO;EAAE,SARO,KAAe;EAQb,SAPF,EAAK,WAAW,EAAO;EAO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AAE,WAAW,mBAAmB,CAAC;AAExF,QAAO;EACL,eAAe,OAAO,MAAe;GACnC,IAAM,IAAS,MAAM,EAAsB,EAAE,WAAW,EAAE,OAAI,EAAE,CAAC;AAIjE,UAHI,EAAO,MAAM,yBACf,EAAK,EAAE,YAAY,GAAI,CAAC,EAEnB;;EAET,MAAM,GAAM;EACZ;EACA;EACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"ProductCreatePage.d.ts","sourceRoot":"","sources":["../../../../../src/product-management/modules/products/pages/ProductCreatePage.tsx"],"names":[],"mappings":"AAOA,wBAAgB,iBAAiB,4CAsDhC"}
1
+ {"version":3,"file":"ProductCreatePage.d.ts","sourceRoot":"","sources":["../../../../../src/product-management/modules/products/pages/ProductCreatePage.tsx"],"names":[],"mappings":"AAQA,wBAAgB,iBAAiB,4CA2EhC"}
@@ -2,56 +2,76 @@ import { useTr as e } from "../../../shared/hooks/useTr.js";
2
2
  import { useProductConsole as t } from "../../../providers/ProductConsoleProvider.js";
3
3
  import { useCreateProduct as n } from "../hooks/useProducts.js";
4
4
  import { ProductForm as r } from "../components/ProductForm.js";
5
- import { ArrowLeft as i } from "lucide-react";
6
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
+ import { useState as i } from "react";
6
+ import { ArrowLeft as a } from "lucide-react";
7
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
8
  //#region src/product-management/modules/products/pages/ProductCreatePage.tsx
8
- function s() {
9
- let { navigate: s, basePath: c = "/products" } = t(), l = e(), { createProduct: u, loading: d } = n(), f = async (e) => {
9
+ function c() {
10
+ let { navigate: c, basePath: l = "/products" } = t(), u = e(), { createProduct: d, loading: f } = n(), [p, m] = i(null), h = async (e) => {
10
11
  try {
11
- let t = await u(e);
12
- t.data?.createPlatformProduct && s(`${c}/${t.data.createPlatformProduct.id}`);
12
+ m(null);
13
+ let t = await d(e);
14
+ if (t.errors && t.errors.length > 0) {
15
+ m(t.errors[0]?.message ?? "Failed to create product");
16
+ return;
17
+ }
18
+ if (t.data?.createPlatformProduct) {
19
+ c(`${l}/${t.data.createPlatformProduct.id}`);
20
+ return;
21
+ }
22
+ m("Failed to create product");
13
23
  } catch (e) {
14
- console.error("Failed to create product:", e);
24
+ m(e instanceof Error ? e.message : "Failed to create product"), console.error("Failed to create product:", e);
15
25
  }
16
- }, p = () => {
17
- s(c);
26
+ }, g = () => {
27
+ c(l);
18
28
  };
19
- return /* @__PURE__ */ o("div", {
29
+ return /* @__PURE__ */ s("div", {
20
30
  className: "min-h-full bg-[var(--color-bg-canvas)] p-6 animate-in fade-in duration-300",
21
- children: [/* @__PURE__ */ o("div", {
22
- className: "mb-6",
23
- children: [
24
- /* @__PURE__ */ o("button", {
25
- onClick: p,
26
- className: "\n inline-flex items-center gap-2 mb-4\n text-text-secondary\n hover:text-text-primary\n transition-all duration-200\n ",
27
- children: [/* @__PURE__ */ a(i, { size: 20 }), /* @__PURE__ */ a("span", {
28
- className: "text-sm font-medium",
29
- children: l("products.backToProducts", "Back to Products")
30
- })]
31
- }),
32
- /* @__PURE__ */ a("h1", {
33
- className: "text-3xl font-bold text-text-primary mb-2",
34
- children: l("products.createProduct", "Create Product")
35
- }),
36
- /* @__PURE__ */ a("p", {
37
- className: "text-text-secondary",
38
- children: l("products.createProductSubtitle", "Add a new product to the platform")
31
+ children: [
32
+ /* @__PURE__ */ s("div", {
33
+ className: "mb-6",
34
+ children: [
35
+ /* @__PURE__ */ s("button", {
36
+ onClick: g,
37
+ className: "\n inline-flex items-center gap-2 mb-4\n text-text-secondary\n hover:text-text-primary\n transition-all duration-200\n ",
38
+ children: [/* @__PURE__ */ o(a, { size: 20 }), /* @__PURE__ */ o("span", {
39
+ className: "text-sm font-medium",
40
+ children: u("products.backToProducts", "Back to Products")
41
+ })]
42
+ }),
43
+ /* @__PURE__ */ o("h1", {
44
+ className: "text-3xl font-bold text-text-primary mb-2",
45
+ children: u("products.createProduct", "Create Product")
46
+ }),
47
+ /* @__PURE__ */ o("p", {
48
+ className: "text-text-secondary",
49
+ children: u("products.createProductSubtitle", "Add a new product to the platform")
50
+ })
51
+ ]
52
+ }),
53
+ p && /* @__PURE__ */ o("div", {
54
+ className: "mb-6 max-w-2xl p-4 bg-[var(--color-status-error-subtle)] border border-[var(--color-status-error-border)] rounded-lg",
55
+ children: /* @__PURE__ */ o("p", {
56
+ className: "text-sm text-[var(--color-status-error)]",
57
+ children: p
39
58
  })
40
- ]
41
- }), /* @__PURE__ */ a("div", {
42
- className: "max-w-2xl",
43
- children: /* @__PURE__ */ a("div", {
44
- className: "bg-surface border border-default rounded-lg p-6 shadow-[var(--shadow-elevation-1)]",
45
- children: /* @__PURE__ */ a(r, {
46
- onSubmit: f,
47
- onCancel: p,
48
- loading: d
59
+ }),
60
+ /* @__PURE__ */ o("div", {
61
+ className: "max-w-2xl",
62
+ children: /* @__PURE__ */ o("div", {
63
+ className: "bg-surface border border-default rounded-lg p-6 shadow-[var(--shadow-elevation-1)]",
64
+ children: /* @__PURE__ */ o(r, {
65
+ onSubmit: h,
66
+ onCancel: g,
67
+ loading: f
68
+ })
49
69
  })
50
70
  })
51
- })]
71
+ ]
52
72
  });
53
73
  }
54
74
  //#endregion
55
- export { s as ProductCreatePage };
75
+ export { c as ProductCreatePage };
56
76
 
57
77
  //# sourceMappingURL=ProductCreatePage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProductCreatePage.js","names":[],"sources":["../../../../../src/product-management/modules/products/pages/ProductCreatePage.tsx"],"sourcesContent":["import { ArrowLeft } from 'lucide-react';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { useProductConsole } from '../../../providers/ProductConsoleProvider';\nimport { useCreateProduct } from '../hooks/useProducts';\nimport { ProductForm } from '../components/ProductForm';\nimport type { CreateProductInput, UpdateProductInput } from '../types';\n\nexport function ProductCreatePage() {\n const { navigate, basePath = '/products' } = useProductConsole();\n const tr = useTr();\n const { createProduct, loading } = useCreateProduct();\n\n const handleSubmit = async (data: CreateProductInput | UpdateProductInput) => {\n try {\n const createData = data as CreateProductInput;\n const result = await createProduct(createData);\n if (result.data?.createPlatformProduct) {\n navigate(`${basePath}/${result.data.createPlatformProduct.id}`);\n }\n } catch (error) {\n console.error('Failed to create product:', error);\n }\n };\n\n const handleCancel = () => {\n navigate(basePath);\n };\n\n return (\n <div className=\"min-h-full bg-[var(--color-bg-canvas)] p-6 animate-in fade-in duration-300\">\n <div className=\"mb-6\">\n <button\n onClick={handleCancel}\n className=\"\n inline-flex items-center gap-2 mb-4\n text-text-secondary\n hover:text-text-primary\n transition-all duration-200\n \"\n >\n <ArrowLeft size={20} />\n <span className=\"text-sm font-medium\">\n {tr('products.backToProducts', 'Back to Products')}\n </span>\n </button>\n\n <h1 className=\"text-3xl font-bold text-text-primary mb-2\">\n {tr('products.createProduct', 'Create Product')}\n </h1>\n <p className=\"text-text-secondary\">\n {tr('products.createProductSubtitle', 'Add a new product to the platform')}\n </p>\n </div>\n\n <div className=\"max-w-2xl\">\n <div className=\"bg-surface border border-default rounded-lg p-6 shadow-[var(--shadow-elevation-1)]\">\n <ProductForm onSubmit={handleSubmit} onCancel={handleCancel} loading={loading} />\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,IAAoB;CAClC,IAAM,EAAE,aAAU,cAAW,gBAAgB,GAAmB,EAC1D,IAAK,GAAO,EACZ,EAAE,kBAAe,eAAY,GAAkB,EAE/C,IAAe,OAAO,MAAkD;AAC5E,MAAI;GAEF,IAAM,IAAS,MAAM,EAAc,EAAW;AAC9C,GAAI,EAAO,MAAM,yBACf,EAAS,GAAG,EAAS,GAAG,EAAO,KAAK,sBAAsB,KAAK;WAE1D,GAAO;AACd,WAAQ,MAAM,6BAA6B,EAAM;;IAI/C,UAAqB;AACzB,IAAS,EAAS;;AAGpB,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,OAAD;GAAK,WAAU;aAAf;IACE,kBAAC,UAAD;KACE,SAAS;KACT,WAAU;eAFZ,CASE,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA,EACvB,kBAAC,QAAD;MAAM,WAAU;gBACb,EAAG,2BAA2B,mBAAmB;MAC7C,CAAA,CACA;;IAET,kBAAC,MAAD;KAAI,WAAU;eACX,EAAG,0BAA0B,iBAAiB;KAC5C,CAAA;IACL,kBAAC,KAAD;KAAG,WAAU;eACV,EAAG,kCAAkC,oCAAoC;KACxE,CAAA;IACA;MAEN,kBAAC,OAAD;GAAK,WAAU;aACb,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,GAAD;KAAa,UAAU;KAAc,UAAU;KAAuB;KAAW,CAAA;IAC7E,CAAA;GACF,CAAA,CACF"}
1
+ {"version":3,"file":"ProductCreatePage.js","names":[],"sources":["../../../../../src/product-management/modules/products/pages/ProductCreatePage.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { ArrowLeft } from 'lucide-react';\nimport { useTr } from '../../../shared/hooks/useTr';\nimport { useProductConsole } from '../../../providers/ProductConsoleProvider';\nimport { useCreateProduct } from '../hooks/useProducts';\nimport { ProductForm } from '../components/ProductForm';\nimport type { CreateProductInput, UpdateProductInput } from '../types';\n\nexport function ProductCreatePage() {\n const { navigate, basePath = '/products' } = useProductConsole();\n const tr = useTr();\n const { createProduct, loading } = useCreateProduct();\n const [error, setError] = useState<string | null>(null);\n\n const handleSubmit = async (data: CreateProductInput | UpdateProductInput) => {\n try {\n setError(null);\n const createData = data as CreateProductInput;\n const result = await createProduct(createData);\n\n // Generated hooks (v3-style codegen) return GraphQL errors in `result.errors`\n // instead of throwing. Surface them inline so submit doesn't silently succeed.\n if (result.errors && result.errors.length > 0) {\n setError(result.errors[0]?.message ?? 'Failed to create product');\n return;\n }\n\n if (result.data?.createPlatformProduct) {\n navigate(`${basePath}/${result.data.createPlatformProduct.id}`);\n return;\n }\n\n setError('Failed to create product');\n } catch (err) {\n const message = err instanceof Error ? err.message : 'Failed to create product';\n setError(message);\n console.error('Failed to create product:', err);\n }\n };\n\n const handleCancel = () => {\n navigate(basePath);\n };\n\n return (\n <div className=\"min-h-full bg-[var(--color-bg-canvas)] p-6 animate-in fade-in duration-300\">\n <div className=\"mb-6\">\n <button\n onClick={handleCancel}\n className=\"\n inline-flex items-center gap-2 mb-4\n text-text-secondary\n hover:text-text-primary\n transition-all duration-200\n \"\n >\n <ArrowLeft size={20} />\n <span className=\"text-sm font-medium\">\n {tr('products.backToProducts', 'Back to Products')}\n </span>\n </button>\n\n <h1 className=\"text-3xl font-bold text-text-primary mb-2\">\n {tr('products.createProduct', 'Create Product')}\n </h1>\n <p className=\"text-text-secondary\">\n {tr('products.createProductSubtitle', 'Add a new product to the platform')}\n </p>\n </div>\n\n {error && (\n <div className=\"mb-6 max-w-2xl p-4 bg-[var(--color-status-error-subtle)] border border-[var(--color-status-error-border)] rounded-lg\">\n <p className=\"text-sm text-[var(--color-status-error)]\">{error}</p>\n </div>\n )}\n\n <div className=\"max-w-2xl\">\n <div className=\"bg-surface border border-default rounded-lg p-6 shadow-[var(--shadow-elevation-1)]\">\n <ProductForm onSubmit={handleSubmit} onCancel={handleCancel} loading={loading} />\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,IAAoB;CAClC,IAAM,EAAE,aAAU,cAAW,gBAAgB,GAAmB,EAC1D,IAAK,GAAO,EACZ,EAAE,kBAAe,eAAY,GAAkB,EAC/C,CAAC,GAAO,KAAY,EAAwB,KAAK,EAEjD,IAAe,OAAO,MAAkD;AAC5E,MAAI;AACF,KAAS,KAAK;GAEd,IAAM,IAAS,MAAM,EAAc,EAAW;AAI9C,OAAI,EAAO,UAAU,EAAO,OAAO,SAAS,GAAG;AAC7C,MAAS,EAAO,OAAO,IAAI,WAAW,2BAA2B;AACjE;;AAGF,OAAI,EAAO,MAAM,uBAAuB;AACtC,MAAS,GAAG,EAAS,GAAG,EAAO,KAAK,sBAAsB,KAAK;AAC/D;;AAGF,KAAS,2BAA2B;WAC7B,GAAK;AAGZ,GADA,EADgB,aAAe,QAAQ,EAAI,UAAU,2BACpC,EACjB,QAAQ,MAAM,6BAA6B,EAAI;;IAI7C,UAAqB;AACzB,IAAS,EAAS;;AAGpB,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf;GACE,kBAAC,OAAD;IAAK,WAAU;cAAf;KACE,kBAAC,UAAD;MACE,SAAS;MACT,WAAU;gBAFZ,CASE,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA,EACvB,kBAAC,QAAD;OAAM,WAAU;iBACb,EAAG,2BAA2B,mBAAmB;OAC7C,CAAA,CACA;;KAET,kBAAC,MAAD;MAAI,WAAU;gBACX,EAAG,0BAA0B,iBAAiB;MAC5C,CAAA;KACL,kBAAC,KAAD;MAAG,WAAU;gBACV,EAAG,kCAAkC,oCAAoC;MACxE,CAAA;KACA;;GAEL,KACC,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,KAAD;KAAG,WAAU;eAA4C;KAAU,CAAA;IAC/D,CAAA;GAGR,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,OAAD;KAAK,WAAU;eACb,kBAAC,GAAD;MAAa,UAAU;MAAc,UAAU;MAAuB;MAAW,CAAA;KAC7E,CAAA;IACF,CAAA;GACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"ProductDetailPage.d.ts","sourceRoot":"","sources":["../../../../../src/product-management/modules/products/pages/ProductDetailPage.tsx"],"names":[],"mappings":"AA2BA;;;GAGG;AACH,wBAAgB,iBAAiB,4CAmkBhC"}
1
+ {"version":3,"file":"ProductDetailPage.d.ts","sourceRoot":"","sources":["../../../../../src/product-management/modules/products/pages/ProductDetailPage.tsx"],"names":[],"mappings":"AA2BA;;;GAGG;AACH,wBAAgB,iBAAiB,4CAwkBhC"}
@@ -1,7 +1,7 @@
1
1
  import { useProductConsole as e } from "../../../providers/ProductConsoleProvider.js";
2
2
  import { LoadingState as t } from "../../../shared/components/feedback/LoadingState.js";
3
3
  import { ErrorState as n } from "../../../shared/components/feedback/ErrorState.js";
4
- import { useDeleteProduct as r, useProduct as i } from "../hooks/useProducts.js";
4
+ import { useDeleteProduct as r, useProductByIdOrSlug as i } from "../hooks/useProducts.js";
5
5
  import { ProductStatusBadge as a } from "../components/ProductStatusBadge.js";
6
6
  import { nativeConfirm as o, nativeImpact as s, nativeNotify as c } from "../../../../utils/nativeBridge.js";
7
7
  import { TagList as l } from "../../../shared/components/TagList.js";
@@ -25,7 +25,7 @@ function k() {
25
25
  cancelButtonTitle: "Cancel"
26
26
  });
27
27
  if (t === null ? window.confirm(e) : t) try {
28
- await L(k), c("success"), A(j);
28
+ await L(P.id), c("success"), A(j);
29
29
  } catch (e) {
30
30
  c("error"), console.error("Failed to delete product:", e);
31
31
  }
@@ -89,7 +89,7 @@ function k() {
89
89
  }), /* @__PURE__ */ D("div", {
90
90
  className: "flex gap-2",
91
91
  children: [/* @__PURE__ */ D("button", {
92
- onClick: () => A(`${j}/${k}/edit`),
92
+ onClick: () => A(`${j}/${P.id}/edit`),
93
93
  className: "\n inline-flex items-center gap-2 px-4 py-2\n bg-surface\n text-text-primary\n border border-default\n rounded-lg\n hover:bg-muted\n transition-all duration-200\n font-medium\n ",
94
94
  children: [/* @__PURE__ */ E(p, { size: 16 }), N("products.editProduct", "Edit Product")]
95
95
  }), /* @__PURE__ */ D("button", {