@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
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
6
+ import { WidgetProvider as t } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
7
+ import "../../../shared/feature/dist/index.js";
8
+ import "./index3.js";
9
+ import { InsightsWidgetContextProvider as n, useInsightsWidgetContext as r } from "./index8.js";
10
+ import { InsightsWidgetAnalyticsEvent as i, WIDGET_NAME as a } from "./index2.js";
11
+ import { InsightsWidget as o } from "../../ui/dist/index3.js";
12
+ import "../../ui/dist/index.js";
13
+ import { SingleInsight as s } from "./index10.js";
14
+ import { useEffect as c } from "react";
15
+ import { jsx as l } from "react/jsx-runtime";
16
+ //#region ../../libs/tesouro-embedded-components-react/insights-widget/feature/dist/index11.js
17
+ function u({ labels: t, singleInsightLabels: n }) {
18
+ let a = e();
19
+ c(() => {
20
+ a(i.Mounted);
21
+ }, [a]);
22
+ let { activeFilter: u, setActiveFilter: d, filteredInsights: f, isLoading: p, isError: m, refetch: h, onDismissClick: g, featureLabels: _, createdDateLabel: v } = r();
23
+ return /* @__PURE__ */ l(o, {
24
+ hasInsights: f.length > 0,
25
+ isLoading: p,
26
+ isError: m,
27
+ onRetry: m ? () => void h() : void 0,
28
+ activeFilter: u,
29
+ setActiveFilter: d,
30
+ labels: t,
31
+ activeTabTestId: "insights-widget-active-tab",
32
+ children: f.map((e) => /* @__PURE__ */ l(s, {
33
+ insight: e,
34
+ createdDate: v,
35
+ featureLabels: _,
36
+ onDismissClick: g,
37
+ labels: n
38
+ }, e.id))
39
+ });
40
+ }
41
+ var d = ({ labels: e, singleInsightLabels: t, featureLabels: r, routingEnabled: i, onRoutingToggleChange: a, onLinkExternalAccountClick: o }) => /* @__PURE__ */ l(n, {
42
+ routingEnabled: i,
43
+ onRoutingToggleChange: a,
44
+ onLinkExternalAccountClick: o,
45
+ featureLabels: r,
46
+ children: /* @__PURE__ */ l(u, {
47
+ labels: e,
48
+ singleInsightLabels: t
49
+ })
50
+ });
51
+ function f({ labels: e, singleInsightLabels: n, featureLabels: r, routingEnabled: i, onRoutingToggleChange: o, onLinkExternalAccountClick: s, ...c }) {
52
+ return /* @__PURE__ */ l(t, {
53
+ ...c,
54
+ widgetName: a,
55
+ children: /* @__PURE__ */ l(d, {
56
+ labels: e,
57
+ singleInsightLabels: n,
58
+ featureLabels: r,
59
+ routingEnabled: i,
60
+ onRoutingToggleChange: o,
61
+ onLinkExternalAccountClick: s
62
+ })
63
+ });
64
+ }
65
+ //#endregion
66
+ export { f as InsightsWidget, u as InsightsWidgetInternal, d as InsightsWidgetWithContext };
@@ -1,112 +1,14 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useAllBankAccountsQuery as e } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
6
- import { useAllExternalBankAccountsQuery as t } from "../../../shared/data-access/dist/lib/external-bank-account/useAllExternalBankAccountsQuery.js";
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";
7
3
  import "../../../shared/data-access/dist/index.js";
8
- import { useRefetchWidget as n, useWidgetConfig as r, useWidgetError as i, useWidgetLoading as a } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
- import "../../../shared/feature/dist/index.js";
10
- import { INSIGHTS_FEATURE_LABELS_EN as o } from "./index3.js";
11
- import { useDismissedInsightIds as s } from "./index5.js";
12
- import { shouldShowRoutingOnboardingInsight as c } from "./index6.js";
13
- import { createContext as l, useCallback as u, useContext as d, useMemo as f, useState as p } from "react";
14
- import { jsx as m } from "react/jsx-runtime";
15
4
  //#region ../../libs/tesouro-embedded-components-react/insights-widget/feature/dist/index7.js
