@nukleus-sports/page-shells 0.0.0-stage → 0.1.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.
package/dist/index.cjs ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/index.ts
17
+ var src_exports = {};
18
+ module.exports = __toCommonJS(src_exports);
19
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,155 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/marketing/index.ts
21
+ var marketing_exports = {};
22
+ __export(marketing_exports, {
23
+ MarketingDealsPanel: () => MarketingDealsPanel
24
+ });
25
+ module.exports = __toCommonJS(marketing_exports);
26
+
27
+ // src/marketing/marketing-deals-panel.tsx
28
+ var import_react = require("react");
29
+ var import_ui_web = require("@nukleus-sports/ui-web");
30
+ var import_marketing = require("@nukleus-sports/ui-patterns/marketing");
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ function MarketingDealsPanel({ adapter, className }) {
33
+ const {
34
+ isLoading,
35
+ error,
36
+ errorMessage = "Could not load marketing deals. Please try again.",
37
+ activeTab,
38
+ onTabChange,
39
+ currentProjectDeals,
40
+ completedProjectDeals,
41
+ manualDeals,
42
+ currentEmptyMessage,
43
+ completedEmptyMessage,
44
+ gatedEmptyState,
45
+ getCollabMembership,
46
+ getCollabHref,
47
+ getOnCollabClick,
48
+ onEditDeal,
49
+ onDeleteDeal,
50
+ onOpenDocument,
51
+ resolveImageUrl
52
+ } = adapter;
53
+ const [previewDeal, setPreviewDeal] = (0, import_react.useState)(null);
54
+ const resolvedCompletedEmptyMessage = typeof completedEmptyMessage === "function" ? completedEmptyMessage(currentProjectDeals.length > 0) : completedEmptyMessage;
55
+ const hasCompletedContent = completedProjectDeals.length > 0 || manualDeals.length > 0;
56
+ if (isLoading) {
57
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_ui_web.cn)("flex flex-col gap-3", className), children: [
58
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui_web.Skeleton, { className: "h-9 w-full rounded-[10px]" }),
59
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui_web.Skeleton, { className: "h-[300px] w-full rounded-[10px]" })
60
+ ] });
61
+ }
62
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className, children: [
63
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
64
+ import_ui_web.Tabs,
65
+ {
66
+ value: activeTab,
67
+ onValueChange: (value) => onTabChange(value),
68
+ className: "w-full flex flex-col gap-3",
69
+ children: [
70
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui_web.TabsList, { className: "grid w-full grid-cols-2 bg-transparent border-b border-greys-grey-strokes-tables rounded-none h-auto p-0", children: [
71
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
72
+ import_ui_web.TabsTrigger,
73
+ {
74
+ value: "current",
75
+ 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",
76
+ children: "Current Deals"
77
+ }
78
+ ),
79
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
80
+ import_ui_web.TabsTrigger,
81
+ {
82
+ value: "completed",
83
+ disabled: !!gatedEmptyState,
84
+ 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",
85
+ children: "Completed"
86
+ }
87
+ )
88
+ ] }),
89
+ error ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "body-text text-destructive py-6 text-center", children: errorMessage }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
90
+ /* @__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" }) }),
91
+ /* @__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)(
92
+ import_marketing.ProjectDealCard,
93
+ {
94
+ deal,
95
+ isCompleted: false,
96
+ collabMembership: getCollabMembership(deal.project_id),
97
+ collabHref: getCollabHref(deal.project_id),
98
+ onCollabClick: getOnCollabClick?.(deal.project_id),
99
+ resolveImageUrl
100
+ },
101
+ deal.project_id
102
+ )) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_marketing.DealEmptyState, { message: currentEmptyMessage }) }),
103
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui_web.TabsContent, { value: "completed", className: "mt-0", children: !hasCompletedContent ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_marketing.DealEmptyState, { message: resolvedCompletedEmptyMessage }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-3 sm:gap-0", children: [
104
+ completedProjectDeals.map((deal) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
105
+ import_marketing.ProjectDealCard,
106
+ {
107
+ deal,
108
+ isCompleted: true,
109
+ collabMembership: getCollabMembership(deal.project_id),
110
+ collabHref: getCollabHref(deal.project_id),
111
+ onCollabClick: getOnCollabClick?.(deal.project_id),
112
+ resolveImageUrl
113
+ },
114
+ deal.project_id
115
+ )),
116
+ manualDeals.map((deal) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
117
+ import_marketing.ManualDealCard,
118
+ {
119
+ deal,
120
+ onPreview: setPreviewDeal,
121
+ onEdit: onEditDeal,
122
+ onDelete: onDeleteDeal,
123
+ onOpenDocument,
124
+ resolveImageUrl
125
+ },
126
+ deal.id
127
+ ))
128
+ ] }) })
129
+ ] })
130
+ ]
131
+ }
132
+ ),
133
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
134
+ import_marketing.ManualDealPreviewDialog,
135
+ {
136
+ deal: previewDeal,
137
+ open: !!previewDeal,
138
+ onOpenChange: (open) => {
139
+ if (!open) setPreviewDeal(null);
140
+ },
141
+ onEdit: onEditDeal ? (deal) => {
142
+ setPreviewDeal(null);
143
+ onEditDeal(deal);
144
+ } : void 0,
145
+ onOpenDocument,
146
+ resolveImageUrl
147
+ }
148
+ )
149
+ ] });
150
+ }
151
+ // Annotate the CommonJS export names for ESM import in node:
152
+ 0 && (module.exports = {
153
+ MarketingDealsPanel
154
+ });
155
+ //# sourceMappingURL=marketing.cjs.map
@@ -0,0 +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 { Skeleton, Tabs, TabsContent, TabsList, TabsTrigger, cn } 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\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 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 <p className=\"body-text text-destructive py-6 text-center\">{errorMessage}</p>\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,oBAAuE;AACvE,uBAUO;AA6ID;AAhCC,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,EACF,IAAI;AAEJ,QAAM,CAAC,aAAa,cAAc,QAAI,uBAA4B,IAAI;AAEtE,QAAM,gCACJ,OAAO,0BAA0B,aAC7B,sBAAsB,oBAAoB,SAAS,CAAC,IACpD;AACN,QAAM,sBAAsB,sBAAsB,SAAS,KAAK,YAAY,SAAS;AAErF,MAAI,WAAW;AACb,WACE,6CAAC,SAAI,eAAW,kBAAG,uBAAuB,SAAS,GACjD;AAAA,kDAAC,0BAAS,WAAU,6BAA4B;AAAA,MAChD,4CAAC,0BAAS,WAAU,mCAAkC;AAAA,OACxD;AAAA,EAEJ;AAEA,SACE,6CAAC,SAAI,WACH;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,QACP,eAAe,CAAC,UAAU,YAAY,KAAgC;AAAA,QACtE,WAAU;AAAA,QAEV;AAAA,uDAAC,0BAAS,WAAU,4GAClB;AAAA;AAAA,cAAC;AAAA;AAAA,gBACC,OAAM;AAAA,gBACN,WAAU;AAAA,gBACX;AAAA;AAAA,YAED;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,OAAM;AAAA,gBACN,UAAU,CAAC,CAAC;AAAA,gBACZ,WAAU;AAAA,gBACX;AAAA;AAAA,YAED;AAAA,aACF;AAAA,UAEC,QACC,4CAAC,OAAE,WAAU,+CAA+C,wBAAa,IAEzE,4EACE;AAAA,wDAAC,SAAI,WAAU,+FACb,sDAAC,UAAK,WAAU,8CAA6C,mBAAK,GACpE;AAAA,YAEA,4CAAC,6BAAY,OAAM,WAAU,WAAU,QACpC,4BACC,kBACE,oBAAoB,SAAS,IAC/B,4CAAC,SAAI,WAAU,gCACZ,8BAAoB,IAAI,CAAC,SACxB;AAAA,cAAC;AAAA;AAAA,gBAEC;AAAA,gBACA,aAAa;AAAA,gBACb,kBAAkB,oBAAoB,KAAK,UAAU;AAAA,gBACrD,YAAY,cAAc,KAAK,UAAU;AAAA,gBACzC,eAAe,mBAAmB,KAAK,UAAU;AAAA,gBACjD;AAAA;AAAA,cANK,KAAK;AAAA,YAOZ,CACD,GACH,IAEA,4CAAC,mCAAe,SAAS,qBAAqB,GAElD;AAAA,YAEA,4CAAC,6BAAY,OAAM,aAAY,WAAU,QACtC,WAAC,sBACA,4CAAC,mCAAe,SAAS,+BAA+B,IAExD,6CAAC,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":[]}
@@ -0,0 +1,102 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, MouseEvent } from 'react';
3
+ import { ProjectDeal, ManualDeal, ProjectCollabMembership, ManualDealDocumentRef, EntityImageResolver } from '@nukleus-sports/ui-patterns/marketing';
4
+
5
+ /**
6
+ * Reconciled from both apps' real current pages:
7
+ * - `nukleus-app`'s `MarketingDealsTab.tsx` (`ClientMarketingTab`)
8
+ * - `nukleus-clientapp`'s `pages/Marketing.tsx` + `hooks/useMarketing.ts`
9
+ *
10
+ * Both pages share one identical skeleton: a "Current Deals"/"Completed" tab
11
+ * pair, a "Deals" label bar, a `ProjectDealCard` list per tab (`Completed`
12
+ * also appends `ManualDealCard`s), matching empty states, and a shared
13
+ * `ManualDealPreviewDialog`. That skeleton is this component's entire scope.
14
+ *
15
+ * ## Deliberately NOT in this shell (stays app-local, per CLAUDE.md's
16
+ * page-shells rule and the decisions already made for this feature)
17
+ * - The page header/title and the "Record Past Deal"/"New Marketing Deal"
18
+ * buttons — `nukleus-app`-only chrome with no clientapp equivalent.
19
+ * - `MarketingDealForm` (the CRUD create/edit form) and `DeleteDialog` —
20
+ * `nukleus-app`-only, no clientapp read-only counterpart to reconcile
21
+ * against, same reasoning as `MarketingOverviewPanel`/`Card` (also kept
22
+ * app-local, rendered alongside this shell, not inside it).
23
+ * - The top-level access gate (`nukleus-app`'s `marketingPermission ===
24
+ * "No Access"` → `RestrictedAccessCard`; `clientapp`'s `!isAgencyLinked` →
25
+ * `AgencyLinkBanner`). Both are a one-time "should the deals experience
26
+ * render at all" decision made from each app's own permission shape
27
+ * (`@nukleus-sports/core`'s `MarketingPermission` union) *before* this
28
+ * shell ever mounts — not something this component re-derives.
29
+ * - Project-membership resolution for the "Collab" link gate (`@nukleus-sports/
30
+ * ui-patterns`' `ProjectDealCard` already enforces this structurally via its
31
+ * required `collabMembership` prop) — the actual membership check is an
32
+ * app-level query, surfaced here through `getCollabMembership`.
33
+ *
34
+ * ## Genuine differences reconciled (not formatting)
35
+ * - Client-status gating (`nukleus-app`'s `isGated`, e.g. a "Prospect" client
36
+ * can't have deals yet): `clientapp` has no such concept. Modeled as an
37
+ * optional `gatedEmptyState` — when supplied, it replaces the Current tab's
38
+ * content and the Completed tab is disabled, exactly matching `nukleus-app`'s
39
+ * structure; omit it and both tabs behave normally (`clientapp`'s case).
40
+ * - Loading skeleton: `clientapp` shows one before the tabs ever render;
41
+ * `nukleus-app` has none (deals just populate once the query resolves).
42
+ * Kept as an additive, opt-in `isLoading` prop — a loading affordance isn't
43
+ * an agency-vs-client distinction, so both can use it.
44
+ * - "Deals" label bar visibility on mobile: `nukleus-app` hides it below `sm`
45
+ * (`hidden sm:flex`), `clientapp` always shows it. Kept `nukleus-app`'s
46
+ * responsive hiding — the mobile layout is already a compact card stack
47
+ * without a tabular header, so the label reads as redundant there.
48
+ * - Completed-tab empty message: `nukleus-app`'s wording depends on whether
49
+ * there are current-tab project deals ("No past deals recorded yet." vs.
50
+ * the fuller "no deals at all" message); `clientapp`'s is a single fixed
51
+ * string. `completedEmptyMessage` accepts either a plain string or a
52
+ * `(hasCurrentProjectDeals: boolean) => string` so both shapes work without
53
+ * baking either app's copy into this package.
54
+ */
55
+ /**
56
+ * The app-supplied bridge to its own data/backend — per
57
+ * `docs/APPLICATION_ARCHITECTURE.md`'s Layer 5 adapter pattern, this shell
58
+ * takes a single typed `adapter` prop rather than flat individual props, so
59
+ * each app's own `use<Page>()` hook has one output shape to satisfy and
60
+ * drifting apart becomes a compile error, not a silent runtime mismatch.
61
+ */
62
+ interface MarketingDealsAdapter {
63
+ /** Shows a loading skeleton in place of the tabs. Additive — see module doc. */
64
+ isLoading?: boolean;
65
+ /** Shows an inline error message in place of the deal lists. */
66
+ error?: boolean;
67
+ errorMessage?: string;
68
+ activeTab: "current" | "completed";
69
+ onTabChange: (tab: "current" | "completed") => void;
70
+ currentProjectDeals: ProjectDeal[];
71
+ completedProjectDeals: ProjectDeal[];
72
+ manualDeals: ManualDeal[];
73
+ currentEmptyMessage: string;
74
+ completedEmptyMessage: string | ((hasCurrentProjectDeals: boolean) => string);
75
+ /**
76
+ * Replaces the Current tab's content and disables the Completed tab —
77
+ * `nukleus-app`'s client-status gating. Omit for `clientapp`'s ungated
78
+ * behavior.
79
+ */
80
+ gatedEmptyState?: ReactNode;
81
+ /** Required — `ProjectDealCard` structurally can't omit this. See module doc. */
82
+ getCollabMembership: (projectId: string) => ProjectCollabMembership;
83
+ getCollabHref: (projectId: string) => string;
84
+ /** `nukleus-app`'s demo-mode upsell toast swaps the link for a button. */
85
+ getOnCollabClick?: (projectId: string) => ((e: MouseEvent<HTMLButtonElement>) => void) | undefined;
86
+ /** Presence of each enables that affordance on `ManualDealCard`/the preview
87
+ * dialog — same shape `ManualDealCard`/`ManualDealPreviewDialog` already
88
+ * take, so this just passes through. */
89
+ onEditDeal?: (deal: ManualDeal) => void;
90
+ onDeleteDeal?: (deal: ManualDeal) => void;
91
+ onOpenDocument: (doc: ManualDealDocumentRef) => void;
92
+ resolveImageUrl?: EntityImageResolver;
93
+ }
94
+ interface MarketingDealsPanelProps {
95
+ adapter: MarketingDealsAdapter;
96
+ /** Pure styling override — not part of the adapter, since it's never
97
+ * backend/data-shaped. */
98
+ className?: string;
99
+ }
100
+ declare function MarketingDealsPanel({ adapter, className }: MarketingDealsPanelProps): react.JSX.Element;
101
+
102
+ export { type MarketingDealsAdapter, MarketingDealsPanel, type MarketingDealsPanelProps };
@@ -0,0 +1,102 @@
1
+ import * as react from 'react';
2
+ import { ReactNode, MouseEvent } from 'react';
3
+ import { ProjectDeal, ManualDeal, ProjectCollabMembership, ManualDealDocumentRef, EntityImageResolver } from '@nukleus-sports/ui-patterns/marketing';
4
+
5
+ /**
6
+ * Reconciled from both apps' real current pages:
7
+ * - `nukleus-app`'s `MarketingDealsTab.tsx` (`ClientMarketingTab`)
8
+ * - `nukleus-clientapp`'s `pages/Marketing.tsx` + `hooks/useMarketing.ts`
9
+ *
10
+ * Both pages share one identical skeleton: a "Current Deals"/"Completed" tab
11
+ * pair, a "Deals" label bar, a `ProjectDealCard` list per tab (`Completed`
12
+ * also appends `ManualDealCard`s), matching empty states, and a shared
13
+ * `ManualDealPreviewDialog`. That skeleton is this component's entire scope.
14
+ *
15
+ * ## Deliberately NOT in this shell (stays app-local, per CLAUDE.md's
16
+ * page-shells rule and the decisions already made for this feature)
17
+ * - The page header/title and the "Record Past Deal"/"New Marketing Deal"
18
+ * buttons — `nukleus-app`-only chrome with no clientapp equivalent.
19
+ * - `MarketingDealForm` (the CRUD create/edit form) and `DeleteDialog` —
20
+ * `nukleus-app`-only, no clientapp read-only counterpart to reconcile
21
+ * against, same reasoning as `MarketingOverviewPanel`/`Card` (also kept
22
+ * app-local, rendered alongside this shell, not inside it).
23
+ * - The top-level access gate (`nukleus-app`'s `marketingPermission ===
24
+ * "No Access"` → `RestrictedAccessCard`; `clientapp`'s `!isAgencyLinked` →
25
+ * `AgencyLinkBanner`). Both are a one-time "should the deals experience
26
+ * render at all" decision made from each app's own permission shape
27
+ * (`@nukleus-sports/core`'s `MarketingPermission` union) *before* this
28
+ * shell ever mounts — not something this component re-derives.
29
+ * - Project-membership resolution for the "Collab" link gate (`@nukleus-sports/
30
+ * ui-patterns`' `ProjectDealCard` already enforces this structurally via its
31
+ * required `collabMembership` prop) — the actual membership check is an
32
+ * app-level query, surfaced here through `getCollabMembership`.
33
+ *
34
+ * ## Genuine differences reconciled (not formatting)
35
+ * - Client-status gating (`nukleus-app`'s `isGated`, e.g. a "Prospect" client
36
+ * can't have deals yet): `clientapp` has no such concept. Modeled as an
37
+ * optional `gatedEmptyState` — when supplied, it replaces the Current tab's
38
+ * content and the Completed tab is disabled, exactly matching `nukleus-app`'s
39
+ * structure; omit it and both tabs behave normally (`clientapp`'s case).
40
+ * - Loading skeleton: `clientapp` shows one before the tabs ever render;
41
+ * `nukleus-app` has none (deals just populate once the query resolves).
42
+ * Kept as an additive, opt-in `isLoading` prop — a loading affordance isn't
43
+ * an agency-vs-client distinction, so both can use it.
44
+ * - "Deals" label bar visibility on mobile: `nukleus-app` hides it below `sm`
45
+ * (`hidden sm:flex`), `clientapp` always shows it. Kept `nukleus-app`'s
46
+ * responsive hiding — the mobile layout is already a compact card stack
47
+ * without a tabular header, so the label reads as redundant there.
48
+ * - Completed-tab empty message: `nukleus-app`'s wording depends on whether
49
+ * there are current-tab project deals ("No past deals recorded yet." vs.
50
+ * the fuller "no deals at all" message); `clientapp`'s is a single fixed
51
+ * string. `completedEmptyMessage` accepts either a plain string or a
52
+ * `(hasCurrentProjectDeals: boolean) => string` so both shapes work without
53
+ * baking either app's copy into this package.
54
+ */
55
+ /**
56
+ * The app-supplied bridge to its own data/backend — per
57
+ * `docs/APPLICATION_ARCHITECTURE.md`'s Layer 5 adapter pattern, this shell
58
+ * takes a single typed `adapter` prop rather than flat individual props, so
59
+ * each app's own `use<Page>()` hook has one output shape to satisfy and
60
+ * drifting apart becomes a compile error, not a silent runtime mismatch.
61
+ */
62
+ interface MarketingDealsAdapter {
63
+ /** Shows a loading skeleton in place of the tabs. Additive — see module doc. */
64
+ isLoading?: boolean;
65
+ /** Shows an inline error message in place of the deal lists. */
66
+ error?: boolean;
67
+ errorMessage?: string;
68
+ activeTab: "current" | "completed";
69
+ onTabChange: (tab: "current" | "completed") => void;
70
+ currentProjectDeals: ProjectDeal[];
71
+ completedProjectDeals: ProjectDeal[];
72
+ manualDeals: ManualDeal[];
73
+ currentEmptyMessage: string;
74
+ completedEmptyMessage: string | ((hasCurrentProjectDeals: boolean) => string);
75
+ /**
76
+ * Replaces the Current tab's content and disables the Completed tab —
77
+ * `nukleus-app`'s client-status gating. Omit for `clientapp`'s ungated
78
+ * behavior.
79
+ */
80
+ gatedEmptyState?: ReactNode;
81
+ /** Required — `ProjectDealCard` structurally can't omit this. See module doc. */
82
+ getCollabMembership: (projectId: string) => ProjectCollabMembership;
83
+ getCollabHref: (projectId: string) => string;
84
+ /** `nukleus-app`'s demo-mode upsell toast swaps the link for a button. */
85
+ getOnCollabClick?: (projectId: string) => ((e: MouseEvent<HTMLButtonElement>) => void) | undefined;
86
+ /** Presence of each enables that affordance on `ManualDealCard`/the preview
87
+ * dialog — same shape `ManualDealCard`/`ManualDealPreviewDialog` already
88
+ * take, so this just passes through. */
89
+ onEditDeal?: (deal: ManualDeal) => void;
90
+ onDeleteDeal?: (deal: ManualDeal) => void;
91
+ onOpenDocument: (doc: ManualDealDocumentRef) => void;
92
+ resolveImageUrl?: EntityImageResolver;
93
+ }
94
+ interface MarketingDealsPanelProps {
95
+ adapter: MarketingDealsAdapter;
96
+ /** Pure styling override — not part of the adapter, since it's never
97
+ * backend/data-shaped. */
98
+ className?: string;
99
+ }
100
+ declare function MarketingDealsPanel({ adapter, className }: MarketingDealsPanelProps): react.JSX.Element;
101
+
102
+ export { type MarketingDealsAdapter, MarketingDealsPanel, type MarketingDealsPanelProps };
@@ -0,0 +1,133 @@
1
+ // src/marketing/marketing-deals-panel.tsx
2
+ import { useState } from "react";
3
+ import { Skeleton, Tabs, TabsContent, TabsList, TabsTrigger, cn } from "@nukleus-sports/ui-web";
4
+ import {
5
+ DealEmptyState,
6
+ ManualDealCard,
7
+ ManualDealPreviewDialog,
8
+ ProjectDealCard
9
+ } from "@nukleus-sports/ui-patterns/marketing";
10
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
+ function MarketingDealsPanel({ adapter, className }) {
12
+ const {
13
+ isLoading,
14
+ error,
15
+ errorMessage = "Could not load marketing deals. Please try again.",
16
+ activeTab,
17
+ onTabChange,
18
+ currentProjectDeals,
19
+ completedProjectDeals,
20
+ manualDeals,
21
+ currentEmptyMessage,
22
+ completedEmptyMessage,
23
+ gatedEmptyState,
24
+ getCollabMembership,
25
+ getCollabHref,
26
+ getOnCollabClick,
27
+ onEditDeal,
28
+ onDeleteDeal,
29
+ onOpenDocument,
30
+ resolveImageUrl
31
+ } = adapter;
32
+ const [previewDeal, setPreviewDeal] = useState(null);
33
+ const resolvedCompletedEmptyMessage = typeof completedEmptyMessage === "function" ? completedEmptyMessage(currentProjectDeals.length > 0) : completedEmptyMessage;
34
+ const hasCompletedContent = completedProjectDeals.length > 0 || manualDeals.length > 0;
35
+ if (isLoading) {
36
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-3", className), children: [
37
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-9 w-full rounded-[10px]" }),
38
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-[300px] w-full rounded-[10px]" })
39
+ ] });
40
+ }
41
+ return /* @__PURE__ */ jsxs("div", { className, children: [
42
+ /* @__PURE__ */ jsxs(
43
+ Tabs,
44
+ {
45
+ value: activeTab,
46
+ onValueChange: (value) => onTabChange(value),
47
+ className: "w-full flex flex-col gap-3",
48
+ children: [
49
+ /* @__PURE__ */ jsxs(TabsList, { className: "grid w-full grid-cols-2 bg-transparent border-b border-greys-grey-strokes-tables rounded-none h-auto p-0", children: [
50
+ /* @__PURE__ */ jsx(
51
+ TabsTrigger,
52
+ {
53
+ value: "current",
54
+ 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",
55
+ children: "Current Deals"
56
+ }
57
+ ),
58
+ /* @__PURE__ */ jsx(
59
+ TabsTrigger,
60
+ {
61
+ value: "completed",
62
+ disabled: !!gatedEmptyState,
63
+ 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",
64
+ children: "Completed"
65
+ }
66
+ )
67
+ ] }),
68
+ error ? /* @__PURE__ */ jsx("p", { className: "body-text text-destructive py-6 text-center", children: errorMessage }) : /* @__PURE__ */ jsxs(Fragment, { children: [
69
+ /* @__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" }) }),
70
+ /* @__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(
71
+ ProjectDealCard,
72
+ {
73
+ deal,
74
+ isCompleted: false,
75
+ collabMembership: getCollabMembership(deal.project_id),
76
+ collabHref: getCollabHref(deal.project_id),
77
+ onCollabClick: getOnCollabClick?.(deal.project_id),
78
+ resolveImageUrl
79
+ },
80
+ deal.project_id
81
+ )) }) : /* @__PURE__ */ jsx(DealEmptyState, { message: currentEmptyMessage }) }),
82
+ /* @__PURE__ */ jsx(TabsContent, { value: "completed", className: "mt-0", children: !hasCompletedContent ? /* @__PURE__ */ jsx(DealEmptyState, { message: resolvedCompletedEmptyMessage }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 sm:gap-0", children: [
83
+ completedProjectDeals.map((deal) => /* @__PURE__ */ jsx(
84
+ ProjectDealCard,
85
+ {
86
+ deal,
87
+ isCompleted: true,
88
+ collabMembership: getCollabMembership(deal.project_id),
89
+ collabHref: getCollabHref(deal.project_id),
90
+ onCollabClick: getOnCollabClick?.(deal.project_id),
91
+ resolveImageUrl
92
+ },
93
+ deal.project_id
94
+ )),
95
+ manualDeals.map((deal) => /* @__PURE__ */ jsx(
96
+ ManualDealCard,
97
+ {
98
+ deal,
99
+ onPreview: setPreviewDeal,
100
+ onEdit: onEditDeal,
101
+ onDelete: onDeleteDeal,
102
+ onOpenDocument,
103
+ resolveImageUrl
104
+ },
105
+ deal.id
106
+ ))
107
+ ] }) })
108
+ ] })
109
+ ]
110
+ }
111
+ ),
112
+ /* @__PURE__ */ jsx(
113
+ ManualDealPreviewDialog,
114
+ {
115
+ deal: previewDeal,
116
+ open: !!previewDeal,
117
+ onOpenChange: (open) => {
118
+ if (!open) setPreviewDeal(null);
119
+ },
120
+ onEdit: onEditDeal ? (deal) => {
121
+ setPreviewDeal(null);
122
+ onEditDeal(deal);
123
+ } : void 0,
124
+ onOpenDocument,
125
+ resolveImageUrl
126
+ }
127
+ )
128
+ ] });
129
+ }
130
+ export {
131
+ MarketingDealsPanel
132
+ };
133
+ //# sourceMappingURL=marketing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/marketing/marketing-deals-panel.tsx"],"sourcesContent":["import { useState, type MouseEvent, type ReactNode } from \"react\";\n\nimport { Skeleton, Tabs, TabsContent, TabsList, TabsTrigger, cn } 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\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 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 <p className=\"body-text text-destructive py-6 text-center\">{errorMessage}</p>\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":"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","names":[]}
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "@nukleus-sports/page-shells",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.1",
4
+ "type": "module",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
13
+ },
14
+ "./marketing": {
15
+ "types": "./dist/marketing.d.ts",
16
+ "import": "./dist/marketing.js",
17
+ "require": "./dist/marketing.cjs"
18
+ },
19
+ "./package.json": "./package.json"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "sideEffects": false,
25
+ "scripts": {
26
+ "build": "tsup",
27
+ "dev": "tsup --watch",
28
+ "test": "vitest run",
29
+ "lint": "eslint \"src/**/*.ts\" \"src/**/*.tsx\" \"tests/**/*.ts\"",
30
+ "typecheck": "tsc --noEmit",
31
+ "prepublishOnly": "bun run build"
32
+ },
33
+ "keywords": [
34
+ "nukleus",
35
+ "page-shells",
36
+ "design-system"
37
+ ],
38
+ "peerDependencies": {
39
+ "react": "^18 || ^19",
40
+ "react-dom": "^18 || ^19"
41
+ },
42
+ "dependencies": {
43
+ "@nukleus-sports/ui-patterns": "^0.1.1",
44
+ "@nukleus-sports/ui-web": "^0.1.0"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^26.6.1",
48
+ "@types/react": "^18.3.3",
49
+ "@types/react-dom": "^18.3.0",
50
+ "react": "^18.3.1",
51
+ "react-dom": "^18.3.1",
52
+ "tsup": "^8.4.0",
53
+ "typescript": "^5.8.2",
54
+ "vitest": "^5.0.1"
55
+ },
56
+ "publishConfig": {
57
+ "access": "public"
58
+ }
59
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.