Documentation
¶
Overview ¶
Package commerce is the eCommerce edition: the blog module list plus the catalog module — native pricing, variant matrices, stock, and SKUs keyed to a configured product post type — and the official storefront theme in place of the blog theme. Install path:
go install github.com/aristorinjuang/lesstruct/cmd/lesstruct-ecommerce@latest
Operators may still override any page or asset with THEME_DIR. The demo project's config.toml works unchanged.
Orders wiring: the three seam adapters the orders module needs. The cart service feeds checkout, the content service snapshots published titles, and the platform email service carries the customer notifications. The wire step lives with the state in commerce.go.
Index ¶
- func Edition() app.Edition
- func NewCartCheckout(service *cartdomain.Service) ordersdomain.CartSource
- func NewCatalogInventory(service *catalogdomain.Service, log kernel.Logger) ordersdomain.Inventory
- func NewCatalogMailer(service *email.Service, notifyEmail string) catalogdomain.Mailer
- func NewCatalogSource(service *catalogdomain.Service, identity ProductIdentityFunc) cartdomain.CatalogSource
- func NewContentTitles(service *contentdomain.Service) ordersdomain.ContentSource
- func NewOrderMailer(service *email.Service, payee email.ManualPayee) ordersdomain.Mailer
- func NewOrderSeams(service *ordersdomain.Service) paymentsdomain.Orders
- func NewPaymentMailer(service *email.Service) paymentsdomain.Mailer
- type ProductIdentity
- type ProductIdentityFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Edition ¶
Edition returns the commerce edition: the full blog composition plus the catalog, cart, and orders modules, with the storefront theme registered in place of the default blog theme. The blog hooks run first (their modules adopt the platform services), then the catalog wire adds the commerce stack and accumulates its config extras, the cart wire adds the token-keyed carts priced from the catalog service, and the orders wire adds checkout over the cart plus the admin order surface. The merged config extras install once after every wire ran.
func NewCartCheckout ¶
func NewCartCheckout(service *cartdomain.Service) ordersdomain.CartSource
NewCartCheckout builds the seam adapter over the adopted cart service.
func NewCatalogInventory ¶
func NewCatalogInventory(service *catalogdomain.Service, log kernel.Logger) ordersdomain.Inventory
NewCatalogInventory builds the seam adapter over the adopted catalog service.
func NewCatalogMailer ¶
func NewCatalogMailer(service *email.Service, notifyEmail string) catalogdomain.Mailer
NewCatalogMailer builds the Mailer seam adapter over the platform email service and the [catalog] notify_email recipient (empty disables).
func NewCatalogSource ¶
func NewCatalogSource(service *catalogdomain.Service, identity ProductIdentityFunc) cartdomain.CatalogSource
NewCatalogSource builds the seam adapter over the adopted catalog service. The identity lookup may be nil, in which case lines carry no display labels.
func NewContentTitles ¶
func NewContentTitles(service *contentdomain.Service) ordersdomain.ContentSource
NewContentTitles builds the seam adapter over the platform content service.
func NewOrderMailer ¶
func NewOrderMailer(service *email.Service, payee email.ManualPayee) ordersdomain.Mailer
NewOrderMailer builds the seam adapter over the platform email service. A set payee appends the How-to-pay block to the confirmation email.
func NewOrderSeams ¶
func NewOrderSeams(service *ordersdomain.Service) paymentsdomain.Orders
NewOrderSeams builds the Orders seam adapter over the adopted orders service.
func NewPaymentMailer ¶
func NewPaymentMailer(service *email.Service) paymentsdomain.Mailer
NewPaymentMailer builds the Mailer seam adapter over the platform email service.
Types ¶
type ProductIdentity ¶
ProductIdentity is the published display identity of one product: what the cart page needs to render a recognizable line.
type ProductIdentityFunc ¶
type ProductIdentityFunc func(ctx context.Context, contentID int) (ProductIdentity, bool)
ProductIdentityFunc resolves a published product's display identity. A miss returns ok=false: the line still resolves, just without labels.
func NewProductIdentity ¶
func NewProductIdentity(service *contentdomain.Service) ProductIdentityFunc
NewProductIdentity adapts the content service onto ProductIdentityFunc. The image is the explicit featured image, falling back to the first image in the body — the same resolution the public content pages use, so cart lines match the storefront cards.