@tesouro/embedded-components-react 0.7.6 → 0.7.12

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.
Files changed (43) hide show
  1. package/README.md +6 -8
  2. package/dist/index.css +0 -76
  3. package/dist/index.d.ts +15 -193
  4. package/dist/index.js +1 -1
  5. package/dist/lib/BillPayWidget.d.ts +10 -188
  6. package/dist/lib/BillPayWidget.js +1 -1
  7. package/dist/lib/CounterpartsWidget.d.ts +1 -1
  8. package/dist/lib/CounterpartsWidgetPublic.d.ts +1 -1
  9. package/dist/lib/CustomersWidget.d.ts +1 -2
  10. package/dist/lib/WidgetSuite.d.ts +4 -4
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +2 -1
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/{BillPayWidgetNative/BillPayWidgetNative.js → BillPayWidget/BillPayWidget.js} +4 -3
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/{BillPayWidgetNative → BillPayWidget}/BillsTab.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/index.js +1 -0
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/{BillPayWidgetNative → BillPayWidget}/labels.js +2 -2
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/{BillPayWidgetNative → BillPayWidget}/testIds.js +1 -1
  17. package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/lib/CustomersWidgetMonite/CustomersWidgetMonite.js +7 -7
  18. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index105.js +53 -53
  19. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index107.js +23 -23
  20. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index108.js +74 -74
  21. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index157.js +30 -30
  22. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index160.js +28 -28
  23. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index21.js +1 -1
  24. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index243.js +6 -6
  25. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index321.js +0 -2
  26. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index332.js +13 -13
  27. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index340.js +9 -9
  28. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index360.js +6 -6
  29. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index372.js +57 -57
  30. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index374.js +6 -6
  31. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index412.js +1 -1
  32. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index49.js +3 -3
  33. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index51.js +3 -3
  34. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index65.js +6 -6
  35. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index91.js +29 -29
  36. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index97.js +24 -24
  37. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  38. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/BillPaySection.js +7 -11
  39. package/package.json +1 -1
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget.js +0 -27
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetMonite/BillPayWidgetMonite.js +0 -46
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetMonite/index.js +0 -1
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/index.js +0 -1
@@ -1,158 +1,6 @@
1
- import * as React from 'react';
2
- import { ReactNode, ComponentType, AnchorHTMLAttributes, ErrorInfo } from 'react';
1
+ import { ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo, ReactElement } from 'react';
3
2
  import { FallbackProps } from 'react-error-boundary';
4
3
 
