@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#4482](https://github.com/snowcone-app/snowcone-monorepo/pull/4482) [`74f36f5`](https://github.com/snowcone-app/snowcone-monorepo/commit/74f36f5690c71d26f1e1a13478062ab458bbdccd) Thanks [@kevinsproles](https://github.com/kevinsproles)! - The chosen size's picture joins the realtime session (the render box renders each mockup at the variant it lists, rendercenter rc#858). Changing the size sends one config with the new size's picture. The other sizes are never rendered and never pending.
|
|
8
|
+
|
|
9
|
+
## 0.10.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#4455](https://github.com/snowcone-app/snowcone-monorepo/pull/4455) [`965c3d6`](https://github.com/snowcone-app/snowcone-monorepo/commit/965c3d647258bf8735bdda6080f27cb42305a406) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Realtime frame flow control. With `config.acks`, the box keeps at most `window` un-acked frames per mockup and sends only the newest when the client falls behind, instead of queueing a backlog behind Cloudflare.
|
|
14
|
+
- **SDK:** `ackFrame(mockupId, seq)` is a cumulative per-mockup ack, batched once per animation frame. The service acks superseded and stale-dropped frames itself, and updates state per frame while acking. `E_RT_ACK_TIMEOUT` and `E_RT_ACK_BAD` are typed faults (`state.acks`, `onAckFault`), never `renderError` or a picture refusal.
|
|
15
|
+
- **UI:** `RealtimeProvider` asks for acks and reports every frame done: drawn (`markBlobShown`), failed (`frameFailed`), not shown, or a dropped or failed composite. A version the box coalesced away settles once each mockup has a newer frame.
|
|
16
|
+
- **Older boxes:** stay unchanged. Acks are dormant until `config_received` carries them.
|
|
17
|
+
|
|
18
|
+
- [#4474](https://github.com/snowcone-app/snowcone-monorepo/pull/4474) [`e41bdc8`](https://github.com/snowcone-app/snowcone-monorepo/commit/e41bdc8293a5b20e199402047d416f17b6e9113e) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Size pictures (`linkedAs: 'size-picture'`, the picture of one size). The product gallery shows exactly one, the chosen size's, last. No "picture for this product / variant" lookup ever returns one.
|
|
19
|
+
- **SDK:** `mockupRole`, `ordinaryMockups` (a branded list), `pictureForVariant`, `primaryMockup` and `gallerySizePicture`. `getVariant`, `resolveMockupId` and `resolvePreviewVariantId` search ordinary mockups only. A size that no ordinary mockup lists gets the product's fallback picture. `linkedAs` is declared in the product schema and the zod schema.
|
|
20
|
+
- **UI:** `CarouselImage.galleryRole`. Slides carry `data-gallery-role` and `data-mockup-id`. A size picture renders on the per-picture URL path (`HeroProductImage mode="static"`, which stamps `data-render-state="static"`). Until the render box resolves the variant per mockup, `RealtimeProvider` leaves size pictures out of the session and never marks one pending.
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`965c3d6`](https://github.com/snowcone-app/snowcone-monorepo/commit/965c3d647258bf8735bdda6080f27cb42305a406), [`e41bdc8`](https://github.com/snowcone-app/snowcone-monorepo/commit/e41bdc8293a5b20e199402047d416f17b6e9113e)]:
|
|
23
|
+
- @snowcone-app/sdk@0.27.0
|
|
24
|
+
|
|
25
|
+
## 0.10.1
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- [#4445](https://github.com/snowcone-app/snowcone-monorepo/pull/4445) [`13b12bb`](https://github.com/snowcone-app/snowcone-monorepo/commit/13b12bbfec1a24e3efb4c5814a47de12f44bbb63) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Phone editor: the catch-up (every picture) starts only when the edit's own newest version has landed and no further export is on its way. On a slow link the editor-open frames were still arriving when a drag began; their settle started a 31-picture catch-up mid-gesture, and the edit's frames queued behind it (21 s). An announced export that never goes out stops holding the edit after 5 s; one cancelled as a no-op releases it at once.
|
|
30
|
+
|
|
3
31
|
## 0.10.0
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -6101,6 +6101,7 @@ var MAX_FRAMES_PER_PICTURE = 3;
|
|
|
6101
6101
|
var FRAME_SUPERSEDE_GRACE_MS = 2e3;
|
|
6102
6102
|
var RERENDER_MIN_INTERVAL_MS = 550;
|
|
6103
6103
|
var EDIT_QUIET_MS = 600;
|
|
6104
|
+
var EXPORT_PENDING_MAX_MS = 5e3;
|
|
6104
6105
|
function mergeMockupIds(current, extra) {
|
|
6105
6106
|
const out = [...current];
|
|
6106
6107
|
for (const id of extra) if (!out.includes(id)) out.push(id);
|
|
@@ -6148,6 +6149,7 @@ function RealtimeProvider({
|
|
|
6148
6149
|
const configSentRef = (0, import_react25.useRef)(false);
|
|
6149
6150
|
const placementSettingsOverridesRef = (0, import_react25.useRef)({});
|
|
6150
6151
|
const lastSentVariantIdRef = (0, import_react25.useRef)(null);
|
|
6152
|
+
const lastSentSizePictureRef = (0, import_react25.useRef)(null);
|
|
6151
6153
|
const lastSentBgRef = (0, import_react25.useRef)(void 0);
|
|
6152
6154
|
const spreadCropsRef = (0, import_react25.useRef)(void 0);
|
|
6153
6155
|
const [spreadCropsVersion, setSpreadCropsVersion] = (0, import_react25.useState)(0);
|
|
@@ -6219,7 +6221,8 @@ function RealtimeProvider({
|
|
|
6219
6221
|
getLastSentVersion,
|
|
6220
6222
|
getLatestSentVersions,
|
|
6221
6223
|
rerender: rerenderRaw,
|
|
6222
|
-
isFrameSuperseded
|
|
6224
|
+
isFrameSuperseded,
|
|
6225
|
+
ackFrame
|
|
6223
6226
|
} = realtimeMockup;
|
|
6224
6227
|
const isFrameSupersededRef = (0, import_react25.useRef)(isFrameSuperseded);
|
|
6225
6228
|
isFrameSupersededRef.current = isFrameSuperseded;
|
|
@@ -6244,6 +6247,16 @@ function RealtimeProvider({
|
|
|
6244
6247
|
const hasBlobInFlightRef = (0, import_react25.useRef)(false);
|
|
6245
6248
|
const pipelineResetCooldownRef = (0, import_react25.useRef)(false);
|
|
6246
6249
|
const dueByVersionRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
6250
|
+
const frameByUrlRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
6251
|
+
const ackFrameRef = (0, import_react25.useRef)(null);
|
|
6252
|
+
ackFrameRef.current = ackFrame;
|
|
6253
|
+
const ackUrl = (0, import_react25.useCallback)((url) => {
|
|
6254
|
+
const f = frameByUrlRef.current.get(url);
|
|
6255
|
+
if (f) ackFrameRef.current?.(f.mockupId, f.seq);
|
|
6256
|
+
}, []);
|
|
6257
|
+
const ackResultFrame = (0, import_react25.useCallback)((result) => {
|
|
6258
|
+
if (typeof result.seq === "number") ackFrameRef.current?.(result.mockupId, result.seq);
|
|
6259
|
+
}, []);
|
|
6247
6260
|
const configuredMockupIdsRef = (0, import_react25.useRef)([]);
|
|
6248
6261
|
const mockupUrlCacheRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
6249
6262
|
const registeredBlobUrlsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Set());
|
|
@@ -6264,6 +6277,7 @@ function RealtimeProvider({
|
|
|
6264
6277
|
const pictureViewsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
|
|
6265
6278
|
const editLiveRef = (0, import_react25.useRef)(false);
|
|
6266
6279
|
const editQuietTimerRef = (0, import_react25.useRef)(null);
|
|
6280
|
+
const exportPendingSinceRef = (0, import_react25.useRef)(0);
|
|
6267
6281
|
const shapeApplyTimerRef = (0, import_react25.useRef)(null);
|
|
6268
6282
|
const lastShapeRef = (0, import_react25.useRef)(null);
|
|
6269
6283
|
const applySessionShapeRef = (0, import_react25.useRef)(null);
|
|
@@ -6330,13 +6344,17 @@ function RealtimeProvider({
|
|
|
6330
6344
|
blobsByOwnerRef.current.set(owner, list.slice(0, oldestShownIdx + 1));
|
|
6331
6345
|
}, [revokeBlobUrl]);
|
|
6332
6346
|
const markBlobShown = (0, import_react25.useCallback)((owner, url, consumer = "default") => {
|
|
6347
|
+
ackUrl(url);
|
|
6333
6348
|
const list = blobsByOwnerRef.current.get(owner);
|
|
6334
6349
|
if (!list || list.indexOf(url) < 0) return;
|
|
6335
6350
|
const shown = shownBlobByOwnerRef.current.get(owner) ?? /* @__PURE__ */ new Map();
|
|
6336
6351
|
shown.set(consumer, url);
|
|
6337
6352
|
shownBlobByOwnerRef.current.set(owner, shown);
|
|
6338
6353
|
releaseOlderFrames(owner);
|
|
6339
|
-
}, [releaseOlderFrames]);
|
|
6354
|
+
}, [releaseOlderFrames, ackUrl]);
|
|
6355
|
+
const frameFailed = (0, import_react25.useCallback)((url) => {
|
|
6356
|
+
ackUrl(url);
|
|
6357
|
+
}, [ackUrl]);
|
|
6340
6358
|
const releaseBlobConsumer = (0, import_react25.useCallback)((owner, consumer) => {
|
|
6341
6359
|
const shown = shownBlobByOwnerRef.current.get(owner);
|
|
6342
6360
|
if (!shown?.delete(consumer)) return;
|
|
@@ -6536,6 +6554,16 @@ function RealtimeProvider({
|
|
|
6536
6554
|
const delivered = new Set(results.map((r) => r.mockupId));
|
|
6537
6555
|
pendingRerenderRef.current = pendingRerenderRef.current.filter((id) => !delivered.has(id));
|
|
6538
6556
|
}
|
|
6557
|
+
results.forEach((result) => {
|
|
6558
|
+
const seq = result.seq;
|
|
6559
|
+
if (typeof seq !== "number") return;
|
|
6560
|
+
const byUrl = frameByUrlRef.current;
|
|
6561
|
+
byUrl.set(result.imageUrl, { mockupId: result.mockupId, seq });
|
|
6562
|
+
if (byUrl.size > 1024) byUrl.delete(byUrl.keys().next().value);
|
|
6563
|
+
const shownUrl = mockupUrlCacheRef.current.get(result.mockupId)?.url;
|
|
6564
|
+
const watched = (mockupSubscribersByIdRef.current.get(result.mockupId)?.size ?? 0) > 0;
|
|
6565
|
+
if (!watched || shownUrl === result.imageUrl) ackFrameRef.current?.(result.mockupId, seq);
|
|
6566
|
+
});
|
|
6539
6567
|
const clearedPlacements = /* @__PURE__ */ new Set();
|
|
6540
6568
|
results.forEach((result) => {
|
|
6541
6569
|
const wasPending = pendingMockupIdsRef.current.has(result.mockupId);
|
|
@@ -6566,18 +6594,24 @@ function RealtimeProvider({
|
|
|
6566
6594
|
}
|
|
6567
6595
|
});
|
|
6568
6596
|
let settledVersions = 0;
|
|
6597
|
+
let newestSettled = 0;
|
|
6569
6598
|
const due = dueByVersionRef.current;
|
|
6570
6599
|
results.forEach((result) => {
|
|
6571
|
-
const
|
|
6572
|
-
if (
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6600
|
+
const w = result.requestVersion;
|
|
6601
|
+
if (w === void 0) return;
|
|
6602
|
+
due.forEach((entry, v) => {
|
|
6603
|
+
if (v > w) return;
|
|
6604
|
+
const seen = entry.seen ??= /* @__PURE__ */ new Set();
|
|
6605
|
+
if (seen.has(result.mockupId)) return;
|
|
6606
|
+
seen.add(result.mockupId);
|
|
6607
|
+
if (entry.due <= 1) {
|
|
6608
|
+
due.delete(v);
|
|
6609
|
+
settledVersions += 1;
|
|
6610
|
+
newestSettled = Math.max(newestSettled, v);
|
|
6611
|
+
} else {
|
|
6612
|
+
entry.due -= 1;
|
|
6613
|
+
}
|
|
6614
|
+
});
|
|
6581
6615
|
});
|
|
6582
6616
|
due.forEach((entry, v) => {
|
|
6583
6617
|
if (now - entry.at > 1e4) due.delete(v);
|
|
@@ -6586,15 +6620,16 @@ function RealtimeProvider({
|
|
|
6586
6620
|
if (!pipelineResetCooldownRef.current) {
|
|
6587
6621
|
hasBlobInFlightRef.current = false;
|
|
6588
6622
|
for (let i = 0; i < settledVersions; i++) pipelineSettledSubscribersRef.current.forEach((cb) => cb());
|
|
6589
|
-
|
|
6623
|
+
const exportPending = exportPendingSinceRef.current > 0 && Date.now() - exportPendingSinceRef.current < EXPORT_PENDING_MAX_MS;
|
|
6624
|
+
if (!exportPending && newestSettled >= getLastSentVersion()) markEditSettled();
|
|
6590
6625
|
}
|
|
6591
6626
|
} else if (due.size === 0 && hasBlobInFlightRef.current && !hasPendingBlobs() && !pipelineResetCooldownRef.current) {
|
|
6592
6627
|
hasBlobInFlightRef.current = false;
|
|
6593
6628
|
pipelineSettledSubscribersRef.current.forEach((cb) => cb());
|
|
6594
|
-
markEditSettled();
|
|
6629
|
+
if (!(exportPendingSinceRef.current > 0 && Date.now() - exportPendingSinceRef.current < EXPORT_PENDING_MAX_MS)) markEditSettled();
|
|
6595
6630
|
}
|
|
6596
6631
|
},
|
|
6597
|
-
[hasPendingBlobs, markEditSettled]
|
|
6632
|
+
[hasPendingBlobs, markEditSettled, getLastSentVersion]
|
|
6598
6633
|
);
|
|
6599
6634
|
const runComposite = (0, import_react25.useCallback)(
|
|
6600
6635
|
async (result) => {
|
|
@@ -6604,6 +6639,7 @@ function RealtimeProvider({
|
|
|
6604
6639
|
console.error(
|
|
6605
6640
|
`[RealtimeProvider] E_OVERLAY_NO_BACKGROUND: cropped frame for ${result.mockupId} has no frozen background \u2014 falling back to full-frame and re-rendering it.`
|
|
6606
6641
|
);
|
|
6642
|
+
ackResultFrame(result);
|
|
6607
6643
|
rerenderFullFrame(result.mockupId);
|
|
6608
6644
|
return;
|
|
6609
6645
|
}
|
|
@@ -6619,9 +6655,13 @@ function RealtimeProvider({
|
|
|
6619
6655
|
rect: result.cropRect,
|
|
6620
6656
|
canvas: compositeCanvasRef.current ?? void 0
|
|
6621
6657
|
});
|
|
6622
|
-
if (gen !== sceneGenRef.current)
|
|
6658
|
+
if (gen !== sceneGenRef.current) {
|
|
6659
|
+
ackResultFrame(result);
|
|
6660
|
+
return;
|
|
6661
|
+
}
|
|
6623
6662
|
deliverResults([{ ...result, imageUrl: registerBlobUrl(blob, void 0, result.mockupId) }]);
|
|
6624
6663
|
} catch (err) {
|
|
6664
|
+
ackResultFrame(result);
|
|
6625
6665
|
if (gen !== sceneGenRef.current || compositeQueueRef.current.has(result.mockupId) || processedFrameRef.current.get(result.mockupId) !== result.imageUrl) {
|
|
6626
6666
|
return;
|
|
6627
6667
|
}
|
|
@@ -6650,7 +6690,7 @@ function RealtimeProvider({
|
|
|
6650
6690
|
rerenderFullFrame(result.mockupId);
|
|
6651
6691
|
}
|
|
6652
6692
|
},
|
|
6653
|
-
[deliverResults, registerBlobUrl, rerenderFullFrame]
|
|
6693
|
+
[deliverResults, registerBlobUrl, rerenderFullFrame, ackResultFrame]
|
|
6654
6694
|
);
|
|
6655
6695
|
const pumpCompositeQueue = (0, import_react25.useCallback)(
|
|
6656
6696
|
(mockupId) => {
|
|
@@ -6710,6 +6750,7 @@ function RealtimeProvider({
|
|
|
6710
6750
|
const sendCanvasBlob = (0, import_react25.useCallback)(
|
|
6711
6751
|
(placement, blob, mockupCount, baseThrottleMs) => {
|
|
6712
6752
|
blobQueuedGenRef.current = pipelineGenRef.current;
|
|
6753
|
+
exportPendingSinceRef.current = 0;
|
|
6713
6754
|
const result = sendCanvasBlobRaw(
|
|
6714
6755
|
placement,
|
|
6715
6756
|
blob,
|
|
@@ -6730,6 +6771,7 @@ function RealtimeProvider({
|
|
|
6730
6771
|
const sendCanvasState = (0, import_react25.useCallback)(
|
|
6731
6772
|
(placement, state, mockupCount, baseThrottleMs) => {
|
|
6732
6773
|
blobQueuedGenRef.current = pipelineGenRef.current;
|
|
6774
|
+
exportPendingSinceRef.current = 0;
|
|
6733
6775
|
const result = sendCanvasStateRaw(
|
|
6734
6776
|
placement,
|
|
6735
6777
|
state,
|
|
@@ -6798,10 +6840,13 @@ function RealtimeProvider({
|
|
|
6798
6840
|
);
|
|
6799
6841
|
const isFirstSend = !configSentRef.current;
|
|
6800
6842
|
const variantChanged = lastSentVariantIdRef.current !== null && lastSentVariantIdRef.current !== variantId;
|
|
6843
|
+
const sizePicture = (0, import_sdk8.gallerySizePicture)(product.mockups, (0, import_sdk8.resolveVariantId)(productContext, void 0, void 0));
|
|
6844
|
+
const sizePictureId = sizePicture?.id ?? null;
|
|
6845
|
+
const sizePictureChanged = configSentRef.current && lastSentSizePictureRef.current !== sizePictureId;
|
|
6801
6846
|
const bgChanged = configSentRef.current && lastSentBgRef.current !== mockupBg;
|
|
6802
6847
|
const spreadCropsJson = JSON.stringify(spreadCropsRef.current ?? null);
|
|
6803
6848
|
const spreadCropsChanged = configSentRef.current && lastSentSpreadCropsRef.current !== spreadCropsJson;
|
|
6804
|
-
if (!isFirstSend && !variantChanged && !bgChanged && !spreadCropsChanged) {
|
|
6849
|
+
if (!isFirstSend && !variantChanged && !bgChanged && !spreadCropsChanged && !sizePictureChanged) {
|
|
6805
6850
|
return;
|
|
6806
6851
|
}
|
|
6807
6852
|
if (variantChanged || bgChanged) {
|
|
@@ -6810,11 +6855,15 @@ function RealtimeProvider({
|
|
|
6810
6855
|
const mockupIds = [];
|
|
6811
6856
|
if (product.mockups && Array.isArray(product.mockups)) {
|
|
6812
6857
|
product.mockups.forEach((mockup) => {
|
|
6813
|
-
if (mockup.id) {
|
|
6858
|
+
if (mockup.id && (0, import_sdk8.mockupRole)(mockup) === "ordinary") {
|
|
6814
6859
|
mockupIds.push(mockup.id);
|
|
6815
6860
|
}
|
|
6816
6861
|
});
|
|
6817
6862
|
}
|
|
6863
|
+
if (sizePictureId) mockupIds.push(sizePictureId);
|
|
6864
|
+
if (croppedActiveRef.current && mockupIds.some((id) => !backgroundsRef.current.has(id))) {
|
|
6865
|
+
croppedActiveRef.current = false;
|
|
6866
|
+
}
|
|
6818
6867
|
configuredMockupIdsRef.current = mockupIds;
|
|
6819
6868
|
const shape = currentShape();
|
|
6820
6869
|
lastShapeRef.current = shape;
|
|
@@ -6826,7 +6875,11 @@ function RealtimeProvider({
|
|
|
6826
6875
|
width: shape.width,
|
|
6827
6876
|
...mockupBg ? { bg: mockupBg } : {},
|
|
6828
6877
|
...spreadCropsRef.current ? { spreadCrops: spreadCropsRef.current } : {},
|
|
6829
|
-
placementSettings: { ...placementSettingsOverridesRef.current }
|
|
6878
|
+
placementSettings: { ...placementSettingsOverridesRef.current },
|
|
6879
|
+
// Frame flow control: this provider acks every frame it is done with (drawn / superseded / not shown /
|
|
6880
|
+
// failed), so the box can coalesce instead of queueing a backlog behind Cloudflare. Dormant on boxes
|
|
6881
|
+
// that don't negotiate it.
|
|
6882
|
+
acks: true
|
|
6830
6883
|
} : {
|
|
6831
6884
|
productId,
|
|
6832
6885
|
mockupIds: shape.mockupIds,
|
|
@@ -6836,7 +6889,11 @@ function RealtimeProvider({
|
|
|
6836
6889
|
width: shape.width,
|
|
6837
6890
|
...mockupBg ? { bg: mockupBg } : {},
|
|
6838
6891
|
...spreadCropsRef.current ? { spreadCrops: spreadCropsRef.current } : {},
|
|
6839
|
-
placementSettings: { ...placementSettingsOverridesRef.current }
|
|
6892
|
+
placementSettings: { ...placementSettingsOverridesRef.current },
|
|
6893
|
+
// Frame flow control: this provider acks every frame it is done with (drawn / superseded / not shown /
|
|
6894
|
+
// failed), so the box can coalesce instead of queueing a backlog behind Cloudflare. Dormant on boxes
|
|
6895
|
+
// that don't negotiate it.
|
|
6896
|
+
acks: true
|
|
6840
6897
|
};
|
|
6841
6898
|
if (variantChanged) {
|
|
6842
6899
|
const imagePlacements = placements.filter((p) => p.type === "image");
|
|
@@ -6851,6 +6908,7 @@ function RealtimeProvider({
|
|
|
6851
6908
|
);
|
|
6852
6909
|
configSentRef.current = true;
|
|
6853
6910
|
lastSentVariantIdRef.current = variantId;
|
|
6911
|
+
lastSentSizePictureRef.current = sizePictureId;
|
|
6854
6912
|
lastSentBgRef.current = mockupBg;
|
|
6855
6913
|
lastSentSpreadCropsRef.current = spreadCropsJson;
|
|
6856
6914
|
setTimeout(() => {
|
|
@@ -7046,6 +7104,7 @@ function RealtimeProvider({
|
|
|
7046
7104
|
);
|
|
7047
7105
|
const notifyPendingExport = (0, import_react25.useCallback)(
|
|
7048
7106
|
(placement) => {
|
|
7107
|
+
exportPendingSinceRef.current = Date.now();
|
|
7049
7108
|
if (pendingPlacementsRef.current.has(placement)) {
|
|
7050
7109
|
return;
|
|
7051
7110
|
}
|
|
@@ -7053,6 +7112,7 @@ function RealtimeProvider({
|
|
|
7053
7112
|
const pendingIds = [];
|
|
7054
7113
|
if (productContext?.product?.mockups) {
|
|
7055
7114
|
productContext.product.mockups.forEach((mockup) => {
|
|
7115
|
+
if ((0, import_sdk8.mockupRole)(mockup) !== "ordinary" && !configuredMockupIdsRef.current.includes(mockup.id)) return;
|
|
7056
7116
|
if (mockup.placement === placement || !mockup.placement) {
|
|
7057
7117
|
pendingMockupIdsRef.current.add(mockup.id);
|
|
7058
7118
|
pendingIds.push(mockup.id);
|
|
@@ -7067,6 +7127,8 @@ function RealtimeProvider({
|
|
|
7067
7127
|
);
|
|
7068
7128
|
const notifyPendingExportCancelled = (0, import_react25.useCallback)(
|
|
7069
7129
|
(placement) => {
|
|
7130
|
+
exportPendingSinceRef.current = 0;
|
|
7131
|
+
markEditSettled();
|
|
7070
7132
|
if (!pendingPlacementsRef.current.has(placement)) {
|
|
7071
7133
|
return;
|
|
7072
7134
|
}
|
|
@@ -7087,7 +7149,7 @@ function RealtimeProvider({
|
|
|
7087
7149
|
);
|
|
7088
7150
|
pendingExportCancelledSubscribersRef.current.forEach((cb) => cb(placement));
|
|
7089
7151
|
},
|
|
7090
|
-
[productContext?.product?.mockups]
|
|
7152
|
+
[productContext?.product?.mockups, markEditSettled]
|
|
7091
7153
|
);
|
|
7092
7154
|
const getMockupUrl3 = (0, import_react25.useCallback)((mockupId) => {
|
|
7093
7155
|
if (pendingMockupIdsRef.current.has(mockupId)) {
|
|
@@ -7240,6 +7302,7 @@ function RealtimeProvider({
|
|
|
7240
7302
|
isMockupLoading,
|
|
7241
7303
|
registerBlobUrl,
|
|
7242
7304
|
markBlobShown,
|
|
7305
|
+
frameFailed,
|
|
7243
7306
|
releaseBlobConsumer,
|
|
7244
7307
|
// WebRTC streaming
|
|
7245
7308
|
subscribeRTCTiming
|
|
@@ -7277,6 +7340,7 @@ function RealtimeProvider({
|
|
|
7277
7340
|
isMockupLoading,
|
|
7278
7341
|
registerBlobUrl,
|
|
7279
7342
|
markBlobShown,
|
|
7343
|
+
frameFailed,
|
|
7280
7344
|
releaseBlobConsumer
|
|
7281
7345
|
]
|
|
7282
7346
|
);
|
|
@@ -11055,6 +11119,8 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11055
11119
|
const getLatestSentVersions = realtimeContext?.getLatestSentVersions;
|
|
11056
11120
|
const refusalCodeRef = (0, import_react46.useRef)(null);
|
|
11057
11121
|
refusalCodeRef.current = unavailable?.code ?? null;
|
|
11122
|
+
const frameFailedRef = (0, import_react46.useRef)(realtimeContext?.frameFailed);
|
|
11123
|
+
frameFailedRef.current = realtimeContext?.frameFailed;
|
|
11058
11124
|
const sessionErrorCodeRef = (0, import_react46.useRef)(null);
|
|
11059
11125
|
sessionErrorCodeRef.current = realtimeContext?.renderError?.code ?? null;
|
|
11060
11126
|
const getCanvasVersion = realtimeContext?.getCanvasVersion;
|
|
@@ -11062,6 +11128,12 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11062
11128
|
const applyRenderStamp = (0, import_react46.useCallback)(() => {
|
|
11063
11129
|
const node = containerRef.current;
|
|
11064
11130
|
if (!node) return;
|
|
11131
|
+
if (mode === "static") {
|
|
11132
|
+
delete node.dataset.canvasVersion;
|
|
11133
|
+
delete node.dataset.renderVersion;
|
|
11134
|
+
node.dataset.renderState = "static";
|
|
11135
|
+
return;
|
|
11136
|
+
}
|
|
11065
11137
|
const canvas = getCanvasVersion?.() ?? 0;
|
|
11066
11138
|
if (canvas <= 0) {
|
|
11067
11139
|
delete node.dataset.canvasVersion;
|
|
@@ -11086,7 +11158,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11086
11158
|
node.dataset.wantedWidth = String(shape.width);
|
|
11087
11159
|
node.dataset.sessionPhase = shape.phase;
|
|
11088
11160
|
}
|
|
11089
|
-
}, [getCanvasVersion, getLatestSentVersions, getSessionShape]);
|
|
11161
|
+
}, [getCanvasVersion, getLatestSentVersions, getSessionShape, mode]);
|
|
11090
11162
|
const applyRenderStampRef = (0, import_react46.useRef)(applyRenderStamp);
|
|
11091
11163
|
applyRenderStampRef.current = applyRenderStamp;
|
|
11092
11164
|
(0, import_react46.useEffect)(() => {
|
|
@@ -11366,6 +11438,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11366
11438
|
else preload.onload = startCrossfade;
|
|
11367
11439
|
preload.onerror = () => {
|
|
11368
11440
|
frameErrorRef.current = "E_FRAME_UNAVAILABLE";
|
|
11441
|
+
frameFailedRef.current?.(displayUrl);
|
|
11369
11442
|
applyRenderStampRef.current?.();
|
|
11370
11443
|
};
|
|
11371
11444
|
return () => {
|
|
@@ -11471,6 +11544,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11471
11544
|
}
|
|
11472
11545
|
setImgFailed(true);
|
|
11473
11546
|
setFirstImageLoaded(true);
|
|
11547
|
+
if (renderedUrl) realtimeContext?.frameFailed?.(renderedUrl);
|
|
11474
11548
|
onError?.();
|
|
11475
11549
|
if (process.env.NODE_ENV !== "production" && !signHintShownRef.current && renderedUrl && /\/[A-Za-z0-9]+\?/.test(renderedUrl) && !/[?&]signature=/.test(renderedUrl)) {
|
|
11476
11550
|
signHintShownRef.current = true;
|
|
@@ -13514,6 +13588,8 @@ var MobileProductCarousel = (0, import_react56.memo)(function MobileProductCarou
|
|
|
13514
13588
|
"div",
|
|
13515
13589
|
{
|
|
13516
13590
|
className: "w-full h-full flex-shrink-0 relative select-none",
|
|
13591
|
+
"data-gallery-role": image.galleryRole,
|
|
13592
|
+
"data-mockup-id": image.galleryRole ? image.mockupId : void 0,
|
|
13517
13593
|
children: [
|
|
13518
13594
|
!isWithinDecodeWindow ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "w-full h-full bg-muted" }) : image.isPlaceholder ? (
|
|
13519
13595
|
// Rainbow prism loader (same as the /create route) instead of
|