@tesouro/embedded-components-react 0.4.31 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/README.md +17 -47
  2. package/dist/index.d.ts +2 -27
  3. package/dist/index.js +20 -26
  4. package/dist/lib/ExpenseManagementWidget.js +1 -1
  5. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index.js +3 -3
  6. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index10.js +74 -1
  7. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index11.js +11 -247
  8. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index12.js +2 -2
  9. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index13.js +34 -57
  10. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index14.js +1 -0
  11. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index8.js +253 -2
  12. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index9.js +2 -48
  13. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/index.js +2 -1
  14. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ReceiptMatchWidget/lib/ReceiptMatchLauncher.js +28 -0
  15. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ReceiptMatchWidget/lib/labels.js +4 -1
  16. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  17. package/package.json +1 -1
  18. package/dist/lib/ExpenseApprovalPoliciesWidget.d.ts +0 -639
  19. package/dist/lib/ExpenseApprovalPoliciesWidget.js +0 -3
  20. package/dist/lib/ExpenseRequirementsWidget.d.ts +0 -639
  21. package/dist/lib/ExpenseRequirementsWidget.js +0 -3
  22. package/dist/lib/ReceiptMatchWidget.d.ts +0 -640
  23. package/dist/lib/ReceiptMatchWidget.js +0 -3
package/README.md CHANGED
@@ -355,30 +355,29 @@ A composite expense widget for receipt upload, matching slots, approval policies
355
355
 
356
356
  #### Props
357
357
 
358
- | Prop | Type | Default | Description |
359
- | --------------------- | -------------------------- | ------------------------ | -------------------------------------------------- |
360
- | `labels` | `Partial<Labels>` | English labels | Overrides tab and heading copy. |
361
- | `receiptUpload` | `UploadReceiptWidgetProps` | `undefined` | Enables the default receipt upload control. |
362
- | `receiptsContent` | `ReactNode` | Upload widget or empty | Replaces the receipts tab content. |
363
- | `matchingContent` | `ReactNode` | Empty | Supplies host-owned matching UI without URL state. |
364
- | `policiesContent` | `ReactNode` | Approval policies widget | Replaces the policies tab content. |
365
- | `requirementsContent` | `ReactNode` | Requirements widget | Replaces the requirements tab content. |
358
+ | Prop | Type | Default | Description |
359
+ | --------------------- | -------------------------- | ------------------------ | --------------------------------------------- |
360
+ | `labels` | `Partial<Labels>` | English labels | Overrides tab and heading copy. |
361
+ | `receiptUpload` | `UploadReceiptWidgetProps` | `undefined` | Enables the default receipt upload control. |
362
+ | `receiptsContent` | `ReactNode` | Upload widget or empty | Replaces the receipts tab content. |
363
+ | `matchingContent` | `ReactNode` | Receipt matching | Replaces the matching tab content. |
364
+ | `policiesContent` | `ReactNode` | Approval policies widget | Replaces the policies tab content. |
365
+ | `requirementsContent` | `ReactNode` | Requirements widget | Replaces the requirements tab content. |
366
366
 