16
- var h = l({
17
- activeFilter: "active",
18
- setActiveFilter: () => {},
19
- filteredInsights: [],
20
- isLoading: !1,
21
- isError: !1,
22
- refetch: async () => void 0,
23
- onDismissClick: () => {},
24
- featureLabels: o,
25
- createdDateLabel: ""
26
- }), g = () => d(h), _ = ({ children: l, routingEnabled: d = !1, onRoutingToggleChange: g, onLinkExternalAccountClick: _, featureLabels: v }) => {
27
- let { initResponse: y } = r(), b = a(), x = i(), S = n(), C = f(() => c(y?.scopes), [y?.scopes]), w = f(() => ({
28
- ...o,
29
- ...v
30
- }), [v]), [T, E] = p("active"), [D, O] = p(!1), k = g !== void 0, A = k ? d : D, j = k ? g : O, { dismissedIds: M, isLoading: N, refetch: P, dismissInsight: F } = s(), { data: I, isLoading: L, isError: R, refetch: z } = e(), { data: B, isLoading: V, isError: H, refetch: U } = t(), W = I?.data, G = B?.data, K = b || L || V || N || (W === void 0 || G === void 0) && !(R || H) && !x, q = !!x || R || H, J = u(() => (S(), Promise.all([
31
- z(),
32
- U(),
33
- P()
34
- ])), [
35
- S,
36
- z,
37
- U,
38
- P
39
- ]), Y = f(() => (/* @__PURE__ */ new Date()).toLocaleDateString(), []), X = f(() => {
40
- if (K || q) return [];
41
- let e = [];
42
- if (C && e.push({
43
- id: "insight-routing-onboarding",
44
- isDismissed: M.includes("insight-routing-onboarding"),
45
- canDismiss: !0,
46
- showToggle: !0,
47
- displayText: w.routingOnboardingText,
48
- toggleLabel: w.enableRoutingToggle,
49
- toggleChecked: A,
50
- onToggle: j
51
- }), W !== void 0 && W.length === 0 && e.push({
52
- id: "insight-create-embedded-account",
53
- isDismissed: M.includes("insight-create-embedded-account"),
54
- canDismiss: !0,
55
- showToggle: !1,
56
- displayText: w.createAccountText
57
- }), G !== void 0 && G.length === 0 && e.push({
58
- id: "insight-connect-external-account",
59
- isDismissed: M.includes("insight-connect-external-account"),
60
- canDismiss: !0,
61
- showToggle: !1,
62
- displayText: w.connectExternalText,
63
- actionText: _ ? w.linkAccountAction : void 0,
64
- onActionClick: _
65
- }), G !== void 0) {
66
- for (let t of G) if (t.verificationStatus !== "VERIFIED") {
67
- let n = `insight-verify-external-${t.id}`;
68
- e.push({
69
- id: n,
70
- isDismissed: M.includes(n),
71
- canDismiss: !0,
72
- showToggle: !1,
73
- displayText: w.verifyExternalAccountText(t.nickname ?? "")
74
- });
75
- }
76
- }
77
- return e;
78
- }, [
79
- W,
80
- G,
81
- K,
82
- q,
83
- M,
84
- C,
85
- A,
86
- j,
87
- _,
88
- w
89
- ]), Z = u((e) => {
90
- F(e);
91
- }, [F]), Q = f(() => T === "dismissed" ? X.filter((e) => M.includes(e.id)) : X.filter((e) => !M.includes(e.id)), [
92
- X,
93
- T,
94
- M
95
- ]);
96
- return /* @__PURE__ */ m(h.Provider, {
97
- value: {
98
- activeFilter: T,
99
- setActiveFilter: E,
100
- filteredInsights: Q,
101
- isLoading: K,
102
- isError: q,
103
- refetch: J,
104
- onDismissClick: Z,
105
- featureLabels: w,
106
- createdDateLabel: Y
107
- },
108
- children: l
109
- });
110
- };
5
+ var n = [t.BankAccountReadOrg], r = [t.ExternalBankAccountReadOrg];
6
+ function i(t) {
7
+ let i = new Set(t ?? []);
8
+ return {
9
+ canReadBankAccounts: e(i, n),
10
+ canReadExternalBankAccounts: e(i, r)
11
+ };
12
+ }
111
13
  //#endregion
112
- export { _ as InsightsWidgetContextProvider, g as useInsightsWidgetContext };
14
+ export { i as getInsightsPermissions };
@@ -1,23 +1,115 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { ClipboardCheck as t } from "lucide-react";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useAllBankAccountsQuery as e } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
6
+ import { useAllExternalBankAccountsQuery as t } from "../../../shared/data-access/dist/lib/external-bank-account/useAllExternalBankAccountsQuery.js";
7
+ import "../../../shared/data-access/dist/index.js";
8
+ import { useRefetchWidget as n, useWidgetConfig as r, useWidgetError as i, useWidgetLoading as a } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
+ import "../../../shared/feature/dist/index.js";
10
+ import { INSIGHTS_FEATURE_LABELS_EN as o } from "./index3.js";
11
+ import { useDismissedInsightIds as s } from "./index5.js";
12
+ import { shouldShowRoutingOnboardingInsight as c } from "./index6.js";
13
+ import { getInsightsPermissions as l } from "./index7.js";
14
+ import { createContext as u, useCallback as d, useContext as f, useMemo as p, useState as m } from "react";
15
+ import { jsx as h } from "react/jsx-runtime";
3
16
  //#region ../../libs/tesouro-embedded-components-react/insights-widget/feature/dist/index8.js
