@tesouro/embedded-components-react 0.5.90 → 0.5.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/experimental/InvoiceSettings.d.ts +263 -21
- package/dist/experimental/InvoiceSettings.js +1 -1
- package/dist/experimental/index.d.ts +263 -21
- package/dist/experimental/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index.js +8 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index2.js +23 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index3.js +24 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index4.js +24 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index5.js +18 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index6.js +40 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index7.js +35 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index8.js +34 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index10.js +145 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index11.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index2.js +8 -3
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index3.js +20 -25
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index4.js +16 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index5.js +20 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index6.js +36 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index7.js +155 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index8.js +103 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index9.js +5 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index.js +20 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index10.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index11.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index12.js +41 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index13.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index14.js +12 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index15.js +9 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index16.js +21 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index17.js +75 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index18.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index19.js +13 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index2.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index20.js +93 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index21.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index3.js +40 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index4.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index5.js +12 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index6.js +131 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index7.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index8.js +14 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index9.js +74 -0
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +27 -27
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +185 -174
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +125 -96
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +831 -826
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/packages/shared-ui-shadcn/dist/index.js +2411 -2354
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo } from 'react';
|
|
2
|
+
import { ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo, Ref } from 'react';
|
|
3
3
|
import { FallbackProps } from 'react-error-boundary';
|
|
4
4
|
|
|
5
5
|
type AuthToken = string | undefined;
|
|
@@ -627,34 +627,276 @@ interface WidgetProviderProps extends WidgetProviderBaseProps {
|
|
|
627
627
|
providerLabels?: Partial<WidgetProviderLabels>;
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
630
|
+
/**
|
|
631
|
+
* Co-located user-facing strings for this component. It takes a
|
|
632
|
+
* `labels?: Partial<…Labels>` prop merged over the `*_LABELS_EN` default.
|
|
633
|
+
*
|
|
634
|
+
* Flat, deliberately: a nested group would need `PartialDeep` from type-fest
|
|
635
|
+
* plus an explicit per-group merge (AGENTS.md), and none of this copy groups
|
|
636
|
+
* naturally.
|
|
637
|
+
*
|
|
638
|
+
* The English strings are ported verbatim from the Monite `templateSettings`
|
|
639
|
+
* screen so the native widget reads identically during side-by-side review
|
|
640
|
+
* (EMBD-5846). Reword in a separate commit, never inside the port.
|
|
641
|
+
*/
|
|
642
|
+
interface InvoiceSettingsPanelLabels {
|
|
643
|
+
submitButton: string;
|
|
644
|
+
/**
|
|
645
|
+
* Copy for the load-failure state. No Monite counterpart: its screen had no
|
|
646
|
+
* error branch at all, so this is new rather than ported.
|
|
647
|
+
*/
|
|
648
|
+
errorTitle: string;
|
|
649
|
+
errorDescription: string;
|
|
650
|
+
errorRetry: string;
|
|
651
|
+
/**
|
|
652
|
+
* Accessible name for the loading spinner. The shared `Spinner` takes no
|
|
653
|
+
* `labels` prop — its English default is an attribute on the element it
|
|
654
|
+
* renders, overridable only through `aria-label` — so without this the panel
|
|
655
|
+
* would announce English to a screen reader on an otherwise localized page.
|
|
656
|
+
*/
|
|
657
|
+
loading: string;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Co-located user-facing strings for this component. It takes a
|
|
662
|
+
* `labels?: Partial<…Labels>` prop merged over the `*_LABELS_EN` default.
|
|
663
|
+
*
|
|
664
|
+
* Flat, deliberately: a nested group would need `PartialDeep` from type-fest
|
|
665
|
+
* plus an explicit per-group merge (AGENTS.md), and none of this copy groups
|
|
666
|
+
* naturally.
|
|
667
|
+
*
|
|
668
|
+
* The English strings are ported verbatim from the Monite `templateSettings`
|
|
669
|
+
* screen so the native widget reads identically during side-by-side review
|
|
670
|
+
* (EMBD-5846). Reword in a separate commit, never inside the port.
|
|
671
|
+
*/
|
|
672
|
+
interface InvoiceNumberingSectionLabels {
|
|
673
|
+
title: string;
|
|
674
|
+
description: string;
|
|
675
|
+
previewLabel: string;
|
|
676
|
+
invoicePrefixLabel: string;
|
|
677
|
+
startingNumberLabel: string;
|
|
678
|
+
digitCountLabel: string;
|
|
679
|
+
includeDateLabel: string;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Co-located user-facing strings for this component. It takes a
|
|
684
|
+
* `labels?: Partial<…Labels>` prop merged over the `*_LABELS_EN` default.
|
|
685
|
+
*
|
|
686
|
+
* Flat, deliberately: a nested group would need `PartialDeep` from type-fest
|
|
687
|
+
* plus an explicit per-group merge (AGENTS.md), and none of this copy groups
|
|
688
|
+
* naturally.
|
|
689
|
+
*
|
|
690
|
+
* The English strings are ported verbatim from the Monite `templateSettings`
|
|
691
|
+
* screen so the native widget reads identically during side-by-side review
|
|
692
|
+
* (EMBD-5846). Reword in a separate commit, never inside the port.
|
|
693
|
+
*/
|
|
694
|
+
interface PdfSettingsSectionLabels {
|
|
695
|
+
title: string;
|
|
696
|
+
description: string;
|
|
697
|
+
bankDetailsTitle: string;
|
|
698
|
+
bankDetailsDescription: string;
|
|
699
|
+
/** Accessible name for the bank-details switch. */
|
|
700
|
+
bankDetailsToggle: string;
|
|
701
|
+
paidInvoicesTitle: string;
|
|
702
|
+
paidInvoicesDescription: string;
|
|
703
|
+
/** Emphasised second line under the paid-invoices description. */
|
|
704
|
+
paidInvoicesWarning: string;
|
|
705
|
+
/** Accessible name for the paid-invoices switch. */
|
|
706
|
+
paidInvoicesToggle: string;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Co-located user-facing strings for this component. It takes a
|
|
711
|
+
* `labels?: Partial<…Labels>` prop merged over the `*_LABELS_EN` default.
|
|
712
|
+
*
|
|
713
|
+
* Flat, deliberately: a nested group would need `PartialDeep` from type-fest
|
|
714
|
+
* plus an explicit per-group merge (AGENTS.md), and none of this copy groups
|
|
715
|
+
* naturally.
|
|
716
|
+
*
|
|
717
|
+
* The English strings are ported verbatim from the Monite `templateSettings`
|
|
718
|
+
* screen so the native widget reads identically during side-by-side review
|
|
719
|
+
* (EMBD-5846). Reword in a separate commit, never inside the port.
|
|
720
|
+
*/
|
|
721
|
+
interface DiscardChangesDialogLabels {
|
|
722
|
+
title: string;
|
|
723
|
+
/** First paragraph of the body. */
|
|
724
|
+
message: string;
|
|
725
|
+
/** Second paragraph of the body. */
|
|
726
|
+
question: string;
|
|
727
|
+
confirmButton: string;
|
|
728
|
+
cancelButton: string;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Co-located user-facing strings for the logo dropzone. Ported from Monite's
|
|
733
|
+
* `DragAndDropBox`, with the accessibility copy its markup never had.
|
|
734
|
+
*/
|
|
735
|
+
interface LogoDropzoneLabels {
|
|
736
|
+
dropPrefix: string;
|
|
737
|
+
browseAction: string;
|
|
738
|
+
/**
|
|
739
|
+
* The accepted formats and the size cap, already formatted. The component is
|
|
740
|
+
* presentational, so it never turns a numeric limit into copy: the owner
|
|
741
|
+
* holds the cap and the units, and overrides this label from its own
|
|
742
|
+
* constant.
|
|
743
|
+
*/
|
|
744
|
+
fileTypesHint: string;
|
|
745
|
+
/** Shown when `status` is `'error'` and the owner supplied no message. */
|
|
746
|
+
genericError: string;
|
|
747
|
+
/** Accessible name for the progress bar, while an upload is in flight. */
|
|
748
|
+
uploadProgress: string;
|
|
749
|
+
/** Announced once an upload finishes, where the bar carries no meaning. */
|
|
750
|
+
uploadComplete: string;
|
|
751
|
+
/** Accessible name for the button that clears a failed upload. */
|
|
752
|
+
dismissError: string;
|
|
633
753
|
}
|
|
634
|
-
|
|
635
|
-
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Co-located user-facing strings for the branding section. Ported from Monite's
|
|
757
|
+
* `LogoSection`, plus the accessible names its icon buttons carried inline.
|
|
758
|
+
*/
|
|
759
|
+
interface LogoSectionLabels {
|
|
760
|
+
title: string;
|
|
761
|
+
description: string;
|
|
762
|
+
uploadTitle: string;
|
|
763
|
+
uploadDescription: string;
|
|
764
|
+
/** Alt text for the current logo. */
|
|
765
|
+
logoAlt: string;
|
|
766
|
+
/** Shown over the current logo while a file is dragged across it. */
|
|
767
|
+
dropToReplace: string;
|
|
768
|
+
/** Accessible name for the icon button that replaces the logo. */
|
|
769
|
+
editLogo: string;
|
|
770
|
+
/** Accessible name for the icon button that removes the logo. */
|
|
771
|
+
deleteLogo: string;
|
|
636
772
|
}
|
|
637
773
|
|
|
638
|
-
|
|
774
|
+
/**
|
|
775
|
+
* Validation copy for the invoice-settings form.
|
|
776
|
+
*
|
|
777
|
+
* It lives in the feature layer rather than beside the controls it appears
|
|
778
|
+
* under, because the messages are produced by the schema, not by a component:
|
|
779
|
+
* the UI takes already-resolved strings through its `errors` prop and has no
|
|
780
|
+
* idea a rule exists. Passing them into the schema keeps the validators pure —
|
|
781
|
+
* they format a message, they do not look one up — and keeps every string a
|
|
782
|
+
* consumer can see in one overridable place.
|
|
783
|
+
*
|
|
784
|
+
* Exposed on the widget as `messageLabels`, matching the channel the chart of
|
|
785
|
+
* accounts and tags widgets use for the same job.
|
|
786
|
+
*/
|
|
787
|
+
interface InvoiceSettingsMessageLabels {
|
|
788
|
+
invoicePrefixRequired: string;
|
|
789
|
+
invoicePrefixTooLong: string;
|
|
790
|
+
customPrefixTooLong: string;
|
|
791
|
+
digitCountTooLow: string;
|
|
792
|
+
digitCountTooHigh: string;
|
|
793
|
+
/**
|
|
794
|
+
* The four document prefixes this screen does not render. A user cannot
|
|
795
|
+
* reach this message through the UI; it exists so a value that arrives empty
|
|
796
|
+
* from the API fails loudly in tests rather than silently patching a blank
|
|
797
|
+
* prefix over a good one.
|
|
798
|
+
*/
|
|
799
|
+
documentPrefixRequired: string;
|
|
800
|
+
/**
|
|
801
|
+
* `nextNumber` is the number the API will issue next for that document type,
|
|
802
|
+
* which is the floor it will accept.
|
|
803
|
+
*/
|
|
804
|
+
numberBelowNext: (nextNumber: number) => string;
|
|
805
|
+
/**
|
|
806
|
+
* Logo rejections. The first two are decided here rather than by the API, so
|
|
807
|
+
* the user hears about a bad file before uploading it; the third stands in
|
|
808
|
+
* for an API failure whose own message is not written for an end user.
|
|
809
|
+
*/
|
|
810
|
+
logoWrongFormat: string;
|
|
811
|
+
logoTooLarge: (maxSizeMb: number) => string;
|
|
812
|
+
logoUploadFailed: string;
|
|
813
|
+
/**
|
|
814
|
+
* The dropzone's format-and-size hint. It lives here, beside the rejection
|
|
815
|
+
* copy, because both are formatted from the one cap this widget enforces —
|
|
816
|
+
* the UI lib ships its own default, and a hint that advertised a different
|
|
817
|
+
* number from the one being enforced is exactly the drift this prevents.
|
|
818
|
+
*/
|
|
819
|
+
logoFileTypesHint: (maxSizeMb: number) => string;
|
|
820
|
+
/**
|
|
821
|
+
* Toast copy, ported verbatim from the Monite hooks these replace
|
|
822
|
+
* (`usePatchEntitySettings`, `useDeleteEntityLogo`) so the native widget
|
|
823
|
+
* reads identically during side-by-side review. Reword in a separate commit,
|
|
824
|
+
* never inside the port.
|
|
825
|
+
*
|
|
826
|
+
* `settingsSaveFailed` has no Monite counterpart — that mutation toasted only
|
|
827
|
+
* on success, so a failed save said nothing at all. There is no inline
|
|
828
|
+
* surface for it on this screen, unlike a rejected logo.
|
|
829
|
+
*/
|
|
830
|
+
settingsSaved: string;
|
|
831
|
+
settingsSaveFailed: string;
|
|
832
|
+
logoDeleted: string;
|
|
833
|
+
logoDeleteFailed: string;
|
|
834
|
+
}
|
|
639
835
|
|
|
640
|
-
|
|
836
|
+
/**
|
|
837
|
+
* Label override channels, one per surface the widget mounts, matching the
|
|
838
|
+
* chart-of-accounts and tags widgets. A single `labels` bag would collide the
|
|
839
|
+
* moment two of these components named a key the same way.
|
|
840
|
+
*/
|
|
841
|
+
interface InvoiceSettingsLabelProps {
|
|
842
|
+
panelLabels?: Partial<InvoiceSettingsPanelLabels>;
|
|
843
|
+
numberingLabels?: Partial<InvoiceNumberingSectionLabels>;
|
|
844
|
+
pdfLabels?: Partial<PdfSettingsSectionLabels>;
|
|
845
|
+
logoLabels?: Partial<LogoSectionLabels>;
|
|
846
|
+
dropzoneLabels?: Partial<LogoDropzoneLabels>;
|
|
847
|
+
discardLabels?: Partial<DiscardChangesDialogLabels>;
|
|
848
|
+
/** Validation and upload-rejection copy. */
|
|
849
|
+
messageLabels?: Partial<InvoiceSettingsMessageLabels>;
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* What a host can ask this widget before navigating away from it.
|
|
853
|
+
*
|
|
854
|
+
* Widgets never touch the host's router, so the widget cannot stop a navigation
|
|
855
|
+
* itself — it can only answer whether one is safe. The host asks, the user
|
|
856
|
+
* answers the discard dialog, and the host proceeds or does not.
|
|
857
|
+
*
|
|
858
|
+
* ```tsx
|
|
859
|
+
* const invoiceSettings = useRef<InvoiceSettingsHandle>(null);
|
|
860
|
+
* // ...before switching away from the Invoices section:
|
|
861
|
+
* if (await invoiceSettings.current?.confirmLeave()) setSection(next);
|
|
862
|
+
* ```
|
|
863
|
+
*
|
|
864
|
+
* **Nothing calls this yet — the Settings shell wires it in EMBD-5849**, and
|
|
865
|
+
* until it does the discard dialog cannot appear. That is not a regression from
|
|
866
|
+
* the screen this replaces: Monite opened the same dialog from exactly one
|
|
867
|
+
* place, its side sheet's close handler, and no caller in this repo has ever
|
|
868
|
+
* passed the `isDialog` prop that renders the sheet. The dialog has been
|
|
869
|
+
* unreachable in both mounts of `TemplateSettings` for as long as they have
|
|
870
|
+
* existed.
|
|
871
|
+
*
|
|
872
|
+
* The bug that makes wiring it worth doing is real and predates this port: the
|
|
873
|
+
* shell's `TabsContent` has no `forceMount`, so switching sections unmounts
|
|
874
|
+
* this widget and throws away unsaved edits with no warning. An unmount cannot
|
|
875
|
+
* be blocked from inside, so `onSectionChange` is the only place to intervene —
|
|
876
|
+
* which is why this is a question the host asks rather than something the
|
|
877
|
+
* widget enforces.
|
|
878
|
+
*/
|
|
879
|
+
interface InvoiceSettingsHandle {
|
|
880
|
+
/** `true` when there is nothing unsaved, or the user chose to discard. */
|
|
881
|
+
confirmLeave: () => Promise<boolean>;
|
|
882
|
+
}
|
|
883
|
+
type InvoiceSettingsProps = WidgetProviderProps & InvoiceSettingsLabelProps & {
|
|
884
|
+
ref?: Ref<InvoiceSettingsHandle>;
|
|
885
|
+
};
|
|
641
886
|
/**
|
|
642
887
|
* Entity invoice settings: document numbering, PDF options and the logo.
|
|
643
888
|
*
|
|
644
|
-
*
|
|
645
|
-
*
|
|
646
|
-
*
|
|
647
|
-
*
|
|
648
|
-
*
|
|
649
|
-
* published export and the Settings cutover (EMBD-5849) be wired and reviewed
|
|
650
|
-
* before that swap, so none of them move again when it happens.
|
|
889
|
+
* Native throughout as of EMBD-5848 — it was a thin wrapper over Monite's
|
|
890
|
+
* `TemplateSettings` from EMBD-5846 until the presentational layer (EMBD-5845,
|
|
891
|
+
* EMBD-5847) and the REST hooks (EMBD-5844) were both in place. The Settings
|
|
892
|
+
* widget's Invoices tab still mounts the Monite screen until EMBD-5849 cuts it
|
|
893
|
+
* over; that screen goes in EMBD-5850.
|
|
651
894
|
*
|
|
652
|
-
*
|
|
653
|
-
*
|
|
654
|
-
*
|
|
655
|
-
* recognise, and the prop would silently do nothing.
|
|
895
|
+
* `WidgetProvider` rather than `MoniteRegionProvider`: nothing here renders
|
|
896
|
+
* Monite any more, so the Monite wrapper and its `finopsThemeColors` prop have
|
|
897
|
+
* both gone from this widget's public surface.
|
|
656
898
|
*/
|
|
657
|
-
declare function InvoiceSettings(
|
|
899
|
+
declare function InvoiceSettings({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, implementation, uiFramework, analytics, disclosuresAcceptance, providerLabels, errorFallback, onError, ref, ...labelProps }: InvoiceSettingsProps): React.JSX.Element;
|
|
658
900
|
|
|
659
901
|
export { InvoiceSettings };
|
|
660
|
-
export type { InvoiceSettingsProps };
|
|
902
|
+
export type { InvoiceSettingsHandle, InvoiceSettingsProps };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { InvoiceSettings as e } from "../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/
|
|
1
|
+
import { InvoiceSettings as e } from "../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index10.js";
|
|
2
2
|
import "../libs/tesouro-embedded-components-react/settings-widget/feature/dist/index.js";
|
|
3
3
|
export { e as InvoiceSettings };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo } from 'react';
|
|
2
|
+
import { ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo, Ref } from 'react';
|
|
3
3
|
import { FallbackProps } from 'react-error-boundary';
|
|
4
4
|
|
|
5
5
|
type AuthToken = string | undefined;
|
|
@@ -627,34 +627,276 @@ interface WidgetProviderProps extends WidgetProviderBaseProps {
|
|
|
627
627
|
providerLabels?: Partial<WidgetProviderLabels>;
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
630
|
+
/**
|
|
631
|
+
* Co-located user-facing strings for this component. It takes a
|
|
632
|
+
* `labels?: Partial<…Labels>` prop merged over the `*_LABELS_EN` default.
|
|
633
|
+
*
|
|
634
|
+
* Flat, deliberately: a nested group would need `PartialDeep` from type-fest
|
|
635
|
+
* plus an explicit per-group merge (AGENTS.md), and none of this copy groups
|
|
636
|
+
* naturally.
|
|
637
|
+
*
|
|
638
|
+
* The English strings are ported verbatim from the Monite `templateSettings`
|
|
639
|
+
* screen so the native widget reads identically during side-by-side review
|
|
640
|
+
* (EMBD-5846). Reword in a separate commit, never inside the port.
|
|
641
|
+
*/
|
|
642
|
+
interface InvoiceSettingsPanelLabels {
|
|
643
|
+
submitButton: string;
|
|
644
|
+
/**
|
|
645
|
+
* Copy for the load-failure state. No Monite counterpart: its screen had no
|
|
646
|
+
* error branch at all, so this is new rather than ported.
|
|
647
|
+
*/
|
|
648
|
+
errorTitle: string;
|
|
649
|
+
errorDescription: string;
|
|
650
|
+
errorRetry: string;
|
|
651
|
+
/**
|
|
652
|
+
* Accessible name for the loading spinner. The shared `Spinner` takes no
|
|
653
|
+
* `labels` prop — its English default is an attribute on the element it
|
|
654
|
+
* renders, overridable only through `aria-label` — so without this the panel
|
|
655
|
+
* would announce English to a screen reader on an otherwise localized page.
|
|
656
|
+
*/
|
|
657
|
+
loading: string;
|
|
633
658
|
}
|
|
634
|
-
|
|
635
|
-
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Co-located user-facing strings for this component. It takes a
|
|
662
|
+
* `labels?: Partial<…Labels>` prop merged over the `*_LABELS_EN` default.
|
|
663
|
+
*
|
|
664
|
+
* Flat, deliberately: a nested group would need `PartialDeep` from type-fest
|
|
665
|
+
* plus an explicit per-group merge (AGENTS.md), and none of this copy groups
|
|
666
|
+
* naturally.
|
|
667
|
+
*
|
|
668
|
+
* The English strings are ported verbatim from the Monite `templateSettings`
|
|
669
|
+
* screen so the native widget reads identically during side-by-side review
|
|
670
|
+
* (EMBD-5846). Reword in a separate commit, never inside the port.
|
|
671
|
+
*/
|
|
672
|
+
interface InvoiceNumberingSectionLabels {
|
|
673
|
+
title: string;
|
|
674
|
+
description: string;
|
|
675
|
+
previewLabel: string;
|
|
676
|
+
invoicePrefixLabel: string;
|
|
677
|
+
startingNumberLabel: string;
|
|
678
|
+
digitCountLabel: string;
|
|
679
|
+
includeDateLabel: string;
|
|
636
680
|
}
|
|
637
681
|
|
|
638
|
-
|
|
682
|
+
/**
|
|
683
|
+
* Co-located user-facing strings for this component. It takes a
|
|
684
|
+
* `labels?: Partial<…Labels>` prop merged over the `*_LABELS_EN` default.
|
|
685
|
+
*
|
|
686
|
+
* Flat, deliberately: a nested group would need `PartialDeep` from type-fest
|
|
687
|
+
* plus an explicit per-group merge (AGENTS.md), and none of this copy groups
|
|
688
|
+
* naturally.
|
|
689
|
+
*
|
|
690
|
+
* The English strings are ported verbatim from the Monite `templateSettings`
|
|
691
|
+
* screen so the native widget reads identically during side-by-side review
|
|
692
|
+
* (EMBD-5846). Reword in a separate commit, never inside the port.
|
|
693
|
+
*/
|
|
694
|
+
interface PdfSettingsSectionLabels {
|
|
695
|
+
title: string;
|
|
696
|
+
description: string;
|
|
697
|
+
bankDetailsTitle: string;
|
|
698
|
+
bankDetailsDescription: string;
|
|
699
|
+
/** Accessible name for the bank-details switch. */
|
|
700
|
+
bankDetailsToggle: string;
|
|
701
|
+
paidInvoicesTitle: string;
|
|
702
|
+
paidInvoicesDescription: string;
|
|
703
|
+
/** Emphasised second line under the paid-invoices description. */
|
|
704
|
+
paidInvoicesWarning: string;
|
|
705
|
+
/** Accessible name for the paid-invoices switch. */
|
|
706
|
+
paidInvoicesToggle: string;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Co-located user-facing strings for this component. It takes a
|
|
711
|
+
* `labels?: Partial<…Labels>` prop merged over the `*_LABELS_EN` default.
|
|
712
|
+
*
|
|
713
|
+
* Flat, deliberately: a nested group would need `PartialDeep` from type-fest
|
|
714
|
+
* plus an explicit per-group merge (AGENTS.md), and none of this copy groups
|
|
715
|
+
* naturally.
|
|
716
|
+
*
|
|
717
|
+
* The English strings are ported verbatim from the Monite `templateSettings`
|
|
718
|
+
* screen so the native widget reads identically during side-by-side review
|
|
719
|
+
* (EMBD-5846). Reword in a separate commit, never inside the port.
|
|
720
|
+
*/
|
|
721
|
+
interface DiscardChangesDialogLabels {
|
|
722
|
+
title: string;
|
|
723
|
+
/** First paragraph of the body. */
|
|
724
|
+
message: string;
|
|
725
|
+
/** Second paragraph of the body. */
|
|
726
|
+
question: string;
|
|
727
|
+
confirmButton: string;
|
|
728
|
+
cancelButton: string;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Co-located user-facing strings for the logo dropzone. Ported from Monite's
|
|
733
|
+
* `DragAndDropBox`, with the accessibility copy its markup never had.
|
|
734
|
+
*/
|
|
735
|
+
interface LogoDropzoneLabels {
|
|
736
|
+
dropPrefix: string;
|
|
737
|
+
browseAction: string;
|
|
738
|
+
/**
|
|
739
|
+
* The accepted formats and the size cap, already formatted. The component is
|
|
740
|
+
* presentational, so it never turns a numeric limit into copy: the owner
|
|
741
|
+
* holds the cap and the units, and overrides this label from its own
|
|
742
|
+
* constant.
|
|
743
|
+
*/
|
|
744
|
+
fileTypesHint: string;
|
|
745
|
+
/** Shown when `status` is `'error'` and the owner supplied no message. */
|
|
746
|
+
genericError: string;
|
|
747
|
+
/** Accessible name for the progress bar, while an upload is in flight. */
|
|
748
|
+
uploadProgress: string;
|
|
749
|
+
/** Announced once an upload finishes, where the bar carries no meaning. */
|
|
750
|
+
uploadComplete: string;
|
|
751
|
+
/** Accessible name for the button that clears a failed upload. */
|
|
752
|
+
dismissError: string;
|
|
753
|
+
}
|
|
639
754
|
|
|
640
|
-
|
|
755
|
+
/**
|
|
756
|
+
* Co-located user-facing strings for the branding section. Ported from Monite's
|
|
757
|
+
* `LogoSection`, plus the accessible names its icon buttons carried inline.
|
|
758
|
+
*/
|
|
759
|
+
interface LogoSectionLabels {
|
|
760
|
+
title: string;
|
|
761
|
+
description: string;
|
|
762
|
+
uploadTitle: string;
|
|
763
|
+
uploadDescription: string;
|
|
764
|
+
/** Alt text for the current logo. */
|
|
765
|
+
logoAlt: string;
|
|
766
|
+
/** Shown over the current logo while a file is dragged across it. */
|
|
767
|
+
dropToReplace: string;
|
|
768
|
+
/** Accessible name for the icon button that replaces the logo. */
|
|
769
|
+
editLogo: string;
|
|
770
|
+
/** Accessible name for the icon button that removes the logo. */
|
|
771
|
+
deleteLogo: string;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Validation copy for the invoice-settings form.
|
|
776
|
+
*
|
|
777
|
+
* It lives in the feature layer rather than beside the controls it appears
|
|
778
|
+
* under, because the messages are produced by the schema, not by a component:
|
|
779
|
+
* the UI takes already-resolved strings through its `errors` prop and has no
|
|
780
|
+
* idea a rule exists. Passing them into the schema keeps the validators pure —
|
|
781
|
+
* they format a message, they do not look one up — and keeps every string a
|
|
782
|
+
* consumer can see in one overridable place.
|
|
783
|
+
*
|
|
784
|
+
* Exposed on the widget as `messageLabels`, matching the channel the chart of
|
|
785
|
+
* accounts and tags widgets use for the same job.
|
|
786
|
+
*/
|
|
787
|
+
interface InvoiceSettingsMessageLabels {
|
|
788
|
+
invoicePrefixRequired: string;
|
|
789
|
+
invoicePrefixTooLong: string;
|
|
790
|
+
customPrefixTooLong: string;
|
|
791
|
+
digitCountTooLow: string;
|
|
792
|
+
digitCountTooHigh: string;
|
|
793
|
+
/**
|
|
794
|
+
* The four document prefixes this screen does not render. A user cannot
|
|
795
|
+
* reach this message through the UI; it exists so a value that arrives empty
|
|
796
|
+
* from the API fails loudly in tests rather than silently patching a blank
|
|
797
|
+
* prefix over a good one.
|
|
798
|
+
*/
|
|
799
|
+
documentPrefixRequired: string;
|
|
800
|
+
/**
|
|
801
|
+
* `nextNumber` is the number the API will issue next for that document type,
|
|
802
|
+
* which is the floor it will accept.
|
|
803
|
+
*/
|
|
804
|
+
numberBelowNext: (nextNumber: number) => string;
|
|
805
|
+
/**
|
|
806
|
+
* Logo rejections. The first two are decided here rather than by the API, so
|
|
807
|
+
* the user hears about a bad file before uploading it; the third stands in
|
|
808
|
+
* for an API failure whose own message is not written for an end user.
|
|
809
|
+
*/
|
|
810
|
+
logoWrongFormat: string;
|
|
811
|
+
logoTooLarge: (maxSizeMb: number) => string;
|
|
812
|
+
logoUploadFailed: string;
|
|
813
|
+
/**
|
|
814
|
+
* The dropzone's format-and-size hint. It lives here, beside the rejection
|
|
815
|
+
* copy, because both are formatted from the one cap this widget enforces —
|
|
816
|
+
* the UI lib ships its own default, and a hint that advertised a different
|
|
817
|
+
* number from the one being enforced is exactly the drift this prevents.
|
|
818
|
+
*/
|
|
819
|
+
logoFileTypesHint: (maxSizeMb: number) => string;
|
|
820
|
+
/**
|
|
821
|
+
* Toast copy, ported verbatim from the Monite hooks these replace
|
|
822
|
+
* (`usePatchEntitySettings`, `useDeleteEntityLogo`) so the native widget
|
|
823
|
+
* reads identically during side-by-side review. Reword in a separate commit,
|
|
824
|
+
* never inside the port.
|
|
825
|
+
*
|
|
826
|
+
* `settingsSaveFailed` has no Monite counterpart — that mutation toasted only
|
|
827
|
+
* on success, so a failed save said nothing at all. There is no inline
|
|
828
|
+
* surface for it on this screen, unlike a rejected logo.
|
|
829
|
+
*/
|
|
830
|
+
settingsSaved: string;
|
|
831
|
+
settingsSaveFailed: string;
|
|
832
|
+
logoDeleted: string;
|
|
833
|
+
logoDeleteFailed: string;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* Label override channels, one per surface the widget mounts, matching the
|
|
838
|
+
* chart-of-accounts and tags widgets. A single `labels` bag would collide the
|
|
839
|
+
* moment two of these components named a key the same way.
|
|
840
|
+
*/
|
|
841
|
+
interface InvoiceSettingsLabelProps {
|
|
842
|
+
panelLabels?: Partial<InvoiceSettingsPanelLabels>;
|
|
843
|
+
numberingLabels?: Partial<InvoiceNumberingSectionLabels>;
|
|
844
|
+
pdfLabels?: Partial<PdfSettingsSectionLabels>;
|
|
845
|
+
logoLabels?: Partial<LogoSectionLabels>;
|
|
846
|
+
dropzoneLabels?: Partial<LogoDropzoneLabels>;
|
|
847
|
+
discardLabels?: Partial<DiscardChangesDialogLabels>;
|
|
848
|
+
/** Validation and upload-rejection copy. */
|
|
849
|
+
messageLabels?: Partial<InvoiceSettingsMessageLabels>;
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* What a host can ask this widget before navigating away from it.
|
|
853
|
+
*
|
|
854
|
+
* Widgets never touch the host's router, so the widget cannot stop a navigation
|
|
855
|
+
* itself — it can only answer whether one is safe. The host asks, the user
|
|
856
|
+
* answers the discard dialog, and the host proceeds or does not.
|
|
857
|
+
*
|
|
858
|
+
* ```tsx
|
|
859
|
+
* const invoiceSettings = useRef<InvoiceSettingsHandle>(null);
|
|
860
|
+
* // ...before switching away from the Invoices section:
|
|
861
|
+
* if (await invoiceSettings.current?.confirmLeave()) setSection(next);
|
|
862
|
+
* ```
|
|
863
|
+
*
|
|
864
|
+
* **Nothing calls this yet — the Settings shell wires it in EMBD-5849**, and
|
|
865
|
+
* until it does the discard dialog cannot appear. That is not a regression from
|
|
866
|
+
* the screen this replaces: Monite opened the same dialog from exactly one
|
|
867
|
+
* place, its side sheet's close handler, and no caller in this repo has ever
|
|
868
|
+
* passed the `isDialog` prop that renders the sheet. The dialog has been
|
|
869
|
+
* unreachable in both mounts of `TemplateSettings` for as long as they have
|
|
870
|
+
* existed.
|
|
871
|
+
*
|
|
872
|
+
* The bug that makes wiring it worth doing is real and predates this port: the
|
|
873
|
+
* shell's `TabsContent` has no `forceMount`, so switching sections unmounts
|
|
874
|
+
* this widget and throws away unsaved edits with no warning. An unmount cannot
|
|
875
|
+
* be blocked from inside, so `onSectionChange` is the only place to intervene —
|
|
876
|
+
* which is why this is a question the host asks rather than something the
|
|
877
|
+
* widget enforces.
|
|
878
|
+
*/
|
|
879
|
+
interface InvoiceSettingsHandle {
|
|
880
|
+
/** `true` when there is nothing unsaved, or the user chose to discard. */
|
|
881
|
+
confirmLeave: () => Promise<boolean>;
|
|
882
|
+
}
|
|
883
|
+
type InvoiceSettingsProps = WidgetProviderProps & InvoiceSettingsLabelProps & {
|
|
884
|
+
ref?: Ref<InvoiceSettingsHandle>;
|
|
885
|
+
};
|
|
641
886
|
/**
|
|
642
887
|
* Entity invoice settings: document numbering, PDF options and the logo.
|
|
643
888
|
*
|
|
644
|
-
*
|
|
645
|
-
*
|
|
646
|
-
*
|
|
647
|
-
*
|
|
648
|
-
*
|
|
649
|
-
* published export and the Settings cutover (EMBD-5849) be wired and reviewed
|
|
650
|
-
* before that swap, so none of them move again when it happens.
|
|
889
|
+
* Native throughout as of EMBD-5848 — it was a thin wrapper over Monite's
|
|
890
|
+
* `TemplateSettings` from EMBD-5846 until the presentational layer (EMBD-5845,
|
|
891
|
+
* EMBD-5847) and the REST hooks (EMBD-5844) were both in place. The Settings
|
|
892
|
+
* widget's Invoices tab still mounts the Monite screen until EMBD-5849 cuts it
|
|
893
|
+
* over; that screen goes in EMBD-5850.
|
|
651
894
|
*
|
|
652
|
-
*
|
|
653
|
-
*
|
|
654
|
-
*
|
|
655
|
-
* recognise, and the prop would silently do nothing.
|
|
895
|
+
* `WidgetProvider` rather than `MoniteRegionProvider`: nothing here renders
|
|
896
|
+
* Monite any more, so the Monite wrapper and its `finopsThemeColors` prop have
|
|
897
|
+
* both gone from this widget's public surface.
|
|
656
898
|
*/
|
|
657
|
-
declare function InvoiceSettings(
|
|
899
|
+
declare function InvoiceSettings({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, implementation, uiFramework, analytics, disclosuresAcceptance, providerLabels, errorFallback, onError, ref, ...labelProps }: InvoiceSettingsProps): React.JSX.Element;
|
|
658
900
|
|
|
659
901
|
interface CheckAmountAndDetailScreenLabels {
|
|
660
902
|
title: string;
|
|
@@ -767,4 +1009,4 @@ interface RemoteCheckCaptureWidgetProps extends WidgetProviderProps {
|
|
|
767
1009
|
declare function RemoteCheckCaptureWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, implementation, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, providerLabels, labels, onDepositComplete, }: RemoteCheckCaptureWidgetProps): React.JSX.Element;
|
|
768
1010
|
|
|
769
1011
|
export { InvoiceSettings, RemoteCheckCaptureWidget };
|
|
770
|
-
export type { InvoiceSettingsProps, RemoteCheckCaptureWidgetProps };
|
|
1012
|
+
export type { InvoiceSettingsHandle, InvoiceSettingsProps, RemoteCheckCaptureWidgetProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InvoiceSettings as e } from "../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/
|
|
1
|
+
import { InvoiceSettings as e } from "../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index10.js";
|
|
2
2
|
import "./InvoiceSettings.js";
|
|
3
3
|
import { RemoteCheckCaptureWidget as t } from "../libs/tesouro-embedded-components-react/remote-check-capture/feature/dist/lib/RemoteCheckCaptureWidget/RemoteCheckCaptureWidget.js";
|
|
4
4
|
import "./RemoteCheckCapture.js";
|
|
@@ -3,6 +3,6 @@ import { SettingsSection as e } from "./index4.js";
|
|
|
3
3
|
import { HELP_FAQ_EN as t } from "../../help/ui/contract/dist/index3.js";
|
|
4
4
|
import { SettingsWidget as n } from "./index6.js";
|
|
5
5
|
import "./index7.js";
|
|
6
|
-
import { InvoiceSettings as r } from "../../invoice-settings/feature/dist/
|
|
6
|
+
import { InvoiceSettings as r } from "../../invoice-settings/feature/dist/index10.js";
|
|
7
7
|
import "../../invoice-settings/feature/dist/index.js";
|
|
8
8
|
export { t as HELP_FAQ_EN, r as InvoiceSettings, e as SettingsSection, n as SettingsWidget };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useMyEntityQuery as e } from "./index2.js";
|
|
2
|
+
import { useEntitySettingsQuery as t } from "./index3.js";
|
|
3
|
+
import { useNextDocumentNumbersQuery as n } from "./index4.js";
|
|
4
|
+
import "./index5.js";
|
|
5
|
+
import { useUpdateEntitySettingsMutation as r } from "./index6.js";
|
|
6
|
+
import { useUploadEntityLogoMutation as i } from "./index7.js";
|
|
7
|
+
import { useDeleteEntityLogoMutation as a } from "./index8.js";
|
|
8
|
+
export { a as useDeleteEntityLogoMutation, t as useEntitySettingsQuery, e as useMyEntityQuery, n as useNextDocumentNumbersQuery, r as useUpdateEntitySettingsMutation, i as useUploadEntityLogoMutation };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { useEmbedApi as e } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
6
|
+
import { organizationHeaders as t } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
7
|
+
import { getEntityUsersMyEntityOptions as n } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
8
|
+
import { withAuthEpoch as r } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
|
|
9
|
+
import "../../../../shared/data-access/dist/index.js";
|
|
10
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
11
|
+
//#region ../../libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index2.js
|
|
12
|
+
function a() {
|
|
13
|
+
let { client: a, organizationId: o, widgetToken: s, authEpoch: c } = e(), l = !!(o && s), u = n({
|
|
14
|
+
client: a,
|
|
15
|
+
headers: t(o)
|
|
16
|
+
});
|
|
17
|
+
return i({
|
|
18
|
+
...r(u, c),
|
|
19
|
+
enabled: l
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { a as useMyEntityQuery };
|