@tesouro/embedded-components-react 0.4.18 → 0.4.20

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 (29) hide show
  1. package/dist/index.css +11 -0
  2. package/dist/index.d.ts +4 -1
  3. package/dist/lib/ReceivablesWidget.d.ts +4 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +23 -14
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +49 -50
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +0 -1
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +254 -250
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +71 -65
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +5 -9
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +3 -4
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +11 -11
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +4 -4
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +1 -2
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +1 -6
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +3 -4
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +3 -2
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +1 -0
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +142 -137
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +2 -2
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +1 -0
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +52 -47
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +89 -86
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index7.js +59 -57
  25. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +1 -0
  26. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/user/useOrganizationUserNames.js +6 -0
  28. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/amountOutputToMajorUnits.js +14 -6
  29. package/package.json +1 -1
package/dist/index.css CHANGED
@@ -49,7 +49,9 @@
49
49
  --ttw-color-emerald-500: oklch(69.6% 0.17 162.48);
50
50
  --ttw-color-emerald-600: oklch(59.6% 0.145 163.225);
51
51
  --ttw-color-emerald-700: oklch(50.8% 0.118 165.612);
52
+ --ttw-color-cyan-50: oklch(98.4% 0.019 200.873);
52
53
  --ttw-color-cyan-100: oklch(95.6% 0.045 203.388);
54
+ --ttw-color-cyan-200: oklch(91.7% 0.08 205.041);
53
55
  --ttw-color-cyan-700: oklch(52% 0.105 223.128);
54
56
  --ttw-color-sky-200: oklch(90.1% 0.058 230.902);
55
57
  --ttw-color-sky-400: oklch(74.6% 0.16 232.661);
@@ -2207,6 +2209,9 @@
2207
2209
  .ttw\:border-cyan-100 {
2208
2210
  border-color: var(--ttw-color-cyan-100);
2209
2211
  }
2212
+ .ttw\:border-cyan-200 {
2213
+ border-color: var(--ttw-color-cyan-200);
2214
+ }
2210
2215
  .ttw\:border-destructive {
2211
2216
  border-color: var(--ttw-destructive);
2212
2217
  }
@@ -2453,6 +2458,9 @@
2453
2458
  .ttw\:bg-card {
2454
2459
  background-color: var(--ttw-card);
2455
2460
  }
2461
+ .ttw\:bg-cyan-50 {
2462
+ background-color: var(--ttw-color-cyan-50);
2463
+ }
2456
2464
  .ttw\:bg-cyan-100 {
2457
2465
  background-color: var(--ttw-color-cyan-100);
2458
2466
  }
@@ -4369,6 +4377,9 @@
4369
4377
  .ttw\:hover\:bg-card:hover {
4370
4378
  background-color: var(--ttw-card);
4371
4379
  }
4380
+ .ttw\:hover\:bg-cyan-50:hover {
4381
+ background-color: var(--ttw-color-cyan-50);
4382
+ }
4372
4383
  .ttw\:hover\:bg-destructive\/10:hover {
4373
4384
  background-color: var(--ttw-destructive);
4374
4385
  }
package/dist/index.d.ts CHANGED
@@ -1109,6 +1109,9 @@ interface WidgetTokenManager {
1109
1109
  subscribe(listener: () => void): () => void;
1110
1110
  }
1111
1111
 
