@tesouro/embedded-components-react 0.2.254 → 0.2.256

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 (142) hide show
  1. package/dist/core.js +1 -1
  2. package/dist/index.css +15 -0
  3. package/dist/index.js +2 -2
  4. package/dist/lib/BillPayWidget.d.ts +151 -151
  5. package/dist/lib/BillPayWidget.js +1 -1
  6. package/dist/lib/InsightsWidget.js +1 -1
  7. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +1 -1
  8. package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index3.js +4 -4
  9. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +119 -121
  10. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index7.js +1 -1
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +10 -0
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +40 -0
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +36 -0
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index3.js +28 -0
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index4.js +22 -0
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +7 -0
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +75 -0
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +166 -0
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +17 -0
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +30 -0
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +15 -1
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +9 -0
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +99 -0
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +4 -0
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +4 -0
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +43 -0
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +1 -0
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +50 -0
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +8 -0
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +7 -0
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +93 -0
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +42 -2
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +3 -0
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +8 -0
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +9 -0
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +85 -0
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +3 -0
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +8 -0
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +112 -0
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +1 -0
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +25 -0
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +51 -35
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +235 -1
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +106 -7
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +35 -88
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +122 -1
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +36 -22
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +74 -0
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +15 -8
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index10.js +24 -3
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index11.js +1 -0
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +12 -0
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +83 -3
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js +1 -0
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +18 -0
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +205 -4
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +1 -0
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +10 -0
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +89 -4
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +1 -0
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +10 -0
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +131 -4
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +1 -0
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +10 -0
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +45 -5
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +17 -1
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +149 -7
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index3.js +73 -4
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index33.js +14 -0
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +24 -2
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index35.js +1 -0
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +24 -1
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +145 -6
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index39.js +10 -0
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +8 -0
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +93 -4
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +1 -0
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +7 -0
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index45.js +30 -2
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +1 -0
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +13 -0
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index48.js +88 -5
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index7.js +62 -5
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index9.js +7 -0
  85. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index4.js +2 -2
  86. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index4.js +13 -13
  87. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index7.js +58 -58
  88. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +19 -19
  89. package/dist/libs/tesouro-embedded-components-react/gl-code-table-widget/feature/dist/index7.js +1 -1
  90. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index.js +2 -2
  91. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index10.js +13 -62
  92. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index11.js +66 -0
  93. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index7.js +11 -109
  94. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index8.js +113 -21
  95. package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index9.js +21 -15
  96. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index7.js +1 -1
  97. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +2 -2
  98. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index8.js +3 -3
  99. package/dist/libs/tesouro-embedded-components-react/profile-widget/feature/dist/index4.js +1 -1
  100. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/policyViewModel.js +1 -1
  101. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +15 -15
  102. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +9 -9
  103. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useAddressForm.js +1 -1
  104. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +32 -29
  105. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useSubEntityForm.js +1 -1
  106. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +7 -7
  107. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index8.js +232 -220
  108. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +19 -19
  109. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +171 -138
  110. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/client/index.js +1 -0
  111. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/core/bodySerializer.gen.js +9 -2
  112. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +404 -293
  113. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/withAuthEpoch.js +6 -4
  114. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +5 -5
  115. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetTokenRefreshProvider.js +1 -1
  116. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/hooks.js +6 -3
  117. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  118. package/dist/libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/lib/MoniteWrapper.js +75 -45
  119. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/index.js +1 -1
  120. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js +1 -1
  121. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js +1 -1
  122. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/{index3.js → lib/amountOutputToMajorUnits.js} +1 -1
  123. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/{index14.js → lib/apiErrors.js} +1 -1
  124. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/{index2.js → lib/coerceAmountValueToMinorUnits.js} +1 -1
  125. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/formatCalendarDate.js +13 -0
  126. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/{index4.js → lib/formatMoneyExact.js} +1 -1
  127. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/{index5.js → lib/formatPhoneDisplay.js} +1 -1
  128. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/{index6.js → lib/getInitials.js} +1 -1
  129. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/{index7.js → lib/normalizeAmountOutputCurrencyCode.js} +1 -1
  130. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/{index8.js → lib/parseAmountOutputMajorUnits.js} +1 -1
  131. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/{index9.js → lib/parseDecimalAmountToMinorUnits.js} +2 -2
  132. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/{index10.js → lib/sumAmountOutputsMajorUnits.js} +3 -3
  133. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/{index11.js → lib/usStates.js} +1 -1
  134. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/{index13.js → lib/widgetDomEvents.js} +1 -1
  135. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/{index12.js → lib/widgetTokenManager.js} +1 -1
  136. package/dist/libs/tesouro-embedded-components-react/tags-widget/feature/dist/index8.js +1 -1
  137. package/dist/libs/tesouro-embedded-components-react/team-widget/feature/dist/index11.js +1 -1
  138. package/dist/libs/tesouro-embedded-components-react/team-widget/feature/dist/index4.js +1 -1
  139. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index4.js +4 -4
  140. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index5.js +1 -1
  141. package/dist/packages/shared-ui-shadcn/dist/index.js +3593 -3582
  142. package/package.json +1 -1
