@snowcone-app/sdk 0.2.2 → 0.3.1
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 +17 -0
- package/dist/index.cjs +12 -0
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +12 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#258](https://github.com/snowcone-app/snowcone-monorepo/pull/258) [`a6d53d8`](https://github.com/snowcone-app/snowcone-monorepo/commit/a6d53d82a18d6dbbb55be4525637cd8372aed760) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Move `zod` from `peerDependencies` to `dependencies`. The SDK uses zod internally (to validate catalog responses) and never asks the consumer to supply a zod schema across the API boundary, so it should bring its own zod rather than demand one as a peer. This removes the unmet-peer warning consumers saw on npm (which is on zod 4 while the SDK targets zod 3).
|
|
8
|
+
|
|
9
|
+
## 0.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#256](https://github.com/snowcone-app/snowcone-monorepo/pull/256) [`49f18e2`](https://github.com/snowcone-app/snowcone-monorepo/commit/49f18e221b49422e88f6aa6a06a1de153f170ff3) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Surface the renderer's required-placement contract on `getProduct()`. The catalog
|
|
14
|
+
product now carries a `requiredPlacements` array — `{ label, key?, type: "image" |
|
|
15
|
+
"color", autoFilledByVariant }` — so a developer can read exactly which placements
|
|
16
|
+
`renderState` will demand (and which are auto-filled from `variantId`) instead of
|
|
17
|
+
reverse-engineering it from a runtime timeout error. Image placements also no longer
|
|
18
|
+
report `type: null`; they default to `"image"`.
|
|
19
|
+
|
|
3
20
|
## 0.2.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -217,6 +217,18 @@ var CatalogProductSchema = import_zod.z.object({
|
|
|
217
217
|
offsetY: import_zod.z.number().optional()
|
|
218
218
|
})
|
|
219
219
|
).optional(),
|
|
220
|
+
// The renderer's required-placement contract, surfaced by the catalog so a
|
|
221
|
+
// dev reads exactly which placements renderState will demand. Image
|
|
222
|
+
// placements + variant-auto-filled color placements. Optional — older catalog
|
|
223
|
+
// docs predate it.
|
|
224
|
+
requiredPlacements: import_zod.z.array(
|
|
225
|
+
import_zod.z.object({
|
|
226
|
+
label: import_zod.z.string(),
|
|
227
|
+
key: import_zod.z.string().optional(),
|
|
228
|
+
type: import_zod.z.enum(["image", "color"]),
|
|
229
|
+
autoFilledByVariant: import_zod.z.boolean()
|
|
230
|
+
})
|
|
231
|
+
).optional(),
|
|
220
232
|
defaultGvid: import_zod.z.string().optional()
|
|
221
233
|
});
|
|
222
234
|
|
package/dist/index.d.cts
CHANGED
|
@@ -80,6 +80,21 @@ interface CatalogProduct$2 {
|
|
|
80
80
|
offsetX?: number;
|
|
81
81
|
offsetY?: number;
|
|
82
82
|
}[];
|
|
83
|
+
/**
|
|
84
|
+
* The renderer's required-placement contract, surfaced so a developer reads exactly which placements `renderState` will demand. Image placements are always sent by the caller; color placements (autoFilledByVariant: true) are filled from `variantId` — omit them when you pass a variantId, send them otherwise.
|
|
85
|
+
*/
|
|
86
|
+
requiredPlacements?: {
|
|
87
|
+
label: string;
|
|
88
|
+
/**
|
|
89
|
+
* URL-safe slug derived from `label`. Present for image placements.
|
|
90
|
+
*/
|
|
91
|
+
key?: string;
|
|
92
|
+
type: 'image' | 'color';
|
|
93
|
+
/**
|
|
94
|
+
* When true, this (color) placement is auto-filled from the variant's option choice when a `variantId` is sent; otherwise the caller must send it explicitly.
|
|
95
|
+
*/
|
|
96
|
+
autoFilledByVariant: boolean;
|
|
97
|
+
}[];
|
|
83
98
|
defaultGvid?: string | null;
|
|
84
99
|
}
|
|
85
100
|
|
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,21 @@ interface CatalogProduct$2 {
|
|
|
80
80
|
offsetX?: number;
|
|
81
81
|
offsetY?: number;
|
|
82
82
|
}[];
|
|
83
|
+
/**
|
|
84
|
+
* The renderer's required-placement contract, surfaced so a developer reads exactly which placements `renderState` will demand. Image placements are always sent by the caller; color placements (autoFilledByVariant: true) are filled from `variantId` — omit them when you pass a variantId, send them otherwise.
|
|
85
|
+
*/
|
|
86
|
+
requiredPlacements?: {
|
|
87
|
+
label: string;
|
|
88
|
+
/**
|
|
89
|
+
* URL-safe slug derived from `label`. Present for image placements.
|
|
90
|
+
*/
|
|
91
|
+
key?: string;
|
|
92
|
+
type: 'image' | 'color';
|
|
93
|
+
/**
|
|
94
|
+
* When true, this (color) placement is auto-filled from the variant's option choice when a `variantId` is sent; otherwise the caller must send it explicitly.
|
|
95
|
+
*/
|
|
96
|
+
autoFilledByVariant: boolean;
|
|
97
|
+
}[];
|
|
83
98
|
defaultGvid?: string | null;
|
|
84
99
|
}
|
|
85
100
|
|
package/dist/index.js
CHANGED
|
@@ -72,6 +72,18 @@ var CatalogProductSchema = z.object({
|
|
|
72
72
|
offsetY: z.number().optional()
|
|
73
73
|
})
|
|
74
74
|
).optional(),
|
|
75
|
+
// The renderer's required-placement contract, surfaced by the catalog so a
|
|
76
|
+
// dev reads exactly which placements renderState will demand. Image
|
|
77
|
+
// placements + variant-auto-filled color placements. Optional — older catalog
|
|
78
|
+
// docs predate it.
|
|
79
|
+
requiredPlacements: z.array(
|
|
80
|
+
z.object({
|
|
81
|
+
label: z.string(),
|
|
82
|
+
key: z.string().optional(),
|
|
83
|
+
type: z.enum(["image", "color"]),
|
|
84
|
+
autoFilledByVariant: z.boolean()
|
|
85
|
+
})
|
|
86
|
+
).optional(),
|
|
75
87
|
defaultGvid: z.string().optional()
|
|
76
88
|
});
|
|
77
89
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snowcone-app/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Snowcone SDK for product mockups and print-on-demand",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"merch",
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
},
|
|
57
57
|
"sideEffects": false,
|
|
58
58
|
"peerDependencies": {
|
|
59
|
-
"zod": "^3.0.0",
|
|
60
59
|
"react": "^18 || ^19"
|
|
61
60
|
},
|
|
62
61
|
"peerDependenciesMeta": {
|
|
@@ -64,14 +63,15 @@
|
|
|
64
63
|
"optional": true
|
|
65
64
|
}
|
|
66
65
|
},
|
|
67
|
-
"dependencies": {
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"zod": "^3.23.8"
|
|
68
|
+
},
|
|
68
69
|
"devDependencies": {
|
|
69
70
|
"@types/node": "^20.11.0",
|
|
70
71
|
"@types/react": "^18.3.0",
|
|
71
72
|
"tsup": "^8.1.0",
|
|
72
73
|
"typescript": "^5.5.4",
|
|
73
74
|
"vitest": "^2.0.5",
|
|
74
|
-
"zod": "^3.23.8",
|
|
75
75
|
"@snowcone-app/mockup-url": "0.1.0"
|
|
76
76
|
},
|
|
77
77
|
"engines": {
|