1112
+ declare const DOCUMENT_KINDS: readonly ["invoice", "quote", "credit_note"];
1113
+ type ReceivableDocumentKind = (typeof DOCUMENT_KINDS)[number];
1114
+
1112
1115
  interface WidgetTokenRefreshProviderProps {
1113
1116
  fetcher: WidgetTokenFetcher;
1114
1117
  leadSeconds?: number;
@@ -3990,7 +3993,7 @@ interface ReceivableActionDialogLabels {
3990
3993
  confirmButton: string;
3991
3994
  }
3992
3995
 
3993
- type ReceivableDocumentType = 'invoice' | 'quote' | 'credit_note';
3996
+ type ReceivableDocumentType = ReceivableDocumentKind;
3994
3997
  type ReceivablesWidgetTab = 'invoices' | 'quotes' | 'credit_notes';
3995
3998
 
3996
3999
  interface ReceivableMessageLabels {
@@ -634,6 +634,9 @@ interface WidgetProviderProps extends WidgetProviderBaseProps {
634
634
  providerLabels?: Partial<WidgetProviderLabels>;
635
635
  }
636
636
 
637
+ declare const DOCUMENT_KINDS: readonly ["invoice", "quote", "credit_note"];
638
+ type ReceivableDocumentKind = (typeof DOCUMENT_KINDS)[number];
639
+
637
640
  interface AddressFieldGroupLabels {
638
641
  line1: string;
639
642
  line2: string;
@@ -970,7 +973,7 @@ interface ReceivableActionDialogLabels {
970
973
  confirmButton: string;
971
974
  }
972
975
 
973
- type ReceivableDocumentType = 'invoice' | 'quote' | 'credit_note';
976
+ type ReceivableDocumentType = ReceivableDocumentKind;
974
977
  type ReceivablesWidgetTab = 'invoices' | 'quotes' | 'credit_notes';
975
978
 
976
979
  interface ReceivableMessageLabels {
@@ -6,26 +6,35 @@ import { BanIcon as n, CalendarXIcon as r, RotateCcwIcon as i, ThumbsDownIcon as
6
6
  function s(n) {
7
7
  return e(n, [t.CounterpartReadOrg]);
8
8
  }
9
- function c({ status: c, scopes: l, canDecideApprovalRequest: u, hasScheduledPayment: d, scheduledPaymentIntentId: f, isPolicyApprover: p, hasWaitingRequest: m, arePendingApproversUnknown: h, labels: g }) {
10
- let _ = e(l, [t.PayablePayOrg]), v = e(l, [t.BankAccountReadOrg]), y = s(l), b = e(l, [t.PaymentRailAch]), x = e(l, [t.PayableWriteOrg]), S = _, C = e(l, [t.PayableApproveOrg]), w = [];
11
- c === "approve_in_progress" && u && (w.push({
9
+ function c({ status: n, scopes: r, hasWaitingRequest: i, arePendingApproversUnknown: a }) {
10
+ let o = e(r, [t.PayableApproveOrg]);
11
+ return !!(n === "approve_in_progress" && i && o && !a);
12
+ }
13
+ function l({ status: l, scopes: u, canDecideApprovalRequest: d, hasScheduledPayment: f, scheduledPaymentIntentId: p, hasWaitingRequest: m, arePendingApproversUnknown: h, labels: g }) {
14
+ let _ = e(u, [t.PayablePayOrg]), v = e(u, [t.BankAccountReadOrg]), y = s(u), b = e(u, [t.PaymentRailAch]), x = e(u, [t.PayableWriteOrg]), S = _, C = [];
15
+ l === "approve_in_progress" && d && (C.push({
12
16
  id: "approve",
13
17
  label: g.approve,
14
18
  variant: "default",
15
19
  surface: "row"
16
- }), w.push({
20
+ }), C.push({
17
21
  id: "reject",
18
22
  label: g.reject,
19
23
  variant: "ghost",
20
24
  surface: "row"
21
- })), c === "approve_in_progress" && m && C && !p && !h && (w.push({
25
+ })), c({
26
+ status: l,
27
+ scopes: u,
28
+ hasWaitingRequest: m,
29
+ arePendingApproversUnknown: h
30
+ }) && (C.push({
22
31
  id: "forceApprove",
23
32
  label: g.forceApprove,
24
33
  variant: "ghost",
25
34
  surface: "menu",
26
35
  icon: o,
27
36
  sectionHeading: g.policyOverridesHeading
28
- }), w.push({
37
+ }), C.push({
29
38
  id: "forceReject",
30
39
  label: g.forceReject,
31
40
  variant: "ghost",
@@ -33,36 +42,36 @@ function c({ status: c, scopes: l, canDecideApprovalRequest: u, hasScheduledPaym
33
42
  icon: a,
34
43
  sectionHeading: g.policyOverridesHeading
35
44
  }));
36
- let T = c === "waiting_to_be_paid" && _ && !d, E = c === "waiting_to_be_paid" && _ && v && y && b && !d;
37
- return T && w.push({
45
+ let w = l === "waiting_to_be_paid" && _ && !f, T = l === "waiting_to_be_paid" && _ && v && y && b && !f;
46
+ return w && C.push({
38
47
  id: "markAsPaid",
39
48
  label: g.markAsPaid,
40
49
  variant: "outline",
41
50
  surface: "row"
42
- }), E && w.push({
51
+ }), T && C.push({
43
52
  id: "payBill",
44
53
  label: g.payBill,
45
54
  variant: "default",
46
55
  surface: "row"
47
- }), c === "new" && x && w.push({
56
+ }), l === "new" && x && C.push({
48
57
  id: "cancel",
49
58
  label: g.cancel,
50
59
  variant: "ghost",
51
60
  surface: "menu",
52
61
  icon: n
53
- }), (c === "rejected" || c === "waiting_to_be_paid" && !d) && x && w.push({
62
+ }), (l === "rejected" || l === "waiting_to_be_paid" && !f) && x && C.push({
54
63
  id: "reopen",
55
64
  label: g.reopen,
56
65
  variant: "ghost",
57
66
  surface: "menu",
58
67
  icon: i
59
- }), c === "waiting_to_be_paid" && d && f && S && w.push({
68
+ }), l === "waiting_to_be_paid" && f && p && S && C.push({
60
69
  id: "cancelScheduledPayment",
61
70
  label: g.cancelScheduledPayment,
62
71
  variant: "ghost",
63
72
  surface: "menu",
64
73
  icon: r
65
- }), w;
74
+ }), C;
66
75
  }
67
76
  //#endregion
68
- export { s as canReadCounterpartBankAccounts, c as getBillDetailActions };
77
+ export { c as canOverrideApprovalPolicy, s as canReadCounterpartBankAccounts, l as getBillDetailActions };
@@ -13,104 +13,103 @@ import { getBillDetailActions as l } from "./index18.js";
13
13
  import { useState as u } from "react";
14
14
  import { HandIcon as d } from "lucide-react";
15
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js
16
- function f({ payableId: d, status: f, currentApprovalRequestId: m, isPolicyApprover: _, hasWaitingRequest: v, arePendingApproversUnknown: y, hasScheduledPayment: b, scheduledPaymentIntentId: x, isScheduledPaymentUnknown: S, labels: C, isMarkAsPaidPending: w, pendingApprovers: T, onPayBillSelect: E, onMarkAsPaidSelect: D, onActionSucceeded: O }) {
17
- let { initResponse: k } = t(), A = r(), j = n(), M = i(), N = a(), P = c(), F = o(), I = s(), L = w || A.isPending || j.isPending || M.isPending || N.isPending || P.isPending || F.isPending || I.isPending, [R, z] = u(), B = R && (R.id !== "cancelScheduledPayment" || R.scheduledPaymentIntentId === x) ? R : void 0, V = d && f ? l({
16
+ function f({ payableId: d, status: f, currentApprovalRequestId: m, hasWaitingRequest: _, arePendingApproversUnknown: v, hasScheduledPayment: y, scheduledPaymentIntentId: b, isScheduledPaymentUnknown: x, labels: S, isMarkAsPaidPending: C, pendingApprovers: w, onPayBillSelect: T, onMarkAsPaidSelect: E, onActionSucceeded: D }) {
17
+ let { initResponse: O } = t(), k = r(), A = n(), j = i(), M = a(), N = c(), P = o(), F = s(), I = C || k.isPending || A.isPending || j.isPending || M.isPending || N.isPending || P.isPending || F.isPending, [L, R] = u(), z = L && (L.id !== "cancelScheduledPayment" || L.scheduledPaymentIntentId === b) ? L : void 0, B = d && f ? l({
18
18
  status: f,
19
- scopes: k?.scopes,
19
+ scopes: O?.scopes,
20
20
  canDecideApprovalRequest: !!m,
21
- isPolicyApprover: _,
22
- hasWaitingRequest: v,
23
- arePendingApproversUnknown: y,
24
- hasScheduledPayment: b || S,
25
- scheduledPaymentIntentId: x,
26
- labels: C
27
- }) : [], H = (t) => ({
28
- onError: () => e.error(C.actionError),
21
+ hasWaitingRequest: _,
22
+ arePendingApproversUnknown: v,
23
+ hasScheduledPayment: y || x,
24
+ scheduledPaymentIntentId: b,
25
+ labels: S
26
+ }) : [], V = (t) => ({
27
+ onError: () => e.error(S.actionError),
29
28
  onSuccess: () => {
30
- e.success(C.actionSuccess[t]), O?.();
29
+ e.success(S.actionSuccess[t]), D?.();
31
30
  }
32
- }), U = {
31
+ }), H = {
33
32
  reject: {
34
- isPending: A.isPending,
35
- run: (e) => m && A.mutate({
33
+ isPending: k.isPending,
34
+ run: (e) => m && k.mutate({
36
35
  path: { approval_request_id: m },
37
36
  body: e ? { reject_reason: e } : void 0
38
- }, H("reject"))
37
+ }, V("reject"))
39
38
  },
40
39
  approve: {
41
- isPending: j.isPending,
42
- run: () => m && j.mutate({ path: { approval_request_id: m } }, H("approve"))
40
+ isPending: A.isPending,
41
+ run: () => m && A.mutate({ path: { approval_request_id: m } }, V("approve"))
43
42
  },
44
43
  cancel: {
45
- isPending: M.isPending,
46
- run: () => d && M.mutate({ path: { payable_id: d } }, H("cancel"))
44
+ isPending: j.isPending,
45
+ run: () => d && j.mutate({ path: { payable_id: d } }, V("cancel"))
47
46
  },
48
47
  cancelScheduledPayment: {
49
- isPending: N.isPending,
48
+ isPending: M.isPending,
50
49
  run: () => {
51
- let e = B?.scheduledPaymentIntentId;
52
- !d || !e || N.mutate({
50
+ let e = z?.scheduledPaymentIntentId;
51
+ !d || !e || M.mutate({
53
52
  path: { payment_intent_id: e },
54
53
  payableId: d
55
- }, H("cancelScheduledPayment"));
54
+ }, V("cancelScheduledPayment"));
56
55
  }
57
56
  },
58
57
  reopen: {
59
- isPending: P.isPending,
60
- run: () => d && P.mutate({ path: { payable_id: d } }, H("reopen"))
58
+ isPending: N.isPending,
59
+ run: () => d && N.mutate({ path: { payable_id: d } }, V("reopen"))
61
60
  },
62
61
  forceApprove: {
63
- isPending: F.isPending,
64
- run: () => d && F.mutate({ path: { payable_id: d } }, H("forceApprove"))
62
+ isPending: P.isPending,
63
+ run: () => d && P.mutate({ path: { payable_id: d } }, V("forceApprove"))
65
64
  },
66
65
  forceReject: {
67
- isPending: I.isPending,
68
- run: () => d && I.mutate({ path: { payable_id: d } }, H("forceReject"))
66
+ isPending: F.isPending,
67
+ run: () => d && F.mutate({ path: { payable_id: d } }, V("forceReject"))
69
68
  }
70
- }, W = V.map((e) => ({
69
+ }, U = B.map((e) => ({
71
70
  ...e,
72
- disabled: L,
73
- loading: e.id === "markAsPaid" ? w : U[e.id]?.isPending ?? !1,
71
+ disabled: I,
72
+ loading: e.id === "markAsPaid" ? C : H[e.id]?.isPending ?? !1,
74
73
  onSelect: () => {
75
- if (!(L || !d)) {
74
+ if (!(I || !d)) {
76
75
  if (e.id === "payBill") {
77
- E();
76
+ T();
78
77
  return;
79
78
  }
80
79
  if (e.id === "markAsPaid") {
81
- D();
80
+ E();
82
81
  return;
83
82
  }
84
83
  if (h(e.id)) {
85
- z({
84
+ R({
86
85
  id: e.id,
87
- scheduledPaymentIntentId: x
86
+ scheduledPaymentIntentId: b
88
87
  });
89
88
  return;
90
89
  }
91
- U[e.id]?.run();
90
+ H[e.id]?.run();
92
91
  }
93
92
  }
94
93
  }));
95
94
  return {
96
- isActionPending: L,
95
+ isActionPending: I,
97
96
  actions: {
98
- row: W.filter((e) => e.surface === "row"),
99
- menu: W.filter((e) => e.surface === "menu")
97
+ row: U.filter((e) => e.surface === "row"),
98
+ menu: U.filter((e) => e.surface === "menu")
100
99
  },
101
100
  decisionDialog: {
102
- open: !!B,
103
- copy: B ? {
104
- ...C.decisionDialog[B.id],
105
- presentation: g(B.id) ? p : void 0,
106
- pendingApprovers: g(B.id) ? T ?? [] : void 0
101
+ open: !!z,
102
+ copy: z ? {
103
+ ...S.decisionDialog[z.id],
104
+ presentation: g(z.id) ? p : void 0,
105
+ pendingApprovers: g(z.id) ? w ?? [] : void 0
107
106
  } : void 0,
108
- isPending: B ? U[B.id]?.isPending ?? !1 : !1,
107
+ isPending: z ? H[z.id]?.isPending ?? !1 : !1,
109
108
  onCancel: () => {
110
- L || z(void 0);
109
+ I || R(void 0);
111
110
  },
112
111
  onConfirm: (e) => {
113
- !B || L || (U[B.id]?.run(e), z(void 0));
112
+ !z || I || (H[z.id]?.run(e), R(void 0));
114
113
  }
115
114
  }
116
115
  };
@@ -92,7 +92,6 @@ var f = {
92
92
  viewTitle: (e) => `Bill from ${e}`,
93
93
  readOnlyTitle: "Bill details",
94
94
  addedOn: (e) => `Added on ${e}`,
95
- submittedSaveButton: "Save changes",
96
95
  unsavedChanges: e,
97
96
  scheduledSummary: c,
98
97
  actions: o,