@tesouro/embedded-components-react 0.5.97 → 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.
@@ -1,4 +1,5 @@
1
1
  import { useCreateCheckDepositMutation as e } from "./index3.js";
2
2
  import { useCustomersQuery as t } from "./index4.js";
3
- import { useInvoicesQuery as n } from "./index5.js";
4
- export { e as useCreateCheckDepositMutation, t as useCustomersQuery, n as useInvoicesQuery };
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 };
@@ -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 { 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";
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 { hashKey as o, useInfiniteQuery as s } from "@tanstack/react-query";
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, 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
- },
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: f,
41
- headers: g,
30
+ client: u,
31
+ headers: m,
42
32
  query: {
43
- ...v,
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(b, _);
54
- let x = b.data?.pages.flatMap((e) => e.data.filter((e) => e.type === "invoice")) ?? [];
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
- ...b,
57
- invoices: x
52
+ ..._,
53
+ data: v
58
54
  };
59
55
  }
60
56
  //#endregion
61
- export { u as useInvoicesQuery };
57
+ export { l as useAllDepositableBankAccountsQuery };
@@ -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.BankAccountReadOrg,
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 n } from "../../../../../shared/feature/dist/lib/analytics/hooks.js";
10
- import { amountOutputToMajorUnits as r, minorExponentForCurrency as i } from "../../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
11
- import { formatCalendarDate as a } from "../../../../../shared/util/dist/lib/formatCalendarDate.js";
12
- import { formatMoneyExact as o } from "../../../../../shared/util/dist/lib/formatMoneyExact.js";
13
- import { parseDecimalAmountToMinorUnits as s } from "../../../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
14
- import { useWidgetConfig as c } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
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 l } from "../analytics/events.js";
17
- import { remoteCheckCaptureWidgetTestIds as u } from "./testIds.js";
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 d } from "../../../../ui/dist/index6.js";
21
- import { DEFAULT_REVIEW_DEPOSIT_SCREEN_LABELS as ne } from "../../../../ui/dist/index7.js";
22
- import { DEFAULT_DEPOSIT_COMPLETE_SCREEN_LABELS as f } from "../../../../ui/dist/index9.js";
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 { useInvoicesQuery as ae } from "../../../../data-access/dist/index5.js";
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 p, useState as m } from "react";
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 h = {
29
+ var m = {
31
30
  Details: "details",
32
31
  Capture: "capture",
33
32
  Review: "review",
34
33
  Complete: "complete"
35
- }, g = 2;
36
- function oe(e, t = /* @__PURE__ */ new Date()) {
37
- let n = new Date(t), r = g;
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 _(e, t) {
50
- return `${e.nickname?.trim() || t} ••${e.accountNumber.slice(-4)}`;
48
+ function g(e, t) {
49
+ return `${e.nickname?.trim() || t} ••${e.lastFour}`;
51
50
  }
52
- function v(e, t) {
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 se(e, t, n) {
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 && _(r, n) || v(e.bank_account_snapshot, n) || n;
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.accountNumber.slice(-4) === r), [a] = i;
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: _(a, n)
67
+ label: g(a, n)
69
68
  } : null;
70
69
  }
71
- function ce(e) {
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 le(e, t) {
75
- let n = i(e.currency), s = o(r({
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: n,
81
- maximumFractionDigits: n
82
- }), c = e.due_date ? ` · ${t} ${a(e.due_date)}` : "";
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 y(e, t) {
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 ue(e, t) {
91
- let n = e.indexOf("."), r = e.lastIndexOf(".");
92
- if (n === -1 || n !== r) return e;
93
- let a = i(t);
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 de(e, t) {
97
- let n = s(e, t);
98
- if (n === null) return `${t} ${e}`;
99
- let a = i(t);
100
- return o(r({
101
- value: n,
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: a,
106
- maximumFractionDigits: a
104
+ minimumFractionDigits: s,
105
+ maximumFractionDigits: s
107
106
  });
108
107
  }
109
- function fe(e) {
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 pe({ labels: r, onDepositComplete: i } = {}) {
117
- let a = r?.details, o = {
115
+ function me({ labels: n, onDepositComplete: r } = {}) {
116
+ let i = n?.details, a = {
118
117
  ...te,
119
- ...a
120
- }, g = n(), { initResponse: v } = c(), pe = ee(v?.scopes);
121
- p(() => {
122
- g(l.Mounted);
123
- }, [g]);
124
- let [b, me] = m(!1), [x, S] = m(h.Details), [C, w] = m(d.Front), [T, E] = m(""), [D, O] = m(""), [k, A] = m(null), [j, M] = m(null), [N, P] = m(null), [F, I] = m(""), [L, R] = m(null), z = t({ enabled: b }), B = (z.data?.data ?? []).filter((e) => e.status === "ACTIVE"), V = ie({ enabled: b }), H = V.customers, U = k === null ? null : H.find((e) => e.id === k) ?? null, he = y(H, k), ge = ae({
125
- counterpartId: U?.id,
126
- enabled: b && !!U
127
- }), W = ge.invoices, G = re(), _e = U ? W.map((e) => le(e, o.invoiceDueDatePrefix)) : [], K = U && j !== null ? W.find((e) => e.id === j) ?? null : null, ve = y(W, j), q = U !== null, J = K ? se(K, B, o.defaultAccountName) : null, Y = q ? null : B.find((e) => e.id === N) ?? null, X = K?.currency ?? Y?.balance.currencyCode ?? "USD";
128
- p(() => {
129
- I((e) => ue(e, X));
130
- }, [X]);
131
- let ye = q ? J ? [J.label] : [] : B.map((e) => _(e, o.defaultAccountName)), be = q ? J ? 0 : null : y(B, N), Z = q ? J : Y ? {
132
- id: Y.id,
133
- label: _(Y, o.defaultAccountName)
134
- } : null, Q = () => {
135
- S(h.Details), w(d.Front), E(""), O(""), A(null), M(null), P(null), I(""), R(null), G.reset();
136
- }, $ = (e) => {
137
- !e && G.isPending || (me(e), e || Q());
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
- let t = s(F, X);
142
- if (!Z || t === null) {
143
- e.error(Z ? o.invalidAmountErrorToast : o.noDepositAccountErrorToast);
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 = de(F, X), r = Z.label;
147
- G.mutate({
148
- path: { id: Z.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: X,
152
- ...K ? { invoiceId: K.id } : {}
150
+ currencyCode: Y,
151
+ ...G ? { invoiceId: G.id } : {}
153
152
  }
154
153
  }, {
155
154
  onSuccess: () => {
156
- R({
155
+ L({
157
156
  isSuccess: !0,
158
157
  formattedAmount: n,
159
- depositAccountLabel: r
160
- }), S(h.Complete), i?.();
158
+ depositAccountLabel: i
159
+ }), x(m.Complete), r?.();
161
160
  },
162
161
  onError: (e) => {
163
- console.error("[remote-check-capture] check deposit failed", e), R({
162
+ console.error("[remote-check-capture] check deposit failed", e), L({
164
163
  isSuccess: !1,
165
164
  formattedAmount: n,
166
- depositAccountLabel: r
167
- }), S(h.Complete);
165
+ depositAccountLabel: i
166
+ }), x(m.Complete);
168
167
  }
169
168
  });
170
- }, Ce = x === h.Review ? r?.review?.title ?? ne.title : x === h.Complete ? L?.isSuccess === !1 ? r?.complete?.errorTitle ?? f.errorTitle : r?.complete?.title ?? f.title : o.title, we = !!(T && D), Te = {
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
- ...a,
173
- currencyPrefix: a?.currencyPrefix ?? fe(X),
174
- ...we ? { continueButton: o.continueToReviewButton } : {}
171
+ ...i,
172
+ currencyPrefix: i?.currencyPrefix ?? pe(Y),
173
+ ...$ ? { continueButton: a.continueToReviewButton } : {}
175
174
  },
176
- testIds: u.detailsScreen,
177
- customerOptions: H.map(ce),
178
- selectedCustomerIndex: he,
175
+ testIds: l.detailsScreen,
176
+ customerOptions: V.map(le),
177
+ selectedCustomerIndex: ge,
179
178
  onCustomerSelect: (e) => {
180
- A(H[e]?.id ?? null), M(null), I("");
179
+ k(V[e]?.id ?? null), j(null), F("");
181
180
  },
182
181
  onCustomerClear: () => {
183
- A(null), M(null), P(null);
182
+ k(null), j(null), N(null);
184
183
  },
185
- customerLoadError: V.isError,
186
- invoiceOptions: _e,
187
- invoiceSelectDisabled: U === null,
188
- invoiceLoadError: U !== null && ge.isError,
189
- selectedInvoiceIndex: ve,
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
- M(W[e]?.id ?? null);
190
+ j(U[e]?.id ?? null);
192
191
  },
193
- onInvoiceClear: () => M(null),
194
- accountOptions: ye,
195
- selectedAccountIndex: be,
192
+ onInvoiceClear: () => j(null),
193
+ accountOptions: be,
194
+ selectedAccountIndex: xe,
196
195
  onAccountSelect: (e) => {
197
- P(B[e]?.id ?? null);
196
+ N(z[e]?.id ?? null);
198
197
  },
199
- accountSelectDisabled: q,
200
- accountLoadError: q ? K !== null && J === null && !z.isLoading : z.isError,
201
- amount: F,
198
+ accountSelectDisabled: K,
199
+ accountLoadError: K ? G !== null && q === null && !R.isLoading : R.isError,
200
+ amount: P,
202
201
  onAmountChange: (e) => {
203
- I(ue(e, X));
202
+ F(de(e, Y));
204
203
  },
205
- limitsHint: o.amountLimitsHint.replaceAll("{currencySymbol}", fe(X)),
206
- onBack: () => $(!1),
204
+ limitsHint: a.amountLimitsHint.replaceAll("{currencySymbol}", pe(Y)),
205
+ onBack: () => Q(!1),
207
206
  onContinue: () => {
208
- if (we) {
209
- S(h.Review);
207
+ if ($) {
208
+ x(m.Review);
210
209
  return;
211
210
  }
212
- w(d.Front), S(h.Capture);
211
+ C(u.Front), x(m.Capture);
213
212
  },
214
- continueDisabled: s(F, X) === null || Z === null || (U === null ? N === null : ve === null)
215
- }, Ee = x === h.Capture ? {
216
- labels: r?.capture,
217
- testIds: u.captureScreen,
218
- side: C,
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
- C === d.Front ? (E(e), D ? S(h.Review) : w(d.Back)) : (O(e), T ? S(h.Review) : w(d.Front));
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 = x === h.Review ? {
223
- labels: r?.review,
224
- testIds: u.reviewScreen,
225
- frontImage: T,
226
- backImage: D,
227
- amount: de(F, X),
228
- depositTo: Z?.label ?? "",
229
- customer: U ? ce(U) : "",
230
- invoice: K ? le(K, o.invoiceDueDatePrefix) : void 0,
231
- availableDate: oe(r?.review?.availabilityEstimateSuffix ?? ne.availabilityEstimateSuffix),
232
- onBack: () => S(h.Details),
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
- w(d.Front), S(h.Capture);
233
+ C(u.Front), x(m.Capture);
235
234
  },
236
235
  onRetakeBack: () => {
237
- w(d.Back), S(h.Capture);
236
+ C(u.Back), x(m.Capture);
238
237
  },
239
- onCompleteDeposit: Se,
240
- isSubmitting: G.isPending
241
- } : null, Oe = x === h.Complete && L ? {
242
- labels: r?.complete,
243
- testIds: u.completeScreen,
244
- isSuccess: L.isSuccess,
245
- amount: L.formattedAmount,
246
- depositAccount: L.depositAccountLabel,
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
- Q();
247
+ Z();
249
248
  },
250
249
  onTryAgain: () => {
251
- R(null), S(h.Review);
250
+ L(null), x(m.Review);
252
251
  },
253
- onDone: () => $(!1)
252
+ onDone: () => Q(!1)
254
253
  } : null;
255
254
  return {
256
- open: b,
257
- onOpenChange: $,
258
- onCollectPaymentClick: xe,
259
- collectPaymentButtonLabel: o.collectPaymentButton,
260
- canCollectDeposit: pe,
261
- step: x,
262
- modalTitle: Ce,
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 { h as RemoteCheckCaptureFlowStep, pe as useRemoteCheckCaptureWidget };
269
+ export { m as RemoteCheckCaptureFlowStep, me as useRemoteCheckCaptureWidget };