@vectoriox/iox-ui 5.97.0 → 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/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/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/harness-core/index.d.ts
CHANGED
|
@@ -15,6 +15,10 @@ declare const SPEC_NEEDS: {
|
|
|
15
15
|
readonly label: "Your work or products";
|
|
16
16
|
readonly archetype: "collection";
|
|
17
17
|
};
|
|
18
|
+
readonly products: {
|
|
19
|
+
readonly label: "Products you sell";
|
|
20
|
+
readonly archetype: "collection";
|
|
21
|
+
};
|
|
18
22
|
readonly detail: {
|
|
19
23
|
readonly label: "A page for each item";
|
|
20
24
|
readonly archetype: "detail";
|
|
@@ -184,6 +188,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
184
188
|
readonly slice: true;
|
|
185
189
|
readonly stock: false;
|
|
186
190
|
readonly booking: "sometimes";
|
|
191
|
+
readonly sells: "offered";
|
|
187
192
|
}, {
|
|
188
193
|
readonly id: "interior-design";
|
|
189
194
|
readonly label: "Interior designer";
|
|
@@ -249,6 +254,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
249
254
|
readonly slice: true;
|
|
250
255
|
readonly stock: false;
|
|
251
256
|
readonly booking: "none";
|
|
257
|
+
readonly sells: "none";
|
|
252
258
|
}, {
|
|
253
259
|
readonly id: "architecture";
|
|
254
260
|
readonly label: "Architect";
|
|
@@ -315,6 +321,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
315
321
|
readonly slice: false;
|
|
316
322
|
readonly stock: false;
|
|
317
323
|
readonly booking: "none";
|
|
324
|
+
readonly sells: "none";
|
|
318
325
|
}, {
|
|
319
326
|
readonly id: "creative-studio";
|
|
320
327
|
readonly label: "Design or branding studio";
|
|
@@ -371,6 +378,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
371
378
|
readonly slice: false;
|
|
372
379
|
readonly stock: false;
|
|
373
380
|
readonly booking: "none";
|
|
381
|
+
readonly sells: "none";
|
|
374
382
|
}, {
|
|
375
383
|
readonly id: "artist";
|
|
376
384
|
readonly label: "Artist or illustrator";
|
|
@@ -429,6 +437,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
429
437
|
readonly slice: false;
|
|
430
438
|
readonly stock: false;
|
|
431
439
|
readonly booking: "none";
|
|
440
|
+
readonly sells: "offered";
|
|
432
441
|
}, {
|
|
433
442
|
readonly id: "makers";
|
|
434
443
|
readonly label: "Ceramics, crafts and makers";
|
|
@@ -469,7 +478,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
469
478
|
readonly world: "macro";
|
|
470
479
|
readonly imagery: "Your pieces and hands at work; natural light.";
|
|
471
480
|
readonly pages: readonly ["home", "pieces (collection)", "piece (detail)", "workshops", "about", "contact"];
|
|
472
|
-
readonly needs: readonly ["
|
|
481
|
+
readonly needs: readonly ["products", "about", "contact"];
|
|
473
482
|
readonly home: readonly ["hero.split", "collection.card-grid", "feature.triad", "cta.banner"];
|
|
474
483
|
readonly avoid: readonly [{
|
|
475
484
|
readonly when: {
|
|
@@ -486,6 +495,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
486
495
|
readonly slice: true;
|
|
487
496
|
readonly stock: false;
|
|
488
497
|
readonly booking: "sometimes";
|
|
498
|
+
readonly sells: "inferred";
|
|
489
499
|
}, {
|
|
490
500
|
readonly id: "jewellery";
|
|
491
501
|
readonly label: "Jewellery";
|
|
@@ -526,7 +536,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
526
536
|
readonly world: "macro";
|
|
527
537
|
readonly imagery: "Close-ups on a plain ground.";
|
|
528
538
|
readonly pages: readonly ["home", "collection", "piece (detail)", "about", "contact"];
|
|
529
|
-
readonly needs: readonly ["
|
|
539
|
+
readonly needs: readonly ["products", "about", "contact"];
|
|
530
540
|
readonly home: readonly ["hero.split", "collection.card-grid", "about.story", "cta.banner"];
|
|
531
541
|
readonly avoid: readonly [{
|
|
532
542
|
readonly when: {
|
|
@@ -544,6 +554,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
544
554
|
readonly slice: false;
|
|
545
555
|
readonly stock: false;
|
|
546
556
|
readonly booking: "none";
|
|
557
|
+
readonly sells: "inferred";
|
|
547
558
|
}, {
|
|
548
559
|
readonly id: "tattoo";
|
|
549
560
|
readonly label: "Tattoo or barber studio";
|
|
@@ -601,6 +612,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
601
612
|
readonly slice: false;
|
|
602
613
|
readonly stock: false;
|
|
603
614
|
readonly booking: "must";
|
|
615
|
+
readonly sells: "none";
|
|
604
616
|
}, {
|
|
605
617
|
readonly id: "spa";
|
|
606
618
|
readonly label: "Spa and massage";
|
|
@@ -668,6 +680,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
668
680
|
readonly slice: true;
|
|
669
681
|
readonly stock: true;
|
|
670
682
|
readonly booking: "must";
|
|
683
|
+
readonly sells: "none";
|
|
671
684
|
}, {
|
|
672
685
|
readonly id: "salon";
|
|
673
686
|
readonly label: "Hair and beauty salon";
|
|
@@ -729,6 +742,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
729
742
|
readonly slice: true;
|
|
730
743
|
readonly stock: true;
|
|
731
744
|
readonly booking: "must";
|
|
745
|
+
readonly sells: "none";
|
|
732
746
|
}, {
|
|
733
747
|
readonly id: "yoga";
|
|
734
748
|
readonly label: "Yoga or pilates studio";
|
|
@@ -787,6 +801,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
787
801
|
readonly slice: false;
|
|
788
802
|
readonly stock: true;
|
|
789
803
|
readonly booking: "must";
|
|
804
|
+
readonly sells: "none";
|
|
790
805
|
}, {
|
|
791
806
|
readonly id: "fitness";
|
|
792
807
|
readonly label: "Trainer, gym or dance";
|
|
@@ -849,6 +864,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
849
864
|
readonly slice: false;
|
|
850
865
|
readonly stock: true;
|
|
851
866
|
readonly booking: "must";
|
|
867
|
+
readonly sells: "none";
|
|
852
868
|
}, {
|
|
853
869
|
readonly id: "therapist";
|
|
854
870
|
readonly label: "Therapist or counsellor";
|
|
@@ -911,6 +927,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
911
927
|
readonly slice: false;
|
|
912
928
|
readonly stock: true;
|
|
913
929
|
readonly booking: "must";
|
|
930
|
+
readonly sells: "never";
|
|
914
931
|
}, {
|
|
915
932
|
readonly id: "clinic";
|
|
916
933
|
readonly label: "Clinic or practice";
|
|
@@ -978,6 +995,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
978
995
|
readonly slice: true;
|
|
979
996
|
readonly stock: true;
|
|
980
997
|
readonly booking: "must";
|
|
998
|
+
readonly sells: "never";
|
|
981
999
|
}, {
|
|
982
1000
|
readonly id: "dental";
|
|
983
1001
|
readonly label: "Dental practice";
|
|
@@ -1035,6 +1053,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1035
1053
|
readonly slice: false;
|
|
1036
1054
|
readonly stock: true;
|
|
1037
1055
|
readonly booking: "must";
|
|
1056
|
+
readonly sells: "never";
|
|
1038
1057
|
}, {
|
|
1039
1058
|
readonly id: "vet";
|
|
1040
1059
|
readonly label: "Vet or pet care";
|
|
@@ -1092,6 +1111,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1092
1111
|
readonly slice: false;
|
|
1093
1112
|
readonly stock: true;
|
|
1094
1113
|
readonly booking: "must";
|
|
1114
|
+
readonly sells: "none";
|
|
1095
1115
|
}, {
|
|
1096
1116
|
readonly id: "restaurant";
|
|
1097
1117
|
readonly label: "Restaurant";
|
|
@@ -1156,6 +1176,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1156
1176
|
readonly slice: false;
|
|
1157
1177
|
readonly stock: true;
|
|
1158
1178
|
readonly booking: "tables";
|
|
1179
|
+
readonly sells: "none";
|
|
1159
1180
|
}, {
|
|
1160
1181
|
readonly id: "cafe-bakery";
|
|
1161
1182
|
readonly label: "Café or bakery";
|
|
@@ -1217,6 +1238,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1217
1238
|
readonly slice: true;
|
|
1218
1239
|
readonly stock: true;
|
|
1219
1240
|
readonly booking: "none";
|
|
1241
|
+
readonly sells: "offered";
|
|
1220
1242
|
}, {
|
|
1221
1243
|
readonly id: "bar-winery";
|
|
1222
1244
|
readonly label: "Bar, winery or brewery";
|
|
@@ -1278,6 +1300,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1278
1300
|
readonly slice: false;
|
|
1279
1301
|
readonly stock: true;
|
|
1280
1302
|
readonly booking: "none";
|
|
1303
|
+
readonly sells: "offered";
|
|
1281
1304
|
}, {
|
|
1282
1305
|
readonly id: "boutique";
|
|
1283
1306
|
readonly label: "Fashion or lifestyle shop";
|
|
@@ -1318,7 +1341,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1318
1341
|
readonly world: "high-key";
|
|
1319
1342
|
readonly imagery: "Product photos on plain grounds; real people wearing them.";
|
|
1320
1343
|
readonly pages: readonly ["home", "collection", "product (detail)", "about", "contact"];
|
|
1321
|
-
readonly needs: readonly ["
|
|
1344
|
+
readonly needs: readonly ["products", "about", "contact"];
|
|
1322
1345
|
readonly home: readonly ["hero.split", "collection.card-grid", "proof.logo-strip", "cta.banner"];
|
|
1323
1346
|
readonly avoid: readonly [{
|
|
1324
1347
|
readonly check: "copy-length";
|
|
@@ -1334,6 +1357,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1334
1357
|
readonly slice: false;
|
|
1335
1358
|
readonly stock: true;
|
|
1336
1359
|
readonly booking: "none";
|
|
1360
|
+
readonly sells: "inferred";
|
|
1337
1361
|
}, {
|
|
1338
1362
|
readonly id: "florist";
|
|
1339
1363
|
readonly label: "Florist or plant shop";
|
|
@@ -1374,7 +1398,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1374
1398
|
readonly world: "macro";
|
|
1375
1399
|
readonly imagery: "Your own arrangements in daylight.";
|
|
1376
1400
|
readonly pages: readonly ["home", "flowers (collection)", "weddings and events", "about", "contact"];
|
|
1377
|
-
readonly needs: readonly ["
|
|
1401
|
+
readonly needs: readonly ["products", "about", "contact"];
|
|
1378
1402
|
readonly home: readonly ["hero.split", "collection.masonry-gallery", "feature.triad", "cta.banner"];
|
|
1379
1403
|
readonly avoid: readonly [{
|
|
1380
1404
|
readonly when: {
|
|
@@ -1391,6 +1415,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1391
1415
|
readonly slice: false;
|
|
1392
1416
|
readonly stock: true;
|
|
1393
1417
|
readonly booking: "none";
|
|
1418
|
+
readonly sells: "inferred";
|
|
1394
1419
|
}, {
|
|
1395
1420
|
readonly id: "home-goods";
|
|
1396
1421
|
readonly label: "Furniture or home goods";
|
|
@@ -1431,7 +1456,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1431
1456
|
readonly world: "documentary";
|
|
1432
1457
|
readonly imagery: "Pieces in real rooms and on plain grounds.";
|
|
1433
1458
|
readonly pages: readonly ["home", "collection", "product (detail)", "about", "contact"];
|
|
1434
|
-
readonly needs: readonly ["
|
|
1459
|
+
readonly needs: readonly ["products", "about", "contact"];
|
|
1435
1460
|
readonly home: readonly ["hero.split", "collection.card-grid", "feature.alternating-rows", "cta.banner"];
|
|
1436
1461
|
readonly avoid: readonly [{
|
|
1437
1462
|
readonly when: {
|
|
@@ -1448,6 +1473,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1448
1473
|
readonly slice: false;
|
|
1449
1474
|
readonly stock: true;
|
|
1450
1475
|
readonly booking: "none";
|
|
1476
|
+
readonly sells: "inferred";
|
|
1451
1477
|
}, {
|
|
1452
1478
|
readonly id: "consultant";
|
|
1453
1479
|
readonly label: "Consultant";
|
|
@@ -1507,6 +1533,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1507
1533
|
readonly slice: true;
|
|
1508
1534
|
readonly stock: true;
|
|
1509
1535
|
readonly booking: "sometimes";
|
|
1536
|
+
readonly sells: "none";
|
|
1510
1537
|
}, {
|
|
1511
1538
|
readonly id: "coach";
|
|
1512
1539
|
readonly label: "Life or business coach";
|
|
@@ -1560,6 +1587,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1560
1587
|
readonly slice: false;
|
|
1561
1588
|
readonly stock: true;
|
|
1562
1589
|
readonly booking: "must";
|
|
1590
|
+
readonly sells: "none";
|
|
1563
1591
|
}, {
|
|
1564
1592
|
readonly id: "law-accounting";
|
|
1565
1593
|
readonly label: "Law or accounting firm";
|
|
@@ -1624,6 +1652,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1624
1652
|
readonly slice: false;
|
|
1625
1653
|
readonly stock: true;
|
|
1626
1654
|
readonly booking: "sometimes";
|
|
1655
|
+
readonly sells: "never";
|
|
1627
1656
|
}, {
|
|
1628
1657
|
readonly id: "real-estate";
|
|
1629
1658
|
readonly label: "Real estate agent";
|
|
@@ -1684,6 +1713,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1684
1713
|
readonly slice: false;
|
|
1685
1714
|
readonly stock: false;
|
|
1686
1715
|
readonly booking: "sometimes";
|
|
1716
|
+
readonly sells: "none";
|
|
1687
1717
|
}, {
|
|
1688
1718
|
readonly id: "nonprofit";
|
|
1689
1719
|
readonly label: "Nonprofit or community";
|
|
@@ -1737,6 +1767,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1737
1767
|
readonly slice: false;
|
|
1738
1768
|
readonly stock: true;
|
|
1739
1769
|
readonly booking: "none";
|
|
1770
|
+
readonly sells: "none";
|
|
1740
1771
|
}, {
|
|
1741
1772
|
readonly id: "venue-events";
|
|
1742
1773
|
readonly label: "Venue, weddings or events";
|
|
@@ -1797,6 +1828,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1797
1828
|
readonly slice: false;
|
|
1798
1829
|
readonly stock: true;
|
|
1799
1830
|
readonly booking: "tables";
|
|
1831
|
+
readonly sells: "none";
|
|
1800
1832
|
}, {
|
|
1801
1833
|
readonly id: "hotel-bnb";
|
|
1802
1834
|
readonly label: "Hotel, B&B or guesthouse";
|
|
@@ -1857,6 +1889,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1857
1889
|
readonly slice: false;
|
|
1858
1890
|
readonly stock: true;
|
|
1859
1891
|
readonly booking: "tables";
|
|
1892
|
+
readonly sells: "none";
|
|
1860
1893
|
}, {
|
|
1861
1894
|
readonly id: "classes";
|
|
1862
1895
|
readonly label: "Teacher, tutor or classes";
|
|
@@ -1915,6 +1948,7 @@ declare const SPEC_BUSINESS_TYPES: readonly [{
|
|
|
1915
1948
|
readonly slice: false;
|
|
1916
1949
|
readonly stock: true;
|
|
1917
1950
|
readonly booking: "must";
|
|
1951
|
+
readonly sells: "offered";
|
|
1918
1952
|
}];
|
|
1919
1953
|
declare const SPEC_ANALYSIS_SHAPE: {
|
|
1920
1954
|
readonly analysis: {
|
|
@@ -2213,6 +2247,17 @@ declare enum BookingNeed {
|
|
|
2213
2247
|
Sometimes = "sometimes",
|
|
2214
2248
|
None = "none"
|
|
2215
2249
|
}
|
|
2250
|
+
/** Commerce C-D21: whether a kind of business sells online — the need `products` (its site is a whole store). */
|
|
2251
|
+
declare enum SellingNeed {
|
|
2252
|
+
/** It sells: the reading names `products` (from: type) — the owner may switch it off. */
|
|
2253
|
+
Inferred = "inferred",
|
|
2254
|
+
/** It may sell (a café's beans, an artist's prints): offered on Analysis, switched off until the owner says so. */
|
|
2255
|
+
Offered = "offered",
|
|
2256
|
+
/** Care and trust work: never a shop, whatever a reading said. */
|
|
2257
|
+
Never = "never",
|
|
2258
|
+
/** Not on the lists: as the owner said. */
|
|
2259
|
+
None = "none"
|
|
2260
|
+
}
|
|
2216
2261
|
/** The content checks of the avoid grammar (a look rule is the other kind). */
|
|
2217
2262
|
declare enum AvoidCheck {
|
|
2218
2263
|
NeedsFamily = "needs-family",
|
|
@@ -2319,6 +2364,7 @@ interface BusinessType {
|
|
|
2319
2364
|
/** Stock photos may fill its pictures (never the work itself). */
|
|
2320
2365
|
readonly stock: boolean;
|
|
2321
2366
|
readonly booking: `${BookingNeed}`;
|
|
2367
|
+
readonly sells: `${SellingNeed}`;
|
|
2322
2368
|
}
|
|
2323
2369
|
/** The 30, in the board's order. Assignment here proves the generated data fits the type. */
|
|
2324
2370
|
declare const BUSINESS_TYPES: ReadonlyArray<BusinessType>;
|
|
@@ -2536,6 +2582,20 @@ interface SiteNeed {
|
|
|
2536
2582
|
* each marked `from: 'type'` (the Analysis step's "we added"). Pure; an unknown type adds nothing.
|
|
2537
2583
|
*/
|
|
2538
2584
|
declare function inferNeeds(typeId: string | null | undefined, said?: ReadonlyArray<Omit<SiteNeed, 'from'>>, types?: ReadonlyArray<BusinessType>): SiteNeed[];
|
|
2585
|
+
/** The need a business that sells names (generation-core `SHOP_NEED`): its site is a whole store. */
|
|
2586
|
+
declare const PRODUCTS_NEED: NeedId;
|
|
2587
|
+
/**
|
|
2588
|
+
* Commerce C-D21 (R-H1): whether a reading's business sells — settled by its kind, never left to a model's guess. A kind
|
|
2589
|
+
* that sells (`inferred`) has `products` (from: type, unless the owner named it); a kind that never sells (care, trust)
|
|
2590
|
+
* has none, whatever was said; the rest keep what the reading said — on Analysis, an `offered` kind shows `products`
|
|
2591
|
+
* switched off (`offeredNeeds`). Pure; the same list when nothing changes.
|
|
2592
|
+
*/
|
|
2593
|
+
declare function withSellingNeed(typeId: string | null | undefined, needs: ReadonlyArray<SiteNeed>, types?: ReadonlyArray<BusinessType>): SiteNeed[];
|
|
2594
|
+
/** The needs Analysis offers switched off for this kind of business (a café's beans): `products` for an `offered` one
|
|
2595
|
+
* whose reading lacks it. */
|
|
2596
|
+
declare function offeredNeeds(typeId: string | null | undefined, needs: ReadonlyArray<Pick<SiteNeed, 'id'>>, types?: ReadonlyArray<BusinessType>): NeedId[];
|
|
2597
|
+
/** True when the needs say the business sells (the plan must name what — generation-core `validateSitePlan`'s `sells`). */
|
|
2598
|
+
declare function needsSell(needs: ReadonlyArray<Pick<SiteNeed, 'id'>>): boolean;
|
|
2539
2599
|
|
|
2540
2600
|
/**
|
|
2541
2601
|
* Design advice (AI plan rev 3 §3f, H5's core): the business type's avoid rules run against a built site's
|
|
@@ -3179,5 +3239,5 @@ type SiteAuditView = SiteAudit & {
|
|
|
3179
3239
|
advice: LintFinding[];
|
|
3180
3240
|
};
|
|
3181
3241
|
|
|
3182
|
-
export { ANIMATE_ADVICE_STEPS, AnalysisIssueCode, AnalysisLocale, AvoidCheck, BUSINESS_TYPES, BUSINESS_TYPE_IDS, BookingNeed, COPY_LENGTH_ORDER, ComposedPageState, CopyLength, GENERATION_LIMITS, HARNESS_SOURCE, LITTLE_MOVEMENT_AVOID, LITTLE_MOVEMENT_CAP, LintKind, MAX_ANALYSIS_MOODS, MAX_PIXEL_SAMPLES, MAX_READ_PICTURES, NEEDS, NEED_IDS, NeedSource, PALETTE_SIZE, PALETTE_THRESHOLDS, PictureRole, PicturesUnavailable, PlanChangeOutcome, PresetFit, RANK_WEIGHTS, READING_SHAPE, READ_ANIMATE, READ_WEIGHTS, RankReason, ReaderState, ReadingIssueCode, SITE_ANALYSIS_SCHEMA_NAME, SITE_READING_SCHEMA_NAME, SPEC_ANALYSIS_SHAPE, SPEC_BUSINESS_TYPES, SPEC_HARNESS_EXAMPLES, SPEC_HARNESS_SOURCE, SPEC_NEEDS, SPEC_STRUCTURES, SPEC_USER_AVOIDS, STRUCTURES, SiteReadRefusal, StyleReadGround, StyleReadHeadings, StyleReadMotion, StyleReadSourceKind, USER_AVOID_IDS, VoiceFormality, VoicePerson, addressesIn, analysisFromWire, analysisPromptContext, analysisToWire, bestRankedPreset, businessTypeById, calmerChoice, decodeSiteReading, inferNeeds, isLookRule, lintDesign, lookMatches, mapStyleRead, matchBusinessType, matchBusinessTypes, measurePalette, mergeStyleReads, motionAdvice, motionFor, normalizeAddress, oklchHue, paletteBrand, paletteGround, paletteSamples, pictureStyleRead, pixelSamples, presetDesign, presetHasSerifHeadings, presetLook, presetReason, presetsByFlavor, rankStylePresets, rankWithReferences, readPalette, referenceSeed, seedPassesPreset, siteAnalysisJsonSchema, siteReadingJsonSchema, startingDesign, structureFor, userAvoidRule, validateSiteAnalysis, validateSiteReading, withoutAddress };
|
|
3242
|
+
export { ANIMATE_ADVICE_STEPS, AnalysisIssueCode, AnalysisLocale, AvoidCheck, BUSINESS_TYPES, BUSINESS_TYPE_IDS, BookingNeed, COPY_LENGTH_ORDER, ComposedPageState, CopyLength, GENERATION_LIMITS, HARNESS_SOURCE, LITTLE_MOVEMENT_AVOID, LITTLE_MOVEMENT_CAP, LintKind, MAX_ANALYSIS_MOODS, MAX_PIXEL_SAMPLES, MAX_READ_PICTURES, NEEDS, NEED_IDS, NeedSource, PALETTE_SIZE, PALETTE_THRESHOLDS, PRODUCTS_NEED, PictureRole, PicturesUnavailable, PlanChangeOutcome, PresetFit, RANK_WEIGHTS, READING_SHAPE, READ_ANIMATE, READ_WEIGHTS, RankReason, ReaderState, ReadingIssueCode, SITE_ANALYSIS_SCHEMA_NAME, SITE_READING_SCHEMA_NAME, SPEC_ANALYSIS_SHAPE, SPEC_BUSINESS_TYPES, SPEC_HARNESS_EXAMPLES, SPEC_HARNESS_SOURCE, SPEC_NEEDS, SPEC_STRUCTURES, SPEC_USER_AVOIDS, STRUCTURES, SellingNeed, SiteReadRefusal, StyleReadGround, StyleReadHeadings, StyleReadMotion, StyleReadSourceKind, USER_AVOID_IDS, VoiceFormality, VoicePerson, addressesIn, analysisFromWire, analysisPromptContext, analysisToWire, bestRankedPreset, businessTypeById, calmerChoice, decodeSiteReading, inferNeeds, isLookRule, lintDesign, lookMatches, mapStyleRead, matchBusinessType, matchBusinessTypes, measurePalette, mergeStyleReads, motionAdvice, motionFor, needsSell, normalizeAddress, offeredNeeds, oklchHue, paletteBrand, paletteGround, paletteSamples, pictureStyleRead, pixelSamples, presetDesign, presetHasSerifHeadings, presetLook, presetReason, presetsByFlavor, rankStylePresets, rankWithReferences, readPalette, referenceSeed, seedPassesPreset, siteAnalysisJsonSchema, siteReadingJsonSchema, startingDesign, structureFor, userAvoidRule, validateSiteAnalysis, validateSiteReading, withSellingNeed, withoutAddress };
|
|
3183
3243
|
export type { AiGenerationView, AnalysisContext, AnalysisIssue, AnalysisValidation, AvoidRule, BusinessType, BusinessTypeMatch, CheckRule, ColourSample, ComposedPageView, FactRead, GenerationBuildRequest, GenerationFileView, GenerationPicturesView, GenerationReadersView, GenerationStartRequest, GoodFit, LayoutCheckRequest, LayoutPhotoView, LintFinding, LintSite, LookCondition, LookDesign, LookRule, MeasuredPicture, MotionBasis, MotionInput, MotionStart, NeedDef, NeedId, PaletteColour, PaletteReading, PictureStyle, PlanRevisionView, PresetFlavorGroup, PromptContext, PromptContextOptions, PromptSection, RankInput, RankedPreset, ReadingIssue, ReferenceSeed, SiteAnalysis, SiteAuditView, SiteNeed, SiteReaderView, SiteReading, StartingDesign, StructureChoice, StructureId, StyleHints, StyleRead, UserAvoidId };
|
package/package.json
CHANGED
|
@@ -50,6 +50,9 @@ export enum SiteFindingCode {
|
|
|
50
50
|
UnfilledFact = 'unfilled-fact',
|
|
51
51
|
CopyPlaceholder = 'copy-placeholder',
|
|
52
52
|
SampleItems = 'sample-items',
|
|
53
|
+
/** Commerce G1 (shop-aware §3i): a sample product the build added still has no price — a price is a fact a buyer is
|
|
54
|
+
* held to, so the owner sets it (or removes the sample) before the store goes live. */
|
|
55
|
+
SamplePrice = 'sample-price',
|
|
53
56
|
StockPhoto = 'stock-photo',
|
|
54
57
|
/** M7: a picture made with AI for the site still stands where one of the studio's own could. */
|
|
55
58
|
MadePicture = 'made-picture',
|
|
@@ -79,6 +82,7 @@ export const FINDING_SEVERITY: Readonly<Record<SiteFindingCode, CheckSeverity>>
|
|
|
79
82
|
[SiteFindingCode.UnfilledFact]: CheckSeverity.Block,
|
|
80
83
|
[SiteFindingCode.CopyPlaceholder]: CheckSeverity.Ask,
|
|
81
84
|
[SiteFindingCode.SampleItems]: CheckSeverity.Ask,
|
|
85
|
+
[SiteFindingCode.SamplePrice]: CheckSeverity.Block,
|
|
82
86
|
[SiteFindingCode.StockPhoto]: CheckSeverity.Ask,
|
|
83
87
|
[SiteFindingCode.MadePicture]: CheckSeverity.Ask,
|
|
84
88
|
[SiteFindingCode.PictureMissing]: CheckSeverity.Warn,
|
|
@@ -105,6 +109,7 @@ const CHECK_OF: Readonly<Record<SiteFindingCode, SiteCheckId>> = {
|
|
|
105
109
|
[SiteFindingCode.UnfilledFact]: SiteCheckId.Facts,
|
|
106
110
|
[SiteFindingCode.CopyPlaceholder]: SiteCheckId.Facts,
|
|
107
111
|
[SiteFindingCode.SampleItems]: SiteCheckId.Facts,
|
|
112
|
+
[SiteFindingCode.SamplePrice]: SiteCheckId.Facts,
|
|
108
113
|
[SiteFindingCode.StockPhoto]: SiteCheckId.Facts,
|
|
109
114
|
[SiteFindingCode.MadePicture]: SiteCheckId.Facts,
|
|
110
115
|
[SiteFindingCode.PictureMissing]: SiteCheckId.Facts,
|
|
@@ -170,6 +175,8 @@ export interface SiteAuditSnapshot {
|
|
|
170
175
|
placeholders?: ReadonlyArray<AuditPlaceholder>;
|
|
171
176
|
/** Sample items still in the site (`isSample`). */
|
|
172
177
|
samples?: ReadonlyArray<{ contentType: string; id: string; label?: string }>;
|
|
178
|
+
/** Commerce G1: sample products (`isSample`) whose price is still not set. */
|
|
179
|
+
unpricedSamples?: ReadonlyArray<{ id: string; label?: string }>;
|
|
173
180
|
/** Stock photos a build placed that are still on the page. */
|
|
174
181
|
stock?: ReadonlyArray<{ nodeId: string; pageId?: string; owner?: string }>;
|
|
175
182
|
/** M7: pictures made with AI that are still on the page. */
|
|
@@ -291,6 +298,7 @@ function checkFacts(ctx: Ctx, snapshot: SiteAuditSnapshot, pages: ReadonlyArray<
|
|
|
291
298
|
else if (p.kind === PlaceholderKind.Copy) add(ctx, SiteFindingCode.CopyPlaceholder, 'Some words are still the template\'s.', where);
|
|
292
299
|
}
|
|
293
300
|
for (const s of snapshot.samples ?? []) add(ctx, SiteFindingCode.SampleItems, `"${s.label ?? s.id}" is a sample — replace or remove it.`, { nodeId: s.id });
|
|
301
|
+
for (const s of snapshot.unpricedSamples ?? []) add(ctx, SiteFindingCode.SamplePrice, `"${s.label ?? s.id}" has no price yet — set yours, or remove the sample.`, { nodeId: s.id });
|
|
294
302
|
for (const s of (snapshot.stock ?? []).filter(inScope)) add(ctx, SiteFindingCode.StockPhoto, 'A stock photo stands in for one of yours.', { pageId: s.pageId, nodeId: s.nodeId, owner: s.owner });
|
|
295
303
|
for (const s of (snapshot.made ?? []).filter(inScope)) add(ctx, SiteFindingCode.MadePicture, 'A picture made with AI stands in for one of yours.', { pageId: s.pageId, nodeId: s.nodeId, owner: s.owner });
|
|
296
304
|
for (const s of (snapshot.missing ?? []).filter(inScope)) add(ctx, SiteFindingCode.PictureMissing, 'A picture could not be made for this spot — add one of yours.', { pageId: s.pageId, nodeId: s.nodeId, owner: s.owner });
|
|
@@ -9,15 +9,17 @@ import {
|
|
|
9
9
|
AccordionAutoBinds, CompositeNodeSpec, findByRole, LIGHTBOX_LABEL, SLIDE_TO_ROW, SLIDE_TYPE, buildTabsRecipe, tabLabelNodeOf,
|
|
10
10
|
tabPanelImageOf, tabPanelTextOf, tabsListOf, tabsPanels, tabsPanelsOf, tabsTriggers, TABS_CONTENT_LIMIT, TABS_IMAGE_BIND_PROP, TABS_LABEL_BIND_PROP,
|
|
11
11
|
TABS_TEXT_BIND_PROP, TABS_WORDS, TabsAutoBinds, BadgeTone, BADGE_TONES, buildSegmentedRecipe, CardWords, ITEM_OPEN_STATE, segmentedOptions,
|
|
12
|
-
setHeaderBehaviour,
|
|
12
|
+
setHeaderBehaviour, SHOP_RECIPES, ShopRecipe, ShopRole, bindShopPart, ShopBindTarget,
|
|
13
13
|
} from '@vectoriox/iox-ui/composite-core';
|
|
14
14
|
|
|
15
15
|
import { EntranceMark, EntrancePart, planEntrances } from './entrances';
|
|
16
16
|
import { filmOfPlan } from './film';
|
|
17
17
|
import { NODE_BASELINES } from './node-baselines.generated';
|
|
18
18
|
import {
|
|
19
|
-
BindScope, CardBindTarget, parsePatternPath, PatternDirective, PatternNode, PatternOpens, PatternPlaceholder, PatternRecipe, PatternTrack,
|
|
19
|
+
BindScope, CardBindTarget, parsePatternPath, PatternDirective, PatternGlobalPosition, PatternNode, PatternOpens, PatternPlaceholder, PatternRecipe, PatternTrack,
|
|
20
|
+
PriceBindTarget, SitePattern, patternById,
|
|
20
21
|
} from './patterns';
|
|
22
|
+
import { planSells, shopCategoriesOf, shopContentType, variantNamesOf } from './shop-plan';
|
|
21
23
|
import { recipeListBinds } from './recipe-fields';
|
|
22
24
|
import { assertStyleSlots, ComposeError, createSerializedNode, SerializedBinding, SerializedNode, setStyleProps, walkSerialized } from './serialized-node';
|
|
23
25
|
import { SitePlanSourceKind, ContentFieldControl, ContentFieldPlan,
|
|
@@ -25,7 +27,7 @@ import { SitePlanSourceKind, ContentFieldControl, ContentFieldPlan,
|
|
|
25
27
|
PlanDataSourceType, RelativeOp, roleField, SiteLocale, SitePlan, SitePlanSource, SITE_FACT_LABELS, SiteBusiness,
|
|
26
28
|
} from './site-plan.model';
|
|
27
29
|
import { assertValidSitePlan, nextSourceOf, routeParams } from './validate-site-plan';
|
|
28
|
-
import { NavShape, planNavShape } from './nav-shape';
|
|
30
|
+
import { NavRole, NavShape, planNavShape } from './nav-shape';
|
|
29
31
|
import { composeLayout, LayoutColourMode, layoutBandScheme } from './compose-layout';
|
|
30
32
|
import { LayoutGalleryList, LayoutPage, LayoutPhotoShape, LayoutPhotoSource, LayoutSite, parseLayoutPhotoId } from './layout-language';
|
|
31
33
|
import { layoutMotionOf, layoutPresetOf } from './layout-look';
|
|
@@ -190,6 +192,31 @@ export interface ComposedSite {
|
|
|
190
192
|
routes: ComposedRoute[];
|
|
191
193
|
placeholders: ComposedPlaceholder[];
|
|
192
194
|
issues: ComposeIssue[];
|
|
195
|
+
/** Commerce C-D21: what the build writes into the studio's SHOP (never a content type) — null when it sells nothing. */
|
|
196
|
+
shop: ComposedShop | null;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/** A sample product as the build writes it through the shop's own write path (its slug made there, from its title). */
|
|
200
|
+
export interface ComposedProduct {
|
|
201
|
+
title: string;
|
|
202
|
+
/** The category's label (the build writes the categories first and links each product to its own). */
|
|
203
|
+
category: string;
|
|
204
|
+
description: string;
|
|
205
|
+
options: Array<{ name: string; values: string[] }>;
|
|
206
|
+
/** Whether it varies, and its variants by name (one per combination; sold, no price, no stock — the owner's). */
|
|
207
|
+
productVariants: boolean;
|
|
208
|
+
variants: Array<{ name: string; enable: true }>;
|
|
209
|
+
/** Never a number (shop-aware §3i, T4): the price is the owner's — a sample's blocks Publish until it is set. */
|
|
210
|
+
pricing: { price: null; compareat: null };
|
|
211
|
+
/** Its picture, once the build placed one (a stock photo, the owner's, a made one) — absent until then. */
|
|
212
|
+
mainImage?: string;
|
|
213
|
+
isSample: true;
|
|
214
|
+
isPublished: true;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface ComposedShop {
|
|
218
|
+
categories: Array<{ label: string }>;
|
|
219
|
+
products: ComposedProduct[];
|
|
193
220
|
}
|
|
194
221
|
|
|
195
222
|
/** `{sampleImage:k}` — a bundled abstract sample image, never a stock photo (plan §6b). */
|
|
@@ -413,7 +440,7 @@ function detailLinkOf(scope: string, repeater: RepeaterScope | null, ctx: Ctx, n
|
|
|
413
440
|
const type = typeSource ? contentTypeOfSource(typeSource, ctx.plan) : undefined;
|
|
414
441
|
const page = type ? ctx.plan.pages.find(p => p.template === type.name && !!p.routeSource) : undefined;
|
|
415
442
|
const byRoute = page ? ctx.plan.dataSources.find(d => d.alias === page.routeSource) : undefined;
|
|
416
|
-
const filter = byRoute && byRoute.type
|
|
443
|
+
const filter = byRoute && byRoute.type !== PlanDataSourceType.Relative ? byRoute.filterByRouteParam : undefined;
|
|
417
444
|
const [param] = page ? routeParams(page.route) : [];
|
|
418
445
|
if (!page || !filter || !param) return null;
|
|
419
446
|
return { route: page.route, param, binding: resolveScoped(`${scope}.${filter.field}`, repeater, ctx, nodeId) };
|
|
@@ -434,6 +461,7 @@ export function contentTypeOfSource(alias: string, plan: SitePlan): ContentTypeP
|
|
|
434
461
|
const ds = plan.dataSources.find(d => d.alias === alias);
|
|
435
462
|
if (!ds) return undefined;
|
|
436
463
|
if (ds.type === PlanDataSourceType.Relative) return contentTypeOfSource(ds.within, plan);
|
|
464
|
+
if (ds.type === PlanDataSourceType.Shop) return shopContentType(ds.resource);
|
|
437
465
|
return plan.contentTypes.find(t => t.name === ds.contentType);
|
|
438
466
|
}
|
|
439
467
|
|
|
@@ -752,6 +780,11 @@ function composeNode(given: PatternNode, id: string, repeater: RepeaterScope | n
|
|
|
752
780
|
throw new ComposeError(`${id}: "alt" belongs on a bound Image`);
|
|
753
781
|
}
|
|
754
782
|
|
|
783
|
+
if (pn.limit !== undefined) {
|
|
784
|
+
if (type !== REPEATER) throw new ComposeError(`${id}: "limit" belongs on a Repeater`);
|
|
785
|
+
setProp(node, 'limit', pn.limit);
|
|
786
|
+
}
|
|
787
|
+
|
|
755
788
|
// Layout.
|
|
756
789
|
applyLayout(node, pn);
|
|
757
790
|
if (pn.shownWhen) hideUntilOn(node, pn, ctx);
|
|
@@ -834,6 +867,7 @@ const CARD_BINDS: Readonly<Record<CardBindTarget, { role: CardRole; prop: string
|
|
|
834
867
|
* through its title (`href` + `param`, the stretched link). Ids derive from the recipe's keys.
|
|
835
868
|
*/
|
|
836
869
|
function composeRecipe(pn: PatternNode, id: string, repeater: RepeaterScope | null, ctx: Ctx): SerializedNode {
|
|
870
|
+
if (SHOP_PATTERN_RECIPES.has(pn.recipe as PatternRecipe)) return composeShopRecipe(pn, id, repeater, ctx);
|
|
837
871
|
if (pn.recipe === PatternRecipe.Accordion) return composeAccordion(pn, id, ctx);
|
|
838
872
|
if (pn.recipe === PatternRecipe.Tabs) return composeTabs(pn, id, ctx);
|
|
839
873
|
if (pn.recipe === PatternRecipe.Carousel) return composeCarousel(pn, id, ctx);
|
|
@@ -1040,6 +1074,90 @@ function composeTabs(pn: PatternNode, id: string, ctx: Ctx): SerializedNode {
|
|
|
1040
1074
|
}
|
|
1041
1075
|
|
|
1042
1076
|
/** A recipe's node factory for this composer: ids derive from the recipe's keys (`<id>-<key>`, the root `<id>`). */
|
|
1077
|
+
/** Commerce G1: a pattern's shop recipes, each E1c's `SHOP_RECIPES` entry and the key its root is built with. */
|
|
1078
|
+
const SHOP_PATTERN_RECIPES: ReadonlyMap<PatternRecipe, { recipe: ShopRecipe; rootKey: string }> = new Map([
|
|
1079
|
+
[PatternRecipe.Price, { recipe: ShopRecipe.Price, rootKey: 'price' }],
|
|
1080
|
+
[PatternRecipe.Variants, { recipe: ShopRecipe.Variants, rootKey: 'variants' }],
|
|
1081
|
+
[PatternRecipe.Quantity, { recipe: ShopRecipe.Quantity, rootKey: 'quantity' }],
|
|
1082
|
+
[PatternRecipe.Add, { recipe: ShopRecipe.Add, rootKey: 'add' }],
|
|
1083
|
+
[PatternRecipe.BuyNow, { recipe: ShopRecipe.BuyNow, rootKey: 'buy-now' }],
|
|
1084
|
+
]);
|
|
1085
|
+
|
|
1086
|
+
const PRICE_BINDS: Readonly<Record<PriceBindTarget, ShopBindTarget>> = {
|
|
1087
|
+
[PriceBindTarget.Price]: ShopBindTarget.Price,
|
|
1088
|
+
[PriceBindTarget.CompareAt]: ShopBindTarget.CompareAt,
|
|
1089
|
+
};
|
|
1090
|
+
|
|
1091
|
+
/** E1c's root keys of the recipes a site holds outside its sections — the header's bag and the one cart drawer. */
|
|
1092
|
+
const CART_BUTTON_KEY = 'cart-button';
|
|
1093
|
+
const CART_DRAWER_KEY = 'cart-drawer';
|
|
1094
|
+
/** The ids the composer gives them (the header's bag; the drawer, a global after the page). */
|
|
1095
|
+
export const SHOP_CART_BUTTON_ID = 'header-cart';
|
|
1096
|
+
export const SHOP_CART_DRAWER_ID = 'cart';
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Commerce G1: a shop part stamped whole from E1c's recipe (`SHOP_RECIPES`) — the product page's own reading the page's
|
|
1100
|
+
* product (`$variant`, the runtime's), a list's price re-bound to its ROW (`binds`: `item.@price` → `pricing.price`,
|
|
1101
|
+
* through `bindShopPart`, the money pipe kept). A compare-at the row's type cannot show is left out. Never an entrance.
|
|
1102
|
+
*/
|
|
1103
|
+
function composeShopRecipe(pn: PatternNode, id: string, repeater: RepeaterScope | null, ctx: Ctx): SerializedNode {
|
|
1104
|
+
const spec = SHOP_PATTERN_RECIPES.get(pn.recipe as PatternRecipe)!;
|
|
1105
|
+
const root = SHOP_RECIPES[spec.recipe](recipeFactory(id, spec.rootKey)) as SerializedNode;
|
|
1106
|
+
if (root.id !== id) throw new ComposeError(`${id}: the ${pn.recipe} recipe's root is not "${spec.rootKey}"`);
|
|
1107
|
+
for (const [key, path] of Object.entries(pn.binds ?? {})) {
|
|
1108
|
+
const target = PRICE_BINDS[key as PriceBindTarget];
|
|
1109
|
+
if (spec.recipe !== ShopRecipe.Price || !target) throw new ComposeError(`${id}: a ${pn.recipe} cannot bind "${key}"`);
|
|
1110
|
+
const scoped = resolveScopedPath(path, repeater, ctx, id);
|
|
1111
|
+
if (scoped) {
|
|
1112
|
+
bindShopPart(root as CompositeNode, target, scoped.source, scoped.path);
|
|
1113
|
+
continue;
|
|
1114
|
+
}
|
|
1115
|
+
if (target === ShopBindTarget.Price) throw new ComposeError(`${id}: a price cannot be left out`);
|
|
1116
|
+
root.children = (root.children ?? []).filter(c => c.role !== ShopRole.PriceCompare);
|
|
1117
|
+
}
|
|
1118
|
+
if (pn.lay) setStyleProps(root, pn.lay);
|
|
1119
|
+
return root;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
/**
|
|
1123
|
+
* Commerce G1 (C-D21): a selling site is a whole store on every page — the header holds the bag (before the menu
|
|
1124
|
+
* button; the brand takes the row's free space, so the bag sits at the end on every width, either direction), and the
|
|
1125
|
+
* site holds the ONE cart drawer as a global after the page (`SHOP_GLOBAL_RECIPES`), which every bag opens. Check out
|
|
1126
|
+
* is the drawer's own (the fixed checkout). Pure: new globals.
|
|
1127
|
+
*/
|
|
1128
|
+
function withStore(globals: SerializedNode[]): SerializedNode[] {
|
|
1129
|
+
const out = [...globals];
|
|
1130
|
+
const header = out.find(g => g.id === GlobalSlot.Header);
|
|
1131
|
+
if (header) {
|
|
1132
|
+
const kids = header.children ?? (header.children = []);
|
|
1133
|
+
const bag = SHOP_RECIPES[ShopRecipe.CartButton](recipeFactory(SHOP_CART_BUTTON_ID, CART_BUTTON_KEY)) as SerializedNode;
|
|
1134
|
+
const menu = kids.findIndex(k => k.role === NavRole.MenuButton);
|
|
1135
|
+
kids.splice(menu >= 0 ? menu : kids.length, 0, bag);
|
|
1136
|
+
const brand = kids.find(k => k.role === NavRole.Brand);
|
|
1137
|
+
if (brand) setStyleProps(brand, { flexGrow: '1' });
|
|
1138
|
+
}
|
|
1139
|
+
const drawer = SHOP_RECIPES[ShopRecipe.CartDrawer](recipeFactory(SHOP_CART_DRAWER_ID, CART_DRAWER_KEY)) as SerializedNode;
|
|
1140
|
+
drawer.isGlobal = true;
|
|
1141
|
+
drawer.globalPosition = PatternGlobalPosition.After;
|
|
1142
|
+
out.push(drawer);
|
|
1143
|
+
return out;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
/** The plan's products as the build writes them — samples, published, each with no price (the owner's to set). */
|
|
1147
|
+
function composeShop(plan: SitePlan): ComposedShop | null {
|
|
1148
|
+
if (!planSells(plan) || !plan.shop) return null;
|
|
1149
|
+
return {
|
|
1150
|
+
categories: shopCategoriesOf(plan.shop.products).map(label => ({ label })),
|
|
1151
|
+
products: plan.shop.products.map(p => ({
|
|
1152
|
+
title: p.name.trim(), category: p.category.trim(), description: p.description.trim(),
|
|
1153
|
+
options: p.options.map(o => ({ name: o.name.trim(), values: o.values.map(v => v.trim()) })),
|
|
1154
|
+
productVariants: variantNamesOf(p.options).length > 0,
|
|
1155
|
+
variants: variantNamesOf(p.options.map(o => ({ values: o.values.map(v => v.trim()) }))).map(name => ({ name, enable: true as const })),
|
|
1156
|
+
pricing: { price: null, compareat: null }, isSample: true, isPublished: true,
|
|
1157
|
+
})),
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1043
1161
|
function recipeFactory(id: string, rootKey: string): (spec: CompositeNodeSpec) => CompositeNode {
|
|
1044
1162
|
return spec => create(spec.key === rootKey ? id : `${id}-${spec.key}`, spec.type, { ...(spec.props ?? {}) }, spec.elementStyle ?? null) as CompositeNode;
|
|
1045
1163
|
}
|
|
@@ -1181,6 +1299,12 @@ function composeDataSource(ds: DataSourcePlan): ComposedDataSource {
|
|
|
1181
1299
|
if (ds.filterByRouteParam) cms['filterByRouteParam'] = { ...ds.filterByRouteParam };
|
|
1182
1300
|
return { id, alias: ds.alias, type: PlanDataSourceType.Cms, mode: ds.mode, request: { cms } };
|
|
1183
1301
|
}
|
|
1302
|
+
if (ds.type === PlanDataSourceType.Shop) {
|
|
1303
|
+
const shop: Record<string, unknown> = { contentType: ds.resource };
|
|
1304
|
+
if (ds.limit !== undefined) shop['limit'] = ds.limit;
|
|
1305
|
+
if (ds.filterByRouteParam) shop['filterByRouteParam'] = { ...ds.filterByRouteParam };
|
|
1306
|
+
return { id, alias: ds.alias, type: PlanDataSourceType.Shop, mode: ds.mode, request: { shop } };
|
|
1307
|
+
}
|
|
1184
1308
|
const pick = ds.op === RelativeOp.SiblingsNext ? 'next' : 'prev';
|
|
1185
1309
|
return {
|
|
1186
1310
|
id, alias: ds.alias, type: PlanDataSourceType.Relative, mode: PlanDataSourceMode.Single,
|
|
@@ -1357,6 +1481,7 @@ export function composeSite(plan: SitePlan, context: ComposeContext): ComposedSi
|
|
|
1357
1481
|
const root = header ? globals.find(g => g.id === slot) : null;
|
|
1358
1482
|
if (header && root) setHeaderBehaviour(root as unknown as CompositeNode, header.behaviour, header.edge ?? null);
|
|
1359
1483
|
}
|
|
1484
|
+
if (planSells(plan)) globals = withStore(globals);
|
|
1360
1485
|
|
|
1361
1486
|
return {
|
|
1362
1487
|
source: clone(plan.source),
|
|
@@ -1370,6 +1495,7 @@ export function composeSite(plan: SitePlan, context: ComposeContext): ComposedSi
|
|
|
1370
1495
|
routes: plan.pages.map(p => ({ key: p.key, path: p.route, isHome: p.isHome === true })),
|
|
1371
1496
|
placeholders,
|
|
1372
1497
|
issues,
|
|
1498
|
+
shop: composeShop(plan),
|
|
1373
1499
|
};
|
|
1374
1500
|
}
|
|
1375
1501
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ShopRole } from '@vectoriox/iox-ui/composite-core';
|
|
1
2
|
import { LinkType } from '@vectoriox/iox-ui/design-core';
|
|
2
3
|
|
|
3
4
|
import { PatternGlobalPosition } from './patterns';
|
|
@@ -433,9 +434,10 @@ function removeRole(node: SerializedNode, role: NavRole): SerializedNode | null
|
|
|
433
434
|
return removed;
|
|
434
435
|
}
|
|
435
436
|
|
|
436
|
-
/** The root's own parts that hide at the phone width: everything but the brand, the menu button
|
|
437
|
+
/** The root's own parts that hide at the phone width: everything but the brand, the menu button, the drawer and a
|
|
438
|
+
* store's bag (commerce G1 — a phone visitor reaches the cart from every page). */
|
|
437
439
|
function phoneHiddenParts(root: SerializedNode): SerializedNode[] {
|
|
438
|
-
const keep = new Set<string | undefined>([NavRole.Brand, NavRole.MenuButton, NavRole.Drawer]);
|
|
440
|
+
const keep = new Set<string | undefined>([NavRole.Brand, NavRole.MenuButton, NavRole.Drawer, ShopRole.CartButton]);
|
|
439
441
|
return (root.children ?? []).filter((c, i) => !keep.has(roleOf(c)) && !(i === 0 && !c.role && c.type === LINKED));
|
|
440
442
|
}
|
|
441
443
|
|