@nukleus-sports/page-shells 0.1.2 → 0.2.0
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.
- package/dist/marketing.cjs +14 -0
- package/dist/marketing.cjs.map +1 -1
- package/dist/marketing.d.cts +29 -0
- package/dist/marketing.d.ts +29 -0
- package/dist/marketing.js +19 -0
- package/dist/marketing.js.map +1 -1
- package/package.json +2 -2
package/dist/marketing.cjs
CHANGED
|
@@ -43,12 +43,14 @@ function MarketingDealsPanel({ adapter, className }) {
|
|
|
43
43
|
currentEmptyMessage,
|
|
44
44
|
completedEmptyMessage,
|
|
45
45
|
gatedEmptyState,
|
|
46
|
+
completedYearFilter,
|
|
46
47
|
getCollabMembership,
|
|
47
48
|
getCollabHref,
|
|
48
49
|
getOnCollabClick,
|
|
49
50
|
onEditDeal,
|
|
50
51
|
onDeleteDeal,
|
|
51
52
|
onOpenDocument,
|
|
53
|
+
clientImageUrl,
|
|
52
54
|
resolveImageUrl
|
|
53
55
|
} = adapter;
|
|
54
56
|
const [previewDeal, setPreviewDeal] = (0, import_react.useState)(null);
|
|
@@ -91,6 +93,17 @@ function MarketingDealsPanel({ adapter, className }) {
|
|
|
91
93
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "body-text text-text-primary text-center", children: errorMessage }),
|
|
92
94
|
onRetry && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui_web.Button, { variant: "secondary", size: "form", onClick: onRetry, children: "Retry" })
|
|
93
95
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
96
|
+
activeTab === "completed" && completedYearFilter && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
97
|
+
import_ui_web.Select,
|
|
98
|
+
{
|
|
99
|
+
value: completedYearFilter.value,
|
|
100
|
+
onValueChange: completedYearFilter.onChange,
|
|
101
|
+
children: [
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui_web.SelectTrigger, { className: "w-[140px]", "aria-label": "Filter completed deals by year", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui_web.SelectValue, {}) }),
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui_web.SelectContent, { children: completedYearFilter.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui_web.SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
),
|
|
94
107
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "hidden sm:flex items-center bg-greys-grey-table-h rounded-t-[10px] py-0 px-3 gap-3 h-[33px]", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "label-xs-table text-text-primary font-ss02", children: "Deals" }) }),
|
|
95
108
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui_web.TabsContent, { value: "current", className: "mt-0", children: gatedEmptyState ? gatedEmptyState : currentProjectDeals.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-col gap-3 sm:gap-0", children: currentProjectDeals.map((deal) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
109
|
import_marketing.ProjectDealCard,
|
|
@@ -147,6 +160,7 @@ function MarketingDealsPanel({ adapter, className }) {
|
|
|
147
160
|
onEditDeal(deal);
|
|
148
161
|
} : void 0,
|
|
149
162
|
onOpenDocument,
|
|
163
|
+
clientImageUrl,
|
|
150
164
|
resolveImageUrl
|
|
151
165
|
}
|
|
152
166
|
)
|
package/dist/marketing.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marketing/index.ts","../src/marketing/marketing-deals-panel.tsx"],"sourcesContent":["export {\n MarketingDealsPanel,\n type MarketingDealsAdapter,\n type MarketingDealsPanelProps,\n} from \"./marketing-deals-panel\";\n","import { useState, type MouseEvent, type ReactNode } from \"react\";\n\nimport {\n Button,\n Skeleton,\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n cn,\n} from \"@nukleus-sports/ui-web\";\nimport {\n DealEmptyState,\n ManualDealCard,\n ManualDealPreviewDialog,\n ProjectDealCard,\n type EntityImageResolver,\n type ManualDeal,\n type ManualDealDocumentRef,\n type ProjectCollabMembership,\n type ProjectDeal,\n} from \"@nukleus-sports/ui-patterns/marketing\";\n\n/**\n * Reconciled from both apps' real current pages:\n * - `nukleus-app`'s `MarketingDealsTab.tsx` (`ClientMarketingTab`)\n * - `nukleus-clientapp`'s `pages/Marketing.tsx` + `hooks/useMarketing.ts`\n *\n * Both pages share one identical skeleton: a \"Current Deals\"/\"Completed\" tab\n * pair, a \"Deals\" label bar, a `ProjectDealCard` list per tab (`Completed`\n * also appends `ManualDealCard`s), matching empty states, and a shared\n * `ManualDealPreviewDialog`. That skeleton is this component's entire scope.\n *\n * ## Deliberately NOT in this shell (stays app-local, per CLAUDE.md's\n * page-shells rule and the decisions already made for this feature)\n * - The page header/title and the \"Record Past Deal\"/\"New Marketing Deal\"\n * buttons — `nukleus-app`-only chrome with no clientapp equivalent.\n * - `MarketingDealForm` (the CRUD create/edit form) and `DeleteDialog` —\n * `nukleus-app`-only, no clientapp read-only counterpart to reconcile\n * against, same reasoning as `MarketingOverviewPanel`/`Card` (also kept\n * app-local, rendered alongside this shell, not inside it).\n * - The top-level access gate (`nukleus-app`'s `marketingPermission ===\n * \"No Access\"` → `RestrictedAccessCard`; `clientapp`'s `!isAgencyLinked` →\n * `AgencyLinkBanner`). Both are a one-time \"should the deals experience\n * render at all\" decision made from each app's own permission shape\n * (`@nukleus-sports/core`'s `MarketingPermission` union) *before* this\n * shell ever mounts — not something this component re-derives.\n * - Project-membership resolution for the \"Collab\" link gate (`@nukleus-sports/\n * ui-patterns`' `ProjectDealCard` already enforces this structurally via its\n * required `collabMembership` prop) — the actual membership check is an\n * app-level query, surfaced here through `getCollabMembership`.\n *\n * ## Genuine differences reconciled (not formatting)\n * - Client-status gating (`nukleus-app`'s `isGated`, e.g. a \"Prospect\" client\n * can't have deals yet): `clientapp` has no such concept. Modeled as an\n * optional `gatedEmptyState` — when supplied, it replaces the Current tab's\n * content and the Completed tab is disabled, exactly matching `nukleus-app`'s\n * structure; omit it and both tabs behave normally (`clientapp`'s case).\n * - Loading skeleton: `clientapp` shows one before the tabs ever render;\n * `nukleus-app` has none (deals just populate once the query resolves).\n * Kept as an additive, opt-in `isLoading` prop — a loading affordance isn't\n * an agency-vs-client distinction, so both can use it.\n * - \"Deals\" label bar visibility on mobile: `nukleus-app` hides it below `sm`\n * (`hidden sm:flex`), `clientapp` always shows it. Kept `nukleus-app`'s\n * responsive hiding — the mobile layout is already a compact card stack\n * without a tabular header, so the label reads as redundant there.\n * - Completed-tab empty message: `nukleus-app`'s wording depends on whether\n * there are current-tab project deals (\"No past deals recorded yet.\" vs.\n * the fuller \"no deals at all\" message); `clientapp`'s is a single fixed\n * string. `completedEmptyMessage` accepts either a plain string or a\n * `(hasCurrentProjectDeals: boolean) => string` so both shapes work without\n * baking either app's copy into this package.\n */\n\n/**\n * The app-supplied bridge to its own data/backend — per\n * `docs/APPLICATION_ARCHITECTURE.md`'s Layer 5 adapter pattern, this shell\n * takes a single typed `adapter` prop rather than flat individual props, so\n * each app's own `use<Page>()` hook has one output shape to satisfy and\n * drifting apart becomes a compile error, not a silent runtime mismatch.\n */\nexport interface MarketingDealsAdapter {\n /** Shows a loading skeleton in place of the tabs. Additive — see module doc. */\n isLoading?: boolean;\n /** Shows an inline error message in place of the deal lists. */\n error?: boolean;\n errorMessage?: string;\n /** Shows a \"Retry\" button in the error state when supplied. Both apps'\n * real pages combine retrying whichever underlying query actually failed\n * behind one button — this stays a single callback for the same reason. */\n onRetry?: () => void;\n\n activeTab: \"current\" | \"completed\";\n onTabChange: (tab: \"current\" | \"completed\") => void;\n\n currentProjectDeals: ProjectDeal[];\n completedProjectDeals: ProjectDeal[];\n manualDeals: ManualDeal[];\n\n currentEmptyMessage: string;\n completedEmptyMessage: string | ((hasCurrentProjectDeals: boolean) => string);\n\n /**\n * Replaces the Current tab's content and disables the Completed tab —\n * `nukleus-app`'s client-status gating. Omit for `clientapp`'s ungated\n * behavior.\n */\n gatedEmptyState?: ReactNode;\n\n /** Required — `ProjectDealCard` structurally can't omit this. See module doc. */\n getCollabMembership: (projectId: string) => ProjectCollabMembership;\n getCollabHref: (projectId: string) => string;\n /** `nukleus-app`'s demo-mode upsell toast swaps the link for a button. */\n getOnCollabClick?: (\n projectId: string,\n ) => ((e: MouseEvent<HTMLButtonElement>) => void) | undefined;\n\n /** Presence of each enables that affordance on `ManualDealCard`/the preview\n * dialog — same shape `ManualDealCard`/`ManualDealPreviewDialog` already\n * take, so this just passes through. */\n onEditDeal?: (deal: ManualDeal) => void;\n onDeleteDeal?: (deal: ManualDeal) => void;\n onOpenDocument: (doc: ManualDealDocumentRef) => void;\n\n resolveImageUrl?: EntityImageResolver;\n}\n\nexport interface MarketingDealsPanelProps {\n adapter: MarketingDealsAdapter;\n /** Pure styling override — not part of the adapter, since it's never\n * backend/data-shaped. */\n className?: string;\n}\n\nexport function MarketingDealsPanel({ adapter, className }: MarketingDealsPanelProps) {\n const {\n isLoading,\n error,\n errorMessage = \"Could not load marketing deals. Please try again.\",\n onRetry,\n activeTab,\n onTabChange,\n currentProjectDeals,\n completedProjectDeals,\n manualDeals,\n currentEmptyMessage,\n completedEmptyMessage,\n gatedEmptyState,\n getCollabMembership,\n getCollabHref,\n getOnCollabClick,\n onEditDeal,\n onDeleteDeal,\n onOpenDocument,\n resolveImageUrl,\n } = adapter;\n\n const [previewDeal, setPreviewDeal] = useState<ManualDeal | null>(null);\n\n const resolvedCompletedEmptyMessage =\n typeof completedEmptyMessage === \"function\"\n ? completedEmptyMessage(currentProjectDeals.length > 0)\n : completedEmptyMessage;\n const hasCompletedContent = completedProjectDeals.length > 0 || manualDeals.length > 0;\n\n if (isLoading) {\n return (\n <div className={cn(\"flex flex-col gap-3\", className)}>\n <Skeleton className=\"h-9 w-full rounded-[10px]\" />\n <Skeleton className=\"h-[300px] w-full rounded-[10px]\" />\n </div>\n );\n }\n\n return (\n <div className={className}>\n <Tabs\n value={activeTab}\n onValueChange={(value) => onTabChange(value as \"current\" | \"completed\")}\n className=\"w-full flex flex-col gap-3\"\n >\n <TabsList className=\"grid w-full grid-cols-2 bg-transparent border-b border-greys-grey-strokes-tables rounded-none h-auto p-0\">\n <TabsTrigger\n value=\"current\"\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none\"\n >\n Current Deals\n </TabsTrigger>\n <TabsTrigger\n value=\"completed\"\n disabled={!!gatedEmptyState}\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n Completed\n </TabsTrigger>\n </TabsList>\n\n {error ? (\n <div className=\"flex flex-col items-center justify-center gap-3 py-10 px-6\" role=\"alert\">\n <p className=\"body-text text-text-primary text-center\">{errorMessage}</p>\n {onRetry && (\n <Button variant=\"secondary\" size=\"form\" onClick={onRetry}>\n Retry\n </Button>\n )}\n </div>\n ) : (\n <>\n <div className=\"hidden sm:flex items-center bg-greys-grey-table-h rounded-t-[10px] py-0 px-3 gap-3 h-[33px]\">\n <span className=\"label-xs-table text-text-primary font-ss02\">Deals</span>\n </div>\n\n <TabsContent value=\"current\" className=\"mt-0\">\n {gatedEmptyState ? (\n gatedEmptyState\n ) : currentProjectDeals.length > 0 ? (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {currentProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={false}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n </div>\n ) : (\n <DealEmptyState message={currentEmptyMessage} />\n )}\n </TabsContent>\n\n <TabsContent value=\"completed\" className=\"mt-0\">\n {!hasCompletedContent ? (\n <DealEmptyState message={resolvedCompletedEmptyMessage} />\n ) : (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {completedProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={true}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n {manualDeals.map((deal) => (\n <ManualDealCard\n key={deal.id}\n deal={deal}\n onPreview={setPreviewDeal}\n onEdit={onEditDeal}\n onDelete={onDeleteDeal}\n onOpenDocument={onOpenDocument}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n </div>\n )}\n </TabsContent>\n </>\n )}\n </Tabs>\n\n <ManualDealPreviewDialog\n deal={previewDeal}\n open={!!previewDeal}\n onOpenChange={(open) => {\n if (!open) setPreviewDeal(null);\n }}\n onEdit={\n onEditDeal\n ? (deal) => {\n // Close the preview before handing off to the edit flow,\n // matching nukleus-app's original behavior.\n setPreviewDeal(null);\n onEditDeal(deal);\n }\n : undefined\n }\n onOpenDocument={onOpenDocument}\n resolveImageUrl={resolveImageUrl}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA0D;AAE1D,oBAQO;AACP,uBAUO;AAkJD;AAjCC,SAAS,oBAAoB,EAAE,SAAS,UAAU,GAA6B;AACpF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;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":[]}
|
|
1
|
+
{"version":3,"sources":["../src/marketing/index.ts","../src/marketing/marketing-deals-panel.tsx"],"sourcesContent":["export {\n MarketingDealsPanel,\n type MarketingDealsAdapter,\n type MarketingDealsPanelProps,\n} from \"./marketing-deals-panel\";\n","import { useState, type MouseEvent, type ReactNode } from \"react\";\n\nimport {\n Button,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n Skeleton,\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n cn,\n} from \"@nukleus-sports/ui-web\";\nimport {\n DealEmptyState,\n ManualDealCard,\n ManualDealPreviewDialog,\n ProjectDealCard,\n type EntityImageResolver,\n type ManualDeal,\n type ManualDealDocumentRef,\n type ProjectCollabMembership,\n type ProjectDeal,\n} from \"@nukleus-sports/ui-patterns/marketing\";\n\n/**\n * Reconciled from both apps' real current pages:\n * - `nukleus-app`'s `MarketingDealsTab.tsx` (`ClientMarketingTab`)\n * - `nukleus-clientapp`'s `pages/Marketing.tsx` + `hooks/useMarketing.ts`\n *\n * Both pages share one identical skeleton: a \"Current Deals\"/\"Completed\" tab\n * pair, a \"Deals\" label bar, a `ProjectDealCard` list per tab (`Completed`\n * also appends `ManualDealCard`s), matching empty states, and a shared\n * `ManualDealPreviewDialog`. That skeleton is this component's entire scope.\n *\n * ## Deliberately NOT in this shell (stays app-local, per CLAUDE.md's\n * page-shells rule and the decisions already made for this feature)\n * - The page header/title and the \"Record Past Deal\"/\"New Marketing Deal\"\n * buttons — `nukleus-app`-only chrome with no clientapp equivalent.\n * - `MarketingDealForm` (the CRUD create/edit form) and `DeleteDialog` —\n * `nukleus-app`-only, no clientapp read-only counterpart to reconcile\n * against, same reasoning as `MarketingOverviewPanel`/`Card` (also kept\n * app-local, rendered alongside this shell, not inside it).\n * - The top-level access gate (`nukleus-app`'s `marketingPermission ===\n * \"No Access\"` → `RestrictedAccessCard`; `clientapp`'s `!isAgencyLinked` →\n * `AgencyLinkBanner`). Both are a one-time \"should the deals experience\n * render at all\" decision made from each app's own permission shape\n * (`@nukleus-sports/core`'s `MarketingPermission` union) *before* this\n * shell ever mounts — not something this component re-derives.\n * - Project-membership resolution for the \"Collab\" link gate (`@nukleus-sports/\n * ui-patterns`' `ProjectDealCard` already enforces this structurally via its\n * required `collabMembership` prop) — the actual membership check is an\n * app-level query, surfaced here through `getCollabMembership`.\n *\n * ## Genuine differences reconciled (not formatting)\n * - Client-status gating (`nukleus-app`'s `isGated`, e.g. a \"Prospect\" client\n * can't have deals yet): `clientapp` has no such concept. Modeled as an\n * optional `gatedEmptyState` — when supplied, it replaces the Current tab's\n * content and the Completed tab is disabled, exactly matching `nukleus-app`'s\n * structure; omit it and both tabs behave normally (`clientapp`'s case).\n * - Loading skeleton: `clientapp` shows one before the tabs ever render;\n * `nukleus-app` has none (deals just populate once the query resolves).\n * Kept as an additive, opt-in `isLoading` prop — a loading affordance isn't\n * an agency-vs-client distinction, so both can use it.\n * - \"Deals\" label bar visibility on mobile: `nukleus-app` hides it below `sm`\n * (`hidden sm:flex`), `clientapp` always shows it. Kept `nukleus-app`'s\n * responsive hiding — the mobile layout is already a compact card stack\n * without a tabular header, so the label reads as redundant there.\n * - Completed-tab empty message: `nukleus-app`'s wording depends on whether\n * there are current-tab project deals (\"No past deals recorded yet.\" vs.\n * the fuller \"no deals at all\" message); `clientapp`'s is a single fixed\n * string. `completedEmptyMessage` accepts either a plain string or a\n * `(hasCurrentProjectDeals: boolean) => string` so both shapes work without\n * baking either app's copy into this package.\n * - Completed-tab year filter: `clientapp` lets a client filter years of\n * deal history via a dropdown; `nukleus-app` has no equivalent at all.\n * Modeled as an optional `completedYearFilter` — when supplied, this\n * package renders the dropdown (and nothing else; which deals actually\n * appear is still just `completedProjectDeals`/`manualDeals`, already\n * filtered by the adapter before this object is built). `nukleus-app`\n * simply omits it, same pattern as `gatedEmptyState`.\n */\n\n/**\n * The app-supplied bridge to its own data/backend — per\n * `docs/APPLICATION_ARCHITECTURE.md`'s Layer 5 adapter pattern, this shell\n * takes a single typed `adapter` prop rather than flat individual props, so\n * each app's own `use<Page>()` hook has one output shape to satisfy and\n * drifting apart becomes a compile error, not a silent runtime mismatch.\n */\nexport interface MarketingDealsAdapter {\n /** Shows a loading skeleton in place of the tabs. Additive — see module doc. */\n isLoading?: boolean;\n /** Shows an inline error message in place of the deal lists. */\n error?: boolean;\n errorMessage?: string;\n /** Shows a \"Retry\" button in the error state when supplied. Both apps'\n * real pages combine retrying whichever underlying query actually failed\n * behind one button — this stays a single callback for the same reason. */\n onRetry?: () => void;\n\n activeTab: \"current\" | \"completed\";\n onTabChange: (tab: \"current\" | \"completed\") => void;\n\n currentProjectDeals: ProjectDeal[];\n completedProjectDeals: ProjectDeal[];\n manualDeals: ManualDeal[];\n\n currentEmptyMessage: string;\n completedEmptyMessage: string | ((hasCurrentProjectDeals: boolean) => string);\n\n /**\n * Replaces the Current tab's content and disables the Completed tab —\n * `nukleus-app`'s client-status gating. Omit for `clientapp`'s ungated\n * behavior.\n */\n gatedEmptyState?: ReactNode;\n\n /**\n * Year filter for the Completed tab's deal history (`clientapp`-only\n * today — `nukleus-app` has no equivalent, so it simply never supplies\n * this). This package renders only the dropdown; filtering which deals\n * actually appear in `completedProjectDeals`/`manualDeals` is the\n * adapter's own job, done before this object is built (same as\n * `clientapp`'s own hook already filtering before this retrofit).\n * `options` already includes any \"All\" entry the caller wants — this\n * package has no opinion on that sentinel value or its label.\n */\n completedYearFilter?: {\n options: { value: string; label: string }[];\n value: string;\n onChange: (value: string) => void;\n };\n\n /** Required — `ProjectDealCard` structurally can't omit this. See module doc. */\n getCollabMembership: (projectId: string) => ProjectCollabMembership;\n getCollabHref: (projectId: string) => string;\n /** `nukleus-app`'s demo-mode upsell toast swaps the link for a button. */\n getOnCollabClick?: (\n projectId: string,\n ) => ((e: MouseEvent<HTMLButtonElement>) => void) | undefined;\n\n /** Presence of each enables that affordance on `ManualDealCard`/the preview\n * dialog — same shape `ManualDealCard`/`ManualDealPreviewDialog` already\n * take, so this just passes through. */\n onEditDeal?: (deal: ManualDeal) => void;\n onDeleteDeal?: (deal: ManualDeal) => void;\n onOpenDocument: (doc: ManualDealDocumentRef) => void;\n\n /** Photo of the client whose page this panel is rendered on, shown beside\n * \"Client Name\" in the manual deal preview dialog. Omit to show just the\n * name (no avatar). */\n clientImageUrl?: string | null;\n resolveImageUrl?: EntityImageResolver;\n}\n\nexport interface MarketingDealsPanelProps {\n adapter: MarketingDealsAdapter;\n /** Pure styling override — not part of the adapter, since it's never\n * backend/data-shaped. */\n className?: string;\n}\n\nexport function MarketingDealsPanel({ adapter, className }: MarketingDealsPanelProps) {\n const {\n isLoading,\n error,\n errorMessage = \"Could not load marketing deals. Please try again.\",\n onRetry,\n activeTab,\n onTabChange,\n currentProjectDeals,\n completedProjectDeals,\n manualDeals,\n currentEmptyMessage,\n completedEmptyMessage,\n gatedEmptyState,\n completedYearFilter,\n getCollabMembership,\n getCollabHref,\n getOnCollabClick,\n onEditDeal,\n onDeleteDeal,\n onOpenDocument,\n clientImageUrl,\n resolveImageUrl,\n } = adapter;\n\n const [previewDeal, setPreviewDeal] = useState<ManualDeal | null>(null);\n\n const resolvedCompletedEmptyMessage =\n typeof completedEmptyMessage === \"function\"\n ? completedEmptyMessage(currentProjectDeals.length > 0)\n : completedEmptyMessage;\n const hasCompletedContent = completedProjectDeals.length > 0 || manualDeals.length > 0;\n\n if (isLoading) {\n return (\n <div className={cn(\"flex flex-col gap-3\", className)}>\n <Skeleton className=\"h-9 w-full rounded-[10px]\" />\n <Skeleton className=\"h-[300px] w-full rounded-[10px]\" />\n </div>\n );\n }\n\n return (\n <div className={className}>\n <Tabs\n value={activeTab}\n onValueChange={(value) => onTabChange(value as \"current\" | \"completed\")}\n className=\"w-full flex flex-col gap-3\"\n >\n <TabsList className=\"grid w-full grid-cols-2 bg-transparent border-b border-greys-grey-strokes-tables rounded-none h-auto p-0\">\n <TabsTrigger\n value=\"current\"\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none\"\n >\n Current Deals\n </TabsTrigger>\n <TabsTrigger\n value=\"completed\"\n disabled={!!gatedEmptyState}\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n Completed\n </TabsTrigger>\n </TabsList>\n\n {error ? (\n <div className=\"flex flex-col items-center justify-center gap-3 py-10 px-6\" role=\"alert\">\n <p className=\"body-text text-text-primary text-center\">{errorMessage}</p>\n {onRetry && (\n <Button variant=\"secondary\" size=\"form\" onClick={onRetry}>\n Retry\n </Button>\n )}\n </div>\n ) : (\n <>\n {activeTab === \"completed\" && completedYearFilter && (\n <Select\n value={completedYearFilter.value}\n onValueChange={completedYearFilter.onChange}\n >\n <SelectTrigger className=\"w-[140px]\" aria-label=\"Filter completed deals by year\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {completedYearFilter.options.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n\n <div className=\"hidden sm:flex items-center bg-greys-grey-table-h rounded-t-[10px] py-0 px-3 gap-3 h-[33px]\">\n <span className=\"label-xs-table text-text-primary font-ss02\">Deals</span>\n </div>\n\n <TabsContent value=\"current\" className=\"mt-0\">\n {gatedEmptyState ? (\n gatedEmptyState\n ) : currentProjectDeals.length > 0 ? (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {currentProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={false}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n </div>\n ) : (\n <DealEmptyState message={currentEmptyMessage} />\n )}\n </TabsContent>\n\n <TabsContent value=\"completed\" className=\"mt-0\">\n {!hasCompletedContent ? (\n <DealEmptyState message={resolvedCompletedEmptyMessage} />\n ) : (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {completedProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={true}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n {manualDeals.map((deal) => (\n <ManualDealCard\n key={deal.id}\n deal={deal}\n onPreview={setPreviewDeal}\n onEdit={onEditDeal}\n onDelete={onDeleteDeal}\n onOpenDocument={onOpenDocument}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n </div>\n )}\n </TabsContent>\n </>\n )}\n </Tabs>\n\n <ManualDealPreviewDialog\n deal={previewDeal}\n open={!!previewDeal}\n onOpenChange={(open) => {\n if (!open) setPreviewDeal(null);\n }}\n onEdit={\n onEditDeal\n ? (deal) => {\n // Close the preview before handing off to the edit flow,\n // matching nukleus-app's original behavior.\n setPreviewDeal(null);\n onEditDeal(deal);\n }\n : undefined\n }\n onOpenDocument={onOpenDocument}\n clientImageUrl={clientImageUrl}\n resolveImageUrl={resolveImageUrl}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA0D;AAE1D,oBAaO;AACP,uBAUO;AA+KD;AAnCC,SAAS,oBAAoB,EAAE,SAAS,UAAU,GAA6B;AACpF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA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IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,MAAM,CAAC,CAAC;AAAA,QACR,cAAc,CAAC,SAAS;AACtB,cAAI,CAAC,KAAM,gBAAe,IAAI;AAAA,QAChC;AAAA,QACA,QACE,aACI,CAAC,SAAS;AAGR,yBAAe,IAAI;AACnB,qBAAW,IAAI;AAAA,QACjB,IACA;AAAA,QAEN;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
|
package/dist/marketing.d.cts
CHANGED
|
@@ -51,6 +51,13 @@ import { ProjectDeal, ManualDeal, ProjectCollabMembership, ManualDealDocumentRef
|
|
|
51
51
|
* string. `completedEmptyMessage` accepts either a plain string or a
|
|
52
52
|
* `(hasCurrentProjectDeals: boolean) => string` so both shapes work without
|
|
53
53
|
* baking either app's copy into this package.
|
|
54
|
+
* - Completed-tab year filter: `clientapp` lets a client filter years of
|
|
55
|
+
* deal history via a dropdown; `nukleus-app` has no equivalent at all.
|
|
56
|
+
* Modeled as an optional `completedYearFilter` — when supplied, this
|
|
57
|
+
* package renders the dropdown (and nothing else; which deals actually
|
|
58
|
+
* appear is still just `completedProjectDeals`/`manualDeals`, already
|
|
59
|
+
* filtered by the adapter before this object is built). `nukleus-app`
|
|
60
|
+
* simply omits it, same pattern as `gatedEmptyState`.
|
|
54
61
|
*/
|
|
55
62
|
/**
|
|
56
63
|
* The app-supplied bridge to its own data/backend — per
|
|
@@ -82,6 +89,24 @@ interface MarketingDealsAdapter {
|
|
|
82
89
|
* behavior.
|
|
83
90
|
*/
|
|
84
91
|
gatedEmptyState?: ReactNode;
|
|
92
|
+
/**
|
|
93
|
+
* Year filter for the Completed tab's deal history (`clientapp`-only
|
|
94
|
+
* today — `nukleus-app` has no equivalent, so it simply never supplies
|
|
95
|
+
* this). This package renders only the dropdown; filtering which deals
|
|
96
|
+
* actually appear in `completedProjectDeals`/`manualDeals` is the
|
|
97
|
+
* adapter's own job, done before this object is built (same as
|
|
98
|
+
* `clientapp`'s own hook already filtering before this retrofit).
|
|
99
|
+
* `options` already includes any "All" entry the caller wants — this
|
|
100
|
+
* package has no opinion on that sentinel value or its label.
|
|
101
|
+
*/
|
|
102
|
+
completedYearFilter?: {
|
|
103
|
+
options: {
|
|
104
|
+
value: string;
|
|
105
|
+
label: string;
|
|
106
|
+
}[];
|
|
107
|
+
value: string;
|
|
108
|
+
onChange: (value: string) => void;
|
|
109
|
+
};
|
|
85
110
|
/** Required — `ProjectDealCard` structurally can't omit this. See module doc. */
|
|
86
111
|
getCollabMembership: (projectId: string) => ProjectCollabMembership;
|
|
87
112
|
getCollabHref: (projectId: string) => string;
|
|
@@ -93,6 +118,10 @@ interface MarketingDealsAdapter {
|
|
|
93
118
|
onEditDeal?: (deal: ManualDeal) => void;
|
|
94
119
|
onDeleteDeal?: (deal: ManualDeal) => void;
|
|
95
120
|
onOpenDocument: (doc: ManualDealDocumentRef) => void;
|
|
121
|
+
/** Photo of the client whose page this panel is rendered on, shown beside
|
|
122
|
+
* "Client Name" in the manual deal preview dialog. Omit to show just the
|
|
123
|
+
* name (no avatar). */
|
|
124
|
+
clientImageUrl?: string | null;
|
|
96
125
|
resolveImageUrl?: EntityImageResolver;
|
|
97
126
|
}
|
|
98
127
|
interface MarketingDealsPanelProps {
|
package/dist/marketing.d.ts
CHANGED
|
@@ -51,6 +51,13 @@ import { ProjectDeal, ManualDeal, ProjectCollabMembership, ManualDealDocumentRef
|
|
|
51
51
|
* string. `completedEmptyMessage` accepts either a plain string or a
|
|
52
52
|
* `(hasCurrentProjectDeals: boolean) => string` so both shapes work without
|
|
53
53
|
* baking either app's copy into this package.
|
|
54
|
+
* - Completed-tab year filter: `clientapp` lets a client filter years of
|
|
55
|
+
* deal history via a dropdown; `nukleus-app` has no equivalent at all.
|
|
56
|
+
* Modeled as an optional `completedYearFilter` — when supplied, this
|
|
57
|
+
* package renders the dropdown (and nothing else; which deals actually
|
|
58
|
+
* appear is still just `completedProjectDeals`/`manualDeals`, already
|
|
59
|
+
* filtered by the adapter before this object is built). `nukleus-app`
|
|
60
|
+
* simply omits it, same pattern as `gatedEmptyState`.
|
|
54
61
|
*/
|
|
55
62
|
/**
|
|
56
63
|
* The app-supplied bridge to its own data/backend — per
|
|
@@ -82,6 +89,24 @@ interface MarketingDealsAdapter {
|
|
|
82
89
|
* behavior.
|
|
83
90
|
*/
|
|
84
91
|
gatedEmptyState?: ReactNode;
|
|
92
|
+
/**
|
|
93
|
+
* Year filter for the Completed tab's deal history (`clientapp`-only
|
|
94
|
+
* today — `nukleus-app` has no equivalent, so it simply never supplies
|
|
95
|
+
* this). This package renders only the dropdown; filtering which deals
|
|
96
|
+
* actually appear in `completedProjectDeals`/`manualDeals` is the
|
|
97
|
+
* adapter's own job, done before this object is built (same as
|
|
98
|
+
* `clientapp`'s own hook already filtering before this retrofit).
|
|
99
|
+
* `options` already includes any "All" entry the caller wants — this
|
|
100
|
+
* package has no opinion on that sentinel value or its label.
|
|
101
|
+
*/
|
|
102
|
+
completedYearFilter?: {
|
|
103
|
+
options: {
|
|
104
|
+
value: string;
|
|
105
|
+
label: string;
|
|
106
|
+
}[];
|
|
107
|
+
value: string;
|
|
108
|
+
onChange: (value: string) => void;
|
|
109
|
+
};
|
|
85
110
|
/** Required — `ProjectDealCard` structurally can't omit this. See module doc. */
|
|
86
111
|
getCollabMembership: (projectId: string) => ProjectCollabMembership;
|
|
87
112
|
getCollabHref: (projectId: string) => string;
|
|
@@ -93,6 +118,10 @@ interface MarketingDealsAdapter {
|
|
|
93
118
|
onEditDeal?: (deal: ManualDeal) => void;
|
|
94
119
|
onDeleteDeal?: (deal: ManualDeal) => void;
|
|
95
120
|
onOpenDocument: (doc: ManualDealDocumentRef) => void;
|
|
121
|
+
/** Photo of the client whose page this panel is rendered on, shown beside
|
|
122
|
+
* "Client Name" in the manual deal preview dialog. Omit to show just the
|
|
123
|
+
* name (no avatar). */
|
|
124
|
+
clientImageUrl?: string | null;
|
|
96
125
|
resolveImageUrl?: EntityImageResolver;
|
|
97
126
|
}
|
|
98
127
|
interface MarketingDealsPanelProps {
|
package/dist/marketing.js
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import {
|
|
4
4
|
Button,
|
|
5
|
+
Select,
|
|
6
|
+
SelectContent,
|
|
7
|
+
SelectItem,
|
|
8
|
+
SelectTrigger,
|
|
9
|
+
SelectValue,
|
|
5
10
|
Skeleton,
|
|
6
11
|
Tabs,
|
|
7
12
|
TabsContent,
|
|
@@ -30,12 +35,14 @@ function MarketingDealsPanel({ adapter, className }) {
|
|
|
30
35
|
currentEmptyMessage,
|
|
31
36
|
completedEmptyMessage,
|
|
32
37
|
gatedEmptyState,
|
|
38
|
+
completedYearFilter,
|
|
33
39
|
getCollabMembership,
|
|
34
40
|
getCollabHref,
|
|
35
41
|
getOnCollabClick,
|
|
36
42
|
onEditDeal,
|
|
37
43
|
onDeleteDeal,
|
|
38
44
|
onOpenDocument,
|
|
45
|
+
clientImageUrl,
|
|
39
46
|
resolveImageUrl
|
|
40
47
|
} = adapter;
|
|
41
48
|
const [previewDeal, setPreviewDeal] = useState(null);
|
|
@@ -78,6 +85,17 @@ function MarketingDealsPanel({ adapter, className }) {
|
|
|
78
85
|
/* @__PURE__ */ jsx("p", { className: "body-text text-text-primary text-center", children: errorMessage }),
|
|
79
86
|
onRetry && /* @__PURE__ */ jsx(Button, { variant: "secondary", size: "form", onClick: onRetry, children: "Retry" })
|
|
80
87
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
88
|
+
activeTab === "completed" && completedYearFilter && /* @__PURE__ */ jsxs(
|
|
89
|
+
Select,
|
|
90
|
+
{
|
|
91
|
+
value: completedYearFilter.value,
|
|
92
|
+
onValueChange: completedYearFilter.onChange,
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "w-[140px]", "aria-label": "Filter completed deals by year", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
95
|
+
/* @__PURE__ */ jsx(SelectContent, { children: completedYearFilter.options.map((option) => /* @__PURE__ */ jsx(SelectItem, { value: option.value, children: option.label }, option.value)) })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
),
|
|
81
99
|
/* @__PURE__ */ jsx("div", { className: "hidden sm:flex items-center bg-greys-grey-table-h rounded-t-[10px] py-0 px-3 gap-3 h-[33px]", children: /* @__PURE__ */ jsx("span", { className: "label-xs-table text-text-primary font-ss02", children: "Deals" }) }),
|
|
82
100
|
/* @__PURE__ */ jsx(TabsContent, { value: "current", className: "mt-0", children: gatedEmptyState ? gatedEmptyState : currentProjectDeals.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 sm:gap-0", children: currentProjectDeals.map((deal) => /* @__PURE__ */ jsx(
|
|
83
101
|
ProjectDealCard,
|
|
@@ -134,6 +152,7 @@ function MarketingDealsPanel({ adapter, className }) {
|
|
|
134
152
|
onEditDeal(deal);
|
|
135
153
|
} : void 0,
|
|
136
154
|
onOpenDocument,
|
|
155
|
+
clientImageUrl,
|
|
137
156
|
resolveImageUrl
|
|
138
157
|
}
|
|
139
158
|
)
|
package/dist/marketing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/marketing/marketing-deals-panel.tsx"],"sourcesContent":["import { useState, type MouseEvent, type ReactNode } from \"react\";\n\nimport {\n Button,\n Skeleton,\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n cn,\n} from \"@nukleus-sports/ui-web\";\nimport {\n DealEmptyState,\n ManualDealCard,\n ManualDealPreviewDialog,\n ProjectDealCard,\n type EntityImageResolver,\n type ManualDeal,\n type ManualDealDocumentRef,\n type ProjectCollabMembership,\n type ProjectDeal,\n} from \"@nukleus-sports/ui-patterns/marketing\";\n\n/**\n * Reconciled from both apps' real current pages:\n * - `nukleus-app`'s `MarketingDealsTab.tsx` (`ClientMarketingTab`)\n * - `nukleus-clientapp`'s `pages/Marketing.tsx` + `hooks/useMarketing.ts`\n *\n * Both pages share one identical skeleton: a \"Current Deals\"/\"Completed\" tab\n * pair, a \"Deals\" label bar, a `ProjectDealCard` list per tab (`Completed`\n * also appends `ManualDealCard`s), matching empty states, and a shared\n * `ManualDealPreviewDialog`. That skeleton is this component's entire scope.\n *\n * ## Deliberately NOT in this shell (stays app-local, per CLAUDE.md's\n * page-shells rule and the decisions already made for this feature)\n * - The page header/title and the \"Record Past Deal\"/\"New Marketing Deal\"\n * buttons — `nukleus-app`-only chrome with no clientapp equivalent.\n * - `MarketingDealForm` (the CRUD create/edit form) and `DeleteDialog` —\n * `nukleus-app`-only, no clientapp read-only counterpart to reconcile\n * against, same reasoning as `MarketingOverviewPanel`/`Card` (also kept\n * app-local, rendered alongside this shell, not inside it).\n * - The top-level access gate (`nukleus-app`'s `marketingPermission ===\n * \"No Access\"` → `RestrictedAccessCard`; `clientapp`'s `!isAgencyLinked` →\n * `AgencyLinkBanner`). Both are a one-time \"should the deals experience\n * render at all\" decision made from each app's own permission shape\n * (`@nukleus-sports/core`'s `MarketingPermission` union) *before* this\n * shell ever mounts — not something this component re-derives.\n * - Project-membership resolution for the \"Collab\" link gate (`@nukleus-sports/\n * ui-patterns`' `ProjectDealCard` already enforces this structurally via its\n * required `collabMembership` prop) — the actual membership check is an\n * app-level query, surfaced here through `getCollabMembership`.\n *\n * ## Genuine differences reconciled (not formatting)\n * - Client-status gating (`nukleus-app`'s `isGated`, e.g. a \"Prospect\" client\n * can't have deals yet): `clientapp` has no such concept. Modeled as an\n * optional `gatedEmptyState` — when supplied, it replaces the Current tab's\n * content and the Completed tab is disabled, exactly matching `nukleus-app`'s\n * structure; omit it and both tabs behave normally (`clientapp`'s case).\n * - Loading skeleton: `clientapp` shows one before the tabs ever render;\n * `nukleus-app` has none (deals just populate once the query resolves).\n * Kept as an additive, opt-in `isLoading` prop — a loading affordance isn't\n * an agency-vs-client distinction, so both can use it.\n * - \"Deals\" label bar visibility on mobile: `nukleus-app` hides it below `sm`\n * (`hidden sm:flex`), `clientapp` always shows it. Kept `nukleus-app`'s\n * responsive hiding — the mobile layout is already a compact card stack\n * without a tabular header, so the label reads as redundant there.\n * - Completed-tab empty message: `nukleus-app`'s wording depends on whether\n * there are current-tab project deals (\"No past deals recorded yet.\" vs.\n * the fuller \"no deals at all\" message); `clientapp`'s is a single fixed\n * string. `completedEmptyMessage` accepts either a plain string or a\n * `(hasCurrentProjectDeals: boolean) => string` so both shapes work without\n * baking either app's copy into this package.\n */\n\n/**\n * The app-supplied bridge to its own data/backend — per\n * `docs/APPLICATION_ARCHITECTURE.md`'s Layer 5 adapter pattern, this shell\n * takes a single typed `adapter` prop rather than flat individual props, so\n * each app's own `use<Page>()` hook has one output shape to satisfy and\n * drifting apart becomes a compile error, not a silent runtime mismatch.\n */\nexport interface MarketingDealsAdapter {\n /** Shows a loading skeleton in place of the tabs. Additive — see module doc. */\n isLoading?: boolean;\n /** Shows an inline error message in place of the deal lists. */\n error?: boolean;\n errorMessage?: string;\n /** Shows a \"Retry\" button in the error state when supplied. Both apps'\n * real pages combine retrying whichever underlying query actually failed\n * behind one button — this stays a single callback for the same reason. */\n onRetry?: () => void;\n\n activeTab: \"current\" | \"completed\";\n onTabChange: (tab: \"current\" | \"completed\") => void;\n\n currentProjectDeals: ProjectDeal[];\n completedProjectDeals: ProjectDeal[];\n manualDeals: ManualDeal[];\n\n currentEmptyMessage: string;\n completedEmptyMessage: string | ((hasCurrentProjectDeals: boolean) => string);\n\n /**\n * Replaces the Current tab's content and disables the Completed tab —\n * `nukleus-app`'s client-status gating. Omit for `clientapp`'s ungated\n * behavior.\n */\n gatedEmptyState?: ReactNode;\n\n /** Required — `ProjectDealCard` structurally can't omit this. See module doc. */\n getCollabMembership: (projectId: string) => ProjectCollabMembership;\n getCollabHref: (projectId: string) => string;\n /** `nukleus-app`'s demo-mode upsell toast swaps the link for a button. */\n getOnCollabClick?: (\n projectId: string,\n ) => ((e: MouseEvent<HTMLButtonElement>) => void) | undefined;\n\n /** Presence of each enables that affordance on `ManualDealCard`/the preview\n * dialog — same shape `ManualDealCard`/`ManualDealPreviewDialog` already\n * take, so this just passes through. */\n onEditDeal?: (deal: ManualDeal) => void;\n onDeleteDeal?: (deal: ManualDeal) => void;\n onOpenDocument: (doc: ManualDealDocumentRef) => void;\n\n resolveImageUrl?: EntityImageResolver;\n}\n\nexport interface MarketingDealsPanelProps {\n adapter: MarketingDealsAdapter;\n /** Pure styling override — not part of the adapter, since it's never\n * backend/data-shaped. */\n className?: string;\n}\n\nexport function MarketingDealsPanel({ adapter, className }: MarketingDealsPanelProps) {\n const {\n isLoading,\n error,\n errorMessage = \"Could not load marketing deals. Please try again.\",\n onRetry,\n activeTab,\n onTabChange,\n currentProjectDeals,\n completedProjectDeals,\n manualDeals,\n currentEmptyMessage,\n completedEmptyMessage,\n gatedEmptyState,\n getCollabMembership,\n getCollabHref,\n getOnCollabClick,\n onEditDeal,\n onDeleteDeal,\n onOpenDocument,\n resolveImageUrl,\n } = adapter;\n\n const [previewDeal, setPreviewDeal] = useState<ManualDeal | null>(null);\n\n const resolvedCompletedEmptyMessage =\n typeof completedEmptyMessage === \"function\"\n ? completedEmptyMessage(currentProjectDeals.length > 0)\n : completedEmptyMessage;\n const hasCompletedContent = completedProjectDeals.length > 0 || manualDeals.length > 0;\n\n if (isLoading) {\n return (\n <div className={cn(\"flex flex-col gap-3\", className)}>\n <Skeleton className=\"h-9 w-full rounded-[10px]\" />\n <Skeleton className=\"h-[300px] w-full rounded-[10px]\" />\n </div>\n );\n }\n\n return (\n <div className={className}>\n <Tabs\n value={activeTab}\n onValueChange={(value) => onTabChange(value as \"current\" | \"completed\")}\n className=\"w-full flex flex-col gap-3\"\n >\n <TabsList className=\"grid w-full grid-cols-2 bg-transparent border-b border-greys-grey-strokes-tables rounded-none h-auto p-0\">\n <TabsTrigger\n value=\"current\"\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none\"\n >\n Current Deals\n </TabsTrigger>\n <TabsTrigger\n value=\"completed\"\n disabled={!!gatedEmptyState}\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n Completed\n </TabsTrigger>\n </TabsList>\n\n {error ? (\n <div className=\"flex flex-col items-center justify-center gap-3 py-10 px-6\" role=\"alert\">\n <p className=\"body-text text-text-primary text-center\">{errorMessage}</p>\n {onRetry && (\n <Button variant=\"secondary\" size=\"form\" onClick={onRetry}>\n Retry\n </Button>\n )}\n </div>\n ) : (\n <>\n <div className=\"hidden sm:flex items-center bg-greys-grey-table-h rounded-t-[10px] py-0 px-3 gap-3 h-[33px]\">\n <span className=\"label-xs-table text-text-primary font-ss02\">Deals</span>\n </div>\n\n <TabsContent value=\"current\" className=\"mt-0\">\n {gatedEmptyState ? (\n gatedEmptyState\n ) : currentProjectDeals.length > 0 ? (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {currentProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={false}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n </div>\n ) : (\n <DealEmptyState message={currentEmptyMessage} />\n )}\n </TabsContent>\n\n <TabsContent value=\"completed\" className=\"mt-0\">\n {!hasCompletedContent ? (\n <DealEmptyState message={resolvedCompletedEmptyMessage} />\n ) : (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {completedProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={true}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n {manualDeals.map((deal) => (\n <ManualDealCard\n key={deal.id}\n deal={deal}\n onPreview={setPreviewDeal}\n onEdit={onEditDeal}\n onDelete={onDeleteDeal}\n onOpenDocument={onOpenDocument}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n </div>\n )}\n </TabsContent>\n </>\n )}\n </Tabs>\n\n <ManualDealPreviewDialog\n deal={previewDeal}\n open={!!previewDeal}\n onOpenChange={(open) => {\n if (!open) setPreviewDeal(null);\n }}\n onEdit={\n onEditDeal\n ? (deal) => {\n // Close the preview before handing off to the edit flow,\n // matching nukleus-app's original behavior.\n setPreviewDeal(null);\n onEditDeal(deal);\n }\n : undefined\n }\n onOpenDocument={onOpenDocument}\n resolveImageUrl={resolveImageUrl}\n />\n </div>\n );\n}\n"],"mappings":";AAAA,SAAS,gBAAiD;AAE1D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AAkJD,SAwCI,UAvCF,KADF;AAjCC,SAAS,oBAAoB,EAAE,SAAS,UAAU,GAA6B;AACpF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,CAAC,aAAa,cAAc,IAAI,SAA4B,IAAI;AAEtE,QAAM,gCACJ,OAAO,0BAA0B,aAC7B,sBAAsB,oBAAoB,SAAS,CAAC,IACpD;AACN,QAAM,sBAAsB,sBAAsB,SAAS,KAAK,YA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Ae,SAAS,qBAAqB,GAElD;AAAA,YAEA,oBAAC,eAAY,OAAM,aAAY,WAAU,QACtC,WAAC,sBACA,oBAAC,kBAAe,SAAS,+BAA+B,IAExD,qBAAC,SAAI,WAAU,gCACZ;AAAA,oCAAsB,IAAI,CAAC,SAC1B;AAAA,gBAAC;AAAA;AAAA,kBAEC;AAAA,kBACA,aAAa;AAAA,kBACb,kBAAkB,oBAAoB,KAAK,UAAU;AAAA,kBACrD,YAAY,cAAc,KAAK,UAAU;AAAA,kBACzC,eAAe,mBAAmB,KAAK,UAAU;AAAA,kBACjD;AAAA;AAAA,gBANK,KAAK;AAAA,cAOZ,CACD;AAAA,cACA,YAAY,IAAI,CAAC,SAChB;AAAA,gBAAC;AAAA;AAAA,kBAEC;AAAA,kBACA,WAAW;AAAA,kBACX,QAAQ;AAAA,kBACR,UAAU;AAAA,kBACV;AAAA,kBACA;AAAA;AAAA,gBANK,KAAK;AAAA,cAOZ,CACD;AAAA,eACH,GAEJ;AAAA,aACF;AAAA;AAAA;AAAA,IAEJ;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,MAAM,CAAC,CAAC;AAAA,QACR,cAAc,CAAC,SAAS;AACtB,cAAI,CAAC,KAAM,gBAAe,IAAI;AAAA,QAChC;AAAA,QACA,QACE,aACI,CAAC,SAAS;AAGR,yBAAe,IAAI;AACnB,qBAAW,IAAI;AAAA,QACjB,IACA;AAAA,QAEN;AAAA,QACA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/marketing/marketing-deals-panel.tsx"],"sourcesContent":["import { useState, type MouseEvent, type ReactNode } from \"react\";\n\nimport {\n Button,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n Skeleton,\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n cn,\n} from \"@nukleus-sports/ui-web\";\nimport {\n DealEmptyState,\n ManualDealCard,\n ManualDealPreviewDialog,\n ProjectDealCard,\n type EntityImageResolver,\n type ManualDeal,\n type ManualDealDocumentRef,\n type ProjectCollabMembership,\n type ProjectDeal,\n} from \"@nukleus-sports/ui-patterns/marketing\";\n\n/**\n * Reconciled from both apps' real current pages:\n * - `nukleus-app`'s `MarketingDealsTab.tsx` (`ClientMarketingTab`)\n * - `nukleus-clientapp`'s `pages/Marketing.tsx` + `hooks/useMarketing.ts`\n *\n * Both pages share one identical skeleton: a \"Current Deals\"/\"Completed\" tab\n * pair, a \"Deals\" label bar, a `ProjectDealCard` list per tab (`Completed`\n * also appends `ManualDealCard`s), matching empty states, and a shared\n * `ManualDealPreviewDialog`. That skeleton is this component's entire scope.\n *\n * ## Deliberately NOT in this shell (stays app-local, per CLAUDE.md's\n * page-shells rule and the decisions already made for this feature)\n * - The page header/title and the \"Record Past Deal\"/\"New Marketing Deal\"\n * buttons — `nukleus-app`-only chrome with no clientapp equivalent.\n * - `MarketingDealForm` (the CRUD create/edit form) and `DeleteDialog` —\n * `nukleus-app`-only, no clientapp read-only counterpart to reconcile\n * against, same reasoning as `MarketingOverviewPanel`/`Card` (also kept\n * app-local, rendered alongside this shell, not inside it).\n * - The top-level access gate (`nukleus-app`'s `marketingPermission ===\n * \"No Access\"` → `RestrictedAccessCard`; `clientapp`'s `!isAgencyLinked` →\n * `AgencyLinkBanner`). Both are a one-time \"should the deals experience\n * render at all\" decision made from each app's own permission shape\n * (`@nukleus-sports/core`'s `MarketingPermission` union) *before* this\n * shell ever mounts — not something this component re-derives.\n * - Project-membership resolution for the \"Collab\" link gate (`@nukleus-sports/\n * ui-patterns`' `ProjectDealCard` already enforces this structurally via its\n * required `collabMembership` prop) — the actual membership check is an\n * app-level query, surfaced here through `getCollabMembership`.\n *\n * ## Genuine differences reconciled (not formatting)\n * - Client-status gating (`nukleus-app`'s `isGated`, e.g. a \"Prospect\" client\n * can't have deals yet): `clientapp` has no such concept. Modeled as an\n * optional `gatedEmptyState` — when supplied, it replaces the Current tab's\n * content and the Completed tab is disabled, exactly matching `nukleus-app`'s\n * structure; omit it and both tabs behave normally (`clientapp`'s case).\n * - Loading skeleton: `clientapp` shows one before the tabs ever render;\n * `nukleus-app` has none (deals just populate once the query resolves).\n * Kept as an additive, opt-in `isLoading` prop — a loading affordance isn't\n * an agency-vs-client distinction, so both can use it.\n * - \"Deals\" label bar visibility on mobile: `nukleus-app` hides it below `sm`\n * (`hidden sm:flex`), `clientapp` always shows it. Kept `nukleus-app`'s\n * responsive hiding — the mobile layout is already a compact card stack\n * without a tabular header, so the label reads as redundant there.\n * - Completed-tab empty message: `nukleus-app`'s wording depends on whether\n * there are current-tab project deals (\"No past deals recorded yet.\" vs.\n * the fuller \"no deals at all\" message); `clientapp`'s is a single fixed\n * string. `completedEmptyMessage` accepts either a plain string or a\n * `(hasCurrentProjectDeals: boolean) => string` so both shapes work without\n * baking either app's copy into this package.\n * - Completed-tab year filter: `clientapp` lets a client filter years of\n * deal history via a dropdown; `nukleus-app` has no equivalent at all.\n * Modeled as an optional `completedYearFilter` — when supplied, this\n * package renders the dropdown (and nothing else; which deals actually\n * appear is still just `completedProjectDeals`/`manualDeals`, already\n * filtered by the adapter before this object is built). `nukleus-app`\n * simply omits it, same pattern as `gatedEmptyState`.\n */\n\n/**\n * The app-supplied bridge to its own data/backend — per\n * `docs/APPLICATION_ARCHITECTURE.md`'s Layer 5 adapter pattern, this shell\n * takes a single typed `adapter` prop rather than flat individual props, so\n * each app's own `use<Page>()` hook has one output shape to satisfy and\n * drifting apart becomes a compile error, not a silent runtime mismatch.\n */\nexport interface MarketingDealsAdapter {\n /** Shows a loading skeleton in place of the tabs. Additive — see module doc. */\n isLoading?: boolean;\n /** Shows an inline error message in place of the deal lists. */\n error?: boolean;\n errorMessage?: string;\n /** Shows a \"Retry\" button in the error state when supplied. Both apps'\n * real pages combine retrying whichever underlying query actually failed\n * behind one button — this stays a single callback for the same reason. */\n onRetry?: () => void;\n\n activeTab: \"current\" | \"completed\";\n onTabChange: (tab: \"current\" | \"completed\") => void;\n\n currentProjectDeals: ProjectDeal[];\n completedProjectDeals: ProjectDeal[];\n manualDeals: ManualDeal[];\n\n currentEmptyMessage: string;\n completedEmptyMessage: string | ((hasCurrentProjectDeals: boolean) => string);\n\n /**\n * Replaces the Current tab's content and disables the Completed tab —\n * `nukleus-app`'s client-status gating. Omit for `clientapp`'s ungated\n * behavior.\n */\n gatedEmptyState?: ReactNode;\n\n /**\n * Year filter for the Completed tab's deal history (`clientapp`-only\n * today — `nukleus-app` has no equivalent, so it simply never supplies\n * this). This package renders only the dropdown; filtering which deals\n * actually appear in `completedProjectDeals`/`manualDeals` is the\n * adapter's own job, done before this object is built (same as\n * `clientapp`'s own hook already filtering before this retrofit).\n * `options` already includes any \"All\" entry the caller wants — this\n * package has no opinion on that sentinel value or its label.\n */\n completedYearFilter?: {\n options: { value: string; label: string }[];\n value: string;\n onChange: (value: string) => void;\n };\n\n /** Required — `ProjectDealCard` structurally can't omit this. See module doc. */\n getCollabMembership: (projectId: string) => ProjectCollabMembership;\n getCollabHref: (projectId: string) => string;\n /** `nukleus-app`'s demo-mode upsell toast swaps the link for a button. */\n getOnCollabClick?: (\n projectId: string,\n ) => ((e: MouseEvent<HTMLButtonElement>) => void) | undefined;\n\n /** Presence of each enables that affordance on `ManualDealCard`/the preview\n * dialog — same shape `ManualDealCard`/`ManualDealPreviewDialog` already\n * take, so this just passes through. */\n onEditDeal?: (deal: ManualDeal) => void;\n onDeleteDeal?: (deal: ManualDeal) => void;\n onOpenDocument: (doc: ManualDealDocumentRef) => void;\n\n /** Photo of the client whose page this panel is rendered on, shown beside\n * \"Client Name\" in the manual deal preview dialog. Omit to show just the\n * name (no avatar). */\n clientImageUrl?: string | null;\n resolveImageUrl?: EntityImageResolver;\n}\n\nexport interface MarketingDealsPanelProps {\n adapter: MarketingDealsAdapter;\n /** Pure styling override — not part of the adapter, since it's never\n * backend/data-shaped. */\n className?: string;\n}\n\nexport function MarketingDealsPanel({ adapter, className }: MarketingDealsPanelProps) {\n const {\n isLoading,\n error,\n errorMessage = \"Could not load marketing deals. Please try again.\",\n onRetry,\n activeTab,\n onTabChange,\n currentProjectDeals,\n completedProjectDeals,\n manualDeals,\n currentEmptyMessage,\n completedEmptyMessage,\n gatedEmptyState,\n completedYearFilter,\n getCollabMembership,\n getCollabHref,\n getOnCollabClick,\n onEditDeal,\n onDeleteDeal,\n onOpenDocument,\n clientImageUrl,\n resolveImageUrl,\n } = adapter;\n\n const [previewDeal, setPreviewDeal] = useState<ManualDeal | null>(null);\n\n const resolvedCompletedEmptyMessage =\n typeof completedEmptyMessage === \"function\"\n ? completedEmptyMessage(currentProjectDeals.length > 0)\n : completedEmptyMessage;\n const hasCompletedContent = completedProjectDeals.length > 0 || manualDeals.length > 0;\n\n if (isLoading) {\n return (\n <div className={cn(\"flex flex-col gap-3\", className)}>\n <Skeleton className=\"h-9 w-full rounded-[10px]\" />\n <Skeleton className=\"h-[300px] w-full rounded-[10px]\" />\n </div>\n );\n }\n\n return (\n <div className={className}>\n <Tabs\n value={activeTab}\n onValueChange={(value) => onTabChange(value as \"current\" | \"completed\")}\n className=\"w-full flex flex-col gap-3\"\n >\n <TabsList className=\"grid w-full grid-cols-2 bg-transparent border-b border-greys-grey-strokes-tables rounded-none h-auto p-0\">\n <TabsTrigger\n value=\"current\"\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none\"\n >\n Current Deals\n </TabsTrigger>\n <TabsTrigger\n value=\"completed\"\n disabled={!!gatedEmptyState}\n className=\"py-2.5 px-2 rounded-none border-b-2 border-transparent text-text-primary data-[state=active]:text-primary-color-nuk-text data-[state=active]:border-primary-color-nuk-text data-[state=active]:bg-transparent data-[state=active]:shadow-none disabled:opacity-50 disabled:cursor-not-allowed\"\n >\n Completed\n </TabsTrigger>\n </TabsList>\n\n {error ? (\n <div className=\"flex flex-col items-center justify-center gap-3 py-10 px-6\" role=\"alert\">\n <p className=\"body-text text-text-primary text-center\">{errorMessage}</p>\n {onRetry && (\n <Button variant=\"secondary\" size=\"form\" onClick={onRetry}>\n Retry\n </Button>\n )}\n </div>\n ) : (\n <>\n {activeTab === \"completed\" && completedYearFilter && (\n <Select\n value={completedYearFilter.value}\n onValueChange={completedYearFilter.onChange}\n >\n <SelectTrigger className=\"w-[140px]\" aria-label=\"Filter completed deals by year\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {completedYearFilter.options.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n )}\n\n <div className=\"hidden sm:flex items-center bg-greys-grey-table-h rounded-t-[10px] py-0 px-3 gap-3 h-[33px]\">\n <span className=\"label-xs-table text-text-primary font-ss02\">Deals</span>\n </div>\n\n <TabsContent value=\"current\" className=\"mt-0\">\n {gatedEmptyState ? (\n gatedEmptyState\n ) : currentProjectDeals.length > 0 ? (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {currentProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={false}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n </div>\n ) : (\n <DealEmptyState message={currentEmptyMessage} />\n )}\n </TabsContent>\n\n <TabsContent value=\"completed\" className=\"mt-0\">\n {!hasCompletedContent ? (\n <DealEmptyState message={resolvedCompletedEmptyMessage} />\n ) : (\n <div className=\"flex flex-col gap-3 sm:gap-0\">\n {completedProjectDeals.map((deal) => (\n <ProjectDealCard\n key={deal.project_id}\n deal={deal}\n isCompleted={true}\n collabMembership={getCollabMembership(deal.project_id)}\n collabHref={getCollabHref(deal.project_id)}\n onCollabClick={getOnCollabClick?.(deal.project_id)}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n {manualDeals.map((deal) => (\n <ManualDealCard\n key={deal.id}\n deal={deal}\n onPreview={setPreviewDeal}\n onEdit={onEditDeal}\n onDelete={onDeleteDeal}\n onOpenDocument={onOpenDocument}\n resolveImageUrl={resolveImageUrl}\n />\n ))}\n </div>\n )}\n </TabsContent>\n </>\n )}\n </Tabs>\n\n <ManualDealPreviewDialog\n deal={previewDeal}\n open={!!previewDeal}\n onOpenChange={(open) => {\n if (!open) setPreviewDeal(null);\n }}\n onEdit={\n onEditDeal\n ? (deal) => {\n // Close the preview before handing off to the edit flow,\n // matching nukleus-app's original behavior.\n setPreviewDeal(null);\n onEditDeal(deal);\n }\n : undefined\n }\n onOpenDocument={onOpenDocument}\n clientImageUrl={clientImageUrl}\n resolveImageUrl={resolveImageUrl}\n />\n </div>\n );\n}\n"],"mappings":";AAAA,SAAS,gBAAiD;AAE1D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAMK;AA+KD,SAwCI,UAvCF,KADF;AAnCC,SAAS,oBAAoB,EAAE,SAAS,UAAU,GAA6B;AACpF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,CAAC,aAAa,cAAc,IAAI,SAA4B,IAAI;AAEtE,QAAM,gCACJ,OAAO,0BAA0B,aAC7B,sBAAsB,oBAAoB,SAAS,CAAC,IACpD;AACN,QAAM,sBAAsB,sBAAsB,SAAS,KAA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AA,QAEN;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nukleus-sports/page-shells",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"react-dom": "^18 || ^19"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@nukleus-sports/ui-patterns": "^0.
|
|
43
|
+
"@nukleus-sports/ui-patterns": "^0.2.0",
|
|
44
44
|
"@nukleus-sports/ui-web": "^0.1.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|