@endora-commerce/mod-invoices 0.109.0 → 0.110.0

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 (71) hide show
  1. package/dist/admin/templates/invoice-puck-config.d.ts.map +1 -1
  2. package/dist/admin/templates/invoice-puck-config.js +220 -135
  3. package/dist/admin/templates/invoice-puck-config.js.map +1 -1
  4. package/dist/backend/entities/invoice-line.entity.d.ts +18 -1
  5. package/dist/backend/entities/invoice-line.entity.d.ts.map +1 -1
  6. package/dist/backend/entities/invoice-line.entity.js +20 -0
  7. package/dist/backend/entities/invoice-line.entity.js.map +1 -1
  8. package/dist/backend/index.d.ts.map +1 -1
  9. package/dist/backend/index.js +19 -3
  10. package/dist/backend/index.js.map +1 -1
  11. package/dist/backend/invoices-prose.d.ts +2 -0
  12. package/dist/backend/invoices-prose.d.ts.map +1 -1
  13. package/dist/backend/invoices-prose.js +2 -0
  14. package/dist/backend/invoices-prose.js.map +1 -1
  15. package/dist/backend/pdf-components/embed-logo-images.d.ts.map +1 -1
  16. package/dist/backend/pdf-components/embed-logo-images.js +2 -15
  17. package/dist/backend/pdf-components/embed-logo-images.js.map +1 -1
  18. package/dist/backend/pdf-components/sections.d.ts.map +1 -1
  19. package/dist/backend/pdf-components/sections.js +3 -1
  20. package/dist/backend/pdf-components/sections.js.map +1 -1
  21. package/dist/backend/plugin.d.ts.map +1 -1
  22. package/dist/backend/plugin.js +2 -1
  23. package/dist/backend/plugin.js.map +1 -1
  24. package/dist/backend/routes.customer.d.ts +3 -3
  25. package/dist/backend/routes.customer.d.ts.map +1 -1
  26. package/dist/backend/routes.customer.js +17 -9
  27. package/dist/backend/routes.customer.js.map +1 -1
  28. package/dist/backend/seeds/generic-invoice-template.d.ts +13 -7
  29. package/dist/backend/seeds/generic-invoice-template.d.ts.map +1 -1
  30. package/dist/backend/seeds/generic-invoice-template.js +34 -22
  31. package/dist/backend/seeds/generic-invoice-template.js.map +1 -1
  32. package/dist/backend/services/auto-issue-reactor.d.ts.map +1 -1
  33. package/dist/backend/services/auto-issue-reactor.js +6 -2
  34. package/dist/backend/services/auto-issue-reactor.js.map +1 -1
  35. package/dist/backend/services/corrective-invoice.d.ts +167 -16
  36. package/dist/backend/services/corrective-invoice.d.ts.map +1 -1
  37. package/dist/backend/services/corrective-invoice.js +389 -52
  38. package/dist/backend/services/corrective-invoice.js.map +1 -1
  39. package/dist/backend/services/invoice-copy-host.service.d.ts.map +1 -1
  40. package/dist/backend/services/invoice-copy-host.service.js +3 -0
  41. package/dist/backend/services/invoice-copy-host.service.js.map +1 -1
  42. package/dist/backend/services/invoice-line-builder.d.ts +4 -0
  43. package/dist/backend/services/invoice-line-builder.d.ts.map +1 -1
  44. package/dist/backend/services/invoice-line-builder.js +1 -0
  45. package/dist/backend/services/invoice-line-builder.js.map +1 -1
  46. package/dist/backend/services/invoice-service.d.ts +27 -4
  47. package/dist/backend/services/invoice-service.d.ts.map +1 -1
  48. package/dist/backend/services/invoice-service.js +69 -12
  49. package/dist/backend/services/invoice-service.js.map +1 -1
  50. package/dist/backend/services/kept-quantities.d.ts +24 -0
  51. package/dist/backend/services/kept-quantities.d.ts.map +1 -0
  52. package/dist/backend/services/kept-quantities.js +32 -0
  53. package/dist/backend/services/kept-quantities.js.map +1 -0
  54. package/dist/backend/services/order-returns-lock.d.ts +19 -0
  55. package/dist/backend/services/order-returns-lock.d.ts.map +1 -0
  56. package/dist/backend/services/order-returns-lock.js +37 -0
  57. package/dist/backend/services/order-returns-lock.js.map +1 -0
  58. package/dist/manifest.d.ts +9 -3
  59. package/dist/manifest.d.ts.map +1 -1
  60. package/dist/migrations/20261108T073244_invoices_invoice_line_kind.d.ts +21 -0
  61. package/dist/migrations/20261108T073244_invoices_invoice_line_kind.d.ts.map +1 -0
  62. package/dist/migrations/20261108T073244_invoices_invoice_line_kind.js +28 -0
  63. package/dist/migrations/20261108T073244_invoices_invoice_line_kind.js.map +1 -0
  64. package/dist/migrations/index.d.ts +2 -1
  65. package/dist/migrations/index.d.ts.map +1 -1
  66. package/dist/migrations/index.js +3 -1
  67. package/dist/migrations/index.js.map +1 -1
  68. package/docs/invoices.md +89 -3
  69. package/i18n/en.json +5 -2
  70. package/i18n/pl.json +5 -2
  71. package/package.json +15 -15