367
- ### ExpenseApprovalPoliciesWidget
368
-
369
- Lets an organization view and manage its expense approval rules — each rule maps an amount range to an outcome (auto-approve or require approval) and, where approval is required, the approving roles. It is backed by the embedded REST API.
370
-
371
- #### Props
372
-
373
- _No props beyond the shared [auth/scope props](#providers)._
367
+ ### UploadReceiptWidget
374
368
 
375
- ### ExpenseRequirementsWidget
369
+ A self-contained "Upload receipts" control: a toggle button that opens a popover with a drag-and-drop / click-to-browse file picker plus a copyable forwarding email address. It is a controlled, presentational widget — the host owns the actual upload via `onFileUpload` and toasts batch progress, success, and failure.
376
370
 
377
- An editable settings surface for an organization's transaction validation rules. It lets an admin toggle whether a receipt and a description/memo are required on expenses, set per-field amount thresholds, and save the changes back to the embedded REST API.
371
+ _Standalone presentational widget — it does not take the shared auth/scope props._
378
372
 
379
373
  #### Props
380
374
 
381
- _No props beyond the shared [auth/scope props](#providers)._
375
+ | Prop | Type | Default | Description |
376
+ | ----------------- | --------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
377
+ | `emailAddress` | `string` | _required_ | Forwarding email address shown in the popover with a copy button; receipts emailed here are processed automatically. |
378
+ | `onFileUpload` | `(file: File) => unknown \| Promise<unknown>` | `undefined` | Called once per selected file. The widget awaits each call and counts resolutions vs. rejections to drive its toasts. Omit to disable uploading. |
379
+ | `onAwaitMatching` | `(uploadedCount: number) => Promise<ReceiptMatchSummary>` | `undefined` | Awaited after every file in a batch has uploaded. Resolve once the backend has finished OCR and auto-matching, and the widget reports the aggregate outcome in its batch toast. Omit to stop at the upload confirmation. |
380
+ | `isUploading` | `boolean` | `false` | Host-controlled loading flag. While `true` (or while a batch is in flight) the popover shows a processing state and blocks new uploads. |
382
381
 
383
382
  ### BalancesWidget
384
383
 
@@ -500,20 +499,6 @@ A self-contained native widget for listing, creating, editing, and acting on cus
500
499
  | `productMessageLabels` | `Partial<ProductMessageLabels>` | English defaults | Overrides product flow validation and error messages. |
501
500
  | `counterpartMessageLabels` | `Partial<CounterpartMessageLabels>` | English defaults | Overrides customer flow validation and error messages. |
502
501
 
503
- ### ReceiptMatchWidget
504
-
505
- A slide-out wizard for attaching uploaded receipts to bank-card transactions. It lists the signed-in user's unmatched receipts, lets them pick a transaction per receipt, and persists each match against the embedded REST API.
506
-
507
- #### Props
508
-
509
- | Prop | Type | Default | Description |
510
- | --------------------------- | ------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
511
- | `isOpen` | `boolean` | `false` | Controls sidebar visibility. The widget renders `null` while falsy and opens when true; it also closes itself when a flow finishes. |
512
- | `onClose` | `() => void` | `undefined` | Called on every dismissal (Done, attach, Esc, overlay). Provide it to keep your `isOpen` state in sync — the widget still self-closes if omitted. |
513
- | `preSelectedReceiptIds` | `string[]` | `[]` | Receipt ids checked when the wizard opens, seeding the batch selection. |
514
- | `targetTransactionId` | `string` | `undefined` | Attach mode: when set, the user picks one receipt and it is attached directly to this transaction (single-select, no transaction-search step). |
515
- | `onSingleTransactionUpdate` | `() => void` | `undefined` | Called after a successful attach in `targetTransactionId` mode, before the widget closes. Use to refresh the host's view of that transaction. |
516
-
517
502
  ### SettingsWidget
518
503
 
519
504
  A composite settings widget that combines Monite document settings, tags, GL codes, and expense configuration.
@@ -556,21 +541,6 @@ A self-contained banking widget for creating book or ACH transfers and reviewing
556
541
  | `defaultIsTransferMoneyOpen` | `boolean` | `false` | The modal's state on first render, for a host that only wants to seed it. Ignored when `isTransferMoneyOpen` is supplied. |
557
542
  | `onTransferMoneyOpenChange` | `(open: boolean) => void` | `undefined` | Called on every open and close — the **Transfer money** CTA, the modal's own dismissals (Esc, overlay, close), and the close after a completed transfer. |
558
543
 
559
- ### UploadReceiptWidget
560
-
561
- A self-contained "Upload receipts" control: a toggle button that opens a popover with a drag-and-drop / click-to-browse file picker plus a copyable forwarding email address. It is a controlled, presentational widget — the host owns the actual upload via `onFileUpload` and toasts batch progress, success, and failure.
562
-
563
- _Standalone presentational widget — it does not take the shared auth/scope props._
564
-
565
- #### Props
566
-
567
- | Prop | Type | Default | Description |
568
- | ----------------- | --------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
569
- | `emailAddress` | `string` | _required_ | Forwarding email address shown in the popover with a copy button; receipts emailed here are processed automatically. |
570
- | `onFileUpload` | `(file: File) => unknown \| Promise<unknown>` | `undefined` | Called once per selected file. The widget awaits each call and counts resolutions vs. rejections to drive its toasts. Omit to disable uploading. |
571
- | `onAwaitMatching` | `(uploadedCount: number) => Promise<ReceiptMatchSummary>` | `undefined` | Awaited after every file in a batch has uploaded. Resolve once the backend has finished OCR and auto-matching, and the widget reports the aggregate outcome in its batch toast. Omit to stop at the upload confirmation. |
572
- | `isUploading` | `boolean` | `false` | Host-controlled loading flag. While `true` (or while a batch is in flight) the popover shows a processing state and blocks new uploads. |
573
-
574
544
  <!-- END GENERATED REFERENCE -->
575
545
 
576
546
  ## UI frameworks (shadcn default, Tecton optional)
package/dist/index.d.ts CHANGED
@@ -3748,31 +3748,6 @@ interface ExpenseManagementWidgetProps extends WidgetProviderProps {
3748
3748
  }
3749
3749
  declare function ExpenseManagementWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, implementation, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, providerLabels, ...innerProps }: ExpenseManagementWidgetProps): React.JSX.Element;
3750
3750
 
3751
- type ReceiptMatchWidgetProps = WidgetProviderProps & {
3752
- isOpen?: boolean;
3753
- preSelectedReceiptIds?: string[];
3754
- onClose?: () => void;
3755
- targetTransactionId?: string;
3756
- onSingleTransactionUpdate?: () => void;
3757
- };
3758
- declare function ReceiptMatchWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, implementation, uiFramework, errorFallback, onError, disclosuresAcceptance, providerLabels, isOpen, preSelectedReceiptIds, onClose, targetTransactionId, onSingleTransactionUpdate, }: ReceiptMatchWidgetProps): React.JSX.Element;
3759
-
3760
- type ExpenseApprovalPoliciesWidgetProps = WidgetProviderProps & {
3761
- /** @deprecated Use `widgetToken` instead */
3762
- token?: string | null;
3763
- /** @deprecated Use `organizationId` instead */
3764
- orgId?: string | null;
3765
- };
3766
- declare function ExpenseApprovalPoliciesWidget({ token, orgId, widgetToken, organizationId, baseUrl, configClient, gatewayRouting, linkComponent, implementation, uiFramework, errorFallback, onError, disclosuresAcceptance, providerLabels, }?: ExpenseApprovalPoliciesWidgetProps): React.JSX.Element;
3767
-
3768
- type ExpenseRequirementsWidgetProps = WidgetProviderProps & {
3769
- /** @deprecated Use `widgetToken` instead */
3770
- token?: string | null;
3771
- /** @deprecated Use `organizationId` instead */
3772
- orgId?: string | null;
3773
- };
3774
- declare function ExpenseRequirementsWidget({ token, orgId, widgetToken, organizationId, baseUrl, configClient, gatewayRouting, linkComponent, implementation, uiFramework, errorFallback, onError, disclosuresAcceptance, providerLabels, }?: ExpenseRequirementsWidgetProps): React.JSX.Element;
3775
-
3776
3751
  type ReceivablesWidgetMoniteProps = MoniteRegionProviderProps & Omit<ReceivablesProps, 'pageTitleComponent' | 'initialView' | 'initialCounterpartId'> & {
3777
3752
  pageTitleComponent?: ReceivablesProps['pageTitleComponent'];
3778
3753
  };
@@ -4695,5 +4670,5 @@ interface CheckAmountAndDetailScreenProps {
4695
4670
 
4696
4671
  type PendingFeatureStyleSources = CheckAmountAndDetailScreenProps | GapCoverageAlertProps | NoPolicyBannerProps;
4697
4672
 
4698
- export { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN, ADDITIONAL_OWNERS_LABELS_EN, AcceptDisclosuresWidget, BALANCES_WIDGET_LABELS_EN, BUSINESS_DETAILS_LABELS_EN, BalancesWidget, BankAccountOnboardingWidget, BankAccountsWidget, BillPayWidget, CardDetailsWidget, CounterpartsWidget, CreditCardsWidget, DebitCardsWidget, ERROR_STATE_ID, ExpenseApprovalPoliciesWidget, ExpenseManagementWidget, ExpenseRequirementsWidget, HELP_FAQ_EN, INSIGHTS_FEATURE_LABELS_EN, INSIGHTS_WIDGET_LABELS_EN, Implementation, InsightsWidget, ReceivablesWidgetMonite as InvoicingWidget, LinkedAccountsWidget, PERSONAL_DETAILS_LABELS_EN, ProductsWidget, RESULT_LABELS_EN, ReceiptMatchWidget, ReceivablesWidget, RefreshingRootWidgetProvider, RootWidgetProvider, SINGLE_INSIGHT_LABELS_EN, SettingsSection, SettingsWidget, DEFAULT_FEATURE_LABELS as TRANSFERS_FEATURE_LABELS_EN, TRANSFERS_WIDGET_LABELS_EN, TransfersWidget, UIFramework, UploadReceiptWidget, WIDGET_SUITE_DEFAULT_SECTIONS, WIDGET_SUITE_LABELS_EN, WidgetProvider, WidgetSuite, WidgetSuiteSectionId, WidgetTokenRefreshProvider, cloneEmbeddedClient, getGlobalWidgetConfig, getGlobalWidgetInitState, registerDesignSystemEnsurer, registerUIRenderers, setGlobalWidgetConfig, subscribeToGlobalWidgetInitState, updateGlobalWidgetConfig, useDisclosuresAcceptanceSurface, useOwnWidgetConfig, useRefetchWidget, useWidgetConfig, useWidgetError, useWidgetInitStaleForToken, useWidgetLoading, useWidgetToken };
4699
- export type { AcceptDisclosuresWidgetLabels, AcceptDisclosuresWidgetProps, Labels$3 as AccountDetailsWidgetLabels, ActivateCardPanelLabels, AdditionalOwner, AdditionalOwnersLabels, AddressFormSheetLabels, BalancesWidgetLabels, BalancesWidgetProps, BankAccountFormSheetLabels, BankAccountOnboardingWidgetLabels, BankAccountOnboardingWidgetProps, FeatureLabels$3 as BankAccountsWidgetFeatureLabels, Labels$4 as BankAccountsWidgetLabels, BankAccountsWidgetProps, BillPayWidgetProps, BusinessDetailsLabels, BusinessDetailsValues, CardDetailsFeatureLabels, CardDetailsPanelLabels as CardDetailsWidgetLabels, CardDetailsWidgetProps, CardsFeatureLabels, CardsListLabels as CardsLabels, CardsPagination, CompanyStructureValue, ConfirmDeleteDialogLabels, CounterpartDetailsSheetLabels, CounterpartFormSheetLabels, CounterpartMessageLabels, CounterpartMode, CounterpartsScreenLabels, CounterpartsWidgetProps, CreditCardsWidgetProps, DebitCardsWidgetProps, DisclosureLinks, EmbeddedClient, ExpenseApprovalPoliciesWidgetProps, Labels$1 as ExpenseManagementWidgetLabels, ExpenseManagementWidgetProps, ExpenseRequirementsWidgetProps, HelpFaqAnswer, HelpFaqBullet, HelpFaqBulletType, HelpFaqItem, HelpFaqSection, InsightsFeatureLabels, InsightsWidgetLabels, InsightsWidgetProps, ReceivablesWidgetMoniteProps as InvoicingWidgetProps, LinkComponent, LinkComponentProps, FeatureLabels as LinkedAccountsWidgetFeatureLabels, Labels as LinkedAccountsWidgetLabels, LinkedAccountsWidgetProps, MarketingWidgetContent, MeasureUnitDeleteDialogLabels, MeasureUnitsManagerLabels, PendingFeatureStyleSources, PersonalDetailsLabels, PersonalDetailsValues, ProductDeleteDialogLabels, ProductDetailsSheetLabels, ProductFormSheetLabels, ProductMessageLabels, ProductsScreenLabels, ProductsWidgetProps, ReceiptMatchSummary, ReceiptMatchWidgetProps, ReceivableActionDialogLabels, ReceivableDetailsSheetLabelOverrides, ReceivableDetailsSheetLabels, ReceivableDocumentType, ReceivableFormSheetLabels, ReceivableMessageLabels, ReceivablePaymentDialogLabels, ReceivableSendDialogLabels, ReceivableStatusBadgeLabels, ReceivablesScreenLabelOverrides, ReceivablesScreenLabels, ReceivablesWidgetProps, ReceivablesWidgetTab, RefreshingRootWidgetProviderProps, ResultLabels, RootWidgetProviderProps, SettingsWidgetAdditionalSection, FeatureLabels$2 as SettingsWidgetFeatureLabels, Labels$2 as SettingsWidgetLabels, SettingsWidgetProps, SettingsWidgetSection, SettingsWidgetSectionId, SingleInsightLabels, FeatureLabels$1 as TransfersWidgetFeatureLabels, TransfersWidgetLabels, TransfersWidgetProps, UploadReceiptWidgetProps, WidgetConfig, WidgetConfigInput, WidgetInitResponse, WidgetInitState, WidgetProviderLabels, WidgetProviderProps, WidgetSuiteCardsLabels, WidgetSuiteDashboardLabels, WidgetSuiteDisclosureLabels, WidgetSuiteExpensesLabels, WidgetSuiteLabelOverrides, WidgetSuiteLabels, WidgetSuiteMenuLabels, WidgetSuiteProps, WidgetSuiteSectionContentLabels, WidgetSuiteSectionTitleLabels, WidgetTokenFetcher, WidgetTokenManager, WidgetTokenRefreshProviderProps, WidgetTokenState };
4673
+ export { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN, ADDITIONAL_OWNERS_LABELS_EN, AcceptDisclosuresWidget, BALANCES_WIDGET_LABELS_EN, BUSINESS_DETAILS_LABELS_EN, BalancesWidget, BankAccountOnboardingWidget, BankAccountsWidget, BillPayWidget, CardDetailsWidget, CounterpartsWidget, CreditCardsWidget, DebitCardsWidget, ERROR_STATE_ID, ExpenseManagementWidget, HELP_FAQ_EN, INSIGHTS_FEATURE_LABELS_EN, INSIGHTS_WIDGET_LABELS_EN, Implementation, InsightsWidget, ReceivablesWidgetMonite as InvoicingWidget, LinkedAccountsWidget, PERSONAL_DETAILS_LABELS_EN, ProductsWidget, RESULT_LABELS_EN, ReceivablesWidget, RefreshingRootWidgetProvider, RootWidgetProvider, SINGLE_INSIGHT_LABELS_EN, SettingsSection, SettingsWidget, DEFAULT_FEATURE_LABELS as TRANSFERS_FEATURE_LABELS_EN, TRANSFERS_WIDGET_LABELS_EN, TransfersWidget, UIFramework, UploadReceiptWidget, WIDGET_SUITE_DEFAULT_SECTIONS, WIDGET_SUITE_LABELS_EN, WidgetProvider, WidgetSuite, WidgetSuiteSectionId, WidgetTokenRefreshProvider, cloneEmbeddedClient, getGlobalWidgetConfig, getGlobalWidgetInitState, registerDesignSystemEnsurer, registerUIRenderers, setGlobalWidgetConfig, subscribeToGlobalWidgetInitState, updateGlobalWidgetConfig, useDisclosuresAcceptanceSurface, useOwnWidgetConfig, useRefetchWidget, useWidgetConfig, useWidgetError, useWidgetInitStaleForToken, useWidgetLoading, useWidgetToken };
4674
+ export type { AcceptDisclosuresWidgetLabels, AcceptDisclosuresWidgetProps, Labels$3 as AccountDetailsWidgetLabels, ActivateCardPanelLabels, AdditionalOwner, AdditionalOwnersLabels, AddressFormSheetLabels, BalancesWidgetLabels, BalancesWidgetProps, BankAccountFormSheetLabels, BankAccountOnboardingWidgetLabels, BankAccountOnboardingWidgetProps, FeatureLabels$3 as BankAccountsWidgetFeatureLabels, Labels$4 as BankAccountsWidgetLabels, BankAccountsWidgetProps, BillPayWidgetProps, BusinessDetailsLabels, BusinessDetailsValues, CardDetailsFeatureLabels, CardDetailsPanelLabels as CardDetailsWidgetLabels, CardDetailsWidgetProps, CardsFeatureLabels, CardsListLabels as CardsLabels, CardsPagination, CompanyStructureValue, ConfirmDeleteDialogLabels, CounterpartDetailsSheetLabels, CounterpartFormSheetLabels, CounterpartMessageLabels, CounterpartMode, CounterpartsScreenLabels, CounterpartsWidgetProps, CreditCardsWidgetProps, DebitCardsWidgetProps, DisclosureLinks, EmbeddedClient, Labels$1 as ExpenseManagementWidgetLabels, ExpenseManagementWidgetProps, HelpFaqAnswer, HelpFaqBullet, HelpFaqBulletType, HelpFaqItem, HelpFaqSection, InsightsFeatureLabels, InsightsWidgetLabels, InsightsWidgetProps, ReceivablesWidgetMoniteProps as InvoicingWidgetProps, LinkComponent, LinkComponentProps, FeatureLabels as LinkedAccountsWidgetFeatureLabels, Labels as LinkedAccountsWidgetLabels, LinkedAccountsWidgetProps, MarketingWidgetContent, MeasureUnitDeleteDialogLabels, MeasureUnitsManagerLabels, PendingFeatureStyleSources, PersonalDetailsLabels, PersonalDetailsValues, ProductDeleteDialogLabels, ProductDetailsSheetLabels, ProductFormSheetLabels, ProductMessageLabels, ProductsScreenLabels, ProductsWidgetProps, ReceiptMatchSummary, ReceivableActionDialogLabels, ReceivableDetailsSheetLabelOverrides, ReceivableDetailsSheetLabels, ReceivableDocumentType, ReceivableFormSheetLabels, ReceivableMessageLabels, ReceivablePaymentDialogLabels, ReceivableSendDialogLabels, ReceivableStatusBadgeLabels, ReceivablesScreenLabelOverrides, ReceivablesScreenLabels, ReceivablesWidgetProps, ReceivablesWidgetTab, RefreshingRootWidgetProviderProps, ResultLabels, RootWidgetProviderProps, SettingsWidgetAdditionalSection, FeatureLabels$2 as SettingsWidgetFeatureLabels, Labels$2 as SettingsWidgetLabels, SettingsWidgetProps, SettingsWidgetSection, SettingsWidgetSectionId, SingleInsightLabels, FeatureLabels$1 as TransfersWidgetFeatureLabels, TransfersWidgetLabels, TransfersWidgetProps, UploadReceiptWidgetProps, WidgetConfig, WidgetConfigInput, WidgetInitResponse, WidgetInitState, WidgetProviderLabels, WidgetProviderProps, WidgetSuiteCardsLabels, WidgetSuiteDashboardLabels, WidgetSuiteDisclosureLabels, WidgetSuiteExpensesLabels, WidgetSuiteLabelOverrides, WidgetSuiteLabels, WidgetSuiteMenuLabels, WidgetSuiteProps, WidgetSuiteSectionContentLabels, WidgetSuiteSectionTitleLabels, WidgetTokenFetcher, WidgetTokenManager, WidgetTokenRefreshProviderProps, WidgetTokenState };
package/dist/index.js CHANGED
@@ -27,19 +27,16 @@ import { InsightsWidget as I } from "./libs/tesouro-embedded-components-react/in
27
27
  import { InvoicingWidget as L } from "./libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index3.js";
28
28
  import { ReceivablesWidget as R } from "./libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js";
29
29
  import { SettingsSection as z } from "./libs/tesouro-embedded-components-react/settings-widget/feature/dist/index4.js";
30
- import { ExpenseApprovalPoliciesWidget as B } from "./libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index6.js";
31
- import { UploadReceiptWidget as V } from "./libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index7.js";
32
- import { ExpenseRequirementsWidget as H } from "./libs/tesouro-embedded-components-react/expense-requirements-widget/feature/dist/lib/ExpenseRequirementsWidget.js";
33
- import { ExpenseManagementWidget as U } from "./libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index9.js";
34
- import { ReceiptMatchWidget as W } from "./libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index13.js";
35
- import { HELP_FAQ_EN as G } from "./libs/tesouro-embedded-components-react/help-widget/ui/contract/dist/index3.js";
36
- import { SettingsWidget as K } from "./libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js";
37
- import { DEFAULT_FEATURE_LABELS as q } from "./libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index3.js";
38
- import { TRANSFERS_WIDGET_LABELS_EN as J } from "./libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/labels.js";
39
- import { TransfersWidget as Y } from "./libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index7.js";
40
- import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as X } from "./libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/lib/AcceptDisclosuresWidget/labels.js";
41
- import { AcceptDisclosuresWidget as Z } from "./libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index5.js";
42
- import { WidgetSuite as Q } from "./libs/tesouro-embedded-components-react/widget-suite/feature/dist/index16.js";
30
+ import { UploadReceiptWidget as B } from "./libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index7.js";
31
+ import { ExpenseManagementWidget as V } from "./libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index13.js";
32
+ import { HELP_FAQ_EN as H } from "./libs/tesouro-embedded-components-react/help-widget/ui/contract/dist/index3.js";
33
+ import { SettingsWidget as U } from "./libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js";
34
+ import { DEFAULT_FEATURE_LABELS as W } from "./libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index3.js";
35
+ import { TRANSFERS_WIDGET_LABELS_EN as G } from "./libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/labels.js";
36
+ import { TransfersWidget as K } from "./libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index7.js";
37
+ import { ACCEPT_DISCLOSURES_WIDGET_LABELS_EN as q } from "./libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/lib/AcceptDisclosuresWidget/labels.js";
38
+ import { AcceptDisclosuresWidget as J } from "./libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index5.js";
39
+ import { WidgetSuite as Y } from "./libs/tesouro-embedded-components-react/widget-suite/feature/dist/index16.js";
43
40
  import "./lib/WidgetSuite.js";
