@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
@@ -1,211 +1,67 @@
1
- import { Button as e, Checkbox as t, Field as n, FieldContent as r, FieldDescription as i, FieldError as a, FieldLabel as o, Input as s, LABEL_LABELS_EN as c, Label as l, RequiredFieldsLegend as u, Spinner as d, Typography as f, cn as p, mergeRequiredFieldsLegendLabels as m } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { CounterpartAddressFields as h } from "../../../shared/counterpart-management/ui/dist/index7.js";
1
+ import { Button as e, LABEL_LABELS_EN as t, RequiredFieldsLegend as n, Spinner as r, Typography as i, mergeRequiredFieldsLegendLabels as a } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { CounterpartAddressFields as o } from "../../../shared/counterpart-management/ui/dist/index7.js";
3
3
  import "../../../shared/counterpart-management/ui/dist/index.js";
4
- import { addressFieldLabels as g } from "./index4.js";
5
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
4
+ import { addressFieldLabels as s } from "./index4.js";
5
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
6
6
  //#region ../../libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js
7
- function y(e) {
8
- return e ? [{ message: e }] : void 0;
9
- }
10
- function b({ form: b, labels: x }) {
11
- let { name: S, email: C, phone: w, taxId: T, reminders: E, address: D, inProgress: O } = b, k = {
12
- ...x,
13
- ...b.labels
14
- }, A = {
15
- ...c,
16
- ...b.fieldMarkers
7
+ function u({ form: u, labels: d }) {
8
+ let f = {
9
+ ...t,
10
+ ...u.fieldMarkers
17
11
  };
18
- return /* @__PURE__ */ v("form", {
12
+ return /* @__PURE__ */ l("form", {
19
13
  className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:rounded-[10px] ttw:border ttw:border-border ttw:bg-muted ttw:p-4",
20
14
  onSubmit: (e) => {
21
- e.preventDefault(), b.onSubmit();
15
+ e.preventDefault(), u.onSubmit();
22
16
  },
23
- children: [/* @__PURE__ */ v("div", {
17
+ children: [/* @__PURE__ */ l("div", {
24
18
  className: "ttw:flex ttw:flex-col ttw:gap-4",
25
19
  children: [
26
- /* @__PURE__ */ _("div", {
27
- className: "ttw:flex ttw:flex-col ttw:gap-1.5 ttw:border-b ttw:border-border ttw:pt-6 ttw:pb-7",
28
- children: /* @__PURE__ */ _(f, {
20
+ /* @__PURE__ */ c("div", {
21
+ className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3 ttw:border-b ttw:border-border ttw:pt-6 ttw:pb-7",
22
+ children: /* @__PURE__ */ c(i, {
29
23
  variant: "body1",
30
24
  className: "ttw:font-medium",
31
- children: b.heading
25
+ children: u.hasExistingAddress ? d.editingAddressHeading : d.addingAddressHeading
32
26
  })
33
27
  }),
34
- /* @__PURE__ */ _(u, { labels: m(A, b.requiredFieldsLegend) }),
35
- b.formError && /* @__PURE__ */ _(f, {
28
+ /* @__PURE__ */ c(n, { labels: a(f, u.requiredFieldsLegend) }),
29
+ u.formError && /* @__PURE__ */ c(i, {
36
30
  variant: "body2",
37
31
  color: "destructive",
38
32
  role: "alert",
39
- children: b.formError
40
- }),
41
- S.kind === "person" ? /* @__PURE__ */ v("div", {
42
- className: "ttw:flex ttw:gap-4",
43
- children: [/* @__PURE__ */ _(n, { children: /* @__PURE__ */ v(r, { children: [
44
- /* @__PURE__ */ _(o, {
45
- htmlFor: "counterpart-edit-first-name",
46
- requirement: "required",
47
- labels: A,
48
- children: k.firstNameLabel
49
- }),
50
- /* @__PURE__ */ _(s, {
51
- id: "counterpart-edit-first-name",
52
- "aria-required": !0,
53
- className: "ttw:bg-background",
54
- value: S.firstName.value,
55
- disabled: O,
56
- "aria-invalid": !!S.firstName.error || void 0,
57
- onChange: (e) => b.onFieldChange("firstName", e.target.value)
58
- }),
59
- /* @__PURE__ */ _(a, { errors: y(S.firstName.error) })
60
- ] }) }), /* @__PURE__ */ _(n, { children: /* @__PURE__ */ v(r, { children: [
61
- /* @__PURE__ */ _(o, {
62
- htmlFor: "counterpart-edit-last-name",
63
- requirement: "required",
64
- labels: A,
65
- children: k.lastNameLabel
66
- }),
67
- /* @__PURE__ */ _(s, {
68
- id: "counterpart-edit-last-name",
69
- "aria-required": !0,
70
- className: "ttw:bg-background",
71
- value: S.lastName.value,
72
- disabled: O,
73
- "aria-invalid": !!S.lastName.error || void 0,
74
- onChange: (e) => b.onFieldChange("lastName", e.target.value)
75
- }),
76
- /* @__PURE__ */ _(a, { errors: y(S.lastName.error) })
77
- ] }) })]
78
- }) : /* @__PURE__ */ _(n, { children: /* @__PURE__ */ v(r, { children: [
79
- /* @__PURE__ */ _(o, {
80
- htmlFor: "counterpart-edit-business-name",
81
- requirement: "required",
82
- labels: A,
83
- children: k.businessNameLabel
84
- }),
85
- /* @__PURE__ */ _(s, {
86
- id: "counterpart-edit-business-name",
87
- "aria-required": !0,
88
- className: "ttw:bg-background",
89
- value: S.businessName.value,
90
- disabled: O,
91
- "aria-invalid": !!S.businessName.error || void 0,
92
- onChange: (e) => b.onFieldChange("businessName", e.target.value)
93
- }),
94
- /* @__PURE__ */ _(a, { errors: y(S.businessName.error) })
95
- ] }) }),
96
- /* @__PURE__ */ v("div", {
97
- className: p("ttw:flex ttw:gap-4", b.contactLayout === "inline" ? "ttw:flex-row" : "ttw:flex-col"),
98
- children: [
99
- /* @__PURE__ */ _(n, { children: /* @__PURE__ */ v(r, { children: [
100
- /* @__PURE__ */ _(o, {
101
- htmlFor: "counterpart-edit-email",
102
- requirement: "required",
103
- labels: A,
104
- children: k.rowEmail
105
- }),
106
- /* @__PURE__ */ _(s, {
107
- id: "counterpart-edit-email",
108
- "aria-required": !0,
109
- type: "email",
110
- className: "ttw:bg-background",
111
- value: C.value,
112
- disabled: O,
113
- "aria-invalid": !!C.error || void 0,
114
- onChange: (e) => b.onFieldChange("email", e.target.value)
115
- }),
116
- /* @__PURE__ */ _(a, { errors: y(C.error) })
117
- ] }) }),
118
- E && /* @__PURE__ */ v(l, {
119
- htmlFor: "counterpart-edit-reminders",
120
- className: "ttw:flex ttw:items-start ttw:gap-3 ttw:rounded-md ttw:border ttw:border-border ttw:bg-background ttw:p-3",
121
- children: [/* @__PURE__ */ _(t, {
122
- id: "counterpart-edit-reminders",
123
- checked: E.checked,
124
- disabled: O,
125
- onCheckedChange: (e) => b.onRemindersChange(e === !0)
126
- }), /* @__PURE__ */ v("span", {
127
- className: "ttw:flex ttw:flex-col ttw:gap-0.5",
128
- children: [/* @__PURE__ */ _("span", {
129
- className: "ttw:text-sm ttw:font-medium",
130
- children: k.remindersCheckboxLabel
131
- }), /* @__PURE__ */ _("span", {
132
- className: "ttw:text-sm ttw:text-muted-foreground",
133
- children: k.remindersCheckboxDescription
134
- })]
135
- })]
136
- }),
137
- /* @__PURE__ */ _(n, { children: /* @__PURE__ */ v(r, { children: [
138
- /* @__PURE__ */ _(o, {
139
- htmlFor: "counterpart-edit-phone",
140
- requirement: "optional",
141
- labels: A,
142
- children: k.rowPhone
143
- }),
144
- /* @__PURE__ */ _(s, {
145
- id: "counterpart-edit-phone",
146
- type: "tel",
147
- className: "ttw:bg-background",
148
- value: w.value,
149
- disabled: O,
150
- "aria-invalid": !!w.error || void 0,
151
- onChange: (e) => b.onFieldChange("phone", e.target.value)
152
- }),
153
- /* @__PURE__ */ _(a, { errors: y(w.error) })
154
- ] }) })
155
- ]
33
+ children: u.formError
156
34
  }),
157
- /* @__PURE__ */ _(n, { children: /* @__PURE__ */ v(r, { children: [
158
- /* @__PURE__ */ _(o, {
159
- htmlFor: "counterpart-edit-tax-id",
160
- requirement: "optional",
161
- labels: A,
162
- children: T.label
163
- }),
164
- /* @__PURE__ */ _(s, {
165
- id: "counterpart-edit-tax-id",
166
- className: "ttw:bg-background",
167
- placeholder: T.placeholder,
168
- value: T.value,
169
- disabled: O,
170
- "aria-invalid": !!T.error || void 0,
171
- onChange: (e) => b.onFieldChange("taxId", e.target.value)
172
- }),
173
- /* @__PURE__ */ _(i, { children: T.description }),
174
- /* @__PURE__ */ _(a, { errors: y(T.error) })
175
- ] }) }),
176
- D && /* @__PURE__ */ _("div", {
177
- className: "ttw:flex ttw:flex-col ttw:gap-4",
178
- children: /* @__PURE__ */ _(h, {
179
- idPrefix: "counterpart-edit-address",
180
- values: D.values,
181
- errors: D.errors,
182
- stateOptions: b.stateOptions,
183
- disabled: O,
184
- onChange: b.onAddressChange,
185
- labels: g(k, {
186
- ...A,
187
- ...b.addressFieldMarkers
188
- })
35
+ /* @__PURE__ */ c(o, {
36
+ idPrefix: "counterpart-address-form",
37
+ values: u.values,
38
+ errors: u.errors,
39
+ stateOptions: u.stateOptions,
40
+ disabled: u.inProgress,
41
+ onChange: u.onChange,
42
+ labels: s(d, {
43
+ ...f,
44
+ ...u.addressFieldMarkers
189
45
  })
190
46
  })
191
47
  ]
192
- }), /* @__PURE__ */ v("div", {
48
+ }), /* @__PURE__ */ l("div", {
193
49
  className: "ttw:flex ttw:justify-end ttw:gap-4 ttw:pt-6",
194
- children: [/* @__PURE__ */ _(e, {
50
+ children: [/* @__PURE__ */ c(e, {
195
51
  type: "button",
196
52
  variant: "outline",
197
53
  className: "ttw:w-fit ttw:border-border",
198
- disabled: O,
199
- onClick: b.onCancel,
200
- children: k.cancelButton
201
- }), /* @__PURE__ */ v(e, {
54
+ disabled: u.inProgress,
55
+ onClick: u.onCancel,
56
+ children: d.cancelButton
57
+ }), /* @__PURE__ */ l(e, {
202
58
  type: "submit",
203
59
  className: "ttw:w-fit",
204
- disabled: O || b.submitDisabled,
205
- children: [O && /* @__PURE__ */ _(d, {}), k.saveButton]
60
+ disabled: u.inProgress || u.submitDisabled,
61
+ children: [u.inProgress && /* @__PURE__ */ c(r, {}), d.saveButton]
206
62
  })]
207
63
  })]
208
64
  });
209
65
  }
210
66
  //#endregion
211
- export { b as CounterpartEditForm };
67
+ export { u as CounterpartAddressForm };