@snowcone-app/ui 0.11.17 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/index.cjs +937 -676
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +185 -60
- package/dist/index.d.ts +185 -60
- package/dist/index.js +847 -597
- 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 +10 -3
- package/src/composed/carousels/firstView.ts +81 -0
- package/src/composed/renderRefusalProbe.ts +35 -0
- package/src/composed/zoom/EnhancedImageViewer.tsx +68 -1
- package/src/composed/zoom/__tests__/EnhancedImageViewer.firstView.test.tsx +126 -0
- package/src/composed/zoom/types.ts +9 -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.js
CHANGED
|
@@ -5631,6 +5631,28 @@ import {
|
|
|
5631
5631
|
import { useRealtimeMockup as useRealtimeMockup2 } from "@snowcone-app/sdk/react";
|
|
5632
5632
|
import { gallerySizePicture, mockupRole, resolvePreviewVariantId, resolveVariantId as resolveVariantIdUtil } from "@snowcone-app/sdk";
|
|
5633
5633
|
|
|
5634
|
+
// src/patterns/gallerySkipRules.ts
|
|
5635
|
+
import { designRefusalKind } from "@snowcone-app/sdk";
|
|
5636
|
+
function gallerySkipVerdict(code, attempt) {
|
|
5637
|
+
const kind = designRefusalKind(code);
|
|
5638
|
+
if (kind === "skip") return "skip";
|
|
5639
|
+
if (kind === "retry-once") return attempt < 1 ? "retry" : "skip";
|
|
5640
|
+
return "loud";
|
|
5641
|
+
}
|
|
5642
|
+
var NO_GALLERY_SKIPS = /* @__PURE__ */ new Map();
|
|
5643
|
+
function galleryWithoutSkipped(images, skipped) {
|
|
5644
|
+
if (skipped.size === 0) return images;
|
|
5645
|
+
const kept = images.filter((img) => !(img.isRealMockup && img.mockupId && skipped.has(img.mockupId)));
|
|
5646
|
+
if (kept.length === images.length || kept.length === 0) return images;
|
|
5647
|
+
return kept;
|
|
5648
|
+
}
|
|
5649
|
+
function gallerySkippedStamp(skipped, shown) {
|
|
5650
|
+
if (skipped.size === 0) return void 0;
|
|
5651
|
+
const shownIds = new Set(shown.map((img) => img.mockupId).filter(Boolean));
|
|
5652
|
+
const parts = [...skipped].filter(([id]) => !shownIds.has(id)).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([id, code]) => `${id}:${code}`);
|
|
5653
|
+
return parts.length ? parts.join(" ") : void 0;
|
|
5654
|
+
}
|
|
5655
|
+
|
|
5634
5656
|
// src/patterns/MockupBackground.tsx
|
|
5635
5657
|
import { createContext as createContext7, useContext as useContext5 } from "react";
|
|
5636
5658
|
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
@@ -5811,6 +5833,9 @@ function RealtimeProvider({
|
|
|
5811
5833
|
);
|
|
5812
5834
|
const resetSessionRef = useRef12(() => {
|
|
5813
5835
|
});
|
|
5836
|
+
const designRefusalSubscribersRef = useRef12(/* @__PURE__ */ new Set());
|
|
5837
|
+
const designBusySeenRef = useRef12(/* @__PURE__ */ new Map());
|
|
5838
|
+
const designRetryRef = useRef12(null);
|
|
5814
5839
|
const realtimeMockup = useRealtimeMockup2({
|
|
5815
5840
|
wsUrl,
|
|
5816
5841
|
getToken: useSessionGrant ? getToken : void 0,
|
|
@@ -5851,6 +5876,23 @@ function RealtimeProvider({
|
|
|
5851
5876
|
const id = detail.mockupId;
|
|
5852
5877
|
setUnavailableMockups((prev) => prev.get(id)?.code === detail.code ? prev : new Map(prev).set(id, detail));
|
|
5853
5878
|
}
|
|
5879
|
+
},
|
|
5880
|
+
onDesignRefusal: (refusal) => {
|
|
5881
|
+
const seen = designBusySeenRef.current.get(refusal.mockupId) ?? 0;
|
|
5882
|
+
const verdict = gallerySkipVerdict(refusal.code, seen);
|
|
5883
|
+
if (verdict === "retry") {
|
|
5884
|
+
designBusySeenRef.current.set(refusal.mockupId, seen + 1);
|
|
5885
|
+
designRetryRef.current?.([refusal.mockupId]);
|
|
5886
|
+
return;
|
|
5887
|
+
}
|
|
5888
|
+
if (verdict !== "skip") return;
|
|
5889
|
+
if (designRefusalSubscribersRef.current.size === 0) {
|
|
5890
|
+
const id = refusal.mockupId;
|
|
5891
|
+
const detail = { code: refusal.code, message: refusal.message, mockupId: id };
|
|
5892
|
+
setUnavailableMockups((prev) => prev.get(id)?.code === detail.code ? prev : new Map(prev).set(id, detail));
|
|
5893
|
+
return;
|
|
5894
|
+
}
|
|
5895
|
+
designRefusalSubscribersRef.current.forEach((cb) => cb(refusal));
|
|
5854
5896
|
}
|
|
5855
5897
|
});
|
|
5856
5898
|
const subscribeRTCTiming = useCallback10((_callback) => {
|
|
@@ -6098,6 +6140,7 @@ function RealtimeProvider({
|
|
|
6098
6140
|
},
|
|
6099
6141
|
[rerenderRaw]
|
|
6100
6142
|
);
|
|
6143
|
+
designRetryRef.current = sendRerenderPaced;
|
|
6101
6144
|
const rerenderFullFrame = useCallback10(
|
|
6102
6145
|
(mockupId) => {
|
|
6103
6146
|
fullFrameRerenderIdsRef.current.add(mockupId);
|
|
@@ -6242,6 +6285,7 @@ function RealtimeProvider({
|
|
|
6242
6285
|
else merged.push(result);
|
|
6243
6286
|
});
|
|
6244
6287
|
mockupResultsRef.current = merged;
|
|
6288
|
+
results.forEach((result) => designBusySeenRef.current.delete(result.mockupId));
|
|
6245
6289
|
if (pendingRerenderRef.current.length > 0) {
|
|
6246
6290
|
const delivered = new Set(results.map((r) => r.mockupId));
|
|
6247
6291
|
pendingRerenderRef.current = pendingRerenderRef.current.filter((id) => !delivered.has(id));
|
|
@@ -6506,6 +6550,7 @@ function RealtimeProvider({
|
|
|
6506
6550
|
const resetSession = useCallback10(() => {
|
|
6507
6551
|
configSentRef.current = false;
|
|
6508
6552
|
dueByVersionRef.current.clear();
|
|
6553
|
+
designBusySeenRef.current.clear();
|
|
6509
6554
|
setUnavailableMockups((prev) => prev.size ? /* @__PURE__ */ new Map() : prev);
|
|
6510
6555
|
lastSentVariantIdRef.current = null;
|
|
6511
6556
|
lastSentBgRef.current = void 0;
|
|
@@ -6891,6 +6936,13 @@ function RealtimeProvider({
|
|
|
6891
6936
|
subscribeBlobSentRef.current = subscribeBlobSent;
|
|
6892
6937
|
subscribePipelineSettledRef.current = subscribePipelineSettled;
|
|
6893
6938
|
subscribePendingExportCancelledRef.current = subscribePendingExportCancelled;
|
|
6939
|
+
const subscribeDesignRefusals = useCallback10((callback) => {
|
|
6940
|
+
const subscribers = designRefusalSubscribersRef.current;
|
|
6941
|
+
subscribers.add(callback);
|
|
6942
|
+
return () => {
|
|
6943
|
+
subscribers.delete(callback);
|
|
6944
|
+
};
|
|
6945
|
+
}, []);
|
|
6894
6946
|
const stableSubscribeMockupResults = useCallback10(
|
|
6895
6947
|
(callback) => {
|
|
6896
6948
|
return subscribeMockupResultsRef.current(callback);
|
|
@@ -6960,6 +7012,7 @@ function RealtimeProvider({
|
|
|
6960
7012
|
isConfigured,
|
|
6961
7013
|
renderError,
|
|
6962
7014
|
unavailableMockups,
|
|
7015
|
+
subscribeDesignRefusals,
|
|
6963
7016
|
// Read from ref - this is a snapshot at render time, NOT reactive
|
|
6964
7017
|
// For reactive updates, use getMockupResultsImmediate() or subscribe functions
|
|
6965
7018
|
get mockupResults() {
|
|
@@ -7016,6 +7069,7 @@ function RealtimeProvider({
|
|
|
7016
7069
|
isConfigured,
|
|
7017
7070
|
renderError,
|
|
7018
7071
|
unavailableMockups,
|
|
7072
|
+
subscribeDesignRefusals,
|
|
7019
7073
|
// mockupResults removed from deps - it's a getter that reads from ref
|
|
7020
7074
|
canvasExportSize,
|
|
7021
7075
|
mockupWidth,
|
|
@@ -9913,17 +9967,80 @@ var LoadingOverlayPrismCandyInline = memo2(
|
|
|
9913
9967
|
import { useRealtimeMockup as useRealtimeMockup3 } from "@snowcone-app/sdk/react";
|
|
9914
9968
|
import { getProduct as getProduct3, listProducts as listProducts4, getMockupUrl } from "@snowcone-app/sdk";
|
|
9915
9969
|
|
|
9916
|
-
// src/patterns/
|
|
9917
|
-
import { createContext as createContext10, useContext as useContext8, useMemo as useMemo13 } from "react";
|
|
9970
|
+
// src/patterns/GallerySkip.tsx
|
|
9971
|
+
import { createContext as createContext10, useCallback as useCallback18, useContext as useContext8, useEffect as useEffect29, useMemo as useMemo13, useRef as useRef21, useState as useState28 } from "react";
|
|
9918
9972
|
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
9919
|
-
var
|
|
9973
|
+
var GallerySkipContext = createContext10(void 0);
|
|
9974
|
+
function useGallerySkipState(design) {
|
|
9975
|
+
const realtime = useRealtimeOptional();
|
|
9976
|
+
const [entries, setEntries] = useState28(() => /* @__PURE__ */ new Map());
|
|
9977
|
+
const entriesRef = useRef21(entries);
|
|
9978
|
+
entriesRef.current = entries;
|
|
9979
|
+
const designRef = useRef21(design);
|
|
9980
|
+
designRef.current = design;
|
|
9981
|
+
const getResults = realtime?.getMockupResultsImmediate;
|
|
9982
|
+
const frameOfRef = useRef21((mockupId) => getResults?.().find((r) => r.mockupId === mockupId)?.imageUrl ?? null);
|
|
9983
|
+
frameOfRef.current = (mockupId) => getResults?.().find((r) => r.mockupId === mockupId)?.imageUrl ?? null;
|
|
9984
|
+
const report = useCallback18((mockupId, code) => {
|
|
9985
|
+
const at = designRef.current;
|
|
9986
|
+
const realtimeUrl = frameOfRef.current(mockupId);
|
|
9987
|
+
setEntries((prev) => {
|
|
9988
|
+
const e = prev.get(mockupId);
|
|
9989
|
+
if (e && e.code === code && e.design === at) return prev;
|
|
9990
|
+
return new Map(prev).set(mockupId, { code, design: at, realtimeUrl });
|
|
9991
|
+
});
|
|
9992
|
+
}, []);
|
|
9993
|
+
const subscribeDesignRefusals = realtime?.subscribeDesignRefusals;
|
|
9994
|
+
useEffect29(() => {
|
|
9995
|
+
if (!subscribeDesignRefusals) return;
|
|
9996
|
+
return subscribeDesignRefusals((refusal) => report(refusal.mockupId, refusal.code));
|
|
9997
|
+
}, [subscribeDesignRefusals, report]);
|
|
9998
|
+
const subscribeMockupResults = realtime?.subscribeMockupResults;
|
|
9999
|
+
useEffect29(() => {
|
|
10000
|
+
if (!subscribeMockupResults) return;
|
|
10001
|
+
return subscribeMockupResults((results) => {
|
|
10002
|
+
const current = entriesRef.current;
|
|
10003
|
+
if (current.size === 0) return;
|
|
10004
|
+
const back = results.filter((r) => {
|
|
10005
|
+
const e = current.get(r.mockupId);
|
|
10006
|
+
if (!e) return false;
|
|
10007
|
+
return !!r.imageUrl && r.imageUrl !== e.realtimeUrl;
|
|
10008
|
+
});
|
|
10009
|
+
if (back.length === 0) return;
|
|
10010
|
+
setEntries((prev) => {
|
|
10011
|
+
const next = new Map(prev);
|
|
10012
|
+
back.forEach((r) => next.delete(r.mockupId));
|
|
10013
|
+
return next;
|
|
10014
|
+
});
|
|
10015
|
+
});
|
|
10016
|
+
}, [subscribeMockupResults]);
|
|
10017
|
+
const skipped = useMemo13(() => {
|
|
10018
|
+
const m = /* @__PURE__ */ new Map();
|
|
10019
|
+
entries.forEach((e, id) => {
|
|
10020
|
+
if (e.design === design) m.set(id, e.code);
|
|
10021
|
+
});
|
|
10022
|
+
return m;
|
|
10023
|
+
}, [entries, design]);
|
|
10024
|
+
return useMemo13(() => ({ skipped, report }), [skipped, report]);
|
|
10025
|
+
}
|
|
10026
|
+
function GallerySkipProvider({ value, children }) {
|
|
10027
|
+
return /* @__PURE__ */ jsx57(GallerySkipContext.Provider, { value, children });
|
|
10028
|
+
}
|
|
10029
|
+
function useGallerySkipOptional() {
|
|
10030
|
+
return useContext8(GallerySkipContext);
|
|
10031
|
+
}
|
|
10032
|
+
|
|
10033
|
+
// src/patterns/PlacementArt.tsx
|
|
10034
|
+
import { createContext as createContext11, useContext as useContext9, useMemo as useMemo14 } from "react";
|
|
10035
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
10036
|
+
var PlacementArtContext = createContext11(null);
|
|
9920
10037
|
function PlacementArt({ art, children }) {
|
|
9921
10038
|
const key = art ? JSON.stringify(art) : "";
|
|
9922
|
-
const value =
|
|
9923
|
-
return /* @__PURE__ */
|
|
10039
|
+
const value = useMemo14(() => key ? JSON.parse(key) : null, [key]);
|
|
10040
|
+
return /* @__PURE__ */ jsx58(PlacementArtContext.Provider, { value, children });
|
|
9924
10041
|
}
|
|
9925
10042
|
function usePlacementArtOptional() {
|
|
9926
|
-
return
|
|
10043
|
+
return useContext9(PlacementArtContext);
|
|
9927
10044
|
}
|
|
9928
10045
|
function placementArtFor(art, placement, fallback) {
|
|
9929
10046
|
if (!art) return fallback;
|
|
@@ -9931,7 +10048,7 @@ function placementArtFor(art, placement, fallback) {
|
|
|
9931
10048
|
}
|
|
9932
10049
|
|
|
9933
10050
|
// src/patterns/ProductPageProvider.tsx
|
|
9934
|
-
import { jsx as
|
|
10051
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
9935
10052
|
function ProductPageProvider({
|
|
9936
10053
|
children,
|
|
9937
10054
|
productId,
|
|
@@ -9945,12 +10062,12 @@ function ProductPageProvider({
|
|
|
9945
10062
|
realtimeGrantUrl,
|
|
9946
10063
|
enablePriority = true
|
|
9947
10064
|
}) {
|
|
9948
|
-
let content = /* @__PURE__ */
|
|
10065
|
+
let content = /* @__PURE__ */ jsx59(Product, { productId, productData, children });
|
|
9949
10066
|
if (enablePriority) {
|
|
9950
|
-
content = /* @__PURE__ */
|
|
10067
|
+
content = /* @__PURE__ */ jsx59(MockupPriorityProvider, { children: content });
|
|
9951
10068
|
}
|
|
9952
10069
|
if (enableRealtime) {
|
|
9953
|
-
content = /* @__PURE__ */
|
|
10070
|
+
content = /* @__PURE__ */ jsx59(
|
|
9954
10071
|
RealtimeProvider,
|
|
9955
10072
|
{
|
|
9956
10073
|
wsUrl: realtimeWsUrl,
|
|
@@ -9960,7 +10077,7 @@ function ProductPageProvider({
|
|
|
9960
10077
|
}
|
|
9961
10078
|
);
|
|
9962
10079
|
}
|
|
9963
|
-
return /* @__PURE__ */
|
|
10080
|
+
return /* @__PURE__ */ jsx59(
|
|
9964
10081
|
Shop,
|
|
9965
10082
|
{
|
|
9966
10083
|
endpoint,
|
|
@@ -9980,31 +10097,31 @@ function ProductPageProviderMinimal({
|
|
|
9980
10097
|
shop,
|
|
9981
10098
|
initialArtwork
|
|
9982
10099
|
}) {
|
|
9983
|
-
return /* @__PURE__ */
|
|
10100
|
+
return /* @__PURE__ */ jsx59(
|
|
9984
10101
|
Shop,
|
|
9985
10102
|
{
|
|
9986
10103
|
endpoint,
|
|
9987
10104
|
mockupUrl,
|
|
9988
10105
|
shop,
|
|
9989
10106
|
initialArtwork,
|
|
9990
|
-
children: /* @__PURE__ */
|
|
10107
|
+
children: /* @__PURE__ */ jsx59(Product, { productId, productData, children })
|
|
9991
10108
|
}
|
|
9992
10109
|
);
|
|
9993
10110
|
}
|
|
9994
10111
|
|
|
9995
10112
|
// src/composed/ArtAlignment.tsx
|
|
9996
10113
|
import {
|
|
9997
|
-
useRef as
|
|
9998
|
-
useState as
|
|
9999
|
-
useEffect as
|
|
10000
|
-
useMemo as
|
|
10114
|
+
useRef as useRef22,
|
|
10115
|
+
useState as useState29,
|
|
10116
|
+
useEffect as useEffect30,
|
|
10117
|
+
useMemo as useMemo15
|
|
10001
10118
|
} from "react";
|
|
10002
10119
|
import { useDrag } from "@use-gesture/react";
|
|
10003
10120
|
import {
|
|
10004
10121
|
describeProductArtAlignment,
|
|
10005
10122
|
getSnapPoints
|
|
10006
10123
|
} from "@snowcone-app/sdk";
|
|
10007
|
-
import { Fragment as Fragment12, jsx as
|
|
10124
|
+
import { Fragment as Fragment12, jsx as jsx60, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
10008
10125
|
function ArtAlignment({
|
|
10009
10126
|
src: propSrc,
|
|
10010
10127
|
artworkAspectRatio: propAspectRatio,
|
|
@@ -10038,16 +10155,16 @@ function ArtAlignment({
|
|
|
10038
10155
|
selection: {}
|
|
10039
10156
|
};
|
|
10040
10157
|
}
|
|
10041
|
-
const containerRef =
|
|
10042
|
-
const imageRef =
|
|
10043
|
-
const lastUserDragTimeRef =
|
|
10044
|
-
const [containerSize, setContainerSize] =
|
|
10045
|
-
const [position, setPosition] =
|
|
10046
|
-
const [isReady, setIsReady] =
|
|
10047
|
-
const [detectedAspectRatio, setDetectedAspectRatio] =
|
|
10158
|
+
const containerRef = useRef22(null);
|
|
10159
|
+
const imageRef = useRef22(null);
|
|
10160
|
+
const lastUserDragTimeRef = useRef22(0);
|
|
10161
|
+
const [containerSize, setContainerSize] = useState29({ width: 0, height: 0 });
|
|
10162
|
+
const [position, setPosition] = useState29({ x: 0, y: 0 });
|
|
10163
|
+
const [isReady, setIsReady] = useState29(false);
|
|
10164
|
+
const [detectedAspectRatio, setDetectedAspectRatio] = useState29();
|
|
10048
10165
|
const effectiveAspectRatio = artworkAspectRatio || detectedAspectRatio;
|
|
10049
10166
|
const alignment = placementDesign?.alignment || propAlignment || "center";
|
|
10050
|
-
const descriptor =
|
|
10167
|
+
const descriptor = useMemo15(
|
|
10051
10168
|
() => describeProductArtAlignment(
|
|
10052
10169
|
{
|
|
10053
10170
|
src,
|
|
@@ -10069,7 +10186,7 @@ function ArtAlignment({
|
|
|
10069
10186
|
productContext
|
|
10070
10187
|
]
|
|
10071
10188
|
);
|
|
10072
|
-
const containerStyle =
|
|
10189
|
+
const containerStyle = useMemo15(() => {
|
|
10073
10190
|
const style = {};
|
|
10074
10191
|
if (height !== void 0) {
|
|
10075
10192
|
const heightValue = typeof height === "number" ? height : parseFloat(height);
|
|
@@ -10100,7 +10217,7 @@ function ArtAlignment({
|
|
|
10100
10217
|
}
|
|
10101
10218
|
return style;
|
|
10102
10219
|
}, [effectiveAspectRatio, height, maxHeight, minHeight]);
|
|
10103
|
-
|
|
10220
|
+
useEffect30(() => {
|
|
10104
10221
|
if (!containerRef.current) return;
|
|
10105
10222
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
10106
10223
|
const entry = entries[0];
|
|
@@ -10126,7 +10243,7 @@ function ArtAlignment({
|
|
|
10126
10243
|
}
|
|
10127
10244
|
}
|
|
10128
10245
|
};
|
|
10129
|
-
|
|
10246
|
+
useEffect30(() => {
|
|
10130
10247
|
if (!imageRef.current || !descriptor) return;
|
|
10131
10248
|
if (imageRef.current.complete) {
|
|
10132
10249
|
setIsReady(true);
|
|
@@ -10151,7 +10268,7 @@ function ArtAlignment({
|
|
|
10151
10268
|
img.removeEventListener("load", handleLoad);
|
|
10152
10269
|
};
|
|
10153
10270
|
}, [descriptor?.src, artworkAspectRatio]);
|
|
10154
|
-
const maskDimensions =
|
|
10271
|
+
const maskDimensions = useMemo15(() => {
|
|
10155
10272
|
if (!isReady || containerSize.width === 0 || !descriptor) {
|
|
10156
10273
|
return { width: 0, height: 0 };
|
|
10157
10274
|
}
|
|
@@ -10166,14 +10283,14 @@ function ArtAlignment({
|
|
|
10166
10283
|
descriptor?.effectiveAlignment,
|
|
10167
10284
|
isReady
|
|
10168
10285
|
]);
|
|
10169
|
-
const clipPathCoords =
|
|
10286
|
+
const clipPathCoords = useMemo15(() => {
|
|
10170
10287
|
const halfMaskW = maskDimensions.width / 2;
|
|
10171
10288
|
const halfMaskH = maskDimensions.height / 2;
|
|
10172
10289
|
const halfContainerW = containerSize.width / 2;
|
|
10173
10290
|
const halfContainerH = containerSize.height / 2;
|
|
10174
10291
|
return { halfMaskW, halfMaskH, halfContainerW, halfContainerH };
|
|
10175
10292
|
}, [maskDimensions.width, maskDimensions.height, containerSize.width, containerSize.height]);
|
|
10176
|
-
|
|
10293
|
+
useEffect30(() => {
|
|
10177
10294
|
if (Date.now() - lastUserDragTimeRef.current < 500) return;
|
|
10178
10295
|
if (!isReady || maskDimensions.width === 0 || !descriptor) return;
|
|
10179
10296
|
const points = getSnapPoints(
|
|
@@ -10195,7 +10312,7 @@ function ArtAlignment({
|
|
|
10195
10312
|
maskDimensions.height,
|
|
10196
10313
|
isReady
|
|
10197
10314
|
]);
|
|
10198
|
-
const overlayStyle =
|
|
10315
|
+
const overlayStyle = useMemo15(() => {
|
|
10199
10316
|
const { halfMaskW, halfMaskH, halfContainerW, halfContainerH } = clipPathCoords;
|
|
10200
10317
|
const cx = position.x + halfContainerW;
|
|
10201
10318
|
const cy = position.y + halfContainerH;
|
|
@@ -10216,7 +10333,7 @@ function ArtAlignment({
|
|
|
10216
10333
|
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"
|
|
10217
10334
|
};
|
|
10218
10335
|
}, [isReady, position.x, position.y, clipPathCoords]);
|
|
10219
|
-
const maskStyle =
|
|
10336
|
+
const maskStyle = useMemo15(() => ({
|
|
10220
10337
|
width: `${maskDimensions.width}px`,
|
|
10221
10338
|
height: `${maskDimensions.height}px`,
|
|
10222
10339
|
boxShadow: `0 0 0 2px var(--color-background), 0 0 0 4px var(--color-primary)`,
|
|
@@ -10231,7 +10348,7 @@ function ArtAlignment({
|
|
|
10231
10348
|
// GPU acceleration for smoother drag
|
|
10232
10349
|
borderRadius: "var(--radius-image, 4px)"
|
|
10233
10350
|
}), [maskDimensions.width, maskDimensions.height]);
|
|
10234
|
-
const clearImageClipPath =
|
|
10351
|
+
const clearImageClipPath = useMemo15(() => {
|
|
10235
10352
|
if (!isReady) return "none";
|
|
10236
10353
|
const { halfMaskW, halfMaskH, halfContainerW, halfContainerH } = clipPathCoords;
|
|
10237
10354
|
const cx = position.x + halfContainerW;
|
|
@@ -10242,12 +10359,12 @@ function ArtAlignment({
|
|
|
10242
10359
|
const top = cy - halfMaskH;
|
|
10243
10360
|
return `polygon(${left}px ${top}px, ${right}px ${top}px, ${right}px ${bottom}px, ${left}px ${bottom}px)`;
|
|
10244
10361
|
}, [isReady, position.x, position.y, clipPathCoords]);
|
|
10245
|
-
const maskTransform =
|
|
10362
|
+
const maskTransform = useMemo15(() => {
|
|
10246
10363
|
return descriptor?.effectiveAlignment === "horizontal" ? `translate(calc(-50% + ${position.x}px), -50%)` : `translate(-50%, calc(-50% + ${position.y}px))`;
|
|
10247
10364
|
}, [descriptor?.effectiveAlignment, position.x, position.y]);
|
|
10248
|
-
const lastContextUpdateTimeRef =
|
|
10249
|
-
const pendingAlignmentRef =
|
|
10250
|
-
const throttleTimeoutRef =
|
|
10365
|
+
const lastContextUpdateTimeRef = useRef22(0);
|
|
10366
|
+
const pendingAlignmentRef = useRef22(null);
|
|
10367
|
+
const throttleTimeoutRef = useRef22(null);
|
|
10251
10368
|
const THROTTLE_MS = 150;
|
|
10252
10369
|
const bind = useDrag(
|
|
10253
10370
|
({ offset: [ox, oy], last }) => {
|
|
@@ -10342,7 +10459,7 @@ function ArtAlignment({
|
|
|
10342
10459
|
if (!descriptor) {
|
|
10343
10460
|
return null;
|
|
10344
10461
|
}
|
|
10345
|
-
return /* @__PURE__ */
|
|
10462
|
+
return /* @__PURE__ */ jsx60(
|
|
10346
10463
|
"div",
|
|
10347
10464
|
{
|
|
10348
10465
|
className: `relative ${className || ""}`,
|
|
@@ -10351,8 +10468,8 @@ function ArtAlignment({
|
|
|
10351
10468
|
width: "fit-content",
|
|
10352
10469
|
maxWidth: "100%"
|
|
10353
10470
|
},
|
|
10354
|
-
children: /* @__PURE__ */
|
|
10355
|
-
/* @__PURE__ */
|
|
10471
|
+
children: /* @__PURE__ */ jsx60("div", { className: "overflow-hidden p-1", children: /* @__PURE__ */ jsxs36("div", { ref: containerRef, className: "relative", style: containerStyle, children: [
|
|
10472
|
+
/* @__PURE__ */ jsx60(
|
|
10356
10473
|
"img",
|
|
10357
10474
|
{
|
|
10358
10475
|
ref: imageRef,
|
|
@@ -10378,8 +10495,8 @@ function ArtAlignment({
|
|
|
10378
10495
|
}
|
|
10379
10496
|
),
|
|
10380
10497
|
isReady && maskDimensions.width > 0 && /* @__PURE__ */ jsxs36(Fragment12, { children: [
|
|
10381
|
-
/* @__PURE__ */
|
|
10382
|
-
/* @__PURE__ */
|
|
10498
|
+
/* @__PURE__ */ jsx60("div", { style: overlayStyle }),
|
|
10499
|
+
/* @__PURE__ */ jsx60(
|
|
10383
10500
|
"img",
|
|
10384
10501
|
{
|
|
10385
10502
|
src: descriptor.src,
|
|
@@ -10407,7 +10524,7 @@ function ArtAlignment({
|
|
|
10407
10524
|
loading: "eager"
|
|
10408
10525
|
}
|
|
10409
10526
|
),
|
|
10410
|
-
/* @__PURE__ */
|
|
10527
|
+
/* @__PURE__ */ jsx60(
|
|
10411
10528
|
"div",
|
|
10412
10529
|
{
|
|
10413
10530
|
...bind(),
|
|
@@ -10424,8 +10541,8 @@ function ArtAlignment({
|
|
|
10424
10541
|
}
|
|
10425
10542
|
|
|
10426
10543
|
// src/composed/ArtworkCustomizer.tsx
|
|
10427
|
-
import { useEffect as
|
|
10428
|
-
import { jsx as
|
|
10544
|
+
import { useEffect as useEffect31 } from "react";
|
|
10545
|
+
import { jsx as jsx61, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
10429
10546
|
function ArtworkCustomizer(props) {
|
|
10430
10547
|
const designContext = useDesign();
|
|
10431
10548
|
const artwork = props.artwork || designContext.selectedArtwork;
|
|
@@ -10437,7 +10554,7 @@ function ArtworkCustomizer(props) {
|
|
|
10437
10554
|
const placements = productCtx?.product?.placements || [];
|
|
10438
10555
|
const selectedPlacement = productCtx?.selectedPlacement;
|
|
10439
10556
|
const setSelectedPlacement = productCtx?.setSelectedPlacement;
|
|
10440
|
-
|
|
10557
|
+
useEffect31(() => {
|
|
10441
10558
|
if (placements.length > 0 && !selectedPlacement && setSelectedPlacement) {
|
|
10442
10559
|
setSelectedPlacement(placements[0].label);
|
|
10443
10560
|
}
|
|
@@ -10447,13 +10564,13 @@ function ArtworkCustomizer(props) {
|
|
|
10447
10564
|
);
|
|
10448
10565
|
const isColorPlacement = currentPlacement?.type === "color";
|
|
10449
10566
|
const isFitMode = currentPlacement?.defaultScaleMode === "fit";
|
|
10450
|
-
|
|
10567
|
+
useEffect31(() => {
|
|
10451
10568
|
}, [selectedPlacement]);
|
|
10452
10569
|
if (!artwork) {
|
|
10453
|
-
return /* @__PURE__ */
|
|
10570
|
+
return /* @__PURE__ */ jsx61("div", { className: `text-sm text-muted-foreground ${props.className || ""}`, children: "Select artwork to customize" });
|
|
10454
10571
|
}
|
|
10455
10572
|
if (artwork.type === "pattern") {
|
|
10456
|
-
return /* @__PURE__ */
|
|
10573
|
+
return /* @__PURE__ */ jsx61(
|
|
10457
10574
|
TileCount,
|
|
10458
10575
|
{
|
|
10459
10576
|
artwork,
|
|
@@ -10465,7 +10582,7 @@ function ArtworkCustomizer(props) {
|
|
|
10465
10582
|
}
|
|
10466
10583
|
const isCanvasEditorMode = props.mode === "canvas" || !!props.children && props.mode !== "alignment";
|
|
10467
10584
|
return /* @__PURE__ */ jsxs37("div", { className: "flex flex-col gap-4", children: [
|
|
10468
|
-
placements.length > 1 && /* @__PURE__ */
|
|
10585
|
+
placements.length > 1 && /* @__PURE__ */ jsx61("div", { className: "text-sm leading-relaxed", children: placements.map((p) => /* @__PURE__ */ jsx61(
|
|
10469
10586
|
"button",
|
|
10470
10587
|
{
|
|
10471
10588
|
onClick: () => setSelectedPlacement?.(p.label),
|
|
@@ -10474,7 +10591,7 @@ function ArtworkCustomizer(props) {
|
|
|
10474
10591
|
},
|
|
10475
10592
|
p.label
|
|
10476
10593
|
)) }),
|
|
10477
|
-
isColorPlacement ? /* @__PURE__ */
|
|
10594
|
+
isColorPlacement ? /* @__PURE__ */ jsx61(ColorPicker2, { placement: selectedPlacement }) : isFitMode ? null : /* @__PURE__ */ jsx61("div", { className: "relative", children: props.children || /* @__PURE__ */ jsx61(
|
|
10478
10595
|
ArtAlignment,
|
|
10479
10596
|
{
|
|
10480
10597
|
artwork: { src: artwork.src },
|
|
@@ -10495,7 +10612,7 @@ import {
|
|
|
10495
10612
|
Shapes as LucideShapes,
|
|
10496
10613
|
Upload as LucideUpload
|
|
10497
10614
|
} from "lucide-react";
|
|
10498
|
-
import { jsx as
|
|
10615
|
+
import { jsx as jsx62, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
10499
10616
|
var ImageIcon = LucideImage;
|
|
10500
10617
|
var TypeIcon = LucideType;
|
|
10501
10618
|
var ShapesIcon = LucideShapes;
|
|
@@ -10507,54 +10624,77 @@ function CanvasEditor({
|
|
|
10507
10624
|
children
|
|
10508
10625
|
}) {
|
|
10509
10626
|
return /* @__PURE__ */ jsxs38("div", { className: "flex flex-col gap-6", children: [
|
|
10510
|
-
/* @__PURE__ */
|
|
10627
|
+
/* @__PURE__ */ jsx62("div", { className: "bg-background border-2 border-border rounded-lg aspect-square overflow-hidden relative", children: children || /* @__PURE__ */ jsx62("div", { className: "flex items-center justify-center w-full h-full", children: /* @__PURE__ */ jsx62("div", { className: "text-muted-foreground text-sm", children: "No editor provided" }) }) }),
|
|
10511
10628
|
/* @__PURE__ */ jsxs38("div", { className: "flex items-center justify-center gap-8 py-2", children: [
|
|
10512
|
-
/* @__PURE__ */
|
|
10629
|
+
/* @__PURE__ */ jsx62(
|
|
10513
10630
|
"button",
|
|
10514
10631
|
{
|
|
10515
10632
|
onClick: onOpenImageGallery,
|
|
10516
10633
|
className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",
|
|
10517
10634
|
"aria-label": "Open image gallery",
|
|
10518
|
-
children: /* @__PURE__ */
|
|
10635
|
+
children: /* @__PURE__ */ jsx62("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ jsx62(ImageIcon, { className: "w-6 h-6" }) })
|
|
10519
10636
|
}
|
|
10520
10637
|
),
|
|
10521
|
-
/* @__PURE__ */
|
|
10638
|
+
/* @__PURE__ */ jsx62(
|
|
10522
10639
|
"button",
|
|
10523
10640
|
{
|
|
10524
10641
|
onClick: onOpenTypography,
|
|
10525
10642
|
className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors",
|
|
10526
10643
|
"aria-label": "Add text",
|
|
10527
|
-
children: /* @__PURE__ */
|
|
10644
|
+
children: /* @__PURE__ */ jsx62("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ jsx62(TypeIcon, { className: "w-6 h-6" }) })
|
|
10528
10645
|
}
|
|
10529
10646
|
),
|
|
10530
|
-
/* @__PURE__ */
|
|
10531
|
-
/* @__PURE__ */
|
|
10647
|
+
/* @__PURE__ */ jsx62("button", { className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ jsx62("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ jsx62(ShapesIcon, { className: "w-6 h-6" }) }) }),
|
|
10648
|
+
/* @__PURE__ */ jsx62("button", { className: "flex flex-col items-center gap-2 text-muted-foreground hover:text-foreground transition-colors", children: /* @__PURE__ */ jsx62("div", { className: "w-10 h-10 flex items-center justify-center", children: /* @__PURE__ */ jsx62(UploadIcon, { className: "w-6 h-6" }) }) })
|
|
10532
10649
|
] })
|
|
10533
10650
|
] });
|
|
10534
10651
|
}
|
|
10535
10652
|
|
|
10536
10653
|
// src/composed/HeroProductImage.tsx
|
|
10537
10654
|
import {
|
|
10538
|
-
useMemo as
|
|
10539
|
-
useState as
|
|
10540
|
-
useEffect as
|
|
10541
|
-
useRef as
|
|
10655
|
+
useMemo as useMemo16,
|
|
10656
|
+
useState as useState32,
|
|
10657
|
+
useEffect as useEffect33,
|
|
10658
|
+
useRef as useRef24,
|
|
10542
10659
|
memo as memo3,
|
|
10543
|
-
useCallback as
|
|
10660
|
+
useCallback as useCallback19
|
|
10544
10661
|
} from "react";
|
|
10662
|
+
|
|
10663
|
+
// src/composed/renderRefusalProbe.ts
|
|
10664
|
+
import { renderRefusalCodeOf } from "@snowcone-app/sdk";
|
|
10665
|
+
async function probeRenderAnswer(url, fetchImpl = fetch) {
|
|
10666
|
+
let res;
|
|
10667
|
+
try {
|
|
10668
|
+
res = await fetchImpl(url, { mode: "cors", cache: "reload", credentials: "omit" });
|
|
10669
|
+
} catch {
|
|
10670
|
+
return { ok: false, status: 0, code: null };
|
|
10671
|
+
}
|
|
10672
|
+
if (res.ok) return { ok: true, status: res.status, code: null };
|
|
10673
|
+
let body = null;
|
|
10674
|
+
try {
|
|
10675
|
+
const text = await res.text();
|
|
10676
|
+
body = text ? JSON.parse(text) : null;
|
|
10677
|
+
} catch {
|
|
10678
|
+
body = null;
|
|
10679
|
+
}
|
|
10680
|
+
return { ok: false, status: res.status, code: renderRefusalCodeOf(body, res.headers.get("x-render-reason")) };
|
|
10681
|
+
}
|
|
10682
|
+
|
|
10683
|
+
// src/composed/HeroProductImage.tsx
|
|
10545
10684
|
import {
|
|
10546
10685
|
createDesignForPlacements,
|
|
10547
10686
|
resolveVariantId,
|
|
10548
10687
|
resolvePreviewVariantId as resolvePreviewVariantId2,
|
|
10549
10688
|
resolveMockupId,
|
|
10550
|
-
SNOWCONE_HOSTS
|
|
10689
|
+
SNOWCONE_HOSTS,
|
|
10690
|
+
isDesignRefusalCode
|
|
10551
10691
|
} from "@snowcone-app/sdk";
|
|
10552
10692
|
|
|
10553
10693
|
// src/hooks/viewport/useContainerWidth.ts
|
|
10554
|
-
import { useState as
|
|
10694
|
+
import { useState as useState31, useLayoutEffect as useLayoutEffect5, useEffect as useEffect32, useRef as useRef23 } from "react";
|
|
10555
10695
|
function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
10556
|
-
const [width, setWidth] =
|
|
10557
|
-
const resizeTimeoutRef =
|
|
10696
|
+
const [width, setWidth] = useState31(0);
|
|
10697
|
+
const resizeTimeoutRef = useRef23(null);
|
|
10558
10698
|
useLayoutEffect5(() => {
|
|
10559
10699
|
const el = containerRef.current;
|
|
10560
10700
|
if (!el) return;
|
|
@@ -10563,7 +10703,7 @@ function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
|
10563
10703
|
const dpr = window.devicePixelRatio ?? 1;
|
|
10564
10704
|
setWidth(Math.min(Math.round(cssWidth * dpr), maxWidth));
|
|
10565
10705
|
}, [containerRef, maxWidth]);
|
|
10566
|
-
|
|
10706
|
+
useEffect32(() => {
|
|
10567
10707
|
const measure = () => {
|
|
10568
10708
|
const el = containerRef.current;
|
|
10569
10709
|
if (!el) return;
|
|
@@ -10586,7 +10726,7 @@ function useContainerWidth(containerRef, maxWidth = 3e3) {
|
|
|
10586
10726
|
}
|
|
10587
10727
|
|
|
10588
10728
|
// src/composed/HeroProductImage.tsx
|
|
10589
|
-
import { jsx as
|
|
10729
|
+
import { jsx as jsx63, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
10590
10730
|
function buildHeroMockupUrl(args) {
|
|
10591
10731
|
const snow = typeof window !== "undefined" && window.snowcone || {};
|
|
10592
10732
|
return heroMockupUrl({ ...args, shop: snow.shop, resolver: snow.resolver });
|
|
@@ -10602,6 +10742,7 @@ function heroSize(stripView, cropWidth, width) {
|
|
|
10602
10742
|
return { width };
|
|
10603
10743
|
}
|
|
10604
10744
|
var EMPTY_IMAGES = [];
|
|
10745
|
+
var DESIGN_BUSY_RETRY_MS = 1500;
|
|
10605
10746
|
function blockingSessionError(error) {
|
|
10606
10747
|
return error && !error.retryable ? error.code : null;
|
|
10607
10748
|
}
|
|
@@ -10655,28 +10796,31 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10655
10796
|
const mockupBg = useMockupBackgroundOptional();
|
|
10656
10797
|
const placementArt = usePlacementArtOptional();
|
|
10657
10798
|
const placementArtKey = placementArt ? JSON.stringify(placementArt) : "";
|
|
10658
|
-
const
|
|
10799
|
+
const gallerySkip = useGallerySkipOptional();
|
|
10800
|
+
const gallerySkipRef = useRef24(gallerySkip);
|
|
10801
|
+
gallerySkipRef.current = gallerySkip;
|
|
10802
|
+
const priorityContextRef = useRef24(priorityContext);
|
|
10659
10803
|
priorityContextRef.current = priorityContext;
|
|
10660
|
-
const contextRef =
|
|
10804
|
+
const contextRef = useRef24(context);
|
|
10661
10805
|
contextRef.current = context;
|
|
10662
10806
|
const actualProductId = product?.id || productId || context?.product?.id;
|
|
10663
|
-
const selectedGvid =
|
|
10807
|
+
const selectedGvid = useMemo16(() => {
|
|
10664
10808
|
return resolveVariantId(context, gvid, variantId);
|
|
10665
10809
|
}, [gvid, variantId, context?.selection, context?.combinations]);
|
|
10666
|
-
const actualMockupId =
|
|
10810
|
+
const actualMockupId = useMemo16(() => {
|
|
10667
10811
|
return resolveMockupId(context, selectedGvid, mockupId);
|
|
10668
10812
|
}, [mockupId, selectedGvid, context]);
|
|
10669
|
-
const actualGvid =
|
|
10813
|
+
const actualGvid = useMemo16(() => {
|
|
10670
10814
|
return gvid || variantId ? selectedGvid : resolvePreviewVariantId2(context, selectedGvid, actualMockupId);
|
|
10671
10815
|
}, [gvid, variantId, selectedGvid, actualMockupId, context]);
|
|
10672
10816
|
const unavailable = actualMockupId ? realtimeContext?.unavailableMockups?.get(actualMockupId) ?? null : null;
|
|
10673
10817
|
const artworkSrc = artwork?.src;
|
|
10674
10818
|
const selectedArtworkSrc = designContext?.selectedArtwork?.src;
|
|
10675
10819
|
const effectiveArtworkSrc = artworkSrc || selectedArtworkSrc;
|
|
10676
|
-
const containerRef =
|
|
10820
|
+
const containerRef = useRef24(null);
|
|
10677
10821
|
const measuredWidth = useContainerWidth(containerRef);
|
|
10678
10822
|
const width = widthProp ?? measuredWidth;
|
|
10679
|
-
const initialStaticUrl =
|
|
10823
|
+
const initialStaticUrl = useMemo16(() => {
|
|
10680
10824
|
if (realtimeUrl) return null;
|
|
10681
10825
|
if (mode === "realtime") return null;
|
|
10682
10826
|
if (typeof window !== "undefined" && window.snowcone?.signMockupUrl) {
|
|
@@ -10747,31 +10891,31 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10747
10891
|
shimmerDelay,
|
|
10748
10892
|
initialUrl: realtimeUrl || initialStaticUrl
|
|
10749
10893
|
});
|
|
10750
|
-
const [error, setError] =
|
|
10751
|
-
const [isInPreloadZone, setIsInPreloadZone] =
|
|
10752
|
-
const componentIdRef =
|
|
10894
|
+
const [error, setError] = useState32(null);
|
|
10895
|
+
const [isInPreloadZone, setIsInPreloadZone] = useState32(true);
|
|
10896
|
+
const componentIdRef = useRef24(
|
|
10753
10897
|
`hero-product-image-${Math.random().toString(36).substr(2, 9)}`
|
|
10754
10898
|
);
|
|
10755
|
-
const [containerMounted, setContainerMounted] =
|
|
10756
|
-
const setContainerRef =
|
|
10899
|
+
const [containerMounted, setContainerMounted] = useState32(false);
|
|
10900
|
+
const setContainerRef = useCallback19((node) => {
|
|
10757
10901
|
containerRef.current = node;
|
|
10758
10902
|
setContainerMounted(!!node);
|
|
10759
10903
|
}, []);
|
|
10760
|
-
const lastUrlRef =
|
|
10761
|
-
const priorityRegisteredRef =
|
|
10762
|
-
const onLoadCalledRef =
|
|
10763
|
-
const prevArtworkSrcRef =
|
|
10764
|
-
const realtimeArtworkSrcRef =
|
|
10765
|
-
const hasReceivedRealtimeRef =
|
|
10766
|
-
const isPendingExportRef =
|
|
10767
|
-
const onUrlGeneratedRef =
|
|
10904
|
+
const lastUrlRef = useRef24(realtimeUrl ?? initialStaticUrl ?? null);
|
|
10905
|
+
const priorityRegisteredRef = useRef24(false);
|
|
10906
|
+
const onLoadCalledRef = useRef24(false);
|
|
10907
|
+
const prevArtworkSrcRef = useRef24(void 0);
|
|
10908
|
+
const realtimeArtworkSrcRef = useRef24(void 0);
|
|
10909
|
+
const hasReceivedRealtimeRef = useRef24(false);
|
|
10910
|
+
const isPendingExportRef = useRef24(false);
|
|
10911
|
+
const onUrlGeneratedRef = useRef24(onUrlGenerated);
|
|
10768
10912
|
onUrlGeneratedRef.current = onUrlGenerated;
|
|
10769
|
-
const onShownRef =
|
|
10913
|
+
const onShownRef = useRef24(onShown);
|
|
10770
10914
|
onShownRef.current = onShown;
|
|
10771
|
-
const presignedUsedRef =
|
|
10772
|
-
const layersLengthRef =
|
|
10915
|
+
const presignedUsedRef = useRef24(false);
|
|
10916
|
+
const layersLengthRef = useRef24(layers.length);
|
|
10773
10917
|
layersLengthRef.current = layers.length;
|
|
10774
|
-
|
|
10918
|
+
useEffect33(() => {
|
|
10775
10919
|
if (initialPriority === 1) return;
|
|
10776
10920
|
if (!containerMounted || !containerRef.current) return;
|
|
10777
10921
|
if (isInPreloadZone) return;
|
|
@@ -10790,7 +10934,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10790
10934
|
);
|
|
10791
10935
|
return unobserve;
|
|
10792
10936
|
}, [containerMounted, initialPriority, isInPreloadZone]);
|
|
10793
|
-
|
|
10937
|
+
useEffect33(() => {
|
|
10794
10938
|
if (!realtimeUrl) return;
|
|
10795
10939
|
if (realtimeUrl === lastUrlRef.current) return;
|
|
10796
10940
|
lastUrlRef.current = realtimeUrl;
|
|
@@ -10798,7 +10942,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10798
10942
|
const isInitialLoad = layersLengthRef.current === 0;
|
|
10799
10943
|
addLayerDirectly(realtimeUrl, { skipTransition: isInitialLoad });
|
|
10800
10944
|
}, [realtimeUrl, addLayerDirectly, actualMockupId, placement]);
|
|
10801
|
-
|
|
10945
|
+
useEffect33(() => {
|
|
10802
10946
|
if (mode === "static") {
|
|
10803
10947
|
return;
|
|
10804
10948
|
}
|
|
@@ -10842,7 +10986,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10842
10986
|
addLayerDirectly
|
|
10843
10987
|
// NOTE: layers.length removed - use layersLengthRef instead to prevent duplicate requests
|
|
10844
10988
|
]);
|
|
10845
|
-
|
|
10989
|
+
useEffect33(() => {
|
|
10846
10990
|
if (mode === "static") return;
|
|
10847
10991
|
if (!realtimeContext?.subscribePendingBlob || !placement) return;
|
|
10848
10992
|
const handlePendingExport = (pendingPlacement) => {
|
|
@@ -10855,38 +10999,38 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10855
10999
|
unsubscribe?.();
|
|
10856
11000
|
};
|
|
10857
11001
|
}, [mode, realtimeContext?.subscribePendingBlob, placement]);
|
|
10858
|
-
const renderVersionRef =
|
|
10859
|
-
const arrivedVersionRef =
|
|
10860
|
-
const versionByUrlRef =
|
|
10861
|
-
const loadedUrlRef =
|
|
10862
|
-
const blobConsumerRef =
|
|
11002
|
+
const renderVersionRef = useRef24(0);
|
|
11003
|
+
const arrivedVersionRef = useRef24(0);
|
|
11004
|
+
const versionByUrlRef = useRef24(/* @__PURE__ */ new Map());
|
|
11005
|
+
const loadedUrlRef = useRef24(null);
|
|
11006
|
+
const blobConsumerRef = useRef24(`el-${Math.random().toString(36).slice(2, 10)}`);
|
|
10863
11007
|
const releaseBlobConsumer = realtimeContext?.releaseBlobConsumer;
|
|
10864
|
-
|
|
11008
|
+
useEffect33(() => {
|
|
10865
11009
|
const id = actualMockupId;
|
|
10866
11010
|
const consumer = blobConsumerRef.current;
|
|
10867
11011
|
return () => {
|
|
10868
11012
|
if (id) releaseBlobConsumer?.(id, consumer);
|
|
10869
11013
|
};
|
|
10870
11014
|
}, [actualMockupId, releaseBlobConsumer]);
|
|
10871
|
-
const frameErrorRef =
|
|
10872
|
-
const showVersionOf =
|
|
11015
|
+
const frameErrorRef = useRef24(null);
|
|
11016
|
+
const showVersionOf = useCallback19((url) => {
|
|
10873
11017
|
const e = versionByUrlRef.current.get(url);
|
|
10874
11018
|
if (!e || e.v < renderVersionRef.current) return;
|
|
10875
11019
|
renderVersionRef.current = e.v;
|
|
10876
11020
|
renderVersionsRef.current = e.versions;
|
|
10877
11021
|
frameErrorRef.current = null;
|
|
10878
11022
|
}, []);
|
|
10879
|
-
const renderVersionsRef =
|
|
11023
|
+
const renderVersionsRef = useRef24(null);
|
|
10880
11024
|
const getLatestSentVersions = realtimeContext?.getLatestSentVersions;
|
|
10881
|
-
const refusalCodeRef =
|
|
11025
|
+
const refusalCodeRef = useRef24(null);
|
|
10882
11026
|
refusalCodeRef.current = unavailable?.code ?? null;
|
|
10883
|
-
const frameFailedRef =
|
|
11027
|
+
const frameFailedRef = useRef24(realtimeContext?.frameFailed);
|
|
10884
11028
|
frameFailedRef.current = realtimeContext?.frameFailed;
|
|
10885
|
-
const sessionErrorCodeRef =
|
|
11029
|
+
const sessionErrorCodeRef = useRef24(null);
|
|
10886
11030
|
sessionErrorCodeRef.current = blockingSessionError(realtimeContext?.renderError);
|
|
10887
11031
|
const getCanvasVersion = realtimeContext?.getCanvasVersion;
|
|
10888
11032
|
const getSessionShape = realtimeContext?.getSessionShape;
|
|
10889
|
-
const applyRenderStamp =
|
|
11033
|
+
const applyRenderStamp = useCallback19(() => {
|
|
10890
11034
|
const node = containerRef.current;
|
|
10891
11035
|
if (!node) return;
|
|
10892
11036
|
if (mode === "static") {
|
|
@@ -10920,12 +11064,12 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10920
11064
|
node.dataset.sessionPhase = shape.phase;
|
|
10921
11065
|
}
|
|
10922
11066
|
}, [getCanvasVersion, getLatestSentVersions, getSessionShape, mode]);
|
|
10923
|
-
const applyRenderStampRef =
|
|
11067
|
+
const applyRenderStampRef = useRef24(applyRenderStamp);
|
|
10924
11068
|
applyRenderStampRef.current = applyRenderStamp;
|
|
10925
|
-
|
|
11069
|
+
useEffect33(() => {
|
|
10926
11070
|
applyRenderStamp();
|
|
10927
11071
|
});
|
|
10928
|
-
|
|
11072
|
+
useEffect33(() => {
|
|
10929
11073
|
const subscribeSent = realtimeContext?.subscribeBlobSent;
|
|
10930
11074
|
const subscribeResult = realtimeContext?.subscribeMockupResultById;
|
|
10931
11075
|
if (!actualMockupId || !subscribeSent || !subscribeResult) return;
|
|
@@ -10952,7 +11096,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10952
11096
|
applyRenderStamp
|
|
10953
11097
|
]);
|
|
10954
11098
|
const reportPictureView = realtimeContext?.reportPictureView;
|
|
10955
|
-
|
|
11099
|
+
useEffect33(() => {
|
|
10956
11100
|
if (!viewportPolicy || !reportPictureView || !actualMockupId) return;
|
|
10957
11101
|
const node = containerRef.current;
|
|
10958
11102
|
if (!node || typeof IntersectionObserver === "undefined") return;
|
|
@@ -10984,7 +11128,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10984
11128
|
reportPictureView(key, null);
|
|
10985
11129
|
};
|
|
10986
11130
|
}, [viewportPolicy, reportPictureView, actualMockupId]);
|
|
10987
|
-
|
|
11131
|
+
useEffect33(() => {
|
|
10988
11132
|
if (!priorityContext || !actualMockupId || !placement) return;
|
|
10989
11133
|
priorityContext.registerMockup(actualMockupId, placement, initialPriority);
|
|
10990
11134
|
priorityRegisteredRef.current = true;
|
|
@@ -10995,7 +11139,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10995
11139
|
}
|
|
10996
11140
|
};
|
|
10997
11141
|
}, [priorityContext, actualMockupId, placement, initialPriority]);
|
|
10998
|
-
|
|
11142
|
+
useEffect33(() => {
|
|
10999
11143
|
if (!priorityContext?.updateElementRef || !actualMockupId) return;
|
|
11000
11144
|
if (containerMounted && containerRef.current) {
|
|
11001
11145
|
priorityContext.updateElementRef(actualMockupId, containerRef.current);
|
|
@@ -11009,7 +11153,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11009
11153
|
const artworkTileCount = artwork?.type === "pattern" ? artwork?.tileCount : void 0;
|
|
11010
11154
|
const selectedArtworkType = designContext?.selectedArtwork?.type;
|
|
11011
11155
|
const selectedArtworkTileCount = designContext?.selectedArtwork?.type === "pattern" ? designContext?.selectedArtwork?.tileCount : void 0;
|
|
11012
|
-
|
|
11156
|
+
useEffect33(() => {
|
|
11013
11157
|
const currentSrc = artIdentity(artworkSrc || selectedArtworkSrc, placementArtKey);
|
|
11014
11158
|
if (currentSrc !== prevArtworkSrcRef.current) {
|
|
11015
11159
|
lastUrlRef.current = null;
|
|
@@ -11019,11 +11163,11 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11019
11163
|
realtimeArtworkSrcRef.current = void 0;
|
|
11020
11164
|
}
|
|
11021
11165
|
}, [artworkSrc, selectedArtworkSrc, placementArtKey]);
|
|
11022
|
-
const contextSelectionRef =
|
|
11023
|
-
const contextOptionAttributesRef =
|
|
11166
|
+
const contextSelectionRef = useRef24(context?.selection);
|
|
11167
|
+
const contextOptionAttributesRef = useRef24(context?.optionAttributes);
|
|
11024
11168
|
contextSelectionRef.current = context?.selection;
|
|
11025
11169
|
contextOptionAttributesRef.current = context?.optionAttributes;
|
|
11026
|
-
const createDesignForPlacementsWrapper =
|
|
11170
|
+
const createDesignForPlacementsWrapper = useCallback19(
|
|
11027
11171
|
(placements, providedImages) => {
|
|
11028
11172
|
const effectiveArtworkSrc2 = artworkSrc || selectedArtworkSrc;
|
|
11029
11173
|
if (!effectiveArtworkSrc2 || effectiveArtworkSrc2.trim() === "" || effectiveArtworkSrc2 === "undefined" || effectiveArtworkSrc2 === "null") {
|
|
@@ -11063,7 +11207,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11063
11207
|
selectedArtworkTileCount
|
|
11064
11208
|
]
|
|
11065
11209
|
);
|
|
11066
|
-
|
|
11210
|
+
useEffect33(() => {
|
|
11067
11211
|
if (mode === "realtime") return;
|
|
11068
11212
|
if (initialStaticUrl && lastUrlRef.current === initialStaticUrl) {
|
|
11069
11213
|
return;
|
|
@@ -11171,12 +11315,15 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11171
11315
|
const topLayer = layers[layers.length - 1];
|
|
11172
11316
|
const displayUrl = topLayer?.url || realtimeUrl || initialStaticUrl;
|
|
11173
11317
|
const CROSSFADE_MS = 400;
|
|
11174
|
-
const [prevUrl, setPrevUrl] =
|
|
11175
|
-
const [showNew, setShowNew] =
|
|
11176
|
-
const [renderedUrl, setRenderedUrl] =
|
|
11177
|
-
const
|
|
11178
|
-
|
|
11179
|
-
const [
|
|
11318
|
+
const [prevUrl, setPrevUrl] = useState32(null);
|
|
11319
|
+
const [showNew, setShowNew] = useState32(false);
|
|
11320
|
+
const [renderedUrl, setRenderedUrl] = useState32(displayUrl);
|
|
11321
|
+
const renderedUrlRef = useRef24(renderedUrl);
|
|
11322
|
+
renderedUrlRef.current = renderedUrl;
|
|
11323
|
+
const [designRefused, setDesignRefused] = useState32(null);
|
|
11324
|
+
const [firstImageLoaded, setFirstImageLoaded] = useState32(false);
|
|
11325
|
+
const [loaderMounted, setLoaderMounted] = useState32(true);
|
|
11326
|
+
const [imgFailed, setImgFailed] = useState32(false);
|
|
11180
11327
|
const failedSrc = (() => {
|
|
11181
11328
|
if (!imgFailed || !renderedUrl) return void 0;
|
|
11182
11329
|
try {
|
|
@@ -11186,15 +11333,16 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11186
11333
|
return "?";
|
|
11187
11334
|
}
|
|
11188
11335
|
})();
|
|
11189
|
-
const [retryNonce, setRetryNonce] =
|
|
11190
|
-
const retriedUrlRef =
|
|
11191
|
-
const prevDisplayUrlRef =
|
|
11192
|
-
const signHintShownRef =
|
|
11193
|
-
|
|
11336
|
+
const [retryNonce, setRetryNonce] = useState32(0);
|
|
11337
|
+
const retriedUrlRef = useRef24(null);
|
|
11338
|
+
const prevDisplayUrlRef = useRef24(displayUrl);
|
|
11339
|
+
const signHintShownRef = useRef24(false);
|
|
11340
|
+
useEffect33(() => {
|
|
11194
11341
|
if (!displayUrl || displayUrl === prevDisplayUrlRef.current) return;
|
|
11195
11342
|
const oldUrl = prevDisplayUrlRef.current;
|
|
11196
11343
|
prevDisplayUrlRef.current = displayUrl;
|
|
11197
11344
|
setImgFailed(false);
|
|
11345
|
+
setDesignRefused(null);
|
|
11198
11346
|
retriedUrlRef.current = null;
|
|
11199
11347
|
if (!oldUrl) {
|
|
11200
11348
|
setRenderedUrl(displayUrl);
|
|
@@ -11223,26 +11371,26 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11223
11371
|
preload.onerror = null;
|
|
11224
11372
|
};
|
|
11225
11373
|
}, [displayUrl]);
|
|
11226
|
-
const handleCrossfadeEnd =
|
|
11374
|
+
const handleCrossfadeEnd = useCallback19(() => {
|
|
11227
11375
|
setPrevUrl(null);
|
|
11228
11376
|
setShowNew(false);
|
|
11229
11377
|
}, []);
|
|
11230
|
-
const handleLoaderExited =
|
|
11378
|
+
const handleLoaderExited = useCallback19(() => setLoaderMounted(false), []);
|
|
11231
11379
|
if (!hasArtwork) {
|
|
11232
|
-
return /* @__PURE__ */
|
|
11380
|
+
return /* @__PURE__ */ jsx63(
|
|
11233
11381
|
"div",
|
|
11234
11382
|
{
|
|
11235
11383
|
className: `bg-gray-100 flex items-center justify-center ${className || ""}`,
|
|
11236
11384
|
style,
|
|
11237
11385
|
children: /* @__PURE__ */ jsxs39("div", { className: "text-gray-400 text-center p-4", children: [
|
|
11238
|
-
/* @__PURE__ */
|
|
11386
|
+
/* @__PURE__ */ jsx63(
|
|
11239
11387
|
"svg",
|
|
11240
11388
|
{
|
|
11241
11389
|
className: "w-8 h-8 mx-auto mb-2",
|
|
11242
11390
|
fill: "none",
|
|
11243
11391
|
stroke: "currentColor",
|
|
11244
11392
|
viewBox: "0 0 24 24",
|
|
11245
|
-
children: /* @__PURE__ */
|
|
11393
|
+
children: /* @__PURE__ */ jsx63(
|
|
11246
11394
|
"path",
|
|
11247
11395
|
{
|
|
11248
11396
|
strokeLinecap: "round",
|
|
@@ -11253,18 +11401,18 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11253
11401
|
)
|
|
11254
11402
|
}
|
|
11255
11403
|
),
|
|
11256
|
-
/* @__PURE__ */
|
|
11404
|
+
/* @__PURE__ */ jsx63("p", { className: "text-xs", children: emptyText })
|
|
11257
11405
|
] })
|
|
11258
11406
|
}
|
|
11259
11407
|
);
|
|
11260
11408
|
}
|
|
11261
11409
|
if (error) {
|
|
11262
|
-
return /* @__PURE__ */
|
|
11410
|
+
return /* @__PURE__ */ jsx63(
|
|
11263
11411
|
"div",
|
|
11264
11412
|
{
|
|
11265
11413
|
className: `bg-red-50 flex items-center justify-center ${className || ""}`,
|
|
11266
11414
|
style,
|
|
11267
|
-
children: /* @__PURE__ */
|
|
11415
|
+
children: /* @__PURE__ */ jsx63("div", { className: "text-red-600 text-center p-4", children: /* @__PURE__ */ jsx63("p", { className: "text-xs", children: errorText }) })
|
|
11268
11416
|
}
|
|
11269
11417
|
);
|
|
11270
11418
|
}
|
|
@@ -11283,8 +11431,9 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11283
11431
|
"data-picture-failed": imgFailed ? "E_PICTURE_UNDISPLAYED" : void 0,
|
|
11284
11432
|
"data-picture-failed-src": failedSrc,
|
|
11285
11433
|
"data-mockup-unavailable": unavailable ? unavailable.code : void 0,
|
|
11434
|
+
"data-design-refused": designRefused ?? void 0,
|
|
11286
11435
|
children: [
|
|
11287
|
-
unavailable && /* @__PURE__ */
|
|
11436
|
+
unavailable && /* @__PURE__ */ jsx63(
|
|
11288
11437
|
"div",
|
|
11289
11438
|
{
|
|
11290
11439
|
role: "status",
|
|
@@ -11293,7 +11442,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11293
11442
|
children: "Mockup unavailable"
|
|
11294
11443
|
}
|
|
11295
11444
|
),
|
|
11296
|
-
renderedUrl && !imgFailed && /* @__PURE__ */
|
|
11445
|
+
renderedUrl && !imgFailed && /* @__PURE__ */ jsx63(
|
|
11297
11446
|
"img",
|
|
11298
11447
|
{
|
|
11299
11448
|
alt: `Product mockup${placement ? ` - ${placement}` : ""}`,
|
|
@@ -11323,8 +11472,29 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11323
11472
|
onError: () => {
|
|
11324
11473
|
if (renderedUrl && retriedUrlRef.current !== renderedUrl) {
|
|
11325
11474
|
retriedUrlRef.current = renderedUrl;
|
|
11326
|
-
|
|
11327
|
-
|
|
11475
|
+
const url = renderedUrl;
|
|
11476
|
+
const mockupIdNow = actualMockupId;
|
|
11477
|
+
void (async () => {
|
|
11478
|
+
let answer = await probeRenderAnswer(url);
|
|
11479
|
+
let verdict = answer.ok ? "loud" : gallerySkipVerdict(answer.code, 0);
|
|
11480
|
+
if (verdict === "retry") {
|
|
11481
|
+
await new Promise((r) => setTimeout(r, DESIGN_BUSY_RETRY_MS));
|
|
11482
|
+
if (renderedUrlRef.current !== url) return;
|
|
11483
|
+
answer = await probeRenderAnswer(url);
|
|
11484
|
+
verdict = answer.ok ? "loud" : gallerySkipVerdict(answer.code, 1);
|
|
11485
|
+
}
|
|
11486
|
+
if (renderedUrlRef.current !== url) return;
|
|
11487
|
+
if (verdict === "skip" && isDesignRefusalCode(answer.code)) {
|
|
11488
|
+
setDesignRefused(answer.code);
|
|
11489
|
+
const skip = gallerySkipRef.current;
|
|
11490
|
+
if (skip && mockupIdNow) {
|
|
11491
|
+
skip.report(mockupIdNow, answer.code);
|
|
11492
|
+
realtimeContext?.frameFailed?.(url);
|
|
11493
|
+
return;
|
|
11494
|
+
}
|
|
11495
|
+
}
|
|
11496
|
+
setRetryNonce((n) => n + 1);
|
|
11497
|
+
})();
|
|
11328
11498
|
return;
|
|
11329
11499
|
}
|
|
11330
11500
|
setImgFailed(true);
|
|
@@ -11342,8 +11512,8 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11342
11512
|
},
|
|
11343
11513
|
retryNonce
|
|
11344
11514
|
),
|
|
11345
|
-
imgFailed && !prevUrl && /* @__PURE__ */
|
|
11346
|
-
realtimeContext?.renderError && /* @__PURE__ */
|
|
11515
|
+
imgFailed && !prevUrl && /* @__PURE__ */ jsx63("div", { className: "absolute inset-0 flex items-center justify-center bg-muted", children: /* @__PURE__ */ jsx63("p", { className: "text-muted-foreground text-xs", children: unavailableText }) }),
|
|
11516
|
+
realtimeContext?.renderError && /* @__PURE__ */ jsx63(
|
|
11347
11517
|
"div",
|
|
11348
11518
|
{
|
|
11349
11519
|
role: realtimeContext.renderError.retryable ? "status" : "alert",
|
|
@@ -11353,7 +11523,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11353
11523
|
children: realtimeContext.renderError.retryable ? realtimeContext.renderError.message : `Render blocked: ${realtimeContext.renderError.code} \u2014 ${realtimeContext.renderError.message}`
|
|
11354
11524
|
}
|
|
11355
11525
|
),
|
|
11356
|
-
prevUrl && /* @__PURE__ */
|
|
11526
|
+
prevUrl && /* @__PURE__ */ jsx63(
|
|
11357
11527
|
"img",
|
|
11358
11528
|
{
|
|
11359
11529
|
alt: "",
|
|
@@ -11368,7 +11538,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11368
11538
|
onTransitionEnd: handleCrossfadeEnd
|
|
11369
11539
|
}
|
|
11370
11540
|
),
|
|
11371
|
-
loaderMounted && /* @__PURE__ */
|
|
11541
|
+
loaderMounted && /* @__PURE__ */ jsx63(
|
|
11372
11542
|
LoadingOverlayPrismCandyInline,
|
|
11373
11543
|
{
|
|
11374
11544
|
visible: !firstImageLoaded,
|
|
@@ -11382,16 +11552,16 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11382
11552
|
});
|
|
11383
11553
|
|
|
11384
11554
|
// src/composed/SafeImg.tsx
|
|
11385
|
-
import
|
|
11386
|
-
import { Fragment as Fragment13, jsx as
|
|
11387
|
-
var SafeImg =
|
|
11555
|
+
import React47, { useEffect as useEffect34, useState as useState33 } from "react";
|
|
11556
|
+
import { Fragment as Fragment13, jsx as jsx64 } from "react/jsx-runtime";
|
|
11557
|
+
var SafeImg = React47.forwardRef(
|
|
11388
11558
|
function SafeImg2({ fallback = null, onError, src, ...rest }, ref) {
|
|
11389
|
-
const [failed, setFailed] =
|
|
11390
|
-
|
|
11559
|
+
const [failed, setFailed] = useState33(false);
|
|
11560
|
+
useEffect34(() => {
|
|
11391
11561
|
setFailed(false);
|
|
11392
11562
|
}, [src]);
|
|
11393
|
-
if (failed) return /* @__PURE__ */
|
|
11394
|
-
return /* @__PURE__ */
|
|
11563
|
+
if (failed) return /* @__PURE__ */ jsx64(Fragment13, { children: fallback });
|
|
11564
|
+
return /* @__PURE__ */ jsx64(
|
|
11395
11565
|
"img",
|
|
11396
11566
|
{
|
|
11397
11567
|
...rest,
|
|
@@ -11429,11 +11599,11 @@ var { searchClient } = instantMeiliSearch(
|
|
|
11429
11599
|
);
|
|
11430
11600
|
|
|
11431
11601
|
// src/composed/search/SearchProvider.tsx
|
|
11432
|
-
import { useEffect as
|
|
11433
|
-
import { jsx as
|
|
11602
|
+
import { useEffect as useEffect35 } from "react";
|
|
11603
|
+
import { jsx as jsx65, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
11434
11604
|
function InitialSearchTrigger() {
|
|
11435
11605
|
const { refine } = useSearchBox();
|
|
11436
|
-
|
|
11606
|
+
useEffect35(() => {
|
|
11437
11607
|
refine("");
|
|
11438
11608
|
}, [refine]);
|
|
11439
11609
|
return null;
|
|
@@ -11485,7 +11655,7 @@ function SearchProvider({
|
|
|
11485
11655
|
}
|
|
11486
11656
|
},
|
|
11487
11657
|
children: [
|
|
11488
|
-
/* @__PURE__ */
|
|
11658
|
+
/* @__PURE__ */ jsx65(
|
|
11489
11659
|
Configure,
|
|
11490
11660
|
{
|
|
11491
11661
|
hitsPerPage,
|
|
@@ -11494,7 +11664,7 @@ function SearchProvider({
|
|
|
11494
11664
|
attributesToRetrieve
|
|
11495
11665
|
}
|
|
11496
11666
|
),
|
|
11497
|
-
/* @__PURE__ */
|
|
11667
|
+
/* @__PURE__ */ jsx65(InitialSearchTrigger, {}),
|
|
11498
11668
|
children
|
|
11499
11669
|
]
|
|
11500
11670
|
}
|
|
@@ -11504,17 +11674,17 @@ function SearchProvider({
|
|
|
11504
11674
|
// src/composed/search/SearchBox.tsx
|
|
11505
11675
|
import { useSearchBox as useSearchBox2 } from "react-instantsearch";
|
|
11506
11676
|
import { Search, X } from "lucide-react";
|
|
11507
|
-
import { useEffect as
|
|
11508
|
-
import { jsx as
|
|
11677
|
+
import { useEffect as useEffect36, useRef as useRef25, useState as useState34 } from "react";
|
|
11678
|
+
import { jsx as jsx66, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
11509
11679
|
function SearchBox() {
|
|
11510
11680
|
const { query, refine, clear } = useSearchBox2();
|
|
11511
11681
|
const searchParams = useUiSearchParams();
|
|
11512
11682
|
const router = useUiRouter();
|
|
11513
|
-
const inputRef =
|
|
11514
|
-
const [showShimmer, setShowShimmer] =
|
|
11683
|
+
const inputRef = useRef25(null);
|
|
11684
|
+
const [showShimmer, setShowShimmer] = useState34(false);
|
|
11515
11685
|
const inputId = "search-products-input";
|
|
11516
11686
|
const descriptionId = "search-description";
|
|
11517
|
-
|
|
11687
|
+
useEffect36(() => {
|
|
11518
11688
|
const handleSpotlight = () => {
|
|
11519
11689
|
inputRef.current?.focus();
|
|
11520
11690
|
inputRef.current?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
@@ -11524,7 +11694,7 @@ function SearchBox() {
|
|
|
11524
11694
|
window.addEventListener("search-spotlight", handleSpotlight);
|
|
11525
11695
|
return () => window.removeEventListener("search-spotlight", handleSpotlight);
|
|
11526
11696
|
}, []);
|
|
11527
|
-
|
|
11697
|
+
useEffect36(() => {
|
|
11528
11698
|
const shouldFocus = searchParams.get("focus") === "search";
|
|
11529
11699
|
if (shouldFocus && inputRef.current) {
|
|
11530
11700
|
const timer = setTimeout(() => {
|
|
@@ -11539,8 +11709,8 @@ function SearchBox() {
|
|
|
11539
11709
|
return () => clearTimeout(timer);
|
|
11540
11710
|
}
|
|
11541
11711
|
}, [searchParams, router]);
|
|
11542
|
-
return /* @__PURE__ */
|
|
11543
|
-
/* @__PURE__ */
|
|
11712
|
+
return /* @__PURE__ */ jsx66("form", { role: "search", onSubmit: (e) => e.preventDefault(), children: /* @__PURE__ */ jsxs41("div", { className: "relative", children: [
|
|
11713
|
+
/* @__PURE__ */ jsx66(
|
|
11544
11714
|
Input,
|
|
11545
11715
|
{
|
|
11546
11716
|
ref: inputRef,
|
|
@@ -11549,15 +11719,15 @@ function SearchBox() {
|
|
|
11549
11719
|
value: query,
|
|
11550
11720
|
onChange: (e) => refine(e.target.value),
|
|
11551
11721
|
placeholder: "Search products...",
|
|
11552
|
-
startContent: /* @__PURE__ */
|
|
11553
|
-
endContent: query ? /* @__PURE__ */
|
|
11722
|
+
startContent: /* @__PURE__ */ jsx66(Search, { className: "w-5 h-5", strokeWidth: 1.5, "aria-hidden": "true" }),
|
|
11723
|
+
endContent: query ? /* @__PURE__ */ jsx66(
|
|
11554
11724
|
"button",
|
|
11555
11725
|
{
|
|
11556
11726
|
type: "button",
|
|
11557
11727
|
onClick: clear,
|
|
11558
11728
|
className: "hover:text-foreground transition-colors",
|
|
11559
11729
|
"aria-label": "Clear search",
|
|
11560
|
-
children: /* @__PURE__ */
|
|
11730
|
+
children: /* @__PURE__ */ jsx66(X, { className: "w-4 h-4", strokeWidth: 2, "aria-hidden": "true" })
|
|
11561
11731
|
}
|
|
11562
11732
|
) : void 0,
|
|
11563
11733
|
"aria-label": "Search products",
|
|
@@ -11567,11 +11737,11 @@ function SearchBox() {
|
|
|
11567
11737
|
className: "[&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden"
|
|
11568
11738
|
}
|
|
11569
11739
|
),
|
|
11570
|
-
showShimmer && /* @__PURE__ */
|
|
11740
|
+
showShimmer && /* @__PURE__ */ jsx66(
|
|
11571
11741
|
"div",
|
|
11572
11742
|
{
|
|
11573
11743
|
className: "absolute inset-0 pointer-events-none rounded-input z-20 overflow-hidden",
|
|
11574
|
-
children: /* @__PURE__ */
|
|
11744
|
+
children: /* @__PURE__ */ jsx66(
|
|
11575
11745
|
"div",
|
|
11576
11746
|
{
|
|
11577
11747
|
className: "absolute inset-0",
|
|
@@ -11584,13 +11754,13 @@ function SearchBox() {
|
|
|
11584
11754
|
)
|
|
11585
11755
|
}
|
|
11586
11756
|
),
|
|
11587
|
-
/* @__PURE__ */
|
|
11757
|
+
/* @__PURE__ */ jsx66("style", { dangerouslySetInnerHTML: { __html: `
|
|
11588
11758
|
@keyframes searchShimmer {
|
|
11589
11759
|
0% { transform: translateX(-100%); }
|
|
11590
11760
|
100% { transform: translateX(100%); }
|
|
11591
11761
|
}
|
|
11592
11762
|
` } }),
|
|
11593
|
-
/* @__PURE__ */
|
|
11763
|
+
/* @__PURE__ */ jsx66("span", { id: descriptionId, className: "sr-only", children: "Search results will update as you type" })
|
|
11594
11764
|
] }) });
|
|
11595
11765
|
}
|
|
11596
11766
|
|
|
@@ -11598,7 +11768,7 @@ function SearchBox() {
|
|
|
11598
11768
|
import { Hits, useStats, useInstantSearch } from "react-instantsearch";
|
|
11599
11769
|
|
|
11600
11770
|
// src/composed/search/ProductHit.tsx
|
|
11601
|
-
import { jsx as
|
|
11771
|
+
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
11602
11772
|
function ProductHitComponent({
|
|
11603
11773
|
hit: product,
|
|
11604
11774
|
variant = "overlay"
|
|
@@ -11615,12 +11785,12 @@ function ProductHitComponent({
|
|
|
11615
11785
|
}
|
|
11616
11786
|
return "";
|
|
11617
11787
|
};
|
|
11618
|
-
return /* @__PURE__ */
|
|
11788
|
+
return /* @__PURE__ */ jsx67(
|
|
11619
11789
|
Product,
|
|
11620
11790
|
{
|
|
11621
11791
|
productId,
|
|
11622
11792
|
productData: product,
|
|
11623
|
-
children: /* @__PURE__ */
|
|
11793
|
+
children: /* @__PURE__ */ jsx67(
|
|
11624
11794
|
ProductCard,
|
|
11625
11795
|
{
|
|
11626
11796
|
variant,
|
|
@@ -11641,10 +11811,10 @@ function ProductHitComponent({
|
|
|
11641
11811
|
}
|
|
11642
11812
|
|
|
11643
11813
|
// src/composed/search/ProductGrid.tsx
|
|
11644
|
-
import { useState as
|
|
11645
|
-
import { jsx as
|
|
11814
|
+
import { useState as useState35, useEffect as useEffect37, useCallback as useCallback20 } from "react";
|
|
11815
|
+
import { jsx as jsx68, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
11646
11816
|
function ProductGridSkeletonItem() {
|
|
11647
|
-
return /* @__PURE__ */
|
|
11817
|
+
return /* @__PURE__ */ jsx68("div", { className: "aspect-square bg-muted animate-pulse" });
|
|
11648
11818
|
}
|
|
11649
11819
|
function ProductGrid({
|
|
11650
11820
|
className = "",
|
|
@@ -11654,16 +11824,16 @@ function ProductGrid({
|
|
|
11654
11824
|
}) {
|
|
11655
11825
|
const { nbHits } = useStats();
|
|
11656
11826
|
const { status, results } = useInstantSearch();
|
|
11657
|
-
const [announcement, setAnnouncement] =
|
|
11827
|
+
const [announcement, setAnnouncement] = useState35("");
|
|
11658
11828
|
const hitsCount = results?.hits?.length ?? 0;
|
|
11659
11829
|
const showSkeleton = hitsCount === 0 && status !== "error";
|
|
11660
|
-
|
|
11830
|
+
useEffect37(() => {
|
|
11661
11831
|
const timer = setTimeout(() => {
|
|
11662
11832
|
setAnnouncement(`${nbHits} ${nbHits === 1 ? "product" : "products"} found`);
|
|
11663
11833
|
}, 1e3);
|
|
11664
11834
|
return () => clearTimeout(timer);
|
|
11665
11835
|
}, [nbHits]);
|
|
11666
|
-
const HitComponent =
|
|
11836
|
+
const HitComponent = useCallback20(({ hit }) => /* @__PURE__ */ jsx68(
|
|
11667
11837
|
ProductHitComponent,
|
|
11668
11838
|
{
|
|
11669
11839
|
hit,
|
|
@@ -11671,9 +11841,9 @@ function ProductGrid({
|
|
|
11671
11841
|
}
|
|
11672
11842
|
), [variant]);
|
|
11673
11843
|
return /* @__PURE__ */ jsxs42("div", { className, children: [
|
|
11674
|
-
/* @__PURE__ */
|
|
11675
|
-
showSkeleton && /* @__PURE__ */
|
|
11676
|
-
/* @__PURE__ */
|
|
11844
|
+
/* @__PURE__ */ jsx68("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement }),
|
|
11845
|
+
showSkeleton && /* @__PURE__ */ jsx68("div", { className: `grid ${gridClassName}`, children: Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ jsx68(ProductGridSkeletonItem, {}, i)) }),
|
|
11846
|
+
/* @__PURE__ */ jsx68("div", { className: showSkeleton ? "hidden" : "", children: /* @__PURE__ */ jsx68(
|
|
11677
11847
|
Hits,
|
|
11678
11848
|
{
|
|
11679
11849
|
hitComponent: HitComponent,
|
|
@@ -11688,11 +11858,11 @@ function ProductGrid({
|
|
|
11688
11858
|
}
|
|
11689
11859
|
|
|
11690
11860
|
// src/composed/search/Filters.tsx
|
|
11691
|
-
import { useState as
|
|
11861
|
+
import { useState as useState37 } from "react";
|
|
11692
11862
|
|
|
11693
11863
|
// src/composed/search/FiltersButton.tsx
|
|
11694
11864
|
import { SlidersHorizontal as LucideSlidersHorizontal } from "lucide-react";
|
|
11695
|
-
import { jsx as
|
|
11865
|
+
import { jsx as jsx69, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
11696
11866
|
var SlidersHorizontalIcon = LucideSlidersHorizontal;
|
|
11697
11867
|
function FiltersButton({
|
|
11698
11868
|
onClick,
|
|
@@ -11707,8 +11877,8 @@ function FiltersButton({
|
|
|
11707
11877
|
className,
|
|
11708
11878
|
"aria-label": "Open filters",
|
|
11709
11879
|
children: [
|
|
11710
|
-
/* @__PURE__ */
|
|
11711
|
-
/* @__PURE__ */
|
|
11880
|
+
/* @__PURE__ */ jsx69(SlidersHorizontalIcon, { className: "w-4 h-4" }),
|
|
11881
|
+
/* @__PURE__ */ jsx69("span", { children })
|
|
11712
11882
|
]
|
|
11713
11883
|
}
|
|
11714
11884
|
);
|
|
@@ -11717,15 +11887,15 @@ function FiltersButton({
|
|
|
11717
11887
|
// src/composed/search/FiltersDrawer.tsx
|
|
11718
11888
|
import { useRefinementList, useRange, useStats as useStats2 } from "react-instantsearch";
|
|
11719
11889
|
import { X as LucideX2, SlidersHorizontal as LucideSlidersHorizontal2 } from "lucide-react";
|
|
11720
|
-
import { useState as
|
|
11890
|
+
import { useState as useState36, useEffect as useEffect38 } from "react";
|
|
11721
11891
|
import * as Slider2 from "@radix-ui/react-slider";
|
|
11722
|
-
import { Fragment as Fragment14, jsx as
|
|
11892
|
+
import { Fragment as Fragment14, jsx as jsx70, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
11723
11893
|
var XIcon2 = LucideX2;
|
|
11724
11894
|
function FiltersDrawer({ isOpen, onClose }) {
|
|
11725
|
-
const [showCounts, setShowCounts] =
|
|
11895
|
+
const [showCounts, setShowCounts] = useState36(false);
|
|
11726
11896
|
const { nbHits } = useStats2();
|
|
11727
11897
|
const containerRef = useFocusTrap(isOpen, onClose);
|
|
11728
|
-
|
|
11898
|
+
useEffect38(() => {
|
|
11729
11899
|
if (isOpen) {
|
|
11730
11900
|
document.body.style.overflow = "hidden";
|
|
11731
11901
|
} else {
|
|
@@ -11735,7 +11905,7 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
11735
11905
|
document.body.style.overflow = "";
|
|
11736
11906
|
};
|
|
11737
11907
|
}, [isOpen]);
|
|
11738
|
-
|
|
11908
|
+
useEffect38(() => {
|
|
11739
11909
|
const handleEscape = (e) => {
|
|
11740
11910
|
if (e.key === "Escape" && isOpen) {
|
|
11741
11911
|
onClose();
|
|
@@ -11745,7 +11915,7 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
11745
11915
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
11746
11916
|
}, [isOpen, onClose]);
|
|
11747
11917
|
return /* @__PURE__ */ jsxs44(Fragment14, { children: [
|
|
11748
|
-
/* @__PURE__ */
|
|
11918
|
+
/* @__PURE__ */ jsx70(
|
|
11749
11919
|
"div",
|
|
11750
11920
|
{
|
|
11751
11921
|
className: `fixed inset-0 bg-black/50 z-40 transition-opacity ${isOpen ? "opacity-100" : "opacity-0 pointer-events-none"}`,
|
|
@@ -11763,25 +11933,25 @@ function FiltersDrawer({ isOpen, onClose }) {
|
|
|
11763
11933
|
"aria-labelledby": "filters-drawer-title",
|
|
11764
11934
|
children: [
|
|
11765
11935
|
/* @__PURE__ */ jsxs44("div", { className: "flex items-center justify-between px-4 py-4", children: [
|
|
11766
|
-
/* @__PURE__ */
|
|
11767
|
-
/* @__PURE__ */
|
|
11936
|
+
/* @__PURE__ */ jsx70("h2", { id: "filters-drawer-title", className: "text-xl font-bold", children: "Filters" }),
|
|
11937
|
+
/* @__PURE__ */ jsx70(
|
|
11768
11938
|
"button",
|
|
11769
11939
|
{
|
|
11770
11940
|
onClick: onClose,
|
|
11771
11941
|
className: "p-2 hover:bg-foreground/5 rounded-full transition-colors",
|
|
11772
11942
|
"aria-label": "Close filters",
|
|
11773
|
-
children: /* @__PURE__ */
|
|
11943
|
+
children: /* @__PURE__ */ jsx70(XIcon2, { className: "w-5 h-5" })
|
|
11774
11944
|
}
|
|
11775
11945
|
)
|
|
11776
11946
|
] }),
|
|
11777
|
-
/* @__PURE__ */
|
|
11947
|
+
/* @__PURE__ */ jsx70("div", { className: "px-4 pb-4", children: /* @__PURE__ */ jsxs44("p", { className: "text-sm font-caption text-foreground/60", role: "status", "aria-live": "polite", children: [
|
|
11778
11948
|
nbHits.toLocaleString(),
|
|
11779
11949
|
" ",
|
|
11780
11950
|
nbHits === 1 ? "result" : "results"
|
|
11781
11951
|
] }) }),
|
|
11782
|
-
/* @__PURE__ */
|
|
11783
|
-
/* @__PURE__ */
|
|
11784
|
-
/* @__PURE__ */
|
|
11952
|
+
/* @__PURE__ */ jsx70("div", { className: "flex-1 overflow-y-auto px-4 pb-4", children: /* @__PURE__ */ jsxs44("div", { className: "flex flex-col gap-8", children: [
|
|
11953
|
+
/* @__PURE__ */ jsx70(TagsSection, { showCounts, setShowCounts }),
|
|
11954
|
+
/* @__PURE__ */ jsx70(PriceSection, {})
|
|
11785
11955
|
] }) })
|
|
11786
11956
|
]
|
|
11787
11957
|
}
|
|
@@ -11797,7 +11967,7 @@ function TagsSection({
|
|
|
11797
11967
|
sortBy: ["count:desc", "name:asc"],
|
|
11798
11968
|
limit: 100
|
|
11799
11969
|
});
|
|
11800
|
-
const [isExpanded, setIsExpanded] =
|
|
11970
|
+
const [isExpanded, setIsExpanded] = useState36(true);
|
|
11801
11971
|
return /* @__PURE__ */ jsxs44("div", { className: "bg-foreground/5 rounded-lg p-4", children: [
|
|
11802
11972
|
/* @__PURE__ */ jsxs44(
|
|
11803
11973
|
"button",
|
|
@@ -11807,8 +11977,8 @@ function TagsSection({
|
|
|
11807
11977
|
"aria-expanded": isExpanded,
|
|
11808
11978
|
"aria-controls": "tags-content",
|
|
11809
11979
|
children: [
|
|
11810
|
-
/* @__PURE__ */
|
|
11811
|
-
/* @__PURE__ */
|
|
11980
|
+
/* @__PURE__ */ jsx70("h3", { className: "text-base font-semibold text-primary", children: "Tags" }),
|
|
11981
|
+
/* @__PURE__ */ jsx70(
|
|
11812
11982
|
"svg",
|
|
11813
11983
|
{
|
|
11814
11984
|
className: `w-5 h-5 transition-transform text-foreground/40 group-hover:text-foreground/60 ${isExpanded ? "rotate-180" : ""}`,
|
|
@@ -11817,14 +11987,14 @@ function TagsSection({
|
|
|
11817
11987
|
stroke: "currentColor",
|
|
11818
11988
|
strokeWidth: 2.5,
|
|
11819
11989
|
"aria-hidden": "true",
|
|
11820
|
-
children: /* @__PURE__ */
|
|
11990
|
+
children: /* @__PURE__ */ jsx70("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
11821
11991
|
}
|
|
11822
11992
|
)
|
|
11823
11993
|
]
|
|
11824
11994
|
}
|
|
11825
11995
|
),
|
|
11826
11996
|
isExpanded && /* @__PURE__ */ jsxs44("div", { className: "space-y-4", id: "tags-content", children: [
|
|
11827
|
-
/* @__PURE__ */
|
|
11997
|
+
/* @__PURE__ */ jsx70("div", { className: "flex flex-wrap gap-2", role: "group", "aria-label": "Product tags filter", children: items.map((item) => /* @__PURE__ */ jsxs44(
|
|
11828
11998
|
"button",
|
|
11829
11999
|
{
|
|
11830
12000
|
onClick: () => refine(item.value),
|
|
@@ -11835,15 +12005,15 @@ function TagsSection({
|
|
|
11835
12005
|
"aria-label": `${item.isRefined ? "Remove" : "Apply"} ${item.label} filter${showCounts ? ` (${item.count} products)` : ""}`,
|
|
11836
12006
|
"aria-pressed": item.isRefined,
|
|
11837
12007
|
children: [
|
|
11838
|
-
/* @__PURE__ */
|
|
11839
|
-
showCounts && /* @__PURE__ */
|
|
12008
|
+
/* @__PURE__ */ jsx70("span", { "aria-hidden": "true", children: item.label }),
|
|
12009
|
+
showCounts && /* @__PURE__ */ jsx70("span", { className: `text-xs font-caption ${item.isRefined ? "opacity-80" : "opacity-60"}`, "aria-hidden": "true", children: item.count })
|
|
11840
12010
|
]
|
|
11841
12011
|
},
|
|
11842
12012
|
item.value
|
|
11843
12013
|
)) }),
|
|
11844
12014
|
/* @__PURE__ */ jsxs44("div", { className: "flex items-center justify-between pt-2", children: [
|
|
11845
|
-
/* @__PURE__ */
|
|
11846
|
-
/* @__PURE__ */
|
|
12015
|
+
/* @__PURE__ */ jsx70("span", { className: "text-sm font-label text-foreground/60", id: "show-counts-label", children: "Show counts" }),
|
|
12016
|
+
/* @__PURE__ */ jsx70(
|
|
11847
12017
|
"button",
|
|
11848
12018
|
{
|
|
11849
12019
|
onClick: () => setShowCounts(!showCounts),
|
|
@@ -11851,7 +12021,7 @@ function TagsSection({
|
|
|
11851
12021
|
role: "switch",
|
|
11852
12022
|
"aria-checked": showCounts,
|
|
11853
12023
|
"aria-labelledby": "show-counts-label",
|
|
11854
|
-
children: /* @__PURE__ */
|
|
12024
|
+
children: /* @__PURE__ */ jsx70(
|
|
11855
12025
|
"span",
|
|
11856
12026
|
{
|
|
11857
12027
|
className: `inline-block h-4 w-4 transform rounded-full bg-background shadow-sm transition-transform ${showCounts ? "translate-x-6" : "translate-x-1"}`,
|
|
@@ -11868,11 +12038,11 @@ function PriceSection() {
|
|
|
11868
12038
|
const { range, refine, start, canRefine } = useRange({ attribute: "price" });
|
|
11869
12039
|
const rangeMin = typeof range.min === "number" && isFinite(range.min) ? range.min : 0;
|
|
11870
12040
|
const rangeMax = typeof range.max === "number" && isFinite(range.max) ? range.max : 15e3;
|
|
11871
|
-
const [localRange, setLocalRange] =
|
|
12041
|
+
const [localRange, setLocalRange] = useState36([
|
|
11872
12042
|
typeof start?.[0] === "number" && isFinite(start[0]) ? start[0] : rangeMin,
|
|
11873
12043
|
typeof start?.[1] === "number" && isFinite(start[1]) ? start[1] : rangeMax
|
|
11874
12044
|
]);
|
|
11875
|
-
|
|
12045
|
+
useEffect38(() => {
|
|
11876
12046
|
if (start && Array.isArray(start)) {
|
|
11877
12047
|
setLocalRange([
|
|
11878
12048
|
typeof start[0] === "number" && isFinite(start[0]) ? start[0] : rangeMin,
|
|
@@ -11882,7 +12052,7 @@ function PriceSection() {
|
|
|
11882
12052
|
setLocalRange([rangeMin, rangeMax]);
|
|
11883
12053
|
}
|
|
11884
12054
|
}, [start, rangeMin, rangeMax]);
|
|
11885
|
-
const [isExpanded, setIsExpanded] =
|
|
12055
|
+
const [isExpanded, setIsExpanded] = useState36(true);
|
|
11886
12056
|
if (!canRefine) {
|
|
11887
12057
|
return null;
|
|
11888
12058
|
}
|
|
@@ -11906,8 +12076,8 @@ function PriceSection() {
|
|
|
11906
12076
|
"aria-expanded": isExpanded,
|
|
11907
12077
|
"aria-controls": "price-content",
|
|
11908
12078
|
children: [
|
|
11909
|
-
/* @__PURE__ */
|
|
11910
|
-
/* @__PURE__ */
|
|
12079
|
+
/* @__PURE__ */ jsx70("h3", { className: "text-base font-semibold text-primary", children: "Price" }),
|
|
12080
|
+
/* @__PURE__ */ jsx70(
|
|
11911
12081
|
"svg",
|
|
11912
12082
|
{
|
|
11913
12083
|
className: `w-5 h-5 transition-transform text-foreground/40 group-hover:text-foreground/60 ${isExpanded ? "rotate-180" : ""}`,
|
|
@@ -11916,7 +12086,7 @@ function PriceSection() {
|
|
|
11916
12086
|
stroke: "currentColor",
|
|
11917
12087
|
strokeWidth: 2.5,
|
|
11918
12088
|
"aria-hidden": "true",
|
|
11919
|
-
children: /* @__PURE__ */
|
|
12089
|
+
children: /* @__PURE__ */ jsx70("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
11920
12090
|
}
|
|
11921
12091
|
)
|
|
11922
12092
|
]
|
|
@@ -11924,14 +12094,14 @@ function PriceSection() {
|
|
|
11924
12094
|
),
|
|
11925
12095
|
isExpanded && /* @__PURE__ */ jsxs44("div", { className: "space-y-6", id: "price-content", children: [
|
|
11926
12096
|
/* @__PURE__ */ jsxs44("div", { className: "flex items-center justify-between text-sm font-display", children: [
|
|
11927
|
-
/* @__PURE__ */
|
|
11928
|
-
/* @__PURE__ */
|
|
12097
|
+
/* @__PURE__ */ jsx70("span", { children: formatPrice2(localRange[0]) }),
|
|
12098
|
+
/* @__PURE__ */ jsx70("span", { className: "text-foreground/70", children: formatPrice2(localRange[1]) })
|
|
11929
12099
|
] }),
|
|
11930
|
-
/* @__PURE__ */
|
|
12100
|
+
/* @__PURE__ */ jsx70("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) => {
|
|
11931
12101
|
const totalBars = 19;
|
|
11932
12102
|
const barPrice = rangeMin + (rangeMax - rangeMin) / totalBars * i;
|
|
11933
12103
|
const isInRange = barPrice >= localRange[0] && barPrice <= localRange[1];
|
|
11934
|
-
return /* @__PURE__ */
|
|
12104
|
+
return /* @__PURE__ */ jsx70(
|
|
11935
12105
|
"div",
|
|
11936
12106
|
{
|
|
11937
12107
|
className: `flex-1 rounded-t-sm transition-opacity ${isInRange ? "bg-foreground" : "bg-foreground/20"}`,
|
|
@@ -11940,7 +12110,7 @@ function PriceSection() {
|
|
|
11940
12110
|
i
|
|
11941
12111
|
);
|
|
11942
12112
|
}) }),
|
|
11943
|
-
/* @__PURE__ */
|
|
12113
|
+
/* @__PURE__ */ jsx70("div", { style: { touchAction: "none" }, className: "my-6", children: /* @__PURE__ */ jsxs44(
|
|
11944
12114
|
Slider2.Root,
|
|
11945
12115
|
{
|
|
11946
12116
|
className: "relative flex w-full touch-none select-none items-center",
|
|
@@ -11958,8 +12128,8 @@ function PriceSection() {
|
|
|
11958
12128
|
step: 1,
|
|
11959
12129
|
minStepsBetweenThumbs: 1,
|
|
11960
12130
|
children: [
|
|
11961
|
-
/* @__PURE__ */
|
|
11962
|
-
/* @__PURE__ */
|
|
12131
|
+
/* @__PURE__ */ jsx70(Slider2.Track, { className: "relative h-3 w-full grow overflow-hidden rounded-full bg-foreground/20", children: /* @__PURE__ */ jsx70(Slider2.Range, { className: "absolute h-full bg-foreground" }) }),
|
|
12132
|
+
/* @__PURE__ */ jsx70(
|
|
11963
12133
|
Slider2.Thumb,
|
|
11964
12134
|
{
|
|
11965
12135
|
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",
|
|
@@ -11973,7 +12143,7 @@ function PriceSection() {
|
|
|
11973
12143
|
"aria-valuetext": formatPrice2(localRange[0])
|
|
11974
12144
|
}
|
|
11975
12145
|
),
|
|
11976
|
-
/* @__PURE__ */
|
|
12146
|
+
/* @__PURE__ */ jsx70(
|
|
11977
12147
|
Slider2.Thumb,
|
|
11978
12148
|
{
|
|
11979
12149
|
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",
|
|
@@ -11992,8 +12162,8 @@ function PriceSection() {
|
|
|
11992
12162
|
) }),
|
|
11993
12163
|
/* @__PURE__ */ jsxs44("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
11994
12164
|
/* @__PURE__ */ jsxs44("div", { children: [
|
|
11995
|
-
/* @__PURE__ */
|
|
11996
|
-
/* @__PURE__ */
|
|
12165
|
+
/* @__PURE__ */ jsx70("label", { htmlFor: "price-min", className: "text-xs font-label text-foreground/60 mb-1.5 block", children: "Min" }),
|
|
12166
|
+
/* @__PURE__ */ jsx70(
|
|
11997
12167
|
"input",
|
|
11998
12168
|
{
|
|
11999
12169
|
id: "price-min",
|
|
@@ -12012,8 +12182,8 @@ function PriceSection() {
|
|
|
12012
12182
|
)
|
|
12013
12183
|
] }),
|
|
12014
12184
|
/* @__PURE__ */ jsxs44("div", { children: [
|
|
12015
|
-
/* @__PURE__ */
|
|
12016
|
-
/* @__PURE__ */
|
|
12185
|
+
/* @__PURE__ */ jsx70("label", { htmlFor: "price-max", className: "text-xs font-label text-foreground/60 mb-1.5 block", children: "Max" }),
|
|
12186
|
+
/* @__PURE__ */ jsx70(
|
|
12017
12187
|
"input",
|
|
12018
12188
|
{
|
|
12019
12189
|
id: "price-max",
|
|
@@ -12037,11 +12207,11 @@ function PriceSection() {
|
|
|
12037
12207
|
}
|
|
12038
12208
|
|
|
12039
12209
|
// src/composed/search/Filters.tsx
|
|
12040
|
-
import { Fragment as Fragment15, jsx as
|
|
12210
|
+
import { Fragment as Fragment15, jsx as jsx71, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
12041
12211
|
function Filters({ buttonClassName, buttonText }) {
|
|
12042
|
-
const [isOpen, setIsOpen] =
|
|
12212
|
+
const [isOpen, setIsOpen] = useState37(false);
|
|
12043
12213
|
return /* @__PURE__ */ jsxs45(Fragment15, { children: [
|
|
12044
|
-
/* @__PURE__ */
|
|
12214
|
+
/* @__PURE__ */ jsx71(
|
|
12045
12215
|
FiltersButton,
|
|
12046
12216
|
{
|
|
12047
12217
|
onClick: () => setIsOpen(true),
|
|
@@ -12049,14 +12219,14 @@ function Filters({ buttonClassName, buttonText }) {
|
|
|
12049
12219
|
children: buttonText
|
|
12050
12220
|
}
|
|
12051
12221
|
),
|
|
12052
|
-
/* @__PURE__ */
|
|
12222
|
+
/* @__PURE__ */ jsx71(FiltersDrawer, { isOpen, onClose: () => setIsOpen(false) })
|
|
12053
12223
|
] });
|
|
12054
12224
|
}
|
|
12055
12225
|
|
|
12056
12226
|
// src/composed/search/CurrentRefinements.tsx
|
|
12057
12227
|
import { useCurrentRefinements } from "react-instantsearch";
|
|
12058
12228
|
import { X as LucideX3 } from "lucide-react";
|
|
12059
|
-
import { jsx as
|
|
12229
|
+
import { jsx as jsx72, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
12060
12230
|
var XIcon3 = LucideX3;
|
|
12061
12231
|
var MIN_PRICE = new RegExp("[\u2265>=]+\\s*(\\d+)");
|
|
12062
12232
|
var MAX_PRICE = new RegExp("[\u2264<=]+\\s*(\\d+)");
|
|
@@ -12104,15 +12274,15 @@ function CurrentRefinements() {
|
|
|
12104
12274
|
if (allRefinements.length === 0) {
|
|
12105
12275
|
return null;
|
|
12106
12276
|
}
|
|
12107
|
-
return /* @__PURE__ */
|
|
12277
|
+
return /* @__PURE__ */ jsx72("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__ */ jsxs46(
|
|
12108
12278
|
"button",
|
|
12109
12279
|
{
|
|
12110
12280
|
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",
|
|
12111
12281
|
onClick: () => refinement.refine(),
|
|
12112
12282
|
"aria-label": `Remove filter: ${refinement.displayLabel}`,
|
|
12113
12283
|
children: [
|
|
12114
|
-
/* @__PURE__ */
|
|
12115
|
-
/* @__PURE__ */
|
|
12284
|
+
/* @__PURE__ */ jsx72("span", { className: "truncate", children: refinement.displayLabel }),
|
|
12285
|
+
/* @__PURE__ */ jsx72(XIcon3, { className: "w-3 h-3" })
|
|
12116
12286
|
]
|
|
12117
12287
|
},
|
|
12118
12288
|
`${refinement.attribute}-${refinement.value}-${index}`
|
|
@@ -12136,12 +12306,12 @@ var FACET_SECTIONS = [
|
|
|
12136
12306
|
];
|
|
12137
12307
|
|
|
12138
12308
|
// src/composed/zoom/ResponsiveZoom.tsx
|
|
12139
|
-
import { useState as
|
|
12309
|
+
import { useState as useState40, useEffect as useEffect40 } from "react";
|
|
12140
12310
|
|
|
12141
12311
|
// src/composed/zoom/ZoomOverlay.tsx
|
|
12142
|
-
import { useState as
|
|
12312
|
+
import { useState as useState38, useCallback as useCallback21 } from "react";
|
|
12143
12313
|
import { Plus as LucidePlus2, Minus as LucideMinus2 } from "lucide-react";
|
|
12144
|
-
import { Fragment as Fragment16, jsx as
|
|
12314
|
+
import { Fragment as Fragment16, jsx as jsx73, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
12145
12315
|
var PlusIcon2 = LucidePlus2;
|
|
12146
12316
|
var MinusIcon2 = LucideMinus2;
|
|
12147
12317
|
function ZoomOverlay({
|
|
@@ -12153,13 +12323,13 @@ function ZoomOverlay({
|
|
|
12153
12323
|
className,
|
|
12154
12324
|
style
|
|
12155
12325
|
}) {
|
|
12156
|
-
const [zoomedImageIndex, setZoomedImageIndex] =
|
|
12157
|
-
const [zoomOrigin, setZoomOrigin] =
|
|
12158
|
-
const [hoveredImageIndex, setHoveredImageIndex] =
|
|
12159
|
-
const [cursorPos, setCursorPos] =
|
|
12160
|
-
const [announcement, setAnnouncement] =
|
|
12161
|
-
const [isZooming, setIsZooming] =
|
|
12162
|
-
const handleZoomClick =
|
|
12326
|
+
const [zoomedImageIndex, setZoomedImageIndex] = useState38(null);
|
|
12327
|
+
const [zoomOrigin, setZoomOrigin] = useState38({ x: 50, y: 50 });
|
|
12328
|
+
const [hoveredImageIndex, setHoveredImageIndex] = useState38(null);
|
|
12329
|
+
const [cursorPos, setCursorPos] = useState38({ x: 0, y: 0 });
|
|
12330
|
+
const [announcement, setAnnouncement] = useState38("");
|
|
12331
|
+
const [isZooming, setIsZooming] = useState38(false);
|
|
12332
|
+
const handleZoomClick = useCallback21(
|
|
12163
12333
|
(e) => {
|
|
12164
12334
|
e.stopPropagation();
|
|
12165
12335
|
if (isLargeTouchDevice && onEnhancedViewer) {
|
|
@@ -12184,7 +12354,7 @@ function ZoomOverlay({
|
|
|
12184
12354
|
},
|
|
12185
12355
|
[zoomedImageIndex, isLargeTouchDevice, onEnhancedViewer, imageIndex]
|
|
12186
12356
|
);
|
|
12187
|
-
const handleZoomMouseMove =
|
|
12357
|
+
const handleZoomMouseMove = useCallback21(
|
|
12188
12358
|
(e) => {
|
|
12189
12359
|
setCursorPos({ x: e.clientX, y: e.clientY });
|
|
12190
12360
|
if (zoomedImageIndex === imageIndex) {
|
|
@@ -12201,8 +12371,8 @@ function ZoomOverlay({
|
|
|
12201
12371
|
const isHovered = hoveredImageIndex === imageIndex;
|
|
12202
12372
|
const cursorStyle = isLargeTouchDevice ? "pointer" : isTouchDevice ? "default" : "none";
|
|
12203
12373
|
return /* @__PURE__ */ jsxs47(Fragment16, { children: [
|
|
12204
|
-
/* @__PURE__ */
|
|
12205
|
-
/* @__PURE__ */
|
|
12374
|
+
/* @__PURE__ */ jsx73("div", { className: "sr-only", role: "status", "aria-live": "polite", "aria-atomic": "true", children: announcement }),
|
|
12375
|
+
/* @__PURE__ */ jsx73(
|
|
12206
12376
|
"div",
|
|
12207
12377
|
{
|
|
12208
12378
|
className,
|
|
@@ -12210,7 +12380,7 @@ function ZoomOverlay({
|
|
|
12210
12380
|
...style,
|
|
12211
12381
|
position: "relative"
|
|
12212
12382
|
},
|
|
12213
|
-
children: /* @__PURE__ */
|
|
12383
|
+
children: /* @__PURE__ */ jsx73(
|
|
12214
12384
|
"div",
|
|
12215
12385
|
{
|
|
12216
12386
|
style: {
|
|
@@ -12233,7 +12403,7 @@ function ZoomOverlay({
|
|
|
12233
12403
|
handleZoomClick(e);
|
|
12234
12404
|
}
|
|
12235
12405
|
},
|
|
12236
|
-
children: /* @__PURE__ */
|
|
12406
|
+
children: /* @__PURE__ */ jsx73(
|
|
12237
12407
|
"div",
|
|
12238
12408
|
{
|
|
12239
12409
|
style: {
|
|
@@ -12249,7 +12419,7 @@ function ZoomOverlay({
|
|
|
12249
12419
|
)
|
|
12250
12420
|
}
|
|
12251
12421
|
),
|
|
12252
|
-
isHovered && !isTouchDevice && /* @__PURE__ */
|
|
12422
|
+
isHovered && !isTouchDevice && /* @__PURE__ */ jsx73(
|
|
12253
12423
|
"div",
|
|
12254
12424
|
{
|
|
12255
12425
|
className: "fixed pointer-events-none z-50 hidden md:block",
|
|
@@ -12259,7 +12429,7 @@ function ZoomOverlay({
|
|
|
12259
12429
|
transform: "translate(-50%, -50%)"
|
|
12260
12430
|
},
|
|
12261
12431
|
"aria-hidden": "true",
|
|
12262
|
-
children: /* @__PURE__ */
|
|
12432
|
+
children: /* @__PURE__ */ jsx73("div", { className: "bg-white dark:bg-gray-800 rounded-full p-2 shadow-sm dark:shadow-gray-950/50", children: isZoomed ? /* @__PURE__ */ jsx73(
|
|
12263
12433
|
MinusIcon2,
|
|
12264
12434
|
{
|
|
12265
12435
|
size: 20,
|
|
@@ -12267,7 +12437,7 @@ function ZoomOverlay({
|
|
|
12267
12437
|
strokeWidth: 1.5,
|
|
12268
12438
|
"aria-hidden": "true"
|
|
12269
12439
|
}
|
|
12270
|
-
) : /* @__PURE__ */
|
|
12440
|
+
) : /* @__PURE__ */ jsx73(
|
|
12271
12441
|
PlusIcon2,
|
|
12272
12442
|
{
|
|
12273
12443
|
size: 20,
|
|
@@ -12283,11 +12453,11 @@ function ZoomOverlay({
|
|
|
12283
12453
|
|
|
12284
12454
|
// src/composed/zoom/EnhancedImageViewer.tsx
|
|
12285
12455
|
import {
|
|
12286
|
-
useState as
|
|
12287
|
-
useRef as
|
|
12288
|
-
useEffect as
|
|
12456
|
+
useState as useState39,
|
|
12457
|
+
useRef as useRef26,
|
|
12458
|
+
useEffect as useEffect39,
|
|
12289
12459
|
useLayoutEffect as useLayoutEffect6,
|
|
12290
|
-
useCallback as
|
|
12460
|
+
useCallback as useCallback22
|
|
12291
12461
|
} from "react";
|
|
12292
12462
|
import { createPortal as createPortal3 } from "react-dom";
|
|
12293
12463
|
import {
|
|
@@ -12295,9 +12465,73 @@ import {
|
|
|
12295
12465
|
TransformComponent as OriginalTransformComponent
|
|
12296
12466
|
} from "react-zoom-pan-pinch";
|
|
12297
12467
|
import { X as X2 } from "lucide-react";
|
|
12298
|
-
|
|
12468
|
+
|
|
12469
|
+
// src/composed/carousels/firstView.ts
|
|
12470
|
+
var SLIDE_FIRST_VIEW_ATTR = "data-first-view";
|
|
12471
|
+
var SLIDE_PRODUCT_BOX_ATTR = "data-product-box";
|
|
12472
|
+
var SLIDE_PHONE_WINDOW_ATTR = "data-phone-window";
|
|
12473
|
+
var SLIDE_FIRST_VIEW_X_VAR = "--first-view-x";
|
|
12474
|
+
var SLIDE_PRODUCT_X0_VAR = "--product-x0";
|
|
12475
|
+
var SLIDE_PRODUCT_X1_VAR = "--product-x1";
|
|
12476
|
+
var r4 = (n) => Math.round(n * 1e4) / 1e4;
|
|
12477
|
+
var FIRST_VIEW_PICTURE_ASPECT = 16 / 9;
|
|
12478
|
+
var FIRST_VIEW_MARGIN = 0.03;
|
|
12479
|
+
function firstViewAnchorOfSlide(image) {
|
|
12480
|
+
const { productBox: product, phoneWindow: window2 } = image;
|
|
12481
|
+
if (window2) return { by: "phone-window", window: window2, product: product ?? null };
|
|
12482
|
+
if (product) return { by: "product", product };
|
|
12483
|
+
return { by: "picture-middle", why: "no-phone-window-no-product-box" };
|
|
12484
|
+
}
|
|
12485
|
+
function firstView(box, anchor, pictureAspect = FIRST_VIEW_PICTURE_ASPECT) {
|
|
12486
|
+
const { width: W, height: H } = box;
|
|
12487
|
+
const pictureWidth = Math.max(W, H * pictureAspect);
|
|
12488
|
+
const product = anchor.by === "picture-middle" ? null : anchor.product;
|
|
12489
|
+
const wanted = anchor.by === "phone-window" ? anchor.window.x + anchor.window.w / 2 : anchor.by === "product" ? anchor.product.x + anchor.product.w / 2 : 0.5;
|
|
12490
|
+
let centrePx = wanted * pictureWidth;
|
|
12491
|
+
if (product) {
|
|
12492
|
+
const mid = (product.x + product.w / 2) * pictureWidth;
|
|
12493
|
+
const lo = (product.x + product.w) * pictureWidth + FIRST_VIEW_MARGIN * W - W / 2;
|
|
12494
|
+
const hi = product.x * pictureWidth - FIRST_VIEW_MARGIN * W + W / 2;
|
|
12495
|
+
centrePx = Math.max(Math.min(lo, mid), Math.min(centrePx, Math.max(hi, mid)));
|
|
12496
|
+
}
|
|
12497
|
+
const left = Math.max(Math.min(0, W - pictureWidth), Math.min(W / 2 - centrePx, 0));
|
|
12498
|
+
const x0 = -left / pictureWidth, x1 = (W - left) / pictureWidth;
|
|
12499
|
+
if (!product) return { x0, x1, pictureWidth, left, product: "unjudged", inView: null, share: null };
|
|
12500
|
+
const seen = Math.max(0, Math.min(product.x + product.w, x1) - Math.max(product.x, x0));
|
|
12501
|
+
const inView = seen / product.w;
|
|
12502
|
+
return { x0, x1, pictureWidth, left, product: inView > 1 - 1e-6 ? "held" : "cut", inView, share: seen / (x1 - x0) };
|
|
12503
|
+
}
|
|
12504
|
+
function slideFirstViewFields(image) {
|
|
12505
|
+
if (!image.isRealMockup) return {};
|
|
12506
|
+
return { ...image.productBox ? { productBox: image.productBox } : {}, ...image.phoneWindow ? { phoneWindow: image.phoneWindow } : {} };
|
|
12507
|
+
}
|
|
12508
|
+
function slideFirstViewProps(image) {
|
|
12509
|
+
const { productBox: box, phoneWindow: phone } = image;
|
|
12510
|
+
if (!box && !phone) return {};
|
|
12511
|
+
const centre = phone ? r4(phone.x + phone.w / 2) : r4(box.x + box.w / 2);
|
|
12512
|
+
const x0 = box ? r4(box.x) : centre, x1 = box ? r4(box.x + box.w) : centre;
|
|
12513
|
+
return {
|
|
12514
|
+
[SLIDE_FIRST_VIEW_ATTR]: phone ? "phone-window" : "product",
|
|
12515
|
+
...box ? { [SLIDE_PRODUCT_BOX_ATTR]: [box.x, box.y, box.w, box.h].map(r4).join(",") } : {},
|
|
12516
|
+
...phone ? { [SLIDE_PHONE_WINDOW_ATTR]: [phone.x, phone.w].map(r4).join(",") } : {},
|
|
12517
|
+
style: { [SLIDE_FIRST_VIEW_X_VAR]: String(centre), [SLIDE_PRODUCT_X0_VAR]: String(x0), [SLIDE_PRODUCT_X1_VAR]: String(x1) }
|
|
12518
|
+
};
|
|
12519
|
+
}
|
|
12520
|
+
|
|
12521
|
+
// src/composed/zoom/EnhancedImageViewer.tsx
|
|
12522
|
+
import { Fragment as Fragment17, jsx as jsx74, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
12299
12523
|
var TransformWrapper = OriginalTransformWrapper;
|
|
12300
12524
|
var TransformComponent = OriginalTransformComponent;
|
|
12525
|
+
function viewerFirstView(image, screen, pictureAspect) {
|
|
12526
|
+
if (image?.fit === "whole") return { by: "whole" };
|
|
12527
|
+
const anchor = firstViewAnchorOfSlide(image ?? {});
|
|
12528
|
+
if (anchor.by === "picture-middle") return anchor;
|
|
12529
|
+
if (pictureAspect !== void 0 && Math.abs(pictureAspect / FIRST_VIEW_PICTURE_ASPECT - 1) > 0.01) {
|
|
12530
|
+
return { by: "picture-middle", why: "picture-not-16:9" };
|
|
12531
|
+
}
|
|
12532
|
+
return { by: anchor.by, view: firstView(screen, anchor) };
|
|
12533
|
+
}
|
|
12534
|
+
var r42 = (n) => Math.round(n * 1e4) / 1e4;
|
|
12301
12535
|
var EnhancedImageViewer = ({
|
|
12302
12536
|
imageUrl,
|
|
12303
12537
|
alt,
|
|
@@ -12306,17 +12540,18 @@ var EnhancedImageViewer = ({
|
|
|
12306
12540
|
onIndexChange,
|
|
12307
12541
|
currentIndex: propCurrentIndex
|
|
12308
12542
|
}) => {
|
|
12309
|
-
const [isMounted, setIsMounted] =
|
|
12310
|
-
const [isClient, setIsClient] =
|
|
12311
|
-
const [scale, setScale] =
|
|
12312
|
-
const [cropDimensions, setCropDimensions] =
|
|
12313
|
-
const [currentZoomScale, setCurrentZoomScale] =
|
|
12314
|
-
const imgRef =
|
|
12315
|
-
const
|
|
12543
|
+
const [isMounted, setIsMounted] = useState39(false);
|
|
12544
|
+
const [isClient, setIsClient] = useState39(false);
|
|
12545
|
+
const [scale, setScale] = useState39({ initial: 1, min: 1, max: 8 });
|
|
12546
|
+
const [cropDimensions, setCropDimensions] = useState39({ width: 0, height: 0 });
|
|
12547
|
+
const [currentZoomScale, setCurrentZoomScale] = useState39(1);
|
|
12548
|
+
const imgRef = useRef26(null);
|
|
12549
|
+
const [loadedAspect, setLoadedAspect] = useState39(null);
|
|
12550
|
+
const touchStartRef = useRef26(
|
|
12316
12551
|
null
|
|
12317
12552
|
);
|
|
12318
|
-
const isSwipingRef =
|
|
12319
|
-
const calculateScale =
|
|
12553
|
+
const isSwipingRef = useRef26(false);
|
|
12554
|
+
const calculateScale = useCallback22(() => {
|
|
12320
12555
|
const viewport = {
|
|
12321
12556
|
width: window.innerWidth,
|
|
12322
12557
|
height: window.innerHeight
|
|
@@ -12328,8 +12563,12 @@ var EnhancedImageViewer = ({
|
|
|
12328
12563
|
max: 8
|
|
12329
12564
|
});
|
|
12330
12565
|
}, []);
|
|
12331
|
-
const handleImageLoad =
|
|
12566
|
+
const handleImageLoad = useCallback22(() => {
|
|
12332
12567
|
calculateScale();
|
|
12568
|
+
const img = imgRef.current;
|
|
12569
|
+
if (img && img.naturalWidth > 0 && img.naturalHeight > 0) {
|
|
12570
|
+
setLoadedAspect({ src: img.currentSrc || img.src, aspect: img.naturalWidth / img.naturalHeight });
|
|
12571
|
+
}
|
|
12333
12572
|
}, [calculateScale]);
|
|
12334
12573
|
useLayoutEffect6(() => {
|
|
12335
12574
|
setIsClient(true);
|
|
@@ -12340,17 +12579,17 @@ var EnhancedImageViewer = ({
|
|
|
12340
12579
|
document.body.style.overflow = "";
|
|
12341
12580
|
};
|
|
12342
12581
|
}, [calculateScale]);
|
|
12343
|
-
|
|
12582
|
+
useEffect39(() => {
|
|
12344
12583
|
calculateScale();
|
|
12345
12584
|
}, [calculateScale]);
|
|
12346
|
-
|
|
12585
|
+
useEffect39(() => {
|
|
12347
12586
|
const handleResize = () => {
|
|
12348
12587
|
calculateScale();
|
|
12349
12588
|
};
|
|
12350
12589
|
window.addEventListener("resize", handleResize);
|
|
12351
12590
|
return () => window.removeEventListener("resize", handleResize);
|
|
12352
12591
|
}, [calculateScale]);
|
|
12353
|
-
|
|
12592
|
+
useEffect39(() => {
|
|
12354
12593
|
const handleKeyDown = (e) => {
|
|
12355
12594
|
if (e.key === "Escape") {
|
|
12356
12595
|
onClose();
|
|
@@ -12376,7 +12615,7 @@ var EnhancedImageViewer = ({
|
|
|
12376
12615
|
document.addEventListener("keydown", handleKeyDown);
|
|
12377
12616
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
12378
12617
|
}, [onClose, imageUrl, images, onIndexChange, propCurrentIndex]);
|
|
12379
|
-
const handleSwipeNavigation =
|
|
12618
|
+
const handleSwipeNavigation = useCallback22(
|
|
12380
12619
|
(direction) => {
|
|
12381
12620
|
let currentIndex = propCurrentIndex !== void 0 ? propCurrentIndex : -1;
|
|
12382
12621
|
if (currentIndex === -1) {
|
|
@@ -12397,7 +12636,7 @@ var EnhancedImageViewer = ({
|
|
|
12397
12636
|
},
|
|
12398
12637
|
[propCurrentIndex, images, imageUrl, onIndexChange]
|
|
12399
12638
|
);
|
|
12400
|
-
const handleTouchStart =
|
|
12639
|
+
const handleTouchStart = useCallback22(
|
|
12401
12640
|
(e) => {
|
|
12402
12641
|
const isAtInitialZoom = Math.abs(currentZoomScale - scale.initial) < 0.1;
|
|
12403
12642
|
if (!isAtInitialZoom) return;
|
|
@@ -12411,7 +12650,7 @@ var EnhancedImageViewer = ({
|
|
|
12411
12650
|
},
|
|
12412
12651
|
[currentZoomScale, scale.initial]
|
|
12413
12652
|
);
|
|
12414
|
-
const handleTouchEnd =
|
|
12653
|
+
const handleTouchEnd = useCallback22(
|
|
12415
12654
|
(e) => {
|
|
12416
12655
|
if (!touchStartRef.current) return;
|
|
12417
12656
|
const touch = e.changedTouches[0];
|
|
@@ -12433,14 +12672,25 @@ var EnhancedImageViewer = ({
|
|
|
12433
12672
|
},
|
|
12434
12673
|
[handleSwipeNavigation]
|
|
12435
12674
|
);
|
|
12675
|
+
const shownIndex = propCurrentIndex ?? images.findIndex((img) => img.src === imageUrl);
|
|
12676
|
+
const shown = images[shownIndex];
|
|
12677
|
+
const shownAspect = loadedAspect && (loadedAspect.src === imageUrl || loadedAspect.src.endsWith(imageUrl)) ? loadedAspect.aspect : shown?.naturalWidth && shown?.naturalHeight ? shown.naturalWidth / shown.naturalHeight : void 0;
|
|
12678
|
+
const opening = viewerFirstView(
|
|
12679
|
+
shown,
|
|
12680
|
+
{
|
|
12681
|
+
width: cropDimensions.width || (typeof window === "undefined" ? 0 : window.innerWidth),
|
|
12682
|
+
height: cropDimensions.height || (typeof window === "undefined" ? 0 : window.innerHeight)
|
|
12683
|
+
},
|
|
12684
|
+
shownAspect
|
|
12685
|
+
);
|
|
12436
12686
|
if (!isMounted || !isClient) {
|
|
12437
12687
|
return createPortal3(
|
|
12438
|
-
/* @__PURE__ */
|
|
12688
|
+
/* @__PURE__ */ jsx74(
|
|
12439
12689
|
"div",
|
|
12440
12690
|
{
|
|
12441
12691
|
className: "fixed inset-0 bg-black flex items-center justify-center",
|
|
12442
12692
|
style: { zIndex: 999999 },
|
|
12443
|
-
children: /* @__PURE__ */
|
|
12693
|
+
children: /* @__PURE__ */ jsx74(
|
|
12444
12694
|
"div",
|
|
12445
12695
|
{
|
|
12446
12696
|
style: {
|
|
@@ -12465,7 +12715,7 @@ var EnhancedImageViewer = ({
|
|
|
12465
12715
|
"aria-modal": "true",
|
|
12466
12716
|
"aria-label": "Image viewer",
|
|
12467
12717
|
children: [
|
|
12468
|
-
/* @__PURE__ */
|
|
12718
|
+
/* @__PURE__ */ jsx74(
|
|
12469
12719
|
"button",
|
|
12470
12720
|
{
|
|
12471
12721
|
onClick: (e) => {
|
|
@@ -12491,10 +12741,10 @@ var EnhancedImageViewer = ({
|
|
|
12491
12741
|
touchAction: "manipulation",
|
|
12492
12742
|
marginBottom: "env(safe-area-inset-bottom, 0px)"
|
|
12493
12743
|
},
|
|
12494
|
-
children: /* @__PURE__ */
|
|
12744
|
+
children: /* @__PURE__ */ jsx74(X2, { className: "w-7 h-7", strokeWidth: 2.5 })
|
|
12495
12745
|
}
|
|
12496
12746
|
),
|
|
12497
|
-
/* @__PURE__ */
|
|
12747
|
+
/* @__PURE__ */ jsx74(
|
|
12498
12748
|
TransformWrapper,
|
|
12499
12749
|
{
|
|
12500
12750
|
initialScale: scale.initial,
|
|
@@ -12541,14 +12791,14 @@ var EnhancedImageViewer = ({
|
|
|
12541
12791
|
onTouchStart: handleTouchStart,
|
|
12542
12792
|
onTouchEnd: handleTouchEnd,
|
|
12543
12793
|
children: [
|
|
12544
|
-
/* @__PURE__ */
|
|
12794
|
+
/* @__PURE__ */ jsx74(
|
|
12545
12795
|
TransformComponent,
|
|
12546
12796
|
{
|
|
12547
12797
|
wrapperStyle: {
|
|
12548
12798
|
width: "100%",
|
|
12549
12799
|
height: "100%"
|
|
12550
12800
|
},
|
|
12551
|
-
children: /* @__PURE__ */
|
|
12801
|
+
children: /* @__PURE__ */ jsx74(
|
|
12552
12802
|
"div",
|
|
12553
12803
|
{
|
|
12554
12804
|
style: {
|
|
@@ -12559,7 +12809,7 @@ var EnhancedImageViewer = ({
|
|
|
12559
12809
|
alignItems: "center",
|
|
12560
12810
|
justifyContent: "center"
|
|
12561
12811
|
},
|
|
12562
|
-
children: /* @__PURE__ */
|
|
12812
|
+
children: /* @__PURE__ */ jsx74(
|
|
12563
12813
|
SafeImg,
|
|
12564
12814
|
{
|
|
12565
12815
|
ref: imgRef,
|
|
@@ -12567,11 +12817,17 @@ var EnhancedImageViewer = ({
|
|
|
12567
12817
|
alt,
|
|
12568
12818
|
crossOrigin: "anonymous",
|
|
12569
12819
|
onLoad: handleImageLoad,
|
|
12820
|
+
"data-first-view": opening.by,
|
|
12821
|
+
"data-first-view-why": opening.by === "picture-middle" ? opening.why : void 0,
|
|
12822
|
+
"data-first-view-product": "view" in opening ? opening.view.product : void 0,
|
|
12823
|
+
"data-first-view-slice": "view" in opening ? `${r42(opening.view.x0)},${r42(opening.view.x1)}` : void 0,
|
|
12570
12824
|
style: {
|
|
12571
12825
|
width: "100%",
|
|
12572
12826
|
height: "100%",
|
|
12573
12827
|
// Crop 16:9 to fill the screen (a hero), or the whole picture for a size picture (a diagram).
|
|
12574
|
-
objectFit:
|
|
12828
|
+
objectFit: opening.by === "whole" ? "contain" : "cover",
|
|
12829
|
+
// Opened on the product by the hero's first-view rule; a picture without the fields keeps the middle.
|
|
12830
|
+
..."view" in opening ? { objectPosition: `${Math.round(opening.view.left * 100) / 100}px 50%` } : {}
|
|
12575
12831
|
}
|
|
12576
12832
|
},
|
|
12577
12833
|
`${imageUrl}-${propCurrentIndex}`
|
|
@@ -12581,7 +12837,7 @@ var EnhancedImageViewer = ({
|
|
|
12581
12837
|
}
|
|
12582
12838
|
),
|
|
12583
12839
|
/* @__PURE__ */ jsxs48("div", { className: "fixed bottom-5 left-0 right-0 z-50", children: [
|
|
12584
|
-
/* @__PURE__ */
|
|
12840
|
+
/* @__PURE__ */ jsx74("div", { className: "flex justify-center gap-2", children: (() => {
|
|
12585
12841
|
let currentIndex = propCurrentIndex !== void 0 ? propCurrentIndex : -1;
|
|
12586
12842
|
if (currentIndex === -1) {
|
|
12587
12843
|
currentIndex = images.findIndex(
|
|
@@ -12615,7 +12871,7 @@ var EnhancedImageViewer = ({
|
|
|
12615
12871
|
const nextIndex = findNextAvailableIndex(currentIndex, 1);
|
|
12616
12872
|
const prevIndex = findNextAvailableIndex(currentIndex, -1);
|
|
12617
12873
|
return /* @__PURE__ */ jsxs48(Fragment17, { children: [
|
|
12618
|
-
/* @__PURE__ */
|
|
12874
|
+
/* @__PURE__ */ jsx74(
|
|
12619
12875
|
"button",
|
|
12620
12876
|
{
|
|
12621
12877
|
onClick: () => {
|
|
@@ -12628,7 +12884,7 @@ var EnhancedImageViewer = ({
|
|
|
12628
12884
|
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"}`,
|
|
12629
12885
|
style: { touchAction: "manipulation" },
|
|
12630
12886
|
"aria-label": "Previous image",
|
|
12631
|
-
children: /* @__PURE__ */
|
|
12887
|
+
children: /* @__PURE__ */ jsx74(
|
|
12632
12888
|
"svg",
|
|
12633
12889
|
{
|
|
12634
12890
|
className: "w-4 h-4",
|
|
@@ -12636,7 +12892,7 @@ var EnhancedImageViewer = ({
|
|
|
12636
12892
|
stroke: "currentColor",
|
|
12637
12893
|
viewBox: "0 0 24 24",
|
|
12638
12894
|
"aria-hidden": "true",
|
|
12639
|
-
children: /* @__PURE__ */
|
|
12895
|
+
children: /* @__PURE__ */ jsx74(
|
|
12640
12896
|
"path",
|
|
12641
12897
|
{
|
|
12642
12898
|
strokeLinecap: "round",
|
|
@@ -12649,7 +12905,7 @@ var EnhancedImageViewer = ({
|
|
|
12649
12905
|
)
|
|
12650
12906
|
}
|
|
12651
12907
|
),
|
|
12652
|
-
/* @__PURE__ */
|
|
12908
|
+
/* @__PURE__ */ jsx74(
|
|
12653
12909
|
"button",
|
|
12654
12910
|
{
|
|
12655
12911
|
onClick: () => {
|
|
@@ -12662,7 +12918,7 @@ var EnhancedImageViewer = ({
|
|
|
12662
12918
|
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"}`,
|
|
12663
12919
|
style: { touchAction: "manipulation" },
|
|
12664
12920
|
"aria-label": "Next image",
|
|
12665
|
-
children: /* @__PURE__ */
|
|
12921
|
+
children: /* @__PURE__ */ jsx74(
|
|
12666
12922
|
"svg",
|
|
12667
12923
|
{
|
|
12668
12924
|
className: "w-4 h-4",
|
|
@@ -12670,7 +12926,7 @@ var EnhancedImageViewer = ({
|
|
|
12670
12926
|
stroke: "currentColor",
|
|
12671
12927
|
viewBox: "0 0 24 24",
|
|
12672
12928
|
"aria-hidden": "true",
|
|
12673
|
-
children: /* @__PURE__ */
|
|
12929
|
+
children: /* @__PURE__ */ jsx74(
|
|
12674
12930
|
"path",
|
|
12675
12931
|
{
|
|
12676
12932
|
strokeLinecap: "round",
|
|
@@ -12685,7 +12941,7 @@ var EnhancedImageViewer = ({
|
|
|
12685
12941
|
)
|
|
12686
12942
|
] });
|
|
12687
12943
|
})() }),
|
|
12688
|
-
/* @__PURE__ */
|
|
12944
|
+
/* @__PURE__ */ jsx74("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: (() => {
|
|
12689
12945
|
const total = Math.max(images.length, 1);
|
|
12690
12946
|
const current = propCurrentIndex !== void 0 ? Math.min(propCurrentIndex + 1, total) : 1;
|
|
12691
12947
|
return `${current} / ${total}`;
|
|
@@ -12697,7 +12953,7 @@ var EnhancedImageViewer = ({
|
|
|
12697
12953
|
},
|
|
12698
12954
|
`${scale.initial}-${scale.min}-${scale.max}`
|
|
12699
12955
|
),
|
|
12700
|
-
/* @__PURE__ */
|
|
12956
|
+
/* @__PURE__ */ jsx74(
|
|
12701
12957
|
"div",
|
|
12702
12958
|
{
|
|
12703
12959
|
className: "absolute inset-0 bg-black",
|
|
@@ -12716,7 +12972,7 @@ var EnhancedImageViewer = ({
|
|
|
12716
12972
|
};
|
|
12717
12973
|
|
|
12718
12974
|
// src/composed/zoom/ResponsiveZoom.tsx
|
|
12719
|
-
import { Fragment as Fragment18, jsx as
|
|
12975
|
+
import { Fragment as Fragment18, jsx as jsx75, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
12720
12976
|
function ResponsiveZoom({
|
|
12721
12977
|
imageIndex,
|
|
12722
12978
|
children,
|
|
@@ -12726,11 +12982,11 @@ function ResponsiveZoom({
|
|
|
12726
12982
|
imageUrl,
|
|
12727
12983
|
alt = "Product image"
|
|
12728
12984
|
}) {
|
|
12729
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
12730
|
-
const [showEnhancedViewer, setShowEnhancedViewer] =
|
|
12731
|
-
const [viewerIndex, setViewerIndex] =
|
|
12732
|
-
const [currentImageUrl, setCurrentImageUrl] =
|
|
12733
|
-
|
|
12985
|
+
const [isTouchDevice, setIsTouchDevice] = useState40(false);
|
|
12986
|
+
const [showEnhancedViewer, setShowEnhancedViewer] = useState40(false);
|
|
12987
|
+
const [viewerIndex, setViewerIndex] = useState40(0);
|
|
12988
|
+
const [currentImageUrl, setCurrentImageUrl] = useState40(imageUrl || "");
|
|
12989
|
+
useEffect40(() => {
|
|
12734
12990
|
const checkDeviceType = () => {
|
|
12735
12991
|
const hasTouch = "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
12736
12992
|
setIsTouchDevice(hasTouch);
|
|
@@ -12758,7 +13014,7 @@ function ResponsiveZoom({
|
|
|
12758
13014
|
}
|
|
12759
13015
|
};
|
|
12760
13016
|
return /* @__PURE__ */ jsxs49(Fragment18, { children: [
|
|
12761
|
-
isTouchDevice ? /* @__PURE__ */
|
|
13017
|
+
isTouchDevice ? /* @__PURE__ */ jsx75(
|
|
12762
13018
|
"div",
|
|
12763
13019
|
{
|
|
12764
13020
|
className,
|
|
@@ -12775,7 +13031,7 @@ function ResponsiveZoom({
|
|
|
12775
13031
|
},
|
|
12776
13032
|
children
|
|
12777
13033
|
}
|
|
12778
|
-
) : /* @__PURE__ */
|
|
13034
|
+
) : /* @__PURE__ */ jsx75(
|
|
12779
13035
|
ZoomOverlay,
|
|
12780
13036
|
{
|
|
12781
13037
|
imageIndex,
|
|
@@ -12786,7 +13042,7 @@ function ResponsiveZoom({
|
|
|
12786
13042
|
children
|
|
12787
13043
|
}
|
|
12788
13044
|
),
|
|
12789
|
-
showEnhancedViewer && isTouchDevice && currentImageUrl && /* @__PURE__ */
|
|
13045
|
+
showEnhancedViewer && isTouchDevice && currentImageUrl && /* @__PURE__ */ jsx75(
|
|
12790
13046
|
EnhancedImageViewer,
|
|
12791
13047
|
{
|
|
12792
13048
|
imageUrl: currentImageUrl,
|
|
@@ -12808,34 +13064,13 @@ function ResponsiveZoom({
|
|
|
12808
13064
|
] });
|
|
12809
13065
|
}
|
|
12810
13066
|
|
|
12811
|
-
// src/composed/carousels/firstView.ts
|
|
12812
|
-
var SLIDE_FIRST_VIEW_ATTR = "data-first-view";
|
|
12813
|
-
var SLIDE_PRODUCT_BOX_ATTR = "data-product-box";
|
|
12814
|
-
var SLIDE_PHONE_WINDOW_ATTR = "data-phone-window";
|
|
12815
|
-
var SLIDE_FIRST_VIEW_X_VAR = "--first-view-x";
|
|
12816
|
-
var SLIDE_PRODUCT_X0_VAR = "--product-x0";
|
|
12817
|
-
var SLIDE_PRODUCT_X1_VAR = "--product-x1";
|
|
12818
|
-
var r4 = (n) => Math.round(n * 1e4) / 1e4;
|
|
12819
|
-
function slideFirstViewProps(image) {
|
|
12820
|
-
const { productBox: box, phoneWindow: phone } = image;
|
|
12821
|
-
if (!box && !phone) return {};
|
|
12822
|
-
const centre = phone ? r4(phone.x + phone.w / 2) : r4(box.x + box.w / 2);
|
|
12823
|
-
const x0 = box ? r4(box.x) : centre, x1 = box ? r4(box.x + box.w) : centre;
|
|
12824
|
-
return {
|
|
12825
|
-
[SLIDE_FIRST_VIEW_ATTR]: phone ? "phone-window" : "product",
|
|
12826
|
-
...box ? { [SLIDE_PRODUCT_BOX_ATTR]: [box.x, box.y, box.w, box.h].map(r4).join(",") } : {},
|
|
12827
|
-
...phone ? { [SLIDE_PHONE_WINDOW_ATTR]: [phone.x, phone.w].map(r4).join(",") } : {},
|
|
12828
|
-
style: { [SLIDE_FIRST_VIEW_X_VAR]: String(centre), [SLIDE_PRODUCT_X0_VAR]: String(x0), [SLIDE_PRODUCT_X1_VAR]: String(x1) }
|
|
12829
|
-
};
|
|
12830
|
-
}
|
|
12831
|
-
|
|
12832
13067
|
// src/composed/carousels/MobileProductCarousel.tsx
|
|
12833
13068
|
import {
|
|
12834
|
-
useState as
|
|
12835
|
-
useRef as
|
|
12836
|
-
useEffect as
|
|
12837
|
-
useCallback as
|
|
12838
|
-
useMemo as
|
|
13069
|
+
useState as useState41,
|
|
13070
|
+
useRef as useRef27,
|
|
13071
|
+
useEffect as useEffect41,
|
|
13072
|
+
useCallback as useCallback23,
|
|
13073
|
+
useMemo as useMemo17,
|
|
12839
13074
|
memo as memo4
|
|
12840
13075
|
} from "react";
|
|
12841
13076
|
|
|
@@ -12848,17 +13083,17 @@ function zoomFit(galleryRole) {
|
|
|
12848
13083
|
}
|
|
12849
13084
|
|
|
12850
13085
|
// src/composed/carousels/MobileProductCarousel.tsx
|
|
12851
|
-
import { jsx as
|
|
13086
|
+
import { jsx as jsx76, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
12852
13087
|
function StaticCarouselImage({
|
|
12853
13088
|
src,
|
|
12854
13089
|
alt,
|
|
12855
13090
|
className
|
|
12856
13091
|
}) {
|
|
12857
|
-
const [failed, setFailed] =
|
|
13092
|
+
const [failed, setFailed] = useState41(false);
|
|
12858
13093
|
if (failed || !src) {
|
|
12859
|
-
return /* @__PURE__ */
|
|
13094
|
+
return /* @__PURE__ */ jsx76("div", { className: `bg-muted ${className ?? ""}`, role: "img", "aria-label": alt });
|
|
12860
13095
|
}
|
|
12861
|
-
return /* @__PURE__ */
|
|
13096
|
+
return /* @__PURE__ */ jsx76(
|
|
12862
13097
|
"img",
|
|
12863
13098
|
{
|
|
12864
13099
|
src,
|
|
@@ -12891,42 +13126,43 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
12891
13126
|
errorText,
|
|
12892
13127
|
unavailableText
|
|
12893
13128
|
}) {
|
|
12894
|
-
const [activeIndex, setActiveIndex] =
|
|
12895
|
-
const
|
|
13129
|
+
const [activeIndex, setActiveIndex] = useState41(currentIndex);
|
|
13130
|
+
const skippedStamp = gallerySkippedStamp(useGallerySkipOptional()?.skipped ?? NO_GALLERY_SKIPS, images ?? []);
|
|
13131
|
+
const [touchStart, setTouchStart] = useState41(
|
|
12896
13132
|
null
|
|
12897
13133
|
);
|
|
12898
|
-
const [touchEnd, setTouchEnd] =
|
|
13134
|
+
const [touchEnd, setTouchEnd] = useState41(
|
|
12899
13135
|
null
|
|
12900
13136
|
);
|
|
12901
|
-
const [showImageViewer, setShowImageViewer] =
|
|
12902
|
-
const [viewerKey, setViewerKey] =
|
|
12903
|
-
const [isDragging, setIsDragging] =
|
|
12904
|
-
const [dragOffset, setDragOffset] =
|
|
12905
|
-
const [isTransitioning, setIsTransitioning] =
|
|
12906
|
-
const [isHorizontalSwipe, setIsHorizontalSwipe] =
|
|
13137
|
+
const [showImageViewer, setShowImageViewer] = useState41(false);
|
|
13138
|
+
const [viewerKey, setViewerKey] = useState41(0);
|
|
13139
|
+
const [isDragging, setIsDragging] = useState41(false);
|
|
13140
|
+
const [dragOffset, setDragOffset] = useState41(0);
|
|
13141
|
+
const [isTransitioning, setIsTransitioning] = useState41(false);
|
|
13142
|
+
const [isHorizontalSwipe, setIsHorizontalSwipe] = useState41(
|
|
12907
13143
|
null
|
|
12908
13144
|
);
|
|
12909
|
-
const [isPeeking, setIsPeeking] =
|
|
12910
|
-
const [isPeekReturning, setIsPeekReturning] =
|
|
12911
|
-
const carouselRef =
|
|
12912
|
-
const indicatorRef =
|
|
12913
|
-
const touchStartRef =
|
|
13145
|
+
const [isPeeking, setIsPeeking] = useState41(false);
|
|
13146
|
+
const [isPeekReturning, setIsPeekReturning] = useState41(false);
|
|
13147
|
+
const carouselRef = useRef27(null);
|
|
13148
|
+
const indicatorRef = useRef27(null);
|
|
13149
|
+
const touchStartRef = useRef27(
|
|
12914
13150
|
null
|
|
12915
13151
|
);
|
|
12916
|
-
const horizontalGestureRef =
|
|
12917
|
-
const hasShownPeekRef =
|
|
12918
|
-
const hasSwipedThisSessionRef =
|
|
12919
|
-
const generatedUrlsRef =
|
|
12920
|
-
const prevArtworkSrcRef =
|
|
12921
|
-
|
|
13152
|
+
const horizontalGestureRef = useRef27(false);
|
|
13153
|
+
const hasShownPeekRef = useRef27(false);
|
|
13154
|
+
const hasSwipedThisSessionRef = useRef27(false);
|
|
13155
|
+
const generatedUrlsRef = useRef27(/* @__PURE__ */ new Map());
|
|
13156
|
+
const prevArtworkSrcRef = useRef27(currentArtwork?.src);
|
|
13157
|
+
useEffect41(() => {
|
|
12922
13158
|
if (currentArtwork?.src !== prevArtworkSrcRef.current) {
|
|
12923
13159
|
generatedUrlsRef.current.clear();
|
|
12924
13160
|
prevArtworkSrcRef.current = currentArtwork?.src;
|
|
12925
13161
|
}
|
|
12926
13162
|
}, [currentArtwork?.src]);
|
|
12927
|
-
const onMockupUrlGeneratedRef =
|
|
13163
|
+
const onMockupUrlGeneratedRef = useRef27(onMockupUrlGenerated);
|
|
12928
13164
|
onMockupUrlGeneratedRef.current = onMockupUrlGenerated;
|
|
12929
|
-
const handleUrlGenerated =
|
|
13165
|
+
const handleUrlGenerated = useCallback23((mockupId, url) => {
|
|
12930
13166
|
generatedUrlsRef.current.set(mockupId, url);
|
|
12931
13167
|
onMockupUrlGeneratedRef.current?.(mockupId, url);
|
|
12932
13168
|
}, []);
|
|
@@ -12934,24 +13170,24 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
12934
13170
|
const shouldHideDots = stickyHeroContext?.shouldHideDots ?? false;
|
|
12935
13171
|
const priorityContext = useMockupPriorityOptional();
|
|
12936
13172
|
const realtimeContext = useRealtimeOptional();
|
|
12937
|
-
const [urlUpdateCounter, setUrlUpdateCounter] =
|
|
12938
|
-
|
|
13173
|
+
const [urlUpdateCounter, setUrlUpdateCounter] = useState41(0);
|
|
13174
|
+
useEffect41(() => {
|
|
12939
13175
|
if (!realtimeContext?.subscribeMockupResults) return;
|
|
12940
13176
|
const unsubscribe = realtimeContext.subscribeMockupResults(() => {
|
|
12941
13177
|
setUrlUpdateCounter((c) => c + 1);
|
|
12942
13178
|
});
|
|
12943
13179
|
return unsubscribe;
|
|
12944
13180
|
}, [realtimeContext?.subscribeMockupResults]);
|
|
12945
|
-
const mockupIds =
|
|
13181
|
+
const mockupIds = useMemo17(() => {
|
|
12946
13182
|
return images.filter((img) => img.isRealMockup && img.mockupId).map((img) => img.mockupId);
|
|
12947
13183
|
}, [images]);
|
|
12948
|
-
const realtimeMockupUrls =
|
|
13184
|
+
const realtimeMockupUrls = useMemo17(() => {
|
|
12949
13185
|
if (!realtimeContext?.getMockupUrls || mockupIds.length === 0) {
|
|
12950
13186
|
return {};
|
|
12951
13187
|
}
|
|
12952
13188
|
return realtimeContext.getMockupUrls(mockupIds);
|
|
12953
13189
|
}, [realtimeContext?.getMockupUrls, mockupIds, urlUpdateCounter]);
|
|
12954
|
-
const imagesWithRealtimeUrls =
|
|
13190
|
+
const imagesWithRealtimeUrls = useMemo17(() => {
|
|
12955
13191
|
return images.map((img) => {
|
|
12956
13192
|
if (img.isRealMockup && img.mockupId && realtimeMockupUrls[img.mockupId]) {
|
|
12957
13193
|
return {
|
|
@@ -12963,10 +13199,10 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
12963
13199
|
});
|
|
12964
13200
|
}, [images, realtimeMockupUrls]);
|
|
12965
13201
|
const minSwipeDistance = 50;
|
|
12966
|
-
|
|
13202
|
+
useEffect41(() => {
|
|
12967
13203
|
setActiveIndex(currentIndex);
|
|
12968
13204
|
}, [currentIndex]);
|
|
12969
|
-
|
|
13205
|
+
useEffect41(() => {
|
|
12970
13206
|
if (!priorityContext) return;
|
|
12971
13207
|
const realMockups = images.map((img, idx) => ({ img, originalIdx: idx })).filter(({ img }) => img.isRealMockup && img.mockupId);
|
|
12972
13208
|
const mockupIdsList = realMockups.map(({ img }) => img.mockupId);
|
|
@@ -12994,7 +13230,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
12994
13230
|
priorityContext.clearMobileCarouselMode?.();
|
|
12995
13231
|
};
|
|
12996
13232
|
}, [priorityContext, activeIndex, images]);
|
|
12997
|
-
|
|
13233
|
+
useEffect41(() => {
|
|
12998
13234
|
const indicator = indicatorRef.current;
|
|
12999
13235
|
if (!indicator) return;
|
|
13000
13236
|
let ticking = false;
|
|
@@ -13035,7 +13271,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13035
13271
|
}, []);
|
|
13036
13272
|
const SWIPE_TRACKING_KEY = "carousel-swipe-tracking";
|
|
13037
13273
|
const PDP_VIEWS_BEFORE_PEEK = 10;
|
|
13038
|
-
const getSwipeTracking =
|
|
13274
|
+
const getSwipeTracking = useCallback23(() => {
|
|
13039
13275
|
try {
|
|
13040
13276
|
const stored = localStorage.getItem(SWIPE_TRACKING_KEY);
|
|
13041
13277
|
if (stored) {
|
|
@@ -13045,7 +13281,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13045
13281
|
}
|
|
13046
13282
|
return { viewsWithoutSwipe: 0, hasEverSwiped: false };
|
|
13047
13283
|
}, []);
|
|
13048
|
-
const recordSwipe =
|
|
13284
|
+
const recordSwipe = useCallback23(() => {
|
|
13049
13285
|
if (hasSwipedThisSessionRef.current) return;
|
|
13050
13286
|
hasSwipedThisSessionRef.current = true;
|
|
13051
13287
|
try {
|
|
@@ -13059,7 +13295,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13059
13295
|
} catch {
|
|
13060
13296
|
}
|
|
13061
13297
|
}, []);
|
|
13062
|
-
|
|
13298
|
+
useEffect41(() => {
|
|
13063
13299
|
if (!enablePeekAnimation || images.length <= 1) return;
|
|
13064
13300
|
const tracking = getSwipeTracking();
|
|
13065
13301
|
const newViewCount = tracking.viewsWithoutSwipe + 1;
|
|
@@ -13100,14 +13336,14 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13100
13336
|
clearTimeout(clearTimeout_);
|
|
13101
13337
|
};
|
|
13102
13338
|
}, [images.length, getSwipeTracking, enablePeekAnimation]);
|
|
13103
|
-
const wasTapRef =
|
|
13104
|
-
const handleImageTap =
|
|
13339
|
+
const wasTapRef = useRef27(false);
|
|
13340
|
+
const handleImageTap = useCallback23(() => {
|
|
13105
13341
|
if (!enableZoom) return;
|
|
13106
13342
|
setViewerKey((prev) => prev + 1);
|
|
13107
13343
|
setShowImageViewer(true);
|
|
13108
13344
|
onZoomChange?.(true);
|
|
13109
13345
|
}, [enableZoom, onZoomChange]);
|
|
13110
|
-
const calculateDragOffset =
|
|
13346
|
+
const calculateDragOffset = useCallback23(
|
|
13111
13347
|
(startX, currentX, containerWidth) => {
|
|
13112
13348
|
const distance = startX - currentX;
|
|
13113
13349
|
const offsetPercent = distance / containerWidth * 100;
|
|
@@ -13132,7 +13368,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13132
13368
|
},
|
|
13133
13369
|
[activeIndex, images.length]
|
|
13134
13370
|
);
|
|
13135
|
-
const handleSwipeEnd =
|
|
13371
|
+
const handleSwipeEnd = useCallback23(
|
|
13136
13372
|
(startX, endX, containerWidth) => {
|
|
13137
13373
|
const distance = startX - endX;
|
|
13138
13374
|
const distancePercent = Math.abs(distance) / containerWidth * 100;
|
|
@@ -13163,7 +13399,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13163
13399
|
},
|
|
13164
13400
|
[activeIndex, images.length, onIndexChange, recordSwipe]
|
|
13165
13401
|
);
|
|
13166
|
-
|
|
13402
|
+
useEffect41(() => {
|
|
13167
13403
|
const container = carouselRef.current;
|
|
13168
13404
|
if (!container) return;
|
|
13169
13405
|
const handleTouchStart = (e) => {
|
|
@@ -13252,11 +13488,11 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13252
13488
|
handleSwipeEnd,
|
|
13253
13489
|
handleImageTap
|
|
13254
13490
|
]);
|
|
13255
|
-
const mouseStartRef =
|
|
13491
|
+
const mouseStartRef = useRef27(
|
|
13256
13492
|
null
|
|
13257
13493
|
);
|
|
13258
|
-
const isMouseDraggingRef =
|
|
13259
|
-
|
|
13494
|
+
const isMouseDraggingRef = useRef27(false);
|
|
13495
|
+
useEffect41(() => {
|
|
13260
13496
|
const container = carouselRef.current;
|
|
13261
13497
|
if (!container) return;
|
|
13262
13498
|
const handleMouseDown = (e) => {
|
|
@@ -13332,7 +13568,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13332
13568
|
container.removeEventListener("mouseleave", handleMouseLeave);
|
|
13333
13569
|
};
|
|
13334
13570
|
}, [calculateDragOffset, handleSwipeEnd, handleImageTap]);
|
|
13335
|
-
const goToSlide =
|
|
13571
|
+
const goToSlide = useCallback23(
|
|
13336
13572
|
(index, withTransition = true) => {
|
|
13337
13573
|
if (withTransition) {
|
|
13338
13574
|
setIsTransitioning(true);
|
|
@@ -13350,16 +13586,16 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13350
13586
|
},
|
|
13351
13587
|
[onIndexChange]
|
|
13352
13588
|
);
|
|
13353
|
-
|
|
13589
|
+
useEffect41(() => {
|
|
13354
13590
|
if (stickyHeroContext?.setCarouselIndicator && images.length > 1) {
|
|
13355
|
-
const indicator = /* @__PURE__ */
|
|
13591
|
+
const indicator = /* @__PURE__ */ jsx76(
|
|
13356
13592
|
"div",
|
|
13357
13593
|
{
|
|
13358
13594
|
className: "w-full",
|
|
13359
13595
|
role: "group",
|
|
13360
13596
|
"aria-label": "Product image navigation",
|
|
13361
13597
|
children: /* @__PURE__ */ jsxs50("div", { className: "relative h-1", children: [
|
|
13362
|
-
/* @__PURE__ */
|
|
13598
|
+
/* @__PURE__ */ jsx76("div", { className: "flex h-full", children: images.map((_, index) => /* @__PURE__ */ jsx76(
|
|
13363
13599
|
"button",
|
|
13364
13600
|
{
|
|
13365
13601
|
onClick: () => goToSlide(index),
|
|
@@ -13369,7 +13605,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13369
13605
|
},
|
|
13370
13606
|
index
|
|
13371
13607
|
)) }),
|
|
13372
|
-
/* @__PURE__ */
|
|
13608
|
+
/* @__PURE__ */ jsx76(
|
|
13373
13609
|
"div",
|
|
13374
13610
|
{
|
|
13375
13611
|
className: "absolute top-0 h-full bg-primary transition-all duration-300 ease-out",
|
|
@@ -13392,10 +13628,10 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13392
13628
|
};
|
|
13393
13629
|
}, [activeIndex, images.length, goToSlide, stickyHeroContext]);
|
|
13394
13630
|
if (!images || images.length === 0) {
|
|
13395
|
-
return /* @__PURE__ */
|
|
13631
|
+
return /* @__PURE__ */ jsx76("div", { className: "w-full aspect-video bg-muted rounded-lg" });
|
|
13396
13632
|
}
|
|
13397
|
-
return /* @__PURE__ */ jsxs50("div", { className: `relative w-full h-full ${className}`, children: [
|
|
13398
|
-
/* @__PURE__ */
|
|
13633
|
+
return /* @__PURE__ */ jsxs50("div", { className: `relative w-full h-full ${className}`, "data-gallery": "product", "data-gallery-skipped": skippedStamp, children: [
|
|
13634
|
+
/* @__PURE__ */ jsx76(
|
|
13399
13635
|
"div",
|
|
13400
13636
|
{
|
|
13401
13637
|
ref: carouselRef,
|
|
@@ -13413,7 +13649,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13413
13649
|
role: "region",
|
|
13414
13650
|
"aria-roledescription": "carousel",
|
|
13415
13651
|
"aria-label": "Product images",
|
|
13416
|
-
children: /* @__PURE__ */
|
|
13652
|
+
children: /* @__PURE__ */ jsx76(
|
|
13417
13653
|
"div",
|
|
13418
13654
|
{
|
|
13419
13655
|
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)]" : ""}`,
|
|
@@ -13431,11 +13667,11 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13431
13667
|
"data-mockup-id": image.galleryRole ? image.mockupId : void 0,
|
|
13432
13668
|
...slideFirstViewProps(image.isRealMockup ? image : {}),
|
|
13433
13669
|
children: [
|
|
13434
|
-
!isWithinDecodeWindow ? /* @__PURE__ */
|
|
13670
|
+
!isWithinDecodeWindow ? /* @__PURE__ */ jsx76("div", { className: "w-full h-full bg-muted" }) : image.isPlaceholder ? (
|
|
13435
13671
|
// Rainbow prism loader (same as the /create route) instead of
|
|
13436
13672
|
// a flat pulse; fills this relative slide via inset:0.
|
|
13437
|
-
/* @__PURE__ */
|
|
13438
|
-
) : image.isRealMockup && currentArtwork ? /* @__PURE__ */
|
|
13673
|
+
/* @__PURE__ */ jsx76(LoadingOverlayPrismCandyInline, { visible: true, variant: "light" })
|
|
13674
|
+
) : image.isRealMockup && currentArtwork ? /* @__PURE__ */ jsx76(
|
|
13439
13675
|
HeroProductImage,
|
|
13440
13676
|
{
|
|
13441
13677
|
productId,
|
|
@@ -13452,7 +13688,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13452
13688
|
viewportPolicy: true,
|
|
13453
13689
|
fit: slideFit(image.galleryRole)
|
|
13454
13690
|
}
|
|
13455
|
-
) : image.isRealMockup && !currentArtwork ? /* @__PURE__ */
|
|
13691
|
+
) : image.isRealMockup && !currentArtwork ? /* @__PURE__ */ jsx76(LoadingOverlayPrismCandyInline, { visible: true, variant: "light" }) : /* @__PURE__ */ jsx76(
|
|
13456
13692
|
StaticCarouselImage,
|
|
13457
13693
|
{
|
|
13458
13694
|
src: image.src,
|
|
@@ -13462,7 +13698,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13462
13698
|
),
|
|
13463
13699
|
isWithinDecodeWindow && (() => {
|
|
13464
13700
|
const action = renderImageAction?.(image, index);
|
|
13465
|
-
return action ? /* @__PURE__ */
|
|
13701
|
+
return action ? /* @__PURE__ */ jsx76(
|
|
13466
13702
|
"div",
|
|
13467
13703
|
{
|
|
13468
13704
|
className: "absolute top-3 right-3 z-10",
|
|
@@ -13476,14 +13712,14 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13476
13712
|
})()
|
|
13477
13713
|
]
|
|
13478
13714
|
},
|
|
13479
|
-
index
|
|
13715
|
+
image.mockupId ? `m:${image.mockupId}` : `i:${index}`
|
|
13480
13716
|
);
|
|
13481
13717
|
})
|
|
13482
13718
|
}
|
|
13483
13719
|
)
|
|
13484
13720
|
}
|
|
13485
13721
|
),
|
|
13486
|
-
showIndicators && images.length > 1 && /* @__PURE__ */
|
|
13722
|
+
showIndicators && images.length > 1 && /* @__PURE__ */ jsx76(
|
|
13487
13723
|
"div",
|
|
13488
13724
|
{
|
|
13489
13725
|
ref: indicatorRef,
|
|
@@ -13492,7 +13728,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13492
13728
|
role: "group",
|
|
13493
13729
|
"aria-label": "Product image navigation",
|
|
13494
13730
|
children: /* @__PURE__ */ jsxs50("div", { className: "relative h-1", children: [
|
|
13495
|
-
/* @__PURE__ */
|
|
13731
|
+
/* @__PURE__ */ jsx76("div", { className: "flex h-full absolute inset-0", children: images.map((_, index) => /* @__PURE__ */ jsx76(
|
|
13496
13732
|
"button",
|
|
13497
13733
|
{
|
|
13498
13734
|
onClick: () => goToSlide(index),
|
|
@@ -13502,7 +13738,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13502
13738
|
},
|
|
13503
13739
|
index
|
|
13504
13740
|
)) }),
|
|
13505
|
-
/* @__PURE__ */
|
|
13741
|
+
/* @__PURE__ */ jsx76(
|
|
13506
13742
|
"div",
|
|
13507
13743
|
{
|
|
13508
13744
|
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"}`,
|
|
@@ -13535,10 +13771,12 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13535
13771
|
alt: img.label,
|
|
13536
13772
|
naturalWidth: img.naturalWidth,
|
|
13537
13773
|
naturalHeight: img.naturalHeight,
|
|
13538
|
-
...zoomFit(img.galleryRole) === "whole" ? { fit: "whole" } : {}
|
|
13774
|
+
...zoomFit(img.galleryRole) === "whole" ? { fit: "whole" } : {},
|
|
13775
|
+
// the viewer opens on the product by the hero's first-view rule (EnhancedImageViewer viewerFirstView)
|
|
13776
|
+
...slideFirstViewFields(img)
|
|
13539
13777
|
} : null;
|
|
13540
13778
|
}).filter((img) => img !== null);
|
|
13541
|
-
return /* @__PURE__ */
|
|
13779
|
+
return /* @__PURE__ */ jsx76(
|
|
13542
13780
|
EnhancedImageViewer,
|
|
13543
13781
|
{
|
|
13544
13782
|
imageUrl,
|
|
@@ -13577,8 +13815,8 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13577
13815
|
});
|
|
13578
13816
|
|
|
13579
13817
|
// src/composed/carousels/HeroCarousel.tsx
|
|
13580
|
-
import { useState as
|
|
13581
|
-
import { jsx as
|
|
13818
|
+
import { useState as useState42, useRef as useRef28, useCallback as useCallback24, useEffect as useEffect42 } from "react";
|
|
13819
|
+
import { jsx as jsx77, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
13582
13820
|
function HeroCarousel({
|
|
13583
13821
|
images,
|
|
13584
13822
|
currentIndex = 0,
|
|
@@ -13588,16 +13826,16 @@ function HeroCarousel({
|
|
|
13588
13826
|
productId,
|
|
13589
13827
|
onImageTap
|
|
13590
13828
|
}) {
|
|
13591
|
-
const [activeIndex, setActiveIndex] =
|
|
13592
|
-
const containerRef =
|
|
13593
|
-
const touchStartRef =
|
|
13829
|
+
const [activeIndex, setActiveIndex] = useState42(currentIndex);
|
|
13830
|
+
const containerRef = useRef28(null);
|
|
13831
|
+
const touchStartRef = useRef28(
|
|
13594
13832
|
null
|
|
13595
13833
|
);
|
|
13596
|
-
const isSwipingRef =
|
|
13597
|
-
|
|
13834
|
+
const isSwipingRef = useRef28(false);
|
|
13835
|
+
useEffect42(() => {
|
|
13598
13836
|
setActiveIndex(currentIndex);
|
|
13599
13837
|
}, [currentIndex]);
|
|
13600
|
-
const goToSlide =
|
|
13838
|
+
const goToSlide = useCallback24(
|
|
13601
13839
|
(index) => {
|
|
13602
13840
|
const clampedIndex = Math.max(0, Math.min(images.length - 1, index));
|
|
13603
13841
|
setActiveIndex(clampedIndex);
|
|
@@ -13605,7 +13843,7 @@ function HeroCarousel({
|
|
|
13605
13843
|
},
|
|
13606
13844
|
[images.length, onIndexChange]
|
|
13607
13845
|
);
|
|
13608
|
-
|
|
13846
|
+
useEffect42(() => {
|
|
13609
13847
|
const container = containerRef.current;
|
|
13610
13848
|
if (!container) return;
|
|
13611
13849
|
const handleTouchStart = (e) => {
|
|
@@ -13657,7 +13895,7 @@ function HeroCarousel({
|
|
|
13657
13895
|
};
|
|
13658
13896
|
}, [activeIndex, images.length, goToSlide, onImageTap]);
|
|
13659
13897
|
if (!images || images.length === 0) {
|
|
13660
|
-
return /* @__PURE__ */
|
|
13898
|
+
return /* @__PURE__ */ jsx77("div", { className: "w-full h-full bg-muted" });
|
|
13661
13899
|
}
|
|
13662
13900
|
return /* @__PURE__ */ jsxs51(
|
|
13663
13901
|
"div",
|
|
@@ -13670,7 +13908,7 @@ function HeroCarousel({
|
|
|
13670
13908
|
overflow: "hidden"
|
|
13671
13909
|
},
|
|
13672
13910
|
children: [
|
|
13673
|
-
/* @__PURE__ */
|
|
13911
|
+
/* @__PURE__ */ jsx77(
|
|
13674
13912
|
"div",
|
|
13675
13913
|
{
|
|
13676
13914
|
className: "flex h-full transition-transform duration-300 ease-out",
|
|
@@ -13681,14 +13919,14 @@ function HeroCarousel({
|
|
|
13681
13919
|
backfaceVisibility: "hidden",
|
|
13682
13920
|
WebkitBackfaceVisibility: "hidden"
|
|
13683
13921
|
},
|
|
13684
|
-
children: images.map((image, index) => /* @__PURE__ */
|
|
13922
|
+
children: images.map((image, index) => /* @__PURE__ */ jsx77(
|
|
13685
13923
|
"div",
|
|
13686
13924
|
{
|
|
13687
13925
|
className: "w-full h-full flex-shrink-0",
|
|
13688
13926
|
style: {
|
|
13689
13927
|
contain: "layout paint"
|
|
13690
13928
|
},
|
|
13691
|
-
children: image.isRealMockup && currentArtwork ? /* @__PURE__ */
|
|
13929
|
+
children: image.isRealMockup && currentArtwork ? /* @__PURE__ */ jsx77(
|
|
13692
13930
|
HeroProductImage,
|
|
13693
13931
|
{
|
|
13694
13932
|
productId,
|
|
@@ -13697,7 +13935,7 @@ function HeroCarousel({
|
|
|
13697
13935
|
mockupId: image.mockupId,
|
|
13698
13936
|
className: "w-full h-full object-cover"
|
|
13699
13937
|
}
|
|
13700
|
-
) : /* @__PURE__ */
|
|
13938
|
+
) : /* @__PURE__ */ jsx77(
|
|
13701
13939
|
"img",
|
|
13702
13940
|
{
|
|
13703
13941
|
src: image.src,
|
|
@@ -13714,12 +13952,12 @@ function HeroCarousel({
|
|
|
13714
13952
|
))
|
|
13715
13953
|
}
|
|
13716
13954
|
),
|
|
13717
|
-
images.length > 1 && /* @__PURE__ */
|
|
13955
|
+
images.length > 1 && /* @__PURE__ */ jsx77(
|
|
13718
13956
|
"div",
|
|
13719
13957
|
{
|
|
13720
13958
|
className: "absolute bottom-4 left-0 right-0 flex justify-center gap-2 z-10",
|
|
13721
13959
|
style: { contain: "layout style" },
|
|
13722
|
-
children: images.map((_, index) => /* @__PURE__ */
|
|
13960
|
+
children: images.map((_, index) => /* @__PURE__ */ jsx77(
|
|
13723
13961
|
"button",
|
|
13724
13962
|
{
|
|
13725
13963
|
onClick: () => goToSlide(index),
|
|
@@ -13736,8 +13974,8 @@ function HeroCarousel({
|
|
|
13736
13974
|
}
|
|
13737
13975
|
|
|
13738
13976
|
// src/composed/grids/MasonryGrid.tsx
|
|
13739
|
-
import { useState as
|
|
13740
|
-
import { Fragment as Fragment19, jsx as
|
|
13977
|
+
import { useState as useState43, useEffect as useEffect43, useMemo as useMemo18 } from "react";
|
|
13978
|
+
import { Fragment as Fragment19, jsx as jsx78 } from "react/jsx-runtime";
|
|
13741
13979
|
var BREAKPOINTS = {
|
|
13742
13980
|
sm: 640,
|
|
13743
13981
|
md: 768,
|
|
@@ -13789,13 +14027,13 @@ function MasonryGrid({
|
|
|
13789
14027
|
className = "",
|
|
13790
14028
|
emptyContent
|
|
13791
14029
|
}) {
|
|
13792
|
-
const [columnCount, setColumnCount] =
|
|
14030
|
+
const [columnCount, setColumnCount] = useState43(
|
|
13793
14031
|
() => typeof columns === "number" ? columns : getColumnCount(
|
|
13794
14032
|
typeof window !== "undefined" ? window.innerWidth : 1024,
|
|
13795
14033
|
columns
|
|
13796
14034
|
)
|
|
13797
14035
|
);
|
|
13798
|
-
|
|
14036
|
+
useEffect43(() => {
|
|
13799
14037
|
const updateColumnCount = () => {
|
|
13800
14038
|
setColumnCount(getColumnCount(window.innerWidth, columns));
|
|
13801
14039
|
};
|
|
@@ -13803,30 +14041,30 @@ function MasonryGrid({
|
|
|
13803
14041
|
window.addEventListener("resize", updateColumnCount);
|
|
13804
14042
|
return () => window.removeEventListener("resize", updateColumnCount);
|
|
13805
14043
|
}, [columns]);
|
|
13806
|
-
const distributedColumns =
|
|
14044
|
+
const distributedColumns = useMemo18(
|
|
13807
14045
|
() => distributeItems(items, columnCount),
|
|
13808
14046
|
[items, columnCount]
|
|
13809
14047
|
);
|
|
13810
14048
|
if (items.length === 0) {
|
|
13811
14049
|
if (emptyContent) {
|
|
13812
|
-
return /* @__PURE__ */
|
|
14050
|
+
return /* @__PURE__ */ jsx78(Fragment19, { children: emptyContent });
|
|
13813
14051
|
}
|
|
13814
14052
|
return null;
|
|
13815
14053
|
}
|
|
13816
|
-
return /* @__PURE__ */
|
|
14054
|
+
return /* @__PURE__ */ jsx78(
|
|
13817
14055
|
"div",
|
|
13818
14056
|
{
|
|
13819
14057
|
className: `flex ${className}`,
|
|
13820
14058
|
style: { gap: `${gap}px` },
|
|
13821
14059
|
role: "list",
|
|
13822
|
-
children: distributedColumns.map((columnItems, columnIndex) => /* @__PURE__ */
|
|
14060
|
+
children: distributedColumns.map((columnItems, columnIndex) => /* @__PURE__ */ jsx78(
|
|
13823
14061
|
"div",
|
|
13824
14062
|
{
|
|
13825
14063
|
className: "flex-1 flex flex-col",
|
|
13826
14064
|
style: { gap: `${gap}px` },
|
|
13827
14065
|
children: columnItems.map((item, itemIndex) => {
|
|
13828
14066
|
const originalIndex = itemIndex * columnCount + columnIndex;
|
|
13829
|
-
return /* @__PURE__ */
|
|
14067
|
+
return /* @__PURE__ */ jsx78("div", { role: "listitem", children: renderItem(item, originalIndex) }, originalIndex);
|
|
13830
14068
|
})
|
|
13831
14069
|
},
|
|
13832
14070
|
columnIndex
|
|
@@ -13836,7 +14074,7 @@ function MasonryGrid({
|
|
|
13836
14074
|
}
|
|
13837
14075
|
|
|
13838
14076
|
// src/layouts/hero-zoom/HeroZoomLayout.tsx
|
|
13839
|
-
import { useEffect as
|
|
14077
|
+
import { useEffect as useEffect45, useRef as useRef29 } from "react";
|
|
13840
14078
|
|
|
13841
14079
|
// src/layouts/hero-zoom/types.ts
|
|
13842
14080
|
var DEFAULT_HERO_ZOOM_CONFIG = {
|
|
@@ -13848,19 +14086,19 @@ var DEFAULT_HERO_ZOOM_CONFIG = {
|
|
|
13848
14086
|
};
|
|
13849
14087
|
|
|
13850
14088
|
// src/layouts/hero-zoom/useHeroZoomScales.ts
|
|
13851
|
-
import { useEffect as
|
|
14089
|
+
import { useEffect as useEffect44, useState as useState44, useCallback as useCallback25 } from "react";
|
|
13852
14090
|
function useHeroZoomScales(config = {}) {
|
|
13853
14091
|
const { initialScale, accountForRetina, maxRetinaMultiplier } = {
|
|
13854
14092
|
...DEFAULT_HERO_ZOOM_CONFIG,
|
|
13855
14093
|
...config
|
|
13856
14094
|
};
|
|
13857
|
-
const [isHydrated, setIsHydrated] =
|
|
14095
|
+
const [isHydrated, setIsHydrated] = useState44(false);
|
|
13858
14096
|
const ssrMultiplier = accountForRetina ? maxRetinaMultiplier : 2;
|
|
13859
|
-
const [scales, setScales] =
|
|
14097
|
+
const [scales, setScales] = useState44(() => ({
|
|
13860
14098
|
visual: initialScale,
|
|
13861
14099
|
render: initialScale * ssrMultiplier
|
|
13862
14100
|
}));
|
|
13863
|
-
const calculateScales =
|
|
14101
|
+
const calculateScales = useCallback25(() => {
|
|
13864
14102
|
const visualScale = Math.max(1, Math.min(4, initialScale));
|
|
13865
14103
|
let renderScale;
|
|
13866
14104
|
if (accountForRetina) {
|
|
@@ -13875,7 +14113,7 @@ function useHeroZoomScales(config = {}) {
|
|
|
13875
14113
|
renderScale = Math.max(1, Math.min(8, renderScale));
|
|
13876
14114
|
return { visual: visualScale, render: renderScale };
|
|
13877
14115
|
}, [initialScale, accountForRetina, maxRetinaMultiplier]);
|
|
13878
|
-
|
|
14116
|
+
useEffect44(() => {
|
|
13879
14117
|
const supportsScrollTimeline = CSS.supports(
|
|
13880
14118
|
"animation-timeline",
|
|
13881
14119
|
"scroll()"
|
|
@@ -13925,7 +14163,7 @@ function useHeroZoomScales(config = {}) {
|
|
|
13925
14163
|
}
|
|
13926
14164
|
|
|
13927
14165
|
// src/layouts/hero-zoom/HeroZoomLayout.tsx
|
|
13928
|
-
import { jsx as
|
|
14166
|
+
import { jsx as jsx79, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
13929
14167
|
function HeroZoomLayout({
|
|
13930
14168
|
config = {},
|
|
13931
14169
|
header,
|
|
@@ -13940,9 +14178,9 @@ function HeroZoomLayout({
|
|
|
13940
14178
|
};
|
|
13941
14179
|
const { aspectRatio, initialScale, headerHeight } = mergedConfig;
|
|
13942
14180
|
const { visual, render, isHydrated } = useHeroZoomScales(mergedConfig);
|
|
13943
|
-
const imageContainerRef =
|
|
13944
|
-
const headerRef =
|
|
13945
|
-
|
|
14181
|
+
const imageContainerRef = useRef29(null);
|
|
14182
|
+
const headerRef = useRef29(null);
|
|
14183
|
+
useEffect45(() => {
|
|
13946
14184
|
if (typeof window === "undefined") return;
|
|
13947
14185
|
const originalRestoration = "scrollRestoration" in history ? history.scrollRestoration : "auto";
|
|
13948
14186
|
if ("scrollRestoration" in history) {
|
|
@@ -13955,7 +14193,7 @@ function HeroZoomLayout({
|
|
|
13955
14193
|
}
|
|
13956
14194
|
};
|
|
13957
14195
|
}, []);
|
|
13958
|
-
|
|
14196
|
+
useEffect45(() => {
|
|
13959
14197
|
const supportsScrollTimeline = CSS.supports(
|
|
13960
14198
|
"animation-timeline",
|
|
13961
14199
|
"scroll()"
|
|
@@ -14098,8 +14336,8 @@ function HeroZoomLayout({
|
|
|
14098
14336
|
"--hero-zoom-final-transform": 1 / activeRender
|
|
14099
14337
|
},
|
|
14100
14338
|
children: [
|
|
14101
|
-
/* @__PURE__ */
|
|
14102
|
-
/* @__PURE__ */
|
|
14339
|
+
/* @__PURE__ */ jsx79("style", { dangerouslySetInnerHTML: { __html: scopedStyles } }),
|
|
14340
|
+
/* @__PURE__ */ jsx79(
|
|
14103
14341
|
"div",
|
|
14104
14342
|
{
|
|
14105
14343
|
style: {
|
|
@@ -14107,7 +14345,7 @@ function HeroZoomLayout({
|
|
|
14107
14345
|
}
|
|
14108
14346
|
}
|
|
14109
14347
|
),
|
|
14110
|
-
header && /* @__PURE__ */
|
|
14348
|
+
header && /* @__PURE__ */ jsx79(
|
|
14111
14349
|
"div",
|
|
14112
14350
|
{
|
|
14113
14351
|
ref: headerRef,
|
|
@@ -14120,7 +14358,7 @@ function HeroZoomLayout({
|
|
|
14120
14358
|
children: header
|
|
14121
14359
|
}
|
|
14122
14360
|
),
|
|
14123
|
-
/* @__PURE__ */
|
|
14361
|
+
/* @__PURE__ */ jsx79(
|
|
14124
14362
|
"div",
|
|
14125
14363
|
{
|
|
14126
14364
|
ref: imageContainerRef,
|
|
@@ -14140,15 +14378,15 @@ function HeroZoomLayout({
|
|
|
14140
14378
|
children: hero
|
|
14141
14379
|
}
|
|
14142
14380
|
),
|
|
14143
|
-
/* @__PURE__ */
|
|
14381
|
+
/* @__PURE__ */ jsx79("div", { className: "relative z-10", children })
|
|
14144
14382
|
]
|
|
14145
14383
|
}
|
|
14146
14384
|
);
|
|
14147
14385
|
}
|
|
14148
14386
|
|
|
14149
14387
|
// src/layouts/hero-zoom/HeroShrinkLayout.tsx
|
|
14150
|
-
import { useEffect as
|
|
14151
|
-
import { jsx as
|
|
14388
|
+
import { useEffect as useEffect46, useRef as useRef30, useState as useState45 } from "react";
|
|
14389
|
+
import { jsx as jsx80, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
14152
14390
|
var DEFAULT_CONFIG = {
|
|
14153
14391
|
aspectRatio: 16 / 9,
|
|
14154
14392
|
initialHeightPercent: 70,
|
|
@@ -14168,13 +14406,13 @@ function HeroShrinkLayout({
|
|
|
14168
14406
|
...config
|
|
14169
14407
|
};
|
|
14170
14408
|
const { aspectRatio, initialHeightPercent, minHeightPercent, headerHeight } = mergedConfig;
|
|
14171
|
-
const heroRef =
|
|
14172
|
-
const headerRef =
|
|
14173
|
-
const [isClient, setIsClient] =
|
|
14174
|
-
|
|
14409
|
+
const heroRef = useRef30(null);
|
|
14410
|
+
const headerRef = useRef30(null);
|
|
14411
|
+
const [isClient, setIsClient] = useState45(false);
|
|
14412
|
+
useEffect46(() => {
|
|
14175
14413
|
setIsClient(true);
|
|
14176
14414
|
}, []);
|
|
14177
|
-
|
|
14415
|
+
useEffect46(() => {
|
|
14178
14416
|
if (!isClient) return;
|
|
14179
14417
|
const supportsScrollTimeline = CSS.supports("animation-timeline", "scroll()");
|
|
14180
14418
|
if (supportsScrollTimeline) return;
|
|
@@ -14267,9 +14505,9 @@ function HeroShrinkLayout({
|
|
|
14267
14505
|
className: `relative min-h-screen ${className}`,
|
|
14268
14506
|
style: { ...style, ...cssVars },
|
|
14269
14507
|
children: [
|
|
14270
|
-
/* @__PURE__ */
|
|
14271
|
-
/* @__PURE__ */
|
|
14272
|
-
header && /* @__PURE__ */
|
|
14508
|
+
/* @__PURE__ */ jsx80("style", { dangerouslySetInnerHTML: { __html: scopedStyles } }),
|
|
14509
|
+
/* @__PURE__ */ jsx80("div", { style: { height: spacerHeight } }),
|
|
14510
|
+
header && /* @__PURE__ */ jsx80(
|
|
14273
14511
|
"div",
|
|
14274
14512
|
{
|
|
14275
14513
|
ref: headerRef,
|
|
@@ -14278,7 +14516,7 @@ function HeroShrinkLayout({
|
|
|
14278
14516
|
children: header
|
|
14279
14517
|
}
|
|
14280
14518
|
),
|
|
14281
|
-
/* @__PURE__ */
|
|
14519
|
+
/* @__PURE__ */ jsx80(
|
|
14282
14520
|
"div",
|
|
14283
14521
|
{
|
|
14284
14522
|
ref: heroRef,
|
|
@@ -14286,15 +14524,15 @@ function HeroShrinkLayout({
|
|
|
14286
14524
|
children: hero
|
|
14287
14525
|
}
|
|
14288
14526
|
),
|
|
14289
|
-
/* @__PURE__ */
|
|
14527
|
+
/* @__PURE__ */ jsx80("div", { className: "relative z-10 bg-background", children })
|
|
14290
14528
|
]
|
|
14291
14529
|
}
|
|
14292
14530
|
);
|
|
14293
14531
|
}
|
|
14294
14532
|
|
|
14295
14533
|
// src/layouts/pdp/ImageEdgeBlur.tsx
|
|
14296
|
-
import
|
|
14297
|
-
import { jsx as
|
|
14534
|
+
import React54 from "react";
|
|
14535
|
+
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
14298
14536
|
var BLUR_CONFIG = {
|
|
14299
14537
|
blur: 24,
|
|
14300
14538
|
crossfade: 68
|
|
@@ -14318,7 +14556,7 @@ var BLUR_LAYERS = [
|
|
|
14318
14556
|
{ blur: Math.round(BLUR_CONFIG.blur * 0.5), zone: 0.6 },
|
|
14319
14557
|
{ blur: BLUR_CONFIG.blur, zone: 1 }
|
|
14320
14558
|
];
|
|
14321
|
-
var ImageEdgeBlur =
|
|
14559
|
+
var ImageEdgeBlur = React54.memo(
|
|
14322
14560
|
function ImageEdgeBlur2({
|
|
14323
14561
|
imageSrc,
|
|
14324
14562
|
imageCapInfo,
|
|
@@ -14349,7 +14587,7 @@ var ImageEdgeBlur = React53.memo(
|
|
|
14349
14587
|
viewportWidth / LAYOUT_CONFIG2.IMAGE.ASPECT_RATIO,
|
|
14350
14588
|
maxWidthPx / LAYOUT_CONFIG2.IMAGE.ASPECT_RATIO
|
|
14351
14589
|
);
|
|
14352
|
-
return /* @__PURE__ */
|
|
14590
|
+
return /* @__PURE__ */ jsx81(
|
|
14353
14591
|
"div",
|
|
14354
14592
|
{
|
|
14355
14593
|
className: `absolute inset-0 pointer-events-none overflow-hidden ${className}`,
|
|
@@ -14357,7 +14595,7 @@ var ImageEdgeBlur = React53.memo(
|
|
|
14357
14595
|
children: BLUR_LAYERS.map((layer, index) => {
|
|
14358
14596
|
const layerMask = index === BLUR_LAYERS.length - 1 ? void 0 : `linear-gradient(to right, black 0%, black ${layer.zone * 100}%, transparent ${layer.zone * 100 + 10}%)`;
|
|
14359
14597
|
const blurScale = 1 + layer.blur * 3 / containerHeightPx;
|
|
14360
|
-
return /* @__PURE__ */
|
|
14598
|
+
return /* @__PURE__ */ jsx81(
|
|
14361
14599
|
"img",
|
|
14362
14600
|
{
|
|
14363
14601
|
src: imageSrc,
|
|
@@ -14404,7 +14642,7 @@ var ImageEdgeBlur = React53.memo(
|
|
|
14404
14642
|
);
|
|
14405
14643
|
|
|
14406
14644
|
// src/layouts/pdp/PDPLayout.tsx
|
|
14407
|
-
import { jsx as
|
|
14645
|
+
import { jsx as jsx82, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
14408
14646
|
function PDPLayout({
|
|
14409
14647
|
renderHeroImage,
|
|
14410
14648
|
renderContent,
|
|
@@ -14434,13 +14672,13 @@ function PDPLayout({
|
|
|
14434
14672
|
};
|
|
14435
14673
|
return /* @__PURE__ */ jsxs54("div", { className: `pdp-layout ${className}`, children: [
|
|
14436
14674
|
(isDesktop === false || isDesktop === null) && /* @__PURE__ */ jsxs54("div", { className: "md:hidden", children: [
|
|
14437
|
-
renderMobileCarousel && /* @__PURE__ */
|
|
14438
|
-
/* @__PURE__ */
|
|
14675
|
+
renderMobileCarousel && /* @__PURE__ */ jsx82("div", { className: "mobile-carousel-container", children: renderMobileCarousel({ images: carouselImages }) }),
|
|
14676
|
+
/* @__PURE__ */ jsx82("div", { className: "mobile-content p-4", children: renderContent(contentProps) })
|
|
14439
14677
|
] }),
|
|
14440
14678
|
(isDesktop === true || isDesktop === null) && /* @__PURE__ */ jsxs54("div", { className: "hidden md:block relative", children: [
|
|
14441
14679
|
/* @__PURE__ */ jsxs54("div", { className: "desktop-hero relative", children: [
|
|
14442
14680
|
renderHeroImage(heroProps),
|
|
14443
|
-
showEdgeBlur && blurImageSrc && isWideMonitor2 && /* @__PURE__ */
|
|
14681
|
+
showEdgeBlur && blurImageSrc && isWideMonitor2 && /* @__PURE__ */ jsx82(
|
|
14444
14682
|
ImageEdgeBlur,
|
|
14445
14683
|
{
|
|
14446
14684
|
imageSrc: blurImageSrc,
|
|
@@ -14451,7 +14689,7 @@ function PDPLayout({
|
|
|
14451
14689
|
}
|
|
14452
14690
|
)
|
|
14453
14691
|
] }),
|
|
14454
|
-
/* @__PURE__ */
|
|
14692
|
+
/* @__PURE__ */ jsx82(
|
|
14455
14693
|
"div",
|
|
14456
14694
|
{
|
|
14457
14695
|
className: "desktop-sidebar",
|
|
@@ -14468,8 +14706,8 @@ function PDPLayout({
|
|
|
14468
14706
|
}
|
|
14469
14707
|
|
|
14470
14708
|
// src/layouts/pdp/SimpleImageBlur.tsx
|
|
14471
|
-
import
|
|
14472
|
-
import { jsx as
|
|
14709
|
+
import React55 from "react";
|
|
14710
|
+
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
14473
14711
|
var BLUR_CONFIG2 = {
|
|
14474
14712
|
blur: 24,
|
|
14475
14713
|
crossfade: 60
|
|
@@ -14492,7 +14730,7 @@ function getFadeInMask(crossfadeWidth) {
|
|
|
14492
14730
|
black ${crossfadeWidth + 10}px
|
|
14493
14731
|
)`;
|
|
14494
14732
|
}
|
|
14495
|
-
var SimpleImageBlur =
|
|
14733
|
+
var SimpleImageBlur = React55.memo(function SimpleImageBlur2({
|
|
14496
14734
|
imageSrc,
|
|
14497
14735
|
width,
|
|
14498
14736
|
height = "100%",
|
|
@@ -14502,7 +14740,7 @@ var SimpleImageBlur = React54.memo(function SimpleImageBlur2({
|
|
|
14502
14740
|
if (!imageSrc || width <= 0) return null;
|
|
14503
14741
|
const fadeInMask = getFadeInMask(BLUR_CONFIG2.crossfade);
|
|
14504
14742
|
const extendedWidth = width + BLUR_CONFIG2.blur * 2;
|
|
14505
|
-
return /* @__PURE__ */
|
|
14743
|
+
return /* @__PURE__ */ jsx83(
|
|
14506
14744
|
"div",
|
|
14507
14745
|
{
|
|
14508
14746
|
className: `relative overflow-hidden ${className}`,
|
|
@@ -14515,7 +14753,7 @@ var SimpleImageBlur = React54.memo(function SimpleImageBlur2({
|
|
|
14515
14753
|
black 0%,
|
|
14516
14754
|
black ${layer.zone * 100}%,
|
|
14517
14755
|
transparent ${layer.zone * 100 + 10}%)`;
|
|
14518
|
-
return /* @__PURE__ */
|
|
14756
|
+
return /* @__PURE__ */ jsx83(
|
|
14519
14757
|
"img",
|
|
14520
14758
|
{
|
|
14521
14759
|
src: imageSrc,
|
|
@@ -14545,8 +14783,8 @@ var SimpleImageBlur = React54.memo(function SimpleImageBlur2({
|
|
|
14545
14783
|
});
|
|
14546
14784
|
|
|
14547
14785
|
// src/layouts/pdp/EdgeBlurBox.tsx
|
|
14548
|
-
import
|
|
14549
|
-
import { jsx as
|
|
14786
|
+
import React56 from "react";
|
|
14787
|
+
import { jsx as jsx84, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
14550
14788
|
var BLUR_CONFIG3 = {
|
|
14551
14789
|
blur: 24,
|
|
14552
14790
|
crossfade: 60
|
|
@@ -14570,7 +14808,7 @@ function getFadeOutMask(crossfadeWidth) {
|
|
|
14570
14808
|
transparent 100%
|
|
14571
14809
|
)`;
|
|
14572
14810
|
}
|
|
14573
|
-
var EdgeBlurBox =
|
|
14811
|
+
var EdgeBlurBox = React56.memo(function EdgeBlurBox2({
|
|
14574
14812
|
imageSrc,
|
|
14575
14813
|
width,
|
|
14576
14814
|
height = "100%",
|
|
@@ -14596,7 +14834,7 @@ var EdgeBlurBox = React55.memo(function EdgeBlurBox2({
|
|
|
14596
14834
|
overflow: hasOverlap ? "visible" : "hidden"
|
|
14597
14835
|
},
|
|
14598
14836
|
children: [
|
|
14599
|
-
/* @__PURE__ */
|
|
14837
|
+
/* @__PURE__ */ jsx84(
|
|
14600
14838
|
"div",
|
|
14601
14839
|
{
|
|
14602
14840
|
style: {
|
|
@@ -14610,7 +14848,7 @@ var EdgeBlurBox = React55.memo(function EdgeBlurBox2({
|
|
|
14610
14848
|
transparent ${100 - (layer.zone * 100 + 10)}%,
|
|
14611
14849
|
black ${100 - layer.zone * 100}%,
|
|
14612
14850
|
black 100%)`;
|
|
14613
|
-
return /* @__PURE__ */
|
|
14851
|
+
return /* @__PURE__ */ jsx84(
|
|
14614
14852
|
"img",
|
|
14615
14853
|
{
|
|
14616
14854
|
src: imageSrc,
|
|
@@ -14638,7 +14876,7 @@ var EdgeBlurBox = React55.memo(function EdgeBlurBox2({
|
|
|
14638
14876
|
})
|
|
14639
14877
|
}
|
|
14640
14878
|
),
|
|
14641
|
-
/* @__PURE__ */
|
|
14879
|
+
/* @__PURE__ */ jsx84(
|
|
14642
14880
|
"img",
|
|
14643
14881
|
{
|
|
14644
14882
|
src: imageSrc,
|
|
@@ -14666,8 +14904,8 @@ var EdgeBlurBox = React55.memo(function EdgeBlurBox2({
|
|
|
14666
14904
|
});
|
|
14667
14905
|
|
|
14668
14906
|
// src/layouts/pdp/ImageBlurExtension.tsx
|
|
14669
|
-
import
|
|
14670
|
-
import { jsx as
|
|
14907
|
+
import React57 from "react";
|
|
14908
|
+
import { jsx as jsx85, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
14671
14909
|
var BLUR_CONFIG4 = {
|
|
14672
14910
|
blur: 24,
|
|
14673
14911
|
crossfadeWidth: 80
|
|
@@ -14690,7 +14928,7 @@ function getFadeOutMask2(crossfadeWidth) {
|
|
|
14690
14928
|
transparent 100%
|
|
14691
14929
|
)`;
|
|
14692
14930
|
}
|
|
14693
|
-
var ImageBlurExtension =
|
|
14931
|
+
var ImageBlurExtension = React57.memo(function ImageBlurExtension2({
|
|
14694
14932
|
imageSrc,
|
|
14695
14933
|
width,
|
|
14696
14934
|
height,
|
|
@@ -14713,7 +14951,7 @@ var ImageBlurExtension = React56.memo(function ImageBlurExtension2({
|
|
|
14713
14951
|
height: heightValue
|
|
14714
14952
|
},
|
|
14715
14953
|
children: [
|
|
14716
|
-
BLUR_LAYERS4.map((layer, index) => /* @__PURE__ */
|
|
14954
|
+
BLUR_LAYERS4.map((layer, index) => /* @__PURE__ */ jsx85(
|
|
14717
14955
|
"img",
|
|
14718
14956
|
{
|
|
14719
14957
|
src: imageSrc,
|
|
@@ -14737,7 +14975,7 @@ var ImageBlurExtension = React56.memo(function ImageBlurExtension2({
|
|
|
14737
14975
|
},
|
|
14738
14976
|
`blur-${index}`
|
|
14739
14977
|
)),
|
|
14740
|
-
/* @__PURE__ */
|
|
14978
|
+
/* @__PURE__ */ jsx85(
|
|
14741
14979
|
"img",
|
|
14742
14980
|
{
|
|
14743
14981
|
src: imageSrc,
|
|
@@ -14765,23 +15003,23 @@ var ImageBlurExtension = React56.memo(function ImageBlurExtension2({
|
|
|
14765
15003
|
});
|
|
14766
15004
|
|
|
14767
15005
|
// src/design-system/ColorSwatch.tsx
|
|
14768
|
-
import { jsx as
|
|
15006
|
+
import { jsx as jsx86, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
14769
15007
|
function ColorTokenSwatch({ name, cssVar, className = "" }) {
|
|
14770
15008
|
return /* @__PURE__ */ jsxs57("div", { className: `flex flex-col gap-1 ${className}`, children: [
|
|
14771
|
-
/* @__PURE__ */
|
|
15009
|
+
/* @__PURE__ */ jsx86(
|
|
14772
15010
|
"div",
|
|
14773
15011
|
{
|
|
14774
15012
|
className: "h-16 w-full rounded-lg border border-border shadow-sm",
|
|
14775
15013
|
style: { backgroundColor: `var(${cssVar})` }
|
|
14776
15014
|
}
|
|
14777
15015
|
),
|
|
14778
|
-
/* @__PURE__ */
|
|
14779
|
-
/* @__PURE__ */
|
|
15016
|
+
/* @__PURE__ */ jsx86("div", { className: "text-sm font-medium text-foreground", children: name }),
|
|
15017
|
+
/* @__PURE__ */ jsx86("code", { className: "text-xs text-muted-foreground font-mono", children: cssVar })
|
|
14780
15018
|
] });
|
|
14781
15019
|
}
|
|
14782
15020
|
function ColorRow({ name, cssVar, description }) {
|
|
14783
15021
|
return /* @__PURE__ */ jsxs57("div", { className: "flex items-center gap-4 py-2", children: [
|
|
14784
|
-
/* @__PURE__ */
|
|
15022
|
+
/* @__PURE__ */ jsx86(
|
|
14785
15023
|
"div",
|
|
14786
15024
|
{
|
|
14787
15025
|
className: "h-10 w-10 rounded-lg border border-border shadow-sm flex-shrink-0",
|
|
@@ -14789,15 +15027,15 @@ function ColorRow({ name, cssVar, description }) {
|
|
|
14789
15027
|
}
|
|
14790
15028
|
),
|
|
14791
15029
|
/* @__PURE__ */ jsxs57("div", { className: "flex-1 min-w-0", children: [
|
|
14792
|
-
/* @__PURE__ */
|
|
14793
|
-
description && /* @__PURE__ */
|
|
15030
|
+
/* @__PURE__ */ jsx86("div", { className: "text-sm font-medium text-foreground", children: name }),
|
|
15031
|
+
description && /* @__PURE__ */ jsx86("div", { className: "text-xs text-muted-foreground", children: description })
|
|
14794
15032
|
] }),
|
|
14795
|
-
/* @__PURE__ */
|
|
15033
|
+
/* @__PURE__ */ jsx86("code", { className: "text-xs text-muted-foreground font-mono bg-muted px-2 py-1 rounded", children: cssVar })
|
|
14796
15034
|
] });
|
|
14797
15035
|
}
|
|
14798
15036
|
|
|
14799
15037
|
// src/design-system/ColorPalette.tsx
|
|
14800
|
-
import { jsx as
|
|
15038
|
+
import { jsx as jsx87, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
14801
15039
|
var COLOR_GROUPS = [
|
|
14802
15040
|
{
|
|
14803
15041
|
name: "Base",
|
|
@@ -14878,17 +15116,17 @@ var COLOR_GROUPS = [
|
|
|
14878
15116
|
}
|
|
14879
15117
|
];
|
|
14880
15118
|
function ColorPalette({ layout = "list", className = "" }) {
|
|
14881
|
-
return /* @__PURE__ */
|
|
14882
|
-
/* @__PURE__ */
|
|
14883
|
-
/* @__PURE__ */
|
|
14884
|
-
layout === "grid" ? /* @__PURE__ */
|
|
15119
|
+
return /* @__PURE__ */ jsx87("div", { className: `space-y-8 ${className}`, children: COLOR_GROUPS.map((group) => /* @__PURE__ */ jsxs58("section", { children: [
|
|
15120
|
+
/* @__PURE__ */ jsx87("h3", { className: "text-lg font-semibold text-foreground mb-1", children: group.name }),
|
|
15121
|
+
/* @__PURE__ */ jsx87("p", { className: "text-sm text-muted-foreground mb-4", children: group.description }),
|
|
15122
|
+
layout === "grid" ? /* @__PURE__ */ jsx87("div", { className: "grid grid-cols-2 sm:grid-cols-4 gap-4", children: group.colors.map((color) => /* @__PURE__ */ jsx87(
|
|
14885
15123
|
ColorTokenSwatch,
|
|
14886
15124
|
{
|
|
14887
15125
|
name: color.name,
|
|
14888
15126
|
cssVar: color.cssVar
|
|
14889
15127
|
},
|
|
14890
15128
|
color.cssVar
|
|
14891
|
-
)) }) : /* @__PURE__ */
|
|
15129
|
+
)) }) : /* @__PURE__ */ jsx87("div", { className: "bg-card rounded-lg border border-border p-4 divide-y divide-border", children: group.colors.map((color) => /* @__PURE__ */ jsx87(
|
|
14892
15130
|
ColorRow,
|
|
14893
15131
|
{
|
|
14894
15132
|
name: color.name,
|
|
@@ -14901,7 +15139,7 @@ function ColorPalette({ layout = "list", className = "" }) {
|
|
|
14901
15139
|
}
|
|
14902
15140
|
|
|
14903
15141
|
// src/design-system/TypographyScale.tsx
|
|
14904
|
-
import { jsx as
|
|
15142
|
+
import { jsx as jsx88, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
14905
15143
|
var FONT_SAMPLES = [
|
|
14906
15144
|
{
|
|
14907
15145
|
name: "Heading",
|
|
@@ -14935,14 +15173,14 @@ var FONT_SAMPLES = [
|
|
|
14935
15173
|
}
|
|
14936
15174
|
];
|
|
14937
15175
|
function TypographyScale({ className = "" }) {
|
|
14938
|
-
return /* @__PURE__ */
|
|
15176
|
+
return /* @__PURE__ */ jsx88("div", { className: `space-y-8 ${className}`, children: FONT_SAMPLES.map((font) => /* @__PURE__ */ jsxs59("section", { className: "bg-card rounded-lg border border-border p-6", children: [
|
|
14939
15177
|
/* @__PURE__ */ jsxs59("div", { className: "flex items-center justify-between mb-4", children: [
|
|
14940
|
-
/* @__PURE__ */
|
|
14941
|
-
/* @__PURE__ */
|
|
15178
|
+
/* @__PURE__ */ jsx88("h3", { className: "text-lg font-semibold text-foreground", children: font.name }),
|
|
15179
|
+
/* @__PURE__ */ jsx88("code", { className: "text-xs text-muted-foreground font-mono bg-muted px-2 py-1 rounded", children: font.cssVar })
|
|
14942
15180
|
] }),
|
|
14943
|
-
/* @__PURE__ */
|
|
14944
|
-
/* @__PURE__ */
|
|
14945
|
-
/* @__PURE__ */
|
|
15181
|
+
/* @__PURE__ */ jsx88("div", { className: "space-y-4", children: font.sizes.map((size) => /* @__PURE__ */ jsxs59("div", { className: "flex items-baseline gap-4", children: [
|
|
15182
|
+
/* @__PURE__ */ jsx88("span", { className: "text-xs text-muted-foreground w-20 flex-shrink-0", children: size }),
|
|
15183
|
+
/* @__PURE__ */ jsx88(
|
|
14946
15184
|
"p",
|
|
14947
15185
|
{
|
|
14948
15186
|
className: `${size} text-foreground`,
|
|
@@ -14961,8 +15199,8 @@ var RADIUS_SAMPLES = [
|
|
|
14961
15199
|
{ name: "Full", value: "9999px" }
|
|
14962
15200
|
];
|
|
14963
15201
|
function RadiusScale({ className = "" }) {
|
|
14964
|
-
return /* @__PURE__ */
|
|
14965
|
-
/* @__PURE__ */
|
|
15202
|
+
return /* @__PURE__ */ jsx88("div", { className: `space-y-4 ${className}`, children: /* @__PURE__ */ jsx88("div", { className: "grid grid-cols-5 gap-4", children: RADIUS_SAMPLES.map((radius) => /* @__PURE__ */ jsxs59("div", { className: "flex flex-col items-center gap-2", children: [
|
|
15203
|
+
/* @__PURE__ */ jsx88(
|
|
14966
15204
|
"div",
|
|
14967
15205
|
{
|
|
14968
15206
|
className: "h-16 w-16 bg-primary",
|
|
@@ -14971,14 +15209,14 @@ function RadiusScale({ className = "" }) {
|
|
|
14971
15209
|
}
|
|
14972
15210
|
}
|
|
14973
15211
|
),
|
|
14974
|
-
/* @__PURE__ */
|
|
14975
|
-
/* @__PURE__ */
|
|
15212
|
+
/* @__PURE__ */ jsx88("span", { className: "text-sm font-medium text-foreground", children: radius.name }),
|
|
15213
|
+
/* @__PURE__ */ jsx88("code", { className: "text-xs text-muted-foreground font-mono", children: radius.cssVar || radius.value })
|
|
14976
15214
|
] }, radius.name)) }) });
|
|
14977
15215
|
}
|
|
14978
15216
|
|
|
14979
15217
|
// src/design-system/ThemeSwitcher.tsx
|
|
14980
|
-
import { useState as
|
|
14981
|
-
import { Fragment as Fragment20, jsx as
|
|
15218
|
+
import { useState as useState46, useEffect as useEffect47 } from "react";
|
|
15219
|
+
import { Fragment as Fragment20, jsx as jsx89, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
14982
15220
|
function readThemeFromDOM() {
|
|
14983
15221
|
if (typeof document === "undefined") {
|
|
14984
15222
|
return { themeName: "Linear", isDark: false };
|
|
@@ -14996,10 +15234,10 @@ function readThemeFromDOM() {
|
|
|
14996
15234
|
return { themeName: "Linear", isDark: dark };
|
|
14997
15235
|
}
|
|
14998
15236
|
function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
14999
|
-
const [currentTheme, setCurrentTheme] =
|
|
15000
|
-
const [isDark, setIsDark] =
|
|
15001
|
-
const [isOpen, setIsOpen] =
|
|
15002
|
-
|
|
15237
|
+
const [currentTheme, setCurrentTheme] = useState46("Linear");
|
|
15238
|
+
const [isDark, setIsDark] = useState46(false);
|
|
15239
|
+
const [isOpen, setIsOpen] = useState46(false);
|
|
15240
|
+
useEffect47(() => {
|
|
15003
15241
|
const { themeName, isDark: dark } = readThemeFromDOM();
|
|
15004
15242
|
setCurrentTheme(themeName);
|
|
15005
15243
|
setIsDark(dark);
|
|
@@ -15046,35 +15284,35 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
15046
15284
|
onClick: () => setIsOpen(!isOpen),
|
|
15047
15285
|
className: "flex items-center gap-2 px-4 py-2 bg-card border border-border rounded-lg hover:bg-muted transition-colors text-foreground",
|
|
15048
15286
|
children: [
|
|
15049
|
-
/* @__PURE__ */
|
|
15050
|
-
/* @__PURE__ */
|
|
15051
|
-
/* @__PURE__ */
|
|
15287
|
+
/* @__PURE__ */ jsx89("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx89("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" }) }),
|
|
15288
|
+
/* @__PURE__ */ jsx89("span", { className: "font-medium", children: currentTheme }),
|
|
15289
|
+
/* @__PURE__ */ jsx89("svg", { className: `w-4 h-4 transition-transform ${isOpen ? "rotate-180" : ""}`, fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx89("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" }) })
|
|
15052
15290
|
]
|
|
15053
15291
|
}
|
|
15054
15292
|
),
|
|
15055
15293
|
isOpen && /* @__PURE__ */ jsxs60(Fragment20, { children: [
|
|
15056
|
-
/* @__PURE__ */
|
|
15294
|
+
/* @__PURE__ */ jsx89(
|
|
15057
15295
|
"div",
|
|
15058
15296
|
{
|
|
15059
15297
|
className: "fixed inset-0 z-40",
|
|
15060
15298
|
onClick: () => setIsOpen(false)
|
|
15061
15299
|
}
|
|
15062
15300
|
),
|
|
15063
|
-
/* @__PURE__ */
|
|
15301
|
+
/* @__PURE__ */ jsx89("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__ */ jsxs60(
|
|
15064
15302
|
"button",
|
|
15065
15303
|
{
|
|
15066
15304
|
onClick: () => handleThemeSelect(theme.name),
|
|
15067
15305
|
className: `w-full px-4 py-2 text-left hover:bg-muted transition-colors flex items-center gap-3 ${currentTheme === theme.name ? "bg-muted" : ""}`,
|
|
15068
15306
|
children: [
|
|
15069
|
-
/* @__PURE__ */
|
|
15307
|
+
/* @__PURE__ */ jsx89(
|
|
15070
15308
|
"div",
|
|
15071
15309
|
{
|
|
15072
15310
|
className: "w-4 h-4 rounded-full border border-border",
|
|
15073
15311
|
style: { backgroundColor: theme.primaryColor || "#888" }
|
|
15074
15312
|
}
|
|
15075
15313
|
),
|
|
15076
|
-
/* @__PURE__ */
|
|
15077
|
-
currentTheme === theme.name && /* @__PURE__ */
|
|
15314
|
+
/* @__PURE__ */ jsx89("span", { className: "text-foreground", children: theme.name }),
|
|
15315
|
+
currentTheme === theme.name && /* @__PURE__ */ jsx89("svg", { className: "w-4 h-4 ml-auto text-primary", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx89("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M5 13l4 4L19 7" }) })
|
|
15078
15316
|
]
|
|
15079
15317
|
},
|
|
15080
15318
|
theme.name
|
|
@@ -15089,10 +15327,10 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
15089
15327
|
title: `Switch to ${isDark ? "light" : "dark"} mode`,
|
|
15090
15328
|
children: [
|
|
15091
15329
|
isDark ? /* @__PURE__ */ jsxs60("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: [
|
|
15092
|
-
/* @__PURE__ */
|
|
15093
|
-
/* @__PURE__ */
|
|
15094
|
-
] }) : /* @__PURE__ */
|
|
15095
|
-
/* @__PURE__ */
|
|
15330
|
+
/* @__PURE__ */ jsx89("circle", { cx: "12", cy: "12", r: "5" }),
|
|
15331
|
+
/* @__PURE__ */ jsx89("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" })
|
|
15332
|
+
] }) : /* @__PURE__ */ jsx89("svg", { className: "w-5 h-5", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 2, children: /* @__PURE__ */ jsx89("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) }),
|
|
15333
|
+
/* @__PURE__ */ jsx89("span", { className: "text-sm", children: isDark ? "Light" : "Dark" })
|
|
15096
15334
|
]
|
|
15097
15335
|
}
|
|
15098
15336
|
)
|
|
@@ -15100,7 +15338,7 @@ function ThemeSwitcher({ className = "", showBaseThemesOnly = true }) {
|
|
|
15100
15338
|
}
|
|
15101
15339
|
|
|
15102
15340
|
// src/design-system/DesignSystemPage.tsx
|
|
15103
|
-
import { jsx as
|
|
15341
|
+
import { jsx as jsx90, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
15104
15342
|
function DesignSystemPage({
|
|
15105
15343
|
showThemeSwitcher = true,
|
|
15106
15344
|
showColors = true,
|
|
@@ -15111,28 +15349,28 @@ function DesignSystemPage({
|
|
|
15111
15349
|
className = ""
|
|
15112
15350
|
}) {
|
|
15113
15351
|
return /* @__PURE__ */ jsxs61("div", { className: `max-w-4xl mx-auto px-4 py-8 ${className}`, children: [
|
|
15114
|
-
/* @__PURE__ */
|
|
15352
|
+
/* @__PURE__ */ jsx90("header", { className: "mb-12", children: /* @__PURE__ */ jsxs61("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4", children: [
|
|
15115
15353
|
/* @__PURE__ */ jsxs61("div", { children: [
|
|
15116
|
-
/* @__PURE__ */
|
|
15117
|
-
/* @__PURE__ */
|
|
15354
|
+
/* @__PURE__ */ jsx90("h1", { className: "text-4xl font-bold text-foreground mb-2", children: "Design System" }),
|
|
15355
|
+
/* @__PURE__ */ jsx90("p", { className: "text-lg text-muted-foreground", children: "Visual reference for theme tokens and styles" })
|
|
15118
15356
|
] }),
|
|
15119
|
-
showThemeSwitcher && /* @__PURE__ */
|
|
15357
|
+
showThemeSwitcher && /* @__PURE__ */ jsx90(ThemeSwitcher, {})
|
|
15120
15358
|
] }) }),
|
|
15121
15359
|
showColors && /* @__PURE__ */ jsxs61("section", { className: "mb-16", children: [
|
|
15122
|
-
/* @__PURE__ */
|
|
15123
|
-
/* @__PURE__ */
|
|
15360
|
+
/* @__PURE__ */ jsx90("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Color Palette" }),
|
|
15361
|
+
/* @__PURE__ */ jsx90(ColorPalette, { layout: colorLayout })
|
|
15124
15362
|
] }),
|
|
15125
15363
|
showTypography && /* @__PURE__ */ jsxs61("section", { className: "mb-16", children: [
|
|
15126
|
-
/* @__PURE__ */
|
|
15127
|
-
/* @__PURE__ */
|
|
15364
|
+
/* @__PURE__ */ jsx90("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Typography" }),
|
|
15365
|
+
/* @__PURE__ */ jsx90(TypographyScale, {})
|
|
15128
15366
|
] }),
|
|
15129
15367
|
showRadius && /* @__PURE__ */ jsxs61("section", { className: "mb-16", children: [
|
|
15130
|
-
/* @__PURE__ */
|
|
15131
|
-
/* @__PURE__ */
|
|
15368
|
+
/* @__PURE__ */ jsx90("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Border Radius" }),
|
|
15369
|
+
/* @__PURE__ */ jsx90(RadiusScale, {})
|
|
15132
15370
|
] }),
|
|
15133
15371
|
showSpacing && /* @__PURE__ */ jsxs61("section", { className: "mb-16", children: [
|
|
15134
|
-
/* @__PURE__ */
|
|
15135
|
-
/* @__PURE__ */
|
|
15372
|
+
/* @__PURE__ */ jsx90("h2", { className: "text-2xl font-semibold text-foreground mb-6 pb-2 border-b border-border", children: "Spacing Scale" }),
|
|
15373
|
+
/* @__PURE__ */ jsx90(SpacingScale, {})
|
|
15136
15374
|
] })
|
|
15137
15375
|
] });
|
|
15138
15376
|
}
|
|
@@ -15147,47 +15385,47 @@ function SpacingScale() {
|
|
|
15147
15385
|
{ name: "12", value: "3rem" },
|
|
15148
15386
|
{ name: "16", value: "4rem" }
|
|
15149
15387
|
];
|
|
15150
|
-
return /* @__PURE__ */
|
|
15151
|
-
/* @__PURE__ */
|
|
15152
|
-
/* @__PURE__ */
|
|
15388
|
+
return /* @__PURE__ */ jsx90("div", { className: "space-y-2", children: spaces.map((space) => /* @__PURE__ */ jsxs61("div", { className: "flex items-center gap-4", children: [
|
|
15389
|
+
/* @__PURE__ */ jsx90("code", { className: "text-xs text-muted-foreground font-mono w-8", children: space.name }),
|
|
15390
|
+
/* @__PURE__ */ jsx90(
|
|
15153
15391
|
"div",
|
|
15154
15392
|
{
|
|
15155
15393
|
className: "h-4 bg-primary rounded",
|
|
15156
15394
|
style: { width: space.value }
|
|
15157
15395
|
}
|
|
15158
15396
|
),
|
|
15159
|
-
/* @__PURE__ */
|
|
15397
|
+
/* @__PURE__ */ jsx90("span", { className: "text-sm text-muted-foreground", children: space.value })
|
|
15160
15398
|
] }, space.name)) });
|
|
15161
15399
|
}
|
|
15162
15400
|
|
|
15163
15401
|
// src/personalization/PersonalizationProvider.tsx
|
|
15164
|
-
import
|
|
15165
|
-
useState as
|
|
15166
|
-
useCallback as
|
|
15167
|
-
useRef as
|
|
15168
|
-
useEffect as
|
|
15402
|
+
import React58, {
|
|
15403
|
+
useState as useState47,
|
|
15404
|
+
useCallback as useCallback27,
|
|
15405
|
+
useRef as useRef31,
|
|
15406
|
+
useEffect as useEffect48
|
|
15169
15407
|
} from "react";
|
|
15170
15408
|
|
|
15171
15409
|
// src/personalization/PersonalizationContext.ts
|
|
15172
|
-
import { createContext as
|
|
15173
|
-
var PersonalizationContext =
|
|
15410
|
+
import { createContext as createContext12, useContext as useContext10 } from "react";
|
|
15411
|
+
var PersonalizationContext = createContext12(null);
|
|
15174
15412
|
function usePersonalizationContext() {
|
|
15175
|
-
return
|
|
15413
|
+
return useContext10(PersonalizationContext);
|
|
15176
15414
|
}
|
|
15177
15415
|
|
|
15178
15416
|
// src/personalization/PersonalizationProvider.tsx
|
|
15179
|
-
import { Fragment as Fragment21, jsx as
|
|
15417
|
+
import { Fragment as Fragment21, jsx as jsx91, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
15180
15418
|
function createBridgeFromCanvas(canvasModule) {
|
|
15181
15419
|
const { useEditor, useCommands, useImageBinding } = canvasModule;
|
|
15182
15420
|
function TextBinder({ name, value }) {
|
|
15183
15421
|
const { elements } = useEditor();
|
|
15184
15422
|
const { executeElementUpdate } = useCommands();
|
|
15185
|
-
const elementsRef =
|
|
15423
|
+
const elementsRef = React58.useRef(elements);
|
|
15186
15424
|
elementsRef.current = elements;
|
|
15187
|
-
const executeRef =
|
|
15425
|
+
const executeRef = React58.useRef(executeElementUpdate);
|
|
15188
15426
|
executeRef.current = executeElementUpdate;
|
|
15189
|
-
const hasUserInput =
|
|
15190
|
-
|
|
15427
|
+
const hasUserInput = React58.useRef(false);
|
|
15428
|
+
React58.useEffect(() => {
|
|
15191
15429
|
if (value == null) return;
|
|
15192
15430
|
if (value === "" && !hasUserInput.current) return;
|
|
15193
15431
|
hasUserInput.current = true;
|
|
@@ -15205,12 +15443,12 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
15205
15443
|
function ColorBinder({ originalColor, newColor }) {
|
|
15206
15444
|
const { elements } = useEditor();
|
|
15207
15445
|
const { executeElementUpdate } = useCommands();
|
|
15208
|
-
const elementsRef =
|
|
15446
|
+
const elementsRef = React58.useRef(elements);
|
|
15209
15447
|
elementsRef.current = elements;
|
|
15210
|
-
const executeRef =
|
|
15448
|
+
const executeRef = React58.useRef(executeElementUpdate);
|
|
15211
15449
|
executeRef.current = executeElementUpdate;
|
|
15212
|
-
const appliedColorRef =
|
|
15213
|
-
|
|
15450
|
+
const appliedColorRef = React58.useRef(normalizeHex(originalColor));
|
|
15451
|
+
React58.useEffect(() => {
|
|
15214
15452
|
const normalizedNew = normalizeHex(newColor);
|
|
15215
15453
|
if (normalizedNew === appliedColorRef.current) return;
|
|
15216
15454
|
const matchColor = appliedColorRef.current;
|
|
@@ -15250,11 +15488,11 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
15250
15488
|
}
|
|
15251
15489
|
function ImageBinder({ name, value, fit = "cover" }) {
|
|
15252
15490
|
const { setImageUrl } = useImageBinding(name, { fit });
|
|
15253
|
-
const hasUserInput =
|
|
15491
|
+
const hasUserInput = React58.useRef(false);
|
|
15254
15492
|
const debouncedValue = useDebouncedValue(value, 500);
|
|
15255
|
-
const setImageUrlRef =
|
|
15493
|
+
const setImageUrlRef = React58.useRef(setImageUrl);
|
|
15256
15494
|
setImageUrlRef.current = setImageUrl;
|
|
15257
|
-
|
|
15495
|
+
React58.useEffect(() => {
|
|
15258
15496
|
if (debouncedValue == null) return;
|
|
15259
15497
|
if (debouncedValue === "" && !hasUserInput.current) return;
|
|
15260
15498
|
hasUserInput.current = true;
|
|
@@ -15264,15 +15502,15 @@ function createBridgeFromCanvas(canvasModule) {
|
|
|
15264
15502
|
return null;
|
|
15265
15503
|
}
|
|
15266
15504
|
return function PersonalizationBridge({ fields = [], values = {} } = {}) {
|
|
15267
|
-
return /* @__PURE__ */
|
|
15505
|
+
return /* @__PURE__ */ jsx91(Fragment21, { children: fields.map((field) => {
|
|
15268
15506
|
if (field.type === "text") {
|
|
15269
|
-
return /* @__PURE__ */
|
|
15507
|
+
return /* @__PURE__ */ jsx91(TextBinder, { name: field.name, value: values[field.name] ?? "" }, `text-${field.name}`);
|
|
15270
15508
|
}
|
|
15271
15509
|
if (field.type === "color") {
|
|
15272
|
-
return /* @__PURE__ */
|
|
15510
|
+
return /* @__PURE__ */ jsx91(ColorBinder, { originalColor: field.color, newColor: values[field.color] ?? field.color }, `color-${field.color}`);
|
|
15273
15511
|
}
|
|
15274
15512
|
if (field.type === "image") {
|
|
15275
|
-
return /* @__PURE__ */
|
|
15513
|
+
return /* @__PURE__ */ jsx91(ImageBinder, { name: field.name, value: values[field.name] ?? "", fit: field.fit ?? "cover" }, `image-${field.name}`);
|
|
15276
15514
|
}
|
|
15277
15515
|
return null;
|
|
15278
15516
|
}) });
|
|
@@ -15294,20 +15532,20 @@ function PersonalizationProvider({
|
|
|
15294
15532
|
children
|
|
15295
15533
|
}) {
|
|
15296
15534
|
const realtime = useRealtimeOptional();
|
|
15297
|
-
const [personValues, setPersonValues] =
|
|
15298
|
-
const [isActive, setIsActive] =
|
|
15299
|
-
const [isExporting, setIsExporting] =
|
|
15300
|
-
const [exportedBlobUrls, setExportedBlobUrls] =
|
|
15301
|
-
const [exportCount, setExportCount] =
|
|
15302
|
-
const blobUrlsRef =
|
|
15303
|
-
const [CanvasComponent, setCanvasComponent] =
|
|
15535
|
+
const [personValues, setPersonValues] = useState47(initialValues ?? {});
|
|
15536
|
+
const [isActive, setIsActive] = useState47(!!(initialValues && Object.keys(initialValues).length > 0));
|
|
15537
|
+
const [isExporting, setIsExporting] = useState47(false);
|
|
15538
|
+
const [exportedBlobUrls, setExportedBlobUrls] = useState47({});
|
|
15539
|
+
const [exportCount, setExportCount] = useState47(0);
|
|
15540
|
+
const blobUrlsRef = useRef31({});
|
|
15541
|
+
const [CanvasComponent, setCanvasComponent] = useState47(
|
|
15304
15542
|
cachedCanvasComponent
|
|
15305
15543
|
);
|
|
15306
|
-
const [BridgeComponent, setBridgeComponent] =
|
|
15544
|
+
const [BridgeComponent, setBridgeComponent] = useState47(
|
|
15307
15545
|
cachedBridgeComponent
|
|
15308
15546
|
);
|
|
15309
15547
|
const hasFields = fields.length > 0;
|
|
15310
|
-
|
|
15548
|
+
useEffect48(() => {
|
|
15311
15549
|
if (CanvasComponent && BridgeComponent) return;
|
|
15312
15550
|
if (!canvasImport || !hasFields) return;
|
|
15313
15551
|
if (!canvasLoadPromise) {
|
|
@@ -15325,8 +15563,8 @@ function PersonalizationProvider({
|
|
|
15325
15563
|
}
|
|
15326
15564
|
});
|
|
15327
15565
|
}, [CanvasComponent, BridgeComponent, canvasImport, hasFields]);
|
|
15328
|
-
const realtimeEnabledRef =
|
|
15329
|
-
|
|
15566
|
+
const realtimeEnabledRef = useRef31(false);
|
|
15567
|
+
useEffect48(() => {
|
|
15330
15568
|
return () => {
|
|
15331
15569
|
for (const url of Object.values(blobUrlsRef.current)) {
|
|
15332
15570
|
try {
|
|
@@ -15336,16 +15574,16 @@ function PersonalizationProvider({
|
|
|
15336
15574
|
}
|
|
15337
15575
|
};
|
|
15338
15576
|
}, []);
|
|
15339
|
-
const updateField =
|
|
15577
|
+
const updateField = useCallback27((key, value) => {
|
|
15340
15578
|
setIsActive(true);
|
|
15341
15579
|
setPersonValues((prev) => ({ ...prev, [key]: value }));
|
|
15342
15580
|
}, []);
|
|
15343
|
-
const reset =
|
|
15581
|
+
const reset = useCallback27(() => {
|
|
15344
15582
|
setPersonValues({});
|
|
15345
15583
|
setIsActive(false);
|
|
15346
15584
|
setIsExporting(false);
|
|
15347
15585
|
}, []);
|
|
15348
|
-
const handleExport =
|
|
15586
|
+
const handleExport = useCallback27(
|
|
15349
15587
|
(exports) => {
|
|
15350
15588
|
const newUrls = {};
|
|
15351
15589
|
for (const [name, data] of Object.entries(exports)) {
|
|
@@ -15379,11 +15617,11 @@ function PersonalizationProvider({
|
|
|
15379
15617
|
},
|
|
15380
15618
|
[realtime, placementOverride]
|
|
15381
15619
|
);
|
|
15382
|
-
const handleExportScheduled =
|
|
15620
|
+
const handleExportScheduled = useCallback27(() => {
|
|
15383
15621
|
setIsExporting(true);
|
|
15384
15622
|
}, []);
|
|
15385
15623
|
const shouldMountCanvas = CanvasComponent && BridgeComponent && canvasState?.elements && canvasState.elements.length > 0 && (!lazy || isActive);
|
|
15386
|
-
const contextValue =
|
|
15624
|
+
const contextValue = React58.useMemo(
|
|
15387
15625
|
() => ({
|
|
15388
15626
|
fields,
|
|
15389
15627
|
personValues,
|
|
@@ -15397,7 +15635,7 @@ function PersonalizationProvider({
|
|
|
15397
15635
|
[fields, personValues, updateField, isActive, isExporting, exportedBlobUrls, exportCount, reset]
|
|
15398
15636
|
);
|
|
15399
15637
|
return /* @__PURE__ */ jsxs62(PersonalizationContext.Provider, { value: contextValue, children: [
|
|
15400
|
-
shouldMountCanvas && CanvasComponent && BridgeComponent && /* @__PURE__ */
|
|
15638
|
+
shouldMountCanvas && CanvasComponent && BridgeComponent && /* @__PURE__ */ jsx91(
|
|
15401
15639
|
"div",
|
|
15402
15640
|
{
|
|
15403
15641
|
style: {
|
|
@@ -15410,7 +15648,7 @@ function PersonalizationProvider({
|
|
|
15410
15648
|
pointerEvents: "none"
|
|
15411
15649
|
},
|
|
15412
15650
|
"aria-hidden": true,
|
|
15413
|
-
children: /* @__PURE__ */
|
|
15651
|
+
children: /* @__PURE__ */ jsx91(
|
|
15414
15652
|
CanvasComponent,
|
|
15415
15653
|
{
|
|
15416
15654
|
initialElements: canvasState?.elements,
|
|
@@ -15430,7 +15668,7 @@ function PersonalizationProvider({
|
|
|
15430
15668
|
exportImageQuality: exportConfig?.imageQuality ?? 0.85,
|
|
15431
15669
|
onExport: handleExport,
|
|
15432
15670
|
onExportScheduled: handleExportScheduled,
|
|
15433
|
-
overlay: /* @__PURE__ */
|
|
15671
|
+
overlay: /* @__PURE__ */ jsx91(BridgeComponent, { fields, values: personValues })
|
|
15434
15672
|
}
|
|
15435
15673
|
)
|
|
15436
15674
|
},
|
|
@@ -15455,7 +15693,7 @@ function usePersonalizationOptional() {
|
|
|
15455
15693
|
}
|
|
15456
15694
|
|
|
15457
15695
|
// src/personalization/PersonalizationInputs.tsx
|
|
15458
|
-
import { jsx as
|
|
15696
|
+
import { jsx as jsx92, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
15459
15697
|
function PersonalizationInputs({
|
|
15460
15698
|
className,
|
|
15461
15699
|
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",
|
|
@@ -15480,7 +15718,7 @@ function PersonalizationInputs({
|
|
|
15480
15718
|
}
|
|
15481
15719
|
};
|
|
15482
15720
|
return /* @__PURE__ */ jsxs63("div", { className: className || "flex flex-col gap-3", children: [
|
|
15483
|
-
textFields.map((field) => /* @__PURE__ */
|
|
15721
|
+
textFields.map((field) => /* @__PURE__ */ jsx92(
|
|
15484
15722
|
"input",
|
|
15485
15723
|
{
|
|
15486
15724
|
type: "text",
|
|
@@ -15495,7 +15733,7 @@ function PersonalizationInputs({
|
|
|
15495
15733
|
`text-${field.name}`
|
|
15496
15734
|
)),
|
|
15497
15735
|
colorFields.map((field) => /* @__PURE__ */ jsxs63("div", { className: "flex items-center gap-3", children: [
|
|
15498
|
-
/* @__PURE__ */
|
|
15736
|
+
/* @__PURE__ */ jsx92(
|
|
15499
15737
|
"input",
|
|
15500
15738
|
{
|
|
15501
15739
|
type: "color",
|
|
@@ -15504,9 +15742,9 @@ function PersonalizationInputs({
|
|
|
15504
15742
|
onChange: (e) => updateField(field.color, e.target.value)
|
|
15505
15743
|
}
|
|
15506
15744
|
),
|
|
15507
|
-
/* @__PURE__ */
|
|
15745
|
+
/* @__PURE__ */ jsx92("span", { className: "text-base text-muted-foreground", children: field.label })
|
|
15508
15746
|
] }, `color-${field.color}`)),
|
|
15509
|
-
imageFields.map((field) => /* @__PURE__ */
|
|
15747
|
+
imageFields.map((field) => /* @__PURE__ */ jsx92(
|
|
15510
15748
|
"input",
|
|
15511
15749
|
{
|
|
15512
15750
|
type: "text",
|
|
@@ -15524,15 +15762,15 @@ function PersonalizationInputs({
|
|
|
15524
15762
|
}
|
|
15525
15763
|
|
|
15526
15764
|
// src/personalization/usePersonalizationShimmer.ts
|
|
15527
|
-
import { useState as
|
|
15765
|
+
import { useState as useState48, useEffect as useEffect49, useRef as useRef32, useCallback as useCallback28 } from "react";
|
|
15528
15766
|
function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
15529
15767
|
const personCtx = usePersonalizationContext();
|
|
15530
15768
|
const realtime = useRealtimeOptional();
|
|
15531
|
-
const [shimmerActive, setShimmerActive] =
|
|
15532
|
-
const sdkSettledRef =
|
|
15533
|
-
const manualTriggerRef =
|
|
15534
|
-
const safetyTimeoutRef =
|
|
15535
|
-
const startShimmer =
|
|
15769
|
+
const [shimmerActive, setShimmerActive] = useState48(false);
|
|
15770
|
+
const sdkSettledRef = useRef32(false);
|
|
15771
|
+
const manualTriggerRef = useRef32(false);
|
|
15772
|
+
const safetyTimeoutRef = useRef32(void 0);
|
|
15773
|
+
const startShimmer = useCallback28(() => {
|
|
15536
15774
|
setShimmerActive(true);
|
|
15537
15775
|
if (safetyTimeoutRef.current) clearTimeout(safetyTimeoutRef.current);
|
|
15538
15776
|
safetyTimeoutRef.current = setTimeout(
|
|
@@ -15544,25 +15782,25 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
15544
15782
|
safetyTimeoutMs
|
|
15545
15783
|
);
|
|
15546
15784
|
}, [safetyTimeoutMs]);
|
|
15547
|
-
|
|
15785
|
+
useEffect49(() => {
|
|
15548
15786
|
if (!personCtx?.isActive) return;
|
|
15549
15787
|
sdkSettledRef.current = false;
|
|
15550
15788
|
manualTriggerRef.current = false;
|
|
15551
15789
|
realtime?.resetPipelineSettled();
|
|
15552
15790
|
startShimmer();
|
|
15553
15791
|
}, [personCtx?.personValues, personCtx?.isActive, startShimmer]);
|
|
15554
|
-
const triggerShimmer =
|
|
15792
|
+
const triggerShimmer = useCallback28(() => {
|
|
15555
15793
|
sdkSettledRef.current = false;
|
|
15556
15794
|
manualTriggerRef.current = true;
|
|
15557
15795
|
startShimmer();
|
|
15558
15796
|
}, [startShimmer]);
|
|
15559
|
-
|
|
15797
|
+
useEffect49(() => {
|
|
15560
15798
|
if (!realtime?.subscribePipelineSettled) return;
|
|
15561
15799
|
return realtime.subscribePipelineSettled(() => {
|
|
15562
15800
|
sdkSettledRef.current = true;
|
|
15563
15801
|
});
|
|
15564
15802
|
}, [realtime]);
|
|
15565
|
-
|
|
15803
|
+
useEffect49(() => {
|
|
15566
15804
|
const container = containerRef.current;
|
|
15567
15805
|
if (!container) return;
|
|
15568
15806
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -15605,7 +15843,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
15605
15843
|
});
|
|
15606
15844
|
return () => observer.disconnect();
|
|
15607
15845
|
}, [containerRef]);
|
|
15608
|
-
|
|
15846
|
+
useEffect49(() => {
|
|
15609
15847
|
return () => {
|
|
15610
15848
|
if (safetyTimeoutRef.current) clearTimeout(safetyTimeoutRef.current);
|
|
15611
15849
|
};
|
|
@@ -15682,11 +15920,14 @@ export {
|
|
|
15682
15920
|
EdgeSwipeGuards,
|
|
15683
15921
|
EnhancedImageViewer,
|
|
15684
15922
|
FACET_SECTIONS,
|
|
15923
|
+
FIRST_VIEW_MARGIN,
|
|
15924
|
+
FIRST_VIEW_PICTURE_ASPECT,
|
|
15685
15925
|
Fieldset,
|
|
15686
15926
|
Filters,
|
|
15687
15927
|
FiltersButton,
|
|
15688
15928
|
FiltersDrawer,
|
|
15689
15929
|
FloatingActionGroup,
|
|
15930
|
+
GallerySkipProvider,
|
|
15690
15931
|
HeroCarousel,
|
|
15691
15932
|
HeroProductImage,
|
|
15692
15933
|
HeroShrinkLayout,
|
|
@@ -15716,6 +15957,7 @@ export {
|
|
|
15716
15957
|
MobileProductCarousel,
|
|
15717
15958
|
MockupBackground,
|
|
15718
15959
|
MockupPriorityProvider,
|
|
15960
|
+
NO_GALLERY_SKIPS,
|
|
15719
15961
|
PDPLayout,
|
|
15720
15962
|
PersonalizationInputs,
|
|
15721
15963
|
PersonalizationProvider,
|
|
@@ -15811,9 +16053,14 @@ export {
|
|
|
15811
16053
|
checkThemeTokens,
|
|
15812
16054
|
createScrollDirectionTracker,
|
|
15813
16055
|
describeProductArtAlignment2 as describeProductArtAlignment,
|
|
16056
|
+
firstView,
|
|
16057
|
+
firstViewAnchorOfSlide,
|
|
15814
16058
|
formatCurrency,
|
|
15815
16059
|
formatDate,
|
|
15816
16060
|
formatDateTime,
|
|
16061
|
+
gallerySkipVerdict,
|
|
16062
|
+
gallerySkippedStamp,
|
|
16063
|
+
galleryWithoutSkipped,
|
|
15817
16064
|
getBrand,
|
|
15818
16065
|
getMockupUrl,
|
|
15819
16066
|
getObservedElementCount,
|
|
@@ -15834,6 +16081,7 @@ export {
|
|
|
15834
16081
|
runConfigChecks,
|
|
15835
16082
|
scrollInputAboveKeyboard,
|
|
15836
16083
|
searchClient,
|
|
16084
|
+
slideFirstViewFields,
|
|
15837
16085
|
slideFirstViewProps,
|
|
15838
16086
|
spinnerVariants,
|
|
15839
16087
|
surfaceVariants,
|
|
@@ -15846,6 +16094,8 @@ export {
|
|
|
15846
16094
|
useDesignOptional,
|
|
15847
16095
|
useDeviceDetection,
|
|
15848
16096
|
useFocusTrap,
|
|
16097
|
+
useGallerySkipOptional,
|
|
16098
|
+
useGallerySkipState,
|
|
15849
16099
|
useHeroZoomScales,
|
|
15850
16100
|
useImagePreloader,
|
|
15851
16101
|
useImageTransition,
|