@tesouro/embedded-components-react 0.5.226 → 0.5.228

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 (160) hide show
  1. package/README.md +21 -21
  2. package/dist/index.d.ts +54 -34
  3. package/dist/index.js +1 -1
  4. package/dist/lib/ReceivablesWidget.d.ts +54 -34
  5. package/dist/lib/ReceivablesWidget.js +1 -1
  6. package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index3.js +41 -39
  7. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index12.js +2 -2
  8. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index2.js +2 -2
  9. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index3.js +2 -2
  10. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index4.js +2 -2
  11. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index9.js +150 -147
  12. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/data-access/dist/index5.js +46 -51
  13. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index7.js +130 -128
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index18.js +31 -32
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index19.js +2 -2
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index2.js +2 -2
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index21.js +2 -2
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index22.js +2 -2
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index3.js +2 -2
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index4.js +36 -37
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-upload/data-access/dist/index2.js +2 -2
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-upload/feature/dist/index4.js +2 -2
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index2.js +6 -10
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index3.js +2 -2
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index4.js +2 -2
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index5.js +2 -2
  27. package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index6.js +2 -2
  28. package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index7.js +2 -2
  29. package/dist/libs/tesouro-embedded-components-react/card-details-widget/data-access/dist/index8.js +2 -2
  30. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index13.js +154 -150
  31. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/data-access/dist/index7.js +2 -2
  32. package/dist/libs/tesouro-embedded-components-react/cards-widget/data-access/dist/index2.js +2 -2
  33. package/dist/libs/tesouro-embedded-components-react/cards-widget/data-access/dist/index3.js +2 -2
  34. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js +151 -149
  35. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index2.js +4 -4
  36. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index3.js +4 -4
  37. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index15.js +2 -2
  38. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index17.js +2 -2
  39. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index18.js +2 -2
  40. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index19.js +2 -2
  41. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index2.js +2 -2
  42. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index3.js +2 -2
  43. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index4.js +2 -2
  44. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index5.js +2 -2
  45. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index6.js +2 -2
  46. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index8.js +2 -2
  47. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/index9.js +2 -2
  48. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index24.js +1 -0
  49. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index27.js +89 -87
  50. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index5.js +133 -130
  51. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index8.js +36 -34
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +4 -4
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +33 -63
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +6 -6
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +2 -2
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js +40 -39
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
  58. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +36 -141
  59. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +26 -16
  60. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +58 -37
  61. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +228 -122
  62. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +300 -147
  63. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +34 -37
  64. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +126 -122
  65. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +150 -58
  66. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +38 -91
  67. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +113 -107
  68. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index25.js +98 -231
  69. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js +111 -27
  70. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index27.js +25 -624
  71. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index28.js +631 -39
  72. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index29.js +41 -40
  73. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index30.js +35 -74
  74. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index31.js +73 -115
  75. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index32.js +115 -313
  76. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index33.js +325 -0
  77. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index7.js +15 -2
  78. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +11 -12
  79. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +42 -1
  80. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +19 -3
  81. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +73 -3
  82. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +3 -1
  83. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +16 -1
  84. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +32 -4
  85. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +304 -11
  86. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +42 -258
  87. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +62 -38
  88. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +485 -61
  89. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +90 -480
  90. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +2 -0
  91. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +3 -1
  92. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +0 -3
  93. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +100 -1
  94. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +23 -95
  95. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +231 -23
  96. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +3 -236
  97. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +249 -3
  98. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +78 -234
  99. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +53 -87
  100. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +343 -49
  101. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +29 -20
  102. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/data-access/dist/index4.js +2 -2
  103. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +209 -207
  104. package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index4.js +10 -5
  105. package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index5.js +10 -5
  106. package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index6.js +11 -6
  107. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index2.js +2 -2
  108. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index3.js +2 -2
  109. package/dist/libs/tesouro-embedded-components-react/settings-widget/profile/data-access/dist/index2.js +2 -2
  110. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index12.js +2 -2
  111. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index13.js +2 -2
  112. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index14.js +30 -28
  113. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index17.js +28 -26
  114. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index18.js +37 -34
  115. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index21.js +28 -26
  116. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/data-access/dist/index22.js +37 -34
  117. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index17.js +294 -292
  118. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index5.js +58 -58
  119. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js +47 -48
  120. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index3.js +4 -4
  121. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index5.js +2 -2
  122. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index7.js +4 -4
  123. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +4 -3
  124. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/EmbedApiContext.js +14 -13
  125. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/allPages.js +1 -1
  126. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/applicationStatusQueryOptions.js +16 -15
  127. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js +7 -5
  128. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/debit-card/useAllDebitCardsQuery.js +7 -5
  129. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/disclosures/useDisclosuresQuery.js +2 -2
  130. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/external-bank-account/useAllExternalBankAccountsQuery.js +7 -5
  131. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/merchant-category-group/useAllMerchantCategoryGroupsQuery.js +28 -29
  132. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/organizationStatus.js +10 -0
  133. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js +26 -27
  134. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/usePaymentTermsQuery.js +2 -2
  135. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +189 -211
  136. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +43 -59
  137. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js +31 -32
  138. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/role/useRolePermissionsQueries.js +2 -2
  139. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useCurrentUserQuery.js +2 -2
  140. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useGetUserDataQuery.js +2 -2
  141. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useMailboxAddress.js +2 -2
  142. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useMyEntityQuery.js +2 -2
  143. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +33 -34
  144. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/withAuthEpoch.js +33 -22
  145. package/dist/libs/tesouro-embedded-components-react/shared/expense-requirements/data-access/dist/index3.js +2 -2
  146. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +43 -32
  147. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +138 -127
  148. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/deriveOrganizationStatus.js +6 -0
  149. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/useWidgetFetch.js +1 -1
  150. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  151. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index10.js +2 -2
  152. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index2.js +2 -2
  153. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index3.js +2 -2
  154. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index4.js +2 -2
  155. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index9.js +2 -2
  156. package/dist/libs/tesouro-embedded-components-react/transfers-widget/data-access/dist/index6.js +2 -2
  157. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index6.js +60 -58
  158. package/package.json +1 -1
  159. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +0 -106
  160. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +0 -353
