@burdenoff/microfe-store 2026.626.1 → 2026.703.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.
@@ -1 +0,0 @@
1
- {"version":3,"file":"PublisherRevenuePage.js","names":[],"sources":["../../src/pages/PublisherRevenuePage.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useMemo } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { ArrowLeft, Wallet, Clock3, TrendingUp } from 'lucide-react';\nimport { useDeveloperEarnings } from '../hooks/useStoreGraphQL';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n GlassCard,\n EmphasisPanel,\n PagePurpose,\n IllustratedEmptyState,\n} from '@burdenoff/fe-libs/ui';\n\ninterface EarningsPayload {\n totalEarnings: number;\n monthlyEarnings: number;\n totalOrders: number;\n monthlyOrders: number;\n currency: string;\n earnings?: Array<{\n month: string;\n year: number;\n earnings: number;\n orders: number;\n currency: string;\n }>;\n topSellingItems?: Array<{\n storeProduct: { id: string; name: string };\n totalSales: number;\n totalEarnings: number;\n monthlySales: number;\n monthlyEarnings: number;\n currency: string;\n }>;\n}\n\nexport const PublisherRevenuePage: FC = () => {\n const navigate = useNavigate();\n const { earnings, loading, error, refetch } = useDeveloperEarnings();\n const { t } = useI18n();\n\n const data = (earnings as EarningsPayload | null) ?? null;\n const currency = data?.currency || 'USD';\n\n const fmt = useMemo(\n () =>\n new Intl.NumberFormat(undefined, {\n style: 'currency',\n currency,\n maximumFractionDigits: 2,\n }),\n [currency]\n );\n\n return (\n <div className=\"flex h-full flex-col\">\n <header className=\"border-b border-border-seam bg-bg-surface px-6 py-4\">\n <div className=\"mx-auto flex max-w-6xl items-center gap-3\">\n <button\n type=\"button\"\n onClick={() => navigate(-1)}\n aria-label=\"Go back\"\n className=\"cursor-pointer rounded-lg p-2 text-text-muted hover:bg-bg-sunken hover:text-text-primary\"\n >\n <ArrowLeft className=\"size-5\" />\n </button>\n <div>\n <h1 className=\"text-2xl font-bold text-text-primary\">\n {t('pages.publisherRevenue.title', { defaultValue: 'Revenue' })}\n </h1>\n <p className=\"text-sm text-text-muted\">\n {t('pages.publisherRevenue.subtitle', {\n defaultValue: 'Track publisher earnings and payouts',\n })}\n </p>\n </div>\n </div>\n </header>\n\n <main className=\"flex-1 overflow-y-auto p-6\">\n <div className=\"mx-auto max-w-6xl space-y-6\">\n <PagePurpose>\n See what your published products are actually earning. Track total and monthly revenue,\n how many orders came in, and which products sell best — so you know where your income\n comes from and which listings are worth doubling down on.\n </PagePurpose>\n {loading ? (\n <p role=\"status\" className=\"text-sm text-text-muted\">\n Loading earnings…\n </p>\n ) : error ? (\n <div\n role=\"alert\"\n className=\"space-y-2 rounded-xl border border-status-error-border bg-status-error-bg-subtle p-6\"\n >\n <p className=\"text-sm text-status-error-text\">\n {t('pages.publisherRevenue.failedToLoad', {\n defaultValue: 'Failed to load earnings data.',\n })}\n </p>\n <button\n type=\"button\"\n onClick={() => refetch()}\n className=\"cursor-pointer rounded-lg bg-action-primary-bg px-3 py-1.5 text-xs font-semibold text-action-primary-text\"\n >\n Retry\n </button>\n </div>\n ) : !data ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={t('pages.publisherRevenue.noRevenueTitle', {\n defaultValue: 'No revenue data yet',\n })}\n description={t('pages.publisherRevenue.noRevenue', {\n defaultValue:\n 'No revenue data available yet. Earnings will appear here once your published products start selling.',\n })}\n />\n ) : (\n <>\n <div className=\"grid gap-4 sm:grid-cols-3\">\n <GlassCard treatment=\"metric\" className=\"p-4\">\n <div className=\"inline-flex items-center gap-2 text-xs uppercase tracking-wide text-text-muted\">\n <Wallet className=\"size-4\" />{' '}\n {t('pages.publisherRevenue.totalEarnings', { defaultValue: 'Total earnings' })}\n </div>\n <p className=\"mt-2 text-2xl font-bold tabular-nums text-text-primary\">\n {fmt.format(data.totalEarnings)}\n </p>\n </GlassCard>\n <GlassCard treatment=\"metric\" className=\"p-4\">\n <div className=\"inline-flex items-center gap-2 text-xs uppercase tracking-wide text-text-muted\">\n <Clock3 className=\"size-4\" />{' '}\n {t('pages.publisherRevenue.monthlyEarnings', {\n defaultValue: 'Monthly earnings',\n })}\n </div>\n <p className=\"mt-2 text-2xl font-bold tabular-nums text-text-primary\">\n {fmt.format(data.monthlyEarnings)}\n </p>\n </GlassCard>\n <GlassCard treatment=\"metric\" className=\"p-4\">\n <div className=\"inline-flex items-center gap-2 text-xs uppercase tracking-wide text-text-muted\">\n <TrendingUp className=\"size-4\" />{' '}\n {t('pages.publisherRevenue.monthlyOrders', { defaultValue: 'Monthly orders' })}\n </div>\n <p className=\"mt-2 text-2xl font-bold tabular-nums text-text-primary\">\n {data.monthlyOrders}\n </p>\n </GlassCard>\n </div>\n\n <EmphasisPanel>\n <h2 className=\"mb-3 text-lg font-semibold text-text-primary\">\n {t('pages.publisherRevenue.topSelling', { defaultValue: 'Top Selling Items' })}\n </h2>\n {!data.topSellingItems || data.topSellingItems.length === 0 ? (\n <p className=\"text-sm text-text-muted\">\n {t('pages.publisherRevenue.noSales', {\n defaultValue: 'No product sales found for this period.',\n })}\n </p>\n ) : (\n <ul className=\"space-y-2\">\n {data.topSellingItems.map((item) => (\n <li\n key={item.storeProduct.id}\n className=\"flex items-center justify-between rounded-lg border border-border-seam bg-bg-surface p-3\"\n >\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {item.storeProduct.name}\n </p>\n <p className=\"text-xs text-text-muted\">\n {item.totalSales} total sales • {item.monthlySales} this period\n </p>\n </div>\n <p className=\"text-sm font-semibold text-text-primary\">\n {fmt.format(item.totalEarnings)}\n </p>\n </li>\n ))}\n </ul>\n )}\n </EmphasisPanel>\n </>\n )}\n </div>\n </main>\n </div>\n );\n};\n"],"mappings":";;;;;;;;AAoCA,IAAa,UAAiC;CAC5C,IAAM,IAAW,GAAa,EACxB,EAAE,aAAU,YAAS,UAAO,eAAY,GAAsB,EAC9D,EAAE,SAAM,GAAS,EAEjB,IAA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;iBACV,EAAI,OAAO,EAAK,cAAc;OAC7B,CAAA,CACD;QAdE,EAAK,aAAa,GAcpB,CACL;KACC,CAAA,CAEO,EAAA,CAAA,CACf,EAAA,CAAA,GA7EH,kBAAC,GAAD;KACE,cAAa;KACb,OAAO,EAAE,yCAAyC,EAChD,cAAc,uBACf,CAAC;KACF,aAAa,EAAE,oCAAoC,EACjD,cACE,wGACH,CAAC;KACF,CAAA,CAsEA;;GACD,CAAA,CACH"}
@@ -1,188 +0,0 @@
1
- import { useStore as e } from "../providers/StoreProvider.js";
2
- import { useSubmissionStatusUpdatedSubscription as t } from "../generated/global-operations.js";
3
- import { useMyPublishedProducts as n } from "../hooks/useStoreGraphQL.js";
4
- import { useMemo as r } from "react";
5
- import { useI18n as i } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
6
- import { ArrowLeft as a, CheckCircle2 as o, Clock3 as s, MessageSquare as c, XCircle as l } from "lucide-react";
7
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
8
- import { useNavigate as f } from "react-router-dom";
9
- import { EmphasisPanel as p, GlassCard as m, IllustratedEmptyState as h, PagePurpose as g } from "@burdenoff/fe-libs/ui";
10
- //#region src/pages/PublisherSubmissionsPage.tsx
11
- var _ = (e) => e === "PUBLISHED" || e === "APPROVED" ? "bg-status-success-bg-subtle text-status-success-text" : e === "REJECTED" || e === "UNLISTED" ? "bg-status-error-bg-subtle text-status-error-text" : e === "PENDING" || e === "SUBMITTED" || e === "UNDER_REVIEW" ? "bg-status-warning-bg-subtle text-status-warning-text" : "bg-bg-sunken text-text-muted", v = () => {
12
- let v = f(), { basePath: y, currentUser: b } = e(), { products: x, hasMore: S, loading: C, error: w, refetch: T, loadMore: E } = n(), { t: D } = i(), O = b?.id;
13
- t({
14
- variables: { publisherId: O ?? "" },
15
- skip: !O,
16
- onData: () => {
17
- T();
18
- },
19
- onError: (e) => {
20
- console.warn("SubmissionStatusUpdated subscription error:", e.message);
21
- }
22
- });
23
- let k = r(() => {
24
- let e = x.filter((e) => e.status === "PUBLISHED" || e.status === "APPROVED").length, t = x.filter((e) => e.status === "REJECTED" || e.status === "UNLISTED").length;
25
- return {
26
- approved: e,
27
- rejected: t,
28
- pending: x.length - e - t
29
- };
30
- }, [x]);
31
- return /* @__PURE__ */ d("div", {
32
- className: "flex h-full flex-col",
33
- children: [/* @__PURE__ */ u("header", {
34
- className: "border-b border-border-seam bg-bg-surface px-6 py-4",
35
- children: /* @__PURE__ */ d("div", {
36
- className: "mx-auto flex max-w-6xl items-center gap-3",
37
- children: [/* @__PURE__ */ u("button", {
38
- type: "button",
39
- onClick: () => v(-1),
40
- "aria-label": "Go back",
41
- className: "cursor-pointer rounded-lg p-2 text-text-muted hover:bg-bg-sunken hover:text-text-primary",
42
- children: /* @__PURE__ */ u(a, { className: "size-5" })
43
- }), /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("h1", {
44
- className: "text-2xl font-bold text-text-primary",
45
- children: D("pages.publisherSubmissions.title", { defaultValue: "Submissions" })
46
- }), /* @__PURE__ */ u("p", {
47
- className: "text-sm text-text-muted",
48
- children: D("pages.publisherSubmissions.subtitle", { defaultValue: "Track approval status for your store products" })
49
- })] })]
50
- })
51
- }), /* @__PURE__ */ u("main", {
52
- className: "flex-1 overflow-y-auto p-6",
53
- children: /* @__PURE__ */ d("div", {
54
- className: "mx-auto max-w-6xl space-y-6",
55
- children: [
56
- /* @__PURE__ */ u(g, { children: "Follow each product you've submitted through the review pipeline — pending, approved or rejected — so you always know what's live and what still needs attention. If a submission is rejected, open it to read the moderator's reason and resubmit a fixed version." }),
57
- /* @__PURE__ */ d("div", {
58
- className: "grid gap-4 sm:grid-cols-3",
59
- children: [
60
- /* @__PURE__ */ d(m, {
61
- treatment: "metric",
62
- className: "p-4",
63
- children: [/* @__PURE__ */ d("div", {
64
- className: "inline-flex items-center gap-2 text-xs uppercase tracking-wide text-text-muted",
65
- children: [
66
- /* @__PURE__ */ u(s, { className: "size-4" }),
67
- " ",
68
- D("store.status.pending", { defaultValue: "Pending" })
69
- ]
70
- }), /* @__PURE__ */ u("p", {
71
- className: "mt-2 text-2xl font-bold tabular-nums text-text-primary",
72
- children: k.pending
73
- })]
74
- }),
75
- /* @__PURE__ */ d(m, {
76
- treatment: "metric",
77
- className: "p-4",
78
- children: [/* @__PURE__ */ d("div", {
79
- className: "inline-flex items-center gap-2 text-xs uppercase tracking-wide text-text-muted",
80
- children: [
81
- /* @__PURE__ */ u(o, { className: "size-4" }),
82
- " ",
83
- D("store.status.approved", { defaultValue: "Approved" })
84
- ]
85
- }), /* @__PURE__ */ u("p", {
86
- className: "mt-2 text-2xl font-bold tabular-nums text-text-primary",
87
- children: k.approved
88
- })]
89
- }),
90
- /* @__PURE__ */ d(m, {
91
- treatment: "metric",
92
- className: "p-4",
93
- children: [/* @__PURE__ */ d("div", {
94
- className: "inline-flex items-center gap-2 text-xs uppercase tracking-wide text-text-muted",
95
- children: [
96
- /* @__PURE__ */ u(l, { className: "size-4" }),
97
- " ",
98
- D("store.status.rejected", { defaultValue: "Rejected" })
99
- ]
100
- }), /* @__PURE__ */ u("p", {
101
- className: "mt-2 text-2xl font-bold tabular-nums text-text-primary",
102
- children: k.rejected
103
- })]
104
- })
105
- ]
106
- }),
107
- /* @__PURE__ */ d(p, { children: [/* @__PURE__ */ d("div", {
108
- className: "mb-4 flex items-center justify-between",
109
- children: [/* @__PURE__ */ u("h2", {
110
- className: "text-lg font-semibold text-text-primary",
111
- children: D("pages.publisherSubmissions.timeline", { defaultValue: "Submission Timeline" })
112
- }), /* @__PURE__ */ u("button", {
113
- type: "button",
114
- onClick: () => v(`${y}/publisher/submit`),
115
- className: "cursor-pointer rounded-lg bg-action-primary-bg px-3 py-1.5 text-sm font-semibold text-action-primary-text",
116
- children: D("pages.publisherSubmissions.newSubmission", { defaultValue: "New Submission" })
117
- })]
118
- }), C ? /* @__PURE__ */ u("p", {
119
- role: "status",
120
- className: "text-sm text-text-muted",
121
- children: "Loading submissions…"
122
- }) : w ? /* @__PURE__ */ d("div", {
123
- role: "alert",
124
- className: "space-y-2",
125
- children: [/* @__PURE__ */ u("p", {
126
- className: "text-sm text-status-error-text",
127
- children: D("pages.publisherSubmissions.failedToLoad", { defaultValue: "Failed to load submissions." })
128
- }), /* @__PURE__ */ u("button", {
129
- type: "button",
130
- onClick: () => T(),
131
- className: "cursor-pointer rounded-lg bg-action-primary-bg px-3 py-1.5 text-xs font-semibold text-action-primary-text",
132
- children: "Retry"
133
- })]
134
- }) : x.length === 0 ? /* @__PURE__ */ u(h, {
135
- illustration: "empty-data",
136
- title: D("pages.publisherSubmissions.emptyTitle", { defaultValue: "No submissions found yet." }),
137
- description: D("pages.publisherSubmissions.emptyDescription", { defaultValue: "Submit a product to start tracking it through review here." }),
138
- action: /* @__PURE__ */ u("button", {
139
- type: "button",
140
- onClick: () => v(`${y}/publisher/submit`),
141
- className: "cursor-pointer rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-semibold text-action-primary-text hover:opacity-90",
142
- children: D("pages.publisherSubmissions.newSubmission", { defaultValue: "New Submission" })
143
- })
144
- }) : /* @__PURE__ */ d("ul", {
145
- className: "space-y-3",
146
- children: [x.map((e) => /* @__PURE__ */ d("li", {
147
- className: "flex items-center justify-between rounded-lg border border-border-seam bg-bg-surface p-3 transition-[box-shadow,border-color] hover:border-border-strong hover:shadow-[var(--shadow-pop)]",
148
- children: [/* @__PURE__ */ d("button", {
149
- type: "button",
150
- onClick: () => v(`${y}/marketplace/product/${e.id}`),
151
- className: "flex flex-1 cursor-pointer items-center justify-between text-left",
152
- children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
153
- className: "font-medium text-text-primary",
154
- children: e.name
155
- }), /* @__PURE__ */ d("p", {
156
- className: "text-xs text-text-muted",
157
- children: ["Reviews: ", e.reviewCount]
158
- })] }), /* @__PURE__ */ u("span", {
159
- className: `rounded-full px-2.5 py-1 text-xs font-semibold ${_(e.status)}`,
160
- children: e.status
161
- })]
162
- }), /* @__PURE__ */ d("button", {
163
- type: "button",
164
- onClick: () => v(`${y}/publisher/product/${e.id}/reviews`),
165
- className: "ml-3 inline-flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-text-link hover:bg-bg-sunken hover:underline",
166
- title: "View reviews",
167
- children: [/* @__PURE__ */ u(c, { className: "size-3.5" }), "Reviews"]
168
- })]
169
- }, e.id)), S && /* @__PURE__ */ u("li", {
170
- className: "flex justify-center pt-4 list-none",
171
- children: /* @__PURE__ */ u("button", {
172
- type: "button",
173
- onClick: E,
174
- disabled: C,
175
- className: "rounded-lg border border-border-default px-6 py-2.5 text-sm font-medium text-text-primary hover:bg-bg-subtle disabled:opacity-50",
176
- children: C ? "Loading…" : "Load more"
177
- })
178
- })]
179
- })] })
180
- ]
181
- })
182
- })]
183
- });
184
- };
185
- //#endregion
186
- export { v as PublisherSubmissionsPage };
187
-
188
- //# sourceMappingURL=PublisherSubmissionsPage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PublisherSubmissionsPage.js","names":[],"sources":["../../src/pages/PublisherSubmissionsPage.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useMemo } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { ArrowLeft, Clock3, CheckCircle2, XCircle, MessageSquare } from 'lucide-react';\nimport { useStore } from '../providers/StoreProvider';\nimport { useMyPublishedProducts } from '../hooks/useStoreGraphQL';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n GlassCard,\n EmphasisPanel,\n PagePurpose,\n IllustratedEmptyState,\n} from '@burdenoff/fe-libs/ui';\nimport { useSubmissionStatusUpdatedSubscription } from '../generated/global-operations';\n\nconst statusClass = (status: string): string => {\n if (status === 'PUBLISHED' || status === 'APPROVED') {\n return 'bg-status-success-bg-subtle text-status-success-text';\n }\n if (status === 'REJECTED' || status === 'UNLISTED') {\n return 'bg-status-error-bg-subtle text-status-error-text';\n }\n if (status === 'PENDING' || status === 'SUBMITTED' || status === 'UNDER_REVIEW') {\n return 'bg-status-warning-bg-subtle text-status-warning-text';\n }\n return 'bg-bg-sunken text-text-muted';\n};\n\nexport const PublisherSubmissionsPage: FC = () => {\n const navigate = useNavigate();\n const { basePath, currentUser } = useStore();\n const { products, hasMore, loading, error, refetch, loadMore } = useMyPublishedProducts();\n const { t } = useI18n();\n\n const publisherId = currentUser?.id;\n useSubmissionStatusUpdatedSubscription({\n variables: { publisherId: publisherId ?? '' },\n skip: !publisherId,\n onData: () => {\n void refetch();\n },\n onError: (err) => {\n console.warn('SubmissionStatusUpdated subscription error:', err.message);\n },\n });\n\n const grouped = useMemo(() => {\n const approved = products.filter(\n (p) => p.status === 'PUBLISHED' || p.status === 'APPROVED'\n ).length;\n const rejected = products.filter(\n (p) => p.status === 'REJECTED' || p.status === 'UNLISTED'\n ).length;\n const pending = products.length - approved - rejected;\n return { approved, rejected, pending };\n }, [products]);\n\n return (\n <div className=\"flex h-full flex-col\">\n <header className=\"border-b border-border-seam bg-bg-surface px-6 py-4\">\n <div className=\"mx-auto flex max-w-6xl items-center gap-3\">\n <button\n type=\"button\"\n onClick={() => navigate(-1)}\n aria-label=\"Go back\"\n className=\"cursor-pointer rounded-lg p-2 text-text-muted hover:bg-bg-sunken hover:text-text-primary\"\n >\n <ArrowLeft className=\"size-5\" />\n </button>\n <div>\n <h1 className=\"text-2xl font-bold text-text-primary\">\n {t('pages.publisherSubmissions.title', { defaultValue: 'Submissions' })}\n </h1>\n <p className=\"text-sm text-text-muted\">\n {t('pages.publisherSubmissions.subtitle', {\n defaultValue: 'Track approval status for your store products',\n })}\n </p>\n </div>\n </div>\n </header>\n\n <main className=\"flex-1 overflow-y-auto p-6\">\n <div className=\"mx-auto max-w-6xl space-y-6\">\n <PagePurpose>\n Follow each product you've submitted through the review pipeline — pending, approved or\n rejected — so you always know what's live and what still needs attention. If a submission\n is rejected, open it to read the moderator's reason and resubmit a fixed version.\n </PagePurpose>\n <div className=\"grid gap-4 sm:grid-cols-3\">\n <GlassCard treatment=\"metric\" className=\"p-4\">\n <div className=\"inline-flex items-center gap-2 text-xs uppercase tracking-wide text-text-muted\">\n <Clock3 className=\"size-4\" />{' '}\n {t('store.status.pending', { defaultValue: 'Pending' })}\n </div>\n <p className=\"mt-2 text-2xl font-bold tabular-nums text-text-primary\">\n {grouped.pending}\n </p>\n </GlassCard>\n <GlassCard treatment=\"metric\" className=\"p-4\">\n <div className=\"inline-flex items-center gap-2 text-xs uppercase tracking-wide text-text-muted\">\n <CheckCircle2 className=\"size-4\" />{' '}\n {t('store.status.approved', { defaultValue: 'Approved' })}\n </div>\n <p className=\"mt-2 text-2xl font-bold tabular-nums text-text-primary\">\n {grouped.approved}\n </p>\n </GlassCard>\n <GlassCard treatment=\"metric\" className=\"p-4\">\n <div className=\"inline-flex items-center gap-2 text-xs uppercase tracking-wide text-text-muted\">\n <XCircle className=\"size-4\" />{' '}\n {t('store.status.rejected', { defaultValue: 'Rejected' })}\n </div>\n <p className=\"mt-2 text-2xl font-bold tabular-nums text-text-primary\">\n {grouped.rejected}\n </p>\n </GlassCard>\n </div>\n\n <EmphasisPanel>\n <div className=\"mb-4 flex items-center justify-between\">\n <h2 className=\"text-lg font-semibold text-text-primary\">\n {t('pages.publisherSubmissions.timeline', { defaultValue: 'Submission Timeline' })}\n </h2>\n <button\n type=\"button\"\n onClick={() => navigate(`${basePath}/publisher/submit`)}\n className=\"cursor-pointer rounded-lg bg-action-primary-bg px-3 py-1.5 text-sm font-semibold text-action-primary-text\"\n >\n {t('pages.publisherSubmissions.newSubmission', { defaultValue: 'New Submission' })}\n </button>\n </div>\n\n {loading ? (\n <p role=\"status\" className=\"text-sm text-text-muted\">\n Loading submissions…\n </p>\n ) : error ? (\n <div role=\"alert\" className=\"space-y-2\">\n <p className=\"text-sm text-status-error-text\">\n {t('pages.publisherSubmissions.failedToLoad', {\n defaultValue: 'Failed to load submissions.',\n })}\n </p>\n <button\n type=\"button\"\n onClick={() => refetch()}\n className=\"cursor-pointer rounded-lg bg-action-primary-bg px-3 py-1.5 text-xs font-semibold text-action-primary-text\"\n >\n Retry\n </button>\n </div>\n ) : products.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-data\"\n title={t('pages.publisherSubmissions.emptyTitle', {\n defaultValue: 'No submissions found yet.',\n })}\n description={t('pages.publisherSubmissions.emptyDescription', {\n defaultValue:\n 'Submit a product to start tracking it through review here.',\n })}\n action={\n <button\n type=\"button\"\n onClick={() => navigate(`${basePath}/publisher/submit`)}\n className=\"cursor-pointer rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-semibold text-action-primary-text hover:opacity-90\"\n >\n {t('pages.publisherSubmissions.newSubmission', {\n defaultValue: 'New Submission',\n })}\n </button>\n }\n />\n ) : (\n <ul className=\"space-y-3\">\n {products.map((product) => (\n <li\n key={product.id}\n className=\"flex items-center justify-between rounded-lg border border-border-seam bg-bg-surface p-3 transition-[box-shadow,border-color] hover:border-border-strong hover:shadow-[var(--shadow-pop)]\"\n >\n <button\n type=\"button\"\n onClick={() => navigate(`${basePath}/marketplace/product/${product.id}`)}\n className=\"flex flex-1 cursor-pointer items-center justify-between text-left\"\n >\n <div>\n <p className=\"font-medium text-text-primary\">{product.name}</p>\n <p className=\"text-xs text-text-muted\">Reviews: {product.reviewCount}</p>\n </div>\n <span\n className={`rounded-full px-2.5 py-1 text-xs font-semibold ${statusClass(product.status)}`}\n >\n {product.status}\n </span>\n </button>\n <button\n type=\"button\"\n onClick={() =>\n navigate(`${basePath}/publisher/product/${product.id}/reviews`)\n }\n className=\"ml-3 inline-flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-text-link hover:bg-bg-sunken hover:underline\"\n title=\"View reviews\"\n >\n <MessageSquare className=\"size-3.5\" />\n Reviews\n </button>\n </li>\n ))}\n {hasMore && (\n <li className=\"flex justify-center pt-4 list-none\">\n <button\n type=\"button\"\n onClick={loadMore}\n disabled={loading}\n className=\"rounded-lg border border-border-default px-6 py-2.5 text-sm font-medium text-text-primary hover:bg-bg-subtle disabled:opacity-50\"\n >\n {loading ? 'Loading\\u2026' : 'Load more'}\n </button>\n </li>\n )}\n </ul>\n )}\n </EmphasisPanel>\n </div>\n </main>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;AAeA,IAAM,KAAe,MACf,MAAW,eAAe,MAAW,aAChC,yDAEL,MAAW,cAAc,MAAW,aAC/B,qDAEL,MAAW,aAAa,MAAW,eAAe,MAAW,iBACxD,yDAEF,gCAGI,UAAqC;CAChD,IAAM,IAAW,GAAa,EACxB,EAAE,aAAU,mBAAgB,GAAU,EACtC,EAAE,aAAU,YAAS,YAAS,UAAO,YAAS,gBAAa,GAAwB,EACnF,EAAE,SAAM,GAAS,EAEjB,IAAc,GAAa;AACjC,GAAuC;EACrC,WAAW,EAAE,aAAa,KAAe,IAAI;EAC7C,MAAM,CAAC;EACP,cAAc;AACP,MAAS;;EAEhB,UAAU,MAAQ;AAChB,WAAQ,KAAK,+CAA+C,EAAI,QAAQ;;EAE3E,CAAC;CAEF,IAAM,IAAU,QAAc;EAC5B,IAAM,IAAW,EAAS,QACvB,MAAM,EAAE,WAAW,eAAe,EAAE,WAAW,WACjD,CAAC,QACI,IAAW,EAAS,QACvB,MAAM,EAAE,WAAW,cAAc,EAAE,WAAW,WAChD,CAAC;AAEF,SAAO;GAAE;GAAU;GAAU,SADb,EAAS,SAAS,IAAW;GACP;IACrC,CAAC,EAAS,CAAC;AAEd,QACE,kBAAC,OAAD;EAAK,WAAU;YAAf,CACE,kBAAC,UAAD;GAAQ,WAAU;aAChB,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,UAAD;KACE,MAAK;KACL,eAAe,EAAS,GAAG;KAC3B,cAAW;KACX,WAAU;eAEV,kBAAC,GAAD,EAAW,WAAU,UAAW,CAAA;KACzB,CAAA,EACT,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,MAAD;KAAI,WAAU;eACX,EAAE,oCAAoC,EAAE,cAAc,eAAe,CAAC;KACpE,CAAA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WAAU;QACV,OAAM;kBANR,CAQE,kBAAC,GAAD,EAAe,WAAU,YAAa,CAAA,EAAA,UAE/B;UACN;SA7BE,EAAQ,GA6BV,CACL,EACD,KACC,kBAAC,MAAD;OAAI,WAAU;iBACZ,kBAAC,UAAD;QACE,MAAK;QACL,SAAS;QACT,UAAU;QACV,WAAU;kBAET,IAAU,aAAkB;QACtB,CAAA;OACN,CAAA,CAEJ;QAEO,EAAA,CAAA;KACZ;;GACD,CAAA,CACH"}
@@ -1,243 +0,0 @@
1
- import { CreateProductForPublisherDocument as e } from "../generated/global-operations.js";
2
- import { useMemo as t, useState as n } from "react";
3
- import { useApolloClient as r } from "@apollo/client/react";
4
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
- import { GlassCard as o, PagePurpose as s } from "@burdenoff/fe-libs/ui";
6
- //#region src/pages/PublisherSubmitPage.tsx
7
- var c = JSON.stringify({
8
- schemaVersion: "1.0.0",
9
- itemType: "app",
10
- author: { name: "Publisher Team" },
11
- compatibility: {
12
- minVersion: "2026.1.0",
13
- products: ["workspaces"]
14
- },
15
- permissions: ["workspace:read"],
16
- dependencies: { integrations: [] }
17
- }, null, 2), l = () => {
18
- let l = r(), [u, d] = n(""), [f, p] = n(""), [m, h] = n(""), [g, _] = n("APP"), [v, y] = n("0"), [b, x] = n(c), [S, C] = n(!1), [w, T] = n(null), [E, D] = n(null), O = t(() => {
19
- try {
20
- return {
21
- value: JSON.parse(b),
22
- error: null
23
- };
24
- } catch {
25
- return {
26
- value: null,
27
- error: "Manifest JSON is invalid."
28
- };
29
- }
30
- }, [b]);
31
- return /* @__PURE__ */ a("main", {
32
- className: "mx-auto max-w-4xl p-6",
33
- children: [
34
- /* @__PURE__ */ a("header", {
35
- className: "mb-6",
36
- children: [/* @__PURE__ */ i("h1", {
37
- className: "text-2xl font-semibold text-text-primary",
38
- children: "Submit Product"
39
- }), /* @__PURE__ */ i("p", {
40
- className: "mt-1 text-sm text-text-muted",
41
- children: "Create a store product with manifest JSON (raw mode)."
42
- })]
43
- }),
44
- /* @__PURE__ */ i(s, {
45
- className: "mb-6",
46
- children: "List your own app, agent, node, widget, or workflow on the marketplace so other users can discover and install it. Fill in the basics, set a price (use 0 for free), and provide a manifest describing what it does and needs. After you submit, it enters review — track it from your Submissions page."
47
- }),
48
- /* @__PURE__ */ i(o, {
49
- treatment: "glass",
50
- glow: !0,
51
- className: "p-5",
52
- children: /* @__PURE__ */ a("form", {
53
- onSubmit: async (t) => {
54
- if (t.preventDefault(), T(null), D(null), !u.trim()) {
55
- T("Product name is required.");
56
- return;
57
- }
58
- if (!f.trim()) {
59
- T("Product slug is required.");
60
- return;
61
- }
62
- if (O.error || !O.value) {
63
- T(O.error || "Manifest JSON is required.");
64
- return;
65
- }
66
- let n = Number(v);
67
- if (!Number.isFinite(n) || n < 0) {
68
- T("Price must be a valid non-negative number.");
69
- return;
70
- }
71
- C(!0);
72
- try {
73
- let t = (await l.mutate({
74
- mutation: e,
75
- variables: { input: {
76
- name: u.trim(),
77
- slug: f.trim(),
78
- type: g,
79
- price: n,
80
- pricingModel: n === 0 ? "FREE" : "PAID_ONETIME",
81
- description: m.trim() || void 0,
82
- manifest: O.value
83
- } }
84
- })).data?.createProduct;
85
- if (!t) {
86
- T("Product creation failed: no product returned by API.");
87
- return;
88
- }
89
- D(`Created ${t.slug} (${t.status})`), d(""), p(""), h("");
90
- } catch (e) {
91
- T(e instanceof Error ? e.message : "Unknown error");
92
- } finally {
93
- C(!1);
94
- }
95
- },
96
- className: "space-y-4",
97
- "aria-label": "Submit Product",
98
- children: [
99
- /* @__PURE__ */ a("div", {
100
- className: "grid gap-4 md:grid-cols-2",
101
- children: [
102
- /* @__PURE__ */ a("label", {
103
- className: "space-y-1",
104
- children: [/* @__PURE__ */ i("span", {
105
- className: "text-sm text-text-secondary",
106
- children: "Product Name"
107
- }), /* @__PURE__ */ i("input", {
108
- "aria-label": "Product Name",
109
- value: u,
110
- onChange: (e) => d(e.target.value),
111
- required: !0,
112
- "aria-required": "true",
113
- className: "w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary",
114
- placeholder: "Acme Automation"
115
- })]
116
- }),
117
- /* @__PURE__ */ a("label", {
118
- className: "space-y-1",
119
- children: [/* @__PURE__ */ i("span", {
120
- className: "text-sm text-text-secondary",
121
- children: "Slug"
122
- }), /* @__PURE__ */ i("input", {
123
- "aria-label": "Slug",
124
- value: f,
125
- onChange: (e) => p(e.target.value),
126
- required: !0,
127
- "aria-required": "true",
128
- className: "w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary",
129
- placeholder: "acme-automation"
130
- })]
131
- }),
132
- /* @__PURE__ */ a("label", {
133
- className: "space-y-1",
134
- children: [/* @__PURE__ */ i("span", {
135
- className: "text-sm text-text-secondary",
136
- children: "Type"
137
- }), /* @__PURE__ */ a("select", {
138
- "aria-label": "Product type",
139
- value: g,
140
- onChange: (e) => _(e.target.value),
141
- className: "w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary",
142
- children: [
143
- /* @__PURE__ */ i("option", {
144
- value: "APP",
145
- children: "APP"
146
- }),
147
- /* @__PURE__ */ i("option", {
148
- value: "AGENT",
149
- children: "AGENT"
150
- }),
151
- /* @__PURE__ */ i("option", {
152
- value: "NODE",
153
- children: "NODE"
154
- }),
155
- /* @__PURE__ */ i("option", {
156
- value: "WIDGET",
157
- children: "WIDGET"
158
- }),
159
- /* @__PURE__ */ i("option", {
160
- value: "WORKFLOW",
161
- children: "WORKFLOW"
162
- })
163
- ]
164
- })]
165
- }),
166
- /* @__PURE__ */ a("label", {
167
- className: "space-y-1",
168
- children: [/* @__PURE__ */ i("span", {
169
- className: "text-sm text-text-secondary",
170
- children: "Price"
171
- }), /* @__PURE__ */ i("input", {
172
- type: "number",
173
- "aria-label": "Price",
174
- min: "0",
175
- step: "0.01",
176
- value: v,
177
- onChange: (e) => y(e.target.value),
178
- className: "w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary"
179
- })]
180
- })
181
- ]
182
- }),
183
- /* @__PURE__ */ a("label", {
184
- className: "block space-y-1",
185
- children: [/* @__PURE__ */ i("span", {
186
- className: "text-sm text-text-secondary",
187
- children: "Description"
188
- }), /* @__PURE__ */ i("textarea", {
189
- "aria-label": "Description",
190
- value: m,
191
- onChange: (e) => h(e.target.value),
192
- rows: 3,
193
- className: "w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary"
194
- })]
195
- }),
196
- /* @__PURE__ */ a("label", {
197
- className: "block space-y-1",
198
- children: [
199
- /* @__PURE__ */ i("span", {
200
- className: "text-sm text-text-secondary",
201
- children: "Manifest (JSON)"
202
- }),
203
- /* @__PURE__ */ i("textarea", {
204
- "aria-label": "Manifest JSON",
205
- value: b,
206
- onChange: (e) => x(e.target.value),
207
- rows: 16,
208
- required: !0,
209
- "aria-required": "true",
210
- className: "w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 font-mono text-xs text-text-primary"
211
- }),
212
- O.error && /* @__PURE__ */ i("p", {
213
- className: "text-xs text-status-error-text",
214
- children: O.error
215
- })
216
- ]
217
- }),
218
- w && /* @__PURE__ */ i("p", {
219
- role: "alert",
220
- className: "rounded-md bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
221
- children: w
222
- }),
223
- E && /* @__PURE__ */ i("p", {
224
- role: "status",
225
- className: "rounded-md bg-status-success-bg-subtle px-3 py-2 text-sm text-status-success-text",
226
- children: E
227
- }),
228
- /* @__PURE__ */ i("button", {
229
- type: "submit",
230
- disabled: S,
231
- className: "rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text disabled:cursor-not-allowed disabled:opacity-60",
232
- children: S ? "Submitting..." : "Submit Product"
233
- })
234
- ]
235
- })
236
- })
237
- ]
238
- });
239
- };
240
- //#endregion
241
- export { l as PublisherSubmitPage };
242
-
243
- //# sourceMappingURL=PublisherSubmitPage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PublisherSubmitPage.js","names":[],"sources":["../../src/pages/PublisherSubmitPage.tsx"],"sourcesContent":["import { useApolloClient } from '@apollo/client/react';\nimport { useMemo, useState, type FC, type FormEvent } from 'react';\n\nimport { GlassCard, PagePurpose } from '@burdenoff/fe-libs/ui';\nimport { CreateProductForPublisherDocument } from '../generated/global-operations';\n\nconst DEFAULT_MANIFEST = JSON.stringify(\n {\n schemaVersion: '1.0.0',\n itemType: 'app',\n author: { name: 'Publisher Team' },\n compatibility: {\n minVersion: '2026.1.0',\n products: ['workspaces'],\n },\n permissions: ['workspace:read'],\n dependencies: {\n integrations: [],\n },\n },\n null,\n 2\n);\n\nexport const PublisherSubmitPage: FC = () => {\n const client = useApolloClient();\n\n const [name, setName] = useState('');\n const [slug, setSlug] = useState('');\n const [description, setDescription] = useState('');\n const [type, setType] = useState('APP');\n const [price, setPrice] = useState('0');\n const [manifestText, setManifestText] = useState(DEFAULT_MANIFEST);\n const [submitting, setSubmitting] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const [success, setSuccess] = useState<string | null>(null);\n\n const parsedManifest = useMemo(() => {\n try {\n return { value: JSON.parse(manifestText), error: null as string | null };\n } catch {\n return { value: null, error: 'Manifest JSON is invalid.' };\n }\n }, [manifestText]);\n\n const submitProduct = async (event: FormEvent) => {\n event.preventDefault();\n setError(null);\n setSuccess(null);\n\n if (!name.trim()) {\n setError('Product name is required.');\n return;\n }\n if (!slug.trim()) {\n setError('Product slug is required.');\n return;\n }\n if (parsedManifest.error || !parsedManifest.value) {\n setError(parsedManifest.error || 'Manifest JSON is required.');\n return;\n }\n\n const numericPrice = Number(price);\n if (!Number.isFinite(numericPrice) || numericPrice < 0) {\n setError('Price must be a valid non-negative number.');\n return;\n }\n\n setSubmitting(true);\n try {\n const result = await client.mutate<{\n createProduct?: { id: string; slug: string; status: string };\n }>({\n mutation: CreateProductForPublisherDocument,\n variables: {\n input: {\n name: name.trim(),\n slug: slug.trim(),\n type,\n price: numericPrice,\n pricingModel: numericPrice === 0 ? 'FREE' : 'PAID_ONETIME',\n description: description.trim() || undefined,\n manifest: parsedManifest.value,\n },\n },\n });\n\n const created = result.data?.createProduct;\n if (!created) {\n setError('Product creation failed: no product returned by API.');\n return;\n }\n\n setSuccess(`Created ${created.slug} (${created.status})`);\n setName('');\n setSlug('');\n setDescription('');\n } catch (mutationError) {\n const message = mutationError instanceof Error ? mutationError.message : 'Unknown error';\n setError(message);\n } finally {\n setSubmitting(false);\n }\n };\n\n return (\n <main className=\"mx-auto max-w-4xl p-6\">\n <header className=\"mb-6\">\n <h1 className=\"text-2xl font-semibold text-text-primary\">Submit Product</h1>\n <p className=\"mt-1 text-sm text-text-muted\">\n Create a store product with manifest JSON (raw mode).\n </p>\n </header>\n\n <PagePurpose className=\"mb-6\">\n List your own app, agent, node, widget, or workflow on the marketplace so other users can\n discover and install it. Fill in the basics, set a price (use 0 for free), and provide a\n manifest describing what it does and needs. After you submit, it enters review — track it\n from your Submissions page.\n </PagePurpose>\n\n <GlassCard treatment=\"glass\" glow className=\"p-5\">\n <form onSubmit={submitProduct} className=\"space-y-4\" aria-label=\"Submit Product\">\n <div className=\"grid gap-4 md:grid-cols-2\">\n <label className=\"space-y-1\">\n <span className=\"text-sm text-text-secondary\">Product Name</span>\n <input\n aria-label=\"Product Name\"\n value={name}\n onChange={(event) => setName(event.target.value)}\n required\n aria-required=\"true\"\n className=\"w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n placeholder=\"Acme Automation\"\n />\n </label>\n\n <label className=\"space-y-1\">\n <span className=\"text-sm text-text-secondary\">Slug</span>\n <input\n aria-label=\"Slug\"\n value={slug}\n onChange={(event) => setSlug(event.target.value)}\n required\n aria-required=\"true\"\n className=\"w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n placeholder=\"acme-automation\"\n />\n </label>\n\n <label className=\"space-y-1\">\n <span className=\"text-sm text-text-secondary\">Type</span>\n <select\n aria-label=\"Product type\"\n value={type}\n onChange={(event) => setType(event.target.value)}\n className=\"w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n >\n <option value=\"APP\">APP</option>\n <option value=\"AGENT\">AGENT</option>\n <option value=\"NODE\">NODE</option>\n <option value=\"WIDGET\">WIDGET</option>\n <option value=\"WORKFLOW\">WORKFLOW</option>\n </select>\n </label>\n\n <label className=\"space-y-1\">\n <span className=\"text-sm text-text-secondary\">Price</span>\n <input\n type=\"number\"\n aria-label=\"Price\"\n min=\"0\"\n step=\"0.01\"\n value={price}\n onChange={(event) => setPrice(event.target.value)}\n className=\"w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n </label>\n </div>\n\n <label className=\"block space-y-1\">\n <span className=\"text-sm text-text-secondary\">Description</span>\n <textarea\n aria-label=\"Description\"\n value={description}\n onChange={(event) => setDescription(event.target.value)}\n rows={3}\n className=\"w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary\"\n />\n </label>\n\n <label className=\"block space-y-1\">\n <span className=\"text-sm text-text-secondary\">Manifest (JSON)</span>\n <textarea\n aria-label=\"Manifest JSON\"\n value={manifestText}\n onChange={(event) => setManifestText(event.target.value)}\n rows={16}\n required\n aria-required=\"true\"\n className=\"w-full rounded-md border border-border-default bg-bg-surface px-3 py-2 font-mono text-xs text-text-primary\"\n />\n {parsedManifest.error && (\n <p className=\"text-xs text-status-error-text\">{parsedManifest.error}</p>\n )}\n </label>\n\n {error && (\n <p\n role=\"alert\"\n className=\"rounded-md bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text\"\n >\n {error}\n </p>\n )}\n {success && (\n <p\n role=\"status\"\n className=\"rounded-md bg-status-success-bg-subtle px-3 py-2 text-sm text-status-success-text\"\n >\n {success}\n </p>\n )}\n\n <button\n type=\"submit\"\n disabled={submitting}\n className=\"rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text disabled:cursor-not-allowed disabled:opacity-60\"\n >\n {subm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