@tesouro/embedded-components-react 0.4.5 → 0.4.6

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 (40) hide show
  1. package/README.md +37 -37
  2. package/dist/index.d.ts +14 -8
  3. package/dist/lib/CreditCardsWidget.d.ts +4 -2
  4. package/dist/lib/DebitCardsWidget.d.ts +4 -2
  5. package/dist/lib/WidgetSuite.d.ts +14 -8
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +4 -4
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +72 -56
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +77 -48
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +47 -91
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +91 -33
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +33 -167
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +168 -75
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +75 -21
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +23 -210
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +199 -203
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +198 -89
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +105 -13
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +12 -47
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +47 -31
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +27 -198
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +198 -30
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +30 -234
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +240 -19
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +19 -342
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +344 -4
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +4 -33
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +32 -83
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +24 -24
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +1 -1
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +2 -2
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +2 -0
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +28 -3
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +2 -0
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +152 -131
  35. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +84 -87
  36. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/labels.js +0 -1
  37. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  38. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js +2 -2
  39. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index9.js +12 -10
  40. package/package.json +1 -1
package/README.md CHANGED
@@ -265,23 +265,23 @@ One page of an organization's **credit** cards, with a scope-gated "Show my card
265
265
 
266
266
  #### Props
267
267
 
268
- | Prop | Type | Default | Description |
269
- | --------------------------- | --------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
270
- | `pagination` | `{ paginationToken?, pageSize? }` | `undefined` | Controlled cursor and page size. Supply with `onPaginationChange` when your app owns the list position. |
271
- | `defaultPagination` | `{ paginationToken?, pageSize? }` | First page, 10 | Initial cursor and page size when uncontrolled. Ignored when `pagination` is supplied. |
272
- | `onPaginationChange` | `(pagination: CardsPagination) => void` | `undefined` | Called whenever the widget moves page or changes page size. Persist the whole object, not the token alone. |
273
- | `labels` | `PartialDeep<CardsLabels>` | English labels | Overrides the copy of the list screen, including the details sheet's screen-reader name under `detailsSheet`. Nested groups merge per group. |
274
- | `featureLabels` | `PartialDeep<CardsFeatureLabels>` | English labels | Overrides the copy this widget resolves rather than passes through — status and form-factor vocabulary, the empty-cell placeholder, and name fallbacks. |
275
- | `selectedCardId` | `string \| null` | `undefined` | Controlled selection of the card whose details panel is open. `null` closes it; omit for uncontrolled. See **Selection** below. |
276
- | `defaultSelectedCardId` | `string \| null` | `undefined` | Initial selection when uncontrolled. Ignored when `selectedCardId` is supplied. |
277
- | `onSelectedCardIdChange` | `(cardId: string \| null) => void` | `undefined` | Fires whenever the open card changes, including on close (`null`). Supplying it does **not** change what renders. |
278
- | `cardDetailsLabels` | `PartialDeep<CardDetailsWidgetLabels>` | English labels | Label overrides forwarded into the details panel. |
279
- | `cardDetailsFeatureLabels` | `PartialDeep<CardDetailsFeatureLabels>` | English labels | Overrides for the copy the panel's feature layer resolves — status vocabulary, form-factor copy, program label, copy-success toast. Distinct from `featureLabels`. |
280
- | `cardDetailsActivateLabels` | `PartialDeep<ActivateCardPanelLabels>` | English labels | Overrides for the Activate Card form the details panel opens — its heading, the two field labels, and its validation and status copy. |
281
- | `bankLogoSrc` | `string` | `undefined` | Bank logo for the details panel's card face. Omit and the face renders without a logo rather than with a placeholder. |
282
- | `bankLogoAlt` | `string` | `undefined` | Alt text for `bankLogoSrc`. |
283
- | `onCreateCard` | `() => void` | `undefined` | Host-owned Create card handler. Required for the button to render at all. See **Create card** below. |
284
- | `onActivateCard` | `(cardId: string) => void` | `undefined` | Called when a row's Activate button is clicked. Omit it and the button is not rendered. |
268
+ | Prop | Type | Default | Description |
269
+ | --------------------------- | --------------------------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
270
+ | `pagination` | `{ paginationToken?, pageSize? }` | `undefined` | Controlled cursor and page size. Supply with `onPaginationChange` when your app owns the list position. |
271
+ | `defaultPagination` | `{ paginationToken?, pageSize? }` | First page, 10 | Initial cursor and page size when uncontrolled. Ignored when `pagination` is supplied. |
272
+ | `onPaginationChange` | `(pagination: CardsPagination) => void` | `undefined` | Called whenever the widget moves page or changes page size. Persist the whole object, not the token alone. |
273
+ | `labels` | `PartialDeep<CardsLabels>` | English labels | Overrides the copy of the list screen — its controls, columns, states, and the details sheet's screen-reader name under `detailsSheet`. Nested groups merge per group. |
274
+ | `featureLabels` | `PartialDeep<CardsFeatureLabels>` | English labels | Overrides the copy this widget resolves rather than passes through — status and form-factor vocabulary, the empty-cell placeholder, and name fallbacks. |
275
+ | `selectedCardId` | `string \| null` | `undefined` | Controlled selection of the card whose details panel is open. `null` closes it; omit for uncontrolled. See **Selection** below. |
276
+ | `defaultSelectedCardId` | `string \| null` | `undefined` | Initial selection when uncontrolled. Ignored when `selectedCardId` is supplied. |
277
+ | `onSelectedCardIdChange` | `(cardId: string \| null) => void` | `undefined` | Fires whenever the open card changes, including on close (`null`). Supplying it does **not** change what renders. |
278
+ | `cardDetailsLabels` | `PartialDeep<CardDetailsWidgetLabels>` | English labels | Label overrides forwarded into the details panel. |
279
+ | `cardDetailsFeatureLabels` | `PartialDeep<CardDetailsFeatureLabels>` | English labels | Overrides for the copy the panel's feature layer resolves — status vocabulary, form-factor copy, program label, copy-success toast. Distinct from `featureLabels`. |
280
+ | `cardDetailsActivateLabels` | `PartialDeep<ActivateCardPanelLabels>` | English labels | Overrides for the Activate Card form the details panel opens — its heading, the two field labels, and its validation and status copy. |
281
+ | `bankLogoSrc` | `string` | `undefined` | Bank logo for the details panel's card face. Omit and the face renders without a logo rather than with a placeholder. |
282
+ | `bankLogoAlt` | `string` | `undefined` | Alt text for `bankLogoSrc`. |
283
+ | `onCreateCard` | `() => void` | `undefined` | Host-owned Create card handler. Required for the button to render at all. See **Create card** below. |
284
+ | `onActivateCard` | `(cardId: string) => void` | `undefined` | Called when a row's Activate button is clicked. Omit it and the button is not rendered. |
285
285
 