@@ -0,0 +1,32 @@
1
+ import { compareDecimals, moneyDifference, moneySum, roundHalfUp } from '@endora-commerce/contracts';
2
+ /**
3
+ * The order lines an invoice issued after a return lists, each with the
4
+ * quantity the buyer kept (issue #435, product-owner ruling of 2026-11-07):
5
+ * the ordered quantity less what settled returns took back, in the order's
6
+ * order. A line returned in full drops out. There is no invoice to correct
7
+ * before the first one is issued (#135), so the invoice itself documents the
8
+ * sale that is left.
9
+ */
10
+ export function keptOrderLines(items, returned) {
11
+ const back = new Map();
12
+ for (const r of returned)
13
+ back.set(r.orderItemId, (back.get(r.orderItemId) ?? 0) + r.quantity);
14
+ const kept = [];
15
+ for (const item of items) {
16
+ const quantity = item.quantity - (back.get(item.id) ?? 0);
17
+ if (quantity > 0)
18
+ kept.push({ item, quantity });
19
+ }
20
+ return kept;
21
+ }
22
+ /**
23
+ * The order-level discount an invoice issued after a return lists (issue #435,
24
+ * product-owner ruling Q3 of 2026-11-07): the order's discount less what the
25
+ * settled returns carried back, as they recorded it — the kept goods' share —
26
+ * at two places, and never below zero. `'0.00'` means the line is left off.
27
+ */
28
+ export function keptDiscount(orderDiscount, returned) {
29
+ const kept = moneyDifference(roundHalfUp(orderDiscount), moneySum(['0', ...returned.map((r) => r.discount)]));
30
+ return compareDecimals(kept, 0) > 0 ? kept : '0.00';
31
+ }
32
+ //# sourceMappingURL=kept-quantities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kept-quantities.js","sourceRoot":"","sources":["../../../src/backend/services/kept-quantities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAA8B,MAAM,4BAA4B,CAAC;AAEjI;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAmB,EACnB,QAA0C;IAE1C,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAC;IACvC,KAAK,MAAM,CAAC,IAAI,QAAQ;QAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC/F,MAAM,IAAI,GAAyC,EAAE,CAAC;IACtD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1D,IAAI,QAAQ,GAAG,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,aAA8B,EAAE,QAA0C;IACrG,MAAM,IAAI,GAAG,eAAe,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9G,OAAO,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;AACtD,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { EntityManager } from '@mikro-orm/postgresql';
2
+ /** Runs `body` while holding the order's returns lock. */
3
+ export interface OrderReturnsLock {
4
+ run<T>(orderId: string, body: () => Promise<T>): Promise<T>;
5
+ }
6
+ /**
7
+ * The order's returns lock, as `returns` takes it to create and to settle a
8
+ * case (`returnCaseOrderLockKey`, review of PR #865, F3), held on a connection
9
+ * of its own for the whole issuance — the reads of what came back and was
10
+ * refunded, and the invoice's own unit of work — the way the settlement holds
11
+ * it. A settlement records the resolution only after it has moved money and
12
+ * asked for a correction, which answers `not_due` while no invoice exists; an
13
+ * invoice issued in between would list every line and nothing would ever take
14
+ * the returned goods off. Issuing waits for it instead, and a settlement that
15
+ * starts afterwards waits for the invoice and corrects it. Waiting longer than
16
+ * {@link ISSUE_LOCK_TIMEOUT} is refused as retryable, with nothing issued.
17
+ */
18
+ export declare function createOrderReturnsLock(emFactory: () => EntityManager): OrderReturnsLock;
19
+ //# sourceMappingURL=order-returns-lock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-returns-lock.d.ts","sourceRoot":"","sources":["../../../src/backend/services/order-returns-lock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAS3D,0DAA0D;AAC1D,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAC7D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,aAAa,GAAG,gBAAgB,CAqBvF"}
@@ -0,0 +1,37 @@
1
+ import { ERROR_CODES, returnCaseOrderLockKey } from '@endora-commerce/contracts';
2
+ import { HttpError } from '@endora-commerce/platform/http';
3
+ /** How long issuing waits for a settlement of the same order. */
4
+ const ISSUE_LOCK_TIMEOUT = '15s';
5
+ /** PostgreSQL's `lock_not_available`, raised when `lock_timeout` elapses. */
6
+ const LOCK_NOT_AVAILABLE = '55P03';
7
+ /**
8
+ * The order's returns lock, as `returns` takes it to create and to settle a
9
+ * case (`returnCaseOrderLockKey`, review of PR #865, F3), held on a connection
10
+ * of its own for the whole issuance — the reads of what came back and was
11
+ * refunded, and the invoice's own unit of work — the way the settlement holds
12
+ * it. A settlement records the resolution only after it has moved money and
13
+ * asked for a correction, which answers `not_due` while no invoice exists; an
14
+ * invoice issued in between would list every line and nothing would ever take
15
+ * the returned goods off. Issuing waits for it instead, and a settlement that
16
+ * starts afterwards waits for the invoice and corrects it. Waiting longer than
17
+ * {@link ISSUE_LOCK_TIMEOUT} is refused as retryable, with nothing issued.
18
+ */
19
+ export function createOrderReturnsLock(emFactory) {
20
+ return {
21
+ run: (orderId, body) => emFactory()
22
+ .getKnex()
23
+ .transaction(async (lock) => {
24
+ await lock.raw(`set local lock_timeout = '${ISSUE_LOCK_TIMEOUT}'`);
25
+ try {
26
+ await lock.raw('select pg_advisory_xact_lock(hashtext(?))', [returnCaseOrderLockKey(orderId)]);
27
+ }
28
+ catch (err) {
29
+ if (err.code !== LOCK_NOT_AVAILABLE)
30
+ throw err;
31
+ throw new HttpError(409, ERROR_CODES.VERSION_CONFLICT, 'A return of this order is being settled. Try again in a moment.', { code: 'settlement_in_progress' });
32
+ }
33
+ return body();
34
+ }),
35
+ };
36
+ }
37
+ //# sourceMappingURL=order-returns-lock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-returns-lock.js","sourceRoot":"","sources":["../../../src/backend/services/order-returns-lock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,iEAAiE;AACjE,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACjC,6EAA6E;AAC7E,MAAM,kBAAkB,GAAG,OAAO,CAAC;AAOnC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,sBAAsB,CAAC,SAA8B;IACnE,OAAO;QACL,GAAG,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,CACrB,SAAS,EAAE;aACR,OAAO,EAAE;aACT,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAC1B,MAAM,IAAI,CAAC,GAAG,CAAC,6BAA6B,kBAAkB,GAAG,CAAC,CAAC;YACnE,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,GAAG,CAAC,2CAA2C,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACjG,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAK,GAAyB,CAAC,IAAI,KAAK,kBAAkB;oBAAE,MAAM,GAAG,CAAC;gBACtE,MAAM,IAAI,SAAS,CACjB,GAAG,EACH,WAAW,CAAC,gBAAgB,EAC5B,iEAAiE,EACjE,EAAE,IAAI,EAAE,wBAAwB,EAAE,CACnC,CAAC;YACJ,CAAC;YACD,OAAO,IAAI,EAAE,CAAC;QAChB,CAAC,CAAC;KACP,CAAC;AACJ,CAAC"}
@@ -120,6 +120,12 @@ export declare const manifest: {
120
120
  description?: string | undefined;
121
121
  requires?: string[] | undefined;
122
122
  }[] | undefined;
