@snowcone-app/ui 0.11.6 → 0.11.9
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 +22 -0
- package/dist/index.cjs +17 -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 +15 -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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.11.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#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.
|
|
8
|
+
|
|
9
|
+
## 0.11.8
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#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".
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`4d9adc4`](https://github.com/snowcone-app/snowcone-monorepo/commit/4d9adc4f31691bd0f0127a1ff736eef876fe8a34)]:
|
|
16
|
+
- @snowcone-app/sdk@0.31.14
|
|
17
|
+
|
|
18
|
+
## 0.11.7
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`1b332fd`](https://github.com/snowcone-app/snowcone-monorepo/commit/1b332fd5b3d58e4e871231bf8c27d8efe2b8f50f)]:
|
|
23
|
+
- @snowcone-app/sdk@0.31.13
|
|
24
|
+
|
|
3
25
|
## 0.11.6
|
|
4
26
|
|
|
5
27
|
### 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,
|
|
@@ -10938,6 +10940,13 @@ function heroSize(stripView, cropWidth, width) {
|
|
|
10938
10940
|
return { width };
|
|
10939
10941
|
}
|
|
10940
10942
|
var EMPTY_IMAGES = [];
|
|
10943
|
+
function blockingSessionError(error) {
|
|
10944
|
+
return error && !error.retryable ? error.code : null;
|
|
10945
|
+
}
|
|
10946
|
+
function pictureRenderState(s) {
|
|
10947
|
+
if (s.refusal || s.behind && s.sessionError) return "refused";
|
|
10948
|
+
return s.behind ? "stale" : "current";
|
|
10949
|
+
}
|
|
10941
10950
|
var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
10942
10951
|
productId,
|
|
10943
10952
|
mockupId,
|
|
@@ -11209,7 +11218,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11209
11218
|
const frameFailedRef = (0, import_react46.useRef)(realtimeContext?.frameFailed);
|
|
11210
11219
|
frameFailedRef.current = realtimeContext?.frameFailed;
|
|
11211
11220
|
const sessionErrorCodeRef = (0, import_react46.useRef)(null);
|
|
11212
|
-
sessionErrorCodeRef.current = realtimeContext?.renderError
|
|
11221
|
+
sessionErrorCodeRef.current = blockingSessionError(realtimeContext?.renderError);
|
|
11213
11222
|
const getCanvasVersion = realtimeContext?.getCanvasVersion;
|
|
11214
11223
|
const getSessionShape = realtimeContext?.getSessionShape;
|
|
11215
11224
|
const applyRenderStamp = (0, import_react46.useCallback)(() => {
|
|
@@ -11237,7 +11246,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11237
11246
|
node.dataset.arrivedVersion = String(arrivedVersionRef.current);
|
|
11238
11247
|
if (frameErrorRef.current) node.dataset.frameError = frameErrorRef.current;
|
|
11239
11248
|
else delete node.dataset.frameError;
|
|
11240
|
-
node.dataset.renderState = refusalCodeRef.current
|
|
11249
|
+
node.dataset.renderState = pictureRenderState({ refusal: refusalCodeRef.current, sessionError: sessionErrorCodeRef.current, behind });
|
|
11241
11250
|
const img = node.querySelector("img");
|
|
11242
11251
|
if (img?.naturalWidth) node.dataset.renderWidth = String(img.naturalWidth);
|
|
11243
11252
|
const shape = getSessionShape?.();
|
|
@@ -11671,10 +11680,11 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
|
|
|
11671
11680
|
realtimeContext?.renderError && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
11672
11681
|
"div",
|
|
11673
11682
|
{
|
|
11674
|
-
role: "alert",
|
|
11683
|
+
role: realtimeContext.renderError.retryable ? "status" : "alert",
|
|
11675
11684
|
"data-render-error": realtimeContext.renderError.code,
|
|
11676
|
-
|
|
11677
|
-
|
|
11685
|
+
"data-render-error-retryable": realtimeContext.renderError.retryable ? "true" : void 0,
|
|
11686
|
+
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"}`,
|
|
11687
|
+
children: realtimeContext.renderError.retryable ? realtimeContext.renderError.message : `Render blocked: ${realtimeContext.renderError.code} \u2014 ${realtimeContext.renderError.message}`
|
|
11678
11688
|
}
|
|
11679
11689
|
),
|
|
11680
11690
|
prevUrl && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
@@ -17287,6 +17297,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17287
17297
|
VISIBILITY_THRESHOLDS,
|
|
17288
17298
|
ZoomOverlay,
|
|
17289
17299
|
badgeVariants,
|
|
17300
|
+
blockingSessionError,
|
|
17290
17301
|
brandAssets,
|
|
17291
17302
|
buttonVariants,
|
|
17292
17303
|
canvasExportService,
|
|
@@ -17313,6 +17324,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
|
|
|
17313
17324
|
listProducts,
|
|
17314
17325
|
normalizeHex,
|
|
17315
17326
|
observe,
|
|
17327
|
+
pictureRenderState,
|
|
17316
17328
|
runConfigChecks,
|
|
17317
17329
|
scrollInputAboveKeyboard,
|
|
17318
17330
|
searchClient,
|