286
286
  ### DebitCardsWidget
287
287
 
@@ -289,26 +289,26 @@ One page of an organization's **debit** cards, with a scope-gated "Show my cards
289
289
 
290
290
  #### Props
291
291
 
292
- | Prop | Type | Default | Description |
293
- | --------------------------- | --------------------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
294
- | `pagination` | `{ paginationToken?, pageSize? }` | `undefined` | Controlled cursor and page size. Supply with `onPaginationChange` when your app owns the list position. |
295
- | `defaultPagination` | `{ paginationToken?, pageSize? }` | First page, 10 | Initial cursor and page size when uncontrolled. Ignored when `pagination` is supplied. |
296
- | `onPaginationChange` | `(pagination: CardsPagination) => void` | `undefined` | Called whenever the widget moves page or changes page size. Persist the whole object, not the token alone. |
297
- | `labels` | `PartialDeep<CardsLabels>` | English labels | Overrides the copy of the list screen, including the details sheet's screen-reader name under `detailsSheet` and the create sheet's under `createSheet`. Nested groups merge per group. |
298
- | `featureLabels` | `PartialDeep<CardsFeatureLabels>` | English labels | Overrides the copy this widget resolves rather than passes through — status and form-factor vocabulary, the empty-cell placeholder, and name fallbacks. |
299
- | `selectedCardId` | `string \| null` | `undefined` | Controlled selection of the card whose details panel is open. `null` closes it; omit for uncontrolled. See **Selection** below. |
300
- | `defaultSelectedCardId` | `string \| null` | `undefined` | Initial selection when uncontrolled. Ignored when `selectedCardId` is supplied. |
301
- | `onSelectedCardIdChange` | `(cardId: string \| null) => void` | `undefined` | Fires whenever the open card changes, including on close (`null`). Supplying it does **not** change what renders. |
302
- | `cardDetailsLabels` | `PartialDeep<CardDetailsWidgetLabels>` | English labels | Label overrides forwarded into the details panel. |
303
- | `cardDetailsFeatureLabels` | `PartialDeep<CardDetailsFeatureLabels>` | English labels | Overrides for the copy the panel's feature layer resolves — status vocabulary, form-factor copy, program label, copy-success toast. Distinct from `featureLabels`. |
304
- | `cardDetailsActivateLabels` | `PartialDeep<ActivateCardPanelLabels>` | English labels | Overrides for the Activate Card form the details panel opens — its heading, the two field labels, and its validation and status copy. |
305
- | `bankLogoSrc` | `string` | `undefined` | Bank logo for the details panel's card face. Omit and the face renders without a logo rather than with a placeholder. |
306
- | `bankLogoAlt` | `string` | `undefined` | Alt text for `bankLogoSrc`. |
307
- | `cardArtSrc` | `string` | `undefined` | Plastic art for the built-in create sheet. Required for that sheet: omit it (with no `onCreateCard`) and Create card is hidden. See **Create card** below. |
308
- | `createCardLabels` | `PartialDeep<CreateCardWidgetLabels>` | English labels | Label overrides forwarded into the nested create-card panel. |
309
- | `createCardFeatureLabels` | toast / untitled-funding overrides | English labels | Overrides for the copy the create panel's feature layer resolves — mutation toasts, untitled funding-account fallback, pending-activation success copy. |
310
- | `onCreateCard` | `() => void` | `undefined` | Host-owned Create card handler. When supplied, the built-in sheet does not open — use it for a custom issuance flow. |
311
- | `onActivateCard` | `(cardId: string) => void` | `undefined` | Called when a row's Activate button is clicked. Omit it and the button is not rendered. |
292
+ | Prop | Type | Default | Description |
293
+ | --------------------------- | --------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
294
+ | `pagination` | `{ paginationToken?, pageSize? }` | `undefined` | Controlled cursor and page size. Supply with `onPaginationChange` when your app owns the list position. |
295
+ | `defaultPagination` | `{ paginationToken?, pageSize? }` | First page, 10 | Initial cursor and page size when uncontrolled. Ignored when `pagination` is supplied. |
296
+ | `onPaginationChange` | `(pagination: CardsPagination) => void` | `undefined` | Called whenever the widget moves page or changes page size. Persist the whole object, not the token alone. |
297
+ | `labels` | `PartialDeep<CardsLabels>` | English labels | Overrides the copy of the list screen — its controls, columns, states, the details sheet's screen-reader name under `detailsSheet` and the create sheet's under `createSheet`. Nested groups merge per group. |
298
+ | `featureLabels` | `PartialDeep<CardsFeatureLabels>` | English labels | Overrides the copy this widget resolves rather than passes through — status and form-factor vocabulary, the empty-cell placeholder, and name fallbacks. |
299
+ | `selectedCardId` | `string \| null` | `undefined` | Controlled selection of the card whose details panel is open. `null` closes it; omit for uncontrolled. See **Selection** below. |
300
+ | `defaultSelectedCardId` | `string \| null` | `undefined` | Initial selection when uncontrolled. Ignored when `selectedCardId` is supplied. |
301
+ | `onSelectedCardIdChange` | `(cardId: string \| null) => void` | `undefined` | Fires whenever the open card changes, including on close (`null`). Supplying it does **not** change what renders. |
302
+ | `cardDetailsLabels` | `PartialDeep<CardDetailsWidgetLabels>` | English labels | Label overrides forwarded into the details panel. |
303
+ | `cardDetailsFeatureLabels` | `PartialDeep<CardDetailsFeatureLabels>` | English labels | Overrides for the copy the panel's feature layer resolves — status vocabulary, form-factor copy, program label, copy-success toast. Distinct from `featureLabels`. |
304
+ | `cardDetailsActivateLabels` | `PartialDeep<ActivateCardPanelLabels>` | English labels | Overrides for the Activate Card form the details panel opens — its heading, the two field labels, and its validation and status copy. |
305
+ | `bankLogoSrc` | `string` | `undefined` | Bank logo for the details panel's card face. Omit and the face renders without a logo rather than with a placeholder. |
306
+ | `bankLogoAlt` | `string` | `undefined` | Alt text for `bankLogoSrc`. |
307
+ | `cardArtSrc` | `string` | `undefined` | Plastic art for the built-in create sheet. Required for that sheet: omit it (with no `onCreateCard`) and Create card is hidden. See **Create card** below. |
308
+ | `createCardLabels` | `PartialDeep<CreateCardWidgetLabels>` | English labels | Label overrides forwarded into the nested create-card panel. |
309
+ | `createCardFeatureLabels` | toast / untitled-funding overrides | English labels | Overrides for the copy the create panel's feature layer resolves — mutation toasts, untitled funding-account fallback, pending-activation success copy. |
310
+ | `onCreateCard` | `() => void` | `undefined` | Host-owned Create card handler. When supplied, the built-in sheet does not open — use it for a custom issuance flow. |
311
+ | `onActivateCard` | `(cardId: string) => void` | `undefined` | Called when a row's Activate button is clicked. Omit it and the button is not rendered. |
312
312
 
