@tesouro/embedded-components-react 0.6.5 → 0.7.1
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 +0 -1
- package/dist/index.css +3 -0
- package/dist/index.d.ts +13 -12
- package/dist/lib/ExpenseManagementWidget.d.ts +1 -0
- package/dist/lib/SettingsWidget.d.ts +2 -12
- package/dist/lib/WidgetSuite.d.ts +2 -11
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useTrackReceiptMatching.js +126 -73
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/ExpenseManagementWidget.js +185 -182
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/TransactionDetails/TransactionDetailsFeature.js +187 -180
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/AccordionItemCard/AccordionItemCard.js +86 -84
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetails/TransactionDetails.js +110 -100
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetails/labels.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/SettingsWidget/SettingsWidget.js +28 -23
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -536,7 +536,6 @@ A single navigable settings surface combining profile, team, invoice, bill-pay,
|
|
|
536
536
|
| `helpContactUrl` | `string` | `undefined` | Link (URL or `mailto:`) for the Help section's "Contact Us" line; hidden when unset. |
|
|
537
537
|
| `helpFaq` | `HelpFaqSection[]` | `HELP_FAQ_EN` | FAQ shown in the Help section. Extend the exported `HELP_FAQ_EN` to add your own questions. |
|
|
538
538
|
| `helpContent` | `ReactNode` | Help widget | Replaces the help section content. |
|
|
539
|
-
| `finopsThemeColors` | `FinopsThemeColors` | `undefined` | Legacy theme overrides; currently has no effect. |
|
|
540
539
|
|
|
541
540
|
### TransfersWidget
|
|
542
541
|
|
package/dist/index.css
CHANGED
|
@@ -4910,6 +4910,9 @@
|
|
|
4910
4910
|
.ttw\:hover\:bg-purple-50:hover {
|
|
4911
4911
|
background-color: var(--ttw-color-purple-50);
|
|
4912
4912
|
}
|
|
4913
|
+
.ttw\:hover\:bg-purple-100:hover {
|
|
4914
|
+
background-color: var(--ttw-color-purple-100);
|
|
4915
|
+
}
|
|
4913
4916
|
.ttw\:hover\:bg-red-50:hover {
|
|
4914
4917
|
background-color: var(--ttw-color-red-50);
|
|
4915
4918
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3256,6 +3256,7 @@ interface TransactionDetailsLabels {
|
|
|
3256
3256
|
acceptedFileTypes: string;
|
|
3257
3257
|
uploadingReceipt: string;
|
|
3258
3258
|
uploadingReceiptBody: string;
|
|
3259
|
+
readingReceipt: string;
|
|
3259
3260
|
loadFailed: string;
|
|
3260
3261
|
}
|
|
3261
3262
|
|
|
@@ -3562,16 +3563,6 @@ interface HelpFaqSection {
|
|
|
3562
3563
|
*/
|
|
3563
3564
|
declare const HELP_FAQ_EN: HelpFaqSection[];
|
|
3564
3565
|
|
|
3565
|
-
interface FinopsThemeColors {
|
|
3566
|
-
primary?: string;
|
|
3567
|
-
primaryForeground?: string;
|
|
3568
|
-
}
|
|
3569
|
-
interface MoniteWrapperProps {
|
|
3570
|
-
finopsThemeColors?: FinopsThemeColors;
|
|
3571
|
-
}
|
|
3572
|
-
|
|
3573
|
-
type MoniteRegionProviderProps = WidgetProviderProps & MoniteWrapperProps;
|
|
3574
|
-
|
|
3575
3566
|
interface FeatureLabels$1 {
|
|
3576
3567
|
profileSection: string;
|
|
3577
3568
|
teamSection: string;
|
|
@@ -3626,7 +3617,7 @@ interface SettingsWidgetAdditionalSection extends SettingsWidgetSection {
|
|
|
3626
3617
|
after?: SettingsSection;
|
|
3627
3618
|
}
|
|
3628
3619
|
|
|
3629
|
-
interface SettingsWidgetProps extends
|
|
3620
|
+
interface SettingsWidgetProps extends WidgetProviderProps {
|
|
3630
3621
|
labels?: Partial<Labels>;
|
|
3631
3622
|
featureLabels?: Partial<FeatureLabels$1>;
|
|
3632
3623
|
/** Forwarded to the embedded Team section's {@link TeamWidget} — the
|
|
@@ -3678,7 +3669,7 @@ interface SettingsWidgetProps extends MoniteRegionProviderProps {
|
|
|
3678
3669
|
invoiceContent?: ReactNode;
|
|
3679
3670
|
legalContent?: ReactNode;
|
|
3680
3671
|
}
|
|
3681
|
-
declare function SettingsWidget({
|
|
3672
|
+
declare function SettingsWidget({ labels, featureLabels, acceptInviteRedirectUri, helpContactUrl, helpFaq, profileContactUrl, selectedSection, defaultSelectedSection, onSelectedSectionChange, additionalSections, profileContent, teamContent, billPayContent, helpContent, expenseContent, accountingContent, invoiceContent, legalContent, ...widgetProviderProps }: SettingsWidgetProps): React.JSX.Element;
|
|
3682
3673
|
|
|
3683
3674
|
interface TransfersWidgetLabels {
|
|
3684
3675
|
widgetTitle: string;
|
|
@@ -4449,6 +4440,16 @@ declare module '@mui/material/transitions' {
|
|
|
4449
4440
|
}
|
|
4450
4441
|
}
|
|
4451
4442
|
|
|
4443
|
+
interface FinopsThemeColors {
|
|
4444
|
+
primary?: string;
|
|
4445
|
+
primaryForeground?: string;
|
|
4446
|
+
}
|
|
4447
|
+
interface MoniteWrapperProps {
|
|
4448
|
+
finopsThemeColors?: FinopsThemeColors;
|
|
4449
|
+
}
|
|
4450
|
+
|
|
4451
|
+
type MoniteRegionProviderProps = WidgetProviderProps & MoniteWrapperProps;
|
|
4452
|
+
|
|
4452
4453
|
type BillPayWidgetMoniteProps = MoniteRegionProviderProps & Omit<PayablesProps, 'pageTitleComponent'> & {
|
|
4453
4454
|
pageTitleComponent?: PayablesProps['pageTitleComponent'];
|
|
4454
4455
|
};
|
|
@@ -678,16 +678,6 @@ interface WidgetProviderProps extends WidgetProviderBaseProps {
|
|
|
678
678
|
providerLabels?: Partial<WidgetProviderLabels>;
|
|
679
679
|
}
|
|
680
680
|
|
|
681
|
-
interface FinopsThemeColors {
|
|
682
|
-
primary?: string;
|
|
683
|
-
primaryForeground?: string;
|
|
684
|
-
}
|
|
685
|
-
interface MoniteWrapperProps {
|
|
686
|
-
finopsThemeColors?: FinopsThemeColors;
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
type MoniteRegionProviderProps = WidgetProviderProps & MoniteWrapperProps;
|
|
690
|
-
|
|
691
681
|
interface FeatureLabels {
|
|
692
682
|
profileSection: string;
|
|
693
683
|
teamSection: string;
|
|
@@ -742,7 +732,7 @@ interface SettingsWidgetAdditionalSection extends SettingsWidgetSection {
|
|
|
742
732
|
after?: SettingsSection;
|
|
743
733
|
}
|
|
744
734
|
|
|
745
|
-
interface SettingsWidgetProps extends
|
|
735
|
+
interface SettingsWidgetProps extends WidgetProviderProps {
|
|
746
736
|
labels?: Partial<Labels>;
|
|
747
737
|
featureLabels?: Partial<FeatureLabels>;
|
|
748
738
|
/** Forwarded to the embedded Team section's {@link TeamWidget} — the
|
|
@@ -794,7 +784,7 @@ interface SettingsWidgetProps extends MoniteRegionProviderProps {
|
|
|
794
784
|
invoiceContent?: ReactNode;
|
|
795
785
|
legalContent?: ReactNode;
|
|
796
786
|
}
|
|
797
|
-
declare function SettingsWidget({
|
|
787
|
+
declare function SettingsWidget({ labels, featureLabels, acceptInviteRedirectUri, helpContactUrl, helpFaq, profileContactUrl, selectedSection, defaultSelectedSection, onSelectedSectionChange, additionalSections, profileContent, teamContent, billPayContent, helpContent, expenseContent, accountingContent, invoiceContent, legalContent, ...widgetProviderProps }: SettingsWidgetProps): React.JSX.Element;
|
|
798
788
|
|
|
799
789
|
export { HELP_FAQ_EN, SettingsSection, SettingsWidget };
|
|
800
790
|
export type { HelpFaqAnswer, HelpFaqBullet, HelpFaqBulletType, HelpFaqItem, HelpFaqSection, SettingsWidgetAdditionalSection, FeatureLabels as SettingsWidgetFeatureLabels, Labels as SettingsWidgetLabels, SettingsWidgetProps, SettingsWidgetSection, SettingsWidgetSectionId };
|
|
@@ -2325,6 +2325,7 @@ interface TransactionDetailsLabels {
|
|
|
2325
2325
|
acceptedFileTypes: string;
|
|
2326
2326
|
uploadingReceipt: string;
|
|
2327
2327
|
uploadingReceiptBody: string;
|
|
2328
|
+
readingReceipt: string;
|
|
2328
2329
|
loadFailed: string;
|
|
2329
2330
|
}
|
|
2330
2331
|
|
|
@@ -2601,16 +2602,6 @@ interface HelpFaqSection {
|
|
|
2601
2602
|
items: HelpFaqItem[];
|
|
2602
2603
|
}
|
|
2603
2604
|
|
|
2604
|
-
interface FinopsThemeColors {
|
|
2605
|
-
primary?: string;
|
|
2606
|
-
primaryForeground?: string;
|
|
2607
|
-
}
|
|
2608
|
-
interface MoniteWrapperProps {
|
|
2609
|
-
finopsThemeColors?: FinopsThemeColors;
|
|
2610
|
-
}
|
|
2611
|
-
|
|
2612
|
-
type MoniteRegionProviderProps = WidgetProviderProps & MoniteWrapperProps;
|
|
2613
|
-
|
|
2614
2605
|
interface FeatureLabels$1 {
|
|
2615
2606
|
profileSection: string;
|
|
2616
2607
|
teamSection: string;
|
|
@@ -2665,7 +2656,7 @@ interface SettingsWidgetAdditionalSection extends SettingsWidgetSection {
|
|
|
2665
2656
|
after?: SettingsSection;
|
|
2666
2657
|
}
|
|
2667
2658
|
|
|
2668
|
-
interface SettingsWidgetProps extends
|
|
2659
|
+
interface SettingsWidgetProps extends WidgetProviderProps {
|
|
2669
2660
|
labels?: Partial<Labels>;
|
|
2670
2661
|
featureLabels?: Partial<FeatureLabels$1>;
|
|
2671
2662
|
/** Forwarded to the embedded Team section's {@link TeamWidget} — the
|
|
@@ -7,14 +7,14 @@ import { invalidateAllClients as t } from "../../../../shared/data-access/dist/l
|
|
|
7
7
|
import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
8
8
|
import { organizationHeaders as r } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
9
9
|
import "../../../../shared/data-access/dist/index.js";
|
|
10
|
-
import { analyticsReceiptsInvalidationKey as i, analyticsTransactionsInvalidationKey as a, receiptsIdInvalidationKey as o, receiptsInvalidationKey as s,
|
|
11
|
-
import { useCallback as
|
|
10
|
+
import { analyticsReceiptsInvalidationKey as i, analyticsTransactionsInvalidationKey as a, receiptsIdInvalidationKey as o, receiptsInvalidationKey as s, transactionsIdExpenseHistoryInvalidationKey as c, transactionsIdInvalidationKey as l, transactionsInvalidationKey as u } from "./queryKeys.js";
|
|
11
|
+
import { useCallback as d, useEffect as f, useRef as p } from "react";
|
|
12
12
|
//#region ../../libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useTrackReceiptMatching.js
|
|
13
|
-
var
|
|
14
|
-
function
|
|
13
|
+
var m = 3e3, h = 30, g = 10;
|
|
14
|
+
function _(e) {
|
|
15
15
|
return e.transaction_id ? "matched" : e.ocr_status === "processing" ? null : e.ocr_status === "error" ? "unreadable" : "unmatched";
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function v(e, t) {
|
|
18
18
|
return new Promise((n, r) => {
|
|
19
19
|
if (t.aborted) {
|
|
20
20
|
r(new DOMException("Aborted", "AbortError"));
|
|
@@ -28,83 +28,136 @@ function _(e, t) {
|
|
|
28
28
|
t.addEventListener("abort", i, { once: !0 });
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
let { client:
|
|
33
|
-
|
|
31
|
+
function y({ intervalMs: y = m, maxAttempts: b = h } = {}) {
|
|
32
|
+
let { client: x, organizationId: S } = n(), C = p(null);
|
|
33
|
+
f(() => {
|
|
34
34
|
let e = new AbortController();
|
|
35
|
-
return
|
|
35
|
+
return C.current = e, () => e.abort();
|
|
36
36
|
}, []);
|
|
37
|
-
let
|
|
37
|
+
let w = d(() => Promise.all([
|
|
38
38
|
t(s({
|
|
39
|
-
client:
|
|
40
|
-
organizationId:
|
|
39
|
+
client: x,
|
|
40
|
+
organizationId: S
|
|
41
41
|
})),
|
|
42
|
-
t(
|
|
43
|
-
client:
|
|
44
|
-
organizationId:
|
|
42
|
+
t(u({
|
|
43
|
+
client: x,
|
|
44
|
+
organizationId: S
|
|
45
45
|
})),
|
|
46
46
|
t(i({
|
|
47
|
-
client:
|
|
48
|
-
organizationId:
|
|
47
|
+
client: x,
|
|
48
|
+
organizationId: S
|
|
49
49
|
})),
|
|
50
50
|
t(a({
|
|
51
|
-
client:
|
|
52
|
-
organizationId:
|
|
51
|
+
client: x,
|
|
52
|
+
organizationId: S
|
|
53
53
|
}))
|
|
54
|
-
]), [
|
|
55
|
-
return {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
54
|
+
]), [x, S]);
|
|
55
|
+
return {
|
|
56
|
+
trackBatch: d(async (n) => {
|
|
57
|
+
let i = {
|
|
58
|
+
total: n.length,
|
|
59
|
+
matched: 0,
|
|
60
|
+
unmatched: 0,
|
|
61
|
+
unreadable: 0,
|
|
62
|
+
stillProcessing: 0
|
|
63
|
+
};
|
|
64
|
+
if (n.length === 0) return i;
|
|
65
|
+
let a = new Set(n), s = C.current?.signal ?? new AbortController().signal;
|
|
66
|
+
await w();
|
|
67
|
+
for (let n = 0; n < b && a.size > 0; n++) {
|
|
68
|
+
if (s.aborted) throw new DOMException("Aborted", "AbortError");
|
|
69
|
+
let { data: c } = await e({
|
|
70
|
+
client: x,
|
|
71
|
+
headers: r(S),
|
|
72
|
+
query: {
|
|
73
|
+
id__in: [...a],
|
|
74
|
+
limit: g
|
|
75
|
+
},
|
|
76
|
+
signal: s,
|
|
77
|
+
throwOnError: !0
|
|
78
|
+
}), u = [], d = [];
|
|
79
|
+
for (let e of c?.data ?? []) {
|
|
80
|
+
if (!a.has(e.id)) continue;
|
|
81
|
+
let t = _(e);
|
|
82
|
+
t && (a.delete(e.id), i[t] += 1, u.push(e.id), t === "matched" && e.transaction_id && d.push(e.transaction_id));
|
|
83
|
+
}
|
|
84
|
+
u.length > 0 && await Promise.all([
|
|
85
|
+
w(),
|
|
86
|
+
...u.map((e) => t(o({
|
|
87
|
+
client: x,
|
|
88
|
+
organizationId: S,
|
|
89
|
+
receiptId: e
|
|
90
|
+
}))),
|
|
91
|
+
...d.map((e) => t(l({
|
|
92
|
+
client: x,
|
|
93
|
+
organizationId: S,
|
|
94
|
+
transactionId: e
|
|
95
|
+
})))
|
|
96
|
+
]), a.size > 0 && n < b - 1 && await v(y, s);
|
|
82
97
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
98
|
+
return {
|
|
99
|
+
...i,
|
|
100
|
+
stillProcessing: a.size
|
|
101
|
+
};
|
|
102
|
+
}, [
|
|
103
|
+
x,
|
|
104
|
+
y,
|
|
105
|
+
b,
|
|
106
|
+
S,
|
|
107
|
+
w
|
|
108
|
+
]),
|
|
109
|
+
trackAttachedReceipt: d(async ({ receiptId: n, transactionId: i }) => {
|
|
110
|
+
let a = C.current?.signal ?? new AbortController().signal;
|
|
111
|
+
for (let s = 0; s < b; s++) {
|
|
112
|
+
if (a.aborted) throw new DOMException("Aborted", "AbortError");
|
|
113
|
+
let u, d = !1;
|
|
114
|
+
try {
|
|
115
|
+
let { data: t } = await e({
|
|
116
|
+
client: x,
|
|
117
|
+
headers: r(S),
|
|
118
|
+
query: {
|
|
119
|
+
id__in: [n],
|
|
120
|
+
limit: 1
|
|
121
|
+
},
|
|
122
|
+
signal: a,
|
|
123
|
+
throwOnError: !0
|
|
124
|
+
});
|
|
125
|
+
u = t?.data?.find((e) => e.id === n);
|
|
126
|
+
} catch (e) {
|
|
127
|
+
if (a.aborted) throw e;
|
|
128
|
+
d = !0;
|
|
129
|
+
}
|
|
130
|
+
if (!d && u?.ocr_status !== "processing") {
|
|
131
|
+
await Promise.all([
|
|
132
|
+
w(),
|
|
133
|
+
t(o({
|
|
134
|
+
client: x,
|
|
135
|
+
organizationId: S,
|
|
136
|
+
receiptId: n
|
|
137
|
+
})),
|
|
138
|
+
t(l({
|
|
139
|
+
client: x,
|
|
140
|
+
organizationId: S,
|
|
141
|
+
transactionId: i
|
|
142
|
+
})),
|
|
143
|
+
t(c({
|
|
144
|
+
client: x,
|
|
145
|
+
organizationId: S,
|
|
146
|
+
transactionId: i
|
|
147
|
+
}))
|
|
148
|
+
]);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
s < b - 1 && await v(y, a);
|
|
152
|
+
}
|
|
153
|
+
}, [
|
|
154
|
+
x,
|
|
155
|
+
y,
|
|
156
|
+
b,
|
|
157
|
+
S,
|
|
158
|
+
w
|
|
159
|
+
])
|
|
160
|
+
};
|
|
108
161
|
}
|
|
109
162
|
//#endregion
|
|
110
|
-
export {
|
|
163
|
+
export { _ as classifyReceipt, y as useTrackReceiptMatching };
|