@sanity/sfcc 1.0.14 → 1.0.15

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/dist/index.js CHANGED
@@ -1,498 +1,544 @@
1
- import { useFormValue, useClient, defineField, definePlugin } from "sanity";
2
- import { jsx, jsxs } from "react/jsx-runtime";
1
+ import { defineField, definePlugin, useClient, useFormValue } from "sanity";
3
2
  import { c } from "react/compiler-runtime";
4
3
  import { WarningOutlineIcon } from "@sanity/icons/WarningOutline";
5
- import { Card, Flex, Text, useToast, Stack } from "@sanity/ui";
4
+ import { Card, Flex, Stack, Text, useToast } from "@sanity/ui";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { TrashIcon } from "@sanity/icons/Trash";
7
7
  import { useState } from "react";
8
8
  import { useRouter } from "sanity/router";
9
9
  import { CloseIcon } from "@sanity/icons/Close";
10
10
  import { ImageIcon } from "@sanity/icons/Image";
11
+ /**
12
+ * Decorative banner injected via `renderMembers` that warns editors when a
13
+ * product or category is offline in SFCC.
14
+ *
15
+ * Reads `store.onlineFlag` (products) and `store.online` (categories) via
16
+ * `useFormValue` so it works without props.
17
+ */
11
18
  function SfccOfflineBanner() {
12
- const $ = c(3);
13
- let t0;
14
- $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = ["store", "onlineFlag"], $[0] = t0) : t0 = $[0];
15
- const onlineFlagRaw = useFormValue(t0);
16
- let t1;
17
- $[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t1 = ["store", "online"], $[1] = t1) : t1 = $[1];
18
- const onlineRaw = useFormValue(t1);
19
- if (((typeof onlineFlagRaw == "boolean" ? onlineFlagRaw : void 0) ?? (typeof onlineRaw == "boolean" ? onlineRaw : void 0)) !== !1)
20
- return null;
21
- let t2;
22
- return $[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx(Card, { padding: 4, radius: 2, shadow: 1, tone: "caution", children: /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 3, children: [
23
- /* @__PURE__ */ jsx(Text, { size: 2, children: /* @__PURE__ */ jsx(WarningOutlineIcon, {}) }),
24
- /* @__PURE__ */ jsx(Text, { size: 1, weight: "medium", children: "This document is currently offline in SFCC." })
25
- ] }) }), $[2] = t2) : t2 = $[2], t2;
19
+ let $ = c(3), t0;
20
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = ["store", "onlineFlag"], $[0] = t0) : t0 = $[0];
21
+ let onlineFlagRaw = useFormValue(t0), t1;
22
+ $[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = ["store", "online"], $[1] = t1) : t1 = $[1];
23
+ let onlineRaw = useFormValue(t1);
24
+ if (((typeof onlineFlagRaw == "boolean" ? onlineFlagRaw : void 0) ?? (typeof onlineRaw == "boolean" ? onlineRaw : void 0)) !== !1) return null;
25
+ let t2;
26
+ return $[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx(Card, {
27
+ padding: 4,
28
+ radius: 2,
29
+ shadow: 1,
30
+ tone: "caution",
31
+ children: /* @__PURE__ */ jsxs(Flex, {
32
+ align: "center",
33
+ gap: 3,
34
+ children: [/* @__PURE__ */ jsx(Text, {
35
+ size: 2,
36
+ children: /* @__PURE__ */ jsx(WarningOutlineIcon, {})
37
+ }), /* @__PURE__ */ jsx(Text, {
38
+ size: 1,
39
+ weight: "medium",
40
+ children: "This document is currently offline in SFCC."
41
+ })]
42
+ })
43
+ }), $[2] = t2) : t2 = $[2], t2;
26
44
  }
27
45
  const API_VERSION = "2026-02-24", CONFIG = {
28
- product: {
29
- message: "Delete the current product and all associated variants in your dataset?",
30
- backPath: "/structure/products"
31
- },
32
- category: {
33
- message: "Delete the current category from your dataset?",
34
- backPath: "/structure/categories"
35
- }
46
+ product: {
47
+ message: "Delete the current product and all associated variants in your dataset?",
48
+ backPath: "/structure/products"
49
+ },
50
+ category: {
51
+ message: "Delete the current category from your dataset?",
52
+ backPath: "/structure/categories"
53
+ }
36
54
  };
55
+ /**
56
+ * Wraps the built-in delete action for SFCC-synced documents.
57
+ *
58
+ * - **Products**: deletes the product *and* all associated variants
59
+ * (resolved from `store.variants[]._ref`) in a single transaction,
60
+ * then navigates back to the products list.
61
+ * - **Categories**: deletes the category with a confirmation warning,
62
+ * then navigates back to the categories list.
63
+ */
37
64
  function createSfccDeleteAction(originalDeleteAction) {
38
- return function(props) {
39
- const originalResult = originalDeleteAction(props), [dialogOpen, setDialogOpen] = useState(!1), router = useRouter(), toast = useToast(), client = useClient({
40
- apiVersion: API_VERSION
41
- }), {
42
- type,
43
- draft,
44
- published
45
- } = props, config = CONFIG[type];
46
- return config ? {
47
- ...originalResult,
48
- tone: "critical",
49
- icon: TrashIcon,
50
- label: "Delete",
51
- onHandle: () => setDialogOpen(!0),
52
- dialog: dialogOpen && {
53
- type: "confirm",
54
- message: /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
55
- /* @__PURE__ */ jsx(Text, { size: 1, children: config.message }),
56
- /* @__PURE__ */ jsx(Text, { size: 1, weight: "medium", children: "No data on SFCC will be deleted." })
57
- ] }),
58
- onCancel: () => setDialogOpen(!1),
59
- onConfirm: async () => {
60
- const transaction = client.transaction();
61
- if (published?._id && transaction.delete(published._id), draft?._id && transaction.delete(draft._id), type === "product" && published) {
62
- const store = published.store, variants = store != null && typeof store == "object" && "variants" in store && Array.isArray(store.variants) ? store.variants : [];
63
- for (const v of variants)
64
- v != null && typeof v == "object" && "_ref" in v && typeof v._ref == "string" && (transaction.delete(v._ref), transaction.delete(`drafts.${v._ref}`));
65
- }
66
- try {
67
- await transaction.commit(), router.navigateUrl({
68
- path: config.backPath
69
- });
70
- } catch (err) {
71
- const message = err instanceof Error ? err.message : "Unknown Error";
72
- toast.push({
73
- status: "error",
74
- title: message
75
- });
76
- } finally {
77
- setDialogOpen(!1);
78
- }
79
- }
80
- }
81
- } : originalResult;
82
- };
65
+ return function(props) {
66
+ let originalResult = originalDeleteAction(props), [dialogOpen, setDialogOpen] = useState(!1), router = useRouter(), toast = useToast(), client = useClient({ apiVersion: API_VERSION }), { type, draft, published } = props, config = CONFIG[type];
67
+ return config ? {
68
+ ...originalResult,
69
+ tone: "critical",
70
+ icon: TrashIcon,
71
+ label: "Delete",
72
+ onHandle: () => setDialogOpen(!0),
73
+ dialog: dialogOpen && {
74
+ type: "confirm",
75
+ message: /* @__PURE__ */ jsxs(Stack, {
76
+ gap: 4,
77
+ children: [/* @__PURE__ */ jsx(Text, {
78
+ size: 1,
79
+ children: config.message
80
+ }), /* @__PURE__ */ jsx(Text, {
81
+ size: 1,
82
+ weight: "medium",
83
+ children: "No data on SFCC will be deleted."
84
+ })]
85
+ }),
86
+ onCancel: () => setDialogOpen(!1),
87
+ onConfirm: async () => {
88
+ let transaction = client.transaction();
89
+ if (published?._id && transaction.delete(published._id), draft?._id && transaction.delete(draft._id), type === "product" && published) {
90
+ let store = published.store, variants = typeof store == "object" && store && "variants" in store && Array.isArray(store.variants) ? store.variants : [];
91
+ for (let v of variants) typeof v == "object" && v && "_ref" in v && typeof v._ref == "string" && (transaction.delete(v._ref), transaction.delete(`drafts.${v._ref}`));
92
+ }
93
+ try {
94
+ await transaction.commit(), router.navigateUrl({ path: config.backPath });
95
+ } catch (err) {
96
+ let message = err instanceof Error ? err.message : "Unknown Error";
97
+ toast.push({
98
+ status: "error",
99
+ title: message
100
+ });
101
+ } finally {
102
+ setDialogOpen(!1);
103
+ }
104
+ }
105
+ }
106
+ } : originalResult;
107
+ };
83
108
  }