5
- /**
6
- * Action handlers for custom payment flows in payable operations.
7
- *
8
- * These handlers provide fine-grained control over payment workflows, allowing customers to:
9
- * - Integrate external payment providers
10
- * - Implement custom approval processes or multi-step authentication
11
- * - Add specialized banking solutions or enterprise payment workflows
12
- * - Control UI feedback and data refresh timing after payment completion
13
- *
14
- * @example Custom payment provider integration:
15
- * ```typescript
16
- * const onPay = (id: string, _data?: unknown, actions?: PayActionHandlers) => {
17
- * // Start custom payment flow
18
- * initiatePayment(id)
19
- * .then(() => {
20
- * // Payment successful - update SDK state and show success message
21
- * actions?.resolve({ showToast: true });
22
- * })
23
- * .catch((error) => {
24
- * // Payment failed - update SDK state and show error message
25
- * actions?.reject(error, { showToast: true });
26
- * });
27
- * };
28
- * ```
29
- */
30
- type PayActionHandlers = {
31
- /**
32
- * Call when a custom payment flow has been successfully initiated/completed.
33
- * This triggers SDK's built-in state management: refreshes payable data,
34
- * payment records, and optionally displays success feedback to the user.
35
- *
36
- * @param options.showToast - Whether to display a success toast notification
37
- */
38
- resolve: (options?: {
39
- showToast?: boolean;
40
- }) => void;
41
- /**
42
- * Call when a custom payment flow failed or was cancelled by the user.
43
- * This triggers SDK's built-in state management: refreshes payable data,
44
- * payment records, and optionally displays error feedback to the user.
45
- *
46
- * @param error - Optional error details from the failed payment attempt
47
- * @param options.showToast - Whether to display an error toast notification
48
- */
49
- reject: (error?: unknown, options?: {
50
- showToast?: boolean;
51
- }) => void;
52
- };
53
-
54
- type UsePayableDetailsProps = {
55
- /**
56
- * The ID of the payable
57
- */
58
- id?: string;
59
- /** when provided it takes precedence over component settings */
60
- enableGLCodes?: boolean;
61
- /** when provided it makes the payable open in edit mode */
62
- shouldOpenInEditMode?: boolean;
63
- /**
64
- * Callback function that is called when the payable is saved
65
- *
66
- * @param {string} id - The ID of the payable
67
- *
68
- * @returns {void}
69
- */
70
- onSaved?: (id: string) => void;
71
- /**
72
- * Callback function that is called when the payable is canceled
73
- *
74
- * @param {string} id - The ID of the payable
75
- *
76
- * @returns {void}
77
- */
78
- onCanceled?: (id: string) => void;
79
- /**
80
- * Callback function that is called when the payable is submitted
81
- *
82
- * @param {string} id - The ID of the payable
83
- *
84
- * @returns {void}
85
- */
86
- onSubmitted?: (id: string) => void;
87
- /**
88
- * Callback function that is called when the payable is rejected
89
- *
90
- * @param {string} id - The ID of the payable
91
- *
92
- * @returns {void}
93
- */
94
- onRejected?: (id: string) => void;
95
- /**
96
- * Callback function that is called when the payable is approved
97
- *
98
- * @param {string} id - The ID of the payable
99
- *
100
- * @returns {void}
101
- */
102
- onApproved?: (id: string) => void;
103
- /** Callback function that is called when the payable is reopened
104
- *
105
- * @param {string} id - The ID of the payable
106
- *
107
- * @returns {void}
108
- */
109
- onReopened?: (id: string) => void;
110
- /** Callback function that is called when the payable is deleted
111
- *
112
- * @param {string} id - The ID of the payable
113
- *
114
- * @returns {void}
115
- */
116
- onDeleted?: (id: string) => void;
117
- /**
118
- * Callback function that is called when the user press the Pay button
119
- *
120
- * @param {string} id - The ID of the payable
121
- *
122
- * @returns {void}
123
- */
124
- onPay?: (id: string, _data?: unknown, actions?: PayActionHandlers) => void;
125
- };
126
-
127
- type PayablesProps = {
128
- pageTitleComponent: (children: ReactNode) => ReactNode;
129
- /**
130
- * Enable GL code selection for payable line items.
131
- * When true, users can assign GL codes to individual line items.
132
- * GL codes are fetched from the connected accounting system.
133
- */
134
- enableGLCodes?: boolean;
135
- /** Arrival prop: 'create' opens the create-bill dialog on mount. */
136
- initialView?: 'create';
137
- /** Arrival prop: preselects this counterpart in the create-bill form. */
138
- initialCounterpartId?: string;
139
- } & Partial<Pick<UsePayableDetailsProps, 'onSaved' | 'onCanceled' | 'onSubmitted' | 'onRejected' | 'onApproved' | 'onReopened' | 'onDeleted' | 'onPay'>>;
140
-
141
- type ALIGN_DIALOG_TYPES = 'left' | 'right';
142
- declare module '@mui/material/transitions' {
143
- interface TransitionProps {
144
- alignDialog?: ALIGN_DIALOG_TYPES;
145
- }
146
- }
147
-
148
- interface FinopsThemeColors {
149
- primary?: string;
150
- primaryForeground?: string;
151
- }
152
- interface MoniteWrapperProps {
153
- finopsThemeColors?: FinopsThemeColors;
154
- }
155
-
156
4
  type AuthToken = string | undefined;
157
5
  interface Auth {
158
6
  /**
@@ -778,49 +626,23 @@ interface WidgetProviderProps extends WidgetProviderBaseProps {
778
626
  providerLabels?: Partial<WidgetProviderLabels>;
779
627
  }
780
628
 
781
- type MoniteRegionProviderProps = WidgetProviderProps & MoniteWrapperProps;
782
-
783
- type BillPayWidgetMoniteProps = MoniteRegionProviderProps & Omit<PayablesProps, 'pageTitleComponent'> & {
784
- pageTitleComponent?: PayablesProps['pageTitleComponent'];
785
- };
786
-
787
629
  declare const TabId: {
788
630
  readonly Bills: "bills";
789
631
  readonly Vendors: "vendors";
790
632
  };
791
- type BillPayWidgetNativeTabId = (typeof TabId)[keyof typeof TabId];
792
-
793
- type BillPayWidgetProps = BillPayWidgetMoniteProps & {
794
- /** Tab to open on initial mount. Native implementation only; ignored under `monite`. */
795
- initialTab?: BillPayWidgetNativeTabId;
796
- /** Bank shown as "Powered by {bank}" next to the source account when paying a bill. Native implementation only; ignored under `monite`. */
633
+ type BillPayWidgetTabId = (typeof TabId)[keyof typeof TabId];
634
+ interface BillPayWidgetProps extends WidgetProviderProps {
635
+ /** Tab to open on initial mount. */
636
+ initialTab?: BillPayWidgetTabId;
637
+ /** Bank shown as "Powered by {bank}" next to the source account when paying; omitted hides the badge. */
797
638
  poweredByBankName?: string;
798
639
  /**
799
- * Opens the host's bill-pay settings surface, from a cog beside the bill
800
- * list's "Add bill" button. Rendered only for a user whose scopes reach that
801
- * surface. Native implementation only; under `monite` the equivalent is a
802
- * settings button the host builds into `pageTitleComponent`.
640
+ * Opens the host's bill-pay settings surface, from a cog beside the Bills
641
+ * tab's "Add bill" button. Only rendered for a user whose scopes reach it.
803
642
  */
804
643
  onSettingsClick?: () => void;
805
- };
806
- /**
807
- * BillPay widget entry point — selects the rendering implementation.
808
- *
809
- * BillPay is deliberately **pinned to `monite`** until the Tesouro-native
810
- * (shadcn) build reaches parity (epic EMBD-2171;
811
- * `docs/billpay-usification-shadcn/technical-design.md` §2). `native` is the
812
- * global default across widgets, so BillPay applies its own `monite` fallback
813
- * whenever *nothing* selects an implementation — this is what keeps the native
814
- * build off by default.
815
- *
816
- * An explicit selection is still honored, whether it comes from this widget's
817
- * `implementation` prop or from the provider/global cascade
818
- * (`RootWidgetProvider implementation="native"`, `setGlobalWidgetConfig`). We
819
- * read the *raw* cascade value (undefined when unset) rather than the resolved
820
- * one so the global `native` default does not leak past the pin. The cutover is
821
- * a one-line change: drop the `monite` fallback once native is at parity.
822
- */
823
- declare function BillPayWidget({ implementation, initialTab, onSettingsClick, ...props }: BillPayWidgetProps): React.JSX.Element;
644
+ }
645
+ declare const BillPayWidget: (props: BillPayWidgetProps) => ReactElement;
824
646
 
825
647
  export { BillPayWidget };
826
648
  export type { BillPayWidgetProps };
@@ -1,3 +1,3 @@
1
- import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget.js";
1
+ import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillPayWidget.js";
2
2
  import "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js";
3
3
  export { e as BillPayWidget };
@@ -961,7 +961,7 @@ type CounterpartsWidgetProps = WidgetProviderProps & CounterpartsWidgetOwnProps;
961
961
  *
962
962
  * The workspace-internal component additionally accepts a `passThrough` prop
963
963
  * that tells it to give up its own analytics identity when a composing widget