123
+ organizationPermissions?: {
124
+ code: string;
125
+ label: string;
126
+ description: string;
127
+ memberDefault: boolean;
128
+ }[] | undefined;
123
129
  transactionalEmails?: {
124
130
  code: string;
125
131
  name: string;
@@ -146,9 +152,9 @@ export declare const manifest: {
146
152
  name: string;
147
153
  labelKey: string;
148
154
  category: string;
149
- contexts: ("invoice" | "cms" | "email" | "newsletter" | "document")[];
155
+ contexts: ("invoice" | "email" | "cms" | "newsletter" | "document")[];
150
156
  fields: Record<string, {
151
- type: "number" | "object" | "array" | "uuid" | "text" | "external" | "textarea" | "select" | "radio" | "richtext";
157
+ type: "number" | "object" | "array" | "text" | "external" | "select" | "uuid" | "textarea" | "radio" | "richtext";
152
158
  label?: string | undefined;
153
159
  required?: boolean | undefined;
154
160
  options?: {
@@ -170,7 +176,7 @@ export declare const manifest: {
170
176
  blockCategories?: {
171
177
  key: string;
172
178
  titleKey: string;
173
- contexts: ("invoice" | "cms" | "email" | "newsletter" | "document")[];
179
+ contexts: ("invoice" | "email" | "cms" | "newsletter" | "document")[];
174
180
  weight?: number | undefined;
175
181
  visible?: boolean | undefined;
176
182
  }[] | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;CAUzB,CAAC;AAEX,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;CA8HnC,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsSnB,CAAC"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;CAUzB,CAAC;AAEX,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;CA8HnC,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsSnB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { Migration } from '@mikro-orm/migrations';
2
+ /**
3
+ * Issue #904, Phase A — `invoice_lines.line_kind`: what a line is, one of
4
+ * `goods`, `delivery`, `payment_surcharge`, `discount` or `price_reduction`.
5
+ *
6
+ * A charge line used to be told apart from the discount line by having no
7
+ * `order_item_id` and by its sign. Once delivery and the payment surcharge
8
+ * carry the goods' VAT, a charge line sits inside a goods rate's row, and the
9
+ * per-rate maths of a correction has to tell it from a goods line at the same
10
+ * rate: the kind has to be stated, not inferred.
11
+ *
12
+ * Written for every line of an invoice or a proforma issued from now on, the
13
+ * 0 % charge lines included. Nullable, no backfill: `null` is a line issued
14
+ * before (or a line no writer has named yet), read by the inference it always
15
+ * was — an issued document is never rewritten.
16
+ */
17
+ export declare class Migration20261108T073244InvoicesInvoiceLineKind extends Migration {
18
+ up(): Promise<void>;
19
+ down(): Promise<void>;
20
+ }
21
+ //# sourceMappingURL=20261108T073244_invoices_invoice_line_kind.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20261108T073244_invoices_invoice_line_kind.d.ts","sourceRoot":"","sources":["../../src/migrations/20261108T073244_invoices_invoice_line_kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,+CAAgD,SAAQ,SAAS;IAC7D,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAQnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAIrC"}
@@ -0,0 +1,28 @@
1
+ import { Migration } from '@mikro-orm/migrations';
2
+ /**
3
+ * Issue #904, Phase A — `invoice_lines.line_kind`: what a line is, one of
4
+ * `goods`, `delivery`, `payment_surcharge`, `discount` or `price_reduction`.
5
+ *
6
+ * A charge line used to be told apart from the discount line by having no
7
+ * `order_item_id` and by its sign. Once delivery and the payment surcharge
8
+ * carry the goods' VAT, a charge line sits inside a goods rate's row, and the
9
+ * per-rate maths of a correction has to tell it from a goods line at the same
10
+ * rate: the kind has to be stated, not inferred.
11
+ *
12
+ * Written for every line of an invoice or a proforma issued from now on, the
13
+ * 0 % charge lines included. Nullable, no backfill: `null` is a line issued
14
+ * before (or a line no writer has named yet), read by the inference it always
15
+ * was — an issued document is never rewritten.
16
+ */
17
+ export class Migration20261108T073244InvoicesInvoiceLineKind extends Migration {
18
+ async up() {
19
+ this.addSql('alter table "invoice_lines" add column if not exists "line_kind" varchar(24) null;');
20
+ this.addSql('alter table "invoice_lines" drop constraint if exists "invoice_lines_line_kind_check";');
21
+ this.addSql(`alter table "invoice_lines" add constraint "invoice_lines_line_kind_check" check ("line_kind" is null or "line_kind" in ('goods', 'delivery', 'payment_surcharge', 'discount', 'price_reduction'));`);
22
+ }
23
+ async down() {
24
+ this.addSql('alter table "invoice_lines" drop constraint if exists "invoice_lines_line_kind_check";');
25
+ this.addSql('alter table "invoice_lines" drop column if exists "line_kind";');
26
+ }
27
+ }
28
+ //# sourceMappingURL=20261108T073244_invoices_invoice_line_kind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"20261108T073244_invoices_invoice_line_kind.js","sourceRoot":"","sources":["../../src/migrations/20261108T073244_invoices_invoice_line_kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,+CAAgD,SAAQ,SAAS;IACnE,KAAK,CAAC,EAAE;QACf,IAAI,CAAC,MAAM,CAAC,oFAAoF,CAAC,CAAC;QAClG,IAAI,CAAC,MAAM,CAAC,wFAAwF,CAAC,CAAC;QACtG,IAAI,CAAC,MAAM,CACT,qMAAqM,CACtM,CAAC;IACJ,CAAC;IAEQ,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,MAAM,CAAC,wFAAwF,CAAC,CAAC;QACtG,IAAI,CAAC,MAAM,CAAC,gEAAgE,CAAC,CAAC;IAChF,CAAC;CACF"}
@@ -29,6 +29,7 @@ import { Migration20260914T133603InvoicesErpImportedSaleDocuments } from './2026
29
29
  import { Migration20260926T230239InvoicesImportIdentity } from './20260926T230239_invoices_import_identity.js';
30
30
  import { Migration20261017T075839InvoicesDropInvoiceTemplates } from './20261017T075839_invoices_drop_invoice_templates.js';
31
31
  import { Migration20261024T145631InvoicesVatSummary } from './20261024T145631_invoices_vat_summary.js';
32
+ import { Migration20261108T073244InvoicesInvoiceLineKind } from './20261108T073244_invoices_invoice_line_kind.js';
32
33
  export declare const migrations: (typeof Migration20260629T125121InvoicesModule)[];
33
- export { Migration20260629T125121InvoicesModule, Migration20260801T111000InvoicesGenericTemplateReseed, Migration20260817T201110InvoicesCorrectionIdempotencyKey, Migration20260903T101756InvoicesNamespaceBlockNames, Migration20260914T133603InvoicesErpImportedSaleDocuments, Migration20260926T230239InvoicesImportIdentity, Migration20261017T075839InvoicesDropInvoiceTemplates, Migration20261024T145631InvoicesVatSummary, };
34
+ export { Migration20260629T125121InvoicesModule, Migration20260801T111000InvoicesGenericTemplateReseed, Migration20260817T201110InvoicesCorrectionIdempotencyKey, Migration20260903T101756InvoicesNamespaceBlockNames, Migration20260914T133603InvoicesErpImportedSaleDocuments, Migration20260926T230239InvoicesImportIdentity, Migration20261017T075839InvoicesDropInvoiceTemplates, Migration20261024T145631InvoicesVatSummary, Migration20261108T073244InvoicesInvoiceLineKind, };
34
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qDAAqD,EAAE,MAAM,uDAAuD,CAAC;AAC9H,OAAO,EAAE,wDAAwD,EAAE,MAAM,0DAA0D,CAAC;AACpI,OAAO,EAAE,mDAAmD,EAAE,MAAM,qDAAqD,CAAC;AAC1H,OAAO,EAAE,wDAAwD,EAAE,MAAM,2DAA2D,CAAC;AACrI,OAAO,EAAE,8CAA8C,EAAE,MAAM,+CAA+C,CAAC;AAC/G,OAAO,EAAE,oDAAoD,EAAE,MAAM,sDAAsD,CAAC;AAC5H,OAAO,EAAE,0CAA0C,EAAE,MAAM,2CAA2C,CAAC;AAEvG,eAAO,MAAM,UAAU,mDAStB,CAAC;AAEF,OAAO,EACL,sCAAsC,EACtC,qDAAqD,EACrD,wDAAwD,EACxD,mDAAmD,EACnD,wDAAwD,EACxD,8CAA8C,EAC9C,oDAAoD,EACpD,0CAA0C,GAC3C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qDAAqD,EAAE,MAAM,uDAAuD,CAAC;AAC9H,OAAO,EAAE,wDAAwD,EAAE,MAAM,0DAA0D,CAAC;AACpI,OAAO,EAAE,mDAAmD,EAAE,MAAM,qDAAqD,CAAC;AAC1H,OAAO,EAAE,wDAAwD,EAAE,MAAM,2DAA2D,CAAC;AACrI,OAAO,EAAE,8CAA8C,EAAE,MAAM,+CAA+C,CAAC;AAC/G,OAAO,EAAE,oDAAoD,EAAE,MAAM,sDAAsD,CAAC;AAC5H,OAAO,EAAE,0CAA0C,EAAE,MAAM,2CAA2C,CAAC;AACvG,OAAO,EAAE,+CAA+C,EAAE,MAAM,iDAAiD,CAAC;AAElH,eAAO,MAAM,UAAU,mDAUtB,CAAC;AAEF,OAAO,EACL,sCAAsC,EACtC,qDAAqD,EACrD,wDAAwD,EACxD,mDAAmD,EACnD,wDAAwD,EACxD,8CAA8C,EAC9C,oDAAoD,EACpD,0CAA0C,EAC1C,+CAA+C,GAChD,CAAC"}
@@ -29,6 +29,7 @@ import { Migration20260914T133603InvoicesErpImportedSaleDocuments } from './2026
29
29
  import { Migration20260926T230239InvoicesImportIdentity } from './20260926T230239_invoices_import_identity.js';
30
30
  import { Migration20261017T075839InvoicesDropInvoiceTemplates } from './20261017T075839_invoices_drop_invoice_templates.js';
31
31
  import { Migration20261024T145631InvoicesVatSummary } from './20261024T145631_invoices_vat_summary.js';
32
+ import { Migration20261108T073244InvoicesInvoiceLineKind } from './20261108T073244_invoices_invoice_line_kind.js';
32
33
  export const migrations = [
33
34
  Migration20260629T125121InvoicesModule,
34
35
  Migration20260801T111000InvoicesGenericTemplateReseed,
@@ -38,6 +39,7 @@ export const migrations = [
38
39
  Migration20260926T230239InvoicesImportIdentity,
39
40
  Migration20261017T075839InvoicesDropInvoiceTemplates,
40
41
  Migration20261024T145631InvoicesVatSummary,
42
+ Migration20261108T073244InvoicesInvoiceLineKind,
41
43
  ];
42
- export { Migration20260629T125121InvoicesModule, Migration20260801T111000InvoicesGenericTemplateReseed, Migration20260817T201110InvoicesCorrectionIdempotencyKey, Migration20260903T101756InvoicesNamespaceBlockNames, Migration20260914T133603InvoicesErpImportedSaleDocuments, Migration20260926T230239InvoicesImportIdentity, Migration20261017T075839InvoicesDropInvoiceTemplates, Migration20261024T145631InvoicesVatSummary, };
44
+ export { Migration20260629T125121InvoicesModule, Migration20260801T111000InvoicesGenericTemplateReseed, Migration20260817T201110InvoicesCorrectionIdempotencyKey, Migration20260903T101756InvoicesNamespaceBlockNames, Migration20260914T133603InvoicesErpImportedSaleDocuments, Migration20260926T230239InvoicesImportIdentity, Migration20261017T075839InvoicesDropInvoiceTemplates, Migration20261024T145631InvoicesVatSummary, Migration20261108T073244InvoicesInvoiceLineKind, };
43
45
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qDAAqD,EAAE,MAAM,uDAAuD,CAAC;AAC9H,OAAO,EAAE,wDAAwD,EAAE,MAAM,0DAA0D,CAAC;AACpI,OAAO,EAAE,mDAAmD,EAAE,MAAM,qDAAqD,CAAC;AAC1H,OAAO,EAAE,wDAAwD,EAAE,MAAM,2DAA2D,CAAC;AACrI,OAAO,EAAE,8CAA8C,EAAE,MAAM,+CAA+C,CAAC;AAC/G,OAAO,EAAE,oDAAoD,EAAE,MAAM,sDAAsD,CAAC;AAC5H,OAAO,EAAE,0CAA0C,EAAE,MAAM,2CAA2C,CAAC;AAEvG,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,sCAAsC;IACtC,qDAAqD;IACrD,wDAAwD;IACxD,mDAAmD;IACnD,wDAAwD;IACxD,8CAA8C;IAC9C,oDAAoD;IACpD,0CAA0C;CAC3C,CAAC;AAEF,OAAO,EACL,sCAAsC,EACtC,qDAAqD,EACrD,wDAAwD,EACxD,mDAAmD,EACnD,wDAAwD,EACxD,8CAA8C,EAC9C,oDAAoD,EACpD,0CAA0C,GAC3C,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qDAAqD,EAAE,MAAM,uDAAuD,CAAC;AAC9H,OAAO,EAAE,wDAAwD,EAAE,MAAM,0DAA0D,CAAC;AACpI,OAAO,EAAE,mDAAmD,EAAE,MAAM,qDAAqD,CAAC;AAC1H,OAAO,EAAE,wDAAwD,EAAE,MAAM,2DAA2D,CAAC;AACrI,OAAO,EAAE,8CAA8C,EAAE,MAAM,+CAA+C,CAAC;AAC/G,OAAO,EAAE,oDAAoD,EAAE,MAAM,sDAAsD,CAAC;AAC5H,OAAO,EAAE,0CAA0C,EAAE,MAAM,2CAA2C,CAAC;AACvG,OAAO,EAAE,+CAA+C,EAAE,MAAM,iDAAiD,CAAC;AAElH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,sCAAsC;IACtC,qDAAqD;IACrD,wDAAwD;IACxD,mDAAmD;IACnD,wDAAwD;IACxD,8CAA8C;IAC9C,oDAAoD;IACpD,0CAA0C;IAC1C,+CAA+C;CAChD,CAAC;AAEF,OAAO,EACL,sCAAsC,EACtC,qDAAqD,EACrD,wDAAwD,EACxD,mDAAmD,EACnD,wDAAwD,EACxD,8CAA8C,EAC9C,oDAAoD,EACpD,0CAA0C,EAC1C,+CAA+C,GAChD,CAAC"}
package/docs/invoices.md CHANGED
@@ -1,9 +1,9 @@
1
1
  ---
2
- title: invoices
2
+ title: Invoices
3
3
  description: PDF invoice / proforma generation + asset linkage
4
4
  ---
5
5
 
6
- # `invoices`
6
+ # Invoices (`invoices`)
7
7
 
8
8
  Generates proforma and final invoice PDFs, registers them under the
9
9
  `assets` module, and links them from the originating Order.
@@ -62,7 +62,83 @@ An order **refunded in full before it was invoiced** — the refunds equal what
62
62
  was received and cover the whole order total — is not invoiced: there is no
63
63
  sale left to document. Issuing answers `422 INVOICE_ORDER_REFUNDED` and draws
64
64
  no number; automatic issuance skips the order and logs the reason. An order
65
- refunded only in part is invoiced, with what was kept as paid.
65
+ refunded only in part is invoiced, with what was kept as paid. An order
66
+ **returned in full** before it was invoiced — every product line back through
67
+ settled returns, and no delivery or payment surcharge kept — counts the same,
68
+ whether or not the refund has been paid out yet (one still waiting for a person
69
+ to make it, or for the payment gateway to confirm it). When the delivery or the
70
+ surcharge is kept, the invoice is issued with only that line. A consumer's
71
+ withdrawal from the whole order refunds both (see *Returns*), so a B2C order
72
+ returned in full usually has nothing left and is refused. A delivery the
73
+ operator reduced to the standard price leaves the difference, which is invoiced
74
+ alone.
75
+
76
+ An invoice issued **after a return was settled** lists only what the buyer
77
+ kept: there is no invoice yet to correct, so the invoice itself documents the
78
+ sale that is left. Each order line is invoiced at its ordered quantity less the
79
+ quantity of the order's settled returns (kind *return*, settled with a refund or
80
+ a credit), whether or not the money has been paid out yet; a line returned in
81
+ full is left off. A replacement, a repair and a complaint change no line. The
82
+ delivery and payment-surcharge lines are the order's, less what a consumer's
83
+ withdrawal refunded of them; a line with nothing left is left off. The discount line carries
84
+ only the kept goods' share: the order discount less the part the settled returns
85
+ carried back with their refunds, and it is left off when nothing remains. VAT is
86
+ still calculated per rate on the sum of the nets, so the invoice equals what is
87
+ left paid to the cent. A proforma lists the same kept lines, and is not refused
88
+ for an order refunded in full. With the `returns` module switched off, every
89
+ line is invoiced at its ordered quantity.
90
+
91
+ A **complaint refunded before the order was invoiced** currently shows on the
92
+ invoice as amount due: the invoice lists the goods in full, and the complaint
93
+ refund is deducted from what was paid.
94
+
95
+ ### Corrective invoices
96
+
97
+ A return or a complaint settled with a refund or a credit **after** the order
98
+ was invoiced gets a corrective invoice (`kind: correction`), one per case. It
99
+ credits gross amounts, at the VAT rate of the invoice line it corrects, and never
100
+ more than is left of the invoice. A replacement or a repair moves no money and
101
+ issues no correction.
102
+
103
+ **A return** credits the goods that came back. On an invoice issued under the
104
+ per-rate VAT method, the correction is worked out from what the invoice keeps:
105
+
106
+ - When the case refunds its default amount, the invoice keeps, at each rate,
107
+ exactly the VAT on the sum of the nets of the kept quantities: the same
108
+ figures an invoice issued after the return would show. For example, returning
109
+ one unit of 3 × 10.01 net at 23 % (36.94 gross) refunds 12.32, and the
110
+ correction credits 10.01 net and 2.31 VAT, which leaves 20.02 net and 4.60 VAT.
111
+ - When the operator approved a lower amount, the invoice keeps the rest of the
112
+ gross at that rate, split into net and VAT by the same rule. For a few amounts
113
+ no net gives that gross exactly (6.00 of 12.32 at 23 %, for example). The
114
+ correction itself then follows the rule, and what the invoice keeps may differ
115
+ from it by 0.01 at that rate until the next correction. The money is always
116
+ exact.
117
+ - The share of the order discount that the returned goods carried is credited
118
+ back on a 0 % line.
119
+ - The delivery and the payment surcharge are credited only on a consumer's
120
+ withdrawal: the return that completes the withdrawal from a B2C order. Each is
121
+ credited on a line of its own (`lineKind` `delivery` or `payment_surcharge`),
122
+ named like the invoice's line and at its VAT rate (0 % today), for the amount
123
+ the settlement refunded. After a full withdrawal the invoice nets to zero. A
124
+ correction that would credit more of a charge than the invoice still charges
125
+ for it is refused with `422 VALIDATION_FAILED`
126
+ (`code: correction_exceeds_charge_remaining`), before any money moves.
127
+ Business customers' returns never credit them.
128
+
129
+ **A complaint** settled with money is a **price reduction**: the buyer keeps the
130
+ goods, so their price is reduced and no quantity comes back. The correction's
131
+ line is named *Obniżka ceny (reklamacja RMA-…): product* and has quantity 0. Its
132
+ net value is the reduction, and its unit price is the reduction spread over the
133
+ units still on the invoice. It credits no discount, because the discount stays
134
+ with the kept goods, and it does not lower the quantity a later return of the
135
+ same line is credited from. For an integration that reads correction lines: a
136
+ goods line with quantity 0 is a price reduction.
137
+
138
+ A correction that would credit more goods at one VAT rate than the invoice still
139
+ charges at that rate is refused with
140
+ `422 VALIDATION_FAILED` (`code: correction_exceeds_rate_remaining`), before any
141
+ money moves.
66
142
 
67
143
  The **amount due** is the gross less what was paid, and never negative. When
68
144
  more was paid than the gross, the amount due is 0 and the invoice states the
@@ -75,6 +151,16 @@ setting of the totals block, and the row can be hidden there).
75
151
  `Invoice` (number, issued/dated timestamps, asset reference,
76
152
  `type ∈ {proforma, final}`).
77
153
 
154
+ `InvoiceLine` (an immutable snapshot of one line at issuance). Its `lineKind`
155
+ says what the line is: `goods`, `delivery`, `payment_surcharge` or `discount`
156
+ on an invoice or a proforma, with `price_reduction` reserved for a
157
+ correction's line. Every line of a document issued from this release records
158
+ it, the 0 % delivery and surcharge lines included; it changes no amount. A line
159
+ issued before, and a correction's goods and discount lines, carry `null` and are
160
+ told apart as before, by whether they name an order line and by their sign. A
161
+ correction's credited delivery or surcharge carries `delivery` or
162
+ `payment_surcharge`.
163
+
78
164
  ## Numbering
79
165
 
80
166
  Two facts about an invoice number pull in opposite directions, and both are
package/i18n/en.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "errors.INVOICE_NUMBER_PATTERN_COLLIDES": "This numbering pattern can produce the same document number as another sales channel. Invoice numbers must be unique across the whole platform.",
16
16
  "errors.INVOICE_NUMBER_PATTERN_COLLIDES.other_channel": "This numbering pattern can produce the same document number as sales channel \"{channel}\". Invoice numbers are unique across the whole platform, so give this channel a pattern the other one cannot repeat — adding the channel token is the usual way.",
17
17
  "errors.INVOICE_NUMBER_PATTERN_COLLIDES.no_sequence_token": "This numbering pattern has no sequence token, so every document in this channel would be given the same number. The field description lists the tokens you can use.",
18
- "errors.INVOICE_ORDER_REFUNDED": "This order's payments were refunded in full before it was invoiced, so there is no sale left to invoice. Nothing was issued.",
18
+ "errors.INVOICE_ORDER_REFUNDED": "This order was refunded or returned in full before it was invoiced, so there is no sale left to invoice. Nothing was issued.",
19
19
  "errors.INVOICE_NUMBER_ALREADY_ISSUED": "This document number is already in use. Invoice numbers are unique across the whole platform.",
20
20
  "errors.INVOICE_NUMBER_ALREADY_ISSUED.other_channel": "Invoice number {number} is already used by sales channel \"{channel}\". Give this channel its own numbering pattern before issuing again — nothing was issued.",
21
21
  "errors.INVOICE_NUMBER_ALREADY_ISSUED.same_channel": "Invoice number {number} has already been issued in this sales channel, so its numbering pattern is producing repeats — nothing was issued.",
@@ -78,5 +78,8 @@
78
78
  "lines.delivery": "Delivery",
79
79
  "lines.paymentSurcharge": "Payment method surcharge",
80
80
  "lines.discount": "Discount",
81
- "actions.openInvoices.keywords": "invoices"
81
+ "lines.priceReduction": "Price reduction (complaint {rma}): {product}",
82
+ "lines.priceReductionUnreferenced": "Price reduction (complaint): {product}",
83
+ "actions.openInvoices.keywords": "invoices",
84
+ "settingGroups.invoices.name": "Invoices"
82
85
  }
package/i18n/pl.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "errors.INVOICE_NUMBER_PATTERN_COLLIDES": "Ten wzorzec numeracji może wygenerować taki sam numer dokumentu jak inny kanał sprzedaży. Numery faktur muszą być unikalne w całej platformie.",
16
16
  "errors.INVOICE_NUMBER_PATTERN_COLLIDES.other_channel": "Ten wzorzec numeracji może wygenerować taki sam numer dokumentu jak kanał sprzedaży \"{channel}\". Numery faktur są unikalne w całej platformie, więc nadaj temu kanałowi wzorzec, którego tamten nie może powtórzyć — zwykle wystarczy dodać token kanału.",
17
17
  "errors.INVOICE_NUMBER_PATTERN_COLLIDES.no_sequence_token": "Ten wzorzec numeracji nie zawiera tokenu sekwencji, więc każdy dokument w tym kanale otrzymałby ten sam numer. Dostępne tokeny są wymienione w opisie pola.",
18
- "errors.INVOICE_ORDER_REFUNDED": "Płatności za to zamówienie zostały w całości zwrócone przed wystawieniem faktury, więc nie ma sprzedaży do zafakturowania. Niczego nie wystawiono.",
18
+ "errors.INVOICE_ORDER_REFUNDED": "Za to zamówienie w całości zwrócono pieniądze lub towary przed wystawieniem faktury, więc nie ma sprzedaży do zafakturowania. Niczego nie wystawiono.",
19
19
  "errors.INVOICE_NUMBER_ALREADY_ISSUED": "Ten numer dokumentu jest już zajęty. Numery faktur są unikalne w całej platformie.",
20
20
  "errors.INVOICE_NUMBER_ALREADY_ISSUED.other_channel": "Numer faktury {number} jest już używany przez kanał sprzedaży \"{channel}\". Nadaj temu kanałowi własny wzorzec numeracji przed ponowną próbą — nic nie zostało wystawione.",
21
21
  "errors.INVOICE_NUMBER_ALREADY_ISSUED.same_channel": "Numer faktury {number} został już wystawiony w tym kanale sprzedaży, więc jego wzorzec numeracji generuje powtórzenia — nic nie zostało wystawione.",
@@ -78,5 +78,8 @@
78
78
  "lines.delivery": "Dostawa",
79
79
  "lines.paymentSurcharge": "Dopłata za metodę płatności",
80
80
  "lines.discount": "Rabat",
81
- "actions.openInvoices.keywords": "faktury"
81
+ "lines.priceReduction": "Obniżka ceny (reklamacja {rma}): {product}",
82
+ "lines.priceReductionUnreferenced": "Obniżka ceny (reklamacja): {product}",
83
+ "actions.openInvoices.keywords": "faktury",
84
+ "settingGroups.invoices.name": "Faktury"
82
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@endora-commerce/mod-invoices",
3
- "version": "0.109.0",
3
+ "version": "0.110.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Invoice generation, numbering, PDF templates, corrections, and email delivery.",
@@ -62,12 +62,12 @@
62
62
  "react": "^19",
63
63
  "react-router-dom": "^7",
64
64
  "zod": "^4",
65
- "@endora-commerce/admin-kit": "0.109.0",
66
- "@endora-commerce/contracts": "0.109.0",
67
- "@endora-commerce/email-components": "0.109.0",
68
- "@endora-commerce/page-builder-admin": "0.109.0",
69
- "@endora-commerce/page-builder-core": "0.109.0",
70
- "@endora-commerce/platform": "0.109.0"
65
+ "@endora-commerce/admin-kit": "0.110.0",
66
+ "@endora-commerce/contracts": "0.110.0",
67
+ "@endora-commerce/email-components": "0.110.0",
68
+ "@endora-commerce/page-builder-admin": "0.110.0",
69
+ "@endora-commerce/page-builder-core": "0.110.0",
70
+ "@endora-commerce/platform": "0.110.0"
71
71
  },
72
72
  "peerDependenciesMeta": {
73
73
  "@endora-commerce/admin-kit": {
@@ -98,20 +98,20 @@
98
98
  "@types/node": "^22.9.0",
99
99
  "@types/pdfmake": "^0.3.2",
100
100
  "@types/react": "^19.2.14",
101
- "fastify": "^5.12.5",
101
+ "fastify": "^5.12.8",
102
102
  "lucide-react": "^1.11.0",
103
103
  "pdfmake": "^0.3.7",
104
104
  "react": "^19.2.5",
105
105
  "react-router-dom": "^7.18.2",
106
106
  "typescript": "^5.9.3",
107
- "vitest": "^4.1.11",
107
+ "vitest": "^4.1.12",
108
108
  "zod": "^4.2.0",
109
- "@endora-commerce/admin-kit": "0.109.0",
110
- "@endora-commerce/contracts": "0.109.0",
111
- "@endora-commerce/email-components": "0.109.0",
112
- "@endora-commerce/page-builder-admin": "0.109.0",
113
- "@endora-commerce/page-builder-core": "0.109.0",
114
- "@endora-commerce/platform": "0.109.0"
109
+ "@endora-commerce/admin-kit": "0.110.0",
110
+ "@endora-commerce/contracts": "0.110.0",
111
+ "@endora-commerce/email-components": "0.110.0",
112
+ "@endora-commerce/page-builder-admin": "0.110.0",
113
+ "@endora-commerce/page-builder-core": "0.110.0",
114
+ "@endora-commerce/platform": "0.110.0"
115
115
  },
116
116
  "scripts": {
117
117
  "build": "node ../../../scripts/clean-package-dist.mjs --src src --out dist && tsc -p tsconfig.build.json && tsc -p tsconfig.ui.build.json",