@happyvertical/smrt-commerce 0.55.24 → 0.56.1

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 (220) hide show
  1. package/AGENTS.md +11 -9
  2. package/README.md +114 -2
  3. package/agents/accounting-snapshot-mapper.md +111 -0
  4. package/agents/contract-money.md +18 -0
  5. package/agents/cost-billing.md +7 -2
  6. package/agents/document-money.md +126 -0
  7. package/agents/invoice-calculations.md +14 -2
  8. package/agents/line-amount-migration.md +50 -0
  9. package/agents/minor-unit-migration.md +20 -0
  10. package/agents/money-calculator.md +45 -0
  11. package/agents/money-model.md +113 -0
  12. package/agents/purchasing-ui.md +4 -3
  13. package/agents/quote-ui.md +3 -2
  14. package/agents/revenue-journal.md +23 -0
  15. package/agents/tax-codes.md +48 -0
  16. package/agents/tax-summary.md +126 -0
  17. package/dist/accounting-snapshot.d.ts +79 -0
  18. package/dist/accounting-snapshot.d.ts.map +1 -0
  19. package/dist/billing/runtime.d.ts +2 -0
  20. package/dist/billing/runtime.d.ts.map +1 -1
  21. package/dist/chunks/ContractLineItemCollection-DYjhj_pU.js +265 -0
  22. package/dist/chunks/ContractLineItemCollection-DYjhj_pU.js.map +1 -0
  23. package/dist/chunks/CustomerCollection-DQIujn4f.js +99 -0
  24. package/dist/chunks/CustomerCollection-DQIujn4f.js.map +1 -0
  25. package/dist/chunks/DocumentTaxCollection-BEpoqXAQ.js +1639 -0
  26. package/dist/chunks/DocumentTaxCollection-BEpoqXAQ.js.map +1 -0
  27. package/dist/chunks/InvoiceCollection-CKQflFjc.js +1047 -0
  28. package/dist/chunks/InvoiceCollection-CKQflFjc.js.map +1 -0
  29. package/dist/chunks/InvoiceLineItemCollection-CHm9zdqh.js +467 -0
  30. package/dist/chunks/InvoiceLineItemCollection-CHm9zdqh.js.map +1 -0
  31. package/dist/chunks/TaxCodeCollection-DOpzW4y8.js +149 -0
  32. package/dist/chunks/TaxCodeCollection-DOpzW4y8.js.map +1 -0
  33. package/dist/chunks/TaxComponentCollection-Cs2uXwEl.js +129 -0
  34. package/dist/chunks/TaxComponentCollection-Cs2uXwEl.js.map +1 -0
  35. package/dist/chunks/TaxSettingsCollection-BBTZDH1S.js +319 -0
  36. package/dist/chunks/TaxSettingsCollection-BBTZDH1S.js.map +1 -0
  37. package/dist/chunks/{money-DfrRxrel.js → allocation-integrity-DI3G16BN.js} +7 -12
  38. package/dist/chunks/allocation-integrity-DI3G16BN.js.map +1 -0
  39. package/dist/chunks/{calculations-Bz7RB3qK.js → calculations-DaHR17il.js} +134 -54
  40. package/dist/chunks/calculations-DaHR17il.js.map +1 -0
  41. package/dist/chunks/credit-allocation-yspz0Lab.js +121 -0
  42. package/dist/chunks/credit-allocation-yspz0Lab.js.map +1 -0
  43. package/dist/chunks/document-money-DNVhDJyC.js +860 -0
  44. package/dist/chunks/document-money-DNVhDJyC.js.map +1 -0
  45. package/dist/chunks/invoice-posting-BwV8g7z0.js +229 -0
  46. package/dist/chunks/invoice-posting-BwV8g7z0.js.map +1 -0
  47. package/dist/chunks/money-rational-CcW7gzG5.js +64 -0
  48. package/dist/chunks/money-rational-CcW7gzG5.js.map +1 -0
  49. package/dist/chunks/revenue-journal-DY9fro8E.js +140 -0
  50. package/dist/chunks/revenue-journal-DY9fro8E.js.map +1 -0
  51. package/dist/chunks/rolldown-runtime-D7D4PA-g.js +13 -0
  52. package/dist/chunks/tenant-money-barrier-DjRXgMnX.js +135 -0
  53. package/dist/chunks/tenant-money-barrier-DjRXgMnX.js.map +1 -0
  54. package/dist/chunks/{types-zVnIjSOk.js → types-LDETvQ1C.js} +3 -14
  55. package/dist/chunks/types-LDETvQ1C.js.map +1 -0
  56. package/dist/chunks/{units-BpZ0_Dpk.js → units-CNcjH_eE.js} +2 -2
  57. package/dist/chunks/{units-BpZ0_Dpk.js.map → units-CNcjH_eE.js.map} +1 -1
  58. package/dist/collections/ContractCollection.d.ts +37 -1
  59. package/dist/collections/ContractCollection.d.ts.map +1 -1
  60. package/dist/collections/ContractLineItemCollection.d.ts +26 -1
  61. package/dist/collections/ContractLineItemCollection.d.ts.map +1 -1
  62. package/dist/collections/DocumentTaxCollection.d.ts +75 -0
  63. package/dist/collections/DocumentTaxCollection.d.ts.map +1 -0
  64. package/dist/collections/InvoiceCollection.d.ts +26 -1
  65. package/dist/collections/InvoiceCollection.d.ts.map +1 -1
  66. package/dist/collections/InvoiceLineItemCollection.d.ts +26 -1
  67. package/dist/collections/InvoiceLineItemCollection.d.ts.map +1 -1
  68. package/dist/collections/MoneyMigrationDocumentCollection.d.ts +12 -0
  69. package/dist/collections/MoneyMigrationDocumentCollection.d.ts.map +1 -0
  70. package/dist/collections/PaymentAllocationCollection.d.ts +2 -0
  71. package/dist/collections/PaymentAllocationCollection.d.ts.map +1 -1
  72. package/dist/collections/PurchaseContractCollection.d.ts +8 -0
  73. package/dist/collections/PurchaseContractCollection.d.ts.map +1 -0
  74. package/dist/collections/SalesContractCollection.d.ts +8 -0
  75. package/dist/collections/SalesContractCollection.d.ts.map +1 -0
  76. package/dist/collections/TaxCodeCollection.d.ts +7 -0
  77. package/dist/collections/TaxCodeCollection.d.ts.map +1 -0
  78. package/dist/collections/TaxComponentCollection.d.ts +6 -0
  79. package/dist/collections/TaxComponentCollection.d.ts.map +1 -0
  80. package/dist/collections/TaxSettingsCollection.d.ts +16 -0
  81. package/dist/collections/TaxSettingsCollection.d.ts.map +1 -0
  82. package/dist/collections/TaxSummaryReportCollection.d.ts +151 -0
  83. package/dist/collections/TaxSummaryReportCollection.d.ts.map +1 -0
  84. package/dist/collections/index.d.ts +8 -0
  85. package/dist/collections/index.d.ts.map +1 -1
  86. package/dist/commerce-money-tools.d.ts +9 -0
  87. package/dist/commerce-money-tools.d.ts.map +1 -0
  88. package/dist/contract-money.d.ts +27 -0
  89. package/dist/contract-money.d.ts.map +1 -0
  90. package/dist/cost-billing.d.ts +0 -1
  91. package/dist/cost-billing.d.ts.map +1 -1
  92. package/dist/cost-billing.js +10 -15
  93. package/dist/cost-billing.js.map +1 -1
  94. package/dist/credit-allocation.d.ts +48 -0
  95. package/dist/credit-allocation.d.ts.map +1 -0
  96. package/dist/document-money-internal.d.ts +44 -0
  97. package/dist/document-money-internal.d.ts.map +1 -0
  98. package/dist/document-money.d.ts +85 -0
  99. package/dist/document-money.d.ts.map +1 -0
  100. package/dist/index.d.ts +16 -4
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js +5563 -4243
  103. package/dist/index.js.map +1 -1
  104. package/dist/invoice-accounting-sync.d.ts +96 -0
  105. package/dist/invoice-accounting-sync.d.ts.map +1 -0
  106. package/dist/invoice-mcp.d.ts +16 -0
  107. package/dist/invoice-mcp.d.ts.map +1 -0
  108. package/dist/invoice-posting.d.ts +9 -0
  109. package/dist/invoice-posting.d.ts.map +1 -0
  110. package/dist/invoice-record-screen.d.ts +60 -0
  111. package/dist/invoice-record-screen.d.ts.map +1 -0
  112. package/dist/invoices.d.ts +2 -0
  113. package/dist/invoices.d.ts.map +1 -1
  114. package/dist/invoices.js +3 -2
  115. package/dist/manifest.json +11605 -4598
  116. package/dist/migrations/commerceLineAmounts.d.ts +84 -0
  117. package/dist/migrations/commerceLineAmounts.d.ts.map +1 -0
  118. package/dist/migrations/partyLinks.d.ts +39 -0
  119. package/dist/migrations/partyLinks.d.ts.map +1 -0
  120. package/dist/models/Contract.d.ts +61 -27
  121. package/dist/models/Contract.d.ts.map +1 -1
  122. package/dist/models/ContractLineItem.d.ts +30 -1
  123. package/dist/models/ContractLineItem.d.ts.map +1 -1
  124. package/dist/models/Customer.d.ts +7 -0
  125. package/dist/models/Customer.d.ts.map +1 -1
  126. package/dist/models/DocumentTax.d.ts +50 -0
  127. package/dist/models/DocumentTax.d.ts.map +1 -0
  128. package/dist/models/Invoice.d.ts +46 -2
  129. package/dist/models/Invoice.d.ts.map +1 -1
  130. package/dist/models/InvoiceLineItem.d.ts +33 -2
  131. package/dist/models/InvoiceLineItem.d.ts.map +1 -1
  132. package/dist/models/MoneyMigrationDocument.d.ts +28 -0
  133. package/dist/models/MoneyMigrationDocument.d.ts.map +1 -0
  134. package/dist/models/Payment.d.ts +5 -1
  135. package/dist/models/Payment.d.ts.map +1 -1
  136. package/dist/models/PaymentAllocation.d.ts.map +1 -1
  137. package/dist/models/TaxCode.d.ts +22 -0
  138. package/dist/models/TaxCode.d.ts.map +1 -0
  139. package/dist/models/TaxComponent.d.ts +21 -0
  140. package/dist/models/TaxComponent.d.ts.map +1 -0
  141. package/dist/models/TaxSettings.d.ts +33 -0
  142. package/dist/models/TaxSettings.d.ts.map +1 -0
  143. package/dist/models/TaxSummaryReport.d.ts +35 -0
  144. package/dist/models/TaxSummaryReport.d.ts.map +1 -0
  145. package/dist/models/Vendor.d.ts +9 -0
  146. package/dist/models/Vendor.d.ts.map +1 -1
  147. package/dist/models/index.d.ts +7 -1
  148. package/dist/models/index.d.ts.map +1 -1
  149. package/dist/money-rational.d.ts +15 -0
  150. package/dist/money-rational.d.ts.map +1 -0
  151. package/dist/money.d.ts +106 -25
  152. package/dist/money.d.ts.map +1 -1
  153. package/dist/money.js +274 -0
  154. package/dist/money.js.map +1 -0
  155. package/dist/recipes.d.ts +17 -47
  156. package/dist/recipes.d.ts.map +1 -1
  157. package/dist/revenue-journal.d.ts +61 -0
  158. package/dist/revenue-journal.d.ts.map +1 -0
  159. package/dist/smrt-knowledge.json +6558 -1316
  160. package/dist/svelte/components/InvoiceActions.svelte +12 -0
  161. package/dist/svelte/components/InvoiceActions.svelte.d.ts +5 -0
  162. package/dist/svelte/components/InvoiceActions.svelte.d.ts.map +1 -1
  163. package/dist/svelte/components/InvoiceEditor.svelte +15 -1
  164. package/dist/svelte/components/InvoiceEditor.svelte.d.ts.map +1 -1
  165. package/dist/svelte/components/InvoiceLineItems.svelte +3 -3
  166. package/dist/svelte/components/InvoiceRecordScreen.svelte +94 -0
  167. package/dist/svelte/components/InvoiceRecordScreen.svelte.d.ts +21 -0
  168. package/dist/svelte/components/InvoiceRecordScreen.svelte.d.ts.map +1 -0
  169. package/dist/svelte/components/InvoiceTotals.svelte +2 -2
  170. package/dist/svelte/components/MoneyInvoiceEditor.svelte +282 -0
  171. package/dist/svelte/components/MoneyInvoiceEditor.svelte.d.ts +31 -0
  172. package/dist/svelte/components/MoneyInvoiceEditor.svelte.d.ts.map +1 -0
  173. package/dist/svelte/components/PurchaseOrderEditor.svelte +53 -1
  174. package/dist/svelte/components/PurchaseOrderEditor.svelte.d.ts +5 -0
  175. package/dist/svelte/components/PurchaseOrderEditor.svelte.d.ts.map +1 -1
  176. package/dist/svelte/components/QuoteEditor.svelte +54 -1
  177. package/dist/svelte/components/QuoteEditor.svelte.d.ts +5 -0
  178. package/dist/svelte/components/QuoteEditor.svelte.d.ts.map +1 -1
  179. package/dist/svelte/i18n.d.ts +16 -0
  180. package/dist/svelte/i18n.d.ts.map +1 -1
  181. package/dist/svelte/i18n.js +16 -0
  182. package/dist/svelte/index.d.ts +7 -2
  183. package/dist/svelte/index.d.ts.map +1 -1
  184. package/dist/svelte/index.js +4 -1
  185. package/dist/svelte/invoices/calculations.d.ts +7 -2
  186. package/dist/svelte/invoices/calculations.d.ts.map +1 -1
  187. package/dist/svelte/invoices/calculations.js +141 -47
  188. package/dist/svelte/invoices/money-editor.d.ts +123 -0
  189. package/dist/svelte/invoices/money-editor.d.ts.map +1 -0
  190. package/dist/svelte/invoices/money-editor.js +101 -0
  191. package/dist/svelte/invoices/types.d.ts +5 -1
  192. package/dist/svelte/invoices/types.d.ts.map +1 -1
  193. package/dist/svelte/purchasing-i18n.d.ts +5 -0
  194. package/dist/svelte/purchasing-i18n.d.ts.map +1 -1
  195. package/dist/svelte/purchasing-i18n.js +5 -0
  196. package/dist/svelte/quote-i18n.d.ts +5 -0
  197. package/dist/svelte/quote-i18n.d.ts.map +1 -1
  198. package/dist/svelte/quote-i18n.js +5 -0
  199. package/dist/tax/cookbook.d.ts +22 -0
  200. package/dist/tax/cookbook.d.ts.map +1 -0
  201. package/dist/tax/example-pack.d.ts +25 -0
  202. package/dist/tax/example-pack.d.ts.map +1 -0
  203. package/dist/tax/identity.d.ts +5 -0
  204. package/dist/tax/identity.d.ts.map +1 -0
  205. package/dist/tax/index.d.ts +4 -0
  206. package/dist/tax/index.d.ts.map +1 -0
  207. package/dist/tax/legacy.d.ts +48 -0
  208. package/dist/tax/legacy.d.ts.map +1 -0
  209. package/dist/tax-summary-report-adapter.d.ts +37 -0
  210. package/dist/tax-summary-report-adapter.d.ts.map +1 -0
  211. package/dist/tax-summary.d.ts +129 -0
  212. package/dist/tax-summary.d.ts.map +1 -0
  213. package/dist/tenant-money-barrier.d.ts +66 -0
  214. package/dist/tenant-money-barrier.d.ts.map +1 -0
  215. package/dist/types/index.d.ts +145 -5
  216. package/dist/types/index.d.ts.map +1 -1
  217. package/package.json +19 -11
  218. package/dist/chunks/calculations-Bz7RB3qK.js.map +0 -1
  219. package/dist/chunks/money-DfrRxrel.js.map +0 -1
  220. package/dist/chunks/types-zVnIjSOk.js.map +0 -1