313
313
  ### CardDetailsWidget
314
314
 
package/dist/index.d.ts CHANGED
@@ -1588,8 +1588,10 @@ interface CardsListDetailsSheetLabels {
1588
1588
  * wording change is not a breaking rename.
1589
1589
  */
1590
1590
  interface CardsListLabels {
1591
- title: string;
1592
- /** Accessible name for the list region. */
1591
+ /**
1592
+ * Accessible name for the list region. Not a heading: the list renders none,
1593
+ * because whoever mounts it names it (embedded ADR 0010).
1594
+ */
1593
1595
  regionLabel: string;
1594
1596
  columnHeaders: CardsListColumnHeaderLabels;
1595
1597
  /** Screen-reader name for the unheaded trailing row-actions column. */
@@ -2858,15 +2860,19 @@ interface WidgetSuiteDashboardLabels {
2858
2860
  insights?: WidgetSuiteInsightsLabels;
2859
2861
  }
2860
2862
  /**
2861
- * The two card lists.
2863
+ * The two card lists, plus the heading the suite writes above each.
2862
2864
  *
2863
- * `labels.title` is the one leaf the suite defaults anywhere under `sections`:
2864
- * `CardsList` titles itself "Cards", and two instances stack in this section, so
2865
- * each is retitled by program.
2865
+ * The headings are suite-owned copy rather than an override injected into a
2866
+ * widget: neither list heads itself (embedded ADR 0010), and this section is the
2867
+ * only layer that knows the two are siblings, so it names them — the same shape
2868
+ * as `SettingsWidget` heading the widgets it composes. The two groups beneath
2869
+ * are forwarded like every other, with no default.
2866
2870
  */
2867
2871
  interface WidgetSuiteCardsLabels {
2868
- creditCards: WidgetSuiteCreditCardsLabels;
2869
- debitCards: WidgetSuiteDebitCardsLabels;
2872
+ creditCardsTitle: string;
2873
+ debitCardsTitle: string;
2874
+ creditCards?: WidgetSuiteCreditCardsLabels;
2875
+ debitCards?: WidgetSuiteDebitCardsLabels;
2870
2876
  }
2871
2877
  /** Expenses is only a placeholder until the suite wires a read/self surface. */
2872
2878
  interface WidgetSuiteExpensesLabels {
@@ -71,8 +71,10 @@ interface CardsListDetailsSheetLabels {
71
71
  * wording change is not a breaking rename.
72
72
  */
73
73
  interface CardsListLabels {
74
- title: string;
75
- /** Accessible name for the list region. */
74
+ /**
75
+ * Accessible name for the list region. Not a heading: the list renders none,
76
+ * because whoever mounts it names it (embedded ADR 0010).
77
+ */
76
78
  regionLabel: string;
77
79
  columnHeaders: CardsListColumnHeaderLabels;
78
80
  /** Screen-reader name for the unheaded trailing row-actions column. */
@@ -71,8 +71,10 @@ interface CardsListDetailsSheetLabels {
71
71
  * wording change is not a breaking rename.
72
72
  */
73
73
  interface CardsListLabels {
74
- title: string;
75
- /** Accessible name for the list region. */
74
+ /**
75
+ * Accessible name for the list region. Not a heading: the list renders none,
76
+ * because whoever mounts it names it (embedded ADR 0010).
77
+ */
76
78
  regionLabel: string;
77
79
  columnHeaders: CardsListColumnHeaderLabels;
78
80
  /** Screen-reader name for the unheaded trailing row-actions column. */
@@ -892,8 +892,10 @@ interface CardsListDetailsSheetLabels {
892
892
  * wording change is not a breaking rename.
893
893
  */
894
894
  interface CardsListLabels {
895
- title: string;
896
- /** Accessible name for the list region. */
895
+ /**
896
+ * Accessible name for the list region. Not a heading: the list renders none,
897
+ * because whoever mounts it names it (embedded ADR 0010).
898
+ */
897
899
  regionLabel: string;
898
900
  columnHeaders: CardsListColumnHeaderLabels;
899
901
  /** Screen-reader name for the unheaded trailing row-actions column. */
@@ -2103,15 +2105,19 @@ interface WidgetSuiteDashboardLabels {
2103
2105
  insights?: WidgetSuiteInsightsLabels;
2104
2106
  }
2105
2107
  /**
2106
- * The two card lists.
2108
+ * The two card lists, plus the heading the suite writes above each.
2107
2109
  *
2108
- * `labels.title` is the one leaf the suite defaults anywhere under `sections`:
2109
- * `CardsList` titles itself "Cards", and two instances stack in this section, so
2110
- * each is retitled by program.
2110
+ * The headings are suite-owned copy rather than an override injected into a
2111
+ * widget: neither list heads itself (embedded ADR 0010), and this section is the
2112
+ * only layer that knows the two are siblings, so it names them — the same shape
2113
+ * as `SettingsWidget` heading the widgets it composes. The two groups beneath
2114
+ * are forwarded like every other, with no default.
2111
2115
  */
2112
2116
  interface WidgetSuiteCardsLabels {
2113
- creditCards: WidgetSuiteCreditCardsLabels;
2114
- debitCards: WidgetSuiteDebitCardsLabels;
2117
+ creditCardsTitle: string;
2118
+ debitCardsTitle: string;
2119
+ creditCards?: WidgetSuiteCreditCardsLabels;
2120
+ debitCards?: WidgetSuiteDebitCardsLabels;
2115
2121
  }
2116
2122
  /** Expenses is only a placeholder until the suite wires a read/self surface. */
2117
2123
  interface WidgetSuiteExpensesLabels {
@@ -9,10 +9,10 @@ import "./index10.js";
9
9
  import "./index11.js";
10
10
  import "./index23.js";
11
11
  import "./index24.js";
12
- import "./index41.js";
13
- import "./index50.js";
14
- import "./index52.js";
15
- import "./index54.js";
12
+ import "./index37.js";
13
+ import "./index42.js";
14
+ import "./index51.js";
15
+ import "./index53.js";
16
16
  import "./index55.js";
17
17
  import "./index56.js";
18
18
  import "./index57.js";
@@ -1,76 +1,92 @@
1
1
  import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
2
  import { derivePayableStatus as t } from "./index4.js";
3
- import { resolveVendor as n } from "./index5.js";
4
- import { resolveAmountDueMinorUnits as r } from "./index17.js";
3
+ import { resolveVendor as n, resolveVendorName as r } from "./index5.js";
5
4
  import { formatBillMoney as i } from "./index36.js";
6
5
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js
7
- function a({ payable: a, lineItems: o, glCodeOptions: s, glCodeRosterAvailable: c = !0, history: l, approvalPolicy: u, labels: d, hasScheduledPayment: f }) {
8
- let p = a.currency, m = t({
6
+ function a({ payable: a, lineItems: s, ledgerAccounts: c, labels: l, hasScheduledPayment: u, now: d }) {
7
+ let f = a.currency, p = (e) => i(e, f), m = t({
9
8
  apiStatus: a.status,
10
9
  dueDate: a.due_date,
11
10
  scheduledPaymentDate: a.scheduled_payment_date,
12
- hasScheduledPayment: f
13
- }), h = n(a), g = h?.bank_account?.account_number, _ = e(a.issued_at) || d.notProvided, v = e(a.due_date) || d.notProvided, y = new Map(s.map((e) => [e.value, e.label])), b = [
11
+ hasScheduledPayment: u,
12
+ now: d
13
+ }), h = n(a), g = r(a), _ = e(a.issued_at) || l.notProvided, v = e(a.due_date) || l.notProvided, y = [{
14
+ label: l.vendorRow,
15
+ value: g || l.notProvided,
16
+ secondaryValue: h?.email ?? void 0
17
+ }], b = h?.bank_account?.account_number;
18
+ b && y.push({
19
+ label: l.bankAccountRow,
20
+ value: l.bankAccountValue(b.slice(-4))
21
+ });
22
+ let x = [
14
23
  {
15
- label: d.subtotalRow,
16
- minorUnits: a.subtotal
24
+ label: l.invoiceNumberRow,
25
+ value: a.document_id || l.notProvided
17
26
  },
18
27
  {
19
- label: d.discountRow,
20
- minorUnits: a.discount
28
+ label: l.issueDateRow,
29
+ value: _
21
30
  },
22
31
  {
23
- label: d.taxRow,
24
- minorUnits: a.tax_amount
32
+ label: l.dueDateRow,
33
+ value: v
34
+ },
35
+ {
36
+ label: l.poNumberRow,
37
+ value: l.notProvided
38
+ }
39
+ ], S = new Map(c.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), C = s.map((e) => {
40
+ let t = p(e.unit_price);
41
+ return {
42
+ id: e.id,
43
+ description: e.name ?? e.description ?? "",
44
+ glCodeLabel: (e.ledger_account_id ? S.get(e.ledger_account_id) : void 0) || l.glCodeMissing,
45
+ quantityLabel: e.quantity != null && t ? l.quantityValue(String(e.quantity), t) : "",
46
+ amountLabel: p(e.subtotal) ?? ""
47
+ };
48
+ }), w = [
49
+ {
50
+ label: l.subtotalRow,
51
+ value: a.subtotal
52
+ },
53
+ {
54
+ label: l.discountsRow,
55
+ value: a.discount
56
+ },
57
+ {
58
+ label: l.taxRow,
59
+ value: a.tax_amount
25
60
  }
26
- ].map((e) => ({
27
- label: e.label,
28
- value: i(e.minorUnits, p)
29
- })).filter((e) => !!e.value), x = i(a.total_amount, p);
30
- return x && b.push({
31
- label: d.totalRow,
32
- value: x,
61
+ ].map(({ label: e, value: t }) => ({
62
+ label: e,
63
+ value: p(t)
64
+ })).filter((e) => !!e.value), T = p(a.total_amount);
65
+ T && w.push({
66
+ label: l.totalRow,
67
+ value: T,
33
68
  emphasis: !0
34
- }), {
35
- amountDue: i(r(a), p) ?? "",
69
+ });
70
+ let E = o(a);
71
+ return {
72
+ title: g,
73
+ subtitle: l.subtitle,
74
+ status: m.status,
75
+ statusTone: m.tone,
76
+ amountDueLabel: p(a.amount_due) ?? p(a.total_amount) ?? "",
77
+ amountPaidLabel: E ? p(a.amount_paid) : void 0,
78
+ paidOnLabel: E ? l.paidOnLabel(E) : void 0,
36
79
  invoiceDateLabel: _,
37
80
  dueDateLabel: v,
38
81
  dueDateTone: m.isOverdue ? "danger" : "default",
39
- status: m.status,
40
- statusTone: m.tone,
41
- payTo: {
42
- name: h?.name || d.notProvided,
43
- email: h?.email ?? void 0,
44
- paymentInstructionsLabel: g ? d.paymentInstructionsValue(g.slice(-4)) : void 0
45
- },
46
- invoiceFields: [
47
- {
48
- label: d.invoiceDateRow,
49
- value: _
50
- },
51
- {
52
- label: d.dueDateRow,
53
- value: v
54
- },
55
- {
56
- label: d.invoiceNumberRow,
57
- value: a.document_id || d.notProvided
58
- }
59
- ],
60
- lineItems: o.map((e) => {
61
- let t = i(e.unit_price, p);
62
- return {
63
- id: e.id,
64
- description: e.name ?? e.description ?? "",
65
- glCodeLabel: e.ledger_account_id ? y.get(e.ledger_account_id) ?? (c ? d.glCodeMissing : d.glCodeUnavailable) : d.glCodeMissing,
66
- qtyPriceLabel: e.quantity != null && t ? d.qtyPriceValue(String(e.quantity), t) : "",
67
- amount: i(e.subtotal, p) ?? ""
68
- };
69
- }),
70
- amountRows: b,
71
- approvalPolicy: u,
72
- history: l
82
+ payToItems: y,
83
+ invoiceItems: x,
84
+ lineItems: C,
85
+ totals: w
73
86
  };
74
87
  }
88
+ function o(t) {
89
+ return t.status === "paid" && t.paid_at ? e(t.paid_at.slice(0, 10)) : void 0;
90
+ }
75
91
  //#endregion
76
- export { a as buildBillDetailView };
92
+ export { o as getPaidAtLabel, a as mapPayableToBillDetails };
@@ -1,52 +1,81 @@
1
- import { derivePayableStatus as e } from "./index4.js";
2
- import { BILL_STATUS_BADGE_LABELS_EN as t } from "../../ui/dist/index18.js";
3
- import "../../ui/dist/index.js";
1
+ import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
+ import { derivePayableStatus as t } from "./index4.js";
3
+ import { resolveVendor as n } from "./index5.js";
4
+ import { resolveAmountDueMinorUnits as r } from "./index17.js";
5
+ import { formatBillMoney as i } from "./index36.js";
6
+ import { getPaidAtLabel as a } from "./index37.js";
4
7
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js
5
- var n = /* @__PURE__ */ new Set([
6
- "credit_note_linked",
7
- "credit_note_unlinked",
8
- "line_item_added",
9
- "line_item_updated",
10
- "line_item_removed",
11
- "deleted"
12
- ]);
13
- function r(n, r, i) {
14
- switch (n) {
15
- case "payable_created": return r?.source_of_payable_data === "ocr" ? i.billUploaded : i.billAdded;
16
- case "payable_updated": return i.billUpdated;
17
- case "file_attached": return i.attachmentAdded;
18
- case "submitted_for_approval": return i.submittedForApproval;
19
- case "approval_requested": return i.approvalRequested;
20
- case "approval_action": {
21
- let e = r?.action, t = r?.reject_reason;
22
- return e === "approve" ? i.approved : e === "reject" ? typeof t == "string" && t ? i.rejectedWithReason(t) : i.rejected : void 0;
8
+ function o({ payable: o, lineItems: s, glCodeOptions: c, glCodeRosterAvailable: l = !0, history: u, approvalPolicy: d, labels: f, hasScheduledPayment: p }) {
9
+ let m = o.currency, h = t({
10
+ apiStatus: o.status,
11
+ dueDate: o.due_date,
12
+ scheduledPaymentDate: o.scheduled_payment_date,
13
+ hasScheduledPayment: p
14
+ }), g = n(o), _ = g?.bank_account?.account_number, v = e(o.issued_at) || f.notProvided, y = e(o.due_date) || f.notProvided, b = new Map(c.map((e) => [e.value, e.label])), x = [
15
+ {
16
+ label: f.subtotalRow,
17
+ minorUnits: o.subtotal
18
+ },
19
+ {
20
+ label: f.discountRow,
21
+ minorUnits: o.discount
22
+ },
23
+ {
24
+ label: f.taxRow,
25
+ minorUnits: o.tax_amount
23
26
  }
24
- case "auto_approved": return i.autoApproved;
25
- case "reopened": return i.reopened;
26
- case "marked_as_paid": return i.markedAsPaid;
27
- case "marked_as_partially_paid": return i.markedAsPartiallyPaid;
28
- case "payment_reverted": return i.paymentReverted;
29
- case "status_changed": {
30
- let n = r?.new_status;
31
- if (typeof n != "string") return;
32
- let a = e({ apiStatus: n }).status;
33
- return i.statusChanged(t[a] ?? t.unknown);
34
- }
35
- default: return;
36
- }
37
- }
38
- function i(e, t, i) {
39
- let a = new Map(t.map((e) => [e.id, e.name]));
40
- return e.filter((e) => !n.has(e.event_type)).map((e) => {
41
- let t = r(e.event_type, e.event_data, i);
42
- if (!t) return;
43
- let n = e.entity_user_id ? a.get(e.entity_user_id) : void 0;
44
- return {
45
- id: e.id,
46
- dateLabel: i.dateLabel(e.timestamp),
47
- description: n ? i.byActor(t, n) : t
48
- };
49
- }).filter((e) => !!e);
27
+ ].map((e) => ({
28
+ label: e.label,
29
+ value: i(e.minorUnits, m)
30
+ })).filter((e) => !!e.value), S = i(o.total_amount, m);
31
+ S && x.push({
32
+ label: f.totalRow,
33
+ value: S,
34
+ emphasis: !0
35
+ });
36
+ let C = a(o);
37
+ return {
38
+ amountDue: i(r(o), m) ?? "",
39
+ amountPaid: C ? i(o.amount_paid, m) : void 0,
40
+ paidOnLabel: C ? f.paidOnLabel(C) : void 0,
41
+ invoiceDateLabel: v,
42
+ dueDateLabel: y,
43
+ dueDateTone: h.isOverdue ? "danger" : "default",
44
+ status: h.status,
45
+ statusTone: h.tone,
46
+ payTo: {
47
+ name: g?.name || f.notProvided,
48
+ email: g?.email ?? void 0,
49
+ paymentInstructionsLabel: _ ? f.paymentInstructionsValue(_.slice(-4)) : void 0
50
+ },
51
+ invoiceFields: [
52
+ {
53
+ label: f.invoiceDateRow,
54
+ value: v
55
+ },
56
+ {
57
+ label: f.dueDateRow,
58
+ value: y
59
+ },
60
+ {
61
+ label: f.invoiceNumberRow,
62
+ value: o.document_id || f.notProvided
63
+ }
64
+ ],
65
+ lineItems: s.map((e) => {
66
+ let t = i(e.unit_price, m);
67
+ return {
68
+ id: e.id,
69
+ description: e.name ?? e.description ?? "",
70
+ glCodeLabel: e.ledger_account_id ? b.get(e.ledger_account_id) ?? (l ? f.glCodeMissing : f.glCodeUnavailable) : f.glCodeMissing,
71
+ qtyPriceLabel: e.quantity != null && t ? f.qtyPriceValue(String(e.quantity), t) : "",
72
+ amount: i(e.subtotal, m) ?? ""
73
+ };
74
+ }),
75
+ amountRows: x,
76
+ approvalPolicy: d,
77
+ history: u
78
+ };
50
79
  }
51
80
  //#endregion
52
- export { i as buildBillHistory };
81
+ export { o as buildBillDetailView };