@tesouro/embedded-components-react 0.2.286 → 0.2.288

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.
@@ -739,6 +739,110 @@ declare const WIDGET_SUITE_SECTION_TITLE_LABELS_EN: WidgetSuiteSectionTitleLabel
739
739
  declare const WIDGET_SUITE_CONTENT_LABELS_EN: WidgetSuiteContentLabels;
740
740
  declare const WIDGET_SUITE_DISCLOSURE_LABELS_EN: WidgetSuiteDisclosureLabels;
741
741
 
742
+ interface CardsWidgetPaginationInput {
743
+ paginationToken?: string;
744
+ pageSize?: number;
745
+ }
746
+
747
+ /**
748
+ * The sections this widget renders itself. These ids are the public vocabulary
749
+ * a host uses to deep-link into a section, so they are part of the package's
750
+ * API surface — renaming one is a breaking change.
751
+ */
752
+ declare const SettingsSection: {
753
+ readonly Profile: "profile";
754
+ readonly Team: "team";
755
+ readonly Invoice: "invoice";
756
+ readonly Expense: "expense";
757
+ readonly BillPay: "bill-pay";
758
+ readonly Accounting: "accounting";
759
+ readonly Tags: "tags";
760
+ readonly Help: "help";
761
+ };
762
+ type SettingsSection = (typeof SettingsSection)[keyof typeof SettingsSection];
763
+ /**
764
+ * A selectable section id: one of the built-ins, or the id of a host-supplied
765
+ * {@link SettingsWidgetAdditionalSection}. The `string & {}` arm keeps the
766
+ * built-in literals visible to editor autocomplete while still accepting a
767
+ * host's own id.
768
+ */
769
+ type SettingsWidgetSectionId = SettingsSection | (string & {});
770
+
771
+ interface WidgetSuiteAccountsSelection {
772
+ /** The account whose details are open. `null` is the list. */
773
+ accountId?: string | null;
774
+ }
775
+ interface WidgetSuiteCardsSelection {
776
+ /** The card whose details panel is open. `null` closes it. */
777
+ cardId?: string | null;
778
+ /**
779
+ * The list's cursor and page size. Forwarded to the widget's own `pagination`
780
+ * and `defaultPagination`, so the suite holds no cursor of its own: leaving
781
+ * the section and coming back restarts the walk unless a host drives it.
782
+ */
783
+ pagination?: CardsWidgetPaginationInput;
784
+ }
785
+ interface WidgetSuiteSettingsSelection {
786
+ /**
787
+ * The settings section on screen. Controlled only: the suite never supplies a
788
+ * value of its own, because `SettingsWidget` substitutes another section when
789
+ * this one is not available to the user and reports nothing when it does
790
+ * (EMBD-4980 adds the `defaultSelectedSection` that would make an initial
791
+ * value safe).
792
+ */
793
+ section?: SettingsWidgetSectionId;
794
+ }
795
+ /**
796
+ * Where the suite is pointed, grouped by section.
797
+ *
798
+ * One object rather than a prop per key: it is the value a host mirrors into its
799
+ * URL, and it groups the same way `contentLabels` does. Every key resolves
800
+ * independently, so `selection={{ section: 'accounts' }}` drives the menu and
801
+ * leaves the account to `defaultSelection`.
802
+ *
803
+ * Credit and debit cards get separate groups because the Cards section mounts
804
+ * two `CardsWidget` instances against two endpoints, so one card id cannot
805
+ * address both. There is no `invoicing` group: that section renders the Monite
806
+ * `<Receivables />`, whose tab is internal state (EMBD-2171 replaces it,
807
+ * EMBD-4979 makes the native tab controllable).
808
+ */
809
+ interface WidgetSuiteSelection {
810
+ section?: WidgetSuiteSectionId;
811
+ accounts?: WidgetSuiteAccountsSelection;
812
+ creditCards?: WidgetSuiteCardsSelection;
813
+ debitCards?: WidgetSuiteCardsSelection;
814
+ settings?: WidgetSuiteSettingsSelection;
815
+ }
816
+ /**
817
+ * Where the suite can *open*, which is not everything it can be driven to:
818
+ * `SettingsWidget` takes no initial section, so naming one here would be a
819
+ * silent no-op (EMBD-4980 adds the prop that makes it work).
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.
823
+ */
824
+ type WidgetSuiteDefaultSelection = Omit<WidgetSuiteSelection, 'settings'>;
825
+ interface WidgetSuiteCardsSelectionSnapshot {
826
+ cardId: string | null;
827
+ pagination: CardsWidgetPaginationInput | undefined;
828
+ }
829
+ /**
830
+ * The selection as the suite reports it: every key carries a value, so a host
831
+ * reading one needs no optional chaining. Assignable to
832
+ * {@link WidgetSuiteSelection}, so a host can hand a snapshot straight back.
833
+ */
834
+ interface WidgetSuiteSelectionSnapshot {
835
+ section: WidgetSuiteSectionId | undefined;
836
+ accounts: {
837
+ accountId: string | null;
838
+ };
839
+ creditCards: WidgetSuiteCardsSelectionSnapshot;
840
+ debitCards: WidgetSuiteCardsSelectionSnapshot;
841
+ settings: {
842
+ section: SettingsWidgetSectionId | undefined;
843
+ };
844
+ }
845
+
742
846
  interface WidgetSuiteProps extends WidgetProviderProps {
743
847
  /**
744
848
  * Which sections the suite offers, in menu order.
@@ -753,6 +857,34 @@ interface WidgetSuiteProps extends WidgetProviderProps {
753
857
  * this is the host's ceiling rather than a promise of what renders.
754
858
  */
755
859
  sections: readonly WidgetSuiteSectionId[];
860
+ /**
861
+ * Where the suite is pointed, for a host that owns navigation — a URL, a
862
+ * router, its own state. Every key resolves on its own, so driving one leaves
863
+ * the rest to the suite.
864
+ *
865
+ * A key here puts the widget behind it in controlled mode for the lifetime of
866
+ * the mount, so supply it with `onSelectionChange` or the surface will not
867
+ * move when the user clicks.
868
+ */
869
+ selection?: WidgetSuiteSelection;
870
+ /**
871
+ * Where the suite opens, for a host that wants a deep link but not ownership.
872
+ * Read once per mount, and ignored per key when `selection` names that key.
873
+ *
874
+ * Carries every key `selection` does bar `settings` — see
875
+ * {@link WidgetSuiteDefaultSelection}.
876
+ */
877
+ defaultSelection?: WidgetSuiteDefaultSelection;
878
+ /**
879
+ * The whole selection after a person moved the suite: a menu click, a row, a
880
+ * card, a settings tab, a page of a card list. Every key carries a value, and
881
+ * the object can be handed straight back as `selection`.
882
+ *
883
+ * Never fired for the entitlement fallback, and never fired on mount, so a
884
+ * host mirroring this into its URL cannot overwrite the deep link it was just
885
+ * handed. A move that touches two keys reports once.
886
+ */
887
+ onSelectionChange?: (selection: WidgetSuiteSelectionSnapshot) => void;
756
888
  /** Overrides for the shell's own copy — the nav landmark name, empty state. */
757
889
  labels?: PartialDeep<WidgetSuiteShellLabels>;
758
890
  /** Overrides for the section names in the menu. */
@@ -779,8 +911,8 @@ interface WidgetSuiteProps extends WidgetProviderProps {
779
911
  * heading reads as a fragment of someone else's. Set `false` when the host
780
912
  * already renders a heading of its own above the suite.
781
913
  *
782
- * Sections whose widget heads itself (Accounts, Settings) never get one, at
783
- * any setting — see `rendersOwnTitle` in `sections.tsx`.
914
+ * Sections whose widget heads itself (Accounts, Cards, Settings) never get
915
+ * one, at any setting — see `rendersOwnTitle` in `sections.tsx`.
784
916
  */
785
917
  showSectionTitle?: boolean;
786
918
  }
@@ -801,15 +933,17 @@ interface WidgetSuiteProps extends WidgetProviderProps {
801
933
  * init fails before answering the disclosure flags, the acceptance surface
802
934
  * alone when the session owes the bank's disclosures, or the nav over its
803
935
  * sections. States rather than an overlay over a mounted shell — see
804
- * `WidgetSuiteInner` for why each boundary sits where it does.
936
+ * `WidgetSuiteSurface` for why each boundary sits where it does.
805
937
  *
806
- * The active section is held here rather than taken as a prop, matching
807
- * `BillPayWidgetNative` and `SettingsWidget`. A host-controlled
808
- * `selectedSectionId` / `onSectionChange` pair is the natural next step for
809
- * deep-linking, and is deliberately not invented on an experimental export
810
- * before a host asks for it.
938
+ * Navigation is one `selection` object a host can drive key by key, published to
939
+ * the sections through `WidgetSuiteProvider`. Only the open panel is mounted, so
940
+ * 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 and Cards its
942
+ * open card, while Bill Pay forgets its tab, Settings its section and each card
943
+ * list its cursor. That split is the widgets' current shape rather than a
944
+ * decision — see `WidgetSuiteSelection` for the ticket behind each gap.
811
945
  */
812
946
  declare function WidgetSuite({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, implementation, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, ...innerProps }: WidgetSuiteProps): React.JSX.Element;
813
947
 
814
948
  export { WIDGET_SUITE_CONTENT_LABELS_EN, WIDGET_SUITE_DEFAULT_SECTIONS, WIDGET_SUITE_DISCLOSURE_LABELS_EN, WIDGET_SUITE_SECTION_LABELS_EN, WIDGET_SUITE_SECTION_TITLE_LABELS_EN, WIDGET_SUITE_SHELL_LABELS_EN, WidgetSuite, WidgetSuiteSectionId };
815
- export type { PartialDeep, WidgetSuiteContentLabels, WidgetSuiteDisclosureLabels, WidgetSuiteProps, WidgetSuiteSectionLabels, WidgetSuiteSectionTitleLabels, WidgetSuiteShellLabels };
949
+ export type { PartialDeep, WidgetSuiteAccountsSelection, WidgetSuiteCardsSelection, WidgetSuiteCardsSelectionSnapshot, WidgetSuiteContentLabels, WidgetSuiteDefaultSelection, WidgetSuiteDisclosureLabels, WidgetSuiteProps, WidgetSuiteSectionLabels, WidgetSuiteSectionTitleLabels, WidgetSuiteSelection, WidgetSuiteSelectionSnapshot, WidgetSuiteSettingsSelection, WidgetSuiteShellLabels };
@@ -1,6 +1,6 @@
1
1
  import { WIDGET_SUITE_CONTENT_LABELS_EN as e, WIDGET_SUITE_DISCLOSURE_LABELS_EN as t, WIDGET_SUITE_SECTION_LABELS_EN as n, WIDGET_SUITE_SECTION_TITLE_LABELS_EN as r } from "../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js";
2
- import { WIDGET_SUITE_DEFAULT_SECTIONS as i, WidgetSuiteSectionId as a } from "../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js";
2
+ import { WIDGET_SUITE_DEFAULT_SECTIONS as i, WidgetSuiteSectionId as a } from "../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js";
3
3
  import { WIDGET_SUITE_SHELL_LABELS_EN as o } from "../libs/tesouro-embedded-components-react/widget-suite/ui/dist/index2.js";
4
- import { WidgetSuite as s } from "../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index6.js";
4
+ import { WidgetSuite as s } from "../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js";
5
5
  import "../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index.js";
6
6
  export { e as WIDGET_SUITE_CONTENT_LABELS_EN, i as WIDGET_SUITE_DEFAULT_SECTIONS, t as WIDGET_SUITE_DISCLOSURE_LABELS_EN, n as WIDGET_SUITE_SECTION_LABELS_EN, r as WIDGET_SUITE_SECTION_TITLE_LABELS_EN, o as WIDGET_SUITE_SHELL_LABELS_EN, s as WidgetSuite, a as WidgetSuiteSectionId };
@@ -739,6 +739,110 @@ declare const WIDGET_SUITE_SECTION_TITLE_LABELS_EN: WidgetSuiteSectionTitleLabel
739
739
  declare const WIDGET_SUITE_CONTENT_LABELS_EN: WidgetSuiteContentLabels;
740
740
  declare const WIDGET_SUITE_DISCLOSURE_LABELS_EN: WidgetSuiteDisclosureLabels;
741
741
 
742
+ interface CardsWidgetPaginationInput {
743
+ paginationToken?: string;
744
+ pageSize?: number;
745
+ }
746
+
747
+ /**
748
+ * The sections this widget renders itself. These ids are the public vocabulary
749
+ * a host uses to deep-link into a section, so they are part of the package's
750
+ * API surface — renaming one is a breaking change.
751
+ */
752
+ declare const SettingsSection: {
753
+ readonly Profile: "profile";
754
+ readonly Team: "team";
755
+ readonly Invoice: "invoice";
756
+ readonly Expense: "expense";
757
+ readonly BillPay: "bill-pay";
758
+ readonly Accounting: "accounting";
759
+ readonly Tags: "tags";
760
+ readonly Help: "help";
761
+ };
762
+ type SettingsSection = (typeof SettingsSection)[keyof typeof SettingsSection];
763
+ /**
764
+ * A selectable section id: one of the built-ins, or the id of a host-supplied
765
+ * {@link SettingsWidgetAdditionalSection}. The `string & {}` arm keeps the
766
+ * built-in literals visible to editor autocomplete while still accepting a
767
+ * host's own id.
768
+ */
769
+ type SettingsWidgetSectionId = SettingsSection | (string & {});
770
+
771
+ interface WidgetSuiteAccountsSelection {
772
+ /** The account whose details are open. `null` is the list. */
773
+ accountId?: string | null;
774
+ }
775
+ interface WidgetSuiteCardsSelection {
776
+ /** The card whose details panel is open. `null` closes it. */
777
+ cardId?: string | null;
778
+ /**
779
+ * The list's cursor and page size. Forwarded to the widget's own `pagination`
780
+ * and `defaultPagination`, so the suite holds no cursor of its own: leaving
781
+ * the section and coming back restarts the walk unless a host drives it.
782
+ */
783
+ pagination?: CardsWidgetPaginationInput;
784
+ }
785
+ interface WidgetSuiteSettingsSelection {
786
+ /**
787
+ * The settings section on screen. Controlled only: the suite never supplies a
788
+ * value of its own, because `SettingsWidget` substitutes another section when
789
+ * this one is not available to the user and reports nothing when it does
790
+ * (EMBD-4980 adds the `defaultSelectedSection` that would make an initial
791
+ * value safe).
792
+ */
793
+ section?: SettingsWidgetSectionId;
794
+ }
795
+ /**
796
+ * Where the suite is pointed, grouped by section.
797
+ *
798
+ * One object rather than a prop per key: it is the value a host mirrors into its
799
+ * URL, and it groups the same way `contentLabels` does. Every key resolves
800
+ * independently, so `selection={{ section: 'accounts' }}` drives the menu and
801
+ * leaves the account to `defaultSelection`.
802
+ *
803
+ * Credit and debit cards get separate groups because the Cards section mounts
804
+ * two `CardsWidget` instances against two endpoints, so one card id cannot
805
+ * address both. There is no `invoicing` group: that section renders the Monite
806
+ * `<Receivables />`, whose tab is internal state (EMBD-2171 replaces it,
807
+ * EMBD-4979 makes the native tab controllable).
808
+ */
809
+ interface WidgetSuiteSelection {
810
+ section?: WidgetSuiteSectionId;
811
+ accounts?: WidgetSuiteAccountsSelection;
812
+ creditCards?: WidgetSuiteCardsSelection;
813
+ debitCards?: WidgetSuiteCardsSelection;
814
+ settings?: WidgetSuiteSettingsSelection;
815
+ }
816
+ /**
817
+ * Where the suite can *open*, which is not everything it can be driven to:
818
+ * `SettingsWidget` takes no initial section, so naming one here would be a
819
+ * silent no-op (EMBD-4980 adds the prop that makes it work).
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.
823
+ */
824
+ type WidgetSuiteDefaultSelection = Omit<WidgetSuiteSelection, 'settings'>;
825
+ interface WidgetSuiteCardsSelectionSnapshot {
826
+ cardId: string | null;
827
+ pagination: CardsWidgetPaginationInput | undefined;
828
+ }
829
+ /**
830
+ * The selection as the suite reports it: every key carries a value, so a host
831
+ * reading one needs no optional chaining. Assignable to
832
+ * {@link WidgetSuiteSelection}, so a host can hand a snapshot straight back.
833
+ */
834
+ interface WidgetSuiteSelectionSnapshot {
835
+ section: WidgetSuiteSectionId | undefined;
836
+ accounts: {
837
+ accountId: string | null;
838
+ };
839
+ creditCards: WidgetSuiteCardsSelectionSnapshot;
840
+ debitCards: WidgetSuiteCardsSelectionSnapshot;
841
+ settings: {
842
+ section: SettingsWidgetSectionId | undefined;
843
+ };
844
+ }
845
+
742
846
  interface WidgetSuiteProps extends WidgetProviderProps {
743
847
  /**
744
848
  * Which sections the suite offers, in menu order.
@@ -753,6 +857,34 @@ interface WidgetSuiteProps extends WidgetProviderProps {
753
857
  * this is the host's ceiling rather than a promise of what renders.
754
858
  */
755
859
  sections: readonly WidgetSuiteSectionId[];
860
+ /**
861
+ * Where the suite is pointed, for a host that owns navigation — a URL, a
862
+ * router, its own state. Every key resolves on its own, so driving one leaves
863
+ * the rest to the suite.
864
+ *
865
+ * A key here puts the widget behind it in controlled mode for the lifetime of
866
+ * the mount, so supply it with `onSelectionChange` or the surface will not
867
+ * move when the user clicks.
868
+ */
869
+ selection?: WidgetSuiteSelection;
870
+ /**
871
+ * Where the suite opens, for a host that wants a deep link but not ownership.
872
+ * Read once per mount, and ignored per key when `selection` names that key.
873
+ *
874
+ * Carries every key `selection` does bar `settings` — see
875
+ * {@link WidgetSuiteDefaultSelection}.
876
+ */
877
+ defaultSelection?: WidgetSuiteDefaultSelection;
878
+ /**
879
+ * The whole selection after a person moved the suite: a menu click, a row, a
880
+ * card, a settings tab, a page of a card list. Every key carries a value, and
881
+ * the object can be handed straight back as `selection`.
882
+ *
883
+ * Never fired for the entitlement fallback, and never fired on mount, so a
884
+ * host mirroring this into its URL cannot overwrite the deep link it was just
885
+ * handed. A move that touches two keys reports once.
886
+ */
887
+ onSelectionChange?: (selection: WidgetSuiteSelectionSnapshot) => void;
756
888
  /** Overrides for the shell's own copy — the nav landmark name, empty state. */
757
889
  labels?: PartialDeep<WidgetSuiteShellLabels>;
758
890
  /** Overrides for the section names in the menu. */
@@ -779,8 +911,8 @@ interface WidgetSuiteProps extends WidgetProviderProps {
779
911
  * heading reads as a fragment of someone else's. Set `false` when the host
780
912
  * already renders a heading of its own above the suite.
781
913
  *
782
- * Sections whose widget heads itself (Accounts, Settings) never get one, at
783
- * any setting — see `rendersOwnTitle` in `sections.tsx`.
914
+ * Sections whose widget heads itself (Accounts, Cards, Settings) never get
915
+ * one, at any setting — see `rendersOwnTitle` in `sections.tsx`.
784
916
  */
785
917
  showSectionTitle?: boolean;
786
918
  }
@@ -801,15 +933,17 @@ interface WidgetSuiteProps extends WidgetProviderProps {
801
933
  * init fails before answering the disclosure flags, the acceptance surface
802
934
  * alone when the session owes the bank's disclosures, or the nav over its
803
935
  * sections. States rather than an overlay over a mounted shell — see
804
- * `WidgetSuiteInner` for why each boundary sits where it does.
936
+ * `WidgetSuiteSurface` for why each boundary sits where it does.
805
937
  *
806
- * The active section is held here rather than taken as a prop, matching
807
- * `BillPayWidgetNative` and `SettingsWidget`. A host-controlled
808
- * `selectedSectionId` / `onSectionChange` pair is the natural next step for
809
- * deep-linking, and is deliberately not invented on an experimental export
810
- * before a host asks for it.
938
+ * Navigation is one `selection` object a host can drive key by key, published to
939
+ * the sections through `WidgetSuiteProvider`. Only the open panel is mounted, so
940
+ * 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 and Cards its
942
+ * open card, while Bill Pay forgets its tab, Settings its section and each card
943
+ * list its cursor. That split is the widgets' current shape rather than a
944
+ * decision — see `WidgetSuiteSelection` for the ticket behind each gap.
811
945
  */
812
946
  declare function WidgetSuite({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, implementation, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, ...innerProps }: WidgetSuiteProps): React.JSX.Element;
813
947
 
814
948
  export { WIDGET_SUITE_CONTENT_LABELS_EN, WIDGET_SUITE_DEFAULT_SECTIONS, WIDGET_SUITE_DISCLOSURE_LABELS_EN, WIDGET_SUITE_SECTION_LABELS_EN, WIDGET_SUITE_SECTION_TITLE_LABELS_EN, WIDGET_SUITE_SHELL_LABELS_EN, WidgetSuite, WidgetSuiteSectionId };
815
- export type { PartialDeep, WidgetSuiteContentLabels, WidgetSuiteDisclosureLabels, WidgetSuiteProps, WidgetSuiteSectionLabels, WidgetSuiteSectionTitleLabels, WidgetSuiteShellLabels };
949
+ export type { PartialDeep, WidgetSuiteAccountsSelection, WidgetSuiteCardsSelection, WidgetSuiteCardsSelectionSnapshot, WidgetSuiteContentLabels, WidgetSuiteDefaultSelection, WidgetSuiteDisclosureLabels, WidgetSuiteProps, WidgetSuiteSectionLabels, WidgetSuiteSectionTitleLabels, WidgetSuiteSelection, WidgetSuiteSelectionSnapshot, WidgetSuiteSettingsSelection, WidgetSuiteShellLabels };
@@ -1,6 +1,6 @@
1
1
  import { WIDGET_SUITE_CONTENT_LABELS_EN as e, WIDGET_SUITE_DISCLOSURE_LABELS_EN as t, WIDGET_SUITE_SECTION_LABELS_EN as n, WIDGET_SUITE_SECTION_TITLE_LABELS_EN as r } from "../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js";
2
- import { WIDGET_SUITE_DEFAULT_SECTIONS as i, WidgetSuiteSectionId as a } from "../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js";
2
+ import { WIDGET_SUITE_DEFAULT_SECTIONS as i, WidgetSuiteSectionId as a } from "../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js";
3
3
  import { WIDGET_SUITE_SHELL_LABELS_EN as o } from "../libs/tesouro-embedded-components-react/widget-suite/ui/dist/index2.js";
4
- import { WidgetSuite as s } from "../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index6.js";
4
+ import { WidgetSuite as s } from "../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js";
5
5
  import "./WidgetSuite.js";
6
6
  export { e as WIDGET_SUITE_CONTENT_LABELS_EN, i as WIDGET_SUITE_DEFAULT_SECTIONS, t as WIDGET_SUITE_DISCLOSURE_LABELS_EN, n as WIDGET_SUITE_SECTION_LABELS_EN, r as WIDGET_SUITE_SECTION_TITLE_LABELS_EN, o as WIDGET_SUITE_SHELL_LABELS_EN, s as WidgetSuite, a as WidgetSuiteSectionId };
package/dist/index.css CHANGED
@@ -4489,8 +4489,8 @@
4489
4489
  outline-style: var(--tw-outline-style);
4490
4490
  outline-width: 2px;
4491
4491
  }
4492
- .ttw\:focus-visible\:outline-offset-2:focus-visible {
4493
- outline-offset: 2px;
4492
+ .ttw\:focus-visible\:-outline-offset-2:focus-visible {
4493
+ outline-offset: calc(2px * -1);
4494
4494
  }
4495
4495
  .ttw\:focus-visible\:outline-ring:focus-visible {
4496
4496
  outline-color: var(--ttw-ring);
@@ -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.2.286", n = "13d727fbf5445ff7c8e70597a9d993fcd25f0d77", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.2.288", n = "75f226753e2f5616b2725736a77388cbc3466f98", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -1,6 +1,6 @@
1
1
  import { WIDGET_SUITE_CONTENT_LABELS_EN as e, WIDGET_SUITE_DISCLOSURE_LABELS_EN as t, WIDGET_SUITE_SECTION_LABELS_EN as n, WIDGET_SUITE_SECTION_TITLE_LABELS_EN as r } from "./index4.js";
2
- import { WIDGET_SUITE_DEFAULT_SECTIONS as i, WidgetSuiteSectionId as a } from "./index5.js";
2
+ import { WIDGET_SUITE_DEFAULT_SECTIONS as i, WidgetSuiteSectionId as a } from "./index7.js";
3
3
  import { WIDGET_SUITE_SHELL_LABELS_EN as o } from "../../ui/dist/index2.js";
4
4
  import "../../ui/dist/index.js";
5
- import { WidgetSuite as s } from "./index6.js";
5
+ import { WidgetSuite as s } from "./index8.js";
6
6
  export { e as WIDGET_SUITE_CONTENT_LABELS_EN, i as WIDGET_SUITE_DEFAULT_SECTIONS, t as WIDGET_SUITE_DISCLOSURE_LABELS_EN, n as WIDGET_SUITE_SECTION_LABELS_EN, r as WIDGET_SUITE_SECTION_TITLE_LABELS_EN, o as WIDGET_SUITE_SHELL_LABELS_EN, s as WidgetSuite, a as WidgetSuiteSectionId };
@@ -2,96 +2,89 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
- import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
7
- import "../../../shared/data-access/dist/index.js";
8
- import { CardProgram as n } from "../../../shared/feature/dist/lib/card/cardProgram.js";
9
- import "../../../shared/feature/dist/index.js";
10
- import { BankAccountsWidget as r } from "../../../bank-accounts-widget/feature/dist/index8.js";
11
- import "../../../bank-accounts-widget/feature/dist/index.js";
12
- import { BillPayWidget as i } from "../../../bill-pay-widget/feature/dist/index34.js";
13
- import "../../../bill-pay-widget/feature/dist/index.js";
14
- import { CardsWidget as a } from "../../../cards-widget/feature/dist/index8.js";
15
- import "../../../cards-widget/feature/dist/index.js";
16
- import { BalancesWidget as o } from "../../../balances-widget/feature/dist/index5.js";
17
- import "../../../balances-widget/feature/dist/index.js";
18
- import { InsightsWidget as s } from "../../../insights-widget/feature/dist/index11.js";
19
- import "../../../insights-widget/feature/dist/index.js";
20
- import { InvoicingWidget as c } from "../../../invoicing-widget/feature/dist/index3.js";
21
- import "../../../invoicing-widget/feature/dist/index.js";
22
- import { SettingsWidget as l } from "../../../settings-widget/feature/dist/index6.js";
23
- import "../../../settings-widget/feature/dist/index.js";
24
- import { TransfersWidget as u } from "../../../transfers-widget/feature/dist/index6.js";
25
- import "../../../transfers-widget/feature/dist/index.js";
26
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
5
+ import { useCallback as e, useMemo as t } from "react";
6
+ import { useControllableState as n } from "@radix-ui/react-use-controllable-state";
27
7
  //#region ../../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js
28
- var p = ({ children: e }) => /* @__PURE__ */ d("div", {
29
- className: "ttw:rounded-md ttw:border ttw:border-dashed ttw:border-border ttw:p-8 ttw:text-sm ttw:text-muted-foreground",
30
- children: e
31
- }), m = {
32
- Dashboard: "dashboard",
33
- Accounts: "accounts",
34
- Cards: "cards",
35
- Transfers: "transfers",
36
- BillPay: "bill-pay",
37
- Invoicing: "invoicing",
38
- Expenses: "expenses",
39
- Settings: "settings"
40
- }, h = [
41
- m.Dashboard,
42
- m.Accounts,
43
- m.Cards,
44
- m.Transfers,
45
- m.BillPay,
46
- m.Invoicing,
47
- m.Expenses,
48
- m.Settings
49
- ], g = {
50
- [m.Dashboard]: { render: ({ grantedScopes: n }) => {
51
- let r = e(n, [t.BankAccountReadOrg]);
52
- return /* @__PURE__ */ f("div", {
53
- className: r ? "ttw:grid ttw:gap-4 ttw:md:grid-cols-2" : "ttw:grid ttw:gap-4",
54
- children: [r && /* @__PURE__ */ d(o, {}), /* @__PURE__ */ d(s, {})]
55
- });
56
- } },
57
- [m.Accounts]: {
58
- anyOfScopes: [t.BankAccountReadOrg, t.ExternalBankAccountReadOrg],
59
- rendersOwnTitle: !0,
60
- render: () => /* @__PURE__ */ d(r, {})
61
- },
62
- [m.Cards]: {
63
- anyOfScopes: [t.CreditCardReadOrg, t.DebitCardReadOrg],
64
- render: ({ grantedScopes: r, labels: i }) => /* @__PURE__ */ f("div", {
65
- className: "ttw:grid ttw:gap-8",
66
- children: [e(r, [t.CreditCardReadOrg]) && /* @__PURE__ */ d(a, {
67
- cardProgram: n.Credit,
68
- labels: i.creditCards
69
- }), e(r, [t.DebitCardReadOrg]) && /* @__PURE__ */ d(a, {
70
- cardProgram: n.Debit,
71
- labels: i.debitCards
72
- })]
73
- })
74
- },
75
- [m.Transfers]: {
76
- anyOfScopes: [t.BankAccountReadOrg],
77
- render: () => /* @__PURE__ */ d(u, {})
78
- },
79
- [m.BillPay]: {
80
- anyOfScopes: [t.PayableReadOrg],
81
- render: () => /* @__PURE__ */ d(i, {})
82
- },
83
- [m.Invoicing]: {
84
- anyOfScopes: [t.InvoiceReadOrg],
85
- render: () => /* @__PURE__ */ d(c, {})
86
- },
87
- [m.Expenses]: {
88
- anyOfScopes: [t.ExpenseReadOrg, t.ExpenseReadSelf],
89
- render: ({ labels: e }) => /* @__PURE__ */ d(p, { children: e.expensePlaceholders.expensesUnavailable })
90
- },
91
- [m.Settings]: {
92
- rendersOwnTitle: !0,
93
- render: () => /* @__PURE__ */ d(l, {})
94
- }
95
- };
8
+ var r = "WidgetSuite";
9
+ function i(e, t) {
10
+ return {
11
+ cardId: t && "cardId" in t ? t.cardId ?? null : e.cardId,
12
+ pagination: t && "pagination" in t ? t.pagination : e.pagination
13
+ };
14
+ }
15
+ function a(e, t) {
16
+ return {
17
+ section: "section" in t ? t.section : e.section,
18
+ accounts: { accountId: t.accounts && "accountId" in t.accounts ? t.accounts.accountId ?? null : e.accounts.accountId },
19
+ creditCards: i(e.creditCards, t.creditCards),
20
+ debitCards: i(e.debitCards, t.debitCards),
21
+ settings: { section: t.settings && "section" in t.settings ? t.settings.section : e.settings.section }
22
+ };
23
+ }
24
+ function o({ selection: i, defaultSelection: a, sections: o }) {
25
+ let [s, c] = n({
26
+ prop: i?.section,
27
+ defaultProp: a?.section ?? o[0],
28
+ caller: r
29
+ }), [l, u] = n({
30
+ prop: i?.accounts?.accountId,
31
+ defaultProp: a?.accounts?.accountId ?? null,
32
+ caller: r
33
+ }), [d, f] = n({
34
+ prop: i?.creditCards?.cardId,
35
+ defaultProp: a?.creditCards?.cardId ?? null,
36
+ caller: r
37
+ }), [p, m] = n({
38
+ prop: i?.debitCards?.cardId,
39
+ defaultProp: a?.debitCards?.cardId ?? null,
40
+ caller: r
41
+ }), [h, g] = n({
42
+ prop: i?.creditCards?.pagination,
43
+ defaultProp: a?.creditCards?.pagination,
44
+ caller: r
45
+ }), [_, v] = n({
46
+ prop: i?.debitCards?.pagination,
47
+ defaultProp: a?.debitCards?.pagination,
48
+ caller: r
49
+ }), [y, b] = n({
50
+ prop: i?.settings?.section,
51
+ defaultProp: void 0,
52
+ caller: r
53
+ }), x = e((e) => {
54
+ "section" in e && c(e.section), e.accounts && "accountId" in e.accounts && u(e.accounts.accountId ?? null), e.creditCards && ("cardId" in e.creditCards && f(e.creditCards.cardId ?? null), "pagination" in e.creditCards && g(e.creditCards.pagination)), e.debitCards && ("cardId" in e.debitCards && m(e.debitCards.cardId ?? null), "pagination" in e.debitCards && v(e.debitCards.pagination)), e.settings && "section" in e.settings && b(e.settings.section);
55
+ }, [
56
+ u,
57
+ f,
58
+ g,
59
+ m,
60
+ v,
61
+ c,
62
+ b
63
+ ]);
64
+ return {
65
+ resolvedSelection: t(() => ({
66
+ section: s,
67
+ accounts: { accountId: l },
68
+ creditCards: {
69
+ cardId: d,
70
+ pagination: h
71
+ },
72
+ debitCards: {
73
+ cardId: p,
74
+ pagination: _
75
+ },
76
+ settings: { section: y }
77
+ }), [
78
+ l,
79
+ d,
80
+ h,
81
+ p,
82
+ _,
83
+ s,
84
+ y
85
+ ]),
86
+ applyPatch: x
87
+ };
88
+ }
96
89
  //#endregion
97
- export { h as WIDGET_SUITE_DEFAULT_SECTIONS, g as WIDGET_SUITE_SECTIONS, m as WidgetSuiteSectionId };
90
+ export { a as mergeSuiteSelection, o as useSuiteSelection };
@@ -2,131 +2,46 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
- import "../../../shared/data-access/dist/index.js";
7
- import { ErrorState as t } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
8
- import "../../../shared/ui/dist/index.js";
9
- import { useAnalyticsTrack as n } from "../../../shared/feature/dist/lib/analytics/hooks.js";
10
- import { WidgetProvider as r } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
11
- import { useRefetchWidget as i, useWidgetConfig as a, useWidgetError as o, useWidgetInitStaleForToken as s } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
12
- import "../../../shared/feature/dist/index.js";
13
- import { AcceptDisclosuresWidget as c } from "../../../accept-disclosures-widget/feature/dist/index4.js";
14
- import "../../../accept-disclosures-widget/feature/dist/index.js";
15
- import { WIDGET_SUITE_CONTENT_LABELS_EN as l, WIDGET_SUITE_DISCLOSURE_LABELS_EN as u, WIDGET_SUITE_SECTION_LABELS_EN as d, WIDGET_SUITE_SECTION_TITLE_LABELS_EN as f } from "./index4.js";
16
- import { WIDGET_SUITE_SECTIONS as p } from "./index5.js";
17
- import { WIDGET_NAME as m, WidgetSuiteAnalyticsEvent as h } from "./index2.js";
18
- import { needsDisclosureAcceptance as g } from "./index3.js";
19
- import { WidgetSuiteShell as _ } from "../../ui/dist/index3.js";
20
- import { SectionPageTitle as v } from "../../ui/dist/index4.js";
21
- import "../../ui/dist/index.js";
22
- import { useCallback as y, useEffect as b, useMemo as x, useState as S } from "react";
23
- import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
5
+ import { mergeSuiteSelection as e, useSuiteSelection as t } from "./index5.js";
6
+ import { createContext as n, useCallback as r, useContext as i } from "react";
7
+ import { jsx as a } from "react/jsx-runtime";
24
8
  //#region ../../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index6.js
25
- var E = {
26
- initFailed: "widget-suite-init-failed",
27
- disclosuresRefreshFailed: "widget-suite-disclosures-refresh-failed"
28
- };
29
- function D({ sections: r, labels: m, sectionLabels: D, sectionTitleLabels: O, contentLabels: k, disclosureLabels: A, showSectionTitle: j = !0 }) {
30
- let M = n();
31
- b(() => {
32
- M(h.Mounted);
33
- }, [M]);
34
- let N = {
35
- ...d,
36
- ...D
37
- }, { initResponse: P } = a(), F = o(), I = s(), L = P?.scopes, R = x(() => ({
38
- creditCards: {
39
- ...l.creditCards,
40
- ...k?.creditCards
9
+ var o = n(null);
10
+ function s({ sections: n, availableSections: i, grantedScopes: s, contentLabels: c, selection: l, defaultSelection: u, onSelectionChange: d, children: f }) {
11
+ let { resolvedSelection: p, applyPatch: m } = t({
12
+ selection: l,
13
+ defaultSelection: u,
14
+ sections: n
15
+ }), h = p.section, g = h && i.includes(h) ? h : i.at(0), _ = r((t) => {
16
+ let n = e({
17
+ ...p,
18
+ section: g
19
+ }, t);
20
+ m(t), d?.(n);
21
+ }, [
22
+ g,
23
+ m,
24
+ d,
25
+ p
26
+ ]);
27
+ return /* @__PURE__ */ a(o.Provider, {
28
+ value: {
29
+ availableSections: i,
30
+ activeSection: g,
31
+ grantedScopes: s,
32
+ contentLabels: c,
33
+ selection: l,
34
+ defaultSelection: u,
35
+ resolvedSelection: p,
36
+ navigate: _
41
37
  },
42
- debitCards: {
43
- ...l.debitCards,
44
- ...k?.debitCards
45
- },
46
- expensePlaceholders: {
47
- ...l.expensePlaceholders,
48
- ...k?.expensePlaceholders
49
- }
50
- }), [k]), [z, B] = S(r[0] ?? ""), V = i(), [H, U] = S(!1), W = y(() => U(!0), []), G = g(P), K = {
51
- ...u,
52
- ...A,
53
- initFailedState: {
54
- ...u.initFailedState,
55
- ...A?.initFailedState
56
- },
57
- refreshFailedState: {
58
- ...u.refreshFailedState,
59
- ...A?.refreshFailedState
60
- }
61
- };
62
- b(() => {
63
- !G && H && U(!1);
64
- }, [H, G]);
65
- let q = !!(P && I);
66
- if (!P && !F || q && !F) return /* @__PURE__ */ w(_, {
67
- isLoading: !0,
68
- sections: [],
69
- selectedSectionId: "",
70
- onSectionChange: B,
71
- labels: m
72
- });
73
- if ((!P || q) && F) return /* @__PURE__ */ w(t, {
74
- title: K.initFailedState.title,
75
- description: K.initFailedState.body,
76
- retryLabel: K.initFailedState.retryButton,
77
- onRetry: V,
78
- testId: E.initFailed
79
- });
80
- if (G) return H && F ? /* @__PURE__ */ w(t, {
81
- title: K.refreshFailedState.title,
82
- description: K.refreshFailedState.body,
83
- retryLabel: K.refreshFailedState.retryButton,
84
- onRetry: V,
85
- testId: E.disclosuresRefreshFailed
86
- }) : /* @__PURE__ */ w(c, { onAccepted: W });
87
- let J = P?.bankName?.trim(), Y = J ? {
88
- ...f,
89
- ...O
90
- }.bankTagline.replaceAll("{bankName}", J) : void 0, X = r.flatMap((t) => {
91
- let n = p[t];
92
- if (!n || n.anyOfScopes && !e(L, n.anyOfScopes)) return [];
93
- let r = N[t], i = n.render({
94
- grantedScopes: L,
95
- labels: R
96
- });
97
- return [{
98
- id: t,
99
- label: r,
100
- content: j && !n.rendersOwnTitle ? /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(v, {
101
- title: r,
102
- bankTagline: Y
103
- }), i] }) : i
104
- }];
105
- }), Z = X.some((e) => e.id === z) ? z : X[0]?.id ?? "";
106
- return /* @__PURE__ */ w(_, {
107
- sections: X,
108
- selectedSectionId: Z,
109
- onSectionChange: B,
110
- labels: m
38
+ children: f
111
39
  });
112
40
  }
113
- function O({ baseUrl: e, widgetToken: t, organizationId: n, configClient: i, gatewayRouting: a, linkComponent: o, implementation: s, uiFramework: c, errorFallback: l, onError: u, analytics: d, disclosuresAcceptance: f, ...p }) {
114
- return /* @__PURE__ */ w(r, {
115
- widgetName: m,
116
- baseUrl: e,
117
- widgetToken: t,
118
- organizationId: n,
119
- configClient: i,
120
- gatewayRouting: a,
121
- linkComponent: o,
122
- implementation: s,
123
- uiFramework: c,
124
- errorFallback: l,
125
- onError: u,
126
- analytics: d,
127
- disclosuresAcceptance: f,
128
- children: /* @__PURE__ */ w(D, { ...p })
129
- });
41
+ function c() {
42
+ let e = i(o);
43
+ if (!e) throw Error("useWidgetSuiteProvider must be called inside a section rendered by WidgetSuite.");
44
+ return e;
130
45
  }
131
46
  //#endregion
132
- export { E as WIDGET_SUITE_TEST_IDS, O as WidgetSuite, O as default };
47
+ export { s as WidgetSuiteProvider, c as useWidgetSuiteProvider };
@@ -0,0 +1,148 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
+ import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
7
+ import "../../../shared/data-access/dist/index.js";
8
+ import { CardProgram as n } from "../../../shared/feature/dist/lib/card/cardProgram.js";
9
+ import "../../../shared/feature/dist/index.js";
10
+ import { BankAccountsWidget as r } from "../../../bank-accounts-widget/feature/dist/index8.js";
11
+ import "../../../bank-accounts-widget/feature/dist/index.js";
12
+ import { BillPayWidget as i } from "../../../bill-pay-widget/feature/dist/index34.js";
13
+ import "../../../bill-pay-widget/feature/dist/index.js";
14
+ import { CardsWidget as a } from "../../../cards-widget/feature/dist/index8.js";
15
+ import "../../../cards-widget/feature/dist/index.js";
16
+ import { BalancesWidget as o } from "../../../balances-widget/feature/dist/index5.js";
17
+ import "../../../balances-widget/feature/dist/index.js";
18
+ import { InsightsWidget as s } from "../../../insights-widget/feature/dist/index11.js";
19
+ import "../../../insights-widget/feature/dist/index.js";
20
+ import { InvoicingWidget as c } from "../../../invoicing-widget/feature/dist/index3.js";
21
+ import "../../../invoicing-widget/feature/dist/index.js";
22
+ import { SettingsWidget as l } from "../../../settings-widget/feature/dist/index6.js";
23
+ import "../../../settings-widget/feature/dist/index.js";
24
+ import { TransfersWidget as u } from "../../../transfers-widget/feature/dist/index6.js";
25
+ import "../../../transfers-widget/feature/dist/index.js";
26
+ import { useWidgetSuiteProvider as d } from "./index6.js";
27
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
28
+ //#region ../../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js
29
+ var m = ({ children: e }) => /* @__PURE__ */ f("div", {
30
+ className: "ttw:rounded-md ttw:border ttw:border-dashed ttw:border-border ttw:p-8 ttw:text-sm ttw:text-muted-foreground",
31
+ children: e
32
+ }), h = {
33
+ Dashboard: "dashboard",
34
+ Accounts: "accounts",
35
+ Cards: "cards",
36
+ Transfers: "transfers",
37
+ BillPay: "bill-pay",
38
+ Invoicing: "invoicing",
39
+ Expenses: "expenses",
40
+ Settings: "settings"
41
+ }, g = [
42
+ h.Dashboard,
43
+ h.Accounts,
44
+ h.Cards,
45
+ h.Transfers,
46
+ h.BillPay,
47
+ h.Invoicing,
48
+ h.Expenses,
49
+ h.Settings
50
+ ];
51
+ function _() {
52
+ let { grantedScopes: n, availableSections: r, navigate: i } = d(), a = e(n, [t.BankAccountReadOrg]), c = r.includes(h.Accounts), l = r.includes(h.Transfers);
53
+ return /* @__PURE__ */ p("div", {
54
+ className: a ? "ttw:grid ttw:gap-4 ttw:md:grid-cols-2" : "ttw:grid ttw:gap-4",
55
+ children: [a && /* @__PURE__ */ f(o, {
56
+ onViewAllAccountsClick: c ? () => i({ section: h.Accounts }) : void 0,
57
+ onBalanceRowClick: c ? (e) => i({
58
+ section: h.Accounts,
59
+ accounts: { accountId: e }
60
+ }) : void 0
61
+ }), /* @__PURE__ */ f(s, { onLinkExternalAccountClick: l ? () => i({ section: h.Transfers }) : void 0 })]
62
+ });
63
+ }
64
+ function v() {
65
+ let { resolvedSelection: e, navigate: t } = d();
66
+ return /* @__PURE__ */ f(r, {
67
+ selectedAccountId: e.accounts.accountId,
68
+ onSelectedAccountIdChange: (e) => t({ accounts: { accountId: e } })
69
+ });
70
+ }
71
+ function y() {
72
+ let { grantedScopes: r, contentLabels: i, resolvedSelection: o, selection: s, defaultSelection: c, navigate: l } = d();
73
+ return /* @__PURE__ */ p("div", {
74
+ className: "ttw:grid ttw:gap-8",
75
+ children: [e(r, [t.CreditCardReadOrg]) && /* @__PURE__ */ f(a, {
76
+ cardProgram: n.Credit,
77
+ labels: i.creditCards,
78
+ selectedCardId: o.creditCards.cardId,
79
+ onSelectedCardIdChange: (e) => l({ creditCards: { cardId: e } }),
80
+ pagination: s?.creditCards?.pagination,
81
+ defaultPagination: c?.creditCards?.pagination,
82
+ onPaginationChange: (e) => l({ creditCards: { pagination: e } })
83
+ }), e(r, [t.DebitCardReadOrg]) && /* @__PURE__ */ f(a, {
84
+ cardProgram: n.Debit,
85
+ labels: i.debitCards,
86
+ selectedCardId: o.debitCards.cardId,
87
+ onSelectedCardIdChange: (e) => l({ debitCards: { cardId: e } }),
88
+ pagination: s?.debitCards?.pagination,
89
+ defaultPagination: c?.debitCards?.pagination,
90
+ onPaginationChange: (e) => l({ debitCards: { pagination: e } })
91
+ })]
92
+ });
93
+ }
94
+ function b() {
95
+ return /* @__PURE__ */ f(u, {});
96
+ }
97
+ function x() {
98
+ return /* @__PURE__ */ f(i, {});
99
+ }
100
+ function S() {
101
+ return /* @__PURE__ */ f(c, {});
102
+ }
103
+ function C() {
104
+ let { contentLabels: e } = d();
105
+ return /* @__PURE__ */ f(m, { children: e.expensePlaceholders.expensesUnavailable });
106
+ }
107
+ function w() {
108
+ let { selection: e, navigate: t } = d();
109
+ return /* @__PURE__ */ f(l, {
110
+ selectedSection: e?.settings?.section,
111
+ onSelectedSectionChange: (e) => t({ settings: { section: e } })
112
+ });
113
+ }
114
+ var T = {
115
+ [h.Dashboard]: { Content: _ },
116
+ [h.Accounts]: {
117
+ anyOfScopes: [t.BankAccountReadOrg, t.ExternalBankAccountReadOrg],
118
+ rendersOwnTitle: !0,
119
+ Content: v
120
+ },
121
+ [h.Cards]: {
122
+ anyOfScopes: [t.CreditCardReadOrg, t.DebitCardReadOrg],
123
+ rendersOwnTitle: !0,
124
+ Content: y
125
+ },
126
+ [h.Transfers]: {
127
+ anyOfScopes: [t.BankAccountReadOrg],
128
+ Content: b
129
+ },
130
+ [h.BillPay]: {
131
+ anyOfScopes: [t.PayableReadOrg],
132
+ Content: x
133
+ },
134
+ [h.Invoicing]: {
135
+ anyOfScopes: [t.InvoiceReadOrg],
136
+ Content: S
137
+ },
138
+ [h.Expenses]: {
139
+ anyOfScopes: [t.ExpenseReadOrg, t.ExpenseReadSelf],
140
+ Content: C
141
+ },
142
+ [h.Settings]: {
143
+ rendersOwnTitle: !0,
144
+ Content: w
145
+ }
146
+ };
147
+ //#endregion
148
+ export { g as WIDGET_SUITE_DEFAULT_SECTIONS, T as WIDGET_SUITE_SECTIONS, h as WidgetSuiteSectionId };
@@ -0,0 +1,144 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
+ import "../../../shared/data-access/dist/index.js";
7
+ import { ErrorState as t } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
8
+ import "../../../shared/ui/dist/index.js";
9
+ import { useAnalyticsTrack as n } from "../../../shared/feature/dist/lib/analytics/hooks.js";
10
+ import { WidgetProvider as r } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
11
+ import { useRefetchWidget as i, useWidgetConfig as a, useWidgetError as o, useWidgetInitStaleForToken as s } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
12
+ import "../../../shared/feature/dist/index.js";
13
+ import { AcceptDisclosuresWidget as c } from "../../../accept-disclosures-widget/feature/dist/index4.js";
14
+ import "../../../accept-disclosures-widget/feature/dist/index.js";
15
+ import { WIDGET_SUITE_CONTENT_LABELS_EN as l, WIDGET_SUITE_DISCLOSURE_LABELS_EN as u, WIDGET_SUITE_SECTION_LABELS_EN as d, WIDGET_SUITE_SECTION_TITLE_LABELS_EN as f } from "./index4.js";
16
+ import { WidgetSuiteProvider as p, useWidgetSuiteProvider as m } from "./index6.js";
17
+ import { WIDGET_SUITE_SECTIONS as h } from "./index7.js";
18
+ import { WIDGET_NAME as g, WidgetSuiteAnalyticsEvent as _ } from "./index2.js";
19
+ import { needsDisclosureAcceptance as v } from "./index3.js";
20
+ import { WidgetSuiteShell as y } from "../../ui/dist/index3.js";
21
+ import { SectionPageTitle as b } from "../../ui/dist/index4.js";
22
+ import "../../ui/dist/index.js";
23
+ import { useCallback as x, useEffect as S, useMemo as C, useState as w } from "react";
24
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
25
+ //#region ../../libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js
26
+ var O = {
27
+ initFailed: "widget-suite-init-failed",
28
+ disclosuresRefreshFailed: "widget-suite-disclosures-refresh-failed"
29
+ };
30
+ function k({ labels: e, sectionLabels: n, sectionTitleLabels: r, disclosureLabels: l, showSectionTitle: p = !0 }) {
31
+ let { availableSections: g, activeSection: _, navigate: C } = m(), { initResponse: k } = a(), A = o(), j = s(), M = i(), N = {
32
+ ...d,
33
+ ...n
34
+ }, P = x((e) => C({ section: e }), [C]), [F, I] = w(!1), L = x(() => I(!0), []), R = v(k), z = {
35
+ ...u,
36
+ ...l,
37
+ initFailedState: {
38
+ ...u.initFailedState,
39
+ ...l?.initFailedState
40
+ },
41
+ refreshFailedState: {
42
+ ...u.refreshFailedState,
43
+ ...l?.refreshFailedState
44
+ }
45
+ };
46
+ S(() => {
47
+ !R && F && I(!1);
48
+ }, [F, R]);
49
+ let B = !!(k && j);
50
+ if (!k && !A || B && !A) return /* @__PURE__ */ E(y, {
51
+ isLoading: !0,
52
+ sections: [],
53
+ selectedSectionId: "",
54
+ onSectionChange: P,
55
+ labels: e
56
+ });
57
+ if ((!k || B) && A) return /* @__PURE__ */ E(t, {
58
+ title: z.initFailedState.title,
59
+ description: z.initFailedState.body,
60
+ retryLabel: z.initFailedState.retryButton,
61
+ onRetry: M,
62
+ testId: O.initFailed
63
+ });
64
+ if (R) return F && A ? /* @__PURE__ */ E(t, {
65
+ title: z.refreshFailedState.title,
66
+ description: z.refreshFailedState.body,
67
+ retryLabel: z.refreshFailedState.retryButton,
68
+ onRetry: M,
69
+ testId: O.disclosuresRefreshFailed
70
+ }) : /* @__PURE__ */ E(c, { onAccepted: L });
71
+ let V = k?.bankName?.trim(), H = V ? {
72
+ ...f,
73
+ ...r
74
+ }.bankTagline.replaceAll("{bankName}", V) : void 0, U = g.map((e) => {
75
+ let { Content: t, rendersOwnTitle: n } = h[e], r = N[e];
76
+ return {
77
+ id: e,
78
+ label: r,
79
+ content: p && !n ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(b, {
80
+ title: r,
81
+ bankTagline: H
82
+ }), /* @__PURE__ */ E(t, {})] }) : /* @__PURE__ */ E(t, {})
83
+ };
84
+ });
85
+ return /* @__PURE__ */ E(y, {
86
+ sections: U,
87
+ selectedSectionId: _ ?? "",
88
+ onSectionChange: P,
89
+ labels: e
90
+ });
91
+ }
92
+ function A({ sections: t, selection: r, defaultSelection: i, onSelectionChange: o, contentLabels: s, ...c }) {
93
+ let u = n();
94
+ S(() => {
95
+ u(_.Mounted);
96
+ }, [u]);
97
+ let { initResponse: d } = a(), f = d?.scopes, m = C(() => ({
98
+ creditCards: {
99
+ ...l.creditCards,
100
+ ...s?.creditCards
101
+ },
102
+ debitCards: {
103
+ ...l.debitCards,
104
+ ...s?.debitCards
105
+ },
106
+ expensePlaceholders: {
107
+ ...l.expensePlaceholders,
108
+ ...s?.expensePlaceholders
109
+ }
110
+ }), [s]), g = t.filter((t) => {
111
+ let n = h[t];
112
+ return !!n && (!n.anyOfScopes || e(f, n.anyOfScopes));
113
+ });
114
+ return /* @__PURE__ */ E(p, {
115
+ sections: t,
116
+ availableSections: g,
117
+ grantedScopes: f,
118
+ contentLabels: m,
119
+ selection: r,
120
+ defaultSelection: i,
121
+ onSelectionChange: o,
122
+ children: /* @__PURE__ */ E(k, { ...c })
123
+ });
124
+ }
125
+ function j({ baseUrl: e, widgetToken: t, organizationId: n, configClient: i, gatewayRouting: a, linkComponent: o, implementation: s, uiFramework: c, errorFallback: l, onError: u, analytics: d, disclosuresAcceptance: f, ...p }) {
126
+ return /* @__PURE__ */ E(r, {
127
+ widgetName: g,
128
+ baseUrl: e,
129
+ widgetToken: t,
130
+ organizationId: n,
131
+ configClient: i,
132
+ gatewayRouting: a,
133
+ linkComponent: o,
134
+ implementation: s,
135
+ uiFramework: c,
136
+ errorFallback: l,
137
+ onError: u,
138
+ analytics: d,
139
+ disclosuresAcceptance: f,
140
+ children: /* @__PURE__ */ E(A, { ...p })
141
+ });
142
+ }
143
+ //#endregion
144
+ export { O as WIDGET_SUITE_TEST_IDS, j as WidgetSuite, j as default };
@@ -44,7 +44,7 @@ function c({ sections: c, selectedSectionId: l, onSectionChange: u, isLoading: d
44
44
  "aria-label": p.loadingAriaLabel,
45
45
  className: "ttw:flex ttw:w-full ttw:flex-col ttw:gap-6",
46
46
  children: [/* @__PURE__ */ a("div", {
47
- className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-1 ttw:border-b ttw:border-border",
47
+ className: "ttw:flex ttw:items-center ttw:gap-1 ttw:overflow-x-auto ttw:border-b ttw:border-border",
48
48
  children: s.map((t) => /* @__PURE__ */ a("div", {
49
49
  className: "ttw:px-4 ttw:py-2.5",
50
50
  children: /* @__PURE__ */ a(e, { className: "ttw:h-5 ttw:w-20" })
@@ -64,21 +64,25 @@ function c({ sections: c, selectedSectionId: l, onSectionChange: u, isLoading: d
64
64
  className: "ttw:flex ttw:w-full ttw:flex-col ttw:gap-6",
65
65
  children: [/* @__PURE__ */ a("nav", {
66
66
  "aria-label": p.navAriaLabel,
67
+ className: "ttw:border-b ttw:border-border",
67
68
  children: /* @__PURE__ */ a("ul", {
68
- className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-1 ttw:border-b ttw:border-border",
69
+ className: "ttw:-mb-px ttw:flex ttw:items-center ttw:gap-1 ttw:overflow-x-auto",
69
70
  children: c.map((e, t) => {
70
71
  let r = e.id === l;
71
- return /* @__PURE__ */ a("li", { children: /* @__PURE__ */ a("button", {
72
- type: "button",
73
- ref: (e) => {
74
- m.current[t] = e;
75
- },
76
- "aria-current": r ? "page" : void 0,
77
- onClick: () => u(e.id),
78
- onKeyDown: (e) => g(e, t),
79
- className: n("ttw:-mb-px ttw:cursor-pointer ttw:border-b-2 ttw:px-4 ttw:py-2.5 ttw:text-sm ttw:font-medium ttw:whitespace-nowrap ttw:focus-visible:outline-2 ttw:focus-visible:outline-offset-2 ttw:focus-visible:outline-ring", r ? "ttw:border-primary ttw:text-primary" : "ttw:border-transparent ttw:text-muted-foreground ttw:hover:border-border ttw:hover:text-foreground"),
80
- children: e.label
81
- }) }, e.id);
72
+ return /* @__PURE__ */ a("li", {
73
+ className: "ttw:shrink-0",
74
+ children: /* @__PURE__ */ a("button", {
75
+ type: "button",
76
+ ref: (e) => {
77
+ m.current[t] = e;
78
+ },
79
+ "aria-current": r ? "page" : void 0,
80
+ onClick: () => u(e.id),
81
+ onKeyDown: (e) => g(e, t),
82
+ className: n("ttw:cursor-pointer ttw:border-b-2 ttw:px-4 ttw:py-2.5 ttw:text-sm ttw:font-medium ttw:whitespace-nowrap ttw:focus-visible:-outline-offset-2 ttw:focus-visible:outline-2 ttw:focus-visible:outline-ring", r ? "ttw:border-primary ttw:text-primary" : "ttw:border-transparent ttw:text-muted-foreground ttw:hover:border-border ttw:hover:text-foreground"),
83
+ children: e.label
84
+ })
85
+ }, e.id);
82
86
  })
83
87
  })
84
88
  }), /* @__PURE__ */ a("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.2.286",
3
+ "version": "0.2.288",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {