@tesouro/embedded-components-react 0.7.61 → 0.7.63
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.
- package/README.md +11 -11
- package/dist/index.css +3 -0
- package/dist/index.d.ts +22 -4
- package/dist/lib/ProductsWidget.d.ts +22 -4
- package/dist/lib/ReceivablesWidget.d.ts +22 -4
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index34.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/ProductsWidget.js +101 -98
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductDelete.js +25 -19
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductsWidget.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/index.js +14 -14
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js +110 -102
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/labels.js +10 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/toasts.js +14 -0
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js +44 -36
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +17 -16
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/ToastNameMessage/ToastNameMessage.js +18 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -561,16 +561,16 @@ Manages an organization's products and services: a filterable, sortable table wi
|
|
|
561
561
|
|
|
562
562
|
#### Props
|
|
563
563
|
|
|
564
|
-
| Prop | Type | Default | Description
|
|
565
|
-
| ------------------------- | ---------------------------------------- | ------------------- |
|
|
566
|
-
| `pageSizeOptions` | `number[]` | `[10, 25, 50, 100]` | Rows-per-page choices.
|
|
567
|
-
| `screenLabels` | `PartialDeep<ProductsScreenLabels>` | English labels | Table/header/filter/empty/error copy.
|
|
568
|
-
| `formLabels` | `Partial<ProductFormSheetLabels>` | English labels | Create/edit form copy.
|
|
569
|
-
| `detailsLabels` | `PartialDeep<ProductDetailsSheetLabels>` | English labels | Details sheet copy.
|
|
570
|
-
| `deleteLabels` | `Partial<ProductDeleteDialogLabels>` | English labels | Product delete confirmation copy.
|
|
571
|
-
| `measureUnitsLabels` | `Partial<MeasureUnitsManagerLabels>` | English labels | Measure-units manager copy.
|
|
572
|
-
| `measureUnitDeleteLabels` | `Partial<MeasureUnitDeleteDialogLabels>` | English labels | Measure-unit delete confirmation copy.
|
|
573
|
-
| `messageLabels` | `Partial<ProductMessageLabels>` | English labels | Validation
|
|
564
|
+
| Prop | Type | Default | Description |
|
|
565
|
+
| ------------------------- | ---------------------------------------- | ------------------- | ------------------------------------------------------------ |
|
|
566
|
+
| `pageSizeOptions` | `number[]` | `[10, 25, 50, 100]` | Rows-per-page choices. |
|
|
567
|
+
| `screenLabels` | `PartialDeep<ProductsScreenLabels>` | English labels | Table/header/filter/empty/error copy. |
|
|
568
|
+
| `formLabels` | `Partial<ProductFormSheetLabels>` | English labels | Create/edit form copy. |
|
|
569
|
+
| `detailsLabels` | `PartialDeep<ProductDetailsSheetLabels>` | English labels | Details sheet copy. |
|
|
570
|
+
| `deleteLabels` | `Partial<ProductDeleteDialogLabels>` | English labels | Product delete confirmation copy. |
|
|
571
|
+
| `measureUnitsLabels` | `Partial<MeasureUnitsManagerLabels>` | English labels | Measure-units manager copy. |
|
|
572
|
+
| `measureUnitDeleteLabels` | `Partial<MeasureUnitDeleteDialogLabels>` | English labels | Measure-unit delete confirmation copy. |
|
|
573
|
+
| `messageLabels` | `Partial<ProductMessageLabels>` | English labels | Validation, error and toast messages produced by the widget. |
|
|
574
574
|
|
|
575
575
|
### ReceivablesWidget
|
|
576
576
|
|
|
@@ -603,7 +603,7 @@ Lists, creates, edits and acts on an organization's invoices, including sending
|
|
|
603
603
|
| `measureUnitsLabels` | `Partial<MeasureUnitsManagerLabels>` | English labels | Measure-unit manager copy. |
|
|
604
604
|
| `measureUnitDeleteLabels` | `Partial<MeasureUnitDeleteDialogLabels>` | English labels | Measure-unit delete confirmation copy. |
|
|
605
605
|
| `messageLabels` | `Partial<ReceivableMessageLabels>` | English labels | Validation, fallback, details panel, reminder and confirmation messages, including the form's save and issue buttons and a new reminder's subject and body. |
|
|
606
|
-
| `productMessageLabels` | `Partial<ProductMessageLabels>` | English labels | Product validation and error messages.
|
|
606
|
+
| `productMessageLabels` | `Partial<ProductMessageLabels>` | English labels | Product validation and error messages, and the measure-unit toasts. |
|
|
607
607
|
| `counterpartMessageLabels` | `Partial<CounterpartMessageLabels>` | English labels | Customer validation and error messages. |
|
|
608
608
|
|
|
609
609
|
### SettingsWidget
|
package/dist/index.css
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -5035,10 +5035,11 @@ interface MeasureUnitDeleteDialogLabels {
|
|
|
5035
5035
|
}
|
|
5036
5036
|
|
|
5037
5037
|
/**
|
|
5038
|
-
* Overridable validation
|
|
5039
|
-
* layer and surfaced through the form's `errors` prop
|
|
5040
|
-
* manager. Consumers override
|
|
5041
|
-
*
|
|
5038
|
+
* Overridable validation, error and toast messages produced by the products
|
|
5039
|
+
* feature layer and surfaced through the form's `errors` prop, the
|
|
5040
|
+
* measure-units manager and toasts. Consumers override them through
|
|
5041
|
+
* `ProductsWidget`'s `messageLabels` or `ReceivablesWidget`'s
|
|
5042
|
+
* `productMessageLabels`, merged over {@link PRODUCT_MESSAGE_LABELS_EN}.
|
|
5042
5043
|
*/
|
|
5043
5044
|
interface ProductMessageLabels {
|
|
5044
5045
|
nameRequired: string;
|
|
@@ -5056,6 +5057,23 @@ interface ProductMessageLabels {
|
|
|
5056
5057
|
createMeasureUnitError: string;
|
|
5057
5058
|
/** Fallback when updating a measure unit fails without a server message. */
|
|
5058
5059
|
updateMeasureUnitError: string;
|
|
5060
|
+
/** Success toast after creating a product; `{name}` is replaced with its name. */
|
|
5061
|
+
productCreated: string;
|
|
5062
|
+
/** Success toast after editing a product; `{name}` is replaced with its name. */
|
|
5063
|
+
productUpdated: string;
|
|
5064
|
+
/** Success toast after editing a service; `{name}` is replaced with its name. */
|
|
5065
|
+
serviceUpdated: string;
|
|
5066
|
+
productDeleted: string;
|
|
5067
|
+
/** Error toast when a product delete fails without a server message. */
|
|
5068
|
+
deleteProductError: string;
|
|
5069
|
+
/** Success toast after creating a measure unit; `{name}` is replaced with its name. */
|
|
5070
|
+
measureUnitCreated: string;
|
|
5071
|
+
/** Success toast after editing a measure unit; `{name}` is replaced with its name. */
|
|
5072
|
+
measureUnitUpdated: string;
|
|
5073
|
+
/** Success toast after deleting a measure unit; `{name}` is replaced with its name. */
|
|
5074
|
+
measureUnitDeleted: string;
|
|
5075
|
+
/** Error toast when a measure unit delete fails without a server message. */
|
|
5076
|
+
deleteMeasureUnitError: string;
|
|
5059
5077
|
}
|
|
5060
5078
|
|
|
5061
5079
|
interface ProductTypeBadgeLabels {
|
|
@@ -663,10 +663,11 @@ interface MeasureUnitDeleteDialogLabels {
|
|
|
663
663
|
}
|
|
664
664
|
|
|
665
665
|
/**
|
|
666
|
-
* Overridable validation
|
|
667
|
-
* layer and surfaced through the form's `errors` prop
|
|
668
|
-
* manager. Consumers override
|
|
669
|
-
*
|
|
666
|
+
* Overridable validation, error and toast messages produced by the products
|
|
667
|
+
* feature layer and surfaced through the form's `errors` prop, the
|
|
668
|
+
* measure-units manager and toasts. Consumers override them through
|
|
669
|
+
* `ProductsWidget`'s `messageLabels` or `ReceivablesWidget`'s
|
|
670
|
+
* `productMessageLabels`, merged over {@link PRODUCT_MESSAGE_LABELS_EN}.
|
|
670
671
|
*/
|
|
671
672
|
interface ProductMessageLabels {
|
|
672
673
|
nameRequired: string;
|
|
@@ -684,6 +685,23 @@ interface ProductMessageLabels {
|
|
|
684
685
|
createMeasureUnitError: string;
|
|
685
686
|
/** Fallback when updating a measure unit fails without a server message. */
|
|
686
687
|
updateMeasureUnitError: string;
|
|
688
|
+
/** Success toast after creating a product; `{name}` is replaced with its name. */
|
|
689
|
+
productCreated: string;
|
|
690
|
+
/** Success toast after editing a product; `{name}` is replaced with its name. */
|
|
691
|
+
productUpdated: string;
|
|
692
|
+
/** Success toast after editing a service; `{name}` is replaced with its name. */
|
|
693
|
+
serviceUpdated: string;
|
|
694
|
+
productDeleted: string;
|
|
695
|
+
/** Error toast when a product delete fails without a server message. */
|
|
696
|
+
deleteProductError: string;
|
|
697
|
+
/** Success toast after creating a measure unit; `{name}` is replaced with its name. */
|
|
698
|
+
measureUnitCreated: string;
|
|
699
|
+
/** Success toast after editing a measure unit; `{name}` is replaced with its name. */
|
|
700
|
+
measureUnitUpdated: string;
|
|
701
|
+
/** Success toast after deleting a measure unit; `{name}` is replaced with its name. */
|
|
702
|
+
measureUnitDeleted: string;
|
|
703
|
+
/** Error toast when a measure unit delete fails without a server message. */
|
|
704
|
+
deleteMeasureUnitError: string;
|
|
687
705
|
}
|
|
688
706
|
|
|
689
707
|
interface ProductTypeBadgeLabels {
|
|
@@ -915,10 +915,11 @@ interface MeasureUnitDeleteDialogLabels {
|
|
|
915
915
|
}
|
|
916
916
|
|
|
917
917
|
/**
|
|
918
|
-
* Overridable validation
|
|
919
|
-
* layer and surfaced through the form's `errors` prop
|
|
920
|
-
* manager. Consumers override
|
|
921
|
-
*
|
|
918
|
+
* Overridable validation, error and toast messages produced by the products
|
|
919
|
+
* feature layer and surfaced through the form's `errors` prop, the
|
|
920
|
+
* measure-units manager and toasts. Consumers override them through
|
|
921
|
+
* `ProductsWidget`'s `messageLabels` or `ReceivablesWidget`'s
|
|
922
|
+
* `productMessageLabels`, merged over {@link PRODUCT_MESSAGE_LABELS_EN}.
|
|
922
923
|
*/
|
|
923
924
|
interface ProductMessageLabels {
|
|
924
925
|
nameRequired: string;
|
|
@@ -936,6 +937,23 @@ interface ProductMessageLabels {
|
|
|
936
937
|
createMeasureUnitError: string;
|
|
937
938
|
/** Fallback when updating a measure unit fails without a server message. */
|
|
938
939
|
updateMeasureUnitError: string;
|
|
940
|
+
/** Success toast after creating a product; `{name}` is replaced with its name. */
|
|
941
|
+
productCreated: string;
|
|
942
|
+
/** Success toast after editing a product; `{name}` is replaced with its name. */
|
|
943
|
+
productUpdated: string;
|
|
944
|
+
/** Success toast after editing a service; `{name}` is replaced with its name. */
|
|
945
|
+
serviceUpdated: string;
|
|
946
|
+
productDeleted: string;
|
|
947
|
+
/** Error toast when a product delete fails without a server message. */
|
|
948
|
+
deleteProductError: string;
|
|
949
|
+
/** Success toast after creating a measure unit; `{name}` is replaced with its name. */
|
|
950
|
+
measureUnitCreated: string;
|
|
951
|
+
/** Success toast after editing a measure unit; `{name}` is replaced with its name. */
|
|
952
|
+
measureUnitUpdated: string;
|
|
953
|
+
/** Success toast after deleting a measure unit; `{name}` is replaced with its name. */
|
|
954
|
+
measureUnitDeleted: string;
|
|
955
|
+
/** Error toast when a measure unit delete fails without a server message. */
|
|
956
|
+
deleteMeasureUnitError: string;
|
|
939
957
|
}
|
|
940
958
|
|
|
941
959
|
declare const InvoicesFilterField: {
|
|
@@ -573,7 +573,6 @@ var h = (d) => {
|
|
|
573
573
|
padding: "0 12px",
|
|
574
574
|
fontWeight: 400,
|
|
575
575
|
fontSize: "15px",
|
|
576
|
-
"& span.Monite-DueDateCell-OverdueDays": { fontSize: "12px" },
|
|
577
576
|
"&[data-field=\"counterpart_id\"], &[data-field=\"counterpart_name\"], &[data-field=\"was_created_by_user_id\"]": { ".MuiChip-root": { paddingLeft: 0 } },
|
|
578
577
|
"&[data-field=\"actions\"]": { textOverflow: "clip" },
|
|
579
578
|
"& .Monite-TextOverflowContainer": {
|
|
@@ -2,125 +2,128 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
5
|
+
import { EmbeddedToaster as e } from "../../../../../shared/ui/dist/lib/EmbeddedToaster.js";
|
|
6
|
+
import "../../../../../shared/ui/dist/index.js";
|
|
7
|
+
import { useAnalyticsTrack as t } from "../../../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
8
|
+
import { WidgetProvider as n } from "../../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
7
9
|
import "../../../../../shared/feature/dist/index.js";
|
|
8
|
-
import { ProductFormSheet as
|
|
9
|
-
import { MeasureUnitsManagerContainer as
|
|
10
|
+
import { ProductFormSheet as r } from "../../../../../shared/product-catalog/ui/dist/index3.js";
|
|
11
|
+
import { MeasureUnitsManagerContainer as i } from "../../../../../shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js";
|
|
10
12
|
import "../../../../../shared/product-catalog/feature/dist/index.js";
|
|
11
|
-
import { ProductsWidgetAnalyticsEvent as
|
|
12
|
-
import { PAGE_SIZE_OPTIONS as
|
|
13
|
-
import { productsWidgetTestIds as
|
|
14
|
-
import { useProductsWidget as
|
|
15
|
-
import { ProductsScreen as
|
|
16
|
-
import { ProductDetailsSheet as
|
|
17
|
-
import { ProductDeleteDialog as
|
|
13
|
+
import { ProductsWidgetAnalyticsEvent as a, WIDGET_NAME as o } from "../analytics/events.js";
|
|
14
|
+
import { PAGE_SIZE_OPTIONS as s } from "./constants.js";
|
|
15
|
+
import { productsWidgetTestIds as c } from "./testIds.js";
|
|
16
|
+
import { useProductsWidget as l } from "./useProductsWidget.js";
|
|
17
|
+
import { ProductsScreen as u } from "../../../../ui/dist/index4.js";
|
|
18
|
+
import { ProductDetailsSheet as d } from "../../../../ui/dist/index5.js";
|
|
19
|
+
import { ProductDeleteDialog as f } from "../../../../ui/dist/index6.js";
|
|
18
20
|
import "../../../../ui/dist/index.js";
|
|
19
|
-
import { useEffect as
|
|
20
|
-
import { Fragment as
|
|
21
|
+
import { useEffect as p } from "react";
|
|
22
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
21
23
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/ProductsWidget.js
|
|
22
|
-
function
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}, [
|
|
27
|
-
let { view:
|
|
28
|
-
return /* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
24
|
+
function _({ pageSizeOptions: n = s, screenLabels: o, formLabels: _, detailsLabels: v, deleteLabels: y, measureUnitsLabels: b, measureUnitDeleteLabels: x, messageLabels: S }) {
|
|
25
|
+
let C = t();
|
|
26
|
+
p(() => {
|
|
27
|
+
C(a.Mounted);
|
|
28
|
+
}, [C]);
|
|
29
|
+
let { view: w, units: T, table: E, details: D, form: O, del: k, permissions: A, isPermissionLoading: j, isTableLoading: M, hasInitError: N, refetchWidgetInit: P, measureUnitsOpen: F, actionsSuspended: I, handleRowClick: L, openMeasureUnits: R, closeMeasureUnits: z, submitForm: B, confirmDelete: V } = l({ messageLabels: S });
|
|
30
|
+
return /* @__PURE__ */ g(m, { children: [
|
|
31
|
+
/* @__PURE__ */ h(e, {}),
|
|
32
|
+
/* @__PURE__ */ h(u, {
|
|
33
|
+
products: E.rows,
|
|
34
|
+
isLoading: M,
|
|
35
|
+
isError: N || E.isError,
|
|
36
|
+
sorting: E.sorting,
|
|
37
|
+
onSortingChange: E.onSortingChange,
|
|
38
|
+
pageSize: E.pageSize,
|
|
39
|
+
onPageSizeChange: E.onPageSizeChange,
|
|
40
|
+
pageSizeOptions: n,
|
|
41
|
+
hasNextPage: E.hasNextPage,
|
|
42
|
+
hasPrevPage: E.hasPrevPage,
|
|
43
|
+
onNextPage: E.onNextPage,
|
|
44
|
+
onPrevPage: E.onPrevPage,
|
|
45
|
+
searchValue: E.searchValue,
|
|
46
|
+
onSearchChange: E.onSearchChange,
|
|
47
|
+
typeFilter: E.typeFilter,
|
|
48
|
+
onTypeFilterChange: E.onTypeFilterChange,
|
|
49
|
+
unitFilter: E.unitFilter,
|
|
50
|
+
onUnitFilterChange: E.onUnitFilterChange,
|
|
51
|
+
unitOptions: T.unitOptions,
|
|
52
|
+
isFiltering: E.isFiltering,
|
|
53
|
+
canCreate: A.canCreate,
|
|
54
|
+
canManageUnits: A.canCreate,
|
|
55
|
+
isAccessRestricted: !j && !N && !A.canRead,
|
|
56
|
+
onCreateClick: O.openCreate,
|
|
57
|
+
onManageUnitsClick: R,
|
|
58
|
+
onRowClick: L,
|
|
59
|
+
onRetry: N ? P : E.onRetry,
|
|
60
|
+
labels: o,
|
|
58
61
|
testIds: {
|
|
59
|
-
empty:
|
|
60
|
-
accessRestricted:
|
|
62
|
+
empty: c.empty,
|
|
63
|
+
accessRestricted: c.accessRestricted
|
|
61
64
|
}
|
|
62
65
|
}),
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
open:
|
|
66
|
+
/* @__PURE__ */ h(r, {
|
|
67
|
+
open: w === "create" || w === "edit",
|
|
65
68
|
onOpenChange: (e) => {
|
|
66
|
-
e ||
|
|
69
|
+
e || O.close();
|
|
67
70
|
},
|
|
68
|
-
mode:
|
|
69
|
-
values:
|
|
70
|
-
errors:
|
|
71
|
-
unitOptions:
|
|
72
|
-
currencyOptions:
|
|
73
|
-
inProgress:
|
|
74
|
-
onChange: (e) =>
|
|
71
|
+
mode: w === "edit" ? "edit" : "create",
|
|
72
|
+
values: O.values,
|
|
73
|
+
errors: O.errors,
|
|
74
|
+
unitOptions: T.unitOptions,
|
|
75
|
+
currencyOptions: O.currencyOptions,
|
|
76
|
+
inProgress: O.isSubmitting || I,
|
|
77
|
+
onChange: (e) => O.setValues((t) => ({
|
|
75
78
|
...t,
|
|
76
79
|
...e
|
|
77
80
|
})),
|
|
78
|
-
onManageUnits:
|
|
79
|
-
onSubmit:
|
|
80
|
-
onCancel:
|
|
81
|
-
labels:
|
|
81
|
+
onManageUnits: R,
|
|
82
|
+
onSubmit: B,
|
|
83
|
+
onCancel: O.close,
|
|
84
|
+
labels: _
|
|
82
85
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
open:
|
|
86
|
+
/* @__PURE__ */ h(d, {
|
|
87
|
+
open: w === "details",
|
|
85
88
|
onOpenChange: (e) => {
|
|
86
|
-
e ||
|
|
89
|
+
e || O.close();
|
|
87
90
|
},
|
|
88
|
-
product:
|
|
89
|
-
isLoading:
|
|
90
|
-
isError:
|
|
91
|
-
onEdit:
|
|
92
|
-
onDelete:
|
|
93
|
-
canEdit:
|
|
94
|
-
canDelete:
|
|
95
|
-
labels: _
|
|
96
|
-
}),
|
|
97
|
-
/* @__PURE__ */ m(d, {
|
|
98
|
-
open: O.open,
|
|
99
|
-
onOpenChange: O.onOpenChange,
|
|
100
|
-
productName: E.productName,
|
|
101
|
-
isDeleting: O.isDeleting || F,
|
|
102
|
-
onConfirm: B,
|
|
103
|
-
onCancel: O.cancel,
|
|
91
|
+
product: D.detailsView,
|
|
92
|
+
isLoading: D.isLoading,
|
|
93
|
+
isError: D.isError,
|
|
94
|
+
onEdit: O.openEdit,
|
|
95
|
+
onDelete: k.requestDelete,
|
|
96
|
+
canEdit: A.canUpdate,
|
|
97
|
+
canDelete: A.canDelete,
|
|
104
98
|
labels: v
|
|
105
99
|
}),
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
open:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
100
|
+
/* @__PURE__ */ h(f, {
|
|
101
|
+
open: k.open,
|
|
102
|
+
onOpenChange: k.onOpenChange,
|
|
103
|
+
productName: D.productName,
|
|
104
|
+
isDeleting: k.isDeleting || I,
|
|
105
|
+
onConfirm: V,
|
|
106
|
+
onCancel: k.cancel,
|
|
107
|
+
labels: y
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ h(i, {
|
|
110
|
+
open: F,
|
|
111
|
+
onClose: z,
|
|
112
|
+
suspended: I,
|
|
113
|
+
managerLabels: b,
|
|
114
|
+
deleteLabels: x,
|
|
115
|
+
messageLabels: S
|
|
113
116
|
})
|
|
114
117
|
] });
|
|
115
118
|
}
|
|
116
|
-
function
|
|
117
|
-
return /* @__PURE__ */
|
|
118
|
-
widgetName:
|
|
119
|
+
function v({ baseUrl: e, widgetToken: t, organizationId: r, configClient: i, gatewayRouting: a, linkComponent: s, uiFramework: c, errorFallback: l, onError: u, analytics: d, disclosuresAcceptance: f, providerLabels: p, ...m }) {
|
|
120
|
+
return /* @__PURE__ */ h(n, {
|
|
121
|
+
widgetName: o,
|
|
119
122
|
baseUrl: e,
|
|
120
|
-
widgetToken:
|
|
123
|
+
widgetToken: t,
|
|
121
124
|
organizationId: r,
|
|
122
125
|
configClient: i,
|
|
123
|
-
gatewayRouting:
|
|
126
|
+
gatewayRouting: a,
|
|
124
127
|
linkComponent: s,
|
|
125
128
|
uiFramework: c,
|
|
126
129
|
errorFallback: l,
|
|
@@ -128,8 +131,8 @@ function _({ baseUrl: e, widgetToken: n, organizationId: r, configClient: i, gat
|
|
|
128
131
|
analytics: d,
|
|
129
132
|
disclosuresAcceptance: f,
|
|
130
133
|
providerLabels: p,
|
|
131
|
-
children: /* @__PURE__ */
|
|
134
|
+
children: /* @__PURE__ */ h(_, { ...m })
|
|
132
135
|
});
|
|
133
136
|
}
|
|
134
137
|
//#endregion
|
|
135
|
-
export {
|
|
138
|
+
export { v as ProductsWidget, v as default };
|
|
@@ -2,31 +2,37 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
5
|
+
import { toast as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import { extractApiErrorMessage as t } from "../../../../../shared/util/dist/lib/apiErrors.js";
|
|
7
|
+
import "../../../../../shared/ui/dist/index.js";
|
|
8
|
+
import { useDeleteProductMutation as n } from "../../../../../shared/product-catalog/data-access/dist/index8.js";
|
|
6
9
|
import "../../../../../shared/product-catalog/feature/dist/index.js";
|
|
7
|
-
import { useCallback as
|
|
10
|
+
import { useCallback as r, useState as i } from "react";
|
|
8
11
|
//#region ../../libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductDelete.js
|
|
9
|
-
function
|
|
10
|
-
let
|
|
11
|
-
e ||
|
|
12
|
-
}, []),
|
|
12
|
+
function a({ selectedProductId: a, setSelectedProductId: o, setView: s, messages: c }) {
|
|
13
|
+
let l = n(), [u, d] = i(!1), f = r(() => d(!0), []), p = r((e) => {
|
|
14
|
+
e || d(!1);
|
|
15
|
+
}, []), m = r(() => d(!1), []);
|
|
13
16
|
return {
|
|
14
|
-
open:
|
|
15
|
-
requestDelete:
|
|
16
|
-
onOpenChange:
|
|
17
|
-
confirm:
|
|
18
|
-
if (
|
|
19
|
-
await
|
|
20
|
-
} catch {
|
|
17
|
+
open: u,
|
|
18
|
+
requestDelete: f,
|
|
19
|
+
onOpenChange: p,
|
|
20
|
+
confirm: r(async () => {
|
|
21
|
+
if (a) try {
|
|
22
|
+
await l.mutateAsync({ path: { product_id: a } }), e.success(c.productDeleted), d(!1), s("none"), o(void 0);
|
|
23
|
+
} catch (n) {
|
|
24
|
+
e.error(t(n) ?? c.deleteProductError);
|
|
25
|
+
}
|
|
21
26
|
}, [
|
|
22
|
-
r,
|
|
23
|
-
o,
|
|
24
27
|
a,
|
|
25
|
-
|
|
28
|
+
l,
|
|
29
|
+
c,
|
|
30
|
+
s,
|
|
31
|
+
o
|
|
26
32
|
]),
|
|
27
|
-
cancel:
|
|
28
|
-
isDeleting:
|
|
33
|
+
cancel: m,
|
|
34
|
+
isDeleting: l.isPending
|
|
29
35
|
};
|
|
30
36
|
}
|
|
31
37
|
//#endregion
|
|
32
|
-
export {
|
|
38
|
+
export { a as useProductDelete };
|
package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
|
|
2
|
-
var e = "@tesouro/embedded-components-react", t = "0.7.
|
|
2
|
+
var e = "@tesouro/embedded-components-react", t = "0.7.63", n = "e47f3b4535cfeb468100c0b2f912924768c6b15f", r = Object.freeze({
|
|
3
3
|
library_name: e,
|
|
4
4
|
library_version: t,
|
|
5
5
|
library_sha: n
|
package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import "../../../util/dist/lib/apiErrors.js";
|
|
2
|
-
import { PRODUCT_MESSAGE_LABELS_EN as
|
|
3
|
-
import { buildProductDetailsView as
|
|
4
|
-
import { ProductFormSheet as
|
|
1
|
+
import { extractApiErrorMessage as e } from "../../../util/dist/lib/apiErrors.js";
|
|
2
|
+
import { PRODUCT_MESSAGE_LABELS_EN as t } from "./lib/labels.js";
|
|
3
|
+
import { buildProductDetailsView as n, buildProductRows as r, formatPrice as i, hasSelectedText as a } from "./lib/helpers.js";
|
|
4
|
+
import { ProductFormSheet as o } from "../../ui/dist/index3.js";
|
|
5
5
|
import "../../ui/dist/index4.js";
|
|
6
6
|
import "../../ui/dist/index5.js";
|
|
7
7
|
import "../../ui/dist/index.js";
|
|
8
|
-
import { useProductsQuery as
|
|
8
|
+
import { useProductsQuery as s } from "../../data-access/dist/index2.js";
|
|
9
9
|
import "../../data-access/dist/index3.js";
|
|
10
|
-
import { useProductQuery as
|
|
11
|
-
import { useCreateProductMutation as
|
|
10
|
+
import { useProductQuery as c } from "../../data-access/dist/index4.js";
|
|
11
|
+
import { useCreateProductMutation as l } from "../../data-access/dist/index6.js";
|
|
12
12
|
import "../../data-access/dist/index7.js";
|
|
13
|
-
import { useDeleteProductMutation as
|
|
14
|
-
import { useMeasureUnitsQuery as
|
|
13
|
+
import { useDeleteProductMutation as u } from "../../data-access/dist/index8.js";
|
|
14
|
+
import { useMeasureUnitsQuery as d } from "../../data-access/dist/index9.js";
|
|
15
15
|
import "../../data-access/dist/index10.js";
|
|
16
16
|
import "../../data-access/dist/index11.js";
|
|
17
17
|
import "../../data-access/dist/index12.js";
|
|
18
18
|
import "../../data-access/dist/index13.js";
|
|
19
19
|
import "../../data-access/dist/index.js";
|
|
20
|
-
import { MeasureUnitsManagerContainer as
|
|
21
|
-
import { useMeasureUnits as
|
|
22
|
-
import { useProductForm as
|
|
20
|
+
import { MeasureUnitsManagerContainer as f } from "./lib/MeasureUnitsManagerContainer.js";
|
|
21
|
+
import { useMeasureUnits as p } from "./lib/useMeasureUnits.js";
|
|
22
|
+
import { useProductForm as m } from "./lib/useProductForm.js";
|
|
23
23
|
import "./lib/useProductSelector.js";
|
|
24
|
-
import { ProductSelector as
|
|
25
|
-
export {
|
|
24
|
+
import { ProductSelector as h } from "./lib/ProductSelector.js";
|
|
25
|
+
export { f as MeasureUnitsManagerContainer, t as PRODUCT_MESSAGE_LABELS_EN, o as ProductFormSheet, h as ProductSelector, n as buildProductDetailsView, r as buildProductRows, e as extractApiErrorMessage, i as formatPrice, a as hasSelectedText, l as useCreateProductMutation, u as useDeleteProductMutation, p as useMeasureUnits, d as useMeasureUnitsQuery, m as useProductForm, c as useProductQuery, s as useProductsQuery };
|
|
@@ -2,146 +2,154 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { toast as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import { extractApiErrorMessage as t } from "../../../../util/dist/lib/apiErrors.js";
|
|
7
|
+
import "../../../../ui/dist/index.js";
|
|
8
|
+
import { PRODUCT_MESSAGE_LABELS_EN as n } from "./labels.js";
|
|
9
|
+
import { formatPrice as r, validateMeasureUnit as i } from "./helpers.js";
|
|
10
|
+
import { toastSuccessWithName as a } from "./toasts.js";
|
|
11
|
+
import { MeasureUnitsManager as o } from "../../../ui/dist/index4.js";
|
|
12
|
+
import { MeasureUnitDeleteDialog as s } from "../../../ui/dist/index5.js";
|
|
10
13
|
import "../../../ui/dist/index.js";
|
|
11
|
-
import { useMeasureUnitsQuery as
|
|
12
|
-
import { useProductsByMeasureUnitQuery as
|
|
13
|
-
import { useCreateMeasureUnitMutation as
|
|
14
|
-
import { useUpdateMeasureUnitMutation as
|
|
15
|
-
import { useDeleteMeasureUnitMutation as
|
|
14
|
+
import { useMeasureUnitsQuery as c } from "../../../data-access/dist/index9.js";
|
|
15
|
+
import { useProductsByMeasureUnitQuery as l } from "../../../data-access/dist/index10.js";
|
|
16
|
+
import { useCreateMeasureUnitMutation as u } from "../../../data-access/dist/index11.js";
|
|
17
|
+
import { useUpdateMeasureUnitMutation as d } from "../../../data-access/dist/index12.js";
|
|
18
|
+
import { useDeleteMeasureUnitMutation as f } from "../../../data-access/dist/index13.js";
|
|
16
19
|
import "../../../data-access/dist/index.js";
|
|
17
|
-
import { useCallback as
|
|
18
|
-
import { Fragment as
|
|
20
|
+
import { useCallback as p, useMemo as m, useState as h } from "react";
|
|
21
|
+
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
19
22
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js
|
|
20
|
-
var
|
|
23
|
+
var y = {
|
|
21
24
|
name: "",
|
|
22
25
|
description: ""
|
|
23
26
|
};
|
|
24
|
-
function
|
|
25
|
-
let
|
|
26
|
-
...
|
|
27
|
-
...
|
|
28
|
-
}), [
|
|
29
|
-
|
|
30
|
-
let
|
|
27
|
+
function b({ open: b, onClose: x, suspended: S = !1, managerLabels: C, deleteLabels: w, messageLabels: T }) {
|
|
28
|
+
let E = m(() => ({
|
|
29
|
+
...n,
|
|
30
|
+
...T
|
|
31
|
+
}), [T]), D = c({ enabled: b && !S }), O = u(), k = d(), A = f(), [j, M] = h(""), [N, P] = h(y), [F, I] = h(), [L, R] = h(), [z, B] = h(y), [V, H] = h(), [U, W] = h(), [G, K] = h(b);
|
|
32
|
+
b !== G && (K(b), b || W(void 0));
|
|
33
|
+
let q = m(() => (D.data?.data ?? []).map((e) => ({
|
|
31
34
|
id: e.id,
|
|
32
35
|
name: e.name,
|
|
33
36
|
description: e.description ?? ""
|
|
34
|
-
})), [
|
|
35
|
-
let e =
|
|
36
|
-
return e ?
|
|
37
|
-
}, [
|
|
37
|
+
})), [D.data]), J = m(() => {
|
|
38
|
+
let e = j.trim().toLowerCase();
|
|
39
|
+
return e ? q.filter((t) => t.name.toLowerCase().includes(e) || t.description.toLowerCase().includes(e)) : q;
|
|
40
|
+
}, [q, j]), Y = l(U?.id, { enabled: b && !S }), X = m(() => (Y.data?.data ?? []).map((e) => ({
|
|
38
41
|
id: e.id,
|
|
39
42
|
name: e.name,
|
|
40
|
-
priceLabel:
|
|
41
|
-
})), [
|
|
42
|
-
if (
|
|
43
|
-
let
|
|
44
|
-
if (
|
|
45
|
-
|
|
43
|
+
priceLabel: r(e.price)
|
|
44
|
+
})), [Y.data]), Z = p(async () => {
|
|
45
|
+
if (S) return;
|
|
46
|
+
let e = i(N, E);
|
|
47
|
+
if (e) {
|
|
48
|
+
I(e);
|
|
46
49
|
return;
|
|
47
50
|
}
|
|
48
|
-
|
|
51
|
+
I(void 0);
|
|
49
52
|
try {
|
|
50
|
-
await
|
|
51
|
-
name:
|
|
52
|
-
description:
|
|
53
|
-
} })
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
let e = await O.mutateAsync({ body: {
|
|
54
|
+
name: N.name.trim(),
|
|
55
|
+
description: N.description.trim() || void 0
|
|
56
|
+
} });
|
|
57
|
+
a(E.measureUnitCreated, e.name), P(y);
|
|
58
|
+
} catch (e) {
|
|
59
|
+
I(t(e) ?? E.createMeasureUnitError);
|
|
56
60
|
}
|
|
57
61
|
}, [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
]),
|
|
63
|
-
|
|
62
|
+
S,
|
|
63
|
+
N,
|
|
64
|
+
O,
|
|
65
|
+
E
|
|
66
|
+
]), Q = p((e) => {
|
|
67
|
+
R(e.id), B({
|
|
64
68
|
name: e.name,
|
|
65
69
|
description: e.description
|
|
66
|
-
}),
|
|
67
|
-
}, []),
|
|
68
|
-
if (
|
|
69
|
-
let
|
|
70
|
-
if (
|
|
71
|
-
|
|
70
|
+
}), H(void 0);
|
|
71
|
+
}, []), $ = p(async () => {
|
|
72
|
+
if (S || !L) return;
|
|
73
|
+
let e = i(z, E);
|
|
74
|
+
if (e) {
|
|
75
|
+
H(e);
|
|
72
76
|
return;
|
|
73
77
|
}
|
|
74
|
-
|
|
78
|
+
H(void 0);
|
|
75
79
|
try {
|
|
76
|
-
await
|
|
77
|
-
path: { unit_id:
|
|
80
|
+
let e = await k.mutateAsync({
|
|
81
|
+
path: { unit_id: L },
|
|
78
82
|
body: {
|
|
79
|
-
name:
|
|
80
|
-
description:
|
|
83
|
+
name: z.name.trim(),
|
|
84
|
+
description: z.description.trim() || void 0
|
|
81
85
|
}
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
});
|
|
87
|
+
a(E.measureUnitUpdated, e.name), R(void 0);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
H(t(e) ?? E.updateMeasureUnitError);
|
|
85
90
|
}
|
|
86
91
|
}, [
|
|
87
|
-
|
|
88
|
-
F,
|
|
92
|
+
S,
|
|
89
93
|
L,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
z,
|
|
95
|
+
k,
|
|
96
|
+
E
|
|
97
|
+
]), ee = p(async () => {
|
|
98
|
+
if (!S && U) try {
|
|
99
|
+
await A.mutateAsync({ path: { unit_id: U.id } }), a(E.measureUnitDeleted, U.name), W(void 0);
|
|
100
|
+
} catch (n) {
|
|
101
|
+
e.error(t(n) ?? E.deleteMeasureUnitError);
|
|
102
|
+
}
|
|
96
103
|
}, [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
S,
|
|
105
|
+
U,
|
|
106
|
+
A,
|
|
107
|
+
E
|
|
100
108
|
]);
|
|
101
|
-
return /* @__PURE__ */ g
|
|
102
|
-
open:
|
|
109
|
+
return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(o, {
|
|
110
|
+
open: b,
|
|
103
111
|
onOpenChange: (e) => {
|
|
104
|
-
e ||
|
|
112
|
+
e || x();
|
|
105
113
|
},
|
|
106
|
-
units:
|
|
107
|
-
isLoading:
|
|
108
|
-
searchValue:
|
|
109
|
-
onSearchChange:
|
|
110
|
-
createValues:
|
|
111
|
-
createError:
|
|
112
|
-
onCreateChange: (e) =>
|
|
114
|
+
units: J,
|
|
115
|
+
isLoading: D.isLoading,
|
|
116
|
+
searchValue: j,
|
|
117
|
+
onSearchChange: M,
|
|
118
|
+
createValues: N,
|
|
119
|
+
createError: F,
|
|
120
|
+
onCreateChange: (e) => P((t) => ({
|
|
113
121
|
...t,
|
|
114
122
|
...e
|
|
115
123
|
})),
|
|
116
|
-
onCreateSubmit:
|
|
117
|
-
isCreating:
|
|
118
|
-
editingUnitId:
|
|
119
|
-
editValues:
|
|
120
|
-
editError:
|
|
121
|
-
onEditStart:
|
|
122
|
-
onEditChange: (e) =>
|
|
124
|
+
onCreateSubmit: Z,
|
|
125
|
+
isCreating: O.isPending || S,
|
|
126
|
+
editingUnitId: L,
|
|
127
|
+
editValues: z,
|
|
128
|
+
editError: V,
|
|
129
|
+
onEditStart: Q,
|
|
130
|
+
onEditChange: (e) => B((t) => ({
|
|
123
131
|
...t,
|
|
124
132
|
...e
|
|
125
133
|
})),
|
|
126
|
-
onEditSubmit:
|
|
127
|
-
onEditCancel: () =>
|
|
128
|
-
isUpdating:
|
|
129
|
-
onDeleteClick:
|
|
130
|
-
onDone:
|
|
131
|
-
labels:
|
|
132
|
-
}), /* @__PURE__ */
|
|
133
|
-
open: !!
|
|
134
|
+
onEditSubmit: $,
|
|
135
|
+
onEditCancel: () => R(void 0),
|
|
136
|
+
isUpdating: k.isPending || S,
|
|
137
|
+
onDeleteClick: W,
|
|
138
|
+
onDone: x,
|
|
139
|
+
labels: C
|
|
140
|
+
}), /* @__PURE__ */ _(s, {
|
|
141
|
+
open: !!U,
|
|
134
142
|
onOpenChange: (e) => {
|
|
135
|
-
e ||
|
|
143
|
+
e || W(void 0);
|
|
136
144
|
},
|
|
137
|
-
unitName:
|
|
138
|
-
affectedProducts:
|
|
139
|
-
isLoadingProducts:
|
|
140
|
-
isDeleting:
|
|
141
|
-
onConfirm:
|
|
142
|
-
onCancel: () =>
|
|
143
|
-
labels:
|
|
145
|
+
unitName: U?.name ?? "",
|
|
146
|
+
affectedProducts: X,
|
|
147
|
+
isLoadingProducts: Y.isLoading,
|
|
148
|
+
isDeleting: A.isPending || S,
|
|
149
|
+
onConfirm: ee,
|
|
150
|
+
onCancel: () => W(void 0),
|
|
151
|
+
labels: w
|
|
144
152
|
})] });
|
|
145
153
|
}
|
|
146
154
|
//#endregion
|
|
147
|
-
export {
|
|
155
|
+
export { b as MeasureUnitsManagerContainer, b as default };
|
|
@@ -9,7 +9,16 @@ var e = {
|
|
|
9
9
|
unitNameRequired: "Unit label is required",
|
|
10
10
|
genericError: "Something went wrong. Please try again.",
|
|
11
11
|
createMeasureUnitError: "Failed to create measure unit.",
|
|
12
|
-
updateMeasureUnitError: "Failed to update measure unit."
|
|
12
|
+
updateMeasureUnitError: "Failed to update measure unit.",
|
|
13
|
+
productCreated: "{name} has been added to the list.",
|
|
14
|
+
productUpdated: "Product {name} was updated.",
|
|
15
|
+
serviceUpdated: "Service {name} was updated.",
|
|
16
|
+
productDeleted: "Product was deleted.",
|
|
17
|
+
deleteProductError: "Failed to delete product.",
|
|
18
|
+
measureUnitCreated: "Unit {name} was added to the list",
|
|
19
|
+
measureUnitUpdated: "Unit {name} was updated",
|
|
20
|
+
measureUnitDeleted: "Unit {name} was deleted from the list.",
|
|
21
|
+
deleteMeasureUnitError: "Failed to delete Unit."
|
|
13
22
|
};
|
|
14
23
|
//#endregion
|
|
15
24
|
export { e as PRODUCT_MESSAGE_LABELS_EN };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { toast as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { ToastNameMessage as t } from "../../../../ui/dist/lib/ToastNameMessage/ToastNameMessage.js";
|
|
3
|
+
import "../../../../ui/dist/index.js";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/toasts.js
|
|
6
|
+
var r = "{name}";
|
|
7
|
+
function i(i, a) {
|
|
8
|
+
e.success(/* @__PURE__ */ n(t, {
|
|
9
|
+
segments: i.split(r),
|
|
10
|
+
name: a
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { i as toastSuccessWithName };
|
|
@@ -4,54 +4,62 @@
|
|
|
4
4
|
"use client";
|
|
5
5
|
import { extractApiErrorMessage as e } from "../../../../util/dist/lib/apiErrors.js";
|
|
6
6
|
import { EMPTY_PRODUCT_FORM_VALUES as t, getCurrencyOptions as n, hasProductFormErrors as r, productFormValuesToRequest as i, productFormValuesToUpdateRequest as a, productToFormValues as o, validateProductForm as s } from "./helpers.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { toastSuccessWithName as c } from "./toasts.js";
|
|
8
|
+
import { useCreateProductMutation as l } from "../../../data-access/dist/index6.js";
|
|
9
|
+
import { useUpdateProductMutation as u } from "../../../data-access/dist/index7.js";
|
|
9
10
|
import "../../../data-access/dist/index.js";
|
|
10
|
-
import { useCallback as
|
|
11
|
+
import { useCallback as d, useMemo as f, useState as p } from "react";
|
|
11
12
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js
|
|
12
|
-
function
|
|
13
|
-
let
|
|
13
|
+
function m({ view: m, setView: h, selectedProductId: g, setSelectedProductId: _, product: v, messages: y }) {
|
|
14
|
+
let b = l(), x = u(), S = b.isPending || x.isPending, [C, w] = p(t), [T, E] = p({});
|
|
14
15
|
return {
|
|
15
|
-
values:
|
|
16
|
-
errors:
|
|
17
|
-
setValues:
|
|
18
|
-
currencyOptions:
|
|
19
|
-
isSubmitting:
|
|
20
|
-
openCreate:
|
|
21
|
-
|
|
22
|
-
}, [
|
|
23
|
-
openEdit:
|
|
24
|
-
|
|
25
|
-
}, [
|
|
26
|
-
close:
|
|
27
|
-
|
|
28
|
-
}, [
|
|
29
|
-
submit:
|
|
30
|
-
let t = s(
|
|
16
|
+
values: C,
|
|
17
|
+
errors: T,
|
|
18
|
+
setValues: w,
|
|
19
|
+
currencyOptions: f(() => n(C.currency), [C.currency]),
|
|
20
|
+
isSubmitting: S,
|
|
21
|
+
openCreate: d(() => {
|
|
22
|
+
_(void 0), w(t), E({}), h("create");
|
|
23
|
+
}, [_, h]),
|
|
24
|
+
openEdit: d(() => {
|
|
25
|
+
v && (w(o(v)), E({}), h("edit"));
|
|
26
|
+
}, [v, h]),
|
|
27
|
+
close: d(() => {
|
|
28
|
+
h("none"), _(void 0);
|
|
29
|
+
}, [_, h]),
|
|
30
|
+
submit: d(async () => {
|
|
31
|
+
let t = s(C, y);
|
|
31
32
|
if (r(t)) {
|
|
32
|
-
|
|
33
|
+
E(t);
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
+
E({});
|
|
36
37
|
try {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
if (m === "edit" && g) {
|
|
39
|
+
let e = await x.mutateAsync({
|
|
40
|
+
path: { product_id: g },
|
|
41
|
+
body: a(C)
|
|
42
|
+
});
|
|
43
|
+
c(e.type === "service" ? y.serviceUpdated : y.productUpdated, e.name);
|
|
44
|
+
} else {
|
|
45
|
+
let e = await b.mutateAsync({ body: i(C) });
|
|
46
|
+
c(y.productCreated, e.name);
|
|
47
|
+
}
|
|
48
|
+
h("none"), _(void 0);
|
|
41
49
|
} catch (t) {
|
|
42
|
-
|
|
50
|
+
E({ form: e(t) ?? y.genericError });
|
|
43
51
|
}
|
|
44
52
|
}, [
|
|
45
|
-
|
|
46
|
-
p,
|
|
47
|
-
h,
|
|
48
|
-
y,
|
|
49
|
-
b,
|
|
50
|
-
v,
|
|
53
|
+
C,
|
|
51
54
|
m,
|
|
52
|
-
g
|
|
55
|
+
g,
|
|
56
|
+
b,
|
|
57
|
+
x,
|
|
58
|
+
y,
|
|
59
|
+
h,
|
|
60
|
+
_
|
|
53
61
|
])
|
|
54
62
|
};
|
|
55
63
|
}
|
|
56
64
|
//#endregion
|
|
57
|
-
export {
|
|
65
|
+
export { m as useProductForm };
|
|
@@ -2,24 +2,25 @@ import "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
|
2
2
|
import { avatarSwatchFor as e } from "./lib/avatarSwatch.js";
|
|
3
3
|
import "./lib/ProductIntroModal/ProductIntroModal.js";
|
|
4
4
|
import { EmbeddedToaster as t } from "./lib/EmbeddedToaster.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { ToastNameMessage as n } from "./lib/ToastNameMessage/ToastNameMessage.js";
|
|
6
|
+
import { UIFramework as r, resolveUIFramework as i } from "./lib/UIContext/UIContext.js";
|
|
7
|
+
import { UIProvider as a } from "./lib/UIContext/UIProvider.js";
|
|
7
8
|
import "./lib/UIContext/useLinkComponent.js";
|
|
8
9
|
import "./lib/UIContext/useUIFramework.js";
|
|
9
|
-
import { registerDesignSystemEnsurer as
|
|
10
|
+
import { registerDesignSystemEnsurer as o, registerUIRenderers as s, useDesignSystemEnsurer as c, useFrameworkRenderer as l } from "./lib/UIContext/uiRendererRegistry.js";
|
|
10
11
|
import "./lib/UIContext/index.js";
|
|
11
|
-
import { HostIsolationScope as
|
|
12
|
-
import { Link as
|
|
13
|
-
import { WidgetContainer as
|
|
14
|
-
import { EmptyState as
|
|
15
|
-
import { ERROR_STATE_ID as
|
|
16
|
-
import { InlineErrorAlert as
|
|
17
|
-
import { PAGINATION_FOOTER_LABELS_EN as
|
|
18
|
-
import { PaginationFooter as
|
|
19
|
-
import { WidgetTitleWithIconAndChildren as
|
|
12
|
+
import { HostIsolationScope as u } from "./lib/HostIsolationScope/HostIsolationScope.js";
|
|
13
|
+
import { Link as d } from "./lib/Link/Link.js";
|
|
14
|
+
import { WidgetContainer as f } from "./lib/WidgetContainer/WidgetContainer.js";
|
|
15
|
+
import { EmptyState as p } from "./lib/EmptyState/EmptyState.js";
|
|
16
|
+
import { ERROR_STATE_ID as m, ErrorState as h } from "./lib/ErrorState/ErrorState.js";
|
|
17
|
+
import { InlineErrorAlert as g } from "./lib/InlineErrorAlert/InlineErrorAlert.js";
|
|
18
|
+
import { PAGINATION_FOOTER_LABELS_EN as _ } from "./lib/PaginationFooter/labels.js";
|
|
19
|
+
import { PaginationFooter as v } from "./lib/PaginationFooter/PaginationFooter.js";
|
|
20
|
+
import { WidgetTitleWithIconAndChildren as y } from "./lib/WidgetTitleWithIconAndChildren/WidgetTitleWithIconAndChildren.js";
|
|
20
21
|
import "./lib/OnboardingShell/labels.js";
|
|
21
22
|
import "./lib/OnboardingShell/OnboardingShellStepper.js";
|
|
22
|
-
import { OnboardingShellOverlayPortal as
|
|
23
|
-
import { OnboardingShell as
|
|
24
|
-
import { SectionHeading as
|
|
25
|
-
export {
|
|
23
|
+
import { OnboardingShellOverlayPortal as b } from "./lib/OnboardingShell/OnboardingShellOverlayPortal.js";
|
|
24
|
+
import { OnboardingShell as x } from "./lib/OnboardingShell/OnboardingShell.js";
|
|
25
|
+
import { SectionHeading as S } from "./lib/SectionHeading/SectionHeading.js";
|
|
26
|
+
export { m as ERROR_STATE_ID, t as EmbeddedToaster, p as EmptyState, h as ErrorState, u as HostIsolationScope, g as InlineErrorAlert, d as Link, x as OnboardingShell, b as OnboardingShellOverlayPortal, _ as PAGINATION_FOOTER_LABELS_EN, v as PaginationFooter, S as SectionHeading, n as ToastNameMessage, r as UIFramework, a as UIProvider, f as WidgetContainer, y as WidgetTitleWithIconAndChildren, e as avatarSwatchFor, o as registerDesignSystemEnsurer, s as registerUIRenderers, i as resolveUIFramework, c as useDesignSystemEnsurer, l as useFrameworkRenderer };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Fragment as e } from "react";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
//#region ../../libs/tesouro-embedded-components-react/shared/ui/dist/lib/ToastNameMessage/ToastNameMessage.js
|
|
4
|
+
function r({ segments: r, name: i }) {
|
|
5
|
+
return /* @__PURE__ */ t("span", {
|
|
6
|
+
className: "ttw:flex ttw:min-w-0",
|
|
7
|
+
children: r.map((a, o) => /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("span", {
|
|
8
|
+
className: "ttw:whitespace-pre-wrap",
|
|
9
|
+
children: a
|
|
10
|
+
}), o < r.length - 1 && /* @__PURE__ */ t("span", {
|
|
11
|
+
className: "ttw:min-w-[4ch] ttw:shrink-9999 ttw:truncate",
|
|
12
|
+
title: i,
|
|
13
|
+
children: i
|
|
14
|
+
})] }, o))
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { r as ToastNameMessage };
|