@happyvertical/smrt-commerce 0.53.4 → 0.53.5
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 +19 -3
- package/README.md +29 -1
- package/agents/commercial-ui.md +78 -0
- package/agents/customer-vendor-ui.md +76 -0
- package/agents/invoice-calculations.md +17 -0
- package/agents/invoice-preparation.md +86 -0
- package/agents/invoice-quantity.md +46 -0
- package/agents/pricing-versions.md +28 -0
- package/agents/purchasing-ui.md +82 -0
- package/agents/quote-ui.md +82 -0
- package/dist/billing/units.d.ts +1 -7
- package/dist/billing/units.d.ts.map +1 -1
- package/dist/chunks/calculations-DPuldr1J.js +242 -0
- package/dist/chunks/calculations-DPuldr1J.js.map +1 -0
- package/dist/chunks/types-CRnln577.js.map +1 -1
- package/dist/chunks/{units-CpBepqG1.js → units-CJcAOQm1.js} +3 -39
- package/dist/chunks/units-CJcAOQm1.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +164 -44
- package/dist/index.js.map +1 -1
- package/dist/invoices.d.ts +3 -0
- package/dist/invoices.d.ts.map +1 -0
- package/dist/invoices.js +2 -0
- package/dist/manifest.json +66 -8
- package/dist/migrations/invoiceEditorStorage.d.ts +39 -0
- package/dist/migrations/invoiceEditorStorage.d.ts.map +1 -0
- package/dist/models/ContractLineItem.d.ts +1 -1
- package/dist/models/InvoiceLineItem.d.ts +18 -36
- package/dist/models/InvoiceLineItem.d.ts.map +1 -1
- package/dist/playground.js +201 -3
- package/dist/playground.js.map +1 -1
- package/dist/smrt-knowledge.json +109 -7
- package/dist/svelte/components/CustomerDetail.svelte +150 -0
- package/dist/svelte/components/CustomerDetail.svelte.d.ts +28 -0
- package/dist/svelte/components/CustomerDetail.svelte.d.ts.map +1 -0
- package/dist/svelte/components/CustomerDirectory.svelte +177 -0
- package/dist/svelte/components/CustomerDirectory.svelte.d.ts +42 -0
- package/dist/svelte/components/CustomerDirectory.svelte.d.ts.map +1 -0
- package/dist/svelte/components/CustomerForm.svelte +234 -0
- package/dist/svelte/components/CustomerForm.svelte.d.ts +44 -0
- package/dist/svelte/components/CustomerForm.svelte.d.ts.map +1 -0
- package/dist/svelte/components/InvoiceAllocationFields.svelte +72 -0
- package/dist/svelte/components/InvoiceAllocationFields.svelte.d.ts +8 -0
- package/dist/svelte/components/InvoiceAllocationFields.svelte.d.ts.map +1 -0
- package/dist/svelte/components/InvoiceCard.svelte +2 -2
- package/dist/svelte/components/InvoiceEditor.svelte +134 -0
- package/dist/svelte/components/InvoiceEditor.svelte.d.ts +8 -0
- package/dist/svelte/components/InvoiceEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/InvoiceLineEditor.svelte +85 -0
- package/dist/svelte/components/InvoiceLineEditor.svelte.d.ts +8 -0
- package/dist/svelte/components/InvoiceLineEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/InvoiceReview.svelte +23 -0
- package/dist/svelte/components/InvoiceReview.svelte.d.ts +10 -0
- package/dist/svelte/components/InvoiceReview.svelte.d.ts.map +1 -0
- package/dist/svelte/components/PartyAddressFields.svelte +95 -0
- package/dist/svelte/components/PartyAddressFields.svelte.d.ts +25 -0
- package/dist/svelte/components/PartyAddressFields.svelte.d.ts.map +1 -0
- package/dist/svelte/components/PartyContactFields.svelte +153 -0
- package/dist/svelte/components/PartyContactFields.svelte.d.ts +28 -0
- package/dist/svelte/components/PartyContactFields.svelte.d.ts.map +1 -0
- package/dist/svelte/components/PricingVersionDecision.svelte +88 -0
- package/dist/svelte/components/PricingVersionDecision.svelte.d.ts +35 -0
- package/dist/svelte/components/PricingVersionDecision.svelte.d.ts.map +1 -0
- package/dist/svelte/components/PricingVersionSummary.svelte +46 -0
- package/dist/svelte/components/PricingVersionSummary.svelte.d.ts +9 -0
- package/dist/svelte/components/PricingVersionSummary.svelte.d.ts.map +1 -0
- package/dist/svelte/components/PurchaseOrderEditor.svelte +210 -0
- package/dist/svelte/components/PurchaseOrderEditor.svelte.d.ts +79 -0
- package/dist/svelte/components/PurchaseOrderEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/PurchaseSourceSelector.svelte +56 -0
- package/dist/svelte/components/PurchaseSourceSelector.svelte.d.ts +30 -0
- package/dist/svelte/components/PurchaseSourceSelector.svelte.d.ts.map +1 -0
- package/dist/svelte/components/PurchasingPlayground.svelte +133 -0
- package/dist/svelte/components/PurchasingPlayground.svelte.d.ts +9 -0
- package/dist/svelte/components/PurchasingPlayground.svelte.d.ts.map +1 -0
- package/dist/svelte/components/QuoteEditor.svelte +177 -0
- package/dist/svelte/components/QuoteEditor.svelte.d.ts +76 -0
- package/dist/svelte/components/QuoteEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/QuotePlayground.svelte +108 -0
- package/dist/svelte/components/QuotePlayground.svelte.d.ts +10 -0
- package/dist/svelte/components/QuotePlayground.svelte.d.ts.map +1 -0
- package/dist/svelte/components/QuoteRevisionComparison.svelte +44 -0
- package/dist/svelte/components/QuoteRevisionComparison.svelte.d.ts +14 -0
- package/dist/svelte/components/QuoteRevisionComparison.svelte.d.ts.map +1 -0
- package/dist/svelte/components/QuoteRevisionHistory.svelte +55 -0
- package/dist/svelte/components/QuoteRevisionHistory.svelte.d.ts +15 -0
- package/dist/svelte/components/QuoteRevisionHistory.svelte.d.ts.map +1 -0
- package/dist/svelte/components/VendorDetail.svelte +134 -0
- package/dist/svelte/components/VendorDetail.svelte.d.ts +26 -0
- package/dist/svelte/components/VendorDetail.svelte.d.ts.map +1 -0
- package/dist/svelte/components/VendorDirectory.svelte +178 -0
- package/dist/svelte/components/VendorDirectory.svelte.d.ts +42 -0
- package/dist/svelte/components/VendorDirectory.svelte.d.ts.map +1 -0
- package/dist/svelte/components/VendorForm.svelte +224 -0
- package/dist/svelte/components/VendorForm.svelte.d.ts +42 -0
- package/dist/svelte/components/VendorForm.svelte.d.ts.map +1 -0
- package/dist/svelte/i18n.d.ts +102 -0
- package/dist/svelte/i18n.d.ts.map +1 -1
- package/dist/svelte/i18n.js +102 -0
- package/dist/svelte/index.d.ts +52 -0
- package/dist/svelte/index.d.ts.map +1 -1
- package/dist/svelte/index.js +49 -0
- package/dist/svelte/invoices/calculations.d.ts +121 -0
- package/dist/svelte/invoices/calculations.d.ts.map +1 -0
- package/dist/svelte/invoices/calculations.js +259 -0
- package/dist/svelte/invoices/currency.d.ts +9 -0
- package/dist/svelte/invoices/currency.d.ts.map +1 -0
- package/dist/svelte/invoices/currency.js +55 -0
- package/dist/svelte/invoices/fields.d.ts +6 -0
- package/dist/svelte/invoices/fields.d.ts.map +1 -0
- package/dist/svelte/invoices/fields.js +22 -0
- package/dist/svelte/invoices/messages.d.ts +53 -0
- package/dist/svelte/invoices/messages.d.ts.map +1 -0
- package/dist/svelte/invoices/messages.js +53 -0
- package/dist/svelte/invoices/types.d.ts +194 -0
- package/dist/svelte/invoices/types.d.ts.map +1 -0
- package/dist/svelte/invoices/types.js +1 -0
- package/dist/svelte/party-types.d.ts +203 -0
- package/dist/svelte/party-types.d.ts.map +1 -0
- package/dist/svelte/party-types.js +82 -0
- package/dist/svelte/playground/InvoicePreparationPreview.svelte +116 -0
- package/dist/svelte/playground/InvoicePreparationPreview.svelte.d.ts +4 -0
- package/dist/svelte/playground/InvoicePreparationPreview.svelte.d.ts.map +1 -0
- package/dist/svelte/playground/PartyFormPreview.svelte +211 -0
- package/dist/svelte/playground/PartyFormPreview.svelte.d.ts +8 -0
- package/dist/svelte/playground/PartyFormPreview.svelte.d.ts.map +1 -0
- package/dist/svelte/playground/PricingVersionPreview.svelte +55 -0
- package/dist/svelte/playground/PricingVersionPreview.svelte.d.ts +4 -0
- package/dist/svelte/playground/PricingVersionPreview.svelte.d.ts.map +1 -0
- package/dist/svelte/playground.d.ts +442 -3
- package/dist/svelte/playground.d.ts.map +1 -1
- package/dist/svelte/playground.js +199 -3
- package/dist/svelte/pricing-i18n.d.ts +10 -0
- package/dist/svelte/pricing-i18n.d.ts.map +1 -0
- package/dist/svelte/pricing-i18n.js +10 -0
- package/dist/svelte/pricing-types.d.ts +38 -0
- package/dist/svelte/pricing-types.d.ts.map +1 -0
- package/dist/svelte/pricing-types.js +1 -0
- package/dist/svelte/purchasing-i18n.d.ts +53 -0
- package/dist/svelte/purchasing-i18n.d.ts.map +1 -0
- package/dist/svelte/purchasing-i18n.js +53 -0
- package/dist/svelte/purchasing-types.d.ts +91 -0
- package/dist/svelte/purchasing-types.d.ts.map +1 -0
- package/dist/svelte/purchasing-types.js +13 -0
- package/dist/svelte/quote-i18n.d.ts +49 -0
- package/dist/svelte/quote-i18n.d.ts.map +1 -0
- package/dist/svelte/quote-i18n.js +49 -0
- package/dist/svelte/quote-types.d.ts +81 -0
- package/dist/svelte/quote-types.d.ts.map +1 -0
- package/dist/svelte/quote-types.js +51 -0
- package/dist/types/index.d.ts +13 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +150 -6
- package/dist/ui.js.map +1 -1
- package/package.json +25 -13
- package/dist/chunks/units-CpBepqG1.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoices.d.ts","sourceRoot":"","sources":["../src/invoices.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,cAAc,mCAAmC,CAAC"}
|
package/dist/invoices.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { i as resolveInvoiceLineDraft, n as calculateInvoiceLine, r as calculateInvoiceMinorLine, t as calculateInvoiceDraft } from "./chunks/calculations-DPuldr1J.js";
|
|
2
|
+
export { calculateInvoiceDraft, calculateInvoiceLine, calculateInvoiceMinorLine, resolveInvoiceLineDraft };
|
package/dist/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": "1.0.0",
|
|
3
3
|
"timestamp": 0,
|
|
4
4
|
"packageName": "@happyvertical/smrt-commerce",
|
|
5
|
-
"packageVersion": "0.53.
|
|
5
|
+
"packageVersion": "0.53.5",
|
|
6
6
|
"objects": {
|
|
7
7
|
"@happyvertical/smrt-commerce:ContractCollection": {
|
|
8
8
|
"name": "contractcollection",
|
|
@@ -1915,7 +1915,7 @@
|
|
|
1915
1915
|
"collectionExportName": "InvoiceLineItemCollectionCollection",
|
|
1916
1916
|
"schema": {
|
|
1917
1917
|
"tableName": "invoice_line_items",
|
|
1918
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"invoice_line_items\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"invoice_id\" UUID,\n \"description\" TEXT DEFAULT '',\n \"sku\" TEXT DEFAULT '',\n \"quantity\"
|
|
1918
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"invoice_line_items\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"invoice_id\" UUID,\n \"description\" TEXT DEFAULT '',\n \"sku\" TEXT DEFAULT '',\n \"quantity\" REAL DEFAULT 1,\n \"invoice_editor_state_json\" TEXT DEFAULT '',\n \"unit_price\" INTEGER DEFAULT 0,\n \"discount\" INTEGER DEFAULT 0,\n \"tax_rate\" REAL DEFAULT 0,\n \"amount\" INTEGER DEFAULT 0,\n \"source_type\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"period_start\" TIMESTAMP,\n \"period_end\" TIMESTAMP,\n \"revenue_account_id\" UUID,\n \"sort_order\" INTEGER DEFAULT 0\n);",
|
|
1919
1919
|
"columns": {
|
|
1920
1920
|
"id": {
|
|
1921
1921
|
"type": "UUID",
|
|
@@ -1973,11 +1973,17 @@
|
|
|
1973
1973
|
"default": ""
|
|
1974
1974
|
},
|
|
1975
1975
|
"quantity": {
|
|
1976
|
-
"type": "
|
|
1976
|
+
"type": "REAL",
|
|
1977
1977
|
"notNull": false,
|
|
1978
1978
|
"unique": false,
|
|
1979
1979
|
"default": 1
|
|
1980
1980
|
},
|
|
1981
|
+
"invoice_editor_state_json": {
|
|
1982
|
+
"type": "TEXT",
|
|
1983
|
+
"notNull": false,
|
|
1984
|
+
"unique": false,
|
|
1985
|
+
"default": ""
|
|
1986
|
+
},
|
|
1981
1987
|
"unit_price": {
|
|
1982
1988
|
"type": "INTEGER",
|
|
1983
1989
|
"notNull": false,
|
|
@@ -2068,7 +2074,7 @@
|
|
|
2068
2074
|
]
|
|
2069
2075
|
}
|
|
2070
2076
|
],
|
|
2071
|
-
"version": "
|
|
2077
|
+
"version": "6d388b43"
|
|
2072
2078
|
},
|
|
2073
2079
|
"importPath": "@happyvertical/smrt-commerce"
|
|
2074
2080
|
},
|
|
@@ -9231,10 +9237,15 @@
|
|
|
9231
9237
|
"default": ""
|
|
9232
9238
|
},
|
|
9233
9239
|
"quantity": {
|
|
9234
|
-
"type": "
|
|
9240
|
+
"type": "decimal",
|
|
9235
9241
|
"required": false,
|
|
9236
9242
|
"default": 1
|
|
9237
9243
|
},
|
|
9244
|
+
"invoiceEditorStateJson": {
|
|
9245
|
+
"type": "text",
|
|
9246
|
+
"required": false,
|
|
9247
|
+
"default": ""
|
|
9248
|
+
},
|
|
9238
9249
|
"unitPrice": {
|
|
9239
9250
|
"type": "integer",
|
|
9240
9251
|
"required": false,
|
|
@@ -9309,6 +9320,47 @@
|
|
|
9309
9320
|
"isStatic": false,
|
|
9310
9321
|
"isPublic": true
|
|
9311
9322
|
},
|
|
9323
|
+
"applyEditorDraft": {
|
|
9324
|
+
"name": "applyEditorDraft",
|
|
9325
|
+
"async": false,
|
|
9326
|
+
"parameters": [
|
|
9327
|
+
{
|
|
9328
|
+
"name": "draft",
|
|
9329
|
+
"type": "InvoiceLineDraft",
|
|
9330
|
+
"optional": false
|
|
9331
|
+
},
|
|
9332
|
+
{
|
|
9333
|
+
"name": "context",
|
|
9334
|
+
"type": "InvoiceCalculationContext",
|
|
9335
|
+
"optional": false
|
|
9336
|
+
}
|
|
9337
|
+
],
|
|
9338
|
+
"returnType": "void",
|
|
9339
|
+
"isStatic": false,
|
|
9340
|
+
"isPublic": true
|
|
9341
|
+
},
|
|
9342
|
+
"getEditorDraft": {
|
|
9343
|
+
"name": "getEditorDraft",
|
|
9344
|
+
"async": false,
|
|
9345
|
+
"parameters": [
|
|
9346
|
+
{
|
|
9347
|
+
"name": "authorizedContext",
|
|
9348
|
+
"type": "InvoiceCalculationContext",
|
|
9349
|
+
"optional": false
|
|
9350
|
+
}
|
|
9351
|
+
],
|
|
9352
|
+
"returnType": "InvoiceLineDraft | null",
|
|
9353
|
+
"isStatic": false,
|
|
9354
|
+
"isPublic": true
|
|
9355
|
+
},
|
|
9356
|
+
"save": {
|
|
9357
|
+
"name": "save",
|
|
9358
|
+
"async": true,
|
|
9359
|
+
"parameters": [],
|
|
9360
|
+
"returnType": "Promise<this>",
|
|
9361
|
+
"isStatic": false,
|
|
9362
|
+
"isPublic": true
|
|
9363
|
+
},
|
|
9312
9364
|
"hasSource": {
|
|
9313
9365
|
"name": "hasSource",
|
|
9314
9366
|
"async": false,
|
|
@@ -9373,7 +9425,7 @@
|
|
|
9373
9425
|
"collectionExportName": "InvoiceLineItemCollection",
|
|
9374
9426
|
"schema": {
|
|
9375
9427
|
"tableName": "invoice_line_items",
|
|
9376
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"invoice_line_items\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"invoice_id\" UUID,\n \"description\" TEXT DEFAULT '',\n \"sku\" TEXT DEFAULT '',\n \"quantity\"
|
|
9428
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"invoice_line_items\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"invoice_id\" UUID,\n \"description\" TEXT DEFAULT '',\n \"sku\" TEXT DEFAULT '',\n \"quantity\" REAL DEFAULT 1,\n \"invoice_editor_state_json\" TEXT DEFAULT '',\n \"unit_price\" INTEGER DEFAULT 0,\n \"discount\" INTEGER DEFAULT 0,\n \"tax_rate\" REAL DEFAULT 0,\n \"amount\" INTEGER DEFAULT 0,\n \"source_type\" TEXT DEFAULT '',\n \"source_id\" TEXT DEFAULT '',\n \"period_start\" TIMESTAMP,\n \"period_end\" TIMESTAMP,\n \"revenue_account_id\" UUID,\n \"sort_order\" INTEGER DEFAULT 0\n);",
|
|
9377
9429
|
"columns": {
|
|
9378
9430
|
"id": {
|
|
9379
9431
|
"type": "UUID",
|
|
@@ -9431,11 +9483,17 @@
|
|
|
9431
9483
|
"default": ""
|
|
9432
9484
|
},
|
|
9433
9485
|
"quantity": {
|
|
9434
|
-
"type": "
|
|
9486
|
+
"type": "REAL",
|
|
9435
9487
|
"notNull": false,
|
|
9436
9488
|
"unique": false,
|
|
9437
9489
|
"default": 1
|
|
9438
9490
|
},
|
|
9491
|
+
"invoice_editor_state_json": {
|
|
9492
|
+
"type": "TEXT",
|
|
9493
|
+
"notNull": false,
|
|
9494
|
+
"unique": false,
|
|
9495
|
+
"default": ""
|
|
9496
|
+
},
|
|
9439
9497
|
"unit_price": {
|
|
9440
9498
|
"type": "INTEGER",
|
|
9441
9499
|
"notNull": false,
|
|
@@ -9526,7 +9584,7 @@
|
|
|
9526
9584
|
]
|
|
9527
9585
|
}
|
|
9528
9586
|
],
|
|
9529
|
-
"version": "
|
|
9587
|
+
"version": "6d388b43"
|
|
9530
9588
|
},
|
|
9531
9589
|
"importPath": "@happyvertical/smrt-commerce"
|
|
9532
9590
|
},
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Explicit invoice quantity widening and additive editor-state storage migration. */
|
|
2
|
+
import { type DatabaseInterface } from '@happyvertical/smrt-core/migrations';
|
|
3
|
+
/** Supported SQL engines; explicit selection avoids guessing from connection URLs. */
|
|
4
|
+
export type InvoiceEditorStorageEngine = 'sqlite' | 'postgres' | 'duckdb';
|
|
5
|
+
/** Read-only quantity migration findings. */
|
|
6
|
+
export interface InvoiceEditorStoragePreflight {
|
|
7
|
+
/** Requested engine. */
|
|
8
|
+
engine: InvoiceEditorStorageEngine;
|
|
9
|
+
/** Existing column type, or null when absent. */
|
|
10
|
+
declaredType: string | null;
|
|
11
|
+
/** All existing quantities satisfy numeric persistence and precision constraints. */
|
|
12
|
+
ok: boolean;
|
|
13
|
+
/** Whether the dedicated TEXT editor-state column already exists. */
|
|
14
|
+
editorStateColumnPresent: boolean;
|
|
15
|
+
/** Rows examined. */
|
|
16
|
+
inspectedRows: number;
|
|
17
|
+
/** Invalid row identifiers; no data is modified while findings remain. */
|
|
18
|
+
invalidRowIds: string[];
|
|
19
|
+
}
|
|
20
|
+
/** Completed quantity migration report. */
|
|
21
|
+
export interface InvoiceEditorStorageMigrationResult {
|
|
22
|
+
/** Preflight used to guard this migration. */
|
|
23
|
+
preflight: InvoiceEditorStoragePreflight;
|
|
24
|
+
/** True if quantity was widened or the editor-state column was added. */
|
|
25
|
+
changed: boolean;
|
|
26
|
+
}
|
|
27
|
+
type QueryExecutor = Pick<DatabaseInterface, 'query'>;
|
|
28
|
+
/** Inspect every existing quantity without rounding, rescaling, or modifying it. */
|
|
29
|
+
export declare function preflightInvoiceEditorStorage(db: QueryExecutor, engine: InvoiceEditorStorageEngine): Promise<InvoiceEditorStoragePreflight>;
|
|
30
|
+
/**
|
|
31
|
+
* Widen existing integer quantity columns without rescaling any values.
|
|
32
|
+
* Run during a writer maintenance window using a root transaction-capable handle.
|
|
33
|
+
* PostgreSQL locks writers while checking and altering; DuckDB detects conflicting transactions.
|
|
34
|
+
* SQLite uses the core live-DDL rebuild planner and refuses unsafe incoming-FK rebuilds.
|
|
35
|
+
* Repeating the migration is harmless and never marks an absent table as migrated.
|
|
36
|
+
*/
|
|
37
|
+
export declare function migrateInvoiceEditorStorage(db: DatabaseInterface, engine: InvoiceEditorStorageEngine): Promise<InvoiceEditorStorageMigrationResult>;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=invoiceEditorStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoiceEditorStorage.d.ts","sourceRoot":"","sources":["../../src/migrations/invoiceEditorStorage.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,OAAO,EACL,KAAK,iBAAiB,EAGvB,MAAM,qCAAqC,CAAC;AAG7C,sFAAsF;AACtF,MAAM,MAAM,0BAA0B,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC;AAC1E,6CAA6C;AAC7C,MAAM,WAAW,6BAA6B;IAC5C,wBAAwB;IACxB,MAAM,EAAE,0BAA0B,CAAC;IACnC,iDAAiD;IACjD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,qFAAqF;IACrF,EAAE,EAAE,OAAO,CAAC;IACZ,qEAAqE;IACrE,wBAAwB,EAAE,OAAO,CAAC;IAClC,qBAAqB;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,0EAA0E;IAC1E,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AACD,2CAA2C;AAC3C,MAAM,WAAW,mCAAmC;IAClD,8CAA8C;IAC9C,SAAS,EAAE,6BAA6B,CAAC;IACzC,yEAAyE;IACzE,OAAO,EAAE,OAAO,CAAC;CAClB;AACD,KAAK,aAAa,GAAG,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAmCtD,oFAAoF;AACpF,wBAAsB,6BAA6B,CACjD,EAAE,EAAE,aAAa,EACjB,MAAM,EAAE,0BAA0B,GACjC,OAAO,CAAC,6BAA6B,CAAC,CAkDxC;AAED;;;;;;GAMG;AACH,wBAAsB,2BAA2B,CAC/C,EAAE,EAAE,iBAAiB,EACrB,MAAM,EAAE,0BAA0B,GACjC,OAAO,CAAC,mCAAmC,CAAC,CAqE9C"}
|
|
@@ -37,7 +37,7 @@ export declare class ContractLineItem extends SmrtObject {
|
|
|
37
37
|
description: string;
|
|
38
38
|
/**
|
|
39
39
|
* Quantity ordered. Decimal on purpose — contracts price fractional
|
|
40
|
-
* quantities (hours, weight, bandwidth),
|
|
40
|
+
* quantities (hours, weight, bandwidth), as do invoice line items.
|
|
41
41
|
*/
|
|
42
42
|
quantity: number;
|
|
43
43
|
/**
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
5
|
import { SmrtObject } from '@happyvertical/smrt-core';
|
|
6
|
-
import type
|
|
6
|
+
import { type InvoiceCalculationContext, type InvoiceLineDraft } from '../svelte/invoices/calculations.js';
|
|
7
|
+
import type { AccountingLineItemInput, InvoiceLineEditorState, InvoiceLineItemOptions } from '../types/index.js';
|
|
7
8
|
/**
|
|
8
9
|
* InvoiceLineItem represents a single line item on an invoice.
|
|
9
10
|
*
|
|
@@ -43,16 +44,14 @@ export declare class InvoiceLineItem extends SmrtObject {
|
|
|
43
44
|
* SKU or item code
|
|
44
45
|
*/
|
|
45
46
|
sku: string;
|
|
46
|
-
/**
|
|
47
|
-
* Quantity (e.g., impressions, hours, units).
|
|
48
|
-
*
|
|
49
|
-
* Left INTEGER: this package's own example is `quantity: 50000` impressions,
|
|
50
|
-
* and nothing in it writes a fractional quantity, so whether fractional
|
|
51
|
-
* quantities are intended here is unresolved. `ContractLineItem.quantity` is
|
|
52
|
-
* decimal, which is the inconsistency to settle deliberately rather than by
|
|
53
|
-
* changing a column type in passing (#2361).
|
|
54
|
-
*/
|
|
47
|
+
/** Nonnegative decimal quantity (hours, weight, units), up to six fractional digits. */
|
|
55
48
|
quantity: number;
|
|
49
|
+
/** Raw editor modes retained only while they resolve to the authoritative model fields. */
|
|
50
|
+
invoiceEditorStateJson: string;
|
|
51
|
+
/** Guarded editor metadata view; malformed stored JSON is treated as absent. */
|
|
52
|
+
get invoiceEditorState(): InvoiceLineEditorState | null;
|
|
53
|
+
/** Store only this model's editor state, preserving unrelated metadata. */
|
|
54
|
+
set invoiceEditorState(value: InvoiceLineEditorState | null);
|
|
56
55
|
/**
|
|
57
56
|
* Unit price before discount, in **integer minor units** (cents, satoshis).
|
|
58
57
|
*
|
|
@@ -103,35 +102,18 @@ export declare class InvoiceLineItem extends SmrtObject {
|
|
|
103
102
|
*/
|
|
104
103
|
sortOrder: number;
|
|
105
104
|
constructor(options?: InvoiceLineItemOptions);
|
|
106
|
-
/**
|
|
107
|
-
* Calculate the line amount, in integer minor units.
|
|
108
|
-
*
|
|
109
|
-
* Formula: `getSubtotal() + getTaxAmount()`, i.e.
|
|
110
|
-
* `(quantity * unitPrice - discount) * (1 + taxRate)` with the tax rounded.
|
|
111
|
-
*
|
|
112
|
-
* Tax is calculated on the discounted subtotal. This follows the common
|
|
113
|
-
* "discount before tax" approach used in most North American jurisdictions.
|
|
114
|
-
* For jurisdictions requiring different tax calculation methods, override
|
|
115
|
-
* this method or calculate amounts externally.
|
|
116
|
-
*/
|
|
105
|
+
/** Calculate exact safe integer-minor totals, rounding gross and tax ties toward positive infinity. */
|
|
117
106
|
calculateAmount(): number;
|
|
118
|
-
/**
|
|
119
|
-
* Get subtotal (before tax), in integer minor units.
|
|
120
|
-
*
|
|
121
|
-
* `quantity` is an integer and `unitPrice` / `discount` are integer minor
|
|
122
|
-
* units, so this is exact with no rounding.
|
|
123
|
-
*/
|
|
107
|
+
/** Rounded quantity times price, less the resolved flat minor-unit discount. */
|
|
124
108
|
getSubtotal(): number;
|
|
125
|
-
/**
|
|
126
|
-
* Get tax amount, in integer minor units.
|
|
127
|
-
*
|
|
128
|
-
* `taxRate` is a genuine fraction, so this product is where a rate meets
|
|
129
|
-
* money and the only place rounding is needed. Rounding here — rather than
|
|
130
|
-
* letting a fractional tax leak into `Invoice.taxAmount` — is what lets the
|
|
131
|
-
* invoice's guards compare integers exactly instead of tolerating an epsilon
|
|
132
|
-
* (#2401).
|
|
133
|
-
*/
|
|
109
|
+
/** Tax on the rounded discounted subtotal, in safe integer minor units. */
|
|
134
110
|
getTaxAmount(): number;
|
|
111
|
+
/** Apply a server-validated draft without saving; authorization and transaction stay caller-owned. */
|
|
112
|
+
applyEditorDraft(draft: InvoiceLineDraft, context: InvoiceCalculationContext): void;
|
|
113
|
+
/** Recover original editing modes only when current authority and resolved model fields agree. */
|
|
114
|
+
getEditorDraft(authorizedContext: InvoiceCalculationContext): InvoiceLineDraft | null;
|
|
115
|
+
/** Validate resolved fields and recompute amount before persistence; editor metadata never determines money. */
|
|
116
|
+
save(): Promise<this>;
|
|
135
117
|
/**
|
|
136
118
|
* Check if line item has source tracking
|
|
137
119
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvoiceLineItem.d.ts","sourceRoot":"","sources":["../../src/models/InvoiceLineItem.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGL,UAAU,EAEX,MAAM,0BAA0B,CAAC;AAGlC,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAMa,eAAgB,SAAQ,UAAU;IAC7C;;;OAGG;IAEH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE/B;;OAEG;IAEH,SAAS,EAAE,MAAM,CAAM;IAEvB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAM;IA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AAS,EAAE,IAAI,GAAG,IAAI,CAAQ;IAM9B;;;OAGG;IAEH,gBAAgB,EAAE,MAAM,CAAM;IAE9B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAK;gBAEV,OAAO,GAAE,sBAA2B;IA0BhD,uGAAuG;IACvG,eAAe,IAAI,MAAM;IAIzB,gFAAgF;IAChF,WAAW,IAAI,MAAM;IAIrB,2EAA2E;IAC3E,YAAY,IAAI,MAAM;IAItB,sGAAsG;IACtG,gBAAgB,CACd,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,yBAAyB,GACjC,IAAI;IAMP,kGAAkG;IAClG,cAAc,CACZ,iBAAiB,EAAE,yBAAyB,GAC3C,gBAAgB,GAAG,IAAI;IA0B1B,gHAAgH;IACjG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAWpC;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;;;;;OAMG;IACH,oBAAoB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,uBAAuB;CAejE;AAED,eAAe,eAAe,CAAC"}
|
package/dist/playground.js
CHANGED
|
@@ -38,21 +38,219 @@ var sampleUnbilledItems = [
|
|
|
38
38
|
category: "QA"
|
|
39
39
|
}
|
|
40
40
|
];
|
|
41
|
+
var sampleCustomer = {
|
|
42
|
+
id: "customer-riverstone",
|
|
43
|
+
profileId: "profile-riverstone",
|
|
44
|
+
profile: {
|
|
45
|
+
id: "profile-riverstone",
|
|
46
|
+
name: "Riverstone Newsroom",
|
|
47
|
+
email: "accounts@riverstone.example",
|
|
48
|
+
description: "Independent newsroom and publishing customer.",
|
|
49
|
+
identityKind: "business"
|
|
50
|
+
},
|
|
51
|
+
status: "active",
|
|
52
|
+
customerType: "wholesale",
|
|
53
|
+
creditLimitMinor: 25e4,
|
|
54
|
+
paymentTerms: "Net 30",
|
|
55
|
+
taxExempt: false,
|
|
56
|
+
defaultShippingAddress: {
|
|
57
|
+
street1: "88 River Avenue",
|
|
58
|
+
city: "Edmonton",
|
|
59
|
+
state: "AB",
|
|
60
|
+
postalCode: "T5J 0K1",
|
|
61
|
+
country: "Canada"
|
|
62
|
+
},
|
|
63
|
+
contacts: [{
|
|
64
|
+
id: "contact-avery",
|
|
65
|
+
name: "Avery Chen",
|
|
66
|
+
label: "Accounts payable",
|
|
67
|
+
email: "avery@riverstone.example",
|
|
68
|
+
phone: "+1 780 555 0142"
|
|
69
|
+
}]
|
|
70
|
+
};
|
|
71
|
+
var sampleVendor = {
|
|
72
|
+
id: "vendor-northstar",
|
|
73
|
+
profileId: "profile-northstar",
|
|
74
|
+
profile: {
|
|
75
|
+
id: "profile-northstar",
|
|
76
|
+
name: "Northstar Supply",
|
|
77
|
+
email: "orders@northstar.example",
|
|
78
|
+
description: "Regional materials and equipment supplier.",
|
|
79
|
+
identityKind: "business"
|
|
80
|
+
},
|
|
81
|
+
status: "active",
|
|
82
|
+
leadTimeDays: 7,
|
|
83
|
+
minimumOrderMinor: 5e4,
|
|
84
|
+
paymentTerms: "Net 45",
|
|
85
|
+
currency: "CAD",
|
|
86
|
+
defaultContactEmail: "orders@northstar.example",
|
|
87
|
+
defaultContactPhone: "+1 403 555 0188",
|
|
88
|
+
contacts: [{
|
|
89
|
+
id: "contact-morgan",
|
|
90
|
+
name: "Morgan Lee",
|
|
91
|
+
label: "Order desk",
|
|
92
|
+
email: "morgan@northstar.example",
|
|
93
|
+
phone: "+1 403 555 0117"
|
|
94
|
+
}]
|
|
95
|
+
};
|
|
96
|
+
var loadCustomerDirectory = () => import("./svelte/components/CustomerDirectory.svelte");
|
|
97
|
+
var loadCustomerDetail = () => import("./svelte/components/CustomerDetail.svelte");
|
|
98
|
+
var loadPartyFormPreview = () => import("./svelte/playground/PartyFormPreview.svelte");
|
|
41
99
|
var loadInvoiceActions = () => import("./svelte/components/InvoiceActions.svelte");
|
|
42
100
|
var loadInvoiceCard = () => import("./svelte/components/InvoiceCard.svelte");
|
|
43
101
|
var loadUnbilledItems = () => import("./svelte/components/UnbilledItems.svelte");
|
|
102
|
+
var loadVendorDirectory = () => import("./svelte/components/VendorDirectory.svelte");
|
|
103
|
+
var loadVendorDetail = () => import("./svelte/components/VendorDetail.svelte");
|
|
44
104
|
var playground_default = {
|
|
45
105
|
packageName: "@happyvertical/smrt-commerce",
|
|
46
106
|
displayName: COMMERCE_MODULE_META.displayName,
|
|
47
107
|
description: COMMERCE_MODULE_META.description,
|
|
48
108
|
moduleMeta: COMMERCE_MODULE_META,
|
|
49
109
|
entries: [
|
|
110
|
+
{
|
|
111
|
+
id: "purchase-order-editor",
|
|
112
|
+
title: "Purchase and award preparation",
|
|
113
|
+
description: "Native allocation entry, review and retained uncertain-response recovery.",
|
|
114
|
+
loadComponent: () => import("./svelte/components/PurchasingPlayground.svelte"),
|
|
115
|
+
order: 30,
|
|
116
|
+
props: { reduction: false },
|
|
117
|
+
modes: { mock: { label: "Interactive demo" } }
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "purchase-reduction",
|
|
121
|
+
title: "Explicit allocation reduction",
|
|
122
|
+
description: "Every retained allocation remains present; zero is explicit, never inferred from blank.",
|
|
123
|
+
loadComponent: () => import("./svelte/components/PurchasingPlayground.svelte"),
|
|
124
|
+
order: 31,
|
|
125
|
+
props: { reduction: true },
|
|
126
|
+
modes: { mock: { label: "Interactive demo" } }
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
id: "quote-editor",
|
|
130
|
+
title: "Vendor quotation editor",
|
|
131
|
+
description: "Edit, add/remove rows and recover a simulated rejected native submission.",
|
|
132
|
+
loadComponent: () => import("./svelte/components/QuotePlayground.svelte"),
|
|
133
|
+
order: 20,
|
|
134
|
+
props: { kind: "vendor-quotation" },
|
|
135
|
+
modes: { mock: { label: "Interactive demo" } }
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
id: "customer-estimate-editor",
|
|
139
|
+
title: "Customer estimate editor",
|
|
140
|
+
description: "Customer estimate draft and retained revision comparison, without acceptance or budget writes.",
|
|
141
|
+
loadComponent: () => import("./svelte/components/QuotePlayground.svelte"),
|
|
142
|
+
order: 21,
|
|
143
|
+
props: { kind: "customer-estimate" },
|
|
144
|
+
modes: { mock: { label: "Interactive demo" } }
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: "pricing-version-decision",
|
|
148
|
+
title: "Pricing version decisions",
|
|
149
|
+
description: "Compare retained estimates and rehearse a rejected decision without losing input.",
|
|
150
|
+
loadComponent: () => import("./svelte/playground/PricingVersionPreview.svelte"),
|
|
151
|
+
order: 30,
|
|
152
|
+
props: {},
|
|
153
|
+
modes: { mock: { label: "Mock" } }
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: "customer-directory",
|
|
157
|
+
title: "Customer Directory",
|
|
158
|
+
description: "Search, paging, responsive cards, and consumer-owned links.",
|
|
159
|
+
loadComponent: loadCustomerDirectory,
|
|
160
|
+
order: 1,
|
|
161
|
+
props: {
|
|
162
|
+
items: [{
|
|
163
|
+
data: sampleCustomer,
|
|
164
|
+
href: "#customer-detail"
|
|
165
|
+
}],
|
|
166
|
+
total: 26,
|
|
167
|
+
page: 1,
|
|
168
|
+
pageSize: 25,
|
|
169
|
+
nextHref: "#customer-page-2",
|
|
170
|
+
addHref: "#add-customer",
|
|
171
|
+
canCreate: true
|
|
172
|
+
},
|
|
173
|
+
modes: { mock: { label: "Mock" } }
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
id: "customer-detail",
|
|
177
|
+
title: "Customer Detail",
|
|
178
|
+
description: "Profile identity, commercial terms, addresses, and contacts.",
|
|
179
|
+
loadComponent: loadCustomerDetail,
|
|
180
|
+
order: 2,
|
|
181
|
+
props: {
|
|
182
|
+
customer: sampleCustomer,
|
|
183
|
+
currency: "CAD",
|
|
184
|
+
backHref: "#customers",
|
|
185
|
+
editHref: "#edit-customer",
|
|
186
|
+
canEdit: true
|
|
187
|
+
},
|
|
188
|
+
modes: { mock: { label: "Mock" } }
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
id: "customer-form",
|
|
192
|
+
title: "Customer Form",
|
|
193
|
+
description: "Native create/edit submission with retained values and contacts.",
|
|
194
|
+
loadComponent: loadPartyFormPreview,
|
|
195
|
+
order: 3,
|
|
196
|
+
props: { kind: "customer" },
|
|
197
|
+
modes: { mock: { label: "Mock" } }
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: "vendor-directory",
|
|
201
|
+
title: "Vendor Directory",
|
|
202
|
+
description: "Search, paging, empty/error states, and consumer-owned links.",
|
|
203
|
+
loadComponent: loadVendorDirectory,
|
|
204
|
+
order: 4,
|
|
205
|
+
props: {
|
|
206
|
+
items: [{
|
|
207
|
+
data: sampleVendor,
|
|
208
|
+
href: "#vendor-detail"
|
|
209
|
+
}],
|
|
210
|
+
total: 1,
|
|
211
|
+
addHref: "#add-vendor",
|
|
212
|
+
canCreate: true
|
|
213
|
+
},
|
|
214
|
+
modes: { mock: { label: "Mock" } }
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
id: "vendor-detail",
|
|
218
|
+
title: "Vendor Detail",
|
|
219
|
+
description: "Profile identity, purchasing terms, and contact composition.",
|
|
220
|
+
loadComponent: loadVendorDetail,
|
|
221
|
+
order: 5,
|
|
222
|
+
props: {
|
|
223
|
+
vendor: sampleVendor,
|
|
224
|
+
backHref: "#vendors",
|
|
225
|
+
editHref: "#edit-vendor",
|
|
226
|
+
canEdit: true
|
|
227
|
+
},
|
|
228
|
+
modes: { mock: { label: "Mock" } }
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
id: "vendor-form",
|
|
232
|
+
title: "Vendor Form",
|
|
233
|
+
description: "Native create/edit submission with retained currency text and contacts.",
|
|
234
|
+
loadComponent: loadPartyFormPreview,
|
|
235
|
+
order: 6,
|
|
236
|
+
props: { kind: "vendor" },
|
|
237
|
+
modes: { mock: { label: "Mock" } }
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: "invoice-preparation",
|
|
241
|
+
title: "Invoice Preparation",
|
|
242
|
+
description: "Edit invoice lines, prices, discounts and tax, with optional source allocations and retained rejection recovery.",
|
|
243
|
+
loadComponent: () => import("./svelte/playground/InvoicePreparationPreview.svelte"),
|
|
244
|
+
order: 7,
|
|
245
|
+
props: {},
|
|
246
|
+
modes: { mock: { label: "Mock" } }
|
|
247
|
+
},
|
|
50
248
|
{
|
|
51
249
|
id: "invoice-card",
|
|
52
250
|
title: "Invoice Card",
|
|
53
251
|
description: "Compact invoice summary card used in billing and receivables views.",
|
|
54
252
|
loadComponent: loadInvoiceCard,
|
|
55
|
-
order:
|
|
253
|
+
order: 20,
|
|
56
254
|
props: {
|
|
57
255
|
invoice: sampleInvoice,
|
|
58
256
|
currency: "CAD",
|
|
@@ -65,7 +263,7 @@ var playground_default = {
|
|
|
65
263
|
title: "Invoice Actions",
|
|
66
264
|
description: "Status-aware billing actions for sending, printing, exporting, and payment confirmation.",
|
|
67
265
|
loadComponent: loadInvoiceActions,
|
|
68
|
-
order:
|
|
266
|
+
order: 21,
|
|
69
267
|
props: {
|
|
70
268
|
status: "sent",
|
|
71
269
|
onmarkpaid: noop,
|
|
@@ -79,7 +277,7 @@ var playground_default = {
|
|
|
79
277
|
title: "Unbilled Items",
|
|
80
278
|
description: "Selectable unbilled work list for creating a new invoice from accumulated items.",
|
|
81
279
|
loadComponent: loadUnbilledItems,
|
|
82
|
-
order:
|
|
280
|
+
order: 22,
|
|
83
281
|
props: {
|
|
84
282
|
items: sampleUnbilledItems,
|
|
85
283
|
currency: "CAD",
|
package/dist/playground.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.js","names":[],"sources":["../src/svelte/playground.ts"],"sourcesContent":["import { COMMERCE_MODULE_META } from '../ui.js';\n\nconst noop = () => {};\n\nconst sampleInvoice = {\n id: 'invoice-2026-0142',\n invoiceNumber: 'INV-2026-0142',\n status: 'sent',\n issueDate: '2026-03-15T00:00:00.000Z',\n dueDate: '2026-03-29T00:00:00.000Z',\n totalAmount: 128450,\n customerName: 'Riverstone Newsroom',\n projectName: 'Editorial Systems Retainer',\n};\n\nconst sampleUnbilledItems = [\n {\n id: 'unbilled-time-1',\n type: 'time',\n description: 'Governance workflow setup',\n date: '2026-03-12T00:00:00.000Z',\n amount: 42000,\n category: 'Implementation',\n selected: true,\n },\n {\n id: 'unbilled-expense-1',\n type: 'expense',\n description: 'Contributor QA workshop',\n date: '2026-03-14T00:00:00.000Z',\n amount: 18500,\n category: 'Training',\n },\n {\n id: 'unbilled-time-2',\n type: 'time',\n description: 'Release validation and docs cleanup',\n date: '2026-03-18T00:00:00.000Z',\n amount: 33950,\n category: 'QA',\n },\n];\n\nconst loadInvoiceActions = () => import('./components/InvoiceActions.svelte');\nconst loadInvoiceCard = () => import('./components/InvoiceCard.svelte');\nconst loadUnbilledItems = () => import('./components/UnbilledItems.svelte');\n\nexport default {\n packageName: '@happyvertical/smrt-commerce',\n displayName: COMMERCE_MODULE_META.displayName,\n description: COMMERCE_MODULE_META.description,\n moduleMeta: COMMERCE_MODULE_META,\n entries: [\n {\n id: 'invoice-card',\n title: 'Invoice Card',\n description:\n 'Compact invoice summary card used in billing and receivables views.',\n loadComponent: loadInvoiceCard,\n order: 1,\n props: {\n invoice: sampleInvoice,\n currency: 'CAD',\n onclick: noop,\n },\n modes: {\n mock: {\n label: 'Mock',\n },\n },\n },\n {\n id: 'invoice-actions',\n title: 'Invoice Actions',\n description:\n 'Status-aware billing actions for sending, printing, exporting, and payment confirmation.',\n loadComponent: loadInvoiceActions,\n order: 2,\n props: {\n status: 'sent',\n onmarkpaid: noop,\n onprint: noop,\n onexport: noop,\n },\n modes: {\n mock: {\n label: 'Mock',\n },\n },\n },\n {\n id: 'unbilled-items',\n title: 'Unbilled Items',\n description:\n 'Selectable unbilled work list for creating a new invoice from accumulated items.',\n loadComponent: loadUnbilledItems,\n order: 3,\n props: {\n items: sampleUnbilledItems,\n currency: 'CAD',\n onselectionchange: noop,\n oncreate: noop,\n },\n modes: {\n mock: {\n label: 'Mock',\n },\n },\n },\n ],\n};\n"],"mappings":";;AAEA,IAAM,aAAa,CAAC;AAEpB,IAAM,gBAAgB;CACpB,IAAI;CACJ,eAAe;CACf,QAAQ;CACR,WAAW;CACX,SAAS;CACT,aAAa;CACb,cAAc;CACd,aAAa;AACf;AAEA,IAAM,sBAAsB;CAC1B;EACE,IAAI;EACJ,MAAM;EACN,aAAa;EACb,MAAM;EACN,QAAQ;EACR,UAAU;EACV,UAAU;CACZ;CACA;EACE,IAAI;EACJ,MAAM;EACN,aAAa;EACb,MAAM;EACN,QAAQ;EACR,UAAU;CACZ;CACA;EACE,IAAI;EACJ,MAAM;EACN,aAAa;EACb,MAAM;EACN,QAAQ;EACR,UAAU;CACZ;AACF;AAEA,IAAM,2BAA2B,OAAO;AACxC,IAAM,wBAAwB,OAAO;AACrC,IAAM,0BAA0B,OAAO;AAEvC,IAAA,qBAAe;CACb,aAAa;CACb,aAAa,qBAAqB;CAClC,aAAa,qBAAqB;CAClC,YAAY;CACZ,SAAS;EACP;GACE,IAAI;GACJ,OAAO;GACP,aACE;GACF,eAAe;GACf,OAAO;GACP,OAAO;IACL,SAAS;IACT,UAAU;IACV,SAAS;GACX;GACA,OAAO,EACL,MAAM,EACJ,OAAO,OACT,EACF;EACF;EACA;GACE,IAAI;GACJ,OAAO;GACP,aACE;GACF,eAAe;GACf,OAAO;GACP,OAAO;IACL,QAAQ;IACR,YAAY;IACZ,SAAS;IACT,UAAU;GACZ;GACA,OAAO,EACL,MAAM,EACJ,OAAO,OACT,EACF;EACF;EACA;GACE,IAAI;GACJ,OAAO;GACP,aACE;GACF,eAAe;GACf,OAAO;GACP,OAAO;IACL,OAAO;IACP,UAAU;IACV,mBAAmB;IACnB,UAAU;GACZ;GACA,OAAO,EACL,MAAM,EACJ,OAAO,OACT,EACF;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"playground.js","names":[],"sources":["../src/svelte/playground.ts"],"sourcesContent":["import { COMMERCE_MODULE_META } from '../ui.js';\n\nconst noop = () => {};\n\nconst sampleInvoice = {\n id: 'invoice-2026-0142',\n invoiceNumber: 'INV-2026-0142',\n status: 'sent',\n issueDate: '2026-03-15T00:00:00.000Z',\n dueDate: '2026-03-29T00:00:00.000Z',\n totalAmount: 128450,\n customerName: 'Riverstone Newsroom',\n projectName: 'Editorial Systems Retainer',\n};\n\nconst sampleUnbilledItems = [\n {\n id: 'unbilled-time-1',\n type: 'time',\n description: 'Governance workflow setup',\n date: '2026-03-12T00:00:00.000Z',\n amount: 42000,\n category: 'Implementation',\n selected: true,\n },\n {\n id: 'unbilled-expense-1',\n type: 'expense',\n description: 'Contributor QA workshop',\n date: '2026-03-14T00:00:00.000Z',\n amount: 18500,\n category: 'Training',\n },\n {\n id: 'unbilled-time-2',\n type: 'time',\n description: 'Release validation and docs cleanup',\n date: '2026-03-18T00:00:00.000Z',\n amount: 33950,\n category: 'QA',\n },\n];\n\nconst sampleCustomer = {\n id: 'customer-riverstone',\n profileId: 'profile-riverstone',\n profile: {\n id: 'profile-riverstone',\n name: 'Riverstone Newsroom',\n email: 'accounts@riverstone.example',\n description: 'Independent newsroom and publishing customer.',\n identityKind: 'business',\n },\n status: 'active',\n customerType: 'wholesale',\n creditLimitMinor: 250000,\n paymentTerms: 'Net 30',\n taxExempt: false,\n defaultShippingAddress: {\n street1: '88 River Avenue',\n city: 'Edmonton',\n state: 'AB',\n postalCode: 'T5J 0K1',\n country: 'Canada',\n },\n contacts: [\n {\n id: 'contact-avery',\n name: 'Avery Chen',\n label: 'Accounts payable',\n email: 'avery@riverstone.example',\n phone: '+1 780 555 0142',\n },\n ],\n};\n\nconst sampleVendor = {\n id: 'vendor-northstar',\n profileId: 'profile-northstar',\n profile: {\n id: 'profile-northstar',\n name: 'Northstar Supply',\n email: 'orders@northstar.example',\n description: 'Regional materials and equipment supplier.',\n identityKind: 'business',\n },\n status: 'active',\n leadTimeDays: 7,\n minimumOrderMinor: 50000,\n paymentTerms: 'Net 45',\n currency: 'CAD',\n defaultContactEmail: 'orders@northstar.example',\n defaultContactPhone: '+1 403 555 0188',\n contacts: [\n {\n id: 'contact-morgan',\n name: 'Morgan Lee',\n label: 'Order desk',\n email: 'morgan@northstar.example',\n phone: '+1 403 555 0117',\n },\n ],\n};\n\nconst loadCustomerDirectory = () =>\n import('./components/CustomerDirectory.svelte');\nconst loadCustomerDetail = () => import('./components/CustomerDetail.svelte');\nconst loadPartyFormPreview = () =>\n import('./playground/PartyFormPreview.svelte');\nconst loadInvoiceActions = () => import('./components/InvoiceActions.svelte');\nconst loadInvoiceCard = () => import('./components/InvoiceCard.svelte');\nconst loadUnbilledItems = () => import('./components/UnbilledItems.svelte');\nconst loadVendorDirectory = () => import('./components/VendorDirectory.svelte');\nconst loadVendorDetail = () => import('./components/VendorDetail.svelte');\n\nexport default {\n packageName: '@happyvertical/smrt-commerce',\n displayName: COMMERCE_MODULE_META.displayName,\n description: COMMERCE_MODULE_META.description,\n moduleMeta: COMMERCE_MODULE_META,\n entries: [\n {\n id: 'purchase-order-editor',\n title: 'Purchase and award preparation',\n description:\n 'Native allocation entry, review and retained uncertain-response recovery.',\n loadComponent: () => import('./components/PurchasingPlayground.svelte'),\n order: 30,\n props: { reduction: false },\n modes: { mock: { label: 'Interactive demo' } },\n },\n {\n id: 'purchase-reduction',\n title: 'Explicit allocation reduction',\n description:\n 'Every retained allocation remains present; zero is explicit, never inferred from blank.',\n loadComponent: () => import('./components/PurchasingPlayground.svelte'),\n order: 31,\n props: { reduction: true },\n modes: { mock: { label: 'Interactive demo' } },\n },\n\n {\n id: 'quote-editor',\n title: 'Vendor quotation editor',\n description:\n 'Edit, add/remove rows and recover a simulated rejected native submission.',\n loadComponent: () => import('./components/QuotePlayground.svelte'),\n order: 20,\n props: { kind: 'vendor-quotation' },\n modes: { mock: { label: 'Interactive demo' } },\n },\n {\n id: 'customer-estimate-editor',\n title: 'Customer estimate editor',\n description:\n 'Customer estimate draft and retained revision comparison, without acceptance or budget writes.',\n loadComponent: () => import('./components/QuotePlayground.svelte'),\n order: 21,\n props: { kind: 'customer-estimate' },\n modes: { mock: { label: 'Interactive demo' } },\n },\n\n {\n id: 'pricing-version-decision',\n title: 'Pricing version decisions',\n description:\n 'Compare retained estimates and rehearse a rejected decision without losing input.',\n loadComponent: () => import('./playground/PricingVersionPreview.svelte'),\n order: 30,\n props: {},\n modes: { mock: { label: 'Mock' } },\n },\n {\n id: 'customer-directory',\n title: 'Customer Directory',\n description:\n 'Search, paging, responsive cards, and consumer-owned links.',\n loadComponent: loadCustomerDirectory,\n order: 1,\n props: {\n items: [{ data: sampleCustomer, href: '#customer-detail' }],\n total: 26,\n page: 1,\n pageSize: 25,\n nextHref: '#customer-page-2',\n addHref: '#add-customer',\n canCreate: true,\n },\n modes: { mock: { label: 'Mock' } },\n },\n {\n id: 'customer-detail',\n title: 'Customer Detail',\n description:\n 'Profile identity, commercial terms, addresses, and contacts.',\n loadComponent: loadCustomerDetail,\n order: 2,\n props: {\n customer: sampleCustomer,\n currency: 'CAD',\n backHref: '#customers',\n editHref: '#edit-customer',\n canEdit: true,\n },\n modes: { mock: { label: 'Mock' } },\n },\n {\n id: 'customer-form',\n title: 'Customer Form',\n description:\n 'Native create/edit submission with retained values and contacts.',\n loadComponent: loadPartyFormPreview,\n order: 3,\n props: { kind: 'customer' },\n modes: { mock: { label: 'Mock' } },\n },\n {\n id: 'vendor-directory',\n title: 'Vendor Directory',\n description:\n 'Search, paging, empty/error states, and consumer-owned links.',\n loadComponent: loadVendorDirectory,\n order: 4,\n props: {\n items: [{ data: sampleVendor, href: '#vendor-detail' }],\n total: 1,\n addHref: '#add-vendor',\n canCreate: true,\n },\n modes: { mock: { label: 'Mock' } },\n },\n {\n id: 'vendor-detail',\n title: 'Vendor Detail',\n description:\n 'Profile identity, purchasing terms, and contact composition.',\n loadComponent: loadVendorDetail,\n order: 5,\n props: {\n vendor: sampleVendor,\n backHref: '#vendors',\n editHref: '#edit-vendor',\n canEdit: true,\n },\n modes: { mock: { label: 'Mock' } },\n },\n {\n id: 'vendor-form',\n title: 'Vendor Form',\n description:\n 'Native create/edit submission with retained currency text and contacts.',\n loadComponent: loadPartyFormPreview,\n order: 6,\n props: { kind: 'vendor' },\n modes: { mock: { label: 'Mock' } },\n },\n {\n id: 'invoice-preparation',\n title: 'Invoice Preparation',\n description:\n 'Edit invoice lines, prices, discounts and tax, with optional source allocations and retained rejection recovery.',\n loadComponent: () =>\n import('./playground/InvoicePreparationPreview.svelte'),\n order: 7,\n props: {},\n modes: { mock: { label: 'Mock' } },\n },\n {\n id: 'invoice-card',\n title: 'Invoice Card',\n description:\n 'Compact invoice summary card used in billing and receivables views.',\n loadComponent: loadInvoiceCard,\n order: 20,\n props: {\n invoice: sampleInvoice,\n currency: 'CAD',\n onclick: noop,\n },\n modes: {\n mock: {\n label: 'Mock',\n },\n },\n },\n {\n id: 'invoice-actions',\n title: 'Invoice Actions',\n description:\n 'Status-aware billing actions for sending, printing, exporting, and payment confirmation.',\n loadComponent: loadInvoiceActions,\n order: 21,\n props: {\n status: 'sent',\n onmarkpaid: noop,\n onprint: noop,\n onexport: noop,\n },\n modes: {\n mock: {\n label: 'Mock',\n },\n },\n },\n {\n id: 'unbilled-items',\n title: 'Unbilled Items',\n description:\n 'Selectable unbilled work list for creating a new invoice from accumulated items.',\n loadComponent: loadUnbilledItems,\n order: 22,\n props: {\n items: sampleUnbilledItems,\n currency: 'CAD',\n onselectionchange: noop,\n oncreate: noop,\n },\n modes: {\n mock: {\n label: 'Mock',\n },\n },\n },\n ],\n};\n"],"mappings":";;AAEA,IAAM,aAAa,CAAC;AAEpB,IAAM,gBAAgB;CACpB,IAAI;CACJ,eAAe;CACf,QAAQ;CACR,WAAW;CACX,SAAS;CACT,aAAa;CACb,cAAc;CACd,aAAa;AACf;AAEA,IAAM,sBAAsB;CAC1B;EACE,IAAI;EACJ,MAAM;EACN,aAAa;EACb,MAAM;EACN,QAAQ;EACR,UA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