@tesouro/embedded-components-react 0.9.32 → 0.9.34

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/index.d.ts CHANGED
@@ -6228,7 +6228,7 @@ interface ReceivableMessageLabels {
6228
6228
  actionsSendSucceeded: string;
6229
6229
  actionsSendFailed: string;
6230
6230
  actionsSendWithoutPaymentLink: string;
6231
- /** A native addition: Monite has no path that sends without the payment-link scope. */
6231
+ /** @deprecated Unused: sending no longer checks a payment-link scope. Kept so existing overrides still compile. */
6232
6232
  actionsSendWithoutPaymentLinkScope: string;
6233
6233
  actionsTitleSent: string;
6234
6234
  actionsTitleIssued: string;
@@ -1661,7 +1661,7 @@ interface ReceivableMessageLabels {
1661
1661
  actionsSendSucceeded: string;
1662
1662
  actionsSendFailed: string;
1663
1663
  actionsSendWithoutPaymentLink: string;
1664
- /** A native addition: Monite has no path that sends without the payment-link scope. */
1664
+ /** @deprecated Unused: sending no longer checks a payment-link scope. Kept so existing overrides still compile. */
1665
1665
  actionsSendWithoutPaymentLinkScope: string;
1666
1666
  actionsTitleSent: string;
1667
1667
  actionsTitleIssued: string;
@@ -3,36 +3,32 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { toast as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { hasAnyScope as t } from "../../../../../shared/data-access/dist/lib/hasAnyScope.js";
7
- import { useMyEntityQuery as n } from "../../../../../shared/data-access/dist/lib/useMyEntityQuery.js";
8
- import { Scope as r } from "../../../../../shared/data-access/dist/lib/scopes.js";
6
+ import { useMyEntityQuery as t } from "../../../../../shared/data-access/dist/lib/useMyEntityQuery.js";
9
7
  import "../../../../../shared/data-access/dist/index.js";
10
8
  import "../../../../../shared/ui/dist/index.js";
11
- import { useWidgetConfig as i } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
12
- import "../../../../../shared/feature/dist/index.js";
13
- import { useEntityPaymentMethodsQuery as a } from "../../../../data-access/dist/index5.js";
14
- import { useCreatePaymentLinkMutation as o } from "../../../../data-access/dist/index7.js";
15
- import { useSendReceivableEmailMutation as s } from "../../../../data-access/dist/index10.js";
9
+ import { useEntityPaymentMethodsQuery as n } from "../../../../data-access/dist/index5.js";
10
+ import { useCreatePaymentLinkMutation as r } from "../../../../data-access/dist/index7.js";
11
+ import { useSendReceivableEmailMutation as i } from "../../../../data-access/dist/index10.js";
16
12
  import "../../../../data-access/dist/index.js";
17
- import { getReceivePaymentMethods as c } from "./preview.js";
18
- import { useCallback as l, useEffect as u, useRef as d } from "react";
13
+ import { getReceivePaymentMethods as a } from "./preview.js";
14
+ import { useCallback as o, useEffect as s, useRef as c } from "react";
19
15
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useSendReceivableWithPaymentLink.js
20
- function f({ messages: f, documentType: p }) {
21
- let { initResponse: m } = i(), h = p === "invoice", g = t(m?.scopes, [r.PaymentLinkWrite]), _ = h && g, v = n({ enabled: _ }), y = v.data?.id, b = a({
22
- entityId: y,
23
- enabled: _
24
- }), x = o(), S = s(), C = v.error || b.error ? void 0 : b.data?.data, w = d(void 0);
25
- u(() => {
26
- p || (w.current = void 0);
27
- }, [p]);
28
- let T = x.mutateAsync, E = S.mutateAsync, D = f.actionsSendWithoutPaymentLink, O = f.actionsSendWithoutPaymentLinkScope;
16
+ function l({ messages: l, documentType: u }) {
17
+ let d = u === "invoice", f = t({ enabled: d }), p = f.data?.id, m = n({
18
+ entityId: p,
19
+ enabled: d
20
+ }), h = r(), g = i(), _ = f.error || m.error ? void 0 : m.data?.data, v = c(void 0);
21
+ s(() => {
22
+ u || (v.current = void 0);
23
+ }, [u]);
24
+ let y = h.mutateAsync, b = g.mutateAsync, x = l.actionsSendWithoutPaymentLink;
29
25
  return {
30
- send: l(async (t) => {
31
- if (!_) return h && e.error(O), E(t);
32
- let n = t.path.receivable_id, r = c(C);
33
- return !y || r.length === 0 ? e.error(D) : w.current !== n && (await T({ body: {
26
+ send: o(async (t) => {
27
+ if (!d) return b(t);
28
+ let n = t.path.receivable_id, r = a(_);
29
+ return !p || r.length === 0 ? e.error(x) : v.current !== n && (await y({ body: {
34
30
  recipient: {
35
- id: y,
31
+ id: p,
36
32
  type: "entity"
37
33
  },
38
34
  payment_methods: r.map((e) => e.type),
@@ -40,19 +36,17 @@ function f({ messages: f, documentType: p }) {
40
36
  id: n,
41
37
  type: "receivable"
42
38
  }
43
- } }), w.current = n), E(t);
39
+ } }), v.current = n), b(t);
44
40
  }, [
45
- _,
46
- T,
41
+ d,
47
42
  y,
48
- h,
49
- C,
50
- O,
51
- E,
52
- D
43
+ p,
44
+ _,
45
+ b,
46
+ x
53
47
  ]),
54
- isPending: _ && (v.isFetching || b.isFetching) || x.isPending || S.isPending
48
+ isPending: d && (f.isFetching || m.isFetching) || h.isPending || g.isPending
55
49
  };
56
50
  }
57
51
  //#endregion
58
- export { f as useSendReceivableWithPaymentLink };
52
+ export { l as useSendReceivableWithPaymentLink };
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.9.32", n = "a94615c7b5725b833f24e0c7bb1f5c1a1388ca97", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.9.34", n = "84b5f60983c6f63de60bf7571c4265ad29fb7dff", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.9.32",
3
+ "version": "0.9.34",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [