@snowcone-app/ui 0.10.0 → 0.10.3
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 +28 -0
- package/dist/index.cjs +99 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +100 -24
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/composed/HeroProductImage.tsx +13 -1
- package/src/composed/carousels/MobileProductCarousel.tsx +2 -0
- package/src/composed/carousels/types.ts +7 -0
- package/src/patterns/RealtimeProvider.tsx +117 -23
- package/src/patterns/__tests__/RealtimeProvider.blobLifecycle.test.tsx +1 -1
- package/src/patterns/__tests__/RealtimeProvider.cropDelivery.test.tsx +1 -1
- package/src/patterns/__tests__/RealtimeProvider.frameAcks.test.tsx +99 -0
- package/src/patterns/__tests__/RealtimeProvider.sessionShape.test.tsx +37 -1
- package/src/patterns/__tests__/RealtimeProvider.sizePicture.test.tsx +75 -0
package/dist/index.d.cts
CHANGED
|
@@ -3123,6 +3123,9 @@ interface RealtimeContextValue {
|
|
|
3123
3123
|
registerBlobUrl: (blobOrUrl: Blob | string, placementName?: string) => string;
|
|
3124
3124
|
/** A picture's <img> loaded `url` (from getMockupUrl): its older composited frames are released. */
|
|
3125
3125
|
markBlobShown: (mockupId: string, url: string, consumer?: string) => void;
|
|
3126
|
+
/** A picture's img failed to load a delivered frame. With frame flow control, every frame must be reported done
|
|
3127
|
+
* (drawn via markBlobShown, or failed here), or the box waits for it until its ack timeout (E_RT_ACK_TIMEOUT). */
|
|
3128
|
+
frameFailed: (url: string) => void;
|
|
3126
3129
|
/** An element that called markBlobShown unmounted: it no longer holds its frame. */
|
|
3127
3130
|
releaseBlobConsumer: (mockupId: string, consumer: string) => void;
|
|
3128
3131
|
}
|
|
@@ -4756,6 +4759,12 @@ interface CarouselImage {
|
|
|
4756
4759
|
mockupId?: string;
|
|
4757
4760
|
/** Aspect ratio of the mockup (e.g., 1.78 for 16:9) */
|
|
4758
4761
|
aspectRatio?: number;
|
|
4762
|
+
/**
|
|
4763
|
+
* What this picture is in the gallery. 'size-picture': the picture of the chosen size (exactly one, last). The
|
|
4764
|
+
* realtime session renders it like any picture (the box renders each mockup at the variant it lists, rc#858).
|
|
4765
|
+
* Stamped data-gallery-role on the slide.
|
|
4766
|
+
*/
|
|
4767
|
+
galleryRole?: "size-picture";
|
|
4759
4768
|
}
|
|
4760
4769
|
/**
|
|
4761
4770
|
* Alias for CarouselImage - used in hero contexts for semantic clarity.
|
package/dist/index.d.ts
CHANGED
|
@@ -3123,6 +3123,9 @@ interface RealtimeContextValue {
|
|
|
3123
3123
|
registerBlobUrl: (blobOrUrl: Blob | string, placementName?: string) => string;
|
|
3124
3124
|
/** A picture's <img> loaded `url` (from getMockupUrl): its older composited frames are released. */
|
|
3125
3125
|
markBlobShown: (mockupId: string, url: string, consumer?: string) => void;
|
|
3126
|
+
/** A picture's img failed to load a delivered frame. With frame flow control, every frame must be reported done
|
|
3127
|
+
* (drawn via markBlobShown, or failed here), or the box waits for it until its ack timeout (E_RT_ACK_TIMEOUT). */
|
|
3128
|
+
frameFailed: (url: string) => void;
|
|
3126
3129
|
/** An element that called markBlobShown unmounted: it no longer holds its frame. */
|
|
3127
3130
|
releaseBlobConsumer: (mockupId: string, consumer: string) => void;
|
|
3128
3131
|
}
|
|
@@ -4756,6 +4759,12 @@ interface CarouselImage {
|
|
|
4756
4759
|
mockupId?: string;
|
|
4757
4760
|
/** Aspect ratio of the mockup (e.g., 1.78 for 16:9) */
|
|
4758
4761
|
aspectRatio?: number;
|
|
4762
|
+
/**
|
|
4763
|
+
* What this picture is in the gallery. 'size-picture': the picture of the chosen size (exactly one, last). The
|
|
4764
|
+
* realtime session renders it like any picture (the box renders each mockup at the variant it lists, rc#858).
|
|
4765
|
+
* Stamped data-gallery-role on the slide.
|
|
4766
|
+
*/
|
|
4767
|
+
galleryRole?: "size-picture";
|
|
4759
4768
|
}
|
|
4760
4769
|
/**
|
|
4761
4770
|
* Alias for CarouselImage - used in hero contexts for semantic clarity.
|
package/dist/index.js
CHANGED
|
@@ -5625,7 +5625,7 @@ import {
|
|
|
5625
5625
|
useMemo as useMemo7
|
|
5626
5626
|
} from "react";
|
|
5627
5627
|
import { useRealtimeMockup as useRealtimeMockup2 } from "@snowcone-app/sdk/react";
|
|
5628
|
-
import { resolvePreviewVariantId, resolveVariantId as resolveVariantIdUtil } from "@snowcone-app/sdk";
|
|
5628
|
+
import { gallerySizePicture, mockupRole, resolvePreviewVariantId, resolveVariantId as resolveVariantIdUtil } from "@snowcone-app/sdk";
|
|
5629
5629
|
|
|
5630
5630
|
// src/patterns/MockupBackground.tsx
|
|
5631
5631
|
import { createContext as createContext7, useContext as useContext5 } from "react";
|
|
@@ -5742,6 +5742,7 @@ var MAX_FRAMES_PER_PICTURE = 3;
|
|
|
5742
5742
|
var FRAME_SUPERSEDE_GRACE_MS = 2e3;
|
|
5743
5743
|
var RERENDER_MIN_INTERVAL_MS = 550;
|
|
5744
5744
|
var EDIT_QUIET_MS = 600;
|
|
5745
|
+
var EXPORT_PENDING_MAX_MS = 5e3;
|
|
5745
5746
|
function mergeMockupIds(current, extra) {
|
|
5746
5747
|
const out = [...current];
|
|
5747
5748
|
for (const id of extra) if (!out.includes(id)) out.push(id);
|
|
@@ -5789,6 +5790,7 @@ function RealtimeProvider({
|
|
|
5789
5790
|
const configSentRef = useRef12(false);
|
|
5790
5791
|
const placementSettingsOverridesRef = useRef12({});
|
|
5791
5792
|
const lastSentVariantIdRef = useRef12(null);
|
|
5793
|
+
const lastSentSizePictureRef = useRef12(null);
|
|
5792
5794
|
const lastSentBgRef = useRef12(void 0);
|
|
5793
5795
|
const spreadCropsRef = useRef12(void 0);
|
|
5794
5796
|
const [spreadCropsVersion, setSpreadCropsVersion] = useState17(0);
|
|
@@ -5860,7 +5862,8 @@ function RealtimeProvider({
|
|
|
5860
5862
|
getLastSentVersion,
|
|
5861
5863
|
getLatestSentVersions,
|
|
5862
5864
|
rerender: rerenderRaw,
|
|
5863
|
-
isFrameSuperseded
|
|
5865
|
+
isFrameSuperseded,
|
|
5866
|
+
ackFrame
|
|
5864
5867
|
} = realtimeMockup;
|
|
5865
5868
|
const isFrameSupersededRef = useRef12(isFrameSuperseded);
|
|
5866
5869
|
isFrameSupersededRef.current = isFrameSuperseded;
|
|
@@ -5885,6 +5888,16 @@ function RealtimeProvider({
|
|
|
5885
5888
|
const hasBlobInFlightRef = useRef12(false);
|
|
5886
5889
|
const pipelineResetCooldownRef = useRef12(false);
|
|
5887
5890
|
const dueByVersionRef = useRef12(/* @__PURE__ */ new Map());
|
|
5891
|
+
const frameByUrlRef = useRef12(/* @__PURE__ */ new Map());
|
|
5892
|
+
const ackFrameRef = useRef12(null);
|
|
5893
|
+
ackFrameRef.current = ackFrame;
|
|
5894
|
+
const ackUrl = useCallback10((url) => {
|
|
5895
|
+
const f = frameByUrlRef.current.get(url);
|
|
5896
|
+
if (f) ackFrameRef.current?.(f.mockupId, f.seq);
|
|
5897
|
+
}, []);
|
|
5898
|
+
const ackResultFrame = useCallback10((result) => {
|
|
5899
|
+
if (typeof result.seq === "number") ackFrameRef.current?.(result.mockupId, result.seq);
|
|
5900
|
+
}, []);
|
|
5888
5901
|
const configuredMockupIdsRef = useRef12([]);
|
|
5889
5902
|
const mockupUrlCacheRef = useRef12(/* @__PURE__ */ new Map());
|
|
5890
5903
|
const registeredBlobUrlsRef = useRef12(/* @__PURE__ */ new Set());
|
|
@@ -5905,6 +5918,7 @@ function RealtimeProvider({
|
|
|
5905
5918
|
const pictureViewsRef = useRef12(/* @__PURE__ */ new Map());
|
|
5906
5919
|
const editLiveRef = useRef12(false);
|
|
5907
5920
|
const editQuietTimerRef = useRef12(null);
|
|
5921
|
+
const exportPendingSinceRef = useRef12(0);
|
|
5908
5922
|
const shapeApplyTimerRef = useRef12(null);
|
|
5909
5923
|
const lastShapeRef = useRef12(null);
|
|
5910
5924
|
const applySessionShapeRef = useRef12(null);
|
|
@@ -5971,13 +5985,17 @@ function RealtimeProvider({
|
|
|
5971
5985
|
blobsByOwnerRef.current.set(owner, list.slice(0, oldestShownIdx + 1));
|
|
5972
5986
|
}, [revokeBlobUrl]);
|
|
5973
5987
|
const markBlobShown = useCallback10((owner, url, consumer = "default") => {
|
|
5988
|
+
ackUrl(url);
|
|
5974
5989
|
const list = blobsByOwnerRef.current.get(owner);
|
|
5975
5990
|
if (!list || list.indexOf(url) < 0) return;
|
|
5976
5991
|
const shown = shownBlobByOwnerRef.current.get(owner) ?? /* @__PURE__ */ new Map();
|
|
5977
5992
|
shown.set(consumer, url);
|
|
5978
5993
|
shownBlobByOwnerRef.current.set(owner, shown);
|
|
5979
5994
|
releaseOlderFrames(owner);
|
|
5980
|
-
}, [releaseOlderFrames]);
|
|
5995
|
+
}, [releaseOlderFrames, ackUrl]);
|
|
5996
|
+
const frameFailed = useCallback10((url) => {
|
|
5997
|
+
ackUrl(url);
|
|
5998
|
+
}, [ackUrl]);
|
|
5981
5999
|
const releaseBlobConsumer = useCallback10((owner, consumer) => {
|
|
5982
6000
|
const shown = shownBlobByOwnerRef.current.get(owner);
|
|
5983
6001
|
if (!shown?.delete(consumer)) return;
|
|
@@ -6177,6 +6195,16 @@ function RealtimeProvider({
|
|
|
6177
6195
|
const delivered = new Set(results.map((r) => r.mockupId));
|
|
6178
6196
|
pendingRerenderRef.current = pendingRerenderRef.current.filter((id) => !delivered.has(id));
|
|
6179
6197
|
}
|
|
6198
|
+
results.forEach((result) => {
|
|
6199
|
+
const seq = result.seq;
|
|
6200
|
+
if (typeof seq !== "number") return;
|
|
6201
|
+
const byUrl = frameByUrlRef.current;
|
|
6202
|
+
byUrl.set(result.imageUrl, { mockupId: result.mockupId, seq });
|
|
6203
|
+
if (byUrl.size > 1024) byUrl.delete(byUrl.keys().next().value);
|
|
6204
|
+
const shownUrl = mockupUrlCacheRef.current.get(result.mockupId)?.url;
|
|
6205
|
+
const watched = (mockupSubscribersByIdRef.current.get(result.mockupId)?.size ?? 0) > 0;
|
|
6206
|
+
if (!watched || shownUrl === result.imageUrl) ackFrameRef.current?.(result.mockupId, seq);
|
|
6207
|
+
});
|
|
6180
6208
|
const clearedPlacements = /* @__PURE__ */ new Set();
|
|
6181
6209
|
results.forEach((result) => {
|
|
6182
6210
|
const wasPending = pendingMockupIdsRef.current.has(result.mockupId);
|
|
@@ -6207,18 +6235,24 @@ function RealtimeProvider({
|
|
|
6207
6235
|
}
|
|
6208
6236
|
});
|
|
6209
6237
|
let settledVersions = 0;
|
|
6238
|
+
let newestSettled = 0;
|
|
6210
6239
|
const due = dueByVersionRef.current;
|
|
6211
6240
|
results.forEach((result) => {
|
|
6212
|
-
const
|
|
6213
|
-
if (
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6241
|
+
const w = result.requestVersion;
|
|
6242
|
+
if (w === void 0) return;
|
|
6243
|
+
due.forEach((entry, v) => {
|
|
6244
|
+
if (v > w) return;
|
|
6245
|
+
const seen = entry.seen ??= /* @__PURE__ */ new Set();
|
|
6246
|
+
if (seen.has(result.mockupId)) return;
|
|
6247
|
+
seen.add(result.mockupId);
|
|
6248
|
+
if (entry.due <= 1) {
|
|
6249
|
+
due.delete(v);
|
|
6250
|
+
settledVersions += 1;
|
|
6251
|
+
newestSettled = Math.max(newestSettled, v);
|
|
6252
|
+
} else {
|
|
6253
|
+
entry.due -= 1;
|
|
6254
|
+
}
|
|
6255
|
+
});
|
|
6222
6256
|
});
|
|
6223
6257
|
due.forEach((entry, v) => {
|
|
6224
6258
|
if (now - entry.at > 1e4) due.delete(v);
|
|
@@ -6227,15 +6261,16 @@ function RealtimeProvider({
|
|
|
6227
6261
|
if (!pipelineResetCooldownRef.current) {
|
|
6228
6262
|
hasBlobInFlightRef.current = false;
|
|
6229
6263
|
for (let i = 0; i < settledVersions; i++) pipelineSettledSubscribersRef.current.forEach((cb) => cb());
|
|
6230
|
-
|
|
6264
|
+
const exportPending = exportPendingSinceRef.current > 0 && Date.now() - exportPendingSinceRef.current < EXPORT_PENDING_MAX_MS;
|
|
6265
|
+
if (!exportPending && newestSettled >= getLastSentVersion()) markEditSettled();
|
|
6231
6266
|
}
|
|
6232
6267
|
} else if (due.size === 0 && hasBlobInFlightRef.current && !hasPendingBlobs() && !pipelineResetCooldownRef.current) {
|
|
6233
6268
|
hasBlobInFlightRef.current = false;
|
|
6234
6269
|
pipelineSettledSubscribersRef.current.forEach((cb) => cb());
|
|
6235
|
-
markEditSettled();
|
|
6270
|
+
if (!(exportPendingSinceRef.current > 0 && Date.now() - exportPendingSinceRef.current < EXPORT_PENDING_MAX_MS)) markEditSettled();
|
|
6236
6271
|
}
|
|
6237
6272
|
},
|
|
6238
|
-
[hasPendingBlobs, markEditSettled]
|
|
6273
|
+
[hasPendingBlobs, markEditSettled, getLastSentVersion]
|
|
6239
6274
|
);
|
|
6240
6275
|
const runComposite = useCallback10(
|
|
6241
6276
|
async (result) => {
|
|
@@ -6245,6 +6280,7 @@ function RealtimeProvider({
|
|
|
6245
6280
|
console.error(
|
|
6246
6281
|
`[RealtimeProvider] E_OVERLAY_NO_BACKGROUND: cropped frame for ${result.mockupId} has no frozen background \u2014 falling back to full-frame and re-rendering it.`
|
|
6247
6282
|
);
|
|
6283
|
+
ackResultFrame(result);
|
|
6248
6284
|
rerenderFullFrame(result.mockupId);
|
|
6249
6285
|
return;
|
|
6250
6286
|
}
|
|
@@ -6260,9 +6296,13 @@ function RealtimeProvider({
|
|
|
6260
6296
|
rect: result.cropRect,
|
|
6261
6297
|
canvas: compositeCanvasRef.current ?? void 0
|
|
6262
6298
|
});
|
|
6263
|
-
if (gen !== sceneGenRef.current)
|
|
6299
|
+
if (gen !== sceneGenRef.current) {
|
|
6300
|
+
ackResultFrame(result);
|
|
6301
|
+
return;
|
|
6302
|
+
}
|
|
6264
6303
|
deliverResults([{ ...result, imageUrl: registerBlobUrl(blob, void 0, result.mockupId) }]);
|
|
6265
6304
|
} catch (err) {
|
|
6305
|
+
ackResultFrame(result);
|
|
6266
6306
|
if (gen !== sceneGenRef.current || compositeQueueRef.current.has(result.mockupId) || processedFrameRef.current.get(result.mockupId) !== result.imageUrl) {
|
|
6267
6307
|
return;
|
|
6268
6308
|
}
|
|
@@ -6291,7 +6331,7 @@ function RealtimeProvider({
|
|
|
6291
6331
|
rerenderFullFrame(result.mockupId);
|
|
6292
6332
|
}
|
|
6293
6333
|
},
|
|
6294
|
-
[deliverResults, registerBlobUrl, rerenderFullFrame]
|
|
6334
|
+
[deliverResults, registerBlobUrl, rerenderFullFrame, ackResultFrame]
|
|
6295
6335
|
);
|
|
6296
6336
|
const pumpCompositeQueue = useCallback10(
|
|
6297
6337
|
(mockupId) => {
|
|
@@ -6351,6 +6391,7 @@ function RealtimeProvider({
|
|
|
6351
6391
|
const sendCanvasBlob = useCallback10(
|
|
6352
6392
|
(placement, blob, mockupCount, baseThrottleMs) => {
|
|
6353
6393
|
blobQueuedGenRef.current = pipelineGenRef.current;
|
|
6394
|
+
exportPendingSinceRef.current = 0;
|
|
6354
6395
|
const result = sendCanvasBlobRaw(
|
|
6355
6396
|
placement,
|
|
6356
6397
|
blob,
|
|
@@ -6371,6 +6412,7 @@ function RealtimeProvider({
|
|
|
6371
6412
|
const sendCanvasState = useCallback10(
|
|
6372
6413
|
(placement, state, mockupCount, baseThrottleMs) => {
|
|
6373
6414
|
blobQueuedGenRef.current = pipelineGenRef.current;
|
|
6415
|
+
exportPendingSinceRef.current = 0;
|
|
6374
6416
|
const result = sendCanvasStateRaw(
|
|
6375
6417
|
placement,
|
|
6376
6418
|
state,
|
|
@@ -6439,10 +6481,13 @@ function RealtimeProvider({
|
|
|
6439
6481
|
);
|
|
6440
6482
|
const isFirstSend = !configSentRef.current;
|
|
6441
6483
|
const variantChanged = lastSentVariantIdRef.current !== null && lastSentVariantIdRef.current !== variantId;
|
|
6484
|
+
const sizePicture = gallerySizePicture(product.mockups, resolveVariantIdUtil(productContext, void 0, void 0));
|
|
6485
|
+
const sizePictureId = sizePicture?.id ?? null;
|
|
6486
|
+
const sizePictureChanged = configSentRef.current && lastSentSizePictureRef.current !== sizePictureId;
|
|
6442
6487
|
const bgChanged = configSentRef.current && lastSentBgRef.current !== mockupBg;
|
|
6443
6488
|
const spreadCropsJson = JSON.stringify(spreadCropsRef.current ?? null);
|
|
6444
6489
|
const spreadCropsChanged = configSentRef.current && lastSentSpreadCropsRef.current !== spreadCropsJson;
|
|
6445
|
-
if (!isFirstSend && !variantChanged && !bgChanged && !spreadCropsChanged) {
|
|
6490
|
+
if (!isFirstSend && !variantChanged && !bgChanged && !spreadCropsChanged && !sizePictureChanged) {
|
|
6446
6491
|
return;
|
|
6447
6492
|
}
|
|
6448
6493
|
if (variantChanged || bgChanged) {
|
|
@@ -6451,11 +6496,15 @@ function RealtimeProvider({
|
|
|
6451
6496
|
const mockupIds = [];
|
|
6452
6497
|
if (product.mockups && Array.isArray(product.mockups)) {
|
|
6453
6498
|
product.mockups.forEach((mockup) => {
|
|
6454
|
-
if (mockup.id) {
|
|
6499
|
+
if (mockup.id && mockupRole(mockup) === "ordinary") {
|
|
6455
6500
|
mockupIds.push(mockup.id);
|
|
6456
6501
|
}
|
|
6457
6502
|
});
|
|
6458
6503
|
}
|
|
6504
|
+
if (sizePictureId) mockupIds.push(sizePictureId);
|
|
6505
|
+
if (croppedActiveRef.current && mockupIds.some((id) => !backgroundsRef.current.has(id))) {
|
|
6506
|
+
croppedActiveRef.current = false;
|
|
6507
|
+
}
|
|
6459
6508
|
configuredMockupIdsRef.current = mockupIds;
|
|
6460
6509
|
const shape = currentShape();
|
|
6461
6510
|
lastShapeRef.current = shape;
|
|
@@ -6467,7 +6516,11 @@ function RealtimeProvider({
|
|
|
6467
6516
|
width: shape.width,
|
|
6468
6517
|
...mockupBg ? { bg: mockupBg } : {},
|
|
6469
6518
|
...spreadCropsRef.current ? { spreadCrops: spreadCropsRef.current } : {},
|
|
6470
|
-
placementSettings: { ...placementSettingsOverridesRef.current }
|
|
6519
|
+
placementSettings: { ...placementSettingsOverridesRef.current },
|
|
6520
|
+
// Frame flow control: this provider acks every frame it is done with (drawn / superseded / not shown /
|
|
6521
|
+
// failed), so the box can coalesce instead of queueing a backlog behind Cloudflare. Dormant on boxes
|
|
6522
|
+
// that don't negotiate it.
|
|
6523
|
+
acks: true
|
|
6471
6524
|
} : {
|
|
6472
6525
|
productId,
|
|
6473
6526
|
mockupIds: shape.mockupIds,
|
|
@@ -6477,7 +6530,11 @@ function RealtimeProvider({
|
|
|
6477
6530
|
width: shape.width,
|
|
6478
6531
|
...mockupBg ? { bg: mockupBg } : {},
|
|
6479
6532
|
...spreadCropsRef.current ? { spreadCrops: spreadCropsRef.current } : {},
|
|
6480
|
-
placementSettings: { ...placementSettingsOverridesRef.current }
|
|
6533
|
+
placementSettings: { ...placementSettingsOverridesRef.current },
|
|
6534
|
+
// Frame flow control: this provider acks every frame it is done with (drawn / superseded / not shown /
|
|
6535
|
+
// failed), so the box can coalesce instead of queueing a backlog behind Cloudflare. Dormant on boxes
|
|
6536
|
+
// that don't negotiate it.
|
|
6537
|
+
acks: true
|
|
6481
6538
|
};
|
|
6482
6539
|
if (variantChanged) {
|
|
6483
6540
|
const imagePlacements = placements.filter((p) => p.type === "image");
|
|
@@ -6492,6 +6549,7 @@ function RealtimeProvider({
|
|
|
6492
6549
|
);
|
|
6493
6550
|
configSentRef.current = true;
|
|
6494
6551
|
lastSentVariantIdRef.current = variantId;
|
|
6552
|
+
lastSentSizePictureRef.current = sizePictureId;
|
|
6495
6553
|
lastSentBgRef.current = mockupBg;
|
|
6496
6554
|
lastSentSpreadCropsRef.current = spreadCropsJson;
|
|
6497
6555
|
setTimeout(() => {
|
|
@@ -6687,6 +6745,7 @@ function RealtimeProvider({
|
|
|
6687
6745
|
);
|
|
6688
6746
|
const notifyPendingExport = useCallback10(
|
|
6689
6747
|
(placement) => {
|
|
6748
|
+
exportPendingSinceRef.current = Date.now();
|
|
6690
6749
|
if (pendingPlacementsRef.current.has(placement)) {
|
|
6691
6750
|
return;
|
|
6692
6751
|
}
|
|
@@ -6694,6 +6753,7 @@ function RealtimeProvider({
|
|
|
6694
6753
|
const pendingIds = [];
|
|
6695
6754
|
if (productContext?.product?.mockups) {
|
|
6696
6755
|
productContext.product.mockups.forEach((mockup) => {
|
|
6756
|
+
if (mockupRole(mockup) !== "ordinary" && !configuredMockupIdsRef.current.includes(mockup.id)) return;
|
|
6697
6757
|
if (mockup.placement === placement || !mockup.placement) {
|
|
6698
6758
|
pendingMockupIdsRef.current.add(mockup.id);
|
|
6699
6759
|
pendingIds.push(mockup.id);
|
|
@@ -6708,6 +6768,8 @@ function RealtimeProvider({
|
|
|
6708
6768
|
);
|
|
6709
6769
|
const notifyPendingExportCancelled = useCallback10(
|
|
6710
6770
|
(placement) => {
|
|
6771
|
+
exportPendingSinceRef.current = 0;
|
|
6772
|
+
markEditSettled();
|
|
6711
6773
|
if (!pendingPlacementsRef.current.has(placement)) {
|
|
6712
6774
|
return;
|
|
6713
6775
|
}
|
|
@@ -6728,7 +6790,7 @@ function RealtimeProvider({
|
|
|
6728
6790
|
);
|
|
6729
6791
|
pendingExportCancelledSubscribersRef.current.forEach((cb) => cb(placement));
|
|
6730
6792
|
},
|
|
6731
|
-
[productContext?.product?.mockups]
|
|
6793
|
+
[productContext?.product?.mockups, markEditSettled]
|
|
6732
6794
|
);
|
|
6733
6795
|
const getMockupUrl3 = useCallback10((mockupId) => {
|
|
6734
6796
|
if (pendingMockupIdsRef.current.has(mockupId)) {
|
|
@@ -6881,6 +6943,7 @@ function RealtimeProvider({
|
|
|
6881
6943
|
isMockupLoading,
|
|
6882
6944
|
registerBlobUrl,
|
|
6883
6945
|
markBlobShown,
|
|
6946
|
+
frameFailed,
|
|
6884
6947
|
releaseBlobConsumer,
|
|
6885
6948
|
// WebRTC streaming
|
|
6886
6949
|
subscribeRTCTiming
|
|
@@ -6918,6 +6981,7 @@ function RealtimeProvider({
|
|
|
6918
6981
|
isMockupLoading,
|
|
6919
6982
|
registerBlobUrl,
|
|
6920
6983
|
markBlobShown,
|
|
6984
|
+
frameFailed,
|
|
6921
6985
|
releaseBlobConsumer
|
|
6922
6986
|
]
|
|
6923
6987
|
);
|
|
@@ -10737,6 +10801,8 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10737
10801
|
const getLatestSentVersions = realtimeContext?.getLatestSentVersions;
|
|
10738
10802
|
const refusalCodeRef = useRef23(null);
|
|
10739
10803
|
refusalCodeRef.current = unavailable?.code ?? null;
|
|
10804
|
+
const frameFailedRef = useRef23(realtimeContext?.frameFailed);
|
|
10805
|
+
frameFailedRef.current = realtimeContext?.frameFailed;
|
|
10740
10806
|
const sessionErrorCodeRef = useRef23(null);
|
|
10741
10807
|
sessionErrorCodeRef.current = realtimeContext?.renderError?.code ?? null;
|
|
10742
10808
|
const getCanvasVersion = realtimeContext?.getCanvasVersion;
|
|
@@ -10744,6 +10810,12 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10744
10810
|
const applyRenderStamp = useCallback18(() => {
|
|
10745
10811
|
const node = containerRef.current;
|
|
10746
10812
|
if (!node) return;
|
|
10813
|
+
if (mode === "static") {
|
|
10814
|
+
delete node.dataset.canvasVersion;
|
|
10815
|
+
delete node.dataset.renderVersion;
|
|
10816
|
+
node.dataset.renderState = "static";
|
|
10817
|
+
return;
|
|
10818
|
+
}
|
|
10747
10819
|
const canvas = getCanvasVersion?.() ?? 0;
|
|
10748
10820
|
if (canvas <= 0) {
|
|
10749
10821
|
delete node.dataset.canvasVersion;
|
|
@@ -10768,7 +10840,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10768
10840
|
node.dataset.wantedWidth = String(shape.width);
|
|
10769
10841
|
node.dataset.sessionPhase = shape.phase;
|
|
10770
10842
|
}
|
|
10771
|
-
}, [getCanvasVersion, getLatestSentVersions, getSessionShape]);
|
|
10843
|
+
}, [getCanvasVersion, getLatestSentVersions, getSessionShape, mode]);
|
|
10772
10844
|
const applyRenderStampRef = useRef23(applyRenderStamp);
|
|
10773
10845
|
applyRenderStampRef.current = applyRenderStamp;
|
|
10774
10846
|
useEffect32(() => {
|
|
@@ -11048,6 +11120,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11048
11120
|
else preload.onload = startCrossfade;
|
|
11049
11121
|
preload.onerror = () => {
|
|
11050
11122
|
frameErrorRef.current = "E_FRAME_UNAVAILABLE";
|
|
11123
|
+
frameFailedRef.current?.(displayUrl);
|
|
11051
11124
|
applyRenderStampRef.current?.();
|
|
11052
11125
|
};
|
|
11053
11126
|
return () => {
|
|
@@ -11153,6 +11226,7 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
11153
11226
|
}
|
|
11154
11227
|
setImgFailed(true);
|
|
11155
11228
|
setFirstImageLoaded(true);
|
|
11229
|
+
if (renderedUrl) realtimeContext?.frameFailed?.(renderedUrl);
|
|
11156
11230
|
onError?.();
|
|
11157
11231
|
if (process.env.NODE_ENV !== "production" && !signHintShownRef.current && renderedUrl && /\/[A-Za-z0-9]+\?/.test(renderedUrl) && !/[?&]signature=/.test(renderedUrl)) {
|
|
11158
11232
|
signHintShownRef.current = true;
|
|
@@ -13215,6 +13289,8 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
|
|
|
13215
13289
|
"div",
|
|
13216
13290
|
{
|
|
13217
13291
|
className: "w-full h-full flex-shrink-0 relative select-none",
|
|
13292
|
+
"data-gallery-role": image.galleryRole,
|
|
13293
|
+
"data-mockup-id": image.galleryRole ? image.mockupId : void 0,
|
|
13218
13294
|
children: [
|
|
13219
13295
|
!isWithinDecodeWindow ? /* @__PURE__ */ jsx74("div", { className: "w-full h-full bg-muted" }) : image.isPlaceholder ? (
|
|
13220
13296
|
// Rainbow prism loader (same as the /create route) instead of
|