@tesouro/embedded-components-react 0.5.98 → 0.5.99
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/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index5.js +32 -36
- package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index6.js +61 -0
- package/dist/libs/tesouro-embedded-components-react/remote-check-capture/feature/dist/lib/RemoteCheckCaptureWidget/permissions.js +2 -3
- package/dist/libs/tesouro-embedded-components-react/remote-check-capture/feature/dist/lib/RemoteCheckCaptureWidget/useRemoteCheckCaptureWidget.js +148 -149
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +27 -27
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +178 -167
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +159 -151
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useCreateCheckDepositMutation as e } from "./index3.js";
|
|
2
2
|
import { useCustomersQuery as t } from "./index4.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { useAllDepositableBankAccountsQuery as n } from "./index5.js";
|
|
4
|
+
import { useInvoicesQuery as r } from "./index6.js";
|
|
5
|
+
export { n as useAllDepositableBankAccountsQuery, e as useCreateCheckDepositMutation, t as useCustomersQuery, r as useInvoicesQuery };
|
package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index5.js
CHANGED
|
@@ -4,43 +4,33 @@
|
|
|
4
4
|
"use client";
|
|
5
5
|
import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
6
6
|
import { organizationHeaders as t } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { getDepositableBankAccounts as n } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
8
|
+
import { getDepositableBankAccountsOptions as r } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
9
|
+
import { getAllPagesNextPageParam as i, useAutoFetchNextPage as a } from "../../../shared/data-access/dist/lib/allPages.js";
|
|
10
10
|
import "../../../shared/data-access/dist/index.js";
|
|
11
|
-
import {
|
|
11
|
+
import { useMemo as o } from "react";
|
|
12
|
+
import { useInfiniteQuery as s } from "@tanstack/react-query";
|
|
12
13
|
//#region ../../libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index5.js
|
|
13
|
-
var c = 100
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
client: f,
|
|
27
|
-
headers: g,
|
|
28
|
-
query: v
|
|
29
|
-
}).queryKey, "all"], b = s({
|
|
30
|
-
queryKey: [...y, { authEpoch: h }],
|
|
31
|
-
enabled: _,
|
|
32
|
-
placeholderData: (e, t) => {
|
|
33
|
-
if (!t) return;
|
|
34
|
-
let n = t.queryKey.slice(0, -1);
|
|
35
|
-
return o(n) === o(y) ? e : void 0;
|
|
36
|
-
},
|
|
14
|
+
var c = 100;
|
|
15
|
+
function l({ enabled: l } = {}) {
|
|
16
|
+
let { client: u, organizationId: d, widgetToken: f, authEpoch: p } = e(), m = t(d), h = !!(d && f) && (l === !0 || l === void 0), g = r({
|
|
17
|
+
client: u,
|
|
18
|
+
headers: m,
|
|
19
|
+
query: { limit: c }
|
|
20
|
+
}), _ = s({
|
|
21
|
+
queryKey: [
|
|
22
|
+
...g.queryKey,
|
|
23
|
+
"all",
|
|
24
|
+
{ authEpoch: p }
|
|
25
|
+
],
|
|
26
|
+
enabled: h,
|
|
37
27
|
initialPageParam: void 0,
|
|
38
28
|
queryFn: async ({ signal: e, pageParam: t }) => {
|
|
39
29
|
let { data: r } = await n({
|
|
40
|
-
client:
|
|
41
|
-
headers:
|
|
30
|
+
client: u,
|
|
31
|
+
headers: m,
|
|
42
32
|
query: {
|
|
43
|
-
|
|
33
|
+
limit: c,
|
|
44
34
|
...t ? { pagination_token: t } : {}
|
|
45
35
|
},
|
|
46
36
|
signal: e,
|
|
@@ -50,12 +40,18 @@ function u({ counterpartId: u, enabled: d } = {}) {
|
|
|
50
40
|
},
|
|
51
41
|
getNextPageParam: i
|
|
52
42
|
});
|
|
53
|
-
a(
|
|
54
|
-
let
|
|
43
|
+
a(_, h);
|
|
44
|
+
let v = o(() => {
|
|
45
|
+
if (_.data) return {
|
|
46
|
+
data: _.data.pages.flatMap((e) => e.data ?? []),
|
|
47
|
+
nextPaginationToken: null,
|
|
48
|
+
prevPaginationToken: null
|
|
49
|
+
};
|
|
50
|
+
}, [_.data]);
|
|
55
51
|
return {
|
|
56
|
-
...
|
|
57
|
-
|
|
52
|
+
..._,
|
|
53
|
+
data: v
|
|
58
54
|
};
|
|
59
55
|
}
|
|
60
56
|
//#endregion
|
|
61
|
-
export {
|
|
57
|
+
export { l as useAllDepositableBankAccountsQuery };
|
package/dist/libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index6.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
6
|
+
import { organizationHeaders as t } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
7
|
+
import { getReceivables as n } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
8
|
+
import { getReceivablesOptions as r } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
9
|
+
import { getAllPagesNextPaginationTokenParam as i, useAutoFetchNextPage as a } from "../../../shared/data-access/dist/lib/allPages.js";
|
|
10
|
+
import "../../../shared/data-access/dist/index.js";
|
|
11
|
+
import { hashKey as o, useInfiniteQuery as s } from "@tanstack/react-query";
|
|
12
|
+
//#region ../../libs/tesouro-embedded-components-react/remote-check-capture/data-access/dist/index6.js
|
|
13
|
+
var c = 100, l = [
|
|
14
|
+
"issued",
|
|
15
|
+
"partially_paid",
|
|
16
|
+
"overdue"
|
|
17
|
+
];
|
|
18
|
+
function u({ counterpartId: u, enabled: d } = {}) {
|
|
19
|
+
let { client: f, organizationId: p, widgetToken: m, authEpoch: h } = e(), g = t(p), _ = !!(p && m && u) && (d === !0 || d === void 0), v = {
|
|
20
|
+
type: "invoice",
|
|
21
|
+
bank_account_type: "INTERNAL",
|
|
22
|
+
limit: c,
|
|
23
|
+
counterpart_id__in: u ? [u] : void 0,
|
|
24
|
+
status__in: [...l]
|
|
25
|
+
}, y = [...r({
|
|
26
|
+
client: f,
|
|
27
|
+
headers: g,
|
|
28
|
+
query: v
|
|
29
|
+
}).queryKey, "all"], b = s({
|
|
30
|
+
queryKey: [...y, { authEpoch: h }],
|
|
31
|
+
enabled: _,
|
|
32
|
+
placeholderData: (e, t) => {
|
|
33
|
+
if (!t) return;
|
|
34
|
+
let n = t.queryKey.slice(0, -1);
|
|
35
|
+
return o(n) === o(y) ? e : void 0;
|
|
36
|
+
},
|
|
37
|
+
initialPageParam: void 0,
|
|
38
|
+
queryFn: async ({ signal: e, pageParam: t }) => {
|
|
39
|
+
let { data: r } = await n({
|
|
40
|
+
client: f,
|
|
41
|
+
headers: g,
|
|
42
|
+
query: {
|
|
43
|
+
...v,
|
|
44
|
+
...t ? { pagination_token: t } : {}
|
|
45
|
+
},
|
|
46
|
+
signal: e,
|
|
47
|
+
throwOnError: !0
|
|
48
|
+
});
|
|
49
|
+
return r;
|
|
50
|
+
},
|
|
51
|
+
getNextPageParam: i
|
|
52
|
+
});
|
|
53
|
+
a(b, _);
|
|
54
|
+
let x = b.data?.pages.flatMap((e) => e.data.filter((e) => e.type === "invoice")) ?? [];
|
|
55
|
+
return {
|
|
56
|
+
...b,
|
|
57
|
+
invoices: x
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { u as useInvoicesQuery };
|
|
@@ -2,10 +2,9 @@ import { Scope as e } from "../../../../../shared/data-access/dist/lib/scopes.js
|
|
|
2
2
|
import "../../../../../shared/data-access/dist/index.js";
|
|
3
3
|
//#region ../../libs/tesouro-embedded-components-react/remote-check-capture/feature/dist/lib/RemoteCheckCaptureWidget/permissions.js
|
|
4
4
|
var t = [
|
|
5
|
-
e.
|
|
5
|
+
e.PaymentCollectOrg,
|
|
6
6
|
e.CounterpartReadOrg,
|
|
7
|
-
e.InvoiceReadOrg
|
|
8
|
-
e.CheckDepositWriteOrg
|
|
7
|
+
e.InvoiceReadOrg
|
|
9
8
|
];
|
|
10
9
|
function n(e) {
|
|
11
10
|
let n = new Set(e ?? []);
|
|
@@ -3,38 +3,37 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
5
|
import { toast as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
-
import { useAllBankAccountsQuery as t } from "../../../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
|
|
7
|
-
import "../../../../../shared/data-access/dist/index.js";
|
|
8
6
|
import "../../../../../shared/ui/dist/index.js";
|
|
9
|
-
import { useAnalyticsTrack as
|
|
10
|
-
import { amountOutputToMajorUnits as
|
|
11
|
-
import { formatCalendarDate as
|
|
12
|
-
import { formatMoneyExact as
|
|
13
|
-
import { parseDecimalAmountToMinorUnits as
|
|
14
|
-
import { useWidgetConfig as
|
|
7
|
+
import { useAnalyticsTrack as t } from "../../../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
8
|
+
import { amountOutputToMajorUnits as n, minorExponentForCurrency as r } from "../../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
|
|
9
|
+
import { formatCalendarDate as i } from "../../../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
10
|
+
import { formatMoneyExact as a } from "../../../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
11
|
+
import { parseDecimalAmountToMinorUnits as o } from "../../../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
|
|
12
|
+
import { useWidgetConfig as s } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
15
13
|
import "../../../../../shared/feature/dist/index.js";
|
|
16
|
-
import { RemoteCheckCaptureWidgetAnalyticsEvent as
|
|
17
|
-
import { remoteCheckCaptureWidgetTestIds as
|
|
14
|
+
import { RemoteCheckCaptureWidgetAnalyticsEvent as c } from "../analytics/events.js";
|
|
15
|
+
import { remoteCheckCaptureWidgetTestIds as l } from "./testIds.js";
|
|
18
16
|
import { canCollectRemoteCheckDeposit as ee } from "./permissions.js";
|
|
19
17
|
import { DEFAULT_CHECK_AMOUNT_AND_DETAIL_SCREEN_LABELS as te } from "../../../../ui/dist/index3.js";
|
|
20
|
-
import { CheckCaptureSide as
|
|
21
|
-
import { DEFAULT_REVIEW_DEPOSIT_SCREEN_LABELS as
|
|
22
|
-
import { DEFAULT_DEPOSIT_COMPLETE_SCREEN_LABELS as
|
|
18
|
+
import { CheckCaptureSide as u } from "../../../../ui/dist/index6.js";
|
|
19
|
+
import { DEFAULT_REVIEW_DEPOSIT_SCREEN_LABELS as d } from "../../../../ui/dist/index7.js";
|
|
20
|
+
import { DEFAULT_DEPOSIT_COMPLETE_SCREEN_LABELS as ne } from "../../../../ui/dist/index9.js";
|
|
23
21
|
import "../../../../ui/dist/index.js";
|
|
24
22
|
import { useCreateCheckDepositMutation as re } from "../../../../data-access/dist/index3.js";
|
|
25
23
|
import { useCustomersQuery as ie } from "../../../../data-access/dist/index4.js";
|
|
26
|
-
import {
|
|
24
|
+
import { useAllDepositableBankAccountsQuery as ae } from "../../../../data-access/dist/index5.js";
|
|
25
|
+
import { useInvoicesQuery as oe } from "../../../../data-access/dist/index6.js";
|
|
27
26
|
import "../../../../data-access/dist/index.js";
|
|
28
|
-
import { useEffect as
|
|
27
|
+
import { useEffect as f, useState as p } from "react";
|
|
29
28
|
//#region ../../libs/tesouro-embedded-components-react/remote-check-capture/feature/dist/lib/RemoteCheckCaptureWidget/useRemoteCheckCaptureWidget.js
|
|
30
|
-
var
|
|
29
|
+
var m = {
|
|
31
30
|
Details: "details",
|
|
32
31
|
Capture: "capture",
|
|
33
32
|
Review: "review",
|
|
34
33
|
Complete: "complete"
|
|
35
|
-
},
|
|
36
|
-
function
|
|
37
|
-
let n = new Date(t), r =
|
|
34
|
+
}, h = 2;
|
|
35
|
+
function se(e, t = /* @__PURE__ */ new Date()) {
|
|
36
|
+
let n = new Date(t), r = h;
|
|
38
37
|
for (; r > 0;) {
|
|
39
38
|
n.setDate(n.getDate() + 1);
|
|
40
39
|
let e = n.getDay();
|
|
@@ -46,15 +45,15 @@ function oe(e, t = /* @__PURE__ */ new Date()) {
|
|
|
46
45
|
day: "numeric"
|
|
47
46
|
}).format(n)} ${e}`;
|
|
48
47
|
}
|
|
49
|
-
function
|
|
50
|
-
return `${e.nickname?.trim() || t} ••${e.
|
|
48
|
+
function g(e, t) {
|
|
49
|
+
return `${e.nickname?.trim() || t} ••${e.lastFour}`;
|
|
51
50
|
}
|
|
52
|
-
function
|
|
51
|
+
function _(e, t) {
|
|
53
52
|
return e?.account_number ? `${e.bank_name?.trim() || t} ••${e.account_number.slice(-4)}` : null;
|
|
54
53
|
}
|
|
55
|
-
function
|
|
54
|
+
function ce(e, t, n) {
|
|
56
55
|
if (e.bank_account_id) {
|
|
57
|
-
let r = t.find((t) => t.id === e.bank_account_id), i = r &&
|
|
56
|
+
let r = t.find((t) => t.id === e.bank_account_id), i = r && g(r, n) || _(e.bank_account_snapshot, n) || n;
|
|
58
57
|
return {
|
|
59
58
|
id: e.bank_account_id,
|
|
60
59
|
label: i
|
|
@@ -62,204 +61,204 @@ function se(e, t, n) {
|
|
|
62
61
|
}
|
|
63
62
|
let r = e.bank_account_snapshot?.account_number?.slice(-4);
|
|
64
63
|
if (!r) return null;
|
|
65
|
-
let i = t.filter((e) => e.
|
|
64
|
+
let i = t.filter((e) => e.lastFour === r), [a] = i;
|
|
66
65
|
return i.length === 1 && a ? {
|
|
67
66
|
id: a.id,
|
|
68
|
-
label:
|
|
67
|
+
label: g(a, n)
|
|
69
68
|
} : null;
|
|
70
69
|
}
|
|
71
|
-
function
|
|
70
|
+
function le(e) {
|
|
72
71
|
return "organization" in e ? e.organization.legal_name : `${e.individual.first_name} ${e.individual.last_name}`.trim();
|
|
73
72
|
}
|
|
74
|
-
function
|
|
75
|
-
let
|
|
73
|
+
function ue(e, t) {
|
|
74
|
+
let o = r(e.currency), s = a(n({
|
|
76
75
|
value: e.amount_due ?? e.total_amount ?? 0,
|
|
77
76
|
currencyCode: e.currency
|
|
78
77
|
}), {
|
|
79
78
|
currencyCode: e.currency,
|
|
80
|
-
minimumFractionDigits:
|
|
81
|
-
maximumFractionDigits:
|
|
82
|
-
}), c = e.due_date ? ` · ${t} ${
|
|
79
|
+
minimumFractionDigits: o,
|
|
80
|
+
maximumFractionDigits: o
|
|
81
|
+
}), c = e.due_date ? ` · ${t} ${i(e.due_date)}` : "";
|
|
83
82
|
return `${e.document_id ?? e.id}${c} · ${s}`;
|
|
84
83
|
}
|
|
85
|
-
function
|
|
84
|
+
function v(e, t) {
|
|
86
85
|
if (t === null) return null;
|
|
87
86
|
let n = e.findIndex((e) => e.id === t);
|
|
88
87
|
return n === -1 ? null : n;
|
|
89
88
|
}
|
|
90
|
-
function
|
|
91
|
-
let n = e.indexOf("."),
|
|
92
|
-
if (n === -1 || n !==
|
|
93
|
-
let a =
|
|
89
|
+
function de(e, t) {
|
|
90
|
+
let n = e.indexOf("."), i = e.lastIndexOf(".");
|
|
91
|
+
if (n === -1 || n !== i) return e;
|
|
92
|
+
let a = r(t);
|
|
94
93
|
return a === 0 ? e.slice(0, n) : e.slice(0, n + 1 + a);
|
|
95
94
|
}
|
|
96
|
-
function
|
|
97
|
-
let
|
|
98
|
-
if (
|
|
99
|
-
let
|
|
100
|
-
return
|
|
101
|
-
value:
|
|
95
|
+
function fe(e, t) {
|
|
96
|
+
let i = o(e, t);
|
|
97
|
+
if (i === null) return `${t} ${e}`;
|
|
98
|
+
let s = r(t);
|
|
99
|
+
return a(n({
|
|
100
|
+
value: i,
|
|
102
101
|
currencyCode: t
|
|
103
102
|
}), {
|
|
104
103
|
currencyCode: t,
|
|
105
|
-
minimumFractionDigits:
|
|
106
|
-
maximumFractionDigits:
|
|
104
|
+
minimumFractionDigits: s,
|
|
105
|
+
maximumFractionDigits: s
|
|
107
106
|
});
|
|
108
107
|
}
|
|
109
|
-
function
|
|
108
|
+
function pe(e) {
|
|
110
109
|
return new Intl.NumberFormat("en-US", {
|
|
111
110
|
style: "currency",
|
|
112
111
|
currency: e,
|
|
113
112
|
currencyDisplay: "narrowSymbol"
|
|
114
113
|
}).formatToParts(0).find((e) => e.type === "currency")?.value ?? e;
|
|
115
114
|
}
|
|
116
|
-
function
|
|
117
|
-
let
|
|
115
|
+
function me({ labels: n, onDepositComplete: r } = {}) {
|
|
116
|
+
let i = n?.details, a = {
|
|
118
117
|
...te,
|
|
119
|
-
...
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}, [
|
|
124
|
-
let [
|
|
125
|
-
counterpartId:
|
|
126
|
-
enabled:
|
|
127
|
-
}),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}, [
|
|
131
|
-
let
|
|
132
|
-
id:
|
|
133
|
-
label:
|
|
134
|
-
} : null,
|
|
135
|
-
|
|
136
|
-
},
|
|
137
|
-
!e &&
|
|
138
|
-
}, xe = () => {
|
|
139
|
-
g(l.CollectPaymentClicked), Q(), me(!0);
|
|
118
|
+
...i
|
|
119
|
+
}, h = t(), { initResponse: _ } = s(), me = ee(_?.scopes);
|
|
120
|
+
f(() => {
|
|
121
|
+
h(c.Mounted);
|
|
122
|
+
}, [h]);
|
|
123
|
+
let [y, he] = p(!1), [b, x] = p(m.Details), [S, C] = p(u.Front), [w, T] = p(""), [E, D] = p(""), [O, k] = p(null), [A, j] = p(null), [M, N] = p(null), [P, F] = p(""), [I, L] = p(null), R = ae({ enabled: y }), z = (R.data?.data ?? []).filter((e) => e.status === "ACTIVE"), B = ie({ enabled: y }), V = B.customers, H = O === null ? null : V.find((e) => e.id === O) ?? null, ge = v(V, O), _e = oe({
|
|
124
|
+
counterpartId: H?.id,
|
|
125
|
+
enabled: y && !!H
|
|
126
|
+
}), U = _e.invoices, W = re(), ve = H ? U.map((e) => ue(e, a.invoiceDueDatePrefix)) : [], G = H && A !== null ? U.find((e) => e.id === A) ?? null : null, ye = v(U, A), K = H !== null, q = G ? ce(G, z, a.defaultAccountName) : null, J = K ? null : z.find((e) => e.id === M) ?? null, Y = G?.currency ?? J?.currencyCode ?? "USD";
|
|
127
|
+
f(() => {
|
|
128
|
+
F((e) => de(e, Y));
|
|
129
|
+
}, [Y]);
|
|
130
|
+
let be = K ? q ? [q.label] : [] : z.map((e) => g(e, a.defaultAccountName)), xe = K ? q ? 0 : null : v(z, M), X = K ? q : J ? {
|
|
131
|
+
id: J.id,
|
|
132
|
+
label: g(J, a.defaultAccountName)
|
|
133
|
+
} : null, Z = () => {
|
|
134
|
+
x(m.Details), C(u.Front), T(""), D(""), k(null), j(null), N(null), F(""), L(null), W.reset();
|
|
135
|
+
}, Q = (e) => {
|
|
136
|
+
!e && W.isPending || (he(e), e || Z());
|
|
140
137
|
}, Se = () => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
h(c.CollectPaymentClicked), Z(), he(!0);
|
|
139
|
+
}, Ce = () => {
|
|
140
|
+
let t = o(P, Y);
|
|
141
|
+
if (!X || t === null) {
|
|
142
|
+
e.error(X ? a.invalidAmountErrorToast : a.noDepositAccountErrorToast);
|
|
144
143
|
return;
|
|
145
144
|
}
|
|
146
|
-
let n =
|
|
147
|
-
|
|
148
|
-
path: { id:
|
|
145
|
+
let n = fe(P, Y), i = X.label;
|
|
146
|
+
W.mutate({
|
|
147
|
+
path: { id: X.id },
|
|
149
148
|
body: {
|
|
150
149
|
amount: t,
|
|
151
|
-
currencyCode:
|
|
152
|
-
...
|
|
150
|
+
currencyCode: Y,
|
|
151
|
+
...G ? { invoiceId: G.id } : {}
|
|
153
152
|
}
|
|
154
153
|
}, {
|
|
155
154
|
onSuccess: () => {
|
|
156
|
-
|
|
155
|
+
L({
|
|
157
156
|
isSuccess: !0,
|
|
158
157
|
formattedAmount: n,
|
|
159
|
-
depositAccountLabel:
|
|
160
|
-
}),
|
|
158
|
+
depositAccountLabel: i
|
|
159
|
+
}), x(m.Complete), r?.();
|
|
161
160
|
},
|
|
162
161
|
onError: (e) => {
|
|
163
|
-
console.error("[remote-check-capture] check deposit failed", e),
|
|
162
|
+
console.error("[remote-check-capture] check deposit failed", e), L({
|
|
164
163
|
isSuccess: !1,
|
|
165
164
|
formattedAmount: n,
|
|
166
|
-
depositAccountLabel:
|
|
167
|
-
}),
|
|
165
|
+
depositAccountLabel: i
|
|
166
|
+
}), x(m.Complete);
|
|
168
167
|
}
|
|
169
168
|
});
|
|
170
|
-
},
|
|
169
|
+
}, we = b === m.Review ? n?.review?.title ?? d.title : b === m.Complete ? I?.isSuccess === !1 ? n?.complete?.errorTitle ?? ne.errorTitle : n?.complete?.title ?? ne.title : a.title, $ = !!(w && E), Te = {
|
|
171
170
|
labels: {
|
|
172
|
-
...
|
|
173
|
-
currencyPrefix:
|
|
174
|
-
|
|
171
|
+
...i,
|
|
172
|
+
currencyPrefix: i?.currencyPrefix ?? pe(Y),
|
|
173
|
+
...$ ? { continueButton: a.continueToReviewButton } : {}
|
|
175
174
|
},
|
|
176
|
-
testIds:
|
|
177
|
-
customerOptions:
|
|
178
|
-
selectedCustomerIndex:
|
|
175
|
+
testIds: l.detailsScreen,
|
|
176
|
+
customerOptions: V.map(le),
|
|
177
|
+
selectedCustomerIndex: ge,
|
|
179
178
|
onCustomerSelect: (e) => {
|
|
180
|
-
|
|
179
|
+
k(V[e]?.id ?? null), j(null), F("");
|
|
181
180
|
},
|
|
182
181
|
onCustomerClear: () => {
|
|
183
|
-
|
|
182
|
+
k(null), j(null), N(null);
|
|
184
183
|
},
|
|
185
|
-
customerLoadError:
|
|
186
|
-
invoiceOptions:
|
|
187
|
-
invoiceSelectDisabled:
|
|
188
|
-
invoiceLoadError:
|
|
189
|
-
selectedInvoiceIndex:
|
|
184
|
+
customerLoadError: B.isError,
|
|
185
|
+
invoiceOptions: ve,
|
|
186
|
+
invoiceSelectDisabled: H === null,
|
|
187
|
+
invoiceLoadError: H !== null && _e.isError,
|
|
188
|
+
selectedInvoiceIndex: ye,
|
|
190
189
|
onInvoiceSelect: (e) => {
|
|
191
|
-
|
|
190
|
+
j(U[e]?.id ?? null);
|
|
192
191
|
},
|
|
193
|
-
onInvoiceClear: () =>
|
|
194
|
-
accountOptions:
|
|
195
|
-
selectedAccountIndex:
|
|
192
|
+
onInvoiceClear: () => j(null),
|
|
193
|
+
accountOptions: be,
|
|
194
|
+
selectedAccountIndex: xe,
|
|
196
195
|
onAccountSelect: (e) => {
|
|
197
|
-
|
|
196
|
+
N(z[e]?.id ?? null);
|
|
198
197
|
},
|
|
199
|
-
accountSelectDisabled:
|
|
200
|
-
accountLoadError:
|
|
201
|
-
amount:
|
|
198
|
+
accountSelectDisabled: K,
|
|
199
|
+
accountLoadError: K ? G !== null && q === null && !R.isLoading : R.isError,
|
|
200
|
+
amount: P,
|
|
202
201
|
onAmountChange: (e) => {
|
|
203
|
-
|
|
202
|
+
F(de(e, Y));
|
|
204
203
|
},
|
|
205
|
-
limitsHint:
|
|
206
|
-
onBack: () =>
|
|
204
|
+
limitsHint: a.amountLimitsHint.replaceAll("{currencySymbol}", pe(Y)),
|
|
205
|
+
onBack: () => Q(!1),
|
|
207
206
|
onContinue: () => {
|
|
208
|
-
if (
|
|
209
|
-
|
|
207
|
+
if ($) {
|
|
208
|
+
x(m.Review);
|
|
210
209
|
return;
|
|
211
210
|
}
|
|
212
|
-
|
|
211
|
+
C(u.Front), x(m.Capture);
|
|
213
212
|
},
|
|
214
|
-
continueDisabled:
|
|
215
|
-
}, Ee =
|
|
216
|
-
labels:
|
|
217
|
-
testIds:
|
|
218
|
-
side:
|
|
213
|
+
continueDisabled: o(P, Y) === null || X === null || (H === null ? M === null : ye === null)
|
|
214
|
+
}, Ee = b === m.Capture ? {
|
|
215
|
+
labels: n?.capture,
|
|
216
|
+
testIds: l.captureScreen,
|
|
217
|
+
side: S,
|
|
219
218
|
onCapture: (e) => {
|
|
220
|
-
|
|
219
|
+
S === u.Front ? (T(e), E ? x(m.Review) : C(u.Back)) : (D(e), w ? x(m.Review) : C(u.Front));
|
|
221
220
|
}
|
|
222
|
-
} : null, De =
|
|
223
|
-
labels:
|
|
224
|
-
testIds:
|
|
225
|
-
frontImage:
|
|
226
|
-
backImage:
|
|
227
|
-
amount:
|
|
228
|
-
depositTo:
|
|
229
|
-
customer:
|
|
230
|
-
invoice:
|
|
231
|
-
availableDate:
|
|
232
|
-
onBack: () =>
|
|
221
|
+
} : null, De = b === m.Review ? {
|
|
222
|
+
labels: n?.review,
|
|
223
|
+
testIds: l.reviewScreen,
|
|
224
|
+
frontImage: w,
|
|
225
|
+
backImage: E,
|
|
226
|
+
amount: fe(P, Y),
|
|
227
|
+
depositTo: X?.label ?? "",
|
|
228
|
+
customer: H ? le(H) : "",
|
|
229
|
+
invoice: G ? ue(G, a.invoiceDueDatePrefix) : void 0,
|
|
230
|
+
availableDate: se(n?.review?.availabilityEstimateSuffix ?? d.availabilityEstimateSuffix),
|
|
231
|
+
onBack: () => x(m.Details),
|
|
233
232
|
onRetakeFront: () => {
|
|
234
|
-
|
|
233
|
+
C(u.Front), x(m.Capture);
|
|
235
234
|
},
|
|
236
235
|
onRetakeBack: () => {
|
|
237
|
-
|
|
236
|
+
C(u.Back), x(m.Capture);
|
|
238
237
|
},
|
|
239
|
-
onCompleteDeposit:
|
|
240
|
-
isSubmitting:
|
|
241
|
-
} : null, Oe =
|
|
242
|
-
labels:
|
|
243
|
-
testIds:
|
|
244
|
-
isSuccess:
|
|
245
|
-
amount:
|
|
246
|
-
depositAccount:
|
|
238
|
+
onCompleteDeposit: Ce,
|
|
239
|
+
isSubmitting: W.isPending
|
|
240
|
+
} : null, Oe = b === m.Complete && I ? {
|
|
241
|
+
labels: n?.complete,
|
|
242
|
+
testIds: l.completeScreen,
|
|
243
|
+
isSuccess: I.isSuccess,
|
|
244
|
+
amount: I.formattedAmount,
|
|
245
|
+
depositAccount: I.depositAccountLabel,
|
|
247
246
|
onDepositAnotherCheck: () => {
|
|
248
|
-
|
|
247
|
+
Z();
|
|
249
248
|
},
|
|
250
249
|
onTryAgain: () => {
|
|
251
|
-
|
|
250
|
+
L(null), x(m.Review);
|
|
252
251
|
},
|
|
253
|
-
onDone: () =>
|
|
252
|
+
onDone: () => Q(!1)
|
|
254
253
|
} : null;
|
|
255
254
|
return {
|
|
256
|
-
open:
|
|
257
|
-
onOpenChange:
|
|
258
|
-
onCollectPaymentClick:
|
|
259
|
-
collectPaymentButtonLabel:
|
|
260
|
-
canCollectDeposit:
|
|
261
|
-
step:
|
|
262
|
-
modalTitle:
|
|
255
|
+
open: y,
|
|
256
|
+
onOpenChange: Q,
|
|
257
|
+
onCollectPaymentClick: Se,
|
|
258
|
+
collectPaymentButtonLabel: a.collectPaymentButton,
|
|
259
|
+
canCollectDeposit: me,
|
|
260
|
+
step: b,
|
|
261
|
+
modalTitle: we,
|
|
263
262
|
detailsScreenProps: Te,
|
|
264
263
|
captureScreenProps: Ee,
|
|
265
264
|
reviewScreenProps: De,
|
|
@@ -267,4 +266,4 @@ function pe({ labels: r, onDepositComplete: i } = {}) {
|
|
|
267
266
|
};
|
|
268
267
|
}
|
|
269
268
|
//#endregion
|
|
270
|
-
export {
|
|
269
|
+
export { m as RemoteCheckCaptureFlowStep, me as useRemoteCheckCaptureWidget };
|