@tesouro/embedded-components-react 0.9.19 → 0.9.22

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.
@@ -3,31 +3,30 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { hasAnyScope as e } from "../../../../shared/data-access/dist/lib/hasAnyScope.js";
6
- import { useCurrentUserQuery as t } from "../../../../shared/data-access/dist/lib/useCurrentUserQuery.js";
7
- import { Scope as n } from "../../../../shared/data-access/dist/lib/scopes.js";
6
+ import { Scope as t } from "../../../../shared/data-access/dist/lib/scopes.js";
8
7
  import "../../../../shared/data-access/dist/index.js";
9
- import { useWidgetConfig as r } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
8
+ import { useWidgetConfig as n } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
9
  import "../../../../shared/feature/dist/index.js";
11
- import { usePayableApprovalRequestsQuery as i } from "../../data-access/dist/index2.js";
10
+ import { usePayableApprovalRequestsQuery as r } from "../../data-access/dist/index2.js";
12
11
  import "../../data-access/dist/index.js";
13
- import { currentApprovalRound as a } from "./index8.js";
14
- import { usePayableApprovalRoundStart as o } from "./index11.js";
12
+ import { currentApprovalRound as i } from "./index8.js";
13
+ import { usePayableApprovalRoundStart as a } from "./index11.js";
15
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js
16
- function s({ payableId: s, status: c }) {
17
- let { initResponse: l } = r(), u = e(l?.scopes, [n.ApprovalRequestReadOrg]), d = c === "approve_in_progress" && u, { roundStartedAt: f } = o({
18
- payableId: s,
19
- enabled: d
20
- }), p = t({ enabled: d }), m = p.data?.id, h = (e) => e.caller_is_policy_approver ?? !!(m && e.user_ids.includes(m)), g = i(s, {
21
- enabled: d,
22
- hasAwaitedRequest: d ? (e) => a(e, f).some(h) : void 0,
23
- currentRoundStartedAt: f
24
- }), _ = d ? a(g.data?.data, f) : [], v = _.some(h), y = _.filter((e) => e.status === "waiting");
15
+ function o({ payableId: o, status: s }) {
16
+ let { initResponse: c } = n(), l = e(c?.scopes, [t.ApprovalRequestReadOrg]), u = s === "approve_in_progress" && l, { roundStartedAt: d } = a({
17
+ payableId: o,
18
+ enabled: u
19
+ }), f = c?.userId ?? void 0, p = (e) => e.caller_is_policy_approver ?? !!(f && e.user_ids.includes(f)), m = r(o, {
20
+ enabled: u,
21
+ hasAwaitedRequest: u ? (e) => i(e, d).some(p) : void 0,
22
+ currentRoundStartedAt: d
23
+ }), h = u ? i(m.data?.data, d) : [], g = h.some(p), _ = h.filter((e) => e.status === "waiting");
25
24
  return {
26
- id: y.filter(h).find((e) => !(m && (e.approved_by ?? []).includes(m)))?.id,
27
- isPolicyApprover: v,
28
- hasWaitingRequest: y.length > 0,
29
- isLoading: g.isLoading || p.isLoading
25
+ id: _.filter(p).find((e) => !(f && (e.approved_by ?? []).includes(f)))?.id,
26
+ isPolicyApprover: g,
27
+ hasWaitingRequest: _.length > 0,
28
+ isLoading: m.isLoading
30
29
  };
31
30
  }
32
31
  //#endregion
33
- export { s as useCurrentApprovalRequestId };
32
+ export { o as useCurrentApprovalRequestId };
@@ -15,7 +15,7 @@ function r({ counterpartId: r, billingAddressId: i, billingCountry: a, inlineCus
15
15
  counterpart_billing_address_id: i || void 0,
16
16
  counterpart_country: a,
17
17
  counterpart_type: d?.type ?? o,
18
- enabled: s && !!(d || o) && !(d && c) && !!(d || a)
18
+ enabled: s && !!(d || o) && !(d && c) && !!(i || a)
19
19
  }), p = !!f.data?.entity?.tax_id?.required, m = !!r && !d && (u.isLoading || u.isFetching);
20
20
  return {
21
21
  counterpart: d,
@@ -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.19", n = "e5b0e315b1696d214e7681ed5cc4042a3a098d79", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.9.22", n = "de85c398e984dc725d382b6d5e2388d8931dc0bc", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -1,6 +1,7 @@
1
1
  import { coerceAmountValueToMinorUnits as e } from "./lib/coerceAmountValueToMinorUnits.js";
2
2
  import { createCurrencyFormatter as t } from "./lib/createCurrencyFormatter.js";
3
3
  import { amountOutputToMajorUnits as n, minorExponentForCurrency as r } from "./lib/amountOutputToMajorUnits.js";
4
+ import "./lib/dateDisplay.js";
4
5
  import { formatCalendarDate as i } from "./lib/formatCalendarDate.js";
5
6
  import { formatTimestampDate as a } from "./lib/formatTimestampDate.js";
6
7
  import { formatRejectionDate as o } from "./lib/formatRejectionDate.js";
@@ -0,0 +1,8 @@
1
+ //#region ../../libs/tesouro-embedded-components-react/shared/util/dist/lib/dateDisplay.js
2
+ var e = "en-US", t = {
3
+ month: "short",
4
+ day: "numeric",
5
+ year: "numeric"
6
+ };
7
+ //#endregion
8
+ export { e as DATE_DISPLAY_LOCALE, t as DATE_DISPLAY_OPTIONS };
@@ -1,13 +1,13 @@
1
+ import { DATE_DISPLAY_LOCALE as e, DATE_DISPLAY_OPTIONS as t } from "./dateDisplay.js";
1
2
  //#region ../../libs/tesouro-embedded-components-react/shared/util/dist/lib/formatCalendarDate.js
2
- function e(e, t) {
3
- if (!e) return "";
4
- let [n, r, i] = e.split("-").map(Number);
5
- return !n || !r || !i ? e : new Date(Date.UTC(n, r - 1, i)).toLocaleDateString("en-US", {
6
- month: t?.month ?? "short",
7
- day: "numeric",
8
- year: "numeric",
3
+ function n(n, r) {
4
+ if (!n) return "";
5
+ let [i, a, o] = n.split("-").map(Number);
6
+ return !i || !a || !o ? n : new Date(Date.UTC(i, a - 1, o)).toLocaleDateString(e, {
7
+ ...t,
8
+ month: r?.month ?? t.month,
9
9
  timeZone: "UTC"
10
10
  });
11
11
  }
12
12
  //#endregion
13
- export { e as formatCalendarDate };
13
+ export { n as formatCalendarDate };
@@ -1,11 +1,12 @@
1
+ import { DATE_DISPLAY_LOCALE as e, DATE_DISPLAY_OPTIONS as t } from "./dateDisplay.js";
1
2
  //#region ../../libs/tesouro-embedded-components-react/shared/util/dist/lib/formatRejectionDate.js
2
- function e(e, t = /* @__PURE__ */ new Date()) {
3
- let n = new Date(e), r = n.getFullYear() !== t.getFullYear();
4
- return n.toLocaleDateString("en-US", {
5
- month: "short",
6
- day: "numeric",
7
- ...r ? { year: "numeric" } : {}
3
+ function n(n, r = /* @__PURE__ */ new Date()) {
4
+ let i = new Date(n), a = i.getFullYear() !== r.getFullYear();
5
+ return i.toLocaleDateString(e, {
6
+ month: t.month,
7
+ day: t.day,
8
+ ...a ? { year: t.year } : {}
8
9
  });
9
10
  }
10
11
  //#endregion
11
- export { e as formatRejectionDate };
12
+ export { n as formatRejectionDate };
@@ -1,13 +1,13 @@
1
+ import { DATE_DISPLAY_LOCALE as e, DATE_DISPLAY_OPTIONS as t } from "./dateDisplay.js";
1
2
  //#region ../../libs/tesouro-embedded-components-react/shared/util/dist/lib/formatTimestampDate.js
2
- function e(e, t) {
3
- if (!e) return "";
4
- let n = new Date(e);
5
- return Number.isNaN(n.getTime()) ? "" : n.toLocaleDateString("en-US", {
6
- month: t?.month ?? "short",
7
- day: "numeric",
8
- year: "numeric",
9
- timeZone: t?.timeZone
3
+ function n(n, r) {
4
+ if (!n) return "";
5
+ let i = new Date(n);
6
+ return Number.isNaN(i.getTime()) ? "" : i.toLocaleDateString(e, {
7
+ ...t,
8
+ month: r?.month ?? t.month,
9
+ timeZone: r?.timeZone
10
10
  });
11
11
  }
12
12
  //#endregion
13
- export { e as formatTimestampDate };
13
+ export { n as formatTimestampDate };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.9.19",
3
+ "version": "0.9.22",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [