@thorprovider/storefront 0.3.1 → 0.4.0-mvp.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/CHANGELOG.md +23 -0
- package/README.md +248 -99
- package/assets/templates/app/app/[[...slug]]/page.tsx +13 -2
- package/assets/templates/app/app/layout.tsx +18 -4
- package/assets/templates/app/app/robots.ts +13 -0
- package/assets/templates/app/app/sitemap.ts +12 -0
- package/assets/templates/app/lib/__STOREFRONT__/actions.ts +542 -0
- package/assets/templates/app/lib/__STOREFRONT__/cart-state.ts +66 -0
- package/assets/templates/app/lib/__STOREFRONT__/catalog.ts +40 -57
- package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +608 -0
- package/assets/templates/app/lib/__STOREFRONT__/handlers.core.ts +165 -0
- package/assets/templates/app/lib/__STOREFRONT__/handlers.ts +5 -36
- package/assets/templates/app/lib/__STOREFRONT__/icon-map.ts +27 -0
- package/assets/templates/app/lib/__STOREFRONT__/mappers.ts +13 -11
- package/assets/templates/app/lib/__STOREFRONT__/registry.tsx +232 -51
- package/assets/templates/app/lib/__STOREFRONT__/runtime.ts +3 -3
- package/assets/templates/app/lib/__STOREFRONT__/schema.ts +121 -0
- package/assets/templates/app/lib/__STOREFRONT__/session.core.ts +470 -0
- package/assets/templates/app/lib/__STOREFRONT__/session.ts +169 -0
- package/assets/templates/app/lib/__STOREFRONT__/shell/content.ts +96 -0
- package/assets/templates/app/lib/__STOREFRONT__/shell/props.ts +34 -0
- package/assets/templates/app/lib/__STOREFRONT__/spec/index.ts +100 -11
- package/assets/templates/app/lib/__STOREFRONT__/spec/page-root.ts +5 -1
- package/assets/templates/app/lib/__STOREFRONT__/spec/seo.ts +26 -0
- package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +257 -0
- package/assets/templates/app/lib/__STOREFRONT__/state.ts +7 -31
- package/assets/templates/app/lib/__STOREFRONT__/store-context.ts +142 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/cta.client.tsx +25 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/cta.tsx +16 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/faq.client.tsx +24 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/faq.tsx +5 -18
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/index.ts +17 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/logoCloud.tsx +26 -14
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/pricing.tsx +36 -18
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.cta.ts +19 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.faq.ts +18 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/statistics.tsx +35 -14
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/testimonials.tsx +31 -13
- package/assets/templates/app/lib/__STOREFRONT__/views/types.ts +5 -3
- package/assets/templates/features/checkout/handlers.ts +153 -0
- package/assets/templates/features/checkout/state.ts +61 -0
- package/assets/templates/features/customer-auth/handlers.ts +59 -0
- package/assets/templates/features/customer-auth/state.ts +36 -0
- package/assets/templates/features/recommendations/state.ts +11 -0
- package/assets/templates/views/account/content.ts +35 -0
- package/assets/templates/views/account/index.tsx +114 -0
- package/assets/templates/views/account/registry.tsx +378 -0
- package/assets/templates/views/account/schema.ts +52 -0
- package/assets/templates/views/category/assembly/assembly.json +28 -0
- package/assets/templates/views/category/assembly/index.skeleton.tsx +193 -0
- package/assets/templates/views/category/assembly/registry.skeleton.tsx +33 -0
- package/assets/templates/views/category/assembly/slots/filter/CategoryFilter2/catalog.part +5 -0
- package/assets/templates/views/category/assembly/slots/filter/CategoryFilter2/element.part +34 -0
- package/assets/templates/views/category/assembly/slots/filter/CategoryFilter2/registry.part +71 -0
- package/assets/templates/views/category/content.ts +30 -0
- package/assets/templates/views/category/data.ts +12 -0
- package/assets/templates/views/category/index.tsx +230 -0
- package/assets/templates/views/category/props.ts +16 -0
- package/assets/templates/views/category/registry.tsx +103 -0
- package/assets/templates/views/category/schema.ts +78 -0
- package/assets/templates/views/checkout/content.ts +105 -0
- package/assets/templates/views/checkout/data.ts +23 -0
- package/assets/templates/views/checkout/index.tsx +111 -0
- package/assets/templates/views/checkout/props.ts +49 -0
- package/assets/templates/views/checkout/registry.tsx +217 -0
- package/assets/templates/views/checkout/schema.ts +229 -0
- package/assets/templates/views/home/assembly/assembly.json +24 -0
- package/assets/templates/views/home/assembly/index.skeleton.tsx +72 -0
- package/assets/templates/views/home/assembly/registry.skeleton.tsx +25 -0
- package/assets/templates/views/home/assembly/slots/benefits/Feature1/binding.json +5 -0
- package/assets/templates/views/home/assembly/slots/benefits/Feature1/catalog.part +4 -0
- package/assets/templates/views/home/assembly/slots/benefits/Feature1/element.part +4 -0
- package/assets/templates/views/home/assembly/slots/benefits/Feature1/registry.part +11 -0
- package/assets/templates/views/home/assembly/slots/benefits/Feature2/binding.json +5 -0
- package/assets/templates/views/home/assembly/slots/benefits/Feature2/catalog.part +4 -0
- package/assets/templates/views/home/assembly/slots/benefits/Feature2/element.part +4 -0
- package/assets/templates/views/home/assembly/slots/benefits/Feature2/registry.part +10 -0
- package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/binding.json +5 -0
- package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/catalog.part +4 -0
- package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/element.part +5 -0
- package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/registry.part +16 -0
- package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/binding.json +5 -0
- package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/catalog.part +4 -0
- package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/element.part +5 -0
- package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/registry.part +26 -0
- package/assets/templates/views/home/content.ts +70 -0
- package/assets/templates/views/home/data.ts +15 -0
- package/assets/templates/views/home/index.tsx +38 -84
- package/assets/templates/views/home/props.ts +22 -0
- package/assets/templates/views/home/registry.tsx +38 -22
- package/assets/templates/views/home/schema.ts +93 -0
- package/assets/templates/views/product/content.ts +25 -0
- package/assets/templates/views/product/data.ts +48 -0
- package/assets/templates/views/product/index.tsx +104 -0
- package/assets/templates/views/product/props.ts +20 -0
- package/assets/templates/views/product/registry.tsx +78 -0
- package/assets/templates/views/product/schema.ts +108 -0
- package/assets/templates/views/static/content.ts +99 -0
- package/assets/templates/views/static/index.tsx +60 -0
- package/assets/templates/views/static/registry.tsx +66 -0
- package/assets/templates/views/static/schema.ts +45 -0
- package/{skills/sf-view-gen/assets → assets}/templates/views/user-panel/index.tsx +8 -70
- package/{skills/sf-view-gen/assets → assets}/templates/views/user-panel/registry.tsx +23 -18
- package/assets/templates/views/user-panel/schema.ts +79 -0
- package/bin/storefront.js +1278 -79
- package/commands/sf-add-view.md +44 -13
- package/commands/sf-feature.md +28 -0
- package/commands/sf-theme.md +14 -8
- package/commands/sf-view.md +54 -12
- package/package.json +6 -4
- package/recipes/archetypes.json +28 -1
- package/recipes/catalog.json +361 -0
- package/recipes/catalog.mjs +128 -0
- package/recipes/catalog.schema.json +64 -0
- package/recipes/feature.schema.json +89 -0
- package/recipes/features.json +139 -0
- package/recipes/manifest.schema.json +69 -0
- package/recipes/operations.schema.json +43 -0
- package/recipes/recipe.schema.json +11 -2
- package/recipes/recipes.json +60 -5
- package/recipes/sections.json +24 -5
- package/recipes/validate.mjs +784 -32
- package/scripts/candidate.mjs +236 -0
- package/scripts/composers.mjs +140 -0
- package/scripts/file-classes.mjs +116 -0
- package/scripts/logical-controls.mjs +61 -0
- package/scripts/manifest.mjs +298 -0
- package/scripts/operation-registry.mjs +256 -0
- package/scripts/operations.mjs +720 -0
- package/scripts/ownership-conflict.mjs +356 -0
- package/scripts/pinning.mjs +504 -0
- package/scripts/plan-apply.mjs +843 -0
- package/scripts/preflight.mjs +51 -0
- package/scripts/reconcile.mjs +511 -0
- package/scripts/render-templates.mjs +245 -28
- package/scripts/schema-validate.mjs +132 -0
- package/scripts/section-compat.mjs +300 -0
- package/scripts/section-operations.mjs +508 -0
- package/scripts/sync-assets.mjs +22 -15
- package/scripts/view-assembly.mjs +291 -0
- package/scripts/view-selection.mjs +211 -0
- package/skills/sf-feature/SKILL.md +67 -0
- package/skills/sf-theme-gen/SKILL.md +12 -5
- package/skills/sf-view-gen/SKILL.md +123 -93
- package/skills/sf-view-gen/assets/recipes/archetypes.json +28 -1
- package/skills/sf-view-gen/assets/recipes/catalog.json +361 -0
- package/skills/sf-view-gen/assets/recipes/catalog.schema.json +64 -0
- package/skills/sf-view-gen/assets/recipes/features.json +139 -0
- package/skills/sf-view-gen/assets/recipes/recipes.json +60 -5
- package/skills/sf-view-gen/assets/recipes/sections.json +24 -5
- package/skills/sf-view-gen/assets/templates/views/sections/cta.client.tsx +25 -0
- package/skills/sf-view-gen/assets/templates/views/sections/cta.tsx +16 -0
- package/skills/sf-view-gen/assets/templates/views/sections/faq.client.tsx +13 -9
- package/skills/sf-view-gen/assets/templates/views/sections/faq.tsx +2 -7
- package/skills/sf-view-gen/assets/templates/views/sections/logoCloud.client.tsx +12 -8
- package/skills/sf-view-gen/assets/templates/views/sections/logoCloud.tsx +2 -7
- package/skills/sf-view-gen/assets/templates/views/sections/pricing.client.tsx +14 -10
- package/skills/sf-view-gen/assets/templates/views/sections/pricing.tsx +2 -9
- package/skills/sf-view-gen/assets/templates/views/sections/schema.cta.ts +19 -0
- package/skills/sf-view-gen/assets/templates/views/sections/schema.faq.ts +18 -0
- package/skills/sf-view-gen/assets/templates/views/sections/schema.logoCloud.ts +19 -0
- package/skills/sf-view-gen/assets/templates/views/sections/schema.pricing.ts +26 -0
- package/skills/sf-view-gen/assets/templates/views/sections/schema.statistics.ts +25 -0
- package/skills/sf-view-gen/assets/templates/views/sections/schema.testimonials.ts +23 -0
- package/skills/sf-view-gen/assets/templates/views/sections/statistics.client.tsx +16 -8
- package/skills/sf-view-gen/assets/templates/views/sections/statistics.tsx +2 -7
- package/skills/sf-view-gen/assets/templates/views/sections/testimonials.client.tsx +13 -9
- package/skills/sf-view-gen/assets/templates/views/sections/testimonials.tsx +2 -5
- package/skills/sf-view-gen/references/views.md +44 -10
- package/skills/sf-view-gen/scripts/catalog.mjs +128 -0
- package/skills/sf-view-gen/scripts/schema-validate.mjs +132 -0
- package/skills/sf-view-gen/scripts/validate.mjs +784 -32
- package/skills/storefront-workflow/SKILL.md +116 -0
- package/skills/sf-view-gen/assets/templates/views/category/index.tsx +0 -86
- package/skills/sf-view-gen/assets/templates/views/category/registry.tsx +0 -48
- package/skills/sf-view-gen/assets/templates/views/checkout/index.tsx +0 -192
- package/skills/sf-view-gen/assets/templates/views/checkout/registry.tsx +0 -45
- package/skills/sf-view-gen/assets/templates/views/product/index.tsx +0 -122
- package/skills/sf-view-gen/assets/templates/views/product/registry.tsx +0 -49
|
@@ -1,79 +1,62 @@
|
|
|
1
1
|
// Generated by Thor Commerce storefront (template: assets/templates/app/lib/__STOREFRONT__/catalog.ts)
|
|
2
2
|
// Base catalog for the app shell plus every registered view's catalog fragment.
|
|
3
3
|
// View element types live with their view module; the shell owns only chrome.
|
|
4
|
+
// Editorial section element types register through the section fragments here.
|
|
4
5
|
|
|
5
6
|
import { defineCatalog } from '@json-render/core'
|
|
6
7
|
import { schema } from '@json-render/react/schema'
|
|
7
8
|
import { z } from 'zod'
|
|
9
|
+
import {
|
|
10
|
+
bannerPropsSchema,
|
|
11
|
+
cartDrawerPropsSchema,
|
|
12
|
+
footerPropsSchema,
|
|
13
|
+
navbarPropsSchema,
|
|
14
|
+
productCardPropsSchema,
|
|
15
|
+
storefrontNavbarPropsSchema,
|
|
16
|
+
} from './schema'
|
|
8
17
|
import { views } from './views'
|
|
9
|
-
|
|
10
|
-
const ctaSchema = z.object({
|
|
11
|
-
label: z.string(),
|
|
12
|
-
href: z.string().optional(),
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
const navLinkSchema = z.object({
|
|
16
|
-
label: z.string(),
|
|
17
|
-
href: z.string().optional(),
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
const footerLinkSchema = z.object({
|
|
21
|
-
label: z.string(),
|
|
22
|
-
href: z.string().optional(),
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
const footerLinkColumnSchema = z.object({
|
|
26
|
-
title: z.string(),
|
|
27
|
-
links: z.array(footerLinkSchema),
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
// Declared locally so the catalog builder's zod version is the only one in play.
|
|
31
|
-
// Cross-major schema assignment (@thorprovider/blocks ships zod v3) breaks the
|
|
32
|
-
// defineCatalog contract, so the block contract is mirrored here instead.
|
|
33
|
-
const productSchema = z.object({
|
|
34
|
-
id: z.union([z.string(), z.number()]),
|
|
35
|
-
title: z.string(),
|
|
36
|
-
price: z.number(),
|
|
37
|
-
originalPrice: z.number().optional(),
|
|
38
|
-
image: z.string().optional(),
|
|
39
|
-
badge: z.string().optional(),
|
|
40
|
-
})
|
|
18
|
+
import { sectionCatalog } from './views/sections'
|
|
41
19
|
|
|
42
20
|
const baseComponents = {
|
|
43
21
|
Layout: {
|
|
44
22
|
props: z.object({}),
|
|
45
|
-
slots: ['default', 'header', 'footer'],
|
|
46
|
-
description:
|
|
23
|
+
slots: ['notices', 'default', 'header', 'footer'],
|
|
24
|
+
description:
|
|
25
|
+
'Page layout shell. The notices slot is the reserved top region for system messages; pages render inside its default slot.',
|
|
26
|
+
},
|
|
27
|
+
Page: {
|
|
28
|
+
props: z.object({}),
|
|
29
|
+
slots: ['default'],
|
|
30
|
+
description:
|
|
31
|
+
'Neutral page root. Wraps a route page without shell chrome so the shell Layout is not nested.',
|
|
32
|
+
},
|
|
33
|
+
SystemNotice: {
|
|
34
|
+
props: z.object({}),
|
|
35
|
+
description:
|
|
36
|
+
'Reserved top-of-page region for system/status notices (renders nothing when there is no notice).',
|
|
47
37
|
},
|
|
48
38
|
Navbar: {
|
|
49
|
-
props:
|
|
50
|
-
navLinks: z.array(navLinkSchema),
|
|
51
|
-
logoText: z.string(),
|
|
52
|
-
logoHref: z.string().optional(),
|
|
53
|
-
currentPath: z.string().optional(),
|
|
54
|
-
signIn: ctaSchema.optional(),
|
|
55
|
-
cta: ctaSchema.optional(),
|
|
56
|
-
cartCount: z.number().optional(),
|
|
57
|
-
}),
|
|
39
|
+
props: navbarPropsSchema,
|
|
58
40
|
description: 'Top navigation bar.',
|
|
59
41
|
},
|
|
42
|
+
StorefrontNavbar: {
|
|
43
|
+
props: storefrontNavbarPropsSchema,
|
|
44
|
+
description: 'Store navigation bar with category menu and cart.',
|
|
45
|
+
},
|
|
46
|
+
CartDrawer: {
|
|
47
|
+
props: cartDrawerPropsSchema,
|
|
48
|
+
description: 'Slide-over shopping cart.',
|
|
49
|
+
},
|
|
50
|
+
Banner: {
|
|
51
|
+
props: bannerPropsSchema,
|
|
52
|
+
description: 'Announcement banner above the header.',
|
|
53
|
+
},
|
|
60
54
|
ProductCard: {
|
|
61
|
-
props:
|
|
62
|
-
products: z.array(productSchema),
|
|
63
|
-
heading: z.string().optional(),
|
|
64
|
-
maxItems: z.number().optional(),
|
|
65
|
-
}),
|
|
55
|
+
props: productCardPropsSchema,
|
|
66
56
|
description: 'Grid of product cards.',
|
|
67
57
|
},
|
|
68
58
|
Footer: {
|
|
69
|
-
props:
|
|
70
|
-
brandName: z.string(),
|
|
71
|
-
brandDescription: z.string().optional(),
|
|
72
|
-
linkColumns: z.array(footerLinkColumnSchema),
|
|
73
|
-
newsletter: z
|
|
74
|
-
.object({ placeholder: z.string().optional(), buttonLabel: z.string().optional() })
|
|
75
|
-
.optional(),
|
|
76
|
-
}),
|
|
59
|
+
props: footerPropsSchema,
|
|
77
60
|
description: 'Site footer.',
|
|
78
61
|
},
|
|
79
62
|
}
|
|
@@ -81,7 +64,7 @@ const baseComponents = {
|
|
|
81
64
|
const viewComponents = Object.assign({}, ...views.map((view) => view.catalog))
|
|
82
65
|
|
|
83
66
|
export const catalog = defineCatalog(schema, {
|
|
84
|
-
components: { ...baseComponents, ...viewComponents },
|
|
67
|
+
components: { ...baseComponents, ...sectionCatalog, ...viewComponents },
|
|
85
68
|
actions: {},
|
|
86
69
|
})
|
|
87
70
|
|