@snowcone-app/sdk 0.20.1 → 0.20.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 +12 -0
- package/dist/{chunk-IL3FXE2X.js → chunk-553YYMDY.js} +1 -0
- package/dist/{chunk-MKLLTNKJ.js → chunk-SZZQ2CBF.js} +68 -2
- package/dist/index.cjs +69 -2
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +2 -2
- package/dist/react.cjs +393 -2
- package/dist/react.d.cts +140 -2
- package/dist/react.d.ts +140 -2
- package/dist/react.js +331 -1
- package/dist/server.cjs +1 -0
- package/dist/server.js +1 -1
- package/dist/{websocket-DXRDbLDN.d.cts → websocket-CScS7UR-.d.cts} +62 -0
- package/dist/{websocket-DXRDbLDN.d.ts → websocket-CScS7UR-.d.ts} +62 -0
- package/package.json +2 -2
|
@@ -230,6 +230,43 @@ interface WebSocketConfig {
|
|
|
230
230
|
* consistent with static renders that carry `bg=`.
|
|
231
231
|
*/
|
|
232
232
|
bg?: string;
|
|
233
|
+
/**
|
|
234
|
+
* Spread-mode crop map (ADR-0060): when the client canvas runs combined
|
|
235
|
+
* spread/group artboards, each canvas_state render of that artboard is
|
|
236
|
+
* cropped server-side into per-placement images by these bounds. Keyed by
|
|
237
|
+
* artboard name; piece rects are in artboard units and `placement` must be
|
|
238
|
+
* the product's placement label.
|
|
239
|
+
*/
|
|
240
|
+
spreadCrops?: Record<string, {
|
|
241
|
+
width: number;
|
|
242
|
+
height: number;
|
|
243
|
+
pieces: Array<{
|
|
244
|
+
placement: string;
|
|
245
|
+
x: number;
|
|
246
|
+
y: number;
|
|
247
|
+
width: number;
|
|
248
|
+
height: number;
|
|
249
|
+
}>;
|
|
250
|
+
}>;
|
|
251
|
+
/**
|
|
252
|
+
* Cropped-overlay delivery: {x,y,w,h} fractions of the OUTPUT frame. Each
|
|
253
|
+
* rendered mockup is cropped server-side to this rect just before AVIF
|
|
254
|
+
* encode, so every realtime frame carries only that region's bytes — the
|
|
255
|
+
* client positions it over a static full-frame render using the same
|
|
256
|
+
* fractions. Full-frame ({x:0,y:0,w:1,h:1}) is a no-op.
|
|
257
|
+
*/
|
|
258
|
+
overlayCrop?: {
|
|
259
|
+
x: number;
|
|
260
|
+
y: number;
|
|
261
|
+
w: number;
|
|
262
|
+
h: number;
|
|
263
|
+
} | 'auto';
|
|
264
|
+
/**
|
|
265
|
+
* Operator-only: when this matches the render server's debug secret, every
|
|
266
|
+
* MockupResult carries `serverTiming` — the render's per-stage breakdown.
|
|
267
|
+
* Wrong values fail renders loudly (never pass user input here).
|
|
268
|
+
*/
|
|
269
|
+
debugKey?: string;
|
|
233
270
|
placementSettings?: Record<string, PlacementSettings>;
|
|
234
271
|
}
|
|
235
272
|
interface MockupResult {
|
|
@@ -251,6 +288,17 @@ interface MockupResult {
|
|
|
251
288
|
costUsd?: number;
|
|
252
289
|
/** Whether the underlying render was served from cache */
|
|
253
290
|
renderCache?: 'hit' | 'miss';
|
|
291
|
+
/** The rect this payload was cropped with (fractions of the full frame) —
|
|
292
|
+
* present on overlayCrop renders; position the overlay with these numbers. */
|
|
293
|
+
cropRect?: {
|
|
294
|
+
x: number;
|
|
295
|
+
y: number;
|
|
296
|
+
w: number;
|
|
297
|
+
h: number;
|
|
298
|
+
};
|
|
299
|
+
/** Raw Server-Timing header of the render — per-stage breakdown, present
|
|
300
|
+
* only when the session's debugKey matched the server's debug secret. */
|
|
301
|
+
serverTiming?: string;
|
|
254
302
|
/** Server-side canvas render timing breakdown (present when canvas_state was used) */
|
|
255
303
|
canvasRenderTiming?: any;
|
|
256
304
|
}
|
|
@@ -279,6 +327,15 @@ interface WebSocketMessage {
|
|
|
279
327
|
costUsd?: number;
|
|
280
328
|
/** Whether the underlying render was served from cache */
|
|
281
329
|
renderCache?: 'hit' | 'miss';
|
|
330
|
+
/** Rect the payload was cropped with (overlayCrop renders) */
|
|
331
|
+
cropRect?: {
|
|
332
|
+
x: number;
|
|
333
|
+
y: number;
|
|
334
|
+
w: number;
|
|
335
|
+
h: number;
|
|
336
|
+
};
|
|
337
|
+
/** Raw Server-Timing breakdown (only when the session's debugKey matched) */
|
|
338
|
+
serverTiming?: string;
|
|
282
339
|
/** Server-side canvas render timing (only present when canvas_state was used) */
|
|
283
340
|
canvasRenderTiming?: {
|
|
284
341
|
poolAcquireMs: number;
|
|
@@ -369,6 +426,8 @@ declare class RealtimeMockupService {
|
|
|
369
426
|
private latestAcceptedVersionByPlacement;
|
|
370
427
|
private sendVersionInBlob;
|
|
371
428
|
private tokenProvider?;
|
|
429
|
+
private pendingFrames;
|
|
430
|
+
private liveObjectUrls;
|
|
372
431
|
private renewTimer;
|
|
373
432
|
private isConnecting;
|
|
374
433
|
private connectAttempt;
|
|
@@ -388,6 +447,9 @@ declare class RealtimeMockupService {
|
|
|
388
447
|
private renew;
|
|
389
448
|
private handleMessage;
|
|
390
449
|
disconnect(): void;
|
|
450
|
+
private handleBinaryFrame;
|
|
451
|
+
/** Swap a ws-delivered frame in for the imageUrl on a render result. */
|
|
452
|
+
private applyBinaryFrame;
|
|
391
453
|
sendConfig(config: WebSocketConfig): boolean;
|
|
392
454
|
/**
|
|
393
455
|
* Update only the mockupIds without changing other config.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snowcone-app/sdk",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.3",
|
|
4
4
|
"description": "Snowcone SDK for product mockups and print-on-demand",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"merch",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"tsup": "^8.1.0",
|
|
86
86
|
"typescript": "^5.5.4",
|
|
87
87
|
"vitest": "^2.0.5",
|
|
88
|
-
"@snowcone-app/mockup-url": "0.3.
|
|
88
|
+
"@snowcone-app/mockup-url": "0.3.4"
|
|
89
89
|
},
|
|
90
90
|
"engines": {
|
|
91
91
|
"node": ">=18"
|