@vectoriox/iox-ui 5.96.2 → 5.98.0
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/commerce-core/index.d.ts +274 -2
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +312 -1
- package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +2 -8
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1114 -223
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +115 -42
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/generation-core/index.d.ts +515 -17
- package/harness-core/index.d.ts +66 -6
- package/package.json +1 -1
- package/src/commerce-core/public-api.ts +2 -0
- package/src/commerce-core/shipping.ts +22 -0
- package/src/commerce-core/site-checkout.ts +406 -0
- package/src/commerce-core/variants.ts +20 -0
- package/src/composite-core/shop-runtime.ts +2 -8
- package/src/generation-core/audit-site.ts +8 -0
- package/src/generation-core/compose-site.ts +130 -4
- package/src/generation-core/nav-shape.ts +4 -2
- package/src/generation-core/patterns.ts +25 -1
- package/src/generation-core/pictures.ts +1 -1
- package/src/generation-core/plan-derived.ts +10 -5
- package/src/generation-core/plan-edits.ts +8 -7
- package/src/generation-core/plan-wire.ts +59 -10
- package/src/generation-core/plan-words.ts +18 -1
- package/src/generation-core/public-api.ts +1 -0
- package/src/generation-core/shop-plan.ts +165 -0
- package/src/generation-core/showcase.ts +29 -4
- package/src/generation-core/site-build-run.ts +25 -0
- package/src/generation-core/site-plan.model.ts +49 -1
- package/src/generation-core/site-spec.generated.ts +330 -2
- package/src/generation-core/stock-photos.ts +19 -2
- package/src/generation-core/validate-site-plan.ts +146 -8
- package/src/harness-core/business-types.ts +13 -0
- package/src/harness-core/harness-spec.generated.ts +69 -39
- package/src/harness-core/needs.ts +30 -1
- package/src/harness-core/site-reading.ts +8 -2
|
@@ -10,7 +10,8 @@ export const SPEC_SITE_PLAN_SHAPE = {
|
|
|
10
10
|
"locale?": "'en' | 'he' — the site's language (site.locales): every page's locale; 'he' reads right to left (absent = en)",
|
|
11
11
|
"design": "design",
|
|
12
12
|
"contentTypes": "contentType[]",
|
|
13
|
-
"dataSources": "(cmsDataSource | relativeDataSource)[] — merged by alias into the org library",
|
|
13
|
+
"dataSources": "(cmsDataSource | relativeDataSource | shopDataSource)[] — merged by alias into the org library",
|
|
14
|
+
"shop?": "shop — what the business sells (commerce C-D21): its products are the studio's SHOP, never a content type; a plan with a shop is a whole store (product pages, the cart button and the cart drawer, the fixed checkout)",
|
|
14
15
|
"pages": "page[]",
|
|
15
16
|
"globals": "globals",
|
|
16
17
|
"film?": "film — the owner's film as pictures (SC6b), set by the build and placed by placeFilm; never a model's",
|
|
@@ -105,6 +106,28 @@ export const SPEC_SITE_PLAN_SHAPE = {
|
|
|
105
106
|
"limit?": "integer ≥ 1",
|
|
106
107
|
"filterByRouteParam?": "{ field, routeParam } — single only: the route param that picks the item"
|
|
107
108
|
},
|
|
109
|
+
"shopDataSource": {
|
|
110
|
+
"alias": "string — unique",
|
|
111
|
+
"type": "'shop'",
|
|
112
|
+
"mode": "'query' | 'single'",
|
|
113
|
+
"resource": "'products' | 'categories' — the shop's own list (generation-core ShopResource)",
|
|
114
|
+
"limit?": "integer ≥ 1",
|
|
115
|
+
"filterByRouteParam?": "{ field, routeParam } — single only: the field ('slug' or '_id') the route param matches"
|
|
116
|
+
},
|
|
117
|
+
"shop": {
|
|
118
|
+
"categories": "string[] — the categories, in order (each product's category; written by the plan, never invented beyond them)",
|
|
119
|
+
"products": "shopProduct[] — at most 6 sample products, by name: what the business sells. Never a price, stock, a fee or a claim — the owner sets those in the product editor"
|
|
120
|
+
},
|
|
121
|
+
"shopProduct": {
|
|
122
|
+
"name": "string — the product as the business would name it",
|
|
123
|
+
"category": "string — one of shop.categories",
|
|
124
|
+
"description": "string — one line about it, in the owner's voice; never a price, a size chart or a claim",
|
|
125
|
+
"options": "shopOption[] — how it varies (size, colour…); [] = one kind only"
|
|
126
|
+
},
|
|
127
|
+
"shopOption": {
|
|
128
|
+
"name": "string — the option's name (Size, Colour)",
|
|
129
|
+
"values": "string[] — its values, in order (S, M, L)"
|
|
130
|
+
},
|
|
108
131
|
"relativeDataSource": {
|
|
109
132
|
"alias": "string — unique",
|
|
110
133
|
"type": "'relative'",
|
|
@@ -161,7 +184,9 @@ export const SPEC_SITE_ROLES = {
|
|
|
161
184
|
"image": "its picture — the card picture, the item page's hero",
|
|
162
185
|
"meta": "a short line beside its name — a place, a price, a duration",
|
|
163
186
|
"date": "when — a year or a date",
|
|
164
|
-
"gallery": "its pictures (a list) — the item page's gallery"
|
|
187
|
+
"gallery": "its pictures (a list) — the item page's gallery",
|
|
188
|
+
"price": "its price — the shop's own field, shown through the money pipe in the studio currency",
|
|
189
|
+
"compareAt": "its earlier price, struck through beside the price (the shop's own field)"
|
|
165
190
|
} as const;
|
|
166
191
|
|
|
167
192
|
export const SPEC_SITE_REQUIRED_ROLES = [
|
|
@@ -193,6 +218,7 @@ export const SPEC_SITE_DENSITY_COPY = {
|
|
|
193
218
|
|
|
194
219
|
export const SPEC_SITE_NEED_IDS = [
|
|
195
220
|
"collection",
|
|
221
|
+
"products",
|
|
196
222
|
"detail",
|
|
197
223
|
"services",
|
|
198
224
|
"prices",
|
|
@@ -2164,6 +2190,293 @@ export const SPEC_SITE_PATTERNS = {
|
|
|
2164
2190
|
]
|
|
2165
2191
|
}
|
|
2166
2192
|
},
|
|
2193
|
+
"commerce.product-grid": {
|
|
2194
|
+
"family": "collection",
|
|
2195
|
+
"shop": true,
|
|
2196
|
+
"label": "Products, three across",
|
|
2197
|
+
"intent": "The products the shop sells as cards — picture, name and price — each linking to its own page.",
|
|
2198
|
+
"node": {
|
|
2199
|
+
"t": "Section",
|
|
2200
|
+
"es": "section",
|
|
2201
|
+
"c": [
|
|
2202
|
+
{
|
|
2203
|
+
"t": "Container",
|
|
2204
|
+
"es": "box",
|
|
2205
|
+
"optional": "header",
|
|
2206
|
+
"lay": {
|
|
2207
|
+
"display": "flex",
|
|
2208
|
+
"justifyContent": "space-between",
|
|
2209
|
+
"alignItems": "baseline",
|
|
2210
|
+
"gap": "16px",
|
|
2211
|
+
"flexWrap": "wrap"
|
|
2212
|
+
},
|
|
2213
|
+
"c": [
|
|
2214
|
+
{
|
|
2215
|
+
"t": "Heading",
|
|
2216
|
+
"es": "h2",
|
|
2217
|
+
"level": "h2",
|
|
2218
|
+
"slot": "title",
|
|
2219
|
+
"max": 52,
|
|
2220
|
+
"text": "New in",
|
|
2221
|
+
"enter": "heading"
|
|
2222
|
+
},
|
|
2223
|
+
{
|
|
2224
|
+
"t": "Link",
|
|
2225
|
+
"es": "link",
|
|
2226
|
+
"href": "/shop",
|
|
2227
|
+
"slot": "more",
|
|
2228
|
+
"max": 28,
|
|
2229
|
+
"text": "Shop all"
|
|
2230
|
+
}
|
|
2231
|
+
]
|
|
2232
|
+
},
|
|
2233
|
+
{
|
|
2234
|
+
"t": "Repeater",
|
|
2235
|
+
"src": "$binding",
|
|
2236
|
+
"lay": {
|
|
2237
|
+
"display": "grid",
|
|
2238
|
+
"gridTemplateColumns": "repeat(3, minmax(0, 1fr))",
|
|
2239
|
+
"gap": "var(--iox-space-gap)"
|
|
2240
|
+
},
|
|
2241
|
+
"resp": {
|
|
2242
|
+
"mobile": {
|
|
2243
|
+
"gridTemplateColumns": "minmax(0, 1fr)"
|
|
2244
|
+
}
|
|
2245
|
+
},
|
|
2246
|
+
"c": [
|
|
2247
|
+
{
|
|
2248
|
+
"t": "Container",
|
|
2249
|
+
"recipe": "card",
|
|
2250
|
+
"layout": "top",
|
|
2251
|
+
"parts": {
|
|
2252
|
+
"badge": false,
|
|
2253
|
+
"eyebrow": false,
|
|
2254
|
+
"text": false,
|
|
2255
|
+
"actions": false
|
|
2256
|
+
},
|
|
2257
|
+
"detail": "item",
|
|
2258
|
+
"enter": "items",
|
|
2259
|
+
"binds": {
|
|
2260
|
+
"image": "item.@image?",
|
|
2261
|
+
"title": "item.@title"
|
|
2262
|
+
},
|
|
2263
|
+
"c": [
|
|
2264
|
+
{
|
|
2265
|
+
"t": "Container",
|
|
2266
|
+
"recipe": "price",
|
|
2267
|
+
"binds": {
|
|
2268
|
+
"price": "item.@price",
|
|
2269
|
+
"compareAt": "item.@compareAt?"
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
]
|
|
2273
|
+
}
|
|
2274
|
+
]
|
|
2275
|
+
}
|
|
2276
|
+
],
|
|
2277
|
+
"lay": {
|
|
2278
|
+
"display": "flex",
|
|
2279
|
+
"flexDirection": "column",
|
|
2280
|
+
"gap": "32px"
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
},
|
|
2284
|
+
"commerce.featured": {
|
|
2285
|
+
"family": "collection",
|
|
2286
|
+
"shop": true,
|
|
2287
|
+
"label": "One product, its picture beside its words",
|
|
2288
|
+
"intent": "One product brought forward — its picture beside its name, price and a line — linking to its own page.",
|
|
2289
|
+
"node": {
|
|
2290
|
+
"t": "Section",
|
|
2291
|
+
"es": "section",
|
|
2292
|
+
"c": [
|
|
2293
|
+
{
|
|
2294
|
+
"t": "Repeater",
|
|
2295
|
+
"src": "$binding",
|
|
2296
|
+
"limit": 1,
|
|
2297
|
+
"lay": {
|
|
2298
|
+
"display": "flex",
|
|
2299
|
+
"flexDirection": "column",
|
|
2300
|
+
"gap": "0px"
|
|
2301
|
+
},
|
|
2302
|
+
"c": [
|
|
2303
|
+
{
|
|
2304
|
+
"t": "Container",
|
|
2305
|
+
"es": "box",
|
|
2306
|
+
"lay": {
|
|
2307
|
+
"display": "grid",
|
|
2308
|
+
"gridTemplateColumns": "1fr 1fr",
|
|
2309
|
+
"gap": "48px",
|
|
2310
|
+
"alignItems": "center"
|
|
2311
|
+
},
|
|
2312
|
+
"resp": {
|
|
2313
|
+
"mobile": {
|
|
2314
|
+
"gridTemplateColumns": "minmax(0, 1fr)"
|
|
2315
|
+
}
|
|
2316
|
+
},
|
|
2317
|
+
"c": [
|
|
2318
|
+
{
|
|
2319
|
+
"t": "Image",
|
|
2320
|
+
"es": "media",
|
|
2321
|
+
"bind": "item.@image?",
|
|
2322
|
+
"aspect": "4 / 5"
|
|
2323
|
+
},
|
|
2324
|
+
{
|
|
2325
|
+
"t": "Container",
|
|
2326
|
+
"es": "box",
|
|
2327
|
+
"lay": {
|
|
2328
|
+
"display": "flex",
|
|
2329
|
+
"flexDirection": "column",
|
|
2330
|
+
"gap": "16px"
|
|
2331
|
+
},
|
|
2332
|
+
"c": [
|
|
2333
|
+
{
|
|
2334
|
+
"t": "Text",
|
|
2335
|
+
"es": "eyebrow",
|
|
2336
|
+
"slot": "eyebrow",
|
|
2337
|
+
"max": 32,
|
|
2338
|
+
"text": "Featured"
|
|
2339
|
+
},
|
|
2340
|
+
{
|
|
2341
|
+
"t": "Heading",
|
|
2342
|
+
"es": "h2",
|
|
2343
|
+
"level": "h2",
|
|
2344
|
+
"bind": "item.@title",
|
|
2345
|
+
"enter": "heading"
|
|
2346
|
+
},
|
|
2347
|
+
{
|
|
2348
|
+
"t": "Container",
|
|
2349
|
+
"recipe": "price",
|
|
2350
|
+
"binds": {
|
|
2351
|
+
"price": "item.@price",
|
|
2352
|
+
"compareAt": "item.@compareAt?"
|
|
2353
|
+
}
|
|
2354
|
+
},
|
|
2355
|
+
{
|
|
2356
|
+
"t": "Text",
|
|
2357
|
+
"es": "body",
|
|
2358
|
+
"bind": "item.@summary?"
|
|
2359
|
+
},
|
|
2360
|
+
{
|
|
2361
|
+
"t": "Container",
|
|
2362
|
+
"es": "box",
|
|
2363
|
+
"lay": {
|
|
2364
|
+
"display": "flex",
|
|
2365
|
+
"flexWrap": "wrap",
|
|
2366
|
+
"gap": "12px",
|
|
2367
|
+
"alignItems": "center"
|
|
2368
|
+
},
|
|
2369
|
+
"c": [
|
|
2370
|
+
{
|
|
2371
|
+
"t": "ButtonBlock",
|
|
2372
|
+
"es": "button-primary",
|
|
2373
|
+
"detail": "item",
|
|
2374
|
+
"slot": "action",
|
|
2375
|
+
"max": 24,
|
|
2376
|
+
"text": "See it"
|
|
2377
|
+
}
|
|
2378
|
+
]
|
|
2379
|
+
}
|
|
2380
|
+
]
|
|
2381
|
+
}
|
|
2382
|
+
]
|
|
2383
|
+
}
|
|
2384
|
+
]
|
|
2385
|
+
}
|
|
2386
|
+
]
|
|
2387
|
+
}
|
|
2388
|
+
},
|
|
2389
|
+
"commerce.product-detail": {
|
|
2390
|
+
"family": "detail",
|
|
2391
|
+
"shop": true,
|
|
2392
|
+
"label": "A product — its picture, price, options and Add to cart",
|
|
2393
|
+
"intent": "One product on its own page: picture, name, price, its line, its options, quantity, Add to cart and Buy now.",
|
|
2394
|
+
"node": {
|
|
2395
|
+
"t": "Section",
|
|
2396
|
+
"es": "section",
|
|
2397
|
+
"c": [
|
|
2398
|
+
{
|
|
2399
|
+
"t": "Container",
|
|
2400
|
+
"es": "box",
|
|
2401
|
+
"lay": {
|
|
2402
|
+
"display": "grid",
|
|
2403
|
+
"gridTemplateColumns": "1.1fr 0.9fr",
|
|
2404
|
+
"gap": "48px",
|
|
2405
|
+
"alignItems": "start"
|
|
2406
|
+
},
|
|
2407
|
+
"resp": {
|
|
2408
|
+
"mobile": {
|
|
2409
|
+
"gridTemplateColumns": "minmax(0, 1fr)"
|
|
2410
|
+
}
|
|
2411
|
+
},
|
|
2412
|
+
"c": [
|
|
2413
|
+
{
|
|
2414
|
+
"t": "Image",
|
|
2415
|
+
"es": "media",
|
|
2416
|
+
"bind": "route.@image?",
|
|
2417
|
+
"aspect": "4 / 5",
|
|
2418
|
+
"enter": "media"
|
|
2419
|
+
},
|
|
2420
|
+
{
|
|
2421
|
+
"t": "Container",
|
|
2422
|
+
"es": "box",
|
|
2423
|
+
"lay": {
|
|
2424
|
+
"display": "flex",
|
|
2425
|
+
"flexDirection": "column",
|
|
2426
|
+
"gap": "20px"
|
|
2427
|
+
},
|
|
2428
|
+
"c": [
|
|
2429
|
+
{
|
|
2430
|
+
"t": "Heading",
|
|
2431
|
+
"es": "h1",
|
|
2432
|
+
"level": "h1",
|
|
2433
|
+
"bind": "route.@title",
|
|
2434
|
+
"enter": "heading"
|
|
2435
|
+
},
|
|
2436
|
+
{
|
|
2437
|
+
"t": "Container",
|
|
2438
|
+
"recipe": "price"
|
|
2439
|
+
},
|
|
2440
|
+
{
|
|
2441
|
+
"t": "Text",
|
|
2442
|
+
"es": "body",
|
|
2443
|
+
"bind": "route.@summary?"
|
|
2444
|
+
},
|
|
2445
|
+
{
|
|
2446
|
+
"t": "Container",
|
|
2447
|
+
"recipe": "variants"
|
|
2448
|
+
},
|
|
2449
|
+
{
|
|
2450
|
+
"t": "Container",
|
|
2451
|
+
"es": "box",
|
|
2452
|
+
"lay": {
|
|
2453
|
+
"display": "flex",
|
|
2454
|
+
"flexWrap": "nowrap",
|
|
2455
|
+
"gap": "12px",
|
|
2456
|
+
"alignItems": "stretch"
|
|
2457
|
+
},
|
|
2458
|
+
"c": [
|
|
2459
|
+
{
|
|
2460
|
+
"t": "Container",
|
|
2461
|
+
"recipe": "quantity"
|
|
2462
|
+
},
|
|
2463
|
+
{
|
|
2464
|
+
"t": "ButtonBlock",
|
|
2465
|
+
"recipe": "add"
|
|
2466
|
+
}
|
|
2467
|
+
]
|
|
2468
|
+
},
|
|
2469
|
+
{
|
|
2470
|
+
"t": "ButtonBlock",
|
|
2471
|
+
"recipe": "buyNow"
|
|
2472
|
+
}
|
|
2473
|
+
]
|
|
2474
|
+
}
|
|
2475
|
+
]
|
|
2476
|
+
}
|
|
2477
|
+
]
|
|
2478
|
+
}
|
|
2479
|
+
},
|
|
2167
2480
|
"feature.triad": {
|
|
2168
2481
|
"family": "feature",
|
|
2169
2482
|
"label": "Three services",
|
|
@@ -5761,6 +6074,21 @@ export const SPEC_SITE_LIBRARY = [
|
|
|
5761
6074
|
"family": "collection",
|
|
5762
6075
|
"composed": true
|
|
5763
6076
|
},
|
|
6077
|
+
{
|
|
6078
|
+
"id": "commerce.product-grid",
|
|
6079
|
+
"family": "collection",
|
|
6080
|
+
"composed": true
|
|
6081
|
+
},
|
|
6082
|
+
{
|
|
6083
|
+
"id": "commerce.featured",
|
|
6084
|
+
"family": "collection",
|
|
6085
|
+
"composed": true
|
|
6086
|
+
},
|
|
6087
|
+
{
|
|
6088
|
+
"id": "commerce.product-detail",
|
|
6089
|
+
"family": "detail",
|
|
6090
|
+
"composed": true
|
|
6091
|
+
},
|
|
5764
6092
|
{
|
|
5765
6093
|
"id": "story.long-form",
|
|
5766
6094
|
"family": "story",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ComposedSite, parseSampleImageRef, PlaceholderKind } from './compose-site';
|
|
2
2
|
import { patternById } from './patterns';
|
|
3
3
|
import { createSerializedNode, SerializedNode, walkSerialized } from './serialized-node';
|
|
4
|
-
import { ContentRole, roleField, SitePlan } from './site-plan.model';
|
|
4
|
+
import { ContentRole, roleField, ShopResource, SitePlan } from './site-plan.model';
|
|
5
|
+
import { SHOP_ROLES } from './shop-plan';
|
|
5
6
|
import {
|
|
6
7
|
aspectRatioOf, scoreStockPhoto, STOCK_FAMILY_INTENTS, STOCK_INTENT_ORDER, StockIntent, StockNeed, stockFits, StockPhotoTraits, stockPhotoUsable,
|
|
7
8
|
stockWords,
|
|
@@ -275,8 +276,16 @@ export function stockSlots(plan: SitePlan, composed: Pick<ComposedSite, 'pages'
|
|
|
275
276
|
* The sample items' pictures a stock photo may fill: per content type with an `image` role, each MARKED sample whose
|
|
276
277
|
* image is still a bundled sample (`{sampleImage:k}`), with the type's and the item's own words.
|
|
277
278
|
*/
|
|
278
|
-
export function stockItemSlots(plan: Pick<SitePlan, 'contentTypes'>, composed: Pick<ComposedSite, 'items'>): StockItemSlot[] {
|
|
279
|
+
export function stockItemSlots(plan: Pick<SitePlan, 'contentTypes'>, composed: Pick<ComposedSite, 'items'> & Partial<Pick<ComposedSite, 'shop'>>): StockItemSlot[] {
|
|
279
280
|
const out: StockItemSlot[] = [];
|
|
281
|
+
// Commerce G1: a sample product's picture (the shop's `image` role) — its name is what the photo must show.
|
|
282
|
+
(composed.shop?.products ?? []).forEach((product, index) => {
|
|
283
|
+
if (product.mainImage) return;
|
|
284
|
+
out.push({
|
|
285
|
+
kind: StockSlotKind.Item, contentType: ShopResource.Products, index, field: SHOP_IMAGE_FIELD, intent: StockIntent.Product, aspect: STOCK_ITEM_ASPECT,
|
|
286
|
+
words: stockWords(product.title, product.category, product.description), subject: stockWords(product.title),
|
|
287
|
+
});
|
|
288
|
+
});
|
|
280
289
|
for (const type of plan.contentTypes) {
|
|
281
290
|
const field = roleField(type, ContentRole.Image);
|
|
282
291
|
if (!field) continue;
|
|
@@ -289,6 +298,8 @@ export function stockItemSlots(plan: Pick<SitePlan, 'contentTypes'>, composed: P
|
|
|
289
298
|
return out;
|
|
290
299
|
}
|
|
291
300
|
|
|
301
|
+
const SHOP_IMAGE_FIELD = SHOP_ROLES[ShopResource.Products].image!;
|
|
302
|
+
|
|
292
303
|
export type StockPlacement<T extends StockTarget = StockTarget> = T & { photo: StockPhoto };
|
|
293
304
|
|
|
294
305
|
/** What a placement run is told besides the slots and the library. */
|
|
@@ -384,6 +395,12 @@ export function applyStockPhotos(trees: ReadonlyArray<SerializedNode>, placed: R
|
|
|
384
395
|
return changed;
|
|
385
396
|
}
|
|
386
397
|
|
|
398
|
+
/** The sample rows a build gives pictures to, by list: the content types' items and (commerce G1) the shop's products. */
|
|
399
|
+
export function pictureItemsOf(composed: Pick<ComposedSite, 'items'> & Partial<Pick<ComposedSite, 'shop'>>): Record<string, ReadonlyArray<Record<string, unknown>>> {
|
|
400
|
+
const products = composed.shop?.products as unknown as ReadonlyArray<Record<string, unknown>> | undefined;
|
|
401
|
+
return products ? { ...composed.items, [ShopResource.Products]: products } : { ...composed.items };
|
|
402
|
+
}
|
|
403
|
+
|
|
387
404
|
/** Put the studio's copy of each photo into its sample item's image field. Returns the items changed. */
|
|
388
405
|
export function applyStockItemPhotos(
|
|
389
406
|
items: Readonly<Record<string, ReadonlyArray<Record<string, unknown>>>>,
|
|
@@ -7,9 +7,11 @@ import {
|
|
|
7
7
|
BindScope, patternById, patternHasForm, patternLinkSlots, patternNeedsBinding, patternOptionalParts, patternRoleNeeds, patternTakesBinding, patternScopes,
|
|
8
8
|
patternSlots, PatternGlobalPosition, slotBudget, SCENE_LEVEL, SCENE_OTHER_PAGES } from './patterns';
|
|
9
9
|
import { ContentFieldControl, FIELD_TYPE_OF_CONTROL,
|
|
10
|
-
FACT_KEYS, GlobalSlot, PAGE_ARCHETYPES, SITE_NEED_IDS, PlanDataSourceMode, PlanDataSourceType, RelativeOp, REQUIRED_CONTENT_ROLES,
|
|
11
|
-
SITE_LOCALES, SITE_PLAN_VERSION,
|
|
10
|
+
FACT_KEYS, GlobalSlot, PAGE_ARCHETYPES, SITE_NEED_IDS, PlanDataSourceMode, PlanDataSourceType, RelativeOp, REQUIRED_CONTENT_ROLES, ShopResource, SitePlan,
|
|
11
|
+
SitePlanSourceKind, SITE_LOCALES, SITE_PLAN_VERSION,
|
|
12
12
|
} from './site-plan.model';
|
|
13
|
+
import { pricesIn } from './plan-words';
|
|
14
|
+
import { isShopResource, planSells, SHOP_PRODUCTS_MAX, SHOP_SLUG_FIELD, shopContentType } from './shop-plan';
|
|
13
15
|
import { artDirectionIssues } from './art-direction';
|
|
14
16
|
import { patternListGap } from './recipe-fields';
|
|
15
17
|
import { SPEC_SITE_LAYOUT, SPEC_SITE_PLAN_SHAPE } from './site-spec.generated';
|
|
@@ -85,6 +87,20 @@ export enum SitePlanIssueCode {
|
|
|
85
87
|
Compose = 'compose',
|
|
86
88
|
/** M8 gate 2: a composed page's layout (`checkLayout`'s issues, each at its path under `layout`). */
|
|
87
89
|
Layout = 'layout',
|
|
90
|
+
/** Commerce C-D21: what the business sells — a selling business without its products, one that sells nothing with a
|
|
91
|
+
* shop, a product past the sixth, a shop source with no shop, or a content type named after a shop list. */
|
|
92
|
+
Shop = 'shop',
|
|
93
|
+
/** Commerce C-D21: a selling site has a product page — a page at a `:slug` route reading the shop's one product. */
|
|
94
|
+
ProductPage = 'product-page',
|
|
95
|
+
/** Commerce C-D21: a price, a stock count or a fee written into what the business sells — the owner sets those. */
|
|
96
|
+
Price = 'price',
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** What the validator is told about the business (iox-cms's reading), beyond the plan itself. */
|
|
100
|
+
export interface SitePlanContext {
|
|
101
|
+
/** True: the business sells (the reading's need `products`) — the plan must name what. False: it sells nothing — the
|
|
102
|
+
* plan holds no shop. Absent: the plan is judged as written (a template, a stored plan). */
|
|
103
|
+
readonly sells?: boolean;
|
|
88
104
|
}
|
|
89
105
|
|
|
90
106
|
export type SitePlanIssue = PathIssue<SitePlanIssueCode>;
|
|
@@ -122,6 +138,10 @@ const SLUG_FIELD = 'slug';
|
|
|
122
138
|
const SEED_FIXED_KEYS = shapeKeys(SHAPE['seed']);
|
|
123
139
|
const CMS_SOURCE_KEYS = shapeKeys(SHAPE['cmsDataSource']);
|
|
124
140
|
const RELATIVE_SOURCE_KEYS = shapeKeys(SHAPE['relativeDataSource']);
|
|
141
|
+
const SHOP_SOURCE_KEYS = shapeKeys(SHAPE['shopDataSource']);
|
|
142
|
+
const SHOP_KEYS = shapeKeys(SHAPE['shop']);
|
|
143
|
+
const SHOP_PRODUCT_KEYS = shapeKeys(SHAPE['shopProduct']);
|
|
144
|
+
const SHOP_OPTION_KEYS = shapeKeys(SHAPE['shopOption']);
|
|
125
145
|
const PAGE_KEYS = shapeKeys(SHAPE['page']);
|
|
126
146
|
const FILM_KEYS = shapeKeys(SHAPE['film']);
|
|
127
147
|
const ART_DIRECTION_KEYS = shapeKeys(SHAPE['artDirection']);
|
|
@@ -288,6 +308,10 @@ function validateRoles(c: Collector, roles: unknown, path: string, typeName: str
|
|
|
288
308
|
|
|
289
309
|
interface SourceInfo { type: string; mode?: string; contentType?: string; routeParam?: string; of?: string; op?: string; }
|
|
290
310
|
|
|
311
|
+
/** A source a page may read ONE item from by its route (`routeSource`), or bind a list to — a cms one or the shop's. */
|
|
312
|
+
const isItemSource = (s: SourceInfo | undefined) => !!s && (s.type === PlanDataSourceType.Cms || s.type === PlanDataSourceType.Shop) && s.mode === PlanDataSourceMode.Single;
|
|
313
|
+
const isListSource = (s: SourceInfo | undefined) => !!s && (s.type === PlanDataSourceType.Cms || s.type === PlanDataSourceType.Shop) && s.mode === PlanDataSourceMode.Query;
|
|
314
|
+
|
|
291
315
|
function validateDataSources(c: Collector, list: unknown[], types: Map<string, ContentTypeInfo>): Map<string, SourceInfo> {
|
|
292
316
|
const sources = new Map<string, SourceInfo>();
|
|
293
317
|
list.forEach((raw, i) => {
|
|
@@ -324,8 +348,11 @@ function validateDataSources(c: Collector, list: unknown[], types: Map<string, C
|
|
|
324
348
|
c.string(raw, 'within', path);
|
|
325
349
|
if (!(Object.values(RelativeOp) as unknown[]).includes(raw['op'])) c.add(SitePlanIssueCode.InvalidDataSource, `${path}.op`, `must be one of ${Object.values(RelativeOp).join(', ')}`);
|
|
326
350
|
if (alias && !sources.has(alias)) sources.set(alias, { type: PlanDataSourceType.Relative, of: raw['of'] as string, op: raw['op'] as string });
|
|
351
|
+
} else if (raw['type'] === PlanDataSourceType.Shop) {
|
|
352
|
+
const routeParam = validateShopSource(c, raw, path);
|
|
353
|
+
if (alias && !sources.has(alias)) sources.set(alias, { type: PlanDataSourceType.Shop, mode: raw['mode'] as string, contentType: raw['resource'] as string, routeParam });
|
|
327
354
|
} else {
|
|
328
|
-
c.add(SitePlanIssueCode.InvalidDataSource, `${path}.type`, `must be
|
|
355
|
+
c.add(SitePlanIssueCode.InvalidDataSource, `${path}.type`, `must be one of ${Object.values(PlanDataSourceType).map(t => `"${t}"`).join(', ')}`);
|
|
329
356
|
}
|
|
330
357
|
});
|
|
331
358
|
c.unique(list.map(r => (isObject(r) && isNonEmptyString(r['alias']) ? r['alias'] : null)), i => `dataSources[${i}].alias`, 'alias');
|
|
@@ -341,6 +368,95 @@ function validateDataSources(c: Collector, list: unknown[], types: Map<string, C
|
|
|
341
368
|
return sources;
|
|
342
369
|
}
|
|
343
370
|
|
|
371
|
+
/** A shop source (derived — `derivedShopSources` — so a bad one is the plan's own writing): a list of the shop or one row of
|
|
372
|
+
* it by its slug. Returns the route param it is looked up by. */
|
|
373
|
+
function validateShopSource(c: Collector, raw: Obj, path: string): string | undefined {
|
|
374
|
+
c.keys(raw, SHOP_SOURCE_KEYS, path);
|
|
375
|
+
const mode = raw['mode'];
|
|
376
|
+
if (mode !== PlanDataSourceMode.Query && mode !== PlanDataSourceMode.Single) c.add(SitePlanIssueCode.InvalidDataSource, `${path}.mode`, `must be "${PlanDataSourceMode.Query}" or "${PlanDataSourceMode.Single}"`);
|
|
377
|
+
if (!isShopResource(raw['resource'])) c.add(SitePlanIssueCode.InvalidDataSource, `${path}.resource`, `must be one of ${Object.values(ShopResource).join(', ')}`);
|
|
378
|
+
if (raw['limit'] !== undefined && (!Number.isInteger(raw['limit']) || (raw['limit'] as number) < 1)) c.add(SitePlanIssueCode.InvalidDataSource, `${path}.limit`, 'must be a positive whole number');
|
|
379
|
+
const byRoute = raw['filterByRouteParam'];
|
|
380
|
+
if (byRoute === undefined) return undefined;
|
|
381
|
+
if (!isObject(byRoute)) { c.add(SitePlanIssueCode.Shape, `${path}.filterByRouteParam`, 'must be an object'); return undefined; }
|
|
382
|
+
c.keys(byRoute, ['field', 'routeParam'], `${path}.filterByRouteParam`);
|
|
383
|
+
const field = c.string(byRoute, 'field', `${path}.filterByRouteParam`);
|
|
384
|
+
const routeParam = c.string(byRoute, 'routeParam', `${path}.filterByRouteParam`) ?? undefined;
|
|
385
|
+
if (field && field !== SHOP_SLUG_FIELD) c.add(SitePlanIssueCode.InvalidDataSource, `${path}.filterByRouteParam.field`, `a shop row is looked up by its ${SHOP_SLUG_FIELD}`);
|
|
386
|
+
if (mode !== PlanDataSourceMode.Single) c.add(SitePlanIssueCode.InvalidDataSource, `${path}.filterByRouteParam`, 'only a single source is looked up by a route param');
|
|
387
|
+
return routeParam;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Commerce C-D21: what the business sells — up to six products by name, each in one of the categories, how each varies;
|
|
392
|
+
* never a price, a stock count or a fee (the owner sets those, shop-aware §3i). A selling business must say what it
|
|
393
|
+
* sells, one that sells nothing holds no shop, and a shop list is never a content type's name (its collection is the
|
|
394
|
+
* shop's). Returns whether the plan sells.
|
|
395
|
+
*/
|
|
396
|
+
function validateShop(c: Collector, plan: Obj, ctx: SitePlanContext): boolean {
|
|
397
|
+
c.array(plan, 'contentTypes', '').forEach((t, i) => {
|
|
398
|
+
if (isObject(t) && isShopResource(t['name'])) c.add(SitePlanIssueCode.Shop, `contentTypes[${i}].name`, `"${t['name']}" is the shop's own list — what the business sells goes in shop, never a content type`);
|
|
399
|
+
});
|
|
400
|
+
const shop = plan['shop'];
|
|
401
|
+
const sells = planSells(plan);
|
|
402
|
+
if (ctx.sells === true && !sells) c.add(SitePlanIssueCode.Shop, 'shop', `this business sells — name what (1–${SHOP_PRODUCTS_MAX} products, each in a category)`);
|
|
403
|
+
if (ctx.sells === false && shop !== undefined) c.add(SitePlanIssueCode.Shop, 'shop', 'this business sells nothing online — no shop');
|
|
404
|
+
if (!sells) {
|
|
405
|
+
c.array(plan, 'dataSources', '').forEach((d, i) => {
|
|
406
|
+
if (isObject(d) && d['type'] === PlanDataSourceType.Shop) c.add(SitePlanIssueCode.Shop, `dataSources[${i}]`, 'a shop source on a plan that sells nothing');
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
if (shop === undefined) return sells;
|
|
410
|
+
if (!isObject(shop)) { c.add(SitePlanIssueCode.Shape, 'shop', 'must be an object'); return false; }
|
|
411
|
+
c.keys(shop, SHOP_KEYS, 'shop');
|
|
412
|
+
const categories = c.array(shop, 'categories', 'shop');
|
|
413
|
+
categories.forEach((name, i) => { if (!isNonEmptyString(name)) c.add(SitePlanIssueCode.Shape, `shop.categories[${i}]`, 'must be a name'); });
|
|
414
|
+
c.unique(categories.map(n => (isNonEmptyString(n) ? n : null)), i => `shop.categories[${i}]`, 'category');
|
|
415
|
+
const products = c.array(shop, 'products', 'shop');
|
|
416
|
+
if (!products.length) c.add(SitePlanIssueCode.Shop, 'shop.products', 'name what the business sells, or hold no shop');
|
|
417
|
+
if (products.length > SHOP_PRODUCTS_MAX) c.add(SitePlanIssueCode.Shop, 'shop.products', `${products.length} products — at most ${SHOP_PRODUCTS_MAX} samples`);
|
|
418
|
+
const price = (path: string, text: unknown) => {
|
|
419
|
+
if (typeof text === 'string' && pricesIn(text).length) c.add(SitePlanIssueCode.Price, path, `"${pricesIn(text)[0]}" — never a price, stock or fee: the owner sets those`);
|
|
420
|
+
};
|
|
421
|
+
products.forEach((raw, i) => {
|
|
422
|
+
const path = `shop.products[${i}]`;
|
|
423
|
+
if (!isObject(raw)) return c.add(SitePlanIssueCode.Shape, path, 'must be an object');
|
|
424
|
+
c.keys(raw, SHOP_PRODUCT_KEYS, path);
|
|
425
|
+
price(`${path}.name`, c.string(raw, 'name', path));
|
|
426
|
+
const category = c.string(raw, 'category', path);
|
|
427
|
+
if (category && !categories.includes(category)) c.add(SitePlanIssueCode.Shop, `${path}.category`, `"${category}" is not one of the shop's categories`);
|
|
428
|
+
const description = raw['description'];
|
|
429
|
+
if (typeof description !== 'string') c.add(SitePlanIssueCode.Shape, `${path}.description`, 'must be a string (one line)');
|
|
430
|
+
else price(`${path}.description`, description);
|
|
431
|
+
const options = c.array(raw, 'options', path);
|
|
432
|
+
options.forEach((o, j) => {
|
|
433
|
+
const op = `${path}.options[${j}]`;
|
|
434
|
+
if (!isObject(o)) return c.add(SitePlanIssueCode.Shape, op, 'must be an object');
|
|
435
|
+
c.keys(o, SHOP_OPTION_KEYS, op);
|
|
436
|
+
c.string(o, 'name', op);
|
|
437
|
+
const values = c.array(o, 'values', op);
|
|
438
|
+
if (!values.length) c.add(SitePlanIssueCode.Shop, `${op}.values`, 'an option names its values (sizes, colours…)');
|
|
439
|
+
values.forEach((v, k) => { if (!isNonEmptyString(v)) c.add(SitePlanIssueCode.Shape, `${op}.values[${k}]`, 'must be a name'); else price(`${op}.values[${k}]`, v); });
|
|
440
|
+
c.unique(values.map(v => (isNonEmptyString(v) ? v : null)), k => `${op}.values[${k}]`, 'value');
|
|
441
|
+
});
|
|
442
|
+
c.unique(options.map(o => (isObject(o) && isNonEmptyString(o['name']) ? o['name'] : null)), j => `${path}.options[${j}].name`, 'option');
|
|
443
|
+
});
|
|
444
|
+
c.unique(products.map(p => (isObject(p) && isNonEmptyString(p['name']) ? p['name'] : null)), i => `shop.products[${i}].name`, 'product');
|
|
445
|
+
return sells;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/** A selling site has a product page: a page whose route item is the shop's one product (`/shop/:slug`). */
|
|
449
|
+
function validateProductPage(c: Collector, pages: unknown[], sources: Map<string, SourceInfo>): void {
|
|
450
|
+
const hasProductPage = pages.some(p => {
|
|
451
|
+
const source = isObject(p) && typeof p['routeSource'] === 'string' ? sources.get(p['routeSource']) : undefined;
|
|
452
|
+
return source?.type === PlanDataSourceType.Shop && source.mode === PlanDataSourceMode.Single && source.contentType === ShopResource.Products;
|
|
453
|
+
});
|
|
454
|
+
if (!hasProductPage) {
|
|
455
|
+
const item = [...sources].find(([, s]) => s.type === PlanDataSourceType.Shop && s.mode === PlanDataSourceMode.Single)?.[0] ?? 'product';
|
|
456
|
+
c.add(SitePlanIssueCode.ProductPage, 'pages', `this site sells — it needs a product page: a page at /shop/:slug whose routeSource is "${item}" and template "${ShopResource.Products}"`);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
344
460
|
function validatePages(c: Collector, list: unknown[], types: Map<string, ContentTypeInfo>, sources: Map<string, SourceInfo>, density: string | null): void {
|
|
345
461
|
const homes: number[] = [];
|
|
346
462
|
const routes = new Set(list.map(p => (isObject(p) && typeof p['route'] === 'string' ? p['route'] : null)).filter((r): r is string => !!r));
|
|
@@ -365,13 +481,13 @@ function validatePages(c: Collector, list: unknown[], types: Map<string, Content
|
|
|
365
481
|
const template = c.string(raw, 'template', path, false);
|
|
366
482
|
const routeSourceAlias = c.string(raw, 'routeSource', path, false);
|
|
367
483
|
const routeSource = routeSourceAlias ? sources.get(routeSourceAlias) : undefined;
|
|
368
|
-
const routeSourceOk =
|
|
484
|
+
const routeSourceOk = isItemSource(routeSource);
|
|
369
485
|
if (template && !types.has(template)) c.add(SitePlanIssueCode.UnknownContentType, `${path}.template`, `no content type "${template}" in the plan`);
|
|
370
486
|
if (params.length > 1) c.add(SitePlanIssueCode.InvalidRoute, `${path}.route`, 'a template page has one route param');
|
|
371
487
|
if (params.length && !routeSourceAlias) c.add(SitePlanIssueCode.RouteSource, `${path}.routeSource`, `a route with :${params[0]} names the source that reads it`);
|
|
372
488
|
if (routeSourceAlias) {
|
|
373
489
|
if (!routeSourceOk) {
|
|
374
|
-
c.add(SitePlanIssueCode.RouteSource, `${path}.routeSource`, `"${routeSourceAlias}" must be a single
|
|
490
|
+
c.add(SitePlanIssueCode.RouteSource, `${path}.routeSource`, `"${routeSourceAlias}" must be a single source of the plan`);
|
|
375
491
|
} else {
|
|
376
492
|
if (!params.length || routeSource!.routeParam !== params[0]) c.add(SitePlanIssueCode.RouteSource, `${path}.routeSource`, `"${routeSourceAlias}" is not looked up by this route's param`);
|
|
377
493
|
if (template && routeSource!.contentType !== template) c.add(SitePlanIssueCode.RouteSource, `${path}.template`, `"${routeSourceAlias}" reads ${routeSource!.contentType}, not ${template}`);
|
|
@@ -439,7 +555,7 @@ function validatePages(c: Collector, list: unknown[], types: Map<string, Content
|
|
|
439
555
|
} else {
|
|
440
556
|
const src = sources.get(binding);
|
|
441
557
|
if (!src) c.add(SitePlanIssueCode.UnknownDataSource, `${sp}.binding`, `no data source "${binding}"`);
|
|
442
|
-
else if (src
|
|
558
|
+
else if (!isListSource(src)) c.add(SitePlanIssueCode.Binding, `${sp}.binding`, `"${binding}" is not a list source`);
|
|
443
559
|
else {
|
|
444
560
|
const listed = src.contentType ? types.get(src.contentType) : undefined;
|
|
445
561
|
const gap = listed ? patternListGap(pattern, listed.described) : null;
|
|
@@ -448,6 +564,15 @@ function validatePages(c: Collector, list: unknown[], types: Map<string, Content
|
|
|
448
564
|
}
|
|
449
565
|
} else if (binding) c.add(SitePlanIssueCode.Binding, `${sp}.binding`, `"${patternId}" repeats nothing — it takes no binding`);
|
|
450
566
|
|
|
567
|
+
// Commerce G1: a store section reads the shop — its list from a shop source, its product from the page's.
|
|
568
|
+
if (pattern.shop) {
|
|
569
|
+
const listed = binding ? sources.get(binding) : undefined;
|
|
570
|
+
if (listed && listed.type !== PlanDataSourceType.Shop) c.add(SitePlanIssueCode.Binding, `${sp}.binding`, `"${patternId}" shows the shop's products — bind a shop source, not "${binding}"`);
|
|
571
|
+
if (patternScopes(pattern).has(BindScope.Route) && routeSourceOk && routeSource!.type !== PlanDataSourceType.Shop) {
|
|
572
|
+
c.add(SitePlanIssueCode.RouteSource, `${sp}.pattern`, `"${patternId}" shows one product — its page reads a shop source, not "${routeSourceAlias}"`);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
451
576
|
// A pattern reading the route item needs a routeSource (an INVALID one is reported above, once).
|
|
452
577
|
const scopes = patternScopes(pattern);
|
|
453
578
|
const readsRoute = scopes.has(BindScope.Route) || scopes.has(BindScope.Next);
|
|
@@ -561,7 +686,7 @@ function validateGlobals(c: Collector, globals: unknown): void {
|
|
|
561
686
|
}
|
|
562
687
|
|
|
563
688
|
/** Check a Site Plan against the plan shape and the pattern library. Never throws, never repairs. */
|
|
564
|
-
export function validateSitePlan(plan: unknown): SitePlanValidation {
|
|
689
|
+
export function validateSitePlan(plan: unknown, ctx: SitePlanContext = {}): SitePlanValidation {
|
|
565
690
|
const c = new Collector();
|
|
566
691
|
if (!isObject(plan)) {
|
|
567
692
|
c.add(SitePlanIssueCode.Shape, '', 'a site plan is an object');
|
|
@@ -575,8 +700,10 @@ export function validateSitePlan(plan: unknown): SitePlanValidation {
|
|
|
575
700
|
validateDesign(c, plan['design']);
|
|
576
701
|
const types = validateContentTypes(c, c.array(plan, 'contentTypes', ''));
|
|
577
702
|
const sources = validateDataSources(c, c.array(plan, 'dataSources', ''), types);
|
|
703
|
+
const sells = validateShop(c, plan, ctx);
|
|
578
704
|
const design = isObject(plan['design']) ? plan['design'] : {};
|
|
579
|
-
validatePages(c, c.array(plan, 'pages', ''), types, sources, typeof design['density'] === 'string' ? design['density'] : null);
|
|
705
|
+
validatePages(c, c.array(plan, 'pages', ''), withShopTypes(types, sources), sources, typeof design['density'] === 'string' ? design['density'] : null);
|
|
706
|
+
if (sells) validateProductPage(c, c.array(plan, 'pages', ''), sources);
|
|
580
707
|
validateGlobals(c, plan['globals']);
|
|
581
708
|
validateScenes(c, c.array(plan, 'pages', ''), typeof design['animate'] === 'string' ? design['animate'] : null);
|
|
582
709
|
validateFilm(c, plan['film'], c.array(plan, 'pages', ''));
|
|
@@ -627,6 +754,17 @@ function validateComposed(c: Collector, pages: unknown[]): void {
|
|
|
627
754
|
if (composed > COMPOSED_PAGES_MAX) c.add(SitePlanIssueCode.Compose, 'pages', `${composed} composed pages — the home page and at most ${COMPOSED_PAGES_MAX - 1} other`);
|
|
628
755
|
}
|
|
629
756
|
|
|
757
|
+
/** The plan's content types and, for each shop list a source reads, the shop's own (fixed fields and roles). */
|
|
758
|
+
function withShopTypes(types: Map<string, ContentTypeInfo>, sources: Map<string, SourceInfo>): Map<string, ContentTypeInfo> {
|
|
759
|
+
const out = new Map(types);
|
|
760
|
+
for (const s of sources.values()) {
|
|
761
|
+
if (s.type !== PlanDataSourceType.Shop || !isShopResource(s.contentType) || out.has(s.contentType)) continue;
|
|
762
|
+
const shop = shopContentType(s.contentType);
|
|
763
|
+
out.set(s.contentType, { fields: new Set(shop.fields.map(f => f.name)), described: shop.fields.map(f => ({ ...f })), roles: { ...shop.roles } as Record<string, string> });
|
|
764
|
+
}
|
|
765
|
+
return out;
|
|
766
|
+
}
|
|
767
|
+
|
|
630
768
|
/** Throw a `SitePlanError` carrying every issue unless the plan is valid. */
|
|
631
769
|
export function assertValidSitePlan(plan: unknown): void {
|
|
632
770
|
const result = validateSitePlan(plan);
|