@snowcone-app/sdk 0.2.2 → 0.3.2

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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#263](https://github.com/snowcone-app/snowcone-monorepo/pull/263) [`eb3b565`](https://github.com/snowcone-app/snowcone-monorepo/commit/eb3b565cc6f6f2181f230413182f2cb629da2e1d) Thanks [@kevinsproles](https://github.com/kevinsproles)! - fix(sdk): expose `./package.json` in the exports map
8
+
9
+ `require('@snowcone-app/sdk/package.json')` failed with
10
+ `ERR_PACKAGE_PATH_NOT_EXPORTED` — the identical bug fixed in canvas (#258) but
11
+ missed on the sibling, because the packaging smoke test was canvas-only. Adds
12
+ `"./package.json": "./package.json"` to both the dev and published exports maps.
13
+
14
+ ## 0.3.1
15
+
16
+ ### Patch Changes
17
+
18
+ - [#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).
19
+
20
+ ## 0.3.0
21
+
22
+ ### Minor Changes
23
+
24
+ - [#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
25
+ product now carries a `requiredPlacements` array — `{ label, key?, type: "image" |
26
+ "color", autoFilledByVariant }` — so a developer can read exactly which placements
27
+ `renderState` will demand (and which are auto-filled from `variantId`) instead of
28
+ reverse-engineering it from a runtime timeout error. Image placements also no longer
29
+ report `type: null`; they default to `"image"`.
30
+
3
31
  ## 0.2.2
4
32
 
5
33
  ### 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.2.2",
3
+ "version": "0.3.2",
4
4
  "description": "Snowcone SDK for product mockups and print-on-demand",
5
5
  "keywords": [
6
6
  "merch",
@@ -44,7 +44,8 @@
44
44
  "import": "./dist/dev-fetcher.js",
45
45
  "require": "./dist/dev-fetcher.cjs",
46
46
  "default": "./dist/dev-fetcher.js"
47
- }
47
+ },
48
+ "./package.json": "./package.json"
48
49
  },
49
50
  "files": [
50
51
  "dist",
@@ -56,7 +57,6 @@
56
57
  },
57
58
  "sideEffects": false,
58
59
  "peerDependencies": {
59
- "zod": "^3.0.0",
60
60
  "react": "^18 || ^19"
61
61
  },
62
62
  "peerDependenciesMeta": {
@@ -64,14 +64,15 @@
64
64
  "optional": true
65
65
  }
66
66
  },
67
- "dependencies": {},
67
+ "dependencies": {
68
+ "zod": "^3.23.8"
69
+ },
68
70
  "devDependencies": {
69
71
  "@types/node": "^20.11.0",
70
72
  "@types/react": "^18.3.0",
71
73
  "tsup": "^8.1.0",
72
74
  "typescript": "^5.5.4",
73
75
  "vitest": "^2.0.5",
74
- "zod": "^3.23.8",
75
76
  "@snowcone-app/mockup-url": "0.1.0"
76
77
  },
77
78
  "engines": {