@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.20.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1630](https://github.com/snowcone-app/snowcone-monorepo/pull/1630) [`e57a5bc`](https://github.com/snowcone-app/snowcone-monorepo/commit/e57a5bcb3b62ac612e43c47ab2709992ef6db385) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Realtime: keep a ws-delivered `blob:` frame when the `all_mockups_rendered` summary repeats the fallback `imageUrl`. The summary merge matched on URL equality, which never matched a frame-swapped entry, so the client re-fetched the fallback URL (on fleet nodes an unreachable internal address).
|
|
8
|
+
|
|
9
|
+
## 0.20.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1150](https://github.com/snowcone-app/snowcone-monorepo/pull/1150) [`06997b2`](https://github.com/snowcone-app/snowcone-monorepo/commit/06997b211736d906d16eb9edeb186404f5acb19c) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Spread-mode printables now use JSON canvas-state realtime mode: `WebSocketConfig.spreadCrops` carries the spread/group artboard geometry (piece rects keyed by placement label), and `RealtimeProvider.setSpreadCrops` sends it on the realtime config so the server slices each rendered spread artboard into per-placement images — no client pixel upload.
|
|
14
|
+
|
|
3
15
|
## 0.20.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -262,6 +262,7 @@ function canonicalForSig(url) {
|
|
|
262
262
|
const rawValue = eq === -1 ? "" : segment.slice(eq + 1);
|
|
263
263
|
const key = decodeURIComponent(rawKey);
|
|
264
264
|
if (key === "signature") continue;
|
|
265
|
+
if (key === "debug") continue;
|
|
265
266
|
pairs.push({ key, raw: rawValue });
|
|
266
267
|
}
|
|
267
268
|
}
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
var REALTIME_WS_URL = "wss://cdn.snowcone.app/realtime";
|
|
3
3
|
|
|
4
4
|
// src/realtime/websocket.ts
|
|
5
|
+
function pruneUndefined(obj) {
|
|
6
|
+
const out = {};
|
|
7
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
8
|
+
if (v !== void 0) out[k] = v;
|
|
9
|
+
}
|
|
10
|
+
return out;
|
|
11
|
+
}
|
|
5
12
|
function randHex(len) {
|
|
6
13
|
const arr = new Uint8Array(len);
|
|
7
14
|
globalThis.crypto.getRandomValues(arr);
|
|
@@ -65,6 +72,13 @@ var RealtimeMockupService = class {
|
|
|
65
72
|
// Session-grant auth: when set, connect() fetches a short-lived token, opens
|
|
66
73
|
// the WS with `?token=`, and renews ~15s before expiry via a `renew` message.
|
|
67
74
|
tokenProvider;
|
|
75
|
+
// Binary-delivered frames waiting for their mockup_rendered metadata,
|
|
76
|
+
// keyed `${requestId ?? ''}:${mockupId}`. The server sends the binary
|
|
77
|
+
// frame before the JSON result on the same socket, so ordering guarantees
|
|
78
|
+
// the entry exists when the result arrives.
|
|
79
|
+
pendingFrames = /* @__PURE__ */ new Map();
|
|
80
|
+
// Last object URL handed out per mockup — revoked when replaced.
|
|
81
|
+
liveObjectUrls = /* @__PURE__ */ new Map();
|
|
68
82
|
renewTimer = null;
|
|
69
83
|
isConnecting = false;
|
|
70
84
|
connectAttempt = 0;
|
|
@@ -119,6 +133,7 @@ var RealtimeMockupService = class {
|
|
|
119
133
|
const url = token ? `${this.wsUrl}${this.wsUrl.includes("?") ? "&" : "?"}token=${encodeURIComponent(token)}` : this.wsUrl;
|
|
120
134
|
this.addLog(`Connecting to ${this.wsUrl}...`);
|
|
121
135
|
this.ws = new WebSocket(url);
|
|
136
|
+
this.ws.binaryType = "arraybuffer";
|
|
122
137
|
this.ws.onopen = () => {
|
|
123
138
|
console.log(`[WS] connection OPENED to ${this.wsUrl}`);
|
|
124
139
|
this.addLog("WebSocket connection opened");
|
|
@@ -126,6 +141,10 @@ var RealtimeMockupService = class {
|
|
|
126
141
|
this.isConnecting = false;
|
|
127
142
|
};
|
|
128
143
|
this.ws.onmessage = (event) => {
|
|
144
|
+
if (event.data instanceof ArrayBuffer) {
|
|
145
|
+
this.handleBinaryFrame(event.data);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
129
148
|
try {
|
|
130
149
|
const data = JSON.parse(event.data);
|
|
131
150
|
this.addLog(JSON.stringify(data, null, 2), "received");
|
|
@@ -235,6 +254,7 @@ var RealtimeMockupService = class {
|
|
|
235
254
|
this.addLog("\u{1F3A8} Mockup rendering has started...");
|
|
236
255
|
break;
|
|
237
256
|
case "mockup_rendered": {
|
|
257
|
+
this.applyBinaryFrame(data);
|
|
238
258
|
const sentAt = data.requestId ? this.requestSendTimes.get(data.requestId) : void 0;
|
|
239
259
|
const clientRoundTripMs = sentAt !== void 0 ? Date.now() - sentAt : void 0;
|
|
240
260
|
console.log(`[WS] mockup_rendered received: mockupId=${data.mockupId} hasImageUrl=${!!data.imageUrl} v=${data.requestVersion} req=${data.requestId ?? "?"} placement="${data.placement}" renderMs=${data.renderMs} blobToRenderMs=${data.blobToRenderMs} clientRoundTripMs=${clientRoundTripMs ?? "?"} at ${Date.now()}`);
|
|
@@ -262,6 +282,8 @@ var RealtimeMockupService = class {
|
|
|
262
282
|
blobToRenderMs: data.blobToRenderMs,
|
|
263
283
|
costUsd: data.costUsd,
|
|
264
284
|
renderCache: data.renderCache,
|
|
285
|
+
cropRect: data.cropRect,
|
|
286
|
+
serverTiming: data.serverTiming,
|
|
265
287
|
canvasRenderTiming: data.canvasRenderTiming
|
|
266
288
|
};
|
|
267
289
|
const existingIndex = this.mockupResults.findIndex((m) => m.mockupId === data.mockupId);
|
|
@@ -297,7 +319,18 @@ var RealtimeMockupService = class {
|
|
|
297
319
|
}
|
|
298
320
|
return true;
|
|
299
321
|
});
|
|
300
|
-
this.mockupResults = freshMockups
|
|
322
|
+
this.mockupResults = freshMockups.map((mockup) => {
|
|
323
|
+
const existing = this.mockupResults.find(
|
|
324
|
+
(m) => m.mockupId === mockup.mockupId && (mockup.requestId === void 0 || m.requestId === mockup.requestId)
|
|
325
|
+
);
|
|
326
|
+
if (!existing) return mockup;
|
|
327
|
+
const merged = { ...existing, ...pruneUndefined(mockup) };
|
|
328
|
+
if (existing.imageUrl.startsWith("blob:")) {
|
|
329
|
+
merged.imageUrl = existing.imageUrl;
|
|
330
|
+
merged.renderUrl = existing.renderUrl;
|
|
331
|
+
}
|
|
332
|
+
return merged;
|
|
333
|
+
});
|
|
301
334
|
this.lastError = null;
|
|
302
335
|
this.renderError = null;
|
|
303
336
|
this.addLog(`\u{1F389} All mockups rendered: ${freshMockups.length} fresh (${data.mockups.length - freshMockups.length} stale filtered)`);
|
|
@@ -333,6 +366,35 @@ var RealtimeMockupService = class {
|
|
|
333
366
|
this.ws = null;
|
|
334
367
|
}
|
|
335
368
|
}
|
|
369
|
+
handleBinaryFrame(buf) {
|
|
370
|
+
try {
|
|
371
|
+
const view = new DataView(buf);
|
|
372
|
+
const headerLen = view.getUint32(0);
|
|
373
|
+
const header = JSON.parse(new TextDecoder().decode(new Uint8Array(buf, 4, headerLen)));
|
|
374
|
+
if (header.type !== "mockup_frame") return;
|
|
375
|
+
const bytes = new Uint8Array(buf, 4 + headerLen);
|
|
376
|
+
const objectUrl = URL.createObjectURL(new Blob([bytes], { type: header.contentType || "image/avif" }));
|
|
377
|
+
const key = `${header.requestId ?? ""}:${header.mockupId}`;
|
|
378
|
+
const prev = this.pendingFrames.get(key);
|
|
379
|
+
if (prev) URL.revokeObjectURL(prev.objectUrl);
|
|
380
|
+
this.pendingFrames.set(key, { objectUrl, bytes: bytes.byteLength });
|
|
381
|
+
this.addLog(`\u{1F4E6} mockup_frame received over ws: ${header.mockupId} (${bytes.byteLength}B)`);
|
|
382
|
+
} catch (e) {
|
|
383
|
+
this.addLog(`\u26A0\uFE0F failed to parse binary frame: ${e}`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
/** Swap a ws-delivered frame in for the imageUrl on a render result. */
|
|
387
|
+
applyBinaryFrame(data) {
|
|
388
|
+
if (data.imageDelivery !== "ws" || !data.mockupId) return;
|
|
389
|
+
const key = `${data.requestId ?? ""}:${data.mockupId}`;
|
|
390
|
+
const frame = this.pendingFrames.get(key);
|
|
391
|
+
if (!frame) return;
|
|
392
|
+
this.pendingFrames.delete(key);
|
|
393
|
+
const prevLive = this.liveObjectUrls.get(data.mockupId);
|
|
394
|
+
if (prevLive) URL.revokeObjectURL(prevLive);
|
|
395
|
+
this.liveObjectUrls.set(data.mockupId, frame.objectUrl);
|
|
396
|
+
data.imageUrl = frame.objectUrl;
|
|
397
|
+
}
|
|
336
398
|
sendConfig(config) {
|
|
337
399
|
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
|
338
400
|
this.addLog("WebSocket not connected, caching config");
|
|
@@ -379,7 +441,11 @@ var RealtimeMockupService = class {
|
|
|
379
441
|
this.configSent = true;
|
|
380
442
|
const message = {
|
|
381
443
|
type: "config",
|
|
382
|
-
|
|
444
|
+
// binaryFrames: ask the server to push rendered image bytes down this
|
|
445
|
+
// socket (mockup_frame binary messages) instead of making us fetch the
|
|
446
|
+
// imageUrl — saves a network round trip per render. Servers that don't
|
|
447
|
+
// know the flag ignore it and we fall back to the URL.
|
|
448
|
+
config: { ...config, binaryFrames: true }
|
|
383
449
|
};
|
|
384
450
|
const messageStr = JSON.stringify(message);
|
|
385
451
|
this.addLog(`\u{1F4E4} Sending config: ${JSON.stringify(message, null, 2)}`, "sent");
|
package/dist/index.cjs
CHANGED
|
@@ -741,6 +741,7 @@ function canonicalForSig(url) {
|
|
|
741
741
|
const rawValue = eq === -1 ? "" : segment.slice(eq + 1);
|
|
742
742
|
const key = decodeURIComponent(rawKey);
|
|
743
743
|
if (key === "signature") continue;
|
|
744
|
+
if (key === "debug") continue;
|
|
744
745
|
pairs.push({ key, raw: rawValue });
|
|
745
746
|
}
|
|
746
747
|
}
|
|
@@ -4996,6 +4997,13 @@ function createSvelteComponent(descriptor, svelte) {
|
|
|
4996
4997
|
var REALTIME_WS_URL = "wss://cdn.snowcone.app/realtime";
|
|
4997
4998
|
|
|
4998
4999
|
// src/realtime/websocket.ts
|
|
5000
|
+
function pruneUndefined(obj) {
|
|
5001
|
+
const out = {};
|
|
5002
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
5003
|
+
if (v !== void 0) out[k] = v;
|
|
5004
|
+
}
|
|
5005
|
+
return out;
|
|
5006
|
+
}
|
|
4999
5007
|
function randHex(len) {
|
|
5000
5008
|
const arr = new Uint8Array(len);
|
|
5001
5009
|
globalThis.crypto.getRandomValues(arr);
|
|
@@ -5059,6 +5067,13 @@ var RealtimeMockupService = class {
|
|
|
5059
5067
|
// Session-grant auth: when set, connect() fetches a short-lived token, opens
|
|
5060
5068
|
// the WS with `?token=`, and renews ~15s before expiry via a `renew` message.
|
|
5061
5069
|
tokenProvider;
|
|
5070
|
+
// Binary-delivered frames waiting for their mockup_rendered metadata,
|
|
5071
|
+
// keyed `${requestId ?? ''}:${mockupId}`. The server sends the binary
|
|
5072
|
+
// frame before the JSON result on the same socket, so ordering guarantees
|
|
5073
|
+
// the entry exists when the result arrives.
|
|
5074
|
+
pendingFrames = /* @__PURE__ */ new Map();
|
|
5075
|
+
// Last object URL handed out per mockup — revoked when replaced.
|
|
5076
|
+
liveObjectUrls = /* @__PURE__ */ new Map();
|
|
5062
5077
|
renewTimer = null;
|
|
5063
5078
|
isConnecting = false;
|
|
5064
5079
|
connectAttempt = 0;
|
|
@@ -5113,6 +5128,7 @@ var RealtimeMockupService = class {
|
|
|
5113
5128
|
const url = token ? `${this.wsUrl}${this.wsUrl.includes("?") ? "&" : "?"}token=${encodeURIComponent(token)}` : this.wsUrl;
|
|
5114
5129
|
this.addLog(`Connecting to ${this.wsUrl}...`);
|
|
5115
5130
|
this.ws = new WebSocket(url);
|
|
5131
|
+
this.ws.binaryType = "arraybuffer";
|
|
5116
5132
|
this.ws.onopen = () => {
|
|
5117
5133
|
console.log(`[WS] connection OPENED to ${this.wsUrl}`);
|
|
5118
5134
|
this.addLog("WebSocket connection opened");
|
|
@@ -5120,6 +5136,10 @@ var RealtimeMockupService = class {
|
|
|
5120
5136
|
this.isConnecting = false;
|
|
5121
5137
|
};
|
|
5122
5138
|
this.ws.onmessage = (event) => {
|
|
5139
|
+
if (event.data instanceof ArrayBuffer) {
|
|
5140
|
+
this.handleBinaryFrame(event.data);
|
|
5141
|
+
return;
|
|
5142
|
+
}
|
|
5123
5143
|
try {
|
|
5124
5144
|
const data = JSON.parse(event.data);
|
|
5125
5145
|
this.addLog(JSON.stringify(data, null, 2), "received");
|
|
@@ -5229,6 +5249,7 @@ var RealtimeMockupService = class {
|
|
|
5229
5249
|
this.addLog("\u{1F3A8} Mockup rendering has started...");
|
|
5230
5250
|
break;
|
|
5231
5251
|
case "mockup_rendered": {
|
|
5252
|
+
this.applyBinaryFrame(data);
|
|
5232
5253
|
const sentAt = data.requestId ? this.requestSendTimes.get(data.requestId) : void 0;
|
|
5233
5254
|
const clientRoundTripMs = sentAt !== void 0 ? Date.now() - sentAt : void 0;
|
|
5234
5255
|
console.log(`[WS] mockup_rendered received: mockupId=${data.mockupId} hasImageUrl=${!!data.imageUrl} v=${data.requestVersion} req=${data.requestId ?? "?"} placement="${data.placement}" renderMs=${data.renderMs} blobToRenderMs=${data.blobToRenderMs} clientRoundTripMs=${clientRoundTripMs ?? "?"} at ${Date.now()}`);
|
|
@@ -5256,6 +5277,8 @@ var RealtimeMockupService = class {
|
|
|
5256
5277
|
blobToRenderMs: data.blobToRenderMs,
|
|
5257
5278
|
costUsd: data.costUsd,
|
|
5258
5279
|
renderCache: data.renderCache,
|
|
5280
|
+
cropRect: data.cropRect,
|
|
5281
|
+
serverTiming: data.serverTiming,
|
|
5259
5282
|
canvasRenderTiming: data.canvasRenderTiming
|
|
5260
5283
|
};
|
|
5261
5284
|
const existingIndex = this.mockupResults.findIndex((m) => m.mockupId === data.mockupId);
|
|
@@ -5291,7 +5314,18 @@ var RealtimeMockupService = class {
|
|
|
5291
5314
|
}
|
|
5292
5315
|
return true;
|
|
5293
5316
|
});
|
|
5294
|
-
this.mockupResults = freshMockups
|
|
5317
|
+
this.mockupResults = freshMockups.map((mockup) => {
|
|
5318
|
+
const existing = this.mockupResults.find(
|
|
5319
|
+
(m) => m.mockupId === mockup.mockupId && (mockup.requestId === void 0 || m.requestId === mockup.requestId)
|
|
5320
|
+
);
|
|
5321
|
+
if (!existing) return mockup;
|
|
5322
|
+
const merged = { ...existing, ...pruneUndefined(mockup) };
|
|
5323
|
+
if (existing.imageUrl.startsWith("blob:")) {
|
|
5324
|
+
merged.imageUrl = existing.imageUrl;
|
|
5325
|
+
merged.renderUrl = existing.renderUrl;
|
|
5326
|
+
}
|
|
5327
|
+
return merged;
|
|
5328
|
+
});
|
|
5295
5329
|
this.lastError = null;
|
|
5296
5330
|
this.renderError = null;
|
|
5297
5331
|
this.addLog(`\u{1F389} All mockups rendered: ${freshMockups.length} fresh (${data.mockups.length - freshMockups.length} stale filtered)`);
|
|
@@ -5327,6 +5361,35 @@ var RealtimeMockupService = class {
|
|
|
5327
5361
|
this.ws = null;
|
|
5328
5362
|
}
|
|
5329
5363
|
}
|
|
5364
|
+
handleBinaryFrame(buf) {
|
|
5365
|
+
try {
|
|
5366
|
+
const view = new DataView(buf);
|
|
5367
|
+
const headerLen = view.getUint32(0);
|
|
5368
|
+
const header = JSON.parse(new TextDecoder().decode(new Uint8Array(buf, 4, headerLen)));
|
|
5369
|
+
if (header.type !== "mockup_frame") return;
|
|
5370
|
+
const bytes = new Uint8Array(buf, 4 + headerLen);
|
|
5371
|
+
const objectUrl = URL.createObjectURL(new Blob([bytes], { type: header.contentType || "image/avif" }));
|
|
5372
|
+
const key = `${header.requestId ?? ""}:${header.mockupId}`;
|
|
5373
|
+
const prev = this.pendingFrames.get(key);
|
|
5374
|
+
if (prev) URL.revokeObjectURL(prev.objectUrl);
|
|
5375
|
+
this.pendingFrames.set(key, { objectUrl, bytes: bytes.byteLength });
|
|
5376
|
+
this.addLog(`\u{1F4E6} mockup_frame received over ws: ${header.mockupId} (${bytes.byteLength}B)`);
|
|
5377
|
+
} catch (e) {
|
|
5378
|
+
this.addLog(`\u26A0\uFE0F failed to parse binary frame: ${e}`);
|
|
5379
|
+
}
|
|
5380
|
+
}
|
|
5381
|
+
/** Swap a ws-delivered frame in for the imageUrl on a render result. */
|
|
5382
|
+
applyBinaryFrame(data) {
|
|
5383
|
+
if (data.imageDelivery !== "ws" || !data.mockupId) return;
|
|
5384
|
+
const key = `${data.requestId ?? ""}:${data.mockupId}`;
|
|
5385
|
+
const frame = this.pendingFrames.get(key);
|
|
5386
|
+
if (!frame) return;
|
|
5387
|
+
this.pendingFrames.delete(key);
|
|
5388
|
+
const prevLive = this.liveObjectUrls.get(data.mockupId);
|
|
5389
|
+
if (prevLive) URL.revokeObjectURL(prevLive);
|
|
5390
|
+
this.liveObjectUrls.set(data.mockupId, frame.objectUrl);
|
|
5391
|
+
data.imageUrl = frame.objectUrl;
|
|
5392
|
+
}
|
|
5330
5393
|
sendConfig(config) {
|
|
5331
5394
|
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
|
5332
5395
|
this.addLog("WebSocket not connected, caching config");
|
|
@@ -5373,7 +5436,11 @@ var RealtimeMockupService = class {
|
|
|
5373
5436
|
this.configSent = true;
|
|
5374
5437
|
const message = {
|
|
5375
5438
|
type: "config",
|
|
5376
|
-
|
|
5439
|
+
// binaryFrames: ask the server to push rendered image bytes down this
|
|
5440
|
+
// socket (mockup_frame binary messages) instead of making us fetch the
|
|
5441
|
+
// imageUrl — saves a network round trip per render. Servers that don't
|
|
5442
|
+
// know the flag ignore it and we fall back to the URL.
|
|
5443
|
+
config: { ...config, binaryFrames: true }
|
|
5377
5444
|
};
|
|
5378
5445
|
const messageStr = JSON.stringify(message);
|
|
5379
5446
|
this.addLog(`\u{1F4E4} Sending config: ${JSON.stringify(message, null, 2)}`, "sent");
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createDevFetcher } from './dev-fetcher.cjs';
|
|
2
2
|
import { PublicDesign, PublicFill, PublicOptions } from '@snowcone-app/mockup-url';
|
|
3
|
-
import { O as OptionAttribute, a as OptionSelection, C as Combination, F as FrameworkAdapter, b as ComponentProps, c as ComponentDescriptor, d as ComponentState, e as ComponentContext, f as ComponentLifecycleHooks, E as EventHandler, g as FrameworkUtilities, P as PlacementSettings, M as MockupResult, R as RealtimeRenderError, h as RealtimeMockupService } from './websocket-
|
|
4
|
-
export { A as AdapterRegistry, i as ProductComponentContext, j as RealtimeMockupCallbacks, k as RealtimeMockupState, l as RenderResult, W as WebSocketConfig, m as WebSocketMessage, n as adapterRegistry, o as computeDisabledChoices, p as createComponent, q as defineComponent, r as deriveDefaultSelection, s as findBestCombination, t as getPricePreview, u as isOptionAvailable, v as resolveBestCombination } from './websocket-
|
|
3
|
+
import { O as OptionAttribute, a as OptionSelection, C as Combination, F as FrameworkAdapter, b as ComponentProps, c as ComponentDescriptor, d as ComponentState, e as ComponentContext, f as ComponentLifecycleHooks, E as EventHandler, g as FrameworkUtilities, P as PlacementSettings, M as MockupResult, R as RealtimeRenderError, h as RealtimeMockupService } from './websocket-CScS7UR-.cjs';
|
|
4
|
+
export { A as AdapterRegistry, i as ProductComponentContext, j as RealtimeMockupCallbacks, k as RealtimeMockupState, l as RenderResult, W as WebSocketConfig, m as WebSocketMessage, n as adapterRegistry, o as computeDisabledChoices, p as createComponent, q as defineComponent, r as deriveDefaultSelection, s as findBestCombination, t as getPricePreview, u as isOptionAvailable, v as resolveBestCombination } from './websocket-CScS7UR-.cjs';
|
|
5
5
|
|
|
6
6
|
interface CatalogProduct {
|
|
7
7
|
id: string;
|
|
@@ -372,7 +372,13 @@ declare function getBuyUrl(productCode: string, opts: GetMockupUrlOptions): stri
|
|
|
372
372
|
* ```
|
|
373
373
|
*/
|
|
374
374
|
interface BffSignerOptions {
|
|
375
|
-
/**
|
|
375
|
+
/**
|
|
376
|
+
* Override fetch (tests / non-global-fetch runtimes). If your sign endpoint
|
|
377
|
+
* sits behind a bot/abuse gate that 401s first-time anonymous visitors
|
|
378
|
+
* (e.g. a Turnstile challenge dance), pass the fetch wrapper that solves it —
|
|
379
|
+
* the default fetch makes ONE attempt and this signer fails open to the
|
|
380
|
+
* unsigned URL, which a signed-URL shop will refuse to serve.
|
|
381
|
+
*/
|
|
376
382
|
fetch?: typeof fetch;
|
|
377
383
|
/** Max URLs per `/api/sign` request (default 50; matches the handler default). */
|
|
378
384
|
maxBatch?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { createDevFetcher } from './dev-fetcher.js';
|
|
2
2
|
import { PublicDesign, PublicFill, PublicOptions } from '@snowcone-app/mockup-url';
|
|
3
|
-
import { O as OptionAttribute, a as OptionSelection, C as Combination, F as FrameworkAdapter, b as ComponentProps, c as ComponentDescriptor, d as ComponentState, e as ComponentContext, f as ComponentLifecycleHooks, E as EventHandler, g as FrameworkUtilities, P as PlacementSettings, M as MockupResult, R as RealtimeRenderError, h as RealtimeMockupService } from './websocket-
|
|
4
|
-
export { A as AdapterRegistry, i as ProductComponentContext, j as RealtimeMockupCallbacks, k as RealtimeMockupState, l as RenderResult, W as WebSocketConfig, m as WebSocketMessage, n as adapterRegistry, o as computeDisabledChoices, p as createComponent, q as defineComponent, r as deriveDefaultSelection, s as findBestCombination, t as getPricePreview, u as isOptionAvailable, v as resolveBestCombination } from './websocket-
|
|
3
|
+
import { O as OptionAttribute, a as OptionSelection, C as Combination, F as FrameworkAdapter, b as ComponentProps, c as ComponentDescriptor, d as ComponentState, e as ComponentContext, f as ComponentLifecycleHooks, E as EventHandler, g as FrameworkUtilities, P as PlacementSettings, M as MockupResult, R as RealtimeRenderError, h as RealtimeMockupService } from './websocket-CScS7UR-.js';
|
|
4
|
+
export { A as AdapterRegistry, i as ProductComponentContext, j as RealtimeMockupCallbacks, k as RealtimeMockupState, l as RenderResult, W as WebSocketConfig, m as WebSocketMessage, n as adapterRegistry, o as computeDisabledChoices, p as createComponent, q as defineComponent, r as deriveDefaultSelection, s as findBestCombination, t as getPricePreview, u as isOptionAvailable, v as resolveBestCombination } from './websocket-CScS7UR-.js';
|
|
5
5
|
|
|
6
6
|
interface CatalogProduct {
|
|
7
7
|
id: string;
|
|
@@ -372,7 +372,13 @@ declare function getBuyUrl(productCode: string, opts: GetMockupUrlOptions): stri
|
|
|
372
372
|
* ```
|
|
373
373
|
*/
|
|
374
374
|
interface BffSignerOptions {
|
|
375
|
-
/**
|
|
375
|
+
/**
|
|
376
|
+
* Override fetch (tests / non-global-fetch runtimes). If your sign endpoint
|
|
377
|
+
* sits behind a bot/abuse gate that 401s first-time anonymous visitors
|
|
378
|
+
* (e.g. a Turnstile challenge dance), pass the fetch wrapper that solves it —
|
|
379
|
+
* the default fetch makes ONE attempt and this signer fails open to the
|
|
380
|
+
* unsigned URL, which a signed-URL shop will refuse to serve.
|
|
381
|
+
*/
|
|
376
382
|
fetch?: typeof fetch;
|
|
377
383
|
/** Max URLs per `/api/sign` request (default 50; matches the handler default). */
|
|
378
384
|
maxBatch?: number;
|
package/dist/index.js
CHANGED
|
@@ -4,14 +4,14 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
REALTIME_WS_URL,
|
|
6
6
|
RealtimeMockupService
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SZZQ2CBF.js";
|
|
8
8
|
import {
|
|
9
9
|
buildMockupUrl,
|
|
10
10
|
buildPublicMockupUrl,
|
|
11
11
|
canonicalForSig,
|
|
12
12
|
normalizeDesignElements,
|
|
13
13
|
normalizeWidth
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-553YYMDY.js";
|
|
15
15
|
|
|
16
16
|
// src/validation.ts
|
|
17
17
|
import { z } from "zod";
|