84
109
  const SfccDocumentStatus = (props) => {
85
- const $ = c(12), {
86
- isDeleted,
87
- imageUrl,
88
- title,
89
- ref
90
- } = props, [imageVisible, setImageVisible] = useState(!0);
91
- let t0;
92
- $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = () => setImageVisible(!1), $[0] = t0) : t0 = $[0];
93
- const handleImageError = t0;
94
- let t1;
95
- $[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t1 = {
96
- alignItems: "center",
97
- borderRadius: "inherit",
98
- display: "flex",
99
- height: "100%",
100
- justifyContent: "center",
101
- overflow: "hidden",
102
- width: "100%"
103
- }, $[1] = t1) : t1 = $[1];
104
- let t2;
105
- $[2] !== imageUrl || $[3] !== imageVisible || $[4] !== title ? (t2 = imageVisible && imageUrl ? /* @__PURE__ */ jsx("img", { onError: handleImageError, src: imageUrl.replace("/large/", "/small/"), style: {
106
- height: "100%",
107
- left: 0,
108
- objectFit: "contain",
109
- position: "absolute",
110
- top: 0,
111
- width: "100%"
112
- }, alt: `${title} preview` }) : /* @__PURE__ */ jsx(ImageIcon, { style: {
113
- position: "absolute"
114
- } }), $[2] = imageUrl, $[3] = imageVisible, $[4] = title, $[5] = t2) : t2 = $[5];
115
- let t3;
116
- $[6] !== isDeleted ? (t3 = isDeleted && /* @__PURE__ */ jsx(CloseIcon, { style: {
117
- background: "rgba(255, 0, 0, 0.7)",
118
- color: "rgba(255, 255, 255, 0.85)",
119
- height: "100%",
120
- position: "relative",
121
- width: "100%"
122
- } }), $[6] = isDeleted, $[7] = t3) : t3 = $[7];
123
- let t4;
124
- return $[8] !== ref || $[9] !== t2 || $[10] !== t3 ? (t4 = /* @__PURE__ */ jsxs("div", { ref, style: t1, children: [
125
- t2,
126
- t3
127
- ] }), $[8] = ref, $[9] = t2, $[10] = t3, $[11] = t4) : t4 = $[11], t4;
110
+ let $ = c(12), { isDeleted, imageUrl, title, ref } = props, [imageVisible, setImageVisible] = useState(!0), t0;
111
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => setImageVisible(!1), $[0] = t0) : t0 = $[0];
112
+ let handleImageError = t0, t1;
113
+ $[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = {
114
+ alignItems: "center",
115
+ borderRadius: "inherit",
116
+ display: "flex",
117
+ height: "100%",
118
+ justifyContent: "center",
119
+ overflow: "hidden",
120
+ width: "100%"
121
+ }, $[1] = t1) : t1 = $[1];
122
+ let t2;
123
+ $[2] !== imageUrl || $[3] !== imageVisible || $[4] !== title ? (t2 = imageVisible && imageUrl ? /* @__PURE__ */ jsx("img", {
124
+ onError: handleImageError,
125
+ src: imageUrl.replace("/large/", "/small/"),
126
+ style: {
127
+ height: "100%",
128
+ left: 0,
129
+ objectFit: "contain",
130
+ position: "absolute",
131
+ top: 0,
132
+ width: "100%"
133
+ },
134
+ alt: `${title} preview`
135
+ }) : /* @__PURE__ */ jsx(ImageIcon, { style: { position: "absolute" } }), $[2] = imageUrl, $[3] = imageVisible, $[4] = title, $[5] = t2) : t2 = $[5];
136
+ let t3;
137
+ $[6] === isDeleted ? t3 = $[7] : (t3 = isDeleted && /* @__PURE__ */ jsx(CloseIcon, { style: {
138
+ background: "rgba(255, 0, 0, 0.7)",
139
+ color: "rgba(255, 255, 255, 0.85)",
140
+ height: "100%",
141
+ position: "relative",
142
+ width: "100%"
143
+ } }), $[6] = isDeleted, $[7] = t3);
144
+ let t4;
145
+ return $[8] !== ref || $[9] !== t2 || $[10] !== t3 ? (t4 = /* @__PURE__ */ jsxs("div", {
146
+ ref,
147
+ style: t1,
148
+ children: [t2, t3]
149
+ }), $[8] = ref, $[9] = t2, $[10] = t3, $[11] = t4) : t4 = $[11], t4;
128
150
  }, sfccCategoryStoreField = defineField({
129
- readOnly: !0,
130
- name: "store",
131
- title: "SFCC Data",
132
- type: "object",
133
- group: "sfcc",
134
- fields: [defineField({
135
- name: "categoryId",
136
- title: "Category ID",
137
- type: "string",
138
- readOnly: !0
139
- }), defineField({
140
- name: "thumbnailImage",
141
- title: "Thumbnail Image",
142
- type: "string",
143
- readOnly: !0
144
- }), defineField({
145
- name: "online",
146
- title: "Online",
147
- type: "boolean",
148
- readOnly: !0
149
- }), defineField({
150
- name: "onlineFrom",
151
- title: "Online From",
152
- type: "date",
153
- readOnly: !0
154
- }), defineField({
155
- name: "onlineTo",
156
- title: "Online To",
157
- type: "date",
158
- readOnly: !0
159
- }), defineField({
160
- name: "creationDate",
161
- title: "Creation Date",
162
- type: "date",
163
- readOnly: !0
164
- }), defineField({
165
- name: "isDeleted",
166
- title: "Is Deleted",
167
- type: "boolean",
168
- readOnly: !0
169
- }), defineField({
170
- name: "parentCategory",
171
- type: "reference",
172
- to: [{
173
- type: "category"
174
- }],
175
- readOnly: !0
176
- }), defineField({
177
- name: "displayName",
178
- title: "Display Name",
179
- type: "internationalizedArrayString",
180
- readOnly: !0
181
- }), defineField({
182
- name: "description",
183
- title: "Description",
184
- type: "internationalizedArrayText",
185
- readOnly: !0
186
- })]
151
+ readOnly: !0,
152
+ name: "store",
153
+ title: "SFCC Data",
154
+ type: "object",
155
+ group: "sfcc",
156
+ fields: [
157
+ defineField({
158
+ name: "categoryId",
159
+ title: "Category ID",
160
+ type: "string",
161
+ readOnly: !0
162
+ }),
163
+ defineField({
164
+ name: "thumbnailImage",
165
+ title: "Thumbnail Image",
166
+ type: "string",
167
+ readOnly: !0
168
+ }),
169
+ defineField({
170
+ name: "online",
171
+ title: "Online",
172
+ type: "boolean",
173
+ readOnly: !0
174
+ }),
175
+ defineField({
176
+ name: "onlineFrom",
177
+ title: "Online From",
178
+ type: "date",
179
+ readOnly: !0
180
+ }),
181
+ defineField({
182
+ name: "onlineTo",
183
+ title: "Online To",
184
+ type: "date",
185
+ readOnly: !0
186
+ }),
187
+ defineField({
188
+ name: "creationDate",
189
+ title: "Creation Date",
190
+ type: "date",
191
+ readOnly: !0
192
+ }),
193
+ defineField({
194
+ name: "isDeleted",
195
+ title: "Is Deleted",
196
+ type: "boolean",
197
+ readOnly: !0
198
+ }),
199
+ defineField({
200
+ name: "parentCategory",
201
+ type: "reference",
202
+ to: [{ type: "category" }],
203
+ readOnly: !0
204
+ }),
205
+ defineField({
206
+ name: "displayName",
207
+ title: "Display Name",
208
+ type: "internationalizedArrayString",
209
+ readOnly: !0
210
+ }),
211
+ defineField({
212
+ name: "description",
213
+ title: "Description",
214
+ type: "internationalizedArrayText",
215
+ readOnly: !0
216
+ })
217
+ ]
187
218
  }), sfccCategoryPreview = {
188
- select: {
189
- imageUrl: "store.thumbnailImage",
190
- isActive: "store.online",
191
- displayName: "store.displayName",
192
- title: "title",
193
- name: "name",
194
- categoryId: "store.categoryId",
195
- parentDisplayName: "store.parentCategory.store.displayName",
196
- parentName: "store.parentCategory.name",
197
- parentId: "store.parentCategory.store.categoryId"
198
- },
199
- prepare({
200
- imageUrl,
201
- displayName,
202
- title,
203
- name,
204
- categoryId,
205
- parentDisplayName,
206
- parentName,
207
- parentId,
208
- isActive
209
- }) {
210
- const displayTitle = title || name || displayName?.[0]?.value || categoryId || "Untitled Category", parentLabel = parentId !== "root" && (parentName || parentDisplayName?.[0]?.value || parentId);
211
- return {
212
- title: displayTitle,
213
- subtitle: parentLabel ? `Parent: ${parentLabel}` : "",
214
- media: /* @__PURE__ */ jsx(SfccDocumentStatus, { isDeleted: !isActive, imageUrl: imageUrl ?? "", title: displayTitle })
215
- };
216
- }
219
+ select: {
220
+ imageUrl: "store.thumbnailImage",
221
+ isActive: "store.online",
222
+ displayName: "store.displayName",
223
+ title: "title",
224
+ name: "name",
225
+ categoryId: "store.categoryId",
226
+ parentDisplayName: "store.parentCategory.store.displayName",
227
+ parentName: "store.parentCategory.name",
228
+ parentId: "store.parentCategory.store.categoryId"
229
+ },
230
+ prepare({ imageUrl, displayName, title, name, categoryId, parentDisplayName, parentName, parentId, isActive }) {
231
+ let displayTitle = title || name || displayName?.[0]?.value || categoryId || "Untitled Category", parentLabel = parentId !== "root" && (parentName || parentDisplayName?.[0]?.value || parentId);
232
+ return {
233
+ title: displayTitle,
234
+ subtitle: parentLabel ? `Parent: ${parentLabel}` : "",
235
+ media: /* @__PURE__ */ jsx(SfccDocumentStatus, {
236
+ isDeleted: !isActive,
237
+ imageUrl: imageUrl ?? "",
238
+ title: displayTitle
239
+ })
240
+ };
241
+ }
217
242
  }, sfccProductStoreField = defineField({
218
- readOnly: !0,
219
- name: "store",
220
- title: "SFCC Data",
221
- type: "object",
222
- group: "sfcc",
223
- fields: [defineField({
224
- name: "productId",
225
- title: "Product ID",
226
- type: "string",
227
- readOnly: !0
228
- }), defineField({
229
- name: "brand",
230
- title: "Brand",
231
- type: "string",
232
- readOnly: !0
233
- }), defineField({
234
- name: "color",
235
- title: "Color",
236
- type: "string",
237
- readOnly: !0
238
- }), defineField({
239
- name: "size",
240
- title: "Size",
241
- type: "string",
242
- readOnly: !0
243
- }), defineField({
244
- name: "width",
245
- title: "Width",
246
- type: "string",
247
- readOnly: !0
248
- }), defineField({
249
- name: "productType",
250
- title: "Product Type",
251
- type: "string",
252
- readOnly: !0
253
- }), defineField({
254
- name: "styleNumber",
255
- title: "Style Number",
256
- type: "string",
257
- readOnly: !0
258
- }), defineField({
259
- name: "searchable",
260
- title: "Searchable",
261
- type: "boolean",
262
- readOnly: !0
263
- }), defineField({
264
- name: "isSale",
265
- title: "On Sale?",
266
- type: "boolean",
267
- readOnly: !0
268
- }), defineField({
269
- name: "isNew",
270
- title: "New Arrival?",
271
- type: "boolean",
272
- readOnly: !0
273
- }), defineField({
274
- name: "manufacturerName",
275
- title: "Manufacturer",
276
- type: "string",
277
- readOnly: !0
278
- }), defineField({
279
- name: "manufacturerSKU",
280
- title: "Manufacturer Product ID",
281
- type: "string",
282
- readOnly: !0
283
- }), defineField({
284
- name: "creationDate",
285
- title: "Creation Date",
286
- type: "datetime",
287
- readOnly: !0
288
- }), defineField({
289
- name: "lastModified",
290
- title: "Last Modified",
291
- type: "datetime",
292
- readOnly: !0
293
- }), defineField({
294
- name: "onlineFlag",
295
- title: "Online",
296
- type: "boolean",
297
- readOnly: !0
298
- }), defineField({
299
- name: "onlineFrom",
300
- title: "Online From",
301
- type: "datetime",
302
- readOnly: !0
303
- }), defineField({
304
- name: "onlineTo",
305
- title: "Online To",
306
- type: "datetime",
307
- readOnly: !0
308
- }), defineField({
309
- name: "length",
310
- title: "Length",
311
- type: "string",
312
- readOnly: !0
313
- }), defineField({
314
- name: "memorySize",
315
- title: "Memory Size",
316
- type: "string",
317
- readOnly: !0
318
- }), defineField({
319
- name: "tvSize",
320
- title: "TV Size",
321
- type: "string",
322
- readOnly: !0
323
- }), defineField({
324
- name: "tvType",
325
- title: "TV Type",
326
- type: "array",
327
- of: [{
328
- type: "string"
329
- }],
330
- readOnly: !0
331
- }), defineField({
332
- name: "productImage",
333
- title: "Product Image",
334
- type: "string",
335
- readOnly: !0
336
- }), defineField({
337
- name: "refinementColor",
338
- title: "Refinement Color",
339
- type: "string",
340
- readOnly: !0
341
- }), defineField({
342
- name: "variants",
343
- title: "Variants",
344
- type: "array",
345
- of: [{
346
- type: "reference",
347
- to: [{
348
- type: "product"
349
- }],
350
- weak: !0
351
- }],
352
- readOnly: !0
353
- }), defineField({
354
- name: "variationAttributes",
355
- title: "Variation Attributes",
356
- type: "array",
357
- of: [{
358
- type: "string"
359
- }],
360
- readOnly: !0
361
- }), defineField({
362
- name: "isDeleted",
363
- title: "Is Deleted",
364
- type: "boolean"
365
- }), defineField({
366
- name: "name",
367
- title: "Name",
368
- type: "internationalizedArrayString",
369
- readOnly: !0
370
- }), defineField({
371
- name: "longDescription",
372
- title: "Long Description",
373
- type: "internationalizedArrayText",
374
- readOnly: !0
375
- }), defineField({
376
- name: "shortDescription",
377
- title: "Short Description",
378
- type: "internationalizedArrayText",
379
- readOnly: !0
380
- }), defineField({
381
- name: "pageTitle",
382
- title: "Page Title",
383
- type: "internationalizedArrayString",
384
- readOnly: !0
385
- }), defineField({
386
- name: "pageDescription",
387
- title: "Page Description",
388
- type: "internationalizedArrayString",
389
- readOnly: !0
390
- }), defineField({
391
- name: "pageKeywords",
392
- title: "Page Keywords",
393
- type: "internationalizedArrayString",
394
- readOnly: !0
395
- }), defineField({
396
- name: "pageURL",
397
- title: "Page URL",
398
- type: "internationalizedArrayString",
399
- readOnly: !0
400
- })]
243
+ readOnly: !0,
244
+ name: "store",
245
+ title: "SFCC Data",
246
+ type: "object",
247
+ group: "sfcc",
248
+ fields: [
249
+ defineField({
250
+ name: "productId",
251
+ title: "Product ID",
252
+ type: "string",
253
+ readOnly: !0
254
+ }),
255
+ defineField({
256
+ name: "brand",
257
+ title: "Brand",
258
+ type: "string",
259
+ readOnly: !0
260
+ }),
261
+ defineField({
262
+ name: "color",
263
+ title: "Color",
264
+ type: "string",
265
+ readOnly: !0
266
+ }),
267
+ defineField({
268
+ name: "size",
269
+ title: "Size",
270
+ type: "string",
271
+ readOnly: !0
272
+ }),
273
+ defineField({
274
+ name: "width",
275
+ title: "Width",
276
+ type: "string",
277
+ readOnly: !0
278
+ }),
279
+ defineField({
280
+ name: "productType",
281
+ title: "Product Type",
282
+ type: "string",
283
+ readOnly: !0
284
+ }),
285
+ defineField({
286
+ name: "styleNumber",
287
+ title: "Style Number",
288
+ type: "string",
289
+ readOnly: !0
290
+ }),
291
+ defineField({
292
+ name: "searchable",
293
+ title: "Searchable",
294
+ type: "boolean",
295
+ readOnly: !0
296
+ }),
297
+ defineField({
298
+ name: "isSale",
299
+ title: "On Sale?",
300
+ type: "boolean",
301
+ readOnly: !0
302
+ }),
303
+ defineField({
304
+ name: "isNew",
305
+ title: "New Arrival?",
306
+ type: "boolean",
307
+ readOnly: !0
308
+ }),
309
+ defineField({
310
+ name: "manufacturerName",
311
+ title: "Manufacturer",
312
+ type: "string",
313
+ readOnly: !0
314
+ }),
315
+ defineField({
316
+ name: "manufacturerSKU",
317
+ title: "Manufacturer Product ID",
318
+ type: "string",
319
+ readOnly: !0
320
+ }),
321
+ defineField({
322
+ name: "creationDate",
323
+ title: "Creation Date",
324
+ type: "datetime",
325
+ readOnly: !0
326
+ }),
327
+ defineField({
328
+ name: "lastModified",
329
+ title: "Last Modified",
330
+ type: "datetime",
331
+ readOnly: !0
332
+ }),
333
+ defineField({
334
+ name: "onlineFlag",
335
+ title: "Online",
336
+ type: "boolean",
337
+ readOnly: !0
338
+ }),
339
+ defineField({
340
+ name: "onlineFrom",
341
+ title: "Online From",
342
+ type: "datetime",
343
+ readOnly: !0
344
+ }),
345
+ defineField({
346
+ name: "onlineTo",
347
+ title: "Online To",
348
+ type: "datetime",
349
+ readOnly: !0
350
+ }),
351
+ defineField({
352
+ name: "length",
353
+ title: "Length",
354
+ type: "string",
355
+ readOnly: !0
356
+ }),
357
+ defineField({
358
+ name: "memorySize",
359
+ title: "Memory Size",
360
+ type: "string",
361
+ readOnly: !0
362
+ }),
363
+ defineField({
364
+ name: "tvSize",
365
+ title: "TV Size",
366
+ type: "string",
367
+ readOnly: !0
368
+ }),
369
+ defineField({
370
+ name: "tvType",
371
+ title: "TV Type",
372
+ type: "array",
373
+ of: [{ type: "string" }],
374
+ readOnly: !0
375
+ }),
376
+ defineField({
377
+ name: "productImage",
378
+ title: "Product Image",
379
+ type: "string",
380
+ readOnly: !0
381
+ }),
382
+ defineField({
383
+ name: "refinementColor",
384
+ title: "Refinement Color",
385
+ type: "string",
386
+ readOnly: !0
387
+ }),
388
+ defineField({
389
+ name: "variants",
390
+ title: "Variants",
391
+ type: "array",
392
+ of: [{
393
+ type: "reference",
394
+ to: [{ type: "product" }],
395
+ weak: !0
396
+ }],
397
+ readOnly: !0
398
+ }),
399
+ defineField({
400
+ name: "variationAttributes",
401
+ title: "Variation Attributes",
402
+ type: "array",
403
+ of: [{ type: "string" }],
404
+ readOnly: !0
405
+ }),
406
+ defineField({
407
+ name: "isDeleted",
408
+ title: "Is Deleted",
409
+ type: "boolean"
410
+ }),
411
+ defineField({
412
+ name: "name",
413
+ title: "Name",
414
+ type: "internationalizedArrayString",
415
+ readOnly: !0
416
+ }),
417
+ defineField({
418
+ name: "longDescription",
419
+ title: "Long Description",
420
+ type: "internationalizedArrayText",
421
+ readOnly: !0
422
+ }),
423
+ defineField({
424
+ name: "shortDescription",
425
+ title: "Short Description",
426
+ type: "internationalizedArrayText",
427
+ readOnly: !0
428
+ }),
429
+ defineField({
430
+ name: "pageTitle",
431
+ title: "Page Title",
432
+ type: "internationalizedArrayString",
433
+ readOnly: !0
434
+ }),
435
+ defineField({
436
+ name: "pageDescription",
437
+ title: "Page Description",
438
+ type: "internationalizedArrayString",
439
+ readOnly: !0
440
+ }),
441
+ defineField({
442
+ name: "pageKeywords",
443
+ title: "Page Keywords",
444
+ type: "internationalizedArrayString",
445
+ readOnly: !0
446
+ }),
447
+ defineField({
448
+ name: "pageURL",
449
+ title: "Page URL",
450
+ type: "internationalizedArrayString",
451
+ readOnly: !0
452
+ })
453
+ ]
401
454
  }), VARIATION_ATTRIBUTE_MAP = {
402
- color: {
403
- label: "Color",
404
- storeKey: "color"
405
- },
406
- size: {
407
- label: "Size",
408
- storeKey: "size"
409
- },
410
- memorySize: {
411
- label: "Memory Size",
412
- storeKey: "memorySize"
413
- },
414
- tvSize: {
415
- label: "TV Size",
416
- storeKey: "tvSize"
417
- }
455
+ color: {
456
+ label: "Color",
457
+ storeKey: "color"
458
+ },
459
+ size: {
460
+ label: "Size",
461
+ storeKey: "size"
462
+ },
463
+ memorySize: {
464
+ label: "Memory Size",
465
+ storeKey: "memorySize"
466
+ },
467
+ tvSize: {
468
+ label: "TV Size",
469
+ storeKey: "tvSize"
470
+ }
418
471
  }, sfccProductPreview = {
419
- select: {
420
- name: "store.name",
421
- id: "store.productId",
422
- productType: "store.productType",
423
- variationAttributes: "store.variationAttributes",
424
- color: "store.color",
425
- size: "store.size",
426
- memorySize: "store.memorySize",
427
- tvSize: "store.tvSize",
428
- productImage: "store.productImage",
429
- isActive: "store.onlineFlag"
430
- },
431
- prepare(selection) {
432
- const {
433
- name,
434
- id,
435
- productType,
436
- variationAttributes,
437
- productImage,
438
- isActive,
439
- ...attrValues
440
- } = selection, title = name?.[0]?.value || id || "Untitled Product", meta = [];
441
- if (productType && productType !== "Variant" && meta.push(productType), variationAttributes?.length)
442
- for (const attr of variationAttributes) {
443
- const mapped = VARIATION_ATTRIBUTE_MAP[attr], value = mapped && attrValues[mapped.storeKey];
444
- mapped && value && meta.push(`${mapped.label}: ${value}`);
445
- }
446
- else
447
- for (const [, {
448
- label,
449
- storeKey
450
- }] of Object.entries(VARIATION_ATTRIBUTE_MAP)) {
451
- const value = attrValues[storeKey];
452
- value && meta.push(`${label}: ${value}`);
453
- }
454
- return {
455
- title,
456
- subtitle: meta.join(" | "),
457
- media: /* @__PURE__ */ jsx(SfccDocumentStatus, { isDeleted: !isActive, imageUrl: productImage ?? "", title })
458
- };
459
- }
460
- }, categoryStructure = (S) => S.listItem().title("Categories").schemaType("category").child(S.documentTypeList("category")), productStructure = (S, context) => {
461
- const client = context.getClient({
462
- apiVersion: API_VERSION
463
- });
464
- return S.listItem().title("Products").schemaType("product").child(S.documentList().title("Products").schemaType("product").filter('_type == "product" && store.productType in ["Master", "Simple"]').apiVersion(API_VERSION).child(async (productId) => {
465
- const product = await client.fetch("*[_id == $id][0]{store}", {
466
- id: productId
467
- });
468
- if (product?.store?.productType === "Master") {
469
- const variantRefs = product.store.variants?.map((v) => v._ref) ?? [];
470
- return S.list().title("Product").items([S.documentListItem().id(productId).schemaType("product"), S.divider().title("Variants"), ...variantRefs.map((ref) => S.documentListItem().id(ref).schemaType("product"))]);
471
- }
472
- return S.document().documentId(productId).schemaType("product");
473
- }));
474
- };
472
+ select: {
473
+ name: "store.name",
474
+ id: "store.productId",
475
+ productType: "store.productType",
476
+ variationAttributes: "store.variationAttributes",
477
+ color: "store.color",
478
+ size: "store.size",
479
+ memorySize: "store.memorySize",
480
+ tvSize: "store.tvSize",
481
+ productImage: "store.productImage",
482
+ isActive: "store.onlineFlag"
483
+ },
484
+ prepare(selection) {
485
+ let { name, id, productType, variationAttributes, productImage, isActive, ...attrValues } = selection, title = name?.[0]?.value || id || "Untitled Product", meta = [];
486
+ if (productType && productType !== "Variant" && meta.push(productType), variationAttributes?.length) for (let attr of variationAttributes) {
487
+ let mapped = VARIATION_ATTRIBUTE_MAP[attr], value = mapped && attrValues[mapped.storeKey];
488
+ mapped && value && meta.push(`${mapped.label}: ${value}`);
489
+ }
490
+ else for (let [, { label, storeKey }] of Object.entries(VARIATION_ATTRIBUTE_MAP)) {
491
+ let value = attrValues[storeKey];
492
+ value && meta.push(`${label}: ${value}`);
493
+ }
494
+ return {
495
+ title,
496
+ subtitle: meta.join(" | "),
497
+ media: /* @__PURE__ */ jsx(SfccDocumentStatus, {
498
+ isDeleted: !isActive,
499
+ imageUrl: productImage ?? "",
500
+ title
501
+ })
502
+ };
503
+ }
504
+ }, categoryStructure = defineStructure((S) => S.listItem().title("Categories").schemaType("category").child(S.documentTypeList("category"))), productStructure = defineStructure((S, context) => {
505
+ let client = context.getClient({ apiVersion: API_VERSION });
506
+ return S.listItem().title("Products").schemaType("product").child(S.documentList().title("Products").schemaType("product").filter("_type == \"product\" && store.productType in [\"Master\", \"Simple\"]").apiVersion(API_VERSION).child(async (productId) => {
507
+ let product = await client.fetch("*[_id == $id][0]{store}", { id: productId });
508
+ if (product?.store?.productType === "Master") {
509
+ let variantRefs = product.store.variants?.map((v) => v._ref) ?? [];
510
+ return S.list().title("Product").items([
511
+ S.documentListItem().id(productId).schemaType("product"),
512
+ S.divider().title("Variants"),
513
+ ...variantRefs.map((ref) => S.documentListItem().id(ref).schemaType("product"))
514
+ ]);
515
+ }
516
+ return S.document().documentId(productId).schemaType("product");
517
+ }));
518
+ });
519
+ /**
520
+ * Helper for creating and typing composable structure parts.
521
+ */
522
+ function defineStructure(factory) {
523
+ return factory;
524
+ }
525
+ /**
526
+ * `renderMembers` callback that injects a caution banner at the top of the
527
+ * document form when the SFCC document is offline or deleted.
528
+ *
529
+ * Usage: add `renderMembers: sfccRenderMembers` to your `defineType` call.
530
+ */
475
531
  const sfccRenderMembers = (members) => [{
476
- key: "sfcc-offline-banner",
477
- kind: "decoration",
478
- component: SfccOfflineBanner
532
+ key: "sfcc-offline-banner",
533
+ kind: "decoration",
534
+ component: SfccOfflineBanner
479
535
  }, ...members], SFCC_TYPES = /* @__PURE__ */ new Set(["product", "category"]), sfccPlugin = definePlugin(() => ({
480
- name: "sfcc",
481
- document: {
482
- actions: (prev, context) => SFCC_TYPES.has(context.schemaType) ? prev.filter((action) => action.action !== "duplicate").map((action) => action.action === "delete" ? createSfccDeleteAction(action) : action) : prev,
483
- newDocumentOptions: (prev) => prev.filter((template) => !SFCC_TYPES.has(template.templateId))
484
- }
536
+ name: "sfcc",
537
+ document: {
538
+ actions: (prev, context) => SFCC_TYPES.has(context.schemaType) ? prev.filter((action) => action.action !== "duplicate").map((action) => action.action === "delete" ? createSfccDeleteAction(action) : action) : prev,
539
+ newDocumentOptions: (prev) => prev.filter((template) => !SFCC_TYPES.has(template.templateId))
540
+ }
485
541
  }));
