@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.
Files changed (38) hide show
  1. package/commerce-core/index.d.ts +274 -2
  2. package/fesm2022/vectoriox-iox-ui-commerce-core.mjs +312 -1
  3. package/fesm2022/vectoriox-iox-ui-commerce-core.mjs.map +1 -1
  4. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +2 -8
  5. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  6. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1114 -223
  7. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  8. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +115 -42
  9. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  10. package/generation-core/index.d.ts +515 -17
  11. package/harness-core/index.d.ts +66 -6
  12. package/package.json +1 -1
  13. package/src/commerce-core/public-api.ts +2 -0
  14. package/src/commerce-core/shipping.ts +22 -0
  15. package/src/commerce-core/site-checkout.ts +406 -0
  16. package/src/commerce-core/variants.ts +20 -0
  17. package/src/composite-core/shop-runtime.ts +2 -8
  18. package/src/generation-core/audit-site.ts +8 -0
  19. package/src/generation-core/compose-site.ts +130 -4
  20. package/src/generation-core/nav-shape.ts +4 -2
  21. package/src/generation-core/patterns.ts +25 -1
  22. package/src/generation-core/pictures.ts +1 -1
  23. package/src/generation-core/plan-derived.ts +10 -5
  24. package/src/generation-core/plan-edits.ts +8 -7
  25. package/src/generation-core/plan-wire.ts +59 -10
  26. package/src/generation-core/plan-words.ts +18 -1
  27. package/src/generation-core/public-api.ts +1 -0
  28. package/src/generation-core/shop-plan.ts +165 -0
  29. package/src/generation-core/showcase.ts +29 -4
  30. package/src/generation-core/site-build-run.ts +25 -0
  31. package/src/generation-core/site-plan.model.ts +49 -1
  32. package/src/generation-core/site-spec.generated.ts +330 -2
  33. package/src/generation-core/stock-photos.ts +19 -2
  34. package/src/generation-core/validate-site-plan.ts +146 -8
  35. package/src/harness-core/business-types.ts +13 -0
  36. package/src/harness-core/harness-spec.generated.ts +69 -39
  37. package/src/harness-core/needs.ts +30 -1
  38. package/src/harness-core/site-reading.ts +8 -2
@@ -39,6 +39,18 @@ export enum BookingNeed {
39
39
  None = 'none',
40
40
  }
41
41
 
42
+ /** Commerce C-D21: whether a kind of business sells online — the need `products` (its site is a whole store). */
43
+ export enum SellingNeed {
44
+ /** It sells: the reading names `products` (from: type) — the owner may switch it off. */
45
+ Inferred = 'inferred',
46
+ /** It may sell (a café's beans, an artist's prints): offered on Analysis, switched off until the owner says so. */
47
+ Offered = 'offered',
48
+ /** Care and trust work: never a shop, whatever a reading said. */
49
+ Never = 'never',
50
+ /** Not on the lists: as the owner said. */
51
+ None = 'none',
52
+ }
53
+
42
54
  /** The content checks of the avoid grammar (a look rule is the other kind). */
