@burdenoff/microfe-store 2026.510.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/README.md +217 -0
  2. package/dist/StoreAdminRoot.d.ts +22 -0
  3. package/dist/StoreAdminRoot.js +23 -0
  4. package/dist/StoreAdminRoot.js.map +1 -0
  5. package/dist/StoreAdminRoutes.d.ts +9 -0
  6. package/dist/StoreAdminRoutes.js +69 -0
  7. package/dist/StoreAdminRoutes.js.map +1 -0
  8. package/dist/StoreRoot.d.ts +31 -0
  9. package/dist/StoreRoot.js +139 -0
  10. package/dist/StoreRoot.js.map +1 -0
  11. package/dist/StoreRoutes.d.ts +12 -0
  12. package/dist/StoreRoutes.js +285 -0
  13. package/dist/StoreRoutes.js.map +1 -0
  14. package/dist/components/InstallAppModal.d.ts +26 -0
  15. package/dist/components/InstallAppModal.js +287 -0
  16. package/dist/components/InstallAppModal.js.map +1 -0
  17. package/dist/components/RouteGuards.d.ts +17 -0
  18. package/dist/components/RouteGuards.js +26 -0
  19. package/dist/components/RouteGuards.js.map +1 -0
  20. package/dist/components/cart/CartDrawer.d.ts +35 -0
  21. package/dist/components/cart/CartDrawer.js +162 -0
  22. package/dist/components/cart/CartDrawer.js.map +1 -0
  23. package/dist/components/index.d.ts +9 -0
  24. package/dist/components/index.js +3 -0
  25. package/dist/components/marketplace/ProductCard.d.ts +18 -0
  26. package/dist/components/marketplace/ProductCard.js +2 -0
  27. package/dist/dev/main.d.ts +1 -0
  28. package/dist/generated/global-operations.d.ts +2012 -0
  29. package/dist/generated/global-operations.js +1444 -0
  30. package/dist/generated/global-operations.js.map +1 -0
  31. package/dist/generated/global-types.d.ts +20856 -0
  32. package/dist/generated/global-types.js +14 -0
  33. package/dist/generated/global-types.js.map +1 -0
  34. package/dist/generated/wspace-operations.d.ts +1 -0
  35. package/dist/generated/wspace-types.d.ts +53362 -0
  36. package/dist/hooks/index.d.ts +12 -0
  37. package/dist/hooks/useBackendCart.d.ts +73 -0
  38. package/dist/hooks/useBackendCart.js +171 -0
  39. package/dist/hooks/useBackendCart.js.map +1 -0
  40. package/dist/hooks/useCart.d.ts +62 -0
  41. package/dist/hooks/useCart.js +90 -0
  42. package/dist/hooks/useCart.js.map +1 -0
  43. package/dist/hooks/useInstallations.d.ts +43 -0
  44. package/dist/hooks/useInstallations.js +140 -0
  45. package/dist/hooks/useInstallations.js.map +1 -0
  46. package/dist/hooks/useOrders.d.ts +40 -0
  47. package/dist/hooks/useOrders.js +73 -0
  48. package/dist/hooks/useOrders.js.map +1 -0
  49. package/dist/hooks/useProductSearch.d.ts +22 -0
  50. package/dist/hooks/useProductSearch.js +59 -0
  51. package/dist/hooks/useProductSearch.js.map +1 -0
  52. package/dist/hooks/useStoreGraphQL.d.ts +475 -0
  53. package/dist/hooks/useStoreGraphQL.js +751 -0
  54. package/dist/hooks/useStoreGraphQL.js.map +1 -0
  55. package/dist/hooks/useStoreGraphQLWithContext.d.ts +48 -0
  56. package/dist/hooks/useStoreGraphQLWithContext.js +39 -0
  57. package/dist/hooks/useStoreGraphQLWithContext.js.map +1 -0
  58. package/dist/hooks/useStorePermissions.d.ts +63 -0
  59. package/dist/hooks/useStorePermissions.js +88 -0
  60. package/dist/hooks/useStorePermissions.js.map +1 -0
  61. package/dist/index.d.ts +44 -0
  62. package/dist/index.js +13 -0
  63. package/dist/pages/AdminDashboardPage.d.ts +3 -0
  64. package/dist/pages/AdminDashboardPage.js +491 -0
  65. package/dist/pages/AdminDashboardPage.js.map +1 -0
  66. package/dist/pages/AdminReviewModerationPage.d.ts +3 -0
  67. package/dist/pages/AdminReviewModerationPage.js +247 -0
  68. package/dist/pages/AdminReviewModerationPage.js.map +1 -0
  69. package/dist/pages/AdminStoresPage.d.ts +3 -0
  70. package/dist/pages/AdminStoresPage.js +442 -0
  71. package/dist/pages/AdminStoresPage.js.map +1 -0
  72. package/dist/pages/AdminSubmissionsQueuePage.d.ts +3 -0
  73. package/dist/pages/AdminSubmissionsQueuePage.js +387 -0
  74. package/dist/pages/AdminSubmissionsQueuePage.js.map +1 -0
  75. package/dist/pages/AppDetailPage.d.ts +3 -0
  76. package/dist/pages/AppDetailPage.js +166 -0
  77. package/dist/pages/AppDetailPage.js.map +1 -0
  78. package/dist/pages/AppSettingsPage.d.ts +3 -0
  79. package/dist/pages/AppSettingsPage.js +100 -0
  80. package/dist/pages/AppSettingsPage.js.map +1 -0
  81. package/dist/pages/CartPage.d.ts +8 -0
  82. package/dist/pages/CartPage.js +259 -0
  83. package/dist/pages/CartPage.js.map +1 -0
  84. package/dist/pages/InstalledAppsPage.d.ts +8 -0
  85. package/dist/pages/InstalledAppsPage.js +290 -0
  86. package/dist/pages/InstalledAppsPage.js.map +1 -0
  87. package/dist/pages/MarketplaceHomePage.d.ts +3 -0
  88. package/dist/pages/MarketplaceHomePage.js +1118 -0
  89. package/dist/pages/MarketplaceHomePage.js.map +1 -0
  90. package/dist/pages/MyLicensesPage.d.ts +3 -0
  91. package/dist/pages/MyLicensesPage.js +146 -0
  92. package/dist/pages/MyLicensesPage.js.map +1 -0
  93. package/dist/pages/OrderConfirmationPage.d.ts +3 -0
  94. package/dist/pages/OrderConfirmationPage.js +178 -0
  95. package/dist/pages/OrderConfirmationPage.js.map +1 -0
  96. package/dist/pages/OrdersPage.d.ts +8 -0
  97. package/dist/pages/OrdersPage.js +358 -0
  98. package/dist/pages/OrdersPage.js.map +1 -0
  99. package/dist/pages/ProductCategoryPage.d.ts +3 -0
  100. package/dist/pages/ProductCategoryPage.js +83 -0
  101. package/dist/pages/ProductCategoryPage.js.map +1 -0
  102. package/dist/pages/ProductDetailPage.d.ts +8 -0
  103. package/dist/pages/ProductDetailPage.js +1205 -0
  104. package/dist/pages/ProductDetailPage.js.map +1 -0
  105. package/dist/pages/ProductReviewsPage.d.ts +3 -0
  106. package/dist/pages/ProductReviewsPage.js +86 -0
  107. package/dist/pages/ProductReviewsPage.js.map +1 -0
  108. package/dist/pages/PublisherDashboardPage.d.ts +3 -0
  109. package/dist/pages/PublisherDashboardPage.js +154 -0
  110. package/dist/pages/PublisherDashboardPage.js.map +1 -0
  111. package/dist/pages/PublisherRevenuePage.d.ts +3 -0
  112. package/dist/pages/PublisherRevenuePage.js +138 -0
  113. package/dist/pages/PublisherRevenuePage.js.map +1 -0
  114. package/dist/pages/PublisherSubmissionsPage.d.ts +3 -0
  115. package/dist/pages/PublisherSubmissionsPage.js +174 -0
  116. package/dist/pages/PublisherSubmissionsPage.js.map +1 -0
  117. package/dist/pages/PublisherSubmitPage.d.ts +3 -0
  118. package/dist/pages/PublisherSubmitPage.js +224 -0
  119. package/dist/pages/PublisherSubmitPage.js.map +1 -0
  120. package/dist/pages/SearchResultsPage.d.ts +3 -0
  121. package/dist/pages/SearchResultsPage.js +125 -0
  122. package/dist/pages/SearchResultsPage.js.map +1 -0
  123. package/dist/pages/StoresPage.d.ts +3 -0
  124. package/dist/pages/StoresPage.js +154 -0
  125. package/dist/pages/StoresPage.js.map +1 -0
  126. package/dist/providers/StoreProvider.d.ts +38 -0
  127. package/dist/providers/StoreProvider.js +51 -0
  128. package/dist/providers/StoreProvider.js.map +1 -0
  129. package/dist/store/storeStore.d.ts +69 -0
  130. package/dist/store/storeStore.js +68 -0
  131. package/dist/store/storeStore.js.map +1 -0
  132. package/dist/translations/en.d.ts +518 -0
  133. package/dist/translations/en.js +514 -0
  134. package/dist/translations/en.js.map +1 -0
  135. package/dist/types/index.d.ts +575 -0
  136. package/dist/utils/index.d.ts +67 -0
  137. package/dist/utils/index.js +114 -0
  138. package/dist/utils/index.js.map +1 -0
  139. package/dist/utils/nativeBridge.d.ts +2 -0
  140. package/dist/utils/nativeBridge.js +2 -0
  141. package/package.json +105 -0
@@ -0,0 +1,1205 @@
1
+ import { useStore as e } from "../providers/StoreProvider.js";
2
+ import { useCart as t } from "../hooks/useCart.js";
3
+ import { formatNumber as n, formatPrice as r } from "../utils/index.js";
4
+ import { useCreateReview as ee, useDeleteReview as te, useMarkReviewHelpful as ne, useStoreProductDetails as re, useUpdateReview as ie } from "../hooks/useStoreGraphQL.js";
5
+ import { nativeConfirm as ae, nativeImpact as oe, nativeNotify as i } from "../utils/nativeBridge.js";
6
+ import { InstallAppModal as se } from "../components/InstallAppModal.js";
7
+ import "../components/index.js";
8
+ import { useCallback as a, useEffect as ce, useState as o } from "react";
9
+ import { AlertCircle as s, ArrowLeft as le, Check as ue, Loader2 as c, Package as de, ShieldCheck as l, ShoppingCart as fe, Star as u, ThumbsUp as d } from "lucide-react";
10
+ import { Fragment as pe, jsx as f, jsxs as p } from "react/jsx-runtime";
11
+ import { useNavigate as me, useParams as he } from "react-router-dom";
12
+ import { useEventBus as ge } from "@burdenoff/fe-libs/shared/events";
13
+ //#region src/pages/ProductDetailPage.tsx
14
+ var _e = (e, t) => ({
15
+ id: e.id,
16
+ publisherId: t?.id || "",
17
+ publisher: {
18
+ id: t?.id || "",
19
+ name: t?.name || e.authorName || "Unknown",
20
+ displayName: t?.name || e.authorName || "Unknown",
21
+ email: t?.email || "",
22
+ verified: t?.isVerified || !1,
23
+ totalProducts: 0,
24
+ totalDownloads: 0,
25
+ averageRating: 0,
26
+ joinedAt: t?.createdAt || e.createdAt,
27
+ website: t?.websiteUrl,
28
+ logoUrl: t?.logoUrl
29
+ },
30
+ name: e.name,
31
+ slug: e.slug || e.id,
32
+ displayName: e.name,
33
+ description: e.longDescription || e.description || "",
34
+ shortDescription: e.description || "",
35
+ iconUrl: e.icon,
36
+ screenshotUrls: e.screenshots || [],
37
+ videoUrls: e.videoUrls || [],
38
+ itemType: ((e, t) => e === "PHYSICAL" ? "PHYSICAL" : {
39
+ APP: "APP",
40
+ BOTAPP: "APP",
41
+ AGENT: "APP",
42
+ WORKFLOW: "WORKFLOW",
43
+ TEMPLATE: "TEMPLATE",
44
+ INTEGRATION: "INTEGRATION",
45
+ EXTENSION: "EXTENSION",
46
+ THEME: "THEME"
47
+ }[t] || "APP")(e.nature, e.type),
48
+ type: ((e) => ({
49
+ APP: "STANDALONE_APP",
50
+ BOTAPP: "STANDALONE_APP",
51
+ AGENT: "STANDALONE_APP",
52
+ WORKFLOW: "WORKFLOW_TEMPLATE",
53
+ TEMPLATE: "WORKFLOW_TEMPLATE",
54
+ INTEGRATION: "API_INTEGRATION",
55
+ EXTENSION: "BROWSER_EXTENSION",
56
+ THEME: "UI_THEME",
57
+ PLUGIN: "WORKSPACE_MODULE",
58
+ COMPONENT: "WORKSPACE_MODULE",
59
+ WIDGET: "WORKSPACE_MODULE",
60
+ VIBEMODULE: "WORKSPACE_MODULE",
61
+ CONSOLE: "STANDALONE_APP",
62
+ NODE: "WORKSPACE_MODULE"
63
+ })[e] || "STANDALONE_APP")(e.type),
64
+ tags: e.tags || [],
65
+ pricingModel: ((e) => ({
66
+ FREE: "FREE",
67
+ PAID_ONETIME: "ONE_TIME",
68
+ SUBSCRIPTION: "SUBSCRIPTION",
69
+ USAGE_BASED: "USAGE_BASED",
70
+ FREEMIUM: "FREEMIUM"
71
+ })[e] || "ONE_TIME")(e.pricingModel),
72
+ basePrice: e.price,
73
+ currency: e.currency || "USD",
74
+ variants: [],
75
+ status: e.status || "PUBLISHED",
76
+ featured: e.featured,
77
+ verified: t?.isVerified || !1,
78
+ downloadCount: e.downloads,
79
+ installCount: e.downloads,
80
+ orderCount: 0,
81
+ averageRating: e.rating || 0,
82
+ reviewCount: e.reviewCount,
83
+ createdAt: e.createdAt,
84
+ updatedAt: e.updatedAt,
85
+ publishedAt: e.publishedAt
86
+ }), ve = ({ stars: e, percentage: t, count: r }) => /* @__PURE__ */ p("div", {
87
+ className: "flex items-center gap-2",
88
+ children: [
89
+ /* @__PURE__ */ f("span", {
90
+ className: "w-3 text-xs text-text-muted",
91
+ children: e
92
+ }),
93
+ /* @__PURE__ */ f("div", {
94
+ className: "h-2 flex-1 overflow-hidden rounded-full bg-bg-sunken",
95
+ children: /* @__PURE__ */ f("div", {
96
+ className: "h-full rounded-full bg-status-warning-bg-subtle",
97
+ style: { width: `${t}%` }
98
+ })
99
+ }),
100
+ /* @__PURE__ */ f("span", {
101
+ className: "w-12 text-right text-xs text-text-muted",
102
+ children: n(r)
103
+ })
104
+ ]
105
+ }), ye = ({ review: e, onMarkHelpful: t, markingHelpful: n }) => /* @__PURE__ */ p("div", {
106
+ className: "rounded-lg border border-border-default bg-bg-surface p-4",
107
+ children: [
108
+ /* @__PURE__ */ f("div", {
109
+ className: "mb-3 flex items-start justify-between",
110
+ children: /* @__PURE__ */ p("div", {
111
+ className: "flex items-center gap-3",
112
+ children: [/* @__PURE__ */ f("div", {
113
+ className: "flex h-10 w-10 items-center justify-center rounded-full bg-bg-sunken text-text-muted",
114
+ children: e.userId.charAt(0).toUpperCase()
115
+ }), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ p("p", {
116
+ className: "font-medium text-text-primary",
117
+ children: ["User ", e.userId.slice(0, 8)]
118
+ }), /* @__PURE__ */ p("div", {
119
+ className: "flex items-center gap-2",
120
+ children: [/* @__PURE__ */ f("div", {
121
+ className: "flex gap-0.5",
122
+ children: [
123
+ 1,
124
+ 2,
125
+ 3,
126
+ 4,
127
+ 5
128
+ ].map((t) => /* @__PURE__ */ f(u, { className: `h-3 w-3 ${t <= e.rating ? "fill-current text-status-warning-text" : "text-text-muted"}` }, t))
129
+ }), /* @__PURE__ */ f("span", {
130
+ className: "text-xs text-text-muted",
131
+ children: ((e) => {
132
+ try {
133
+ return new Date(e).toLocaleDateString("en-US", {
134
+ year: "numeric",
135
+ month: "short",
136
+ day: "numeric"
137
+ });
138
+ } catch {
139
+ return e;
140
+ }
141
+ })(e.createdAt)
142
+ })]
143
+ })] })]
144
+ })
145
+ }),
146
+ e.title && /* @__PURE__ */ f("h4", {
147
+ className: "mb-2 font-medium text-text-primary",
148
+ children: e.title
149
+ }),
150
+ e.comment && /* @__PURE__ */ f("p", {
151
+ className: "mb-3 text-sm text-text-muted",
152
+ children: e.comment
153
+ }),
154
+ /* @__PURE__ */ f("div", {
155
+ className: "flex items-center justify-between",
156
+ children: /* @__PURE__ */ p("button", {
157
+ type: "button",
158
+ onClick: () => t(e.id),
159
+ disabled: n,
160
+ "aria-label": `Mark review from ${e.userId} as helpful`,
161
+ className: "flex items-center gap-1 text-xs text-text-muted transition-colors hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-60",
162
+ children: [/* @__PURE__ */ f(d, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ f("span", { children: n ? "Updating…" : `Helpful (${e.helpful})` })]
163
+ })
164
+ })
165
+ ]
166
+ }), be = () => /* @__PURE__ */ p("div", {
167
+ className: "h-full overflow-y-auto",
168
+ children: [/* @__PURE__ */ f("div", {
169
+ className: "sticky top-0 z-10 border-b border-border-default bg-bg-surface px-6 py-4",
170
+ children: /* @__PURE__ */ p("div", {
171
+ className: "flex items-center gap-4",
172
+ children: [
173
+ /* @__PURE__ */ f("div", { className: "h-10 w-10 animate-pulse rounded-lg bg-bg-sunken" }),
174
+ /* @__PURE__ */ f("div", { className: "h-6 w-48 flex-1 animate-pulse rounded bg-bg-sunken" }),
175
+ /* @__PURE__ */ p("div", {
176
+ className: "flex gap-2",
177
+ children: [/* @__PURE__ */ f("div", { className: "h-10 w-10 animate-pulse rounded-lg bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "h-10 w-10 animate-pulse rounded-lg bg-bg-sunken" })]
178
+ })
179
+ ]
180
+ })
181
+ }), /* @__PURE__ */ p("div", {
182
+ className: "mx-auto max-w-6xl px-6 py-6",
183
+ children: [
184
+ /* @__PURE__ */ p("div", {
185
+ className: "mb-8 flex flex-col gap-6 md:flex-row",
186
+ children: [/* @__PURE__ */ p("div", {
187
+ className: "flex gap-4 md:w-1/2",
188
+ children: [/* @__PURE__ */ f("div", { className: "h-28 w-28 animate-pulse rounded-2xl bg-bg-sunken" }), /* @__PURE__ */ p("div", {
189
+ className: "flex flex-1 flex-col justify-center gap-2",
190
+ children: [
191
+ /* @__PURE__ */ f("div", { className: "h-8 w-3/4 animate-pulse rounded bg-bg-sunken" }),
192
+ /* @__PURE__ */ p("div", {
193
+ className: "flex items-center gap-2",
194
+ children: [/* @__PURE__ */ f("div", { className: "h-4 w-32 animate-pulse rounded bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "h-4 w-4 animate-pulse rounded-full bg-bg-sunken" })]
195
+ }),
196
+ /* @__PURE__ */ p("div", {
197
+ className: "flex gap-3",
198
+ children: [/* @__PURE__ */ f("div", { className: "h-5 w-16 animate-pulse rounded bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "h-5 w-24 animate-pulse rounded bg-bg-sunken" })]
199
+ })
200
+ ]
201
+ })]
202
+ }), /* @__PURE__ */ p("div", {
203
+ className: "flex flex-col gap-4 md:w-1/2 md:items-end",
204
+ children: [/* @__PURE__ */ p("div", {
205
+ className: "flex items-center gap-4",
206
+ children: [
207
+ /* @__PURE__ */ p("div", {
208
+ className: "text-center",
209
+ children: [/* @__PURE__ */ f("div", { className: "h-10 w-16 animate-pulse rounded bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "mt-1 h-3 w-20 animate-pulse rounded bg-bg-sunken" })]
210
+ }),
211
+ /* @__PURE__ */ f("div", { className: "h-12 w-px bg-border-default" }),
212
+ /* @__PURE__ */ p("div", {
213
+ className: "text-center",
214
+ children: [/* @__PURE__ */ f("div", { className: "h-8 w-16 animate-pulse rounded bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "mt-1 h-3 w-16 animate-pulse rounded bg-bg-sunken" })]
215
+ }),
216
+ /* @__PURE__ */ f("div", { className: "h-12 w-px bg-border-default" }),
217
+ /* @__PURE__ */ p("div", {
218
+ className: "text-center",
219
+ children: [/* @__PURE__ */ f("div", { className: "h-8 w-20 animate-pulse rounded bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "mt-1 h-3 w-12 animate-pulse rounded bg-bg-sunken" })]
220
+ })
221
+ ]
222
+ }), /* @__PURE__ */ p("div", {
223
+ className: "flex gap-3",
224
+ children: [/* @__PURE__ */ f("div", { className: "h-12 w-40 animate-pulse rounded-lg bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "h-12 w-12 animate-pulse rounded-lg bg-bg-sunken" })]
225
+ })]
226
+ })]
227
+ }),
228
+ /* @__PURE__ */ p("section", {
229
+ className: "mb-8",
230
+ children: [/* @__PURE__ */ f("div", { className: "aspect-video animate-pulse rounded-lg bg-bg-sunken" }), /* @__PURE__ */ f("div", {
231
+ className: "mt-4 flex gap-4",
232
+ children: [...[
233
+ ,
234
+ ,
235
+ ,
236
+ ,
237
+ ]].map((e, t) => /* @__PURE__ */ f("div", { className: "h-20 w-36 animate-pulse rounded-lg bg-bg-sunken" }, t))
238
+ })]
239
+ }),
240
+ /* @__PURE__ */ p("section", {
241
+ className: "mb-8",
242
+ children: [/* @__PURE__ */ p("div", {
243
+ className: "mb-4 flex items-center gap-2",
244
+ children: [/* @__PURE__ */ f("div", { className: "h-5 w-5 animate-pulse rounded bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "h-6 w-32 animate-pulse rounded bg-bg-sunken" })]
245
+ }), /* @__PURE__ */ p("div", {
246
+ className: "animate-pulse rounded-lg border border-border-default bg-bg-surface p-4",
247
+ children: [/* @__PURE__ */ p("div", {
248
+ className: "space-y-2",
249
+ children: [
250
+ /* @__PURE__ */ f("div", { className: "h-4 w-full rounded bg-bg-sunken" }),
251
+ /* @__PURE__ */ f("div", { className: "h-4 w-full rounded bg-bg-sunken" }),
252
+ /* @__PURE__ */ f("div", { className: "h-4 w-3/4 rounded bg-bg-sunken" }),
253
+ /* @__PURE__ */ f("div", { className: "h-4 w-5/6 rounded bg-bg-sunken" })
254
+ ]
255
+ }), /* @__PURE__ */ f("div", {
256
+ className: "mt-4 flex gap-2",
257
+ children: [...[
258
+ ,
259
+ ,
260
+ ,
261
+ ,
262
+ ]].map((e, t) => /* @__PURE__ */ f("div", { className: "h-6 w-16 rounded-full bg-bg-sunken" }, t))
263
+ })]
264
+ })]
265
+ }),
266
+ /* @__PURE__ */ p("section", {
267
+ className: "mb-8",
268
+ children: [
269
+ /* @__PURE__ */ p("div", {
270
+ className: "mb-4 flex items-center justify-between",
271
+ children: [/* @__PURE__ */ p("div", {
272
+ className: "flex items-center gap-2",
273
+ children: [/* @__PURE__ */ f("div", { className: "h-5 w-5 animate-pulse rounded bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "h-6 w-40 animate-pulse rounded bg-bg-sunken" })]
274
+ }), /* @__PURE__ */ f("div", { className: "h-4 w-16 animate-pulse rounded bg-bg-sunken" })]
275
+ }),
276
+ /* @__PURE__ */ p("div", {
277
+ className: "mb-6 flex flex-col gap-6 md:flex-row",
278
+ children: [/* @__PURE__ */ f("div", {
279
+ className: "animate-pulse rounded-lg border border-border-default bg-bg-surface p-4 md:w-64",
280
+ children: /* @__PURE__ */ p("div", {
281
+ className: "flex items-center gap-6",
282
+ children: [/* @__PURE__ */ p("div", {
283
+ className: "text-center",
284
+ children: [
285
+ /* @__PURE__ */ f("div", { className: "h-12 w-16 rounded bg-bg-sunken" }),
286
+ /* @__PURE__ */ f("div", {
287
+ className: "my-1 flex justify-center gap-0.5",
288
+ children: [...[
289
+ ,
290
+ ,
291
+ ,
292
+ ,
293
+ ,
294
+ ]].map((e, t) => /* @__PURE__ */ f("div", { className: "h-4 w-4 rounded bg-bg-sunken" }, t))
295
+ }),
296
+ /* @__PURE__ */ f("div", { className: "h-3 w-20 rounded bg-bg-sunken" })
297
+ ]
298
+ }), /* @__PURE__ */ f("div", {
299
+ className: "flex-1 space-y-1",
300
+ children: [...[
301
+ ,
302
+ ,
303
+ ,
304
+ ,
305
+ ,
306
+ ]].map((e, t) => /* @__PURE__ */ p("div", {
307
+ className: "flex items-center gap-2",
308
+ children: [
309
+ /* @__PURE__ */ f("div", { className: "h-2 w-3 rounded bg-bg-sunken" }),
310
+ /* @__PURE__ */ f("div", { className: "h-2 flex-1 rounded-full bg-bg-sunken" }),
311
+ /* @__PURE__ */ f("div", { className: "h-2 w-8 rounded bg-bg-sunken" })
312
+ ]
313
+ }, t))
314
+ })]
315
+ })
316
+ }), /* @__PURE__ */ f("div", { className: "h-12 w-32 animate-pulse rounded-lg bg-bg-sunken" })]
317
+ }),
318
+ /* @__PURE__ */ f("div", {
319
+ className: "space-y-4",
320
+ children: [...[, ,]].map((e, t) => /* @__PURE__ */ p("div", {
321
+ className: "animate-pulse rounded-lg border border-border-default bg-bg-surface p-4",
322
+ children: [/* @__PURE__ */ p("div", {
323
+ className: "mb-3 flex items-start gap-3",
324
+ children: [/* @__PURE__ */ f("div", { className: "h-10 w-10 rounded-full bg-bg-sunken" }), /* @__PURE__ */ p("div", {
325
+ className: "flex-1",
326
+ children: [/* @__PURE__ */ f("div", { className: "h-4 w-32 rounded bg-bg-sunken" }), /* @__PURE__ */ p("div", {
327
+ className: "mt-1 flex items-center gap-2",
328
+ children: [/* @__PURE__ */ f("div", {
329
+ className: "flex gap-0.5",
330
+ children: [...[
331
+ ,
332
+ ,
333
+ ,
334
+ ,
335
+ ,
336
+ ]].map((e, t) => /* @__PURE__ */ f("div", { className: "h-3 w-3 rounded bg-bg-sunken" }, t))
337
+ }), /* @__PURE__ */ f("div", { className: "h-3 w-20 rounded bg-bg-sunken" })]
338
+ })]
339
+ })]
340
+ }), /* @__PURE__ */ p("div", {
341
+ className: "space-y-2",
342
+ children: [/* @__PURE__ */ f("div", { className: "h-4 w-full rounded bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "h-4 w-2/3 rounded bg-bg-sunken" })]
343
+ })]
344
+ }, t))
345
+ })
346
+ ]
347
+ }),
348
+ /* @__PURE__ */ p("section", {
349
+ className: "mb-8",
350
+ children: [/* @__PURE__ */ p("div", {
351
+ className: "mb-4 flex items-center gap-2",
352
+ children: [/* @__PURE__ */ f("div", { className: "h-5 w-5 animate-pulse rounded bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "h-6 w-48 animate-pulse rounded bg-bg-sunken" })]
353
+ }), /* @__PURE__ */ f("div", {
354
+ className: "animate-pulse rounded-lg border border-border-default bg-bg-surface p-4",
355
+ children: /* @__PURE__ */ f("div", {
356
+ className: "grid gap-4 md:grid-cols-2",
357
+ children: [...[
358
+ ,
359
+ ,
360
+ ,
361
+ ,
362
+ ,
363
+ ,
364
+ ]].map((e, t) => /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("div", { className: "h-3 w-16 rounded bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "mt-1 h-5 w-24 rounded bg-bg-sunken" })] }, t))
365
+ })
366
+ })]
367
+ }),
368
+ /* @__PURE__ */ p("section", {
369
+ className: "mb-8",
370
+ children: [/* @__PURE__ */ p("div", {
371
+ className: "mb-4 flex items-center justify-between",
372
+ children: [/* @__PURE__ */ p("div", {
373
+ className: "flex items-center gap-2",
374
+ children: [/* @__PURE__ */ f("div", { className: "h-5 w-5 animate-pulse rounded bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "h-6 w-40 animate-pulse rounded bg-bg-sunken" })]
375
+ }), /* @__PURE__ */ f("div", { className: "h-4 w-16 animate-pulse rounded bg-bg-sunken" })]
376
+ }), /* @__PURE__ */ f("div", {
377
+ className: "grid gap-4 md:grid-cols-4",
378
+ children: [...[
379
+ ,
380
+ ,
381
+ ,
382
+ ,
383
+ ]].map((e, t) => /* @__PURE__ */ f("div", {
384
+ className: "animate-pulse rounded-lg border border-border-default bg-bg-surface p-3",
385
+ children: /* @__PURE__ */ p("div", {
386
+ className: "flex items-center gap-3",
387
+ children: [/* @__PURE__ */ f("div", { className: "h-14 w-14 rounded-xl bg-bg-sunken" }), /* @__PURE__ */ p("div", {
388
+ className: "flex-1",
389
+ children: [
390
+ /* @__PURE__ */ f("div", { className: "h-4 w-24 rounded bg-bg-sunken" }),
391
+ /* @__PURE__ */ f("div", { className: "mt-1 h-3 w-16 rounded bg-bg-sunken" }),
392
+ /* @__PURE__ */ p("div", {
393
+ className: "mt-1 flex items-center gap-2",
394
+ children: [/* @__PURE__ */ f("div", { className: "h-3 w-8 rounded bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "h-3 w-12 rounded bg-bg-sunken" })]
395
+ })
396
+ ]
397
+ })]
398
+ })
399
+ }, t))
400
+ })]
401
+ }),
402
+ /* @__PURE__ */ p("section", {
403
+ className: "mb-8",
404
+ children: [/* @__PURE__ */ f("div", { className: "mb-4 h-6 w-36 animate-pulse rounded bg-bg-sunken" }), /* @__PURE__ */ p("div", {
405
+ className: "animate-pulse rounded-lg border border-border-default bg-bg-surface p-4",
406
+ children: [/* @__PURE__ */ p("div", {
407
+ className: "flex items-center gap-4",
408
+ children: [/* @__PURE__ */ f("div", { className: "h-12 w-12 rounded-lg bg-bg-sunken" }), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ p("div", {
409
+ className: "flex items-center gap-2",
410
+ children: [/* @__PURE__ */ f("div", { className: "h-5 w-32 rounded bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "h-4 w-4 rounded-full bg-bg-sunken" })]
411
+ }), /* @__PURE__ */ f("div", { className: "mt-1 h-4 w-40 rounded bg-bg-sunken" })] })]
412
+ }), /* @__PURE__ */ p("div", {
413
+ className: "mt-3 space-y-2",
414
+ children: [/* @__PURE__ */ f("div", { className: "h-4 w-full rounded bg-bg-sunken" }), /* @__PURE__ */ f("div", { className: "h-4 w-2/3 rounded bg-bg-sunken" })]
415
+ })]
416
+ })]
417
+ })
418
+ ]
419
+ })]
420
+ }), xe = ({ error: e, onRetry: t, onBack: n }) => /* @__PURE__ */ f("div", {
421
+ className: "flex h-full items-center justify-center",
422
+ children: /* @__PURE__ */ p("div", {
423
+ className: "text-center",
424
+ children: [
425
+ /* @__PURE__ */ f(s, { className: "mx-auto mb-4 h-12 w-12 text-status-error-text" }),
426
+ /* @__PURE__ */ f("h2", {
427
+ className: "mb-2 text-xl font-semibold text-text-primary",
428
+ children: "Failed to load product"
429
+ }),
430
+ /* @__PURE__ */ f("p", {
431
+ className: "mb-4 text-text-muted",
432
+ children: e.message || "An error occurred while loading the product details."
433
+ }),
434
+ /* @__PURE__ */ p("div", {
435
+ className: "flex justify-center gap-3",
436
+ children: [/* @__PURE__ */ f("button", {
437
+ onClick: t,
438
+ className: "rounded-lg bg-action-primary-bg px-4 py-2 text-action-primary-text transition-opacity hover:opacity-90",
439
+ children: "Try Again"
440
+ }), /* @__PURE__ */ f("button", {
441
+ onClick: n,
442
+ className: "rounded-lg border border-border-default px-4 py-2 text-text-primary transition-colors hover:bg-bg-sunken",
443
+ children: "Go Back"
444
+ })]
445
+ })
446
+ ]
447
+ })
448
+ }), m = () => {
449
+ let { productId: s } = he(), d = me(), { basePath: m } = e(), { addProduct: Se, cartItems: Ce, addingToCart: we, createOrder: Te, checkingOut: Ee } = t(), { createReview: De, loading: h } = ee(), { updateReview: g, loading: _ } = ie(), { deleteReview: v, loading: y } = te(), { markHelpful: b, loading: Oe } = ne(), x = ge(), [S, ke] = o(!1), [C, Ae] = o(!1), [w, T] = o(!1), [E, D] = o(null), [O, k] = o(null), [A, j] = o("success"), [M, N] = o(!1), [P, F] = o(""), [I, L] = o(""), [R, z] = o(5), [je, B] = o(null), [Me, Ne] = o(!1), { data: Pe, loading: Fe, error: Ie, refetch: V } = re({
450
+ id: s,
451
+ slug: s,
452
+ includeReviews: !0,
453
+ reviewsLimit: 10,
454
+ includeRelated: !0,
455
+ relatedLimit: 4,
456
+ includeVersions: !0
457
+ }), H = Pe, U = H?.product, W = H?.publisher, G = Ce.some((e) => e.productId === U?.id), Le = a(async () => {
458
+ if (U) {
459
+ if (D(null), G) {
460
+ d(`${m}/cart`);
461
+ return;
462
+ }
463
+ try {
464
+ await Se(_e(U, W), void 0, 1);
465
+ } catch (e) {
466
+ console.error("Failed to add product to cart:", e), D("Failed to add this product to cart. Please try again.");
467
+ }
468
+ }
469
+ }, [
470
+ U,
471
+ W,
472
+ Se,
473
+ G,
474
+ d,
475
+ m
476
+ ]), Re = a(async () => {
477
+ if (U) {
478
+ D(null), T(!0);
479
+ try {
480
+ let e = U.price || 0, t = await Te({
481
+ total: e,
482
+ lineItems: [{
483
+ productId: U.id,
484
+ name: U.name,
485
+ quantity: 1,
486
+ unitPrice: e,
487
+ subtotal: e,
488
+ itemType: U.nature?.toLowerCase() || "digital",
489
+ pricingModel: U.pricingModel || "PAID_ONETIME"
490
+ }],
491
+ billingAccountId: ""
492
+ });
493
+ t?.id ? d(`/billing/checkout/store/${t.id}`) : (console.error("Failed to create order"), D("Failed to create order. Please try again."), T(!1));
494
+ } catch (e) {
495
+ console.error("Buy Now error:", e), D(e instanceof Error ? e.message : "Failed to start checkout"), T(!1);
496
+ }
497
+ }
498
+ }, [
499
+ U,
500
+ Te,
501
+ d
502
+ ]), ze = a(() => {
503
+ U && Ne(!0);
504
+ }, [U]);
505
+ ce(() => {
506
+ U && x.emit("store.product.viewed", {
507
+ productId: U.id,
508
+ productSlug: U.slug,
509
+ productType: U.type,
510
+ pricingModel: U.pricingModel
511
+ });
512
+ }, [U?.id]);
513
+ let Be = a((e, t) => {
514
+ U && (x.emit("store.product.installed", {
515
+ productId: U.id,
516
+ workspaceId: e
517
+ }), console.log(`Successfully installed ${U.name} to workspace ${t} (${e})`));
518
+ }, [U, x]), Ve = a((e) => {
519
+ console.error("Installation failed:", e.message);
520
+ }, []), He = a(() => {
521
+ F(H?.userReview?.title ?? ""), L(H?.userReview?.comment ?? ""), z(H?.userReview?.rating ?? 5), k(null), j("success"), N(!0);
522
+ }, [H?.userReview]), Ue = a(async () => {
523
+ if (!U) return;
524
+ if (R < 1 || R > 5) {
525
+ j("error"), k("Choose a rating from 1 to 5 stars.");
526
+ return;
527
+ }
528
+ let e = {
529
+ productId: U.id,
530
+ rating: R,
531
+ title: P.trim() || void 0,
532
+ comment: I.trim() || void 0
533
+ };
534
+ if (!(H?.userReview ? await g(H.userReview.id, {
535
+ rating: e.rating,
536
+ title: e.title,
537
+ comment: e.comment
538
+ }) : await De(e))) {
539
+ j("error"), k("We could not save your review. Please try again.");
540
+ return;
541
+ }
542
+ j("success"), k(H?.userReview ? "Your review was updated." : "Your review was submitted."), N(!1), x.emit("store.review.submitted", {
543
+ productId: U.id,
544
+ rating: R
545
+ }), await V();
546
+ }, [
547
+ x,
548
+ De,
549
+ U,
550
+ H?.userReview,
551
+ V,
552
+ I,
553
+ R,
554
+ P,
555
+ g
556
+ ]), We = a(async () => {
557
+ if (H?.userReview && (oe("medium"), await ae({
558
+ title: "Delete review",
559
+ message: "Are you sure you want to remove your review?",
560
+ okButtonTitle: "Delete",
561
+ cancelButtonTitle: "Cancel"
562
+ }) !== !1)) {
563
+ if (!await v(H.userReview.id)) {
564
+ j("error"), k("We could not remove your review. Please try again."), i("error");
565
+ return;
566
+ }
567
+ j("success"), k("Your review was removed."), N(!1), F(""), L(""), z(5), i("success"), await V();
568
+ }
569
+ }, [
570
+ v,
571
+ H?.userReview,
572
+ V
573
+ ]), Ge = a(async (e) => {
574
+ B(e), await b(e) && await V(), B(null);
575
+ }, [b, V]);
576
+ if (Fe) return /* @__PURE__ */ f(be, {});
577
+ if (Ie) return /* @__PURE__ */ f(xe, {
578
+ error: Ie,
579
+ onRetry: V,
580
+ onBack: () => d(`${m}/marketplace`)
581
+ });
582
+ if (!H?.product) return /* @__PURE__ */ f("div", {
583
+ className: "flex h-full items-center justify-center",
584
+ children: /* @__PURE__ */ p("div", {
585
+ className: "text-center",
586
+ children: [
587
+ /* @__PURE__ */ f("h2", {
588
+ className: "mb-2 text-xl font-semibold text-text-primary",
589
+ children: "Product not found"
590
+ }),
591
+ /* @__PURE__ */ f("p", {
592
+ className: "mb-4 text-text-muted",
593
+ children: "The product you are looking for does not exist or has been removed."
594
+ }),
595
+ /* @__PURE__ */ f("button", {
596
+ onClick: () => d(`${m}/marketplace`),
597
+ className: "rounded-lg bg-action-primary-bg px-4 py-2 text-action-primary-text transition-opacity hover:opacity-90",
598
+ children: "Back to Marketplace"
599
+ })
600
+ ]
601
+ })
602
+ });
603
+ let { reviews: K, reviewsCount: Ke, relatedProducts: q, ratingDistribution: J, isPurchased: Y, userEntitlement: X } = H, Z = U, Q = J ? J.fiveStars + J.fourStars + J.threeStars + J.twoStars + J.oneStar : 0, qe = J ? [
604
+ {
605
+ stars: 5,
606
+ count: J.fiveStars,
607
+ percentage: Q > 0 ? J.fiveStars / Q * 100 : 0
608
+ },
609
+ {
610
+ stars: 4,
611
+ count: J.fourStars,
612
+ percentage: Q > 0 ? J.fourStars / Q * 100 : 0
613
+ },
614
+ {
615
+ stars: 3,
616
+ count: J.threeStars,
617
+ percentage: Q > 0 ? J.threeStars / Q * 100 : 0
618
+ },
619
+ {
620
+ stars: 2,
621
+ count: J.twoStars,
622
+ percentage: Q > 0 ? J.twoStars / Q * 100 : 0
623
+ },
624
+ {
625
+ stars: 1,
626
+ count: J.oneStar,
627
+ percentage: Q > 0 ? J.oneStar / Q * 100 : 0
628
+ }
629
+ ] : [], Je = Z.requiredPermissions || [], Ye = Z.integrationDeps || [], Xe = () => Z.pricingModel === "FREE" ? "Free" : Z.pricingModel === "SUBSCRIPTION" ? `${r(Z.price, Z.currency)}/mo` : r(Z.price, Z.currency), $ = Z.pricingModel === "FREE" || Z.price === 0;
630
+ return /* @__PURE__ */ p("div", {
631
+ className: "h-full overflow-y-auto bg-bg-base",
632
+ children: [
633
+ /* @__PURE__ */ f("div", {
634
+ className: "relative bg-bg-surface",
635
+ children: /* @__PURE__ */ f("div", {
636
+ className: "mx-auto max-w-7xl",
637
+ children: /* @__PURE__ */ p("div", {
638
+ className: "flex flex-col lg:flex-row",
639
+ children: [/* @__PURE__ */ p("div", {
640
+ className: "flex-1 px-6 py-8 lg:max-w-xl lg:py-12",
641
+ children: [
642
+ /* @__PURE__ */ p("button", {
643
+ onClick: () => d(-1),
644
+ className: "mb-6 cursor-pointer inline-flex items-center gap-2 text-sm text-text-muted transition-colors hover:text-text-primary",
645
+ children: [/* @__PURE__ */ f(le, { className: "h-4 w-4" }), "Back"]
646
+ }),
647
+ /* @__PURE__ */ f("h1", {
648
+ className: "mb-4 text-4xl font-normal leading-tight text-text-primary lg:text-5xl",
649
+ children: Z.name
650
+ }),
651
+ /* @__PURE__ */ p("div", {
652
+ className: "mb-2",
653
+ children: [W?.websiteUrl ? /* @__PURE__ */ f("a", {
654
+ href: W.websiteUrl,
655
+ target: "_blank",
656
+ rel: "noreferrer",
657
+ className: "text-base font-medium text-text-link hover:underline",
658
+ children: W.name
659
+ }) : /* @__PURE__ */ f("span", {
660
+ className: "text-base font-medium text-text-primary",
661
+ children: W?.name || Z.authorName || "Unknown Publisher"
662
+ }), W?.isVerified && /* @__PURE__ */ f(l, { className: "ml-1.5 inline h-4 w-4 text-status-success-text" })]
663
+ }),
664
+ /* @__PURE__ */ p("p", {
665
+ className: "mb-6 text-sm text-text-muted",
666
+ children: [
667
+ Z.category && /* @__PURE__ */ f("span", { children: Z.category }),
668
+ Z.category && " · ",
669
+ n(Z.downloads),
670
+ "+ downloads"
671
+ ]
672
+ }),
673
+ /* @__PURE__ */ p("div", {
674
+ className: "mb-6 flex items-center gap-4",
675
+ children: [
676
+ /* @__PURE__ */ f("div", {
677
+ className: "flex h-12 w-12 items-center justify-center overflow-hidden rounded-xl bg-bg-sunken",
678
+ children: Z.icon ? /* @__PURE__ */ f("img", {
679
+ src: Z.icon,
680
+ alt: "",
681
+ className: "h-full w-full object-cover"
682
+ }) : /* @__PURE__ */ f("span", {
683
+ className: "text-lg font-bold text-text-muted",
684
+ children: Z.name.charAt(0)
685
+ })
686
+ }),
687
+ /* @__PURE__ */ p("div", {
688
+ className: "flex items-center gap-1 border-l border-border-default pl-4",
689
+ children: [
690
+ /* @__PURE__ */ f("span", {
691
+ className: "text-sm font-medium text-text-primary",
692
+ children: (Z.rating || 0).toFixed(1)
693
+ }),
694
+ /* @__PURE__ */ f(u, { className: "h-4 w-4 fill-current text-status-warning-text" }),
695
+ /* @__PURE__ */ p("span", {
696
+ className: "ml-1 text-xs text-text-muted",
697
+ children: [n(Ke || Z.reviewCount), " reviews"]
698
+ })
699
+ ]
700
+ }),
701
+ /* @__PURE__ */ p("div", {
702
+ className: "border-l border-border-default pl-4",
703
+ children: [/* @__PURE__ */ p("span", {
704
+ className: "text-sm font-medium text-text-primary",
705
+ children: [n(Z.downloads), "+"]
706
+ }), /* @__PURE__ */ f("p", {
707
+ className: "text-xs text-text-muted",
708
+ children: "Downloads"
709
+ })]
710
+ }),
711
+ /* @__PURE__ */ p("div", {
712
+ className: "border-l border-border-default pl-4",
713
+ children: [/* @__PURE__ */ f("span", {
714
+ className: "rounded bg-bg-sunken px-2 py-1 text-xs font-medium text-text-primary",
715
+ children: Z.type
716
+ }), /* @__PURE__ */ f("p", {
717
+ className: "mt-0.5 text-xs text-text-muted",
718
+ children: "Type"
719
+ })]
720
+ })
721
+ ]
722
+ }),
723
+ E && /* @__PURE__ */ f("div", {
724
+ role: "alert",
725
+ className: "mb-4 rounded-lg border border-status-error-bg bg-status-error-bg-subtle px-4 py-3 text-sm text-status-error-text",
726
+ children: E
727
+ }),
728
+ /* @__PURE__ */ p("div", {
729
+ className: "mb-6 flex items-center gap-3",
730
+ children: [Y && !$ ? /* @__PURE__ */ f("button", {
731
+ onClick: ze,
732
+ className: "cursor-pointer rounded-full bg-action-primary-bg px-8 py-3 font-medium text-action-primary-text transition-opacity hover:opacity-90",
733
+ children: "Install to Workspace"
734
+ }) : $ ? /* @__PURE__ */ f("button", {
735
+ onClick: ze,
736
+ className: "cursor-pointer rounded-full bg-action-primary-bg px-8 py-3 font-medium text-action-primary-text transition-opacity hover:opacity-90",
737
+ children: "Install"
738
+ }) : /* @__PURE__ */ f("button", {
739
+ onClick: Re,
740
+ disabled: w || Ee,
741
+ className: "cursor-pointer flex items-center gap-2 rounded-full bg-action-primary-bg px-8 py-3 font-medium text-action-primary-text transition-opacity hover:opacity-90 disabled:opacity-70",
742
+ children: w || Ee ? /* @__PURE__ */ p(pe, { children: [/* @__PURE__ */ f(c, { className: "h-4 w-4 animate-spin" }), "Processing..."] }) : `Buy ${Xe()}`
743
+ }), !$ && !Y && /* @__PURE__ */ p("button", {
744
+ onClick: Le,
745
+ disabled: we,
746
+ className: "cursor-pointer flex items-center gap-2 rounded-full border border-border-default px-4 py-3 text-sm text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50",
747
+ children: [we ? /* @__PURE__ */ f(c, { className: "h-4 w-4 animate-spin" }) : G ? /* @__PURE__ */ f(ue, { className: "h-4 w-4 text-status-success-text" }) : /* @__PURE__ */ f(fe, { className: "h-4 w-4" }), G ? "In Cart" : "Add to Cart"]
748
+ })]
749
+ }),
750
+ /* @__PURE__ */ p("p", {
751
+ className: "flex items-center gap-2 text-xs text-text-muted",
752
+ children: [/* @__PURE__ */ f(de, { className: "h-4 w-4" }), "This app is available for your workspace"]
753
+ }),
754
+ X && /* @__PURE__ */ p("p", {
755
+ className: "mt-2 flex items-center gap-2 text-xs text-text-muted",
756
+ children: [
757
+ /* @__PURE__ */ f(l, { className: "h-4 w-4 text-status-success-text" }),
758
+ "License: ",
759
+ X.status,
760
+ X.expiresAt && ` (Expires: ${new Date(X.expiresAt).toLocaleDateString()})`
761
+ ]
762
+ })
763
+ ]
764
+ }), /* @__PURE__ */ f("div", {
765
+ className: "relative flex-1 bg-bg-sunken lg:min-h-[500px]",
766
+ children: Z.screenshots && Z.screenshots.length > 0 ? /* @__PURE__ */ f("img", {
767
+ src: Z.screenshots[0],
768
+ alt: `${Z.name} screenshot`,
769
+ className: "h-full w-full object-cover"
770
+ }) : /* @__PURE__ */ f("div", {
771
+ className: "flex h-full min-h-[300px] items-center justify-center",
772
+ children: /* @__PURE__ */ p("div", {
773
+ className: "text-center",
774
+ children: [/* @__PURE__ */ f("div", {
775
+ className: "mx-auto mb-4 flex h-24 w-24 items-center justify-center rounded-2xl bg-bg-surface text-4xl font-bold text-text-muted",
776
+ children: Z.name.charAt(0)
777
+ }), /* @__PURE__ */ f("p", {
778
+ className: "text-sm text-text-muted",
779
+ children: "No preview available"
780
+ })]
781
+ })
782
+ })
783
+ })]
784
+ })
785
+ })
786
+ }),
787
+ /* @__PURE__ */ f("main", {
788
+ className: "mx-auto max-w-7xl px-6 py-8",
789
+ children: /* @__PURE__ */ p("div", {
790
+ className: "flex flex-col gap-8 lg:flex-row",
791
+ children: [/* @__PURE__ */ p("div", {
792
+ className: "flex-1 lg:max-w-3xl",
793
+ children: [
794
+ Z.screenshots && Z.screenshots.length > 1 && /* @__PURE__ */ f("section", {
795
+ className: "mb-8",
796
+ children: /* @__PURE__ */ f("div", {
797
+ className: "flex gap-4 overflow-x-auto pb-4",
798
+ children: Z.screenshots.map((e, t) => /* @__PURE__ */ f("div", {
799
+ className: "relative h-64 w-96 flex-shrink-0 overflow-hidden rounded-xl bg-bg-sunken",
800
+ children: /* @__PURE__ */ f("img", {
801
+ src: e,
802
+ alt: `Screenshot ${t + 1}`,
803
+ className: "h-full w-full object-cover"
804
+ })
805
+ }, t))
806
+ })
807
+ }),
808
+ /* @__PURE__ */ p("section", {
809
+ className: "mb-8",
810
+ children: [
811
+ /* @__PURE__ */ f("div", {
812
+ className: "mb-4 flex items-center justify-between text-left",
813
+ children: /* @__PURE__ */ f("h2", {
814
+ className: "text-lg font-medium text-text-primary",
815
+ children: "About this app"
816
+ })
817
+ }),
818
+ /* @__PURE__ */ p("div", {
819
+ className: "text-sm leading-relaxed text-text-secondary",
820
+ children: [/* @__PURE__ */ f("p", {
821
+ className: S ? "" : "line-clamp-4",
822
+ children: Z.longDescription || Z.description || "No description available."
823
+ }), ((Z.longDescription || Z.description)?.length ?? 0) > 200 && /* @__PURE__ */ f("button", {
824
+ onClick: () => ke(!S),
825
+ className: "cursor-pointer mt-3 text-sm font-medium text-text-link",
826
+ children: S ? "Show less" : "Show more"
827
+ })]
828
+ }),
829
+ Z.tags && Z.tags.length > 0 && /* @__PURE__ */ f("div", {
830
+ className: "mt-4 flex flex-wrap gap-2",
831
+ children: Z.tags.map((e) => /* @__PURE__ */ f("span", {
832
+ className: "rounded-full border border-border-default px-3 py-1.5 text-xs text-text-muted transition-colors hover:bg-bg-sunken",
833
+ children: e
834
+ }, e))
835
+ })
836
+ ]
837
+ }),
838
+ /* @__PURE__ */ p("section", {
839
+ className: "mb-8",
840
+ children: [
841
+ /* @__PURE__ */ f("div", {
842
+ className: "mb-4 flex items-center justify-between text-left",
843
+ children: /* @__PURE__ */ f("h2", {
844
+ className: "text-lg font-medium text-text-primary",
845
+ children: "Ratings & Reviews"
846
+ })
847
+ }),
848
+ /* @__PURE__ */ p("div", {
849
+ className: "rounded-xl border border-border-default bg-bg-surface p-5",
850
+ children: [K && K.length > 0 ? /* @__PURE__ */ p("div", {
851
+ className: "flex items-start gap-8",
852
+ children: [/* @__PURE__ */ p("div", {
853
+ className: "text-center",
854
+ children: [
855
+ /* @__PURE__ */ f("p", {
856
+ className: "text-5xl font-light text-text-primary",
857
+ children: (Z.rating || 0).toFixed(1)
858
+ }),
859
+ /* @__PURE__ */ f("div", {
860
+ className: "my-2 flex justify-center gap-0.5",
861
+ children: [
862
+ 1,
863
+ 2,
864
+ 3,
865
+ 4,
866
+ 5
867
+ ].map((e) => /* @__PURE__ */ f(u, { className: `h-4 w-4 ${e <= Math.round(Z.rating || 0) ? "fill-current text-status-warning-text" : "text-text-muted"}` }, e))
868
+ }),
869
+ /* @__PURE__ */ p("p", {
870
+ className: "text-sm text-text-muted",
871
+ children: [n(Ke || Z.reviewCount), " reviews"]
872
+ })
873
+ ]
874
+ }), qe.length > 0 && /* @__PURE__ */ f("div", {
875
+ className: "flex-1 space-y-1.5",
876
+ children: qe.map((e) => /* @__PURE__ */ f(ve, { ...e }, e.stars))
877
+ })]
878
+ }) : /* @__PURE__ */ p("div", {
879
+ className: "flex flex-col items-center justify-center py-6 text-center",
880
+ children: [
881
+ /* @__PURE__ */ f("div", {
882
+ className: "mb-3 flex gap-0.5",
883
+ children: [
884
+ 1,
885
+ 2,
886
+ 3,
887
+ 4,
888
+ 5
889
+ ].map((e) => /* @__PURE__ */ f(u, { className: "h-5 w-5 text-border-default" }, e))
890
+ }),
891
+ /* @__PURE__ */ f("p", {
892
+ className: "font-medium text-text-primary",
893
+ children: "No reviews yet"
894
+ }),
895
+ /* @__PURE__ */ f("p", {
896
+ className: "mt-1 text-sm text-text-muted",
897
+ children: "Be the first to share your experience with this app."
898
+ })
899
+ ]
900
+ }), /* @__PURE__ */ p("div", {
901
+ className: "mt-6 border-t border-border-default pt-4",
902
+ children: [O && /* @__PURE__ */ f("p", {
903
+ role: A === "success" ? "status" : "alert",
904
+ className: `mb-3 rounded-lg px-3 py-2 text-sm ${A === "success" ? "bg-status-success-bg-subtle text-status-success-text" : "bg-status-error-bg-subtle text-status-error-text"}`,
905
+ children: O
906
+ }), Y || H?.userReview ? /* @__PURE__ */ p("div", {
907
+ className: "space-y-4",
908
+ children: [/* @__PURE__ */ f("button", {
909
+ type: "button",
910
+ onClick: () => M ? N(!1) : He(),
911
+ className: "w-full cursor-pointer py-2 text-center text-sm font-medium text-text-primary transition-colors hover:text-text-link",
912
+ children: H?.userReview ? M ? "Cancel review editing" : "Edit your review" : M ? "Cancel review" : "Write a Review"
913
+ }), M && /* @__PURE__ */ p("div", {
914
+ className: "rounded-xl border border-border-default bg-bg-sunken p-4",
915
+ children: [
916
+ /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("p", {
917
+ className: "text-sm font-medium text-text-primary",
918
+ children: "Your rating"
919
+ }), /* @__PURE__ */ f("div", {
920
+ className: "mt-2 flex flex-wrap gap-2",
921
+ children: [
922
+ 1,
923
+ 2,
924
+ 3,
925
+ 4,
926
+ 5
927
+ ].map((e) => /* @__PURE__ */ p("button", {
928
+ type: "button",
929
+ onClick: () => z(e),
930
+ className: `cursor-pointer rounded-full border px-3 py-1.5 text-sm transition-colors ${R === e ? "border-action-primary-border bg-action-primary-bg text-action-primary-text" : "border-border-default bg-bg-surface text-text-primary hover:bg-bg-surface"}`,
931
+ children: [e, " ★"]
932
+ }, e))
933
+ })] }),
934
+ /* @__PURE__ */ p("label", {
935
+ className: "mt-4 block text-sm font-medium text-text-primary",
936
+ children: ["Title", /* @__PURE__ */ f("input", {
937
+ value: P,
938
+ onChange: (e) => F(e.target.value),
939
+ className: "mt-2 w-full rounded-lg border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary outline-none focus:border-action-primary-border",
940
+ placeholder: "Summarize your experience"
941
+ })]
942
+ }),
943
+ /* @__PURE__ */ p("label", {
944
+ className: "mt-4 block text-sm font-medium text-text-primary",
945
+ children: ["Review", /* @__PURE__ */ f("textarea", {
946
+ value: I,
947
+ onChange: (e) => L(e.target.value),
948
+ rows: 4,
949
+ required: !0,
950
+ "aria-required": "true",
951
+ className: "mt-2 w-full rounded-lg border border-border-default bg-bg-surface px-3 py-2 text-sm text-text-primary outline-none focus:border-action-primary-border",
952
+ placeholder: "What worked well? What should improve?"
953
+ })]
954
+ }),
955
+ /* @__PURE__ */ p("div", {
956
+ className: "mt-4 flex flex-wrap gap-3",
957
+ children: [/* @__PURE__ */ f("button", {
958
+ type: "button",
959
+ onClick: Ue,
960
+ disabled: h || _,
961
+ className: "cursor-pointer rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60",
962
+ children: h || _ ? "Saving..." : H?.userReview ? "Update Review" : "Submit Review"
963
+ }), H?.userReview && /* @__PURE__ */ f("button", {
964
+ type: "button",
965
+ onClick: We,
966
+ disabled: y,
967
+ className: "cursor-pointer rounded-lg border border-status-error-border px-4 py-2 text-sm font-medium text-status-error-text hover:bg-status-error-bg-subtle disabled:cursor-not-allowed disabled:opacity-60",
968
+ children: y ? "Removing..." : "Delete Review"
969
+ })]
970
+ })
971
+ ]
972
+ })]
973
+ }) : /* @__PURE__ */ f("p", {
974
+ className: "text-center text-sm text-text-muted",
975
+ children: "Purchase this app to submit a review."
976
+ })]
977
+ })]
978
+ }),
979
+ K && K.length > 0 && /* @__PURE__ */ p("div", {
980
+ className: "mt-4 space-y-3",
981
+ children: [/* @__PURE__ */ f("ul", {
982
+ className: "space-y-3",
983
+ children: (C ? K : K.slice(0, 2)).map((e) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ f(ye, {
984
+ review: e,
985
+ onMarkHelpful: Ge,
986
+ markingHelpful: Oe && je === e.id
987
+ }) }, e.id))
988
+ }), K.length > 2 && /* @__PURE__ */ f("button", {
989
+ onClick: () => Ae(!C),
990
+ className: "cursor-pointer text-sm font-medium text-text-link",
991
+ children: C ? "Show less" : `Show all ${K.length} reviews`
992
+ })]
993
+ }),
994
+ (!K || K.length === 0) && /* @__PURE__ */ f("p", {
995
+ className: "mt-4 text-sm text-text-muted",
996
+ children: "No reviews yet. Be the first to review!"
997
+ })
998
+ ]
999
+ }),
1000
+ Je.length > 0 && /* @__PURE__ */ p("section", {
1001
+ className: "mb-8",
1002
+ children: [/* @__PURE__ */ f("h2", {
1003
+ className: "mb-4 text-lg font-medium text-text-primary",
1004
+ children: "Required Permissions"
1005
+ }), /* @__PURE__ */ f("div", {
1006
+ className: "space-y-2",
1007
+ children: Je.map((e) => /* @__PURE__ */ p("div", {
1008
+ className: "flex items-center gap-3 rounded-lg bg-bg-surface px-4 py-3",
1009
+ children: [/* @__PURE__ */ f(l, { className: "h-5 w-5 text-status-success-text" }), /* @__PURE__ */ f("span", {
1010
+ className: "text-sm text-text-primary",
1011
+ children: e
1012
+ })]
1013
+ }, e))
1014
+ })]
1015
+ }),
1016
+ Ye.length > 0 && /* @__PURE__ */ p("section", {
1017
+ className: "mb-8",
1018
+ children: [/* @__PURE__ */ f("h2", {
1019
+ className: "mb-4 text-lg font-medium text-text-primary",
1020
+ children: "Integrations"
1021
+ }), /* @__PURE__ */ f("div", {
1022
+ className: "flex flex-wrap gap-2",
1023
+ children: Ye.map((e) => /* @__PURE__ */ f("span", {
1024
+ className: "rounded-lg bg-bg-surface px-4 py-2 text-sm font-medium text-text-primary",
1025
+ children: e
1026
+ }, e))
1027
+ })]
1028
+ }),
1029
+ /* @__PURE__ */ p("section", {
1030
+ className: "mb-8",
1031
+ children: [/* @__PURE__ */ f("h2", {
1032
+ className: "mb-4 text-lg font-medium text-text-primary",
1033
+ children: "Additional Information"
1034
+ }), /* @__PURE__ */ p("div", {
1035
+ className: "grid grid-cols-2 gap-6 md:grid-cols-3",
1036
+ children: [
1037
+ Z.manifestVersion && /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("p", {
1038
+ className: "text-xs text-text-muted",
1039
+ children: "Version"
1040
+ }), /* @__PURE__ */ f("p", {
1041
+ className: "mt-1 text-sm font-medium text-text-primary",
1042
+ children: Z.manifestVersion
1043
+ })] }),
1044
+ /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("p", {
1045
+ className: "text-xs text-text-muted",
1046
+ children: "Type"
1047
+ }), /* @__PURE__ */ f("p", {
1048
+ className: "mt-1 text-sm font-medium text-text-primary",
1049
+ children: Z.type
1050
+ })] }),
1051
+ Z.publishedAt && /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("p", {
1052
+ className: "text-xs text-text-muted",
1053
+ children: "Published"
1054
+ }), /* @__PURE__ */ f("p", {
1055
+ className: "mt-1 text-sm font-medium text-text-primary",
1056
+ children: new Date(Z.publishedAt).toLocaleDateString()
1057
+ })] }),
1058
+ /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("p", {
1059
+ className: "text-xs text-text-muted",
1060
+ children: "Updated"
1061
+ }), /* @__PURE__ */ f("p", {
1062
+ className: "mt-1 text-sm font-medium text-text-primary",
1063
+ children: new Date(Z.updatedAt).toLocaleDateString()
1064
+ })] }),
1065
+ Z.license && /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("p", {
1066
+ className: "text-xs text-text-muted",
1067
+ children: "License"
1068
+ }), /* @__PURE__ */ f("p", {
1069
+ className: "mt-1 text-sm font-medium text-text-primary",
1070
+ children: Z.license
1071
+ })] }),
1072
+ Z.minPlatformVersion && /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("p", {
1073
+ className: "text-xs text-text-muted",
1074
+ children: "Min Platform Version"
1075
+ }), /* @__PURE__ */ f("p", {
1076
+ className: "mt-1 text-sm font-medium text-text-primary",
1077
+ children: Z.minPlatformVersion
1078
+ })] })
1079
+ ]
1080
+ })]
1081
+ })
1082
+ ]
1083
+ }), /* @__PURE__ */ p("div", {
1084
+ className: "w-full lg:w-80",
1085
+ children: [
1086
+ (Z.documentationUrl || Z.repositoryUrl || W?.email) && /* @__PURE__ */ p("div", {
1087
+ className: "mb-6 rounded-xl border border-border-default bg-bg-surface p-4",
1088
+ children: [/* @__PURE__ */ f("h3", {
1089
+ className: "font-medium text-text-primary",
1090
+ children: "App support"
1091
+ }), /* @__PURE__ */ p("div", {
1092
+ className: "mt-3 space-y-2 text-sm",
1093
+ children: [
1094
+ Z.documentationUrl && /* @__PURE__ */ f("a", {
1095
+ href: Z.documentationUrl,
1096
+ target: "_blank",
1097
+ rel: "noreferrer",
1098
+ className: "block text-text-link hover:underline",
1099
+ children: "Documentation"
1100
+ }),
1101
+ Z.repositoryUrl && /* @__PURE__ */ f("a", {
1102
+ href: Z.repositoryUrl,
1103
+ target: "_blank",
1104
+ rel: "noreferrer",
1105
+ className: "block text-text-link hover:underline",
1106
+ children: "Source repository"
1107
+ }),
1108
+ W?.email && /* @__PURE__ */ f("a", {
1109
+ href: `mailto:${W.email}`,
1110
+ className: "block text-text-link hover:underline",
1111
+ children: "Contact publisher"
1112
+ })
1113
+ ]
1114
+ })]
1115
+ }),
1116
+ W && /* @__PURE__ */ p("div", {
1117
+ className: "mb-6 rounded-xl border border-border-default bg-bg-surface p-4",
1118
+ children: [
1119
+ /* @__PURE__ */ f("h3", {
1120
+ className: "font-medium text-text-primary",
1121
+ children: "Publisher"
1122
+ }),
1123
+ /* @__PURE__ */ f("p", {
1124
+ className: "mt-2 text-sm text-text-primary",
1125
+ children: W.name
1126
+ }),
1127
+ W.bio && /* @__PURE__ */ f("p", {
1128
+ className: "mt-2 text-sm text-text-muted",
1129
+ children: W.bio
1130
+ }),
1131
+ W.websiteUrl && /* @__PURE__ */ f("a", {
1132
+ href: W.websiteUrl,
1133
+ target: "_blank",
1134
+ rel: "noreferrer",
1135
+ className: "mt-3 inline-block text-sm text-text-link hover:underline",
1136
+ children: "Visit publisher website"
1137
+ })
1138
+ ]
1139
+ }),
1140
+ q && q.length > 0 && /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("div", {
1141
+ className: "mb-4 flex items-center justify-between text-left",
1142
+ children: /* @__PURE__ */ f("span", {
1143
+ className: "font-medium text-text-primary",
1144
+ children: "Similar apps"
1145
+ })
1146
+ }), /* @__PURE__ */ f("div", {
1147
+ className: "space-y-3",
1148
+ children: q.slice(0, 4).map((e) => /* @__PURE__ */ p("button", {
1149
+ onClick: () => d(`${m}/marketplace/product/${e.id}`),
1150
+ className: "flex w-full cursor-pointer items-center gap-3 rounded-lg p-2 text-left transition-colors hover:bg-bg-sunken",
1151
+ children: [e.icon ? /* @__PURE__ */ f("img", {
1152
+ src: e.icon,
1153
+ alt: e.name,
1154
+ className: "h-12 w-12 rounded-xl object-cover"
1155
+ }) : /* @__PURE__ */ f("div", {
1156
+ className: "flex h-12 w-12 items-center justify-center rounded-xl bg-bg-sunken text-lg font-bold text-text-muted",
1157
+ children: e.name.charAt(0)
1158
+ }), /* @__PURE__ */ p("div", {
1159
+ className: "flex-1 overflow-hidden",
1160
+ children: [
1161
+ /* @__PURE__ */ f("p", {
1162
+ className: "truncate text-sm font-medium text-text-primary",
1163
+ children: e.name
1164
+ }),
1165
+ /* @__PURE__ */ f("p", {
1166
+ className: "text-xs text-text-muted",
1167
+ children: W?.name || "Unknown"
1168
+ }),
1169
+ (e.reviewCount ?? 0) > 0 && /* @__PURE__ */ p("div", {
1170
+ className: "flex items-center gap-1",
1171
+ children: [/* @__PURE__ */ f("span", {
1172
+ className: "text-xs text-text-muted",
1173
+ children: (e.rating || 0).toFixed(1)
1174
+ }), /* @__PURE__ */ f(u, { className: "h-3 w-3 fill-current text-status-warning-text" })]
1175
+ })
1176
+ ]
1177
+ })]
1178
+ }, e.id))
1179
+ })] })
1180
+ ]
1181
+ })]
1182
+ })
1183
+ }),
1184
+ Z && /* @__PURE__ */ f(se, {
1185
+ isOpen: Me,
1186
+ onClose: () => Ne(!1),
1187
+ app: {
1188
+ id: Z.id,
1189
+ name: Z.name,
1190
+ slug: Z.slug,
1191
+ icon: Z.icon,
1192
+ type: Z.type,
1193
+ version: Z.manifestVersion
1194
+ },
1195
+ purchaseState: Y && !$ ? "purchased" : "free",
1196
+ onInstallSuccess: Be,
1197
+ onInstallError: Ve
1198
+ })
1199
+ ]
1200
+ });
1201
+ };
1202
+ //#endregion
1203
+ export { m as ProductDetailPage };
1204
+
1205
+ //# sourceMappingURL=ProductDetailPage.js.map