964
- * (`CustomersWidgetNative`, `BillPayWidgetNative`'s Vendors tab) mounts it to
964
+ * (`CustomersWidgetNative`, `BillPayWidget`'s Vendors tab) mounts it to
965
965
  * inherit the host's identity instead (EMBD-5384). That choice is set **only**
966
966
  * by those composing widgets, never by integrators: an integrator's own
967
967
  * standalone mount must always claim its own identity.
@@ -961,7 +961,7 @@ type CounterpartsWidgetProps = WidgetProviderProps & CounterpartsWidgetOwnProps;
961
961
  *
962
962
  * The workspace-internal component additionally accepts a `passThrough` prop
963
963
  * that tells it to give up its own analytics identity when a composing widget
964
- * (`CustomersWidgetNative`, `BillPayWidgetNative`'s Vendors tab) mounts it to
964
+ * (`CustomersWidgetNative`, `BillPayWidget`'s Vendors tab) mounts it to
965
965
  * inherit the host's identity instead (EMBD-5384). That choice is set **only**
966
966
  * by those composing widgets, never by integrators: an integrator's own
967
967
  * standalone mount must always claim its own identity.
@@ -939,8 +939,7 @@ type CustomersWidgetProps = WidgetProviderProps & CustomersWidgetOwnProps;
939
939
  /**
940
940
  * Customers widget entry point — selects the rendering implementation.
941
941
  *
942
- * Unlike `BillPayWidget`, this one is not pinned to Monite: the native
943
- * implementation (a thin `counterpartType="customer"` wrapper around the
942
+ * The native implementation (a thin `counterpartType="customer"` wrapper around the
944
943
  * published `CounterpartsWidget`) is already at parity, so this simply
945
944
  * inherits the package-wide `native` default. An explicit selection is still
946
945
  * honored, whether from this widget's `implementation` prop or from the
@@ -2997,10 +2997,10 @@ interface WidgetSuiteCardsLabels {
2997
2997
  * A group is shaped as the override its widget accepts, so it is handed down by
2998
2998
  * reference rather than remapped key by key.
2999
2999
  *
3000
- * Two sections have no group: Bill Pay and Invoicing both mount a Monite
3001
- * surface, which carries its own copy and takes no label props at all. They get
3002
- * one when the native builds replace them, and adding a group to an
3003
- * already-optional tree breaks nobody.
3000
+ * Two sections have no group. Invoicing mounts a Monite surface, which carries
3001
+ * its own copy and takes no label props at all. Bill Pay is native, but
3002
+ * `BillPayWidget` does not publish its `labels` yet. Each gets a group when it
3003
+ * can take one, and adding a group to an already-optional tree breaks nobody.
3004
3004
  */
3005
3005
  interface WidgetSuiteSectionContentLabels {
3006
3006
  dashboard: WidgetSuiteDashboardLabels;
@@ -1,2 +1,3 @@
1
- import { BillPayWidget as e } from "./lib/BillPayWidget.js";
1
+ import { BillPayWidget as e } from "./lib/BillPayWidget/BillPayWidget.js";
2
+ import "./lib/BillPayWidget/index.js";
2
3
  export { e as BillPayWidget };
@@ -18,12 +18,12 @@ import "../../../../ui/dist/index.js";
18
18
  import { BillUploadWidget as u } from "../../../../bill-upload/feature/dist/index8.js";
19
19
  import "../../../../bill-upload/feature/dist/index.js";
20
20
  import { BillsTab as d } from "./BillsTab.js";
21
- import { BILL_PAY_WIDGET_NATIVE_LABELS_EN as f } from "./labels.js";
21
+ import { BILL_PAY_WIDGET_LABELS_EN as f } from "./labels.js";
22
22
  import { CounterpartsWidget as p } from "../../../../../counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js";
23
23
  import "../../../../../counterparts-widget/feature/dist/index.js";
24
24
  import { useCallback as m, useEffect as h, useMemo as g, useRef as _, useState as v } from "react";
25
25
  import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
26
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/BillPayWidgetNative.js
26
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillPayWidget.js
27
27
  var S = {
28
28
  Bills: "bills",
29
29
  Vendors: "vendors"
@@ -103,5 +103,6 @@ function T({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gat
103
103
  children: /* @__PURE__ */ b(w, { ...h })
104
104
  });
105
105
  }
106
+ var E = T;
106
107
  //#endregion
107
- export { T as BillPayWidgetNative, T as default };
108
+ export { E as BillPayWidget, E as default, T as BillPayWidgetWithLabels };
@@ -17,7 +17,7 @@ import { PayBillWidget as s } from "../../../../pay-bill/feature/dist/index14.js
17
17
  import "../../../../pay-bill/feature/dist/index.js";
18
18
  import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
19
19
  import { jsx as p, jsxs as m } from "react/jsx-runtime";
20
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/BillsTab.js
20
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js
21
21
  function h({ labels: h, onEnqueueFiles: g, openPayableId: _, onOpenPayableHandled: v, vendorIntent: y, onVendorIntentHandled: b, poweredByBankName: x, onSettingsClick: S }) {
22
22
  let C = d(null), [w, T] = f(), [E, D] = f(), [O, k] = f(!1), [A, j] = f(), [M, N] = f(!1), [P, F] = f(!1), [I, L] = f(null), R = !I || {
23
23
  create: O,
@@ -1,7 +1,7 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/labels.js
1
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/labels.js
2
2
  var e = {
3
3
  bills: "Bills",
4
4
  vendors: "Vendors"
5
5
  }, t = { tabs: e };
6
6
  //#endregion
7
- export { t as BILL_PAY_WIDGET_NATIVE_LABELS_EN, e as DEFAULT_TABS_LABELS };
7
+ export { t as BILL_PAY_WIDGET_LABELS_EN, e as DEFAULT_TABS_LABELS };
@@ -1,4 +1,4 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/testIds.js
1
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/testIds.js
2
2
  var e = {
3
3
  root: "bill-pay-bills-tab",
4
4
  detailsSheet: "bill-pay-details-sheet"
@@ -4,11 +4,11 @@
4
4
  "use client";
5
5
  import { useAnalyticsTrack as e } from "../../../../../shared/feature/dist/lib/analytics/hooks.js";
6
6
  import "../../../../../shared/feature/dist/index.js";
7
- import { Counterparts as t } from "../../../../../monite-sdk/dist/index162.js";
7
+ import { CustomersWidgetAnalyticsEvent as t, WIDGET_NAME as n } from "../analytics/events.js";
8
+ import { Counterparts as r } from "../../../../../monite-sdk/dist/index162.js";
8
9
  import "../../../../../monite-sdk/dist/index.js";
9
- import { MoniteRegionProvider as n } from "../../../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
10
+ import { MoniteRegionProvider as i } from "../../../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
10
11
  import "../../../../../shared/monite-wrapper/feature/dist/index.js";
11
- import { CustomersWidgetAnalyticsEvent as r, WIDGET_NAME as i } from "../analytics/events.js";
12
12
  import { useEffect as a } from "react";
13
13
  import { jsx as o } from "react/jsx-runtime";
14
14
  //#region ../../libs/tesouro-embedded-components-react/customers-widget/feature/dist/lib/CustomersWidgetMonite/CustomersWidgetMonite.js
@@ -16,8 +16,8 @@ var s = (e) => e;
16
16
  function c({ onViewAllDocuments: n, onCreateDocument: i, pageTitleComponent: c = s }) {
17
17
  let l = e();
18
18
  return a(() => {
19
- l(r.Mounted);
20
- }, [l]), /* @__PURE__ */ o(t, {
19
+ l(t.Mounted);
20
+ }, [l]), /* @__PURE__ */ o(r, {
21
21
  type: "customer",
22
22
  pageTitleComponent: c,
23
23
  onCreateInvoiceForCustomer: i && ((e) => i({
@@ -31,9 +31,9 @@ function c({ onViewAllDocuments: n, onCreateDocument: i, pageTitleComponent: c =
31
31
  });
32
32
  }
33
33
  function l({ onViewAllDocuments: e, onCreateDocument: t, pageTitleComponent: r, ...a }) {
34
- return /* @__PURE__ */ o(n, {
34
+ return /* @__PURE__ */ o(i, {
35
35
  ...a,
36
- widgetName: i,
36
+ widgetName: n,
37
37
  children: /* @__PURE__ */ o(c, {
38
38
  onViewAllDocuments: e,
39
39
  onCreateDocument: t,
@@ -5,122 +5,122 @@ import { USStatesEnum as o } from "./index99.js";
5
5
  import { Select as s, SelectContent as c, SelectItem as l, SelectTrigger as u, SelectValue as d } from "./index100.js";
6
6
  import { MoniteCountryShadcn as f } from "./index104.js";
7
7
  import { useRef as p } from "react";
8
- import { Fragment as m, jsx as h, jsxs as g } from "@emotion/react/jsx-runtime";
9
- import { useLingui as _ } from "@lingui/react";
10
- import { twMerge as v } from "tailwind-merge";
8
+ import { twMerge as m } from "tailwind-merge";
9
+ import { Fragment as h, jsx as g, jsxs as _ } from "@emotion/react/jsx-runtime";
10
+ import { useLingui as v } from "@lingui/react";
11
11
  import { Controller as y, useFormContext as b } from "react-hook-form";
12
12
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index105.js
13
13
  var x = ({ hasExistingAddress: x, isLoading: S, isStandalone: C, customerType: w }) => {
14
- let { i18n: T } = _(), { watch: E, control: D } = b(), O = p(null), k = w === "vendor";
15
- return /* @__PURE__ */ g("div", {
16
- className: v("ttw:flex ttw:flex-col ttw:gap-4"),
14
+ let { i18n: T } = v(), { watch: E, control: D } = b(), O = p(null), k = w === "vendor";
15
+ return /* @__PURE__ */ _("div", {
16
+ className: m("ttw:flex ttw:flex-col ttw:gap-4"),
17
17
  ref: O,
18
18
  children: [
19
- C ? /* @__PURE__ */ h("div", {
19
+ C ? /* @__PURE__ */ g("div", {
20
20
  className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3 ttw:pt-6 ttw:pb-7 ttw:border-b ttw:border-border",
21
- children: /* @__PURE__ */ h(t, {
21
+ children: /* @__PURE__ */ g(t, {
22
22
  variant: "body1",
23
23
  className: "ttw:font-medium",
24
24
  children: x ? T._("Editing address") : T._("Adding address")
25
25
  })
26
- }) : /* @__PURE__ */ h(m, { children: !k && /* @__PURE__ */ h("div", {
26
+ }) : /* @__PURE__ */ g(h, { children: !k && /* @__PURE__ */ g("div", {
27
27
  className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-3 ttw:pt-6 ttw:pb-7 ttw:border-b ttw:border-border",
28
- children: /* @__PURE__ */ g(t, {
28
+ children: /* @__PURE__ */ _(t, {
29
29
  variant: "body1",
30
30
  className: "ttw:font-medium",
31
31
  children: [
32
32
  T._("Address"),
33
33
  " ",
34
- /* @__PURE__ */ h("span", {
34
+ /* @__PURE__ */ g("span", {
35
35
  className: "ttw:text-muted-foreground",
36
36
  children: T._("(optional)")
37
37
  })
38
38
  ]
39
39
  })
40
40
  }) }),
41
- /* @__PURE__ */ g("div", {
41
+ /* @__PURE__ */ _("div", {
42
42
  className: "ttw:flex ttw:gap-4",
43
- children: [/* @__PURE__ */ h(y, {
43
+ children: [/* @__PURE__ */ g(y, {
44
44
  name: "line1",
45
45
  control: D,
46
- render: ({ field: t, fieldState: { error: o } }) => /* @__PURE__ */ h(n, { children: /* @__PURE__ */ g(r, { children: [
47
- /* @__PURE__ */ h(a, {
46
+ render: ({ field: t, fieldState: { error: o } }) => /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
47
+ /* @__PURE__ */ g(a, {
48
48
  htmlFor: t.name,
49
49
  children: T._("Street address")
50
50
  }),
51
- /* @__PURE__ */ h(e, {
51
+ /* @__PURE__ */ g(e, {
52
52
  id: t.name,
53
53
  ...t,
54
54
  className: C || k ? "ttw:bg-white" : "",
55
55
  disabled: S,
56
56
  "aria-invalid": !!o || void 0
57
57
  }),
58
- /* @__PURE__ */ h(i, { errors: [o] })
58
+ /* @__PURE__ */ g(i, { errors: [o] })
59
59
  ] }) })
60
- }), /* @__PURE__ */ h(y, {
60
+ }), /* @__PURE__ */ g(y, {
61
61
  name: "line2",
62
62
  control: D,
63
- render: ({ field: o, fieldState: { error: s } }) => /* @__PURE__ */ h(n, { children: /* @__PURE__ */ g(r, { children: [
64
- /* @__PURE__ */ g(a, {
63
+ render: ({ field: o, fieldState: { error: s } }) => /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
64
+ /* @__PURE__ */ _(a, {
65
65
  htmlFor: o.name,
66
66
  className: "ttw:gap-1",
67
- children: [T._("Apt, suite, floor, etc."), k && /* @__PURE__ */ h(t, {
67
+ children: [T._("Apt, suite, floor, etc."), k && /* @__PURE__ */ g(t, {
68
68
  variant: "body2",
69
69
  color: "muted",
70
70
  className: "ttw:leading-snug",
71
71
  children: T._("(optional)")
72
72
  })]
73
73
  }),
74
- /* @__PURE__ */ h(e, {
74
+ /* @__PURE__ */ g(e, {
75
75
  id: o.name,
76
76
  ...o,
77
77
  className: C || k ? "ttw:bg-white" : "",
78
78
  disabled: S,
79
79
  "aria-invalid": !!s || void 0
80
80
  }),
81
- /* @__PURE__ */ h(i, { errors: [s] })
81
+ /* @__PURE__ */ g(i, { errors: [s] })
82
82
  ] }) })
83
83
  })]
84
84
  }),
85
- /* @__PURE__ */ g("div", {
85
+ /* @__PURE__ */ _("div", {
86
86
  className: "ttw:flex ttw:gap-4",
87
- children: [/* @__PURE__ */ h(y, {
87
+ children: [/* @__PURE__ */ g(y, {
88
88
  name: "city",
89
89
  control: D,
90
- render: ({ field: t, fieldState: { error: o } }) => /* @__PURE__ */ h(n, { children: /* @__PURE__ */ g(r, { children: [
91
- /* @__PURE__ */ h(a, {
90
+ render: ({ field: t, fieldState: { error: o } }) => /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
91
+ /* @__PURE__ */ g(a, {
92
92
  htmlFor: t.name,
93
93
  children: T._("City")
94
94
  }),
95
- /* @__PURE__ */ h(e, {
95
+ /* @__PURE__ */ g(e, {
96
96
  id: t.name,
97
97
  ...t,
98
98
  className: C || k ? "ttw:bg-white" : "",
99
99
  disabled: S,
100
100
  "aria-invalid": !!o || void 0
101
101
  }),
102
- /* @__PURE__ */ h(i, { errors: [o] })
102
+ /* @__PURE__ */ g(i, { errors: [o] })
103
103
  ] }) })
104
- }), /* @__PURE__ */ h(y, {
104
+ }), /* @__PURE__ */ g(y, {
105
105
  name: "state",
106
106
  control: D,
107
- render: ({ field: t, fieldState: { error: f } }) => E("country") === "US" ? /* @__PURE__ */ h(n, { children: /* @__PURE__ */ g(r, { children: [
108
- /* @__PURE__ */ h(a, {
107
+ render: ({ field: t, fieldState: { error: f } }) => E("country") === "US" ? /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
108
+ /* @__PURE__ */ g(a, {
109
109
  htmlFor: t.name,
110
110
  children: T._("State")
111
111
  }),
112
- /* @__PURE__ */ g(s, {
112
+ /* @__PURE__ */ _(s, {
113
113
  value: t.value ?? void 0,
114
114
  onValueChange: t.onChange,
115
115
  disabled: S,
116
- children: [/* @__PURE__ */ h(u, {
116
+ children: [/* @__PURE__ */ g(u, {
117
117
  ref: t.ref,
118
118
  onBlur: t.onBlur,
119
119
  "aria-invalid": !!f || void 0,
120
- className: v("ttw:w-full", (C || k) && "ttw:bg-white"),
120
+ className: m("ttw:w-full", (C || k) && "ttw:bg-white"),
121
121
  disabled: S,
122
- children: /* @__PURE__ */ h(d, { placeholder: T._("Select a state") })
123
- }), /* @__PURE__ */ h(c, { children: Object.entries(o).map(([e, t]) => /* @__PURE__ */ g(l, {
122
+ children: /* @__PURE__ */ g(d, { placeholder: T._("Select a state") })
123
+ }), /* @__PURE__ */ g(c, { children: Object.entries(o).map(([e, t]) => /* @__PURE__ */ _(l, {
124
124
  value: e,
125
125
  children: [
126
126
  t,
@@ -129,48 +129,48 @@ var x = ({ hasExistingAddress: x, isLoading: S, isStandalone: C, customerType: w
129
129
  ]
130
130
  }, e)) })]
131
131
  }),
132
- /* @__PURE__ */ h(i, { errors: [f] })
133
- ] }) }) : /* @__PURE__ */ h(n, { children: /* @__PURE__ */ g(r, { children: [
134
- /* @__PURE__ */ h(a, {
132
+ /* @__PURE__ */ g(i, { errors: [f] })
133
+ ] }) }) : /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
134
+ /* @__PURE__ */ g(a, {
135
135
  htmlFor: t.name,
136
136
  children: T._("State")
137
137
  }),
138
- /* @__PURE__ */ h(e, {
138
+ /* @__PURE__ */ g(e, {
139
139
  id: t.name,
140
140
  ...t,
141
141
  className: C || k ? "ttw:bg-white" : "",
142
142
  disabled: S,
143
143
  "aria-invalid": !!f || void 0
144
144
  }),
145
- /* @__PURE__ */ h(i, { errors: [f] })
145
+ /* @__PURE__ */ g(i, { errors: [f] })
146
146
  ] }) })
147
147
  })]
148
148
  }),
149
- /* @__PURE__ */ g("div", {
149
+ /* @__PURE__ */ _("div", {
150
150
  className: "ttw:flex ttw:gap-4",
151
- children: [/* @__PURE__ */ h(y, {
151
+ children: [/* @__PURE__ */ g(y, {
152
152
  name: "postalCode",
153
153
  control: D,
154
- render: ({ field: t, fieldState: { error: o } }) => /* @__PURE__ */ h(n, { children: /* @__PURE__ */ g(r, { children: [
155
- /* @__PURE__ */ h(a, {
154
+ render: ({ field: t, fieldState: { error: o } }) => /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
155
+ /* @__PURE__ */ g(a, {
156
156
  htmlFor: t.name,
157
157
  children: T._("Postal code")
158
158
  }),
159
- /* @__PURE__ */ h(e, {
159
+ /* @__PURE__ */ g(e, {
160
160
  id: t.name,
161
161
  ...t,
162
162
  className: C || k ? "ttw:bg-white" : "",
163
163
  disabled: S,
164
164
  "aria-invalid": !!o || void 0
165
165
  }),
166
- /* @__PURE__ */ h(i, { errors: [o] })
166
+ /* @__PURE__ */ g(i, { errors: [o] })
167
167
  ] }) })
168
- }), /* @__PURE__ */ h(y, {
168
+ }), /* @__PURE__ */ g(y, {
169
169
  name: "country",
170
170
  control: D,
171
- render: ({ field: e, fieldState: { error: t } }) => /* @__PURE__ */ h(n, { children: /* @__PURE__ */ g(r, { children: [
172
- /* @__PURE__ */ h(a, { children: T._("Country") }),
173
- /* @__PURE__ */ h(f, {
171
+ render: ({ field: e, fieldState: { error: t } }) => /* @__PURE__ */ g(n, { children: /* @__PURE__ */ _(r, { children: [
172
+ /* @__PURE__ */ g(a, { children: T._("Country") }),
173
+ /* @__PURE__ */ g(f, {
174
174
  value: e.value,
175
175
  className: C || k ? "ttw:bg-white" : "",
176
176
  onChange: e.onChange,
@@ -179,7 +179,7 @@ var x = ({ hasExistingAddress: x, isLoading: S, isStandalone: C, customerType: w
179
179
  container: O?.current,
180
180
  allowedCountries: ["US"]
181
181
  }),
182
- /* @__PURE__ */ h(i, { errors: [t] })
182
+ /* @__PURE__ */ g(i, { errors: [t] })
183
183
  ] }) })
184
184
  })]
185
185
  })