@burdenoff/website-sdk 2026.709.3 → 2026.716.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.
@@ -0,0 +1,2110 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var reactHelmetAsync = require('react-helmet-async');
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
10
+ function formatPrice(price, currency, pricingModel) {
11
+ if (pricingModel === "FREE" || !price || price === 0) return "Free";
12
+ const curr = currency || "USD";
13
+ try {
14
+ return new Intl.NumberFormat("en-US", {
15
+ style: "currency",
16
+ currency: curr
17
+ }).format(price);
18
+ } catch {
19
+ return `${curr} ${price.toFixed(2)}`;
20
+ }
21
+ }
22
+ function formatDownloads(n) {
23
+ if (!n) return "0";
24
+ if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
25
+ if (n >= 1e3) return `${(n / 1e3).toFixed(1)}K`;
26
+ return n.toString();
27
+ }
28
+ function StarRating({ rating }) {
29
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex items-center gap-0.5", children: [1, 2, 3, 4, 5].map((star) => /* @__PURE__ */ jsxRuntime.jsx(
30
+ "svg",
31
+ {
32
+ viewBox: "0 0 12 12",
33
+ className: `w-3 h-3 ${star <= Math.round(rating) ? "text-amber-400 fill-current" : "text-muted-foreground/30 fill-current"}`,
34
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 1l1.545 3.09L11 4.59l-2.5 2.41.59 3.41L6 8.79l-3.09 1.61L3.5 7 1 4.59l3.455-.5L6 1z" })
35
+ },
36
+ star
37
+ )) });
38
+ }
39
+ function TypeBadge({ type }) {
40
+ const labels = {
41
+ APP: "App",
42
+ NODE: "Node",
43
+ WORKFLOW: "Workflow",
44
+ TEMPLATE: "Template",
45
+ INTEGRATION: "Integration",
46
+ EXTENSION: "Extension",
47
+ THEME: "Theme"
48
+ };
49
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block text-xs px-2 py-0.5 rounded-full bg-primary/10 text-primary font-medium", children: labels[type] ?? type });
50
+ }
51
+ function ProductCard({ product, onClick, href }) {
52
+ const priceLabel = formatPrice(
53
+ product.price,
54
+ product.currency,
55
+ product.pricingModel
56
+ );
57
+ const inner = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group bg-card border border-border rounded-xl p-4 flex flex-col gap-3 transition-all duration-200 hover:shadow-md hover:border-primary/30 cursor-pointer h-full", children: [
58
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-2", children: [
59
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-12 h-12 rounded-lg bg-muted flex-shrink-0 overflow-hidden", children: product.icon ? /* @__PURE__ */ jsxRuntime.jsx(
60
+ "img",
61
+ {
62
+ src: product.icon,
63
+ alt: "",
64
+ "aria-hidden": "true",
65
+ className: "w-full h-full object-cover"
66
+ }
67
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/15 to-primary/5", children: /* @__PURE__ */ jsxRuntime.jsxs(
68
+ "svg",
69
+ {
70
+ viewBox: "0 0 32 32",
71
+ className: "w-8 h-8",
72
+ fill: "none",
73
+ xmlns: "http://www.w3.org/2000/svg",
74
+ "aria-hidden": "true",
75
+ children: [
76
+ /* @__PURE__ */ jsxRuntime.jsx(
77
+ "polygon",
78
+ {
79
+ points: "16,4 28,10 16,16 4,10",
80
+ className: "fill-primary/30",
81
+ stroke: "currentColor",
82
+ strokeWidth: "0.6",
83
+ strokeOpacity: "0.35"
84
+ }
85
+ ),
86
+ /* @__PURE__ */ jsxRuntime.jsx(
87
+ "polygon",
88
+ {
89
+ points: "4,10 16,16 16,28 4,22",
90
+ className: "fill-primary/15",
91
+ stroke: "currentColor",
92
+ strokeWidth: "0.6",
93
+ strokeOpacity: "0.35"
94
+ }
95
+ ),
96
+ /* @__PURE__ */ jsxRuntime.jsx(
97
+ "polygon",
98
+ {
99
+ points: "28,10 16,16 16,28 28,22",
100
+ className: "fill-primary/20",
101
+ stroke: "currentColor",
102
+ strokeWidth: "0.6",
103
+ strokeOpacity: "0.35"
104
+ }
105
+ )
106
+ ]
107
+ }
108
+ ) }) }),
109
+ /* @__PURE__ */ jsxRuntime.jsx(TypeBadge, { type: product.type })
110
+ ] }),
111
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
112
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-foreground text-sm leading-snug line-clamp-1 group-hover:text-primary transition-colors", children: product.name }),
113
+ product.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground text-xs mt-1 line-clamp-2 leading-relaxed", children: product.description })
114
+ ] }),
115
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
116
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-1.5", children: product.rating != null && product.rating > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
117
+ /* @__PURE__ */ jsxRuntime.jsx(StarRating, { rating: product.rating }),
118
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: product.rating.toFixed(1) })
119
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: "No reviews yet" }) }),
120
+ /* @__PURE__ */ jsxRuntime.jsx(
121
+ "span",
122
+ {
123
+ className: `text-xs font-semibold ${priceLabel === "Free" ? "text-emerald-500" : "text-foreground"}`,
124
+ children: priceLabel
125
+ }
126
+ )
127
+ ] })
128
+ ] });
129
+ if (href) {
130
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { href, onClick, className: "block h-full no-underline", children: inner });
131
+ }
132
+ return /* @__PURE__ */ jsxRuntime.jsx(
133
+ "button",
134
+ {
135
+ type: "button",
136
+ onClick,
137
+ className: "block w-full text-left h-full",
138
+ children: inner
139
+ }
140
+ );
141
+ }
142
+
143
+ // src/store/queries.ts
144
+ var STORE_PRODUCT_FIELDS = `
145
+ fragment StoreProductFields on StoreProduct {
146
+ id name slug type subType nature status pricingModel
147
+ price currency description icon bannerUrl screenshots
148
+ category tags featured downloads viewCount rating reviewCount
149
+ publisherId authorName license compatibleProducts
150
+ }
151
+ `;
152
+ var HOME_GROUPED_PRODUCTS_QUERY = `
153
+ ${STORE_PRODUCT_FIELDS}
154
+ query HomeGroupedProducts($compatibleWith: String) {
155
+ homeGroupedProducts(compatibleWith: $compatibleWith) {
156
+ featured { ...StoreProductFields }
157
+ mostDownloaded { ...StoreProductFields }
158
+ recentlyAdded { ...StoreProductFields }
159
+ freeItems { ...StoreProductFields }
160
+ }
161
+ }
162
+ `;
163
+ var BROWSE_STORE_QUERY = `
164
+ ${STORE_PRODUCT_FIELDS}
165
+ query BrowseStore($input: BrowseStoreInput!) {
166
+ browseStore(input: $input) {
167
+ products { ...StoreProductFields }
168
+ totalCount
169
+ hasMore
170
+ nextCursor
171
+ facets {
172
+ types { value count }
173
+ categories { value count }
174
+ pricingModels { value count }
175
+ priceRange { min max }
176
+ }
177
+ }
178
+ }
179
+ `;
180
+ var STORE_PRODUCT_DETAILS_QUERY = `
181
+ ${STORE_PRODUCT_FIELDS}
182
+ query StoreProductDetails($input: StoreProductDetailsInput!) {
183
+ storeProductDetails(input: $input) {
184
+ product { ...StoreProductFields longDescription videoUrls minPlatformVersion }
185
+ publisher { id name email websiteUrl logoUrl bio isVerified tier }
186
+ reviews { id rating title comment verifiedPurchase helpful createdAt }
187
+ reviewsCount
188
+ relatedProducts { ...StoreProductFields }
189
+ ratingDistribution { fiveStars fourStars threeStars twoStars oneStar }
190
+ }
191
+ }
192
+ `;
193
+ var CATEGORIES_QUERY = `
194
+ query Categories {
195
+ categories {
196
+ id name slug description icon parentId
197
+ }
198
+ }
199
+ `;
200
+
201
+ // src/client/security.ts
202
+ var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"]);
203
+ var RESERVED_HEADERS = /* @__PURE__ */ new Set([
204
+ "authorization",
205
+ "cookie",
206
+ "x-actor-id",
207
+ "x-actor-type",
208
+ "x-consent-granted-by",
209
+ "x-consent-scope",
210
+ "x-consent-granted-at",
211
+ "x-consent-expires-at"
212
+ ]);
213
+ function validateGatewayUrl(value) {
214
+ let url;
215
+ try {
216
+ url = new URL(value);
217
+ } catch {
218
+ throw new Error("Gateway URL must be a valid absolute URL");
219
+ }
220
+ if (url.protocol === "https:") {
221
+ return url.toString();
222
+ }
223
+ if (url.protocol === "http:" && LOOPBACK_HOSTS.has(url.hostname.toLowerCase())) {
224
+ return url.toString();
225
+ }
226
+ throw new Error("Gateway URL must use HTTPS unless it targets localhost");
227
+ }
228
+ function sanitizeHeaders(headers) {
229
+ if (!headers) return void 0;
230
+ return Object.fromEntries(
231
+ Object.entries(headers).filter(
232
+ ([key]) => !RESERVED_HEADERS.has(key.toLowerCase())
233
+ )
234
+ );
235
+ }
236
+
237
+ // src/client/graphql-client.ts
238
+ var _WebSDKClient = class _WebSDKClient {
239
+ constructor(config) {
240
+ __publicField(this, "config");
241
+ __publicField(this, "queryCache", /* @__PURE__ */ new Map());
242
+ __publicField(this, "inflight", /* @__PURE__ */ new Map());
243
+ this.config = {
244
+ ...config,
245
+ gatewayUrl: validateGatewayUrl(config.gatewayUrl),
246
+ headers: sanitizeHeaders(config.headers)
247
+ };
248
+ }
249
+ getConfig() {
250
+ return this.config;
251
+ }
252
+ /**
253
+ * Execute a GraphQL query (with deduplication and caching)
254
+ */
255
+ async query(query, variables) {
256
+ const cacheKey = JSON.stringify({ query, variables });
257
+ const cached = this.queryCache.get(cacheKey);
258
+ if (cached) {
259
+ if (Date.now() - cached.ts < _WebSDKClient.CACHE_TTL) {
260
+ return cached.data;
261
+ }
262
+ this.queryCache.delete(cacheKey);
263
+ }
264
+ const existing = this.inflight.get(cacheKey);
265
+ if (existing) {
266
+ return existing;
267
+ }
268
+ const promise = this.request(query, variables).then((result) => {
269
+ if (result.data && !result.errors?.length) {
270
+ if (this.queryCache.size >= _WebSDKClient.MAX_CACHE_ENTRIES) {
271
+ const oldestEntry = this.queryCache.keys().next().value;
272
+ if (oldestEntry) {
273
+ this.queryCache.delete(oldestEntry);
274
+ }
275
+ }
276
+ this.queryCache.set(cacheKey, { data: result, ts: Date.now() });
277
+ }
278
+ return result;
279
+ }).finally(() => {
280
+ this.inflight.delete(cacheKey);
281
+ });
282
+ this.inflight.set(cacheKey, promise);
283
+ return promise;
284
+ }
285
+ /**
286
+ * Execute a GraphQL mutation
287
+ */
288
+ async mutate(mutation, variables) {
289
+ return this.request(mutation, variables);
290
+ }
291
+ async request(query, variables) {
292
+ try {
293
+ const response = await fetch(this.config.gatewayUrl, {
294
+ method: "POST",
295
+ headers: {
296
+ "Content-Type": "application/json",
297
+ "x-product-id": this.config.productId,
298
+ ...this.config.headers
299
+ },
300
+ body: JSON.stringify({ query, variables })
301
+ });
302
+ if (!response.ok) {
303
+ console.error(
304
+ "[WebSDK] GraphQL request failed",
305
+ response.status,
306
+ response.statusText
307
+ );
308
+ return {
309
+ errors: [
310
+ {
311
+ message: `HTTP ${response.status}: ${response.statusText}`,
312
+ extensions: { code: `HTTP_${response.status}` }
313
+ }
314
+ ]
315
+ };
316
+ }
317
+ return await response.json();
318
+ } catch (error) {
319
+ console.error(
320
+ "[WebSDK] Network error",
321
+ error instanceof Error ? error.message : "unknown error"
322
+ );
323
+ return {
324
+ errors: [
325
+ {
326
+ message: error instanceof Error ? error.message : "Network error",
327
+ extensions: { code: "NETWORK_ERROR" }
328
+ }
329
+ ]
330
+ };
331
+ }
332
+ }
333
+ };
334
+ __publicField(_WebSDKClient, "CACHE_TTL", 5 * 60 * 1e3);
335
+ // 5 minutes
336
+ __publicField(_WebSDKClient, "MAX_CACHE_ENTRIES", 100);
337
+ var WebSDKContext = react.createContext(null);
338
+ function useWebSDK() {
339
+ const client = react.useContext(WebSDKContext);
340
+ if (!client) {
341
+ throw new Error("useWebSDK must be used within a WebSDKProvider");
342
+ }
343
+ return client;
344
+ }
345
+ function PageHead({
346
+ title,
347
+ description,
348
+ productName,
349
+ keywords,
350
+ image,
351
+ url,
352
+ favicon,
353
+ robots = "index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1",
354
+ locale = "en_US",
355
+ twitterHandle,
356
+ themeColor = "#000000",
357
+ structuredData,
358
+ additionalMeta
359
+ }) {
360
+ const fullTitle = productName && !title.includes(productName) ? `${title} | ${productName}` : title;
361
+ const fullImageUrl = image && !image.startsWith("http") && url ? `${url.replace(/\/$/, "")}${image}` : image;
362
+ const structuredDataItems = structuredData ? Array.isArray(structuredData) ? structuredData : [structuredData] : [];
363
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactHelmetAsync.Helmet, { children: [
364
+ /* @__PURE__ */ jsxRuntime.jsx("title", { children: fullTitle }),
365
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "title", content: fullTitle }),
366
+ description && /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "description", content: description }),
367
+ keywords && /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "keywords", content: keywords }),
368
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "author", content: "Burdenoff Consultancy Services Pvt Ltd" }),
369
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "robots", content: robots }),
370
+ url && /* @__PURE__ */ jsxRuntime.jsx("link", { rel: "canonical", href: url }),
371
+ favicon && /* @__PURE__ */ jsxRuntime.jsx("link", { rel: "icon", href: favicon }),
372
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { property: "og:type", content: "website" }),
373
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { property: "og:title", content: fullTitle }),
374
+ description && /* @__PURE__ */ jsxRuntime.jsx("meta", { property: "og:description", content: description }),
375
+ fullImageUrl && /* @__PURE__ */ jsxRuntime.jsx("meta", { property: "og:image", content: fullImageUrl }),
376
+ url && /* @__PURE__ */ jsxRuntime.jsx("meta", { property: "og:url", content: url }),
377
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { property: "og:locale", content: locale }),
378
+ productName && /* @__PURE__ */ jsxRuntime.jsx("meta", { property: "og:site_name", content: productName }),
379
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "twitter:card", content: "summary_large_image" }),
380
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "twitter:title", content: fullTitle }),
381
+ description && /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "twitter:description", content: description }),
382
+ fullImageUrl && /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "twitter:image", content: fullImageUrl }),
383
+ twitterHandle && /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "twitter:creator", content: twitterHandle }),
384
+ /* @__PURE__ */ jsxRuntime.jsx("meta", { name: "theme-color", content: themeColor }),
385
+ structuredDataItems.map((data, index) => /* @__PURE__ */ jsxRuntime.jsx("script", { type: "application/ld+json", children: JSON.stringify(data) }, `ld-${index}`)),
386
+ additionalMeta?.map((meta, index) => /* @__PURE__ */ jsxRuntime.jsx(
387
+ "meta",
388
+ {
389
+ ...meta.name ? { name: meta.name } : {},
390
+ ...meta.property ? { property: meta.property } : {},
391
+ content: meta.content
392
+ },
393
+ `meta-${index}`
394
+ ))
395
+ ] });
396
+ }
397
+ function dedupAcross(lists) {
398
+ const seen = /* @__PURE__ */ new Set();
399
+ return lists.map((list) => {
400
+ const out = [];
401
+ for (const p of list) {
402
+ if (!seen.has(p.id)) {
403
+ seen.add(p.id);
404
+ out.push(p);
405
+ }
406
+ }
407
+ return out;
408
+ });
409
+ }
410
+ function FeaturedHeroCard({
411
+ product,
412
+ onNavigate
413
+ }) {
414
+ const priceLabel = formatPrice(
415
+ product.price,
416
+ product.currency,
417
+ product.pricingModel
418
+ );
419
+ return /* @__PURE__ */ jsxRuntime.jsxs(
420
+ "button",
421
+ {
422
+ type: "button",
423
+ onClick: () => onNavigate(`/store/${product.slug}`),
424
+ className: "group w-full text-left h-full rounded-2xl border border-border bg-card overflow-hidden hover:border-primary/40 transition-all duration-300 hover:shadow-xl hover:shadow-primary/10 flex flex-col",
425
+ children: [
426
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative h-44 sm:h-52 bg-gradient-to-br from-primary/20 via-primary/8 to-background overflow-hidden flex-shrink-0", children: [
427
+ product.bannerUrl ? /* @__PURE__ */ jsxRuntime.jsx(
428
+ "img",
429
+ {
430
+ src: product.bannerUrl,
431
+ alt: "",
432
+ "aria-hidden": "true",
433
+ className: "w-full h-full object-cover"
434
+ }
435
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
436
+ /* @__PURE__ */ jsxRuntime.jsxs(
437
+ "svg",
438
+ {
439
+ className: "absolute inset-0 w-full h-full opacity-[0.07]",
440
+ xmlns: "http://www.w3.org/2000/svg",
441
+ "aria-hidden": "true",
442
+ children: [
443
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx(
444
+ "pattern",
445
+ {
446
+ id: "fg-hero-grid",
447
+ width: "36",
448
+ height: "36",
449
+ patternUnits: "userSpaceOnUse",
450
+ children: /* @__PURE__ */ jsxRuntime.jsx(
451
+ "path",
452
+ {
453
+ d: "M 36 0 L 0 0 0 36",
454
+ fill: "none",
455
+ stroke: "currentColor",
456
+ strokeWidth: "1"
457
+ }
458
+ )
459
+ }
460
+ ) }),
461
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "100%", height: "100%", fill: "url(#fg-hero-grid)" })
462
+ ]
463
+ }
464
+ ),
465
+ /* @__PURE__ */ jsxRuntime.jsx(
466
+ "div",
467
+ {
468
+ className: "absolute inset-0 flex items-center justify-center",
469
+ "aria-hidden": "true",
470
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
471
+ "svg",
472
+ {
473
+ viewBox: "0 0 64 64",
474
+ className: "w-20 h-20 opacity-25",
475
+ fill: "none",
476
+ xmlns: "http://www.w3.org/2000/svg",
477
+ children: [
478
+ /* @__PURE__ */ jsxRuntime.jsx(
479
+ "polygon",
480
+ {
481
+ points: "32,8 56,20 32,32 8,20",
482
+ className: "fill-primary/40",
483
+ stroke: "currentColor",
484
+ strokeWidth: "1",
485
+ strokeOpacity: "0.5"
486
+ }
487
+ ),
488
+ /* @__PURE__ */ jsxRuntime.jsx(
489
+ "polygon",
490
+ {
491
+ points: "8,20 32,32 32,56 8,44",
492
+ className: "fill-primary/20",
493
+ stroke: "currentColor",
494
+ strokeWidth: "1",
495
+ strokeOpacity: "0.5"
496
+ }
497
+ ),
498
+ /* @__PURE__ */ jsxRuntime.jsx(
499
+ "polygon",
500
+ {
501
+ points: "56,20 32,32 32,56 56,44",
502
+ className: "fill-primary/30",
503
+ stroke: "currentColor",
504
+ strokeWidth: "1",
505
+ strokeOpacity: "0.5"
506
+ }
507
+ )
508
+ ]
509
+ }
510
+ )
511
+ }
512
+ )
513
+ ] }),
514
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute top-3 left-3 text-xs font-semibold px-2.5 py-1 rounded-full bg-primary text-primary-foreground shadow-sm", children: "Featured" }),
515
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute bottom-4 left-4 w-14 h-14 rounded-xl shadow-lg overflow-hidden border-2 border-background", children: product.icon ? /* @__PURE__ */ jsxRuntime.jsx(
516
+ "img",
517
+ {
518
+ src: product.icon,
519
+ alt: "",
520
+ "aria-hidden": "true",
521
+ className: "w-full h-full object-cover"
522
+ }
523
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full bg-gradient-to-br from-primary/25 to-primary/10 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs(
524
+ "svg",
525
+ {
526
+ viewBox: "0 0 32 32",
527
+ className: "w-8 h-8",
528
+ fill: "none",
529
+ xmlns: "http://www.w3.org/2000/svg",
530
+ "aria-hidden": "true",
531
+ children: [
532
+ /* @__PURE__ */ jsxRuntime.jsx(
533
+ "polygon",
534
+ {
535
+ points: "16,4 28,10 16,16 4,10",
536
+ className: "fill-primary/40",
537
+ stroke: "currentColor",
538
+ strokeWidth: "0.6",
539
+ strokeOpacity: "0.4"
540
+ }
541
+ ),
542
+ /* @__PURE__ */ jsxRuntime.jsx(
543
+ "polygon",
544
+ {
545
+ points: "4,10 16,16 16,28 4,22",
546
+ className: "fill-primary/20",
547
+ stroke: "currentColor",
548
+ strokeWidth: "0.6",
549
+ strokeOpacity: "0.4"
550
+ }
551
+ ),
552
+ /* @__PURE__ */ jsxRuntime.jsx(
553
+ "polygon",
554
+ {
555
+ points: "28,10 16,16 16,28 28,22",
556
+ className: "fill-primary/30",
557
+ stroke: "currentColor",
558
+ strokeWidth: "0.6",
559
+ strokeOpacity: "0.4"
560
+ }
561
+ )
562
+ ]
563
+ }
564
+ ) }) })
565
+ ] }),
566
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-5 flex flex-col flex-1", children: [
567
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-3 mb-2", children: [
568
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-base font-bold text-foreground group-hover:text-primary transition-colors line-clamp-1", children: product.name }),
569
+ /* @__PURE__ */ jsxRuntime.jsx(
570
+ "span",
571
+ {
572
+ className: `text-sm font-bold flex-shrink-0 ${priceLabel === "Free" ? "text-emerald-500" : "text-foreground"}`,
573
+ children: priceLabel
574
+ }
575
+ )
576
+ ] }),
577
+ product.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground line-clamp-2 leading-relaxed flex-1", children: product.description }),
578
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 flex items-center gap-2", children: [
579
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs px-2 py-0.5 rounded-full bg-primary/10 text-primary font-medium", children: product.type }),
580
+ product.authorName && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground truncate", children: [
581
+ "by ",
582
+ product.authorName
583
+ ] })
584
+ ] })
585
+ ] })
586
+ ]
587
+ }
588
+ );
589
+ }
590
+ function ScrollRow({
591
+ products,
592
+ onProductClick
593
+ }) {
594
+ const ref = react.useRef(null);
595
+ function scroll(dir) {
596
+ ref.current?.scrollBy({
597
+ left: dir === "r" ? 272 : -272,
598
+ behavior: "smooth"
599
+ });
600
+ }
601
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative group/row", children: [
602
+ /* @__PURE__ */ jsxRuntime.jsx(
603
+ "button",
604
+ {
605
+ type: "button",
606
+ onClick: () => scroll("l"),
607
+ "aria-label": "Scroll left",
608
+ className: "absolute left-0 top-1/2 -translate-y-1/2 -translate-x-4 z-10 w-8 h-8 rounded-full bg-background border border-border shadow-md items-center justify-center text-muted-foreground hover:text-primary hover:border-primary/40 transition-all hidden sm:flex opacity-0 group-hover/row:opacity-100",
609
+ children: /* @__PURE__ */ jsxRuntime.jsx(
610
+ "svg",
611
+ {
612
+ viewBox: "0 0 16 16",
613
+ className: "w-4 h-4",
614
+ fill: "none",
615
+ stroke: "currentColor",
616
+ strokeWidth: "1.5",
617
+ strokeLinecap: "round",
618
+ strokeLinejoin: "round",
619
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10 3L6 8l4 5" })
620
+ }
621
+ )
622
+ }
623
+ ),
624
+ /* @__PURE__ */ jsxRuntime.jsx(
625
+ "div",
626
+ {
627
+ ref,
628
+ className: "flex gap-3 overflow-x-auto pb-1 snap-x snap-mandatory",
629
+ style: { scrollbarWidth: "none", msOverflowStyle: "none" },
630
+ children: products.map((product) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 w-56 snap-start", children: /* @__PURE__ */ jsxRuntime.jsx(
631
+ ProductCard,
632
+ {
633
+ product,
634
+ onClick: () => onProductClick(product)
635
+ }
636
+ ) }, product.id))
637
+ }
638
+ ),
639
+ /* @__PURE__ */ jsxRuntime.jsx(
640
+ "button",
641
+ {
642
+ type: "button",
643
+ onClick: () => scroll("r"),
644
+ "aria-label": "Scroll right",
645
+ className: "absolute right-0 top-1/2 -translate-y-1/2 translate-x-4 z-10 w-8 h-8 rounded-full bg-background border border-border shadow-md items-center justify-center text-muted-foreground hover:text-primary hover:border-primary/40 transition-all hidden sm:flex opacity-0 group-hover/row:opacity-100",
646
+ children: /* @__PURE__ */ jsxRuntime.jsx(
647
+ "svg",
648
+ {
649
+ viewBox: "0 0 16 16",
650
+ className: "w-4 h-4",
651
+ fill: "none",
652
+ stroke: "currentColor",
653
+ strokeWidth: "1.5",
654
+ strokeLinecap: "round",
655
+ strokeLinejoin: "round",
656
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 3l4 5-4 5" })
657
+ }
658
+ )
659
+ }
660
+ )
661
+ ] });
662
+ }
663
+ function SectionHead({
664
+ title,
665
+ hint,
666
+ browseHref,
667
+ onNavigate
668
+ }) {
669
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-end justify-between mb-5 gap-4", children: [
670
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
671
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-xl font-bold text-foreground", children: title }),
672
+ hint && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground mt-0.5", children: hint })
673
+ ] }),
674
+ /* @__PURE__ */ jsxRuntime.jsx(
675
+ "button",
676
+ {
677
+ type: "button",
678
+ onClick: () => onNavigate(browseHref),
679
+ className: "text-sm text-primary hover:underline font-medium flex-shrink-0 underline-offset-2",
680
+ children: "See all \u2192"
681
+ }
682
+ )
683
+ ] });
684
+ }
685
+ var TYPE_FILTERS = [
686
+ { type: "NODE", label: "Nodes" },
687
+ { type: "WORKFLOW", label: "Workflows" },
688
+ { type: "TEMPLATE", label: "Templates" },
689
+ { type: "INTEGRATION", label: "Integrations" },
690
+ { type: "APP", label: "Apps" },
691
+ { type: "EXTENSION", label: "Extensions" }
692
+ ];
693
+ function TypeFilters({
694
+ browsePath,
695
+ onNavigate
696
+ }) {
697
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2 justify-center", children: TYPE_FILTERS.map((f) => /* @__PURE__ */ jsxRuntime.jsx(
698
+ "button",
699
+ {
700
+ type: "button",
701
+ onClick: () => onNavigate(`${browsePath}?type=${f.type}`),
702
+ className: "px-4 py-1.5 rounded-full border border-border bg-background text-sm text-foreground hover:border-primary/50 hover:bg-primary/5 hover:text-primary transition-all duration-200",
703
+ children: f.label
704
+ },
705
+ f.type
706
+ )) });
707
+ }
708
+ function HeroCardSkeleton() {
709
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-2xl border border-border bg-card overflow-hidden animate-pulse h-full", children: [
710
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-44 sm:h-52 bg-muted" }),
711
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-5 space-y-3", children: [
712
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-5 bg-muted rounded w-1/2" }),
713
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 bg-muted rounded w-3/4" }),
714
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 bg-muted rounded w-5/6" }),
715
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-5 bg-muted rounded w-16 mt-2" })
716
+ ] })
717
+ ] });
718
+ }
719
+ function GridCardSkeleton() {
720
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-border bg-card p-4 h-36 animate-pulse", children: [
721
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 mb-3", children: [
722
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-12 h-12 rounded-lg bg-muted flex-shrink-0" }),
723
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-2 pt-1", children: [
724
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 bg-muted rounded w-3/4" }),
725
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 bg-muted rounded w-1/2" })
726
+ ] })
727
+ ] }),
728
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 bg-muted rounded w-full mb-2" }),
729
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 bg-muted rounded w-5/6" })
730
+ ] });
731
+ }
732
+ function ScrollCardSkeleton() {
733
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-shrink-0 w-56 rounded-xl border border-border bg-card p-4 h-36 animate-pulse", children: [
734
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-3 mb-3", children: [
735
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-12 h-12 rounded-lg bg-muted flex-shrink-0" }),
736
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-2 pt-1", children: [
737
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 bg-muted rounded w-3/4" }),
738
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 bg-muted rounded w-1/2" })
739
+ ] })
740
+ ] }),
741
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 bg-muted rounded w-full mb-2" }),
742
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 bg-muted rounded w-5/6" })
743
+ ] });
744
+ }
745
+ function StoreHomePage({
746
+ compatibleWith,
747
+ appLoginUrl,
748
+ onNavigate,
749
+ productName,
750
+ heroTitle,
751
+ heroSubtitle,
752
+ browsePath = "/store/browse",
753
+ seoTitle,
754
+ seoDescription,
755
+ seoKeywords
756
+ }) {
757
+ const client = useWebSDK();
758
+ const [grouped, setGrouped] = react.useState(null);
759
+ const [loading, setLoading] = react.useState(true);
760
+ const [error, setError] = react.useState(null);
761
+ react.useEffect(() => {
762
+ let cancelled = false;
763
+ async function load() {
764
+ setLoading(true);
765
+ try {
766
+ const res = await client.query(
767
+ HOME_GROUPED_PRODUCTS_QUERY,
768
+ { compatibleWith: compatibleWith ?? null }
769
+ );
770
+ if (cancelled) return;
771
+ if (res.errors?.length) throw new Error(res.errors[0].message);
772
+ if (!res.data?.homeGroupedProducts) throw new Error("No data");
773
+ setGrouped(res.data.homeGroupedProducts);
774
+ setError(null);
775
+ } catch {
776
+ if (!cancelled) setError("Failed to load store. Please try again.");
777
+ } finally {
778
+ if (!cancelled) setLoading(false);
779
+ }
780
+ }
781
+ load();
782
+ return () => {
783
+ cancelled = true;
784
+ };
785
+ }, [client, compatibleWith]);
786
+ function navigate(path) {
787
+ if (onNavigate) {
788
+ onNavigate(path);
789
+ return;
790
+ }
791
+ window.location.href = path;
792
+ }
793
+ function handleProductClick(product) {
794
+ navigate(`/store/${product.slug}`);
795
+ }
796
+ const deduped = grouped ? dedupAcross([grouped.featured, grouped.mostDownloaded, grouped.freeItems]) : [[], [], []];
797
+ const featuredItems = deduped[0] ?? [];
798
+ const popularItems = deduped[1] ?? [];
799
+ const freeItems = deduped[2] ?? [];
800
+ const resolvedTitle = heroTitle ?? `${productName ? `${productName} ` : ""}Store`;
801
+ const resolvedSubtitle = heroSubtitle ?? "Discover workflows, nodes, integrations, and templates built by the community.";
802
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full", children: [
803
+ /* @__PURE__ */ jsxRuntime.jsx(
804
+ PageHead,
805
+ {
806
+ title: seoTitle ?? `Store${productName ? ` \u2013 ${productName}` : ""}`,
807
+ description: seoDescription ?? resolvedSubtitle,
808
+ keywords: seoKeywords,
809
+ productName
810
+ }
811
+ ),
812
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "relative overflow-hidden pt-14 pb-12 sm:pt-20 sm:pb-16", children: [
813
+ /* @__PURE__ */ jsxRuntime.jsx(
814
+ "div",
815
+ {
816
+ className: "absolute inset-0 bg-gradient-to-b from-background via-primary/[0.06] to-background pointer-events-none",
817
+ "aria-hidden": "true"
818
+ }
819
+ ),
820
+ /* @__PURE__ */ jsxRuntime.jsxs(
821
+ "svg",
822
+ {
823
+ className: "absolute inset-0 w-full h-full opacity-[0.035] pointer-events-none",
824
+ xmlns: "http://www.w3.org/2000/svg",
825
+ "aria-hidden": "true",
826
+ children: [
827
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx(
828
+ "pattern",
829
+ {
830
+ id: "store-home-grid",
831
+ width: "40",
832
+ height: "40",
833
+ patternUnits: "userSpaceOnUse",
834
+ children: /* @__PURE__ */ jsxRuntime.jsx(
835
+ "path",
836
+ {
837
+ d: "M 40 0 L 0 0 0 40",
838
+ fill: "none",
839
+ stroke: "currentColor",
840
+ strokeWidth: "1"
841
+ }
842
+ )
843
+ }
844
+ ) }),
845
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "100%", height: "100%", fill: "url(#store-home-grid)" })
846
+ ]
847
+ }
848
+ ),
849
+ /* @__PURE__ */ jsxRuntime.jsx(
850
+ "div",
851
+ {
852
+ className: "absolute -top-16 left-1/3 w-80 h-80 rounded-full bg-primary/10 blur-3xl pointer-events-none",
853
+ "aria-hidden": "true"
854
+ }
855
+ ),
856
+ /* @__PURE__ */ jsxRuntime.jsx(
857
+ "div",
858
+ {
859
+ className: "absolute top-8 right-1/4 w-56 h-56 rounded-full bg-primary/8 blur-2xl pointer-events-none",
860
+ "aria-hidden": "true"
861
+ }
862
+ ),
863
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 text-center", children: [
864
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex items-center gap-2 px-3 py-1 rounded-full border border-primary/30 bg-primary/10 text-xs font-semibold text-primary mb-5", children: [
865
+ /* @__PURE__ */ jsxRuntime.jsx(
866
+ "span",
867
+ {
868
+ className: "w-1.5 h-1.5 rounded-full bg-primary flex-shrink-0",
869
+ "aria-hidden": "true"
870
+ }
871
+ ),
872
+ "Community Marketplace"
873
+ ] }),
874
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-4xl sm:text-5xl md:text-6xl font-extrabold tracking-tight text-foreground mb-4 leading-[1.08]", children: resolvedTitle }),
875
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg text-muted-foreground max-w-2xl mx-auto mb-8 leading-relaxed", children: resolvedSubtitle }),
876
+ /* @__PURE__ */ jsxRuntime.jsxs(
877
+ "form",
878
+ {
879
+ className: "max-w-xl mx-auto flex gap-2 mb-7",
880
+ onSubmit: (e) => {
881
+ e.preventDefault();
882
+ const q = new FormData(e.currentTarget).get("q");
883
+ navigate(
884
+ q.trim() ? `${browsePath}?q=${encodeURIComponent(q.trim())}` : browsePath
885
+ );
886
+ },
887
+ children: [
888
+ /* @__PURE__ */ jsxRuntime.jsx(
889
+ "input",
890
+ {
891
+ name: "q",
892
+ type: "search",
893
+ placeholder: "Search nodes, workflows, templates\u2026",
894
+ className: "flex-1 h-12 rounded-xl border border-border bg-background px-4 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/40 shadow-sm"
895
+ }
896
+ ),
897
+ /* @__PURE__ */ jsxRuntime.jsx(
898
+ "button",
899
+ {
900
+ type: "submit",
901
+ className: "h-12 px-6 rounded-xl bg-primary text-primary-foreground text-sm font-semibold hover:opacity-90 transition-opacity shadow-sm",
902
+ children: "Search"
903
+ }
904
+ )
905
+ ]
906
+ }
907
+ ),
908
+ /* @__PURE__ */ jsxRuntime.jsx(TypeFilters, { browsePath, onNavigate: navigate })
909
+ ] })
910
+ ] }),
911
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 pb-20 space-y-14 pt-4", children: [
912
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { children: [
913
+ /* @__PURE__ */ jsxRuntime.jsx(
914
+ SectionHead,
915
+ {
916
+ title: "Featured",
917
+ hint: "Hand-picked highlights from the community",
918
+ browseHref: `${browsePath}?featured=true`,
919
+ onNavigate: navigate
920
+ }
921
+ ),
922
+ loading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-[1fr_2fr] gap-4 items-start", children: [
923
+ /* @__PURE__ */ jsxRuntime.jsx(HeroCardSkeleton, {}),
924
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [...Array(4)].map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(GridCardSkeleton, {}, i)) })
925
+ ] }) : error ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-16 text-center", children: [
926
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mb-4", children: error }),
927
+ /* @__PURE__ */ jsxRuntime.jsx(
928
+ "button",
929
+ {
930
+ type: "button",
931
+ onClick: () => window.location.reload(),
932
+ className: "text-sm text-primary hover:underline",
933
+ children: "Retry"
934
+ }
935
+ )
936
+ ] }) : featuredItems.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-[1fr_2fr] gap-4 items-start", children: [
937
+ /* @__PURE__ */ jsxRuntime.jsx(
938
+ FeaturedHeroCard,
939
+ {
940
+ product: featuredItems[0],
941
+ onNavigate: navigate
942
+ }
943
+ ),
944
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: featuredItems.slice(1, 5).map((product) => /* @__PURE__ */ jsxRuntime.jsx(
945
+ ProductCard,
946
+ {
947
+ product,
948
+ onClick: () => handleProductClick(product)
949
+ },
950
+ product.id
951
+ )) })
952
+ ] }) : null
953
+ ] }),
954
+ (loading || popularItems.length > 0) && /* @__PURE__ */ jsxRuntime.jsxs("section", { children: [
955
+ /* @__PURE__ */ jsxRuntime.jsx(
956
+ SectionHead,
957
+ {
958
+ title: "Most Popular",
959
+ hint: "Top downloads across the community",
960
+ browseHref: `${browsePath}?sortBy=DOWNLOADS`,
961
+ onNavigate: navigate
962
+ }
963
+ ),
964
+ loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3 overflow-hidden", children: [...Array(5)].map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(ScrollCardSkeleton, {}, i)) }) : /* @__PURE__ */ jsxRuntime.jsx(
965
+ ScrollRow,
966
+ {
967
+ products: popularItems,
968
+ onProductClick: handleProductClick
969
+ }
970
+ )
971
+ ] }),
972
+ (loading || freeItems.length > 0) && /* @__PURE__ */ jsxRuntime.jsxs("section", { children: [
973
+ /* @__PURE__ */ jsxRuntime.jsx(
974
+ SectionHead,
975
+ {
976
+ title: "Free to Use",
977
+ hint: "Zero cost, full power \u2014 community-contributed freebies",
978
+ browseHref: `${browsePath}?pricingModel=FREE`,
979
+ onNavigate: navigate
980
+ }
981
+ ),
982
+ loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4", children: [...Array(6)].map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(GridCardSkeleton, {}, i)) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4", children: freeItems.slice(0, 6).map((product) => /* @__PURE__ */ jsxRuntime.jsx(
983
+ ProductCard,
984
+ {
985
+ product,
986
+ onClick: () => handleProductClick(product)
987
+ },
988
+ product.id
989
+ )) })
990
+ ] })
991
+ ] }),
992
+ /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "relative overflow-hidden border-t border-border", children: [
993
+ /* @__PURE__ */ jsxRuntime.jsx(
994
+ "div",
995
+ {
996
+ className: "absolute inset-0 bg-gradient-to-br from-primary/8 via-background to-primary/5 pointer-events-none",
997
+ "aria-hidden": "true"
998
+ }
999
+ ),
1000
+ /* @__PURE__ */ jsxRuntime.jsx(
1001
+ "div",
1002
+ {
1003
+ className: "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-80 h-40 rounded-full bg-primary/12 blur-3xl pointer-events-none",
1004
+ "aria-hidden": "true"
1005
+ }
1006
+ ),
1007
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative max-w-2xl mx-auto px-4 py-16 text-center", children: [
1008
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex items-center gap-2 px-3 py-1 rounded-full border border-primary/30 bg-primary/10 text-xs font-semibold text-primary mb-5", children: [
1009
+ /* @__PURE__ */ jsxRuntime.jsx(
1010
+ "span",
1011
+ {
1012
+ className: "w-1.5 h-1.5 rounded-full bg-primary flex-shrink-0",
1013
+ "aria-hidden": "true"
1014
+ }
1015
+ ),
1016
+ "Become a publisher"
1017
+ ] }),
1018
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-2xl sm:text-3xl font-bold text-foreground mb-3", children: "Built something useful?" }),
1019
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground mb-8 max-w-lg mx-auto leading-relaxed", children: [
1020
+ "Share your workflows, nodes, and integrations with",
1021
+ " ",
1022
+ productName ?? "the",
1023
+ " community. Earn from your work or contribute for free."
1024
+ ] }),
1025
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col sm:flex-row gap-3 justify-center", children: [
1026
+ /* @__PURE__ */ jsxRuntime.jsx(
1027
+ "a",
1028
+ {
1029
+ href: appLoginUrl,
1030
+ target: "_blank",
1031
+ rel: "noopener noreferrer",
1032
+ className: "inline-flex items-center justify-center h-11 px-7 rounded-lg bg-primary text-primary-foreground text-sm font-semibold hover:opacity-90 transition-opacity",
1033
+ children: "Submit to Store"
1034
+ }
1035
+ ),
1036
+ /* @__PURE__ */ jsxRuntime.jsx(
1037
+ "button",
1038
+ {
1039
+ type: "button",
1040
+ onClick: () => navigate(browsePath),
1041
+ className: "inline-flex items-center justify-center h-11 px-7 rounded-lg border border-border bg-background text-sm font-medium text-foreground hover:border-primary/40 hover:bg-primary/5 transition-all",
1042
+ children: "Browse the store"
1043
+ }
1044
+ )
1045
+ ] })
1046
+ ] })
1047
+ ] })
1048
+ ] });
1049
+ }
1050
+ var SORT_OPTIONS = [
1051
+ { value: "RELEVANCE", label: "Relevance" },
1052
+ { value: "NEWEST", label: "Newest" },
1053
+ { value: "DOWNLOADS", label: "Most Downloaded" },
1054
+ { value: "RATING", label: "Top Rated" },
1055
+ { value: "PRICE_LOW", label: "Price: Low to High" },
1056
+ { value: "PRICE_HIGH", label: "Price: High to Low" },
1057
+ { value: "NAME_ASC", label: "Name A\u2013Z" }
1058
+ ];
1059
+ var TYPE_OPTIONS = [
1060
+ { value: "", label: "All types" },
1061
+ { value: "APP", label: "Apps" },
1062
+ { value: "NODE", label: "Nodes" },
1063
+ { value: "WORKFLOW", label: "Workflows" },
1064
+ { value: "TEMPLATE", label: "Templates" },
1065
+ { value: "INTEGRATION", label: "Integrations" },
1066
+ { value: "EXTENSION", label: "Extensions" },
1067
+ { value: "THEME", label: "Themes" }
1068
+ ];
1069
+ var PRICING_OPTIONS = [
1070
+ { value: "", label: "All pricing" },
1071
+ { value: "FREE", label: "Free" },
1072
+ { value: "ONE_TIME", label: "Paid (one-time)" },
1073
+ { value: "SUBSCRIPTION", label: "Subscription" }
1074
+ ];
1075
+ function parseUrlParams() {
1076
+ if (typeof window === "undefined")
1077
+ return {
1078
+ q: "",
1079
+ type: "",
1080
+ pricingModel: "",
1081
+ category: "",
1082
+ sortBy: "RELEVANCE",
1083
+ featured: false
1084
+ };
1085
+ const p = new URLSearchParams(window.location.search);
1086
+ return {
1087
+ q: p.get("q") ?? "",
1088
+ type: p.get("type") ?? "",
1089
+ pricingModel: p.get("pricingModel") ?? "",
1090
+ category: p.get("category") ?? "",
1091
+ sortBy: p.get("sortBy") ?? (p.get("q") ? "RELEVANCE" : "NEWEST"),
1092
+ featured: p.get("featured") === "true"
1093
+ };
1094
+ }
1095
+ function FacetList({
1096
+ title,
1097
+ facets,
1098
+ selected,
1099
+ onSelect
1100
+ }) {
1101
+ if (facets.length === 0) return null;
1102
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1103
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2", children: title }),
1104
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-1", children: facets.map((f) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
1105
+ "button",
1106
+ {
1107
+ type: "button",
1108
+ onClick: () => onSelect(selected === f.value ? "" : f.value),
1109
+ className: `w-full text-left text-sm px-2 py-1 rounded flex items-center justify-between gap-2 transition-colors ${selected === f.value ? "bg-primary/10 text-primary font-medium" : "text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,
1110
+ children: [
1111
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: f.value }),
1112
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs opacity-60 flex-shrink-0", children: f.count })
1113
+ ]
1114
+ }
1115
+ ) }, f.value)) })
1116
+ ] });
1117
+ }
1118
+ function StoreBrowsePage({
1119
+ compatibleWith,
1120
+ onNavigate,
1121
+ productName,
1122
+ seoTitle,
1123
+ seoDescription
1124
+ }) {
1125
+ const client = useWebSDK();
1126
+ const initial = parseUrlParams();
1127
+ const [search, setSearch] = react.useState(initial.q);
1128
+ const [inputValue, setInputValue] = react.useState(initial.q);
1129
+ const [type, setType] = react.useState(initial.type);
1130
+ const [pricingModel, setPricingModel] = react.useState(initial.pricingModel);
1131
+ const [category, setCategory] = react.useState(initial.category);
1132
+ const [sortBy, setSortBy] = react.useState(initial.sortBy);
1133
+ const [featured, setFeatured] = react.useState(initial.featured);
1134
+ const [offset, setOffset] = react.useState(0);
1135
+ const [result, setResult] = react.useState(null);
1136
+ const [allProducts, setAllProducts] = react.useState(
1137
+ []
1138
+ );
1139
+ const [categories, setCategories] = react.useState([]);
1140
+ const [loading, setLoading] = react.useState(true);
1141
+ const [loadingMore, setLoadingMore] = react.useState(false);
1142
+ const [filtersOpen, setFiltersOpen] = react.useState(false);
1143
+ const searchRef = react.useRef(null);
1144
+ const PAGE_SIZE = 24;
1145
+ react.useEffect(() => {
1146
+ client.query(CATEGORIES_QUERY, {}).then((r) => {
1147
+ if (r.data?.categories) setCategories(r.data.categories);
1148
+ }).catch(() => {
1149
+ });
1150
+ }, [client]);
1151
+ react.useEffect(() => {
1152
+ let cancelled = false;
1153
+ setOffset(0);
1154
+ setLoading(true);
1155
+ setAllProducts([]);
1156
+ client.query(BROWSE_STORE_QUERY, {
1157
+ input: {
1158
+ filter: {
1159
+ search: search || void 0,
1160
+ type: type || void 0,
1161
+ pricingModel: pricingModel || void 0,
1162
+ category: category || void 0,
1163
+ compatibleWith: compatibleWith ?? void 0,
1164
+ featured: featured || void 0
1165
+ },
1166
+ sortBy,
1167
+ pagination: { limit: PAGE_SIZE, offset: 0 }
1168
+ }
1169
+ }).then((r) => {
1170
+ if (cancelled) return;
1171
+ if (r.data?.browseStore) {
1172
+ setResult(r.data.browseStore);
1173
+ setAllProducts(r.data.browseStore.products);
1174
+ }
1175
+ }).catch(() => {
1176
+ }).finally(() => {
1177
+ if (!cancelled) setLoading(false);
1178
+ });
1179
+ return () => {
1180
+ cancelled = true;
1181
+ };
1182
+ }, [
1183
+ client,
1184
+ search,
1185
+ type,
1186
+ pricingModel,
1187
+ category,
1188
+ sortBy,
1189
+ compatibleWith,
1190
+ featured
1191
+ ]);
1192
+ function loadMore() {
1193
+ const nextOffset = offset + PAGE_SIZE;
1194
+ setLoadingMore(true);
1195
+ client.query(BROWSE_STORE_QUERY, {
1196
+ input: {
1197
+ filter: {
1198
+ search: search || void 0,
1199
+ type: type || void 0,
1200
+ pricingModel: pricingModel || void 0,
1201
+ category: category || void 0,
1202
+ compatibleWith: compatibleWith ?? void 0,
1203
+ featured: featured || void 0
1204
+ },
1205
+ sortBy,
1206
+ pagination: { limit: PAGE_SIZE, offset: nextOffset }
1207
+ }
1208
+ }).then((r) => {
1209
+ if (r.data?.browseStore) {
1210
+ setResult(r.data.browseStore);
1211
+ setAllProducts((prev) => [...prev, ...r.data.browseStore.products]);
1212
+ setOffset(nextOffset);
1213
+ }
1214
+ }).catch(() => {
1215
+ }).finally(() => setLoadingMore(false));
1216
+ }
1217
+ function navigate(path) {
1218
+ if (onNavigate) {
1219
+ onNavigate(path);
1220
+ return;
1221
+ }
1222
+ window.location.href = path;
1223
+ }
1224
+ function handleSearchSubmit(e) {
1225
+ e.preventDefault();
1226
+ setSearch(inputValue);
1227
+ setSortBy(inputValue ? "RELEVANCE" : "NEWEST");
1228
+ }
1229
+ function resetFilters() {
1230
+ setSearch("");
1231
+ setInputValue("");
1232
+ setType("");
1233
+ setPricingModel("");
1234
+ setCategory("");
1235
+ setSortBy("NEWEST");
1236
+ setFeatured(false);
1237
+ searchRef.current?.focus();
1238
+ }
1239
+ const hasActiveFilters = !!(search || type || pricingModel || category || featured);
1240
+ const facetTypes = result?.facets?.types ?? [];
1241
+ const facetCategories = result?.facets?.categories ?? [];
1242
+ const sidebarContent = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6", children: [
1243
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1244
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2", children: "Type" }),
1245
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: TYPE_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(
1246
+ "button",
1247
+ {
1248
+ type: "button",
1249
+ onClick: () => setType(opt.value),
1250
+ className: `w-full text-left text-sm px-2 py-1.5 rounded transition-colors ${type === opt.value ? "bg-primary/10 text-primary font-medium" : "text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,
1251
+ children: opt.label
1252
+ },
1253
+ opt.value
1254
+ )) })
1255
+ ] }),
1256
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1257
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2", children: "Pricing" }),
1258
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-1", children: PRICING_OPTIONS.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(
1259
+ "button",
1260
+ {
1261
+ type: "button",
1262
+ onClick: () => setPricingModel(opt.value),
1263
+ className: `w-full text-left text-sm px-2 py-1.5 rounded transition-colors ${pricingModel === opt.value ? "bg-primary/10 text-primary font-medium" : "text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,
1264
+ children: opt.label
1265
+ },
1266
+ opt.value
1267
+ )) })
1268
+ ] }),
1269
+ (facetCategories.length > 0 || categories.length > 0) && /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1270
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2", children: "Category" }),
1271
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1272
+ /* @__PURE__ */ jsxRuntime.jsx(
1273
+ "button",
1274
+ {
1275
+ type: "button",
1276
+ onClick: () => setCategory(""),
1277
+ className: `w-full text-left text-sm px-2 py-1.5 rounded transition-colors ${!category ? "bg-primary/10 text-primary font-medium" : "text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,
1278
+ children: "All categories"
1279
+ }
1280
+ ),
1281
+ (facetCategories.length > 0 ? facetCategories : categories.slice(0, 12).map((c) => ({ value: c.slug, count: 0 }))).map((f) => {
1282
+ const cat = categories.find((c) => c.slug === f.value);
1283
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1284
+ "button",
1285
+ {
1286
+ type: "button",
1287
+ onClick: () => setCategory(category === f.value ? "" : f.value),
1288
+ className: `w-full text-left text-sm px-2 py-1.5 rounded flex items-center justify-between gap-2 transition-colors ${category === f.value ? "bg-primary/10 text-primary font-medium" : "text-muted-foreground hover:text-foreground hover:bg-muted/50"}`,
1289
+ children: [
1290
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: cat?.name ?? f.value }),
1291
+ f.count > 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs opacity-60 flex-shrink-0", children: f.count })
1292
+ ]
1293
+ },
1294
+ f.value
1295
+ );
1296
+ })
1297
+ ] })
1298
+ ] }),
1299
+ facetTypes.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1300
+ FacetList,
1301
+ {
1302
+ title: "Available types",
1303
+ facets: facetTypes,
1304
+ selected: type,
1305
+ onSelect: setType
1306
+ }
1307
+ ),
1308
+ hasActiveFilters && /* @__PURE__ */ jsxRuntime.jsx(
1309
+ "button",
1310
+ {
1311
+ type: "button",
1312
+ onClick: resetFilters,
1313
+ className: "text-sm text-muted-foreground hover:text-foreground underline",
1314
+ children: "Clear all filters"
1315
+ }
1316
+ )
1317
+ ] });
1318
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full", children: [
1319
+ /* @__PURE__ */ jsxRuntime.jsx(
1320
+ PageHead,
1321
+ {
1322
+ title: seoTitle ?? `Browse Store${productName ? ` \u2013 ${productName}` : ""}`,
1323
+ description: seoDescription ?? "Browse all apps, workflows, nodes, and templates.",
1324
+ productName
1325
+ }
1326
+ ),
1327
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8", children: [
1328
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col sm:flex-row gap-3 mb-6", children: [
1329
+ /* @__PURE__ */ jsxRuntime.jsxs("form", { className: "flex-1 flex gap-2", onSubmit: handleSearchSubmit, children: [
1330
+ /* @__PURE__ */ jsxRuntime.jsx(
1331
+ "input",
1332
+ {
1333
+ ref: searchRef,
1334
+ type: "search",
1335
+ value: inputValue,
1336
+ onChange: (e) => setInputValue(e.target.value),
1337
+ placeholder: "Search\u2026",
1338
+ className: "flex-1 h-10 rounded-lg border border-border bg-background px-4 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/50"
1339
+ }
1340
+ ),
1341
+ /* @__PURE__ */ jsxRuntime.jsx(
1342
+ "button",
1343
+ {
1344
+ type: "submit",
1345
+ className: "h-10 px-5 rounded-lg bg-primary text-primary-foreground text-sm font-medium hover:opacity-90 transition-opacity",
1346
+ children: "Search"
1347
+ }
1348
+ )
1349
+ ] }),
1350
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
1351
+ /* @__PURE__ */ jsxRuntime.jsx(
1352
+ "select",
1353
+ {
1354
+ value: sortBy,
1355
+ onChange: (e) => setSortBy(e.target.value),
1356
+ className: "h-10 rounded-lg border border-border bg-background px-3 text-sm text-foreground focus:outline-none focus:ring-2 focus:ring-primary/50",
1357
+ children: SORT_OPTIONS.map((o) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: o.value, children: o.label }, o.value))
1358
+ }
1359
+ ),
1360
+ /* @__PURE__ */ jsxRuntime.jsxs(
1361
+ "button",
1362
+ {
1363
+ type: "button",
1364
+ onClick: () => setFiltersOpen(!filtersOpen),
1365
+ className: "lg:hidden h-10 px-4 rounded-lg border border-border bg-background text-sm text-foreground hover:bg-muted/50 transition-colors",
1366
+ children: [
1367
+ "Filters",
1368
+ " ",
1369
+ hasActiveFilters && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary", children: "\u2022" })
1370
+ ]
1371
+ }
1372
+ )
1373
+ ] })
1374
+ ] }),
1375
+ filtersOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "lg:hidden mb-6 p-4 border border-border rounded-xl bg-card", children: sidebarContent }),
1376
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-8", children: [
1377
+ /* @__PURE__ */ jsxRuntime.jsx("aside", { className: "hidden lg:block w-52 flex-shrink-0", children: sidebarContent }),
1378
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
1379
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-4 flex-wrap", children: [
1380
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-muted-foreground", children: loading ? "Loading\u2026" : `${result?.totalCount ?? 0} results` }),
1381
+ hasActiveFilters && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-1.5", children: [
1382
+ search && /* @__PURE__ */ jsxRuntime.jsx(
1383
+ Chip,
1384
+ {
1385
+ label: `"${search}"`,
1386
+ onRemove: () => {
1387
+ setSearch("");
1388
+ setInputValue("");
1389
+ }
1390
+ }
1391
+ ),
1392
+ type && /* @__PURE__ */ jsxRuntime.jsx(Chip, { label: type, onRemove: () => setType("") }),
1393
+ pricingModel && /* @__PURE__ */ jsxRuntime.jsx(
1394
+ Chip,
1395
+ {
1396
+ label: pricingModel,
1397
+ onRemove: () => setPricingModel("")
1398
+ }
1399
+ ),
1400
+ category && /* @__PURE__ */ jsxRuntime.jsx(Chip, { label: category, onRemove: () => setCategory("") }),
1401
+ featured && /* @__PURE__ */ jsxRuntime.jsx(
1402
+ Chip,
1403
+ {
1404
+ label: "Featured",
1405
+ onRemove: () => setFeatured(false)
1406
+ }
1407
+ )
1408
+ ] })
1409
+ ] }),
1410
+ loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4", children: [...Array(12)].map((_, i) => /* @__PURE__ */ jsxRuntime.jsx(
1411
+ "div",
1412
+ {
1413
+ className: "bg-card border border-border rounded-xl p-4 h-36 animate-pulse"
1414
+ },
1415
+ i
1416
+ )) }) : allProducts.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-20 text-center", children: [
1417
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground mb-4", children: [
1418
+ "No results found",
1419
+ search ? ` for "${search}"` : "",
1420
+ "."
1421
+ ] }),
1422
+ /* @__PURE__ */ jsxRuntime.jsx(
1423
+ "button",
1424
+ {
1425
+ type: "button",
1426
+ onClick: resetFilters,
1427
+ className: "text-sm text-primary hover:underline",
1428
+ children: "Clear filters"
1429
+ }
1430
+ )
1431
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1432
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4", children: allProducts.map((product) => /* @__PURE__ */ jsxRuntime.jsx(
1433
+ ProductCard,
1434
+ {
1435
+ product,
1436
+ onClick: () => navigate(`/store/${product.slug}`)
1437
+ },
1438
+ product.id
1439
+ )) }),
1440
+ result?.hasMore && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-8 text-center", children: /* @__PURE__ */ jsxRuntime.jsx(
1441
+ "button",
1442
+ {
1443
+ type: "button",
1444
+ onClick: loadMore,
1445
+ disabled: loadingMore,
1446
+ className: "h-10 px-8 rounded-lg border border-border text-sm font-medium text-foreground hover:bg-muted/50 transition-colors disabled:opacity-50",
1447
+ children: loadingMore ? "Loading\u2026" : "Load more"
1448
+ }
1449
+ ) })
1450
+ ] })
1451
+ ] })
1452
+ ] })
1453
+ ] })
1454
+ ] });
1455
+ }
1456
+ function Chip({ label, onRemove }) {
1457
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 text-xs bg-primary/10 text-primary rounded-full px-2.5 py-0.5 font-medium", children: [
1458
+ label,
1459
+ /* @__PURE__ */ jsxRuntime.jsx(
1460
+ "button",
1461
+ {
1462
+ type: "button",
1463
+ onClick: onRemove,
1464
+ "aria-label": `Remove ${label}`,
1465
+ className: "hover:opacity-70",
1466
+ children: "\xD7"
1467
+ }
1468
+ )
1469
+ ] });
1470
+ }
1471
+ function detectTheme() {
1472
+ if (typeof document === "undefined") return "light";
1473
+ const root = document.documentElement;
1474
+ return root.classList.contains("dark") || root.getAttribute("data-theme") === "dark" ? "dark" : "light";
1475
+ }
1476
+ function WorkflowEmbed({
1477
+ appUrl,
1478
+ productId,
1479
+ theme,
1480
+ clickToInteract = true,
1481
+ hideCta = false,
1482
+ className,
1483
+ onError
1484
+ }) {
1485
+ const iframeRef = react.useRef(null);
1486
+ const [status, setStatus] = react.useState("loading");
1487
+ const [interactive, setInteractive] = react.useState(!clickToInteract);
1488
+ const resolvedTheme = react.useMemo(() => theme ?? detectTheme(), [theme]);
1489
+ const src = react.useMemo(() => {
1490
+ const base = appUrl.replace(/\/+$/, "");
1491
+ const params = new URLSearchParams({
1492
+ productId,
1493
+ theme: resolvedTheme
1494
+ });
1495
+ if (hideCta) params.set("cta", "false");
1496
+ return `${base}/embed/workflow?${params.toString()}`;
1497
+ }, [appUrl, productId, resolvedTheme, hideCta]);
1498
+ react.useEffect(() => {
1499
+ const handler = (event) => {
1500
+ if (event.source !== iframeRef.current?.contentWindow) return;
1501
+ const data = event.data;
1502
+ if (data?.type === "fluidgrids:embed:loaded") setStatus("loaded");
1503
+ if (data?.type === "fluidgrids:embed:error") {
1504
+ setStatus("error");
1505
+ onError?.(data.message ?? "Failed to load workflow preview");
1506
+ }
1507
+ };
1508
+ window.addEventListener("message", handler);
1509
+ return () => window.removeEventListener("message", handler);
1510
+ }, [onError]);
1511
+ if (status === "error") return null;
1512
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1513
+ "div",
1514
+ {
1515
+ className: `relative w-full overflow-hidden rounded-xl border border-border bg-muted ${className ?? ""}`,
1516
+ style: { aspectRatio: "16 / 9" },
1517
+ children: [
1518
+ status === "loading" && /* @__PURE__ */ jsxRuntime.jsx(
1519
+ "div",
1520
+ {
1521
+ className: "absolute inset-0 animate-pulse bg-muted",
1522
+ "aria-hidden": "true"
1523
+ }
1524
+ ),
1525
+ /* @__PURE__ */ jsxRuntime.jsx(
1526
+ "iframe",
1527
+ {
1528
+ ref: iframeRef,
1529
+ src,
1530
+ title: "Workflow preview",
1531
+ loading: "lazy",
1532
+ className: "h-full w-full border-0",
1533
+ style: interactive ? void 0 : { pointerEvents: "none" }
1534
+ }
1535
+ ),
1536
+ clickToInteract && !interactive && status === "loaded" && /* @__PURE__ */ jsxRuntime.jsx(
1537
+ "button",
1538
+ {
1539
+ type: "button",
1540
+ onClick: () => setInteractive(true),
1541
+ className: "absolute inset-0 flex items-end justify-center bg-transparent pb-4",
1542
+ "aria-label": "Click to explore the workflow",
1543
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full border border-border bg-background/90 px-4 py-1.5 text-xs font-medium text-foreground shadow-sm backdrop-blur transition-colors hover:bg-background", children: "Click to explore" })
1544
+ }
1545
+ )
1546
+ ]
1547
+ }
1548
+ );
1549
+ }
1550
+ var ANIM_STYLES = `
1551
+ @keyframes sdFadeUp {
1552
+ from { opacity: 0; transform: translateY(16px); }
1553
+ to { opacity: 1; transform: translateY(0); }
1554
+ }
1555
+ @keyframes sdFadeIn {
1556
+ from { opacity: 0; }
1557
+ to { opacity: 1; }
1558
+ }
1559
+ @keyframes sdScaleIn {
1560
+ from { opacity: 0; transform: scale(0.94); }
1561
+ to { opacity: 1; transform: scale(1); }
1562
+ }
1563
+ @keyframes sdGlowPulse {
1564
+ 0%, 100% { opacity: 0.35; }
1565
+ 50% { opacity: 0.65; }
1566
+ }
1567
+ @media (prefers-reduced-motion: reduce) {
1568
+ .sd-fu, .sd-fi, .sd-si { animation: none !important; opacity: 1 !important; transform: none !important; }
1569
+ .sd-gp { animation: none !important; }
1570
+ }
1571
+ .sd-fu { animation: sdFadeUp 0.55s cubic-bezier(0.16,1,0.3,1) both; }
1572
+ .sd-fi { animation: sdFadeIn 0.45s ease-out both; }
1573
+ .sd-si { animation: sdScaleIn 0.45s cubic-bezier(0.16,1,0.3,1) both; }
1574
+ .sd-gp { animation: sdGlowPulse 3s ease-in-out infinite; }
1575
+ .sd-d1 { animation-delay: 60ms; }
1576
+ .sd-d2 { animation-delay: 120ms; }
1577
+ .sd-d3 { animation-delay: 180ms; }
1578
+ .sd-d4 { animation-delay: 240ms; }
1579
+ .sd-d5 { animation-delay: 320ms; }
1580
+ .sd-d6 { animation-delay: 400ms; }
1581
+ `;
1582
+ function RatingBar({
1583
+ label,
1584
+ count,
1585
+ total
1586
+ }) {
1587
+ const pct = total > 0 ? Math.round(count / total * 100) : 0;
1588
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
1589
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-12 text-right shrink-0", children: label }),
1590
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 h-1.5 bg-muted rounded-full overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
1591
+ "div",
1592
+ {
1593
+ className: "h-full bg-amber-400 rounded-full transition-all duration-700",
1594
+ style: { width: `${pct}%` }
1595
+ }
1596
+ ) }),
1597
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-6 shrink-0", children: count })
1598
+ ] });
1599
+ }
1600
+ function IconBlock({ src }) {
1601
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex-shrink-0", children: [
1602
+ /* @__PURE__ */ jsxRuntime.jsx(
1603
+ "div",
1604
+ {
1605
+ className: "sd-gp absolute -inset-1.5 rounded-2xl bg-primary/30 blur-md pointer-events-none",
1606
+ "aria-hidden": "true"
1607
+ }
1608
+ ),
1609
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sd-si relative w-20 h-20 rounded-2xl overflow-hidden shadow-lg ring-1 ring-border", children: src ? /* @__PURE__ */ jsxRuntime.jsx(
1610
+ "img",
1611
+ {
1612
+ src,
1613
+ alt: "",
1614
+ "aria-hidden": true,
1615
+ className: "w-full h-full object-cover"
1616
+ }
1617
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full h-full bg-gradient-to-br from-primary/25 to-primary/8 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs(
1618
+ "svg",
1619
+ {
1620
+ viewBox: "0 0 40 40",
1621
+ className: "w-10 h-10",
1622
+ fill: "none",
1623
+ xmlns: "http://www.w3.org/2000/svg",
1624
+ "aria-hidden": "true",
1625
+ children: [
1626
+ /* @__PURE__ */ jsxRuntime.jsx(
1627
+ "polygon",
1628
+ {
1629
+ points: "20,4 34,11 20,18 6,11",
1630
+ className: "fill-primary/40",
1631
+ stroke: "currentColor",
1632
+ strokeWidth: "0.6",
1633
+ strokeOpacity: "0.4"
1634
+ }
1635
+ ),
1636
+ /* @__PURE__ */ jsxRuntime.jsx(
1637
+ "polygon",
1638
+ {
1639
+ points: "6,11 20,18 20,34 6,27",
1640
+ className: "fill-primary/20",
1641
+ stroke: "currentColor",
1642
+ strokeWidth: "0.6",
1643
+ strokeOpacity: "0.4"
1644
+ }
1645
+ ),
1646
+ /* @__PURE__ */ jsxRuntime.jsx(
1647
+ "polygon",
1648
+ {
1649
+ points: "34,11 20,18 20,34 34,27",
1650
+ className: "fill-primary/30",
1651
+ stroke: "currentColor",
1652
+ strokeWidth: "0.6",
1653
+ strokeOpacity: "0.4"
1654
+ }
1655
+ )
1656
+ ]
1657
+ }
1658
+ ) }) })
1659
+ ] });
1660
+ }
1661
+ function StoreProductDetailPage({
1662
+ slug,
1663
+ id,
1664
+ appLoginUrl,
1665
+ onNavigate,
1666
+ productName
1667
+ }) {
1668
+ const client = useWebSDK();
1669
+ const [details, setDetails] = react.useState(null);
1670
+ const [loading, setLoading] = react.useState(true);
1671
+ const [error, setError] = react.useState(null);
1672
+ const [activeScreenshot, setActiveScreenshot] = react.useState(0);
1673
+ const [screenshotKey, setScreenshotKey] = react.useState(0);
1674
+ const [embedFailed, setEmbedFailed] = react.useState(false);
1675
+ react.useEffect(() => {
1676
+ if (!slug && !id) {
1677
+ setError("Product not found.");
1678
+ setLoading(false);
1679
+ return;
1680
+ }
1681
+ let cancelled = false;
1682
+ setLoading(true);
1683
+ client.query(STORE_PRODUCT_DETAILS_QUERY, {
1684
+ input: { slug: slug ?? void 0, id: id ?? void 0 }
1685
+ }).then((r) => {
1686
+ if (cancelled) return;
1687
+ if (r.errors?.length) throw new Error(r.errors[0].message);
1688
+ if (!r.data?.storeProductDetails) throw new Error("Not found");
1689
+ setDetails(r.data.storeProductDetails);
1690
+ }).catch(() => {
1691
+ if (!cancelled) setError("Product not found or unavailable.");
1692
+ }).finally(() => {
1693
+ if (!cancelled) setLoading(false);
1694
+ });
1695
+ return () => {
1696
+ cancelled = true;
1697
+ };
1698
+ }, [client, slug, id]);
1699
+ function navigate(path) {
1700
+ if (onNavigate) {
1701
+ onNavigate(path);
1702
+ return;
1703
+ }
1704
+ window.location.href = path;
1705
+ }
1706
+ function switchScreenshot(i) {
1707
+ setActiveScreenshot(i);
1708
+ setScreenshotKey((k) => k + 1);
1709
+ }
1710
+ if (loading) {
1711
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 animate-pulse", children: [
1712
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 bg-muted rounded w-40 mb-8" }),
1713
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-6 mb-8", children: [
1714
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-20 h-20 rounded-2xl bg-muted flex-shrink-0" }),
1715
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-3 pt-1", children: [
1716
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-6 bg-muted rounded w-1/3" }),
1717
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 bg-muted rounded w-1/2" }),
1718
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 bg-muted rounded w-1/4" })
1719
+ ] })
1720
+ ] }),
1721
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-56 bg-muted rounded-xl mb-8" }),
1722
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: [...Array(5)].map((_, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-4 bg-muted rounded" }, i)) })
1723
+ ] });
1724
+ }
1725
+ if (error || !details) {
1726
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-20 text-center", children: [
1727
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-muted-foreground mb-4", children: error ?? "Product not found." }),
1728
+ /* @__PURE__ */ jsxRuntime.jsx(
1729
+ "button",
1730
+ {
1731
+ type: "button",
1732
+ onClick: () => navigate("/store"),
1733
+ className: "text-sm text-primary hover:underline",
1734
+ children: "Back to Store"
1735
+ }
1736
+ )
1737
+ ] });
1738
+ }
1739
+ const {
1740
+ product,
1741
+ publisher,
1742
+ reviews,
1743
+ reviewsCount,
1744
+ relatedProducts,
1745
+ ratingDistribution
1746
+ } = details;
1747
+ const priceLabel = formatPrice(
1748
+ product.price,
1749
+ product.currency,
1750
+ product.pricingModel
1751
+ );
1752
+ const screenshots = product.screenshots ?? [];
1753
+ const totalRatings = ratingDistribution ? ratingDistribution.fiveStars + ratingDistribution.fourStars + ratingDistribution.threeStars + ratingDistribution.twoStars + ratingDistribution.oneStar : 0;
1754
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full", children: [
1755
+ /* @__PURE__ */ jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: ANIM_STYLES } }),
1756
+ /* @__PURE__ */ jsxRuntime.jsx(
1757
+ PageHead,
1758
+ {
1759
+ title: `${product.name}${productName ? ` \u2013 ${productName} Store` : " \u2013 Store"}`,
1760
+ description: product.description ?? void 0,
1761
+ productName
1762
+ }
1763
+ ),
1764
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative overflow-hidden", children: [
1765
+ /* @__PURE__ */ jsxRuntime.jsx(
1766
+ "div",
1767
+ {
1768
+ className: "absolute inset-0 bg-gradient-to-b from-primary/[0.07] via-background to-background pointer-events-none",
1769
+ "aria-hidden": "true"
1770
+ }
1771
+ ),
1772
+ /* @__PURE__ */ jsxRuntime.jsxs(
1773
+ "svg",
1774
+ {
1775
+ className: "absolute inset-0 w-full h-full opacity-[0.04] pointer-events-none",
1776
+ xmlns: "http://www.w3.org/2000/svg",
1777
+ "aria-hidden": "true",
1778
+ children: [
1779
+ /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx(
1780
+ "pattern",
1781
+ {
1782
+ id: "sd-grid",
1783
+ width: "40",
1784
+ height: "40",
1785
+ patternUnits: "userSpaceOnUse",
1786
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1787
+ "path",
1788
+ {
1789
+ d: "M 40 0 L 0 0 0 40",
1790
+ fill: "none",
1791
+ stroke: "currentColor",
1792
+ strokeWidth: "1"
1793
+ }
1794
+ )
1795
+ }
1796
+ ) }),
1797
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "100%", height: "100%", fill: "url(#sd-grid)" })
1798
+ ]
1799
+ }
1800
+ ),
1801
+ /* @__PURE__ */ jsxRuntime.jsx(
1802
+ "div",
1803
+ {
1804
+ className: "absolute -top-12 -left-12 w-72 h-72 rounded-full bg-primary/10 blur-3xl pointer-events-none",
1805
+ "aria-hidden": "true"
1806
+ }
1807
+ ),
1808
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 pt-6 pb-8", children: [
1809
+ /* @__PURE__ */ jsxRuntime.jsxs("nav", { className: "sd-fi text-sm text-muted-foreground mb-6 flex items-center gap-1.5 flex-wrap", children: [
1810
+ /* @__PURE__ */ jsxRuntime.jsx(
1811
+ "button",
1812
+ {
1813
+ type: "button",
1814
+ onClick: () => navigate("/store"),
1815
+ className: "hover:text-primary transition-colors",
1816
+ children: "Store"
1817
+ }
1818
+ ),
1819
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "\u203A" }),
1820
+ product.category && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1821
+ /* @__PURE__ */ jsxRuntime.jsx(
1822
+ "button",
1823
+ {
1824
+ type: "button",
1825
+ onClick: () => navigate(`/store/browse?category=${product.category}`),
1826
+ className: "hover:text-primary transition-colors",
1827
+ children: product.category
1828
+ }
1829
+ ),
1830
+ /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: "\u203A" })
1831
+ ] }),
1832
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground font-medium", children: product.name })
1833
+ ] }),
1834
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-5 items-start", children: [
1835
+ /* @__PURE__ */ jsxRuntime.jsx(IconBlock, { src: product.icon, name: product.name }),
1836
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
1837
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sd-fu flex items-start gap-2 flex-wrap mb-1", children: [
1838
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-2xl sm:text-3xl font-bold text-foreground leading-tight", children: product.name }),
1839
+ /* @__PURE__ */ jsxRuntime.jsx(TypeBadge, { type: product.type })
1840
+ ] }),
1841
+ product.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "sd-fu sd-d1 text-muted-foreground text-sm mb-2 leading-relaxed", children: product.description }),
1842
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sd-fu sd-d2 flex items-center gap-3 text-sm text-muted-foreground flex-wrap", children: [
1843
+ product.rating != null && product.rating > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-1", children: [
1844
+ /* @__PURE__ */ jsxRuntime.jsx(StarRating, { rating: product.rating }),
1845
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-foreground", children: product.rating.toFixed(1) }),
1846
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1847
+ "(",
1848
+ reviewsCount ?? 0,
1849
+ ")"
1850
+ ] })
1851
+ ] }),
1852
+ product.downloads != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1853
+ formatDownloads(product.downloads),
1854
+ " downloads"
1855
+ ] }),
1856
+ product.authorName && /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
1857
+ "by ",
1858
+ product.authorName
1859
+ ] }),
1860
+ product.license && /* @__PURE__ */ jsxRuntime.jsx("span", { children: product.license })
1861
+ ] })
1862
+ ] })
1863
+ ] })
1864
+ ] })
1865
+ ] }),
1866
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid lg:grid-cols-[1fr_300px] gap-8", children: [
1867
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1868
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sd-fu sd-d3 lg:hidden mb-6 p-4 rounded-xl border border-border bg-card flex items-center gap-4", children: [
1869
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1870
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-2xl font-bold text-foreground", children: priceLabel }),
1871
+ product.pricingModel === "SUBSCRIPTION" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground", children: "per month" })
1872
+ ] }),
1873
+ /* @__PURE__ */ jsxRuntime.jsx(
1874
+ "a",
1875
+ {
1876
+ href: appLoginUrl,
1877
+ target: "_blank",
1878
+ rel: "noopener noreferrer",
1879
+ className: "flex-1 h-11 rounded-lg bg-primary text-primary-foreground text-sm font-semibold flex items-center justify-center hover:opacity-90 transition-opacity",
1880
+ children: priceLabel === "Free" ? "Install Free" : `Get for ${priceLabel}`
1881
+ }
1882
+ )
1883
+ ] }),
1884
+ product.type === "WORKFLOW" && !embedFailed && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "sd-fu sd-d3 mb-8", children: /* @__PURE__ */ jsxRuntime.jsx(
1885
+ WorkflowEmbed,
1886
+ {
1887
+ appUrl: appLoginUrl,
1888
+ productId: product.id,
1889
+ onError: () => setEmbedFailed(true)
1890
+ }
1891
+ ) }),
1892
+ screenshots.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sd-fu sd-d3 mb-8", children: [
1893
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl overflow-hidden bg-muted aspect-video mb-3 shadow-md", children: /* @__PURE__ */ jsxRuntime.jsx(
1894
+ "img",
1895
+ {
1896
+ src: screenshots[activeScreenshot],
1897
+ alt: `Screenshot ${activeScreenshot + 1}`,
1898
+ className: "sd-fi w-full h-full object-cover"
1899
+ },
1900
+ screenshotKey
1901
+ ) }),
1902
+ screenshots.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-2 overflow-x-auto pb-1", children: screenshots.map((src, i) => /* @__PURE__ */ jsxRuntime.jsx(
1903
+ "button",
1904
+ {
1905
+ type: "button",
1906
+ onClick: () => switchScreenshot(i),
1907
+ className: `w-20 h-14 rounded-lg overflow-hidden flex-shrink-0 border-2 transition-all duration-200 ${i === activeScreenshot ? "border-primary shadow-sm shadow-primary/20" : "border-transparent opacity-50 hover:opacity-80"}`,
1908
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1909
+ "img",
1910
+ {
1911
+ src,
1912
+ alt: `Thumbnail ${i + 1}`,
1913
+ className: "w-full h-full object-cover"
1914
+ }
1915
+ )
1916
+ },
1917
+ i
1918
+ )) })
1919
+ ] }),
1920
+ product.longDescription && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sd-fu sd-d4 mb-8", children: [
1921
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-bold text-foreground mb-3", children: "About" }),
1922
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose prose-sm max-w-none text-muted-foreground leading-relaxed whitespace-pre-line", children: product.longDescription })
1923
+ ] }),
1924
+ publisher && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sd-fu sd-d5 mb-8 p-4 rounded-xl border border-border bg-card hover:border-primary/30 transition-colors duration-300", children: [
1925
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-sm font-semibold text-foreground mb-3", children: "Publisher" }),
1926
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
1927
+ publisher.logoUrl ? /* @__PURE__ */ jsxRuntime.jsx(
1928
+ "img",
1929
+ {
1930
+ src: publisher.logoUrl,
1931
+ alt: publisher.name,
1932
+ className: "w-10 h-10 rounded-full object-cover"
1933
+ }
1934
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center text-primary text-sm font-bold", children: publisher.name.charAt(0).toUpperCase() }),
1935
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1936
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
1937
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold text-foreground text-sm", children: publisher.name }),
1938
+ publisher.isVerified && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-primary font-medium", children: "\u2713 Verified" })
1939
+ ] }),
1940
+ publisher.bio && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: publisher.bio })
1941
+ ] })
1942
+ ] })
1943
+ ] }),
1944
+ (reviews?.length ?? 0) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sd-fu sd-d5 mb-8", children: [
1945
+ /* @__PURE__ */ jsxRuntime.jsxs("h2", { className: "text-lg font-bold text-foreground mb-4", children: [
1946
+ "Reviews (",
1947
+ reviewsCount ?? reviews.length,
1948
+ ")"
1949
+ ] }),
1950
+ ratingDistribution && totalRatings > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sd-si flex gap-6 mb-5 p-4 rounded-xl border border-border bg-card", children: [
1951
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
1952
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-4xl font-bold text-foreground tabular-nums", children: product.rating?.toFixed(1) ?? "\u2014" }),
1953
+ product.rating != null && /* @__PURE__ */ jsxRuntime.jsx(StarRating, { rating: product.rating }),
1954
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-muted-foreground mt-1", children: [
1955
+ totalRatings,
1956
+ " ratings"
1957
+ ] })
1958
+ ] }),
1959
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-1.5 pt-1", children: [
1960
+ /* @__PURE__ */ jsxRuntime.jsx(
1961
+ RatingBar,
1962
+ {
1963
+ label: "5 \u2605",
1964
+ count: ratingDistribution.fiveStars,
1965
+ total: totalRatings
1966
+ }
1967
+ ),
1968
+ /* @__PURE__ */ jsxRuntime.jsx(
1969
+ RatingBar,
1970
+ {
1971
+ label: "4 \u2605",
1972
+ count: ratingDistribution.fourStars,
1973
+ total: totalRatings
1974
+ }
1975
+ ),
1976
+ /* @__PURE__ */ jsxRuntime.jsx(
1977
+ RatingBar,
1978
+ {
1979
+ label: "3 \u2605",
1980
+ count: ratingDistribution.threeStars,
1981
+ total: totalRatings
1982
+ }
1983
+ ),
1984
+ /* @__PURE__ */ jsxRuntime.jsx(
1985
+ RatingBar,
1986
+ {
1987
+ label: "2 \u2605",
1988
+ count: ratingDistribution.twoStars,
1989
+ total: totalRatings
1990
+ }
1991
+ ),
1992
+ /* @__PURE__ */ jsxRuntime.jsx(
1993
+ RatingBar,
1994
+ {
1995
+ label: "1 \u2605",
1996
+ count: ratingDistribution.oneStar,
1997
+ total: totalRatings
1998
+ }
1999
+ )
2000
+ ] })
2001
+ ] }),
2002
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: reviews.slice(0, 5).map((review, idx) => /* @__PURE__ */ jsxRuntime.jsxs(
2003
+ "div",
2004
+ {
2005
+ className: "sd-fu p-4 rounded-xl border border-border bg-card hover:border-primary/20 transition-colors duration-200",
2006
+ style: { animationDelay: `${(idx + 5) * 60}ms` },
2007
+ children: [
2008
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2 mb-2", children: [
2009
+ /* @__PURE__ */ jsxRuntime.jsx(StarRating, { rating: review.rating }),
2010
+ review.verifiedPurchase && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-emerald-500 font-medium", children: "Verified" })
2011
+ ] }),
2012
+ review.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "font-semibold text-sm text-foreground mb-1", children: review.title }),
2013
+ review.comment && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground leading-relaxed", children: review.comment }),
2014
+ review.createdAt && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-2", children: new Date(review.createdAt).toLocaleDateString(
2015
+ "en-US",
2016
+ {
2017
+ year: "numeric",
2018
+ month: "short",
2019
+ day: "numeric"
2020
+ }
2021
+ ) })
2022
+ ]
2023
+ },
2024
+ review.id
2025
+ )) })
2026
+ ] }),
2027
+ (relatedProducts?.length ?? 0) > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sd-fu sd-d6", children: [
2028
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-lg font-bold text-foreground mb-4", children: "Related" }),
2029
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4", children: relatedProducts.slice(0, 6).map((p) => /* @__PURE__ */ jsxRuntime.jsx(
2030
+ ProductCard,
2031
+ {
2032
+ product: p,
2033
+ onClick: () => navigate(`/store/${p.slug}`)
2034
+ },
2035
+ p.id
2036
+ )) })
2037
+ ] })
2038
+ ] }),
2039
+ /* @__PURE__ */ jsxRuntime.jsx("aside", { className: "lg:sticky lg:top-24 self-start", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "sd-fu sd-d4 bg-card border border-border rounded-xl p-5 space-y-4 hover:border-primary/30 transition-colors duration-300 hover:shadow-lg hover:shadow-primary/5", children: [
2040
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2041
+ /* @__PURE__ */ jsxRuntime.jsx(
2042
+ "div",
2043
+ {
2044
+ className: `text-3xl font-extrabold ${priceLabel === "Free" ? "text-emerald-500" : "text-foreground"}`,
2045
+ children: priceLabel
2046
+ }
2047
+ ),
2048
+ product.pricingModel === "SUBSCRIPTION" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs text-muted-foreground", children: "per month" })
2049
+ ] }),
2050
+ /* @__PURE__ */ jsxRuntime.jsx(
2051
+ "a",
2052
+ {
2053
+ href: appLoginUrl,
2054
+ target: "_blank",
2055
+ rel: "noopener noreferrer",
2056
+ className: "flex items-center justify-center w-full h-11 rounded-lg bg-primary text-primary-foreground text-sm font-semibold hover:opacity-90 active:scale-[0.98] transition-all duration-150",
2057
+ children: priceLabel === "Free" ? "Install Free" : `Get for ${priceLabel}`
2058
+ }
2059
+ ),
2060
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground text-center", children: "Login required to install" }),
2061
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border pt-4 space-y-2 text-xs text-muted-foreground", children: [
2062
+ product.type && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
2063
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Type" }),
2064
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground font-medium", children: product.type })
2065
+ ] }),
2066
+ product.category && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
2067
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Category" }),
2068
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground font-medium", children: product.category })
2069
+ ] }),
2070
+ product.license && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
2071
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "License" }),
2072
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground font-medium", children: product.license })
2073
+ ] }),
2074
+ product.minPlatformVersion && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
2075
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Requires" }),
2076
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-foreground font-medium", children: [
2077
+ "v",
2078
+ product.minPlatformVersion,
2079
+ "+"
2080
+ ] })
2081
+ ] }),
2082
+ product.downloads != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
2083
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Downloads" }),
2084
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground font-medium", children: formatDownloads(product.downloads) })
2085
+ ] })
2086
+ ] }),
2087
+ (product.tags?.length ?? 0) > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1.5 pt-1", children: product.tags.map((tag) => /* @__PURE__ */ jsxRuntime.jsx(
2088
+ "span",
2089
+ {
2090
+ className: "text-xs px-2 py-0.5 rounded-full bg-primary/10 text-primary font-medium",
2091
+ children: tag
2092
+ },
2093
+ tag
2094
+ )) })
2095
+ ] }) })
2096
+ ] }) })
2097
+ ] });
2098
+ }
2099
+
2100
+ exports.ProductCard = ProductCard;
2101
+ exports.StarRating = StarRating;
2102
+ exports.StoreBrowsePage = StoreBrowsePage;
2103
+ exports.StoreHomePage = StoreHomePage;
2104
+ exports.StoreProductDetailPage = StoreProductDetailPage;
2105
+ exports.TypeBadge = TypeBadge;
2106
+ exports.WorkflowEmbed = WorkflowEmbed;
2107
+ exports.formatDownloads = formatDownloads;
2108
+ exports.formatPrice = formatPrice;
2109
+ //# sourceMappingURL=index.js.map
2110
+ //# sourceMappingURL=index.js.map