@tesouro/embedded-components-react 0.2.307 → 0.2.309
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/README.md +27 -23
- package/dist/experimental/WidgetSuite.d.ts +15 -17
- package/dist/experimental/index.d.ts +15 -17
- package/dist/index.d.ts +23 -1
- package/dist/lib/SettingsWidget.d.ts +7 -0
- package/dist/lib/TransfersWidget.d.ts +16 -1
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index7.js +132 -110
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/UploadReceiptWidget/labels.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +33 -33
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index4.js +174 -164
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index5.js +55 -52
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index6.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -546,25 +546,26 @@ A composite settings widget that combines Monite document settings, tags, GL cod
|
|
|
546
546
|
|
|
547
547
|
#### Props
|
|
548
548
|
|
|
549
|
-
| Prop | Type | Default | Description
|
|
550
|
-
| ------------------------- | -------------------------------------------- | --------------------------------- |
|
|
551
|
-
| `acceptInviteRedirectUri` | `string` | Same-origin `/accept-invite` | Forwarded to the Team section's widget — allowlisted URL invite emails link to. Defaults to `${window.location.origin}/accept-invite`; set it when the host app's registered landing route differs from the widget's same-origin default, or the origin is not on the OIDC redirect-URI allowlist (preview/localhost).
|
|
552
|
-
| `labels` | `Partial<Labels>` | English labels | Overrides the settings heading copy.
|
|
553
|
-
| `featureLabels` | `Partial<FeatureLabels>` | English labels | Overrides section labels.
|
|
554
|
-
| `profileContent` | `ReactNode` | Profile widget | Replaces the profile section content.
|
|
555
|
-
| `teamContent` | `ReactNode` | Empty | Supplies the team section content.
|
|
556
|
-
| `invoiceContent` | `ReactNode` | Monite template settings | Replaces invoice settings content.
|
|
557
|
-
| `billPayContent` | `ReactNode` | Monite approval policies | Replaces bill-pay settings content.
|
|
558
|
-
| `accountingContent` | `ReactNode` | GL code table widget | Replaces accounting content.
|
|
559
|
-
| `tagsContent` | `ReactNode` | Monite tags | Replaces tags content.
|
|
560
|
-
| `expenseContent` | `ReactNode` | Expense policies and requirements | Replaces expense content.
|
|
561
|
-
| `profileContactUrl` | `string` | `undefined` | Forwarded to the Profile section's widget — where its "to change this information, contact your bank" line links. Left unset, the card shows the plain unlinked sentence instead; the bank name comes from widget init.
|
|
562
|
-
| `selectedSection` | `SettingsWidgetSectionId` | `undefined` | The section to show. Leave unset to let the widget own the selection; supply it (with `onSelectedSectionChange`) to drive navigation from a route or search param. A section the user's scopes hide falls back to the first visible one.
|
|
563
|
-
| `
|
|
564
|
-
| `
|
|
565
|
-
| `
|
|
566
|
-
| `
|
|
567
|
-
| `
|
|
549
|
+
| Prop | Type | Default | Description |
|
|
550
|
+
| ------------------------- | -------------------------------------------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
551
|
+
| `acceptInviteRedirectUri` | `string` | Same-origin `/accept-invite` | Forwarded to the Team section's widget — allowlisted URL invite emails link to. Defaults to `${window.location.origin}/accept-invite`; set it when the host app's registered landing route differs from the widget's same-origin default, or the origin is not on the OIDC redirect-URI allowlist (preview/localhost). |
|
|
552
|
+
| `labels` | `Partial<Labels>` | English labels | Overrides the settings heading copy. |
|
|
553
|
+
| `featureLabels` | `Partial<FeatureLabels>` | English labels | Overrides section labels. |
|
|
554
|
+
| `profileContent` | `ReactNode` | Profile widget | Replaces the profile section content. |
|
|
555
|
+
| `teamContent` | `ReactNode` | Empty | Supplies the team section content. |
|
|
556
|
+
| `invoiceContent` | `ReactNode` | Monite template settings | Replaces invoice settings content. |
|
|
557
|
+
| `billPayContent` | `ReactNode` | Monite approval policies | Replaces bill-pay settings content. |
|
|
558
|
+
| `accountingContent` | `ReactNode` | GL code table widget | Replaces accounting content. |
|
|
559
|
+
| `tagsContent` | `ReactNode` | Monite tags | Replaces tags content. |
|
|
560
|
+
| `expenseContent` | `ReactNode` | Expense policies and requirements | Replaces expense content. |
|
|
561
|
+
| `profileContactUrl` | `string` | `undefined` | Forwarded to the Profile section's widget — where its "to change this information, contact your bank" line links. Left unset, the card shows the plain unlinked sentence instead; the bank name comes from widget init. |
|
|
562
|
+
| `selectedSection` | `SettingsWidgetSectionId` | `undefined` | The section to show. Leave unset to let the widget own the selection; supply it (with `onSelectedSectionChange`) to drive navigation from a route or search param. A section the user's scopes hide falls back to the first visible one. |
|
|
563
|
+
| `defaultSelectedSection` | `SettingsWidgetSectionId` | First visible section | The section to open on, for a host that wants a deep link without owning the selection. Read once per mount and ignored when `selectedSection` is supplied. Scopes arrive with widget init, so a section this names opens as soon as it becomes visible; one the user's scopes never grant leaves the first visible section on screen. |
|
|
564
|
+
| `onSelectedSectionChange` | `(section: SettingsWidgetSectionId) => void` | `undefined` | Called with the id of the section the user selected. Fires whether or not `selectedSection` is supplied, so a host can mirror the selection into its URL without taking ownership of it. |
|
|
565
|
+
| `additionalSections` | `SettingsWidgetAdditionalSection[]` | `undefined` | Host-owned sections rendered alongside the built-in ones. Each is `{ id, label, content }` plus an optional `after` naming the built-in section to place it behind. Unlike the built-ins, these are not scope-gated. |
|
|
566
|
+
| `helpContactUrl` | `string` | `undefined` | Forwarded to the Help section's widget — where its "Contact Us" line links (a support page URL or a `mailto:`). The line is hidden while unset, since the package has no tenant-agnostic support address to fall back on; the bank name in that line comes from widget init. |
|
|
567
|
+
| `helpContent` | `ReactNode` | Help widget | Replaces the help section content. |
|
|
568
|
+
| `finopsThemeColors` | `FinopsThemeColors` | `undefined` | Optional Monite theme color overrides. |
|
|
568
569
|
|
|
569
570
|
### TagsWidget
|
|
570
571
|
|
|
@@ -599,10 +600,13 @@ A self-contained banking widget for creating book or ACH transfers and reviewing
|
|
|
599
600
|
|
|
600
601
|
#### Props
|
|
601
602
|
|
|
602
|
-
| Prop
|
|
603
|
-
|
|
|
604
|
-
| `labels`
|
|
605
|
-
| `featureLabels`
|
|
603
|
+
| Prop | Type | Default | Description |
|
|
604
|
+
| ---------------------------- | --------------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
605
|
+
| `labels` | `Partial<TransfersWidgetLabels>` | English labels | Override shell and modal copy. |
|
|
606
|
+
| `featureLabels` | `Partial<TransfersWidgetFeatureLabels>` | English defaults | Override routing copy, fallbacks, default currency, and ACH SEC code. |
|
|
607
|
+
| `isTransferMoneyOpen` | `boolean` | Uncontrolled | Whether the transfer money modal is showing. Supplying it makes the modal controlled: the widget reports every open and close and changes nothing until you re-supply a new value. |
|
|
608
|
+
| `defaultIsTransferMoneyOpen` | `boolean` | `false` | The modal's state on first render, for a host that only wants to seed it. Ignored when `isTransferMoneyOpen` is supplied. |
|
|
609
|
+
| `onTransferMoneyOpenChange` | `(open: boolean) => void` | `undefined` | Called on every open and close — the **Transfer money** CTA, the modal's own dismissals (Esc, overlay, close), and the close after a completed transfer. |
|
|
606
610
|
|
|
607
611
|
### UploadReceiptWidget
|
|
608
612
|
|
|
@@ -784,11 +784,13 @@ interface WidgetSuiteCardsSelection {
|
|
|
784
784
|
}
|
|
785
785
|
interface WidgetSuiteSettingsSelection {
|
|
786
786
|
/**
|
|
787
|
-
* The settings section on screen.
|
|
788
|
-
*
|
|
789
|
-
*
|
|
790
|
-
*
|
|
791
|
-
* value
|
|
787
|
+
* The settings section on screen. The suite holds this one, so it survives
|
|
788
|
+
* leaving the section — but hands it down as the widget's
|
|
789
|
+
* `defaultSelectedSection`, never its controlled `selectedSection`. The widget
|
|
790
|
+
* substitutes another section when this one is not available to the user and
|
|
791
|
+
* reports nothing when it does, so a controlled value could disagree with the
|
|
792
|
+
* screen with no way to recover; an initial one just loses a deep link the
|
|
793
|
+
* user could never have reached.
|
|
792
794
|
*/
|
|
793
795
|
section?: SettingsWidgetSectionId;
|
|
794
796
|
}
|
|
@@ -814,14 +816,11 @@ interface WidgetSuiteSelection {
|
|
|
814
816
|
settings?: WidgetSuiteSettingsSelection;
|
|
815
817
|
}
|
|
816
818
|
/**
|
|
817
|
-
* Where the suite can *open*, which is
|
|
818
|
-
*
|
|
819
|
-
*
|
|
820
|
-
*
|
|
821
|
-
* Derived rather than hand-written, so each key stays in exactly one of the two
|
|
822
|
-
* types as the widgets behind them gain the props they are missing.
|
|
819
|
+
* Where the suite can *open*, which is narrower than what it can be driven to
|
|
820
|
+
* whenever a key's widget takes no initial value. Every key has both halves
|
|
821
|
+
* today, so nothing is omitted; this is where the next controlled-only key goes.
|
|
823
822
|
*/
|
|
824
|
-
type WidgetSuiteDefaultSelection =
|
|
823
|
+
type WidgetSuiteDefaultSelection = WidgetSuiteSelection;
|
|
825
824
|
interface WidgetSuiteCardsSelectionSnapshot {
|
|
826
825
|
cardId: string | null;
|
|
827
826
|
pagination: CardsWidgetPaginationInput | undefined;
|
|
@@ -871,8 +870,7 @@ interface WidgetSuiteProps extends WidgetProviderProps {
|
|
|
871
870
|
* Where the suite opens, for a host that wants a deep link but not ownership.
|
|
872
871
|
* Read once per mount, and ignored per key when `selection` names that key.
|
|
873
872
|
*
|
|
874
|
-
* Carries every key `selection` does
|
|
875
|
-
* {@link WidgetSuiteDefaultSelection}.
|
|
873
|
+
* Carries every key `selection` does — see {@link WidgetSuiteDefaultSelection}.
|
|
876
874
|
*/
|
|
877
875
|
defaultSelection?: WidgetSuiteDefaultSelection;
|
|
878
876
|
/**
|
|
@@ -938,9 +936,9 @@ interface WidgetSuiteProps extends WidgetProviderProps {
|
|
|
938
936
|
* Navigation is one `selection` object a host can drive key by key, published to
|
|
939
937
|
* the sections through `WidgetSuiteProvider`. Only the open panel is mounted, so
|
|
940
938
|
* a key the suite holds survives leaving a section and coming back and a key it
|
|
941
|
-
* does not hold is lost: today Accounts remembers its open account
|
|
942
|
-
* open card, while Bill Pay forgets its tab
|
|
943
|
-
* list its cursor. That split is the widgets' current shape rather than a
|
|
939
|
+
* does not hold is lost: today Accounts remembers its open account, Cards its
|
|
940
|
+
* open card and Settings its section, while Bill Pay forgets its tab and each
|
|
941
|
+
* card list its cursor. That split is the widgets' current shape rather than a
|
|
944
942
|
* decision — see `WidgetSuiteSelection` for the ticket behind each gap.
|
|
945
943
|
*/
|
|
946
944
|
declare function WidgetSuite({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, implementation, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, ...innerProps }: WidgetSuiteProps): React.JSX.Element;
|
|
@@ -784,11 +784,13 @@ interface WidgetSuiteCardsSelection {
|
|
|
784
784
|
}
|
|
785
785
|
interface WidgetSuiteSettingsSelection {
|
|
786
786
|
/**
|
|
787
|
-
* The settings section on screen.
|
|
788
|
-
*
|
|
789
|
-
*
|
|
790
|
-
*
|
|
791
|
-
* value
|
|
787
|
+
* The settings section on screen. The suite holds this one, so it survives
|
|
788
|
+
* leaving the section — but hands it down as the widget's
|
|
789
|
+
* `defaultSelectedSection`, never its controlled `selectedSection`. The widget
|
|
790
|
+
* substitutes another section when this one is not available to the user and
|
|
791
|
+
* reports nothing when it does, so a controlled value could disagree with the
|
|
792
|
+
* screen with no way to recover; an initial one just loses a deep link the
|
|
793
|
+
* user could never have reached.
|
|
792
794
|
*/
|
|
793
795
|
section?: SettingsWidgetSectionId;
|
|
794
796
|
}
|
|
@@ -814,14 +816,11 @@ interface WidgetSuiteSelection {
|
|
|
814
816
|
settings?: WidgetSuiteSettingsSelection;
|
|
815
817
|
}
|
|
816
818
|
/**
|
|
817
|
-
* Where the suite can *open*, which is
|
|
818
|
-
*
|
|
819
|
-
*
|
|
820
|
-
*
|
|
821
|
-
* Derived rather than hand-written, so each key stays in exactly one of the two
|
|
822
|
-
* types as the widgets behind them gain the props they are missing.
|
|
819
|
+
* Where the suite can *open*, which is narrower than what it can be driven to
|
|
820
|
+
* whenever a key's widget takes no initial value. Every key has both halves
|
|
821
|
+
* today, so nothing is omitted; this is where the next controlled-only key goes.
|
|
823
822
|
*/
|
|
824
|
-
type WidgetSuiteDefaultSelection =
|
|
823
|
+
type WidgetSuiteDefaultSelection = WidgetSuiteSelection;
|
|
825
824
|
interface WidgetSuiteCardsSelectionSnapshot {
|
|
826
825
|
cardId: string | null;
|
|
827
826
|
pagination: CardsWidgetPaginationInput | undefined;
|
|
@@ -871,8 +870,7 @@ interface WidgetSuiteProps extends WidgetProviderProps {
|
|
|
871
870
|
* Where the suite opens, for a host that wants a deep link but not ownership.
|
|
872
871
|
* Read once per mount, and ignored per key when `selection` names that key.
|
|
873
872
|
*
|
|
874
|
-
* Carries every key `selection` does
|
|
875
|
-
* {@link WidgetSuiteDefaultSelection}.
|
|
873
|
+
* Carries every key `selection` does — see {@link WidgetSuiteDefaultSelection}.
|
|
876
874
|
*/
|
|
877
875
|
defaultSelection?: WidgetSuiteDefaultSelection;
|
|
878
876
|
/**
|
|
@@ -938,9 +936,9 @@ interface WidgetSuiteProps extends WidgetProviderProps {
|
|
|
938
936
|
* Navigation is one `selection` object a host can drive key by key, published to
|
|
939
937
|
* the sections through `WidgetSuiteProvider`. Only the open panel is mounted, so
|
|
940
938
|
* a key the suite holds survives leaving a section and coming back and a key it
|
|
941
|
-
* does not hold is lost: today Accounts remembers its open account
|
|
942
|
-
* open card, while Bill Pay forgets its tab
|
|
943
|
-
* list its cursor. That split is the widgets' current shape rather than a
|
|
939
|
+
* does not hold is lost: today Accounts remembers its open account, Cards its
|
|
940
|
+
* open card and Settings its section, while Bill Pay forgets its tab and each
|
|
941
|
+
* card list its cursor. That split is the widgets' current shape rather than a
|
|
944
942
|
* decision — see `WidgetSuiteSelection` for the ticket behind each gap.
|
|
945
943
|
*/
|
|
946
944
|
declare function WidgetSuite({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, implementation, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, ...innerProps }: WidgetSuiteProps): React.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -4271,6 +4271,13 @@ interface SettingsWidgetProps extends MoniteRegionProviderProps {
|
|
|
4271
4271
|
* drive navigation from a route, a search param, or host state. A section
|
|
4272
4272
|
* hidden by the user's scopes falls back to the first visible one. */
|
|
4273
4273
|
selectedSection?: SettingsWidgetSectionId;
|
|
4274
|
+
/** The section to open on, for a host that wants a deep link without taking
|
|
4275
|
+
* ownership of the selection. Ignored when
|
|
4276
|
+
* {@link SettingsWidgetProps.selectedSection} is supplied; defaults to the
|
|
4277
|
+
* first visible section. Scopes arrive with the init response, so a section
|
|
4278
|
+
* this names opens as soon as it becomes visible, and one the user's scopes
|
|
4279
|
+
* never grant leaves the first visible section on screen. */
|
|
4280
|
+
defaultSelectedSection?: SettingsWidgetSectionId;
|
|
4274
4281
|
/** Called with the id of the section the user selected. Fires whether or not
|
|
4275
4282
|
* {@link SettingsWidgetProps.selectedSection} is supplied, so a host can mirror
|
|
4276
4283
|
* the selection into its URL without taking ownership of it. */
|
|
@@ -4709,10 +4716,25 @@ declare const DEFAULT_FEATURE_LABELS: FeatureLabels;
|
|
|
4709
4716
|
interface TransfersWidgetPassthroughProps {
|
|
4710
4717
|
labels?: Partial<TransfersWidgetLabels>;
|
|
4711
4718
|
featureLabels?: Partial<FeatureLabels>;
|
|
4719
|
+
/**
|
|
4720
|
+
* Whether the transfer money modal is showing. Supplying it makes the modal
|
|
4721
|
+
* controlled: the widget reports every open and close through
|
|
4722
|
+
* `onTransferMoneyOpenChange` and changes nothing on screen until the host
|
|
4723
|
+
* supplies a new value. Omit to let the widget own it.
|
|
4724
|
+
*/
|
|
4725
|
+
isTransferMoneyOpen?: boolean;
|
|
4726
|
+
/** The modal's state on first render, for a host that only wants to seed it. */
|
|
4727
|
+
defaultIsTransferMoneyOpen?: boolean;
|
|
4728
|
+
/**
|
|
4729
|
+
* Called on every open and close — the CTA, the modal's own dismissals, and
|
|
4730
|
+
* the close that follows a completed transfer — whether or not the modal is
|
|
4731
|
+
* controlled.
|
|
4732
|
+
*/
|
|
4733
|
+
onTransferMoneyOpenChange?: (open: boolean) => void;
|
|
4712
4734
|
}
|
|
4713
4735
|
interface TransfersWidgetProps extends WidgetProviderProps, TransfersWidgetPassthroughProps {
|
|
4714
4736
|
}
|
|
4715
|
-
declare function TransfersWidget({ labels, featureLabels, ...widgetProviderProps }: TransfersWidgetProps): React.JSX.Element;
|
|
4737
|
+
declare function TransfersWidget({ labels, featureLabels, isTransferMoneyOpen, defaultIsTransferMoneyOpen, onTransferMoneyOpenChange, ...widgetProviderProps }: TransfersWidgetProps): React.JSX.Element;
|
|
4716
4738
|
|
|
4717
4739
|
/**
|
|
4718
4740
|
* Public {@link WidgetProvider} — the integrator-facing provider.
|
|
@@ -697,6 +697,13 @@ interface SettingsWidgetProps extends MoniteRegionProviderProps {
|
|
|
697
697
|
* drive navigation from a route, a search param, or host state. A section
|
|
698
698
|
* hidden by the user's scopes falls back to the first visible one. */
|
|
699
699
|
selectedSection?: SettingsWidgetSectionId;
|
|
700
|
+
/** The section to open on, for a host that wants a deep link without taking
|
|
701
|
+
* ownership of the selection. Ignored when
|
|
702
|
+
* {@link SettingsWidgetProps.selectedSection} is supplied; defaults to the
|
|
703
|
+
* first visible section. Scopes arrive with the init response, so a section
|
|
704
|
+
* this names opens as soon as it becomes visible, and one the user's scopes
|
|
705
|
+
* never grant leaves the first visible section on screen. */
|
|
706
|
+
defaultSelectedSection?: SettingsWidgetSectionId;
|
|
700
707
|
/** Called with the id of the section the user selected. Fires whether or not
|
|
701
708
|
* {@link SettingsWidgetProps.selectedSection} is supplied, so a host can mirror
|
|
702
709
|
* the selection into its URL without taking ownership of it. */
|
|
@@ -680,10 +680,25 @@ declare const DEFAULT_FEATURE_LABELS: FeatureLabels;
|
|
|
680
680
|
interface TransfersWidgetPassthroughProps {
|
|
681
681
|
labels?: Partial<TransfersWidgetLabels>;
|
|
682
682
|
featureLabels?: Partial<FeatureLabels>;
|
|
683
|
+
/**
|
|
684
|
+
* Whether the transfer money modal is showing. Supplying it makes the modal
|
|
685
|
+
* controlled: the widget reports every open and close through
|
|
686
|
+
* `onTransferMoneyOpenChange` and changes nothing on screen until the host
|
|
687
|
+
* supplies a new value. Omit to let the widget own it.
|
|
688
|
+
*/
|
|
689
|
+
isTransferMoneyOpen?: boolean;
|
|
690
|
+
/** The modal's state on first render, for a host that only wants to seed it. */
|
|
691
|
+
defaultIsTransferMoneyOpen?: boolean;
|
|
692
|
+
/**
|
|
693
|
+
* Called on every open and close — the CTA, the modal's own dismissals, and
|
|
694
|
+
* the close that follows a completed transfer — whether or not the modal is
|
|
695
|
+
* controlled.
|
|
696
|
+
*/
|
|
697
|
+
onTransferMoneyOpenChange?: (open: boolean) => void;
|
|
683
698
|
}
|
|
684
699
|
interface TransfersWidgetProps extends WidgetProviderProps, TransfersWidgetPassthroughProps {
|
|
685
700
|
}
|
|
686
|
-
declare function TransfersWidget({ labels, featureLabels, ...widgetProviderProps }: TransfersWidgetProps): React.JSX.Element;
|
|
701
|
+
declare function TransfersWidget({ labels, featureLabels, isTransferMoneyOpen, defaultIsTransferMoneyOpen, onTransferMoneyOpenChange, ...widgetProviderProps }: TransfersWidgetProps): React.JSX.Element;
|
|
687
702
|
|
|
688
703
|
export { DEFAULT_FEATURE_LABELS as TRANSFERS_FEATURE_LABELS_EN, TRANSFERS_WIDGET_LABELS_EN, TransfersWidget };
|
|
689
704
|
export type { FeatureLabels as TransfersWidgetFeatureLabels, TransfersWidgetLabels, TransfersWidgetProps };
|
package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index7.js
CHANGED
|
@@ -11,164 +11,186 @@ import { TESOURO_NEW_EMBEDDED_BANK_ACCOUNT_CREATED_SUCCESS_EVENT as ee, emitWidg
|
|
|
11
11
|
import { useWidgetConfig as ne, useWidgetError as re, useWidgetLoading as ie } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
12
12
|
import "../../../shared/feature/dist/index.js";
|
|
13
13
|
import { BankAccountsWidgetAnalyticsEvent as i } from "./index2.js";
|
|
14
|
-
import { copyTextToClipboard as ae, formatAmountLabel as a, formatTotalAvailableBalanceLabel as oe, maskAccountNumber as
|
|
15
|
-
import { DEFAULT_FEATURE_LABELS as
|
|
16
|
-
import { getBankAccountsPermissions as
|
|
17
|
-
import { toAccessRows as
|
|
18
|
-
import { DEFAULT_LABELS as
|
|
14
|
+
import { copyTextToClipboard as ae, formatAmountLabel as a, formatTotalAvailableBalanceLabel as oe, maskAccountNumber as se } from "./index3.js";
|
|
15
|
+
import { DEFAULT_FEATURE_LABELS as ce } from "./index4.js";
|
|
16
|
+
import { getBankAccountsPermissions as le } from "./index5.js";
|
|
17
|
+
import { toAccessRows as ue, toOrganizationRoleOptions as de, toTeamMembers as fe } from "./index6.js";
|
|
18
|
+
import { DEFAULT_LABELS as pe } from "../../ui/dist/lib/labels.js";
|
|
19
19
|
import "../../ui/dist/index.js";
|
|
20
|
-
import { useCreateBankAccountMutation as
|
|
21
|
-
import { useGrantBankAccountAccessMutation as
|
|
22
|
-
import { useAllOrganizationUsersQuery as
|
|
20
|
+
import { useCreateBankAccountMutation as me } from "../../data-access/dist/index3.js";
|
|
21
|
+
import { useGrantBankAccountAccessMutation as he } from "../../data-access/dist/index4.js";
|
|
22
|
+
import { useAllOrganizationUsersQuery as ge } from "../../data-access/dist/index5.js";
|
|
23
23
|
import "../../data-access/dist/index.js";
|
|
24
|
-
import { filterRolesForOrganization as
|
|
25
|
-
import { useCallback as
|
|
26
|
-
import { useControllableState as
|
|
24
|
+
import { filterRolesForOrganization as _e } from "../../../../shared/util-validation/dist/index6.js";
|
|
25
|
+
import { useCallback as o, useEffect as s, useMemo as c, useRef as ve, useState as l } from "react";
|
|
26
|
+
import { useControllableState as ye } from "@radix-ui/react-use-controllable-state";
|
|
27
27
|
//#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index7.js
|
|
28
28
|
var u = { nickname: "" };
|
|
29
|
-
function d(
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
function d(e, t) {
|
|
30
|
+
return e !== void 0 && t !== void 0 && e !== t;
|
|
31
|
+
}
|
|
32
|
+
function f({ labels: a, featureLabels: se, isBankingTaglineVisible: f = !0, bankLogoSrc: xe, bankLogoAlt: Se, depositAgreementUrl: Ce, selectedAccountId: we, defaultSelectedAccountId: Te, onSelectedAccountIdChange: Ee, "data-testid": De } = {}) {
|
|
33
|
+
let p = {
|
|
34
|
+
...pe,
|
|
32
35
|
...a
|
|
33
|
-
},
|
|
34
|
-
...
|
|
35
|
-
...
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
}, m = {
|
|
37
|
+
...ce,
|
|
38
|
+
...se
|
|
39
|
+
}, h = r(), { organizationId: g, widgetToken: Oe, initResponse: _ } = ne(), ke = ie(), v = !!re(), y = !!(g && Oe), b = c(() => le(_?.scopes), [_?.scopes]), Ae = y && b.canRead && !!_, x = _?.userId ?? void 0, [S, je] = l(g);
|
|
40
|
+
g !== void 0 && g !== S && je(g);
|
|
41
|
+
let [C, Me] = l(x);
|
|
42
|
+
x !== void 0 && x !== C && Me(x);
|
|
43
|
+
let [Ne, w] = ye({
|
|
44
|
+
prop: we,
|
|
45
|
+
defaultProp: Te ?? null,
|
|
46
|
+
onChange: Ee,
|
|
40
47
|
caller: "BankAccountsWidget"
|
|
41
|
-
}),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
}), T = ve({
|
|
49
|
+
organizationId: S,
|
|
50
|
+
userId: C
|
|
51
|
+
}), Pe = d(T.current.organizationId, S) || d(T.current.userId, C);
|
|
52
|
+
s(() => {
|
|
53
|
+
let e = T.current;
|
|
54
|
+
T.current = {
|
|
55
|
+
organizationId: S,
|
|
56
|
+
userId: C
|
|
57
|
+
}, (d(e.organizationId, S) || d(e.userId, C)) && w(null);
|
|
58
|
+
}, [
|
|
59
|
+
S,
|
|
60
|
+
C,
|
|
61
|
+
w
|
|
62
|
+
]);
|
|
63
|
+
let E = Pe ? null : Ne, D = Ae && !E, O = o((e) => {
|
|
64
|
+
w(e);
|
|
65
|
+
}, [w]), [k, Fe] = l(!1), [A, j] = l(u), [M, N] = l([]), [Ie, P] = l(!1), [F, I] = l(), [Le, Re] = l({}), [L, R] = l({});
|
|
66
|
+
s(() => {
|
|
67
|
+
h(i.Mounted);
|
|
68
|
+
}, [h]);
|
|
69
|
+
let z = t({ enabled: D }), B = me(), V = he(), H = k, U = ge({ enabled: H }), W = n({ enabled: H }), G = c(() => {
|
|
70
|
+
let e = W.data?.data ?? [], t = g ? _e(e, {
|
|
71
|
+
organizationId: g,
|
|
72
|
+
organizationTypes: _?.organizationTypes ?? []
|
|
51
73
|
}) : e;
|
|
52
|
-
return
|
|
74
|
+
return fe(U.data?.data ?? [], de(t));
|
|
53
75
|
}, [
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
]),
|
|
59
|
-
await ae(r) && (e.success(n === "account" ?
|
|
76
|
+
W.data?.data,
|
|
77
|
+
U.data?.data,
|
|
78
|
+
g,
|
|
79
|
+
_?.organizationTypes
|
|
80
|
+
]), K = U.isLoading || U.isFetchingNextPage || !!U.hasNextPage || W.isResolving, q = !K && !U.isError, J = D ? z.data?.data ?? [] : [], Y = [.../* @__PURE__ */ new Set([...G.filter((e) => e.locked).map((e) => e.id), ...M])], X = _?.bankName?.trim() ?? "", ze = _?.vspName?.trim() ?? "", Be = Ce?.trim() || void 0, Z = y && b.canWrite, Q = !z.hasNextPage && !z.isFetchingNextPage, Ve = c(() => Q ? oe(J) : void 0, [J, Q]), He = J.length > 1 && b.canRead && Q, $ = o(async (t, n, r) => {
|
|
81
|
+
await ae(r) && (e.success(n === "account" ? m.copyAccountNumberToast : m.copyRoutingNumberToast), R((e) => ({
|
|
60
82
|
...e,
|
|
61
83
|
[t]: n
|
|
62
84
|
})), window.setTimeout(() => {
|
|
63
|
-
|
|
85
|
+
R((e) => ({
|
|
64
86
|
...e,
|
|
65
87
|
[t]: void 0
|
|
66
88
|
}));
|
|
67
89
|
}, 2e3));
|
|
68
|
-
}, [
|
|
69
|
-
isAccountNumberVisible:
|
|
70
|
-
isAccountNumberCopied:
|
|
71
|
-
isRoutingNumberCopied:
|
|
72
|
-
onToggleAccountNumberVisibility: () =>
|
|
90
|
+
}, [m.copyAccountNumberToast, m.copyRoutingNumberToast]), Ue = c(() => J.map((e) => be(e, m, {
|
|
91
|
+
isAccountNumberVisible: Le[e.id] ?? !1,
|
|
92
|
+
isAccountNumberCopied: L[e.id] === "account",
|
|
93
|
+
isRoutingNumberCopied: L[e.id] === "routing",
|
|
94
|
+
onToggleAccountNumberVisibility: () => Re((t) => ({
|
|
73
95
|
...t,
|
|
74
96
|
[e.id]: !t[e.id]
|
|
75
97
|
})),
|
|
76
|
-
onCopyAccountNumber: () => void
|
|
77
|
-
onCopyRoutingNumber: () => void
|
|
98
|
+
onCopyAccountNumber: () => void $(e.id, "account", e.accountNumber),
|
|
99
|
+
onCopyRoutingNumber: () => void $(e.id, "routing", e.routingNumber),
|
|
78
100
|
onSelect: () => {
|
|
79
|
-
|
|
101
|
+
O(e.id), h(i.AccountSelected, { accountId: e.id });
|
|
80
102
|
}
|
|
81
103
|
})), [
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
]),
|
|
90
|
-
|
|
104
|
+
J,
|
|
105
|
+
Le,
|
|
106
|
+
L,
|
|
107
|
+
m,
|
|
108
|
+
$,
|
|
109
|
+
O,
|
|
110
|
+
h
|
|
111
|
+
]), We = (t) => {
|
|
112
|
+
V.mutate({
|
|
91
113
|
path: { id: t },
|
|
92
|
-
body: { userIds:
|
|
114
|
+
body: { userIds: Y }
|
|
93
115
|
}, { onSuccess: () => {
|
|
94
|
-
te(ee), e.success(
|
|
116
|
+
te(ee), e.success(m.createSuccessToast), j(u), N([]), I(void 0), P(!1), Fe(!1);
|
|
95
117
|
} });
|
|
96
|
-
},
|
|
97
|
-
if (
|
|
98
|
-
if (
|
|
99
|
-
|
|
118
|
+
}, Ge = () => {
|
|
119
|
+
if (Z && q) {
|
|
120
|
+
if (A.nickname.trim() === "") {
|
|
121
|
+
P(!0);
|
|
100
122
|
return;
|
|
101
123
|
}
|
|
102
|
-
if (
|
|
124
|
+
if (Y.length === 0) {
|
|
103
125
|
console.warn("No team members selected on submit");
|
|
104
126
|
return;
|
|
105
127
|
}
|
|
106
|
-
if (
|
|
107
|
-
|
|
128
|
+
if (F) {
|
|
129
|
+
We(F);
|
|
108
130
|
return;
|
|
109
131
|
}
|
|
110
|
-
|
|
111
|
-
|
|
132
|
+
B.mutate({ body: { nickname: A.nickname.trim() } }, { onSuccess: (e) => {
|
|
133
|
+
h(i.AccountCreated, { accountId: e?.id }), e?.id && (I(e.id), We(e.id));
|
|
112
134
|
} });
|
|
113
135
|
}
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
},
|
|
117
|
-
e && !
|
|
118
|
-
},
|
|
119
|
-
selectedUserIds:
|
|
120
|
-
disabled:
|
|
121
|
-
fallbackTooltip:
|
|
122
|
-
onUserToggle:
|
|
136
|
+
}, Ke = (e, t) => {
|
|
137
|
+
G.find((t) => t.id === e)?.locked || N((n) => t ? [.../* @__PURE__ */ new Set([...n, e])] : n.filter((t) => t !== e));
|
|
138
|
+
}, qe = (e) => {
|
|
139
|
+
e && !Z || (e && (j(u), N([]), I(void 0), P(!1), B.reset(), V.reset()), Fe(e));
|
|
140
|
+
}, Je = B.isPending || V.isPending, Ye = ue(G, {
|
|
141
|
+
selectedUserIds: M,
|
|
142
|
+
disabled: Je || !b.canWrite,
|
|
143
|
+
fallbackTooltip: p.teamMemberAccessTooltip,
|
|
144
|
+
onUserToggle: Ke
|
|
123
145
|
});
|
|
124
146
|
return {
|
|
125
|
-
"data-testid":
|
|
126
|
-
selectedAccountId:
|
|
127
|
-
title:
|
|
128
|
-
bankDisplayName:
|
|
129
|
-
bankLogoSrc:
|
|
130
|
-
bankLogoAlt:
|
|
131
|
-
availableBalanceLabel:
|
|
132
|
-
shouldDisplayAvailableBalance:
|
|
133
|
-
isBankingTaglineVisible:
|
|
134
|
-
accountCards:
|
|
135
|
-
shouldDisplayAddAccountCard:
|
|
136
|
-
isLoading: !
|
|
137
|
-
isError:
|
|
138
|
-
isCreateOpen:
|
|
139
|
-
createForm:
|
|
147
|
+
"data-testid": De,
|
|
148
|
+
selectedAccountId: E,
|
|
149
|
+
title: p.title,
|
|
150
|
+
bankDisplayName: X,
|
|
151
|
+
bankLogoSrc: xe,
|
|
152
|
+
bankLogoAlt: Se,
|
|
153
|
+
availableBalanceLabel: Ve,
|
|
154
|
+
shouldDisplayAvailableBalance: He,
|
|
155
|
+
isBankingTaglineVisible: f,
|
|
156
|
+
accountCards: Ue,
|
|
157
|
+
shouldDisplayAddAccountCard: b.canWrite,
|
|
158
|
+
isLoading: !v && (!y || ke && !_ || D && (z.isLoading || z.isFetchingNextPage || z.hasNextPage)),
|
|
159
|
+
isError: v || D && z.isError,
|
|
160
|
+
isCreateOpen: k,
|
|
161
|
+
createForm: A,
|
|
140
162
|
legalCopy: {
|
|
141
|
-
bankName:
|
|
142
|
-
vspName:
|
|
143
|
-
agreementUrl:
|
|
163
|
+
bankName: X,
|
|
164
|
+
vspName: ze,
|
|
165
|
+
agreementUrl: Be
|
|
144
166
|
},
|
|
145
|
-
accessRows:
|
|
146
|
-
isTeamMembersLoading:
|
|
147
|
-
isTeamMembersError:
|
|
148
|
-
isCreateSubmitDisabled: !
|
|
149
|
-
isCreateError:
|
|
150
|
-
hasNicknameError:
|
|
151
|
-
isSubmitting:
|
|
152
|
-
isCreateDisabled: !
|
|
153
|
-
onCreateOpenChange:
|
|
167
|
+
accessRows: Ye,
|
|
168
|
+
isTeamMembersLoading: K,
|
|
169
|
+
isTeamMembersError: U.isError,
|
|
170
|
+
isCreateSubmitDisabled: !Z || !q || A.nickname.trim() === "" || Y.length === 0,
|
|
171
|
+
isCreateError: B.isError || V.isError,
|
|
172
|
+
hasNicknameError: Ie,
|
|
173
|
+
isSubmitting: Je,
|
|
174
|
+
isCreateDisabled: !Z,
|
|
175
|
+
onCreateOpenChange: qe,
|
|
154
176
|
onCreateFormChange: (e) => {
|
|
155
|
-
|
|
177
|
+
P(!1), j(e);
|
|
156
178
|
},
|
|
157
|
-
onCreateSubmit:
|
|
158
|
-
onAddAccountClick: () =>
|
|
159
|
-
onSelectAccount:
|
|
179
|
+
onCreateSubmit: Ge,
|
|
180
|
+
onAddAccountClick: () => qe(!0),
|
|
181
|
+
onSelectAccount: O
|
|
160
182
|
};
|
|
161
183
|
}
|
|
162
|
-
function
|
|
184
|
+
function be(e, t, n) {
|
|
163
185
|
return {
|
|
164
186
|
id: e.id,
|
|
165
187
|
name: e.nickname?.trim() || t.accountFallback,
|
|
166
188
|
balanceLabel: a(e.balance),
|
|
167
189
|
accountNumberLabel: e.accountNumber,
|
|
168
|
-
maskedAccountNumberLabel:
|
|
190
|
+
maskedAccountNumberLabel: se(e.accountNumber),
|
|
169
191
|
routingNumberLabel: e.routingNumber,
|
|
170
192
|
...n
|
|
171
193
|
};
|
|
172
194
|
}
|
|
173
195
|
//#endregion
|
|
174
|
-
export {
|
|
196
|
+
export { f as useBankAccountsWidget };
|
|
@@ -24,7 +24,7 @@ var r = {
|
|
|
24
24
|
UploadedPartial: (e, t) => `Uploaded ${e} of ${t} attachments`,
|
|
25
25
|
TooManyFiles: (e) => `You can only upload up to ${e} files at a time`,
|
|
26
26
|
Matching: (e) => e === 1 ? "Matching 1 receipt to a transaction" : `Matching ${e} receipts to transactions`,
|
|
27
|
-
MatchedAll: (e) => e === 1 ? "
|
|
27
|
+
MatchedAll: (e) => e === 1 ? "1 of 1 receipt matched to a transaction" : `${e} of ${e} receipts matched to transactions`,
|
|
28
28
|
MatchedPartial: (e, t) => `${e} of ${t} receipts matched. Match the rest from the receipt inbox.`,
|
|
29
29
|
MatchingUnfinished: (e) => e === 1 ? "Still processing 1 receipt. Matching continues in the background." : `Still processing ${e} receipts. Matching continues in the background.`
|
|
30
30
|
};
|