@snowcone-app/ui 0.12.0 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/index.cjs +838 -654
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -2
- package/dist/index.d.ts +62 -2
- package/dist/index.js +753 -575
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/composed/HeroProductImage.tsx +45 -3
- package/src/composed/__tests__/HeroProductImage.designRefusal.test.tsx +117 -0
- package/src/composed/carousels/MobileProductCarousel.tsx +7 -2
- package/src/composed/renderRefusalProbe.ts +35 -0
- package/src/index.ts +15 -0
- package/src/patterns/GallerySkip.tsx +113 -0
- package/src/patterns/RealtimeProvider.tsx +46 -0
- package/src/patterns/__tests__/RealtimeProvider.designRefusal.test.tsx +125 -0
- package/src/patterns/__tests__/gallerySkipRules.test.ts +71 -0
- package/src/patterns/gallerySkipRules.ts +57 -0
package/dist/index.cjs
CHANGED
|
@@ -229,6 +229,7 @@ __export(src_exports, {
|
|
|
229
229
|
FiltersButton: () => FiltersButton,
|
|
230
230
|
FiltersDrawer: () => FiltersDrawer,
|
|
231
231
|
FloatingActionGroup: () => FloatingActionGroup,
|
|
232
|
+
GallerySkipProvider: () => GallerySkipProvider,
|
|
232
233
|
HeroCarousel: () => HeroCarousel,
|
|
233
234
|
HeroProductImage: () => HeroProductImage,
|
|
234
235
|
HeroShrinkLayout: () => HeroShrinkLayout,
|
|
@@ -258,6 +259,7 @@ __export(src_exports, {
|
|
|
258
259
|
MobileProductCarousel: () => MobileProductCarousel,
|
|
259
260
|
MockupBackground: () => MockupBackground,
|
|
260
261
|
MockupPriorityProvider: () => MockupPriorityProvider,
|
|
262
|
+
NO_GALLERY_SKIPS: () => NO_GALLERY_SKIPS,
|
|
261
263
|
PDPLayout: () => PDPLayout,
|
|
262
264
|
PersonalizationInputs: () => PersonalizationInputs,
|
|
263
265
|
PersonalizationProvider: () => PersonalizationProvider,
|
|
@@ -352,25 +354,28 @@ __export(src_exports, {
|
|
|
352
354
|
checkTailwindConfig: () => checkTailwindConfig,
|
|
353
355
|
checkThemeTokens: () => checkThemeTokens,
|
|
354
356
|
createScrollDirectionTracker: () => createScrollDirectionTracker,
|
|
355
|
-
describeProductArtAlignment: () =>
|
|
357
|
+
describeProductArtAlignment: () => import_sdk16.describeProductArtAlignment,
|
|
356
358
|
firstView: () => firstView,
|
|
357
359
|
firstViewAnchorOfSlide: () => firstViewAnchorOfSlide,
|
|
358
360
|
formatCurrency: () => formatCurrency,
|
|
359
361
|
formatDate: () => formatDate,
|
|
360
362
|
formatDateTime: () => formatDateTime,
|
|
363
|
+
gallerySkipVerdict: () => gallerySkipVerdict,
|
|
364
|
+
gallerySkippedStamp: () => gallerySkippedStamp,
|
|
365
|
+
galleryWithoutSkipped: () => galleryWithoutSkipped,
|
|
361
366
|
getBrand: () => getBrand,
|
|
362
|
-
getMockupUrl: () =>
|
|
367
|
+
getMockupUrl: () => import_sdk15.getMockupUrl,
|
|
363
368
|
getObservedElementCount: () => getObservedElementCount,
|
|
364
369
|
getObserverCount: () => getObserverCount,
|
|
365
|
-
getProduct: () =>
|
|
366
|
-
getSnapPoints: () =>
|
|
370
|
+
getProduct: () => import_sdk15.getProduct,
|
|
371
|
+
getSnapPoints: () => import_sdk16.getSnapPoints,
|
|
367
372
|
hasEdgeBlur: () => hasEdgeBlur,
|
|
368
373
|
isObserved: () => isObserved,
|
|
369
374
|
isWideMonitor: () => isWideMonitor,
|
|
370
375
|
kbdVariants: () => kbdVariants,
|
|
371
376
|
linkVariants: () => linkVariants,
|
|
372
377
|
linkedPlacementsLabel: () => linkedPlacementsLabel,
|
|
373
|
-
listProducts: () =>
|
|
378
|
+
listProducts: () => import_sdk15.listProducts,
|
|
374
379
|
normalizeHex: () => normalizeHex,
|
|
375
380
|
observe: () => observe,
|
|
376
381
|
pictureRenderState: () => pictureRenderState,
|
|
@@ -391,6 +396,8 @@ __export(src_exports, {
|
|
|
391
396
|
useDesignOptional: () => useDesignOptional,
|
|
392
397
|
useDeviceDetection: () => useDeviceDetection,
|
|
393
398
|
useFocusTrap: () => useFocusTrap,
|
|
399
|
+
useGallerySkipOptional: () => useGallerySkipOptional,
|
|
400
|
+
useGallerySkipState: () => useGallerySkipState,
|
|
394
401
|
useHeroZoomScales: () => useHeroZoomScales,
|
|
395
402
|
useImagePreloader: () => useImagePreloader,
|
|
396
403
|
useImageTransition: () => useImageTransition,
|
|
@@ -414,7 +421,7 @@ __export(src_exports, {
|
|
|
414
421
|
useProductSelection: () => useProductSelection,
|
|
415
422
|
useProviderStatus: () => useProviderStatus,
|
|
416
423
|
useRealtime: () => useRealtime,
|
|
417
|
-
useRealtimeMockup: () =>
|
|
424
|
+
useRealtimeMockup: () => import_react73.useRealtimeMockup,
|
|
418
425
|
useRealtimeOptional: () => useRealtimeOptional,
|
|
419
426
|
useRenderCount: () => useRenderCount,
|
|
420
427
|
useRenderGuard: () => useRenderGuard,
|
|
@@ -6016,7 +6023,29 @@ var import_react27 = require("react");
|
|
|
6016
6023
|
// src/patterns/RealtimeProvider.tsx
|
|
6017
6024
|
var import_react25 = require("react");
|
|
6018
6025
|
var import_react26 = require("@snowcone-app/sdk/react");
|
|
6026
|
+
var import_sdk10 = require("@snowcone-app/sdk");
|
|
6027
|
+
|
|
6028
|
+
// src/patterns/gallerySkipRules.ts
|
|
6019
6029
|
var import_sdk9 = require("@snowcone-app/sdk");
|
|
6030
|
+
function gallerySkipVerdict(code, attempt) {
|
|
6031
|
+
const kind = (0, import_sdk9.designRefusalKind)(code);
|
|
6032
|
+
if (kind === "skip") return "skip";
|
|
6033
|
+
if (kind === "retry-once") return attempt < 1 ? "retry" : "skip";
|
|
6034
|
+
return "loud";
|
|
6035
|
+
}
|
|
6036
|
+
var NO_GALLERY_SKIPS = /* @__PURE__ */ new Map();
|
|
6037
|
+
function galleryWithoutSkipped(images, skipped) {
|
|
6038
|
+
if (skipped.size === 0) return images;
|
|
6039
|
+
const kept = images.filter((img) => !(img.isRealMockup && img.mockupId && skipped.has(img.mockupId)));
|
|
6040
|
+
if (kept.length === images.length || kept.length === 0) return images;
|
|
6041
|
+
return kept;
|
|
6042
|
+
}
|
|
6043
|
+
function gallerySkippedStamp(skipped, shown) {
|
|
6044
|
+
if (skipped.size === 0) return void 0;
|
|
6045
|
+
const shownIds = new Set(shown.map((img) => img.mockupId).filter(Boolean));
|
|
6046
|
+
const parts = [...skipped].filter(([id]) => !shownIds.has(id)).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([id, code]) => `${id}:${code}`);
|
|
6047
|
+
return parts.length ? parts.join(" ") : void 0;
|
|
6048
|
+
}
|
|
6020
6049
|
|
|
6021
6050
|
// src/patterns/MockupBackground.tsx
|
|
6022
6051
|
var import_react24 = require("react");
|
|
@@ -6198,6 +6227,9 @@ function RealtimeProvider({
|
|
|
6198
6227
|
);
|
|
6199
6228
|
const resetSessionRef = (0, import_react25.useRef)(() => {
|
|
6200
6229
|
});
|
|
6230
|
+
const designRefusalSubscribersRef = (0, import_react25.useRef)(/* @__PURE__ */ new Set());
|
|
6231
|
+
const designBusySeenRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
6232
|
+
const designRetryRef = (0, import_react25.useRef)(null);
|
|
6201
6233
|
const realtimeMockup = (0, import_react26.useRealtimeMockup)({
|
|
6202
6234
|
wsUrl,
|
|
6203
6235
|
getToken: useSessionGrant ? getToken : void 0,
|
|
@@ -6238,6 +6270,23 @@ function RealtimeProvider({
|
|
|
6238
6270
|
const id = detail.mockupId;
|
|
6239
6271
|
setUnavailableMockups((prev) => prev.get(id)?.code === detail.code ? prev : new Map(prev).set(id, detail));
|
|
6240
6272
|
}
|
|
6273
|
+
},
|
|
6274
|
+
onDesignRefusal: (refusal) => {
|
|
6275
|
+
const seen = designBusySeenRef.current.get(refusal.mockupId) ?? 0;
|
|
6276
|
+
const verdict = gallerySkipVerdict(refusal.code, seen);
|
|
6277
|
+
if (verdict === "retry") {
|
|
6278
|
+
designBusySeenRef.current.set(refusal.mockupId, seen + 1);
|
|
6279
|
+
designRetryRef.current?.([refusal.mockupId]);
|
|
6280
|
+
return;
|
|
6281
|
+
}
|
|
6282
|
+
if (verdict !== "skip") return;
|
|
6283
|
+
if (designRefusalSubscribersRef.current.size === 0) {
|
|
6284
|
+
const id = refusal.mockupId;
|
|
6285
|
+
const detail = { code: refusal.code, message: refusal.message, mockupId: id };
|
|
6286
|
+
setUnavailableMockups((prev) => prev.get(id)?.code === detail.code ? prev : new Map(prev).set(id, detail));
|
|
6287
|
+
return;
|
|
6288
|
+
}
|
|
6289
|
+
designRefusalSubscribersRef.current.forEach((cb) => cb(refusal));
|
|
6241
6290
|
}
|
|
6242
6291
|
});
|
|
6243
6292
|
const subscribeRTCTiming = (0, import_react25.useCallback)((_callback) => {
|
|
@@ -6485,6 +6534,7 @@ function RealtimeProvider({
|
|
|
6485
6534
|
},
|
|
6486
6535
|
[rerenderRaw]
|
|
6487
6536
|
);
|
|
6537
|
+
designRetryRef.current = sendRerenderPaced;
|
|
6488
6538
|
const rerenderFullFrame = (0, import_react25.useCallback)(
|
|
6489
6539
|
(mockupId) => {
|
|
6490
6540
|
fullFrameRerenderIdsRef.current.add(mockupId);
|
|
@@ -6629,6 +6679,7 @@ function RealtimeProvider({
|
|
|
6629
6679
|
else merged.push(result);
|
|
6630
6680
|
});
|
|
6631
6681
|
mockupResultsRef.current = merged;
|
|
6682
|
+
results.forEach((result) => designBusySeenRef.current.delete(result.mockupId));
|
|
6632
6683
|
if (pendingRerenderRef.current.length > 0) {
|
|
6633
6684
|
const delivered = new Set(results.map((r) => r.mockupId));
|
|
6634
6685
|
pendingRerenderRef.current = pendingRerenderRef.current.filter((id) => !delivered.has(id));
|
|
@@ -6893,6 +6944,7 @@ function RealtimeProvider({
|
|
|
6893
6944
|
const resetSession = (0, import_react25.useCallback)(() => {
|
|
6894
6945
|
configSentRef.current = false;
|
|
6895
6946
|
dueByVersionRef.current.clear();
|
|
6947
|
+
designBusySeenRef.current.clear();
|
|
6896
6948
|
setUnavailableMockups((prev) => prev.size ? /* @__PURE__ */ new Map() : prev);
|
|
6897
6949
|
lastSentVariantIdRef.current = null;
|
|
6898
6950
|
lastSentBgRef.current = void 0;
|
|
@@ -6921,13 +6973,13 @@ function RealtimeProvider({
|
|
|
6921
6973
|
const product = productContext.product;
|
|
6922
6974
|
const productId = product.id;
|
|
6923
6975
|
const placements = product.placements || [];
|
|
6924
|
-
const variantId = (0,
|
|
6976
|
+
const variantId = (0, import_sdk10.resolvePreviewVariantId)(
|
|
6925
6977
|
productContext,
|
|
6926
|
-
(0,
|
|
6978
|
+
(0, import_sdk10.resolveVariantId)(productContext, void 0, void 0)
|
|
6927
6979
|
);
|
|
6928
6980
|
const isFirstSend = !configSentRef.current;
|
|
6929
6981
|
const variantChanged = lastSentVariantIdRef.current !== null && lastSentVariantIdRef.current !== variantId;
|
|
6930
|
-
const sizePicture = (0,
|
|
6982
|
+
const sizePicture = (0, import_sdk10.gallerySizePicture)(product.mockups, (0, import_sdk10.resolveVariantId)(productContext, void 0, void 0));
|
|
6931
6983
|
const sizePictureId = sizePicture?.id ?? null;
|
|
6932
6984
|
const sizePictureChanged = configSentRef.current && lastSentSizePictureRef.current !== sizePictureId;
|
|
6933
6985
|
const bgChanged = configSentRef.current && lastSentBgRef.current !== mockupBg;
|
|
@@ -6942,7 +6994,7 @@ function RealtimeProvider({
|
|
|
6942
6994
|
const mockupIds = [];
|
|
6943
6995
|
if (product.mockups && Array.isArray(product.mockups)) {
|
|
6944
6996
|
product.mockups.forEach((mockup) => {
|
|
6945
|
-
if (mockup.id && (0,
|
|
6997
|
+
if (mockup.id && (0, import_sdk10.mockupRole)(mockup) === "ordinary") {
|
|
6946
6998
|
mockupIds.push(mockup.id);
|
|
6947
6999
|
}
|
|
6948
7000
|
});
|
|
@@ -7200,7 +7252,7 @@ function RealtimeProvider({
|
|
|
7200
7252
|
const pendingIds = [];
|
|
7201
7253
|
if (productContext?.product?.mockups) {
|
|
7202
7254
|
productContext.product.mockups.forEach((mockup) => {
|
|
7203
|
-
if ((0,
|
|
7255
|
+
if ((0, import_sdk10.mockupRole)(mockup) !== "ordinary" && !configuredMockupIdsRef.current.includes(mockup.id)) return;
|
|
7204
7256
|
if (mockup.placement === placement || !mockup.placement) {
|
|
7205
7257
|
pendingMockupIdsRef.current.add(mockup.id);
|
|
7206
7258
|
pendingIds.push(mockup.id);
|
|
@@ -7278,6 +7330,13 @@ function RealtimeProvider({
|
|
|
7278
7330
|
subscribeBlobSentRef.current = subscribeBlobSent;
|
|
7279
7331
|
subscribePipelineSettledRef.current = subscribePipelineSettled;
|
|
7280
7332
|
subscribePendingExportCancelledRef.current = subscribePendingExportCancelled;
|
|
7333
|
+
const subscribeDesignRefusals = (0, import_react25.useCallback)((callback) => {
|
|
7334
|
+
const subscribers = designRefusalSubscribersRef.current;
|
|
7335
|
+
subscribers.add(callback);
|
|
7336
|
+
return () => {
|
|
7337
|
+
subscribers.delete(callback);
|
|
7338
|
+
};
|
|
7339
|
+
}, []);
|
|
7281
7340
|
const stableSubscribeMockupResults = (0, import_react25.useCallback)(
|
|
7282
7341
|
(callback) => {
|
|
7283
7342
|
return subscribeMockupResultsRef.current(callback);
|
|
@@ -7347,6 +7406,7 @@ function RealtimeProvider({
|
|
|
7347
7406
|
isConfigured,
|
|
7348
7407
|
renderError,
|
|
7349
7408
|
unavailableMockups,
|
|
7409
|
+
subscribeDesignRefusals,
|
|
7350
7410
|
// Read from ref - this is a snapshot at render time, NOT reactive
|
|
7351
7411
|
// For reactive updates, use getMockupResultsImmediate() or subscribe functions
|
|
7352
7412
|
get mockupResults() {
|
|
@@ -7403,6 +7463,7 @@ function RealtimeProvider({
|
|
|
7403
7463
|
isConfigured,
|
|
7404
7464
|
renderError,
|
|
7405
7465
|
unavailableMockups,
|
|
7466
|
+
subscribeDesignRefusals,
|
|
7406
7467
|
// mockupResults removed from deps - it's a getter that reads from ref
|
|
7407
7468
|
canvasExportSize,
|
|
7408
7469
|
mockupWidth,
|
|
@@ -10282,14 +10343,77 @@ var LoadingOverlayPrismCandyInline = (0, import_react41.memo)(
|
|
|
10282
10343
|
);
|
|
10283
10344
|
|
|
10284
10345
|
// src/index.ts
|
|
10285
|
-
var
|
|
10286
|
-
var
|
|
10346
|
+
var import_react73 = require("@snowcone-app/sdk/react");
|
|
10347
|
+
var import_sdk15 = require("@snowcone-app/sdk");
|
|
10287
10348
|
|
|
10288
|
-
// src/patterns/
|
|
10349
|
+
// src/patterns/GallerySkip.tsx
|
|
10289
10350
|
var import_react42 = require("react");
|
|
10351
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
10352
|
+
var GallerySkipContext = (0, import_react42.createContext)(void 0);
|
|
10353
|
+
function useGallerySkipState(design) {
|
|
10354
|
+
const realtime = useRealtimeOptional();
|
|
10355
|
+
const [entries, setEntries] = (0, import_react42.useState)(() => /* @__PURE__ */ new Map());
|
|
10356
|
+
const entriesRef = (0, import_react42.useRef)(entries);
|
|
10357
|
+
entriesRef.current = entries;
|
|
10358
|
+
const designRef = (0, import_react42.useRef)(design);
|
|
10359
|
+
designRef.current = design;
|
|
10360
|
+
const getResults = realtime?.getMockupResultsImmediate;
|
|
10361
|
+
const frameOfRef = (0, import_react42.useRef)((mockupId) => getResults?.().find((r) => r.mockupId === mockupId)?.imageUrl ?? null);
|
|
10362
|
+
frameOfRef.current = (mockupId) => getResults?.().find((r) => r.mockupId === mockupId)?.imageUrl ?? null;
|
|
10363
|
+
const report = (0, import_react42.useCallback)((mockupId, code) => {
|
|
10364
|
+
const at = designRef.current;
|
|
10365
|
+
const realtimeUrl = frameOfRef.current(mockupId);
|
|
10366
|
+
setEntries((prev) => {
|
|
10367
|
+
const e = prev.get(mockupId);
|
|
10368
|
+
if (e && e.code === code && e.design === at) return prev;
|
|
10369
|
+
return new Map(prev).set(mockupId, { code, design: at, realtimeUrl });
|
|
10370
|
+
});
|
|
10371
|
+
}, []);
|
|
10372
|
+
const subscribeDesignRefusals = realtime?.subscribeDesignRefusals;
|
|
10373
|
+
(0, import_react42.useEffect)(() => {
|
|
10374
|
+
if (!subscribeDesignRefusals) return;
|
|
10375
|
+
return subscribeDesignRefusals((refusal) => report(refusal.mockupId, refusal.code));
|
|
10376
|
+
}, [subscribeDesignRefusals, report]);
|
|
10377
|
+
const subscribeMockupResults = realtime?.subscribeMockupResults;
|
|
10378
|
+
(0, import_react42.useEffect)(() => {
|
|
10379
|
+
if (!subscribeMockupResults) return;
|
|
10380
|
+
return subscribeMockupResults((results) => {
|
|
10381
|
+
const current = entriesRef.current;
|
|
10382
|
+
if (current.size === 0) return;
|
|
10383
|
+
const back = results.filter((r) => {
|
|
10384
|
+
const e = current.get(r.mockupId);
|
|
10385
|
+
if (!e) return false;
|
|
10386
|
+
return !!r.imageUrl && r.imageUrl !== e.realtimeUrl;
|
|
10387
|
+
});
|
|
10388
|
+
if (back.length === 0) return;
|
|
10389
|
+
setEntries((prev) => {
|
|
10390
|
+
const next = new Map(prev);
|
|
10391
|
+
back.forEach((r) => next.delete(r.mockupId));
|
|
10392
|
+
return next;
|
|
10393
|
+
});
|
|
10394
|
+
});
|
|
10395
|
+
}, [subscribeMockupResults]);
|
|
10396
|
+
const skipped = (0, import_react42.useMemo)(() => {
|
|
10397
|
+
const m = /* @__PURE__ */ new Map();
|
|
10398
|
+
entries.forEach((e, id) => {
|
|
10399
|
+
if (e.design === design) m.set(id, e.code);
|
|
10400
|
+
});
|
|
10401
|
+
return m;
|
|
10402
|
+
}, [entries, design]);
|
|
10403
|
+
return (0, import_react42.useMemo)(() => ({ skipped, report }), [skipped, report]);
|
|
10404
|
+
}
|
|
10405
|
+
function GallerySkipProvider({ value, children }) {
|
|
10406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(GallerySkipContext.Provider, { value, children });
|
|
10407
|
+
}
|
|
10408
|
+
function useGallerySkipOptional() {
|
|
10409
|
+
return (0, import_react42.useContext)(GallerySkipContext);
|
|
10410
|
+
}
|
|
10411
|
+
|
|
10412
|
+
// src/patterns/PlacementArt.tsx
|
|
10413
|
+
var import_react43 = require("react");
|
|
10290
10414
|
|
|
10291
10415
|
// src/composed/heroMockupUrl.ts
|
|
10292
|
-
var
|
|
10416
|
+
var import_sdk11 = require("@snowcone-app/sdk");
|
|
10293
10417
|
function slugifyPlacementKey(label) {
|
|
10294
10418
|
return label.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
10295
10419
|
}
|
|
@@ -10316,7 +10440,7 @@ function heroMockupUrl(args) {
|
|
|
10316
10440
|
if (!args.shop) return null;
|
|
10317
10441
|
const publicDesign = toPublicDesign(args.design, args.placements);
|
|
10318
10442
|
if (Object.keys(publicDesign).length === 0) return null;
|
|
10319
|
-
return (0,
|
|
10443
|
+
return (0, import_sdk11.getMockupUrl)(args.productCode, {
|
|
10320
10444
|
shop: args.shop,
|
|
10321
10445
|
design: publicDesign,
|
|
10322
10446
|
..."stripView" in args.size ? { aspect: "8:3", stripView: args.size.stripView, ...args.size.width !== void 0 ? { width: args.size.width } : {} } : { width: args.size.width },
|
|
@@ -10328,15 +10452,15 @@ function heroMockupUrl(args) {
|
|
|
10328
10452
|
}
|
|
10329
10453
|
|
|
10330
10454
|
// src/patterns/PlacementArt.tsx
|
|
10331
|
-
var
|
|
10332
|
-
var PlacementArtContext = (0,
|
|
10455
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
10456
|
+
var PlacementArtContext = (0, import_react43.createContext)(null);
|
|
10333
10457
|
function PlacementArt({ art, children }) {
|
|
10334
10458
|
const key = art ? JSON.stringify(art) : "";
|
|
10335
|
-
const value = (0,
|
|
10336
|
-
return /* @__PURE__ */ (0,
|
|
10459
|
+
const value = (0, import_react43.useMemo)(() => key ? JSON.parse(key) : null, [key]);
|
|
10460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PlacementArtContext.Provider, { value, children });
|
|
10337
10461
|
}
|
|
10338
10462
|
function usePlacementArtOptional() {
|
|
10339
|
-
return (0,
|
|
10463
|
+
return (0, import_react43.useContext)(PlacementArtContext);
|
|
10340
10464
|
}
|
|
10341
10465
|
function placementArtFor(art, placement, fallback) {
|
|
10342
10466
|
if (!art) return fallback;
|
|
@@ -10344,7 +10468,7 @@ function placementArtFor(art, placement, fallback) {
|
|
|
10344
10468
|
}
|
|
10345
10469
|
|
|
10346
10470
|
// src/patterns/ProductPageProvider.tsx
|
|
10347
|
-
var
|
|
10471
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
10348
10472
|
function ProductPageProvider({
|
|
10349
10473
|
children,
|
|
10350
10474
|
productId,
|
|
@@ -10358,12 +10482,12 @@ function ProductPageProvider({
|
|
|
10358
10482
|
realtimeGrantUrl,
|
|
10359
10483
|
enablePriority = true
|
|
10360
10484
|
}) {
|
|
10361
|
-
let content = /* @__PURE__ */ (0,
|
|
10485
|
+
let content = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Product, { productId, productData, children });
|
|
10362
10486
|
if (enablePriority) {
|
|
10363
|
-
content = /* @__PURE__ */ (0,
|
|
10487
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(MockupPriorityProvider, { children: content });
|
|
10364
10488
|
}
|
|
10365
10489
|
if (enableRealtime) {
|
|
10366
|
-
content = /* @__PURE__ */ (0,
|
|
10490
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10367
10491
|
RealtimeProvider,
|
|
10368
10492
|
{
|
|
10369
10493
|
wsUrl: realtimeWsUrl,
|
|
@@ -10373,7 +10497,7 @@ function ProductPageProvider({
|
|
|
10373
10497
|
}
|
|
10374
10498
|
);
|
|
10375
10499
|
}
|
|
10376
|
-
return /* @__PURE__ */ (0,
|
|
10500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10377
10501
|
Shop,
|
|
10378
10502
|
{
|
|
10379
10503
|
endpoint,
|
|
@@ -10393,23 +10517,23 @@ function ProductPageProviderMinimal({
|
|
|
10393
10517
|
shop,
|
|
10394
10518
|
initialArtwork
|
|
10395
10519
|
}) {
|
|
10396
|
-
return /* @__PURE__ */ (0,
|
|
10520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
10397
10521
|
Shop,
|
|
10398
10522
|
{
|
|
10399
10523
|
endpoint,
|
|
10400
10524
|
mockupUrl,
|
|
10401
10525
|
shop,
|
|
10402
10526
|
initialArtwork,
|
|
10403
|
-
children: /* @__PURE__ */ (0,
|
|
10527
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Product, { productId, productData, children })
|
|
10404
10528
|
}
|
|
10405
10529
|
);
|
|
10406
10530
|
}
|
|
10407
10531
|
|
|
10408
10532
|
// src/composed/ArtAlignment.tsx
|
|
10409
|
-
var
|
|
10410
|
-
var
|
|
10411
|
-
var
|
|
10412
|
-
var
|
|
10533
|
+
var import_react44 = require("react");
|
|
10534
|
+
var import_react45 = require("@use-gesture/react");
|
|
10535
|
+
var import_sdk12 = require("@snowcone-app/sdk");
|
|
10536
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
10413
10537
|
function ArtAlignment({
|
|
10414
10538
|
src: propSrc,
|
|
10415
10539
|
artworkAspectRatio: propAspectRatio,
|
|
@@ -10443,17 +10567,17 @@ function ArtAlignment({
|
|
|
10443
10567
|
selection: {}
|
|
10444
10568
|
};
|
|
10445
10569
|
}
|
|
10446
|
-
const containerRef = (0,
|
|
10447
|
-
const imageRef = (0,
|
|
10448
|
-
const lastUserDragTimeRef = (0,
|
|
10449
|
-
const [containerSize, setContainerSize] = (0,
|
|
10450
|
-
const [position, setPosition] = (0,
|
|
10451
|
-
const [isReady, setIsReady] = (0,
|
|
10452
|
-
const [detectedAspectRatio, setDetectedAspectRatio] = (0,
|
|
10570
|
+
const containerRef = (0, import_react44.useRef)(null);
|
|
10571
|
+
const imageRef = (0, import_react44.useRef)(null);
|
|
10572
|
+
const lastUserDragTimeRef = (0, import_react44.useRef)(0);
|
|
10573
|
+
const [containerSize, setContainerSize] = (0, import_react44.useState)({ width: 0, height: 0 });
|
|
10574
|
+
const [position, setPosition] = (0, import_react44.useState)({ x: 0, y: 0 });
|
|
10575
|
+
const [isReady, setIsReady] = (0, import_react44.useState)(false);
|
|
10576
|
+
const [detectedAspectRatio, setDetectedAspectRatio] = (0, import_react44.useState)();
|
|
10453
10577
|
const effectiveAspectRatio = artworkAspectRatio || detectedAspectRatio;
|
|
10454
10578
|
const alignment = placementDesign?.alignment || propAlignment || "center";
|
|
10455
|
-
const descriptor = (0,
|
|
10456
|
-
() => (0,
|
|
10579
|
+
const descriptor = (0, import_react44.useMemo)(
|
|
10580
|
+
() => (0, import_sdk12.describeProductArtAlignment)(
|
|
10457
10581
|
{
|
|
10458
10582
|
src,
|
|
10459
10583
|
artworkAspectRatio: effectiveAspectRatio,
|
|
@@ -10474,7 +10598,7 @@ function ArtAlignment({
|
|
|
10474
10598
|
productContext
|
|
10475
10599
|
]
|
|
10476
10600
|
);
|
|
10477
|
-
const containerStyle = (0,
|
|
10601
|
+
const containerStyle = (0, import_react44.useMemo)(() => {
|
|
10478
10602
|
const style = {};
|
|
10479
10603
|
if (height !== void 0) {
|
|
10480
10604
|
const heightValue = typeof height === "number" ? height : parseFloat(height);
|
|
@@ -10505,7 +10629,7 @@ function ArtAlignment({
|
|
|
10505
10629
|
}
|
|
10506
10630
|
return style;
|
|
10507
10631
|
}, [effectiveAspectRatio, height, maxHeight, minHeight]);
|
|
10508
|
-
(0,
|
|
10632
|
+
(0, import_react44.useEffect)(() => {
|
|
10509
10633
|
if (!containerRef.current) return;
|
|
10510
10634
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
10511
10635
|
const entry = entries[0];
|
|
@@ -10531,7 +10655,7 @@ function ArtAlignment({
|
|
|
10531
10655
|
}
|
|
10532
10656
|
}
|
|
10533
10657
|
};
|
|
10534
|
-
(0,
|
|
10658
|
+
(0, import_react44.useEffect)(() => {
|
|
10535
10659
|
if (!imageRef.current || !descriptor) return;
|
|
10536
10660
|
if (imageRef.current.complete) {
|
|
10537
10661
|
setIsReady(true);
|
|
@@ -10556,7 +10680,7 @@ function ArtAlignment({
|
|
|
10556
10680
|
img.removeEventListener("load", handleLoad);
|
|
10557
10681
|
};
|
|
10558
10682
|
}, [descriptor?.src, artworkAspectRatio]);
|
|
10559
|
-
const maskDimensions = (0,
|
|
10683
|
+
const maskDimensions = (0, import_react44.useMemo)(() => {
|
|
10560
10684
|
if (!isReady || containerSize.width === 0 || !descriptor) {
|
|
10561
10685
|
return { width: 0, height: 0 };
|
|
10562
10686
|
}
|
|
@@ -10571,17 +10695,17 @@ function ArtAlignment({
|
|
|
10571
10695
|
descriptor?.effectiveAlignment,
|
|
10572
10696
|
isReady
|
|
10573
10697
|
]);
|
|
10574
|
-
const clipPathCoords = (0,
|
|
10698
|
+
const clipPathCoords = (0, import_react44.useMemo)(() => {
|
|
10575
10699
|
const halfMaskW = maskDimensions.width / 2;
|
|
10576
10700
|
const halfMaskH = maskDimensions.height / 2;
|
|
10577
10701
|
const halfContainerW = containerSize.width / 2;
|
|
10578
10702
|
const halfContainerH = containerSize.height / 2;
|
|
10579
10703
|
return { halfMaskW, halfMaskH, halfContainerW, halfContainerH };
|
|
10580
10704
|
}, [maskDimensions.width, maskDimensions.height, containerSize.width, containerSize.height]);
|
|
10581
|
-
(0,
|
|
10705
|
+
(0, import_react44.useEffect)(() => {
|
|
10582
10706
|
if (Date.now() - lastUserDragTimeRef.current < 500) return;
|
|
10583
10707
|
if (!isReady || maskDimensions.width === 0 || !descriptor) return;
|
|
10584
|
-
const points = (0,
|
|
10708
|
+
const points = (0, import_sdk12.getSnapPoints)(
|
|
10585
10709
|
containerSize,
|
|
10586
10710
|
maskDimensions,
|
|
10587
10711
|
descriptor.effectiveAlignment
|
|
@@ -10600,7 +10724,7 @@ function ArtAlignment({
|
|
|
10600
10724
|
maskDimensions.height,
|
|
10601
10725
|
isReady
|
|
10602
10726
|
]);
|
|
10603
|
-
const overlayStyle = (0,
|
|
10727
|
+
const overlayStyle = (0, import_react44.useMemo)(() => {
|
|
10604
10728
|
const { halfMaskW, halfMaskH, halfContainerW, halfContainerH } = clipPathCoords;
|
|
10605
10729
|
const cx = position.x + halfContainerW;
|
|
10606
10730
|
const cy = position.y + halfContainerH;
|
|
@@ -10621,7 +10745,7 @@ function ArtAlignment({
|
|
|
10621
10745
|
clipPath: isReady ? `polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 0%, ${right}px ${bottom}px, ${right}px ${top}px, ${left}px ${top}px, ${left}px ${bottom}px, ${right}px ${bottom}px)` : "none"
|
|
10622
10746
|
};
|
|
10623
10747
|
}, [isReady, position.x, position.y, clipPathCoords]);
|
|
10624
|
-
const maskStyle = (0,
|
|
10748
|
+
const maskStyle = (0, import_react44.useMemo)(() => ({
|
|
10625
10749
|
width: `${maskDimensions.width}px`,
|
|
10626
10750
|
height: `${maskDimensions.height}px`,
|
|
10627
10751
|
boxShadow: `0 0 0 2px var(--color-background), 0 0 0 4px var(--color-primary)`,
|
|
@@ -10636,7 +10760,7 @@ function ArtAlignment({
|
|
|
10636
10760
|
// GPU acceleration for smoother drag
|
|
10637
10761
|
borderRadius: "var(--radius-image, 4px)"
|
|
10638
10762
|
}), [maskDimensions.width, maskDimensions.height]);
|
|
10639
|
-
const clearImageClipPath = (0,
|
|
10763
|
+
const clearImageClipPath = (0, import_react44.useMemo)(() => {
|
|
10640
10764
|
if (!isReady) return "none";
|
|
10641
10765
|
const { halfMaskW, halfMaskH, halfContainerW, halfContainerH } = clipPathCoords;
|
|
10642
10766
|
const cx = position.x + halfContainerW;
|
|
@@ -10647,14 +10771,14 @@ function ArtAlignment({
|
|
|
10647
10771
|
const top = cy - halfMaskH;
|
|
10648
10772
|
return `polygon(${left}px ${top}px, ${right}px ${top}px, ${right}px ${bottom}px, ${left}px ${bottom}px)`;
|
|
10649
10773
|
}, [isReady, position.x, position.y, clipPathCoords]);
|
|
10650
|
-
const maskTransform = (0,
|
|
10774
|
+
const maskTransform = (0, import_react44.useMemo)(() => {
|
|
10651
10775
|
return descriptor?.effectiveAlignment === "horizontal" ? `translate(calc(-50% + ${position.x}px), -50%)` : `translate(-50%, calc(-50% + ${position.y}px))`;
|
|
10652
10776
|
}, [descriptor?.effectiveAlignment, position.x, position.y]);
|
|
10653
|
-
const lastContextUpdateTimeRef = (0,
|
|
10654
|
-
const pendingAlignmentRef = (0,
|
|
10655
|
-
const throttleTimeoutRef = (0,
|
|
10777
|
+
const lastContextUpdateTimeRef = (0, import_react44.useRef)(0);
|
|
10778
|
+
const pendingAlignmentRef = (0, import_react44.useRef)(null);
|
|
10779
|
+
const throttleTimeoutRef = (0, import_react44.useRef)(null);
|
|
10656
10780
|
const THROTTLE_MS = 150;
|
|
10657
|
-
const bind = (0,
|
|
10781
|
+
const bind = (0, import_react45.useDrag)(
|
|
10658
10782
|
({ offset: [ox, oy], last }) => {
|
|
10659
10783
|
if (maskDimensions.width === 0 || maskDimensions.height === 0 || !descriptor) {
|
|
10660
10784
|
return;
|
|
@@ -10666,7 +10790,7 @@ function ArtAlignment({
|
|
|
10666
10790
|
-maxDistance
|
|
10667
10791
|
);
|
|
10668
10792
|
const positions = Object.entries(
|
|
10669
|
-
(0,
|
|
10793
|
+
(0, import_sdk12.getSnapPoints)(
|
|
10670
10794
|
containerSize,
|
|
10671
10795
|
maskDimensions,
|
|
10672
10796
|
descriptor.effectiveAlignment
|
|
@@ -10679,7 +10803,7 @@ function ArtAlignment({
|
|
|
10679
10803
|
},
|
|
10680
10804
|
["center", Infinity]
|
|
10681
10805
|
);
|
|
10682
|
-
const snapPoints = (0,
|
|
10806
|
+
const snapPoints = (0, import_sdk12.getSnapPoints)(
|
|
10683
10807
|
containerSize,
|
|
10684
10808
|
maskDimensions,
|
|
10685
10809
|
descriptor.effectiveAlignment
|
|
@@ -10747,7 +10871,7 @@ function ArtAlignment({
|
|
|
10747
10871
|
if (!descriptor) {
|
|
10748
10872
|
return null;
|
|
10749
10873
|
}
|
|
10750
|
-
return /* @__PURE__ */ (0,
|
|
10874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10751
10875
|
"div",
|
|
10752
10876
|
{
|
|
10753
10877
|
className: `relative ${className || ""}`,
|
|
@@ -10756,8 +10880,8 @@ function ArtAlignment({
|
|
|
10756
10880
|
width: "fit-content",
|
|
10757
10881
|
maxWidth: "100%"
|
|
10758
10882
|
},
|
|
10759
|
-
children: /* @__PURE__ */ (0,
|
|
10760
|
-
/* @__PURE__ */ (0,
|
|
10883
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "overflow-hidden p-1", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { ref: containerRef, className: "relative", style: containerStyle, children: [
|
|
10884
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10761
10885
|
"img",
|
|
10762
10886
|
{
|
|
10763
10887
|
ref: imageRef,
|
|
@@ -10782,9 +10906,9 @@ function ArtAlignment({
|
|
|
10782
10906
|
loading: "eager"
|
|
10783
10907
|
}
|
|
10784
10908
|
),
|
|
10785
|
-
isReady && maskDimensions.width > 0 && /* @__PURE__ */ (0,
|
|
10786
|
-
/* @__PURE__ */ (0,
|
|
10787
|
-
/* @__PURE__ */ (0,
|
|
10909
|
+
isReady && maskDimensions.width > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
10910
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { style: overlayStyle }),
|
|
10911
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10788
10912
|
"img",
|
|
10789
10913
|
{
|
|
10790
10914
|
src: descriptor.src,
|
|
@@ -10812,7 +10936,7 @@ function ArtAlignment({
|
|
|
10812
10936
|
loading: "eager"
|
|
10813
10937
|
}
|
|
10814
10938
|
),
|
|
10815
|
-
/* @__PURE__ */ (0,
|
|
10939
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10816
10940
|
"div",
|
|
10817
10941
|
{
|
|
10818
10942
|
...bind(),
|
|
@@ -10829,8 +10953,8 @@ function ArtAlignment({
|
|
|
10829
10953
|
}
|
|
10830
10954
|
|
|
10831
10955
|
// src/composed/ArtworkCustomizer.tsx
|
|
10832
|
-
var
|
|
10833
|
-
var
|
|
10956
|
+
var import_react46 = require("react");
|
|
10957
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
10834
10958
|
function ArtworkCustomizer(props) {
|
|
10835
10959
|
const designContext = useDesign();
|
|
10836
10960
|
const artwork = props.artwork || designContext.selectedArtwork;
|
|
@@ -10842,7 +10966,7 @@ function ArtworkCustomizer(props) {
|
|
|
10842
10966
|
const placements = productCtx?.product?.placements || [];
|
|
10843
10967
|
const selectedPlacement = productCtx?.selectedPlacement;
|
|
10844
10968
|
const setSelectedPlacement = productCtx?.setSelectedPlacement;
|
|
10845
|
-
(0,
|
|
10969
|
+
(0, import_react46.useEffect)(() => {
|
|
10846
10970
|
if (placements.length > 0 && !selectedPlacement && setSelectedPlacement) {
|
|
10847
10971
|
setSelectedPlacement(placements[0].label);
|
|
10848
10972
|
}
|
|
@@ -10852,13 +10976,13 @@ function ArtworkCustomizer(props) {
|
|
|
10852
10976
|
);
|
|
10853
10977
|
const isColorPlacement = currentPlacement?.type === "color";
|
|
10854
10978
|
const isFitMode = currentPlacement?.defaultScaleMode === "fit";
|
|
10855
|
-
(0,
|
|
10979
|
+
(0, import_react46.useEffect)(() => {
|
|
10856
10980
|
}, [selectedPlacement]);
|
|
10857
10981
|
if (!artwork) {
|
|
10858
|
-
return /* @__PURE__ */ (0,
|
|
10982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: `text-sm text-muted-foreground ${props.className || ""}`, children: "Select artwork to customize" });
|
|
10859
10983
|
}
|
|
10860
10984
|
if (artwork.type === "pattern") {
|
|
10861
|
-
return /* @__PURE__ */ (0,
|
|
10985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
10862
10986
|
TileCount,
|
|
10863
10987
|
{
|
|
10864
10988
|
artwork,
|
|
@@ -10869,8 +10993,8 @@ function ArtworkCustomizer(props) {
|
|
|
10869
10993
|
);
|
|
10870
10994
|
}
|
|
10871
10995
|
const isCanvasEditorMode = props.mode === "canvas" || !!props.children && props.mode !== "alignment";
|
|
10872
|
-
return /* @__PURE__ */ (0,
|
|
10873
|
-
placements.length > 1 && /* @__PURE__ */ (0,
|
|
10996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex flex-col gap-4", children: [
|
|
10997
|
+
placements.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "text-sm leading-relaxed", children: placements.map((p) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
10874
10998
|
"button",
|
|
10875
10999
|
{
|
|
10876
11000
|
onClick: () => setSelectedPlacement?.(p.label),
|
|
@@ -10879,7 +11003,7 @@ function ArtworkCustomizer(props) {
|
|
|
10879
11003
|
},
|
|
10880
11004
|
p.label
|
|
10881
11005
|
)) }),
|
|
10882
|
-
isColorPlacement ? /* @__PURE__ */ (0,
|
|
11006
|
+
isColorPlacement ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ColorPicker2, { placement: selectedPlacement }) : isFitMode ? null : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "relative", children: props.children || /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
10883
11007
|
ArtAlignment,
|
|
10884
11008
|
{
|
|
10885
11009
|
artwork: { src: artwork.src },
|
|
@@ -10895,7 +11019,7 @@ function ArtworkCustomizer(props) {
|
|
|
10895
11019
|
|
|
10896
11020
|
// src/composed/CanvasEditor.tsx
|
|
10897
11021
|
var import_lucide_react2 = require("lucide-react");
|
|
10898
|
-
var
|
|
11022
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
10899
11023
|
var ImageIcon = import_lucide_react2.Image;
|
|
10900
11024
|
var TypeIcon = import_lucide_react2.Type;
|
|
10901
11025
|
var ShapesIcon = import_lucide_react2.Shapes;
|
|
@@ -10906,43 +11030,65 @@ function CanvasEditor({
|
|
|
10906
11030
|
onOpenTypography,
|
|
10907
11031
|
children
|
|
10908
11032
|
}) {
|
|
10909
|
-
return /* @__PURE__ */ (0,
|
|
10910
|
-
/* @__PURE__ */ (0,
|
|
10911
|
-
/* @__PURE__ */ (0,
|
|
10912
|
-
/* @__PURE__ */ (0,
|
|
11033
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex flex-col gap-6", children: [
|
|
11034
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "bg-background border-2 border-border rounded-lg aspect-square overflow-hidden relative", children: children || /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "text-muted-foreground text-sm", children: "No editor provided" }) }) }),
|
|
11035
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex items-center justify-center gap-8 py-2", children: [
|
|
11036
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
10913
11037
|
"button",
|
|
10914
11038
|
{
|
|
10915
11039
|
onClick: onOpenImageGallery,
|
|
10916
11040
|
className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",
|
|
10917
11041
|
"aria-label": "Open image gallery",
|
|
10918
|
-
children: /* @__PURE__ */ (0,
|
|
11042
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ImageIcon, { className: "w-6 h-6" }) })
|
|
10919
11043
|
}
|
|
10920
11044
|
),
|
|
10921
|
-
/* @__PURE__ */ (0,
|
|
11045
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
10922
11046
|
"button",
|
|
10923
11047
|
{
|
|
10924
11048
|
onClick: onOpenTypography,
|
|
10925
11049
|
className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",
|
|
10926
11050
|
"aria-label": "Add text",
|
|
10927
|
-
children: /* @__PURE__ */ (0,
|
|
11051
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(TypeIcon, { className: "w-6 h-6" }) })
|
|
10928
11052
|
}
|
|
10929
11053
|
),
|
|
10930
|
-
/* @__PURE__ */ (0,
|
|
10931
|
-
/* @__PURE__ */ (0,
|
|
11054
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ShapesIcon, { className: "w-6 h-6" }) }) }),
|
|
11055
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("button", { className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(UploadIcon, { className: "w-6 h-6" }) }) })
|
|
10932
11056
|
] })
|
|
10933
11057
|
] });
|
|
10934
11058
|
}
|
|
10935
11059
|
|
|
10936
11060
|
// src/composed/HeroProductImage.tsx
|
|
10937
|
-
var
|
|
10938
|
-
|
|
11061
|
+
var import_react48 = require("react");
|
|
11062
|
+
|
|
11063
|
+
// src/composed/renderRefusalProbe.ts
|
|
11064
|
+
var import_sdk13 = require("@snowcone-app/sdk");
|
|
11065
|
+
async function probeRenderAnswer(url, fetchImpl = fetch) {
|
|
11066
|
+
let res;
|
|
11067
|
+
try {
|
|
11068
|
+
res = await fetchImpl(url, { mode: "cors", cache: "reload", credentials: "omit" });
|
|
11069
|
+
} catch {
|
|
11070
|
+
return { ok: false, status: 0, code: null };
|
|
11071
|
+
}
|
|
11072
|
+
if (res.ok) return { ok: true, status: res.status, code: null };
|
|
11073
|
+
let body = null;
|
|
11074
|
+
try {
|
|
11075
|
+
const text = await res.text();
|
|
11076
|
+
body = text ? JSON.parse(text) : null;
|
|
11077
|
+
} catch {
|
|
11078
|
+
body = null;
|
|
11079
|
+
}
|
|
11080
|
+
return { ok: false, status: res.status, code: (0, import_sdk13.renderRefusalCodeOf)(body, res.headers.get("x-render-reason")) };
|
|
11081
|
+
}
|
|
11082
|
+
|
|
11083
|
+
// src/composed/HeroProductImage.tsx
|
|
11084
|
+
var import_sdk14 = require("@snowcone-app/sdk");
|
|
10939
11085
|
|
|
10940
11086
|
// src/hooks/viewport/useContainerWidth.ts
|
|
10941
|
-
var
|
|
11087
|
+
var import_react47 = require("react");
|
|
10942
11088
|
function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
10943
|
-
const [width, setWidth] = (0,
|
|
10944
|
-
const resizeTimeoutRef = (0,
|
|
10945
|
-
(0,
|
|
11089
|
+
const [width, setWidth] = (0, import_react47.useState)(0);
|
|
11090
|
+
const resizeTimeoutRef = (0, import_react47.useRef)(null);
|
|
11091
|
+
(0, import_react47.useLayoutEffect)(() => {
|
|
10946
11092
|
const el = containerRef.current;
|
|
10947
11093
|
if (!el) return;
|
|
10948
11094
|
const cssWidth = el.offsetWidth;
|
|
@@ -10950,7 +11096,7 @@ function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
|
10950
11096
|
const dpr = window.devicePixelRatio ?? 1;
|
|
10951
11097
|
setWidth(Math.min(Math.round(cssWidth * dpr), maxWidth));
|
|
10952
11098
|
}, [containerRef, maxWidth]);
|
|
10953
|
-
(0,
|
|
11099
|
+
(0, import_react47.useEffect)(() => {
|
|
10954
11100
|
const measure = () => {
|
|
10955
11101
|
const el = containerRef.current;
|
|
10956
11102
|
if (!el) return;
|
|
@@ -10973,7 +11119,7 @@ function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
|
10973
11119
|
}
|
|
10974
11120
|
|
|
10975
11121
|
// src/composed/HeroProductImage.tsx
|
|
10976
|
-
var
|
|
11122
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
10977
11123
|
function buildHeroMockupUrl(args) {
|
|
10978
11124
|
const snow = typeof window !== "undefined" && window.snowcone || {};
|
|
10979
11125
|
return heroMockupUrl({ ...args, shop: snow.shop, resolver: snow.resolver });
|
|
@@ -10989,6 +11135,7 @@ function heroSize(stripView, cropWidth, width) {
|
|
|
10989
11135
|
return { width };
|
|
10990
11136
|
}
|
|
10991
11137
|
var EMPTY_IMAGES = [];
|
|
11138
|
+
var DESIGN_BUSY_RETRY_MS = 1500;
|
|
10992
11139
|
function blockingSessionError(error) {
|
|
10993
11140
|
return error && !error.retryable ? error.code : null;
|
|
10994
11141
|
}
|
|
@@ -10996,7 +11143,7 @@ function pictureRenderState(s) {
|
|
|
10996
11143
|
if (s.refusal || s.behind && s.sessionError) return "refused";
|
|
10997
11144
|
return s.behind ? "stale" : "current";
|
|
10998
11145
|
}
|
|
10999
|
-
var HeroProductImage = (0,
|
|
11146
|
+
var HeroProductImage = (0, import_react48.memo)(function HeroProductImage2({
|
|
11000
11147
|
productId,
|
|
11001
11148
|
mockupId,
|
|
11002
11149
|
variantId,
|
|
@@ -11042,28 +11189,31 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11042
11189
|
const mockupBg = useMockupBackgroundOptional();
|
|
11043
11190
|
const placementArt = usePlacementArtOptional();
|
|
11044
11191
|
const placementArtKey = placementArt ? JSON.stringify(placementArt) : "";
|
|
11045
|
-
const
|
|
11192
|
+
const gallerySkip = useGallerySkipOptional();
|
|
11193
|
+
const gallerySkipRef = (0, import_react48.useRef)(gallerySkip);
|
|
11194
|
+
gallerySkipRef.current = gallerySkip;
|
|
11195
|
+
const priorityContextRef = (0, import_react48.useRef)(priorityContext);
|
|
11046
11196
|
priorityContextRef.current = priorityContext;
|
|
11047
|
-
const contextRef = (0,
|
|
11197
|
+
const contextRef = (0, import_react48.useRef)(context);
|
|
11048
11198
|
contextRef.current = context;
|
|
11049
11199
|
const actualProductId = product?.id || productId || context?.product?.id;
|
|
11050
|
-
const selectedGvid = (0,
|
|
11051
|
-
return (0,
|
|
11200
|
+
const selectedGvid = (0, import_react48.useMemo)(() => {
|
|
11201
|
+
return (0, import_sdk14.resolveVariantId)(context, gvid, variantId);
|
|
11052
11202
|
}, [gvid, variantId, context?.selection, context?.combinations]);
|
|
11053
|
-
const actualMockupId = (0,
|
|
11054
|
-
return (0,
|
|
11203
|
+
const actualMockupId = (0, import_react48.useMemo)(() => {
|
|
11204
|
+
return (0, import_sdk14.resolveMockupId)(context, selectedGvid, mockupId);
|
|
11055
11205
|
}, [mockupId, selectedGvid, context]);
|
|
11056
|
-
const actualGvid = (0,
|
|
11057
|
-
return gvid || variantId ? selectedGvid : (0,
|
|
11206
|
+
const actualGvid = (0, import_react48.useMemo)(() => {
|
|
11207
|
+
return gvid || variantId ? selectedGvid : (0, import_sdk14.resolvePreviewVariantId)(context, selectedGvid, actualMockupId);
|
|
11058
11208
|
}, [gvid, variantId, selectedGvid, actualMockupId, context]);
|
|
11059
11209
|
const unavailable = actualMockupId ? realtimeContext?.unavailableMockups?.get(actualMockupId) ?? null : null;
|
|
11060
11210
|
const artworkSrc = artwork?.src;
|
|
11061
11211
|
const selectedArtworkSrc = designContext?.selectedArtwork?.src;
|
|
11062
11212
|
const effectiveArtworkSrc = artworkSrc || selectedArtworkSrc;
|
|
11063
|
-
const containerRef = (0,
|
|
11213
|
+
const containerRef = (0, import_react48.useRef)(null);
|
|
11064
11214
|
const measuredWidth = useContainerWidth(containerRef);
|
|
11065
11215
|
const width = widthProp ?? measuredWidth;
|
|
11066
|
-
const initialStaticUrl = (0,
|
|
11216
|
+
const initialStaticUrl = (0, import_react48.useMemo)(() => {
|
|
11067
11217
|
if (realtimeUrl) return null;
|
|
11068
11218
|
if (mode === "realtime") return null;
|
|
11069
11219
|
if (typeof window !== "undefined" && window.snowcone?.signMockupUrl) {
|
|
@@ -11085,7 +11235,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11085
11235
|
};
|
|
11086
11236
|
}
|
|
11087
11237
|
}
|
|
11088
|
-
const design = (0,
|
|
11238
|
+
const design = (0, import_sdk14.createDesignForPlacements)(allPlacements, images, {
|
|
11089
11239
|
artworkSrc: effectiveArtworkSrc,
|
|
11090
11240
|
placementDesigns
|
|
11091
11241
|
});
|
|
@@ -11134,31 +11284,31 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11134
11284
|
shimmerDelay,
|
|
11135
11285
|
initialUrl: realtimeUrl || initialStaticUrl
|
|
11136
11286
|
});
|
|
11137
|
-
const [error, setError] = (0,
|
|
11138
|
-
const [isInPreloadZone, setIsInPreloadZone] = (0,
|
|
11139
|
-
const componentIdRef = (0,
|
|
11287
|
+
const [error, setError] = (0, import_react48.useState)(null);
|
|
11288
|
+
const [isInPreloadZone, setIsInPreloadZone] = (0, import_react48.useState)(true);
|
|
11289
|
+
const componentIdRef = (0, import_react48.useRef)(
|
|
11140
11290
|
`hero-product-image-${Math.random().toString(36).substr(2, 9)}`
|
|
11141
11291
|
);
|
|
11142
|
-
const [containerMounted, setContainerMounted] = (0,
|
|
11143
|
-
const setContainerRef = (0,
|
|
11292
|
+
const [containerMounted, setContainerMounted] = (0, import_react48.useState)(false);
|
|
11293
|
+
const setContainerRef = (0, import_react48.useCallback)((node) => {
|
|
11144
11294
|
containerRef.current = node;
|
|
11145
11295
|
setContainerMounted(!!node);
|
|
11146
11296
|
}, []);
|
|
11147
|
-
const lastUrlRef = (0,
|
|
11148
|
-
const priorityRegisteredRef = (0,
|
|
11149
|
-
const onLoadCalledRef = (0,
|
|
11150
|
-
const prevArtworkSrcRef = (0,
|
|
11151
|
-
const realtimeArtworkSrcRef = (0,
|
|
11152
|
-
const hasReceivedRealtimeRef = (0,
|
|
11153
|
-
const isPendingExportRef = (0,
|
|
11154
|
-
const onUrlGeneratedRef = (0,
|
|
11297
|
+
const lastUrlRef = (0, import_react48.useRef)(realtimeUrl ?? initialStaticUrl ?? null);
|
|
11298
|
+
const priorityRegisteredRef = (0, import_react48.useRef)(false);
|
|
11299
|
+
const onLoadCalledRef = (0, import_react48.useRef)(false);
|
|
11300
|
+
const prevArtworkSrcRef = (0, import_react48.useRef)(void 0);
|
|
11301
|
+
const realtimeArtworkSrcRef = (0, import_react48.useRef)(void 0);
|
|
11302
|
+
const hasReceivedRealtimeRef = (0, import_react48.useRef)(false);
|
|
11303
|
+
const isPendingExportRef = (0, import_react48.useRef)(false);
|
|
11304
|
+
const onUrlGeneratedRef = (0, import_react48.useRef)(onUrlGenerated);
|
|
11155
11305
|
onUrlGeneratedRef.current = onUrlGenerated;
|
|
11156
|
-
const onShownRef = (0,
|
|
11306
|
+
const onShownRef = (0, import_react48.useRef)(onShown);
|
|
11157
11307
|
onShownRef.current = onShown;
|
|
11158
|
-
const presignedUsedRef = (0,
|
|
11159
|
-
const layersLengthRef = (0,
|
|
11308
|
+
const presignedUsedRef = (0, import_react48.useRef)(false);
|
|
11309
|
+
const layersLengthRef = (0, import_react48.useRef)(layers.length);
|
|
11160
11310
|
layersLengthRef.current = layers.length;
|
|
11161
|
-
(0,
|
|
11311
|
+
(0, import_react48.useEffect)(() => {
|
|
11162
11312
|
if (initialPriority === 1) return;
|
|
11163
11313
|
if (!containerMounted || !containerRef.current) return;
|
|
11164
11314
|
if (isInPreloadZone) return;
|
|
@@ -11177,7 +11327,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11177
11327
|
);
|
|
11178
11328
|
return unobserve;
|
|
11179
11329
|
}, [containerMounted, initialPriority, isInPreloadZone]);
|
|
11180
|
-
(0,
|
|
11330
|
+
(0, import_react48.useEffect)(() => {
|
|
11181
11331
|
if (!realtimeUrl) return;
|
|
11182
11332
|
if (realtimeUrl === lastUrlRef.current) return;
|
|
11183
11333
|
lastUrlRef.current = realtimeUrl;
|
|
@@ -11185,7 +11335,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11185
11335
|
const isInitialLoad = layersLengthRef.current === 0;
|
|
11186
11336
|
addLayerDirectly(realtimeUrl, { skipTransition: isInitialLoad });
|
|
11187
11337
|
}, [realtimeUrl, addLayerDirectly, actualMockupId, placement]);
|
|
11188
|
-
(0,
|
|
11338
|
+
(0, import_react48.useEffect)(() => {
|
|
11189
11339
|
if (mode === "static") {
|
|
11190
11340
|
return;
|
|
11191
11341
|
}
|
|
@@ -11229,7 +11379,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11229
11379
|
addLayerDirectly
|
|
11230
11380
|
// NOTE: layers.length removed - use layersLengthRef instead to prevent duplicate requests
|
|
11231
11381
|
]);
|
|
11232
|
-
(0,
|
|
11382
|
+
(0, import_react48.useEffect)(() => {
|
|
11233
11383
|
if (mode === "static") return;
|
|
11234
11384
|
if (!realtimeContext?.subscribePendingBlob || !placement) return;
|
|
11235
11385
|
const handlePendingExport = (pendingPlacement) => {
|
|
@@ -11242,38 +11392,38 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11242
11392
|
unsubscribe?.();
|
|
11243
11393
|
};
|
|
11244
11394
|
}, [mode, realtimeContext?.subscribePendingBlob, placement]);
|
|
11245
|
-
const renderVersionRef = (0,
|
|
11246
|
-
const arrivedVersionRef = (0,
|
|
11247
|
-
const versionByUrlRef = (0,
|
|
11248
|
-
const loadedUrlRef = (0,
|
|
11249
|
-
const blobConsumerRef = (0,
|
|
11395
|
+
const renderVersionRef = (0, import_react48.useRef)(0);
|
|
11396
|
+
const arrivedVersionRef = (0, import_react48.useRef)(0);
|
|
11397
|
+
const versionByUrlRef = (0, import_react48.useRef)(/* @__PURE__ */ new Map());
|
|
11398
|
+
const loadedUrlRef = (0, import_react48.useRef)(null);
|
|
11399
|
+
const blobConsumerRef = (0, import_react48.useRef)(`el-${Math.random().toString(36).slice(2, 10)}`);
|
|
11250
11400
|
const releaseBlobConsumer = realtimeContext?.releaseBlobConsumer;
|
|
11251
|
-
(0,
|
|
11401
|
+
(0, import_react48.useEffect)(() => {
|
|
11252
11402
|
const id = actualMockupId;
|
|
11253
11403
|
const consumer = blobConsumerRef.current;
|
|
11254
11404
|
return () => {
|
|
11255
11405
|
if (id) releaseBlobConsumer?.(id, consumer);
|
|
11256
11406
|
};
|
|
11257
11407
|
}, [actualMockupId, releaseBlobConsumer]);
|
|
11258
|
-
const frameErrorRef = (0,
|
|
11259
|
-
const showVersionOf = (0,
|
|
11408
|
+
const frameErrorRef = (0, import_react48.useRef)(null);
|
|
11409
|
+
const showVersionOf = (0, import_react48.useCallback)((url) => {
|
|
11260
11410
|
const e = versionByUrlRef.current.get(url);
|
|
11261
11411
|
if (!e || e.v < renderVersionRef.current) return;
|
|
11262
11412
|
renderVersionRef.current = e.v;
|
|
11263
11413
|
renderVersionsRef.current = e.versions;
|
|
11264
11414
|
frameErrorRef.current = null;
|
|
11265
11415
|
}, []);
|
|
11266
|
-
const renderVersionsRef = (0,
|
|
11416
|
+
const renderVersionsRef = (0, import_react48.useRef)(null);
|
|
11267
11417
|
const getLatestSentVersions = realtimeContext?.getLatestSentVersions;
|
|
11268
|
-
const refusalCodeRef = (0,
|
|
11418
|
+
const refusalCodeRef = (0, import_react48.useRef)(null);
|
|
11269
11419
|
refusalCodeRef.current = unavailable?.code ?? null;
|
|
11270
|
-
const frameFailedRef = (0,
|
|
11420
|
+
const frameFailedRef = (0, import_react48.useRef)(realtimeContext?.frameFailed);
|
|
11271
11421
|
frameFailedRef.current = realtimeContext?.frameFailed;
|
|
11272
|
-
const sessionErrorCodeRef = (0,
|
|
11422
|
+
const sessionErrorCodeRef = (0, import_react48.useRef)(null);
|
|
11273
11423
|
sessionErrorCodeRef.current = blockingSessionError(realtimeContext?.renderError);
|
|
11274
11424
|
const getCanvasVersion = realtimeContext?.getCanvasVersion;
|
|
11275
11425
|
const getSessionShape = realtimeContext?.getSessionShape;
|
|
11276
|
-
const applyRenderStamp = (0,
|
|
11426
|
+
const applyRenderStamp = (0, import_react48.useCallback)(() => {
|
|
11277
11427
|
const node = containerRef.current;
|
|
11278
11428
|
if (!node) return;
|
|
11279
11429
|
if (mode === "static") {
|
|
@@ -11307,12 +11457,12 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11307
11457
|
node.dataset.sessionPhase = shape.phase;
|
|
11308
11458
|
}
|
|
11309
11459
|
}, [getCanvasVersion, getLatestSentVersions, getSessionShape, mode]);
|
|
11310
|
-
const applyRenderStampRef = (0,
|
|
11460
|
+
const applyRenderStampRef = (0, import_react48.useRef)(applyRenderStamp);
|
|
11311
11461
|
applyRenderStampRef.current = applyRenderStamp;
|
|
11312
|
-
(0,
|
|
11462
|
+
(0, import_react48.useEffect)(() => {
|
|
11313
11463
|
applyRenderStamp();
|
|
11314
11464
|
});
|
|
11315
|
-
(0,
|
|
11465
|
+
(0, import_react48.useEffect)(() => {
|
|
11316
11466
|
const subscribeSent = realtimeContext?.subscribeBlobSent;
|
|
11317
11467
|
const subscribeResult = realtimeContext?.subscribeMockupResultById;
|
|
11318
11468
|
if (!actualMockupId || !subscribeSent || !subscribeResult) return;
|
|
@@ -11339,7 +11489,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11339
11489
|
applyRenderStamp
|
|
11340
11490
|
]);
|
|
11341
11491
|
const reportPictureView = realtimeContext?.reportPictureView;
|
|
11342
|
-
(0,
|
|
11492
|
+
(0, import_react48.useEffect)(() => {
|
|
11343
11493
|
if (!viewportPolicy || !reportPictureView || !actualMockupId) return;
|
|
11344
11494
|
const node = containerRef.current;
|
|
11345
11495
|
if (!node || typeof IntersectionObserver === "undefined") return;
|
|
@@ -11371,7 +11521,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11371
11521
|
reportPictureView(key, null);
|
|
11372
11522
|
};
|
|
11373
11523
|
}, [viewportPolicy, reportPictureView, actualMockupId]);
|
|
11374
|
-
(0,
|
|
11524
|
+
(0, import_react48.useEffect)(() => {
|
|
11375
11525
|
if (!priorityContext || !actualMockupId || !placement) return;
|
|
11376
11526
|
priorityContext.registerMockup(actualMockupId, placement, initialPriority);
|
|
11377
11527
|
priorityRegisteredRef.current = true;
|
|
@@ -11382,7 +11532,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11382
11532
|
}
|
|
11383
11533
|
};
|
|
11384
11534
|
}, [priorityContext, actualMockupId, placement, initialPriority]);
|
|
11385
|
-
(0,
|
|
11535
|
+
(0, import_react48.useEffect)(() => {
|
|
11386
11536
|
if (!priorityContext?.updateElementRef || !actualMockupId) return;
|
|
11387
11537
|
if (containerMounted && containerRef.current) {
|
|
11388
11538
|
priorityContext.updateElementRef(actualMockupId, containerRef.current);
|
|
@@ -11396,7 +11546,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11396
11546
|
const artworkTileCount = artwork?.type === "pattern" ? artwork?.tileCount : void 0;
|
|
11397
11547
|
const selectedArtworkType = designContext?.selectedArtwork?.type;
|
|
11398
11548
|
const selectedArtworkTileCount = designContext?.selectedArtwork?.type === "pattern" ? designContext?.selectedArtwork?.tileCount : void 0;
|
|
11399
|
-
(0,
|
|
11549
|
+
(0, import_react48.useEffect)(() => {
|
|
11400
11550
|
const currentSrc = artIdentity(artworkSrc || selectedArtworkSrc, placementArtKey);
|
|
11401
11551
|
if (currentSrc !== prevArtworkSrcRef.current) {
|
|
11402
11552
|
lastUrlRef.current = null;
|
|
@@ -11406,11 +11556,11 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11406
11556
|
realtimeArtworkSrcRef.current = void 0;
|
|
11407
11557
|
}
|
|
11408
11558
|
}, [artworkSrc, selectedArtworkSrc, placementArtKey]);
|
|
11409
|
-
const contextSelectionRef = (0,
|
|
11410
|
-
const contextOptionAttributesRef = (0,
|
|
11559
|
+
const contextSelectionRef = (0, import_react48.useRef)(context?.selection);
|
|
11560
|
+
const contextOptionAttributesRef = (0, import_react48.useRef)(context?.optionAttributes);
|
|
11411
11561
|
contextSelectionRef.current = context?.selection;
|
|
11412
11562
|
contextOptionAttributesRef.current = context?.optionAttributes;
|
|
11413
|
-
const createDesignForPlacementsWrapper = (0,
|
|
11563
|
+
const createDesignForPlacementsWrapper = (0, import_react48.useCallback)(
|
|
11414
11564
|
(placements, providedImages) => {
|
|
11415
11565
|
const effectiveArtworkSrc2 = artworkSrc || selectedArtworkSrc;
|
|
11416
11566
|
if (!effectiveArtworkSrc2 || effectiveArtworkSrc2.trim() === "" || effectiveArtworkSrc2 === "undefined" || effectiveArtworkSrc2 === "null") {
|
|
@@ -11431,7 +11581,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11431
11581
|
const placementTiles = firstPlacement ? getPlacementDesign?.(firstPlacement.label)?.tiles : void 0;
|
|
11432
11582
|
const isCurrentArtworkPattern = artworkType === "pattern" || selectedArtworkType === "pattern";
|
|
11433
11583
|
const tiles = isCurrentArtworkPattern ? placementTiles ? placementTiles : artworkTileCount ? artworkTileCount : selectedArtworkTileCount ? selectedArtworkTileCount : void 0 : void 0;
|
|
11434
|
-
return (0,
|
|
11584
|
+
return (0, import_sdk14.createDesignForPlacements)(placements, providedImages, {
|
|
11435
11585
|
selection: contextSelectionRef.current,
|
|
11436
11586
|
attributes: contextOptionAttributesRef.current,
|
|
11437
11587
|
artworkSrc: effectiveArtworkSrc2,
|
|
@@ -11450,7 +11600,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11450
11600
|
selectedArtworkTileCount
|
|
11451
11601
|
]
|
|
11452
11602
|
);
|
|
11453
|
-
(0,
|
|
11603
|
+
(0, import_react48.useEffect)(() => {
|
|
11454
11604
|
if (mode === "realtime") return;
|
|
11455
11605
|
if (initialStaticUrl && lastUrlRef.current === initialStaticUrl) {
|
|
11456
11606
|
return;
|
|
@@ -11558,12 +11708,15 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11558
11708
|
const topLayer = layers[layers.length - 1];
|
|
11559
11709
|
const displayUrl = topLayer?.url || realtimeUrl || initialStaticUrl;
|
|
11560
11710
|
const CROSSFADE_MS = 400;
|
|
11561
|
-
const [prevUrl, setPrevUrl] = (0,
|
|
11562
|
-
const [showNew, setShowNew] = (0,
|
|
11563
|
-
const [renderedUrl, setRenderedUrl] = (0,
|
|
11564
|
-
const
|
|
11565
|
-
|
|
11566
|
-
const [
|
|
11711
|
+
const [prevUrl, setPrevUrl] = (0, import_react48.useState)(null);
|
|
11712
|
+
const [showNew, setShowNew] = (0, import_react48.useState)(false);
|
|
11713
|
+
const [renderedUrl, setRenderedUrl] = (0, import_react48.useState)(displayUrl);
|
|
11714
|
+
const renderedUrlRef = (0, import_react48.useRef)(renderedUrl);
|
|
11715
|
+
renderedUrlRef.current = renderedUrl;
|
|
11716
|
+
const [designRefused, setDesignRefused] = (0, import_react48.useState)(null);
|
|
11717
|
+
const [firstImageLoaded, setFirstImageLoaded] = (0, import_react48.useState)(false);
|
|
11718
|
+
const [loaderMounted, setLoaderMounted] = (0, import_react48.useState)(true);
|
|
11719
|
+
const [imgFailed, setImgFailed] = (0, import_react48.useState)(false);
|
|
11567
11720
|
const failedSrc = (() => {
|
|
11568
11721
|
if (!imgFailed || !renderedUrl) return void 0;
|
|
11569
11722
|
try {
|
|
@@ -11573,15 +11726,16 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11573
11726
|
return "?";
|
|
11574
11727
|
}
|
|
11575
11728
|
})();
|
|
11576
|
-
const [retryNonce, setRetryNonce] = (0,
|
|
11577
|
-
const retriedUrlRef = (0,
|
|
11578
|
-
const prevDisplayUrlRef = (0,
|
|
11579
|
-
const signHintShownRef = (0,
|
|
11580
|
-
(0,
|
|
11729
|
+
const [retryNonce, setRetryNonce] = (0, import_react48.useState)(0);
|
|
11730
|
+
const retriedUrlRef = (0, import_react48.useRef)(null);
|
|
11731
|
+
const prevDisplayUrlRef = (0, import_react48.useRef)(displayUrl);
|
|
11732
|
+
const signHintShownRef = (0, import_react48.useRef)(false);
|
|
11733
|
+
(0, import_react48.useEffect)(() => {
|
|
11581
11734
|
if (!displayUrl || displayUrl === prevDisplayUrlRef.current) return;
|
|
11582
11735
|
const oldUrl = prevDisplayUrlRef.current;
|
|
11583
11736
|
prevDisplayUrlRef.current = displayUrl;
|
|
11584
11737
|
setImgFailed(false);
|
|
11738
|
+
setDesignRefused(null);
|
|
11585
11739
|
retriedUrlRef.current = null;
|
|
11586
11740
|
if (!oldUrl) {
|
|
11587
11741
|
setRenderedUrl(displayUrl);
|
|
@@ -11610,26 +11764,26 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11610
11764
|
preload.onerror = null;
|
|
11611
11765
|
};
|
|
11612
11766
|
}, [displayUrl]);
|
|
11613
|
-
const handleCrossfadeEnd = (0,
|
|
11767
|
+
const handleCrossfadeEnd = (0, import_react48.useCallback)(() => {
|
|
11614
11768
|
setPrevUrl(null);
|
|
11615
11769
|
setShowNew(false);
|
|
11616
11770
|
}, []);
|
|
11617
|
-
const handleLoaderExited = (0,
|
|
11771
|
+
const handleLoaderExited = (0, import_react48.useCallback)(() => setLoaderMounted(false), []);
|
|
11618
11772
|
if (!hasArtwork) {
|
|
11619
|
-
return /* @__PURE__ */ (0,
|
|
11773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11620
11774
|
"div",
|
|
11621
11775
|
{
|
|
11622
11776
|
className: `bg-gray-100 flex items-center justify-center ${className || ""}`,
|
|
11623
11777
|
style,
|
|
11624
|
-
children: /* @__PURE__ */ (0,
|
|
11625
|
-
/* @__PURE__ */ (0,
|
|
11778
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "text-gray-400 text-center p-4", children: [
|
|
11779
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11626
11780
|
"svg",
|
|
11627
11781
|
{
|
|
11628
11782
|
className: "w-8 h-8 mx-auto mb-2",
|
|
11629
11783
|
fill: "none",
|
|
11630
11784
|
stroke: "currentColor",
|
|
11631
11785
|
viewBox: "0 0 24 24",
|
|
11632
|
-
children: /* @__PURE__ */ (0,
|
|
11786
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11633
11787
|
"path",
|
|
11634
11788
|
{
|
|
11635
11789
|
strokeLinecap: "round",
|
|
@@ -11640,22 +11794,22 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11640
11794
|
)
|
|
11641
11795
|
}
|
|
11642
11796
|
),
|
|
11643
|
-
/* @__PURE__ */ (0,
|
|
11797
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "text-xs", children: emptyText })
|
|
11644
11798
|
] })
|
|
11645
11799
|
}
|
|
11646
11800
|
);
|
|
11647
11801
|
}
|
|
11648
11802
|
if (error) {
|
|
11649
|
-
return /* @__PURE__ */ (0,
|
|
11803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11650
11804
|
"div",
|
|
11651
11805
|
{
|
|
11652
11806
|
className: `bg-red-50 flex items-center justify-center ${className || ""}`,
|
|
11653
11807
|
style,
|
|
11654
|
-
children: /* @__PURE__ */ (0,
|
|
11808
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "text-red-600 text-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "text-xs", children: errorText }) })
|
|
11655
11809
|
}
|
|
11656
11810
|
);
|
|
11657
11811
|
}
|
|
11658
|
-
return /* @__PURE__ */ (0,
|
|
11812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
11659
11813
|
"div",
|
|
11660
11814
|
{
|
|
11661
11815
|
ref: setContainerRef,
|
|
@@ -11670,8 +11824,9 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11670
11824
|
"data-picture-failed": imgFailed ? "E_PICTURE_UNDISPLAYED" : void 0,
|
|
11671
11825
|
"data-picture-failed-src": failedSrc,
|
|
11672
11826
|
"data-mockup-unavailable": unavailable ? unavailable.code : void 0,
|
|
11827
|
+
"data-design-refused": designRefused ?? void 0,
|
|
11673
11828
|
children: [
|
|
11674
|
-
unavailable && /* @__PURE__ */ (0,
|
|
11829
|
+
unavailable && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11675
11830
|
"div",
|
|
11676
11831
|
{
|
|
11677
11832
|
role: "status",
|
|
@@ -11680,7 +11835,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11680
11835
|
children: "Mockup unavailable"
|
|
11681
11836
|
}
|
|
11682
11837
|
),
|
|
11683
|
-
renderedUrl && !imgFailed && /* @__PURE__ */ (0,
|
|
11838
|
+
renderedUrl && !imgFailed && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11684
11839
|
"img",
|
|
11685
11840
|
{
|
|
11686
11841
|
alt: `Product mockup${placement ? ` - ${placement}` : ""}`,
|
|
@@ -11710,8 +11865,29 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11710
11865
|
onError: () => {
|
|
11711
11866
|
if (renderedUrl && retriedUrlRef.current !== renderedUrl) {
|
|
11712
11867
|
retriedUrlRef.current = renderedUrl;
|
|
11713
|
-
|
|
11714
|
-
|
|
11868
|
+
const url = renderedUrl;
|
|
11869
|
+
const mockupIdNow = actualMockupId;
|
|
11870
|
+
void (async () => {
|
|
11871
|
+
let answer = await probeRenderAnswer(url);
|
|
11872
|
+
let verdict = answer.ok ? "loud" : gallerySkipVerdict(answer.code, 0);
|
|
11873
|
+
if (verdict === "retry") {
|
|
11874
|
+
await new Promise((r) => setTimeout(r, DESIGN_BUSY_RETRY_MS));
|
|
11875
|
+
if (renderedUrlRef.current !== url) return;
|
|
11876
|
+
answer = await probeRenderAnswer(url);
|
|
11877
|
+
verdict = answer.ok ? "loud" : gallerySkipVerdict(answer.code, 1);
|
|
11878
|
+
}
|
|
11879
|
+
if (renderedUrlRef.current !== url) return;
|
|
11880
|
+
if (verdict === "skip" && (0, import_sdk14.isDesignRefusalCode)(answer.code)) {
|
|
11881
|
+
setDesignRefused(answer.code);
|
|
11882
|
+
const skip = gallerySkipRef.current;
|
|
11883
|
+
if (skip && mockupIdNow) {
|
|
11884
|
+
skip.report(mockupIdNow, answer.code);
|
|
11885
|
+
realtimeContext?.frameFailed?.(url);
|
|
11886
|
+
return;
|
|
11887
|
+
}
|
|
11888
|
+
}
|
|
11889
|
+
setRetryNonce((n) => n + 1);
|
|
11890
|
+
})();
|
|
11715
11891
|
return;
|
|
11716
11892
|
}
|
|
11717
11893
|
setImgFailed(true);
|
|
@@ -11722,15 +11898,15 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11722
11898
|
signHintShownRef.current = true;
|
|
11723
11899
|
const hasSigner = typeof window !== "undefined" && !!window.snowcone?.signMockupUrl;
|
|
11724
11900
|
console.warn(
|
|
11725
|
-
hasSigner ? "[Snowcone] A mockup image failed to load and its URL is unsigned. Your `signMockupUrl` likely errored \u2014 check your /api/sign route and that its secret matches the shop's signing secret." : `[Snowcone] A mockup image failed to load (likely 'Missing required signature'). If your shop requires signed URLs, pass \`signMockupUrl\` to <Shop> so the UI can sign mockup <img> URLs. Docs: ${
|
|
11901
|
+
hasSigner ? "[Snowcone] A mockup image failed to load and its URL is unsigned. Your `signMockupUrl` likely errored \u2014 check your /api/sign route and that its secret matches the shop's signing secret." : `[Snowcone] A mockup image failed to load (likely 'Missing required signature'). If your shop requires signed URLs, pass \`signMockupUrl\` to <Shop> so the UI can sign mockup <img> URLs. Docs: ${import_sdk14.SNOWCONE_HOSTS.docs}/design-system/signing-at-scale`
|
|
11726
11902
|
);
|
|
11727
11903
|
}
|
|
11728
11904
|
}
|
|
11729
11905
|
},
|
|
11730
11906
|
retryNonce
|
|
11731
11907
|
),
|
|
11732
|
-
imgFailed && !prevUrl && /* @__PURE__ */ (0,
|
|
11733
|
-
realtimeContext?.renderError && /* @__PURE__ */ (0,
|
|
11908
|
+
imgFailed && !prevUrl && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "absolute inset-0 flex items-center justify-center bg-muted", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "text-muted-foreground text-xs", children: unavailableText }) }),
|
|
11909
|
+
realtimeContext?.renderError && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11734
11910
|
"div",
|
|
11735
11911
|
{
|
|
11736
11912
|
role: realtimeContext.renderError.retryable ? "status" : "alert",
|
|
@@ -11740,7 +11916,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11740
11916
|
children: realtimeContext.renderError.retryable ? realtimeContext.renderError.message : `Render blocked: ${realtimeContext.renderError.code} \u2014 ${realtimeContext.renderError.message}`
|
|
11741
11917
|
}
|
|
11742
11918
|
),
|
|
11743
|
-
prevUrl && /* @__PURE__ */ (0,
|
|
11919
|
+
prevUrl && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11744
11920
|
"img",
|
|
11745
11921
|
{
|
|
11746
11922
|
alt: "",
|
|
@@ -11755,7 +11931,7 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11755
11931
|
onTransitionEnd: handleCrossfadeEnd
|
|
11756
11932
|
}
|
|
11757
11933
|
),
|
|
11758
|
-
loaderMounted && /* @__PURE__ */ (0,
|
|
11934
|
+
loaderMounted && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
11759
11935
|
LoadingOverlayPrismCandyInline,
|
|
11760
11936
|
{
|
|
11761
11937
|
visible: !firstImageLoaded,
|
|
@@ -11769,16 +11945,16 @@ var HeroProductImage = (0, import_react47.memo)(function HeroProductImage2({
|
|
|
11769
11945
|
});
|
|
11770
11946
|
|
|
11771
11947
|
// src/composed/SafeImg.tsx
|
|
11772
|
-
var
|
|
11773
|
-
var
|
|
11774
|
-
var SafeImg =
|
|
11948
|
+
var import_react49 = __toESM(require("react"), 1);
|
|
11949
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
11950
|
+
var SafeImg = import_react49.default.forwardRef(
|
|
11775
11951
|
function SafeImg2({ fallback = null, onError, src, ...rest }, ref) {
|
|
11776
|
-
const [failed, setFailed] = (0,
|
|
11777
|
-
(0,
|
|
11952
|
+
const [failed, setFailed] = (0, import_react49.useState)(false);
|
|
11953
|
+
(0, import_react49.useEffect)(() => {
|
|
11778
11954
|
setFailed(false);
|
|
11779
11955
|
}, [src]);
|
|
11780
|
-
if (failed) return /* @__PURE__ */ (0,
|
|
11781
|
-
return /* @__PURE__ */ (0,
|
|
11956
|
+
if (failed) return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: fallback });
|
|
11957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
11782
11958
|
"img",
|
|
11783
11959
|
{
|
|
11784
11960
|
...rest,
|
|
@@ -11794,7 +11970,7 @@ var SafeImg = import_react48.default.forwardRef(
|
|
|
11794
11970
|
);
|
|
11795
11971
|
|
|
11796
11972
|
// src/index.ts
|
|
11797
|
-
var
|
|
11973
|
+
var import_sdk16 = require("@snowcone-app/sdk");
|
|
11798
11974
|
|
|
11799
11975
|
// src/composed/search/SearchProvider.tsx
|
|
11800
11976
|
var import_react_instantsearch = require("react-instantsearch");
|
|
@@ -11813,11 +11989,11 @@ var { searchClient } = (0, import_instant_meilisearch.instantMeiliSearch)(
|
|
|
11813
11989
|
);
|
|
11814
11990
|
|
|
11815
11991
|
// src/composed/search/SearchProvider.tsx
|
|
11816
|
-
var
|
|
11817
|
-
var
|
|
11992
|
+
var import_react50 = require("react");
|
|
11993
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
11818
11994
|
function InitialSearchTrigger() {
|
|
11819
11995
|
const { refine } = (0, import_react_instantsearch.useSearchBox)();
|
|
11820
|
-
(0,
|
|
11996
|
+
(0, import_react50.useEffect)(() => {
|
|
11821
11997
|
refine("");
|
|
11822
11998
|
}, [refine]);
|
|
11823
11999
|
return null;
|
|
@@ -11841,7 +12017,7 @@ function SearchProvider({
|
|
|
11841
12017
|
],
|
|
11842
12018
|
children
|
|
11843
12019
|
}) {
|
|
11844
|
-
return /* @__PURE__ */ (0,
|
|
12020
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
11845
12021
|
import_react_instantsearch.InstantSearch,
|
|
11846
12022
|
{
|
|
11847
12023
|
searchClient,
|
|
@@ -11869,7 +12045,7 @@ function SearchProvider({
|
|
|
11869
12045
|
}
|
|
11870
12046
|
},
|
|
11871
12047
|
children: [
|
|
11872
|
-
/* @__PURE__ */ (0,
|
|
12048
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
11873
12049
|
import_react_instantsearch.Configure,
|
|
11874
12050
|
{
|
|
11875
12051
|
hitsPerPage,
|
|
@@ -11878,7 +12054,7 @@ function SearchProvider({
|
|
|
11878
12054
|
attributesToRetrieve
|
|
11879
12055
|
}
|
|
11880
12056
|
),
|
|
11881
|
-
/* @__PURE__ */ (0,
|
|
12057
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(InitialSearchTrigger, {}),
|
|
11882
12058
|
children
|
|
11883
12059
|
]
|
|
11884
12060
|
}
|
|
@@ -11888,17 +12064,17 @@ function SearchProvider({
|
|
|
11888
12064
|
// src/composed/search/SearchBox.tsx
|
|
11889
12065
|
var import_react_instantsearch2 = require("react-instantsearch");
|
|
11890
12066
|
var import_lucide_react3 = require("lucide-react");
|
|
11891
|
-
var
|
|
11892
|
-
var
|
|
12067
|
+
var import_react51 = require("react");
|
|
12068
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
11893
12069
|
function SearchBox() {
|
|
11894
12070
|
const { query, refine, clear } = (0, import_react_instantsearch2.useSearchBox)();
|
|
11895
12071
|
const searchParams = useUiSearchParams();
|
|
11896
12072
|
const router = useUiRouter();
|
|
11897
|
-
const inputRef = (0,
|
|
11898
|
-
const [showShimmer, setShowShimmer] = (0,
|
|
12073
|
+
const inputRef = (0, import_react51.useRef)(null);
|
|
12074
|
+
const [showShimmer, setShowShimmer] = (0, import_react51.useState)(false);
|
|
11899
12075
|
const inputId = "search-products-input";
|
|
11900
12076
|
const descriptionId = "search-description";
|
|
11901
|
-
(0,
|
|
12077
|
+
(0, import_react51.useEffect)(() => {
|
|
11902
12078
|
const handleSpotlight = () => {
|
|
11903
12079
|
inputRef.current?.focus();
|
|
11904
12080
|
inputRef.current?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -11908,7 +12084,7 @@ function SearchBox() {
|
|
|
11908
12084
|
window.addEventListener("search-spotlight", handleSpotlight);
|
|
11909
12085
|
return () => window.removeEventListener("search-spotlight", handleSpotlight);
|
|
11910
12086
|
}, []);
|
|
11911
|
-
(0,
|
|
12087
|
+
(0, import_react51.useEffect)(() => {
|
|
11912
12088
|
const shouldFocus = searchParams.get("focus") === "search";
|
|
11913
12089
|
if (shouldFocus && inputRef.current) {
|
|
11914
12090
|
const timer = setTimeout(() => {
|
|
@@ -11923,8 +12099,8 @@ function SearchBox() {
|
|
|
11923
12099
|
return () => clearTimeout(timer);
|
|
11924
12100
|
}
|
|
11925
12101
|
}, [searchParams, router]);
|
|
11926
|
-
return /* @__PURE__ */ (0,
|
|
11927
|
-
/* @__PURE__ */ (0,
|
|
12102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("form", { role: "search", onSubmit: (e) => e.preventDefault(), children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "relative", children: [
|
|
12103
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11928
12104
|
Input,
|
|
11929
12105
|
{
|
|
11930
12106
|
ref: inputRef,
|
|
@@ -11933,15 +12109,15 @@ function SearchBox() {
|
|
|
11933
12109
|
value: query,
|
|
11934
12110
|
onChange: (e) => refine(e.target.value),
|
|
11935
12111
|
placeholder: "Search products...",
|
|
11936
|
-
startContent: /* @__PURE__ */ (0,
|
|
11937
|
-
endContent: query ? /* @__PURE__ */ (0,
|
|
12112
|
+
startContent: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_lucide_react3.Search, { className: "w-5 h-5", strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
12113
|
+
endContent: query ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11938
12114
|
"button",
|
|
11939
12115
|
{
|
|
11940
12116
|
type: "button",
|
|
11941
12117
|
onClick: clear,
|
|
11942
12118
|
className: "hover:text-foreground transition-colors",
|
|
11943
12119
|
"aria-label": "Clear search",
|
|
11944
|
-
children: /* @__PURE__ */ (0,
|
|
12120
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_lucide_react3.X, { className: "w-4 h-4", strokeWidth: 2, "aria-hidden": "true" })
|
|
11945
12121
|
}
|
|
11946
12122
|
) : void 0,
|
|
11947
12123
|
"aria-label": "Search products",
|
|
@@ -11951,11 +12127,11 @@ function SearchBox() {
|
|
|
11951
12127
|
className: "[&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden"
|
|
11952
12128
|
}
|
|
11953
12129
|
),
|
|
11954
|
-
showShimmer && /* @__PURE__ */ (0,
|
|
12130
|
+
showShimmer && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11955
12131
|
"div",
|
|
11956
12132
|
{
|
|
11957
12133
|
className: "absolute inset-0 pointer-events-none rounded-input z-20 overflow-hidden",
|
|
11958
|
-
children: /* @__PURE__ */ (0,
|
|
12134
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
11959
12135
|
"div",
|
|
11960
12136
|
{
|
|
11961
12137
|
className: "absolute inset-0",
|
|
@@ -11968,13 +12144,13 @@ function SearchBox() {
|
|
|
11968
12144
|
)
|
|
11969
12145
|
}
|
|
11970
12146
|
),
|
|
11971
|
-
/* @__PURE__ */ (0,
|
|
12147
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("style", { dangerouslySetInnerHTML: { __html: `
|
|
11972
12148
|
@keyframes searchShimmer {
|
|
11973
12149
|
0% { transform: translateX(-100%); }
|
|
11974
12150
|
100% { transform: translateX(100%); }
|
|
11975
12151
|
}
|
|
11976
12152
|
` } }),
|
|
11977
|
-
/* @__PURE__ */ (0,
|
|
12153
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { id: descriptionId, className: "sr-only", children: "Search results will update as you type" })
|
|
11978
12154
|
] }) });
|
|
11979
12155
|
}
|
|
11980
12156
|
|
|
@@ -11982,7 +12158,7 @@ function SearchBox() {
|
|
|
11982
12158
|
var import_react_instantsearch3 = require("react-instantsearch");
|
|
11983
12159
|
|
|
11984
12160
|
// src/composed/search/ProductHit.tsx
|
|
11985
|
-
var
|
|
12161
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
11986
12162
|
function ProductHitComponent({
|
|
11987
12163
|
hit: product,
|
|
11988
12164
|
variant = "overlay"
|
|
@@ -11999,12 +12175,12 @@ function ProductHitComponent({
|
|
|
11999
12175
|
}
|
|
12000
12176
|
return "";
|
|
12001
12177
|
};
|
|
12002
|
-
return /* @__PURE__ */ (0,
|
|
12178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12003
12179
|
Product,
|
|
12004
12180
|
{
|
|
12005
12181
|
productId,
|
|
12006
12182
|
productData: product,
|
|
12007
|
-
children: /* @__PURE__ */ (0,
|
|
12183
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
12008
12184
|
ProductCard,
|
|
12009
12185
|
{
|
|
12010
12186
|
variant,
|
|
@@ -12025,10 +12201,10 @@ function ProductHitComponent({
|
|
|
12025
12201
|
}
|
|
12026
12202
|
|
|
12027
12203
|
// src/composed/search/ProductGrid.tsx
|
|
12028
|
-
var
|
|
12029
|
-
var
|
|
12204
|
+
var import_react52 = require("react");
|
|
12205
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
12030
12206
|
function ProductGridSkeletonItem() {
|
|
12031
|
-
return /* @__PURE__ */ (0,
|
|
12207
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "aspect-square bg-muted animate-pulse" });
|
|
12032
12208
|
}
|
|
12033
12209
|
function ProductGrid({
|
|
12034
12210
|
className = "",
|
|
@@ -12038,26 +12214,26 @@ function ProductGrid({
|
|
|
12038
12214
|
}) {
|
|
12039
12215
|
const { nbHits } = (0, import_react_instantsearch3.useStats)();
|
|
12040
12216
|
const { status, results } = (0, import_react_instantsearch3.useInstantSearch)();
|
|
12041
|
-
const [announcement, setAnnouncement] = (0,
|
|
12217
|
+
const [announcement, setAnnouncement] = (0, import_react52.useState)("");
|
|
12042
12218
|
const hitsCount = results?.hits?.length ?? 0;
|
|
12043
12219
|
const showSkeleton = hitsCount === 0 && status !== "error";
|
|
12044
|
-
(0,
|
|
12220
|
+
(0, import_react52.useEffect)(() => {
|
|
12045
12221
|
const timer = setTimeout(() => {
|
|
12046
12222
|
setAnnouncement(`${nbHits} ${nbHits === 1 ? "product" : "products"} found`);
|
|
12047
12223
|
}, 1e3);
|
|
12048
12224
|
return () => clearTimeout(timer);
|
|
12049
12225
|
}, [nbHits]);
|
|
12050
|
-
const HitComponent = (0,
|
|
12226
|
+
const HitComponent = (0, import_react52.useCallback)(({ hit }) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12051
12227
|
ProductHitComponent,
|
|
12052
12228
|
{
|
|
12053
12229
|
hit,
|
|
12054
12230
|
variant
|
|
12055
12231
|
}
|
|
12056
12232
|
), [variant]);
|
|
12057
|
-
return /* @__PURE__ */ (0,
|
|
12058
|
-
/* @__PURE__ */ (0,
|
|
12059
|
-
showSkeleton && /* @__PURE__ */ (0,
|
|
12060
|
-
/* @__PURE__ */ (0,
|
|
12233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className, children: [
|
|
12234
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement }),
|
|
12235
|
+
showSkeleton && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: `grid ${gridClassName}`, children: Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ProductGridSkeletonItem, {}, i)) }),
|
|
12236
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: showSkeleton ? "hidden" : "", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
12061
12237
|
import_react_instantsearch3.Hits,
|
|
12062
12238
|
{
|
|
12063
12239
|
hitComponent: HitComponent,
|
|
@@ -12072,18 +12248,18 @@ function ProductGrid({
|
|
|
12072
12248
|
}
|
|
12073
12249
|
|
|
12074
12250
|
// src/composed/search/Filters.tsx
|
|
12075
|
-
var
|
|
12251
|
+
var import_react54 = require("react");
|
|
12076
12252
|
|
|
12077
12253
|
// src/composed/search/FiltersButton.tsx
|
|
12078
12254
|
var import_lucide_react4 = require("lucide-react");
|
|
12079
|
-
var
|
|
12255
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
12080
12256
|
var SlidersHorizontalIcon = import_lucide_react4.SlidersHorizontal;
|
|
12081
12257
|
function FiltersButton({
|
|
12082
12258
|
onClick,
|
|
12083
12259
|
className = "",
|
|
12084
12260
|
children = "Filters"
|
|
12085
12261
|
}) {
|
|
12086
|
-
return /* @__PURE__ */ (0,
|
|
12262
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
12087
12263
|
Button,
|
|
12088
12264
|
{
|
|
12089
12265
|
variant: "field",
|
|
@@ -12091,8 +12267,8 @@ function FiltersButton({
|
|
|
12091
12267
|
className,
|
|
12092
12268
|
"aria-label": "Open filters",
|
|
12093
12269
|
children: [
|
|
12094
|
-
/* @__PURE__ */ (0,
|
|
12095
|
-
/* @__PURE__ */ (0,
|
|
12270
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(SlidersHorizontalIcon, { className: "w-4 h-4" }),
|
|
12271
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children })
|
|
12096
12272
|
]
|
|
12097
12273
|
}
|
|
12098
12274
|
);
|
|
@@ -12101,15 +12277,15 @@ function FiltersButton({
|
|
|
12101
12277
|
// src/composed/search/FiltersDrawer.tsx
|
|
12102
12278
|
var import_react_instantsearch4 = require("react-instantsearch");
|
|
12103
12279
|
var import_lucide_react5 = require("lucide-react");
|
|
12104
|
-
var
|
|
12280
|
+
var import_react53 = require("react");
|
|
12105
12281
|
var Slider2 = __toESM(require("@radix-ui/react-slider"), 1);
|
|
12106
|
-
var
|
|
12282
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
12107
12283
|
var XIcon2 = import_lucide_react5.X;
|
|
12108
12284
|
function FiltersDrawer({ isOpen, onClose }) {
|
|
12109
|
-
const [showCounts, setShowCounts] = (0,
|
|
12285
|
+
const [showCounts, setShowCounts] = (0, import_react53.useState)(false);
|
|
12110
12286
|
const { nbHits } = (0, import_react_instantsearch4.useStats)();
|
|
12111
12287
|
const containerRef = useFocusTrap(isOpen, onClose);
|
|
12112
|
-
(0,
|
|
12288
|
+
(0, import_react53.useEffect)(() => {
|
|
12113
12289
|
if (isOpen) {
|
|
12114
12290
|
document.body.style.overflow = "hidden";
|
|
12115
12291
|
} else {
|
|
@@ -12119,7 +12295,7 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
12119
12295
|
document.body.style.overflow = "";
|
|
12120
12296
|
};
|
|
12121
12297
|
}, [isOpen]);
|
|
12122
|
-
(0,
|
|
12298
|
+
(0, import_react53.useEffect)(() => {
|
|
12123
12299
|
const handleEscape = (e) => {
|
|
12124
12300
|
if (e.key === "Escape" && isOpen) {
|
|
12125
12301
|
onClose();
|
|
@@ -12128,8 +12304,8 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
12128
12304
|
document.addEventListener("keydown", handleEscape);
|
|
12129
12305
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
12130
12306
|
}, [isOpen, onClose]);
|
|
12131
|
-
return /* @__PURE__ */ (0,
|
|
12132
|
-
/* @__PURE__ */ (0,
|
|
12307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
12308
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12133
12309
|
"div",
|
|
12134
12310
|
{
|
|
12135
12311
|
className: `fixed inset-0 bg-black/50 z-40 transition-opacity ${isOpen ? "opacity-100" : "opacity-0 pointer-events-none"}`,
|
|
@@ -12137,7 +12313,7 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
12137
12313
|
"aria-hidden": "true"
|
|
12138
12314
|
}
|
|
12139
12315
|
),
|
|
12140
|
-
/* @__PURE__ */ (0,
|
|
12316
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
12141
12317
|
"div",
|
|
12142
12318
|
{
|
|
12143
12319
|
ref: containerRef,
|
|
@@ -12146,26 +12322,26 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
12146
12322
|
"aria-modal": "true",
|
|
12147
12323
|
"aria-labelledby": "filters-drawer-title",
|
|
12148
12324
|
children: [
|
|
12149
|
-
/* @__PURE__ */ (0,
|
|
12150
|
-
/* @__PURE__ */ (0,
|
|
12151
|
-
/* @__PURE__ */ (0,
|
|
12325
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center justify-between px-4 py-4", children: [
|
|
12326
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h2", { id: "filters-drawer-title", className: "text-xl font-bold", children: "Filters" }),
|
|
12327
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12152
12328
|
"button",
|
|
12153
12329
|
{
|
|
12154
12330
|
onClick: onClose,
|
|
12155
12331
|
className: "p-2 hover:bg-foreground/5 rounded-full transition-colors",
|
|
12156
12332
|
"aria-label": "Close filters",
|
|
12157
|
-
children: /* @__PURE__ */ (0,
|
|
12333
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(XIcon2, { className: "w-5 h-5" })
|
|
12158
12334
|
}
|
|
12159
12335
|
)
|
|
12160
12336
|
] }),
|
|
12161
|
-
/* @__PURE__ */ (0,
|
|
12337
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "px-4 pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("p", { className: "text-sm font-caption text-foreground/60", role: "status", "aria-live": "polite", children: [
|
|
12162
12338
|
nbHits.toLocaleString(),
|
|
12163
12339
|
" ",
|
|
12164
12340
|
nbHits === 1 ? "result" : "results"
|
|
12165
12341
|
] }) }),
|
|
12166
|
-
/* @__PURE__ */ (0,
|
|
12167
|
-
/* @__PURE__ */ (0,
|
|
12168
|
-
/* @__PURE__ */ (0,
|
|
12342
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "flex-1 overflow-y-auto px-4 pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex flex-col gap-8", children: [
|
|
12343
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TagsSection, { showCounts, setShowCounts }),
|
|
12344
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(PriceSection, {})
|
|
12169
12345
|
] }) })
|
|
12170
12346
|
]
|
|
12171
12347
|
}
|
|
@@ -12181,9 +12357,9 @@ function TagsSection({
|
|
|
12181
12357
|
sortBy: ["count:desc", "name:asc"],
|
|
12182
12358
|
limit: 100
|
|
12183
12359
|
});
|
|
12184
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
12185
|
-
return /* @__PURE__ */ (0,
|
|
12186
|
-
/* @__PURE__ */ (0,
|
|
12360
|
+
const [isExpanded, setIsExpanded] = (0, import_react53.useState)(true);
|
|
12361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "bg-foreground/5 rounded-lg p-4", children: [
|
|
12362
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
12187
12363
|
"button",
|
|
12188
12364
|
{
|
|
12189
12365
|
onClick: () => setIsExpanded(!isExpanded),
|
|
@@ -12191,8 +12367,8 @@ function TagsSection({
|
|
|
12191
12367
|
"aria-expanded": isExpanded,
|
|
12192
12368
|
"aria-controls": "tags-content",
|
|
12193
12369
|
children: [
|
|
12194
|
-
/* @__PURE__ */ (0,
|
|
12195
|
-
/* @__PURE__ */ (0,
|
|
12370
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h3", { className: "text-base font-semibold text-primary", children: "Tags" }),
|
|
12371
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12196
12372
|
"svg",
|
|
12197
12373
|
{
|
|
12198
12374
|
className: `w-5 h-5 transition-transform text-foreground/40 group-hover:text-foreground/60 ${isExpanded ? "rotate-180" : ""}`,
|
|
@@ -12201,14 +12377,14 @@ function TagsSection({
|
|
|
12201
12377
|
stroke: "currentColor",
|
|
12202
12378
|
strokeWidth: 2.5,
|
|
12203
12379
|
"aria-hidden": "true",
|
|
12204
|
-
children: /* @__PURE__ */ (0,
|
|
12380
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
12205
12381
|
}
|
|
12206
12382
|
)
|
|
12207
12383
|
]
|
|
12208
12384
|
}
|
|
12209
12385
|
),
|
|
12210
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
12211
|
-
/* @__PURE__ */ (0,
|
|
12386
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "space-y-4", id: "tags-content", children: [
|
|
12387
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "flex flex-wrap gap-2", role: "group", "aria-label": "Product tags filter", children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
12212
12388
|
"button",
|
|
12213
12389
|
{
|
|
12214
12390
|
onClick: () => refine(item.value),
|
|
@@ -12219,15 +12395,15 @@ function TagsSection({
|
|
|
12219
12395
|
"aria-label": `${item.isRefined ? "Remove" : "Apply"} ${item.label} filter${showCounts ? ` (${item.count} products)` : ""}`,
|
|
12220
12396
|
"aria-pressed": item.isRefined,
|
|
12221
12397
|
children: [
|
|
12222
|
-
/* @__PURE__ */ (0,
|
|
12223
|
-
showCounts && /* @__PURE__ */ (0,
|
|
12398
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { "aria-hidden": "true", children: item.label }),
|
|
12399
|
+
showCounts && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: `text-xs font-caption ${item.isRefined ? "opacity-80" : "opacity-60"}`, "aria-hidden": "true", children: item.count })
|
|
12224
12400
|
]
|
|
12225
12401
|
},
|
|
12226
12402
|
item.value
|
|
12227
12403
|
)) }),
|
|
12228
|
-
/* @__PURE__ */ (0,
|
|
12229
|
-
/* @__PURE__ */ (0,
|
|
12230
|
-
/* @__PURE__ */ (0,
|
|
12404
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center justify-between pt-2", children: [
|
|
12405
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "text-sm font-label text-foreground/60", id: "show-counts-label", children: "Show counts" }),
|
|
12406
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12231
12407
|
"button",
|
|
12232
12408
|
{
|
|
12233
12409
|
onClick: () => setShowCounts(!showCounts),
|
|
@@ -12235,7 +12411,7 @@ function TagsSection({
|
|
|
12235
12411
|
role: "switch",
|
|
12236
12412
|
"aria-checked": showCounts,
|
|
12237
12413
|
"aria-labelledby": "show-counts-label",
|
|
12238
|
-
children: /* @__PURE__ */ (0,
|
|
12414
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12239
12415
|
"span",
|
|
12240
12416
|
{
|
|
12241
12417
|
className: `inline-block h-4 w-4 transform rounded-full bg-background shadow-sm transition-transform ${showCounts ? "translate-x-6" : "translate-x-1"}`,
|
|
@@ -12252,11 +12428,11 @@ function PriceSection() {
|
|
|
12252
12428
|
const { range, refine, start, canRefine } = (0, import_react_instantsearch4.useRange)({ attribute: "price" });
|
|
12253
12429
|
const rangeMin = typeof range.min === "number" && isFinite(range.min) ? range.min : 0;
|
|
12254
12430
|
const rangeMax = typeof range.max === "number" && isFinite(range.max) ? range.max : 15e3;
|
|
12255
|
-
const [localRange, setLocalRange] = (0,
|
|
12431
|
+
const [localRange, setLocalRange] = (0, import_react53.useState)([
|
|
12256
12432
|
typeof start?.[0] === "number" && isFinite(start[0]) ? start[0] : rangeMin,
|
|
12257
12433
|
typeof start?.[1] === "number" && isFinite(start[1]) ? start[1] : rangeMax
|
|
12258
12434
|
]);
|
|
12259
|
-
(0,
|
|
12435
|
+
(0, import_react53.useEffect)(() => {
|
|
12260
12436
|
if (start && Array.isArray(start)) {
|
|
12261
12437
|
setLocalRange([
|
|
12262
12438
|
typeof start[0] === "number" && isFinite(start[0]) ? start[0] : rangeMin,
|
|
@@ -12266,7 +12442,7 @@ function PriceSection() {
|
|
|
12266
12442
|
setLocalRange([rangeMin, rangeMax]);
|
|
12267
12443
|
}
|
|
12268
12444
|
}, [start, rangeMin, rangeMax]);
|
|
12269
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
12445
|
+
const [isExpanded, setIsExpanded] = (0, import_react53.useState)(true);
|
|
12270
12446
|
if (!canRefine) {
|
|
12271
12447
|
return null;
|
|
12272
12448
|
}
|
|
@@ -12281,8 +12457,8 @@ function PriceSection() {
|
|
|
12281
12457
|
return `$${priceInDollars.toFixed(2)}`;
|
|
12282
12458
|
}
|
|
12283
12459
|
};
|
|
12284
|
-
return /* @__PURE__ */ (0,
|
|
12285
|
-
/* @__PURE__ */ (0,
|
|
12460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "bg-foreground/5 rounded-lg p-4", children: [
|
|
12461
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
12286
12462
|
"button",
|
|
12287
12463
|
{
|
|
12288
12464
|
onClick: () => setIsExpanded(!isExpanded),
|
|
@@ -12290,8 +12466,8 @@ function PriceSection() {
|
|
|
12290
12466
|
"aria-expanded": isExpanded,
|
|
12291
12467
|
"aria-controls": "price-content",
|
|
12292
12468
|
children: [
|
|
12293
|
-
/* @__PURE__ */ (0,
|
|
12294
|
-
/* @__PURE__ */ (0,
|
|
12469
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("h3", { className: "text-base font-semibold text-primary", children: "Price" }),
|
|
12470
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12295
12471
|
"svg",
|
|
12296
12472
|
{
|
|
12297
12473
|
className: `w-5 h-5 transition-transform text-foreground/40 group-hover:text-foreground/60 ${isExpanded ? "rotate-180" : ""}`,
|
|
@@ -12300,22 +12476,22 @@ function PriceSection() {
|
|
|
12300
12476
|
stroke: "currentColor",
|
|
12301
12477
|
strokeWidth: 2.5,
|
|
12302
12478
|
"aria-hidden": "true",
|
|
12303
|
-
children: /* @__PURE__ */ (0,
|
|
12479
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
12304
12480
|
}
|
|
12305
12481
|
)
|
|
12306
12482
|
]
|
|
12307
12483
|
}
|
|
12308
12484
|
),
|
|
12309
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
12310
|
-
/* @__PURE__ */ (0,
|
|
12311
|
-
/* @__PURE__ */ (0,
|
|
12312
|
-
/* @__PURE__ */ (0,
|
|
12485
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "space-y-6", id: "price-content", children: [
|
|
12486
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center justify-between text-sm font-display", children: [
|
|
12487
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { children: formatPrice2(localRange[0]) }),
|
|
12488
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { className: "text-foreground/70", children: formatPrice2(localRange[1]) })
|
|
12313
12489
|
] }),
|
|
12314
|
-
/* @__PURE__ */ (0,
|
|
12490
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "relative h-24 flex items-end justify-between gap-0.5 px-1", "aria-hidden": "true", role: "presentation", children: [60, 40, 80, 50, 60, 30, 20, 15, 10, 5, 30, 20, 15, 10, 5, 3, 3, 60, 40].map((height, i) => {
|
|
12315
12491
|
const totalBars = 19;
|
|
12316
12492
|
const barPrice = rangeMin + (rangeMax - rangeMin) / totalBars * i;
|
|
12317
12493
|
const isInRange = barPrice >= localRange[0] && barPrice <= localRange[1];
|
|
12318
|
-
return /* @__PURE__ */ (0,
|
|
12494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12319
12495
|
"div",
|
|
12320
12496
|
{
|
|
12321
12497
|
className: `flex-1 rounded-t-sm transition-opacity ${isInRange ? "bg-foreground" : "bg-foreground/20"}`,
|
|
@@ -12324,7 +12500,7 @@ function PriceSection() {
|
|
|
12324
12500
|
i
|
|
12325
12501
|
);
|
|
12326
12502
|
}) }),
|
|
12327
|
-
/* @__PURE__ */ (0,
|
|
12503
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { style: { touchAction: "none" }, className: "my-6", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
12328
12504
|
Slider2.Root,
|
|
12329
12505
|
{
|
|
12330
12506
|
className: "relative flex w-full touch-none select-none items-center",
|
|
@@ -12342,8 +12518,8 @@ function PriceSection() {
|
|
|
12342
12518
|
step: 1,
|
|
12343
12519
|
minStepsBetweenThumbs: 1,
|
|
12344
12520
|
children: [
|
|
12345
|
-
/* @__PURE__ */ (0,
|
|
12346
|
-
/* @__PURE__ */ (0,
|
|
12521
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Slider2.Track, { className: "relative h-3 w-full grow overflow-hidden rounded-full bg-foreground/20", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Slider2.Range, { className: "absolute h-full bg-foreground" }) }),
|
|
12522
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12347
12523
|
Slider2.Thumb,
|
|
12348
12524
|
{
|
|
12349
12525
|
className: "block h-6 w-6 rounded-full bg-background shadow transition-all focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50 cursor-grab active:cursor-grabbing hover:scale-105 border-2 border-primary",
|
|
@@ -12357,7 +12533,7 @@ function PriceSection() {
|
|
|
12357
12533
|
"aria-valuetext": formatPrice2(localRange[0])
|
|
12358
12534
|
}
|
|
12359
12535
|
),
|
|
12360
|
-
/* @__PURE__ */ (0,
|
|
12536
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12361
12537
|
Slider2.Thumb,
|
|
12362
12538
|
{
|
|
12363
12539
|
className: "block h-6 w-6 rounded-full bg-background shadow transition-all focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50 cursor-grab active:cursor-grabbing hover:scale-105 border-2 border-primary",
|
|
@@ -12374,10 +12550,10 @@ function PriceSection() {
|
|
|
12374
12550
|
]
|
|
12375
12551
|
}
|
|
12376
12552
|
) }),
|
|
12377
|
-
/* @__PURE__ */ (0,
|
|
12378
|
-
/* @__PURE__ */ (0,
|
|
12379
|
-
/* @__PURE__ */ (0,
|
|
12380
|
-
/* @__PURE__ */ (0,
|
|
12553
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
12554
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { children: [
|
|
12555
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("label", { htmlFor: "price-min", className: "text-xs font-label text-foreground/60 mb-1.5 block", children: "Min" }),
|
|
12556
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12381
12557
|
"input",
|
|
12382
12558
|
{
|
|
12383
12559
|
id: "price-min",
|
|
@@ -12395,9 +12571,9 @@ function PriceSection() {
|
|
|
12395
12571
|
}
|
|
12396
12572
|
)
|
|
12397
12573
|
] }),
|
|
12398
|
-
/* @__PURE__ */ (0,
|
|
12399
|
-
/* @__PURE__ */ (0,
|
|
12400
|
-
/* @__PURE__ */ (0,
|
|
12574
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { children: [
|
|
12575
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("label", { htmlFor: "price-max", className: "text-xs font-label text-foreground/60 mb-1.5 block", children: "Max" }),
|
|
12576
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
12401
12577
|
"input",
|
|
12402
12578
|
{
|
|
12403
12579
|
id: "price-max",
|
|
@@ -12421,11 +12597,11 @@ function PriceSection() {
|
|
|
12421
12597
|
}
|
|
12422
12598
|
|
|
12423
12599
|
// src/composed/search/Filters.tsx
|
|
12424
|
-
var
|
|
12600
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
12425
12601
|
function Filters({ buttonClassName, buttonText }) {
|
|
12426
|
-
const [isOpen, setIsOpen] = (0,
|
|
12427
|
-
return /* @__PURE__ */ (0,
|
|
12428
|
-
/* @__PURE__ */ (0,
|
|
12602
|
+
const [isOpen, setIsOpen] = (0, import_react54.useState)(false);
|
|
12603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
|
|
12604
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
12429
12605
|
FiltersButton,
|
|
12430
12606
|
{
|
|
12431
12607
|
onClick: () => setIsOpen(true),
|
|
@@ -12433,14 +12609,14 @@ function Filters({ buttonClassName, buttonText }) {
|
|
|
12433
12609
|
children: buttonText
|
|
12434
12610
|
}
|
|
12435
12611
|
),
|
|
12436
|
-
/* @__PURE__ */ (0,
|
|
12612
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(FiltersDrawer, { isOpen, onClose: () => setIsOpen(false) })
|
|
12437
12613
|
] });
|
|
12438
12614
|
}
|
|
12439
12615
|
|
|
12440
12616
|
// src/composed/search/CurrentRefinements.tsx
|
|
12441
12617
|
var import_react_instantsearch5 = require("react-instantsearch");
|
|
12442
12618
|
var import_lucide_react6 = require("lucide-react");
|
|
12443
|
-
var
|
|
12619
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
12444
12620
|
var XIcon3 = import_lucide_react6.X;
|
|
12445
12621
|
var MIN_PRICE = new RegExp("[\u2265>=]+\\s*(\\d+)");
|
|
12446
12622
|
var MAX_PRICE = new RegExp("[\u2264<=]+\\s*(\\d+)");
|
|
@@ -12488,15 +12664,15 @@ function CurrentRefinements() {
|
|
|
12488
12664
|
if (allRefinements.length === 0) {
|
|
12489
12665
|
return null;
|
|
12490
12666
|
}
|
|
12491
|
-
return /* @__PURE__ */ (0,
|
|
12667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "flex flex-wrap items-center gap-2 mb-4 -mt-1", role: "group", "aria-label": "Active filters", children: allRefinements.map((refinement, index) => /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
12492
12668
|
"button",
|
|
12493
12669
|
{
|
|
12494
12670
|
className: "bg-primary text-on-primary hover:bg-primary/90 inline-flex h-7 items-center gap-1.5 rounded-full px-3 text-sm transition-colors",
|
|
12495
12671
|
onClick: () => refinement.refine(),
|
|
12496
12672
|
"aria-label": `Remove filter: ${refinement.displayLabel}`,
|
|
12497
12673
|
children: [
|
|
12498
|
-
/* @__PURE__ */ (0,
|
|
12499
|
-
/* @__PURE__ */ (0,
|
|
12674
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "truncate", children: refinement.displayLabel }),
|
|
12675
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(XIcon3, { className: "w-3 h-3" })
|
|
12500
12676
|
]
|
|
12501
12677
|
},
|
|
12502
12678
|
`${refinement.attribute}-${refinement.value}-${index}`
|
|
@@ -12520,12 +12696,12 @@ var FACET_SECTIONS = [
|
|
|
12520
12696
|
];
|
|
12521
12697
|
|
|
12522
12698
|
// src/composed/zoom/ResponsiveZoom.tsx
|
|
12523
|
-
var
|
|
12699
|
+
var import_react57 = require("react");
|
|
12524
12700
|
|
|
12525
12701
|
// src/composed/zoom/ZoomOverlay.tsx
|
|
12526
|
-
var
|
|
12702
|
+
var import_react55 = require("react");
|
|
12527
12703
|
var import_lucide_react7 = require("lucide-react");
|
|
12528
|
-
var
|
|
12704
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
12529
12705
|
var PlusIcon2 = import_lucide_react7.Plus;
|
|
12530
12706
|
var MinusIcon2 = import_lucide_react7.Minus;
|
|
12531
12707
|
function ZoomOverlay({
|
|
@@ -12537,13 +12713,13 @@ function ZoomOverlay({
|
|
|
12537
12713
|
className,
|
|
12538
12714
|
style
|
|
12539
12715
|
}) {
|
|
12540
|
-
const [zoomedImageIndex, setZoomedImageIndex] = (0,
|
|
12541
|
-
const [zoomOrigin, setZoomOrigin] = (0,
|
|
12542
|
-
const [hoveredImageIndex, setHoveredImageIndex] = (0,
|
|
12543
|
-
const [cursorPos, setCursorPos] = (0,
|
|
12544
|
-
const [announcement, setAnnouncement] = (0,
|
|
12545
|
-
const [isZooming, setIsZooming] = (0,
|
|
12546
|
-
const handleZoomClick = (0,
|
|
12716
|
+
const [zoomedImageIndex, setZoomedImageIndex] = (0, import_react55.useState)(null);
|
|
12717
|
+
const [zoomOrigin, setZoomOrigin] = (0, import_react55.useState)({ x: 50, y: 50 });
|
|
12718
|
+
const [hoveredImageIndex, setHoveredImageIndex] = (0, import_react55.useState)(null);
|
|
12719
|
+
const [cursorPos, setCursorPos] = (0, import_react55.useState)({ x: 0, y: 0 });
|
|
12720
|
+
const [announcement, setAnnouncement] = (0, import_react55.useState)("");
|
|
12721
|
+
const [isZooming, setIsZooming] = (0, import_react55.useState)(false);
|
|
12722
|
+
const handleZoomClick = (0, import_react55.useCallback)(
|
|
12547
12723
|
(e) => {
|
|
12548
12724
|
e.stopPropagation();
|
|
12549
12725
|
if (isLargeTouchDevice && onEnhancedViewer) {
|
|
@@ -12568,7 +12744,7 @@ function ZoomOverlay({
|
|
|
12568
12744
|
},
|
|
12569
12745
|
[zoomedImageIndex, isLargeTouchDevice, onEnhancedViewer, imageIndex]
|
|
12570
12746
|
);
|
|
12571
|
-
const handleZoomMouseMove = (0,
|
|
12747
|
+
const handleZoomMouseMove = (0, import_react55.useCallback)(
|
|
12572
12748
|
(e) => {
|
|
12573
12749
|
setCursorPos({ x: e.clientX, y: e.clientY });
|
|
12574
12750
|
if (zoomedImageIndex === imageIndex) {
|
|
@@ -12584,9 +12760,9 @@ function ZoomOverlay({
|
|
|
12584
12760
|
const isZoomed = zoomedImageIndex === imageIndex;
|
|
12585
12761
|
const isHovered = hoveredImageIndex === imageIndex;
|
|
12586
12762
|
const cursorStyle = isLargeTouchDevice ? "pointer" : isTouchDevice ? "default" : "none";
|
|
12587
|
-
return /* @__PURE__ */ (0,
|
|
12588
|
-
/* @__PURE__ */ (0,
|
|
12589
|
-
/* @__PURE__ */ (0,
|
|
12763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
|
|
12764
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement }),
|
|
12765
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12590
12766
|
"div",
|
|
12591
12767
|
{
|
|
12592
12768
|
className,
|
|
@@ -12594,7 +12770,7 @@ function ZoomOverlay({
|
|
|
12594
12770
|
...style,
|
|
12595
12771
|
position: "relative"
|
|
12596
12772
|
},
|
|
12597
|
-
children: /* @__PURE__ */ (0,
|
|
12773
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12598
12774
|
"div",
|
|
12599
12775
|
{
|
|
12600
12776
|
style: {
|
|
@@ -12617,7 +12793,7 @@ function ZoomOverlay({
|
|
|
12617
12793
|
handleZoomClick(e);
|
|
12618
12794
|
}
|
|
12619
12795
|
},
|
|
12620
|
-
children: /* @__PURE__ */ (0,
|
|
12796
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12621
12797
|
"div",
|
|
12622
12798
|
{
|
|
12623
12799
|
style: {
|
|
@@ -12633,7 +12809,7 @@ function ZoomOverlay({
|
|
|
12633
12809
|
)
|
|
12634
12810
|
}
|
|
12635
12811
|
),
|
|
12636
|
-
isHovered && !isTouchDevice && /* @__PURE__ */ (0,
|
|
12812
|
+
isHovered && !isTouchDevice && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12637
12813
|
"div",
|
|
12638
12814
|
{
|
|
12639
12815
|
className: "fixed pointer-events-none z-50 hidden md:block",
|
|
@@ -12643,7 +12819,7 @@ function ZoomOverlay({
|
|
|
12643
12819
|
transform: "translate(-50%, -50%)"
|
|
12644
12820
|
},
|
|
12645
12821
|
"aria-hidden": "true",
|
|
12646
|
-
children: /* @__PURE__ */ (0,
|
|
12822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "bg-white dark:bg-gray-800 rounded-full p-2 shadow-sm dark:shadow-gray-950/50", children: isZoomed ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12647
12823
|
MinusIcon2,
|
|
12648
12824
|
{
|
|
12649
12825
|
size: 20,
|
|
@@ -12651,7 +12827,7 @@ function ZoomOverlay({
|
|
|
12651
12827
|
strokeWidth: 1.5,
|
|
12652
12828
|
"aria-hidden": "true"
|
|
12653
12829
|
}
|
|
12654
|
-
) : /* @__PURE__ */ (0,
|
|
12830
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
12655
12831
|
PlusIcon2,
|
|
12656
12832
|
{
|
|
12657
12833
|
size: 20,
|
|
@@ -12666,7 +12842,7 @@ function ZoomOverlay({
|
|
|
12666
12842
|
}
|
|
12667
12843
|
|
|
12668
12844
|
// src/composed/zoom/EnhancedImageViewer.tsx
|
|
12669
|
-
var
|
|
12845
|
+
var import_react56 = require("react");
|
|
12670
12846
|
var import_react_dom3 = require("react-dom");
|
|
12671
12847
|
var import_react_zoom_pan_pinch = require("react-zoom-pan-pinch");
|
|
12672
12848
|
var import_lucide_react8 = require("lucide-react");
|
|
@@ -12724,7 +12900,7 @@ function slideFirstViewProps(image) {
|
|
|
12724
12900
|
}
|
|
12725
12901
|
|
|
12726
12902
|
// src/composed/zoom/EnhancedImageViewer.tsx
|
|
12727
|
-
var
|
|
12903
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
12728
12904
|
var TransformWrapper = import_react_zoom_pan_pinch.TransformWrapper;
|
|
12729
12905
|
var TransformComponent = import_react_zoom_pan_pinch.TransformComponent;
|
|
12730
12906
|
function viewerFirstView(image, screen, pictureAspect) {
|
|
@@ -12745,18 +12921,18 @@ var EnhancedImageViewer = ({
|
|
|
12745
12921
|
onIndexChange,
|
|
12746
12922
|
currentIndex: propCurrentIndex
|
|
12747
12923
|
}) => {
|
|
12748
|
-
const [isMounted, setIsMounted] = (0,
|
|
12749
|
-
const [isClient, setIsClient] = (0,
|
|
12750
|
-
const [scale, setScale] = (0,
|
|
12751
|
-
const [cropDimensions, setCropDimensions] = (0,
|
|
12752
|
-
const [currentZoomScale, setCurrentZoomScale] = (0,
|
|
12753
|
-
const imgRef = (0,
|
|
12754
|
-
const [loadedAspect, setLoadedAspect] = (0,
|
|
12755
|
-
const touchStartRef = (0,
|
|
12924
|
+
const [isMounted, setIsMounted] = (0, import_react56.useState)(false);
|
|
12925
|
+
const [isClient, setIsClient] = (0, import_react56.useState)(false);
|
|
12926
|
+
const [scale, setScale] = (0, import_react56.useState)({ initial: 1, min: 1, max: 8 });
|
|
12927
|
+
const [cropDimensions, setCropDimensions] = (0, import_react56.useState)({ width: 0, height: 0 });
|
|
12928
|
+
const [currentZoomScale, setCurrentZoomScale] = (0, import_react56.useState)(1);
|
|
12929
|
+
const imgRef = (0, import_react56.useRef)(null);
|
|
12930
|
+
const [loadedAspect, setLoadedAspect] = (0, import_react56.useState)(null);
|
|
12931
|
+
const touchStartRef = (0, import_react56.useRef)(
|
|
12756
12932
|
null
|
|
12757
12933
|
);
|
|
12758
|
-
const isSwipingRef = (0,
|
|
12759
|
-
const calculateScale = (0,
|
|
12934
|
+
const isSwipingRef = (0, import_react56.useRef)(false);
|
|
12935
|
+
const calculateScale = (0, import_react56.useCallback)(() => {
|
|
12760
12936
|
const viewport = {
|
|
12761
12937
|
width: window.innerWidth,
|
|
12762
12938
|
height: window.innerHeight
|
|
@@ -12768,14 +12944,14 @@ var EnhancedImageViewer = ({
|
|
|
12768
12944
|
max: 8
|
|
12769
12945
|
});
|
|
12770
12946
|
}, []);
|
|
12771
|
-
const handleImageLoad = (0,
|
|
12947
|
+
const handleImageLoad = (0, import_react56.useCallback)(() => {
|
|
12772
12948
|
calculateScale();
|
|
12773
12949
|
const img = imgRef.current;
|
|
12774
12950
|
if (img && img.naturalWidth > 0 && img.naturalHeight > 0) {
|
|
12775
12951
|
setLoadedAspect({ src: img.currentSrc || img.src, aspect: img.naturalWidth / img.naturalHeight });
|
|
12776
12952
|
}
|
|
12777
12953
|
}, [calculateScale]);
|
|
12778
|
-
(0,
|
|
12954
|
+
(0, import_react56.useLayoutEffect)(() => {
|
|
12779
12955
|
setIsClient(true);
|
|
12780
12956
|
setIsMounted(true);
|
|
12781
12957
|
document.body.style.overflow = "hidden";
|
|
@@ -12784,17 +12960,17 @@ var EnhancedImageViewer = ({
|
|
|
12784
12960
|
document.body.style.overflow = "";
|
|
12785
12961
|
};
|
|
12786
12962
|
}, [calculateScale]);
|
|
12787
|
-
(0,
|
|
12963
|
+
(0, import_react56.useEffect)(() => {
|
|
12788
12964
|
calculateScale();
|
|
12789
12965
|
}, [calculateScale]);
|
|
12790
|
-
(0,
|
|
12966
|
+
(0, import_react56.useEffect)(() => {
|
|
12791
12967
|
const handleResize = () => {
|
|
12792
12968
|
calculateScale();
|
|
12793
12969
|
};
|
|
12794
12970
|
window.addEventListener("resize", handleResize);
|
|
12795
12971
|
return () => window.removeEventListener("resize", handleResize);
|
|
12796
12972
|
}, [calculateScale]);
|
|
12797
|
-
(0,
|
|
12973
|
+
(0, import_react56.useEffect)(() => {
|
|
12798
12974
|
const handleKeyDown = (e) => {
|
|
12799
12975
|
if (e.key === "Escape") {
|
|
12800
12976
|
onClose();
|
|
@@ -12820,7 +12996,7 @@ var EnhancedImageViewer = ({
|
|
|
12820
12996
|
document.addEventListener("keydown", handleKeyDown);
|
|
12821
12997
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
12822
12998
|
}, [onClose, imageUrl, images, onIndexChange, propCurrentIndex]);
|
|
12823
|
-
const handleSwipeNavigation = (0,
|
|
12999
|
+
const handleSwipeNavigation = (0, import_react56.useCallback)(
|
|
12824
13000
|
(direction) => {
|
|
12825
13001
|
let currentIndex = propCurrentIndex !== void 0 ? propCurrentIndex : -1;
|
|
12826
13002
|
if (currentIndex === -1) {
|
|
@@ -12841,7 +13017,7 @@ var EnhancedImageViewer = ({
|
|
|
12841
13017
|
},
|
|
12842
13018
|
[propCurrentIndex, images, imageUrl, onIndexChange]
|
|
12843
13019
|
);
|
|
12844
|
-
const handleTouchStart = (0,
|
|
13020
|
+
const handleTouchStart = (0, import_react56.useCallback)(
|
|
12845
13021
|
(e) => {
|
|
12846
13022
|
const isAtInitialZoom = Math.abs(currentZoomScale - scale.initial) < 0.1;
|
|
12847
13023
|
if (!isAtInitialZoom) return;
|
|
@@ -12855,7 +13031,7 @@ var EnhancedImageViewer = ({
|
|
|
12855
13031
|
},
|
|
12856
13032
|
[currentZoomScale, scale.initial]
|
|
12857
13033
|
);
|
|
12858
|
-
const handleTouchEnd = (0,
|
|
13034
|
+
const handleTouchEnd = (0, import_react56.useCallback)(
|
|
12859
13035
|
(e) => {
|
|
12860
13036
|
if (!touchStartRef.current) return;
|
|
12861
13037
|
const touch = e.changedTouches[0];
|
|
@@ -12890,12 +13066,12 @@ var EnhancedImageViewer = ({
|
|
|
12890
13066
|
);
|
|
12891
13067
|
if (!isMounted || !isClient) {
|
|
12892
13068
|
return (0, import_react_dom3.createPortal)(
|
|
12893
|
-
/* @__PURE__ */ (0,
|
|
13069
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12894
13070
|
"div",
|
|
12895
13071
|
{
|
|
12896
13072
|
className: "fixed inset-0 bg-black flex items-center justify-center",
|
|
12897
13073
|
style: { zIndex: 999999 },
|
|
12898
|
-
children: /* @__PURE__ */ (0,
|
|
13074
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12899
13075
|
"div",
|
|
12900
13076
|
{
|
|
12901
13077
|
style: {
|
|
@@ -12911,7 +13087,7 @@ var EnhancedImageViewer = ({
|
|
|
12911
13087
|
);
|
|
12912
13088
|
}
|
|
12913
13089
|
return (0, import_react_dom3.createPortal)(
|
|
12914
|
-
/* @__PURE__ */ (0,
|
|
13090
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
12915
13091
|
"div",
|
|
12916
13092
|
{
|
|
12917
13093
|
className: "fixed inset-0 bg-black flex items-center justify-center",
|
|
@@ -12920,7 +13096,7 @@ var EnhancedImageViewer = ({
|
|
|
12920
13096
|
"aria-modal": "true",
|
|
12921
13097
|
"aria-label": "Image viewer",
|
|
12922
13098
|
children: [
|
|
12923
|
-
/* @__PURE__ */ (0,
|
|
13099
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12924
13100
|
"button",
|
|
12925
13101
|
{
|
|
12926
13102
|
onClick: (e) => {
|
|
@@ -12946,10 +13122,10 @@ var EnhancedImageViewer = ({
|
|
|
12946
13122
|
touchAction: "manipulation",
|
|
12947
13123
|
marginBottom: "env(safe-area-inset-bottom, 0px)"
|
|
12948
13124
|
},
|
|
12949
|
-
children: /* @__PURE__ */ (0,
|
|
13125
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_lucide_react8.X, { className: "w-7 h-7", strokeWidth: 2.5 })
|
|
12950
13126
|
}
|
|
12951
13127
|
),
|
|
12952
|
-
/* @__PURE__ */ (0,
|
|
13128
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
12953
13129
|
TransformWrapper,
|
|
12954
13130
|
{
|
|
12955
13131
|
initialScale: scale.initial,
|
|
@@ -12983,7 +13159,7 @@ var EnhancedImageViewer = ({
|
|
|
12983
13159
|
onTransformed: (ref) => {
|
|
12984
13160
|
setCurrentZoomScale(ref.state.scale);
|
|
12985
13161
|
},
|
|
12986
|
-
children: ({ zoomIn, zoomOut, resetTransform }) => /* @__PURE__ */ (0,
|
|
13162
|
+
children: ({ zoomIn, zoomOut, resetTransform }) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
12987
13163
|
"div",
|
|
12988
13164
|
{
|
|
12989
13165
|
style: {
|
|
@@ -12996,14 +13172,14 @@ var EnhancedImageViewer = ({
|
|
|
12996
13172
|
onTouchStart: handleTouchStart,
|
|
12997
13173
|
onTouchEnd: handleTouchEnd,
|
|
12998
13174
|
children: [
|
|
12999
|
-
/* @__PURE__ */ (0,
|
|
13175
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13000
13176
|
TransformComponent,
|
|
13001
13177
|
{
|
|
13002
13178
|
wrapperStyle: {
|
|
13003
13179
|
width: "100%",
|
|
13004
13180
|
height: "100%"
|
|
13005
13181
|
},
|
|
13006
|
-
children: /* @__PURE__ */ (0,
|
|
13182
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13007
13183
|
"div",
|
|
13008
13184
|
{
|
|
13009
13185
|
style: {
|
|
@@ -13014,7 +13190,7 @@ var EnhancedImageViewer = ({
|
|
|
13014
13190
|
alignItems: "center",
|
|
13015
13191
|
justifyContent: "center"
|
|
13016
13192
|
},
|
|
13017
|
-
children: /* @__PURE__ */ (0,
|
|
13193
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13018
13194
|
SafeImg,
|
|
13019
13195
|
{
|
|
13020
13196
|
ref: imgRef,
|
|
@@ -13041,8 +13217,8 @@ var EnhancedImageViewer = ({
|
|
|
13041
13217
|
)
|
|
13042
13218
|
}
|
|
13043
13219
|
),
|
|
13044
|
-
/* @__PURE__ */ (0,
|
|
13045
|
-
/* @__PURE__ */ (0,
|
|
13220
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "fixed bottom-5 left-0 right-0 z-50", children: [
|
|
13221
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "flex justify-center gap-2", children: (() => {
|
|
13046
13222
|
let currentIndex = propCurrentIndex !== void 0 ? propCurrentIndex : -1;
|
|
13047
13223
|
if (currentIndex === -1) {
|
|
13048
13224
|
currentIndex = images.findIndex(
|
|
@@ -13075,8 +13251,8 @@ var EnhancedImageViewer = ({
|
|
|
13075
13251
|
};
|
|
13076
13252
|
const nextIndex = findNextAvailableIndex(currentIndex, 1);
|
|
13077
13253
|
const prevIndex = findNextAvailableIndex(currentIndex, -1);
|
|
13078
|
-
return /* @__PURE__ */ (0,
|
|
13079
|
-
/* @__PURE__ */ (0,
|
|
13254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
13255
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13080
13256
|
"button",
|
|
13081
13257
|
{
|
|
13082
13258
|
onClick: () => {
|
|
@@ -13089,7 +13265,7 @@ var EnhancedImageViewer = ({
|
|
|
13089
13265
|
className: `w-10 h-10 rounded-full shadow-lg flex items-center justify-center transition-all duration-200 ${prevIndex === -1 ? "bg-white/40 text-black opacity-50 cursor-not-allowed" : "bg-white/90 hover:bg-white text-black"}`,
|
|
13090
13266
|
style: { touchAction: "manipulation" },
|
|
13091
13267
|
"aria-label": "Previous image",
|
|
13092
|
-
children: /* @__PURE__ */ (0,
|
|
13268
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13093
13269
|
"svg",
|
|
13094
13270
|
{
|
|
13095
13271
|
className: "w-4 h-4",
|
|
@@ -13097,7 +13273,7 @@ var EnhancedImageViewer = ({
|
|
|
13097
13273
|
stroke: "currentColor",
|
|
13098
13274
|
viewBox: "0 0 24 24",
|
|
13099
13275
|
"aria-hidden": "true",
|
|
13100
|
-
children: /* @__PURE__ */ (0,
|
|
13276
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13101
13277
|
"path",
|
|
13102
13278
|
{
|
|
13103
13279
|
strokeLinecap: "round",
|
|
@@ -13110,7 +13286,7 @@ var EnhancedImageViewer = ({
|
|
|
13110
13286
|
)
|
|
13111
13287
|
}
|
|
13112
13288
|
),
|
|
13113
|
-
/* @__PURE__ */ (0,
|
|
13289
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13114
13290
|
"button",
|
|
13115
13291
|
{
|
|
13116
13292
|
onClick: () => {
|
|
@@ -13123,7 +13299,7 @@ var EnhancedImageViewer = ({
|
|
|
13123
13299
|
className: `w-10 h-10 rounded-full shadow-lg flex items-center justify-center transition-all duration-200 ${nextIndex === -1 ? "bg-white/40 text-black opacity-50 cursor-not-allowed" : "bg-white/90 hover:bg-white text-black"}`,
|
|
13124
13300
|
style: { touchAction: "manipulation" },
|
|
13125
13301
|
"aria-label": "Next image",
|
|
13126
|
-
children: /* @__PURE__ */ (0,
|
|
13302
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13127
13303
|
"svg",
|
|
13128
13304
|
{
|
|
13129
13305
|
className: "w-4 h-4",
|
|
@@ -13131,7 +13307,7 @@ var EnhancedImageViewer = ({
|
|
|
13131
13307
|
stroke: "currentColor",
|
|
13132
13308
|
viewBox: "0 0 24 24",
|
|
13133
13309
|
"aria-hidden": "true",
|
|
13134
|
-
children: /* @__PURE__ */ (0,
|
|
13310
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13135
13311
|
"path",
|
|
13136
13312
|
{
|
|
13137
13313
|
strokeLinecap: "round",
|
|
@@ -13146,7 +13322,7 @@ var EnhancedImageViewer = ({
|
|
|
13146
13322
|
)
|
|
13147
13323
|
] });
|
|
13148
13324
|
})() }),
|
|
13149
|
-
/* @__PURE__ */ (0,
|
|
13325
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { style: { position: "fixed", bottom: 20, left: 24, zIndex: 10, marginBottom: "env(safe-area-inset-bottom, 0px)" }, className: "h-10 px-3 rounded-full bg-white/90 text-black text-sm font-medium flex items-center justify-center shadow-lg", children: (() => {
|
|
13150
13326
|
const total = Math.max(images.length, 1);
|
|
13151
13327
|
const current = propCurrentIndex !== void 0 ? Math.min(propCurrentIndex + 1, total) : 1;
|
|
13152
13328
|
return `${current} / ${total}`;
|
|
@@ -13158,7 +13334,7 @@ var EnhancedImageViewer = ({
|
|
|
13158
13334
|
},
|
|
13159
13335
|
`${scale.initial}-${scale.min}-${scale.max}`
|
|
13160
13336
|
),
|
|
13161
|
-
/* @__PURE__ */ (0,
|
|
13337
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
13162
13338
|
"div",
|
|
13163
13339
|
{
|
|
13164
13340
|
className: "absolute inset-0 bg-black",
|
|
@@ -13177,7 +13353,7 @@ var EnhancedImageViewer = ({
|
|
|
13177
13353
|
};
|
|
13178
13354
|
|
|
13179
13355
|
// src/composed/zoom/ResponsiveZoom.tsx
|
|
13180
|
-
var
|
|
13356
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
13181
13357
|
function ResponsiveZoom({
|
|
13182
13358
|
imageIndex,
|
|
13183
13359
|
children,
|
|
@@ -13187,11 +13363,11 @@ function ResponsiveZoom({
|
|
|
13187
13363
|
imageUrl,
|
|
13188
13364
|
alt = "Product image"
|
|
13189
13365
|
}) {
|
|
13190
|
-
const [isTouchDevice, setIsTouchDevice] = (0,
|
|
13191
|
-
const [showEnhancedViewer, setShowEnhancedViewer] = (0,
|
|
13192
|
-
const [viewerIndex, setViewerIndex] = (0,
|
|
13193
|
-
const [currentImageUrl, setCurrentImageUrl] = (0,
|
|
13194
|
-
(0,
|
|
13366
|
+
const [isTouchDevice, setIsTouchDevice] = (0, import_react57.useState)(false);
|
|
13367
|
+
const [showEnhancedViewer, setShowEnhancedViewer] = (0, import_react57.useState)(false);
|
|
13368
|
+
const [viewerIndex, setViewerIndex] = (0, import_react57.useState)(0);
|
|
13369
|
+
const [currentImageUrl, setCurrentImageUrl] = (0, import_react57.useState)(imageUrl || "");
|
|
13370
|
+
(0, import_react57.useEffect)(() => {
|
|
13195
13371
|
const checkDeviceType = () => {
|
|
13196
13372
|
const hasTouch = "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
13197
13373
|
setIsTouchDevice(hasTouch);
|
|
@@ -13218,8 +13394,8 @@ function ResponsiveZoom({
|
|
|
13218
13394
|
}
|
|
13219
13395
|
}
|
|
13220
13396
|
};
|
|
13221
|
-
return /* @__PURE__ */ (0,
|
|
13222
|
-
isTouchDevice ? /* @__PURE__ */ (0,
|
|
13397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
13398
|
+
isTouchDevice ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13223
13399
|
"div",
|
|
13224
13400
|
{
|
|
13225
13401
|
className,
|
|
@@ -13236,7 +13412,7 @@ function ResponsiveZoom({
|
|
|
13236
13412
|
},
|
|
13237
13413
|
children
|
|
13238
13414
|
}
|
|
13239
|
-
) : /* @__PURE__ */ (0,
|
|
13415
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13240
13416
|
ZoomOverlay,
|
|
13241
13417
|
{
|
|
13242
13418
|
imageIndex,
|
|
@@ -13247,7 +13423,7 @@ function ResponsiveZoom({
|
|
|
13247
13423
|
children
|
|
13248
13424
|
}
|
|
13249
13425
|
),
|
|
13250
|
-
showEnhancedViewer && isTouchDevice && currentImageUrl && /* @__PURE__ */ (0,
|
|
13426
|
+
showEnhancedViewer && isTouchDevice && currentImageUrl && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13251
13427
|
EnhancedImageViewer,
|
|
13252
13428
|
{
|
|
13253
13429
|
imageUrl: currentImageUrl,
|
|
@@ -13270,7 +13446,7 @@ function ResponsiveZoom({
|
|
|
13270
13446
|
}
|
|
13271
13447
|
|
|
13272
13448
|
// src/composed/carousels/MobileProductCarousel.tsx
|
|
13273
|
-
var
|
|
13449
|
+
var import_react58 = require("react");
|
|
13274
13450
|
|
|
13275
13451
|
// src/composed/carousels/fit.ts
|
|
13276
13452
|
function slideFit(_galleryRole) {
|
|
@@ -13281,17 +13457,17 @@ function zoomFit(galleryRole) {
|
|
|
13281
13457
|
}
|
|
13282
13458
|
|
|
13283
13459
|
// src/composed/carousels/MobileProductCarousel.tsx
|
|
13284
|
-
var
|
|
13460
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
13285
13461
|
function StaticCarouselImage({
|
|
13286
13462
|
src,
|
|
13287
13463
|
alt,
|
|
13288
13464
|
className
|
|
13289
13465
|
}) {
|
|
13290
|
-
const [failed, setFailed] = (0,
|
|
13466
|
+
const [failed, setFailed] = (0, import_react58.useState)(false);
|
|
13291
13467
|
if (failed || !src) {
|
|
13292
|
-
return /* @__PURE__ */ (0,
|
|
13468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: `bg-muted ${className ?? ""}`, role: "img", "aria-label": alt });
|
|
13293
13469
|
}
|
|
13294
|
-
return /* @__PURE__ */ (0,
|
|
13470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13295
13471
|
"img",
|
|
13296
13472
|
{
|
|
13297
13473
|
src,
|
|
@@ -13305,7 +13481,7 @@ function StaticCarouselImage({
|
|
|
13305
13481
|
}
|
|
13306
13482
|
);
|
|
13307
13483
|
}
|
|
13308
|
-
var MobileProductCarousel = (0,
|
|
13484
|
+
var MobileProductCarousel = (0, import_react58.memo)(function MobileProductCarousel2({
|
|
13309
13485
|
images,
|
|
13310
13486
|
currentIndex = 0,
|
|
13311
13487
|
onIndexChange,
|
|
@@ -13324,42 +13500,43 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13324
13500
|
errorText,
|
|
13325
13501
|
unavailableText
|
|
13326
13502
|
}) {
|
|
13327
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
13328
|
-
const
|
|
13503
|
+
const [activeIndex, setActiveIndex] = (0, import_react58.useState)(currentIndex);
|
|
13504
|
+
const skippedStamp = gallerySkippedStamp(useGallerySkipOptional()?.skipped ?? NO_GALLERY_SKIPS, images ?? []);
|
|
13505
|
+
const [touchStart, setTouchStart] = (0, import_react58.useState)(
|
|
13329
13506
|
null
|
|
13330
13507
|
);
|
|
13331
|
-
const [touchEnd, setTouchEnd] = (0,
|
|
13508
|
+
const [touchEnd, setTouchEnd] = (0, import_react58.useState)(
|
|
13332
13509
|
null
|
|
13333
13510
|
);
|
|
13334
|
-
const [showImageViewer, setShowImageViewer] = (0,
|
|
13335
|
-
const [viewerKey, setViewerKey] = (0,
|
|
13336
|
-
const [isDragging, setIsDragging] = (0,
|
|
13337
|
-
const [dragOffset, setDragOffset] = (0,
|
|
13338
|
-
const [isTransitioning, setIsTransitioning] = (0,
|
|
13339
|
-
const [isHorizontalSwipe, setIsHorizontalSwipe] = (0,
|
|
13511
|
+
const [showImageViewer, setShowImageViewer] = (0, import_react58.useState)(false);
|
|
13512
|
+
const [viewerKey, setViewerKey] = (0, import_react58.useState)(0);
|
|
13513
|
+
const [isDragging, setIsDragging] = (0, import_react58.useState)(false);
|
|
13514
|
+
const [dragOffset, setDragOffset] = (0, import_react58.useState)(0);
|
|
13515
|
+
const [isTransitioning, setIsTransitioning] = (0, import_react58.useState)(false);
|
|
13516
|
+
const [isHorizontalSwipe, setIsHorizontalSwipe] = (0, import_react58.useState)(
|
|
13340
13517
|
null
|
|
13341
13518
|
);
|
|
13342
|
-
const [isPeeking, setIsPeeking] = (0,
|
|
13343
|
-
const [isPeekReturning, setIsPeekReturning] = (0,
|
|
13344
|
-
const carouselRef = (0,
|
|
13345
|
-
const indicatorRef = (0,
|
|
13346
|
-
const touchStartRef = (0,
|
|
13519
|
+
const [isPeeking, setIsPeeking] = (0, import_react58.useState)(false);
|
|
13520
|
+
const [isPeekReturning, setIsPeekReturning] = (0, import_react58.useState)(false);
|
|
13521
|
+
const carouselRef = (0, import_react58.useRef)(null);
|
|
13522
|
+
const indicatorRef = (0, import_react58.useRef)(null);
|
|
13523
|
+
const touchStartRef = (0, import_react58.useRef)(
|
|
13347
13524
|
null
|
|
13348
13525
|
);
|
|
13349
|
-
const horizontalGestureRef = (0,
|
|
13350
|
-
const hasShownPeekRef = (0,
|
|
13351
|
-
const hasSwipedThisSessionRef = (0,
|
|
13352
|
-
const generatedUrlsRef = (0,
|
|
13353
|
-
const prevArtworkSrcRef = (0,
|
|
13354
|
-
(0,
|
|
13526
|
+
const horizontalGestureRef = (0, import_react58.useRef)(false);
|
|
13527
|
+
const hasShownPeekRef = (0, import_react58.useRef)(false);
|
|
13528
|
+
const hasSwipedThisSessionRef = (0, import_react58.useRef)(false);
|
|
13529
|
+
const generatedUrlsRef = (0, import_react58.useRef)(/* @__PURE__ */ new Map());
|
|
13530
|
+
const prevArtworkSrcRef = (0, import_react58.useRef)(currentArtwork?.src);
|
|
13531
|
+
(0, import_react58.useEffect)(() => {
|
|
13355
13532
|
if (currentArtwork?.src !== prevArtworkSrcRef.current) {
|
|
13356
13533
|
generatedUrlsRef.current.clear();
|
|
13357
13534
|
prevArtworkSrcRef.current = currentArtwork?.src;
|
|
13358
13535
|
}
|
|
13359
13536
|
}, [currentArtwork?.src]);
|
|
13360
|
-
const onMockupUrlGeneratedRef = (0,
|
|
13537
|
+
const onMockupUrlGeneratedRef = (0, import_react58.useRef)(onMockupUrlGenerated);
|
|
13361
13538
|
onMockupUrlGeneratedRef.current = onMockupUrlGenerated;
|
|
13362
|
-
const handleUrlGenerated = (0,
|
|
13539
|
+
const handleUrlGenerated = (0, import_react58.useCallback)((mockupId, url) => {
|
|
13363
13540
|
generatedUrlsRef.current.set(mockupId, url);
|
|
13364
13541
|
onMockupUrlGeneratedRef.current?.(mockupId, url);
|
|
13365
13542
|
}, []);
|
|
@@ -13367,24 +13544,24 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13367
13544
|
const shouldHideDots = stickyHeroContext?.shouldHideDots ?? false;
|
|
13368
13545
|
const priorityContext = useMockupPriorityOptional();
|
|
13369
13546
|
const realtimeContext = useRealtimeOptional();
|
|
13370
|
-
const [urlUpdateCounter, setUrlUpdateCounter] = (0,
|
|
13371
|
-
(0,
|
|
13547
|
+
const [urlUpdateCounter, setUrlUpdateCounter] = (0, import_react58.useState)(0);
|
|
13548
|
+
(0, import_react58.useEffect)(() => {
|
|
13372
13549
|
if (!realtimeContext?.subscribeMockupResults) return;
|
|
13373
13550
|
const unsubscribe = realtimeContext.subscribeMockupResults(() => {
|
|
13374
13551
|
setUrlUpdateCounter((c) => c + 1);
|
|
13375
13552
|
});
|
|
13376
13553
|
return unsubscribe;
|
|
13377
13554
|
}, [realtimeContext?.subscribeMockupResults]);
|
|
13378
|
-
const mockupIds = (0,
|
|
13555
|
+
const mockupIds = (0, import_react58.useMemo)(() => {
|
|
13379
13556
|
return images.filter((img) => img.isRealMockup && img.mockupId).map((img) => img.mockupId);
|
|
13380
13557
|
}, [images]);
|
|
13381
|
-
const realtimeMockupUrls = (0,
|
|
13558
|
+
const realtimeMockupUrls = (0, import_react58.useMemo)(() => {
|
|
13382
13559
|
if (!realtimeContext?.getMockupUrls || mockupIds.length === 0) {
|
|
13383
13560
|
return {};
|
|
13384
13561
|
}
|
|
13385
13562
|
return realtimeContext.getMockupUrls(mockupIds);
|
|
13386
13563
|
}, [realtimeContext?.getMockupUrls, mockupIds, urlUpdateCounter]);
|
|
13387
|
-
const imagesWithRealtimeUrls = (0,
|
|
13564
|
+
const imagesWithRealtimeUrls = (0, import_react58.useMemo)(() => {
|
|
13388
13565
|
return images.map((img) => {
|
|
13389
13566
|
if (img.isRealMockup && img.mockupId && realtimeMockupUrls[img.mockupId]) {
|
|
13390
13567
|
return {
|
|
@@ -13396,10 +13573,10 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13396
13573
|
});
|
|
13397
13574
|
}, [images, realtimeMockupUrls]);
|
|
13398
13575
|
const minSwipeDistance = 50;
|
|
13399
|
-
(0,
|
|
13576
|
+
(0, import_react58.useEffect)(() => {
|
|
13400
13577
|
setActiveIndex(currentIndex);
|
|
13401
13578
|
}, [currentIndex]);
|
|
13402
|
-
(0,
|
|
13579
|
+
(0, import_react58.useEffect)(() => {
|
|
13403
13580
|
if (!priorityContext) return;
|
|
13404
13581
|
const realMockups = images.map((img, idx) => ({ img, originalIdx: idx })).filter(({ img }) => img.isRealMockup && img.mockupId);
|
|
13405
13582
|
const mockupIdsList = realMockups.map(({ img }) => img.mockupId);
|
|
@@ -13427,7 +13604,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13427
13604
|
priorityContext.clearMobileCarouselMode?.();
|
|
13428
13605
|
};
|
|
13429
13606
|
}, [priorityContext, activeIndex, images]);
|
|
13430
|
-
(0,
|
|
13607
|
+
(0, import_react58.useEffect)(() => {
|
|
13431
13608
|
const indicator = indicatorRef.current;
|
|
13432
13609
|
if (!indicator) return;
|
|
13433
13610
|
let ticking = false;
|
|
@@ -13468,7 +13645,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13468
13645
|
}, []);
|
|
13469
13646
|
const SWIPE_TRACKING_KEY = "carousel-swipe-tracking";
|
|
13470
13647
|
const PDP_VIEWS_BEFORE_PEEK = 10;
|
|
13471
|
-
const getSwipeTracking = (0,
|
|
13648
|
+
const getSwipeTracking = (0, import_react58.useCallback)(() => {
|
|
13472
13649
|
try {
|
|
13473
13650
|
const stored = localStorage.getItem(SWIPE_TRACKING_KEY);
|
|
13474
13651
|
if (stored) {
|
|
@@ -13478,7 +13655,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13478
13655
|
}
|
|
13479
13656
|
return { viewsWithoutSwipe: 0, hasEverSwiped: false };
|
|
13480
13657
|
}, []);
|
|
13481
|
-
const recordSwipe = (0,
|
|
13658
|
+
const recordSwipe = (0, import_react58.useCallback)(() => {
|
|
13482
13659
|
if (hasSwipedThisSessionRef.current) return;
|
|
13483
13660
|
hasSwipedThisSessionRef.current = true;
|
|
13484
13661
|
try {
|
|
@@ -13492,7 +13669,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13492
13669
|
} catch {
|
|
13493
13670
|
}
|
|
13494
13671
|
}, []);
|
|
13495
|
-
(0,
|
|
13672
|
+
(0, import_react58.useEffect)(() => {
|
|
13496
13673
|
if (!enablePeekAnimation || images.length <= 1) return;
|
|
13497
13674
|
const tracking = getSwipeTracking();
|
|
13498
13675
|
const newViewCount = tracking.viewsWithoutSwipe + 1;
|
|
@@ -13533,14 +13710,14 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13533
13710
|
clearTimeout(clearTimeout_);
|
|
13534
13711
|
};
|
|
13535
13712
|
}, [images.length, getSwipeTracking, enablePeekAnimation]);
|
|
13536
|
-
const wasTapRef = (0,
|
|
13537
|
-
const handleImageTap = (0,
|
|
13713
|
+
const wasTapRef = (0, import_react58.useRef)(false);
|
|
13714
|
+
const handleImageTap = (0, import_react58.useCallback)(() => {
|
|
13538
13715
|
if (!enableZoom) return;
|
|
13539
13716
|
setViewerKey((prev) => prev + 1);
|
|
13540
13717
|
setShowImageViewer(true);
|
|
13541
13718
|
onZoomChange?.(true);
|
|
13542
13719
|
}, [enableZoom, onZoomChange]);
|
|
13543
|
-
const calculateDragOffset = (0,
|
|
13720
|
+
const calculateDragOffset = (0, import_react58.useCallback)(
|
|
13544
13721
|
(startX, currentX, containerWidth) => {
|
|
13545
13722
|
const distance = startX - currentX;
|
|
13546
13723
|
const offsetPercent = distance / containerWidth * 100;
|
|
@@ -13565,7 +13742,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13565
13742
|
},
|
|
13566
13743
|
[activeIndex, images.length]
|
|
13567
13744
|
);
|
|
13568
|
-
const handleSwipeEnd = (0,
|
|
13745
|
+
const handleSwipeEnd = (0, import_react58.useCallback)(
|
|
13569
13746
|
(startX, endX, containerWidth) => {
|
|
13570
13747
|
const distance = startX - endX;
|
|
13571
13748
|
const distancePercent = Math.abs(distance) / containerWidth * 100;
|
|
@@ -13596,7 +13773,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13596
13773
|
},
|
|
13597
13774
|
[activeIndex, images.length, onIndexChange, recordSwipe]
|
|
13598
13775
|
);
|
|
13599
|
-
(0,
|
|
13776
|
+
(0, import_react58.useEffect)(() => {
|
|
13600
13777
|
const container = carouselRef.current;
|
|
13601
13778
|
if (!container) return;
|
|
13602
13779
|
const handleTouchStart = (e) => {
|
|
@@ -13685,11 +13862,11 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13685
13862
|
handleSwipeEnd,
|
|
13686
13863
|
handleImageTap
|
|
13687
13864
|
]);
|
|
13688
|
-
const mouseStartRef = (0,
|
|
13865
|
+
const mouseStartRef = (0, import_react58.useRef)(
|
|
13689
13866
|
null
|
|
13690
13867
|
);
|
|
13691
|
-
const isMouseDraggingRef = (0,
|
|
13692
|
-
(0,
|
|
13868
|
+
const isMouseDraggingRef = (0, import_react58.useRef)(false);
|
|
13869
|
+
(0, import_react58.useEffect)(() => {
|
|
13693
13870
|
const container = carouselRef.current;
|
|
13694
13871
|
if (!container) return;
|
|
13695
13872
|
const handleMouseDown = (e) => {
|
|
@@ -13765,7 +13942,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13765
13942
|
container.removeEventListener("mouseleave", handleMouseLeave);
|
|
13766
13943
|
};
|
|
13767
13944
|
}, [calculateDragOffset, handleSwipeEnd, handleImageTap]);
|
|
13768
|
-
const goToSlide = (0,
|
|
13945
|
+
const goToSlide = (0, import_react58.useCallback)(
|
|
13769
13946
|
(index, withTransition = true) => {
|
|
13770
13947
|
if (withTransition) {
|
|
13771
13948
|
setIsTransitioning(true);
|
|
@@ -13783,16 +13960,16 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13783
13960
|
},
|
|
13784
13961
|
[onIndexChange]
|
|
13785
13962
|
);
|
|
13786
|
-
(0,
|
|
13963
|
+
(0, import_react58.useEffect)(() => {
|
|
13787
13964
|
if (stickyHeroContext?.setCarouselIndicator && images.length > 1) {
|
|
13788
|
-
const indicator = /* @__PURE__ */ (0,
|
|
13965
|
+
const indicator = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13789
13966
|
"div",
|
|
13790
13967
|
{
|
|
13791
13968
|
className: "w-full",
|
|
13792
13969
|
role: "group",
|
|
13793
13970
|
"aria-label": "Product image navigation",
|
|
13794
|
-
children: /* @__PURE__ */ (0,
|
|
13795
|
-
/* @__PURE__ */ (0,
|
|
13971
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "relative h-1", children: [
|
|
13972
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "flex h-full", children: images.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13796
13973
|
"button",
|
|
13797
13974
|
{
|
|
13798
13975
|
onClick: () => goToSlide(index),
|
|
@@ -13802,7 +13979,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13802
13979
|
},
|
|
13803
13980
|
index
|
|
13804
13981
|
)) }),
|
|
13805
|
-
/* @__PURE__ */ (0,
|
|
13982
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13806
13983
|
"div",
|
|
13807
13984
|
{
|
|
13808
13985
|
className: "absolute top-0 h-full bg-primary transition-all duration-300 ease-out",
|
|
@@ -13825,10 +14002,10 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13825
14002
|
};
|
|
13826
14003
|
}, [activeIndex, images.length, goToSlide, stickyHeroContext]);
|
|
13827
14004
|
if (!images || images.length === 0) {
|
|
13828
|
-
return /* @__PURE__ */ (0,
|
|
14005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "w-full aspect-video bg-muted rounded-lg" });
|
|
13829
14006
|
}
|
|
13830
|
-
return /* @__PURE__ */ (0,
|
|
13831
|
-
/* @__PURE__ */ (0,
|
|
14007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: `relative w-full h-full ${className}`, "data-gallery": "product", "data-gallery-skipped": skippedStamp, children: [
|
|
14008
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13832
14009
|
"div",
|
|
13833
14010
|
{
|
|
13834
14011
|
ref: carouselRef,
|
|
@@ -13846,7 +14023,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13846
14023
|
role: "region",
|
|
13847
14024
|
"aria-roledescription": "carousel",
|
|
13848
14025
|
"aria-label": "Product images",
|
|
13849
|
-
children: /* @__PURE__ */ (0,
|
|
14026
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13850
14027
|
"div",
|
|
13851
14028
|
{
|
|
13852
14029
|
className: `flex h-full ${isPeekReturning ? "transition-transform duration-300 ease-[cubic-bezier(0,0,0.2,1)]" : isPeeking ? "transition-transform duration-500 ease-[cubic-bezier(0.4,0,0.2,1)]" : isTransitioning || !isDragging ? "transition-transform duration-300 ease-[cubic-bezier(0.25,0.46,0.45,0.94)]" : ""}`,
|
|
@@ -13856,7 +14033,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13856
14033
|
children: images.map((image, index) => {
|
|
13857
14034
|
const DECODE_WINDOW = 1;
|
|
13858
14035
|
const isWithinDecodeWindow = Math.abs(index - activeIndex) <= DECODE_WINDOW;
|
|
13859
|
-
return /* @__PURE__ */ (0,
|
|
14036
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
13860
14037
|
"div",
|
|
13861
14038
|
{
|
|
13862
14039
|
className: "w-full h-full flex-shrink-0 relative select-none",
|
|
@@ -13864,11 +14041,11 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13864
14041
|
"data-mockup-id": image.galleryRole ? image.mockupId : void 0,
|
|
13865
14042
|
...slideFirstViewProps(image.isRealMockup ? image : {}),
|
|
13866
14043
|
children: [
|
|
13867
|
-
!isWithinDecodeWindow ? /* @__PURE__ */ (0,
|
|
14044
|
+
!isWithinDecodeWindow ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "w-full h-full bg-muted" }) : image.isPlaceholder ? (
|
|
13868
14045
|
// Rainbow prism loader (same as the /create route) instead of
|
|
13869
14046
|
// a flat pulse; fills this relative slide via inset:0.
|
|
13870
|
-
/* @__PURE__ */ (0,
|
|
13871
|
-
) : image.isRealMockup && currentArtwork ? /* @__PURE__ */ (0,
|
|
14047
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(LoadingOverlayPrismCandyInline, { visible: true, variant: "light" })
|
|
14048
|
+
) : image.isRealMockup && currentArtwork ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13872
14049
|
HeroProductImage,
|
|
13873
14050
|
{
|
|
13874
14051
|
productId,
|
|
@@ -13885,7 +14062,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13885
14062
|
viewportPolicy: true,
|
|
13886
14063
|
fit: slideFit(image.galleryRole)
|
|
13887
14064
|
}
|
|
13888
|
-
) : image.isRealMockup && !currentArtwork ? /* @__PURE__ */ (0,
|
|
14065
|
+
) : image.isRealMockup && !currentArtwork ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(LoadingOverlayPrismCandyInline, { visible: true, variant: "light" }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13889
14066
|
StaticCarouselImage,
|
|
13890
14067
|
{
|
|
13891
14068
|
src: image.src,
|
|
@@ -13895,7 +14072,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13895
14072
|
),
|
|
13896
14073
|
isWithinDecodeWindow && (() => {
|
|
13897
14074
|
const action = renderImageAction?.(image, index);
|
|
13898
|
-
return action ? /* @__PURE__ */ (0,
|
|
14075
|
+
return action ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13899
14076
|
"div",
|
|
13900
14077
|
{
|
|
13901
14078
|
className: "absolute top-3 right-3 z-10",
|
|
@@ -13909,14 +14086,14 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13909
14086
|
})()
|
|
13910
14087
|
]
|
|
13911
14088
|
},
|
|
13912
|
-
index
|
|
14089
|
+
image.mockupId ? `m:${image.mockupId}` : `i:${index}`
|
|
13913
14090
|
);
|
|
13914
14091
|
})
|
|
13915
14092
|
}
|
|
13916
14093
|
)
|
|
13917
14094
|
}
|
|
13918
14095
|
),
|
|
13919
|
-
showIndicators && images.length > 1 && /* @__PURE__ */ (0,
|
|
14096
|
+
showIndicators && images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13920
14097
|
"div",
|
|
13921
14098
|
{
|
|
13922
14099
|
ref: indicatorRef,
|
|
@@ -13924,8 +14101,8 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13924
14101
|
className: "relative z-20 w-full",
|
|
13925
14102
|
role: "group",
|
|
13926
14103
|
"aria-label": "Product image navigation",
|
|
13927
|
-
children: /* @__PURE__ */ (0,
|
|
13928
|
-
/* @__PURE__ */ (0,
|
|
14104
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "relative h-1", children: [
|
|
14105
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "flex h-full absolute inset-0", children: images.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13929
14106
|
"button",
|
|
13930
14107
|
{
|
|
13931
14108
|
onClick: () => goToSlide(index),
|
|
@@ -13935,7 +14112,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13935
14112
|
},
|
|
13936
14113
|
index
|
|
13937
14114
|
)) }),
|
|
13938
|
-
/* @__PURE__ */ (0,
|
|
14115
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13939
14116
|
"div",
|
|
13940
14117
|
{
|
|
13941
14118
|
className: `absolute top-0 h-full bg-foreground ${isPeekReturning ? "transition-all duration-300 ease-[cubic-bezier(0,0,0.2,1)]" : isPeeking ? "transition-all duration-500 ease-[cubic-bezier(0.4,0,0.2,1)]" : isDragging ? "" : "transition-all duration-300 ease-out"}`,
|
|
@@ -13973,7 +14150,7 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
13973
14150
|
...slideFirstViewFields(img)
|
|
13974
14151
|
} : null;
|
|
13975
14152
|
}).filter((img) => img !== null);
|
|
13976
|
-
return /* @__PURE__ */ (0,
|
|
14153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
13977
14154
|
EnhancedImageViewer,
|
|
13978
14155
|
{
|
|
13979
14156
|
imageUrl,
|
|
@@ -14012,8 +14189,8 @@ var MobileProductCarousel = (0, import_react57.memo)(function MobileProductCarou
|
|
|
14012
14189
|
});
|
|
14013
14190
|
|
|
14014
14191
|
// src/composed/carousels/HeroCarousel.tsx
|
|
14015
|
-
var
|
|
14016
|
-
var
|
|
14192
|
+
var import_react59 = require("react");
|
|
14193
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
14017
14194
|
function HeroCarousel({
|
|
14018
14195
|
images,
|
|
14019
14196
|
currentIndex = 0,
|
|
@@ -14023,16 +14200,16 @@ function HeroCarousel({
|
|
|
14023
14200
|
productId,
|
|
14024
14201
|
onImageTap
|
|
14025
14202
|
}) {
|
|
14026
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
14027
|
-
const containerRef = (0,
|
|
14028
|
-
const touchStartRef = (0,
|
|
14203
|
+
const [activeIndex, setActiveIndex] = (0, import_react59.useState)(currentIndex);
|
|
14204
|
+
const containerRef = (0, import_react59.useRef)(null);
|
|
14205
|
+
const touchStartRef = (0, import_react59.useRef)(
|
|
14029
14206
|
null
|
|
14030
14207
|
);
|
|
14031
|
-
const isSwipingRef = (0,
|
|
14032
|
-
(0,
|
|
14208
|
+
const isSwipingRef = (0, import_react59.useRef)(false);
|
|
14209
|
+
(0, import_react59.useEffect)(() => {
|
|
14033
14210
|
setActiveIndex(currentIndex);
|
|
14034
14211
|
}, [currentIndex]);
|
|
14035
|
-
const goToSlide = (0,
|
|
14212
|
+
const goToSlide = (0, import_react59.useCallback)(
|
|
14036
14213
|
(index) => {
|
|
14037
14214
|
const clampedIndex = Math.max(0, Math.min(images.length - 1, index));
|
|
14038
14215
|
setActiveIndex(clampedIndex);
|
|
@@ -14040,7 +14217,7 @@ function HeroCarousel({
|
|
|
14040
14217
|
},
|
|
14041
14218
|
[images.length, onIndexChange]
|
|
14042
14219
|
);
|
|
14043
|
-
(0,
|
|
14220
|
+
(0, import_react59.useEffect)(() => {
|
|
14044
14221
|
const container = containerRef.current;
|
|
14045
14222
|
if (!container) return;
|
|
14046
14223
|
const handleTouchStart = (e) => {
|
|
@@ -14092,9 +14269,9 @@ function HeroCarousel({
|
|
|
14092
14269
|
};
|
|
14093
14270
|
}, [activeIndex, images.length, goToSlide, onImageTap]);
|
|
14094
14271
|
if (!images || images.length === 0) {
|
|
14095
|
-
return /* @__PURE__ */ (0,
|
|
14272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "w-full h-full bg-muted" });
|
|
14096
14273
|
}
|
|
14097
|
-
return /* @__PURE__ */ (0,
|
|
14274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
14098
14275
|
"div",
|
|
14099
14276
|
{
|
|
14100
14277
|
ref: containerRef,
|
|
@@ -14105,7 +14282,7 @@ function HeroCarousel({
|
|
|
14105
14282
|
overflow: "hidden"
|
|
14106
14283
|
},
|
|
14107
14284
|
children: [
|
|
14108
|
-
/* @__PURE__ */ (0,
|
|
14285
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14109
14286
|
"div",
|
|
14110
14287
|
{
|
|
14111
14288
|
className: "flex h-full transition-transform duration-300 ease-out",
|
|
@@ -14116,14 +14293,14 @@ function HeroCarousel({
|
|
|
14116
14293
|
backfaceVisibility: "hidden",
|
|
14117
14294
|
WebkitBackfaceVisibility: "hidden"
|
|
14118
14295
|
},
|
|
14119
|
-
children: images.map((image, index) => /* @__PURE__ */ (0,
|
|
14296
|
+
children: images.map((image, index) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14120
14297
|
"div",
|
|
14121
14298
|
{
|
|
14122
14299
|
className: "w-full h-full flex-shrink-0",
|
|
14123
14300
|
style: {
|
|
14124
14301
|
contain: "layout paint"
|
|
14125
14302
|
},
|
|
14126
|
-
children: image.isRealMockup && currentArtwork ? /* @__PURE__ */ (0,
|
|
14303
|
+
children: image.isRealMockup && currentArtwork ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14127
14304
|
HeroProductImage,
|
|
14128
14305
|
{
|
|
14129
14306
|
productId,
|
|
@@ -14132,7 +14309,7 @@ function HeroCarousel({
|
|
|
14132
14309
|
mockupId: image.mockupId,
|
|
14133
14310
|
className: "w-full h-full object-cover"
|
|
14134
14311
|
}
|
|
14135
|
-
) : /* @__PURE__ */ (0,
|
|
14312
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14136
14313
|
"img",
|
|
14137
14314
|
{
|
|
14138
14315
|
src: image.src,
|
|
@@ -14149,12 +14326,12 @@ function HeroCarousel({
|
|
|
14149
14326
|
))
|
|
14150
14327
|
}
|
|
14151
14328
|
),
|
|
14152
|
-
images.length > 1 && /* @__PURE__ */ (0,
|
|
14329
|
+
images.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14153
14330
|
"div",
|
|
14154
14331
|
{
|
|
14155
14332
|
className: "absolute bottom-4 left-0 right-0 flex justify-center gap-2 z-10",
|
|
14156
14333
|
style: { contain: "layout style" },
|
|
14157
|
-
children: images.map((_, index) => /* @__PURE__ */ (0,
|
|
14334
|
+
children: images.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14158
14335
|
"button",
|
|
14159
14336
|
{
|
|
14160
14337
|
onClick: () => goToSlide(index),
|
|
@@ -14171,8 +14348,8 @@ function HeroCarousel({
|
|
|
14171
14348
|
}
|
|
14172
14349
|
|
|
14173
14350
|
// src/composed/grids/MasonryGrid.tsx
|
|
14174
|
-
var
|
|
14175
|
-
var
|
|
14351
|
+
var import_react60 = require("react");
|
|
14352
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
14176
14353
|
var BREAKPOINTS = {
|
|
14177
14354
|
sm: 640,
|
|
14178
14355
|
md: 768,
|
|
@@ -14224,13 +14401,13 @@ function MasonryGrid({
|
|
|
14224
14401
|
className = "",
|
|
14225
14402
|
emptyContent
|
|
14226
14403
|
}) {
|
|
14227
|
-
const [columnCount, setColumnCount] = (0,
|
|
14404
|
+
const [columnCount, setColumnCount] = (0, import_react60.useState)(
|
|
14228
14405
|
() => typeof columns === "number" ? columns : getColumnCount(
|
|
14229
14406
|
typeof window !== "undefined" ? window.innerWidth : 1024,
|
|
14230
14407
|
columns
|
|
14231
14408
|
)
|
|
14232
14409
|
);
|
|
14233
|
-
(0,
|
|
14410
|
+
(0, import_react60.useEffect)(() => {
|
|
14234
14411
|
const updateColumnCount = () => {
|
|
14235
14412
|
setColumnCount(getColumnCount(window.innerWidth, columns));
|
|
14236
14413
|
};
|
|
@@ -14238,30 +14415,30 @@ function MasonryGrid({
|
|
|
14238
14415
|
window.addEventListener("resize", updateColumnCount);
|
|
14239
14416
|
return () => window.removeEventListener("resize", updateColumnCount);
|
|
14240
14417
|
}, [columns]);
|
|
14241
|
-
const distributedColumns = (0,
|
|
14418
|
+
const distributedColumns = (0, import_react60.useMemo)(
|
|
14242
14419
|
() => distributeItems(items, columnCount),
|
|
14243
14420
|
[items, columnCount]
|
|
14244
14421
|
);
|
|
14245
14422
|
if (items.length === 0) {
|
|
14246
14423
|
if (emptyContent) {
|
|
14247
|
-
return /* @__PURE__ */ (0,
|
|
14424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_jsx_runtime78.Fragment, { children: emptyContent });
|
|
14248
14425
|
}
|
|
14249
14426
|
return null;
|
|
14250
14427
|
}
|
|
14251
|
-
return /* @__PURE__ */ (0,
|
|
14428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14252
14429
|
"div",
|
|
14253
14430
|
{
|
|
14254
14431
|
className: `flex ${className}`,
|
|
14255
14432
|
style: { gap: `${gap}px` },
|
|
14256
14433
|
role: "list",
|
|
14257
|
-
children: distributedColumns.map((columnItems, columnIndex) => /* @__PURE__ */ (0,
|
|
14434
|
+
children: distributedColumns.map((columnItems, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
14258
14435
|
"div",
|
|
14259
14436
|
{
|
|
14260
14437
|
className: "flex-1 flex flex-col",
|
|
14261
14438
|
style: { gap: `${gap}px` },
|
|
14262
14439
|
children: columnItems.map((item, itemIndex) => {
|
|
14263
14440
|
const originalIndex = itemIndex * columnCount + columnIndex;
|
|
14264
|
-
return /* @__PURE__ */ (0,
|
|
14441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { role: "listitem", children: renderItem(item, originalIndex) }, originalIndex);
|
|
14265
14442
|
})
|
|
14266
14443
|
},
|
|
14267
14444
|
columnIndex
|
|
@@ -14274,7 +14451,7 @@ function MasonryGrid({
|
|
|
14274
14451
|
init_dev_warnings();
|
|
14275
14452
|
|
|
14276
14453
|
// src/layouts/hero-zoom/HeroZoomLayout.tsx
|
|
14277
|
-
var
|
|
14454
|
+
var import_react62 = require("react");
|
|
14278
14455
|
|
|
14279
14456
|
// src/layouts/hero-zoom/types.ts
|
|
14280
14457
|
var DEFAULT_HERO_ZOOM_CONFIG = {
|
|
@@ -14286,19 +14463,19 @@ var DEFAULT_HERO_ZOOM_CONFIG = {
|
|
|
14286
14463
|
};
|
|
14287
14464
|
|
|
14288
14465
|
// src/layouts/hero-zoom/useHeroZoomScales.ts
|
|
14289
|
-
var
|
|
14466
|
+
var import_react61 = require("react");
|
|
14290
14467
|
function useHeroZoomScales(config = {}) {
|
|
14291
14468
|
const { initialScale, accountForRetina, maxRetinaMultiplier } = {
|
|
14292
14469
|
...DEFAULT_HERO_ZOOM_CONFIG,
|
|
14293
14470
|
...config
|
|
14294
14471
|
};
|
|
14295
|
-
const [isHydrated, setIsHydrated] = (0,
|
|
14472
|
+
const [isHydrated, setIsHydrated] = (0, import_react61.useState)(false);
|
|
14296
14473
|
const ssrMultiplier = accountForRetina ? maxRetinaMultiplier : 2;
|
|
14297
|
-
const [scales, setScales] = (0,
|
|
14474
|
+
const [scales, setScales] = (0, import_react61.useState)(() => ({
|
|
14298
14475
|
visual: initialScale,
|
|
14299
14476
|
render: initialScale * ssrMultiplier
|
|
14300
14477
|
}));
|
|
14301
|
-
const calculateScales = (0,
|
|
14478
|
+
const calculateScales = (0, import_react61.useCallback)(() => {
|
|
14302
14479
|
const visualScale = Math.max(1, Math.min(4, initialScale));
|
|
14303
14480
|
let renderScale;
|
|
14304
14481
|
if (accountForRetina) {
|
|
@@ -14313,7 +14490,7 @@ function useHeroZoomScales(config = {}) {
|
|
|
14313
14490
|
renderScale = Math.max(1, Math.min(8, renderScale));
|
|
14314
14491
|
return { visual: visualScale, render: renderScale };
|
|
14315
14492
|
}, [initialScale, accountForRetina, maxRetinaMultiplier]);
|
|
14316
|
-
(0,
|
|
14493
|
+
(0, import_react61.useEffect)(() => {
|
|
14317
14494
|
const supportsScrollTimeline = CSS.supports(
|
|
14318
14495
|
"animation-timeline",
|
|
14319
14496
|
"scroll()"
|
|
@@ -14363,7 +14540,7 @@ function useHeroZoomScales(config = {}) {
|
|
|
14363
14540
|
}
|
|
14364
14541
|
|
|
14365
14542
|
// src/layouts/hero-zoom/HeroZoomLayout.tsx
|
|
14366
|
-
var
|
|
14543
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
14367
14544
|
function HeroZoomLayout({
|
|
14368
14545
|
config = {},
|
|
14369
14546
|
header,
|
|
@@ -14378,9 +14555,9 @@ function HeroZoomLayout({
|
|
|
14378
14555
|
};
|
|
14379
14556
|
const { aspectRatio, initialScale, headerHeight } = mergedConfig;
|
|
14380
14557
|
const { visual, render, isHydrated } = useHeroZoomScales(mergedConfig);
|
|
14381
|
-
const imageContainerRef = (0,
|
|
14382
|
-
const headerRef = (0,
|
|
14383
|
-
(0,
|
|
14558
|
+
const imageContainerRef = (0, import_react62.useRef)(null);
|
|
14559
|
+
const headerRef = (0, import_react62.useRef)(null);
|
|
14560
|
+
(0, import_react62.useEffect)(() => {
|
|
14384
14561
|
if (typeof window === "undefined") return;
|
|
14385
14562
|
const originalRestoration = "scrollRestoration" in history ? history.scrollRestoration : "auto";
|
|
14386
14563
|
if ("scrollRestoration" in history) {
|
|
@@ -14393,7 +14570,7 @@ function HeroZoomLayout({
|
|
|
14393
14570
|
}
|
|
14394
14571
|
};
|
|
14395
14572
|
}, []);
|
|
14396
|
-
(0,
|
|
14573
|
+
(0, import_react62.useEffect)(() => {
|
|
14397
14574
|
const supportsScrollTimeline = CSS.supports(
|
|
14398
14575
|
"animation-timeline",
|
|
14399
14576
|
"scroll()"
|
|
@@ -14522,7 +14699,7 @@ function HeroZoomLayout({
|
|
|
14522
14699
|
The drawer covers the hero completely, so let animation run continuously. */
|
|
14523
14700
|
}
|
|
14524
14701
|
`;
|
|
14525
|
-
return /* @__PURE__ */ (0,
|
|
14702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(
|
|
14526
14703
|
"div",
|
|
14527
14704
|
{
|
|
14528
14705
|
className: `relative min-h-screen ${className}`,
|
|
@@ -14536,8 +14713,8 @@ function HeroZoomLayout({
|
|
|
14536
14713
|
"--hero-zoom-final-transform": 1 / activeRender
|
|
14537
14714
|
},
|
|
14538
14715
|
children: [
|
|
14539
|
-
/* @__PURE__ */ (0,
|
|
14540
|
-
/* @__PURE__ */ (0,
|
|
14716
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("style", { dangerouslySetInnerHTML: { __html: scopedStyles } }),
|
|
14717
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14541
14718
|
"div",
|
|
14542
14719
|
{
|
|
14543
14720
|
style: {
|
|
@@ -14545,7 +14722,7 @@ function HeroZoomLayout({
|
|
|
14545
14722
|
}
|
|
14546
14723
|
}
|
|
14547
14724
|
),
|
|
14548
|
-
header && /* @__PURE__ */ (0,
|
|
14725
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14549
14726
|
"div",
|
|
14550
14727
|
{
|
|
14551
14728
|
ref: headerRef,
|
|
@@ -14558,7 +14735,7 @@ function HeroZoomLayout({
|
|
|
14558
14735
|
children: header
|
|
14559
14736
|
}
|
|
14560
14737
|
),
|
|
14561
|
-
/* @__PURE__ */ (0,
|
|
14738
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14562
14739
|
"div",
|
|
14563
14740
|
{
|
|
14564
14741
|
ref: imageContainerRef,
|
|
@@ -14578,15 +14755,15 @@ function HeroZoomLayout({
|
|
|
14578
14755
|
children: hero
|
|
14579
14756
|
}
|
|
14580
14757
|
),
|
|
14581
|
-
/* @__PURE__ */ (0,
|
|
14758
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "relative z-10", children })
|
|
14582
14759
|
]
|
|
14583
14760
|
}
|
|
14584
14761
|
);
|
|
14585
14762
|
}
|
|
14586
14763
|
|
|
14587
14764
|
// src/layouts/hero-zoom/HeroShrinkLayout.tsx
|
|
14588
|
-
var
|
|
14589
|
-
var
|
|
14765
|
+
var import_react63 = require("react");
|
|
14766
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
14590
14767
|
var DEFAULT_CONFIG = {
|
|
14591
14768
|
aspectRatio: 16 / 9,
|
|
14592
14769
|
initialHeightPercent: 70,
|
|
@@ -14606,13 +14783,13 @@ function HeroShrinkLayout({
|
|
|
14606
14783
|
...config
|
|
14607
14784
|
};
|
|
14608
14785
|
const { aspectRatio, initialHeightPercent, minHeightPercent, headerHeight } = mergedConfig;
|
|
14609
|
-
const heroRef = (0,
|
|
14610
|
-
const headerRef = (0,
|
|
14611
|
-
const [isClient, setIsClient] = (0,
|
|
14612
|
-
(0,
|
|
14786
|
+
const heroRef = (0, import_react63.useRef)(null);
|
|
14787
|
+
const headerRef = (0, import_react63.useRef)(null);
|
|
14788
|
+
const [isClient, setIsClient] = (0, import_react63.useState)(false);
|
|
14789
|
+
(0, import_react63.useEffect)(() => {
|
|
14613
14790
|
setIsClient(true);
|
|
14614
14791
|
}, []);
|
|
14615
|
-
(0,
|
|
14792
|
+
(0, import_react63.useEffect)(() => {
|
|
14616
14793
|
if (!isClient) return;
|
|
14617
14794
|
const supportsScrollTimeline = CSS.supports("animation-timeline", "scroll()");
|
|
14618
14795
|
if (supportsScrollTimeline) return;
|
|
@@ -14699,15 +14876,15 @@ function HeroShrinkLayout({
|
|
|
14699
14876
|
}
|
|
14700
14877
|
`;
|
|
14701
14878
|
const spacerHeight = `calc(${initialHeightPercent}svh + ${headerHeight}px)`;
|
|
14702
|
-
return /* @__PURE__ */ (0,
|
|
14879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
14703
14880
|
"div",
|
|
14704
14881
|
{
|
|
14705
14882
|
className: `relative min-h-screen ${className}`,
|
|
14706
14883
|
style: { ...style, ...cssVars },
|
|
14707
14884
|
children: [
|
|
14708
|
-
/* @__PURE__ */ (0,
|
|
14709
|
-
/* @__PURE__ */ (0,
|
|
14710
|
-
header && /* @__PURE__ */ (0,
|
|
14885
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("style", { dangerouslySetInnerHTML: { __html: scopedStyles } }),
|
|
14886
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { style: { height: spacerHeight } }),
|
|
14887
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14711
14888
|
"div",
|
|
14712
14889
|
{
|
|
14713
14890
|
ref: headerRef,
|
|
@@ -14716,7 +14893,7 @@ function HeroShrinkLayout({
|
|
|
14716
14893
|
children: header
|
|
14717
14894
|
}
|
|
14718
14895
|
),
|
|
14719
|
-
/* @__PURE__ */ (0,
|
|
14896
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14720
14897
|
"div",
|
|
14721
14898
|
{
|
|
14722
14899
|
ref: heroRef,
|
|
@@ -14724,15 +14901,15 @@ function HeroShrinkLayout({
|
|
|
14724
14901
|
children: hero
|
|
14725
14902
|
}
|
|
14726
14903
|
),
|
|
14727
|
-
/* @__PURE__ */ (0,
|
|
14904
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "relative z-10 bg-background", children })
|
|
14728
14905
|
]
|
|
14729
14906
|
}
|
|
14730
14907
|
);
|
|
14731
14908
|
}
|
|
14732
14909
|
|
|
14733
14910
|
// src/layouts/pdp/ImageEdgeBlur.tsx
|
|
14734
|
-
var
|
|
14735
|
-
var
|
|
14911
|
+
var import_react64 = __toESM(require("react"), 1);
|
|
14912
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
14736
14913
|
var BLUR_CONFIG = {
|
|
14737
14914
|
blur: 24,
|
|
14738
14915
|
crossfade: 68
|
|
@@ -14756,7 +14933,7 @@ var BLUR_LAYERS = [
|
|
|
14756
14933
|
{ blur: Math.round(BLUR_CONFIG.blur * 0.5), zone: 0.6 },
|
|
14757
14934
|
{ blur: BLUR_CONFIG.blur, zone: 1 }
|
|
14758
14935
|
];
|
|
14759
|
-
var ImageEdgeBlur =
|
|
14936
|
+
var ImageEdgeBlur = import_react64.default.memo(
|
|
14760
14937
|
function ImageEdgeBlur2({
|
|
14761
14938
|
imageSrc,
|
|
14762
14939
|
imageCapInfo,
|
|
@@ -14787,7 +14964,7 @@ var ImageEdgeBlur = import_react63.default.memo(
|
|
|
14787
14964
|
viewportWidth / LAYOUT_CONFIG2.IMAGE.ASPECT_RATIO,
|
|
14788
14965
|
maxWidthPx / LAYOUT_CONFIG2.IMAGE.ASPECT_RATIO
|
|
14789
14966
|
);
|
|
14790
|
-
return /* @__PURE__ */ (0,
|
|
14967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14791
14968
|
"div",
|
|
14792
14969
|
{
|
|
14793
14970
|
className: `absolute inset-0 pointer-events-none overflow-hidden ${className}`,
|
|
@@ -14795,7 +14972,7 @@ var ImageEdgeBlur = import_react63.default.memo(
|
|
|
14795
14972
|
children: BLUR_LAYERS.map((layer, index) => {
|
|
14796
14973
|
const layerMask = index === BLUR_LAYERS.length - 1 ? void 0 : `linear-gradient(to right, black 0%, black ${layer.zone * 100}%, transparent ${layer.zone * 100 + 10}%)`;
|
|
14797
14974
|
const blurScale = 1 + layer.blur * 3 / containerHeightPx;
|
|
14798
|
-
return /* @__PURE__ */ (0,
|
|
14975
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14799
14976
|
"img",
|
|
14800
14977
|
{
|
|
14801
14978
|
src: imageSrc,
|
|
@@ -14842,7 +15019,7 @@ var ImageEdgeBlur = import_react63.default.memo(
|
|
|
14842
15019
|
);
|
|
14843
15020
|
|
|
14844
15021
|
// src/layouts/pdp/PDPLayout.tsx
|
|
14845
|
-
var
|
|
15022
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
14846
15023
|
function PDPLayout({
|
|
14847
15024
|
renderHeroImage,
|
|
14848
15025
|
renderContent,
|
|
@@ -14870,15 +15047,15 @@ function PDPLayout({
|
|
|
14870
15047
|
isDesktop,
|
|
14871
15048
|
isWideMonitor: isWideMonitor2
|
|
14872
15049
|
};
|
|
14873
|
-
return /* @__PURE__ */ (0,
|
|
14874
|
-
(isDesktop === false || isDesktop === null) && /* @__PURE__ */ (0,
|
|
14875
|
-
renderMobileCarousel && /* @__PURE__ */ (0,
|
|
14876
|
-
/* @__PURE__ */ (0,
|
|
15050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `pdp-layout ${className}`, children: [
|
|
15051
|
+
(isDesktop === false || isDesktop === null) && /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "md:hidden", children: [
|
|
15052
|
+
renderMobileCarousel && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "mobile-carousel-container", children: renderMobileCarousel({ images: carouselImages }) }),
|
|
15053
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "mobile-content p-4", children: renderContent(contentProps) })
|
|
14877
15054
|
] }),
|
|
14878
|
-
(isDesktop === true || isDesktop === null) && /* @__PURE__ */ (0,
|
|
14879
|
-
/* @__PURE__ */ (0,
|
|
15055
|
+
(isDesktop === true || isDesktop === null) && /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "hidden md:block relative", children: [
|
|
15056
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "desktop-hero relative", children: [
|
|
14880
15057
|
renderHeroImage(heroProps),
|
|
14881
|
-
showEdgeBlur && blurImageSrc && isWideMonitor2 && /* @__PURE__ */ (0,
|
|
15058
|
+
showEdgeBlur && blurImageSrc && isWideMonitor2 && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14882
15059
|
ImageEdgeBlur,
|
|
14883
15060
|
{
|
|
14884
15061
|
imageSrc: blurImageSrc,
|
|
@@ -14889,7 +15066,7 @@ function PDPLayout({
|
|
|
14889
15066
|
}
|
|
14890
15067
|
)
|
|
14891
15068
|
] }),
|
|
14892
|
-
/* @__PURE__ */ (0,
|
|
15069
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14893
15070
|
"div",
|
|
14894
15071
|
{
|
|
14895
15072
|
className: "desktop-sidebar",
|
|
@@ -14906,8 +15083,8 @@ function PDPLayout({
|
|
|
14906
15083
|
}
|
|
14907
15084
|
|
|
14908
15085
|
// src/layouts/pdp/SimpleImageBlur.tsx
|
|
14909
|
-
var
|
|
14910
|
-
var
|
|
15086
|
+
var import_react65 = __toESM(require("react"), 1);
|
|
15087
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
14911
15088
|
var BLUR_CONFIG2 = {
|
|
14912
15089
|
blur: 24,
|
|
14913
15090
|
crossfade: 60
|
|
@@ -14930,7 +15107,7 @@ function getFadeInMask(crossfadeWidth) {
|
|
|
14930
15107
|
black ${crossfadeWidth + 10}px
|
|
14931
15108
|
)`;
|
|
14932
15109
|
}
|
|
14933
|
-
var SimpleImageBlur =
|
|
15110
|
+
var SimpleImageBlur = import_react65.default.memo(function SimpleImageBlur2({
|
|
14934
15111
|
imageSrc,
|
|
14935
15112
|
width,
|
|
14936
15113
|
height = "100%",
|
|
@@ -14940,7 +15117,7 @@ var SimpleImageBlur = import_react64.default.memo(function SimpleImageBlur2({
|
|
|
14940
15117
|
if (!imageSrc || width <= 0) return null;
|
|
14941
15118
|
const fadeInMask = getFadeInMask(BLUR_CONFIG2.crossfade);
|
|
14942
15119
|
const extendedWidth = width + BLUR_CONFIG2.blur * 2;
|
|
14943
|
-
return /* @__PURE__ */ (0,
|
|
15120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14944
15121
|
"div",
|
|
14945
15122
|
{
|
|
14946
15123
|
className: `relative overflow-hidden ${className}`,
|
|
@@ -14953,7 +15130,7 @@ var SimpleImageBlur = import_react64.default.memo(function SimpleImageBlur2({
|
|
|
14953
15130
|
black 0%,
|
|
14954
15131
|
black ${layer.zone * 100}%,
|
|
14955
15132
|
transparent ${layer.zone * 100 + 10}%)`;
|
|
14956
|
-
return /* @__PURE__ */ (0,
|
|
15133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
14957
15134
|
"img",
|
|
14958
15135
|
{
|
|
14959
15136
|
src: imageSrc,
|
|
@@ -14983,8 +15160,8 @@ var SimpleImageBlur = import_react64.default.memo(function SimpleImageBlur2({
|
|
|
14983
15160
|
});
|
|
14984
15161
|
|
|
14985
15162
|
// src/layouts/pdp/EdgeBlurBox.tsx
|
|
14986
|
-
var
|
|
14987
|
-
var
|
|
15163
|
+
var import_react66 = __toESM(require("react"), 1);
|
|
15164
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
14988
15165
|
var BLUR_CONFIG3 = {
|
|
14989
15166
|
blur: 24,
|
|
14990
15167
|
crossfade: 60
|
|
@@ -15008,7 +15185,7 @@ function getFadeOutMask(crossfadeWidth) {
|
|
|
15008
15185
|
transparent 100%
|
|
15009
15186
|
)`;
|
|
15010
15187
|
}
|
|
15011
|
-
var EdgeBlurBox =
|
|
15188
|
+
var EdgeBlurBox = import_react66.default.memo(function EdgeBlurBox2({
|
|
15012
15189
|
imageSrc,
|
|
15013
15190
|
width,
|
|
15014
15191
|
height = "100%",
|
|
@@ -15023,7 +15200,7 @@ var EdgeBlurBox = import_react65.default.memo(function EdgeBlurBox2({
|
|
|
15023
15200
|
const blurExtend = BLUR_CONFIG3.blur * 2;
|
|
15024
15201
|
const actualSharpWidth = sharpImageWidth ?? width + overlapLeft;
|
|
15025
15202
|
const hasOverlap = overlapLeft > 0;
|
|
15026
|
-
return /* @__PURE__ */ (0,
|
|
15203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
15027
15204
|
"div",
|
|
15028
15205
|
{
|
|
15029
15206
|
className: `relative ${className}`,
|
|
@@ -15034,7 +15211,7 @@ var EdgeBlurBox = import_react65.default.memo(function EdgeBlurBox2({
|
|
|
15034
15211
|
overflow: hasOverlap ? "visible" : "hidden"
|
|
15035
15212
|
},
|
|
15036
15213
|
children: [
|
|
15037
|
-
/* @__PURE__ */ (0,
|
|
15214
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
15038
15215
|
"div",
|
|
15039
15216
|
{
|
|
15040
15217
|
style: {
|
|
@@ -15048,7 +15225,7 @@ var EdgeBlurBox = import_react65.default.memo(function EdgeBlurBox2({
|
|
|
15048
15225
|
transparent ${100 - (layer.zone * 100 + 10)}%,
|
|
15049
15226
|
black ${100 - layer.zone * 100}%,
|
|
15050
15227
|
black 100%)`;
|
|
15051
|
-
return /* @__PURE__ */ (0,
|
|
15228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
15052
15229
|
"img",
|
|
15053
15230
|
{
|
|
15054
15231
|
src: imageSrc,
|
|
@@ -15076,7 +15253,7 @@ var EdgeBlurBox = import_react65.default.memo(function EdgeBlurBox2({
|
|
|
15076
15253
|
})
|
|
15077
15254
|
}
|
|
15078
15255
|
),
|
|
15079
|
-
/* @__PURE__ */ (0,
|
|
15256
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
15080
15257
|
"img",
|
|
15081
15258
|
{
|
|
15082
15259
|
src: imageSrc,
|
|
@@ -15104,8 +15281,8 @@ var EdgeBlurBox = import_react65.default.memo(function EdgeBlurBox2({
|
|
|
15104
15281
|
});
|
|
15105
15282
|
|
|
15106
15283
|
// src/layouts/pdp/ImageBlurExtension.tsx
|
|
15107
|
-
var
|
|
15108
|
-
var
|
|
15284
|
+
var import_react67 = __toESM(require("react"), 1);
|
|
15285
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
15109
15286
|
var BLUR_CONFIG4 = {
|
|
15110
15287
|
blur: 24,
|
|
15111
15288
|
crossfadeWidth: 80
|
|
@@ -15128,7 +15305,7 @@ function getFadeOutMask2(crossfadeWidth) {
|
|
|
15128
15305
|
transparent 100%
|
|
15129
15306
|
)`;
|
|
15130
15307
|
}
|
|
15131
|
-
var ImageBlurExtension =
|
|
15308
|
+
var ImageBlurExtension = import_react67.default.memo(function ImageBlurExtension2({
|
|
15132
15309
|
imageSrc,
|
|
15133
15310
|
width,
|
|
15134
15311
|
height,
|
|
@@ -15142,7 +15319,7 @@ var ImageBlurExtension = import_react66.default.memo(function ImageBlurExtension
|
|
|
15142
15319
|
const internalImageLeft = `calc(${heroImageLeft} - 100vw + ${width}px)`;
|
|
15143
15320
|
const fadeOutMask = getFadeOutMask2(crossfadeWidth);
|
|
15144
15321
|
const heightValue = typeof height === "number" ? `${height}px` : height;
|
|
15145
|
-
return /* @__PURE__ */ (0,
|
|
15322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
15146
15323
|
"div",
|
|
15147
15324
|
{
|
|
15148
15325
|
className: `relative overflow-hidden ${className}`,
|
|
@@ -15151,7 +15328,7 @@ var ImageBlurExtension = import_react66.default.memo(function ImageBlurExtension
|
|
|
15151
15328
|
height: heightValue
|
|
15152
15329
|
},
|
|
15153
15330
|
children: [
|
|
15154
|
-
BLUR_LAYERS4.map((layer, index) => /* @__PURE__ */ (0,
|
|
15331
|
+
BLUR_LAYERS4.map((layer, index) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
15155
15332
|
"img",
|
|
15156
15333
|
{
|
|
15157
15334
|
src: imageSrc,
|
|
@@ -15175,7 +15352,7 @@ var ImageBlurExtension = import_react66.default.memo(function ImageBlurExtension
|
|
|
15175
15352
|
},
|
|
15176
15353
|
`blur-${index}`
|
|
15177
15354
|
)),
|
|
15178
|
-
/* @__PURE__ */ (0,
|
|
15355
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
15179
15356
|
"img",
|
|
15180
15357
|
{
|
|
15181
15358
|
src: imageSrc,
|
|
@@ -15203,39 +15380,39 @@ var ImageBlurExtension = import_react66.default.memo(function ImageBlurExtension
|
|
|
15203
15380
|
});
|
|
15204
15381
|
|
|
15205
15382
|
// src/design-system/ColorSwatch.tsx
|
|
15206
|
-
var
|
|
15383
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
15207
15384
|
function ColorTokenSwatch({ name, cssVar, className = "" }) {
|
|
15208
|
-
return /* @__PURE__ */ (0,
|
|
15209
|
-
/* @__PURE__ */ (0,
|
|
15385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `flex flex-col gap-1 ${className}`, children: [
|
|
15386
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
15210
15387
|
"div",
|
|
15211
15388
|
{
|
|
15212
15389
|
className: "h-16 w-full rounded-lg border border-border shadow-sm",
|
|
15213
15390
|
style: { backgroundColor: `var(${cssVar})` }
|
|
15214
15391
|
}
|
|
15215
15392
|
),
|
|
15216
|
-
/* @__PURE__ */ (0,
|
|
15217
|
-
/* @__PURE__ */ (0,
|
|
15393
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "text-sm font-medium text-foreground", children: name }),
|
|
15394
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("code", { className: "text-xs text-muted-foreground font-mono", children: cssVar })
|
|
15218
15395
|
] });
|
|
15219
15396
|
}
|
|
15220
15397
|
function ColorRow({ name, cssVar, description }) {
|
|
15221
|
-
return /* @__PURE__ */ (0,
|
|
15222
|
-
/* @__PURE__ */ (0,
|
|
15398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex items-center gap-4 py-2", children: [
|
|
15399
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
15223
15400
|
"div",
|
|
15224
15401
|
{
|
|
15225
15402
|
className: "h-10 w-10 rounded-lg border border-border shadow-sm flex-shrink-0",
|
|
15226
15403
|
style: { backgroundColor: `var(${cssVar})` }
|
|
15227
15404
|
}
|
|
15228
15405
|
),
|
|
15229
|
-
/* @__PURE__ */ (0,
|
|
15230
|
-
/* @__PURE__ */ (0,
|
|
15231
|
-
description && /* @__PURE__ */ (0,
|
|
15406
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
15407
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "text-sm font-medium text-foreground", children: name }),
|
|
15408
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "text-xs text-muted-foreground", children: description })
|
|
15232
15409
|
] }),
|
|
15233
|
-
/* @__PURE__ */ (0,
|
|
15410
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("code", { className: "text-xs text-muted-foreground font-mono bg-muted px-2 py-1 rounded", children: cssVar })
|
|
15234
15411
|
] });
|
|
15235
15412
|
}
|
|
15236
15413
|
|
|
15237
15414
|
// src/design-system/ColorPalette.tsx
|
|
15238
|
-
var
|
|
15415
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
15239
15416
|
var COLOR_GROUPS = [
|
|
15240
15417
|
{
|
|
15241
15418
|
name: "Base",
|
|
@@ -15316,17 +15493,17 @@ var COLOR_GROUPS = [
|
|
|
15316
15493
|
}
|
|
15317
15494
|
];
|
|
15318
15495
|
function ColorPalette({ layout = "list", className = "" }) {
|
|
15319
|
-
return /* @__PURE__ */ (0,
|
|
15320
|
-
/* @__PURE__ */ (0,
|
|
15321
|
-
/* @__PURE__ */ (0,
|
|
15322
|
-
layout === "grid" ? /* @__PURE__ */ (0,
|
|
15496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: `space-y-8 ${className}`, children: COLOR_GROUPS.map((group) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("section", { children: [
|
|
15497
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("h3", { className: "text-lg font-semibold text-foreground mb-1", children: group.name }),
|
|
15498
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("p", { className: "text-sm text-muted-foreground mb-4", children: group.description }),
|
|
15499
|
+
layout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "grid grid-cols-2 sm:grid-cols-4 gap-4", children: group.colors.map((color) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15323
15500
|
ColorTokenSwatch,
|
|
15324
15501
|
{
|
|
15325
15502
|
name: color.name,
|
|
15326
15503
|
cssVar: color.cssVar
|
|
15327
15504
|
},
|
|
15328
15505
|
color.cssVar
|
|
15329
|
-
)) }) : /* @__PURE__ */ (0,
|
|
15506
|
+
)) }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "bg-card rounded-lg border border-border p-4 divide-y divide-border", children: group.colors.map((color) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15330
15507
|
ColorRow,
|
|
15331
15508
|
{
|
|
15332
15509
|
name: color.name,
|
|
@@ -15339,7 +15516,7 @@ function ColorPalette({ layout = "list", className = "" }) {
|
|
|
15339
15516
|
}
|
|
15340
15517
|
|
|
15341
15518
|
// src/design-system/TypographyScale.tsx
|
|
15342
|
-
var
|
|
15519
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
15343
15520
|
var FONT_SAMPLES = [
|
|
15344
15521
|
{
|
|
15345
15522
|
name: "Heading",
|
|
@@ -15373,14 +15550,14 @@ var FONT_SAMPLES = [
|
|
|
15373
15550
|
}
|
|
15374
15551
|
];
|
|
15375
15552
|
function TypographyScale({ className = "" }) {
|
|
15376
|
-
return /* @__PURE__ */ (0,
|
|
15377
|
-
/* @__PURE__ */ (0,
|
|
15378
|
-
/* @__PURE__ */ (0,
|
|
15379
|
-
/* @__PURE__ */ (0,
|
|
15553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: `space-y-8 ${className}`, children: FONT_SAMPLES.map((font) => /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("section", { className: "bg-card rounded-lg border border-border p-6", children: [
|
|
15554
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex items-center justify-between mb-4", children: [
|
|
15555
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("h3", { className: "text-lg font-semibold text-foreground", children: font.name }),
|
|
15556
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("code", { className: "text-xs text-muted-foreground font-mono bg-muted px-2 py-1 rounded", children: font.cssVar })
|
|
15380
15557
|
] }),
|
|
15381
|
-
/* @__PURE__ */ (0,
|
|
15382
|
-
/* @__PURE__ */ (0,
|
|
15383
|
-
/* @__PURE__ */ (0,
|
|
15558
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "space-y-4", children: font.sizes.map((size) => /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex items-baseline gap-4", children: [
|
|
15559
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "text-xs text-muted-foreground w-20 flex-shrink-0", children: size }),
|
|
15560
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15384
15561
|
"p",
|
|
15385
15562
|
{
|
|
15386
15563
|
className: `${size} text-foreground`,
|
|
@@ -15399,8 +15576,8 @@ var RADIUS_SAMPLES = [
|
|
|
15399
15576
|
{ name: "Full", value: "9999px" }
|
|
15400
15577
|
];
|
|
15401
15578
|
function RadiusScale({ className = "" }) {
|
|
15402
|
-
return /* @__PURE__ */ (0,
|
|
15403
|
-
/* @__PURE__ */ (0,
|
|
15579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: `space-y-4 ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "grid grid-cols-5 gap-4", children: RADIUS_SAMPLES.map((radius) => /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "flex flex-col items-center gap-2", children: [
|
|
15580
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
15404
15581
|
"div",
|
|
15405
15582
|
{
|
|
15406
15583
|
className: "h-16 w-16 bg-primary",
|
|
@@ -15409,13 +15586,13 @@ function RadiusScale({ className = "" }) {
|
|
|
15409
15586
|
}
|
|
15410
15587
|
}
|
|
15411
15588
|
),
|
|
15412
|
-
/* @__PURE__ */ (0,
|
|
15413
|
-
/* @__PURE__ */ (0,
|
|
15589
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "text-sm font-medium text-foreground", children: radius.name }),
|
|
15590
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("code", { className: "text-xs text-muted-foreground font-mono", children: radius.cssVar || radius.value })
|
|
15414
15591
|
] }, radius.name)) }) });
|
|
15415
15592
|
}
|
|
15416
15593
|
|
|
15417
15594
|
// src/design-system/ThemeSwitcher.tsx
|
|
15418
|
-
var
|
|
15595
|
+
var import_react68 = require("react");
|
|
15419
15596
|
|
|
15420
15597
|
// src/themes/types.ts
|
|
15421
15598
|
var RADIUS_PRESETS = {
|
|
@@ -16583,7 +16760,7 @@ function applyTheme(config) {
|
|
|
16583
16760
|
}
|
|
16584
16761
|
|
|
16585
16762
|
// src/design-system/ThemeSwitcher.tsx
|
|
16586
|
-
var
|
|
16763
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
16587
16764
|
function readThemeFromDOM() {
|
|
16588
16765
|
if (typeof document === "undefined") {
|
|
16589
16766
|
return { themeName: "Linear", isDark: false };
|
|
@@ -16601,10 +16778,10 @@ function readThemeFromDOM() {
|
|
|
16601
16778
|
return { themeName: "Linear", isDark: dark };
|
|
16602
16779
|
}
|
|
16603
16780
|
function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
16604
|
-
const [currentTheme, setCurrentTheme] = (0,
|
|
16605
|
-
const [isDark, setIsDark] = (0,
|
|
16606
|
-
const [isOpen, setIsOpen] = (0,
|
|
16607
|
-
(0,
|
|
16781
|
+
const [currentTheme, setCurrentTheme] = (0, import_react68.useState)("Linear");
|
|
16782
|
+
const [isDark, setIsDark] = (0, import_react68.useState)(false);
|
|
16783
|
+
const [isOpen, setIsOpen] = (0, import_react68.useState)(false);
|
|
16784
|
+
(0, import_react68.useEffect)(() => {
|
|
16608
16785
|
const { themeName, isDark: dark } = readThemeFromDOM();
|
|
16609
16786
|
setCurrentTheme(themeName);
|
|
16610
16787
|
setIsDark(dark);
|
|
@@ -16643,61 +16820,61 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
16643
16820
|
applyTheme(config);
|
|
16644
16821
|
};
|
|
16645
16822
|
const themes = showBaseThemesOnly ? baseThemes : baseThemes;
|
|
16646
|
-
return /* @__PURE__ */ (0,
|
|
16647
|
-
/* @__PURE__ */ (0,
|
|
16648
|
-
/* @__PURE__ */ (0,
|
|
16823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `flex items-center gap-3 ${className}`, children: [
|
|
16824
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "relative", children: [
|
|
16825
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
16649
16826
|
"button",
|
|
16650
16827
|
{
|
|
16651
16828
|
onClick: () => setIsOpen(!isOpen),
|
|
16652
16829
|
className: "flex items-center gap-2 px-4 py-2 bg-card border border-border rounded-lg hover:bg-muted transition-colors text-foreground",
|
|
16653
16830
|
children: [
|
|
16654
|
-
/* @__PURE__ */ (0,
|
|
16655
|
-
/* @__PURE__ */ (0,
|
|
16656
|
-
/* @__PURE__ */ (0,
|
|
16831
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01" }) }),
|
|
16832
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "font-medium", children: currentTheme }),
|
|
16833
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("svg", { className: `w-4 h-4 transition-transform ${isOpen ? "rotate-180" : ""}`, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) })
|
|
16657
16834
|
]
|
|
16658
16835
|
}
|
|
16659
16836
|
),
|
|
16660
|
-
isOpen && /* @__PURE__ */ (0,
|
|
16661
|
-
/* @__PURE__ */ (0,
|
|
16837
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
16838
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
16662
16839
|
"div",
|
|
16663
16840
|
{
|
|
16664
16841
|
className: "fixed inset-0 z-40",
|
|
16665
16842
|
onClick: () => setIsOpen(false)
|
|
16666
16843
|
}
|
|
16667
16844
|
),
|
|
16668
|
-
/* @__PURE__ */ (0,
|
|
16845
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "absolute top-full left-0 mt-2 w-56 max-h-80 overflow-auto bg-card border border-border rounded-lg shadow-lg z-50", children: themes.map((theme) => /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
16669
16846
|
"button",
|
|
16670
16847
|
{
|
|
16671
16848
|
onClick: () => handleThemeSelect(theme.name),
|
|
16672
16849
|
className: `w-full px-4 py-2 text-left hover:bg-muted transition-colors flex items-center gap-3 ${currentTheme === theme.name ? "bg-muted" : ""}`,
|
|
16673
16850
|
children: [
|
|
16674
|
-
/* @__PURE__ */ (0,
|
|
16851
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
16675
16852
|
"div",
|
|
16676
16853
|
{
|
|
16677
16854
|
className: "w-4 h-4 rounded-full border border-border",
|
|
16678
16855
|
style: { backgroundColor: theme.primaryColor || "#888" }
|
|
16679
16856
|
}
|
|
16680
16857
|
),
|
|
16681
|
-
/* @__PURE__ */ (0,
|
|
16682
|
-
currentTheme === theme.name && /* @__PURE__ */ (0,
|
|
16858
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "text-foreground", children: theme.name }),
|
|
16859
|
+
currentTheme === theme.name && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("svg", { className: "w-4 h-4 ml-auto text-primary", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" }) })
|
|
16683
16860
|
]
|
|
16684
16861
|
},
|
|
16685
16862
|
theme.name
|
|
16686
16863
|
)) })
|
|
16687
16864
|
] })
|
|
16688
16865
|
] }),
|
|
16689
|
-
/* @__PURE__ */ (0,
|
|
16866
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
16690
16867
|
"button",
|
|
16691
16868
|
{
|
|
16692
16869
|
onClick: handleDarkModeToggle,
|
|
16693
16870
|
className: "flex items-center gap-2 px-4 py-2 bg-card border border-border rounded-lg hover:bg-muted transition-colors text-foreground",
|
|
16694
16871
|
title: `Switch to ${isDark ? "light" : "dark"} mode`,
|
|
16695
16872
|
children: [
|
|
16696
|
-
isDark ? /* @__PURE__ */ (0,
|
|
16697
|
-
/* @__PURE__ */ (0,
|
|
16698
|
-
/* @__PURE__ */ (0,
|
|
16699
|
-
] }) : /* @__PURE__ */ (0,
|
|
16700
|
-
/* @__PURE__ */ (0,
|
|
16873
|
+
isDark ? /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
|
|
16874
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("circle", { cx: "12", cy: "12", r: "5" }),
|
|
16875
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { d: "M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42" })
|
|
16876
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) }),
|
|
16877
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "text-sm", children: isDark ? "Light" : "Dark" })
|
|
16701
16878
|
]
|
|
16702
16879
|
}
|
|
16703
16880
|
)
|
|
@@ -16705,7 +16882,7 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
16705
16882
|
}
|
|
16706
16883
|
|
|
16707
16884
|
// src/design-system/DesignSystemPage.tsx
|
|
16708
|
-
var
|
|
16885
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
16709
16886
|
function DesignSystemPage({
|
|
16710
16887
|
showThemeSwitcher = true,
|
|
16711
16888
|
showColors = true,
|
|
@@ -16715,29 +16892,29 @@ function DesignSystemPage({
|
|
|
16715
16892
|
colorLayout = "list",
|
|
16716
16893
|
className = ""
|
|
16717
16894
|
}) {
|
|
16718
|
-
return /* @__PURE__ */ (0,
|
|
16719
|
-
/* @__PURE__ */ (0,
|
|
16720
|
-
/* @__PURE__ */ (0,
|
|
16721
|
-
/* @__PURE__ */ (0,
|
|
16722
|
-
/* @__PURE__ */ (0,
|
|
16895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: `max-w-4xl mx-auto px-4 py-8 ${className}`, children: [
|
|
16896
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("header", { className: "mb-12", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4", children: [
|
|
16897
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { children: [
|
|
16898
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("h1", { className: "text-4xl font-bold text-foreground mb-2", children: "Design System" }),
|
|
16899
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { className: "text-lg text-muted-foreground", children: "Visual reference for theme tokens and styles" })
|
|
16723
16900
|
] }),
|
|
16724
|
-
showThemeSwitcher && /* @__PURE__ */ (0,
|
|
16901
|
+
showThemeSwitcher && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ThemeSwitcher, {})
|
|
16725
16902
|
] }) }),
|
|
16726
|
-
showColors && /* @__PURE__ */ (0,
|
|
16727
|
-
/* @__PURE__ */ (0,
|
|
16728
|
-
/* @__PURE__ */ (0,
|
|
16903
|
+
showColors && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("section", { className: "mb-16", children: [
|
|
16904
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Color Palette" }),
|
|
16905
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ColorPalette, { layout: colorLayout })
|
|
16729
16906
|
] }),
|
|
16730
|
-
showTypography && /* @__PURE__ */ (0,
|
|
16731
|
-
/* @__PURE__ */ (0,
|
|
16732
|
-
/* @__PURE__ */ (0,
|
|
16907
|
+
showTypography && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("section", { className: "mb-16", children: [
|
|
16908
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Typography" }),
|
|
16909
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(TypographyScale, {})
|
|
16733
16910
|
] }),
|
|
16734
|
-
showRadius && /* @__PURE__ */ (0,
|
|
16735
|
-
/* @__PURE__ */ (0,
|
|
16736
|
-
/* @__PURE__ */ (0,
|
|
16911
|
+
showRadius && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("section", { className: "mb-16", children: [
|
|
16912
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Border Radius" }),
|
|
16913
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(RadiusScale, {})
|
|
16737
16914
|
] }),
|
|
16738
|
-
showSpacing && /* @__PURE__ */ (0,
|
|
16739
|
-
/* @__PURE__ */ (0,
|
|
16740
|
-
/* @__PURE__ */ (0,
|
|
16915
|
+
showSpacing && /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("section", { className: "mb-16", children: [
|
|
16916
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Spacing Scale" }),
|
|
16917
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(SpacingScale, {})
|
|
16741
16918
|
] })
|
|
16742
16919
|
] });
|
|
16743
16920
|
}
|
|
@@ -16752,31 +16929,31 @@ function SpacingScale() {
|
|
|
16752
16929
|
{ name: "12", value: "3rem" },
|
|
16753
16930
|
{ name: "16", value: "4rem" }
|
|
16754
16931
|
];
|
|
16755
|
-
return /* @__PURE__ */ (0,
|
|
16756
|
-
/* @__PURE__ */ (0,
|
|
16757
|
-
/* @__PURE__ */ (0,
|
|
16932
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "space-y-2", children: spaces.map((space) => /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
16933
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("code", { className: "text-xs text-muted-foreground font-mono w-8", children: space.name }),
|
|
16934
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
16758
16935
|
"div",
|
|
16759
16936
|
{
|
|
16760
16937
|
className: "h-4 bg-primary rounded",
|
|
16761
16938
|
style: { width: space.value }
|
|
16762
16939
|
}
|
|
16763
16940
|
),
|
|
16764
|
-
/* @__PURE__ */ (0,
|
|
16941
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("span", { className: "text-sm text-muted-foreground", children: space.value })
|
|
16765
16942
|
] }, space.name)) });
|
|
16766
16943
|
}
|
|
16767
16944
|
|
|
16768
16945
|
// src/personalization/PersonalizationProvider.tsx
|
|
16769
|
-
var
|
|
16946
|
+
var import_react71 = __toESM(require("react"), 1);
|
|
16770
16947
|
|
|
16771
16948
|
// src/personalization/PersonalizationContext.ts
|
|
16772
|
-
var
|
|
16773
|
-
var PersonalizationContext = (0,
|
|
16949
|
+
var import_react69 = require("react");
|
|
16950
|
+
var PersonalizationContext = (0, import_react69.createContext)(null);
|
|
16774
16951
|
function usePersonalizationContext() {
|
|
16775
|
-
return (0,
|
|
16952
|
+
return (0, import_react69.useContext)(PersonalizationContext);
|
|
16776
16953
|
}
|
|
16777
16954
|
|
|
16778
16955
|
// src/personalization/utils.ts
|
|
16779
|
-
var
|
|
16956
|
+
var import_react70 = require("react");
|
|
16780
16957
|
function normalizeHex(color) {
|
|
16781
16958
|
let hex = color.trim().toUpperCase();
|
|
16782
16959
|
if (hex.length === 4 && hex.startsWith("#")) {
|
|
@@ -16797,8 +16974,8 @@ function isValidImageUrl(url) {
|
|
|
16797
16974
|
}
|
|
16798
16975
|
}
|
|
16799
16976
|
function useDebouncedValue(value, delay) {
|
|
16800
|
-
const [debounced, setDebounced] = (0,
|
|
16801
|
-
(0,
|
|
16977
|
+
const [debounced, setDebounced] = (0, import_react70.useState)(value);
|
|
16978
|
+
(0, import_react70.useEffect)(() => {
|
|
16802
16979
|
const timer = setTimeout(() => setDebounced(value), delay);
|
|
16803
16980
|
return () => clearTimeout(timer);
|
|
16804
16981
|
}, [value, delay]);
|
|
@@ -16819,18 +16996,18 @@ function scrollInputAboveKeyboard(input) {
|
|
|
16819
16996
|
}
|
|
16820
16997
|
|
|
16821
16998
|
// src/personalization/PersonalizationProvider.tsx
|
|
16822
|
-
var
|
|
16999
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
16823
17000
|
function createBridgeFromCanvas(canvasModule) {
|
|
16824
17001
|
const { useEditor, useCommands, useImageBinding } = canvasModule;
|
|
16825
17002
|
function TextBinder({ name, value }) {
|
|
16826
17003
|
const { elements } = useEditor();
|
|
16827
17004
|
const { executeElementUpdate } = useCommands();
|
|
16828
|
-
const elementsRef =
|
|
17005
|
+
const elementsRef = import_react71.default.useRef(elements);
|
|
16829
17006
|
elementsRef.current = elements;
|
|
16830
|
-
const executeRef =
|
|
17007
|
+
const executeRef = import_react71.default.useRef(executeElementUpdate);
|
|
16831
17008
|
executeRef.current = executeElementUpdate;
|
|
16832
|
-
const hasUserInput =
|
|
16833
|
-
|
|
17009
|
+
const hasUserInput = import_react71.default.useRef(false);
|
|
17010
|
+
import_react71.default.useEffect(() => {
|
|
16834
17011
|
if (value == null) return;
|
|
16835
17012
|
if (value === "" && !hasUserInput.current) return;
|
|
16836
17013
|
hasUserInput.current = true;
|
|
@@ -16848,12 +17025,12 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
16848
17025
|
function ColorBinder({ originalColor, newColor }) {
|
|
16849
17026
|
const { elements } = useEditor();
|
|
16850
17027
|
const { executeElementUpdate } = useCommands();
|
|
16851
|
-
const elementsRef =
|
|
17028
|
+
const elementsRef = import_react71.default.useRef(elements);
|
|
16852
17029
|
elementsRef.current = elements;
|
|
16853
|
-
const executeRef =
|
|
17030
|
+
const executeRef = import_react71.default.useRef(executeElementUpdate);
|
|
16854
17031
|
executeRef.current = executeElementUpdate;
|
|
16855
|
-
const appliedColorRef =
|
|
16856
|
-
|
|
17032
|
+
const appliedColorRef = import_react71.default.useRef(normalizeHex(originalColor));
|
|
17033
|
+
import_react71.default.useEffect(() => {
|
|
16857
17034
|
const normalizedNew = normalizeHex(newColor);
|
|
16858
17035
|
if (normalizedNew === appliedColorRef.current) return;
|
|
16859
17036
|
const matchColor = appliedColorRef.current;
|
|
@@ -16893,11 +17070,11 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
16893
17070
|
}
|
|
16894
17071
|
function ImageBinder({ name, value, fit = "cover" }) {
|
|
16895
17072
|
const { setImageUrl } = useImageBinding(name, { fit });
|
|
16896
|
-
const hasUserInput =
|
|
17073
|
+
const hasUserInput = import_react71.default.useRef(false);
|
|
16897
17074
|
const debouncedValue = useDebouncedValue(value, 500);
|
|
16898
|
-
const setImageUrlRef =
|
|
17075
|
+
const setImageUrlRef = import_react71.default.useRef(setImageUrl);
|
|
16899
17076
|
setImageUrlRef.current = setImageUrl;
|
|
16900
|
-
|
|
17077
|
+
import_react71.default.useEffect(() => {
|
|
16901
17078
|
if (debouncedValue == null) return;
|
|
16902
17079
|
if (debouncedValue === "" && !hasUserInput.current) return;
|
|
16903
17080
|
hasUserInput.current = true;
|
|
@@ -16907,15 +17084,15 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
16907
17084
|
return null;
|
|
16908
17085
|
}
|
|
16909
17086
|
return function PersonalizationBridge({ fields = [], values = {} } = {}) {
|
|
16910
|
-
return /* @__PURE__ */ (0,
|
|
17087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_jsx_runtime91.Fragment, { children: fields.map((field) => {
|
|
16911
17088
|
if (field.type === "text") {
|
|
16912
|
-
return /* @__PURE__ */ (0,
|
|
17089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(TextBinder, { name: field.name, value: values[field.name] ?? "" }, `text-${field.name}`);
|
|
16913
17090
|
}
|
|
16914
17091
|
if (field.type === "color") {
|
|
16915
|
-
return /* @__PURE__ */ (0,
|
|
17092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ColorBinder, { originalColor: field.color, newColor: values[field.color] ?? field.color }, `color-${field.color}`);
|
|
16916
17093
|
}
|
|
16917
17094
|
if (field.type === "image") {
|
|
16918
|
-
return /* @__PURE__ */ (0,
|
|
17095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(ImageBinder, { name: field.name, value: values[field.name] ?? "", fit: field.fit ?? "cover" }, `image-${field.name}`);
|
|
16919
17096
|
}
|
|
16920
17097
|
return null;
|
|
16921
17098
|
}) });
|
|
@@ -16937,20 +17114,20 @@ function PersonalizationProvider({
|
|
|
16937
17114
|
children
|
|
16938
17115
|
}) {
|
|
16939
17116
|
const realtime = useRealtimeOptional();
|
|
16940
|
-
const [personValues, setPersonValues] = (0,
|
|
16941
|
-
const [isActive, setIsActive] = (0,
|
|
16942
|
-
const [isExporting, setIsExporting] = (0,
|
|
16943
|
-
const [exportedBlobUrls, setExportedBlobUrls] = (0,
|
|
16944
|
-
const [exportCount, setExportCount] = (0,
|
|
16945
|
-
const blobUrlsRef = (0,
|
|
16946
|
-
const [CanvasComponent, setCanvasComponent] = (0,
|
|
17117
|
+
const [personValues, setPersonValues] = (0, import_react71.useState)(initialValues ?? {});
|
|
17118
|
+
const [isActive, setIsActive] = (0, import_react71.useState)(!!(initialValues && Object.keys(initialValues).length > 0));
|
|
17119
|
+
const [isExporting, setIsExporting] = (0, import_react71.useState)(false);
|
|
17120
|
+
const [exportedBlobUrls, setExportedBlobUrls] = (0, import_react71.useState)({});
|
|
17121
|
+
const [exportCount, setExportCount] = (0, import_react71.useState)(0);
|
|
17122
|
+
const blobUrlsRef = (0, import_react71.useRef)({});
|
|
17123
|
+
const [CanvasComponent, setCanvasComponent] = (0, import_react71.useState)(
|
|
16947
17124
|
cachedCanvasComponent
|
|
16948
17125
|
);
|
|
16949
|
-
const [BridgeComponent, setBridgeComponent] = (0,
|
|
17126
|
+
const [BridgeComponent, setBridgeComponent] = (0, import_react71.useState)(
|
|
16950
17127
|
cachedBridgeComponent
|
|
16951
17128
|
);
|
|
16952
17129
|
const hasFields = fields.length > 0;
|
|
16953
|
-
(0,
|
|
17130
|
+
(0, import_react71.useEffect)(() => {
|
|
16954
17131
|
if (CanvasComponent && BridgeComponent) return;
|
|
16955
17132
|
if (!canvasImport || !hasFields) return;
|
|
16956
17133
|
if (!canvasLoadPromise) {
|
|
@@ -16968,8 +17145,8 @@ function PersonalizationProvider({
|
|
|
16968
17145
|
}
|
|
16969
17146
|
});
|
|
16970
17147
|
}, [CanvasComponent, BridgeComponent, canvasImport, hasFields]);
|
|
16971
|
-
const realtimeEnabledRef = (0,
|
|
16972
|
-
(0,
|
|
17148
|
+
const realtimeEnabledRef = (0, import_react71.useRef)(false);
|
|
17149
|
+
(0, import_react71.useEffect)(() => {
|
|
16973
17150
|
return () => {
|
|
16974
17151
|
for (const url of Object.values(blobUrlsRef.current)) {
|
|
16975
17152
|
try {
|
|
@@ -16979,16 +17156,16 @@ function PersonalizationProvider({
|
|
|
16979
17156
|
}
|
|
16980
17157
|
};
|
|
16981
17158
|
}, []);
|
|
16982
|
-
const updateField = (0,
|
|
17159
|
+
const updateField = (0, import_react71.useCallback)((key, value) => {
|
|
16983
17160
|
setIsActive(true);
|
|
16984
17161
|
setPersonValues((prev) => ({ ...prev, [key]: value }));
|
|
16985
17162
|
}, []);
|
|
16986
|
-
const reset = (0,
|
|
17163
|
+
const reset = (0, import_react71.useCallback)(() => {
|
|
16987
17164
|
setPersonValues({});
|
|
16988
17165
|
setIsActive(false);
|
|
16989
17166
|
setIsExporting(false);
|
|
16990
17167
|
}, []);
|
|
16991
|
-
const handleExport = (0,
|
|
17168
|
+
const handleExport = (0, import_react71.useCallback)(
|
|
16992
17169
|
(exports2) => {
|
|
16993
17170
|
const newUrls = {};
|
|
16994
17171
|
for (const [name, data] of Object.entries(exports2)) {
|
|
@@ -17022,11 +17199,11 @@ function PersonalizationProvider({
|
|
|
17022
17199
|
},
|
|
17023
17200
|
[realtime, placementOverride]
|
|
17024
17201
|
);
|
|
17025
|
-
const handleExportScheduled = (0,
|
|
17202
|
+
const handleExportScheduled = (0, import_react71.useCallback)(() => {
|
|
17026
17203
|
setIsExporting(true);
|
|
17027
17204
|
}, []);
|
|
17028
17205
|
const shouldMountCanvas = CanvasComponent && BridgeComponent && canvasState?.elements && canvasState.elements.length > 0 && (!lazy || isActive);
|
|
17029
|
-
const contextValue =
|
|
17206
|
+
const contextValue = import_react71.default.useMemo(
|
|
17030
17207
|
() => ({
|
|
17031
17208
|
fields,
|
|
17032
17209
|
personValues,
|
|
@@ -17039,8 +17216,8 @@ function PersonalizationProvider({
|
|
|
17039
17216
|
}),
|
|
17040
17217
|
[fields, personValues, updateField, isActive, isExporting, exportedBlobUrls, exportCount, reset]
|
|
17041
17218
|
);
|
|
17042
|
-
return /* @__PURE__ */ (0,
|
|
17043
|
-
shouldMountCanvas && CanvasComponent && BridgeComponent && /* @__PURE__ */ (0,
|
|
17219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(PersonalizationContext.Provider, { value: contextValue, children: [
|
|
17220
|
+
shouldMountCanvas && CanvasComponent && BridgeComponent && /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
17044
17221
|
"div",
|
|
17045
17222
|
{
|
|
17046
17223
|
style: {
|
|
@@ -17053,7 +17230,7 @@ function PersonalizationProvider({
|
|
|
17053
17230
|
pointerEvents: "none"
|
|
17054
17231
|
},
|
|
17055
17232
|
"aria-hidden": true,
|
|
17056
|
-
children: /* @__PURE__ */ (0,
|
|
17233
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
17057
17234
|
CanvasComponent,
|
|
17058
17235
|
{
|
|
17059
17236
|
initialElements: canvasState?.elements,
|
|
@@ -17073,7 +17250,7 @@ function PersonalizationProvider({
|
|
|
17073
17250
|
exportImageQuality: exportConfig?.imageQuality ?? 0.85,
|
|
17074
17251
|
onExport: handleExport,
|
|
17075
17252
|
onExportScheduled: handleExportScheduled,
|
|
17076
|
-
overlay: /* @__PURE__ */ (0,
|
|
17253
|
+
overlay: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(BridgeComponent, { fields, values: personValues })
|
|
17077
17254
|
}
|
|
17078
17255
|
)
|
|
17079
17256
|
},
|
|
@@ -17098,7 +17275,7 @@ function usePersonalizationOptional() {
|
|
|
17098
17275
|
}
|
|
17099
17276
|
|
|
17100
17277
|
// src/personalization/PersonalizationInputs.tsx
|
|
17101
|
-
var
|
|
17278
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
17102
17279
|
function PersonalizationInputs({
|
|
17103
17280
|
className,
|
|
17104
17281
|
inputClassName = "w-full px-4 py-3 rounded-lg border text-base text-foreground placeholder:text-muted-foreground bg-white/50 outline-none focus:ring-2 focus:ring-foreground/20",
|
|
@@ -17122,8 +17299,8 @@ function PersonalizationInputs({
|
|
|
17122
17299
|
scrollInputAboveKeyboard(e.target);
|
|
17123
17300
|
}
|
|
17124
17301
|
};
|
|
17125
|
-
return /* @__PURE__ */ (0,
|
|
17126
|
-
textFields.map((field) => /* @__PURE__ */ (0,
|
|
17302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: className || "flex flex-col gap-3", children: [
|
|
17303
|
+
textFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
17127
17304
|
"input",
|
|
17128
17305
|
{
|
|
17129
17306
|
type: "text",
|
|
@@ -17137,8 +17314,8 @@ function PersonalizationInputs({
|
|
|
17137
17314
|
},
|
|
17138
17315
|
`text-${field.name}`
|
|
17139
17316
|
)),
|
|
17140
|
-
colorFields.map((field) => /* @__PURE__ */ (0,
|
|
17141
|
-
/* @__PURE__ */ (0,
|
|
17317
|
+
colorFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
17318
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
17142
17319
|
"input",
|
|
17143
17320
|
{
|
|
17144
17321
|
type: "color",
|
|
@@ -17147,9 +17324,9 @@ function PersonalizationInputs({
|
|
|
17147
17324
|
onChange: (e) => updateField(field.color, e.target.value)
|
|
17148
17325
|
}
|
|
17149
17326
|
),
|
|
17150
|
-
/* @__PURE__ */ (0,
|
|
17327
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "text-base text-muted-foreground", children: field.label })
|
|
17151
17328
|
] }, `color-${field.color}`)),
|
|
17152
|
-
imageFields.map((field) => /* @__PURE__ */ (0,
|
|
17329
|
+
imageFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
17153
17330
|
"input",
|
|
17154
17331
|
{
|
|
17155
17332
|
type: "text",
|
|
@@ -17167,15 +17344,15 @@ function PersonalizationInputs({
|
|
|
17167
17344
|
}
|
|
17168
17345
|
|
|
17169
17346
|
// src/personalization/usePersonalizationShimmer.ts
|
|
17170
|
-
var
|
|
17347
|
+
var import_react72 = require("react");
|
|
17171
17348
|
function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
17172
17349
|
const personCtx = usePersonalizationContext();
|
|
17173
17350
|
const realtime = useRealtimeOptional();
|
|
17174
|
-
const [shimmerActive, setShimmerActive] = (0,
|
|
17175
|
-
const sdkSettledRef = (0,
|
|
17176
|
-
const manualTriggerRef = (0,
|
|
17177
|
-
const safetyTimeoutRef = (0,
|
|
17178
|
-
const startShimmer = (0,
|
|
17351
|
+
const [shimmerActive, setShimmerActive] = (0, import_react72.useState)(false);
|
|
17352
|
+
const sdkSettledRef = (0, import_react72.useRef)(false);
|
|
17353
|
+
const manualTriggerRef = (0, import_react72.useRef)(false);
|
|
17354
|
+
const safetyTimeoutRef = (0, import_react72.useRef)(void 0);
|
|
17355
|
+
const startShimmer = (0, import_react72.useCallback)(() => {
|
|
17179
17356
|
setShimmerActive(true);
|
|
17180
17357
|
if (safetyTimeoutRef.current) clearTimeout(safetyTimeoutRef.current);
|
|
17181
17358
|
safetyTimeoutRef.current = setTimeout(
|
|
@@ -17187,25 +17364,25 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17187
17364
|
safetyTimeoutMs
|
|
17188
17365
|
);
|
|
17189
17366
|
}, [safetyTimeoutMs]);
|
|
17190
|
-
(0,
|
|
17367
|
+
(0, import_react72.useEffect)(() => {
|
|
17191
17368
|
if (!personCtx?.isActive) return;
|
|
17192
17369
|
sdkSettledRef.current = false;
|
|
17193
17370
|
manualTriggerRef.current = false;
|
|
17194
17371
|
realtime?.resetPipelineSettled();
|
|
17195
17372
|
startShimmer();
|
|
17196
17373
|
}, [personCtx?.personValues, personCtx?.isActive, startShimmer]);
|
|
17197
|
-
const triggerShimmer = (0,
|
|
17374
|
+
const triggerShimmer = (0, import_react72.useCallback)(() => {
|
|
17198
17375
|
sdkSettledRef.current = false;
|
|
17199
17376
|
manualTriggerRef.current = true;
|
|
17200
17377
|
startShimmer();
|
|
17201
17378
|
}, [startShimmer]);
|
|
17202
|
-
(0,
|
|
17379
|
+
(0, import_react72.useEffect)(() => {
|
|
17203
17380
|
if (!realtime?.subscribePipelineSettled) return;
|
|
17204
17381
|
return realtime.subscribePipelineSettled(() => {
|
|
17205
17382
|
sdkSettledRef.current = true;
|
|
17206
17383
|
});
|
|
17207
17384
|
}, [realtime]);
|
|
17208
|
-
(0,
|
|
17385
|
+
(0, import_react72.useEffect)(() => {
|
|
17209
17386
|
const container = containerRef.current;
|
|
17210
17387
|
if (!container) return;
|
|
17211
17388
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -17248,7 +17425,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17248
17425
|
});
|
|
17249
17426
|
return () => observer.disconnect();
|
|
17250
17427
|
}, [containerRef]);
|
|
17251
|
-
(0,
|
|
17428
|
+
(0, import_react72.useEffect)(() => {
|
|
17252
17429
|
return () => {
|
|
17253
17430
|
if (safetyTimeoutRef.current) clearTimeout(safetyTimeoutRef.current);
|
|
17254
17431
|
};
|
|
@@ -17333,6 +17510,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17333
17510
|
FiltersButton,
|
|
17334
17511
|
FiltersDrawer,
|
|
17335
17512
|
FloatingActionGroup,
|
|
17513
|
+
GallerySkipProvider,
|
|
17336
17514
|
HeroCarousel,
|
|
17337
17515
|
HeroProductImage,
|
|
17338
17516
|
HeroShrinkLayout,
|
|
@@ -17362,6 +17540,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17362
17540
|
MobileProductCarousel,
|
|
17363
17541
|
MockupBackground,
|
|
17364
17542
|
MockupPriorityProvider,
|
|
17543
|
+
NO_GALLERY_SKIPS,
|
|
17365
17544
|
PDPLayout,
|
|
17366
17545
|
PersonalizationInputs,
|
|
17367
17546
|
PersonalizationProvider,
|
|
@@ -17462,6 +17641,9 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17462
17641
|
formatCurrency,
|
|
17463
17642
|
formatDate,
|
|
17464
17643
|
formatDateTime,
|
|
17644
|
+
gallerySkipVerdict,
|
|
17645
|
+
gallerySkippedStamp,
|
|
17646
|
+
galleryWithoutSkipped,
|
|
17465
17647
|
getBrand,
|
|
17466
17648
|
getMockupUrl,
|
|
17467
17649
|
getObservedElementCount,
|
|
@@ -17495,6 +17677,8 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17495
17677
|
useDesignOptional,
|
|
17496
17678
|
useDeviceDetection,
|
|
17497
17679
|
useFocusTrap,
|
|
17680
|
+
useGallerySkipOptional,
|
|
17681
|
+
useGallerySkipState,
|
|
17498
17682
|
useHeroZoomScales,
|
|
17499
17683
|
useImagePreloader,
|
|
17500
17684
|
useImageTransition,
|