-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplatformkit.config.ts
More file actions
208 lines (206 loc) · 4.84 KB
/
platformkit.config.ts
File metadata and controls
208 lines (206 loc) · 4.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
import type { PlatformKitConfig } from "./src/lib/config";
/**
* Root platform-level config.
*
* Theme-specific settings (collections, build hooks, etc.) belong in the
* active theme's platformkit.build.ts — NOT here.
*
* User overrides go in src/overrides/platformkit.config.ts (or staged there
* by the CLI from the user's content directory).
*
* Merge order: root → theme → user overrides (deep merge, buildHooks concatenated).
*/
const config: PlatformKitConfig = {
contentCollections: {
products: {
directory: "content/products",
format: "yaml",
version: 1,
label: "Products",
icon: "ShoppingCart",
itemSchema: [
{
$formkit: "select",
name: "product_type",
label: "Product Type",
validation: "required",
options: [
{ label: "Physical", value: "physical" },
{ label: "Digital", value: "digital" },
{ label: "Subscription", value: "subscription" },
],
},
{
$formkit: "text",
name: "name",
label: "Product Name",
validation: "required",
},
{
$formkit: "textarea",
name: "description",
label: "Description",
},
{
$formkit: "listPanel",
name: "images",
label: "Images",
children: [{ $formkit: "image-upload", name: "image", label: "Image" }],
},
{
$formkit: "checkbox",
name: "shippable",
label: "Shippable",
if: "$product_type == 'physical'",
},
{
$formkit: "listPanel",
name: "attributes",
label: "Attributes (Options)",
if: "$product_type == 'physical'",
help: "Define product options (e.g. Size, Color). Each attribute can have multiple values.",
ui: { collapsible: true, collapsed: true, summaryField: "name" },
children: [
{
$formkit: "group",
name: "attribute",
label: "Attribute",
children: [
{
$formkit: "text",
name: "name",
label: "Attribute Name",
},
{
$formkit: "listPanel",
name: "values",
label: "Values",
children: [{ $formkit: "text", name: "value", label: "Value" }],
},
],
},
],
},
{
$formkit: "listPanel",
name: "variants",
label: "Variants (SKUs)",
if: "$product_type == 'physical'",
help: "Each variant is a unique combination of attributes (e.g. Size: M, Color: Blue) with its own SKU and inventory.",
ui: { collapsible: true, collapsed: true, summaryField: "sku" },
children: [
{
$formkit: "group",
name: "variant",
label: "Variant",
children: [
{
$formkit: "text",
name: "sku",
label: "SKU",
},
{
$formkit: "listPanel",
name: "attributes",
label: "Attributes",
children: [
{
$formkit: "group",
name: "attribute",
label: "Attribute",
children: [
{
$formkit: "text",
name: "name",
label: "Attribute Name",
},
{
$formkit: "text",
name: "value",
label: "Value",
},
],
},
],
},
{
$formkit: "number",
name: "inventory",
label: "Inventory",
},
],
},
],
},
{
$formkit: "listPanel",
name: "metadata",
label: "Product Metadata",
help: "Custom key-value pairs for this product.",
ui: { collapsible: true, collapsed: true, summaryField: "key" },
children: [
{
$formkit: "group",
name: "meta",
label: "Meta",
children: [
{
$formkit: "text",
name: "key",
label: "Key",
},
{
$formkit: "text",
name: "value",
label: "Value",
},
],
},
],
},
{ $formkit: "text", name: "stripe_product_id", label: "Stripe Product ID" },
{
$formkit: "listPanel",
name: "extra",
label: "Extra Stripe Fields",
help: "Advanced: Add any extra fields for Stripe sync.",
ui: { collapsible: true, collapsed: true, summaryField: "key" },
children: [
{
$formkit: "group",
name: "extraField",
label: "Extra Field",
children: [
{
$formkit: "text",
name: "key",
label: "Key",
},
{
$formkit: "text",
name: "value",
label: "Value",
},
],
},
],
},
],
newItem: () => ({
name: "",
description: "",
images: [],
shippable: false,
attributes: [],
variants: [],
metadata: {},
prices: [],
stripe_product_id: "",
extra: {},
}),
itemLabel: (item: any) => item.title,
itemThumbnail: (item: any) => item.image,
},
},
};
export default config;