4
- function n(n, r, i) {
5
- return {
6
- displayText: n.displayText,
7
- createdDate: i,
8
- badgeLabel: r.onboardingBadgeLabel,
9
- badgeIcon: /* @__PURE__ */ e(t, {
10
- className: "ttw:size-4",
11
- "aria-hidden": !0
12
- }),
13
- showDismissButton: n.canDismiss && !n.isDismissed,
14
- showToggle: n.showToggle,
15
- toggleLabel: n.toggleLabel,
16
- toggleChecked: n.toggleChecked,
17
- onToggle: n.onToggle,
18
- actionText: n.actionText,
19
- onActionClick: n.onActionClick
20
- };
21
- }
17
+ var g = u({
18
+ activeFilter: "active",
19
+ setActiveFilter: () => {},
20
+ filteredInsights: [],
21
+ isLoading: !1,
22
+ isError: !1,
23
+ refetch: async () => void 0,
24
+ onDismissClick: () => {},
25
+ featureLabels: o,
26
+ createdDateLabel: ""
27
+ }), _ = () => f(g), v = ({ children: u, routingEnabled: f = !1, onRoutingToggleChange: _, onLinkExternalAccountClick: v, featureLabels: y }) => {
28
+ let { initResponse: b } = r(), x = a(), S = i(), C = n(), w = p(() => c(b?.scopes), [b?.scopes]), { canReadBankAccounts: T, canReadExternalBankAccounts: E } = p(() => l(b?.scopes), [b?.scopes]), D = p(() => ({
29
+ ...o,
30
+ ...y
31
+ }), [y]), [O, k] = m("active"), [A, j] = m(!1), M = _ !== void 0, N = M ? f : A, P = M ? _ : j, { dismissedIds: F, isLoading: I, refetch: L, dismissInsight: R } = s(), { data: z, isLoading: B, isError: V, refetch: H } = e({ enabled: T }), { data: U, isLoading: W, isError: G, refetch: K } = t({ enabled: E }), q = z?.data, J = U?.data, Y = x || B || W || I || !((!T || q !== void 0) && (!E || J !== void 0)) && !(V || G) && !S, X = !!S || V || G, Z = d(() => (C(), Promise.all([
32
+ T ? H() : void 0,
33
+ E ? K() : void 0,
34
+ L()
35
+ ])), [
36
+ C,
37
+ H,
38
+ K,
39
+ L,
40
+ T,
41
+ E
42
+ ]), Q = p(() => (/* @__PURE__ */ new Date()).toLocaleDateString(), []), $ = p(() => {
43
+ if (Y || X) return [];
44
+ let e = [];
45
+ if (w && e.push({
46
+ id: "insight-routing-onboarding",
47
+ isDismissed: F.includes("insight-routing-onboarding"),
48
+ canDismiss: !0,
49
+ showToggle: !0,
50
+ displayText: D.routingOnboardingText,
51
+ toggleLabel: D.enableRoutingToggle,
52
+ toggleChecked: N,
53
+ onToggle: P
54
+ }), q !== void 0 && q.length === 0 && e.push({
55
+ id: "insight-create-embedded-account",
56
+ isDismissed: F.includes("insight-create-embedded-account"),
57
+ canDismiss: !0,
58
+ showToggle: !1,
59
+ displayText: D.createAccountText
60
+ }), J !== void 0 && J.length === 0 && e.push({
61
+ id: "insight-connect-external-account",
62
+ isDismissed: F.includes("insight-connect-external-account"),
63
+ canDismiss: !0,
64
+ showToggle: !1,
65
+ displayText: D.connectExternalText,
66
+ actionText: v ? D.linkAccountAction : void 0,
67
+ onActionClick: v
68
+ }), J !== void 0) {
69
+ for (let t of J) if (t.verificationStatus !== "VERIFIED") {
70
+ let n = `insight-verify-external-${t.id}`;
71
+ e.push({
72
+ id: n,
73
+ isDismissed: F.includes(n),
74
+ canDismiss: !0,
75
+ showToggle: !1,
76
+ displayText: D.verifyExternalAccountText(t.nickname ?? "")
77
+ });
78
+ }
79
+ }
80
+ return e;
81
+ }, [
82
+ q,
83
+ J,
84
+ Y,
85
+ X,
86
+ F,
87
+ w,
88
+ N,
89
+ P,
90
+ v,
91
+ D
92
+ ]), ee = d((e) => {
93
+ R(e);
94
+ }, [R]), te = p(() => O === "dismissed" ? $.filter((e) => F.includes(e.id)) : $.filter((e) => !F.includes(e.id)), [
95
+ $,
96
+ O,
97
+ F
98
+ ]);
99
+ return /* @__PURE__ */ h(g.Provider, {
100
+ value: {
101
+ activeFilter: O,
102
+ setActiveFilter: k,
103
+ filteredInsights: te,
104
+ isLoading: Y,
105
+ isError: X,
106
+ refetch: Z,
107
+ onDismissClick: ee,
108
+ featureLabels: D,
109
+ createdDateLabel: Q
110
+ },
111
+ children: u
112
+ });
113
+ };
22
114
  //#endregion
