@vectoriox/iox-ui 5.97.0 → 5.99.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/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/fesm2022/vectoriox-iox-ui-identity-core.mjs +535 -0
- package/fesm2022/vectoriox-iox-ui-identity-core.mjs.map +1 -0
- package/generation-core/index.d.ts +515 -17
- package/harness-core/index.d.ts +66 -6
- package/identity-core/index.d.ts +364 -0
- package/identity-core/package.json +3 -0
- package/package.json +5 -1
- 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
- package/src/identity-core/guards.ts +87 -0
- package/src/identity-core/public-api.ts +13 -0
- package/src/identity-core/sign-in.ts +223 -0
- package/src/identity-core/site-auth.ts +172 -0
- package/src/identity-core/words.ts +194 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComposedPlaceholder, ComposeIssue } from './compose-site';
|
|
2
2
|
import { SitePlan, SitePlanSource } from './site-plan.model';
|
|
3
3
|
import { SitePlanIssueCode } from './validate-site-plan';
|
|
4
|
+
import { planSells } from './shop-plan';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* A site build's WIRE vocabulary (AI plan §3b, W2): what iox-cms's `site-builds` API answers and what every
|
|
@@ -32,6 +33,8 @@ export enum BuildStep {
|
|
|
32
33
|
/** I2: the curated stock photos the plan's empty picture slots take, copied into the studio (never hot-linked). */
|
|
33
34
|
StockPhotos = 'stock-photos',
|
|
34
35
|
Items = 'items',
|
|
36
|
+
/** Commerce G1: what the business sells, into the studio's SHOP — its categories, then sample products (no price). */
|
|
37
|
+
Shop = 'shop',
|
|
35
38
|
DataSources = 'data-sources',
|
|
36
39
|
Pages = 'pages',
|
|
37
40
|
Globals = 'globals',
|
|
@@ -40,6 +43,12 @@ export enum BuildStep {
|
|
|
40
43
|
|
|
41
44
|
export const BUILD_STEPS: ReadonlyArray<BuildStep> = Object.values(BuildStep);
|
|
42
45
|
|
|
46
|
+
/** The steps a build of `plan` takes, in order: every one, the shop's only when the plan sells (commerce G1). */
|
|
47
|
+
export function buildStepsOf(plan: unknown): BuildStep[] {
|
|
48
|
+
const sells = planSells(plan);
|
|
49
|
+
return BUILD_STEPS.filter(step => step !== BuildStep.Shop || sells);
|
|
50
|
+
}
|
|
51
|
+
|
|
43
52
|
export enum StepState {
|
|
44
53
|
Wait = 'wait',
|
|
45
54
|
Run = 'run',
|
|
@@ -56,6 +65,10 @@ export enum CreatedKind {
|
|
|
56
65
|
/** A stock photo copied into the studio's storage (`media/stock/…`), with its assets row. */
|
|
57
66
|
StockPhoto = 'stock-photo',
|
|
58
67
|
Item = 'item',
|
|
68
|
+
/** Commerce G1: a shop category the build added (one the studio had is reused, never recorded). */
|
|
69
|
+
ShopCategory = 'shop-category',
|
|
70
|
+
/** Commerce G1: a sample product, written through the shop's own write path. */
|
|
71
|
+
ShopProduct = 'shop-product',
|
|
59
72
|
DataSource = 'data-source',
|
|
60
73
|
Page = 'page',
|
|
61
74
|
Global = 'global',
|
|
@@ -132,6 +145,11 @@ export enum BuildNoticeCode {
|
|
|
132
145
|
/** M7: a picture made for the site was refused by its review twice (or its second try did not fit the cost shown):
|
|
133
146
|
* stock or the empty box stands in, and the run says so. */
|
|
134
147
|
PictureFallback = 'picture-fallback',
|
|
148
|
+
/** Commerce G1 (shop-aware A-D9): the studio already sells products — the site shows them, and no sample is added. */
|
|
149
|
+
ShopHasProducts = 'shop-has-products',
|
|
150
|
+
/** Commerce G1: the studio had never set its currency and VAT — the build stored the ones its language implies
|
|
151
|
+
* (Hebrew: ILS and 18%), said here so the owner checks them in Settings ▸ General before setting prices. */
|
|
152
|
+
ShopMoneyInferred = 'shop-money-inferred',
|
|
135
153
|
}
|
|
136
154
|
|
|
137
155
|
export interface BuildNotice {
|
|
@@ -206,6 +224,8 @@ export const buildKeys = {
|
|
|
206
224
|
contentType: (name: string) => `schema:${name}`,
|
|
207
225
|
contentTypeFields: (name: string) => `schema-fields:${name}`,
|
|
208
226
|
item: (contentType: string, n: number) => `item:${contentType}:${n}`,
|
|
227
|
+
shopCategory: (n: number) => `shop-category:${n}`,
|
|
228
|
+
shopProduct: (n: number) => `shop-product:${n}`,
|
|
209
229
|
sampleImage: (n: number) => `sample-image:${n}`,
|
|
210
230
|
stockPhoto: (libraryKey: string) => `stock-photo:${libraryKey}`,
|
|
211
231
|
dataSource: (alias: string) => `data-source:${alias}`,
|
|
@@ -249,6 +269,9 @@ export interface BuildStepFacts {
|
|
|
249
269
|
contentTypeActions: Partial<Record<ContentTypeAction, string[]>>;
|
|
250
270
|
/** Sample items, all types together. */
|
|
251
271
|
items: number;
|
|
272
|
+
/** Commerce G1: sample products for the shop (0 = the plan sells nothing) and their categories. */
|
|
273
|
+
products: number;
|
|
274
|
+
categories: number;
|
|
252
275
|
/** Pages (template pages included) and their routes. */
|
|
253
276
|
pages: number;
|
|
254
277
|
routes: string[];
|
|
@@ -268,6 +291,8 @@ export function buildStepFacts(plan: SitePlan, actions: Readonly<Record<string,
|
|
|
268
291
|
contentTypes: plan.contentTypes.map(t => t.label),
|
|
269
292
|
contentTypeActions,
|
|
270
293
|
items: plan.contentTypes.reduce((n, t) => n + (t.seed?.count ?? 0), 0),
|
|
294
|
+
products: plan.shop?.products.length ?? 0,
|
|
295
|
+
categories: plan.shop?.categories.length ?? 0,
|
|
271
296
|
pages: plan.pages.length,
|
|
272
297
|
routes: plan.pages.map(p => p.route),
|
|
273
298
|
navLinks: plan.pages.filter(p => p.inNav).length,
|
|
@@ -96,8 +96,15 @@ export enum ContentRole {
|
|
|
96
96
|
Meta = 'meta',
|
|
97
97
|
Date = 'date',
|
|
98
98
|
Gallery = 'gallery',
|
|
99
|
+
/** Commerce C-D21: the shop's own price — played only by the shop's fields (`SHOP_ROLES`), never a content type's. */
|
|
100
|
+
Price = 'price',
|
|
101
|
+
/** Commerce C-D21: the shop's earlier price, struck through. */
|
|
102
|
+
CompareAt = 'compareAt',
|
|
99
103
|
}
|
|
100
104
|
|
|
105
|
+
/** The roles only the shop plays (contract `site.roles` less `planShape.roles`): a content type never names them. */
|
|
106
|
+
export const SHOP_ONLY_CONTENT_ROLES: ReadonlyArray<`${ContentRole}`> = [ContentRole.Price, ContentRole.CompareAt];
|
|
107
|
+
|
|
101
108
|
/** What each role means, verbatim from the contract — what the model reads. */
|
|
102
109
|
export const CONTENT_ROLE_MEANINGS: Readonly<Record<`${ContentRole}`, string>> = SPEC_SITE_ROLES;
|
|
103
110
|
export const REQUIRED_CONTENT_ROLES: ReadonlyArray<`${ContentRole}`> = SPEC_SITE_REQUIRED_ROLES;
|
|
@@ -126,6 +133,14 @@ export function roleField(type: Pick<ContentTypePlan, 'roles'> | null | undefine
|
|
|
126
133
|
export enum PlanDataSourceType {
|
|
127
134
|
Cms = 'cms',
|
|
128
135
|
Relative = 'relative',
|
|
136
|
+
/** Commerce C-D21 (shop-aware A-D1): the studio's SHOP — products a visitor buys are never a content type. */
|
|
137
|
+
Shop = 'shop',
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** The shop lists a plan's shop source may read (closed, so a plan can never name `orders`). */
|
|
141
|
+
export enum ShopResource {
|
|
142
|
+
Products = 'products',
|
|
143
|
+
Categories = 'categories',
|
|
129
144
|
}
|
|
130
145
|
|
|
131
146
|
export enum PlanDataSourceMode {
|
|
@@ -158,7 +173,37 @@ export interface RelativeDataSourcePlan {
|
|
|
158
173
|
readonly within: string;
|
|
159
174
|
}
|
|
160
175
|
|
|
161
|
-
|
|
176
|
+
/** Commerce C-D21: a list of the shop (or one row of it, by a route param) — derived from the plan's `shop`, never asked. */
|
|
177
|
+
export interface ShopDataSourcePlan {
|
|
178
|
+
readonly alias: string;
|
|
179
|
+
readonly type: `${PlanDataSourceType.Shop}`;
|
|
180
|
+
readonly mode: `${PlanDataSourceMode}`;
|
|
181
|
+
readonly resource: `${ShopResource}`;
|
|
182
|
+
readonly limit?: number;
|
|
183
|
+
readonly filterByRouteParam?: { readonly field: string; readonly routeParam: string };
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export type DataSourcePlan = CmsDataSourcePlan | RelativeDataSourcePlan | ShopDataSourcePlan;
|
|
187
|
+
|
|
188
|
+
/** One way a product varies (Size: S, M, L). */
|
|
189
|
+
export interface ShopOptionPlan {
|
|
190
|
+
readonly name: string;
|
|
191
|
+
readonly values: ReadonlyArray<string>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/** A sample product, by name (commerce §3j): never a price, stock or a fee — the owner sets those. */
|
|
195
|
+
export interface ShopProductPlan {
|
|
196
|
+
readonly name: string;
|
|
197
|
+
readonly category: string;
|
|
198
|
+
readonly description: string;
|
|
199
|
+
readonly options: ReadonlyArray<ShopOptionPlan>;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** What the business sells (commerce C-D21): its categories and up to six sample products. */
|
|
203
|
+
export interface ShopPlan {
|
|
204
|
+
readonly categories: ReadonlyArray<string>;
|
|
205
|
+
readonly products: ReadonlyArray<ShopProductPlan>;
|
|
206
|
+
}
|
|
162
207
|
|
|
163
208
|
export interface PageSectionPlan {
|
|
164
209
|
readonly pattern: string;
|
|
@@ -254,6 +299,9 @@ export interface SitePlan {
|
|
|
254
299
|
readonly dataSources: ReadonlyArray<DataSourcePlan>;
|
|
255
300
|
readonly pages: ReadonlyArray<PagePlan>;
|
|
256
301
|
readonly globals: Readonly<Record<`${GlobalSlot}`, string>>;
|
|
302
|
+
/** Commerce C-D21: what the business sells — present = the site is a whole store (shop sources, product pages, the
|
|
303
|
+
* cart button in the header, the cart drawer). */
|
|
304
|
+
readonly shop?: ShopPlan;
|
|
257
305
|
/** SC6b: the owner's film as pictures, set by the build and placed by `placeFilm` — never a model's. */
|
|
258
306
|
readonly film?: PlanFilm;
|
|
259
307
|
/** M7: what every picture made for the site shares (a world and its five parts) — set by the generation from the
|
|
@@ -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>>>>,
|