@aglyn/plugins-commerce 1.0.0-beta.143 → 1.0.0-beta.144

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 (2) hide show
  1. package/README.md +90 -8
  2. package/package.json +13 -13
package/README.md CHANGED
@@ -1,10 +1,92 @@
1
- # @aglyn/plugins-ui-commerce
1
+ # @aglyn/plugins-commerce
2
2
 
3
- The commerce storefront UI feature plugin (AGL-290): product grids,
4
- product detail, cart, and checkout blocks for the besigner and tenant
5
- renderer. Built on the feature-plugin pattern (AGL-277) — it depends on
6
- `@aglyn/plugins-ui-mui` for primitives and theming and is never merged
7
- into it.
3
+ The Commerce plugin for Aglyn: products, carts, checkout, orders and point of sale, plus the visitor accounts and member blocks that ship in the same bundle. Install it if you are running or building on the Aglyn platform and want a storefront.
8
4
 
9
- Component ids registered here are persisted in screen documents; never
10
- rename them.
5
+ > Beta. Published from the Aglyn monorepo under the `beta` dist-tag; APIs can change between beta releases.
6
+
7
+ ## Install
8
+
9
+ npm install @aglyn/plugins-commerce@beta
10
+
11
+ Peer dependencies:
12
+
13
+ - `@mui/material`
14
+ - `firebase`
15
+ - `next`
16
+ - `react`
17
+
18
+ None is optional. The server half additionally relies on `firebase-admin` through `@aglyn/tenant-data-admin`.
19
+
20
+ ## What's in it
21
+
22
+ This package is a first-party Aglyn plugin. It is loaded through Aglyn's plugin manager: the apps read its entry in the monorepo's `plugins.config.json`, import the module each surface names, and call the registrar declared for that surface. It is not a standalone library; installing it on its own loads nothing.
23
+
24
+ ### On a published site
25
+
26
+ `registerCommercePlugin()` registers these canvas components, placed in Besigner like any other element:
27
+
28
+ - Storefront: `product-grid`, `product-detail`, `related-products`, `product-reviews`, `cart`, `wishlist`, `reservation-widget`, `newsletter-signup`
29
+ - Accounts and members: `customer-account`, `member-signin`, `member-signup`, `member-recovery`, `member-feed`, `gate`, `gated-video`
30
+
31
+ Component ids are persisted in screen documents and are never renamed.
32
+
33
+ The entry in `plugins.config.json` also declares an `accounts` capability ("User Accounts"): visitor accounts on the site, with the sign-in, sign-up and recovery pages and the member blocks. It requires commerce, is off for a site until turned on, and has no separate package; this bundle registers its blocks and its `membership/*` handlers.
34
+
35
+ ### In the console
36
+
37
+ `registerCommerceConsole()` registers:
38
+
39
+ - A **Products** nav item and page at `/products`, with the sections Catalog, Orders, Promotions, Reservations, Settings and Analytics as routes.
40
+ - A **POS** nav item and page at `/pos`, which requires the plugin's own `managePos` permission.
41
+ - A "Commerce" widget in the `commerceGlance` slot, and a "Newest site users" widget in the `hostDashboard` slot under the accounts capability.
42
+ - The plugin's permissions (`COMMERCE_PERMISSIONS`) and its config schema (`COMMERCE_CONFIG_SCHEMA`, which holds the POS discount ceiling).
43
+
44
+ All console pages and cards are code-split.
45
+
46
+ ### On the server
47
+
48
+ `@aglyn/plugins-commerce/server` pulls in `firebase-admin` and Stripe and is kept out of the client entry point.
49
+
50
+ - `registerCommerceApi()` (the `tenantApi` surface) registers the storefront routes under `commerce/` (catalog, product, related, reviews, cart, cart checkout, checkout, download, feed, newsletter, restock notifications, order analytics, reservations, gate, member feed, stream, subscription portal) and the account routes under `membership/` (register, login, logout, recover, reset, account, content, wishlist). It also registers a site page resolver and enricher, the commerce tax profile and a product card reader on core seams.
51
+ - `registerCommerceConsoleApi()` (the `consoleApi` surface) registers the merchant routes: cancel, fulfill and refund an order, draft orders, POS orders, gift cards, member posts, Stripe Connect, supplier updates, and the abandoned-checkout and restock processors. It also adds a handler on the platform billing webhook and order figure readers.
52
+ - Loading the module registers scheduled plugin jobs: `abandoned-checkout-recovery`, `back-in-stock-alerts`, `stock-decrement-reconciliation` and `supplier-webhook-delivery`. This is why `package.json` lists `./src/lib/server.*` under `sideEffects`.
53
+
54
+ Routes are served by the host app's API dispatcher under `/api/`, for example `/api/commerce/catalog`.
55
+
56
+ ### Entry points
57
+
58
+ | import | contents |
59
+ | -- | -- |
60
+ | `@aglyn/plugins-commerce` | `BUNDLE_ID`, `registerCommerceConsole`, the site half, and the pure model: carts (`upsertCartLine`, `removeCartLine`, `cartCount`, `mergeCarts`), product CSV (`productsToCsv`, `parseProductsCsv`), and the order, discount, promotion, gift card, reservation, shipping, stock hold and tax modules |
61
+ | `@aglyn/plugins-commerce/site` | `registerCommercePlugin` and `COMMERCE_BUNDLE` only. This is what a published page loads, so it carries no console code |
62
+ | `@aglyn/plugins-commerce/server` | `registerCommerceApi`, `registerCommerceConsoleApi` |
63
+ | `@aglyn/plugins-commerce/*` | any module under `src/lib/`. Console components are deep-imported from `@aglyn/plugins-commerce/components/console/...` and are deliberately not re-exported from the root |
64
+
65
+ ## Usage
66
+
67
+ The registrars are normally called by Aglyn's generated plugin loaders. Called directly:
68
+
69
+ ```ts
70
+ // Published site (canvas half only)
71
+ import { registerCommercePlugin } from '@aglyn/plugins-commerce/site'
72
+ registerCommercePlugin()
73
+
74
+ // Console app
75
+ import { registerCommerceConsole } from '@aglyn/plugins-commerce'
76
+ registerCommerceConsole()
77
+
78
+ // Server-only API dispatcher
79
+ import {
80
+ registerCommerceApi,
81
+ registerCommerceConsoleApi,
82
+ } from '@aglyn/plugins-commerce/server'
83
+ registerCommerceApi()
84
+ ```
85
+
86
+ ## How it fits
87
+
88
+ A plugin may import the tenant runtime, the renderer, the Besigner logic, the core and the shared packages. It never imports another plugin, and the core never imports a plugin. Commerce depends on `@aglyn/aglyn`, `@aglyn/tenant-runtime`, `@aglyn/tenant-data-admin`, `@aglyn/tenant-feature-instance`, several `@aglyn/shared-*` packages, and the Stripe client libraries. What other plugins need from it goes through core seams: it registers the plugin tax profile that a paid booking is priced with, and the product card and order figure readers other plugins read by contract.
89
+
90
+ ## License
91
+
92
+ Apache-2.0. Source: https://github.com/aglyn/aglyn/tree/main/libs/plugins/commerce
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/plugins-commerce",
3
- "version": "1.0.0-beta.143",
3
+ "version": "1.0.0-beta.144",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,18 +25,18 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/aglyn": "1.0.0-beta.143",
29
- "@aglyn/shared-data-mdi": "1.0.0-beta.143",
30
- "@aglyn/shared-ui-jsx": "1.0.0-beta.143",
31
- "@aglyn/shared-ui-next": "1.0.0-beta.143",
32
- "@aglyn/shared-ui-snackstack": "1.0.0-beta.143",
33
- "@aglyn/shared-util-email": "1.0.0-beta.143",
34
- "@aglyn/shared-util-http": "1.0.0-beta.143",
35
- "@aglyn/shared-util-timestamp": "1.0.0-beta.143",
36
- "@aglyn/shared-util-tools": "1.0.0-beta.143",
37
- "@aglyn/tenant-data-admin": "1.0.0-beta.143",
38
- "@aglyn/tenant-feature-instance": "1.0.0-beta.143",
39
- "@aglyn/tenant-runtime": "1.0.0-beta.143",
28
+ "@aglyn/aglyn": "1.0.0-beta.144",
29
+ "@aglyn/shared-data-mdi": "1.0.0-beta.144",
30
+ "@aglyn/shared-ui-jsx": "1.0.0-beta.144",
31
+ "@aglyn/shared-ui-next": "1.0.0-beta.144",
32
+ "@aglyn/shared-ui-snackstack": "1.0.0-beta.144",
33
+ "@aglyn/shared-util-email": "1.0.0-beta.144",
34
+ "@aglyn/shared-util-http": "1.0.0-beta.144",
35
+ "@aglyn/shared-util-timestamp": "1.0.0-beta.144",
36
+ "@aglyn/shared-util-tools": "1.0.0-beta.144",
37
+ "@aglyn/tenant-data-admin": "1.0.0-beta.144",
38
+ "@aglyn/tenant-feature-instance": "1.0.0-beta.144",
39
+ "@aglyn/tenant-runtime": "1.0.0-beta.144",
40
40
  "@stripe/react-stripe-js": "^3.10.0",
41
41
  "@stripe/stripe-js": "^5.10.0",
42
42
  "@swc/helpers": "0.5.23",