@snowcone-app/ui 0.11.16 → 0.11.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowcone-app/ui",
3
- "version": "0.11.16",
3
+ "version": "0.11.17",
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.33.1"
106
+ "@snowcone-app/sdk": "0.33.2"
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): off until the render-side fix.
1001
+ // #6369 (croppedDeliveryLimit.ts): more than 5 mockups stay on full frames.
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,10 +48,6 @@ 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
-
55
51
  vi.mock("@snowcone-app/sdk/react", () => ({
56
52
  useRealtimeMockup: (opts: unknown) => {
57
53
  h.opts = opts as typeof h.opts;
@@ -1,6 +1,6 @@
1
1
  /**
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.
2
+ * #6369 stopgap (croppedDeliveryLimit.ts): a realtime session with more than 5 mockups stays on full-frame delivery;
3
+ * 5 or fewer turn on cropped delivery once every background is seeded, as before.
4
4
  */
5
5
  import { describe, expect, it, beforeEach, vi } from "vitest";
6
6
  import React from "react";
@@ -137,23 +137,36 @@ async function seedAll(n: number) {
137
137
  void capturedCtx;
138
138
  }
139
139
 
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);
140
+ // #6369: more than 5 mockups -> full-frame delivery (why: the issue).
141
+ describe("cropped delivery limit (#6369 stopgap)", () => {
142
+ it("the limit is the measured boundary: 5, the same as the SDK's useMockupStage", async () => {
143
+ expect(CROPPED_DELIVERY_MAX_MOCKUPS).toBe(5);
143
144
  const sdk = await vi.importActual<typeof import("@snowcone-app/sdk")>("@snowcone-app/sdk");
144
145
  expect(sdk.CROPPED_DELIVERY_MAX_MOCKUPS).toBe(CROPPED_DELIVERY_MAX_MOCKUPS);
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
- }
146
+ expect(croppedDeliveryAllowed(5)).toBe(true);
147
+ expect(croppedDeliveryAllowed(6)).toBe(false);
149
148
  });
150
149
 
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);
150
+ it("2 mockups (a phone session): untouched, cropped delivery turns on", async () => {
151
+ await seedAll(2);
152
+ await waitFor(() => expect(sentConfigs().some((c) => c.overlayCrop === "auto")).toBe(true));
153
+ });
154
+
155
+ it("5 mockups: cropped delivery turns on once every mockup is seeded", async () => {
156
+ await seedAll(5);
157
+ await waitFor(() => expect(sentConfigs().some((c) => c.overlayCrop === "auto")).toBe(true));
158
+ expect(sentConfigs()[0].mockupIds).toHaveLength(5);
159
+ });
160
+
161
+ it("6 mockups: full-frame delivery, overlayCrop is never sent", async () => {
162
+ await seedAll(6);
154
163
  expect(sentConfigs().length).toBeGreaterThan(0);
155
- expect(sentConfigs()[0]).toMatchObject({ width: 1400 });
156
- expect(sentConfigs()[0].mockupIds).toHaveLength(n);
164
+ expect(sentConfigs()[0].mockupIds).toHaveLength(6);
165
+ expect(sentConfigs().some((c) => c.overlayCrop)).toBe(false);
166
+ });
167
+
168
+ it("33 mockups (a desktop gallery): full-frame delivery", async () => {
169
+ await seedAll(33);
157
170
  expect(sentConfigs().some((c) => c.overlayCrop)).toBe(false);
158
171
  });
159
172
  });
@@ -24,10 +24,6 @@ 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
-
31
27
  vi.mock("@snowcone-app/sdk/react", () => ({
32
28
  useRealtimeMockup: () => ({
33
29
  isConnected: true, isConfigured: true, renderError: null, mockupResults: h.state.results,
@@ -19,10 +19,6 @@ 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
-
26
22
  vi.mock("@snowcone-app/sdk/react", () => ({
27
23
  useRealtimeMockup: () => ({
28
24
  isConnected: true, isConfigured: true, renderError: null, mockupResults: h.state.results,
@@ -1,17 +1,16 @@
1
1
  /**
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.
2
+ * Cropped-delivery size limit (#6369), removable: a realtime session that holds MORE than this many mockups asks for
3
+ * FULL-FRAME delivery and never turns on cropped delivery (`overlayCrop: "auto"`); 5 or fewer use cropped delivery.
5
4
  *
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).
5
+ * Why: issue #6369 (details and measurements live there, not here: this package ships its source).
8
6
  *
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.
7
+ * The SDK's useMockupStage holds the same rule (`@snowcone-app/sdk` CROPPED_DELIVERY_MAX_MOCKUPS; a test pins the two
8
+ * equal). Remove (delete this module and its three call sites in RealtimeProvider, and the SDK's twin) once the editor
9
+ * canary passes with cropped delivery at 33 mockups.
11
10
  */
12
- export const CROPPED_DELIVERY_MAX_MOCKUPS = 0;
11
+ export const CROPPED_DELIVERY_MAX_MOCKUPS = 5;
13
12
 
14
- /** Whether a session holding `mockupCount` mockups may use cropped delivery (#6369 stopgap: none may). */
13
+ /** Whether a session holding `mockupCount` mockups may use cropped delivery (#6369). */
15
14
  export function croppedDeliveryAllowed(mockupCount: number): boolean {
16
15
  return mockupCount <= CROPPED_DELIVERY_MAX_MOCKUPS;
17
16
  }