@happyvertical/smrt-commerce 0.55.6 → 0.55.8
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/AGENTS.md +4 -0
- package/README.md +34 -0
- package/agents/customer-vendor-ui.md +31 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +642 -240
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +1473 -109
- package/dist/models/Contract.d.ts.map +1 -1
- package/dist/models/ContractLineItem.d.ts.map +1 -1
- package/dist/models/Customer.d.ts.map +1 -1
- package/dist/models/Fulfillment.d.ts.map +1 -1
- package/dist/models/FulfillmentLineItem.d.ts.map +1 -1
- package/dist/models/Invoice.d.ts.map +1 -1
- package/dist/models/InvoiceLineItem.d.ts.map +1 -1
- package/dist/models/Payment.d.ts.map +1 -1
- package/dist/models/PaymentAllocation.d.ts.map +1 -1
- package/dist/models/Vendor.d.ts.map +1 -1
- package/dist/playground.js +19 -0
- package/dist/playground.js.map +1 -1
- package/dist/recipes.d.ts +733 -19
- package/dist/recipes.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +1171 -123
- package/dist/svelte/components/CustomerSelect.svelte +53 -0
- package/dist/svelte/components/CustomerSelect.svelte.d.ts +47 -0
- package/dist/svelte/components/CustomerSelect.svelte.d.ts.map +1 -0
- package/dist/svelte/components/PartySelect.svelte +138 -0
- package/dist/svelte/components/PartySelect.svelte.d.ts +70 -0
- package/dist/svelte/components/PartySelect.svelte.d.ts.map +1 -0
- package/dist/svelte/components/VendorSelect.svelte +53 -0
- package/dist/svelte/components/VendorSelect.svelte.d.ts +47 -0
- package/dist/svelte/components/VendorSelect.svelte.d.ts.map +1 -0
- package/dist/svelte/i18n.d.ts +8 -0
- package/dist/svelte/i18n.d.ts.map +1 -1
- package/dist/svelte/i18n.js +8 -0
- package/dist/svelte/index.d.ts +6 -0
- package/dist/svelte/index.d.ts.map +1 -1
- package/dist/svelte/index.js +6 -0
- package/dist/svelte/playground/PartySelectPreview.svelte +108 -0
- package/dist/svelte/playground/PartySelectPreview.svelte.d.ts +8 -0
- package/dist/svelte/playground/PartySelectPreview.svelte.d.ts.map +1 -0
- package/dist/svelte/playground.d.ts.map +1 -1
- package/dist/svelte/playground.js +19 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +20 -0
- package/dist/ui.js.map +1 -1
- package/package.json +16 -12
package/AGENTS.md
CHANGED
|
@@ -176,6 +176,10 @@ for usage.
|
|
|
176
176
|
|
|
177
177
|
## Commercial UI
|
|
178
178
|
|
|
179
|
+
`CustomerSelect`/`VendorSelect` are the registered selectors for Customer and
|
|
180
|
+
Vendor (`selects` in `src/ui.ts`); models carry `ui.widget` hints. See
|
|
181
|
+
[customer/vendor UI](agents/customer-vendor-ui.md#selectors-3602).
|
|
182
|
+
|
|
179
183
|
See [commercial UI composition](agents/commercial-ui.md) for native form recovery, amount compatibility and backend ownership. Package-owned guides under `agents/` ship with the package.
|
|
180
184
|
|
|
181
185
|
## Quote and estimate UI
|
package/README.md
CHANGED
|
@@ -531,6 +531,40 @@ native forms, recovery, amount units and consumer adoption, plus the focused
|
|
|
531
531
|
[customer/vendor](agents/customer-vendor-ui.md) and
|
|
532
532
|
[quotation](agents/quote-ui.md) contracts for selector restrictions.
|
|
533
533
|
|
|
534
|
+
## Customer and vendor selectors
|
|
535
|
+
|
|
536
|
+
`CustomerSelect` and `VendorSelect` from `@happyvertical/smrt-commerce/svelte`
|
|
537
|
+
are searchable, field-sized pickers for a customer or vendor relation field.
|
|
538
|
+
They are registered in `COMMERCE_UI_SLOTS` with `selects:
|
|
539
|
+
'@happyvertical/smrt-commerce:Customer'` / `':Vendor'`, so generic forms (via
|
|
540
|
+
`findSelectorFor` over the manifest's `uiSelectors`) use them for any
|
|
541
|
+
`@foreignKey` or `@crossPackageRef` field targeting those models.
|
|
542
|
+
|
|
543
|
+
They are presentation only. The caller owns the data: `search(query)` returns
|
|
544
|
+
the existing party DTOs (`CustomerDisplayData` / `VendorDisplayData`, whose
|
|
545
|
+
`profile.name` is the label), and `resolve(id)` returns the record behind the
|
|
546
|
+
current value. Each row shows the profile name with status (and customer type).
|
|
547
|
+
The committed id, never the name, posts under `name`. Pass `onCreate` to offer a
|
|
548
|
+
"New customer" / "New vendor" action; it receives the searched text, and a
|
|
549
|
+
returned record is selected.
|
|
550
|
+
|
|
551
|
+
```svelte
|
|
552
|
+
<CustomerSelect
|
|
553
|
+
name="customerId"
|
|
554
|
+
bind:value={customerId}
|
|
555
|
+
search={(query) => customers.search(query)}
|
|
556
|
+
resolve={(id) => customers.byId(id)}
|
|
557
|
+
onCreate={(query) => openCustomerDialog(query)}
|
|
558
|
+
/>
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
The same models carry `@field({ ui: { widget } })` hints in the manifest:
|
|
562
|
+
`textarea` on `Contract` (and subclass) `terms` and `notes`, `Customer`/`Vendor`
|
|
563
|
+
`notes`, and `Invoice` notes and terms; `currency` (an ISO 4217 code picker) on
|
|
564
|
+
`Contract`, `Vendor`, `Invoice` and `Payment` `currency`; `email`/`phone` on
|
|
565
|
+
`Vendor.defaultContactEmail`/`defaultContactPhone`. See
|
|
566
|
+
[customer and vendor selectors](agents/customer-vendor-ui.md#selectors-3602).
|
|
567
|
+
|
|
534
568
|
## Invoice preparation UI
|
|
535
569
|
|
|
536
570
|
`InvoiceLineEditor` and `InvoiceEditor` from `@happyvertical/smrt-commerce/svelte`
|
|
@@ -91,3 +91,34 @@ hidden/visible duplicate name from changing native form serialization.
|
|
|
91
91
|
The registry keys are `customer-directory`, `customer-detail`, `customer-form`, `vendor-directory`, `vendor-detail`, `vendor-form`, and `party-contact-fields`. Interactive examples are published by `@happyvertical/smrt-commerce/playground` and ship in the next generated Commerce package release. DomaCraft can replace its local routes incrementally by adapting its existing server DTOs and payload names; no identity or database migration is required.
|
|
92
92
|
|
|
93
93
|
The form playground previews handle save, add-contact, and remove-contact intents in memory. They deliberately return a simulated validation error on save so retained values and retry behavior can be inspected without a backend.
|
|
94
|
+
|
|
95
|
+
## Selectors (#3602)
|
|
96
|
+
|
|
97
|
+
`CustomerSelect` and `VendorSelect` are field-sized pickers built on the shared
|
|
98
|
+
smrt-ui `RelationInput` (`@happyvertical/smrt-ui/forms`, ARIA 1.2 combobox),
|
|
99
|
+
through one internal `PartySelect` adapter that maps party DTOs to relation
|
|
100
|
+
options and localizes the field's text. Search, resolve, debounce, stale-result
|
|
101
|
+
and create handling live in `RelationInput`, not here.
|
|
102
|
+
|
|
103
|
+
| Prop | Meaning |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `name`, `value` (bindable), `label`, `required`, `disabled`, `error`, `placeholder`, `description` | Field basics. `label` defaults to the localized "Customer"/"Vendor"; `error` renders a linked `role="alert"`. |
|
|
106
|
+
| `search(query)` | Caller-owned lookup returning party DTOs; called with `''` when the list opens and, debounced (`debounceMs`, default 250), as the person types. |
|
|
107
|
+
| `resolve(id)` | Caller-owned lookup of the current value's DTO when it has not been listed; without it a value stays blank until searched. |
|
|
108
|
+
| `onCreate(query)` | Optional. Renders "+ New customer/vendor" (`createLabel` overrides); a returned DTO is selected. |
|
|
109
|
+
| `onchange(id)`, `interaction` | Change callback (`''` when cleared) and agent-interaction options. |
|
|
110
|
+
|
|
111
|
+
Rows show `profile.name` with localized status and, for customers, type
|
|
112
|
+
(`Active · Wholesale`). Data never enters the component: no stores, no fetches,
|
|
113
|
+
no tenant logic. A failed `search` shows an inline status, not an exception;
|
|
114
|
+
a failed `onCreate` leaves the field as it was. Text comes from the
|
|
115
|
+
`commerce.select.*` messages. The selectors are registered as the
|
|
116
|
+
`customer-select` and `vendor-select` slots, whose `selects` qualified names
|
|
117
|
+
are emitted into the manifest's `uiSelectors`; keep `selects` a string literal
|
|
118
|
+
so the scanner can read it.
|
|
119
|
+
|
|
120
|
+
Widget hints (`@field({ ui: { widget } })`, #3599) are presentation-only and
|
|
121
|
+
the build rejects them on non-text fields; `currency` is a currency-code
|
|
122
|
+
picker for ISO 4217 strings and is never applied to minor-unit amounts.
|
|
123
|
+
Behaviour tests run under jsdom: `pnpm exec vitest run --config
|
|
124
|
+
vitest.selects.config.ts` (also part of `pnpm test:ui`).
|
package/dist/index.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export { type InvoiceEditorStorageEngine, type InvoiceEditorStorageMigrationResu
|
|
|
67
67
|
export { COMMERCE_MONEY_COLUMNS, COMMERCE_MONEY_MINOR_UNITS_BACKFILL, COMMERCE_NATIVE_UNIT_COLUMNS, migrateCommerceMoneyToMinorUnits, preflightCommerceMoneyMinorUnits, } from './migrations/moneyMinorUnits.js';
|
|
68
68
|
export { Agreement, BillingAccount, type BillingCloseKind, BillingLineSource, type BillingLineSourceType, BillingPaymentAttempt, type BillingPaymentAttemptFlag, type BillingPaymentAttemptPurpose, type BillingPaymentAttemptTransition, BillingPeriodClose, type BillingPeriodCloseStatus, type BillingStanding, Cart, Contract, ContractLineItem, Customer, Estimate, Fulfillment, FulfillmentLineItem, Invoice, InvoiceLineItem, Lease, type LicenseRightsSnapshot, LicenseSale, Order, Payment, PaymentAllocation, PaymentInstrument, PaymentIntent, Payout, ProductionOrder, PurchaseOrder, Vendor, WholesaleOrder, } from './models/index.js';
|
|
69
69
|
export { assertIntegerMinorUnits } from './money.js';
|
|
70
|
-
export { CustomersRecipe, PurchasesRecipe, SalesRecipe, VendorsRecipe, } from './recipes.js';
|
|
70
|
+
export { AgreementsRecipe, CustomersRecipe, EstimatesRecipe, FulfillmentRecipe, InvoicingRecipe, LeasesRecipe, LicensesRecipe, PurchasesRecipe, SalesRecipe, VendorsRecipe, WholesaleRecipe, } from './recipes.js';
|
|
71
71
|
export { type Address, ContractStatus, ContractType, CustomerStatus, CustomerType, FulfillmentStatus, FulfillmentType, type InvoiceCollectionMethod, InvoiceStatus, PaymentInstrumentStatus, PaymentIntentStatus, PaymentMethod, type PaymentOption, PaymentStatus, PayoutStatus, type RecognizeRevenueOptions, type RecordPaymentOptions, VendorStatus, } from './types/index.js';
|
|
72
72
|
export { COMMERCE_MODULE_META, COMMERCE_UI_SLOTS } from './ui.js';
|
|
73
73
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAKH,OAAO,wBAAwB,CAAC;AAGhC,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,2BAA2B,EAChC,kBAAkB,EAClB,qBAAqB,EACrB,6BAA6B,EAC7B,iBAAiB,EACjB,yBAAyB,EACzB,KAAK,oBAAoB,EACzB,2BAA2B,EAC3B,iBAAiB,EACjB,2BAA2B,EAC3B,uBAAuB,EACvB,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,mCAAmC,EACxC,KAAK,6BAA6B,EAClC,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EACL,sBAAsB,EACtB,mCAAmC,EACnC,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,GACjC,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,SAAS,EACT,cAAc,EACd,KAAK,gBAAgB,EACrB,iBAAiB,EACjB,KAAK,qBAAqB,EAC1B,qBAAqB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACpC,kBAAkB,EAClB,KAAK,wBAAwB,EAC7B,KAAK,eAAe,EACpB,IAAI,EACJ,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,WAAW,EACX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