@@ -1,9 +1,108 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { VENDOR_SECTION_PROPS_LABELS_EN as e } from "./index2.js";
6
+ import { usePayableSuggestionsQuery as t } from "../../data-access/dist/index11.js";
7
+ import "../../data-access/dist/index.js";
8
+ import { getCounterpartEmail as n, getCounterpartName as r } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
9
+ import { useCounterpartsQuery as i } from "../../../shared/counterpart-management/data-access/dist/index3.js";
10
+ import { useCounterpartDetails as a } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
11
+ import "../../../shared/counterpart-management/feature/dist/index.js";
12
+ import { VendorInlineForm as o } from "./index4.js";
13
+ import { useCallback as s, useEffect as c, useMemo as l, useState as u } from "react";
14
+ import { jsx as d } from "react/jsx-runtime";
1
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js
2
- var e = {
3
- bills: "Bills",
4
- vendors: "Vendors",
5
- settings: "Settings",
6
- billsPlaceholder: "Bills will appear here."
7
- };
16
+ var f = 25, p = 300;
17
+ function m({ payableId: m, counterpartId: h, payableCounterpartId: g, onCounterpartChange: _, labels: v }) {
18
+ let y = {
19
+ ...e,
20
+ ...v
21
+ }, [b, x] = u(""), [S, C] = u(""), [w, T] = u(), [E, D] = u(!1), O = s((e) => {
22
+ D(!0), _(e);
23
+ }, [_]), k = t(m, { enabled: !!m && !h && !g }).data?.suggested_counterpart?.id;
24
+ c(() => {
25
+ !E && !h && !g && k && O(k);
26
+ }, [
27
+ h,
28
+ g,
29
+ E,
30
+ k,
31
+ O
32
+ ]), c(() => {
33
+ let e = setTimeout(() => {
34
+ C(b.trim());
35
+ }, p);
36
+ return () => clearTimeout(e);
37
+ }, [b]);
38
+ let A = i({
39
+ sort: "counterpart_name",
40
+ order: "asc",
41
+ limit: f,
42
+ counterpart_name__icontains: S || void 0,
43
+ is_vendor: !0
44
+ }), j = a({ selectedId: h }), M = l(() => {
45
+ let e = j.counterpart;
46
+ if (!e) return;
47
+ let t = j.bankAccounts?.find((e) => e.is_default_for_currency);
48
+ return {
49
+ name: r(e),
50
+ email: n(e),
51
+ methodLabel: t ? y.achMethod : y.noMethod,
52
+ fields: t ? [
53
+ {
54
+ label: y.accountHolder,
55
+ value: t.account_holder_name ?? ""
56
+ },
57
+ {
58
+ label: y.routingNumber,
59
+ value: t.routing_number ?? ""
60
+ },
61
+ {
62
+ label: y.accountNumber,
63
+ value: "",
64
+ maskedValue: t.account_number ?? ""
65
+ }
66
+ ] : []
67
+ };
68
+ }, [
69
+ j.bankAccounts,
70
+ j.counterpart,
71
+ y
72
+ ]), N = l(() => (A.data?.data ?? []).map((e) => ({
73
+ name: r(e),
74
+ email: n(e),
75
+ onSelect: () => O(e.id)
76
+ })), [A.data, O]), P = s(() => T(void 0), []), F = s((e) => {
77
+ T(void 0), O(e);
78
+ }, [O]);
79
+ return w ? {
80
+ mode: "creating",
81
+ newVendorForm: /* @__PURE__ */ d(o, {
82
+ mode: w,
83
+ counterpart: w === "edit" ? j.counterpart : void 0,
84
+ primaryAddress: w === "edit" ? j.primaryAddress : void 0,
85
+ initialName: w === "create" ? b : void 0,
86
+ onSaved: F,
87
+ onCancel: P
88
+ }),
89
+ onClear: P
90
+ } : M ? {
91
+ mode: "resolved",
92
+ summary: M,
93
+ onEdit: () => T("edit"),
94
+ onClear: () => O(void 0)
95
+ } : {
96
+ mode: "selecting",
97
+ error: A.isError ? y.searchFailed : j.isError ? y.vendorDetailsFailed : void 0,
98
+ search: {
99
+ query: b,
100
+ onQueryChange: x,
101
+ isLoading: A.isLoading,
102
+ onAddVendor: () => T("create"),
103
+ results: N
104
+ }
105
+ };
106
+ }
8
107
  //#endregion