486
- export {
487
- SfccDocumentStatus,
488
- SfccOfflineBanner,
489
- categoryStructure,
490
- productStructure,
491
- sfccCategoryPreview,
492
- sfccCategoryStoreField,
493
- sfccPlugin,
494
- sfccProductPreview,
495
- sfccProductStoreField,
496
- sfccRenderMembers
497
- };
498
- //# sourceMappingURL=index.js.map
542
+ export { SfccDocumentStatus, SfccOfflineBanner, categoryStructure, productStructure, sfccCategoryPreview, sfccCategoryStoreField, sfccPlugin, sfccProductPreview, sfccProductStoreField, sfccRenderMembers };
543
+
544
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/components/SfccOfflineBanner.tsx","../src/constants.ts","../src/documentActions/sfccDelete.tsx","../src/components/SfccDocumentStatus.tsx","../src/schemas/category.tsx","../src/schemas/product.tsx","../src/structure/categoryStructure.ts","../src/structure/productStructure.ts","../src/index.ts"],"sourcesContent":["import {WarningOutlineIcon} from '@sanity/icons/WarningOutline'\nimport {Card, Flex, Text} from '@sanity/ui'\nimport {useFormValue} from 'sanity'\n\n/**\n * Decorative banner injected via `renderMembers` that warns editors when a\n * product or category is offline in SFCC.\n *\n * Reads `store.onlineFlag` (products) and `store.online` (categories) via\n * `useFormValue` so it works without props.\n */\nexport function SfccOfflineBanner() {\n const onlineFlagRaw = useFormValue(['store', 'onlineFlag'])\n const onlineRaw = useFormValue(['store', 'online'])\n\n const onlineFlag = typeof onlineFlagRaw === 'boolean' ? onlineFlagRaw : undefined\n const online = typeof onlineRaw === 'boolean' ? onlineRaw : undefined\n const isOnline = onlineFlag ?? online\n\n if (isOnline !== false) return null\n\n return (\n <Card padding={4} radius={2} shadow={1} tone=\"caution\">\n <Flex align=\"center\" gap={3}>\n <Text size={2}>\n <WarningOutlineIcon />\n </Text>\n <Text size={1} weight=\"medium\">\n This document is currently offline in SFCC.\n </Text>\n </Flex>\n </Card>\n )\n}\n","export const API_VERSION = '2026-02-24'\n","import {TrashIcon} from '@sanity/icons/Trash'\nimport {Stack, Text, useToast} from '@sanity/ui'\nimport {useState} from 'react'\nimport {type DocumentActionComponent, useClient} from 'sanity'\nimport {useRouter} from 'sanity/router'\n\nimport {API_VERSION} from '../constants'\n\nconst CONFIG: Record<string, {message: string; backPath: string}> = {\n product: {\n message: 'Delete the current product and all associated variants in your dataset?',\n backPath: '/structure/products',\n },\n category: {\n message: 'Delete the current category from your dataset?',\n backPath: '/structure/categories',\n },\n}\n\n/**\n * Wraps the built-in delete action for SFCC-synced documents.\n *\n * - **Products**: deletes the product *and* all associated variants\n * (resolved from `store.variants[]._ref`) in a single transaction,\n * then navigates back to the products list.\n * - **Categories**: deletes the category with a confirmation warning,\n * then navigates back to the categories list.\n */\nexport function createSfccDeleteAction(\n originalDeleteAction: DocumentActionComponent,\n): DocumentActionComponent {\n return function SfccDeleteAction(props) {\n const originalResult = originalDeleteAction(props)\n\n const [dialogOpen, setDialogOpen] = useState(false)\n const router = useRouter()\n const toast = useToast()\n const client = useClient({apiVersion: API_VERSION})\n\n const {type, draft, published} = props\n const config = CONFIG[type]\n\n if (!config) return originalResult\n\n return {\n ...originalResult,\n tone: 'critical',\n icon: TrashIcon,\n label: 'Delete',\n onHandle: () => setDialogOpen(true),\n dialog: dialogOpen && {\n type: 'confirm',\n message: (\n <Stack gap={4}>\n <Text size={1}>{config.message}</Text>\n <Text size={1} weight=\"medium\">\n No data on SFCC will be deleted.\n </Text>\n </Stack>\n ),\n onCancel: () => setDialogOpen(false),\n onConfirm: async () => {\n const transaction = client.transaction()\n if (published?._id) transaction.delete(published._id)\n if (draft?._id) transaction.delete(draft._id)\n\n if (type === 'product' && published) {\n const store = published['store']\n const variants =\n store != null &&\n typeof store === 'object' &&\n 'variants' in store &&\n Array.isArray(store.variants)\n ? store.variants\n : []\n for (const v of variants) {\n if (v != null && typeof v === 'object' && '_ref' in v && typeof v._ref === 'string') {\n transaction.delete(v._ref)\n transaction.delete(`drafts.${v._ref}`)\n }\n }\n }\n\n try {\n await transaction.commit()\n router.navigateUrl({path: config.backPath})\n } catch (err) {\n const message = err instanceof Error ? err.message : 'Unknown Error'\n toast.push({status: 'error', title: message})\n } finally {\n setDialogOpen(false)\n }\n },\n },\n }\n }\n}\n","import {CloseIcon} from '@sanity/icons/Close'\nimport {ImageIcon} from '@sanity/icons/Image'\nimport {type Ref, useState} from 'react'\n\ntype Props = {\n isDeleted: boolean\n imageUrl: string\n title: string\n ref?: Ref<HTMLDivElement>\n}\n\nconst SfccDocumentStatus = (props: Props) => {\n const {isDeleted, imageUrl, title, ref} = props\n\n const [imageVisible, setImageVisible] = useState(true)\n\n const handleImageError = () => setImageVisible(false)\n\n return (\n <div\n ref={ref}\n style={{\n alignItems: 'center',\n borderRadius: 'inherit',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n overflow: 'hidden',\n width: '100%',\n }}\n >\n {imageVisible && imageUrl ? (\n <img\n onError={handleImageError}\n src={imageUrl.replace('/large/', '/small/')}\n style={{\n height: '100%',\n left: 0,\n objectFit: 'contain',\n position: 'absolute',\n top: 0,\n width: '100%',\n }}\n alt={`${title} preview`}\n />\n ) : (\n <ImageIcon style={{position: 'absolute'}} />\n )}\n\n {isDeleted && (\n <CloseIcon\n style={{\n background: 'rgba(255, 0, 0, 0.7)',\n color: 'rgba(255, 255, 255, 0.85)',\n height: '100%',\n position: 'relative',\n width: '100%',\n }}\n />\n )}\n </div>\n )\n}\n\nexport {SfccDocumentStatus}\n","import {defineField} from 'sanity'\n\nimport {SfccDocumentStatus} from '../components/SfccDocumentStatus'\n\n/**\n * SFCC category store field — contains all read-only data synced from\n * Salesforce Commerce Cloud. Add this to a `category` document type's\n * `fields` array alongside your own custom fields.\n *\n * The field is placed in the `sfcc` group; make sure the document type\n * declares that group.\n */\nexport const sfccCategoryStoreField = defineField({\n readOnly: true,\n name: 'store',\n title: 'SFCC Data',\n type: 'object',\n group: 'sfcc',\n fields: [\n defineField({name: 'categoryId', title: 'Category ID', type: 'string', readOnly: true}),\n defineField({\n name: 'thumbnailImage',\n title: 'Thumbnail Image',\n type: 'string',\n readOnly: true,\n }),\n defineField({name: 'online', title: 'Online', type: 'boolean', readOnly: true}),\n defineField({name: 'onlineFrom', title: 'Online From', type: 'date', readOnly: true}),\n defineField({name: 'onlineTo', title: 'Online To', type: 'date', readOnly: true}),\n defineField({name: 'creationDate', title: 'Creation Date', type: 'date', readOnly: true}),\n defineField({name: 'isDeleted', title: 'Is Deleted', type: 'boolean', readOnly: true}),\n defineField({\n name: 'parentCategory',\n type: 'reference',\n to: [{type: 'category'}],\n readOnly: true,\n }),\n defineField({\n name: 'displayName',\n title: 'Display Name',\n type: 'internationalizedArrayString',\n readOnly: true,\n }),\n defineField({\n name: 'description',\n title: 'Description',\n type: 'internationalizedArrayText',\n readOnly: true,\n }),\n ],\n})\n\n/**\n * Default preview configuration for the `category` document type.\n * Shows Category Name with parent category as subtitle.\n */\nexport const sfccCategoryPreview = {\n select: {\n imageUrl: 'store.thumbnailImage',\n isActive: 'store.online',\n displayName: 'store.displayName',\n title: 'title',\n name: 'name',\n categoryId: 'store.categoryId',\n parentDisplayName: 'store.parentCategory.store.displayName',\n parentName: 'store.parentCategory.name',\n parentId: 'store.parentCategory.store.categoryId',\n },\n prepare({\n imageUrl,\n displayName,\n title,\n name,\n categoryId,\n parentDisplayName,\n parentName,\n parentId,\n isActive,\n }: {\n imageUrl?: string\n displayName?: {value: string}[]\n title?: string\n name?: string\n categoryId?: string\n parentDisplayName?: {value: string}[]\n parentName?: string\n parentId?: string\n isActive?: boolean\n }) {\n const displayTitle =\n title || name || displayName?.[0]?.value || categoryId || 'Untitled Category'\n\n const isRoot = parentId === 'root'\n const parentLabel = !isRoot && (parentName || parentDisplayName?.[0]?.value || parentId)\n\n return {\n title: displayTitle,\n subtitle: parentLabel ? `Parent: ${parentLabel}` : '',\n media: (\n <SfccDocumentStatus isDeleted={!isActive} imageUrl={imageUrl ?? ''} title={displayTitle} />\n ),\n }\n },\n}\n","import {defineField} from 'sanity'\n\nimport {SfccDocumentStatus} from '../components/SfccDocumentStatus'\n\n/**\n * SFCC product store field — contains all read-only data synced from\n * Salesforce Commerce Cloud. Add this to a `product` document type's\n * `fields` array alongside your own custom fields.\n *\n * The field is placed in the `sfcc` group; make sure the document type\n * declares that group.\n */\nexport const sfccProductStoreField = defineField({\n readOnly: true,\n name: 'store',\n title: 'SFCC Data',\n type: 'object',\n group: 'sfcc',\n fields: [\n defineField({name: 'productId', title: 'Product ID', type: 'string', readOnly: true}),\n defineField({name: 'brand', title: 'Brand', type: 'string', readOnly: true}),\n defineField({name: 'color', title: 'Color', type: 'string', readOnly: true}),\n defineField({name: 'size', title: 'Size', type: 'string', readOnly: true}),\n defineField({name: 'width', title: 'Width', type: 'string', readOnly: true}),\n defineField({name: 'productType', title: 'Product Type', type: 'string', readOnly: true}),\n defineField({name: 'styleNumber', title: 'Style Number', type: 'string', readOnly: true}),\n defineField({name: 'searchable', title: 'Searchable', type: 'boolean', readOnly: true}),\n defineField({name: 'isSale', title: 'On Sale?', type: 'boolean', readOnly: true}),\n defineField({name: 'isNew', title: 'New Arrival?', type: 'boolean', readOnly: true}),\n defineField({\n name: 'manufacturerName',\n title: 'Manufacturer',\n type: 'string',\n readOnly: true,\n }),\n defineField({\n name: 'manufacturerSKU',\n title: 'Manufacturer Product ID',\n type: 'string',\n readOnly: true,\n }),\n defineField({\n name: 'creationDate',\n title: 'Creation Date',\n type: 'datetime',\n readOnly: true,\n }),\n defineField({\n name: 'lastModified',\n title: 'Last Modified',\n type: 'datetime',\n readOnly: true,\n }),\n defineField({name: 'onlineFlag', title: 'Online', type: 'boolean', readOnly: true}),\n defineField({name: 'onlineFrom', title: 'Online From', type: 'datetime', readOnly: true}),\n defineField({name: 'onlineTo', title: 'Online To', type: 'datetime', readOnly: true}),\n defineField({name: 'length', title: 'Length', type: 'string', readOnly: true}),\n defineField({name: 'memorySize', title: 'Memory Size', type: 'string', readOnly: true}),\n defineField({name: 'tvSize', title: 'TV Size', type: 'string', readOnly: true}),\n defineField({\n name: 'tvType',\n title: 'TV Type',\n type: 'array',\n of: [{type: 'string'}],\n readOnly: true,\n }),\n defineField({\n name: 'productImage',\n title: 'Product Image',\n type: 'string',\n readOnly: true,\n }),\n defineField({\n name: 'refinementColor',\n title: 'Refinement Color',\n type: 'string',\n readOnly: true,\n }),\n defineField({\n name: 'variants',\n title: 'Variants',\n type: 'array',\n of: [{type: 'reference', to: [{type: 'product'}], weak: true}],\n readOnly: true,\n }),\n defineField({\n name: 'variationAttributes',\n title: 'Variation Attributes',\n type: 'array',\n of: [{type: 'string'}],\n readOnly: true,\n }),\n defineField({name: 'isDeleted', title: 'Is Deleted', type: 'boolean'}),\n defineField({\n name: 'name',\n title: 'Name',\n type: 'internationalizedArrayString',\n readOnly: true,\n }),\n defineField({\n name: 'longDescription',\n title: 'Long Description',\n type: 'internationalizedArrayText',\n readOnly: true,\n }),\n defineField({\n name: 'shortDescription',\n title: 'Short Description',\n type: 'internationalizedArrayText',\n readOnly: true,\n }),\n defineField({\n name: 'pageTitle',\n title: 'Page Title',\n type: 'internationalizedArrayString',\n readOnly: true,\n }),\n defineField({\n name: 'pageDescription',\n title: 'Page Description',\n type: 'internationalizedArrayString',\n readOnly: true,\n }),\n defineField({\n name: 'pageKeywords',\n title: 'Page Keywords',\n type: 'internationalizedArrayString',\n readOnly: true,\n }),\n defineField({\n name: 'pageURL',\n title: 'Page URL',\n type: 'internationalizedArrayString',\n readOnly: true,\n }),\n ],\n})\n\ntype VariationAttrKey = 'color' | 'size' | 'memorySize' | 'tvSize'\n\n/**\n * Maps SFCC variation attribute IDs to their store field keys and display labels.\n */\nconst VARIATION_ATTRIBUTE_MAP: Record<string, {label: string; storeKey: VariationAttrKey}> = {\n color: {label: 'Color', storeKey: 'color'},\n size: {label: 'Size', storeKey: 'size'},\n memorySize: {label: 'Memory Size', storeKey: 'memorySize'},\n tvSize: {label: 'TV Size', storeKey: 'tvSize'},\n}\n\n/**\n * Default preview configuration for the `product` document type.\n * Shows product type for Master/Simple, and the relevant variation\n * attributes (driven by `store.variationAttributes`) for all products.\n */\nexport const sfccProductPreview = {\n select: {\n name: 'store.name',\n id: 'store.productId',\n productType: 'store.productType',\n variationAttributes: 'store.variationAttributes',\n color: 'store.color',\n size: 'store.size',\n memorySize: 'store.memorySize',\n tvSize: 'store.tvSize',\n productImage: 'store.productImage',\n isActive: 'store.onlineFlag',\n },\n prepare(selection: {\n name?: {value: string}[]\n id?: string\n productType?: string\n variationAttributes?: string[]\n color?: string\n size?: string\n memorySize?: string\n tvSize?: string\n productImage?: string\n isActive?: boolean\n }) {\n const {name, id, productType, variationAttributes, productImage, isActive, ...attrValues} =\n selection\n\n const title = name?.[0]?.value || id || 'Untitled Product'\n const meta: string[] = []\n if (productType && productType !== 'Variant') meta.push(productType)\n\n if (variationAttributes?.length) {\n for (const attr of variationAttributes) {\n const mapped = VARIATION_ATTRIBUTE_MAP[attr]\n const value = mapped && attrValues[mapped.storeKey]\n if (mapped && value) meta.push(`${mapped.label}: ${value}`)\n }\n } else {\n for (const [, {label, storeKey}] of Object.entries(VARIATION_ATTRIBUTE_MAP)) {\n const value = attrValues[storeKey]\n if (value) meta.push(`${label}: ${value}`)\n }\n }\n\n return {\n title,\n subtitle: meta.join(' | '),\n media: (\n <SfccDocumentStatus isDeleted={!isActive} imageUrl={productImage ?? ''} title={title} />\n ),\n }\n },\n}\n","import {defineStructure} from './index'\n\nexport const categoryStructure = defineStructure((S) =>\n S.listItem().title('Categories').schemaType('category').child(S.documentTypeList('category')),\n)\n","import {API_VERSION} from '../constants'\nimport {defineStructure} from './index'\n\nexport const productStructure = defineStructure((S, context) => {\n const client = context.getClient({apiVersion: API_VERSION})\n\n return S.listItem()\n .title('Products')\n .schemaType('product')\n .child(\n S.documentList()\n .title('Products')\n .schemaType('product')\n .filter('_type == \"product\" && store.productType in [\"Master\", \"Simple\"]')\n .apiVersion(API_VERSION)\n .child(async (productId) => {\n const product = await client.fetch('*[_id == $id][0]{store}', {id: productId})\n\n if (product?.store?.productType === 'Master') {\n const variantRefs: string[] =\n product.store.variants?.map((v: {_ref: string}) => v._ref) ?? []\n\n return S.list()\n .title('Product')\n .items([\n S.documentListItem().id(productId).schemaType('product'),\n S.divider().title('Variants'),\n ...variantRefs.map((ref) => S.documentListItem().id(ref).schemaType('product')),\n ])\n }\n\n return S.document().documentId(productId).schemaType('product')\n }),\n )\n})\n","import {type DecorationMember, definePlugin, type ObjectMember} from 'sanity'\n\nimport {SfccOfflineBanner} from './components/SfccOfflineBanner'\nimport {createSfccDeleteAction} from './documentActions/sfccDelete'\n\n// Schema building blocks\nexport {sfccCategoryPreview, sfccCategoryStoreField} from './schemas/category'\nexport {sfccProductPreview, sfccProductStoreField} from './schemas/product'\n\n// Structure builders\nexport {categoryStructure, productStructure} from './structure'\n\n// Components\nexport {SfccDocumentStatus} from './components/SfccDocumentStatus'\nexport {SfccOfflineBanner} from './components/SfccOfflineBanner'\n\n/**\n * `renderMembers` callback that injects a caution banner at the top of the\n * document form when the SFCC document is offline or deleted.\n *\n * Usage: add `renderMembers: sfccRenderMembers` to your `defineType` call.\n */\nexport const sfccRenderMembers = (members: ObjectMember[]): (ObjectMember | DecorationMember)[] => [\n {\n key: 'sfcc-offline-banner',\n kind: 'decoration',\n component: SfccOfflineBanner,\n },\n ...members,\n]\n\nconst SFCC_TYPES = new Set(['product', 'category'])\n\n/**\n * SFCC plugin — enforces document-level guardrails for synced commerce data:\n *\n * - Replaces the built-in `delete` action with a custom one that also cleans\n * up associated product variants when deleting a product.\n * - Removes the `duplicate` action (documents are managed by SFCC sync).\n * - Hides product / category from the \"Create new document\" menu\n * (new documents are only created by the sync process).\n */\nexport const sfccPlugin = definePlugin(() => ({\n name: 'sfcc',\n document: {\n actions: (prev, context) => {\n if (SFCC_TYPES.has(context.schemaType)) {\n return prev\n .filter((action) => action.action !== 'duplicate')\n .map((action) => (action.action === 'delete' ? createSfccDeleteAction(action) : action))\n }\n return prev\n },\n newDocumentOptions: (prev) => {\n return prev.filter((template) => !SFCC_TYPES.has(template.templateId))\n },\n },\n}))\n"],"names":["SfccOfflineBanner","$","_c","t0","for","onlineFlagRaw","useFormValue","t1","onlineRaw","undefined","t2","Symbol","API_VERSION","CONFIG","product","message","backPath","category","createSfccDeleteAction","originalDeleteAction","props","originalResult","dialogOpen","setDialogOpen","useState","router","useRouter","toast","useToast","client","useClient","apiVersion","type","draft","published","config","tone","icon","TrashIcon","label","onHandle","dialog","onCancel","onConfirm","transaction","_id","delete","store","variants","Array","isArray","v","_ref","commit","navigateUrl","path","err","Error","push","status","title","SfccDocumentStatus","isDeleted","imageUrl","ref","imageVisible","setImageVisible","handleImageError","alignItems","borderRadius","display","height","justifyContent","overflow","width","replace","left","objectFit","position","top","t3","background","color","t4","sfccCategoryStoreField","defineField","readOnly","name","group","fields","to","sfccCategoryPreview","select","isActive","displayName","categoryId","parentDisplayName","parentName","parentId","prepare","displayTitle","value","parentLabel","subtitle","media","sfccProductStoreField","of","weak","VARIATION_ATTRIBUTE_MAP","storeKey","size","memorySize","tvSize","sfccProductPreview","id","productType","variationAttributes","productImage","selection","attrValues","meta","length","attr","mapped","Object","entries","join","categoryStructure","S","listItem","schemaType","child","documentTypeList","productStructure","context","getClient","documentList","filter","productId","fetch","variantRefs","map","list","items","documentListItem","divider","document","documentId","sfccRenderMembers","members","key","kind","component","SFCC_TYPES","Set","sfccPlugin","definePlugin","actions","prev","has","action","newDocumentOptions","template","templateId"],"mappings":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AAa,CAACT,WAAWM,IAAIG,SAASC,UAAU,CAAC;AAAA,EAAA;AAG3E,EAAE;"}
1
+ {"version":3,"file":"index.js","names":["WarningOutlineIcon","Card","Flex","Text","useFormValue","SfccOfflineBanner","$","_c","t0","Symbol","for","onlineFlagRaw","t1","onlineRaw","onlineFlag","undefined","online","isOnline","t2","API_VERSION","TrashIcon","Stack","Text","useToast","useState","DocumentActionComponent","useClient","useRouter","API_VERSION","CONFIG","Record","message","backPath","product","category","createSfccDeleteAction","originalDeleteAction","SfccDeleteAction","props","originalResult","dialogOpen","setDialogOpen","router","toast","client","apiVersion","type","draft","published","config","tone","icon","label","onHandle","dialog","onCancel","onConfirm","transaction","_id","delete","store","variants","Array","isArray","v","_ref","commit","navigateUrl","path","err","Error","push","status","title","CloseIcon","ImageIcon","Ref","useState","Props","isDeleted","imageUrl","title","ref","HTMLDivElement","SfccDocumentStatus","props","$","_c","imageVisible","setImageVisible","t0","Symbol","for","handleImageError","t1","alignItems","borderRadius","display","height","justifyContent","overflow","width","t2","replace","left","objectFit","position","top","t3","background","color","t4","defineField","SfccDocumentStatus","sfccCategoryStoreField","readOnly","name","title","type","group","fields","to","sfccCategoryPreview","select","imageUrl","isActive","displayName","categoryId","parentDisplayName","parentName","parentId","prepare","value","displayTitle","isRoot","parentLabel","subtitle","media","defineField","SfccDocumentStatus","sfccProductStoreField","readOnly","name","title","type","group","fields","of","to","weak","VariationAttrKey","VARIATION_ATTRIBUTE_MAP","Record","label","storeKey","color","size","memorySize","tvSize","sfccProductPreview","select","id","productType","variationAttributes","productImage","isActive","prepare","selection","value","attrValues","meta","push","length","attr","mapped","Object","entries","subtitle","join","media","defineStructure","categoryStructure","S","listItem","title","schemaType","child","documentTypeList","API_VERSION","defineStructure","productStructure","S","context","client","getClient","apiVersion","listItem","title","schemaType","child","documentList","filter","productId","product","fetch","id","store","productType","variantRefs","variants","map","v","_ref","list","items","documentListItem","divider","ref","document","documentId","ConfigContext","StructureBuilder","defineStructure","factory","S","context","StructureType","DecorationMember","definePlugin","ObjectMember","SfccOfflineBanner","createSfccDeleteAction","sfccCategoryPreview","sfccCategoryStoreField","sfccProductPreview","sfccProductStoreField","categoryStructure","productStructure","SfccDocumentStatus","sfccRenderMembers","members","key","kind","component","SFCC_TYPES","Set","sfccPlugin","name","document","actions","prev","context","has","schemaType","filter","action","map","newDocumentOptions","template","templateId"],"sources":["../src/components/SfccOfflineBanner.tsx","../src/constants.ts","../src/documentActions/sfccDelete.tsx","../src/components/SfccDocumentStatus.tsx","../src/schemas/category.tsx","../src/schemas/product.tsx","../src/structure/categoryStructure.ts","../src/structure/productStructure.ts","../src/structure/index.ts","../src/index.ts"],"sourcesContent":["import {WarningOutlineIcon} from '@sanity/icons/WarningOutline'\nimport {Card, Flex, Text} from '@sanity/ui'\nimport {useFormValue} from 'sanity'\n\n/**\n * Decorative banner injected via `renderMembers` that warns editors when a\n * product or category is offline in SFCC.\n *\n * Reads `store.onlineFlag` (products) and `store.online` (categories) via\n * `useFormValue` so it works without props.\n */\nexport function SfccOfflineBanner() {\n const onlineFlagRaw = useFormValue(['store', 'onlineFlag'])\n const onlineRaw = useFormValue(['store', 'online'])\n\n const onlineFlag = typeof onlineFlagRaw === 'boolean' ? onlineFlagRaw : undefined\n const online = typeof onlineRaw === 'boolean' ? onlineRaw : undefined\n const isOnline = onlineFlag ?? online\n\n if (isOnline !== false) return null\n\n return (\n <Card padding={4} radius={2} shadow={1} tone=\"caution\">\n <Flex align=\"center\" gap={3}>\n <Text size={2}>\n <WarningOutlineIcon />\n </Text>\n <Text size={1} weight=\"medium\">\n This document is currently offline in SFCC.\n </Text>\n </Flex>\n </Card>\n )\n}\n","export const API_VERSION = '2026-02-24'\n","import {TrashIcon} from '@sanity/icons/Trash'\nimport {Stack, Text, useToast} from '@sanity/ui'\nimport {useState} from 'react'\nimport {type DocumentActionComponent, useClient} from 'sanity'\nimport {useRouter} from 'sanity/router'\n\nimport {API_VERSION} from '../constants'\n\nconst CONFIG: Record<string, {message: string; backPath: string}> = {\n product: {\n message: 'Delete the current product and all associated variants in your dataset?',\n backPath: '/structure/products',\n },\n category: {\n message: 'Delete the current category from your dataset?',\n backPath: '/structure/categories',\n },\n}\n\n/**\n * Wraps the built-in delete action for SFCC-synced documents.\n *\n * - **Products**: deletes the product *and* all associated variants\n * (resolved from `store.variants[]._ref`) in a single transaction,\n * then navigates back to the products list.\n * - **Categories**: deletes the category with a confirmation warning,\n * then navigates back to the categories list.\n */\nexport function createSfccDeleteAction(\n originalDeleteAction: DocumentActionComponent,\n): DocumentActionComponent {\n return function SfccDeleteAction(props) {\n const originalResult = originalDeleteAction(props)\n\n const [dialogOpen, setDialogOpen] = useState(false)\n const router = useRouter()\n const toast = useToast()\n const client = useClient({apiVersion: API_VERSION})\n\n const {type, draft, published} = props\n const config = CONFIG[type]\n\n if (!config) return originalResult\n\n return {\n ...originalResult,\n tone: 'critical',\n icon: TrashIcon,\n label: 'Delete',\n onHandle: () => setDialogOpen(true),\n dialog: dialogOpen && {\n type: 'confirm',\n message: (\n <Stack gap={4}>\n <Text size={1}>{config.message}</Text>\n <Text size={1} weight=\"medium\">\n No data on SFCC will be deleted.\n </Text>\n </Stack>\n ),\n onCancel: () => setDialogOpen(false),\n onConfirm: async () => {\n const transaction = client.transaction()\n if (published?._id) transaction.delete(published._id)\n if (draft?._id) transaction.delete(draft._id)\n\n if (type === 'product' && published) {\n const store = published['store']\n const variants =\n store != null &&\n typeof store === 'object' &&\n 'variants' in store &&\n Array.isArray(store.variants)\n ? store.variants\n : []\n for (const v of variants) {\n if (v != null && typeof v === 'object' && '_ref' in v && typeof v._ref === 'string') {\n transaction.delete(v._ref)\n transaction.delete(`drafts.${v._ref}`)\n }\n }\n }\n\n try {\n await transaction.commit()\n router.navigateUrl({path: config.backPath})\n } catch (err) {\n const message = err instanceof Error ? err.message : 'Unknown Error'\n toast.push({status: 'error', title: message})\n } finally {\n setDialogOpen(false)\n }\n },\n },\n }\n }\n}\n","import {CloseIcon} from '@sanity/icons/Close'\nimport {ImageIcon} from '@sanity/icons/Image'\nimport {type Ref, useState} from 'react'\n\ntype Props = {\n isDeleted: boolean\n imageUrl: string\n title: string\n ref?: Ref<HTMLDivElement>\n}\n\nconst SfccDocumentStatus = (props: Props) => {\n const {isDeleted, imageUrl, title, ref} = props\n\n const [imageVisible, setImageVisible] = useState(true)\n\n const handleImageError = () => setImageVisible(false)\n\n return (\n <div\n ref={ref}\n style={{\n alignItems: 'center',\n borderRadius: 'inherit',\n display: 'flex',\n height: '100%',\n justifyContent: 'center',\n overflow: 'hidden',\n width: '100%',\n }}\n >\n {imageVisible && imageUrl ? (\n <img\n onError={handleImageError}\n src={imageUrl.replace('/large/', '/small/')}\n style={{\n height: '100%',\n left: 0,\n objectFit: 'contain',\n position: 'absolute',\n top: 0,\n width: '100%',\n }}\n alt={`${title} preview`}\n />\n ) : (\n <ImageIcon style={{position: 'absolute'}} />\n )}\n\n {isDeleted && (\n <CloseIcon\n style={{\n background: 'rgba(255, 0, 0, 0.7)',\n color: 'rgba(255, 255, 255, 0.85)',\n height: '100%',\n position: 'relative',\n width: '100%',\n }}\n />\n )}\n </div>\n )\n}\n\nexport {SfccDocumentStatus}\n","import {defineField} from 'sanity'\n\nimport {SfccDocumentStatus} from '../components/SfccDocumentStatus'\n\n/**\n * SFCC category store field — contains all read-only data synced from\n * Salesforce Commerce Cloud. Add this to a `category` document type's\n * `fields` array alongside your own custom fields.\n *\n * The field is placed in the `sfcc` group; make sure the document type\n * declares that group.\n */\nexport const sfccCategoryStoreField = defineField({\n readOnly: true,\n name: 'store',\n title: 'SFCC Data',\n type: 'object',\n group: 'sfcc',\n fields: [\n defineField({name: 'categoryId', title: 'Category ID', type: 'string', readOnly: true}),\n defineField({\n name: 'thumbnailImage',\n title: 'Thumbnail Image',\n type: 'string',\n readOnly: true,\n }),\n defineField({name: 'online', title: 'Online', type: 'boolean', readOnly: true}),\n defineField({name: 'onlineFrom', title: 'Online From', type: 'date', readOnly: true}),\n defineField({name: 'onlineTo', title: 'Online To', type: 'date', readOnly: true}),\n defineField({name: 'creationDate', title: 'Creation Date', type: 'date', readOnly: true}),\n defineField({name: 'isDeleted', title: 'Is Deleted', type: 'boolean', readOnly: true}),\n defineField({\n name: 'parentCategory',\n type: 'reference',\n to: [{type: 'category'}],\n readOnly: true,\n }),\n defineField({\n name: 'displayName',\n title: 'Display Name',\n type: 'internationalizedArrayString',\n readOnly: true,\n }),\n defineField({\n name: 'description',\n title: 'Description',\n type: 'internationalizedArrayText',\n readOnly: true,\n }),\n ],\n})\n\n/**\n * Default preview configuration for the `category` document type.\n * Shows Category Name with parent category as subtitle.\n */\nexport const sfccCategoryPreview = {\n select: {\n imageUrl: 'store.thumbnailImage',\n isActive: 'store.online',\n displayName: 'store.displayName',\n title: 'title',\n name: 'name',\n categoryId: 'store.categoryId',\n parentDisplayName: 'store.parentCategory.store.displayName',\n parentName: 'store.parentCategory.name',\n parentId: 'store.parentCategory.store.categoryId',\n },\n prepare({\n imageUrl,\n displayName,\n title,\n name,\n categoryId,\n parentDisplayName,\n parentName,\n parentId,\n isActive,\n }: {\n imageUrl?: string\n displayName?: {value: string}[]\n title?: string\n name?: string\n categoryId?: string\n parentDisplayName?: {value: string}[]\n parentName?: string\n parentId?: string\n isActive?: boolean\n }) {\n const displayTitle =\n title || name || displayName?.[0]?.value || categoryId || 'Untitled Category'\n\n const isRoot = parentId === 'root'\n const parentLabel = !isRoot && (parentName || parentDisplayName?.[0]?.value || parentId)\n\n return {\n title: displayTitle,\n subtitle: parentLabel ? `Parent: ${parentLabel}` : '',\n media: (\n <SfccDocumentStatus isDeleted={!isActive} imageUrl={imageUrl ?? ''} title={displayTitle} />\n ),\n }\n },\n}\n","import {defineField} from 'sanity'\n\nimport {SfccDocumentStatus} from '../components/SfccDocumentStatus'\n\n/**\n * SFCC product store field — contains all read-only data synced from\n * Salesforce Commerce Cloud. Add this to a `product` document type's\n * `fields` array alongside your own custom fields.\n *\n * The field is placed in the `sfcc` group; make sure the document type\n * declares that group.\n */\nexport const sfccProductStoreField = defineField({\n readOnly: true,\n name: 'store',\n title: 'SFCC Data',\n type: 'object',\n group: 'sfcc',\n fields: [\n defineField({name: 'productId', title: 'Product ID', type: 'string', readOnly: true}),\n defineField({name: 'brand', title: 'Brand', type: 'string', readOnly: true}),\n defineField({name: 'color', title: 'Color', type: 'string', readOnly: true}),\n defineField({name: 'size', title: 'Size', type: 'string', readOnly: true}),\n defineField({name: 'width', title: 'Width', type: 'string', readOnly: true}),\n defineField({name: 'productType', title: 'Product Type', type: 'string', readOnly: true}),\n defineField({name: 'styleNumber', title: 'Style Number', type: 'string', readOnly: true}),\n defineField({name: 'searchable', title: 'Searchable', type: 'boolean', readOnly: true}),\n defineField({name: 'isSale', title: 'On Sale?', type: 'boolean', readOnly: true}),\n defineField({name: 'isNew', title: 'New Arrival?', type: 'boolean', readOnly: true}),\n defineField({\n name: 'manufacturerName',\n title: 'Manufacturer',\n type: 'string',\n readOnly: true,\n }),\n defineField({\n name: 'manufacturerSKU',\n title: 'Manufacturer Product ID',\n type: 'string',\n readOnly: true,\n }),\n defineField({\n name: 'creationDate',\n title: 'Creation Date',\n type: 'datetime',\n readOnly: true,\n }),\n defineField({\n name: 'lastModified',\n title: 'Last Modified',\n type: 'datetime',\n readOnly: true,\n }),\n defineField({name: 'onlineFlag', title: 'Online', type: 'boolean', readOnly: true}),\n defineField({name: 'onlineFrom', title: 'Online From', type: 'datetime', readOnly: true}),\n defineField({name: 'onlineTo', title: 'Online To', type: 'datetime', readOnly: true}),\n defineField({name: 'length', title: 'Length', type: 'string', readOnly: true}),\n defineField({name: 'memorySize', title: 'Memory Size', type: 'string', readOnly: true}),\n defineField({name: 'tvSize', title: 'TV Size', type: 'string', readOnly: true}),\n defineField({\n name: 'tvType',\n title: 'TV Type',\n type: 'array',\n of: [{type: 'string'}],\n readOnly: true,\n }),\n defineField({\n name: 'productImage',\n title: 'Product Image',\n type: 'string',\n readOnly: true,\n }),\n defineField({\n name: 'refinementColor',\n title: 'Refinement Color',\n type: 'string',\n readOnly: true,\n }),\n defineField({\n name: 'variants',\n title: 'Variants',\n type: 'array',\n of: [{type: 'reference', to: [{type: 'product'}], weak: true}],\n readOnly: true,\n }),\n defineField({\n name: 'variationAttributes',\n title: 'Variation Attributes',\n type: 'array',\n of: [{type: 'string'}],\n readOnly: true,\n }),\n defineField({name: 'isDeleted', title: 'Is Deleted', type: 'boolean'}),\n defineField({\n name: 'name',\n title: 'Name',\n type: 'internationalizedArrayString',\n readOnly: true,\n }),\n defineField({\n name: 'longDescription',\n title: 'Long Description',\n type: 'internationalizedArrayText',\n readOnly: true,\n }),\n defineField({\n name: 'shortDescription',\n title: 'Short Description',\n type: 'internationalizedArrayText',\n readOnly: true,\n }),\n defineField({\n name: 'pageTitle',\n title: 'Page Title',\n type: 'internationalizedArrayString',\n readOnly: true,\n }),\n defineField({\n name: 'pageDescription',\n title: 'Page Description',\n type: 'internationalizedArrayString',\n readOnly: true,\n }),\n defineField({\n name: 'pageKeywords',\n title: 'Page Keywords',\n type: 'internationalizedArrayString',\n readOnly: true,\n }),\n defineField({\n name: 'pageURL',\n title: 'Page URL',\n type: 'internationalizedArrayString',\n readOnly: true,\n }),\n ],\n})\n\ntype VariationAttrKey = 'color' | 'size' | 'memorySize' | 'tvSize'\n\n/**\n * Maps SFCC variation attribute IDs to their store field keys and display labels.\n */\nconst VARIATION_ATTRIBUTE_MAP: Record<string, {label: string; storeKey: VariationAttrKey}> = {\n color: {label: 'Color', storeKey: 'color'},\n size: {label: 'Size', storeKey: 'size'},\n memorySize: {label: 'Memory Size', storeKey: 'memorySize'},\n tvSize: {label: 'TV Size', storeKey: 'tvSize'},\n}\n\n/**\n * Default preview configuration for the `product` document type.\n * Shows product type for Master/Simple, and the relevant variation\n * attributes (driven by `store.variationAttributes`) for all products.\n */\nexport const sfccProductPreview = {\n select: {\n name: 'store.name',\n id: 'store.productId',\n productType: 'store.productType',\n variationAttributes: 'store.variationAttributes',\n color: 'store.color',\n size: 'store.size',\n memorySize: 'store.memorySize',\n tvSize: 'store.tvSize',\n productImage: 'store.productImage',\n isActive: 'store.onlineFlag',\n },\n prepare(selection: {\n name?: {value: string}[]\n id?: string\n productType?: string\n variationAttributes?: string[]\n color?: string\n size?: string\n memorySize?: string\n tvSize?: string\n productImage?: string\n isActive?: boolean\n }) {\n const {name, id, productType, variationAttributes, productImage, isActive, ...attrValues} =\n selection\n\n const title = name?.[0]?.value || id || 'Untitled Product'\n const meta: string[] = []\n if (productType && productType !== 'Variant') meta.push(productType)\n\n if (variationAttributes?.length) {\n for (const attr of variationAttributes) {\n const mapped = VARIATION_ATTRIBUTE_MAP[attr]\n const value = mapped && attrValues[mapped.storeKey]\n if (mapped && value) meta.push(`${mapped.label}: ${value}`)\n }\n } else {\n for (const [, {label, storeKey}] of Object.entries(VARIATION_ATTRIBUTE_MAP)) {\n const value = attrValues[storeKey]\n if (value) meta.push(`${label}: ${value}`)\n }\n }\n\n return {\n title,\n subtitle: meta.join(' | '),\n media: (\n <SfccDocumentStatus isDeleted={!isActive} imageUrl={productImage ?? ''} title={title} />\n ),\n }\n },\n}\n","import {defineStructure} from './index'\n\nexport const categoryStructure = defineStructure((S) =>\n S.listItem().title('Categories').schemaType('category').child(S.documentTypeList('category')),\n)\n","import {API_VERSION} from '../constants'\nimport {defineStructure} from './index'\n\nexport const productStructure = defineStructure((S, context) => {\n const client = context.getClient({apiVersion: API_VERSION})\n\n return S.listItem()\n .title('Products')\n .schemaType('product')\n .child(\n S.documentList()\n .title('Products')\n .schemaType('product')\n .filter('_type == \"product\" && store.productType in [\"Master\", \"Simple\"]')\n .apiVersion(API_VERSION)\n .child(async (productId) => {\n const product = await client.fetch('*[_id == $id][0]{store}', {id: productId})\n\n if (product?.store?.productType === 'Master') {\n const variantRefs: string[] =\n product.store.variants?.map((v: {_ref: string}) => v._ref) ?? []\n\n return S.list()\n .title('Product')\n .items([\n S.documentListItem().id(productId).schemaType('product'),\n S.divider().title('Variants'),\n ...variantRefs.map((ref) => S.documentListItem().id(ref).schemaType('product')),\n ])\n }\n\n return S.document().documentId(productId).schemaType('product')\n }),\n )\n})\n","import type {ConfigContext} from 'sanity'\nimport type {StructureBuilder} from 'sanity/structure'\n\n/**\n * Helper for creating and typing composable structure parts.\n */\nexport function defineStructure<StructureType>(\n factory: (S: StructureBuilder, context: ConfigContext) => StructureType,\n) {\n return factory\n}\n\nexport * from './categoryStructure'\nexport * from './productStructure'\n","import {type DecorationMember, definePlugin, type ObjectMember} from 'sanity'\n\nimport {SfccOfflineBanner} from './components/SfccOfflineBanner'\nimport {createSfccDeleteAction} from './documentActions/sfccDelete'\n\n// Schema building blocks\nexport {sfccCategoryPreview, sfccCategoryStoreField} from './schemas/category'\nexport {sfccProductPreview, sfccProductStoreField} from './schemas/product'\n\n// Structure builders\nexport {categoryStructure, productStructure} from './structure'\n\n// Components\nexport {SfccDocumentStatus} from './components/SfccDocumentStatus'\nexport {SfccOfflineBanner} from './components/SfccOfflineBanner'\n\n/**\n * `renderMembers` callback that injects a caution banner at the top of the\n * document form when the SFCC document is offline or deleted.\n *\n * Usage: add `renderMembers: sfccRenderMembers` to your `defineType` call.\n */\nexport const sfccRenderMembers = (members: ObjectMember[]): (ObjectMember | DecorationMember)[] => [\n {\n key: 'sfcc-offline-banner',\n kind: 'decoration',\n component: SfccOfflineBanner,\n },\n ...members,\n]\n\nconst SFCC_TYPES = new Set(['product', 'category'])\n\n/**\n * SFCC plugin — enforces document-level guardrails for synced commerce data:\n *\n * - Replaces the built-in `delete` action with a custom one that also cleans\n * up associated product variants when deleting a product.\n * - Removes the `duplicate` action (documents are managed by SFCC sync).\n * - Hides product / category from the \"Create new document\" menu\n * (new documents are only created by the sync process).\n */\nexport const sfccPlugin = definePlugin(() => ({\n name: 'sfcc',\n document: {\n actions: (prev, context) => {\n if (SFCC_TYPES.has(context.schemaType)) {\n return prev\n .filter((action) => action.action !== 'duplicate')\n .map((action) => (action.action === 'delete' ? createSfccDeleteAction(action) : action))\n }\n return prev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package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/sfcc",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "Sanity plugin for Salesforce Commerce Cloud (SFCC) integration — synced product and category data with editorial enrichment.",
5
5
  "keywords": [
6
6
  "salesforce-commerce-cloud",
@@ -33,18 +33,17 @@
33
33
  "@sanity/ui": "^3.3.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@sanity/pkg-utils": "^10.9.0",
37
- "@sanity/tsconfig": "^2.1.0",
36
+ "@sanity/tsconfig": "^2.2.0",
37
+ "@sanity/tsdown-config": "^0.11.0",
38
38
  "@types/node": "^24.13.2",
39
39
  "@types/react": "^19.2.17",
40
40
  "@types/react-dom": "^19.2.3",
41
41
  "babel-plugin-react-compiler": "^1.0.0",
42
- "babel-plugin-styled-components": "^2.3.0",
43
42
  "react": "^19.2.7",
44
43
  "react-dom": "^19.2.7",
45
44
  "sanity": "^6.3.0",
46
45
  "styled-components": "^6.4.3",
47
- "@repo/package.config": "0.0.0"
46
+ "tsdown": "^0.22.3"
48
47
  },
49
48
  "peerDependencies": {
50
49
  "react": "^19.2",
@@ -56,6 +55,6 @@
56
55
  "node": ">=20.19 <22 || >=22.12"
57
56
  },
58
57
  "scripts": {
59
- "build": "pkg build --strict --check --clean"
58
+ "build": "tsdown"
60
59
  }
61
60
  }