@snowcone-app/sdk 0.3.5 → 0.3.6
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 +30 -0
- package/README.md +3 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#317](https://github.com/snowcone-app/snowcone-monorepo/pull/317) [`ef0f08e`](https://github.com/snowcone-app/snowcone-monorepo/commit/ef0f08ee3ffa14b1db3a4011e4a0f7e5e42340a1) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Republish to ship two already-landed source fixes that never reached npm:
|
|
8
|
+
- **ui:** the `./package.json` export (added in #279) is in source but the live
|
|
9
|
+
`0.1.30` tarball still omits it, so `@snowcone-app/ui/package.json` resolution
|
|
10
|
+
throws `ERR_PACKAGE_PATH_NOT_EXPORTED` for anyone installing today. This bump
|
|
11
|
+
republishes with it.
|
|
12
|
+
- **sdk:** carries the corrected `RenderSession` `mockupIds` examples (JSDoc +
|
|
13
|
+
README) out to npm — they showed a placement name where opaque catalog scene
|
|
14
|
+
codes (`mockups[].id`, e.g. `FV1qjO`) belong.
|
|
15
|
+
|
|
16
|
+
- [#322](https://github.com/snowcone-app/snowcone-monorepo/pull/322) [`4017a11`](https://github.com/snowcone-app/snowcone-monorepo/commit/4017a11385d3eab3cc1b86f27842e2f783e1f628) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Fix client-side `mockupUrl()` base resolution: prefer the resolver
|
|
17
|
+
(`window.snowcone.resolver` / `NEXT_PUBLIC_MOCKUP_RESOLVER_URL` /
|
|
18
|
+
`SNOWCONE_IMAGE_URL`, default `img.snowcone.app`) and never fall back to the
|
|
19
|
+
renderer. `ShopProvider` publishes the renderer as `window.snowcone.mockupUrl`,
|
|
20
|
+
which `resolveMockupBaseUrl()` previously read first — so in the browser every
|
|
21
|
+
`mockupUrl()` built the resolver grammar against the renderer host and 400'd
|
|
22
|
+
with "required property 'seal'". (The prior fix only corrected the server path,
|
|
23
|
+
where `window.snowcone` is absent.)
|
|
24
|
+
|
|
25
|
+
- [#321](https://github.com/snowcone-app/snowcone-monorepo/pull/321) [`3f693ac`](https://github.com/snowcone-app/snowcone-monorepo/commit/3f693ac8cd28405ffd7e14781432a2f43ddf2dc9) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Fix `mockupUrl()` base host: it builds the public-image **resolver** grammar
|
|
26
|
+
(`/{code}?asset=&shop=…`, unsigned), so its base must be the resolver
|
|
27
|
+
(`img.snowcone.app`), which seals the URL and 302s to the renderer. It was
|
|
28
|
+
defaulting to the **renderer** (`cdn.snowcone.app`), which rejects unsigned
|
|
29
|
+
URLs with `400 … querystring must have required property 'seal'`. Now defaults
|
|
30
|
+
to `img.snowcone.app` (matching `getMockupUrl`) and prefers
|
|
31
|
+
`NEXT_PUBLIC_MOCKUP_RESOLVER_URL`.
|
|
32
|
+
|
|
3
33
|
## 0.3.5
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -204,7 +204,9 @@ import { RenderSession } from '@snowcone-app/sdk';
|
|
|
204
204
|
const session = new RenderSession({
|
|
205
205
|
shop: 'YOUR_SHOP_ID', // publishable, like Stripe pk_
|
|
206
206
|
grantUrl: '/api/realtime/grant', // your proxy above
|
|
207
|
-
|
|
207
|
+
// mockupIds are catalog SCENE CODES (product.mockups[].id) — not placement
|
|
208
|
+
// names. variantId is required for products with a color/size option.
|
|
209
|
+
product: { productId: 'BEEB77', mockupIds: ['FV1qjO'], variantId: 'Pv1sLC' },
|
|
208
210
|
});
|
|
209
211
|
|
|
210
212
|
session.onMockups((results) => { img.src = results[0].imageUrl; });
|
package/dist/index.cjs
CHANGED
|
@@ -1798,7 +1798,7 @@ function buildMockupUrl2(options, cfg) {
|
|
|
1798
1798
|
}
|
|
1799
1799
|
function resolveMockupBaseUrl() {
|
|
1800
1800
|
const winConfig = typeof window !== "undefined" && window.snowcone || {};
|
|
1801
|
-
return winConfig.
|
|
1801
|
+
return winConfig.resolver || typeof process !== "undefined" && process.env?.NEXT_PUBLIC_MOCKUP_RESOLVER_URL || typeof process !== "undefined" && process.env?.SNOWCONE_IMAGE_URL || "https://img.snowcone.app";
|
|
1802
1802
|
}
|
|
1803
1803
|
function resolveShop() {
|
|
1804
1804
|
const winConfig = typeof window !== "undefined" && window.snowcone || {};
|
package/dist/index.d.cts
CHANGED
|
@@ -820,7 +820,8 @@ type UserSelection = Record<string, string>;
|
|
|
820
820
|
* Config for the pure URL builder: the two things not on MockupGenerationOptions.
|
|
821
821
|
*/
|
|
822
822
|
interface BuildMockupUrlConfig {
|
|
823
|
-
/** Base of the
|
|
823
|
+
/** Base of the public-image RESOLVER, e.g. https://img.snowcone.app (it
|
|
824
|
+
* seals the URL and 302s to the renderer). NOT the renderer host. */
|
|
824
825
|
mockupBaseUrl: string;
|
|
825
826
|
/** The shop's public Shop ID (= shop.id). */
|
|
826
827
|
shop: string;
|
|
@@ -2581,9 +2582,13 @@ declare function fetchRealtimeGrant(grantUrl: string, shop: string, fetchImpl?:
|
|
|
2581
2582
|
* const session = new RenderSession({
|
|
2582
2583
|
* shop: 'YOUR_SHOP_ID',
|
|
2583
2584
|
* grantUrl: '/api/realtime/grant', // your proxy → mintRealtimeGrant (server)
|
|
2584
|
-
*
|
|
2585
|
+
* // mockupIds are opaque catalog SCENE CODES (product.mockups[].id) — NOT
|
|
2586
|
+
* // placement names. variantId is required for products with a color/size axis.
|
|
2587
|
+
* product: { productId: 'BEEB77', mockupIds: ['FV1qjO'], variantId: 'Pv1sLC' },
|
|
2585
2588
|
* });
|
|
2586
2589
|
* session.onMockups((results) => { img.src = results[0].imageUrl; });
|
|
2590
|
+
* // First arg is the PLACEMENT name (placements[].label, e.g. 'Front') — a
|
|
2591
|
+
* // different id space from mockupIds, and it must match a canvas artboard.
|
|
2587
2592
|
* await session.renderState('Front', serializeStateForServer(canvasState));
|
|
2588
2593
|
*
|
|
2589
2594
|
* For the low-level escape hatch, use {@link RealtimeMockupService} directly.
|
package/dist/index.d.ts
CHANGED
|
@@ -820,7 +820,8 @@ type UserSelection = Record<string, string>;
|
|
|
820
820
|
* Config for the pure URL builder: the two things not on MockupGenerationOptions.
|
|
821
821
|
*/
|
|
822
822
|
interface BuildMockupUrlConfig {
|
|
823
|
-
/** Base of the
|
|
823
|
+
/** Base of the public-image RESOLVER, e.g. https://img.snowcone.app (it
|
|
824
|
+
* seals the URL and 302s to the renderer). NOT the renderer host. */
|
|
824
825
|
mockupBaseUrl: string;
|
|
825
826
|
/** The shop's public Shop ID (= shop.id). */
|
|
826
827
|
shop: string;
|
|
@@ -2581,9 +2582,13 @@ declare function fetchRealtimeGrant(grantUrl: string, shop: string, fetchImpl?:
|
|
|
2581
2582
|
* const session = new RenderSession({
|
|
2582
2583
|
* shop: 'YOUR_SHOP_ID',
|
|
2583
2584
|
* grantUrl: '/api/realtime/grant', // your proxy → mintRealtimeGrant (server)
|
|
2584
|
-
*
|
|
2585
|
+
* // mockupIds are opaque catalog SCENE CODES (product.mockups[].id) — NOT
|
|
2586
|
+
* // placement names. variantId is required for products with a color/size axis.
|
|
2587
|
+
* product: { productId: 'BEEB77', mockupIds: ['FV1qjO'], variantId: 'Pv1sLC' },
|
|
2585
2588
|
* });
|
|
2586
2589
|
* session.onMockups((results) => { img.src = results[0].imageUrl; });
|
|
2590
|
+
* // First arg is the PLACEMENT name (placements[].label, e.g. 'Front') — a
|
|
2591
|
+
* // different id space from mockupIds, and it must match a canvas artboard.
|
|
2587
2592
|
* await session.renderState('Front', serializeStateForServer(canvasState));
|
|
2588
2593
|
*
|
|
2589
2594
|
* For the low-level escape hatch, use {@link RealtimeMockupService} directly.
|
package/dist/index.js
CHANGED
|
@@ -1643,7 +1643,7 @@ function buildMockupUrl2(options, cfg) {
|
|
|
1643
1643
|
}
|
|
1644
1644
|
function resolveMockupBaseUrl() {
|
|
1645
1645
|
const winConfig = typeof window !== "undefined" && window.snowcone || {};
|
|
1646
|
-
return winConfig.
|
|
1646
|
+
return winConfig.resolver || typeof process !== "undefined" && process.env?.NEXT_PUBLIC_MOCKUP_RESOLVER_URL || typeof process !== "undefined" && process.env?.SNOWCONE_IMAGE_URL || "https://img.snowcone.app";
|
|
1647
1647
|
}
|
|
1648
1648
|
function resolveShop() {
|
|
1649
1649
|
const winConfig = typeof window !== "undefined" && window.snowcone || {};
|