23
- export { n as mapInsightToRowView };
115
+ export { v as InsightsWidgetContextProvider, _ as useInsightsWidgetContext };
@@ -1,17 +1,23 @@
1
- import { mapInsightToRowView as e } from "./index8.js";
2
- import { SingleInsight as t } from "../../ui/dist/index5.js";
3
- import "../../ui/dist/index.js";
4
- import { jsx as n } from "react/jsx-runtime";
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { ClipboardCheck as t } from "lucide-react";
5
3
  //#region ../../libs/tesouro-embedded-components-react/insights-widget/feature/dist/index9.js
6
- var r = ({ insight: r, createdDate: i, featureLabels: a, onDismissClick: o, labels: s }) => {
7
- let c = e(r, a, i);
8
- return /* @__PURE__ */ n(t, {
9
- row: c,
10
- labels: s,
11
- onDismissClick: c.showDismissButton ? () => {
12
- o(r.id);
13
- } : void 0
14
- });
15
- };
4
+ function n(n, r, i) {
5
+ return {
6
+ displayText: n.displayText,
7
+ createdDate: i,
8
+ badgeLabel: r.onboardingBadgeLabel,
9
+ badgeIcon: /* @__PURE__ */ e(t, {
10
+ className: "ttw:size-4",
11
+ "aria-hidden": !0
12
+ }),
13
+ showDismissButton: n.canDismiss && !n.isDismissed,
14
+ showToggle: n.showToggle,
15
+ toggleLabel: n.toggleLabel,
16
+ toggleChecked: n.toggleChecked,
17
+ onToggle: n.onToggle,
18
+ actionText: n.actionText,
19
+ onActionClick: n.onActionClick
20
+ };
21
+ }
16
22
  //#endregion
17
- export { r as SingleInsight };
23
+ export { n as mapInsightToRowView };
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { extractApiErrorMessage as e } from "../../../shared/util/dist/index14.js";
5
+ import { extractApiErrorMessage as e } from "../../../shared/util/dist/lib/apiErrors.js";
6
6
  import { defaultPaymentValues as t, defaultSendValues as n, fromMajorUnits as r, hasPaymentErrors as i, hasSendErrors as a, splitEmailList as o, validatePaymentValues as s, validateSendValues as c } from "./index5.js";
7
7
  import { useSendReceivableEmailMutation as l } from "../../data-access/dist/index3.js";
8
8
  import { useAcceptReceivableMutation as ee, useCancelReceivableMutation as u, useCloneReceivableMutation as d, useDeclineReceivableMutation as f, useDeleteReceivableMutation as p, useIssueReceivableMutation as m } from "../../data-access/dist/index4.js";
@@ -3,8 +3,8 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { usePaymentTermsQuery as e } from "../../../shared/data-access/dist/lib/reference-data/usePaymentTermsQuery.js";
6
- import { getStateOptions as t } from "../../../shared/util/dist/index11.js";
7
- import { extractApiErrorMessage as n } from "../../../shared/util/dist/index14.js";
6
+ import { getStateOptions as t } from "../../../shared/util/dist/lib/usStates.js";
7
+ import { extractApiErrorMessage as n } from "../../../shared/util/dist/lib/apiErrors.js";
8
8
  import { COUNTERPART_MESSAGE_LABELS_EN as r } from "../../../shared/counterpart-management/feature/dist/lib/labels.js";
9
9
  import { useCounterpartAddressesQuery as i } from "../../../shared/counterpart-management/data-access/dist/index7.js";
10
10
  import { useCounterpartForm as ee } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
@@ -7,9 +7,9 @@ import { useAllOrganizationRolesQuery as t } from "../../../shared/data-access/d
7
7
  import { useAllOrganizationUsersQuery as n } from "../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
8
8
  import "../../../shared/ui/dist/index.js";