44
41
  import "./lib/AcceptDisclosuresWidget.js";
45
42
  import "./lib/BankAccountsWidget.js";
@@ -49,26 +46,23 @@ import "./lib/DebitCardsWidget.js";
49
46
  import "./lib/CardDetailsWidget.js";
50
47
  import "./lib/CounterpartsWidget.js";
51
48
  import "./lib/ExpenseManagementWidget.js";
52
- import "./lib/ExpenseApprovalPoliciesWidget.js";
53
- import "./lib/ExpenseRequirementsWidget.js";
49
+ import "./lib/UploadReceiptWidget.js";
54
50
  import "./lib/BalancesWidget.js";
55
51
  import "./lib/InsightsWidget.js";
56
52
  import "./lib/InvoicingWidget.js";
57
- import { LinkedAccountsWidget as $ } from "./libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index10.js";
53
+ import { LinkedAccountsWidget as X } from "./libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index10.js";
58
54
  import "./lib/LinkedAccountsWidget.js";
59
- import { ADDITIONAL_OWNERS_LABELS_EN as ee } from "./libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index4.js";
60
- import { BUSINESS_DETAILS_LABELS_EN as te } from "./libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index6.js";
61
- import { PERSONAL_DETAILS_LABELS_EN as ne } from "./libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index7.js";
62
- import { RESULT_LABELS_EN as re } from "./libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index12.js";
63
- import { BankAccountOnboardingWidget as ie } from "./libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js";
55
+ import { ADDITIONAL_OWNERS_LABELS_EN as Z } from "./libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index4.js";
56
+ import { BUSINESS_DETAILS_LABELS_EN as Q } from "./libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index6.js";
57
+ import { PERSONAL_DETAILS_LABELS_EN as $ } from "./libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index7.js";
58
+ import { RESULT_LABELS_EN as ee } from "./libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index12.js";
59
+ import { BankAccountOnboardingWidget as te } from "./libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js";
64
60
  import "./lib/BankAccountOnboardingWidget.js";
