@snowcone-app/ui 0.11.14 → 0.11.15
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 +9 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/patterns/RealtimeProvider.tsx +1 -1
- package/src/patterns/__tests__/RealtimeProvider.cropDelivery.test.tsx +4 -0
- package/src/patterns/__tests__/RealtimeProvider.croppedLimit.test.tsx +14 -28
- package/src/patterns/__tests__/RealtimeProvider.shapeCrop.test.tsx +4 -0
- package/src/patterns/__tests__/RealtimeProvider.views.test.tsx +4 -0
- package/src/patterns/croppedDeliveryLimit.ts +9 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snowcone-app/ui",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.15",
|
|
4
4
|
"description": "React components for merchandise visualization and customization",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"react-instantsearch": "^7.15.5",
|
|
104
104
|
"react-zoom-pan-pinch": "^3.6.4",
|
|
105
105
|
"tailwind-merge": "^3.0.0",
|
|
106
|
-
"@snowcone-app/sdk": "0.
|
|
106
|
+
"@snowcone-app/sdk": "0.33.0"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@chromatic-com/storybook": "^4.1.2",
|
|
@@ -998,7 +998,7 @@ export function RealtimeProvider({
|
|
|
998
998
|
const base = lastConfigBaseRef.current;
|
|
999
999
|
if (!base) return;
|
|
1000
1000
|
const ids = (base.mockupIds as string[] | undefined) ?? [];
|
|
1001
|
-
// #6369 stopgap (croppedDeliveryLimit.ts):
|
|
1001
|
+
// #6369 stopgap (croppedDeliveryLimit.ts): off until the render-side fix.
|
|
1002
1002
|
if (!croppedDeliveryAllowed(ids.length)) {
|
|
1003
1003
|
console.log(`[RTP] Cropped delivery OFF: ${ids.length} mockups > ${CROPPED_DELIVERY_MAX_MOCKUPS} (#6369 stopgap, full-frame frames)`);
|
|
1004
1004
|
return;
|
|
@@ -48,6 +48,10 @@ const h = vi.hoisted(() => {
|
|
|
48
48
|
};
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
+
// These tests pin the cropped path itself. The #6369 stopgap turns cropped delivery off (croppedDeliveryLimit.ts, tested
|
|
52
|
+
// in RealtimeProvider.croppedLimit.test.tsx); lift it here so the path stays covered for the day the stopgap comes out.
|
|
53
|
+
vi.mock("../croppedDeliveryLimit", () => ({ CROPPED_DELIVERY_MAX_MOCKUPS: Infinity, croppedDeliveryAllowed: () => true }));
|
|
54
|
+
|
|
51
55
|
vi.mock("@snowcone-app/sdk/react", () => ({
|
|
52
56
|
useRealtimeMockup: (opts: unknown) => {
|
|
53
57
|
h.opts = opts as typeof h.opts;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* #6369 stopgap (croppedDeliveryLimit.ts):
|
|
3
|
-
*
|
|
2
|
+
* #6369 stopgap (croppedDeliveryLimit.ts): cropped delivery is OFF for every session until the render-side fix has rolled
|
|
3
|
+
* (why: issue #6369; this package ships its source). Every session stays on full-frame delivery.
|
|
4
4
|
*/
|
|
5
5
|
import { describe, expect, it, beforeEach, vi } from "vitest";
|
|
6
6
|
import React from "react";
|
|
@@ -137,37 +137,23 @@ async function seedAll(n: number) {
|
|
|
137
137
|
void capturedCtx;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
it("the limit is the measured boundary: 5, the same as the SDK's useMockupStage", async () => {
|
|
144
|
-
expect(CROPPED_DELIVERY_MAX_MOCKUPS).toBe(5);
|
|
140
|
+
describe("cropped delivery is off (#6369 stopgap)", () => {
|
|
141
|
+
it("no session may use it, in both clients (the limit is 0, the same as the SDK's useMockupStage)", async () => {
|
|
142
|
+
expect(CROPPED_DELIVERY_MAX_MOCKUPS).toBe(0);
|
|
145
143
|
const sdk = await vi.importActual<typeof import("@snowcone-app/sdk")>("@snowcone-app/sdk");
|
|
146
144
|
expect(sdk.CROPPED_DELIVERY_MAX_MOCKUPS).toBe(CROPPED_DELIVERY_MAX_MOCKUPS);
|
|
147
|
-
|
|
148
|
-
|
|
145
|
+
for (const n of [1, 2, 3, 5, 6, 33]) {
|
|
146
|
+
expect(croppedDeliveryAllowed(n)).toBe(false);
|
|
147
|
+
expect(sdk.croppedDeliveryAllowed(n)).toBe(false);
|
|
148
|
+
}
|
|
149
149
|
});
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
await
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
it("5 mockups: cropped delivery turns on once every mockup is seeded", async () => {
|
|
157
|
-
await seedAll(5);
|
|
158
|
-
await waitFor(() => expect(sentConfigs().some((c) => c.overlayCrop === "auto")).toBe(true));
|
|
159
|
-
expect(sentConfigs()[0].mockupIds).toHaveLength(5);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
it("6 mockups: full-frame delivery, overlayCrop is never sent", async () => {
|
|
163
|
-
await seedAll(6);
|
|
151
|
+
// 3 at the default width 1400 is the lead's case: cropped before this change.
|
|
152
|
+
it.each([1, 2, 3, 5, 6, 33])("%i mockup(s) at the default width: full-frame delivery, overlayCrop is never sent", async (n) => {
|
|
153
|
+
await seedAll(n);
|
|
164
154
|
expect(sentConfigs().length).toBeGreaterThan(0);
|
|
165
|
-
expect(sentConfigs()[0]
|
|
166
|
-
expect(sentConfigs().
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it("33 mockups (a desktop gallery): full-frame delivery", async () => {
|
|
170
|
-
await seedAll(33);
|
|
155
|
+
expect(sentConfigs()[0]).toMatchObject({ width: 1400 });
|
|
156
|
+
expect(sentConfigs()[0].mockupIds).toHaveLength(n);
|
|
171
157
|
expect(sentConfigs().some((c) => c.overlayCrop)).toBe(false);
|
|
172
158
|
});
|
|
173
159
|
});
|
|
@@ -24,6 +24,10 @@ const h = vi.hoisted(() => ({
|
|
|
24
24
|
},
|
|
25
25
|
}));
|
|
26
26
|
|
|
27
|
+
// These tests pin the cropped path itself. The #6369 stopgap turns cropped delivery off (croppedDeliveryLimit.ts, tested
|
|
28
|
+
// in RealtimeProvider.croppedLimit.test.tsx); lift it here so the path stays covered for the day the stopgap comes out.
|
|
29
|
+
vi.mock("../croppedDeliveryLimit", () => ({ CROPPED_DELIVERY_MAX_MOCKUPS: Infinity, croppedDeliveryAllowed: () => true }));
|
|
30
|
+
|
|
27
31
|
vi.mock("@snowcone-app/sdk/react", () => ({
|
|
28
32
|
useRealtimeMockup: () => ({
|
|
29
33
|
isConnected: true, isConfigured: true, renderError: null, mockupResults: h.state.results,
|
|
@@ -19,6 +19,10 @@ const h = vi.hoisted(() => ({
|
|
|
19
19
|
},
|
|
20
20
|
}));
|
|
21
21
|
|
|
22
|
+
// These tests pin the cropped path itself. The #6369 stopgap turns cropped delivery off (croppedDeliveryLimit.ts, tested
|
|
23
|
+
// in RealtimeProvider.croppedLimit.test.tsx); lift it here so the path stays covered for the day the stopgap comes out.
|
|
24
|
+
vi.mock("../croppedDeliveryLimit", () => ({ CROPPED_DELIVERY_MAX_MOCKUPS: Infinity, croppedDeliveryAllowed: () => true }));
|
|
25
|
+
|
|
22
26
|
vi.mock("@snowcone-app/sdk/react", () => ({
|
|
23
27
|
useRealtimeMockup: () => ({
|
|
24
28
|
isConnected: true, isConfigured: true, renderError: null, mockupResults: h.state.results,
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* STOPGAP for #6369 (2026-11-25), removable:
|
|
3
|
-
*
|
|
2
|
+
* STOPGAP for #6369 (2026-11-25), removable: cropped delivery (`overlayCrop: "auto"`) is OFF for every session; all frames
|
|
3
|
+
* are full frames. `croppedDeliveryAllowed` is the one switch for `RealtimeProvider`; the SDK's `useMockupStage`
|
|
4
|
+
* holds the same rule (`@snowcone-app/sdk`) and a test pins the two equal.
|
|
4
5
|
*
|
|
5
|
-
* Why:
|
|
6
|
-
*
|
|
7
|
-
* stalled at 10, 20, 31 and 33 (the box reported E_RT_PREVIEW_SLOW, renders 4-12 s). Full-frame delivery reached the
|
|
8
|
-
* last version at every size up to 33. Desktop galleries hold 20-33 mockups, so desktop live previews stopped updating
|
|
9
|
-
* after the second version (67 of 80 editor-canary runs from 2026-11-23 20:00Z).
|
|
6
|
+
* Why: some cropped frames cannot be rendered safely yet, at ordinary session widths, so neither a picture count nor a
|
|
7
|
+
* width floor covers it (details, measurements and the earlier limit of 5: issue #6369, not here, this ships to npm).
|
|
10
8
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* and the canary passes with cropped delivery at 33 mockups.
|
|
9
|
+
* REVERT with the render-side fix: set the limit back (or delete this module and its call sites) once it is rolled on
|
|
10
|
+
* every box and the editor canary passes with cropped delivery at 33 mockups.
|
|
14
11
|
*/
|
|
15
|
-
export const CROPPED_DELIVERY_MAX_MOCKUPS =
|
|
12
|
+
export const CROPPED_DELIVERY_MAX_MOCKUPS = 0;
|
|
16
13
|
|
|
17
|
-
/** Whether a session holding `mockupCount` mockups may use cropped delivery (#6369 stopgap). */
|
|
14
|
+
/** Whether a session holding `mockupCount` mockups may use cropped delivery (#6369 stopgap: none may). */
|
|
18
15
|
export function croppedDeliveryAllowed(mockupCount: number): boolean {
|
|
19
16
|
return mockupCount <= CROPPED_DELIVERY_MAX_MOCKUPS;
|
|
20
17
|
}
|