43
55
  export enum AvoidCheck {
44
56
  NeedsFamily = 'needs-family',
@@ -131,6 +143,7 @@ export interface BusinessType {
131
143
  /** Stock photos may fill its pictures (never the work itself). */
132
144
  readonly stock: boolean;
133
145
  readonly booking: `${BookingNeed}`;
146
+ readonly sells: `${SellingNeed}`;
134
147
  }
135
148
 
136
149
  /** The 30, in the board's order. Assignment here proves the generated data fits the type. */
@@ -15,6 +15,10 @@ export const SPEC_NEEDS = {
15
15
  "label": "Your work or products",
16
16
  "archetype": "collection"
17
17
  },
18
+ "products": {
19
+ "label": "Products you sell",
20
+ "archetype": "collection"
21
+ },
18
22
  "detail": {
19
23
  "label": "A page for each item",
20
24
  "archetype": "detail"
@@ -260,7 +264,8 @@ export const SPEC_BUSINESS_TYPES = [
260
264
  "structure": "studio",
261
265
  "slice": true,
262
266
  "stock": false,
263
- "booking": "sometimes"
267
+ "booking": "sometimes",
268
+ "sells": "offered"
264
269
  },
265
270
  {
266
271
  "id": "interior-design",
@@ -372,7 +377,8 @@ export const SPEC_BUSINESS_TYPES = [
372
377
  "structure": "studio",
373
378
  "slice": true,
374
379
  "stock": false,
375
- "booking": "none"
380
+ "booking": "none",
381
+ "sells": "none"
376
382
  },
377
383
  {
378
384
  "id": "architecture",
@@ -479,7 +485,8 @@ export const SPEC_BUSINESS_TYPES = [
479
485
  "structure": "studio",
480
486
  "slice": false,
481
487
  "stock": false,
482
- "booking": "none"
488
+ "booking": "none",
489
+ "sells": "none"
483
490
  },
484
491
  {
485
492
  "id": "creative-studio",
@@ -578,7 +585,8 @@ export const SPEC_BUSINESS_TYPES = [
578
585
  "structure": "studio",
579
586
  "slice": false,
580
587
  "stock": false,
581
- "booking": "none"
588
+ "booking": "none",
589
+ "sells": "none"
582
590
  },
583
591
  {
584
592
  "id": "artist",
@@ -679,7 +687,8 @@ export const SPEC_BUSINESS_TYPES = [
679
687
  "structure": "studio",
680
688
  "slice": false,
681
689
  "stock": false,
682
- "booking": "none"
690
+ "booking": "none",
691
+ "sells": "offered"
683
692
  },
684
693
  {
685
694
  "id": "makers",
@@ -751,8 +760,7 @@ export const SPEC_BUSINESS_TYPES = [
751
760
  "contact"
752
761
  ],
753
762
  "needs": [
754
- "collection",
755
- "detail",
763
+ "products",
756
764
  "about",
757
765
  "contact"
758
766
  ],
@@ -785,7 +793,8 @@ export const SPEC_BUSINESS_TYPES = [
785
793
  "structure": "studio",
786
794
  "slice": true,
787
795
  "stock": false,
788
- "booking": "sometimes"
796
+ "booking": "sometimes",
797
+ "sells": "inferred"
789
798
  },
790
799
  {
791
800
  "id": "jewellery",
@@ -849,8 +858,7 @@ export const SPEC_BUSINESS_TYPES = [
849
858
  "contact"
850
859
  ],
851
860
  "needs": [
852
- "collection",
853
- "detail",
861
+ "products",
854
862
  "about",
855
863
  "contact"
856
864
  ],
@@ -887,7 +895,8 @@ export const SPEC_BUSINESS_TYPES = [
887
895
  "structure": "studio",
888
896
  "slice": false,
889
897
  "stock": false,
890
- "booking": "none"
898
+ "booking": "none",
899
+ "sells": "inferred"
891
900
  },
892
901
  {
893
902
  "id": "tattoo",
@@ -984,7 +993,8 @@ export const SPEC_BUSINESS_TYPES = [
984
993
  "structure": "studio",
985
994
  "slice": false,
986
995
  "stock": false,
987
- "booking": "must"
996
+ "booking": "must",
997
+ "sells": "none"
988
998
  },
989
999
  {
990
1000
  "id": "spa",
@@ -1101,7 +1111,8 @@ export const SPEC_BUSINESS_TYPES = [
1101
1111
  "structure": "practice",
1102
1112
  "slice": true,
1103
1113
  "stock": true,
1104
- "booking": "must"
1114
+ "booking": "must",
1115
+ "sells": "none"
1105
1116
  },
1106
1117
  {
1107
1118
  "id": "salon",
@@ -1207,7 +1218,8 @@ export const SPEC_BUSINESS_TYPES = [
1207
1218
  "structure": "practice",
1208
1219
  "slice": true,
1209
1220
  "stock": true,
1210
- "booking": "must"
1221
+ "booking": "must",
1222
+ "sells": "none"
1211
1223
  },
1212
1224
  {
1213
1225
  "id": "yoga",
@@ -1309,7 +1321,8 @@ export const SPEC_BUSINESS_TYPES = [
1309
1321
  "structure": "practice",
1310
1322
  "slice": false,
1311
1323
  "stock": true,
1312
- "booking": "must"
1324
+ "booking": "must",
1325
+ "sells": "none"
1313
1326
  },
1314
1327
  {
1315
1328
  "id": "fitness",
@@ -1419,7 +1432,8 @@ export const SPEC_BUSINESS_TYPES = [
1419
1432
  "structure": "practice",
1420
1433
  "slice": false,
1421
1434
  "stock": true,
1422
- "booking": "must"
1435
+ "booking": "must",
1436
+ "sells": "none"
1423
1437
  },
1424
1438
  {
1425
1439
  "id": "therapist",
@@ -1530,7 +1544,8 @@ export const SPEC_BUSINESS_TYPES = [
1530
1544
  "structure": "practice",
1531
1545
  "slice": false,
1532
1546
  "stock": true,
1533
- "booking": "must"
1547
+ "booking": "must",
1548
+ "sells": "never"
1534
1549
  },
1535
1550
  {
1536
1551
  "id": "clinic",
@@ -1644,7 +1659,8 @@ export const SPEC_BUSINESS_TYPES = [
1644
1659
  "structure": "practice",
1645
1660
  "slice": true,
1646
1661
  "stock": true,
1647
- "booking": "must"
1662
+ "booking": "must",
1663
+ "sells": "never"
1648
1664
  },
1649
1665
  {
1650
1666
  "id": "dental",
@@ -1743,7 +1759,8 @@ export const SPEC_BUSINESS_TYPES = [
1743
1759
  "structure": "practice",
1744
1760
  "slice": false,
1745
1761
  "stock": true,
1746
- "booking": "must"
1762
+ "booking": "must",
1763
+ "sells": "never"
1747
1764
  },
1748
1765
  {
1749
1766
  "id": "vet",
@@ -1843,7 +1860,8 @@ export const SPEC_BUSINESS_TYPES = [
1843
1860
  "structure": "practice",
1844
1861
  "slice": false,
1845
1862
  "stock": true,
1846
- "booking": "must"
1863
+ "booking": "must",
1864
+ "sells": "none"
1847
1865
  },
1848
1866
  {
1849
1867
  "id": "restaurant",
@@ -1951,7 +1969,8 @@ export const SPEC_BUSINESS_TYPES = [
1951
1969
  "structure": "place",
1952
1970
  "slice": false,
1953
1971
  "stock": true,
1954
- "booking": "tables"
1972
+ "booking": "tables",
1973
+ "sells": "none"
1955
1974
  },
1956
1975
  {
1957
1976
  "id": "cafe-bakery",
@@ -2055,7 +2074,8 @@ export const SPEC_BUSINESS_TYPES = [
2055
2074
  "structure": "place",
2056
2075
  "slice": true,
2057
2076
  "stock": true,
2058
- "booking": "none"
2077
+ "booking": "none",
2078
+ "sells": "offered"
2059
2079
  },
2060
2080
  {
2061
2081
  "id": "bar-winery",
@@ -2160,7 +2180,8 @@ export const SPEC_BUSINESS_TYPES = [
2160
2180
  "structure": "place",
2161
2181
  "slice": false,
2162
2182
  "stock": true,
2163
- "booking": "none"
2183
+ "booking": "none",
2184
+ "sells": "offered"
2164
2185
  },
2165
2186
  {
2166
2187
  "id": "boutique",
@@ -2227,8 +2248,7 @@ export const SPEC_BUSINESS_TYPES = [
2227
2248
  "contact"
2228
2249
  ],
2229
2250
  "needs": [
2230
- "collection",
2231
- "detail",
2251
+ "products",
2232
2252
  "about",
2233
2253
  "contact"
2234
2254
  ],
@@ -2257,7 +2277,8 @@ export const SPEC_BUSINESS_TYPES = [
2257
2277
  "structure": "studio",
2258
2278
  "slice": false,
2259
2279
  "stock": true,
2260
- "booking": "none"
2280
+ "booking": "none",
2281
+ "sells": "inferred"
2261
2282
  },
2262
2283
  {
2263
2284
  "id": "florist",
@@ -2323,7 +2344,7 @@ export const SPEC_BUSINESS_TYPES = [
2323
2344
  "contact"
2324
2345
  ],
2325
2346
  "needs": [
2326
- "collection",
2347
+ "products",
2327
2348
  "about",
2328
2349
  "contact"
2329
2350
  ],
@@ -2355,7 +2376,8 @@ export const SPEC_BUSINESS_TYPES = [
2355
2376
  "structure": "studio",
2356
2377
  "slice": false,
2357
2378
  "stock": true,
2358
- "booking": "none"
2379
+ "booking": "none",
2380
+ "sells": "inferred"
2359
2381
  },
2360
2382
  {
2361
2383
  "id": "home-goods",
@@ -2420,8 +2442,7 @@ export const SPEC_BUSINESS_TYPES = [
2420
2442
  "contact"
2421
2443
  ],
2422
2444
  "needs": [
2423
- "collection",
2424
- "detail",
2445
+ "products",
2425
2446
  "about",
2426
2447
  "contact"
2427
2448
  ],
@@ -2453,7 +2474,8 @@ export const SPEC_BUSINESS_TYPES = [
2453
2474
  "structure": "studio",
2454
2475
  "slice": false,
2455
2476
  "stock": true,
2456
- "booking": "none"
2477
+ "booking": "none",
2478
+ "sells": "inferred"
2457
2479
  },
2458
2480
  {
2459
2481
  "id": "consultant",
@@ -2554,7 +2576,8 @@ export const SPEC_BUSINESS_TYPES = [
2554
2576
  "structure": "practice",
2555
2577
  "slice": true,
2556
2578
  "stock": true,
2557
- "booking": "sometimes"
2579
+ "booking": "sometimes",
2580
+ "sells": "none"
2558
2581
  },
2559
2582
  {
2560
2583
  "id": "coach",
@@ -2648,7 +2671,8 @@ export const SPEC_BUSINESS_TYPES = [
2648
2671
  "structure": "practice",
2649
2672
  "slice": false,
2650
2673
  "stock": true,
2651
- "booking": "must"
2674
+ "booking": "must",
2675
+ "sells": "none"
2652
2676
  },
2653
2677
  {
2654
2678
  "id": "law-accounting",
@@ -2762,7 +2786,8 @@ export const SPEC_BUSINESS_TYPES = [
2762
2786
  "structure": "practice",
2763
2787
  "slice": false,
2764
2788
  "stock": true,
2765
- "booking": "sometimes"
2789
+ "booking": "sometimes",
2790
+ "sells": "never"
2766
2791
  },
2767
2792
  {
2768
2793
  "id": "real-estate",
@@ -2866,7 +2891,8 @@ export const SPEC_BUSINESS_TYPES = [
2866
2891
  "structure": "studio",
2867
2892
  "slice": false,
2868
2893
  "stock": false,
2869
- "booking": "sometimes"
2894
+ "booking": "sometimes",
2895
+ "sells": "none"
2870
2896
  },
2871
2897
  {
2872
2898
  "id": "nonprofit",
@@ -2959,7 +2985,8 @@ export const SPEC_BUSINESS_TYPES = [
2959
2985
  "structure": "practice",
2960
2986
  "slice": false,
2961
2987
  "stock": true,
2962
- "booking": "none"
2988
+ "booking": "none",
2989
+ "sells": "none"
2963
2990
  },
2964
2991
  {
2965
2992
  "id": "venue-events",
@@ -3064,7 +3091,8 @@ export const SPEC_BUSINESS_TYPES = [
3064
3091
  "structure": "place",
3065
3092
  "slice": false,
3066
3093
  "stock": true,
3067
- "booking": "tables"
3094
+ "booking": "tables",
3095
+ "sells": "none"
3068
3096
  },
3069
3097
  {
3070
3098
  "id": "hotel-bnb",
@@ -3169,7 +3197,8 @@ export const SPEC_BUSINESS_TYPES = [
3169
3197
  "structure": "place",
3170
3198
  "slice": false,
3171
3199
  "stock": true,
3172
- "booking": "tables"
3200
+ "booking": "tables",
3201
+ "sells": "none"
3173
3202
  },
3174
3203
  {
3175
3204
  "id": "classes",
@@ -3276,7 +3305,8 @@ export const SPEC_BUSINESS_TYPES = [
3276
3305
  "structure": "practice",
3277
3306
  "slice": false,
3278
3307
  "stock": true,
3279
- "booking": "must"
3308
+ "booking": "must",
3309
+ "sells": "offered"
3280
3310
  }
3281
3311
  ] as const;
3282
3312
 
@@ -1,4 +1,4 @@
1
- import { BookingNeed, BUSINESS_TYPES, BusinessType, NeedId } from './business-types';
1
+ import { BookingNeed, BUSINESS_TYPES, BusinessType, NeedId, SellingNeed } from './business-types';
2
2
 
3
3
  /** Who asked for a need: the owner named it, or the kind of business needs it ("we added"). */
4
4
  export enum NeedSource {
@@ -40,3 +40,32 @@ export function inferNeeds(
40
40
  }
41
41
  return out;
42
42
  }
43
+
44
+ /** The need a business that sells names (generation-core `SHOP_NEED`): its site is a whole store. */
45
+ export const PRODUCTS_NEED: NeedId = 'products';
46
+
47
+ /**
48
+ * Commerce C-D21 (R-H1): whether a reading's business sells — settled by its kind, never left to a model's guess. A kind
49
+ * that sells (`inferred`) has `products` (from: type, unless the owner named it); a kind that never sells (care, trust)
50
+ * has none, whatever was said; the rest keep what the reading said — on Analysis, an `offered` kind shows `products`
51
+ * switched off (`offeredNeeds`). Pure; the same list when nothing changes.
52
+ */
53
+ export function withSellingNeed(typeId: string | null | undefined, needs: ReadonlyArray<SiteNeed>, types: ReadonlyArray<BusinessType> = BUSINESS_TYPES): SiteNeed[] {
54
+ const sells = types.find(t => t.id === typeId)?.sells;
55
+ const has = needs.some(n => n.id === PRODUCTS_NEED);
56
+ if (sells === SellingNeed.Never && has) return needs.filter(n => n.id !== PRODUCTS_NEED);
57
+ if (sells === SellingNeed.Inferred && !has) return [...needs, { id: PRODUCTS_NEED, from: NeedSource.Type }];
58
+ return [...needs];
59
+ }
60
+
61
+ /** The needs Analysis offers switched off for this kind of business (a café's beans): `products` for an `offered` one
62
+ * whose reading lacks it. */
63
+ export function offeredNeeds(typeId: string | null | undefined, needs: ReadonlyArray<Pick<SiteNeed, 'id'>>, types: ReadonlyArray<BusinessType> = BUSINESS_TYPES): NeedId[] {
64
+ const sells = types.find(t => t.id === typeId)?.sells;
65
+ return sells === SellingNeed.Offered && !needs.some(n => n.id === PRODUCTS_NEED) ? [PRODUCTS_NEED] : [];
66
+ }
67
+
68
+ /** True when the needs say the business sells (the plan must name what — generation-core `validateSitePlan`'s `sells`). */
69
+ export function needsSell(needs: ReadonlyArray<Pick<SiteNeed, 'id'>>): boolean {
70
+ return needs.some(n => n.id === PRODUCTS_NEED);
71
+ }
@@ -4,6 +4,7 @@ import {
4
4
  shapeKeys, requiredShapeKeys,
5
5
  } from '@vectoriox/iox-ui/generation-core';
6
6
 
7
+ import { withSellingNeed } from './needs';
7
8
  import { paletteSamples, readPalette } from './palette';
8
9
  import { StyleRead, StyleReadGround, StyleReadHeadings, StyleReadSourceKind } from './rank';
9
10
  import { AnalysisIssue, analysisFromWire, MAX_ANALYSIS_MOODS, SiteAnalysis, siteAnalysisJsonSchema, validateSiteAnalysis } from './site-analysis';
@@ -152,9 +153,14 @@ export function validateSiteReading(value: unknown, ctx: { prompt: string; pictu
152
153
 
153
154
  /** A valid reading's answer → `SiteReading` (the analysis alone answers `{ analysis }`; the facts made a map again). */
154
155
  export function decodeSiteReading(value: unknown, pictureCount: number): SiteReading {
155
- if (pictureCount <= 0) return { analysis: analysisFromWire(value).analysis as SiteAnalysis };
156
+ if (pictureCount <= 0) return { analysis: settled(analysisFromWire(value).analysis as SiteAnalysis) };
156
157
  const reading = value as SiteReading;
157
- return { ...reading, analysis: analysisFromWire(reading.analysis).analysis as SiteAnalysis };
158
+ return { ...reading, analysis: settled(analysisFromWire(reading.analysis).analysis as SiteAnalysis) };
159
+ }
160
+
161
+ /** What a reading's kind of business settles whatever the model wrote: whether it sells (`withSellingNeed`). */
162
+ function settled(analysis: SiteAnalysis): SiteAnalysis {
163
+ return Array.isArray(analysis?.needs) ? { ...analysis, needs: withSellingNeed(analysis.businessType, analysis.needs) } : analysis;
158
164
  }
159
165
 
160
166
  // ── Readings → ONE StyleRead ───────────────────────────────────────────────────────────────────────────