65
- import { ProductsWidget as ae } from "./libs/tesouro-embedded-components-react/products-widget/feature/dist/index8.js";
61
+ import { ProductsWidget as ne } from "./libs/tesouro-embedded-components-react/products-widget/feature/dist/index8.js";
66
62
  import "./lib/ProductsWidget.js";
67
63
  import "./lib/ReceivablesWidget.js";
68
- import "./lib/ReceiptMatchWidget.js";
69
64
  import "./lib/SettingsWidget.js";
70
65
  import "./lib/TransfersWidget.js";
71
- import "./lib/UploadReceiptWidget.js";
72
- import { WidgetProvider as oe } from "./lib/WidgetProviderPublic.js";
66
+ import { WidgetProvider as re } from "./lib/WidgetProviderPublic.js";
73
67
  import "./lib/WidgetProvider.js";
74
- export { X as ACCEPT_DISCLOSURES_WIDGET_LABELS_EN, ee as ADDITIONAL_OWNERS_LABELS_EN, Z as AcceptDisclosuresWidget, j as BALANCES_WIDGET_LABELS_EN, te as BUSINESS_DETAILS_LABELS_EN, M as BalancesWidget, ie as BankAccountOnboardingWidget, T as BankAccountsWidget, D as BillPayWidget, O as CardDetailsWidget, E as CounterpartsWidget, k as CreditCardsWidget, A as DebitCardsWidget, s as ERROR_STATE_ID, B as ExpenseApprovalPoliciesWidget, U as ExpenseManagementWidget, H as ExpenseRequirementsWidget, G as HELP_FAQ_EN, N as INSIGHTS_FEATURE_LABELS_EN, P as INSIGHTS_WIDGET_LABELS_EN, c as Implementation, I as InsightsWidget, L as InvoicingWidget, $ as LinkedAccountsWidget, ne as PERSONAL_DETAILS_LABELS_EN, ae as ProductsWidget, re as RESULT_LABELS_EN, W as ReceiptMatchWidget, R as ReceivablesWidget, _ as RefreshingRootWidgetProvider, m as RootWidgetProvider, F as SINGLE_INSIGHT_LABELS_EN, z as SettingsSection, K as SettingsWidget, q as TRANSFERS_FEATURE_LABELS_EN, J as TRANSFERS_WIDGET_LABELS_EN, Y as TransfersWidget, i as UIFramework, V as UploadReceiptWidget, t as WIDGET_SUITE_DEFAULT_SECTIONS, e as WIDGET_SUITE_LABELS_EN, oe as WidgetProvider, Q as WidgetSuite, n as WidgetSuiteSectionId, h as WidgetTokenRefreshProvider, r as cloneEmbeddedClient, l as getGlobalWidgetConfig, f as getGlobalWidgetInitState, a as registerDesignSystemEnsurer, o as registerUIRenderers, u as setGlobalWidgetConfig, p as subscribeToGlobalWidgetInitState, d as updateGlobalWidgetConfig, v as useDisclosuresAcceptanceSurface, y as useOwnWidgetConfig, b as useRefetchWidget, x as useWidgetConfig, S as useWidgetError, C as useWidgetInitStaleForToken, w as useWidgetLoading, g as useWidgetToken };
68
+ export { q as ACCEPT_DISCLOSURES_WIDGET_LABELS_EN, Z as ADDITIONAL_OWNERS_LABELS_EN, J as AcceptDisclosuresWidget, j as BALANCES_WIDGET_LABELS_EN, Q as BUSINESS_DETAILS_LABELS_EN, M as BalancesWidget, te as BankAccountOnboardingWidget, T as BankAccountsWidget, D as BillPayWidget, O as CardDetailsWidget, E as CounterpartsWidget, k as CreditCardsWidget, A as DebitCardsWidget, s as ERROR_STATE_ID, V as ExpenseManagementWidget, H as HELP_FAQ_EN, N as INSIGHTS_FEATURE_LABELS_EN, P as INSIGHTS_WIDGET_LABELS_EN, c as Implementation, I as InsightsWidget, L as InvoicingWidget, X as LinkedAccountsWidget, $ as PERSONAL_DETAILS_LABELS_EN, ne as ProductsWidget, ee as RESULT_LABELS_EN, R as ReceivablesWidget, _ as RefreshingRootWidgetProvider, m as RootWidgetProvider, F as SINGLE_INSIGHT_LABELS_EN, z as SettingsSection, U as SettingsWidget, W as TRANSFERS_FEATURE_LABELS_EN, G as TRANSFERS_WIDGET_LABELS_EN, K as TransfersWidget, i as UIFramework, B as UploadReceiptWidget, t as WIDGET_SUITE_DEFAULT_SECTIONS, e as WIDGET_SUITE_LABELS_EN, re as WidgetProvider, Y as WidgetSuite, n as WidgetSuiteSectionId, h as WidgetTokenRefreshProvider, r as cloneEmbeddedClient, l as getGlobalWidgetConfig, f as getGlobalWidgetInitState, a as registerDesignSystemEnsurer, o as registerUIRenderers, u as setGlobalWidgetConfig, p as subscribeToGlobalWidgetInitState, d as updateGlobalWidgetConfig, v as useDisclosuresAcceptanceSurface, y as useOwnWidgetConfig, b as useRefetchWidget, x as useWidgetConfig, S as useWidgetError, C as useWidgetInitStaleForToken, w as useWidgetLoading, g as useWidgetToken };
@@ -1,3 +1,3 @@
1
- import { ExpenseManagementWidget as e } from "../libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index9.js";
1
+ import { ExpenseManagementWidget as e } from "../libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index13.js";
2
2
  import "../libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index.js";
3
3
  export { e as ExpenseManagementWidget };
@@ -1,7 +1,7 @@
1
1
  import "./index4.js";
2
2
  import { ExpenseApprovalPoliciesWidget as e } from "./index6.js";
3
3
  import { UploadReceiptWidget as t } from "./index7.js";
4
- import { ExpenseManagementWidget as n } from "./index9.js";
5
4
  import "./index10.js";
6
- import { ReceiptMatchWidget as r } from "./index13.js";
7
- export { e as ExpenseApprovalPoliciesWidget, n as ExpenseManagementWidget, r as ReceiptMatchWidget, t as UploadReceiptWidget };
5
+ import { ExpenseManagementWidget as n } from "./index13.js";
6
+ import "./index14.js";
7
+ export { e as ExpenseApprovalPoliciesWidget, n as ExpenseManagementWidget, t as UploadReceiptWidget };
@@ -1 +1,74 @@
1
- import "./index9.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { EmbeddedToaster as e } from "../../../shared/ui/dist/lib/EmbeddedToaster.js";
6
+ import "../../../shared/ui/dist/index.js";
7
+ import { useAnalyticsTrack as t } from "../../../shared/feature/dist/lib/analytics/hooks.js";
8
+ import { WidgetProvider as n } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
9
+ import "../../../shared/feature/dist/index.js";
10
+ import { ReceiptMatchSidebar as r } from "../../ui/dist/lib/ReceiptMatchWidget/lib/ReceiptMatchSidebar.js";
11
+ import "../../ui/dist/index.js";
12
+ import { useReceiptMatch as i } from "./index8.js";
13
+ import { ReceiptMatchAnalyticsEvent as a, WIDGET_NAME as o } from "./index9.js";
14
+ import { useCallback as s, useEffect as c, useState as l } from "react";
15
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
16
+ //#region ../../libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index10.js
17
+ function p({ preSelectedReceiptIds: n = [], onClose: o, targetTransactionId: l, onSingleTransactionUpdate: p }) {
18
+ let m = t();
19
+ c(() => {
20
+ m(a.Mounted);
21
+ }, [m]);
22
+ let h = i({
23
+ preSelectedIds: n,
24
+ onClose: o,
25
+ targetTransactionId: l,
26
+ onSingleTransactionUpdate: p
27
+ }), g = s(() => {
28
+ h.onCancel(), o();
29
+ }, [h.onCancel, o]);
30
+ return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(e, {}), /* @__PURE__ */ d(r, {
31
+ open: !0,
32
+ onClose: g,
33
+ ...h
34
+ })] });
35
+ }
36
+ function m({ isOpen: e, onClose: t, ...n }) {
37
+ let [r, i] = l(!!e);
38
+ c(() => {
39
+ i(!!e);
40
+ }, [e]);
41
+ let a = s(() => {
42
+ i(!1), t?.();
43
+ }, [t]);
44
+ return r ? /* @__PURE__ */ d(p, {
45
+ onClose: a,
46
+ ...n
47
+ }) : null;
48
+ }
49
+ function h({ baseUrl: e, widgetToken: t, organizationId: r, configClient: i, gatewayRouting: a, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: f, disclosuresAcceptance: p, providerLabels: h, isOpen: g, preSelectedReceiptIds: _, onClose: v, targetTransactionId: y, onSingleTransactionUpdate: b }) {
50
+ return /* @__PURE__ */ d(n, {
51
+ widgetName: o,
52
+ baseUrl: e,
53
+ widgetToken: t,
54
+ organizationId: r,
55
+ configClient: i,
56
+ gatewayRouting: a,
57
+ linkComponent: s,
58
+ implementation: c,
59
+ uiFramework: l,
60
+ errorFallback: u,
61
+ onError: f,
62
+ disclosuresAcceptance: p,
63
+ providerLabels: h,
64
+ children: /* @__PURE__ */ d(m, {
65
+ isOpen: g,
66
+ preSelectedReceiptIds: _,
67
+ onClose: v,
68
+ targetTransactionId: y,
69
+ onSingleTransactionUpdate: b
70
+ })
71
+ });
72
+ }
73
+ //#endregion
74
+ export { h as ReceiptMatchWidget };
@@ -2,254 +2,18 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import "../../../shared/ui/dist/index.js";
7
- import { useWidgetConfig as t, useWidgetLoading as n } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
8
- import "../../../shared/feature/dist/index.js";
9
- import { ReceiptMatchLabels as r } from "../../ui/dist/lib/ReceiptMatchWidget/lib/labels.js";
5
+ import { ReceiptMatchLauncher as e } from "../../ui/dist/lib/ReceiptMatchWidget/lib/ReceiptMatchLauncher.js";
10
6
  import "../../ui/dist/index.js";
