@tesouro/embedded-components-react 0.2.259 → 0.2.261

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 (26) hide show
  1. package/README.md +45 -37
  2. package/dist/index.d.ts +236 -128
  3. package/dist/index.js +13 -12
  4. package/dist/lib/CardsWidget.d.ts +142 -14
  5. package/dist/lib/ProfileWidget.d.ts +16 -0
  6. package/dist/lib/SettingsWidget.d.ts +65 -3
  7. package/dist/lib/SettingsWidget.js +3 -2
  8. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index5.js +13 -8
  9. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index7.js +31 -30
  10. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +56 -34
  11. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListDetailsSheet.js +20 -20
  12. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/labels.js +8 -0
  13. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index22.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index327.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index597.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/profile-widget/feature/dist/index4.js +59 -56
  17. package/dist/libs/tesouro-embedded-components-react/profile-widget/ui/dist/index2.js +3 -1
  18. package/dist/libs/tesouro-embedded-components-react/profile-widget/ui/dist/index3.js +25 -9
  19. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index.js +4 -3
  20. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index4.js +20 -41
  21. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index5.js +37 -122
  22. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +133 -2
  23. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index7.js +3 -0
  24. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  25. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js +1 -1
  26. package/package.json +1 -1
@@ -27,7 +27,7 @@ var g = () => /* @__PURE__ */ p(r, { children: /* @__PURE__ */ p(_, {}) }), _ =
27
27
  /* @__PURE__ */ p(c, {
28
28
  className: "ttw:px-2",
29
29
  titleVariant: "h3",
30
- title: r._("Bill pay settings"),
30
+ title: r._("Bill pay"),
31
31
  extra: /* @__PURE__ */ m(e, {
32
32
  id: "create",
33
33
  size: "sm",
@@ -53,7 +53,7 @@ var S = (e) => /* @__PURE__ */ y(u, { children: /* @__PURE__ */ y(C, { ...e }) }
53
53
  }) : /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(l, {
54
54
  className: "-Header",
55
55
  titleVariant: "h3",
56
- title: /* @__PURE__ */ y(v, { children: D._("Invoice settings") })
56
+ title: /* @__PURE__ */ y(v, { children: D._("Invoices") })
57
57
  }), /* @__PURE__ */ y("div", {
58
58
  className: "ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card ttw:p-6",
59
59
  children: z
@@ -5,27 +5,28 @@
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
7
  import { formatPhoneDisplay as n } from "../../../shared/util/dist/lib/formatPhoneDisplay.js";
8
+ import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
8
9
  import "../../../shared/feature/dist/index.js";
9
- import { DEFAULT_FEATURE_LABELS as r } from "./index3.js";
10
- import { ProfileWidgetAnalyticsEvent as i, WIDGET_NAME as a } from "./index2.js";
11
- import { useProfileQuery as o } from "../../data-access/dist/index2.js";
10
+ import { DEFAULT_FEATURE_LABELS as i } from "./index3.js";
11
+ import { ProfileWidgetAnalyticsEvent as a, WIDGET_NAME as o } from "./index2.js";
12
+ import { useProfileQuery as s } from "../../data-access/dist/index2.js";
12
13
  import "../../data-access/dist/index.js";
13
- import { ProfileCard as s } from "../../ui/dist/index3.js";
14
+ import { ProfileCard as c } from "../../ui/dist/index3.js";
14
15
  import "../../ui/dist/index.js";
15
- import { useCallback as c, useEffect as l, useState as u } from "react";
16
- import { jsx as d } from "react/jsx-runtime";
16
+ import { useCallback as l, useEffect as u, useState as d } from "react";
17
+ import { jsx as f } from "react/jsx-runtime";
17
18
  //#region ../../libs/tesouro-embedded-components-react/profile-widget/feature/dist/index4.js
18
- var f = {
19
+ var p = {
19
20
  Personal: "personal",
20
21
  Business: "business"
21
22
  };
22
- function p(e, t) {
23
+ function m(e, t) {
23
24
  return e?.trim() ? e : t;
24
25
  }
25
- function m(e) {
26
+ function h(e) {
26
27
  return [e?.first_name, e?.last_name].filter((e) => !!e?.trim()).join(" ");
27
28
  }
28
- function h(e) {
29
+ function g(e) {
29
30
  if (!e) return "";
30
31
  let t = [e.line1, e.line2].filter((e) => !!e?.trim()).join(" "), n = [e.state, e.postal_code].filter((e) => !!e?.trim()).join(" ");
31
32
  return [
@@ -34,84 +35,86 @@ function h(e) {
34
35
  n
35
36
  ].filter((e) => !!e?.trim()).join(", ");
36
37
  }
37
- function g(e) {
38
+ function _(e) {
38
39
  return e ? e.type === "organization" ? e.organization.legal_name : [e.individual.first_name, e.individual.last_name].filter((e) => !!e?.trim()).join(" ") : "";
39
40
  }
40
- function _({ labels: t, featureLabels: a }) {
41
- let _ = {
42
- ...r,
43
- ...a
44
- }, v = e();
45
- l(() => {
46
- v(i.Mounted);
47
- }, [v]);
48
- let [y, b] = u(f.Personal), x = c((e) => {
49
- (e === f.Personal || e === f.Business) && b(e);
50
- }, []), { userQuery: S, entityQuery: C } = o(), w = S.isLoading || C.isLoading, T = S.isError || C.isError, E = S.data, D = C.data, O = y === f.Personal, k = m(E), A = _.emptyValue, j = p(g(D), A), M = O ? [
41
+ function v({ labels: t, featureLabels: o, contactUrl: v }) {
42
+ let y = {
43
+ ...i,
44
+ ...o
45
+ }, b = e();
46
+ u(() => {
47
+ b(a.Mounted);
48
+ }, [b]);
49
+ let [x, S] = d(p.Personal), C = l((e) => {
50
+ (e === p.Personal || e === p.Business) && S(e);
51
+ }, []), { initResponse: w } = r(), T = w?.bankName ?? void 0, { userQuery: E, entityQuery: D } = s(), O = E.isLoading || D.isLoading, k = E.isError || D.isError, A = E.data, j = D.data, M = x === p.Personal, N = h(A), P = y.emptyValue, F = m(_(j), P), I = M ? [
51
52
  {
52
- label: _.nameLabel,
53
- value: p(k, A)
53
+ label: y.nameLabel,
54
+ value: m(N, P)
54
55
  },
55
56
  {
56
- label: _.phoneLabel,
57
- value: n(E?.phone, A)
57
+ label: y.phoneLabel,
58
+ value: n(A?.phone, P)
58
59
  },
59
60
  {
60
- label: _.emailLabel,
61
- value: p(E?.email, A)
61
+ label: y.emailLabel,
62
+ value: m(A?.email, P)
62
63
  }
63
64
  ] : [
64
65
  {
65
- label: _.legalNameLabel,
66
- value: j
66
+ label: y.legalNameLabel,
67
+ value: F
67
68
  },
68
69
  {
69
- label: _.companyAddressLabel,
70
- value: p(h(D?.address), A)
70
+ label: y.companyAddressLabel,
71
+ value: m(g(j?.address), P)
71
72
  },
72
73
  {
73
- label: _.companyPhoneLabel,
74
- value: n(D?.phone, A)
74
+ label: y.companyPhoneLabel,
75
+ value: n(j?.phone, P)
75
76
  },
76
77
  {
77
- label: _.companyEmailLabel,
78
- value: p(D?.email, A)
78
+ label: y.companyEmailLabel,
79
+ value: m(j?.email, P)
79
80
  }
80
81
  ];
81
- return /* @__PURE__ */ d(s, {
82
+ return /* @__PURE__ */ f(c, {
82
83
  labels: t,
83
84
  tabs: [{
84
- id: f.Personal,
85
- label: _.personalTab
85
+ id: p.Personal,
86
+ label: y.personalTab
86
87
  }, {
87
- id: f.Business,
88
- label: _.businessTab
88
+ id: p.Business,
89
+ label: y.businessTab
89
90
  }],
90
- activeTabId: y,
91
- onTabChange: x,
92
- bannerTone: O ? "primary" : "secondary",
93
- title: O ? p(k, A) : j,
94
- subtitle: _.subtitle,
95
- fields: M,
96
- isLoading: w,
97
- isError: T
91
+ activeTabId: x,
92
+ onTabChange: C,
93
+ bannerTone: M ? "primary" : "secondary",
94
+ title: M ? m(N, P) : F,
95
+ subtitle: y.subtitle,
96
+ bankName: T,
97
+ contactUrl: v,
98
+ fields: I,
99
+ isLoading: O,
100
+ isError: k
98
101
  });
99
102
  }
100
- function v({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, linkComponent: o, implementation: s, uiFramework: c, errorFallback: l, onError: u, analytics: f, ...p }) {
101
- return /* @__PURE__ */ d(t, {
102
- widgetName: a,
103
+ function y({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, linkComponent: a, implementation: s, uiFramework: c, errorFallback: l, onError: u, analytics: d, ...p }) {
104
+ return /* @__PURE__ */ f(t, {
105
+ widgetName: o,
103
106
  baseUrl: e,
104
107
  widgetToken: n,
105
108
  organizationId: r,
106
109
  configClient: i,
107
- linkComponent: o,
110
+ linkComponent: a,
108
111
  implementation: s,
109
112
  uiFramework: c,
110
113
  errorFallback: l,
111
114
  onError: u,
112
- analytics: f,
113
- children: /* @__PURE__ */ d(_, { ...p })
115
+ analytics: d,
116
+ children: /* @__PURE__ */ f(v, { ...p })
114
117
  });
115
118
  }
116
119
  //#endregion
117
- export { v as ProfileWidget, v as default };
120
+ export { y as ProfileWidget, y as default };
@@ -1,7 +1,9 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/profile-widget/ui/dist/index2.js
2
2
  var e = {
3
3
  loadingLabel: "Loading profile",
4
- errorLabel: "Unable to load profile"
4
+ errorLabel: "Unable to load profile",
5
+ contactPrefix: "To change this information, please contact",
6
+ contactLinkText: "here"
5
7
  };
6
8
  //#endregion
7
9
  export { e as DEFAULT_LABELS };
@@ -16,8 +16,8 @@ var d = {
16
16
  primary: "ttw:bg-gradient-to-r ttw:from-sky-200 ttw:via-rose-300 ttw:to-purple-400",
17
17
  secondary: "ttw:bg-gradient-to-r ttw:from-sky-400 ttw:via-red-400 ttw:to-violet-400"
18
18
  };
19
- function p({ labels: p, tabs: m, activeTabId: h, onTabChange: g, bannerTone: _ = d.Primary, title: v, subtitle: y, fields: b, isLoading: x = !1, isError: S = !1 }) {
20
- let C = {
19
+ function p({ labels: p, tabs: m, activeTabId: h, onTabChange: g, bannerTone: _ = d.Primary, title: v, subtitle: y, bankName: b, contactUrl: x, fields: S, isLoading: C = !1, isError: w = !1 }) {
20
+ let T = {
21
21
  ...o,
22
22
  ...p
23
23
  };
@@ -30,7 +30,7 @@ function p({ labels: p, tabs: m, activeTabId: h, onTabChange: g, bannerTone: _ =
30
30
  }),
31
31
  /* @__PURE__ */ l("div", {
32
32
  className: "ttw:px-6 ttw:pt-5 ttw:pb-2",
33
- children: x ? /* @__PURE__ */ u("div", {
33
+ children: C ? /* @__PURE__ */ u("div", {
34
34
  "aria-hidden": !0,
35
35
  children: [/* @__PURE__ */ l(e, {
36
36
  width: 150,
@@ -42,7 +42,23 @@ function p({ labels: p, tabs: m, activeTabId: h, onTabChange: g, bannerTone: _ =
42
42
  }) : /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(a, {
43
43
  className: "ttw:truncate ttw:mb-0",
44
44
  children: v
45
- }), y ? /* @__PURE__ */ l("p", {
45
+ }), x && b ? /* @__PURE__ */ u("p", {
46
+ className: "ttw:truncate ttw:text-sm ttw:text-muted-foreground",
47
+ children: [
48
+ T.contactPrefix,
49
+ " ",
50
+ b,
51
+ " ",
52
+ /* @__PURE__ */ l("a", {
53
+ href: x,
54
+ target: "_blank",
55
+ rel: "noopener noreferrer",
56
+ className: "ttw:font-medium ttw:text-primary ttw:underline",
57
+ children: T.contactLinkText
58
+ }),
59
+ "."
60
+ ]
61
+ }) : y ? /* @__PURE__ */ l("p", {
46
62
  className: "ttw:truncate ttw:text-sm ttw:text-muted-foreground",
47
63
  children: y
48
64
  }) : null] })
@@ -56,9 +72,9 @@ function p({ labels: p, tabs: m, activeTabId: h, onTabChange: g, bannerTone: _ =
56
72
  children: e.label
57
73
  }, e.id)) }), /* @__PURE__ */ l(n, {
58
74
  value: h,
59
- children: x ? /* @__PURE__ */ u("div", {
75
+ children: C ? /* @__PURE__ */ u("div", {
60
76
  role: "status",
61
- "aria-label": C.loadingLabel,
77
+ "aria-label": T.loadingLabel,
62
78
  className: "ttw:grid ttw:grid-cols-2 ttw:gap-2 ttw:py-4",
63
79
  children: [
64
80
  /* @__PURE__ */ l(e, {
@@ -78,13 +94,13 @@ function p({ labels: p, tabs: m, activeTabId: h, onTabChange: g, bannerTone: _ =
78
94
  height: 20
79
95
  })
80
96
  ]
81
- }) : S ? /* @__PURE__ */ l("div", {
97
+ }) : w ? /* @__PURE__ */ l("div", {
82
98
  role: "alert",
83
99
  className: "ttw:py-4 ttw:text-sm ttw:text-destructive",
84
- children: C.errorLabel
100
+ children: T.errorLabel
85
101
  }) : /* @__PURE__ */ l("dl", {
86
102
  className: "ttw:grid ttw:grid-cols-[50%_1fr] ttw:gap-x-6 ttw:gap-y-4 ttw:py-4",
87
- children: b.map((e) => /* @__PURE__ */ u(s, { children: [/* @__PURE__ */ l("dt", {
103
+ children: S.map((e) => /* @__PURE__ */ u(s, { children: [/* @__PURE__ */ l("dt", {
88
104
  className: "ttw:text-sm ttw:font-medium ttw:text-muted-foreground",
89
105
  children: e.label
90
106
  }), /* @__PURE__ */ l("dd", {
@@ -1,4 +1,5 @@
1
1
  import "./index3.js";
2
- import { SettingsWidget as e } from "./index5.js";
3
- import "./index6.js";
4
- export { e as SettingsWidget };
2
+ import { SettingsSection as e } from "./index4.js";
3
+ import { SettingsWidget as t } from "./index6.js";
4
+ import "./index7.js";
5
+ export { e as SettingsSection, t as SettingsWidget };
@@ -1,44 +1,23 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { Tabs as e, TabsContent as t, TabsList as n, TabsTrigger as r } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { SectionHeading as i } from "../../../shared/ui/dist/lib/SectionHeading/SectionHeading.js";
7
- import "../../../shared/ui/dist/index.js";
8
- import { ExpenseApprovalPoliciesWidget as a } from "../../../expense-approval-policies-widget/feature/dist/lib/ExpenseApprovalPoliciesWidgetFeature.js";
9
- import "../../../expense-approval-policies-widget/feature/dist/index.js";
10
- import { ExpenseRequirementsWidget as o } from "../../../expense-requirements-widget/feature/dist/lib/ExpenseRequirementsWidget.js";
11
- import "../../../expense-requirements-widget/feature/dist/index.js";
12
- import { useState as s } from "react";
13
- import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
14
1
  //#region ../../libs/tesouro-embedded-components-react/settings-widget/feature/dist/index4.js
15
- function d({ sectionTitle: d, approvalsLabel: f, requirementsLabel: p }) {
16
- let [m, h] = s("approvals");
17
- return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(i, { children: d }), /* @__PURE__ */ l("div", {
18
- className: "ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card ttw:p-6",
19
- children: /* @__PURE__ */ u(e, {
20
- value: m,
21
- onValueChange: h,
22
- className: "ttw:w-full ttw:space-y-5",
23
- children: [
24
- /* @__PURE__ */ u(n, { children: [/* @__PURE__ */ l(r, {
25
- value: "approvals",
26
- children: f
27
- }), /* @__PURE__ */ l(r, {
28
- value: "requirements",
29
- children: p
30
- })] }),
31
- /* @__PURE__ */ l(t, {
32
- value: "approvals",
33
- children: /* @__PURE__ */ l(a, {})
34
- }),
35
- /* @__PURE__ */ l(t, {
36
- value: "requirements",
37
- children: /* @__PURE__ */ l(o, {})
38
- })
39
- ]
40
- })
41
- })] });
2
+ var e = {
3
+ Profile: "profile",
4
+ Team: "team",
5
+ Invoice: "invoice",
6
+ Expense: "expense",
7
+ BillPay: "bill-pay",
8
+ Accounting: "accounting",
9
+ Tags: "tags",
10
+ Help: "help"
11
+ }, t = new Set(Object.values(e));
12
+ function n(e, n) {
13
+ if (n.length === 0) return e;
14
+ let r = n.filter((e) => !t.has(e.id)), i = [], a = new Set(e.map((e) => e.id));
15
+ for (let t of e) {
16
+ i.push(t);
17
+ for (let e of r) e.after === t.id && !a.has(e.id) && (i.push(e), a.add(e.id));
18
+ }
19
+ for (let e of r) a.has(e.id) || (i.push(e), a.add(e.id));
20
+ return i;
42
21
  }
43
22
  //#endregion
44
- export { d as ExpenseSettingsTabs, d as default };
23
+ export { e as SettingsSection, n as mergeAdditionalSections };
@@ -2,128 +2,43 @@
2
2
  "use client";
3
3
  "use client";
4
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 { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
- import "../../../shared/feature/dist/index.js";
11
- import { ApprovalPolicies as i } from "../../../monite-sdk/dist/index327.js";
12
- import { TemplateSettings as a } from "../../../monite-sdk/dist/index597.js";
13
- import "../../../monite-sdk/dist/index.js";
14
- import { MoniteRegionProvider as o } from "../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
15
- import "../../../shared/monite-wrapper/feature/dist/index.js";
16
- import { ChartOfAccountsWidget as s } from "../../../gl-code-table-widget/feature/dist/index8.js";
17
- import "../../../gl-code-table-widget/feature/dist/index.js";
18
- import { HelpWidget as c } from "../../../help-widget/feature/dist/index3.js";
19
- import "../../../help-widget/feature/dist/index.js";
20
- import { ProfileWidget as l } from "../../../profile-widget/feature/dist/index4.js";
21
- import "../../../profile-widget/feature/dist/index.js";
22
- import { DEFAULT_FEATURE_LABELS as u } from "./index3.js";
23
- import { SettingsWidgetAnalyticsEvent as d, WIDGET_NAME as f } from "./index2.js";
24
- import { ExpenseSettingsTabs as p } from "./index4.js";
25
- import { TagsWidget as m } from "../../../tags-widget/feature/dist/index11.js";
26
- import "../../../tags-widget/feature/dist/index.js";
27
- import { TeamWidget as h } from "../../../team-widget/feature/dist/index17.js";
28
- import "../../../team-widget/feature/dist/index.js";
29
- import { SettingsWidgetUi as g } from "../../ui/dist/lib/SettingsWidgetUi/SettingsWidgetUi.js";
30
- import "../../ui/dist/index.js";
31
- import { useEffect as _, useState as v } from "react";
32
- import { jsx as y } from "react/jsx-runtime";
5
+ import { Tabs as e, TabsContent as t, TabsList as n, TabsTrigger as r } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { SectionHeading as i } from "../../../shared/ui/dist/lib/SectionHeading/SectionHeading.js";
7
+ import "../../../shared/ui/dist/index.js";
8
+ import { ExpenseApprovalPoliciesWidget as a } from "../../../expense-approval-policies-widget/feature/dist/lib/ExpenseApprovalPoliciesWidgetFeature.js";
9
+ import "../../../expense-approval-policies-widget/feature/dist/index.js";
10
+ import { ExpenseRequirementsWidget as o } from "../../../expense-requirements-widget/feature/dist/lib/ExpenseRequirementsWidget.js";
11
+ import "../../../expense-requirements-widget/feature/dist/index.js";
12
+ import { useState as s } from "react";
13
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
33
14
  //#region ../../libs/tesouro-embedded-components-react/settings-widget/feature/dist/index5.js
34
- var b = {
35
- profile: [],
36
- team: [t.UserReadOrg],
37
- invoice: [t.OrganizationSettingsWriteOrg],
38
- "bill-pay": [t.ApprovalPolicyWriteOrg, t.PayableWriteOrg],
39
- accounting: [t.AccountingConfigReadOrg],
40
- tags: [t.AccountingConfigReadOrg],
41
- expense: [t.ApprovalPolicyWriteOrg, t.ExpenseWriteOrg],
42
- help: []
43
- };
44
- function x({ labels: t, featureLabels: o, acceptInviteRedirectUri: f, helpContactUrl: x, profileContent: S, teamContent: C, billPayContent: w, helpContent: T, expenseContent: E, accountingContent: D, tagsContent: O, invoiceContent: k }) {
45
- let A = {
46
- ...u,
47
- ...o
48
- }, j = n();
49
- _(() => {
50
- j(d.Mounted);
51
- }, [j]);
52
- let { initResponse: M } = r(), N = M?.scopes, P = [
53
- {
54
- id: "profile",
55
- label: A.profileSection,
56
- content: S ?? /* @__PURE__ */ y(l, {})
57
- },
58
- {
59
- id: "team",
60
- label: A.teamSection,
61
- content: C ?? /* @__PURE__ */ y(h, {
62
- title: A.teamSection,
63
- acceptInviteRedirectUri: f
64
- })
65
- },
66
- {
67
- id: "invoice",
68
- label: A.invoiceSection,
69
- content: k ?? /* @__PURE__ */ y(a, {})
70
- },
71
- {
72
- id: "expense",
73
- label: A.expenseSection,
74
- content: E ?? /* @__PURE__ */ y(p, {
75
- sectionTitle: A.expenseSection,
76
- approvalsLabel: A.expenseApprovalsTab,
77
- requirementsLabel: A.expenseRequirementsTab
78
- })
79
- },
80
- {
81
- id: "bill-pay",
82
- label: A.billPaySection,
83
- content: w ?? /* @__PURE__ */ y(i, {})
84
- },
85
- {
86
- id: "accounting",
87
- label: A.accountingSection,
88
- content: D ?? /* @__PURE__ */ y(s, { title: A.accountingSection })
89
- },
90
- {
91
- id: "tags",
92
- label: A.tagsSection,
93
- content: O ?? /* @__PURE__ */ y(m, {})
94
- },
95
- {
96
- id: "help",
97
- label: A.helpSection,
98
- content: T ?? /* @__PURE__ */ y(c, { contactUrl: x })
99
- }
100
- ].filter((t) => {
101
- let n = b[t.id] ?? [];
102
- return n.length === 0 || n.every((t) => e(N, [t]));
103
- }), F = P[0]?.id ?? "", [I, L] = v(F), R = P.some((e) => e.id === I) ? I : F;
104
- return /* @__PURE__ */ y(g, {
105
- labels: t,
106
- sections: P,
107
- selectedSectionId: R,
108
- onSectionChange: L
109
- });
110
- }
111
- function S({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, linkComponent: i, implementation: a, uiFramework: s, errorFallback: c, onError: l, finopsThemeColors: u, analytics: d, ...p }) {
112
- return /* @__PURE__ */ y(o, {
113
- widgetName: f,
114
- baseUrl: e,
115
- widgetToken: t,
116
- organizationId: n,
117
- configClient: r,
118
- linkComponent: i,
119
- implementation: a,
120
- uiFramework: s,
121
- errorFallback: c,
122
- onError: l,
123
- finopsThemeColors: u,
124
- analytics: d,
125
- children: /* @__PURE__ */ y(x, { ...p })
126
- });
15
+ function d({ sectionTitle: d, approvalsLabel: f, requirementsLabel: p }) {
16
+ let [m, h] = s("approvals");
17
+ return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(i, { children: d }), /* @__PURE__ */ l("div", {
18
+ className: "ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card ttw:p-6",
19
+ children: /* @__PURE__ */ u(e, {
20
+ value: m,
21
+ onValueChange: h,
22
+ className: "ttw:w-full ttw:space-y-5",
23
+ children: [
24
+ /* @__PURE__ */ u(n, { children: [/* @__PURE__ */ l(r, {
25
+ value: "approvals",
26
+ children: f
27
+ }), /* @__PURE__ */ l(r, {
28
+ value: "requirements",
29
+ children: p
30
+ })] }),
31
+ /* @__PURE__ */ l(t, {
32
+ value: "approvals",
33
+ children: /* @__PURE__ */ l(a, {})
34
+ }),
35
+ /* @__PURE__ */ l(t, {
36
+ value: "requirements",
37
+ children: /* @__PURE__ */ l(o, {})
38
+ })
39
+ ]
40
+ })
41
+ })] });
127
42
  }
128
43
  //#endregion
129
- export { S as SettingsWidget, S as default };
44
+ export { d as ExpenseSettingsTabs, d as default };
@@ -1,2 +1,133 @@
1
- import "./index3.js";
2
- import "./index5.js";
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 { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
+ import "../../../shared/feature/dist/index.js";
11
+ import { ApprovalPolicies as i } from "../../../monite-sdk/dist/index327.js";
12
+ import { TemplateSettings as a } from "../../../monite-sdk/dist/index597.js";
13
+ import "../../../monite-sdk/dist/index.js";
14
+ import { MoniteRegionProvider as o } from "../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
15
+ import "../../../shared/monite-wrapper/feature/dist/index.js";
16
+ import { ChartOfAccountsWidget as s } from "../../../gl-code-table-widget/feature/dist/index8.js";
17
+ import "../../../gl-code-table-widget/feature/dist/index.js";
18
+ import { HelpWidget as c } from "../../../help-widget/feature/dist/index3.js";
19
+ import "../../../help-widget/feature/dist/index.js";
20
+ import { ProfileWidget as l } from "../../../profile-widget/feature/dist/index4.js";
21
+ import "../../../profile-widget/feature/dist/index.js";
22
+ import { DEFAULT_FEATURE_LABELS as u } from "./index3.js";
23
+ import { SettingsSection as d, mergeAdditionalSections as f } from "./index4.js";
24
+ import { SettingsWidgetAnalyticsEvent as p, WIDGET_NAME as m } from "./index2.js";
25
+ import { ExpenseSettingsTabs as h } from "./index5.js";
26
+ import { TagsWidget as g } from "../../../tags-widget/feature/dist/index11.js";
27
+ import "../../../tags-widget/feature/dist/index.js";
28
+ import { TeamWidget as _ } from "../../../team-widget/feature/dist/index17.js";
29
+ import "../../../team-widget/feature/dist/index.js";
30
+ import { SettingsWidgetUi as v } from "../../ui/dist/lib/SettingsWidgetUi/SettingsWidgetUi.js";
31
+ import "../../ui/dist/index.js";
32
+ import { useEffect as y } from "react";
33
+ import { jsx as b } from "react/jsx-runtime";
34
+ import { useControllableState as x } from "@radix-ui/react-use-controllable-state";
35
+ //#region ../../libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js
36
+ var S = {
37
+ [d.Profile]: [],
38
+ [d.Team]: [t.UserReadOrg],
39
+ [d.Invoice]: [t.OrganizationSettingsWriteOrg],
40
+ [d.BillPay]: [t.ApprovalPolicyWriteOrg, t.PayableWriteOrg],
41
+ [d.Accounting]: [t.AccountingConfigReadOrg],
42
+ [d.Tags]: [t.AccountingConfigReadOrg],
43
+ [d.Expense]: [t.ApprovalPolicyWriteOrg, t.ExpenseWriteOrg],
44
+ [d.Help]: []
45
+ };
46
+ function C({ labels: t, featureLabels: o, acceptInviteRedirectUri: m, helpContactUrl: C, profileContactUrl: w, selectedSection: T, onSelectedSectionChange: E, additionalSections: D, profileContent: O, teamContent: k, billPayContent: A, helpContent: j, expenseContent: M, accountingContent: N, tagsContent: P, invoiceContent: F }) {
47
+ let I = {
48
+ ...u,
49
+ ...o
50
+ }, L = n();
51
+ y(() => {
52
+ L(p.Mounted);
53
+ }, [L]);
54
+ let { initResponse: R } = r(), z = R?.scopes, B = [
55
+ {
56
+ id: d.Profile,
57
+ label: I.profileSection,
58
+ content: O ?? /* @__PURE__ */ b(l, { contactUrl: w })
59
+ },
60
+ {
61
+ id: d.Team,
62
+ label: I.teamSection,
63
+ content: k ?? /* @__PURE__ */ b(_, {
64
+ title: I.teamSection,
65
+ acceptInviteRedirectUri: m
66
+ })
67
+ },
68
+ {
69
+ id: d.Invoice,
70
+ label: I.invoiceSection,
71
+ content: F ?? /* @__PURE__ */ b(a, {})
72
+ },
73
+ {
74
+ id: d.Expense,
75
+ label: I.expenseSection,
76
+ content: M ?? /* @__PURE__ */ b(h, {
77
+ sectionTitle: I.expenseSection,
78
+ approvalsLabel: I.expenseApprovalsTab,
79
+ requirementsLabel: I.expenseRequirementsTab
80
+ })
81
+ },
82
+ {
83
+ id: d.BillPay,
84
+ label: I.billPaySection,
85
+ content: A ?? /* @__PURE__ */ b(i, {})
86
+ },
87
+ {
88
+ id: d.Accounting,
89
+ label: I.accountingSection,
90
+ content: N ?? /* @__PURE__ */ b(s, { title: I.accountingSection })
91
+ },
92
+ {
93
+ id: d.Tags,
94
+ label: I.tagsSection,
95
+ content: P ?? /* @__PURE__ */ b(g, {})
96
+ },
97
+ {
98
+ id: d.Help,
99
+ label: I.helpSection,
100
+ content: j ?? /* @__PURE__ */ b(c, { contactUrl: C })
101
+ }
102
+ ], V = f(B.filter((t) => S[t.id].every((t) => e(z, [t]))), D ?? []), H = V[0]?.id ?? "", [U, W] = x({
103
+ prop: T,
104
+ defaultProp: H,
105
+ onChange: E,
106
+ caller: "SettingsWidget"
107
+ }), G = V.some((e) => e.id === U) ? U : H;
108
+ return /* @__PURE__ */ b(v, {
109
+ labels: t,
110
+ sections: V,
111
+ selectedSectionId: G,
112
+ onSectionChange: W
113
+ });
114
+ }
115
+ function w({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, linkComponent: i, implementation: a, uiFramework: s, errorFallback: c, onError: l, finopsThemeColors: u, analytics: d, ...f }) {
116
+ return /* @__PURE__ */ b(o, {
117
+ widgetName: m,
118
+ baseUrl: e,
119
+ widgetToken: t,
120
+ organizationId: n,
121
+ configClient: r,
122
+ linkComponent: i,
123
+ implementation: a,
124
+ uiFramework: s,
125
+ errorFallback: c,
126
+ onError: l,
127
+ finopsThemeColors: u,
128
+ analytics: d,
129
+ children: /* @__PURE__ */ b(C, { ...f })
130
+ });
131
+ }
132
+ //#endregion
133
+ export { w as SettingsWidget, w as default };