9
9
  import { useAnalyticsTrack as ee } from "../../../shared/feature/dist/lib/analytics/hooks.js";
10
- import { getInitials as te } from "../../../shared/util/dist/index6.js";
11
- import { TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT as ne, emitWidgetDomEvent as r } from "../../../shared/util/dist/index13.js";
12
- import { extractApiErrorMessage as re } from "../../../shared/util/dist/index14.js";
10
+ import { getInitials as te } from "../../../shared/util/dist/lib/getInitials.js";
11
+ import { TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT as ne, emitWidgetDomEvent as r } from "../../../shared/util/dist/lib/widgetDomEvents.js";
12
+ import { extractApiErrorMessage as re } from "../../../shared/util/dist/lib/apiErrors.js";
13
13
  import { useWidgetConfig as ie, useWidgetError as ae, useWidgetLoading as oe } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
14
14
  import "../../../shared/feature/dist/index.js";
15
15
  import { filterRolesForOrganization as se } from "../../../../shared/util-validation/dist/index6.js";
@@ -4,7 +4,7 @@
4
4
  "use client";
5
5
  import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
6
6
  import { WidgetProvider as t } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
7
- import { formatPhoneDisplay as n } from "../../../shared/util/dist/index5.js";
7
+ import { formatPhoneDisplay as n } from "../../../shared/util/dist/lib/formatPhoneDisplay.js";
8
8
  import "../../../shared/feature/dist/index.js";
9
9
  import { DEFAULT_FEATURE_LABELS as r } from "./index3.js";
10
10
  import { ProfileWidgetAnalyticsEvent as i, WIDGET_NAME as a } from "./index2.js";
@@ -1,4 +1,4 @@
1
- import { formatMoneyExact as e } from "../../../../util/dist/index4.js";
1
+ import { formatMoneyExact as e } from "../../../../util/dist/lib/formatMoneyExact.js";
2
2
  import { formatLabel as t } from "./labels.js";
3
3
  import { amountConditionsOverlap as n } from "../../../util/dist/lib/amountCoverage.js";
4
4
  import { formatMinorUnitsAsAmountInput as r } from "../../../util/dist/lib/amountInput.js";
@@ -1,21 +1,21 @@
1
- import "../../../util/dist/index14.js";
1
+ import "../../../util/dist/lib/apiErrors.js";
2
2
  import { COUNTERPART_MESSAGE_LABELS_EN as e } from "./lib/labels.js";
3
- import { CounterpartFormSheet as t } from "../../ui/dist/index8.js";
4
- import { BankAccountFormSheet as n } from "../../ui/dist/index10.js";
5
- import { AddressFormSheet as r } from "../../ui/dist/index12.js";
6
- import { ConfirmDeleteDialog as i } from "../../ui/dist/index13.js";
3
+ import { CounterpartFormFields as t, CounterpartFormSheet as n } from "../../ui/dist/index8.js";
4
+ import { BankAccountFormSheet as r } from "../../ui/dist/index10.js";
5
+ import { AddressFormSheet as i } from "../../ui/dist/index12.js";
6
+ import { ConfirmDeleteDialog as a } from "../../ui/dist/index13.js";
7
7
  import "../../ui/dist/index.js";
8
- import { buildAnalyticsMap as a, buildCounterpartRows as o, formatCounterpartDate as s, formatMoney as c, hasSelectedText as l } from "./lib/helpers.js";
9
- import { useCounterpartsQuery as u } from "../../data-access/dist/index3.js";
8
+ import { buildAnalyticsMap as o, buildCounterpartRows as s, formatCounterpartDate as c, formatMoney as l, getCounterpartEmail as u, getCounterpartName as d, hasSelectedText as f } from "./lib/helpers.js";
9
+ import { useCounterpartsQuery as p } from "../../data-access/dist/index3.js";
10
10
  import "../../data-access/dist/index5.js";
11
- import { useCounterpartAddressesForRowsQuery as d, useCounterpartAddressesQuery as f } from "../../data-access/dist/index7.js";
11
+ import { useCounterpartAddressesForRowsQuery as m, useCounterpartAddressesQuery as h } from "../../data-access/dist/index7.js";
12
12
  import "../../data-access/dist/index.js";
13
- import { useAddressForm as p } from "./lib/useAddressForm.js";
14
- import { useCounterpartDetails as m } from "./lib/useCounterpartDetails.js";
15
- import { useCounterpartForm as h } from "./lib/useCounterpartForm.js";
13
+ import { useAddressForm as g } from "./lib/useAddressForm.js";
14
+ import { useCounterpartDetails as _ } from "./lib/useCounterpartDetails.js";
15
+ import { useCounterpartForm as v } from "./lib/useCounterpartForm.js";
16
16
  import "./lib/useCounterpartSelector.js";
