@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.
@@ -6,77 +6,78 @@ import { ApolloClient as o, InMemoryCache as s, createHttpLink as c, from as l,
6
6
  import { ApolloProvider as d } from "@apollo/client/react";
7
7
  import { setContext as f } from "@apollo/client/link/context";
8
8
  import { PermissionProvider as p } from "@burdenoff/fe-libs/shared/providers/shell";
9
- import { jsx as m } from "react/jsx-runtime";
9
+ import { resolveGatewayUrl as m } from "@burdenoff/fe-libs/shared/graphql";
10
+ import { jsx as h } from "react/jsx-runtime";
10
11
  //#region src/providers/StoreProvider.tsx
11
- function h(e) {
12
+ function g(e) {
12
13
  return e.replace(/^https/, "wss").replace(/^http/, "ws");
13
14
  }
14
- var g = {}, _ = r(null), v = ({ children: r, basePath: i = "/", apiGatewayUrl: v, authToken: y, features: b = g, user: x, currentUser: S, productId: C, productName: w, defaultCompatibleWith: T, ...E }) => {
15
- let D = a(() => ({
16
- ...E,
15
+ var _ = {}, v = r(null), y = ({ children: r, basePath: i = "/", apiGatewayUrl: y, authToken: b, features: x = _, user: S, currentUser: C, productId: w, productName: T, defaultCompatibleWith: E, ...D }) => {
16
+ let O = a(() => ({
17
+ ...D,
17
18
  basePath: i,
18
- apiGatewayUrl: v || "",
19
- authToken: y,
20
- user: x || S,
21
- currentUser: S || x,
22
- productId: C,
23
- productName: w,
24
- defaultCompatibleWith: T,
19
+ apiGatewayUrl: y || "",
20
+ authToken: b,
21
+ user: S || C,
22
+ currentUser: C || S,
23
+ productId: w,
24
+ productName: T,
25
+ defaultCompatibleWith: E,
25
26
  features: {
26
- enablePhysicalProducts: b?.enablePhysicalProducts ?? !0,
27
- enablePublisherPortal: b?.enablePublisherPortal ?? !0,
28
- enableReviews: b?.enableReviews ?? !0,
29
- enableSubscriptions: b?.enableSubscriptions ?? !0
27
+ enablePhysicalProducts: x?.enablePhysicalProducts ?? !0,
28
+ enablePublisherPortal: x?.enablePublisherPortal ?? !0,
29
+ enableReviews: x?.enableReviews ?? !0,
30
+ enableSubscriptions: x?.enableSubscriptions ?? !0
30
31
  }
31
32
  }), [
32
- E,
33
+ D,
33
34
  i,
34
- v,
35
35
  y,
36
- x,
36
+ b,
37
37
  S,
38
38
  C,
39
39
  w,
40
40
  T,
41
- b
41
+ E,
42
+ x
42
43
  ]);
43
- return /* @__PURE__ */ m(d, {
44
+ return /* @__PURE__ */ h(d, {
44
45
  client: a(() => {
45
- let r = c({ uri: v || "/global/graphql" }), i = f((e, t) => ({ headers: {
46
+ let r = m("global", y || void 0), i = c({ uri: r }), a = f((e, t) => ({ headers: {
46
47
  ...t.headers,
47
- ...y ? { authorization: `Bearer ${y}` } : {}
48
+ ...b ? { authorization: `Bearer ${b}` } : {}
48
49
  } }));
49
50
  return new o({
50
51
  link: u(({ query: t }) => {
51
52
  let n = e(t);
52
53
  return n.kind === "OperationDefinition" && n.operation === "subscription";
53
54
  }, new t(n({
54
- url: h(v || "ws://localhost:4000/global/graphql"),
55
- connectionParams: y ? { authorization: `Bearer ${y}` } : {}
56
- })), l([i, r])),
55
+ url: g(r),
56
+ connectionParams: b ? { authorization: `Bearer ${b}` } : {}
57
+ })), l([a, i])),
57
58
  cache: new s(),
58
59
  defaultOptions: {
59
60
  watchQuery: { fetchPolicy: "cache-and-network" },
60
61
  query: { fetchPolicy: "cache-first" }
61
62
  }
62
63
  });
63
- }, [v, y]),
64
- children: /* @__PURE__ */ m(_.Provider, {
65
- value: D,
66
- children: /* @__PURE__ */ m(p, {
67
- scopeId: D.organizationId ?? null,
64
+ }, [y, b]),
65
+ children: /* @__PURE__ */ h(v.Provider, {
66
+ value: O,
67
+ children: /* @__PURE__ */ h(p, {
68
+ scopeId: O.organizationId ?? null,
68
69
  gateway: "global",
69
70
  children: r
70
71
  })
71
72
  })
72
73
  });
73
74
  };
74
- function y() {
75
- let e = i(_);
75
+ function b() {
76
+ let e = i(v);
76
77
  if (!e) throw Error("useStore must be used within StoreProvider");
77
78
  return e;
78
79
  }
79
80
  //#endregion
80
- export { v as StoreProvider, y as useStore };
81
+ export { y as StoreProvider, b as useStore };
81
82
 
82
83
  //# sourceMappingURL=StoreProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StoreProvider.js","names":[],"sources":["../../src/providers/StoreProvider.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { createContext, use, useMemo } from 'react';\nimport { ApolloClient, InMemoryCache, createHttpLink, from, split } from '@apollo/client/core';\nimport { ApolloProvider } from '@apollo/client/react';\nimport { setContext } from '@apollo/client/link/context';\nimport { GraphQLWsLink } from '@apollo/client/link/subscriptions';\nimport { getMainDefinition } from '@apollo/client/utilities';\nimport { createClient as createWsClient } from 'graphql-ws';\nimport { PermissionProvider } from '@burdenoff/fe-libs/shared/providers/shell';\nimport type { StoreRootProps, User } from '../types';\n\nfunction toWsUrl(httpUrl: string): string {\n return httpUrl.replace(/^https/, 'wss').replace(/^http/, 'ws');\n}\n\nconst EMPTY_FEATURES: StoreRootProps['features'] = {};\n\n/**\n * Store context value\n */\ninterface StoreContextValue extends Omit<StoreRootProps, 'children'> {\n basePath: string;\n apiGatewayUrl: string;\n authToken?: string;\n user?: User;\n productId?: string;\n productName?: string;\n defaultCompatibleWith?: string;\n features: {\n enablePhysicalProducts: boolean;\n enablePublisherPortal: boolean;\n enableReviews: boolean;\n enableSubscriptions: boolean;\n };\n}\n\n/**\n * Store context\n */\nconst StoreContext = createContext<StoreContextValue | null>(null);\n\n/**\n * Props for StoreProvider\n */\ninterface StoreProviderProps extends StoreRootProps {\n children: ReactNode;\n}\n\n/**\n * StoreProvider component\n *\n * Provides store context to all child components.\n */\nexport const StoreProvider: FC<StoreProviderProps> = ({\n children,\n basePath = '/',\n apiGatewayUrl,\n authToken,\n features = EMPTY_FEATURES,\n user,\n currentUser,\n productId,\n productName,\n defaultCompatibleWith,\n ...props\n}) => {\n const value = useMemo<StoreContextValue>(\n () => ({\n ...props,\n basePath,\n apiGatewayUrl: apiGatewayUrl || '',\n authToken,\n user: user || currentUser,\n currentUser: currentUser || user,\n productId,\n productName,\n defaultCompatibleWith,\n features: {\n enablePhysicalProducts: features?.enablePhysicalProducts ?? true,\n enablePublisherPortal: features?.enablePublisherPortal ?? true,\n enableReviews: features?.enableReviews ?? true,\n enableSubscriptions: features?.enableSubscriptions ?? true,\n },\n }),\n [\n props,\n basePath,\n apiGatewayUrl,\n authToken,\n user,\n currentUser,\n productId,\n productName,\n defaultCompatibleWith,\n features,\n ]\n );\n\n const storeApolloClient = useMemo(() => {\n const httpLink = createHttpLink({ uri: apiGatewayUrl || '/global/graphql' });\n\n const authLink = setContext((_, prevContext) => ({\n headers: {\n ...(prevContext.headers as Record<string, string> | undefined),\n ...(authToken ? { authorization: `Bearer ${authToken}` } : {}),\n },\n }));\n\n const wsLink = new GraphQLWsLink(\n createWsClient({\n url: toWsUrl(apiGatewayUrl || 'ws://localhost:4000/global/graphql'),\n connectionParams: authToken ? { authorization: `Bearer ${authToken}` } : {},\n })\n );\n\n const splitLink = split(\n ({ query }) => {\n const definition = getMainDefinition(query);\n return definition.kind === 'OperationDefinition' && definition.operation === 'subscription';\n },\n wsLink,\n from([authLink, httpLink])\n );\n\n return new ApolloClient({\n link: splitLink,\n cache: new InMemoryCache(),\n defaultOptions: {\n watchQuery: { fetchPolicy: 'cache-and-network' },\n query: { fetchPolicy: 'cache-first' },\n },\n });\n }, [apiGatewayUrl, authToken]);\n\n return (\n <ApolloProvider client={storeApolloClient}>\n <StoreContext.Provider value={value}>\n <PermissionProvider scopeId={value.organizationId ?? null} gateway=\"global\">\n {children}\n </PermissionProvider>\n </StoreContext.Provider>\n </ApolloProvider>\n );\n};\n\n/**\n * Hook to use store context\n */\nexport function useStore(): StoreContextValue {\n const context = use(StoreContext);\n\n if (!context) {\n throw new Error('useStore must be used within StoreProvider');\n }\n\n return context;\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAS,EAAQ,GAAyB;A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AAC,EAAa,UAAd;GAA8B;aAC5B,kBAAC,GAAD;IAAoB,SAAS,EAAM,kBAAkB;IAAM,SAAQ;IAChE;IACkB,CAAA;GACC,CAAA;EACT,CAAA;;AAOrB,SAAgB,IAA8B;CAC5C,IAAM,IAAU,EAAI,EAAa;AAEjC,KAAI,CAAC,EACH,OAAU,MAAM,6CAA6C;AAG/D,QAAO"}
1
+ {"version":3,"file":"StoreProvider.js","names":[],"sources":["../../src/providers/StoreProvider.tsx"],"sourcesContent":["import type { FC, ReactNode } from 'react';\nimport { createContext, use, useMemo } from 'react';\nimport { ApolloClient, InMemoryCache, createHttpLink, from, split } from '@apollo/client/core';\nimport { ApolloProvider } from '@apollo/client/react';\nimport { setContext } from '@apollo/client/link/context';\nimport { GraphQLWsLink } from '@apollo/client/link/subscriptions';\nimport { getMainDefinition } from '@apollo/client/utilities';\nimport { createClient as createWsClient } from 'graphql-ws';\nimport { PermissionProvider } from '@burdenoff/fe-libs/shared/providers/shell';\nimport { resolveGatewayUrl } from '@burdenoff/fe-libs/shared/graphql';\nimport type { StoreRootProps, User } from '../types';\n\nfunction toWsUrl(httpUrl: string): string {\n return httpUrl.replace(/^https/, 'wss').replace(/^http/, 'ws');\n}\n\nconst EMPTY_FEATURES: StoreRootProps['features'] = {};\n\n/**\n * Store context value\n */\ninterface StoreContextValue extends Omit<StoreRootProps, 'children'> {\n basePath: string;\n apiGatewayUrl: string;\n authToken?: string;\n user?: User;\n productId?: string;\n productName?: string;\n defaultCompatibleWith?: string;\n features: {\n enablePhysicalProducts: boolean;\n enablePublisherPortal: boolean;\n enableReviews: boolean;\n enableSubscriptions: boolean;\n };\n}\n\n/**\n * Store context\n */\nconst StoreContext = createContext<StoreContextValue | null>(null);\n\n/**\n * Props for StoreProvider\n */\ninterface StoreProviderProps extends StoreRootProps {\n children: ReactNode;\n}\n\n/**\n * StoreProvider component\n *\n * Provides store context to all child components.\n */\nexport const StoreProvider: FC<StoreProviderProps> = ({\n children,\n basePath = '/',\n apiGatewayUrl,\n authToken,\n features = EMPTY_FEATURES,\n user,\n currentUser,\n productId,\n productName,\n defaultCompatibleWith,\n ...props\n}) => {\n const value = useMemo<StoreContextValue>(\n () => ({\n ...props,\n basePath,\n apiGatewayUrl: apiGatewayUrl || '',\n authToken,\n user: user || currentUser,\n currentUser: currentUser || user,\n productId,\n productName,\n defaultCompatibleWith,\n features: {\n enablePhysicalProducts: features?.enablePhysicalProducts ?? true,\n enablePublisherPortal: features?.enablePublisherPortal ?? true,\n enableReviews: features?.enableReviews ?? true,\n enableSubscriptions: features?.enableSubscriptions ?? true,\n },\n }),\n [\n props,\n basePath,\n apiGatewayUrl,\n authToken,\n user,\n currentUser,\n productId,\n productName,\n defaultCompatibleWith,\n features,\n ]\n );\n\n const storeApolloClient = useMemo(() => {\n // The shell passes a BARE gateway base URL (e.g. https://graphql.burdenoff.com)\n // without the /global/graphql path. Use the shared resolver so the store matches\n // every other global MFE and posts to the correct global subgraph endpoint.\n const httpUri = resolveGatewayUrl('global', apiGatewayUrl || undefined);\n\n const httpLink = createHttpLink({ uri: httpUri });\n\n const authLink = setContext((_, prevContext) => ({\n headers: {\n ...(prevContext.headers as Record<string, string> | undefined),\n ...(authToken ? { authorization: `Bearer ${authToken}` } : {}),\n },\n }));\n\n const wsLink = new GraphQLWsLink(\n createWsClient({\n url: toWsUrl(httpUri),\n connectionParams: authToken ? { authorization: `Bearer ${authToken}` } : {},\n })\n );\n\n const splitLink = split(\n ({ query }) => {\n const definition = getMainDefinition(query);\n return definition.kind === 'OperationDefinition' && definition.operation === 'subscription';\n },\n wsLink,\n from([authLink, httpLink])\n );\n\n return new ApolloClient({\n link: splitLink,\n cache: new InMemoryCache(),\n defaultOptions: {\n watchQuery: { fetchPolicy: 'cache-and-network' },\n query: { fetchPolicy: 'cache-first' },\n },\n });\n }, [apiGatewayUrl, authToken]);\n\n return (\n <ApolloProvider client={storeApolloClient}>\n <StoreContext.Provider value={value}>\n <PermissionProvider scopeId={value.organizationId ?? null} gateway=\"global\">\n {children}\n </PermissionProvider>\n </StoreContext.Provider>\n </ApolloProvider>\n );\n};\n\n/**\n * Hook to use store context\n */\nexport function useStore(): StoreContextValue {\n const context = use(StoreContext);\n\n if (!context) {\n throw new Error('useStore must be used within StoreProvider');\n }\n\n return context;\n}\n"],"mappings":";;;;;;;;;;;AAYA,SAAS,EAAQ,GAAyB;AACxC,QAAO,EAAQ,QAAQ,UAAU,MAAM,CAAC,QAAQ,SAAS,KAAK;;AAGhE,IAAM,IAA6C,EAAE,EAwB/C,IAAe,EAAwC,KAAK,EAcrD,KAAyC,EACpD,aACA,cAAW,KACX,kBACA,cACA,cAAW,GACX,SACA,gBACA,cACA,gBACA,0BACA,GAAG,QACC;CACJ,IAAM,IAAQ,SACL;EACL,GAAG;EACH;EACA,eAAe,KAAiB;EAChC;EACA,MAAM,KAAQ;EACd,aAAa,KAAe;EAC5B;EACA;EACA;EACA,UAAU;GACR,wBAAwB,GAAU,0BAA0B;GAC5D,uBAAuB,GAAU,yBAAyB;GAC1D,eAAe,GAAU,iBAAiB;GAC1C,qBAAqB,GAAU,uBAAuB;GACvD;EACF,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AA2CD,QACE,kBAAC,GAAD;EAAgB,QA1CQ,QAAc;GAItC,IAAM,IAAU,EAAkB,UAAU,KAAiB,KAAA,EAAU,EAEjE,IAAW,EAAe,EAAE,KAAK,GAAS,CAAC,EAE3C,IAAW,GAAY,GAAG,OAAiB,EAC/C,SAAS;IACP,GAAI,EAAY;IAChB,GAAI,IAAY,EAAE,eAAe,UAAU,KAAa,GAAG,EAAE;IAC9D,EACF,EAAE;AAkBH,UAAO,IAAI,EAAa;IACtB,MAVgB,GACf,EAAE,eAAY;KACb,IAAM,IAAa,EAAkB,EAAM;AAC3C,YAAO,EAAW,SAAS,yBAAyB,EAAW,cAAc;OAVlE,IAAI,EACjB,EAAe;KACb,KAAK,EAAQ,EAAQ;KACrB,kBAAkB,IAAY,EAAE,eAAe,UAAU,KAAa,GAAG,EAAE;KAC5E,CAAC,CACH,EAQC,EAAK,CAAC,GAAU,EAAS,CAAC,CAC3B;IAIC,OAAO,IAAI,GAAe;IAC1B,gBAAgB;KACd,YAAY,EAAE,aAAa,qBAAqB;KAChD,OAAO,EAAE,aAAa,eAAe;KACtC;IACF,CAAC;KACD,CAAC,GAAe,EAAU,CAAC;YAI1B,kBAAC,EAAa,UAAd;GAA8B;aAC5B,kBAAC,GAAD;IAAoB,SAAS,EAAM,kBAAkB;IAAM,SAAQ;IAChE;IACkB,CAAA;GACC,CAAA;EACT,CAAA;;AAOrB,SAAgB,IAA8B;CAC5C,IAAM,IAAU,EAAI,EAAa;AAEjC,KAAI,CAAC,EACH,OAAU,MAAM,6CAA6C;AAG/D,QAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-store",
3
- "version": "2026.626.1",
3
+ "version": "2026.703.1",
4
4
  "description": "Store microfrontend for Burdenoff products",
5
5
  "type": "module",
6
6
  "files": [
@@ -1,92 +0,0 @@
1
- import { useProductReviews as e } from "../hooks/useStoreGraphQL.js";
2
- import { useI18n as t } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
3
- import { ArrowLeft as n, Star as r } from "lucide-react";
4
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
- import { useNavigate as o, useParams as s } from "react-router-dom";
6
- import { IllustratedEmptyState as c, PagePurpose as l } from "@burdenoff/fe-libs/ui";
7
- //#region src/pages/ProductReviewsPage.tsx
8
- var u = () => {
9
- let u = o(), { productId: d } = s(), { reviews: f, loading: p, error: m } = e(d ?? ""), { t: h } = t();
10
- return /* @__PURE__ */ a("div", {
11
- className: "flex h-full flex-col",
12
- children: [/* @__PURE__ */ i("header", {
13
- className: "border-b border-border-seam bg-bg-surface px-6 py-4",
14
- children: /* @__PURE__ */ a("div", {
15
- className: "mx-auto flex max-w-4xl items-center gap-3",
16
- children: [/* @__PURE__ */ i("button", {
17
- type: "button",
18
- onClick: () => u(-1),
19
- "aria-label": "Go back",
20
- className: "cursor-pointer rounded-lg p-2 text-text-muted hover:bg-bg-sunken hover:text-text-primary",
21
- children: /* @__PURE__ */ i(n, { className: "size-5" })
22
- }), /* @__PURE__ */ a("div", { children: [/* @__PURE__ */ i("h1", {
23
- className: "text-2xl font-bold text-text-primary",
24
- children: h("pages.productReviews.title", { defaultValue: "Product Reviews" })
25
- }), /* @__PURE__ */ i("p", {
26
- className: "text-sm text-text-muted",
27
- children: h("pages.productReviews.subtitle", { defaultValue: "Moderate and inspect product feedback" })
28
- })] })]
29
- })
30
- }), /* @__PURE__ */ i("main", {
31
- className: "flex-1 overflow-y-auto p-6",
32
- children: /* @__PURE__ */ a("div", {
33
- className: "mx-auto max-w-4xl",
34
- children: [/* @__PURE__ */ i(l, {
35
- className: "mb-4",
36
- children: "Read what customers think of this product in their own words. Use these ratings and comments to gauge quality before installing, spot recurring issues, and — as a moderator — keep an eye on feedback that may need a response or review."
37
- }), p ? /* @__PURE__ */ i("p", {
38
- role: "status",
39
- className: "text-sm text-text-muted",
40
- children: "Loading reviews…"
41
- }) : m ? /* @__PURE__ */ i("p", {
42
- role: "alert",
43
- className: "text-sm text-status-error-text",
44
- children: m.message
45
- }) : f.length === 0 ? /* @__PURE__ */ i(c, {
46
- illustration: "empty-notifications",
47
- title: "No reviews yet",
48
- description: "This product hasn't received any reviews. Once customers leave feedback, it will appear here for you to read and moderate."
49
- }) : /* @__PURE__ */ i("ul", {
50
- className: "space-y-3",
51
- children: f.map((e) => /* @__PURE__ */ a("li", {
52
- className: "rounded-xl border border-border-seam bg-bg-surface p-4 transition-[box-shadow,border-color] hover:border-border-strong hover:shadow-[var(--shadow-pop)]",
53
- children: [
54
- /* @__PURE__ */ a("div", {
55
- className: "flex items-center justify-between",
56
- children: [/* @__PURE__ */ i("p", {
57
- className: "font-medium text-text-primary",
58
- children: e.title || h("pages.productReviews.untitled", { defaultValue: "Untitled review" })
59
- }), /* @__PURE__ */ a("span", {
60
- className: "inline-flex items-center gap-1 text-sm text-text-muted",
61
- children: [
62
- /* @__PURE__ */ i(r, { className: "size-4" }),
63
- " ",
64
- e.rating,
65
- "/5"
66
- ]
67
- })]
68
- }),
69
- /* @__PURE__ */ i("p", {
70
- className: "mt-2 text-sm text-text-muted",
71
- children: e.comment || h("pages.productReviews.noComment", { defaultValue: "No comment provided." })
72
- }),
73
- /* @__PURE__ */ a("p", {
74
- className: "mt-2 text-xs text-text-muted",
75
- children: [
76
- "Status: ",
77
- e.status,
78
- " • Helpful: ",
79
- e.helpful
80
- ]
81
- })
82
- ]
83
- }, e.id))
84
- })]
85
- })
86
- })]
87
- });
88
- };
89
- //#endregion
90
- export { u as ProductReviewsPage };
91
-
92
- //# sourceMappingURL=ProductReviewsPage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProductReviewsPage.js","names":[],"sources":["../../src/pages/ProductReviewsPage.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useNavigate, useParams } from 'react-router-dom';\nimport { ArrowLeft, Star } from 'lucide-react';\nimport { useProductReviews } from '../hooks/useStoreGraphQL';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { PagePurpose, IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\n\nexport const ProductReviewsPage: FC = () => {\n const navigate = useNavigate();\n const { productId } = useParams<{ productId: string }>();\n const { reviews, loading, error } = useProductReviews(productId ?? '');\n const { t } = useI18n();\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-4xl 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.productReviews.title', { defaultValue: 'Product Reviews' })}\n </h1>\n <p className=\"text-sm text-text-muted\">\n {t('pages.productReviews.subtitle', {\n defaultValue: 'Moderate and inspect product feedback',\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-4xl\">\n <PagePurpose className=\"mb-4\">\n Read what customers think of this product in their own words. Use these ratings and\n comments to gauge quality before installing, spot recurring issues, and — as a\n moderator — keep an eye on feedback that may need a response or review.\n </PagePurpose>\n {loading ? (\n <p role=\"status\" className=\"text-sm text-text-muted\">\n Loading reviews…\n </p>\n ) : error ? (\n <p role=\"alert\" className=\"text-sm text-status-error-text\">\n {error.message}\n </p>\n ) : reviews.length === 0 ? (\n <IllustratedEmptyState\n illustration=\"empty-notifications\"\n title=\"No reviews yet\"\n description=\"This product hasn't received any reviews. Once customers leave feedback, it will appear here for you to read and moderate.\"\n />\n ) : (\n <ul className=\"space-y-3\">\n {reviews.map((review) => (\n <li\n key={review.id}\n className=\"rounded-xl border border-border-seam bg-bg-surface p-4 transition-[box-shadow,border-color] hover:border-border-strong hover:shadow-[var(--shadow-pop)]\"\n >\n <div className=\"flex items-center justify-between\">\n <p className=\"font-medium text-text-primary\">\n {review.title ||\n t('pages.productReviews.untitled', { defaultValue: 'Untitled review' })}\n </p>\n <span className=\"inline-flex items-center gap-1 text-sm text-text-muted\">\n <Star className=\"size-4\" /> {review.rating}/5\n </span>\n </div>\n <p className=\"mt-2 text-sm text-text-muted\">\n {review.comment ||\n t('pages.productReviews.noComment', { defaultValue: 'No comment provided.' })}\n </p>\n <p className=\"mt-2 text-xs text-text-muted\">\n Status: {review.status} • Helpful: {review.helpful}\n </p>\n </li>\n ))}\n </ul>\n )}\n </div>\n </main>\n </div>\n );\n};\n"],"mappings":";;;;;;;AAOA,IAAa,UAA+B;CAC1C,IAAM,IAAW,GAAa,EACxB,EAAE,iBAAc,GAAkC,EAClD,EAAE,YAAS,YAAS,aAAU,EAAkB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O,WACN,EAAE,kCAAkC,EAAE,cAAc,wBAAwB,CAAC;QAC7E,CAAA;OACJ,kBAAC,KAAD;QAAG,WAAU;kBAAb;SAA4C;SACjC,EAAO;SAAO;SAAa,EAAO;SACzC;;OACD;QAnBE,EAAO,GAmBT,CACL;KACC,CAAA,CAEH;;GACD,CAAA,CACH"}
@@ -1,195 +0,0 @@
1
- import { useStore as e } from "../providers/StoreProvider.js";
2
- import { useMyPublishedProducts as t } from "../hooks/useStoreGraphQL.js";
3
- import { useMemo as n } from "react";
4
- import { useI18n as r } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
5
- import { ArrowLeft as i, Download as a, LineChart as o, MessageSquare as s, Plus as c, Star as l } from "lucide-react";
6
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
7
- import { useNavigate as f } from "react-router-dom";
8
- import { EmphasisPanel as p, GlassCard as m, IllustratedEmptyState as h, NextSteps as g, PagePurpose as _ } from "@burdenoff/fe-libs/ui";
9
- //#region src/pages/PublisherDashboardPage.tsx
10
- var v = () => {
11
- let v = f(), { basePath: y } = e(), { t: b } = r(), { products: x, loading: S, error: C, refetch: w } = t(), T = n(() => {
12
- let e = x.length;
13
- return {
14
- totalProducts: e,
15
- totalDownloads: x.reduce((e, t) => e + (t.downloads ?? 0), 0),
16
- avgRating: e > 0 ? x.reduce((e, t) => e + (t.rating ?? 0), 0) / e : 0
17
- };
18
- }, [x]);
19
- return /* @__PURE__ */ d("div", {
20
- className: "flex h-full flex-col",
21
- children: [/* @__PURE__ */ u("header", {
22
- className: "border-b border-border-seam bg-bg-surface px-6 py-4",
23
- children: /* @__PURE__ */ d("div", {
24
- className: "mx-auto flex max-w-6xl items-center justify-between",
25
- children: [/* @__PURE__ */ d("div", {
26
- className: "flex items-center gap-3",
27
- children: [/* @__PURE__ */ u("button", {
28
- type: "button",
29
- onClick: () => v(-1),
30
- "aria-label": "Go back",
31
- className: "cursor-pointer rounded-lg p-2 text-text-muted transition-colors hover:bg-bg-sunken hover:text-text-primary",
32
- children: /* @__PURE__ */ u(i, { className: "size-5" })
33
- }), /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("h1", {
34
- className: "text-2xl font-bold text-text-primary",
35
- children: b("pages.publisherDashboard.title", { defaultValue: "Publisher Dashboard" })
36
- }), /* @__PURE__ */ u("p", {
37
- className: "text-sm text-text-muted",
38
- children: b("pages.publisherDashboard.subtitle", { defaultValue: "Manage your published products and performance" })
39
- })] })]
40
- }), /* @__PURE__ */ d("button", {
41
- type: "button",
42
- onClick: () => v(`${y}/publisher/submit`),
43
- className: "inline-flex cursor-pointer items-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-semibold text-action-primary-text",
44
- children: [/* @__PURE__ */ u(c, { className: "size-4" }), "Submit Product"]
45
- })]
46
- })
47
- }), /* @__PURE__ */ u("main", {
48
- className: "flex-1 overflow-y-auto p-6",
49
- children: /* @__PURE__ */ d("div", {
50
- className: "mx-auto max-w-6xl space-y-6",
51
- children: [
52
- /* @__PURE__ */ u(_, { children: "Your home base as a marketplace seller. Track how your published products are performing — downloads, ratings and revenue — submit new products for review, and respond to customer reviews. Use it to decide what to build next and to keep your listings healthy." }),
53
- /* @__PURE__ */ u(g, {
54
- storageKey: "store-publisher-dashboard",
55
- steps: [
56
- {
57
- id: "submit",
58
- label: "Submit a product",
59
- description: "List a new app or tool for review and publishing.",
60
- icon: /* @__PURE__ */ u(c, { className: "size-4" }),
61
- onClick: () => v(`${y}/publisher/submit`),
62
- done: T.totalProducts > 0
63
- },
64
- {
65
- id: "revenue",
66
- label: "Check your earnings",
67
- description: "See revenue and payouts across your products.",
68
- icon: /* @__PURE__ */ u(o, { className: "size-4" }),
69
- onClick: () => v(`${y}/publisher/revenue`)
70
- },
71
- {
72
- id: "track",
73
- label: "Track submission status",
74
- description: "Follow products through the review pipeline.",
75
- onClick: () => v(`${y}/publisher/submissions`)
76
- }
77
- ]
78
- }),
79
- /* @__PURE__ */ d("div", {
80
- className: "grid gap-4 sm:grid-cols-3",
81
- children: [
82
- /* @__PURE__ */ d(m, {
83
- treatment: "metric",
84
- className: "p-4",
85
- children: [/* @__PURE__ */ u("p", {
86
- className: "text-xs uppercase tracking-wide text-text-muted",
87
- children: b("pages.publisherDashboard.totalProducts", { defaultValue: "Published products" })
88
- }), /* @__PURE__ */ u("p", {
89
- className: "mt-2 text-2xl font-bold tabular-nums text-text-primary",
90
- children: T.totalProducts
91
- })]
92
- }),
93
- /* @__PURE__ */ d(m, {
94
- treatment: "metric",
95
- className: "p-4",
96
- children: [/* @__PURE__ */ u("p", {
97
- className: "text-xs uppercase tracking-wide text-text-muted",
98
- children: b("pages.publisherDashboard.totalInstalls", { defaultValue: "Total downloads" })
99
- }), /* @__PURE__ */ u("p", {
100
- className: "mt-2 text-2xl font-bold tabular-nums text-text-primary",
101
- children: T.totalDownloads
102
- })]
103
- }),
104
- /* @__PURE__ */ d(m, {
105
- treatment: "metric",
106
- className: "p-4",
107
- children: [/* @__PURE__ */ u("p", {
108
- className: "text-xs uppercase tracking-wide text-text-muted",
109
- children: b("pages.publisherDashboard.avgRating", { defaultValue: "Average rating" })
110
- }), /* @__PURE__ */ u("p", {
111
- className: "mt-2 text-2xl font-bold tabular-nums text-text-primary",
112
- children: T.avgRating.toFixed(1)
113
- })]
114
- })
115
- ]
116
- }),
117
- /* @__PURE__ */ d(p, { children: [/* @__PURE__ */ d("div", {
118
- className: "mb-4 flex items-center justify-between",
119
- children: [/* @__PURE__ */ u("h2", {
120
- className: "text-lg font-semibold text-text-primary",
121
- children: b("pages.publisherDashboard.yourProducts", { defaultValue: "Your Products" })
122
- }), /* @__PURE__ */ d("button", {
123
- type: "button",
124
- onClick: () => v(`${y}/publisher/revenue`),
125
- className: "inline-flex cursor-pointer items-center gap-1.5 text-sm font-medium text-text-link hover:underline",
126
- children: [/* @__PURE__ */ u(o, { className: "size-4" }), "Revenue"]
127
- })]
128
- }), S ? /* @__PURE__ */ u("p", {
129
- role: "status",
130
- className: "text-sm text-text-muted",
131
- children: b("common.loading", { defaultValue: "Loading..." })
132
- }) : C ? /* @__PURE__ */ d("div", {
133
- role: "alert",
134
- className: "space-y-2",
135
- children: [/* @__PURE__ */ u("p", {
136
- className: "text-sm text-status-error-text",
137
- children: b("pages.publisherDashboard.failedToLoad", { defaultValue: "Failed to load publisher products." })
138
- }), /* @__PURE__ */ u("button", {
139
- type: "button",
140
- onClick: () => w(),
141
- className: "cursor-pointer rounded-lg bg-action-primary-bg px-3 py-1.5 text-xs font-semibold text-action-primary-text",
142
- children: "Retry"
143
- })]
144
- }) : x.length === 0 ? /* @__PURE__ */ u(h, {
145
- illustration: "empty-data",
146
- title: b("pages.publisherDashboard.noProductsTitle", { defaultValue: "No published products yet" }),
147
- description: b("pages.publisherDashboard.noProducts", { defaultValue: "No published products yet. Submit your first product to get started." }),
148
- action: /* @__PURE__ */ d("button", {
149
- type: "button",
150
- onClick: () => v(`${y}/publisher/submit`),
151
- className: "inline-flex cursor-pointer items-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-semibold text-action-primary-text hover:opacity-90",
152
- children: [/* @__PURE__ */ u(c, { className: "size-4" }), "Submit Product"]
153
- })
154
- }) : /* @__PURE__ */ u("ul", {
155
- className: "space-y-3",
156
- children: x.map((e) => /* @__PURE__ */ d("li", {
157
- 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)]",
158
- children: [/* @__PURE__ */ d("button", {
159
- type: "button",
160
- onClick: () => v(`${y}/marketplace/product/${e.id}`),
161
- className: "flex flex-1 cursor-pointer items-center justify-between text-left",
162
- children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("p", {
163
- className: "font-medium text-text-primary",
164
- children: e.name
165
- }), /* @__PURE__ */ u("p", {
166
- className: "text-xs text-text-muted",
167
- children: e.status
168
- })] }), /* @__PURE__ */ d("div", {
169
- className: "flex items-center gap-4 text-xs text-text-muted",
170
- children: [/* @__PURE__ */ d("span", {
171
- className: "inline-flex items-center gap-1",
172
- children: [/* @__PURE__ */ u(l, { className: "size-3.5" }), (e.rating ?? 0).toFixed(1)]
173
- }), /* @__PURE__ */ d("span", {
174
- className: "inline-flex items-center gap-1",
175
- children: [/* @__PURE__ */ u(a, { className: "size-3.5" }), e.downloads]
176
- })]
177
- })]
178
- }), /* @__PURE__ */ d("button", {
179
- type: "button",
180
- onClick: () => v(`${y}/publisher/product/${e.id}/reviews`),
181
- 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",
182
- title: "View reviews",
183
- children: [/* @__PURE__ */ u(s, { className: "size-3.5" }), "Reviews"]
184
- })]
185
- }, e.id))
186
- })] })
187
- ]
188
- })
189
- })]
190
- });
191
- };
192
- //#endregion
193
- export { v as PublisherDashboardPage };
194
-
195
- //# sourceMappingURL=PublisherDashboardPage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PublisherDashboardPage.js","names":[],"sources":["../../src/pages/PublisherDashboardPage.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { useMemo } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { ArrowLeft, Star, Download, Plus, LineChart, 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 NextSteps,\n IllustratedEmptyState,\n} from '@burdenoff/fe-libs/ui';\n\nexport const PublisherDashboardPage: FC = () => {\n const navigate = useNavigate();\n const { basePath } = useStore();\n const { t } = useI18n();\n const { products, loading, error, refetch } = useMyPublishedProducts();\n\n const metrics = useMemo(() => {\n const totalProducts = products.length;\n const totalDownloads = products.reduce((sum, p) => sum + (p.downloads ?? 0), 0);\n const avgRating =\n totalProducts > 0 ? products.reduce((sum, p) => sum + (p.rating ?? 0), 0) / totalProducts : 0;\n return {\n totalProducts,\n totalDownloads,\n avgRating,\n };\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 justify-between\">\n <div className=\"flex 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 transition-colors 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.publisherDashboard.title', { defaultValue: 'Publisher Dashboard' })}\n </h1>\n <p className=\"text-sm text-text-muted\">\n {t('pages.publisherDashboard.subtitle', {\n defaultValue: 'Manage your published products and performance',\n })}\n </p>\n </div>\n </div>\n\n <button\n type=\"button\"\n onClick={() => navigate(`${basePath}/publisher/submit`)}\n className=\"inline-flex cursor-pointer items-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-semibold text-action-primary-text\"\n >\n <Plus className=\"size-4\" />\n Submit Product\n </button>\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 Your home base as a marketplace seller. Track how your published products are performing\n — downloads, ratings and revenue — submit new products for review, and respond to\n customer reviews. Use it to decide what to build next and to keep your listings healthy.\n </PagePurpose>\n\n <NextSteps\n storageKey=\"store-publisher-dashboard\"\n steps={[\n {\n id: 'submit',\n label: 'Submit a product',\n description: 'List a new app or tool for review and publishing.',\n icon: <Plus className=\"size-4\" />,\n onClick: () => navigate(`${basePath}/publisher/submit`),\n done: metrics.totalProducts > 0,\n },\n {\n id: 'revenue',\n label: 'Check your earnings',\n description: 'See revenue and payouts across your products.',\n icon: <LineChart className=\"size-4\" />,\n onClick: () => navigate(`${basePath}/publisher/revenue`),\n },\n {\n id: 'track',\n label: 'Track submission status',\n description: 'Follow products through the review pipeline.',\n onClick: () => navigate(`${basePath}/publisher/submissions`),\n },\n ]}\n />\n\n <div className=\"grid gap-4 sm:grid-cols-3\">\n <GlassCard treatment=\"metric\" className=\"p-4\">\n <p className=\"text-xs uppercase tracking-wide text-text-muted\">\n {t('pages.publisherDashboard.totalProducts', {\n defaultValue: 'Published products',\n })}\n </p>\n <p className=\"mt-2 text-2xl font-bold tabular-nums text-text-primary\">\n {metrics.totalProducts}\n </p>\n </GlassCard>\n <GlassCard treatment=\"metric\" className=\"p-4\">\n <p className=\"text-xs uppercase tracking-wide text-text-muted\">\n {t('pages.publisherDashboard.totalInstalls', { defaultValue: 'Total downloads' })}\n </p>\n <p className=\"mt-2 text-2xl font-bold tabular-nums text-text-primary\">\n {metrics.totalDownloads}\n </p>\n </GlassCard>\n <GlassCard treatment=\"metric\" className=\"p-4\">\n <p className=\"text-xs uppercase tracking-wide text-text-muted\">\n {t('pages.publisherDashboard.avgRating', { defaultValue: 'Average rating' })}\n </p>\n <p className=\"mt-2 text-2xl font-bold tabular-nums text-text-primary\">\n {metrics.avgRating.toFixed(1)}\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.publisherDashboard.yourProducts', { defaultValue: 'Your Products' })}\n </h2>\n <button\n type=\"button\"\n onClick={() => navigate(`${basePath}/publisher/revenue`)}\n className=\"inline-flex cursor-pointer items-center gap-1.5 text-sm font-medium text-text-link hover:underline\"\n >\n <LineChart className=\"size-4\" />\n Revenue\n </button>\n </div>\n\n {loading ? (\n <p role=\"status\" className=\"text-sm text-text-muted\">\n {t('common.loading', { defaultValue: 'Loading...' })}\n </p>\n ) : error ? (\n <div role=\"alert\" className=\"space-y-2\">\n <p className=\"text-sm text-status-error-text\">\n {t('pages.publisherDashboard.failedToLoad', {\n defaultValue: 'Failed to load publisher products.',\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.publisherDashboard.noProductsTitle', {\n defaultValue: 'No published products yet',\n })}\n description={t('pages.publisherDashboard.noProducts', {\n defaultValue:\n 'No published products yet. Submit your first product to get started.',\n })}\n action={\n <button\n type=\"button\"\n onClick={() => navigate(`${basePath}/publisher/submit`)}\n className=\"inline-flex cursor-pointer items-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-semibold text-action-primary-text hover:opacity-90\"\n >\n <Plus className=\"size-4\" />\n Submit Product\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\">{product.status}</p>\n </div>\n <div className=\"flex items-center gap-4 text-xs text-text-muted\">\n <span className=\"inline-flex items-center gap-1\">\n <Star className=\"size-3.5\" />\n {(product.rating ?? 0).toFixed(1)}\n </span>\n <span className=\"inline-flex items-center gap-1\">\n <Download className=\"size-3.5\" />\n {product.downloads}\n </span>\n </div>\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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QAAD;UAAM,WAAU;oBAAhB,CACE,kBAAC,GAAD,EAAM,WAAU,YAAa,CAAA,GAC3B,EAAQ,UAAU,GAAG,QAAQ,EAAE,CAC5B;aACP,kBAAC,QAAD;UAAM,WAAU;oBAAhB,CACE,kBAAC,GAAD,EAAU,WAAU,YAAa,CAAA,EAChC,EAAQ,UACJ;YACH;WACC;WACT,kBAAC,UAAD;QACE,MAAK;QACL,eACE,EAAS,GAAG,EAAS,qBAAqB,EAAQ,GAAG,UAAU;QAEjE,WAAU;QACV,OAAM;kBANR,CAQE,kBAAC,GAAD,EAAe,WAAU,YAAa,CAAA,EAAA,UAE/B;UACN;SAlCE,EAAQ,GAkCV,CACL;MACC,CAAA,CAEO,EAAA,CAAA;KACZ;;GACD,CAAA,CACH"}
@@ -1,142 +0,0 @@
1
- import { useDeveloperEarnings as e } from "../hooks/useStoreGraphQL.js";
2
- import { useMemo as t } from "react";
3
- import { useI18n as n } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
4
- import { ArrowLeft as r, Clock3 as i, TrendingUp as a, Wallet as o } from "lucide-react";
5
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
6
- import { useNavigate as u } from "react-router-dom";
7
- import { EmphasisPanel as d, GlassCard as f, IllustratedEmptyState as p, PagePurpose as m } from "@burdenoff/fe-libs/ui";
8
- //#region src/pages/PublisherRevenuePage.tsx
9
- var h = () => {
10
- let h = u(), { earnings: g, loading: _, error: v, refetch: y } = e(), { t: b } = n(), x = g ?? null, S = x?.currency || "USD", C = t(() => new Intl.NumberFormat(void 0, {
11
- style: "currency",
12
- currency: S,
13
- maximumFractionDigits: 2
14
- }), [S]);
15
- return /* @__PURE__ */ l("div", {
16
- className: "flex h-full flex-col",
17
- children: [/* @__PURE__ */ c("header", {
18
- className: "border-b border-border-seam bg-bg-surface px-6 py-4",
19
- children: /* @__PURE__ */ l("div", {
20
- className: "mx-auto flex max-w-6xl items-center gap-3",
21
- children: [/* @__PURE__ */ c("button", {
22
- type: "button",
23
- onClick: () => h(-1),
24
- "aria-label": "Go back",
25
- className: "cursor-pointer rounded-lg p-2 text-text-muted hover:bg-bg-sunken hover:text-text-primary",
26
- children: /* @__PURE__ */ c(r, { className: "size-5" })
27
- }), /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("h1", {
28
- className: "text-2xl font-bold text-text-primary",
29
- children: b("pages.publisherRevenue.title", { defaultValue: "Revenue" })
30
- }), /* @__PURE__ */ c("p", {
31
- className: "text-sm text-text-muted",
32
- children: b("pages.publisherRevenue.subtitle", { defaultValue: "Track publisher earnings and payouts" })
33
- })] })]
34
- })
35
- }), /* @__PURE__ */ c("main", {
36
- className: "flex-1 overflow-y-auto p-6",
37
- children: /* @__PURE__ */ l("div", {
38
- className: "mx-auto max-w-6xl space-y-6",
39
- children: [/* @__PURE__ */ c(m, { children: "See what your published products are actually earning. Track total and monthly revenue, how many orders came in, and which products sell best — so you know where your income comes from and which listings are worth doubling down on." }), _ ? /* @__PURE__ */ c("p", {
40
- role: "status",
41
- className: "text-sm text-text-muted",
42
- children: "Loading earnings…"
43
- }) : v ? /* @__PURE__ */ l("div", {
44
- role: "alert",
45
- className: "space-y-2 rounded-xl border border-status-error-border bg-status-error-bg-subtle p-6",
46
- children: [/* @__PURE__ */ c("p", {
47
- className: "text-sm text-status-error-text",
48
- children: b("pages.publisherRevenue.failedToLoad", { defaultValue: "Failed to load earnings data." })
49
- }), /* @__PURE__ */ c("button", {
50
- type: "button",
51
- onClick: () => y(),
52
- className: "cursor-pointer rounded-lg bg-action-primary-bg px-3 py-1.5 text-xs font-semibold text-action-primary-text",
53
- children: "Retry"
54
- })]
55
- }) : x ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ l("div", {
56
- className: "grid gap-4 sm:grid-cols-3",
57
- children: [
58
- /* @__PURE__ */ l(f, {
59
- treatment: "metric",
60
- className: "p-4",
61
- children: [/* @__PURE__ */ l("div", {
62
- className: "inline-flex items-center gap-2 text-xs uppercase tracking-wide text-text-muted",
63
- children: [
64
- /* @__PURE__ */ c(o, { className: "size-4" }),
65
- " ",
66
- b("pages.publisherRevenue.totalEarnings", { defaultValue: "Total earnings" })
67
- ]
68
- }), /* @__PURE__ */ c("p", {
69
- className: "mt-2 text-2xl font-bold tabular-nums text-text-primary",
70
- children: C.format(x.totalEarnings)
71
- })]
72
- }),
73
- /* @__PURE__ */ l(f, {
74
- treatment: "metric",
75
- className: "p-4",
76
- children: [/* @__PURE__ */ l("div", {
77
- className: "inline-flex items-center gap-2 text-xs uppercase tracking-wide text-text-muted",
78
- children: [
79
- /* @__PURE__ */ c(i, { className: "size-4" }),
80
- " ",
81
- b("pages.publisherRevenue.monthlyEarnings", { defaultValue: "Monthly earnings" })
82
- ]
83
- }), /* @__PURE__ */ c("p", {
84
- className: "mt-2 text-2xl font-bold tabular-nums text-text-primary",
85
- children: C.format(x.monthlyEarnings)
86
- })]
87
- }),
88
- /* @__PURE__ */ l(f, {
89
- treatment: "metric",
90
- className: "p-4",
91
- children: [/* @__PURE__ */ l("div", {
92
- className: "inline-flex items-center gap-2 text-xs uppercase tracking-wide text-text-muted",
93
- children: [
94
- /* @__PURE__ */ c(a, { className: "size-4" }),
95
- " ",
96
- b("pages.publisherRevenue.monthlyOrders", { defaultValue: "Monthly orders" })
97
- ]
98
- }), /* @__PURE__ */ c("p", {
99
- className: "mt-2 text-2xl font-bold tabular-nums text-text-primary",
100
- children: x.monthlyOrders
101
- })]
102
- })
103
- ]
104
- }), /* @__PURE__ */ l(d, { children: [/* @__PURE__ */ c("h2", {
105
- className: "mb-3 text-lg font-semibold text-text-primary",
106
- children: b("pages.publisherRevenue.topSelling", { defaultValue: "Top Selling Items" })
107
- }), !x.topSellingItems || x.topSellingItems.length === 0 ? /* @__PURE__ */ c("p", {
108
- className: "text-sm text-text-muted",
109
- children: b("pages.publisherRevenue.noSales", { defaultValue: "No product sales found for this period." })
110
- }) : /* @__PURE__ */ c("ul", {
111
- className: "space-y-2",
112
- children: x.topSellingItems.map((e) => /* @__PURE__ */ l("li", {
113
- className: "flex items-center justify-between rounded-lg border border-border-seam bg-bg-surface p-3",
114
- children: [/* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("p", {
115
- className: "text-sm font-medium text-text-primary",
116
- children: e.storeProduct.name
117
- }), /* @__PURE__ */ l("p", {
118
- className: "text-xs text-text-muted",
119
- children: [
120
- e.totalSales,
121
- " total sales • ",
122
- e.monthlySales,
123
- " this period"
124
- ]
125
- })] }), /* @__PURE__ */ c("p", {
126
- className: "text-sm font-semibold text-text-primary",
127
- children: C.format(e.totalEarnings)
128
- })]
129
- }, e.storeProduct.id))
130
- })] })] }) : /* @__PURE__ */ c(p, {
131
- illustration: "empty-data",
132
- title: b("pages.publisherRevenue.noRevenueTitle", { defaultValue: "No revenue data yet" }),
133
- description: b("pages.publisherRevenue.noRevenue", { defaultValue: "No revenue data available yet. Earnings will appear here once your published products start selling." })
134
- })]
135
- })
136
- })]
137
- });
138
- };
139
- //#endregion
140
- export { h as PublisherRevenuePage };
141
-
142
- //# sourceMappingURL=PublisherRevenuePage.js.map