@snowcone-app/ui 0.11.7 → 0.11.10
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 +24 -0
- package/dist/index.cjs +29 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +27 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/composed/HeroProductImage.tsx +26 -7
- package/src/composed/__tests__/HeroProductImage.render-state.test.ts +31 -0
- package/src/patterns/RealtimeProvider.tsx +10 -0
- package/src/patterns/__tests__/RealtimeProvider.blobLifecycle.test.tsx +5 -0
- package/src/patterns/__tests__/RealtimeProvider.croppedLimit.test.tsx +171 -0
- package/src/patterns/croppedDeliveryLimit.ts +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.11.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#6396](https://github.com/snowcone-app/snowcone-monorepo/pull/6396) [`bbd0cc4`](https://github.com/snowcone-app/snowcone-monorepo/commit/bbd0cc442607ee2fd2ebdb0007f32aa91bf72365) Thanks [@kevinsproles](https://github.com/kevinsproles)! - RealtimeProvider: a realtime session holding more than 5 mockups stays on full-frame delivery instead of turning on cropped delivery (`overlayCrop: "auto"`). A stopgap for #6369 (the render boxes stall on cropped renders from about 10 mockups a session); named in `croppedDeliveryLimit.ts` and removed once the box-side fix is rolled. Sessions of 5 or fewer mockups (phone pages) are unchanged.
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`88db704`](https://github.com/snowcone-app/snowcone-monorepo/commit/88db7044a04c2d43b4de871adddc16411effeed5)]:
|
|
10
|
+
- @snowcone-app/sdk@0.31.15
|
|
11
|
+
|
|
12
|
+
## 0.11.9
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#6141](https://github.com/snowcone-app/snowcone-monorepo/pull/6141) [`35ab419`](https://github.com/snowcone-app/snowcone-monorepo/commit/35ab41931f0b6b62e884e1b8f003c188b357255e) Thanks [@kevinsproles](https://github.com/kevinsproles)! - HeroProductImage: a retryable render error (a busy or slow render server, `E_RT_PREVIEW_SLOW` / `E_RT_RENDER_BUSY`) no longer stamps a behind picture `data-render-state="refused"`; it reads `stale` until it catches up.
|
|
17
|
+
|
|
18
|
+
## 0.11.8
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#6137](https://github.com/snowcone-app/snowcone-monorepo/pull/6137) [`4d9adc4`](https://github.com/snowcone-app/snowcone-monorepo/commit/4d9adc4f31691bd0f0127a1ff736eef876fe8a34) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Realtime: `RealtimeRenderError.retryable` marks errors where nothing is broken and the preview catches up on its own. That covers the box's `E_RT_RENDER_BUSY` and the SDK's new `E_RT_PREVIEW_SLOW`, which is set when a frame lands more than 8 s after its edit and carries the seconds behind and the box's render time. HeroProductImage shows these as an amber "behind" notice (`role="status"`, `data-render-error-retryable`) instead of a red "Render blocked".
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [[`4d9adc4`](https://github.com/snowcone-app/snowcone-monorepo/commit/4d9adc4f31691bd0f0127a1ff736eef876fe8a34)]:
|
|
25
|
+
- @snowcone-app/sdk@0.31.14
|
|
26
|
+
|
|
3
27
|
## 0.11.7
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -335,6 +335,7 @@ __export(src_exports, {
|
|
|
335
335
|
VISIBILITY_THRESHOLDS: () => VISIBILITY_THRESHOLDS,
|
|
336
336
|
ZoomOverlay: () => ZoomOverlay,
|
|
337
337
|
badgeVariants: () => badgeVariants,
|
|
338
|
+
blockingSessionError: () => blockingSessionError,
|
|
338
339
|
brandAssets: () => brandAssets,
|
|
339
340
|
buttonVariants: () => buttonVariants,
|
|
340
341
|
canvasExportService: () => canvasExportService,
|
|
@@ -361,6 +362,7 @@ __export(src_exports, {
|
|
|
361
362
|
listProducts: () => import_sdk13.listProducts,
|
|
362
363
|
normalizeHex: () => normalizeHex,
|
|
363
364
|
observe: () => observe,
|
|
365
|
+
pictureRenderState: () => pictureRenderState,
|
|
364
366
|
runConfigChecks: () => runConfigChecks,
|
|
365
367
|
scrollInputAboveKeyboard: () => scrollInputAboveKeyboard,
|
|
366
368
|
searchClient: () => searchClient,
|
|
@@ -6108,6 +6110,12 @@ async function compositeCroppedFrame(args) {
|
|
|
6108
6110
|
return blob;
|
|
6109
6111
|
}
|
|
6110
6112
|
|
|
6113
|
+
// src/patterns/croppedDeliveryLimit.ts
|
|
6114
|
+
var CROPPED_DELIVERY_MAX_MOCKUPS = 5;
|
|
6115
|
+
function croppedDeliveryAllowed(mockupCount) {
|
|
6116
|
+
return mockupCount <= CROPPED_DELIVERY_MAX_MOCKUPS;
|
|
6117
|
+
}
|
|
6118
|
+
|
|
6111
6119
|
// src/patterns/RealtimeProvider.tsx
|
|
6112
6120
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
6113
6121
|
var DEFAULT_ARTBOARD_SIZE = 2e3;
|
|
@@ -6496,6 +6504,10 @@ function RealtimeProvider({
|
|
|
6496
6504
|
const base = lastConfigBaseRef.current;
|
|
6497
6505
|
if (!base) return;
|
|
6498
6506
|
const ids = base.mockupIds ?? [];
|
|
6507
|
+
if (!croppedDeliveryAllowed(ids.length)) {
|
|
6508
|
+
console.log(`[RTP] Cropped delivery OFF: ${ids.length} mockups > ${CROPPED_DELIVERY_MAX_MOCKUPS} (#6369 stopgap, full-frame frames)`);
|
|
6509
|
+
return;
|
|
6510
|
+
}
|
|
6499
6511
|
const seeded = new Set(backgroundsRef.current.keys());
|
|
6500
6512
|
if (allBackgroundsSeeded(ids, seeded)) {
|
|
6501
6513
|
console.log(`[RTP] Cropped delivery ON \u2014 all ${ids.length} mockup background(s) seeded`);
|
|
@@ -6555,6 +6567,7 @@ function RealtimeProvider({
|
|
|
6555
6567
|
base.mockupIds = shape.mockupIds;
|
|
6556
6568
|
base.width = shape.width;
|
|
6557
6569
|
requestedMockupIdsRef.current = [...shape.mockupIds];
|
|
6570
|
+
if (croppedActiveRef.current && !croppedDeliveryAllowed(shape.mockupIds.length)) croppedActiveRef.current = false;
|
|
6558
6571
|
sendConfigRaw({
|
|
6559
6572
|
...base,
|
|
6560
6573
|
placementSettings: { ...placementSettingsOverridesRef.current },
|
|
@@ -6962,6 +6975,7 @@ function RealtimeProvider({
|
|
|
6962
6975
|
}
|
|
6963
6976
|
lastConfigBaseRef.current = configPayload;
|
|
6964
6977
|
requestedMockupIdsRef.current = [...shape.mockupIds];
|
|
6978
|
+
if (croppedActiveRef.current && !croppedDeliveryAllowed(shape.mockupIds.length)) croppedActiveRef.current = false;
|
|
6965
6979
|
sendConfigRaw(
|
|
6966
6980
|
croppedActiveRef.current ? { ...configPayload, overlayCrop: "auto" } : configPayload
|
|
6967
6981
|
);
|
|
@@ -10938,6 +10952,13 @@ function heroSize(stripView, cropWidth, width) {
|
|
|
10938
10952
|
return { width };
|
|
10939
10953
|
}
|
|
10940
10954
|
var EMPTY_IMAGES = [];
|
|
10955
|
+
function blockingSessionError(error) {
|
|
10956
|
+
return error && !error.retryable ? error.code : null;
|
|
10957
|
+
}
|
|
10958
|
+
function pictureRenderState(s) {
|
|
10959
|
+
if (s.refusal || s.behind && s.sessionError) return "refused";
|
|
10960
|
+
return s.behind ? "stale" : "current";
|
|
10961
|
+
}
|
|
10941
10962
|
var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
10942
10963
|
productId,
|
|
10943
10964
|
mockupId,
|
|
@@ -11209,7 +11230,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11209
11230
|
const frameFailedRef = (0, import_react46.useRef)(realtimeContext?.frameFailed);
|
|
11210
11231
|
frameFailedRef.current = realtimeContext?.frameFailed;
|
|
11211
11232
|
const sessionErrorCodeRef = (0, import_react46.useRef)(null);
|
|
11212
|
-
sessionErrorCodeRef.current = realtimeContext?.renderError
|
|
11233
|
+
sessionErrorCodeRef.current = blockingSessionError(realtimeContext?.renderError);
|
|
11213
11234
|
const getCanvasVersion = realtimeContext?.getCanvasVersion;
|
|
11214
11235
|
const getSessionShape = realtimeContext?.getSessionShape;
|
|
11215
11236
|
const applyRenderStamp = (0, import_react46.useCallback)(() => {
|
|
@@ -11237,7 +11258,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11237
11258
|
node.dataset.arrivedVersion = String(arrivedVersionRef.current);
|
|
11238
11259
|
if (frameErrorRef.current) node.dataset.frameError = frameErrorRef.current;
|
|
11239
11260
|
else delete node.dataset.frameError;
|
|
11240
|
-
node.dataset.renderState = refusalCodeRef.current
|
|
11261
|
+
node.dataset.renderState = pictureRenderState({ refusal: refusalCodeRef.current, sessionError: sessionErrorCodeRef.current, behind });
|
|
11241
11262
|
const img = node.querySelector("img");
|
|
11242
11263
|
if (img?.naturalWidth) node.dataset.renderWidth = String(img.naturalWidth);
|
|
11243
11264
|
const shape = getSessionShape?.();
|
|
@@ -11671,10 +11692,11 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11671
11692
|
realtimeContext?.renderError && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
11672
11693
|
"div",
|
|
11673
11694
|
{
|
|
11674
|
-
role: "alert",
|
|
11695
|
+
role: realtimeContext.renderError.retryable ? "status" : "alert",
|
|
11675
11696
|
"data-render-error": realtimeContext.renderError.code,
|
|
11676
|
-
|
|
11677
|
-
|
|
11697
|
+
"data-render-error-retryable": realtimeContext.renderError.retryable ? "true" : void 0,
|
|
11698
|
+
className: `absolute inset-x-0 bottom-0 z-20 text-xs font-medium px-3 py-2 pointer-events-none ${realtimeContext.renderError.retryable ? "bg-amber-500/90 text-black" : "bg-red-600/90 text-white"}`,
|
|
11699
|
+
children: realtimeContext.renderError.retryable ? realtimeContext.renderError.message : `Render blocked: ${realtimeContext.renderError.code} \u2014 ${realtimeContext.renderError.message}`
|
|
11678
11700
|
}
|
|
11679
11701
|
),
|
|
11680
11702
|
prevUrl && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
@@ -17287,6 +17309,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17287
17309
|
VISIBILITY_THRESHOLDS,
|
|
17288
17310
|
ZoomOverlay,
|
|
17289
17311
|
badgeVariants,
|
|
17312
|
+
blockingSessionError,
|
|
17290
17313
|
brandAssets,
|
|
17291
17314
|
buttonVariants,
|
|
17292
17315
|
canvasExportService,
|
|
@@ -17313,6 +17336,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17313
17336
|
listProducts,
|
|
17314
17337
|
normalizeHex,
|
|
17315
17338
|
observe,
|
|
17339
|
+
pictureRenderState,
|
|
17316
17340
|
runConfigChecks,
|
|
17317
17341
|
scrollInputAboveKeyboard,
|
|
17318
17342
|
searchClient,
|