17
- import { CounterpartSelector as g } from "./lib/CounterpartSelector.js";
18
- import { useDeleteController as _ } from "./lib/useDeleteController.js";
17
+ import { CounterpartSelector as y } from "./lib/CounterpartSelector.js";
18
+ import { useDeleteController as b } from "./lib/useDeleteController.js";
19
19
  import "./lib/useSubEntityForm.js";
20
- import { useBankAccountForm as v } from "./lib/subEntityForms.js";
21
- export { r as AddressFormSheet, n as BankAccountFormSheet, e as COUNTERPART_MESSAGE_LABELS_EN, i as ConfirmDeleteDialog, t as CounterpartFormSheet, g as CounterpartSelector, a as buildAnalyticsMap, o as buildCounterpartRows, s as formatCounterpartDate, c as formatMoney, l as hasSelectedText, p as useAddressForm, v as useBankAccountForm, d as useCounterpartAddressesForRowsQuery, f as useCounterpartAddressesQuery, m as useCounterpartDetails, h as useCounterpartForm, u as useCounterpartsQuery, _ as useDeleteController };
20
+ import { useBankAccountForm as x } from "./lib/subEntityForms.js";
21
+ export { i as AddressFormSheet, r as BankAccountFormSheet, e as COUNTERPART_MESSAGE_LABELS_EN, a as ConfirmDeleteDialog, t as CounterpartFormFields, n as CounterpartFormSheet, y as CounterpartSelector, o as buildAnalyticsMap, s as buildCounterpartRows, c as formatCounterpartDate, l as formatMoney, u as getCounterpartEmail, d as getCounterpartName, f as hasSelectedText, g as useAddressForm, x as useBankAccountForm, m as useCounterpartAddressesForRowsQuery, h as useCounterpartAddressesQuery, _ as useCounterpartDetails, v as useCounterpartForm, p as useCounterpartsQuery, b as useDeleteController };
@@ -1,4 +1,4 @@
1
- import { formatMoneyExact as e } from "../../../../util/dist/index4.js";
1
+ import { formatMoneyExact as e } from "../../../../util/dist/lib/formatMoneyExact.js";
2
2
  import { COUNTERPART_MESSAGE_LABELS_EN as t } from "./labels.js";
3
3
  import { EMPTY_ADDRESS_FORM_VALUES as n } from "../../../ui/dist/index5.js";
4
4
  import "../../../ui/dist/index.js";