11
- import { useGetReceiptsQuery as i } from "../../data-access/dist/index2.js";
12
- import { useGetTransactionsQuery as a } from "../../data-access/dist/index3.js";
13
- import { usePatchReceiptMutation as ee } from "../../data-access/dist/index5.js";
14
- import { useDeleteReceiptMutation as te } from "../../data-access/dist/index6.js";
15
- import "../../data-access/dist/index.js";
16
- import { useCallback as o, useEffect as ne, useMemo as s, useState as c } from "react";
7
+ import { ReceiptMatchWidget as t } from "./index10.js";
8
+ import { useCallback as n, useState as r } from "react";
9
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
17
10
  //#region ../../libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index11.js
18
- function l(e, t) {
19
- if (typeof e == "object" && e) {
20
- let t = e.error;
21
- if (typeof t == "object" && t) {
22
- let e = t.message;
23
- if (typeof e == "string") return e;
24
- }
25
- }
26
- return e instanceof Error && e.message ? e.message : t;
27
- }
28
- function u(e, t) {
29
- let n = e / 100;
30
- try {
31
- return new Intl.NumberFormat("en-US", {
32
- style: "currency",
33
- currency: t
34
- }).format(n);
35
- } catch {
36
- return `${t} ${n.toFixed(2)}`;
37
- }
38
- }
39
- function d(e) {
40
- if (!e) return "";
41
- let t = new Date(e);
42
- return Number.isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-US", {
43
- month: "short",
44
- day: "numeric",
45
- year: "numeric"
46
- });
47
- }
48
- function re(e) {
49
- if (!e) return "";
50
- let t = new Date(e);
51
- return Number.isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-US", {
52
- month: "long",
53
- day: "numeric",
54
- year: "numeric"
55
- });
56
- }
57
- function f(e) {
58
- if (!e) return "";
59
- let t = new Date(e);
60
- return Number.isNaN(t.getTime()) ? "" : t.toLocaleTimeString("en-US", {
61
- hour: "numeric",
62
- minute: "2-digit",
63
- second: "2-digit",
64
- hour12: !0
65
- });
66
- }
67
- function ie(e) {
68
- let t = e.ocr_status === "processing";
69
- return {
70
- id: e.id,
71
- primaryText: t ? r.ReceiptScanningTitle : e.merchant_name?.trim() || r.ReceiptScanningTitle,
72
- secondaryText: t ? r.ReceiptScanningSubtitle : d(e.issued_at),
73
- thumbnailUrl: e.file_url ?? void 0
74
- };
75
- }
76
- function p(e) {
77
- return {
78
- id: e.id,
79
- merchantName: e.merchant_name,
80
- date: d(e.started_at),
81
- formattedAmount: u(e.amount, e.currency)
82
- };
83
- }
84
- var m = .5, h = 3, g = .25, _ = 5e3, v = !1;
85
- function y({ preSelectedIds: d, onClose: y, targetTransactionId: b, onSingleTransactionUpdate: x }) {
86
- let { initResponse: S } = t(), C = n(), w = S?.userId ?? void 0, T = !!w && !C, [E, D] = c(1), [O, k] = c(0), [A, j] = c([]), [M, N] = c(() => d), [P, F] = c(""), [I, L] = c([]), R = s(() => I.map((e) => e.id), [I]), [z, B] = c(1), V = i({
87
- has_transaction: !1,
88
- created_by_entity_user_id: w,
89
- enabled: T
90
- }), H = a({
91
- merchant_name__icontains: P || void 0,
92
- has_receipt: !1,
93
- enabled: E === 2
94
- }), U = ee(), W = te(), G = V.data?.data ?? [], K = s(() => w ? G.filter((e) => e.created_by_entity_user_id == null || e.created_by_entity_user_id === w) : [], [G, w]);
95
- ne(() => {
96
- if (!K.some((e) => e.ocr_status === "processing")) return;
97
- let e = window.setInterval(() => {
98
- V.isFetching || V.refetch();
99
- }, _);
100
- return () => window.clearInterval(e);
101
- }, [
102
- V.isFetching,
103
- V.refetch,
104
- K
105
- ]);
106
- let q = s(() => K.map(ie), [K]), J = s(() => new Set(A.flatMap((e) => e.transactionIds)), [A]), ae = s(() => (H.data?.data ?? []).filter((e) => !J.has(e.id)).map(p), [H.data, J]), Y = H.data?.data ?? [], X = M[O], Z = s(() => K.find((e) => e.id === X), [K, X]), oe = Z?.file_url ?? void 0, se = Z?.file_name ?? void 0, ce = s(() => {
107
- if (b) return "Attach";
108
- if (!(M.length <= 1)) return `Review (${O + 1}/${M.length})`;
109
- }, [
110
- b,
111
- M.length,
112
- O
113
- ]), le = s(() => A.filter((e) => e.receiptId === X).flatMap((e) => e.transactionDetails), [A, X]), ue = O >= M.length - 1 ? r.Done : r.ReviewNextReceipt(O + 2, M.length), Q = o(() => {
114
- F(""), L([]), B(1);
115
- }, []), de = o((e) => {
116
- if (b) {
117
- N((t) => t.includes(e) ? [] : [e]);
118
- return;
119
- }
120
- N((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
121
- }, [b]), fe = o(() => {
122
- N(q.map((e) => e.id));
123
- }, [q]), pe = o(() => {
124
- N([]);
125
- }, []), me = o((e) => {
126
- let t = K.find((t) => t.id === e);
127
- t?.file_url && window.open(t.file_url, "_blank", "noopener,noreferrer");
128
- }, [K]), $ = o(async (t) => {
129
- try {
130
- await W.mutateAsync({ path: { receipt_id: t } });
131
- } catch (t) {
132
- e.error(l(t, "Failed to delete receipt"));
133
- return;
134
- }
135
- N((e) => e.filter((e) => e !== t));
136
- }, [W]), he = o(async () => {
137
- if (M.length !== 0) {
138
- if (b) {
139
- try {
140
- await U.mutateAsync({
141
- path: { receipt_id: M[0] },
142
- body: { transaction_id: b }
143
- }), x?.(), y();
144
- } catch (t) {
145
- e.error(l(t, "Failed to attach receipt"));
146
- }
147
- return;
148
- }
149
- k(0), j([]), Q(), D(2);
150
- }
151
- }, [
152
- M,
153
- b,
154
- U,
155
- x,
156
- y,
157
- Q
158
- ]), ge = o((e) => {
159
- F(e);
160
- }, []), _e = o((e) => {
161
- L((t) => {
162
- let n = t.find((t) => t.id === e), r = Y.find((t) => t.id === e);
163
- return n ? [] : r ? [r] : [];
164
- });
165
- }, [Y]), ve = o(async () => {
166
- if (I.length === 0 || !X) return;
167
- let t = I, n = (e) => ({
168
- merchant: e.merchant_name,
169
- location: e.merchant_location,
170
- date: re(e.started_at),
171
- time: f(e.started_at),
172
- formattedAmount: u(e.amount, e.currency)
173
- }), r = [], i = [];
174
- for (let a of t) try {
175
- await U.mutateAsync({
176
- path: { receipt_id: X },
177
- body: { transaction_id: a.id }
178
- }), r.push(a.id), i.push(n(a));
179
- } catch (t) {
180
- r.length > 0 && j((e) => [...e, {
181
- receiptId: X,
182
- transactionIds: r,
183
- transactionDetails: i
184
- }]), L((e) => e.filter((e) => !r.includes(e.id))), e.error(l(t, "Failed to match receipt"));
185
- return;
186
- }
187
- j((e) => [...e, {
188
- receiptId: X,
189
- transactionIds: r,
190
- transactionDetails: i
191
- }]), D(3);
192
- }, [
193
- I,
194
- X,
195
- U
196
- ]), ye = o(() => {
197
- B((e) => Math.min(e + g, h));
198
- }, []), be = o(() => {
199
- B((e) => Math.max(e - g, m));
200
- }, []), xe = o(() => {
201
- let e = O + 1;
202
- if (e < M.length) {
203
- k(e), Q(), D(2);
204
- return;
205
- }
206
- y();
207
- }, [
208
- O,
209
- M.length,
210
- Q,
211
- y
212
- ]), Se = o(() => {
213
- if (A.length > 0) {
214
- let e = new Set(A.map((e) => e.receiptId));
215
- N((t) => t.filter((t) => !e.has(t)));
216
- }
217
- Q(), k(0), j([]), D(1);
218
- }, [Q, A]);
219
- return {
220
- step: E,
221
- receipts: q,
222
- selectedReceiptIds: M,
223
- onSelectAll: fe,
224
- onReset: pe,
225
- onReceiptToggle: de,
226
- onViewAttachment: me,
227
- onDeleteReceipt: $,
228
- onReview: he,
229
- isReceiptsLoading: V.isLoading,
230
- showSelectAllButton: !b,
231
- receiptPreviewUrl: oe,
232
- receiptFileName: se,
233
- transactions: ae,
234
- isTransactionsLoading: H.isLoading,
235
- selectedTransactionIds: R,
236
- allowMultipleTransactions: v,
237
- searchValue: P,
238
- onSearchChange: ge,
239
- onTransactionSelect: _e,
240
- onConfirmMatch: ve,
241
- isConfirming: U.isPending,
242
- zoom: z,
243
- onZoomIn: ye,
244
- onZoomOut: be,
245
- canZoomIn: z < h,
246
- canZoomOut: z > m,
247
- matchedTransactions: le,
248
- primaryLabel: ue,
249
- onPrimary: xe,
250
- onCancel: Se,
251
- reviewLabel: ce
252
- };
11
+ function s() {
12
+ let [s, c] = r(!1), l = n(() => c(!1), []);
13
+ return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a(e, { onStart: () => c(!0) }), s && /* @__PURE__ */ a(t, {
14
+ isOpen: !0,
15
+ onClose: l
16
+ })] });
253
17
  }
254
18
  //#endregion
255
- export { y as useReceiptMatch };
19
+ export { s as ReceiptMatchPane };
@@ -1,4 +1,4 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index12.js
2
- var e = { Mounted: "receipt_match.mounted" }, t = "receipt_match";
2
+ var e = { Mounted: "expense_management_widget.mounted" }, t = "expense_management_widget";
3
3
  //#endregion
4
- export { e as ReceiptMatchAnalyticsEvent, t as WIDGET_NAME };
4
+ export { e as ExpenseManagementWidgetAnalyticsEvent, t as WIDGET_NAME };