@@ -36,22 +36,32 @@ var e = {
36
36
  invoiceType: "Invoice",
37
37
  quoteType: "Quote",
38
38
  creditNoteType: "Credit note",
39
- summaryDocumentType: "Document type",
40
- summaryDocumentNumber: "Document number",
41
- summaryCustomer: "Customer",
42
- summaryIssued: "Issued",
43
- summaryDue: "Due",
44
- summaryCreated: "Created",
45
- summaryUpdated: "Updated",
46
- summaryTotal: "Total",
47
- summaryAmountDue: "Amount due",
48
- activityStatusChanged: "Status changed",
49
- activityReceivableCreated: "Receivable created",
50
- activityReceivableUpdated: "Receivable updated",
51
- activityPaymentReceived: "Payment received",
52
- activityMailSent: "Email sent",
53
- activityUnknown: "Activity",
54
- recipientsNone: "No recipients",
39
+ detailsUnsupportedTitle: "Receivable type not supported",
40
+ detailsUnsupportedDescription: "Receivable type {type} is not supported. Only invoice is supported.",
41
+ detailsInvoiceSubtitle: "Invoice: {number}",
42
+ detailsDaysOverdue: "{days} days overdue",
43
+ detailsInvoiceAmount: "Invoice amount",
44
+ detailsBalanceDue: "Balance due",
45
+ detailsAmountReceived: "Amount received",
46
+ detailsCancelledAmount: "Cancelled amount",
47
+ detailsAmountWrittenOff: "Amount written off",
48
+ detailsCancelledOnCaption: "Cancelled on",
49
+ detailsPending: "Pending",
50
+ detailsNotProvided: "Not provided",
51
+ detailsCustomerName: "Name",
52
+ detailsCustomerEmail: "Email",
53
+ detailsCustomerPhone: "Phone",
54
+ detailsCustomerAddress: "Address",
55
+ detailsInvoiceNumber: "Invoice number",
56
+ detailsInvoiceDate: "Invoice date",
57
+ detailsDueDate: "Due date",
58
+ detailsPaymentTerms: "Payment terms",
59
+ detailsPaymentReminders: "Payment reminders",
60
+ detailsPoNumber: "PO number",
61
+ detailsDepositAccount: "Deposit account",
62
+ detailsRemindersBefore: "before",
63
+ detailsRemindersAfter: "after",
64
+ detailsRemindersNone: "None",
55
65
  sendSubjectDefault: "Your receivable document",
56
66
  sendBodyDefault: "Please find the receivable document attached.",
57
67
  issueTitle: "Issue receivable?",
@@ -1,42 +1,63 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { buildReceivableDetailsView as e } from "./index12.js";
6
- import { useReceivableHistoryQuery as t, useReceivableMailsQuery as n, useReceivablePdfLinkQuery as r, useReceivableQuery as i } from "../../data-access/dist/index10.js";
7
- import "../../data-access/dist/index.js";
8
- import { useMemo as a } from "react";
1
+ import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
2
+ import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
3
+ import "../../../shared/data-access/dist/index.js";
9
4
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js
10
- function o({ selectedReceivableId: o, enabled: s = !0, messages: c }) {
11
- let l = i(o, { enabled: s }), u = t(o, {
12
- enabled: s,
13
- limit: 25,
14
- sort: "timestamp",
15
- order: "desc"
16
- }), d = n(o, {
17
- enabled: s,
18
- limit: 10,
19
- sort: "created_at",
20
- order: "desc"
21
- }), f = r(o, { enabled: s && !!l.data }), p = a(() => e({
22
- receivable: l.data,
23
- history: u.data?.data ?? [],
24
- mails: d.data?.data ?? [],
25
- pdfUrl: f.data?.file_url || f.data?.original_file_url || void 0,
26
- messages: c
27
- }), [
28
- l.data,
29
- u.data?.data,
30
- d.data?.data,
31
- c,
32
- f.data
33
- ]);
5
+ var n = {
6
+ routingNumber: "",
7
+ accountNumber: "",
8
+ accountHolderName: "",
9
+ displayName: ""
10
+ };
11
+ function r(n) {
12
+ let r = new Set(n ?? []);
34
13
  return {
35
- receivable: l.data,
36
- detailsView: p,
37
- isLoading: l.isLoading || u.isLoading || d.isLoading || f.isLoading,
38
- isError: l.isError
14
+ canReadEmbedded: e(r, [t.BankAccountReadOrg]),
15
+ canReadExternal: e(r, [t.ExternalBankAccountReadOrg]),
16
+ canAddAccount: e(r, [t.BankAccountWriteOrg])
17
+ };
18
+ }
19
+ function i(e, t) {
20
+ return [e.displayName || t.bankAccountFallbackName, e.accountNumberLast4].filter(Boolean).join(" - ");
21
+ }
22
+ function a(e, t, n) {
23
+ switch (e) {
24
+ case "INTERNAL": return t ? n.bankAccountPoweredBy.replace("{embeddedBankName}", t) : void 0;
25
+ case "EXTERNAL": return n.bankAccountLinked;
26
+ default: return;
27
+ }
28
+ }
29
+ function o({ accounts: e, embeddedBankName: t, messages: n }) {
30
+ return e.map((e) => ({
31
+ value: e.id,
32
+ label: i(e, n),
33
+ sourceLabel: a(e.type, t, n)
34
+ })).sort((e, t) => e.label.localeCompare(t.label));
35
+ }
36
+ function s({ options: e, isLoading: t, selectedId: n, isAddingAccount: r, canAddAccount: i, formValues: a, formErrors: o, isSaving: s }) {
37
+ return t ? { kind: "loading" } : e.length > 0 && !r ? {
38
+ kind: "picker",
39
+ options: e,
40
+ selected: e.find((e) => e.value === n),
41
+ canAddAccount: i
42
+ } : i ? {
43
+ kind: "form",
44
+ values: a,
45
+ errors: o,
46
+ canCancel: e.length > 0,
47
+ isSaving: s
48
+ } : { kind: "restricted" };
49
+ }
50
+ function c(e, t) {
51
+ let n = {}, r = e.accountHolderName.trim(), i = e.accountNumber.trim(), a = e.routingNumber.trim();
52
+ return r ? r.length > 255 && (n.accountHolderName = t.bankAccountHolderNameTooLong) : n.accountHolderName = t.bankAccountHolderNameRequired, i ? /^\d+$/.test(i) ? i.length < 4 ? n.accountNumber = t.bankAccountNumberTooShort : i.length > 17 && (n.accountNumber = t.bankAccountNumberTooLong) : n.accountNumber = t.bankAccountNumberDigitsOnly : n.accountNumber = t.bankAccountNumberRequired, a ? /^\d{9}$/.test(a) || (n.routingNumber = t.bankAccountRoutingNumberInvalid) : n.routingNumber = t.bankAccountRoutingNumberRequired, e.displayName.length > 200 && (n.displayName = t.bankAccountNicknameTooLong), n;
53
+ }
54
+ function l(e) {
55
+ return {
56
+ display_name: e.displayName || void 0,
57
+ account_holder_name: e.accountHolderName.trim() || void 0,
58
+ account_number: e.accountNumber.trim() || void 0,
59
+ routing_number: e.routingNumber.trim() || void 0
39
60
  };
40
61
  }
41
62
  //#endregion
42
- export { o as useReceivableDetails };
63
+ export { n as EMPTY_BANK_ACCOUNT_FORM_VALUES, l as bankAccountFormToPayload, s as buildBankAccountSectionView, o as buildPaymentAccountOptions, r as getBankAccountPermissions, i as getPaymentAccountLineLabel, a as getPaymentAccountSourceLabel, c as validateBankAccountForm };
@@ -1,131 +1,237 @@
1
+ import { minorExponentForCurrency as e } from "../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
2
+ import "../../ui/dist/index10.js";
3
+ import "../../ui/dist/index.js";
4
+ import { isBlankLineItem as t, keepsSavedTaxRates as n, lineItemTaxRateMinorUnits as r, parseQuantity as i, priceInputToMinorUnits as a, taxRateToMinorUnits as o } from "./index6.js";
5
+ import { formatTermDate as s, resolveIssueDate as c, termDueDate as l } from "./index9.js";
6
+ import { formatMoney as u } from "./index12.js";
7
+ import { differenceInCalendarDays as d, parseISO as f } from "date-fns";
1
8
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js
2
- var e = {
3
- invoice: [
4
- "ReceivableFacadeCreateQuotePayload",
5
- "ReceivableCreateBasedOnPayload",
6
- "UpdateQuotePayload",
7
- "UpdateCreditNotePayload",
8
- "UpdateIssuedInvoicePayload"
9
- ],
10
- quote: [
11
- "ReceivableFacadeCreateInvoicePayload",
12
- "ReceivableCreateBasedOnPayload",
13
- "UpdateInvoicePayload",
14
- "UpdateCreditNotePayload",
15
- "UpdateIssuedInvoicePayload"
16
- ]
17
- }, t = {
18
- counterpart_id: "customerId",
19
- counterpart_billing_address_id: "customerId",
20
- counterpart_shipping_address_id: "customerId",
21
- bank_account_id: "bankAccountId",
22
- bank_account_type: "bankAccountId",
23
- payment_terms_id: "paymentTermsId",
24
- "payment_terms.term_final.end_date": "paymentTermsId",
25
- "payment_terms.term_final.number_of_days": "paymentTermsId",
26
- memo: "openingNote",
27
- footer: "closingNote",
28
- "discount.amount": "discount"
29
- }, n = {
30
- quantity: "quantity",
31
- "product.name": "name",
32
- "product.price.value": "price",
33
- "product.price.currency": "price",
34
- "product.measure_unit.name": "measureUnit"
35
- }, r = (e) => typeof e == "number" || /^\d+$/.test(e), i = (e) => /^[A-Z]/.test(e) || e.includes("[") || e.includes("-"), a = (e) => e.filter((e, t) => t !== 0 || e !== "body").filter((e) => r(e) || !i(String(e))).join("."), o = (e) => typeof e == "string" || typeof e == "number", s = (e, t) => e === t || RegExp(`(^|[^A-Za-z0-9_])${t}([^A-Za-z0-9_]|$)`).test(e), c = (e) => typeof e == "object" && !!e;
36
- function l(e) {
37
- if (typeof e == "string") return e.trim() ? {
38
- path: "",
39
- loc: [],
40
- msg: e,
41
- type: ""
42
- } : null;
43
- if (!c(e)) return null;
44
- let { loc: t, msg: n, type: r } = e;
45
- if (typeof n != "string" || !n.trim()) return null;
46
- let i = Array.isArray(t) ? t.filter(o) : [];
9
+ var p = "US", m = 100;
10
+ function h(e) {
11
+ try {
12
+ return new Intl.DisplayNames(void 0, { type: "region" }).of(e) ?? e;
13
+ } catch {
14
+ return e;
15
+ }
16
+ }
17
+ function g({ address: e, issuerCountry: t, formatCountry: n = h }) {
18
+ if (!e) return [];
19
+ let r = [e.city, e.state].filter(Boolean).join(", "), i = e.country === p && t === p;
20
+ return [
21
+ [e.line1, e.line2].filter(Boolean).join(" "),
22
+ [r, e.postal_code].filter(Boolean).join(" "),
23
+ e.country && !i ? n(e.country) : ""
24
+ ].filter(Boolean);
25
+ }
26
+ var _ = { kind: "pending" }, v = (e) => ({
27
+ kind: "text",
28
+ lines: e
29
+ });
30
+ function y(e, t) {
31
+ return e.previewNetDays.replace("{days}", String(t));
32
+ }
33
+ function b(e, t) {
34
+ let n = e.previewEarlyPaymentDays.replace("{days}", String(t.number_of_days));
35
+ return t.discount ? `${n}, ${e.previewEarlyPaymentDiscount.replace("{rate}", String(t.discount / m))}` : n;
36
+ }
37
+ function x({ paymentTermsId: e, paymentTermsCustomDate: t, paymentTerms: n, issueDate: r, messages: i }) {
38
+ let a = {
39
+ dueDate: _,
40
+ paymentTerms: _
41
+ };
42
+ if (e === "custom") {
43
+ if (!t) return a;
44
+ let e = f(t), n = Math.max(0, d(e, r));
45
+ return {
46
+ dueDate: v([s(e)]),
47
+ paymentTerms: v([y(i, n)])
48
+ };
49
+ }
50
+ if (e === "receipt_due") return {
51
+ dueDate: v([s(r)]),
52
+ paymentTerms: v([i.previewDueOnReceipt])
53
+ };
54
+ let o = n?.find((t) => t.id === e);
55
+ if (!o) return a;
56
+ let c = l(o, r), u = [
57
+ o.term_1 && b(i, o.term_1),
58
+ o.term_2 && b(i, o.term_2),
59
+ o.term_final && y(i, o.term_final.number_of_days)
60
+ ].filter((e) => !!e);
47
61
  return {
48
- path: a(i),
49
- loc: i,
50
- msg: n,
51
- type: typeof r == "string" ? r : ""
62
+ dueDate: c ? v([s(c)]) : _,
63
+ paymentTerms: u.length > 0 ? v(u) : _
52
64
  };
53
65
  }
54
- function u(e, t = []) {
55
- if (!c(e) || !Array.isArray(e.detail)) return [];
56
- let n = [], r = /* @__PURE__ */ new Set();
57
- for (let i of e.detail) {
58
- let e = l(i);
59
- if (!e || e.loc.some((e) => typeof e == "string" && t.some((t) => s(e, t)))) continue;
60
- let a = `${e.path}:${e.msg}`;
61
- r.has(a) || (r.add(a), n.push(e));
62
- }
63
- return n;
64
- }
65
- var d = 3;
66
- function f(e, t) {
67
- let n = [...new Set(e.map(({ msg: e }) => e))];
68
- if (!n.length) return "";
69
- let r = n.slice(0, d).join("; "), i = n.length - d;
70
- return i > 0 ? t.apiErrorsSummary.replace("{message}", r).replace("{count}", String(i)) : r;
71
- }
72
- var p = 200;
73
- function m(e) {
74
- let t = e.trim();
75
- if (!(!t || t.length > p) && !t.includes("<")) return t;
76
- }
77
- function h(e, { irrelevantVariants: t, messages: n }) {
78
- if (e instanceof Error) return e.message;
79
- if (typeof e == "string") return m(e) ?? n.unknownError;
80
- if (!c(e)) return n.unknownError;
81
- if (c(e.error) && typeof e.error.message == "string") return e.error.message;
82
- if (Array.isArray(e.detail)) {
83
- let r = f(u(e, t), n);
84
- if (r) return r;
85
- }
86
- return n.unknownError;
87
- }
88
- function g(e) {
89
- return e.replace(/^(invoice|quote)\./, "");
90
- }
91
- var _ = /^line_items\.(?:(add|replace)\.)?(\d+)\.(?:data\.)?(.+)$/;
92
- function v(e, t, n) {
93
- return e === "add" ? n.added?.[t] : e === "replace" ? n.replaced?.[t] : n.created?.[t];
94
- }
95
- function y(e, r) {
96
- let i = {}, a;
97
- for (let { path: o, msg: s } of e) {
98
- if (!o) continue;
99
- let e = g(o);
100
- if (e === "line_items") {
101
- a = s;
102
- continue;
103
- }
104
- let c = t[e];
105
- if (c) {
106
- i[c] = s;
107
- continue;
108
- }
109
- let l = e.match(_);
110
- if (!l) continue;
111
- let [, u, d, f] = l;
112
- if (f === "tax_rate_value") {
113
- i.taxRate = s;
114
- continue;
66
+ function S(e, t) {
67
+ return t ? e.previewTaxId.replace("{taxId}", t) : void 0;
68
+ }
69
+ function C(e) {
70
+ return e.length > 0 ? e : void 0;
71
+ }
72
+ function w(e, t) {
73
+ return e ? {
74
+ name: e.type === "organization" ? e.organization.legal_name : void 0,
75
+ addressLines: C(g({
76
+ address: e.address,
77
+ issuerCountry: e.address?.country
78
+ })),
79
+ taxIdLine: S(t, e.tax_id),
80
+ email: e.email ?? void 0,
81
+ phone: e.phone ?? void 0
82
+ } : {};
83
+ }
84
+ function T(e) {
85
+ let t = "organization" in e ? e.organization : e.individual;
86
+ return {
87
+ name: "organization" in e ? e.organization.legal_name : [e.individual.first_name, e.individual.last_name].filter(Boolean).join(" "),
88
+ email: t.email,
89
+ phone: t.phone
90
+ };
91
+ }
92
+ function E({ counterpart: e, billingAddress: t, issuerCountry: n, messages: r }) {
93
+ if (!e) return { kind: "pending" };
94
+ let { name: i, email: a, phone: o } = T(e);
95
+ return i ? {
96
+ kind: "party",
97
+ name: i,
98
+ addressLines: C(g({
99
+ address: t,
100
+ issuerCountry: n
101
+ })),
102
+ taxIdLine: S(r, e.tax_id),
103
+ email: a || void 0,
104
+ phone: o || void 0
105
+ } : { kind: "pending" };
106
+ }
107
+ function D({ lineItems: e, currency: n, unitNamesById: r, messages: o }) {
108
+ return e.filter((e) => !t(e)).map((e) => {
109
+ let t = a(e.price, n), s = i(e.quantity), c = r[e.measureUnitId] || e.measureUnitName;
110
+ return {
111
+ id: e.id,
112
+ name: e.name,
113
+ quantity: String(s),
114
+ price: u({
115
+ amount: t,
116
+ currency: n,
117
+ fallback: ""
118
+ }),
119
+ ...c ? { unit: c } : {},
120
+ taxable: e.taxable ? o.previewTaxableYes : o.previewTaxableNo,
121
+ amount: u({
122
+ amount: Math.round(t * s),
123
+ currency: n,
124
+ fallback: ""
125
+ })
126
+ };
127
+ });
128
+ }
129
+ function O(t, n) {
130
+ return n ? new Intl.NumberFormat(void 0, {
131
+ style: "currency",
132
+ currency: n,
133
+ currencySign: "accounting"
134
+ }).format(-t / 10 ** e(n)) : "";
135
+ }
136
+ function k(e, i) {
137
+ if (!e.taxRate) return i.previewTax;
138
+ let a = o(e.taxRate), s = n(e.taxRate, e.savedTaxRate);
139
+ return new Set(e.lineItems.filter((e) => e.taxable && !t(e)).map((e) => r(e, a, s))).size > 1 ? i.previewTax : i.previewTaxWithRate.replace("{rate}", String(a / m));
140
+ }
141
+ function A({ totals: e, currency: t, taxLabel: n, messages: r }) {
142
+ let i = (e) => u({
143
+ amount: e,
144
+ currency: t,
145
+ fallback: ""
146
+ }), a = e.discountAmount > 0, o = e.taxableItemsSubtotal > 0, s = e.nonTaxableItemsSubtotal > 0, c = [{
147
+ id: "subtotal",
148
+ label: r.previewSubtotal,
149
+ value: i(e.subtotal)
150
+ }];
151
+ return a && c.push({
152
+ id: "discount",
153
+ label: r.previewDiscount,
154
+ value: O(e.discountAmount, t)
155
+ }), s && (o || a) && c.push({
156
+ id: "nonTaxableSubtotal",
157
+ label: r.previewNonTaxableSubtotal,
158
+ value: i(e.nonTaxableSubtotal),
159
+ muted: !0
160
+ }), o && (s || a) && c.push({
161
+ id: "taxableSubtotal",
162
+ label: r.previewTaxableSubtotal,
163
+ value: i(e.taxableSubtotal),
164
+ muted: !0
165
+ }), c.push({
166
+ id: "tax",
167
+ label: n,
168
+ value: i(e.totalTaxes)
169
+ }), {
170
+ rows: c,
171
+ total: {
172
+ label: r.previewTotal,
173
+ value: i(e.total)
115
174
  }
116
- let p = n[f], m = v(u, Number(d), r);
117
- p && m && (i.lineItems = {
118
- ...i.lineItems,
119
- [m]: {
120
- ...i.lineItems?.[m],
121
- [p]: s
122
- }
123
- });
124
- }
175
+ };
176
+ }
177
+ function j({ bankDetails: e, canReceivePayments: t, messages: n }) {
178
+ let r = e ? [
179
+ [n.previewAccountHolderName, e.accountHolderName],
180
+ [n.previewRoutingNumber, e.routingNumber],
181
+ [n.previewAccountNumber, e.accountNumber]
182
+ ].filter((e) => !!e[1]).map(([e, t]) => e.replace("{value}", t)) : [];
183
+ if (t || r.length !== 0) return {
184
+ showPayOnline: t,
185
+ bankLines: r
186
+ };
187
+ }
188
+ function M({ values: e, totals: t, entity: n, counterpart: r, billingAddress: i, paymentTerms: a, unitNamesById: o, bankDetails: l, canReceivePayments: u = !1, messages: d, today: f = /* @__PURE__ */ new Date() }) {
189
+ let p = D({
190
+ lineItems: e.lineItems,
191
+ currency: e.currency,
192
+ unitNamesById: o,
193
+ messages: d
194
+ }), m = n?.logo?.url, h = w(n, d), g = c(e.issueDate, f);
125
195
  return {
126
- errors: i,
127
- listError: a
196
+ issuer: h,
197
+ logo: m ? {
198
+ kind: "image",
199
+ src: m,
200
+ alt: h.name ? d.previewLogoAlt.replace("{name}", h.name) : d.previewLogoAltNoName
201
+ } : { kind: "placeholder" },
202
+ billTo: E({
203
+ counterpart: r,
204
+ billingAddress: i,
205
+ issuerCountry: n?.address?.country,
206
+ messages: d
207
+ }),
208
+ invoiceNumber: _,
209
+ issueDate: s(g),
210
+ ...x({
211
+ paymentTermsId: e.paymentTermsId,
212
+ paymentTermsCustomDate: e.paymentTermsCustomDate,
213
+ paymentTerms: a,
214
+ issueDate: g,
215
+ messages: d
216
+ }),
217
+ openingNote: e.openingNote || void 0,
218
+ lineItems: p.length > 0 ? {
219
+ kind: "rows",
220
+ rows: p
221
+ } : { kind: "empty" },
222
+ totals: p.length > 0 ? A({
223
+ totals: t,
224
+ currency: e.currency,
225
+ taxLabel: k(e, d),
226
+ messages: d
227
+ }) : void 0,
228
+ closingNote: e.closingNote || void 0,
229
+ payment: j({
230
+ bankDetails: l,
231
+ canReceivePayments: u,
232
+ messages: d
233
+ })
128
234
  };
129
235
  }
130
236
  //#endregion
131
- export { e as UNSUBMITTED_PAYLOAD_VARIANTS, y as apiValidationErrorsToFormErrors, h as getApiErrorMessage, u as parseApiValidationErrors, f as summarizeApiValidationErrors, g as toCreatePayloadPath };
237
+ export { g as buildPreviewAddressLines, x as buildPreviewPaymentTerms, M as buildReceivablePreviewView, h as formatCountryName, O as formatDeduction };