@@ -30,6 +30,11 @@ export interface Props {
30
30
  onprint?: () => void;
31
31
  /** Called when export/download is clicked */
32
32
  onexport?: () => void;
33
+ /**
34
+ * Host-authorized credit-note creation for an issued source invoice. The
35
+ * caller owns authorization, navigation, and persistence.
36
+ */
37
+ oncreatecreditnote?: () => void;
33
38
  /** Size variant */
34
39
  size?: 'sm' | 'md';
35
40
  }
@@ -43,6 +48,7 @@ const {
43
48
  ondelete,
44
49
  onprint,
45
50
  onexport,
51
+ oncreatecreditnote,
46
52
  size = 'md',
47
53
  }: Props = $props();
48
54
 
@@ -93,6 +99,12 @@ const canDelete = $derived(status === 'draft');
93
99
  </Button>
94
100
  {/if}
95
101
 
102
+ {#if oncreatecreditnote && !canEdit}
103
+ <Button variant="secondary" {size} onclick={oncreatecreditnote} disabled={loading}>
104
+ {t(M['commerce.invoice_actions.create_credit_note'])}
105
+ </Button>
106
+ {/if}
107
+
96
108
  {#if onexport}
97
109
  <Button variant="secondary" {size} onclick={onexport} disabled={loading}>
98
110
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5">
@@ -17,6 +17,11 @@ export interface Props {
17
17
  onprint?: () => void;
18
18
  /** Called when export/download is clicked */
19
19
  onexport?: () => void;
20
+ /**
21
+ * Host-authorized credit-note creation for an issued source invoice. The
22
+ * caller owns authorization, navigation, and persistence.
23
+ */
24
+ oncreatecreditnote?: () => void;
20
25
  /** Size variant */
21
26
  size?: 'sm' | 'md';
22
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InvoiceActions.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/InvoiceActions.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,yCAAyC;AACzC,MAAM,WAAW,KAAK;IACpB,6BAA6B;IAC7B,MAAM,EAAE,aAAa,CAAC;IACtB,oBAAoB;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,mBAAmB;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AA+FD,QAAA,MAAM,cAAc,2CAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"InvoiceActions.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/InvoiceActions.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,yCAAyC;AACzC,MAAM,WAAW,KAAK;IACpB,6BAA6B;IAC7B,MAAM,EAAE,aAAa,CAAC;IACtB,oBAAoB;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,kCAAkC;IAClC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,mBAAmB;IACnB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CACpB;AAsGD,QAAA,MAAM,cAAc,2CAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
@@ -22,6 +22,7 @@ import type {
22
22
  } from '../invoices/types.js';
23
23
  import InvoiceLineEditor from './InvoiceLineEditor.svelte';
24
24
  import InvoiceReview from './InvoiceReview.svelte';
25
+ import MoneyInvoiceEditor from './MoneyInvoiceEditor.svelte';
25
26
  /** General native invoice editor; server owns prices, tax, authorization and persistence. */
26
27
  export interface Props extends InvoiceEditorProps {}
27
28
  let {
@@ -29,7 +30,15 @@ let {
29
30
  method = 'post',
30
31
  id,
31
32
  title,
32
- values,
33
+ values = {
34
+ customerId: '',
35
+ issuedOn: '',
36
+ dueOn: '',
37
+ currency: 'USD',
38
+ paymentTerms: '',
39
+ taxRate: '0',
40
+ lines: [],
41
+ },
33
42
  roundingScope = 'line',
34
43
  customers = [],
35
44
  errors = {},
@@ -48,6 +57,7 @@ let {
48
57
  cancelHref,
49
58
  children,
50
59
  onsubmit,
60
+ money,
51
61
  }: Props = $props();
52
62
  const { t } = useI18n();
53
63
  const instanceId = $props.id();
@@ -86,6 +96,9 @@ function lineErrors(key: string) {
86
96
  ) as Partial<Record<keyof InvoiceLineFieldNames, string>>;
87
97
  }
88
98
  </script>
99
+ {#if money?.mode === 'v2'}
100
+ <MoneyInvoiceEditor {action} {method} {money} {canEdit} {pending} {hiddenFields} intentField={names.intent} {saveIntent} {saveLabel} {onsubmit} />
101
+ {:else}
89
102
  <section class="invoice-editor" aria-labelledby={`${formId}-title`} data-smrt-component="InvoiceEditor">
90
103
  <h2 id={`${formId}-title`}>{title ?? t(M['commerce.preparation.title'])}</h2>
91
104
  {#if review}<InvoiceReview {review} />{/if}
@@ -126,6 +139,7 @@ function lineErrors(key: string) {
126
139
  </div>
127
140
  </Form>
128
141
  </section>
142
+ {/if}
129
143
  <style>
130
144
  @layer smrt.reset, smrt.structure, smrt.theme;
131
145
  @layer smrt.theme {
@@ -1 +1 @@
1
- {"version":3,"file":"InvoiceEditor.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/InvoiceEditor.svelte.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAEV,kBAAkB,EAEnB,MAAM,sBAAsB,CAAC;AAI9B,6FAA6F;AAC7F,MAAM,WAAW,KAAM,SAAQ,kBAAkB;CAAG;AAuHpD,QAAA,MAAM,aAAa,2CAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"InvoiceEditor.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/InvoiceEditor.svelte.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAEV,kBAAkB,EAEnB,MAAM,sBAAsB,CAAC;AAK9B,6FAA6F;AAC7F,MAAM,WAAW,KAAM,SAAQ,kBAAkB;CAAG;AAqIpD,QAAA,MAAM,aAAa,2CAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
@@ -66,8 +66,8 @@ const onadd = $derived(legacy?.onadd);
66
66
  const showSource = $derived(legacy?.showSource ?? false);
67
67
  const emptyMessage = $derived(props.emptyMessage ?? 'No line items');
68
68
 
69
- // Format decimal-dollar amounts. The commerce models store DECIMAL dollars
70
- // (AGENTS.md "Currency in decimal fields"), not integer cents.
69
+ // This legacy branch receives decimal-major values from its historical API.
70
+ // Exact retained views above use integer minor units through formatInvoiceMinorUnits.
71
71
  function formatMoney(amount: number): string {
72
72
  return new Intl.NumberFormat('en-CA', {
73
73
  style: 'currency',
@@ -178,7 +178,7 @@ const total = $derived(items.reduce((sum, item) => sum + item.amount, 0));
178
178
  </tbody>
179
179
  <tfoot>
180
180
  <tr class="total-row">
181
- <td colspan={showSource ? 4 : 3} class="total-label">Subtotal</td>
181
+ <td colspan={showSource ? 4 : 3} class="total-label">{t(M['commerce.invoice_line_items.line_total'])}</td>
182
182
  <td class="col-amount">{formatMoney(total)}</td>
183
183
  {#if editable}
184
184
  <td></td>
@@ -0,0 +1,94 @@
1
+ <script lang="ts">
2
+ /**
3
+ * InvoiceRecordScreen composes the published generic record screen with
4
+ * commerce's stored-money projection and host-authorized credit-note action.
5
+ * The host loads `data` server-side with `loadInvoiceRecordScreenData()`.
6
+ */
7
+ import {
8
+ RecordScreen,
9
+ type RecordScreenProps,
10
+ } from '@happyvertical/smrt-svelte/screens';
11
+ import { useI18n } from '@happyvertical/smrt-ui/i18n';
12
+ import { Button } from '@happyvertical/smrt-ui/ui';
13
+ import type { InvoiceRecordScreenData } from '../../invoice-record-screen.js';
14
+ import { M } from '../i18n.js';
15
+
16
+ export interface InvoiceRecordScreenProps {
17
+ /** Generic record-screen wiring owned by the host application. */
18
+ screen: Omit<
19
+ RecordScreenProps,
20
+ 'lineItemStoredTotals' | 'extraActions' | 'children'
21
+ >;
22
+ /** Tenant-scoped persisted invoice facts from `loadInvoiceRecordScreenData`. */
23
+ data: InvoiceRecordScreenData;
24
+ /** Result of the host's server-side authorization check. */
25
+ canCreateCreditNote?: boolean;
26
+ /** Host-owned navigation or mutation after an authorized click. */
27
+ onCreateCreditNote?: () => void;
28
+ }
29
+
30
+ let {
31
+ screen,
32
+ data,
33
+ canCreateCreditNote = false,
34
+ onCreateCreditNote,
35
+ }: InvoiceRecordScreenProps = $props();
36
+ const { t } = useI18n();
37
+
38
+ const showCreditAction = $derived(
39
+ data.kind === 'invoice' &&
40
+ canCreateCreditNote &&
41
+ onCreateCreditNote !== undefined,
42
+ );
43
+ </script>
44
+
45
+ {#snippet relatedCredits()}
46
+ {#if data.creditNotes.length > 0}
47
+ <section class="invoice-record-screen__credits" aria-label={t(M['commerce.invoice_record.credit_notes'])}>
48
+ <h2>{t(M['commerce.invoice_record.credit_notes'])}</h2>
49
+ <ul>
50
+ {#each data.creditNotes as credit (credit.id)}
51
+ <li>
52
+ <strong>{credit.invoiceNumber}</strong>
53
+ <span>{credit.status}</span>
54
+ <time datetime={credit.issueDate}>{credit.issueDate.slice(0, 10)}</time>
55
+ </li>
56
+ {/each}
57
+ </ul>
58
+ </section>
59
+ {/if}
60
+ {/snippet}
61
+
62
+ {#if showCreditAction}
63
+ <RecordScreen {...screen} lineItemStoredTotals={() => data.storedTotals}>
64
+ {#snippet extraActions()}
65
+ <Button variant="secondary" onclick={onCreateCreditNote}>
66
+ {t(M['commerce.invoice_actions.create_credit_note'])}
67
+ </Button>
68
+ {/snippet}
69
+ {#snippet children()}
70
+ {@render relatedCredits()}
71
+ {/snippet}
72
+ </RecordScreen>
73
+ {:else}
74
+ <RecordScreen {...screen} lineItemStoredTotals={() => data.storedTotals}>
75
+ {#snippet children()}
76
+ {@render relatedCredits()}
77
+ {/snippet}
78
+ </RecordScreen>
79
+ {/if}
80
+
81
+ <style>
82
+ @layer smrt.reset, smrt.structure, smrt.theme;
83
+ @layer smrt.theme {
84
+ .invoice-record-screen__credits {
85
+ display: grid;
86
+ gap: var(--smrt-spacing-sm, 0.5rem);
87
+ margin-block-start: var(--smrt-spacing-md, 1rem);
88
+ }
89
+ .invoice-record-screen__credits h2 { margin: 0; font: var(--smrt-typography-title-small-font); }
90
+ .invoice-record-screen__credits ul { display: grid; gap: var(--smrt-spacing-xs, 0.25rem); margin: 0; padding-inline-start: 1.25rem; }
91
+ .invoice-record-screen__credits li { display: flex; flex-wrap: wrap; gap: var(--smrt-spacing-sm, 0.5rem); color: var(--smrt-color-on-surface); }
92
+ .invoice-record-screen__credits li span, .invoice-record-screen__credits time { color: var(--smrt-color-on-surface-variant); }
93
+ }
94
+ </style>
@@ -0,0 +1,21 @@
1
+ /**
2
+ * InvoiceRecordScreen composes the published generic record screen with
3
+ * commerce's stored-money projection and host-authorized credit-note action.
4
+ * The host loads `data` server-side with `loadInvoiceRecordScreenData()`.
5
+ */
6
+ import { type RecordScreenProps } from '@happyvertical/smrt-svelte/screens';
7
+ import type { InvoiceRecordScreenData } from '../../invoice-record-screen.js';
8
+ export interface InvoiceRecordScreenProps {
9
+ /** Generic record-screen wiring owned by the host application. */
10
+ screen: Omit<RecordScreenProps, 'lineItemStoredTotals' | 'extraActions' | 'children'>;
11
+ /** Tenant-scoped persisted invoice facts from `loadInvoiceRecordScreenData`. */
12
+ data: InvoiceRecordScreenData;
13
+ /** Result of the host's server-side authorization check. */
14
+ canCreateCreditNote?: boolean;
15
+ /** Host-owned navigation or mutation after an authorized click. */
16
+ onCreateCreditNote?: () => void;
17
+ }
18
+ declare const InvoiceRecordScreen: import("svelte").Component<InvoiceRecordScreenProps, {}, "">;
19
+ type InvoiceRecordScreen = ReturnType<typeof InvoiceRecordScreen>;
20
+ export default InvoiceRecordScreen;
21
+ //# sourceMappingURL=InvoiceRecordScreen.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InvoiceRecordScreen.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/InvoiceRecordScreen.svelte.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAI9E,MAAM,WAAW,wBAAwB;IACvC,kEAAkE;IAClE,MAAM,EAAE,IAAI,CACV,iBAAiB,EACjB,sBAAsB,GAAG,cAAc,GAAG,UAAU,CACrD,CAAC;IACF,gFAAgF;IAChF,IAAI,EAAE,uBAAuB,CAAC;IAC9B,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,mEAAmE;IACnE,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC;AAiED,QAAA,MAAM,mBAAmB,8DAAwC,CAAC;AAClE,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAClE,eAAe,mBAAmB,CAAC"}
@@ -75,8 +75,8 @@ const calculatedTax = $derived(taxAmount ?? subtotal * (taxRate / 100));
75
75
  // Calculate balance due
76
76
  const balanceDue = $derived(total - amountPaid);
77
77
 
78
- // Format decimal-dollar amounts. The commerce models store DECIMAL dollars
79
- // (AGENTS.md "Currency in decimal fields"), not integer cents.
78
+ // This legacy branch receives decimal-major values from its historical API.
79
+ // Exact retained views above use integer minor units through formatInvoiceMinorUnits.
80
80
  function formatMoney(amount: number): string {
81
81
  return new Intl.NumberFormat('en-CA', {
82
82
  style: 'currency',
@@ -0,0 +1,282 @@
1
+ <script lang="ts">
2
+ import { CurrencyDisplay } from '@happyvertical/smrt-ui';
3
+ import { Form, Input, Select } from '@happyvertical/smrt-ui/forms';
4
+ import { useI18n } from '@happyvertical/smrt-ui/i18n';
5
+ import { Button } from '@happyvertical/smrt-ui/ui';
6
+ import type { HTMLFormAttributes } from 'svelte/elements';
7
+ import { M } from '../i18n.js';
8
+ import {
9
+ calculateMoneyEditorDraft,
10
+ type MoneyEditorProps,
11
+ moneyEditorFieldNames,
12
+ } from '../invoices/money-editor.js';
13
+
14
+ export interface Props {
15
+ /** Native form action owned by the caller's invoice route. */
16
+ action: string;
17
+ /** Native HTTP method retained for progressive enhancement. */
18
+ method?: 'post' | 'get';
19
+ /** Typed v2 money draft, tax-code choices, and stored issued snapshot. */
20
+ money: MoneyEditorProps;
21
+ /** Presentation capability; the server remains the authority for writes. */
22
+ canEdit?: boolean;
23
+ /** Caller transport state that disables edits and the save submitter. */
24
+ pending?: boolean;
25
+ /** Caller-owned request identity and route fields submitted unchanged. */
26
+ hiddenFields?: readonly { name: string; value: string }[];
27
+ /** Native submitter field name expected by the caller. */
28
+ intentField?: string;
29
+ /** Submitter value that requests a draft save. */
30
+ saveIntent?: string;
31
+ /** Caller-visible label for the save submitter. */
32
+ saveLabel?: string;
33
+ /** Optional native form enhancement; omitted submissions stay native. */
34
+ onsubmit?: HTMLFormAttributes['onsubmit'];
35
+ }
36
+
37
+ let {
38
+ action,
39
+ method = 'post',
40
+ money,
41
+ canEdit = true,
42
+ pending = false,
43
+ hiddenFields = [],
44
+ intentField = 'intent',
45
+ saveIntent = 'save',
46
+ saveLabel = 'Save invoice draft',
47
+ onsubmit,
48
+ }: Props = $props();
49
+ const { t } = useI18n();
50
+
51
+ const names = $derived({ ...moneyEditorFieldNames, ...money.names });
52
+ // The selector owns a local pending choice until the native form submits.
53
+ // svelte-ignore state_referenced_locally
54
+ let lineAmountType = $state(money.draft.lineAmountType);
55
+ // svelte-ignore state_referenced_locally
56
+ let lines = $state([...money.draft.lines]);
57
+ let modeConfirmed = $state(false);
58
+ const frozen = $derived(money.frozen === true);
59
+ const editable = $derived(canEdit && !frozen);
60
+ // Issued documents display only their server-authoritative snapshot; never recalculate it.
61
+ const calculation = $derived(
62
+ frozen
63
+ ? null
64
+ : calculateMoneyEditorDraft(
65
+ { ...money.draft, lineAmountType, lines },
66
+ money.taxCodes,
67
+ ),
68
+ );
69
+ const result = $derived(calculation?.valid ? calculation.result : null);
70
+ const stored = $derived(money.stored);
71
+ const totals = $derived(
72
+ frozen && stored
73
+ ? stored
74
+ : result
75
+ ? {
76
+ lineAmountType,
77
+ roundingScope: money.draft.roundingScope,
78
+ subtotalMinor: result.subtotalMinor,
79
+ discountTotalMinor: result.discountTotalMinor,
80
+ taxMinor: result.taxMinor,
81
+ totalMinor: result.totalMinor,
82
+ taxes: result.taxes.map((tax) => {
83
+ const code = money.taxCodes.find(
84
+ (candidate) => candidate.id === tax.taxCodeId,
85
+ );
86
+ const component = code?.components.find(
87
+ (candidate) => candidate.taxComponentId === tax.taxComponentId,
88
+ );
89
+ return {
90
+ id: `${tax.taxCodeId}:${tax.taxComponentId ?? ''}`,
91
+ taxComponentId: tax.taxComponentId,
92
+ name:
93
+ code?.componentNames?.[tax.taxComponentId ?? ''] ??
94
+ code?.name ??
95
+ code?.code ??
96
+ 'Tax',
97
+ percent: component?.percent ?? '0',
98
+ taxableMinor: tax.taxableMinor,
99
+ taxMinor: tax.taxMinor,
100
+ };
101
+ }),
102
+ }
103
+ : null,
104
+ );
105
+
106
+ function inheritedHint(line: MoneyEditorProps['draft']['lines'][number]) {
107
+ const code = money.taxCodes.find(
108
+ (candidate) => candidate.id === line.inheritedTaxCodeId,
109
+ );
110
+ if (!code) return 'No tax code';
111
+ const source =
112
+ line.inheritedTaxCodeSource === 'exempt-customer'
113
+ ? 'customer is exempt'
114
+ : line.inheritedTaxCodeSource === 'customer'
115
+ ? 'from customer'
116
+ : line.inheritedTaxCodeSource === 'product'
117
+ ? 'from product'
118
+ : 'app default';
119
+ return `${code.code} · ${source}`;
120
+ }
121
+
122
+ function groupedTaxes(
123
+ taxes: readonly {
124
+ id: string;
125
+ taxComponentId?: string | null;
126
+ name: string;
127
+ percent: string;
128
+ taxableMinor: number;
129
+ taxMinor: number;
130
+ }[],
131
+ ) {
132
+ const rows = new Map<
133
+ string,
134
+ {
135
+ id: string;
136
+ taxComponentId?: string | null;
137
+ name: string;
138
+ percent: string;
139
+ taxableMinor: number;
140
+ taxMinor: number;
141
+ }
142
+ >();
143
+ for (const tax of taxes) {
144
+ const key = `${tax.taxComponentId ?? tax.id}\u0000${tax.name}\u0000${tax.percent}`;
145
+ const current = rows.get(key);
146
+ if (current) {
147
+ current.taxableMinor += tax.taxableMinor;
148
+ current.taxMinor += tax.taxMinor;
149
+ } else rows.set(key, { ...tax });
150
+ }
151
+ return [...rows.values()];
152
+ }
153
+
154
+ function patchLine(
155
+ index: number,
156
+ patch: Partial<MoneyEditorProps['draft']['lines'][number]>,
157
+ ) {
158
+ lines[index] = { ...lines[index], ...patch };
159
+ }
160
+
161
+ function changeDiscount(index: number, event: Event) {
162
+ const discountType = (event.currentTarget as HTMLSelectElement)
163
+ .value as MoneyEditorProps['draft']['lines'][number]['discountType'];
164
+ patchLine(index, { discountType, discountValue: '' });
165
+ }
166
+
167
+ function changeTaxCode(index: number, event: Event) {
168
+ const taxCodeId = (event.currentTarget as HTMLSelectElement).value;
169
+ patchLine(index, {
170
+ taxCodeId: taxCodeId || null,
171
+ taxMode: taxCodeId ? 'override' : 'inherit',
172
+ });
173
+ }
174
+
175
+ function changeMode(event: Event) {
176
+ const next = (event.currentTarget as HTMLSelectElement)
177
+ .value as typeof lineAmountType;
178
+ if (next === lineAmountType) return;
179
+ if (
180
+ money.draft.lines.length > 0 &&
181
+ !modeConfirmed &&
182
+ typeof window !== 'undefined' &&
183
+ !window.confirm('Keep the prices as typed and recompute tax?')
184
+ ) {
185
+ (event.currentTarget as HTMLSelectElement).value = lineAmountType;
186
+ return;
187
+ }
188
+ modeConfirmed = true;
189
+ lineAmountType = next;
190
+ }
191
+ </script>
192
+
193
+ <section class="invoice-editor money-editor" aria-label={t(M['commerce.invoice_money.aria_label'])} data-smrt-component="MoneyInvoiceEditor" data-money-model="v2">
194
+ {#if frozen}
195
+ <p role="status">Frozen{money.status ? ` · ${money.status}` : ''}</p>
196
+ {#if money.kind !== 'credit_note'}
197
+ <Button
198
+ type="button"
199
+ disabled={!money.onCreateCreditNote}
200
+ title={money.onCreateCreditNote ? undefined : 'Credit notes are not available yet'}
201
+ onclick={money.onCreateCreditNote}
202
+ >{t(M['commerce.invoice_actions.create_credit_note'])}</Button>
203
+ {/if}
204
+ {/if}
205
+ {#if money.sellerTaxRegistrations?.length || money.partyTaxId}
206
+ <p class="tax-registrations">
207
+ {#each money.sellerTaxRegistrations ?? [] as registration}{registration}{#if money.partyTaxId || registration !== money.sellerTaxRegistrations?.at(-1)} · {/if}{/each}
208
+ {#if money.partyTaxId}{money.partyTaxId}{/if}
209
+ </p>
210
+ {/if}
211
+ <Form {action} {method} preventDefault={false} stagedReview={false} {onsubmit} aria-busy={pending}>
212
+ {#each hiddenFields as field}<Input type="hidden" name={field.name} value={field.value} interaction={false} />{/each}
213
+ <fieldset disabled={!editable || pending}>
214
+ <label>
215
+ {t(M['commerce.invoice_money.amounts_are'])}
216
+ <Select name={names.lineAmountType} value={lineAmountType} onchange={changeMode}>
217
+ <option value="exclusive">{t(M['commerce.invoice_money.tax_exclusive'])}</option>
218
+ <option value="inclusive">{t(M['commerce.invoice_money.tax_inclusive'])}</option>
219
+ <option value="none">{t(M['commerce.invoice_money.no_tax'])}</option>
220
+ </Select>
221
+ </label>
222
+ <Input type="hidden" name={names.roundingScope} value={money.draft.roundingScope} interaction={false} />
223
+ {#if money.customerTaxExempt && lineAmountType === 'inclusive'}<p>{t(M['commerce.invoice_money.exempt_inclusive'])}</p>{/if}
224
+ {#each lines as line, index (line.id)}
225
+ <fieldset class="money-line">
226
+ <legend>{t(M['commerce.invoice_money.line'], { number: index + 1 })}</legend>
227
+ <Input type="hidden" name={names.lineId} value={line.id} interaction={false} />
228
+ <label>Description <Input name={names.lineDescription} value={line.description} oninput={(event) => patchLine(index, { description: (event.currentTarget as HTMLInputElement).value })} /></label>
229
+ <label>Quantity <Input name={names.lineQuantity} value={line.quantity} inputmode="decimal" oninput={(event) => patchLine(index, { quantity: (event.currentTarget as HTMLInputElement).value })} /></label>
230
+ <label>{t(M['commerce.invoice_money.unit_price'])} <Input name={names.lineUnitPrice} value={line.unitPrice} inputmode="decimal" oninput={(event) => patchLine(index, { unitPrice: (event.currentTarget as HTMLInputElement).value })} /></label>
231
+ <label>{t(M['commerce.invoice_money.discount_type'])}
232
+ <Select name={names.lineDiscountType} value={line.discountType} onchange={(event) => changeDiscount(index, event)}>
233
+ <option value="none">None</option><option value="percent">%</option><option value="amount">$</option>
234
+ </Select>
235
+ </label>
236
+ <label>Discount <Input name={names.lineDiscountValue} value={line.discountValue} inputmode="decimal" oninput={(event) => patchLine(index, { discountValue: (event.currentTarget as HTMLInputElement).value })} /></label>
237
+ <label>{t(M['commerce.invoice_money.tax_code'])}
238
+ <Select name={names.lineTaxCodeId} value={line.taxMode === 'override' ? line.taxCodeId ?? '' : ''} onchange={(event) => changeTaxCode(index, event)}>
239
+ <option value="">{inheritedHint(line)}</option>
240
+ {#each money.taxCodes as code}<option value={code.id}>{code.code}</option>{/each}
241
+ </Select>
242
+ </label>
243
+ <Input type="hidden" name={names.lineTaxMode} value={line.taxMode} interaction={false} />
244
+ {#if money.customerTaxExempt && line.taxMode === 'override'}<p role="status">{t(M['commerce.invoice_money.exempt_override'])}</p>{/if}
245
+ </fieldset>
246
+ {/each}
247
+ </fieldset>
248
+ {#if editable}<Button type="submit" name={intentField} value={saveIntent} disabled={pending}>{saveLabel}</Button>{/if}
249
+ </Form>
250
+ {#if !totals}
251
+ <p role="alert">{calculation?.valid || frozen ? 'Stored totals are required for a frozen document.' : calculation?.message}</p>
252
+ {:else}
253
+ <dl class="summary" aria-live="polite">
254
+ {#if totals.lineAmountType !== 'inclusive' || totals.taxMinor === 0}
255
+ <div><dt>Subtotal</dt><dd><CurrencyDisplay amount={totals.subtotalMinor} currency={money.draft.currency} unit="cents" /></dd></div>
256
+ {/if}
257
+ {#if totals.discountTotalMinor !== 0}<div class="muted"><dt>{t(M['commerce.invoice_money.includes_discounts'])} <CurrencyDisplay amount={Math.abs(totals.discountTotalMinor)} currency={money.draft.currency} unit="cents" /></dt></div>{/if}
258
+ {#each groupedTaxes(totals.taxes).filter((tax) => tax.taxMinor !== 0) as tax (tax.id)}
259
+ <div class:muted={totals.lineAmountType === 'inclusive'}>
260
+ <dt>{totals.lineAmountType === 'inclusive' ? `Includes ${tax.name} ${tax.percent}% of` : `${tax.name} ${tax.percent}% on`} <CurrencyDisplay amount={totals.lineAmountType === 'inclusive' ? tax.taxMinor : tax.taxableMinor} currency={money.draft.currency} unit="cents" /></dt>
261
+ {#if totals.lineAmountType !== 'inclusive'}<dd><CurrencyDisplay amount={tax.taxMinor} currency={money.draft.currency} unit="cents" /></dd>{/if}
262
+ </div>
263
+ {/each}
264
+ {#if totals.roundingScope === 'document'}<div class="muted"><dt>{t(M['commerce.invoice_money.rounded_document'])}</dt></div>{/if}
265
+ <div class="total"><dt>Total</dt><dd><CurrencyDisplay amount={totals.totalMinor} currency={money.draft.currency} unit="cents" /></dd></div>
266
+ {#if totals.lineAmountType === 'inclusive' && totals.taxMinor !== 0 && money.showNetSubtotal}<div><dt>Subtotal (excl. tax)</dt><dd><CurrencyDisplay amount={totals.subtotalMinor} currency={money.draft.currency} unit="cents" /></dd></div>{/if}
267
+ </dl>
268
+ {/if}
269
+ </section>
270
+
271
+ <style>
272
+ @layer smrt.reset, smrt.structure, smrt.theme;
273
+ @layer smrt.theme {
274
+ .money-editor, .money-editor :global(.form), fieldset, .money-line { display: grid; gap: var(--smrt-spacing-3); min-width: 0; }
275
+ .money-editor { max-width: 48rem; overflow-wrap: anywhere; }
276
+ .summary { display: grid; gap: var(--smrt-spacing-2); }
277
+ .summary > div { display: flex; justify-content: space-between; gap: var(--smrt-spacing-4); }
278
+ .summary .muted { color: var(--smrt-color-on-surface-variant); font-size: var(--smrt-typography-body-small-size); }
279
+ .summary .total { border-top: var(--smrt-hairline-strong); padding-top: var(--smrt-spacing-2); font-weight: var(--smrt-typography-weight-semibold); }
280
+ dd { margin: 0; }
281
+ }
282
+ </style>
@@ -0,0 +1,31 @@
1
+ import type { HTMLFormAttributes } from 'svelte/elements';
2
+ import { type MoneyEditorProps } from '../invoices/money-editor.js';
3
+ export interface Props {
4
+ /** Native form action owned by the caller's invoice route. */
5
+ action: string;
6
+ /** Native HTTP method retained for progressive enhancement. */
7
+ method?: 'post' | 'get';
8
+ /** Typed v2 money draft, tax-code choices, and stored issued snapshot. */
9
+ money: MoneyEditorProps;
10
+ /** Presentation capability; the server remains the authority for writes. */
11
+ canEdit?: boolean;
12
+ /** Caller transport state that disables edits and the save submitter. */
13
+ pending?: boolean;
14
+ /** Caller-owned request identity and route fields submitted unchanged. */
15
+ hiddenFields?: readonly {
16
+ name: string;
17
+ value: string;
18
+ }[];
19
+ /** Native submitter field name expected by the caller. */
20
+ intentField?: string;
21
+ /** Submitter value that requests a draft save. */
22
+ saveIntent?: string;
23
+ /** Caller-visible label for the save submitter. */
24
+ saveLabel?: string;
25
+ /** Optional native form enhancement; omitted submissions stay native. */
26
+ onsubmit?: HTMLFormAttributes['onsubmit'];
27
+ }
28
+ declare const MoneyInvoiceEditor: import("svelte").Component<Props, {}, "">;
29
+ type MoneyInvoiceEditor = ReturnType<typeof MoneyInvoiceEditor>;
30
+ export default MoneyInvoiceEditor;
31
+ //# sourceMappingURL=MoneyInvoiceEditor.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoneyInvoiceEditor.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/MoneyInvoiceEditor.svelte.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,6BAA6B,CAAC;AAGrC,MAAM,WAAW,KAAK;IACpB,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACxB,0EAA0E;IAC1E,KAAK,EAAE,gBAAgB,CAAC;IACxB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,yEAAyE;IACzE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC1D,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,QAAQ,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC;CAC3C;AAoPD,QAAA,MAAM,kBAAkB,2CAAwC,CAAC;AACjE,KAAK,kBAAkB,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAChE,eAAe,kBAAkB,CAAC"}