9
- export { e as DEFAULT_TABS_LABELS };
108
+ export { m as useVendorSectionProps };
@@ -1,93 +1,40 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
- import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
7
- import "../../../shared/data-access/dist/index.js";
8
- import { useAnalyticsTrack as n } from "../../../shared/feature/dist/lib/analytics/hooks.js";
9
- import { WidgetProvider as r } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
10
- import { useWidgetConfig as i } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
- import "../../../shared/feature/dist/index.js";
12
- import { BillPayWidgetAnalyticsEvent as a, WIDGET_NAME as o } from "./index2.js";
13
- import { DEFAULT_TABS_LABELS as s } from "./index5.js";
14
- import { BillPayWidgetUi as c } from "../../ui/dist/index31.js";
15
- import "../../ui/dist/index.js";
16
- import { ApprovalPoliciesSettings as l } from "../../../shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js";
17
- import "../../../shared/approval-policy/feature/dist/index.js";
18
- import { CounterpartsWidget as u } from "../../../counterparts-widget/feature/dist/index8.js";
19
- import "../../../counterparts-widget/feature/dist/index.js";
20
- import { useEffect as d, useState as f } from "react";
21
- import { jsx as p } from "react/jsx-runtime";
1
+ import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoneyExact.js";
2
+ import { parseDecimalAmountToMinorUnits as t } from "../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
3
+ import "../../data-access/dist/index.js";
22
4
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js
23
- var m = {
24
- Bills: "bills",
25
- Vendors: "vendors",
26
- Settings: "settings"
27
- }, h = [
28
- m.Settings,
29
- m.Vendors,
30
- m.Bills
31
- ];
32
- function g({ text: e }) {
33
- return /* @__PURE__ */ p("p", {
34
- className: "ttw:text-sm ttw:text-muted-foreground",
35
- children: e
36
- });
5
+ var n = "USD";
6
+ function r(e) {
7
+ return t(e, n) ?? 0;
37
8
  }
38
- function _({ labels: r, tabsLabels: o, approvalPolicyLabels: _, approvalPolicyComponentLabels: v, vendorLabels: y }) {
39
- let b = n();
40
- d(() => {
41
- b(a.Mounted);
42
- }, [b]);
43
- let x = {
44
- ...s,
45
- ...o
46
- }, { initResponse: S } = i(), C = e(S?.scopes, [t.ApprovalPolicyWriteOrg]), w = !S || C, [T, E] = f(m.Settings), D = [{
47
- id: m.Bills,
48
- label: x.bills,
49
- content: /* @__PURE__ */ p(g, { text: x.billsPlaceholder })
50
- }, {
51
- id: m.Vendors,
52
- label: x.vendors,
53
- content: /* @__PURE__ */ p(u, {
54
- ...y,
55
- counterpartType: "vendor",
56
- showTitle: !1,
57
- onViewAllDocuments: () => E(m.Bills)
58
- })
59
- }];
60
- w && D.push({
61
- id: m.Settings,
62
- label: x.settings,
63
- content: /* @__PURE__ */ p(l, {
64
- labels: _,
65
- componentLabels: v
66
- })
67
- });
68
- let O = D.some((e) => e.id === T) ? T : h.find((e) => D.some((t) => t.id === e)) ?? D[0]?.id ?? "";
69
- return /* @__PURE__ */ p(c, {
70
- labels: r,
71
- tabs: D,
72
- selectedTabId: O,
73
- onTabChange: E
74
- });
9
+ function i(e) {
10
+ let t = Number.parseFloat(e);
11
+ return Number.isFinite(t) ? t : 0;
75
12
  }
76
- function v({ baseUrl: e, widgetToken: t, organizationId: n, configClient: i, linkComponent: a, implementation: s, uiFramework: c, errorFallback: l, onError: u, analytics: d, ...f }) {
77
- return /* @__PURE__ */ p(r, {
78
- widgetName: o,
79
- baseUrl: e,
80
- widgetToken: t,
81
- organizationId: n,
82
- configClient: i,
83
- linkComponent: a,
84
- implementation: s,
85
- uiFramework: c,
86
- errorFallback: l,
87
- onError: u,
88
- analytics: d,
89
- children: /* @__PURE__ */ p(_, { ...f })
90
- });
13
+ function a({ values: e, paymentTerm: t, counterpartId: r }) {
14
+ let i = { currency: n };
15
+ return r && (i.counterpart_id = r), e.invoiceNumber && (i.document_id = e.invoiceNumber), e.invoiceDate && (i.issued_at = e.invoiceDate), e.dueDate && (i.due_date = e.dueDate), t?.term_final && t.name && (i.payment_terms = {
16
+ name: t.name,
17
+ ...t.description ? { description: t.description } : {},
18
+ ...t.term_1 ? { term_1: t.term_1 } : {},
19
+ ...t.term_2 ? { term_2: t.term_2 } : {},
20
+ term_final: t.term_final
21
+ }), i;
22
+ }
23
+ function o(e) {
24
+ return e.filter((e) => e.description || e.price).map((e) => ({
25
+ name: e.description,
26
+ quantity: i(e.quantity),
27
+ unit_price: r(e.price),
28
+ ...e.glCode ? { ledger_account_id: e.glCode } : {}
29
+ }));
30
+ }
31
+ function s(t, a) {
32
+ let o = Math.round(i(t) * r(a));
33
+ return e(o / 100, { currencyCode: n });
34
+ }
35
+ function c(t) {
36
+ let a = t.reduce((e, t) => e + Math.round(i(t.quantity) * r(t.price)), 0);
37
+ return e(a / 100, { currencyCode: n });
91
38
  }
92
39
  //#endregion
93
- export { v as BillPayWidgetNative, v as default };
40
+ export { s as displayLineAmount, c as displayTotal, a as mapBillFormToPayload, o as mapLineItemsToPayload };
@@ -1 +1,122 @@
1
- import "./index6.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import "../../../shared/ui/dist/index.js";
7
+ import { BILL_CREATE_MESSAGE_LABELS_EN as t } from "./index2.js";
8
+ import { useReplacePayableLineItemsMutation as n } from "../../data-access/dist/index6.js";
9
+ import { useCreatePayableMutation as r, useSubmitPayableForApprovalMutation as i, useUpdatePayableMutation as a, useValidatePayableMutation as o } from "../../data-access/dist/index7.js";
10
+ import "../../data-access/dist/index.js";
11
+ import { mapBillFormToPayload as s, mapLineItemsToPayload as c } from "./index6.js";
12
+ import { useCallback as l, useRef as u, useState as d } from "react";
13
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js
14
+ var f = {
15
+ document_id: "invoiceNumber",
16
+ issued_at: "invoiceDate",
17
+ due_date: "dueDate",
18
+ payment_terms: "paymentTerms"
19
+ };
20
+ function p(e) {
21
+ return e.type === "type_error.none.not_allowed" || e.msg === "none is not an allowed value";
22
+ }
23
+ function m(e, n = t) {
24
+ let r = {}, i = [];
25
+ for (let t of e) {
26
+ let e = t.loc[0] ?? n.unknownValidationField, a = f[e], o = p(t) ? n.requiredField : t.msg;
27
+ a ? r[a] = o : i.push(n.unmappedValidationError(e, o));
28
+ }
29
+ return i.length && (r.form = i.join(" ")), r;
30
+ }
31
+ function h({ payableId: f, form: p, paymentTerm: h, counterpartId: g, onSaved: _, onPayableCreated: v, onDraftSaved: y, onFinalized: b, labels: x }) {
32
+ let S = {
33
+ ...t,
34
+ ...x
35
+ }, [C, w] = d(), T = f ?? C, [E, D] = d(), O = u(!1), k = r(), A = a(), j = n(), M = o(), N = i(), P = l(async () => {
36
+ let e = s({
37
+ values: p.values,
38
+ paymentTerm: h,
39
+ counterpartId: g
40
+ }), t = T;
41
+ if (t ? await A.mutateAsync({
42
+ path: { payable_id: t },
43
+ body: e
44
+ }) : (t = (await k.mutateAsync({ body: e }))?.id, t && (w(t), v?.(t))), !t) throw Error("Payable was created without an id");
45
+ return await j.mutateAsync({
46
+ path: { payable_id: t },
47
+ body: { data: c(p.lineItems) }
48
+ }), t;
49
+ }, [
50
+ g,
51
+ k,
52
+ p.lineItems,
53
+ p.values,
54
+ v,
55
+ h,
56
+ T,
57
+ j,
58
+ A
59
+ ]);
60
+ return {
61
+ saveDraft: l(async () => {
62
+ if (!O.current) {
63
+ O.current = !0, D("draft");
64
+ try {
65
+ let t = await P();
66
+ p.setErrors(void 0), _?.(t), y?.(t), e.success(S.draftSaved);
67
+ } catch {
68
+ p.setErrors({ form: S.saveFailed });
69
+ } finally {
70
+ D(void 0), O.current = !1;
71
+ }
72
+ }
73
+ }, [
74
+ p,
75
+ S.draftSaved,
76
+ S.saveFailed,
77
+ y,
78
+ _,
79
+ P
80
+ ]),
81
+ finalize: l(async () => {
82
+ if (!O.current) {
83
+ O.current = !0, D("finalize");
84
+ try {
85
+ let t;
86
+ try {
87
+ t = await P();
88
+ } catch {
89
+ p.setErrors({ form: S.saveFailed });
90
+ return;
91
+ }
92
+ _?.(t);
93
+ try {
94
+ let n = await M.mutateAsync({ path: { payable_id: t } });
95
+ if (n.validation_errors.length) {
96
+ p.setErrors(m(n.validation_errors, S));
97
+ return;
98
+ }
99
+ await N.mutateAsync({ path: { payable_id: t } }), p.setErrors(void 0), b?.(t), e.success(S.billFinalized);
100
+ } catch {
101
+ p.setErrors({ form: S.finalizeFailed });
102
+ }
103
+ } finally {
104
+ D(void 0), O.current = !1;
105
+ }
106
+ }
107
+ }, [
108
+ p,
109
+ S,
110
+ b,
111
+ _,
112
+ P,
113
+ N,
114
+ M
115
+ ]),
116
+ payableId: T,
117
+ isSavingDraft: E === "draft",
118
+ isFinalizing: E === "finalize"
119
+ };
120
+ }
121
+ //#endregion
122
+ export { m as mapValidationErrorsToForm, h as useBillCreateController };
@@ -1,25 +1,39 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { Implementation as e } from "../../../shared/feature/dist/lib/WidgetProvider/types.js";
6
- import { useWidgetConfig as t } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
7
- import "../../../shared/feature/dist/index.js";
8
- import { BillPayWidgetMonite as n } from "./index3.js";
9
- import "./index4.js";
10
- import { BillPayWidgetNative as r } from "./index6.js";
11
- import "./index7.js";
12
- import { jsx as i } from "react/jsx-runtime";
1
+ import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoneyExact.js";
2
+ import "../../data-access/dist/index.js";
13
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js
14
- function a({ implementation: a, ...o }) {
15
- let s = t().implementation, c = a ?? s ?? e.Monite;
16
- return c === e.Native ? /* @__PURE__ */ i(r, {
17
- implementation: c,
18
- ...o
19
- }) : /* @__PURE__ */ i(n, {
20
- implementation: c,
21
- ...o
22
- });
4
+ var t = "USD";
5
+ function n() {
6
+ return {
7
+ id: crypto.randomUUID(),
8
+ description: "",
9
+ glCode: "",
10
+ quantity: "1",
11
+ price: "",
12
+ amount: ""
13
+ };
14
+ }
15
+ function r(e) {
16
+ return typeof e == "number" ? (e / 100).toFixed(2) : "";
17
+ }
18
+ function i({ payable: i, lineItems: a }) {
19
+ let o = {
20
+ invoiceNumber: i.document_id ?? "",
21
+ invoiceDate: i.issued_at ?? "",
22
+ dueDate: i.due_date ?? "",
23
+ paymentTerms: "",
24
+ poNumber: ""
25
+ }, s = a.map((n) => ({
26
+ id: n.id,
27
+ description: n.name ?? "",
28
+ glCode: n.ledger_account_id ?? "",
29
+ quantity: n.quantity == null ? "" : String(n.quantity),
30
+ price: r(n.unit_price),
31
+ amount: typeof n.total == "number" ? e(n.total / 100, { currencyCode: t }) : ""
32
+ }));
33
+ return {
34
+ values: o,
35
+ lineItems: s.length ? s : [n()]
36
+ };
23
37
  }
24
38
  //#endregion
25
- export { a as BillPayWidget, a as default };
39
+ export { n as emptyLineItem, i as mapPayableToBillForm };
@@ -0,0 +1,74 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { displayLineAmount as e, displayTotal as t } from "./index6.js";
6
+ import { emptyLineItem as n, mapPayableToBillForm as r } from "./index8.js";
7
+ import { useCallback as i, useEffect as a, useMemo as o, useState as s } from "react";
8
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js
9
+ function c({ payable: c, lineItems: l } = {}) {
10
+ let u = o(() => r({
11
+ payable: c ?? {},
12
+ lineItems: l ?? []
13
+ }), [c, l]), [d, f] = s(u.values), [p, m] = s(u.lineItems), [h, g] = s(), [_, v] = s(!1), [y, b] = s(!1);
14
+ a(() => {
15
+ _ || f(u.values);
16
+ }, [u]), a(() => {
17
+ y || m(u.lineItems);
18
+ }, [u]);
19
+ let x = i((e) => {
20
+ f((t) => ({
21
+ ...t,
22
+ ...e
23
+ })), v(!0);
24
+ }, []), S = i((t, n) => {
25
+ m((r) => r.map((r) => {
26
+ if (r.id !== t) return r;
27
+ let i = {
28
+ ...r,
29
+ ...n
30
+ };
31
+ return {
32
+ ...i,
33
+ amount: e(i.quantity, i.price)
34
+ };
35
+ })), b(!0);
36
+ }, []), C = i((t, n) => {
37
+ m((r) => r.map((r) => {
38
+ if (r.id !== t) return r;
39
+ let i = Number.parseFloat(r.quantity), a = String(Math.max(1, (Number.isFinite(i) ? i : 1) + n));
40
+ return {
41
+ ...r,
42
+ quantity: a,
43
+ amount: e(a, r.price)
44
+ };
45
+ })), b(!0);
46
+ }, []), w = i((e) => {
47
+ m((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e)), b(!0);
48
+ }, []), T = i(() => {
49
+ m((e) => [...e, n()]), b(!0);
50
+ }, []);
51
+ return {
52
+ values: d,
53
+ errors: h,
54
+ setErrors: g,
55
+ onChange: x,
56
+ lineItems: p,
57
+ lineItemRows: o(() => p.map((e) => ({
58
+ ...e,
59
+ onChange: (t) => S(e.id, t),
60
+ onQuantityStep: (t) => C(e.id, t),
61
+ onRemove: () => w(e.id)
62
+ })), [
63
+ p,
64
+ S,
65
+ w,
66
+ C
67
+ ]),
68
+ totalAmountLabel: o(() => t(p), [p]),
69
+ onAddLineItem: T,
70
+ isDirty: _ || y
71
+ };
72
+ }
73
+ //#endregion
74
+ export { c as useBillForm };
@@ -4,33 +4,40 @@ import "./index5.js";
4
4
  import "./index6.js";
5
5
  import "./index7.js";
6
6
  import "./index8.js";
7
- import "./index10.js";
7
+ import "./index9.js";
8
+ import { AddBillDialog as e } from "./index10.js";
8
9
  import "./index11.js";
10
+ import "./index12.js";
9
11
  import "./index13.js";
10
12
  import "./index14.js";
13
+ import "./index15.js";
11
14
  import "./index16.js";
12
15
  import "./index17.js";
16
+ import "./index18.js";
13
17
  import "./index19.js";
14
18
  import "./index20.js";
15
19
  import "./index24.js";
16
20
  import "./index25.js";
17
21
  import "./index26.js";
18
22
  import "./index27.js";
19
- import "./index28.js";
23
+ import { BillCreateScreen as t } from "./index28.js";
20
24
  import "./index29.js";
21
25
  import "./index30.js";
22
- import { BillPayWidgetUi as e } from "./index31.js";
26
+ import { BillPayWidgetUi as n } from "./index31.js";
23
27
  import "./index32.js";
28
+ import "./index33.js";
24
29
  import "./index34.js";
25
30
  import "./index35.js";
26
31
  import "./index36.js";
27
32
  import "./index37.js";
28
- import "./index38.js";
29
- import "./index41.js";
33
+ import { BillsScreen as r } from "./index38.js";
34
+ import "./index39.js";
35
+ import { BillUploadStatusTray as i } from "./index41.js";
30
36
  import "./index43.js";
31
- import "./index45.js";
37
+ import "./index44.js";
38
+ import { ExtractionNotice as a } from "./index45.js";
32
39
  import "./index46.js";
33
40
  import "./index47.js";
34
- import "./index48.js";
41
+ import { SourceDocumentPanel as o } from "./index48.js";
35
42
  import "./index49.js";
36
- export { e as BillPayWidgetUi };
43
+ export { e as AddBillDialog, t as BillCreateScreen, n as BillPayWidgetUi, i as BillUploadStatusTray, r as BillsScreen, a as ExtractionNotice, o as SourceDocumentPanel };
@@ -1,4 +1,25 @@
1
- import "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import "./index7.js";
1
+ import { Dialog as e, DialogContent as t, DialogDescription as n, DialogHeader as r, DialogTitle as i } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { AddBillPanel as a } from "./index7.js";
3
3
  import "./index8.js";
4
- import "react/jsx-runtime";
4
+ import { ADD_BILL_DIALOG_LABELS_EN as o } from "./index9.js";
5
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index10.js
7
+ function l({ open: l, onOpenChange: u, dialogLabels: d, ...f }) {
8
+ let p = {
9
+ ...o,
10
+ ...d
11
+ };
12
+ return /* @__PURE__ */ s(e, {
13
+ open: l,
14
+ onOpenChange: u,
15
+ children: /* @__PURE__ */ c(t, {
16
+ className: "ttw:sm:max-w-2xl",
17
+ children: [/* @__PURE__ */ c(r, {
18
+ className: "ttw:sr-only",
19
+ children: [/* @__PURE__ */ s(i, { children: p.dialogTitle }), /* @__PURE__ */ s(n, { children: p.dialogDescription })]
20
+ }), /* @__PURE__ */ s(a, { ...f })]
21
+ })
22
+ });
23
+ }
24
+ //#endregion
25
+ export { l as AddBillDialog, l as default };
@@ -1 +1,2 @@
1
+ import "./index9.js";
1
2
  import "./index10.js";
@@ -0,0 +1,12 @@
1
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js
2
+ var e = {
3
+ invoiceNumber: "Invoice number",
4
+ invoiceDate: "Invoice date",
5
+ dueDate: "Due date",
6
+ paymentTerms: "Payment terms (optional)",
7
+ paymentTermsPlaceholder: "Select payment terms",
8
+ paymentTermsNone: "No payment terms",
9
+ poNumber: "PO number (optional)"
10
+ };
11
+ //#endregion
12
+ export { e as BILL_FORM_FIELDS_LABELS_EN };