@tesouro/embedded-components-react 0.7.28 → 0.7.30

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 (34) hide show
  1. package/dist/index.d.ts +1 -12
  2. package/dist/lib/CounterpartsWidget.d.ts +1 -12
  3. package/dist/lib/CounterpartsWidgetPublic.d.ts +1 -12
  4. package/dist/lib/CustomersWidget.d.ts +0 -2
  5. package/dist/lib/ReceivablesWidget.d.ts +0 -2
  6. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +59 -38
  7. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsPanel.js +137 -0
  8. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +86 -182
  9. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsActions.js +116 -0
  10. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +16 -16
  11. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +51 -108
  12. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useRebaseOnRefresh.js +33 -0
  13. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +40 -39
  14. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +2 -65
  16. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js +37 -181
  17. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js +193 -502
  18. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index7.js +520 -0
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +2 -0
  20. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index.js +3 -3
  21. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index5.js +31 -55
  22. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +11 -11
  23. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +98 -163
  24. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +1 -3
  25. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/subEntityForms.js +37 -32
  26. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +86 -93
  27. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +2 -0
  28. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +42 -173
  29. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +3 -12
  30. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index5.js +16 -16
  31. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +42 -42
  32. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +117 -125
  33. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  34. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -4402,20 +4402,11 @@ interface CounterpartFormSheetLabels {
4402
4402
  interface BankAccountFormSheetLabels {
4403
4403
  createTitle: string;
4404
4404
  editTitle: string;
4405
- nameLabel: string;
4406
4405
  accountHolderNameLabel: string;
4407
4406
  accountNumberLabel: string;
4408
4407
  routingNumberLabel: string;
4409
- ibanLabel: string;
4410
- bicLabel: string;
4411
- sortCodeLabel: string;
4412
- currencyLabel: string;
4413
- currencyPlaceholder: string;
4414
- countryLabel: string;
4415
- countryValue: string;
4416
- isDefaultLabel: string;
4408
+ helperText: string;
4417
4409
  cancelButton: string;
4418
- createButton: string;
4419
4410
  saveButton: string;
4420
4411
  fieldMarkers: LabelLabels;
4421
4412
  }
@@ -4450,8 +4441,6 @@ interface CounterpartMessageLabels {
4450
4441
  cityRequired: string;
4451
4442
  stateRequired: string;
4452
4443
  postalCodeRequired: string;
4453
- bankAccountIdentifierRequired: string;
4454
- bankAccountCurrencyRequired: string;
4455
4444
  accountHolderNameRequired: string;
4456
4445
  routingNumberInvalid: string;
4457
4446
  accountNumberInvalid: string;
@@ -745,20 +745,11 @@ interface CounterpartFormSheetLabels {
745
745
  interface BankAccountFormSheetLabels {
746
746
  createTitle: string;
747
747
  editTitle: string;
748
- nameLabel: string;
749
748
  accountHolderNameLabel: string;
750
749
  accountNumberLabel: string;
751
750
  routingNumberLabel: string;
752
- ibanLabel: string;
753
- bicLabel: string;
754
- sortCodeLabel: string;
755
- currencyLabel: string;
756
- currencyPlaceholder: string;
757
- countryLabel: string;
758
- countryValue: string;
759
- isDefaultLabel: string;
751
+ helperText: string;
760
752
  cancelButton: string;
761
- createButton: string;
762
753
  saveButton: string;
763
754
  fieldMarkers: LabelLabels;
764
755
  }
@@ -793,8 +784,6 @@ interface CounterpartMessageLabels {
793
784
  cityRequired: string;
794
785
  stateRequired: string;
795
786
  postalCodeRequired: string;
796
- bankAccountIdentifierRequired: string;
797
- bankAccountCurrencyRequired: string;
798
787
  accountHolderNameRequired: string;
799
788
  routingNumberInvalid: string;
800
789
  accountNumberInvalid: string;
@@ -745,20 +745,11 @@ interface CounterpartFormSheetLabels {
745
745
  interface BankAccountFormSheetLabels {
746
746
  createTitle: string;
747
747
  editTitle: string;
748
- nameLabel: string;
749
748
  accountHolderNameLabel: string;
750
749
  accountNumberLabel: string;
751
750
  routingNumberLabel: string;
752
- ibanLabel: string;
753
- bicLabel: string;
754
- sortCodeLabel: string;
755
- currencyLabel: string;
756
- currencyPlaceholder: string;
757
- countryLabel: string;
758
- countryValue: string;
759
- isDefaultLabel: string;
751
+ helperText: string;
760
752
  cancelButton: string;
761
- createButton: string;
762
753
  saveButton: string;
763
754
  fieldMarkers: LabelLabels;
764
755
  }
@@ -793,8 +784,6 @@ interface CounterpartMessageLabels {
793
784
  cityRequired: string;
794
785
  stateRequired: string;
795
786
  postalCodeRequired: string;
796
- bankAccountIdentifierRequired: string;
797
- bankAccountCurrencyRequired: string;
798
787
  accountHolderNameRequired: string;
799
788
  routingNumberInvalid: string;
800
789
  accountNumberInvalid: string;
@@ -774,8 +774,6 @@ interface CounterpartMessageLabels {
774
774
  cityRequired: string;
775
775
  stateRequired: string;
776
776
  postalCodeRequired: string;
777
- bankAccountIdentifierRequired: string;
778
- bankAccountCurrencyRequired: string;
779
777
  accountHolderNameRequired: string;
780
778
  routingNumberInvalid: string;
781
779
  accountNumberInvalid: string;
@@ -849,8 +849,6 @@ interface CounterpartMessageLabels {
849
849
  cityRequired: string;
850
850
  stateRequired: string;
851
851
  postalCodeRequired: string;
852
- bankAccountIdentifierRequired: string;
853
- bankAccountCurrencyRequired: string;
854
852
  accountHolderNameRequired: string;
855
853
  routingNumberInvalid: string;
856
854
  accountNumberInvalid: string;
@@ -2,48 +2,69 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { useWidgetConfig as e } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
5
+ import { getStateOptions as e } from "../../../../../shared/util/dist/lib/usStates.js";
6
+ import { useWidgetConfig as t } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
6
7
  import "../../../../../shared/feature/dist/index.js";
7
- import { getCounterpartPermissions as t } from "./permissions.js";
8
- import { useCounterpartDetailsSheetView as n } from "./useCounterpartDetailsSheetView.js";
9
- import { COUNTERPART_DETAILS_SHEET_LABELS_EN as r } from "../../../../ui/dist/index2.js";
10
- import { CounterpartDetailsSheet as i } from "../../../../ui/dist/index6.js";
8
+ import { COUNTERPART_MESSAGE_LABELS_EN as n } from "../../../../../shared/counterpart-management/feature/dist/lib/labels.js";
9
+ import "../../../../../shared/counterpart-management/feature/dist/index.js";
10
+ import { getCounterpartPermissions as r } from "./permissions.js";
11
+ import { COUNTERPART_DETAILS_SHEET_LABELS_EN as i } from "../../../../ui/dist/index2.js";
11
12
  import "../../../../ui/dist/index.js";
12
- import { useMemo as a } from "react";
13
- import { jsx as o } from "react/jsx-runtime";
13
+ import { CounterpartDetailsPanel as a } from "./CounterpartDetailsPanel.js";
14
+ import { useCounterpartDetailsActions as o } from "./useCounterpartDetailsActions.js";
15
+ import { useCounterpartDetailsSheetView as s } from "./useCounterpartDetailsSheetView.js";
16
+ import { useCallback as c, useMemo as l, useState as u } from "react";
17
+ import { jsx as d } from "react/jsx-runtime";
14
18
  //#region ../../libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js
15
- function s({ counterpartId: s, counterpartType: c, onClose: l, onViewAllDocuments: u, onCreateDocument: d, labels: f }) {
16
- let { initResponse: p } = e(), m = t(p?.scopes).canRead, h = a(() => ({
17
- ...r,
18
- ...f
19
- }), [f]), { details: g, detailsSheetView: _ } = n({
20
- selectedId: s,
21
- isCustomer: c === "customer",
22
- enabled: m,
23
- detailsText: h
24
- }), v = s && _ ? {
25
- id: s,
26
- name: _.name
27
- } : void 0;
28
- return /* @__PURE__ */ o(i, {
29
- open: m && s !== void 0,
30
- onOpenChange: (e) => {
31
- e || l();
32
- },
33
- privacyResetKey: s,
34
- mode: c,
35
- counterpart: _,
36
- isLoading: g.isLoading,
37
- isError: g.isError,
38
- canEdit: !1,
19
+ var f = () => void 0;
20
+ function p({ counterpartId: p, counterpartType: m, onClose: h, onViewAllDocuments: g, onCreateDocument: _, labels: v, formLabels: y, messageLabels: b }) {
21
+ let { initResponse: x } = t(), S = l(() => r(x?.scopes), [x?.scopes]), C = l(() => ({
22
+ ...i,
23
+ ...v
24
+ }), [v]), w = l(() => ({
25
+ ...n,
26
+ ...b
27
+ }), [b]), T = l(() => e(), []), [E, D] = u("none"), { details: O, detailsSheetView: k } = s({
28
+ selectedId: p,
29
+ isCustomer: m === "customer",
30
+ enabled: S.canRead,
31
+ detailsText: C
32
+ }), A = o({
33
+ counterpartType: m,
34
+ selectedId: p,
35
+ setSelectedId: f,
36
+ view: E,
37
+ setView: D,
38
+ details: O,
39
+ messages: w
40
+ }), { closeAddress: j } = A, { close: M } = A.bank.form, { close: N } = A.del, P = c(() => {
41
+ j(), M(), N(), D("none");
42
+ }, [
43
+ j,
44
+ M,
45
+ N
46
+ ]), [F, I] = u(p);
47
+ F !== p && (I(p), P());
48
+ let L = c(() => {
49
+ P(), h();
50
+ }, [P, h]);
51
+ return /* @__PURE__ */ d(a, {
52
+ counterpartType: m,
53
+ open: S.canRead && p !== void 0,
54
+ selectedId: p,
55
+ view: E,
56
+ details: O,
57
+ detailsSheetView: k,
58
+ actions: A,
59
+ stateOptions: T,
60
+ canEdit: S.canUpdate,
39
61
  canDelete: !1,
40
- onEdit: () => void 0,
41
- onDelete: () => void 0,
42
- onClose: l,
43
- onViewAllDocuments: u && v ? () => u(v) : void 0,
44
- onCreateDocument: d && v ? () => d(v) : void 0,
45
- labels: f
62
+ onClose: L,
63
+ onViewAllDocuments: g,
64
+ onCreateDocument: _,
65
+ detailsLabels: v,
66
+ formLabels: y
46
67
  });
47
68
  }
48
69
  //#endregion
49
- export { s as CounterpartDetailsContainer };
70
+ export { p as CounterpartDetailsContainer };
@@ -0,0 +1,137 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { BankAccountFormSheet as e } from "../../../../../shared/counterpart-management/ui/dist/index12.js";
6
+ import { ConfirmDeleteDialog as t } from "../../../../../shared/counterpart-management/ui/dist/index15.js";
7
+ import "../../../../../shared/counterpart-management/feature/dist/index.js";
8
+ import { EDIT_FORM_FIELD_KEYS as n, addressFormLabelOverrides as r, buildCounterpartEditFormView as i, editFormLabelOverrides as a, withAddressLabelOverrides as o } from "./viewModels.js";
9
+ import { COUNTERPART_DETAILS_SHEET_LABELS_EN as s } from "../../../../ui/dist/index2.js";
10
+ import { CounterpartDetailsSheet as c } from "../../../../ui/dist/index7.js";
11
+ import "../../../../ui/dist/index.js";
12
+ import { useMemo as l } from "react";
13
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
14
+ //#region ../../libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsPanel.js
15
+ function p({ counterpartType: p, open: m, selectedId: h, view: g, details: _, detailsSheetView: v, actions: y, stateOptions: b, canEdit: x, canDelete: S, onClose: C, onViewAllDocuments: w, onCreateDocument: T, formLabels: E, detailsLabels: D, bankAccountLabels: O, addressLabels: k, deleteLabels: A }) {
16
+ let { form: j, bank: M, address: N, del: P, isEditDirty: F, isAddressDirty: I } = y, L = !_.isAddressesLoading && !_.isAddressesFetching && !_.isAddressesError, R = x && L, z = !_.isLoading && !_.isFetching && !_.isError && (p === "vendor" ? R : x), B = !_.isBankAccountsLoading && !_.isBankAccountsFetching && !_.isBankAccountsError, V = l(() => o(D, k), [k, D]), H = l(() => r(k), [k]), U = l(() => a(E), [E]), W = l(() => g === "edit" ? i(p, j.values, j.errors, {
17
+ ...s,
18
+ ...V,
19
+ ...U.labels
20
+ }) : void 0, [
21
+ p,
22
+ U,
23
+ j.errors,
24
+ j.values,
25
+ V,
26
+ g
27
+ ]), G = l(() => h && v ? {
28
+ id: h,
29
+ name: v.name
30
+ } : void 0, [v, h]);
31
+ return /* @__PURE__ */ f(u, { children: [
32
+ /* @__PURE__ */ d(c, {
33
+ open: m,
34
+ onOpenChange: (e) => {
35
+ e || C();
36
+ },
37
+ privacyResetKey: h,
38
+ mode: p,
39
+ counterpart: v,
40
+ isLoading: _.isLoading,
41
+ isError: _.isError,
42
+ canEdit: x,
43
+ canEditProfile: z,
44
+ canEditAddress: R,
45
+ canEditPaymentMethod: x && B,
46
+ canDelete: S,
47
+ onEdit: y.handleEditProfile,
48
+ onDelete: P.requestDeleteCounterpart,
49
+ onClose: C,
50
+ onAddAddress: N.openCreate,
51
+ onEditAddress: N.openEdit,
52
+ onAddBankAccount: M.form.openCreate,
53
+ onEditBankAccount: M.form.openEdit,
54
+ onViewAllDocuments: w && G ? () => w(G) : void 0,
55
+ onCreateDocument: T && G ? () => T(G) : void 0,
56
+ onDeleteBankAccount: (e) => P.requestDelete({
57
+ kind: "bankAccount",
58
+ id: e,
59
+ label: _.bankItems.find((t) => t.id === e)?.primary ?? ""
60
+ }),
61
+ editForm: W && {
62
+ ...W,
63
+ ...U,
64
+ stateOptions: b,
65
+ inProgress: j.isSubmitting,
66
+ submitDisabled: !F || !z,
67
+ onFieldChange: (e, t) => j.setValues((r) => ({
68
+ ...r,
69
+ [n[e]]: t
70
+ })),
71
+ onRemindersChange: (e) => j.setValues((t) => ({
72
+ ...t,
73
+ remindersEnabled: e
74
+ })),
75
+ onAddressChange: (e) => j.setValues((t) => ({
76
+ ...t,
77
+ address: {
78
+ ...t.address,
79
+ ...e
80
+ }
81
+ })),
82
+ onSubmit: j.submit,
83
+ onCancel: j.close
84
+ },
85
+ addressForm: N.open ? {
86
+ hasExistingAddress: !!_.primaryAddress,
87
+ values: N.values,
88
+ errors: N.errors,
89
+ stateOptions: b,
90
+ inProgress: N.isPending,
91
+ submitDisabled: !I || !L,
92
+ formError: N.formError,
93
+ ...H,
94
+ onChange: (e) => N.setValues((t) => ({
95
+ ...t,
96
+ ...e
97
+ })),
98
+ onSubmit: N.submit,
99
+ onCancel: N.close
100
+ } : void 0,
101
+ labels: V
102
+ }),
103
+ /* @__PURE__ */ d(e, {
104
+ open: M.form.sheet.open,
105
+ onOpenChange: (e) => {
106
+ e || M.form.close();
107
+ },
108
+ mode: M.form.sheet.mode,
109
+ values: M.form.values,
110
+ errors: M.form.errors,
111
+ highlightedFields: M.highlightedFields,
112
+ inProgress: M.inProgress,
113
+ submitDisabled: !M.isDirty || !B,
114
+ onChange: (e) => M.form.setValues((t) => ({
115
+ ...t,
116
+ ...e
117
+ })),
118
+ onSubmit: M.form.submit,
119
+ onCancel: M.form.close,
120
+ labels: O
121
+ }),
122
+ /* @__PURE__ */ d(t, {
123
+ open: P.target !== null,
124
+ onOpenChange: (e) => {
125
+ e || P.close();
126
+ },
127
+ title: P.dialogTitle,
128
+ message: P.dialogMessage,
129
+ isDeleting: P.isDeleting,
130
+ onConfirm: P.confirm,
131
+ onCancel: P.close,
132
+ labels: A
133
+ })
134
+ ] });
135
+ }
136
+ //#endregion
137
+ export { p as CounterpartDetailsPanel };