@tesouro/embedded-components-react 0.7.70 → 0.7.73
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 +15 -12
- package/dist/index.css +24 -6
- package/dist/index.d.ts +76 -8
- package/dist/lib/LinkedAccountsWidget.d.ts +9 -0
- package/dist/lib/ProductsWidget.d.ts +12 -6
- package/dist/lib/ReceivablesWidget.d.ts +1 -5
- package/dist/lib/TransfersWidget.d.ts +55 -2
- package/dist/lib/WidgetSuite.d.ts +63 -1
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/LinkedAccountsWidget.js +6 -4
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +199 -182
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/ProductsWidget.js +23 -24
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/constants.js +6 -2
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductsTable.js +112 -51
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/lib/ProductsWidget/useProductsWidget.js +80 -56
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index.js +6 -5
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index2.js +15 -6
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index4.js +170 -135
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index5.js +49 -150
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index6.js +152 -24
- package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index7.js +28 -0
- 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 +13 -12
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/ProductSelector.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/helpers.js +41 -27
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js +70 -52
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index.js +7 -6
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +19 -8
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index3.js +171 -218
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index4.js +52 -180
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index5.js +188 -46
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js +47 -124
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index7.js +128 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetFeature.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetInner.js +99 -108
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/testIds.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/transferViews.js +135 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/useTransferMoneyModalController.js +140 -153
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferAccountTile.js +15 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferDetailSheet.js +111 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransferStatusBadge.js +18 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransfersWidget.js +181 -126
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/labels.js +33 -0
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/TransfersSection.js +16 -8
- package/dist/packages/shared-ui-shadcn/dist/index.js +328 -327
- package/package.json +1 -1
package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js
CHANGED
|
@@ -1,128 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
|
-
import { CheckIcon as c, ChevronDownIcon as l, Loader2Icon as u } from "lucide-react";
|
|
1
|
+
import { AlertDialog as e, AlertDialogContent as t, AlertDialogDescription as n, AlertDialogFooter as r, AlertDialogHeader as i, AlertDialogTitle as a, Button as o, Spinner as s, Table as c, TableBody as l, TableCell as u, TableRow as d } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { MEASURE_UNIT_DELETE_DIALOG_LABELS_EN as f } from "./index2.js";
|
|
3
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
6
4
|
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js
|
|
7
|
-
function
|
|
8
|
-
let
|
|
9
|
-
...
|
|
10
|
-
...
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
g ? /* @__PURE__ */ o(u, { className: "ttw:pointer-events-none ttw:ml-3 ttw:size-4 ttw:shrink-0 ttw:animate-spin ttw:text-muted-foreground" }) : null,
|
|
51
|
-
/* @__PURE__ */ o("input", {
|
|
52
|
-
id: y,
|
|
53
|
-
role: "combobox",
|
|
54
|
-
"aria-label": C.fieldLabel,
|
|
55
|
-
"aria-autocomplete": "list",
|
|
56
|
-
"aria-expanded": T,
|
|
57
|
-
"aria-controls": w,
|
|
58
|
-
"aria-activedescendant": L,
|
|
59
|
-
"aria-invalid": v || void 0,
|
|
60
|
-
autoComplete: "off",
|
|
61
|
-
ref: F,
|
|
62
|
-
maxLength: x,
|
|
63
|
-
disabled: _,
|
|
64
|
-
placeholder: C.placeholder,
|
|
65
|
-
className: e("ttw:h-full ttw:min-w-0 ttw:flex-1 ttw:text-ellipsis ttw:bg-transparent ttw:pr-2 ttw:text-base ttw:outline-none ttw:placeholder:text-muted-foreground ttw:disabled:cursor-not-allowed ttw:md:text-sm", g ? "ttw:pl-2" : "ttw:pl-3"),
|
|
66
|
-
value: d,
|
|
67
|
-
title: d || void 0,
|
|
68
|
-
onFocus: () => E(!0),
|
|
69
|
-
onClick: () => E(!0),
|
|
70
|
-
onBlur: A,
|
|
71
|
-
onChange: (e) => {
|
|
72
|
-
f(e.target.value), E(!0), O(void 0);
|
|
73
|
-
},
|
|
74
|
-
onKeyDown: N
|
|
75
|
-
}),
|
|
76
|
-
/* @__PURE__ */ o("button", {
|
|
77
|
-
type: "button",
|
|
78
|
-
tabIndex: -1,
|
|
79
|
-
"aria-label": C.toggleListButton,
|
|
80
|
-
"aria-controls": w,
|
|
81
|
-
"aria-expanded": T,
|
|
82
|
-
disabled: _,
|
|
83
|
-
className: "ttw:mr-[0.3rem] ttw:flex ttw:size-6 ttw:shrink-0 ttw:cursor-pointer ttw:items-center ttw:justify-center ttw:rounded-[calc(var(--radius)-5px)] ttw:text-muted-foreground ttw:transition-all ttw:hover:bg-accent ttw:hover:text-accent-foreground ttw:disabled:pointer-events-none",
|
|
84
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
85
|
-
onClick: I,
|
|
86
|
-
children: /* @__PURE__ */ o(l, { className: "ttw:pointer-events-none ttw:size-4" })
|
|
87
|
-
})
|
|
88
|
-
]
|
|
89
|
-
}), T && !_ ? /* @__PURE__ */ o("div", {
|
|
90
|
-
role: "presentation",
|
|
91
|
-
className: e("ttw:absolute ttw:left-0 ttw:top-full ttw:z-50 ttw:mt-1.5 ttw:w-full ttw:min-w-138 ttw:overflow-hidden ttw:rounded-md ttw:bg-popover ttw:text-popover-foreground ttw:shadow-md ttw:ring-1 ttw:ring-foreground/10", !p.length && "ttw:pointer-events-none"),
|
|
92
|
-
onMouseDown: p.length ? (e) => e.preventDefault() : void 0,
|
|
93
|
-
children: /* @__PURE__ */ s("ul", {
|
|
94
|
-
id: w,
|
|
95
|
-
role: "listbox",
|
|
96
|
-
"aria-label": C.fieldLabel,
|
|
97
|
-
className: "ttw:max-h-87 ttw:scroll-py-1 ttw:overflow-y-auto ttw:p-1",
|
|
98
|
-
children: [p.map((t, n) => /* @__PURE__ */ s("li", {
|
|
99
|
-
id: M(n),
|
|
100
|
-
role: "option",
|
|
101
|
-
"aria-selected": t.value === m,
|
|
102
|
-
className: e("ttw:relative ttw:flex ttw:w-full ttw:cursor-default ttw:items-center ttw:gap-2 ttw:rounded-sm ttw:py-1.5 ttw:pr-8 ttw:pl-2 ttw:text-sm ttw:select-none", n === k && "ttw:bg-accent ttw:text-accent-foreground"),
|
|
103
|
-
onMouseEnter: () => O(t.value),
|
|
104
|
-
onMouseDown: () => j(t.value),
|
|
105
|
-
children: [
|
|
106
|
-
/* @__PURE__ */ o("span", {
|
|
107
|
-
className: "ttw:min-w-0 ttw:flex-1 ttw:truncate",
|
|
108
|
-
children: t.label
|
|
109
|
-
}),
|
|
110
|
-
t.meta ? /* @__PURE__ */ o("span", {
|
|
111
|
-
className: "ttw:shrink-0 ttw:text-right ttw:text-xs ttw:text-muted-foreground",
|
|
112
|
-
children: t.meta
|
|
113
|
-
}) : null,
|
|
114
|
-
t.value === m ? /* @__PURE__ */ o("span", {
|
|
115
|
-
className: "ttw:pointer-events-none ttw:absolute ttw:right-2 ttw:flex ttw:size-4 ttw:items-center ttw:justify-center",
|
|
116
|
-
children: /* @__PURE__ */ o(c, { className: "ttw:size-4" })
|
|
117
|
-
}) : null
|
|
118
|
-
]
|
|
119
|
-
}, t.value)), p.length ? null : /* @__PURE__ */ o("li", {
|
|
120
|
-
className: "ttw:py-2 ttw:text-center ttw:text-sm ttw:text-muted-foreground",
|
|
121
|
-
children: C.emptyText
|
|
122
|
-
})]
|
|
123
|
-
})
|
|
124
|
-
}) : null]
|
|
5
|
+
function h({ open: h, onOpenChange: g, unitName: _, affectedProducts: v, isLoadingProducts: y, isDeleting: b, onConfirm: x, onCancel: S, labels: C }) {
|
|
6
|
+
let w = {
|
|
7
|
+
...f,
|
|
8
|
+
...C
|
|
9
|
+
}, T = v.length > 0;
|
|
10
|
+
return /* @__PURE__ */ p(e, {
|
|
11
|
+
open: h,
|
|
12
|
+
onOpenChange: g,
|
|
13
|
+
children: /* @__PURE__ */ m(t, { children: [
|
|
14
|
+
/* @__PURE__ */ m(i, { children: [/* @__PURE__ */ p(a, { children: (T ? w.titleWithItems : w.titleNoItems).replace("{name}", _) }), /* @__PURE__ */ p(n, { children: T ? w.messageWithItems : w.messageNoItems })] }),
|
|
15
|
+
/* @__PURE__ */ p("p", {
|
|
16
|
+
className: "ttw:text-sm ttw:text-muted-foreground",
|
|
17
|
+
children: T ? w.messageWithItemsHint : w.messageNoItemsHint
|
|
18
|
+
}),
|
|
19
|
+
y ? /* @__PURE__ */ p("div", {
|
|
20
|
+
className: "ttw:flex ttw:justify-center ttw:py-4",
|
|
21
|
+
children: /* @__PURE__ */ p(s, {})
|
|
22
|
+
}) : T ? /* @__PURE__ */ p("div", {
|
|
23
|
+
className: "ttw:max-h-60 ttw:overflow-auto ttw:rounded-md ttw:border",
|
|
24
|
+
children: /* @__PURE__ */ p(c, { children: /* @__PURE__ */ p(l, { children: v.map((e) => /* @__PURE__ */ m(d, {
|
|
25
|
+
className: "ttw:border-border ttw:hover:bg-transparent",
|
|
26
|
+
children: [/* @__PURE__ */ p(u, {
|
|
27
|
+
className: "ttw:pl-0 ttw:whitespace-normal ttw:text-text ttw:font-medium",
|
|
28
|
+
children: e.name
|
|
29
|
+
}), /* @__PURE__ */ p(u, {
|
|
30
|
+
className: "ttw:pr-0 ttw:text-right ttw:text-text ttw:font-medium",
|
|
31
|
+
children: e.priceLabel
|
|
32
|
+
})]
|
|
33
|
+
}, e.id)) }) })
|
|
34
|
+
}) : null,
|
|
35
|
+
/* @__PURE__ */ m(r, { children: [/* @__PURE__ */ p(o, {
|
|
36
|
+
variant: "ghost",
|
|
37
|
+
onClick: S,
|
|
38
|
+
disabled: b,
|
|
39
|
+
children: w.cancelButton
|
|
40
|
+
}), /* @__PURE__ */ p(o, {
|
|
41
|
+
variant: "destructive",
|
|
42
|
+
onClick: x,
|
|
43
|
+
disabled: b || y,
|
|
44
|
+
loading: b,
|
|
45
|
+
children: w.confirmButton
|
|
46
|
+
})] })
|
|
47
|
+
] })
|
|
125
48
|
});
|
|
126
49
|
}
|
|
127
50
|
//#endregion
|
|
128
|
-
export {
|
|
51
|
+
export { h as MeasureUnitDeleteDialog, h as default };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { cn as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { PRODUCT_SELECTOR_LABELS_EN as t } from "./index2.js";
|
|
3
|
+
import { useCallback as n, useId as r, useRef as i, useState as a } from "react";
|
|
4
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
|
+
import { CheckIcon as c, ChevronDownIcon as l, Loader2Icon as u } from "lucide-react";
|
|
6
|
+
//#region ../../libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index7.js
|
|
7
|
+
function d({ inputValue: d, onInputValueChange: f, options: p, value: m, onOptionSelect: h, isLoading: g, disabled: _, invalid: v, inputId: y, focusOnMount: b, maxLength: x, labels: S }) {
|
|
8
|
+
let C = {
|
|
9
|
+
...t,
|
|
10
|
+
...S
|
|
11
|
+
}, w = r(), [T, E] = a(!1), [D, O] = a(), k = p.findIndex((e) => e.value === D), A = () => {
|
|
12
|
+
E(!1), O(void 0);
|
|
13
|
+
}, j = (e) => {
|
|
14
|
+
h(e), A();
|
|
15
|
+
}, M = (e) => `${w}-option-${e}`, N = (e) => {
|
|
16
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
17
|
+
if (e.preventDefault(), E(!0), !p.length) return;
|
|
18
|
+
let t = e.key === "ArrowDown" ? Math.min(k + 1, p.length - 1) : Math.max(k - 1, 0);
|
|
19
|
+
O(p[t].value), document.getElementById(M(t))?.scrollIntoView?.({ block: "nearest" });
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (e.key === "Enter") {
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
let t = p[k];
|
|
25
|
+
T && t ? j(t.value) : A();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (e.key === "Tab" && T) {
|
|
29
|
+
let e = d.trim().toLowerCase();
|
|
30
|
+
if (!e) return;
|
|
31
|
+
let t = p.find((t) => t.label.toLowerCase() === e) ?? (p.length === 1 ? p[0] : void 0);
|
|
32
|
+
t ? j(t.value) : A();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
e.key === "Escape" && T && (e.stopPropagation(), A());
|
|
36
|
+
}, P = i(null), F = n((e) => {
|
|
37
|
+
P.current = e, e && b && e.focus();
|
|
38
|
+
}, [b]), I = () => {
|
|
39
|
+
if (T) {
|
|
40
|
+
A();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
P.current?.focus(), E(!0);
|
|
44
|
+
}, L = T && k >= 0 ? M(k) : void 0;
|
|
45
|
+
return /* @__PURE__ */ s("div", {
|
|
46
|
+
className: "ttw:relative ttw:w-full",
|
|
47
|
+
children: [/* @__PURE__ */ s("div", {
|
|
48
|
+
className: e("ttw:flex ttw:h-9 ttw:w-full ttw:min-w-0 ttw:items-center ttw:rounded-md ttw:border ttw:border-input ttw:shadow-xs ttw:transition-[color,box-shadow] ttw:has-[input:focus-visible]:border-ring ttw:has-[input:focus-visible]:ring-[3px] ttw:has-[input:focus-visible]:ring-ring/50 ttw:has-[[aria-invalid=true]]:border-destructive", _ && "ttw:opacity-50"),
|
|
49
|
+
children: [
|
|
50
|
+
g ? /* @__PURE__ */ o(u, { className: "ttw:pointer-events-none ttw:ml-3 ttw:size-4 ttw:shrink-0 ttw:animate-spin ttw:text-muted-foreground" }) : null,
|
|
51
|
+
/* @__PURE__ */ o("input", {
|
|
52
|
+
id: y,
|
|
53
|
+
role: "combobox",
|
|
54
|
+
"aria-label": C.fieldLabel,
|
|
55
|
+
"aria-autocomplete": "list",
|
|
56
|
+
"aria-expanded": T,
|
|
57
|
+
"aria-controls": w,
|
|
58
|
+
"aria-activedescendant": L,
|
|
59
|
+
"aria-invalid": v || void 0,
|
|
60
|
+
autoComplete: "off",
|
|
61
|
+
ref: F,
|
|
62
|
+
maxLength: x,
|
|
63
|
+
disabled: _,
|
|
64
|
+
placeholder: C.placeholder,
|
|
65
|
+
className: e("ttw:h-full ttw:min-w-0 ttw:flex-1 ttw:text-ellipsis ttw:bg-transparent ttw:pr-2 ttw:text-base ttw:outline-none ttw:placeholder:text-muted-foreground ttw:disabled:cursor-not-allowed ttw:md:text-sm", g ? "ttw:pl-2" : "ttw:pl-3"),
|
|
66
|
+
value: d,
|
|
67
|
+
title: d || void 0,
|
|
68
|
+
onFocus: () => E(!0),
|
|
69
|
+
onClick: () => E(!0),
|
|
70
|
+
onBlur: A,
|
|
71
|
+
onChange: (e) => {
|
|
72
|
+
f(e.target.value), E(!0), O(void 0);
|
|
73
|
+
},
|
|
74
|
+
onKeyDown: N
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ o("button", {
|
|
77
|
+
type: "button",
|
|
78
|
+
tabIndex: -1,
|
|
79
|
+
"aria-label": C.toggleListButton,
|
|
80
|
+
"aria-controls": w,
|
|
81
|
+
"aria-expanded": T,
|
|
82
|
+
disabled: _,
|
|
83
|
+
className: "ttw:mr-[0.3rem] ttw:flex ttw:size-6 ttw:shrink-0 ttw:cursor-pointer ttw:items-center ttw:justify-center ttw:rounded-[calc(var(--radius)-5px)] ttw:text-muted-foreground ttw:transition-all ttw:hover:bg-accent ttw:hover:text-accent-foreground ttw:disabled:pointer-events-none",
|
|
84
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
85
|
+
onClick: I,
|
|
86
|
+
children: /* @__PURE__ */ o(l, { className: "ttw:pointer-events-none ttw:size-4" })
|
|
87
|
+
})
|
|
88
|
+
]
|
|
89
|
+
}), T && !_ ? /* @__PURE__ */ o("div", {
|
|
90
|
+
role: "presentation",
|
|
91
|
+
className: e("ttw:absolute ttw:left-0 ttw:top-full ttw:z-50 ttw:mt-1.5 ttw:w-full ttw:min-w-138 ttw:overflow-hidden ttw:rounded-md ttw:bg-popover ttw:text-popover-foreground ttw:shadow-md ttw:ring-1 ttw:ring-foreground/10", !p.length && "ttw:pointer-events-none"),
|
|
92
|
+
onMouseDown: p.length ? (e) => e.preventDefault() : void 0,
|
|
93
|
+
children: /* @__PURE__ */ s("ul", {
|
|
94
|
+
id: w,
|
|
95
|
+
role: "listbox",
|
|
96
|
+
"aria-label": C.fieldLabel,
|
|
97
|
+
className: "ttw:max-h-87 ttw:scroll-py-1 ttw:overflow-y-auto ttw:p-1",
|
|
98
|
+
children: [p.map((t, n) => /* @__PURE__ */ s("li", {
|
|
99
|
+
id: M(n),
|
|
100
|
+
role: "option",
|
|
101
|
+
"aria-selected": t.value === m,
|
|
102
|
+
className: e("ttw:relative ttw:flex ttw:w-full ttw:cursor-default ttw:items-center ttw:gap-2 ttw:rounded-sm ttw:py-1.5 ttw:pr-8 ttw:pl-2 ttw:text-sm ttw:select-none", n === k && "ttw:bg-accent ttw:text-accent-foreground"),
|
|
103
|
+
onMouseEnter: () => O(t.value),
|
|
104
|
+
onMouseDown: () => j(t.value),
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ o("span", {
|
|
107
|
+
className: "ttw:min-w-0 ttw:flex-1 ttw:truncate",
|
|
108
|
+
children: t.label
|
|
109
|
+
}),
|
|
110
|
+
t.meta ? /* @__PURE__ */ o("span", {
|
|
111
|
+
className: "ttw:shrink-0 ttw:text-right ttw:text-xs ttw:text-muted-foreground",
|
|
112
|
+
children: t.meta
|
|
113
|
+
}) : null,
|
|
114
|
+
t.value === m ? /* @__PURE__ */ o("span", {
|
|
115
|
+
className: "ttw:pointer-events-none ttw:absolute ttw:right-2 ttw:flex ttw:size-4 ttw:items-center ttw:justify-center",
|
|
116
|
+
children: /* @__PURE__ */ o(c, { className: "ttw:size-4" })
|
|
117
|
+
}) : null
|
|
118
|
+
]
|
|
119
|
+
}, t.value)), p.length ? null : /* @__PURE__ */ o("li", {
|
|
120
|
+
className: "ttw:py-2 ttw:text-center ttw:text-sm ttw:text-muted-foreground",
|
|
121
|
+
children: C.emptyText
|
|
122
|
+
})]
|
|
123
|
+
})
|
|
124
|
+
}) : null]
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
export { d as ProductSelector, d as default };
|
|
@@ -11,16 +11,17 @@ import { WIDGET_NAME as n } from "../analytics/events.js";
|
|
|
11
11
|
import { TransfersWidgetInner as r } from "./TransfersWidgetInner.js";
|
|
12
12
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
13
13
|
//#region ../../libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetFeature.js
|
|
14
|
-
function o({ labels: o, featureLabels: s, isTransferMoneyOpen: c, defaultIsTransferMoneyOpen: l, onTransferMoneyOpenChange: u,
|
|
14
|
+
function o({ labels: o, featureLabels: s, isTransferMoneyOpen: c, defaultIsTransferMoneyOpen: l, onTransferMoneyOpenChange: u, onLinkAccountClick: d, ...f }) {
|
|
15
15
|
return /* @__PURE__ */ a(t, {
|
|
16
|
-
...
|
|
16
|
+
...f,
|
|
17
17
|
widgetName: n,
|
|
18
18
|
children: [/* @__PURE__ */ i(e, {}), /* @__PURE__ */ i(r, {
|
|
19
19
|
labels: o,
|
|
20
20
|
featureLabels: s,
|
|
21
21
|
isTransferMoneyOpen: c,
|
|
22
22
|
defaultIsTransferMoneyOpen: l,
|
|
23
|
-
onTransferMoneyOpenChange: u
|
|
23
|
+
onTransferMoneyOpenChange: u,
|
|
24
|
+
onLinkAccountClick: d
|
|
24
25
|
})]
|
|
25
26
|
});
|
|
26
27
|
}
|
|
@@ -3,149 +3,140 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
5
|
import { TESOURO_NEW_EMBEDDED_BANK_ACCOUNT_CREATED_SUCCESS_EVENT as e, TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT as t } from "../../../../../shared/util/dist/lib/widgetDomEvents.js";
|
|
6
|
-
import { isOrganizationOnItsWay as
|
|
7
|
-
import { useEmbedApi as
|
|
8
|
-
import { Scope as
|
|
6
|
+
import { isOrganizationOnItsWay as ee } from "../../../../../shared/data-access/dist/lib/organizationStatus.js";
|
|
7
|
+
import { useEmbedApi as n } from "../../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
8
|
+
import { Scope as r } from "../../../../../shared/data-access/dist/lib/scopes.js";
|
|
9
9
|
import "../../../../../shared/data-access/dist/index.js";
|
|
10
|
-
import { useAnalyticsTrack as
|
|
11
|
-
import { useWidgetConfig as
|
|
10
|
+
import { useAnalyticsTrack as te } from "../../../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
11
|
+
import { useWidgetConfig as ne } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
12
12
|
import "../../../../../shared/feature/dist/index.js";
|
|
13
|
-
import { DEFAULT_FEATURE_LABELS as
|
|
14
|
-
import { TRANSFERS_ANALYTICS_EVENTS as
|
|
15
|
-
import { isPaginatedAccountsQueryInFlight as
|
|
16
|
-
import { useTransferBankAccountsQuery as
|
|
17
|
-
import { useTransferExternalAccountsQuery as
|
|
18
|
-
import { useOrganizationTransfersQuery as
|
|
13
|
+
import { DEFAULT_FEATURE_LABELS as i } from "./featureLabels.js";
|
|
14
|
+
import { TRANSFERS_ANALYTICS_EVENTS as re } from "../analytics/events.js";
|
|
15
|
+
import { isPaginatedAccountsQueryInFlight as a } from "../../../../data-access/dist/index2.js";
|
|
16
|
+
import { useTransferBankAccountsQuery as ie } from "../../../../data-access/dist/index4.js";
|
|
17
|
+
import { useTransferExternalAccountsQuery as ae } from "../../../../data-access/dist/index5.js";
|
|
18
|
+
import { useOrganizationTransfersQuery as oe } from "../../../../data-access/dist/index6.js";
|
|
19
19
|
import "../../../../data-access/dist/index.js";
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
20
|
+
import { useTransferMoneyModalController as se } from "./useTransferMoneyModalController.js";
|
|
21
|
+
import { buildAccountDirectory as ce, mapTransferToDetailView as o, mapTransferToRowView as s } from "./transferViews.js";
|
|
22
|
+
import { transfersWidgetTestIds as c } from "./testIds.js";
|
|
23
|
+
import { TRANSFERS_PAGE_SIZE_OPTIONS as le, useTransfersPageState as ue } from "./useTransfersPageState.js";
|
|
24
|
+
import { TRANSFERS_WIDGET_LABELS_EN as de } from "../../../../ui/dist/lib/TransfersWidget/labels.js";
|
|
25
|
+
import { TransfersWidget as fe } from "../../../../ui/dist/lib/TransfersWidget/TransfersWidget.js";
|
|
25
26
|
import "../../../../ui/dist/index.js";
|
|
26
|
-
import { useCallback as
|
|
27
|
-
import { jsx as
|
|
27
|
+
import { useCallback as pe, useEffect as l, useMemo as u, useState as d } from "react";
|
|
28
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
28
29
|
//#region ../../libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetInner.js
|
|
29
|
-
var
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
function y({ labels: e, featureLabels: t, isTransferMoneyOpen: y, defaultIsTransferMoneyOpen: le, onTransferMoneyOpenChange: ue }) {
|
|
34
|
-
let b = {
|
|
35
|
-
...o,
|
|
30
|
+
var p = [r.TransferWriteOrg, r.BankAccountReadOrg], m = [t, e];
|
|
31
|
+
function h({ labels: e, featureLabels: t, isTransferMoneyOpen: h, defaultIsTransferMoneyOpen: me, onTransferMoneyOpenChange: he, onLinkAccountClick: g }) {
|
|
32
|
+
let _ = {
|
|
33
|
+
...i,
|
|
36
34
|
...t
|
|
37
|
-
},
|
|
38
|
-
...
|
|
35
|
+
}, v = {
|
|
36
|
+
...de,
|
|
39
37
|
...e,
|
|
40
38
|
...t?.routeSeparator === void 0 ? {} : { listAccountsSeparator: t.routeSeparator }
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}, [
|
|
45
|
-
let
|
|
46
|
-
organizationId:
|
|
47
|
-
userId:
|
|
48
|
-
}), { data:
|
|
49
|
-
limit:
|
|
50
|
-
pagination_token:
|
|
51
|
-
}),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
e.set(t.id, `${r} ···${n}`);
|
|
60
|
-
}
|
|
61
|
-
return e;
|
|
62
|
-
}, [
|
|
63
|
-
V,
|
|
64
|
-
x.accountFallbackName,
|
|
65
|
-
H
|
|
66
|
-
]), W = k?.data, G = p(() => (W ?? []).map((e) => ne(e, U, x, b)), [
|
|
67
|
-
U,
|
|
68
|
-
b,
|
|
69
|
-
x,
|
|
70
|
-
W
|
|
71
|
-
]), K = k?.nextPaginationToken ?? void 0, q = k?.prevPaginationToken ?? void 0, [J, ge] = m(O);
|
|
72
|
-
!M && (J.pageIndex !== O.pageIndex || J.pageSize !== O.pageSize) && ge(O);
|
|
73
|
-
let Y = J.pageIndex * J.pageSize, _e = {
|
|
74
|
-
pageSize: O.pageSize,
|
|
75
|
-
pageSizeOptions: ie,
|
|
76
|
-
rangeLabel: `${b.viewingRangeLabel} ${G.length === 0 ? "0-0" : `${Y + 1}-${Y + G.length}`}`,
|
|
39
|
+
}, y = te(), { initResponse: b } = ne(), { organizationId: ge, organizationStatus: _e } = n(), ve = ee(_e);
|
|
40
|
+
l(() => {
|
|
41
|
+
y(re.Mounted);
|
|
42
|
+
}, [y]);
|
|
43
|
+
let x = b?.scopes ?? [], S = x.includes(r.ExternalBankAccountReadOrg), ye = x.includes(r.PaymentRailAch), C = S && ye, w = p.every((e) => x.includes(e)), T = ue({
|
|
44
|
+
organizationId: ge,
|
|
45
|
+
userId: b?.userId
|
|
46
|
+
}), { data: E, isLoading: D, isError: O, isPlaceholderData: k, refetch: A } = oe({
|
|
47
|
+
limit: T.pageSize,
|
|
48
|
+
pagination_token: T.paginationToken
|
|
49
|
+
}), j = ie(), { data: M, isError: N, refetch: P } = j, F = ae({ enabled: S }), { data: I, isError: be, refetch: L } = F, R = M?.data ?? [], z = u(() => C ? (I?.data ?? []).filter((e) => e.verificationStatus === "VERIFIED" && e.accountStatus === "ACTIVE") : [], [C, I?.data]), xe = I?.data, B = ce(R, xe ?? [], v), V = E?.data, H = (V ?? []).map((e) => s(e, B, v, _)), [Se, U] = d(), W = `${T.pageSize}:${T.paginationToken ?? ""}`, [Ce, we] = d(W);
|
|
50
|
+
W !== Ce && (we(W), U(void 0));
|
|
51
|
+
let G = V?.find((e) => e.id === Se), Te = G ? o(G, B, v, _) : void 0, K = E?.nextPaginationToken ?? void 0, q = E?.prevPaginationToken ?? void 0, [J, Ee] = d(T);
|
|
52
|
+
!k && (J.pageIndex !== T.pageIndex || J.pageSize !== T.pageSize) && Ee(T);
|
|
53
|
+
let Y = J.pageIndex * J.pageSize, De = {
|
|
54
|
+
pageSize: T.pageSize,
|
|
55
|
+
pageSizeOptions: le,
|
|
56
|
+
rangeLabel: `${_.viewingRangeLabel} ${H.length === 0 ? "0-0" : `${Y + 1}-${Y + H.length}`}`,
|
|
77
57
|
isPreviousDisabled: !q,
|
|
78
58
|
isNextDisabled: !K,
|
|
79
|
-
isDisabled:
|
|
80
|
-
onPageSizeChange:
|
|
59
|
+
isDisabled: k,
|
|
60
|
+
onPageSizeChange: T.changePageSize,
|
|
81
61
|
onPreviousPageClick: () => {
|
|
82
|
-
q &&
|
|
62
|
+
q && T.goToPreviousPage(q);
|
|
83
63
|
},
|
|
84
64
|
onNextPageClick: () => {
|
|
85
|
-
K &&
|
|
65
|
+
K && T.goToNextPage(K);
|
|
86
66
|
}
|
|
87
|
-
}, X =
|
|
88
|
-
|
|
67
|
+
}, X = pe(() => {
|
|
68
|
+
A(), P(), S && L();
|
|
89
69
|
}, [
|
|
90
|
-
|
|
70
|
+
S,
|
|
71
|
+
P,
|
|
91
72
|
L,
|
|
92
|
-
|
|
93
|
-
N
|
|
73
|
+
A
|
|
94
74
|
]);
|
|
95
|
-
|
|
75
|
+
l(() => {
|
|
96
76
|
let e = () => {
|
|
97
77
|
X();
|
|
98
78
|
};
|
|
99
|
-
for (let t of
|
|
79
|
+
for (let t of m) window.addEventListener(t, e);
|
|
100
80
|
return () => {
|
|
101
|
-
for (let t of
|
|
81
|
+
for (let t of m) window.removeEventListener(t, e);
|
|
102
82
|
};
|
|
103
83
|
}, [X]);
|
|
104
|
-
let { modalProps:
|
|
105
|
-
labels:
|
|
106
|
-
featureLabels:
|
|
107
|
-
embeddedBankAccounts:
|
|
108
|
-
verifiedExternalBankAccounts:
|
|
109
|
-
track:
|
|
110
|
-
isTransferMoneyOpen:
|
|
111
|
-
defaultIsTransferMoneyOpen:
|
|
112
|
-
onTransferMoneyOpenChange:
|
|
113
|
-
}),
|
|
114
|
-
return /* @__PURE__ */
|
|
115
|
-
transferRows:
|
|
116
|
-
pagination:
|
|
117
|
-
|
|
84
|
+
let { modalProps: Z, openModal: Oe } = se({
|
|
85
|
+
labels: v,
|
|
86
|
+
featureLabels: _,
|
|
87
|
+
embeddedBankAccounts: R,
|
|
88
|
+
verifiedExternalBankAccounts: z,
|
|
89
|
+
track: y,
|
|
90
|
+
isTransferMoneyOpen: h,
|
|
91
|
+
defaultIsTransferMoneyOpen: me,
|
|
92
|
+
onTransferMoneyOpenChange: he
|
|
93
|
+
}), ke = a(j), Ae = S && a(F), je = ve && !M || D || ke || Ae, Q = O || N || S && be, Me = R.length + z.length, $ = !(R.length > 0) || Me <= 1;
|
|
94
|
+
return /* @__PURE__ */ f(fe, {
|
|
95
|
+
transferRows: H,
|
|
96
|
+
pagination: De,
|
|
97
|
+
selectedRowKey: G?.id,
|
|
98
|
+
onRowClick: U,
|
|
99
|
+
transferDetail: Te,
|
|
100
|
+
onTransferDetailClose: () => U(void 0),
|
|
101
|
+
onLinkAccountClick: g ? () => {
|
|
102
|
+
U(void 0), g();
|
|
103
|
+
} : void 0,
|
|
104
|
+
isLoading: je,
|
|
118
105
|
isError: Q,
|
|
119
106
|
onRetry: Q ? () => void X() : void 0,
|
|
120
|
-
showTransferMoneyCta:
|
|
107
|
+
showTransferMoneyCta: w,
|
|
121
108
|
isTransferMoneyCtaDisabled: $,
|
|
122
|
-
onTransferMoneyClick:
|
|
109
|
+
onTransferMoneyClick: w && !$ ? () => Oe() : void 0,
|
|
123
110
|
transferMoneyModal: {
|
|
124
|
-
...
|
|
111
|
+
...Z,
|
|
125
112
|
testIds: {
|
|
126
|
-
root:
|
|
127
|
-
closeButton:
|
|
128
|
-
fromAccountTrigger:
|
|
129
|
-
toAccountTrigger:
|
|
130
|
-
accountsConfirm:
|
|
131
|
-
amountInput:
|
|
113
|
+
root: c.modal,
|
|
114
|
+
closeButton: c.modalCloseButton,
|
|
115
|
+
fromAccountTrigger: c.modalFromAccountTrigger,
|
|
116
|
+
toAccountTrigger: c.modalToAccountTrigger,
|
|
117
|
+
accountsConfirm: c.modalAccountsConfirmButton,
|
|
118
|
+
amountInput: c.modalAmountInput,
|
|
132
119
|
reviewStep: {
|
|
133
|
-
confirm:
|
|
134
|
-
goBack:
|
|
120
|
+
confirm: c.modalConfirmTransferButton,
|
|
121
|
+
goBack: c.modalGoBackButton
|
|
135
122
|
},
|
|
136
|
-
resultStep: { backToTransfers:
|
|
123
|
+
resultStep: { backToTransfers: c.modalBackToTransfersButton }
|
|
137
124
|
}
|
|
138
125
|
},
|
|
139
126
|
labels: e,
|
|
140
127
|
testIds: {
|
|
141
|
-
transferMoneyButton:
|
|
142
|
-
skeleton:
|
|
143
|
-
error:
|
|
144
|
-
retry:
|
|
145
|
-
empty:
|
|
146
|
-
transferRow:
|
|
128
|
+
transferMoneyButton: c.transferMoneyButton,
|
|
129
|
+
skeleton: c.skeleton,
|
|
130
|
+
error: c.error,
|
|
131
|
+
retry: c.retry,
|
|
132
|
+
empty: c.empty,
|
|
133
|
+
transferRow: c.transferRow,
|
|
134
|
+
transferDetail: {
|
|
135
|
+
root: c.transferDetail,
|
|
136
|
+
returnedBanner: c.transferDetailReturnedBanner
|
|
137
|
+
}
|
|
147
138
|
}
|
|
148
139
|
});
|
|
149
140
|
}
|
|
150
141
|
//#endregion
|
|
151
|
-
export {
|
|
142
|
+
export { h as TransfersWidgetInner };
|
|
@@ -5,6 +5,8 @@ var e = {
|
|
|
5
5
|
retry: "transfers-widget-retry",
|
|
6
6
|
empty: "transfers-widget-empty",
|
|
7
7
|
transferRow: "embedded-banking-transfer-row",
|
|
8
|
+
transferDetail: "transfers-widget-transfer-detail",
|
|
9
|
+
transferDetailReturnedBanner: "transfers-widget-transfer-detail-returned-banner",
|
|
8
10
|
transferMoneyButton: "embedded-banking-transfer-money-button",
|
|
9
11
|
modal: "embedded-banking-transfer-money-modal",
|
|
10
12
|
modalCloseButton: "embedded-banking-transfer-money-modal-close-button",
|