@@ -330,17 +330,17 @@ function R(e, t) {
330
330
  function z(e) {
331
331
  return Object.values(e).some(Boolean);
332
332
  }
333
- function B(e, n, r = t, i = "customer") {
334
- let a = {};
335
- if (e.entityType === "organization" ? e.legalName.trim().length === 0 && (a.legalName = r.legalNameRequired) : (e.firstName.trim().length === 0 && (a.firstName = r.firstNameRequired), e.lastName.trim().length === 0 && (a.lastName = r.lastNameRequired)), e.email.trim().length === 0 ? a.email = r.emailRequired : L(e.email.trim()) || (a.email = r.emailInvalid), i === "vendor" || E(e.address)) {
333
+ function B(e, n, r = t, i = "customer", { requireAddress: a = !0 } = {}) {
334
+ let o = {};
335
+ if (e.entityType === "organization" ? e.legalName.trim().length === 0 && (o.legalName = r.legalNameRequired) : (e.firstName.trim().length === 0 && (o.firstName = r.firstNameRequired), e.lastName.trim().length === 0 && (o.lastName = r.lastNameRequired)), e.email.trim().length === 0 ? o.email = r.emailRequired : L(e.email.trim()) || (o.email = r.emailInvalid), i === "vendor" && a || E(e.address)) {
336
336
  let t = R(e.address, r);
337
- z(t) && (a.address = t);
337
+ z(t) && (o.address = t);
338
338
  }
339
- if (n === "create" && i === "vendor" && j(e)) {
339
+ if (i === "vendor" && j(e)) {
340
340
  let t = {}, n = e.bankAccount.routingNumber.trim(), i = e.bankAccount.accountNumber.trim();
341
- n.length > 0 && n.length !== 9 && (t.routingNumber = r.routingNumberInvalid), i.length > 0 && (i.length < 9 || i.length > 12) && (t.accountNumber = r.accountNumberInvalid), z(t) && (a.bankAccount = t);
341
+ n.length > 0 && n.length !== 9 && (t.routingNumber = r.routingNumberInvalid), i.length > 0 && (i.length < 9 || i.length > 12) && (t.accountNumber = r.accountNumberInvalid), z(t) && (o.bankAccount = t);
342
342
  }
343
- return a;
343
+ return o;
344
344
  }
345
345
  function V(e) {
346
346
  let { address: t, bankAccount: n, ...r } = e;
@@ -361,4 +361,4 @@ function G() {
361
361
  return !!(e && e.toString().length > 0);
362
362
  }
363
363
  //#endregion
364
- export { S as addressFormToCreatePayload, C as addressFormToUpdatePayload, x as addressResponseToFormValues, F as bankAccountFormToCreatePayload, I as bankAccountFormToUpdatePayload, P as bankAccountToFormValues, p as buildAnalyticsMap, y as buildBankAccountItems, _ as buildCounterpartDetailsView, m as buildCounterpartRows, M as counterpartFormBankAccountToCreatePayload, O as counterpartFormToCreatePayload, k as counterpartFormToUpdatePayload, T as counterpartToFormValues, N as emptyBankAccountFormValues, w as emptyCounterpartFormValues, l as formatCounterpartDate, s as formatMoney, o as fromMinorUnits, u as getCounterpartName, i as getCurrencyOptions, U as hasBankAccountFormErrors, A as hasCounterpartFormAddressValues, j as hasCounterpartFormBankAccountValues, V as hasCounterpartFormErrors, G as hasSelectedText, W as validateAddressForm, H as validateBankAccountForm, B as validateCounterpartForm };
364
+ export { S as addressFormToCreatePayload, C as addressFormToUpdatePayload, x as addressResponseToFormValues, F as bankAccountFormToCreatePayload, I as bankAccountFormToUpdatePayload, P as bankAccountToFormValues, p as buildAnalyticsMap, y as buildBankAccountItems, _ as buildCounterpartDetailsView, m as buildCounterpartRows, M as counterpartFormBankAccountToCreatePayload, O as counterpartFormToCreatePayload, k as counterpartFormToUpdatePayload, T as counterpartToFormValues, N as emptyBankAccountFormValues, w as emptyCounterpartFormValues, l as formatCounterpartDate, s as formatMoney, o as fromMinorUnits, d as getCounterpartEmail, u as getCounterpartName, i as getCurrencyOptions, U as hasBankAccountFormErrors, A as hasCounterpartFormAddressValues, j as hasCounterpartFormBankAccountValues, V as hasCounterpartFormErrors, G as hasSelectedText, W as validateAddressForm, H as validateBankAccountForm, B as validateCounterpartForm };
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { extractApiErrorMessage as e } from "../../../../util/dist/index14.js";
5
+ import { extractApiErrorMessage as e } from "../../../../util/dist/lib/apiErrors.js";
6
6
  import { addressFormToCreatePayload as t, addressFormToUpdatePayload as n, addressResponseToFormValues as r, validateAddressForm as i } from "./helpers.js";
7
7
  import { useCreateCounterpartAddressMutation as a, useUpdateCounterpartAddressMutation as o } from "../../../data-access/dist/index7.js";
8
8
  import "../../../data-access/dist/index.js";
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { extractApiErrorMessage as e } from "../../../../util/dist/index14.js";
5
+ import { extractApiErrorMessage as e } from "../../../../util/dist/lib/apiErrors.js";
6
6
  import { addressFormToCreatePayload as t, addressFormToUpdatePayload as n, addressResponseToFormValues as r, counterpartFormBankAccountToCreatePayload as i, counterpartFormToCreatePayload as a, counterpartFormToUpdatePayload as o, counterpartToFormValues as s, emptyCounterpartFormValues as c, hasCounterpartFormAddressValues as l, hasCounterpartFormBankAccountValues as u, hasCounterpartFormErrors as d, validateCounterpartForm as f } from "./helpers.js";
7
7
  import { useCreateCounterpartMutation as p, useUpdateCounterpartMutation as m } from "../../../data-access/dist/index3.js";
8
8
  import { useCreateCounterpartBankAccountMutation as h } from "../../../data-access/dist/index5.js";
@@ -22,23 +22,23 @@ function S(e, t) {
22
22
  let n = r(t);
23
23
  return e.address.line1.trim() !== n.line1.trim() || e.address.line2.trim() !== n.line2.trim() || e.address.city.trim() !== n.city.trim() || e.address.state.trim() !== n.state.trim() || e.address.postalCode.trim() !== n.postalCode.trim();
24
24
  }
25
- function C({ view: r, setView: C, selectedId: w, setSelectedId: T, messages: E, counterpartType: D, counterpart: O, primaryAddress: k }) {
26
- let A = p(), j = g(), M = h(), N = m(), P = _(), [F, I] = y(() => c()), [L, R] = y({}), [z, B] = y();
25
+ function C({ view: r, setView: C, selectedId: w, setSelectedId: T, messages: E, counterpartType: D, counterpart: O, primaryAddress: k, requireAddress: A }) {
26
+ let j = p(), M = g(), N = h(), P = m(), F = _(), [I, L] = y(() => c()), [R, z] = y({}), [B, V] = y(), H = j.isPending || M.isPending || N.isPending || P.isPending || F.isPending, U = D === "vendor" && A !== !1;
27
27
  return {
28
- values: F,
29
- errors: L,
30
- setValues: I,
31
- isSubmitting: A.isPending || j.isPending || M.isPending || N.isPending || P.isPending,
32
- isSubmitDisabled: !b(F) || F.email.trim().length === 0 || D === "vendor" && !x(F),
28
+ values: I,
29
+ errors: R,
30
+ setValues: L,
31
+ isSubmitting: H,
32
+ isSubmitDisabled: !b(I) || I.email.trim().length === 0 || U && !x(I),
33
33
  openCreate: v(() => {
34
- T(void 0), B(void 0), I(c("organization", D)), R({}), C("create");
34
+ T(void 0), V(void 0), L(c("organization", D)), z({}), C("create");
35
35
  }, [
36
36
  D,
37
37
  T,
38
38
  C
39
39
  ]),
40
40
  openEdit: v(() => {
41
- O && (B(void 0), I(s(O, k)), R({}), C("edit"));
41
+ O && (V(void 0), L(s(O, k)), z({}), C("edit"));
42
42
  }, [
43
43
  O,
44
44
  k,
@@ -48,46 +48,49 @@ function C({ view: r, setView: C, selectedId: w, setSelectedId: T, messages: E,
48
48
  C("none");
49
49
  }, [C]),
50
50
  submit: v(async () => {
51
- let s = f(F, r === "edit" ? "edit" : "create", E, D);
51
+ let s = f(I, r === "edit" ? "edit" : "create", E, D, { requireAddress: A });
52
52
  if (d(s)) {
53
- R(s);
53
+ z(s);
54
54
  return;
55
55
  }
56
- R({});
57
- let c = z;
56
+ z({});
57
+ let c = B;
58
58
  try {
59
- r === "edit" && w ? (B(void 0), await N.mutateAsync({
59
+ r === "edit" && w ? (V(void 0), await P.mutateAsync({
60
60
  path: { counterpart_id: w },
61
- body: o(F, D)
62
- }), k ? S(F, k) && await P.mutateAsync({
61
+ body: o(I, D)
62
+ }), k ? S(I, k) && await F.mutateAsync({
63
63
  path: {
64
64
  counterpart_id: w,
65
65
  address_id: k.id
66
66
  },
67
- body: n(F.address)
68
- }) : l(F) && await j.mutateAsync({
67
+ body: n(I.address)
68
+ }) : l(I) && await M.mutateAsync({
69
69
  path: { counterpart_id: w },
70
- body: t(F.address)
71
- }), C("none")) : (c ||= (await A.mutateAsync({ body: a(F, D) }))?.id, c && D === "vendor" && u(F) && (B(c), await M.mutateAsync({
70
+ body: t(I.address)
71
+ }), D === "vendor" && u(I) && await N.mutateAsync({
72
+ path: { counterpart_id: w },
73
+ body: i(I.bankAccount)
74
+ }), C("none")) : (c ||= (await j.mutateAsync({ body: a(I, D) }))?.id, c && D === "vendor" && u(I) && (V(c), await N.mutateAsync({
72
75
  path: { counterpart_id: c },
73
- body: i(F.bankAccount)
74
- })), B(void 0), C("none"), c && T(c));
76
+ body: i(I.bankAccount)
77
+ })), V(void 0), C("none"), c && T(c));
75
78
  } catch (t) {
76
- c && (B(c), T(c)), R({ form: e(t) ?? E.genericError });
79
+ c && (V(c), T(c)), z({ form: e(t) ?? E.genericError });
77
80
  }
78
81
  }, [
79
82
  r,
80
- F,
83
+ I,
81
84
  w,
82
- z,
85
+ B,
83
86
  E,
84
87
  D,
85
88
  k,
86
- j,
87
89
  M,
88
- A,
89
- P,
90
90
  N,
91
+ j,
92
+ F,
93
+ P,
91
94
  C,
92
95
  T
93
96
  ])
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { extractApiErrorMessage as e } from "../../../../util/dist/index14.js";
5
+ import { extractApiErrorMessage as e } from "../../../../util/dist/lib/apiErrors.js";
6
6
  import { useCallback as t, useState as n } from "react";
7
7
  //#region ../../libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useSubEntityForm.js
8
8
  var r = {