@voyant-travel/finance-react 0.119.5
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/LICENSE +201 -0
- package/README.md +75 -0
- package/dist/admin/booking-invoices-widget.d.ts +19 -0
- package/dist/admin/booking-invoices-widget.d.ts.map +1 -0
- package/dist/admin/booking-invoices-widget.js +204 -0
- package/dist/admin/booking-payment-policy-widget.d.ts +21 -0
- package/dist/admin/booking-payment-policy-widget.d.ts.map +1 -0
- package/dist/admin/booking-payment-policy-widget.js +128 -0
- package/dist/admin/booking-pending-payment-sessions-widget.d.ts +24 -0
- package/dist/admin/booking-pending-payment-sessions-widget.d.ts.map +1 -0
- package/dist/admin/booking-pending-payment-sessions-widget.js +139 -0
- package/dist/admin/credit-note-dialog.d.ts +9 -0
- package/dist/admin/credit-note-dialog.d.ts.map +1 -0
- package/dist/admin/credit-note-dialog.js +70 -0
- package/dist/admin/finance-shared.d.ts +7 -0
- package/dist/admin/finance-shared.d.ts.map +1 -0
- package/dist/admin/finance-shared.js +30 -0
- package/dist/admin/index.d.ts +99 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +286 -0
- package/dist/admin/invoice-detail-host.d.ts +19 -0
- package/dist/admin/invoice-detail-host.d.ts.map +1 -0
- package/dist/admin/invoice-detail-host.js +147 -0
- package/dist/admin/invoice-detail-sections.d.ts +31 -0
- package/dist/admin/invoice-detail-sections.d.ts.map +1 -0
- package/dist/admin/invoice-detail-sections.js +109 -0
- package/dist/admin/invoice-detail-skeleton.d.ts +11 -0
- package/dist/admin/invoice-detail-skeleton.d.ts.map +1 -0
- package/dist/admin/invoice-detail-skeleton.js +33 -0
- package/dist/admin/line-item-dialog.d.ts +10 -0
- package/dist/admin/line-item-dialog.d.ts.map +1 -0
- package/dist/admin/line-item-dialog.js +91 -0
- package/dist/admin/pages/invoice-detail.d.ts +8 -0
- package/dist/admin/pages/invoice-detail.d.ts.map +1 -0
- package/dist/admin/pages/invoice-detail.js +11 -0
- package/dist/admin/pages/invoices-index.d.ts +8 -0
- package/dist/admin/pages/invoices-index.d.ts.map +1 -0
- package/dist/admin/pages/invoices-index.js +14 -0
- package/dist/admin/pages/payment-detail.d.ts +8 -0
- package/dist/admin/pages/payment-detail.d.ts.map +1 -0
- package/dist/admin/pages/payment-detail.js +11 -0
- package/dist/admin/pages/payments-index.d.ts +9 -0
- package/dist/admin/pages/payments-index.d.ts.map +1 -0
- package/dist/admin/pages/payments-index.js +21 -0
- package/dist/admin/pages/profitability.d.ts +10 -0
- package/dist/admin/pages/profitability.d.ts.map +1 -0
- package/dist/admin/pages/profitability.js +32 -0
- package/dist/admin/pages/supplier-invoice-detail.d.ts +20 -0
- package/dist/admin/pages/supplier-invoice-detail.d.ts.map +1 -0
- package/dist/admin/pages/supplier-invoice-detail.js +102 -0
- package/dist/admin/pages/supplier-invoices-index.d.ts +9 -0
- package/dist/admin/pages/supplier-invoices-index.d.ts.map +1 -0
- package/dist/admin/pages/supplier-invoices-index.js +16 -0
- package/dist/admin/payment-detail-host.d.ts +12 -0
- package/dist/admin/payment-detail-host.d.ts.map +1 -0
- package/dist/admin/payment-detail-host.js +108 -0
- package/dist/admin/payment-detail-skeleton.d.ts +8 -0
- package/dist/admin/payment-detail-skeleton.d.ts.map +1 -0
- package/dist/admin/payment-detail-skeleton.js +15 -0
- package/dist/admin/payment-dialog.d.ts +9 -0
- package/dist/admin/payment-dialog.d.ts.map +1 -0
- package/dist/admin/payment-dialog.js +99 -0
- package/dist/admin/record-payment-dialog.d.ts +16 -0
- package/dist/admin/record-payment-dialog.d.ts.map +1 -0
- package/dist/admin/record-payment-dialog.js +219 -0
- package/dist/admin/supplier-payment-policy-widget.d.ts +18 -0
- package/dist/admin/supplier-payment-policy-widget.d.ts.map +1 -0
- package/dist/admin/supplier-payment-policy-widget.js +31 -0
- package/dist/admin/use-supplier-picker.d.ts +19 -0
- package/dist/admin/use-supplier-picker.d.ts.map +1 -0
- package/dist/admin/use-supplier-picker.js +30 -0
- package/dist/checkout-components/collect-payment-dialog.d.ts +45 -0
- package/dist/checkout-components/collect-payment-dialog.d.ts.map +1 -0
- package/dist/checkout-components/collect-payment-dialog.js +121 -0
- package/dist/checkout-components/payment-link-landing-page.d.ts +76 -0
- package/dist/checkout-components/payment-link-landing-page.d.ts.map +1 -0
- package/dist/checkout-components/payment-link-landing-page.js +173 -0
- package/dist/checkout-components/payment-step.d.ts +42 -0
- package/dist/checkout-components/payment-step.d.ts.map +1 -0
- package/dist/checkout-components/payment-step.js +113 -0
- package/dist/checkout-hooks/index.d.ts +5 -0
- package/dist/checkout-hooks/index.d.ts.map +1 -0
- package/dist/checkout-hooks/index.js +4 -0
- package/dist/checkout-hooks/use-checkout-payment-link-config.d.ts +20 -0
- package/dist/checkout-hooks/use-checkout-payment-link-config.d.ts.map +1 -0
- package/dist/checkout-hooks/use-checkout-payment-link-config.js +26 -0
- package/dist/checkout-hooks/use-collect-payment.d.ts +227 -0
- package/dist/checkout-hooks/use-collect-payment.d.ts.map +1 -0
- package/dist/checkout-hooks/use-collect-payment.js +80 -0
- package/dist/checkout-hooks/use-initiate-checkout-collection.d.ts +308 -0
- package/dist/checkout-hooks/use-initiate-checkout-collection.d.ts.map +1 -0
- package/dist/checkout-hooks/use-initiate-checkout-collection.js +35 -0
- package/dist/checkout-hooks/use-preview-checkout-collection.d.ts +65 -0
- package/dist/checkout-hooks/use-preview-checkout-collection.d.ts.map +1 -0
- package/dist/checkout-hooks/use-preview-checkout-collection.js +27 -0
- package/dist/checkout-i18n/en.d.ts +3 -0
- package/dist/checkout-i18n/en.d.ts.map +1 -0
- package/dist/checkout-i18n/en.js +127 -0
- package/dist/checkout-i18n/index.d.ts +5 -0
- package/dist/checkout-i18n/index.d.ts.map +1 -0
- package/dist/checkout-i18n/index.js +3 -0
- package/dist/checkout-i18n/messages.d.ts +121 -0
- package/dist/checkout-i18n/messages.d.ts.map +1 -0
- package/dist/checkout-i18n/messages.js +1 -0
- package/dist/checkout-i18n/provider.d.ts +26 -0
- package/dist/checkout-i18n/provider.d.ts.map +1 -0
- package/dist/checkout-i18n/provider.js +41 -0
- package/dist/checkout-i18n/ro.d.ts +3 -0
- package/dist/checkout-i18n/ro.d.ts.map +1 -0
- package/dist/checkout-i18n/ro.js +127 -0
- package/dist/checkout-types.d.ts +53 -0
- package/dist/checkout-types.d.ts.map +1 -0
- package/dist/checkout-types.js +1 -0
- package/dist/checkout-ui.d.ts +7 -0
- package/dist/checkout-ui.d.ts.map +1 -0
- package/dist/checkout-ui.js +4 -0
- package/dist/checkout.d.ts +5 -0
- package/dist/checkout.d.ts.map +1 -0
- package/dist/checkout.js +3 -0
- package/dist/client.d.ts +16 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +79 -0
- package/dist/components/accountant-portal/body.d.ts +8 -0
- package/dist/components/accountant-portal/body.d.ts.map +1 -0
- package/dist/components/accountant-portal/body.js +114 -0
- package/dist/components/accountant-portal/widgets.d.ts +13 -0
- package/dist/components/accountant-portal/widgets.d.ts.map +1 -0
- package/dist/components/accountant-portal/widgets.js +27 -0
- package/dist/components/accountant-portal.d.ts +10 -0
- package/dist/components/accountant-portal.d.ts.map +1 -0
- package/dist/components/accountant-portal.js +22 -0
- package/dist/components/accountant-share-dialog.d.ts +6 -0
- package/dist/components/accountant-share-dialog.d.ts.map +1 -0
- package/dist/components/accountant-share-dialog.js +53 -0
- package/dist/components/async-combobox.d.ts +33 -0
- package/dist/components/async-combobox.d.ts.map +1 -0
- package/dist/components/async-combobox.js +100 -0
- package/dist/components/booking-invoice-dialog.d.ts +63 -0
- package/dist/components/booking-invoice-dialog.d.ts.map +1 -0
- package/dist/components/booking-invoice-dialog.js +383 -0
- package/dist/components/cost-categories-page.d.ts +5 -0
- package/dist/components/cost-categories-page.d.ts.map +1 -0
- package/dist/components/cost-categories-page.js +30 -0
- package/dist/components/invoice-action-ledger-card.d.ts +15 -0
- package/dist/components/invoice-action-ledger-card.d.ts.map +1 -0
- package/dist/components/invoice-action-ledger-card.js +76 -0
- package/dist/components/invoice-bulk-actions.d.ts +10 -0
- package/dist/components/invoice-bulk-actions.d.ts.map +1 -0
- package/dist/components/invoice-bulk-actions.js +19 -0
- package/dist/components/invoice-detail-page/cards.d.ts +44 -0
- package/dist/components/invoice-detail-page/cards.d.ts.map +1 -0
- package/dist/components/invoice-detail-page/cards.js +43 -0
- package/dist/components/invoice-detail-page/header.d.ts +15 -0
- package/dist/components/invoice-detail-page/header.d.ts.map +1 -0
- package/dist/components/invoice-detail-page/header.js +30 -0
- package/dist/components/invoice-detail-page/notes-dialogs.d.ts +28 -0
- package/dist/components/invoice-detail-page/notes-dialogs.d.ts.map +1 -0
- package/dist/components/invoice-detail-page/notes-dialogs.js +104 -0
- package/dist/components/invoice-detail-page/primitives.d.ts +47 -0
- package/dist/components/invoice-detail-page/primitives.d.ts.map +1 -0
- package/dist/components/invoice-detail-page/primitives.js +76 -0
- package/dist/components/invoice-detail-page-with-action-ledger.d.ts +7 -0
- package/dist/components/invoice-detail-page-with-action-ledger.d.ts.map +1 -0
- package/dist/components/invoice-detail-page-with-action-ledger.js +11 -0
- package/dist/components/invoice-detail-page.d.ts +46 -0
- package/dist/components/invoice-detail-page.d.ts.map +1 -0
- package/dist/components/invoice-detail-page.js +134 -0
- package/dist/components/invoice-dialog.d.ts +9 -0
- package/dist/components/invoice-dialog.d.ts.map +1 -0
- package/dist/components/invoice-dialog.js +145 -0
- package/dist/components/invoice-number-series-dialog.d.ts +9 -0
- package/dist/components/invoice-number-series-dialog.d.ts.map +1 -0
- package/dist/components/invoice-number-series-dialog.js +134 -0
- package/dist/components/invoice-number-series-format.d.ts +3 -0
- package/dist/components/invoice-number-series-format.d.ts.map +1 -0
- package/dist/components/invoice-number-series-format.js +4 -0
- package/dist/components/invoice-number-series-page.d.ts +5 -0
- package/dist/components/invoice-number-series-page.d.ts.map +1 -0
- package/dist/components/invoice-number-series-page.js +55 -0
- package/dist/components/invoice-table-parts.d.ts +25 -0
- package/dist/components/invoice-table-parts.d.ts.map +1 -0
- package/dist/components/invoice-table-parts.js +32 -0
- package/dist/components/invoices-page-skeleton.d.ts +5 -0
- package/dist/components/invoices-page-skeleton.d.ts.map +1 -0
- package/dist/components/invoices-page-skeleton.js +13 -0
- package/dist/components/invoices-page.d.ts +6 -0
- package/dist/components/invoices-page.d.ts.map +1 -0
- package/dist/components/invoices-page.js +145 -0
- package/dist/components/payment-detail-page.d.ts +47 -0
- package/dist/components/payment-detail-page.d.ts.map +1 -0
- package/dist/components/payment-detail-page.js +90 -0
- package/dist/components/payment-policy-form.d.ts +49 -0
- package/dist/components/payment-policy-form.d.ts.map +1 -0
- package/dist/components/payment-policy-form.js +82 -0
- package/dist/components/payments-page/controls.d.ts +23 -0
- package/dist/components/payments-page/controls.d.ts.map +1 -0
- package/dist/components/payments-page/controls.js +20 -0
- package/dist/components/payments-page-skeleton.d.ts +5 -0
- package/dist/components/payments-page-skeleton.d.ts.map +1 -0
- package/dist/components/payments-page-skeleton.js +13 -0
- package/dist/components/payments-page.d.ts +20 -0
- package/dist/components/payments-page.d.ts.map +1 -0
- package/dist/components/payments-page.js +143 -0
- package/dist/components/profitability-page/sections.d.ts +24 -0
- package/dist/components/profitability-page/sections.d.ts.map +1 -0
- package/dist/components/profitability-page/sections.js +43 -0
- package/dist/components/profitability-page.d.ts +13 -0
- package/dist/components/profitability-page.d.ts.map +1 -0
- package/dist/components/profitability-page.js +175 -0
- package/dist/components/record-booking-payment-dialog/shared.d.ts +54 -0
- package/dist/components/record-booking-payment-dialog/shared.d.ts.map +1 -0
- package/dist/components/record-booking-payment-dialog/shared.js +47 -0
- package/dist/components/record-booking-payment-dialog.d.ts +4 -0
- package/dist/components/record-booking-payment-dialog.d.ts.map +1 -0
- package/dist/components/record-booking-payment-dialog.js +256 -0
- package/dist/components/supplier-invoice-detail-page/dialogs.d.ts +34 -0
- package/dist/components/supplier-invoice-detail-page/dialogs.d.ts.map +1 -0
- package/dist/components/supplier-invoice-detail-page/dialogs.js +119 -0
- package/dist/components/supplier-invoice-detail-page/shared.d.ts +64 -0
- package/dist/components/supplier-invoice-detail-page/shared.d.ts.map +1 -0
- package/dist/components/supplier-invoice-detail-page/shared.js +70 -0
- package/dist/components/supplier-invoice-detail-page.d.ts +4 -0
- package/dist/components/supplier-invoice-detail-page.d.ts.map +1 -0
- package/dist/components/supplier-invoice-detail-page.js +101 -0
- package/dist/components/supplier-invoice-form-dialog.d.ts +45 -0
- package/dist/components/supplier-invoice-form-dialog.d.ts.map +1 -0
- package/dist/components/supplier-invoice-form-dialog.js +102 -0
- package/dist/components/supplier-invoices-page.d.ts +14 -0
- package/dist/components/supplier-invoices-page.d.ts.map +1 -0
- package/dist/components/supplier-invoices-page.js +69 -0
- package/dist/components/supplier-payment-dialog.d.ts +7 -0
- package/dist/components/supplier-payment-dialog.d.ts.map +1 -0
- package/dist/components/supplier-payment-dialog.js +103 -0
- package/dist/components/taxes-page/policy-profile-sheet.d.ts +8 -0
- package/dist/components/taxes-page/policy-profile-sheet.d.ts.map +1 -0
- package/dist/components/taxes-page/policy-profile-sheet.js +52 -0
- package/dist/components/taxes-page/policy-rule-sheet.d.ts +10 -0
- package/dist/components/taxes-page/policy-rule-sheet.d.ts.map +1 -0
- package/dist/components/taxes-page/policy-rule-sheet.js +137 -0
- package/dist/components/taxes-page/shared.d.ts +128 -0
- package/dist/components/taxes-page/shared.d.ts.map +1 -0
- package/dist/components/taxes-page/shared.js +288 -0
- package/dist/components/taxes-page/sheets.d.ts +4 -0
- package/dist/components/taxes-page/sheets.d.ts.map +1 -0
- package/dist/components/taxes-page/sheets.js +3 -0
- package/dist/components/taxes-page/tax-sheet.d.ts +9 -0
- package/dist/components/taxes-page/tax-sheet.d.ts.map +1 -0
- package/dist/components/taxes-page/tax-sheet.js +108 -0
- package/dist/components/taxes-page.d.ts +4 -0
- package/dist/components/taxes-page.d.ts.map +1 -0
- package/dist/components/taxes-page.js +165 -0
- package/dist/hooks/index.d.ts +53 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +52 -0
- package/dist/hooks/use-accountant-share-mutation.d.ts +20 -0
- package/dist/hooks/use-accountant-share-mutation.d.ts.map +1 -0
- package/dist/hooks/use-accountant-share-mutation.js +27 -0
- package/dist/hooks/use-accountant-shares.d.ts +13 -0
- package/dist/hooks/use-accountant-shares.d.ts.map +1 -0
- package/dist/hooks/use-accountant-shares.js +8 -0
- package/dist/hooks/use-admin-booking-payments.d.ts +30 -0
- package/dist/hooks/use-admin-booking-payments.d.ts.map +1 -0
- package/dist/hooks/use-admin-booking-payments.js +18 -0
- package/dist/hooks/use-all-payments.d.ts +35 -0
- package/dist/hooks/use-all-payments.d.ts.map +1 -0
- package/dist/hooks/use-all-payments.js +12 -0
- package/dist/hooks/use-booking-guarantees.d.ts +82 -0
- package/dist/hooks/use-booking-guarantees.d.ts.map +1 -0
- package/dist/hooks/use-booking-guarantees.js +46 -0
- package/dist/hooks/use-booking-payment-schedule-regenerate-mutation.d.ts +44 -0
- package/dist/hooks/use-booking-payment-schedule-regenerate-mutation.d.ts.map +1 -0
- package/dist/hooks/use-booking-payment-schedule-regenerate-mutation.js +27 -0
- package/dist/hooks/use-booking-payment-schedules.d.ts +63 -0
- package/dist/hooks/use-booking-payment-schedules.d.ts.map +1 -0
- package/dist/hooks/use-booking-payment-schedules.js +47 -0
- package/dist/hooks/use-cost-categories.d.ts +14 -0
- package/dist/hooks/use-cost-categories.d.ts.map +1 -0
- package/dist/hooks/use-cost-categories.js +9 -0
- package/dist/hooks/use-cost-category-mutation.d.ts +31 -0
- package/dist/hooks/use-cost-category-mutation.d.ts.map +1 -0
- package/dist/hooks/use-cost-category-mutation.js +27 -0
- package/dist/hooks/use-departure-profitability.d.ts +56 -0
- package/dist/hooks/use-departure-profitability.d.ts.map +1 -0
- package/dist/hooks/use-departure-profitability.js +12 -0
- package/dist/hooks/use-finance-action-ledger.d.ts +94 -0
- package/dist/hooks/use-finance-action-ledger.d.ts.map +1 -0
- package/dist/hooks/use-finance-action-ledger.js +20 -0
- package/dist/hooks/use-invoice-attachment-mutation.d.ts +43 -0
- package/dist/hooks/use-invoice-attachment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-attachment-mutation.js +39 -0
- package/dist/hooks/use-invoice-attachments.d.ts +18 -0
- package/dist/hooks/use-invoice-attachments.d.ts.map +1 -0
- package/dist/hooks/use-invoice-attachments.js +12 -0
- package/dist/hooks/use-invoice-bulk-status-mutation.d.ts +51 -0
- package/dist/hooks/use-invoice-bulk-status-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-bulk-status-mutation.js +66 -0
- package/dist/hooks/use-invoice-credit-note-mutation.d.ts +38 -0
- package/dist/hooks/use-invoice-credit-note-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-credit-note-mutation.js +35 -0
- package/dist/hooks/use-invoice-credit-notes.d.ts +17 -0
- package/dist/hooks/use-invoice-credit-notes.d.ts.map +1 -0
- package/dist/hooks/use-invoice-credit-notes.js +12 -0
- package/dist/hooks/use-invoice-fx-rate.d.ts +19 -0
- package/dist/hooks/use-invoice-fx-rate.d.ts.map +1 -0
- package/dist/hooks/use-invoice-fx-rate.js +13 -0
- package/dist/hooks/use-invoice-line-item-mutation.d.ts +40 -0
- package/dist/hooks/use-invoice-line-item-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-line-item-mutation.js +42 -0
- package/dist/hooks/use-invoice-line-items.d.ts +17 -0
- package/dist/hooks/use-invoice-line-items.d.ts.map +1 -0
- package/dist/hooks/use-invoice-line-items.js +12 -0
- package/dist/hooks/use-invoice-mutation.d.ts +225 -0
- package/dist/hooks/use-invoice-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-mutation.js +121 -0
- package/dist/hooks/use-invoice-note-mutation.d.ts +11 -0
- package/dist/hooks/use-invoice-note-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-note-mutation.js +23 -0
- package/dist/hooks/use-invoice-notes.d.ts +13 -0
- package/dist/hooks/use-invoice-notes.d.ts.map +1 -0
- package/dist/hooks/use-invoice-notes.js +12 -0
- package/dist/hooks/use-invoice-number-series-mutation.d.ts +62 -0
- package/dist/hooks/use-invoice-number-series-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-number-series-mutation.js +39 -0
- package/dist/hooks/use-invoice-number-series.d.ts +28 -0
- package/dist/hooks/use-invoice-number-series.d.ts.map +1 -0
- package/dist/hooks/use-invoice-number-series.js +12 -0
- package/dist/hooks/use-invoice-payment-mutation.d.ts +29 -0
- package/dist/hooks/use-invoice-payment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-invoice-payment-mutation.js +35 -0
- package/dist/hooks/use-invoice-payments.d.ts +21 -0
- package/dist/hooks/use-invoice-payments.d.ts.map +1 -0
- package/dist/hooks/use-invoice-payments.js +12 -0
- package/dist/hooks/use-invoice.d.ts +32 -0
- package/dist/hooks/use-invoice.d.ts.map +1 -0
- package/dist/hooks/use-invoice.js +12 -0
- package/dist/hooks/use-invoices.d.ts +36 -0
- package/dist/hooks/use-invoices.d.ts.map +1 -0
- package/dist/hooks/use-invoices.js +12 -0
- package/dist/hooks/use-payment-mutation.d.ts +57 -0
- package/dist/hooks/use-payment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-payment-mutation.js +59 -0
- package/dist/hooks/use-payment-session-mutation.d.ts +205 -0
- package/dist/hooks/use-payment-session-mutation.d.ts.map +1 -0
- package/dist/hooks/use-payment-session-mutation.js +38 -0
- package/dist/hooks/use-payment-sessions.d.ts +97 -0
- package/dist/hooks/use-payment-sessions.d.ts.map +1 -0
- package/dist/hooks/use-payment-sessions.js +17 -0
- package/dist/hooks/use-payment.d.ts +31 -0
- package/dist/hooks/use-payment.d.ts.map +1 -0
- package/dist/hooks/use-payment.js +12 -0
- package/dist/hooks/use-product-profitability.d.ts +52 -0
- package/dist/hooks/use-product-profitability.d.ts.map +1 -0
- package/dist/hooks/use-product-profitability.js +12 -0
- package/dist/hooks/use-public-booking-documents.d.ts +29 -0
- package/dist/hooks/use-public-booking-documents.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-documents.js +12 -0
- package/dist/hooks/use-public-booking-payment-options.d.ts +47 -0
- package/dist/hooks/use-public-booking-payment-options.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-payment-options.js +12 -0
- package/dist/hooks/use-public-booking-payments.d.ts +24 -0
- package/dist/hooks/use-public-booking-payments.d.ts.map +1 -0
- package/dist/hooks/use-public-booking-payments.js +12 -0
- package/dist/hooks/use-public-finance-document-by-reference.d.ts +27 -0
- package/dist/hooks/use-public-finance-document-by-reference.d.ts.map +1 -0
- package/dist/hooks/use-public-finance-document-by-reference.js +12 -0
- package/dist/hooks/use-public-payment-session-mutation.d.ts +82 -0
- package/dist/hooks/use-public-payment-session-mutation.d.ts.map +1 -0
- package/dist/hooks/use-public-payment-session-mutation.js +33 -0
- package/dist/hooks/use-public-payment-session.d.ts +73 -0
- package/dist/hooks/use-public-payment-session.d.ts.map +1 -0
- package/dist/hooks/use-public-payment-session.js +12 -0
- package/dist/hooks/use-public-voucher-validation-mutation.d.ts +23 -0
- package/dist/hooks/use-public-voucher-validation-mutation.d.ts.map +1 -0
- package/dist/hooks/use-public-voucher-validation-mutation.js +17 -0
- package/dist/hooks/use-supplier-invoice-attachments.d.ts +17 -0
- package/dist/hooks/use-supplier-invoice-attachments.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoice-attachments.js +12 -0
- package/dist/hooks/use-supplier-invoice-mutation.d.ts +353 -0
- package/dist/hooks/use-supplier-invoice-mutation.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoice-mutation.js +81 -0
- package/dist/hooks/use-supplier-invoice-payments.d.ts +26 -0
- package/dist/hooks/use-supplier-invoice-payments.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoice-payments.js +12 -0
- package/dist/hooks/use-supplier-invoice.d.ts +65 -0
- package/dist/hooks/use-supplier-invoice.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoice.js +12 -0
- package/dist/hooks/use-supplier-invoices.d.ts +36 -0
- package/dist/hooks/use-supplier-invoices.d.ts.map +1 -0
- package/dist/hooks/use-supplier-invoices.js +12 -0
- package/dist/hooks/use-supplier-payment-mutation.d.ts +55 -0
- package/dist/hooks/use-supplier-payment-mutation.d.ts.map +1 -0
- package/dist/hooks/use-supplier-payment-mutation.js +35 -0
- package/dist/hooks/use-supplier-payments.d.ts +27 -0
- package/dist/hooks/use-supplier-payments.d.ts.map +1 -0
- package/dist/hooks/use-supplier-payments.js +12 -0
- package/dist/hooks/use-traveler-profitability.d.ts +24 -0
- package/dist/hooks/use-traveler-profitability.d.ts.map +1 -0
- package/dist/hooks/use-traveler-profitability.js +11 -0
- package/dist/hooks/use-voucher-mutation.d.ts +105 -0
- package/dist/hooks/use-voucher-mutation.d.ts.map +1 -0
- package/dist/hooks/use-voucher-mutation.js +50 -0
- package/dist/hooks/use-voucher.d.ts +38 -0
- package/dist/hooks/use-voucher.d.ts.map +1 -0
- package/dist/hooks/use-voucher.js +17 -0
- package/dist/hooks/use-vouchers.d.ts +34 -0
- package/dist/hooks/use-vouchers.d.ts.map +1 -0
- package/dist/hooks/use-vouchers.js +18 -0
- package/dist/i18n/en/invoices.d.ts +278 -0
- package/dist/i18n/en/invoices.d.ts.map +1 -0
- package/dist/i18n/en/invoices.js +277 -0
- package/dist/i18n/en/numberingAndPayments.d.ts +387 -0
- package/dist/i18n/en/numberingAndPayments.d.ts.map +1 -0
- package/dist/i18n/en/numberingAndPayments.js +386 -0
- package/dist/i18n/en/profitability.d.ts +147 -0
- package/dist/i18n/en/profitability.d.ts.map +1 -0
- package/dist/i18n/en/profitability.js +146 -0
- package/dist/i18n/en/suppliers.d.ts +187 -0
- package/dist/i18n/en/suppliers.d.ts.map +1 -0
- package/dist/i18n/en/suppliers.js +186 -0
- package/dist/i18n/en.d.ts +998 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +22 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/messages/core.d.ts +18 -0
- package/dist/i18n/messages/core.d.ts.map +1 -0
- package/dist/i18n/messages/core.js +30 -0
- package/dist/i18n/messages/invoices.d.ts +252 -0
- package/dist/i18n/messages/invoices.d.ts.map +1 -0
- package/dist/i18n/messages/invoices.js +1 -0
- package/dist/i18n/messages/numberingAndPayments.d.ts +277 -0
- package/dist/i18n/messages/numberingAndPayments.d.ts.map +1 -0
- package/dist/i18n/messages/numberingAndPayments.js +1 -0
- package/dist/i18n/messages/profitability.d.ts +151 -0
- package/dist/i18n/messages/profitability.d.ts.map +1 -0
- package/dist/i18n/messages/profitability.js +1 -0
- package/dist/i18n/messages/suppliers.d.ts +167 -0
- package/dist/i18n/messages/suppliers.d.ts.map +1 -0
- package/dist/i18n/messages/suppliers.js +1 -0
- package/dist/i18n/messages.d.ts +29 -0
- package/dist/i18n/messages.d.ts.map +1 -0
- package/dist/i18n/messages.js +1 -0
- package/dist/i18n/provider.d.ts +2018 -0
- package/dist/i18n/provider.d.ts.map +1 -0
- package/dist/i18n/provider.js +44 -0
- package/dist/i18n/ro/invoices.d.ts +278 -0
- package/dist/i18n/ro/invoices.d.ts.map +1 -0
- package/dist/i18n/ro/invoices.js +277 -0
- package/dist/i18n/ro/numberingAndPayments.d.ts +387 -0
- package/dist/i18n/ro/numberingAndPayments.d.ts.map +1 -0
- package/dist/i18n/ro/numberingAndPayments.js +386 -0
- package/dist/i18n/ro/profitability.d.ts +147 -0
- package/dist/i18n/ro/profitability.d.ts.map +1 -0
- package/dist/i18n/ro/profitability.js +146 -0
- package/dist/i18n/ro/suppliers.d.ts +187 -0
- package/dist/i18n/ro/suppliers.d.ts.map +1 -0
- package/dist/i18n/ro/suppliers.js +186 -0
- package/dist/i18n/ro.d.ts +998 -0
- package/dist/i18n/ro.d.ts.map +1 -0
- package/dist/i18n/ro.js +22 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/operations.d.ts +484 -0
- package/dist/operations.d.ts.map +1 -0
- package/dist/operations.js +52 -0
- package/dist/provider.d.ts +2 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +1 -0
- package/dist/query-keys.d.ts +195 -0
- package/dist/query-keys.d.ts.map +1 -0
- package/dist/query-keys.js +49 -0
- package/dist/query-options/public-reporting.d.ts +2129 -0
- package/dist/query-options/public-reporting.d.ts.map +1 -0
- package/dist/query-options/public-reporting.js +193 -0
- package/dist/query-options-action-ledger.d.ts +382 -0
- package/dist/query-options-action-ledger.d.ts.map +1 -0
- package/dist/query-options-action-ledger.js +36 -0
- package/dist/query-options.d.ts +2057 -0
- package/dist/query-options.d.ts.map +1 -0
- package/dist/query-options.js +328 -0
- package/dist/schemas/accountant.d.ts +168 -0
- package/dist/schemas/accountant.d.ts.map +1 -0
- package/dist/schemas/accountant.js +53 -0
- package/dist/schemas/action-ledger.d.ts +206 -0
- package/dist/schemas/action-ledger.d.ts.map +1 -0
- package/dist/schemas/action-ledger.js +83 -0
- package/dist/schemas/common.d.ts +17 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/common.js +10 -0
- package/dist/schemas/invoice.d.ts +1451 -0
- package/dist/schemas/invoice.d.ts.map +1 -0
- package/dist/schemas/invoice.js +438 -0
- package/dist/schemas/profitability.d.ts +333 -0
- package/dist/schemas/profitability.d.ts.map +1 -0
- package/dist/schemas/profitability.js +84 -0
- package/dist/schemas/public.d.ts +481 -0
- package/dist/schemas/public.d.ts.map +1 -0
- package/dist/schemas/public.js +9 -0
- package/dist/schemas/responses.d.ts +632 -0
- package/dist/schemas/responses.d.ts.map +1 -0
- package/dist/schemas/responses.js +27 -0
- package/dist/schemas/supplier.d.ts +226 -0
- package/dist/schemas/supplier.d.ts.map +1 -0
- package/dist/schemas/supplier.js +103 -0
- package/dist/schemas/vouchers.d.ts +283 -0
- package/dist/schemas/vouchers.d.ts.map +1 -0
- package/dist/schemas/vouchers.js +49 -0
- package/dist/schemas.d.ts +10 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +9 -0
- package/dist/ui.d.ts +27 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +26 -0
- package/package.json +181 -0
- package/src/styles.css +12 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout-ui.d.ts","sourceRoot":"","sources":["../src/checkout-ui.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,GAC/B,MAAM,iDAAiD,CAAA;AACxD,OAAO,EACL,KAAK,wBAAwB,EAC7B,sBAAsB,EACtB,KAAK,2BAA2B,GACjC,MAAM,oDAAoD,CAAA;AAC3D,OAAO,EACL,WAAW,EACX,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,GACtB,MAAM,uCAAuC,CAAA;AAC9C,YAAY,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7F,OAAO,EACL,KAAK,0BAA0B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC5B,iBAAiB,EACjB,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC1B,qBAAqB,EACrB,8BAA8B,GAC/B,MAAM,0BAA0B,CAAA;AACjC,YAAY,EACV,aAAa,EACb,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { CollectPaymentDialog, } from "./checkout-components/collect-payment-dialog.js";
|
|
2
|
+
export { PaymentLinkLandingPage, } from "./checkout-components/payment-link-landing-page.js";
|
|
3
|
+
export { PaymentStep, } from "./checkout-components/payment-step.js";
|
|
4
|
+
export { CheckoutUiMessagesProvider, checkoutUiMessageDefinitions, getCheckoutUiI18n, resolveCheckoutUiMessages, useCheckoutUiI18n, useCheckoutUiI18nOrDefault, useCheckoutUiMessages, useCheckoutUiMessagesOrDefault, } from "./checkout-i18n/index.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from "./checkout-hooks/index.js";
|
|
2
|
+
export * from "./checkout-i18n/index.js";
|
|
3
|
+
export type { PaymentChoice, PaymentStepCapabilities, PaymentStepExtraOption, SavedPaymentAccount, } from "./checkout-types.js";
|
|
4
|
+
export { useVoyantFinanceContext, type VoyantFinanceContextValue, VoyantFinanceProvider, type VoyantFinanceProviderProps, } from "./provider.js";
|
|
5
|
+
//# sourceMappingURL=checkout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../src/checkout.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,YAAY,EACV,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,uBAAuB,EACvB,KAAK,yBAAyB,EAC9B,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,eAAe,CAAA"}
|
package/dist/checkout.js
ADDED
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
export type VoyantFetcher = (url: string, init?: RequestInit) => Promise<Response>;
|
|
3
|
+
export declare const defaultFetcher: VoyantFetcher;
|
|
4
|
+
export declare class VoyantApiError extends Error {
|
|
5
|
+
readonly status: number;
|
|
6
|
+
readonly body: unknown;
|
|
7
|
+
constructor(message: string, status: number, body: unknown);
|
|
8
|
+
}
|
|
9
|
+
export interface FetchWithValidationOptions {
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
fetcher: VoyantFetcher;
|
|
12
|
+
}
|
|
13
|
+
export type QueryParamValue = string | number | boolean | null | undefined | Array<string | number | boolean>;
|
|
14
|
+
export declare function fetchWithValidation<TOut>(path: string, schema: z.ZodType<TOut>, options: FetchWithValidationOptions, init?: RequestInit): Promise<TOut>;
|
|
15
|
+
export declare function withQueryParams(path: string, query?: object): string;
|
|
16
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAElF,eAAO,MAAM,cAAc,EAAE,aACoB,CAAA;AAEjD,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;gBAEV,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;CAM3D;AAaD,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,aAAa,CAAA;CACvB;AAED,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAA;AAEpC,wBAAsB,mBAAmB,CAAC,IAAI,EAC5C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EACvB,OAAO,EAAE,0BAA0B,EACnC,IAAI,CAAC,EAAE,WAAW,GACjB,OAAO,CAAC,IAAI,CAAC,CAgCf;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAwBpE"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export const defaultFetcher = (url, init) => fetch(url, { credentials: "include", ...init });
|
|
2
|
+
export class VoyantApiError extends Error {
|
|
3
|
+
status;
|
|
4
|
+
body;
|
|
5
|
+
constructor(message, status, body) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "VoyantApiError";
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.body = body;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function extractErrorMessage(status, statusText, body) {
|
|
13
|
+
if (typeof body === "object" && body !== null && "error" in body) {
|
|
14
|
+
const err = body.error;
|
|
15
|
+
if (typeof err === "string")
|
|
16
|
+
return err;
|
|
17
|
+
if (typeof err === "object" && err !== null && "message" in err) {
|
|
18
|
+
return String(err.message);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return `Voyant API error: ${status} ${statusText}`;
|
|
22
|
+
}
|
|
23
|
+
export async function fetchWithValidation(path, schema, options, init) {
|
|
24
|
+
const url = joinUrl(options.baseUrl, path);
|
|
25
|
+
const headers = new Headers(init?.headers);
|
|
26
|
+
if (init?.body !== undefined && !headers.has("Content-Type")) {
|
|
27
|
+
headers.set("Content-Type", "application/json");
|
|
28
|
+
}
|
|
29
|
+
const response = await options.fetcher(url, { ...init, headers });
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
const body = await safeJson(response);
|
|
32
|
+
throw new VoyantApiError(extractErrorMessage(response.status, response.statusText, body), response.status, body);
|
|
33
|
+
}
|
|
34
|
+
if (response.status === 204) {
|
|
35
|
+
return schema.parse(undefined);
|
|
36
|
+
}
|
|
37
|
+
const body = await safeJson(response);
|
|
38
|
+
const parsed = schema.safeParse(body);
|
|
39
|
+
if (!parsed.success) {
|
|
40
|
+
throw new VoyantApiError(`Voyant API response failed validation: ${parsed.error.message}`, response.status, body);
|
|
41
|
+
}
|
|
42
|
+
return parsed.data;
|
|
43
|
+
}
|
|
44
|
+
export function withQueryParams(path, query) {
|
|
45
|
+
if (!query) {
|
|
46
|
+
return path;
|
|
47
|
+
}
|
|
48
|
+
const params = new URLSearchParams();
|
|
49
|
+
for (const [key, value] of Object.entries(query)) {
|
|
50
|
+
if (value === undefined || value === null) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (Array.isArray(value)) {
|
|
54
|
+
for (const item of value) {
|
|
55
|
+
params.append(key, String(item));
|
|
56
|
+
}
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
params.set(key, String(value));
|
|
60
|
+
}
|
|
61
|
+
const serialized = params.toString();
|
|
62
|
+
return serialized ? `${path}?${serialized}` : path;
|
|
63
|
+
}
|
|
64
|
+
async function safeJson(response) {
|
|
65
|
+
const text = await response.text();
|
|
66
|
+
if (!text)
|
|
67
|
+
return undefined;
|
|
68
|
+
try {
|
|
69
|
+
return JSON.parse(text);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return text;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function joinUrl(baseUrl, path) {
|
|
76
|
+
const trimmedBase = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
|
|
77
|
+
const trimmedPath = path.startsWith("/") ? path : `/${path}`;
|
|
78
|
+
return `${trimmedBase}${trimmedPath}`;
|
|
79
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FinanceUiMessages } from "../../i18n/index.js";
|
|
2
|
+
import type { AccountantPortalProps } from "../accountant-portal.js";
|
|
3
|
+
export declare function AccountantPortalBody({ token, apiBaseUrl, className, messages, locale, onLocaleChange, }: Omit<AccountantPortalProps, "defaultLocale"> & {
|
|
4
|
+
messages: FinanceUiMessages;
|
|
5
|
+
locale: string;
|
|
6
|
+
onLocaleChange: (locale: string) => void;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"body.d.ts","sourceRoot":"","sources":["../../../src/components/accountant-portal/body.tsx"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAO5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAYpE,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,UAAU,EACV,SAAS,EACT,QAAQ,EACR,MAAM,EACN,cAAc,GACf,EAAE,IAAI,CAAC,qBAAqB,EAAE,eAAe,CAAC,GAAG;IAChD,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CACzC,2CAkgBA"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useQuery } from "@tanstack/react-query";
|
|
4
|
+
import { formatMessage } from "@voyant-travel/i18n";
|
|
5
|
+
import { Badge, Button, Card, CardContent, CardHeader, CardTitle, Checkbox, Label, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@voyant-travel/ui/components";
|
|
6
|
+
import { ChartContainer, ChartLegend, ChartLegendContent, ChartTooltip, ChartTooltipContent, } from "@voyant-travel/ui/components/chart";
|
|
7
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@voyant-travel/ui/components/table";
|
|
8
|
+
import { cn } from "@voyant-travel/ui/lib/utils";
|
|
9
|
+
import { Download, Globe } from "lucide-react";
|
|
10
|
+
import { useMemo, useState } from "react";
|
|
11
|
+
import { Bar, BarChart, CartesianGrid, Cell, Pie, PieChart, XAxis, YAxis } from "recharts";
|
|
12
|
+
import { financeUiMessageDefinitions } from "../../i18n/index.js";
|
|
13
|
+
import { defaultFetcher, getAccountantInvoicesQueryOptions, getAccountantSummaryQueryOptions, } from "../../index.js";
|
|
14
|
+
import { AsyncCombobox, localOptionSearch } from "../async-combobox.js";
|
|
15
|
+
import { formatInvoiceAmount } from "../invoice-table-parts.js";
|
|
16
|
+
import { Kpi, serviceTypeChart } from "./widgets.js";
|
|
17
|
+
const CHART_DEPARTURE_LIMIT = 12;
|
|
18
|
+
const marginText = (value) => (value == null ? "—" : `${value.toFixed(1)}%`);
|
|
19
|
+
const LOCALES = Object.keys(financeUiMessageDefinitions);
|
|
20
|
+
const LOCALE_NAMES = { en: "English", ro: "Română" };
|
|
21
|
+
export function AccountantPortalBody({ token, apiBaseUrl, className, messages, locale, onLocaleChange, }) {
|
|
22
|
+
const t = messages.profitability;
|
|
23
|
+
const client = useMemo(() => ({ baseUrl: apiBaseUrl, fetcher: defaultFetcher }), [apiBaseUrl]);
|
|
24
|
+
const [currency, setCurrency] = useState("");
|
|
25
|
+
// Consolidated view = the operator accounting-base rollup (snapshotted FX).
|
|
26
|
+
// The base currency is fixed by the operator — no viewer-chosen base.
|
|
27
|
+
const [consolidate, setConsolidate] = useState(true);
|
|
28
|
+
const [productId, setProductId] = useState("");
|
|
29
|
+
const [departureId, setDepartureId] = useState("");
|
|
30
|
+
const summary = useQuery(getAccountantSummaryQueryOptions(client, token));
|
|
31
|
+
const invoices = useQuery(getAccountantInvoicesQueryOptions(client, token));
|
|
32
|
+
const data = summary.data?.data;
|
|
33
|
+
const departures = data?.departures;
|
|
34
|
+
const products = data?.products;
|
|
35
|
+
const baseCurrencyCode = departures?.base?.currency ?? products?.base?.currency ?? "";
|
|
36
|
+
const baseMode = consolidate && Boolean(departures?.base);
|
|
37
|
+
const currencies = useMemo(() => {
|
|
38
|
+
const set = new Set();
|
|
39
|
+
for (const row of departures?.rows ?? [])
|
|
40
|
+
set.add(row.currency);
|
|
41
|
+
for (const row of products?.rows ?? [])
|
|
42
|
+
set.add(row.currency);
|
|
43
|
+
return [...set].sort();
|
|
44
|
+
}, [departures, products]);
|
|
45
|
+
const activeCurrency = baseMode
|
|
46
|
+
? (departures?.base?.currency ?? "")
|
|
47
|
+
: currency && currencies.includes(currency)
|
|
48
|
+
? currency
|
|
49
|
+
: (currencies[0] ?? "");
|
|
50
|
+
const currencyDepartureRows = baseMode
|
|
51
|
+
? (departures?.base?.rows ?? [])
|
|
52
|
+
: (departures?.rows ?? []).filter((r) => r.currency === activeCurrency);
|
|
53
|
+
const currencyProductRows = baseMode
|
|
54
|
+
? (products?.base?.rows ?? [])
|
|
55
|
+
: (products?.rows ?? []).filter((r) => r.currency === activeCurrency);
|
|
56
|
+
// Product/departure filters (client-side over the loaded scope).
|
|
57
|
+
const productOptions = useMemo(() => {
|
|
58
|
+
const map = new Map();
|
|
59
|
+
for (const r of currencyDepartureRows) {
|
|
60
|
+
if (r.productId)
|
|
61
|
+
map.set(r.productId, r.productName ?? r.productId);
|
|
62
|
+
}
|
|
63
|
+
return [...map.entries()]
|
|
64
|
+
.map(([id, name]) => ({ id, name }))
|
|
65
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
66
|
+
}, [currencyDepartureRows]);
|
|
67
|
+
const departureOptions = useMemo(() => currencyDepartureRows
|
|
68
|
+
.filter((r) => !productId || r.productId === productId)
|
|
69
|
+
.map((r) => ({ id: r.departureId, label: r.departureLabel ?? r.departureId })), [currencyDepartureRows, productId]);
|
|
70
|
+
const departureRows = currencyDepartureRows.filter((r) => (!productId || r.productId === productId) && (!departureId || r.departureId === departureId));
|
|
71
|
+
const productRows = currencyProductRows.filter((r) => !productId || r.productId === productId);
|
|
72
|
+
const totals = useMemo(() => {
|
|
73
|
+
let revenue = 0;
|
|
74
|
+
let actual = 0;
|
|
75
|
+
for (const r of departureRows) {
|
|
76
|
+
revenue += r.revenueCents;
|
|
77
|
+
actual += r.actualCostCents;
|
|
78
|
+
}
|
|
79
|
+
const profit = revenue - actual;
|
|
80
|
+
return { revenue, actual, profit, margin: revenue > 0 ? (profit / revenue) * 100 : null };
|
|
81
|
+
}, [departureRows]);
|
|
82
|
+
const serviceTypeData = serviceTypeChart(departures, baseMode, activeCurrency, t.serviceTypeLabels);
|
|
83
|
+
const chartData = [...departureRows]
|
|
84
|
+
.sort((a, b) => b.revenueCents - a.revenueCents)
|
|
85
|
+
.slice(0, CHART_DEPARTURE_LIMIT)
|
|
86
|
+
.map((r) => ({
|
|
87
|
+
name: r.departureLabel ?? r.departureId,
|
|
88
|
+
revenue: r.revenueCents / 100,
|
|
89
|
+
actualCost: r.actualCostCents / 100,
|
|
90
|
+
profit: r.profitCents / 100,
|
|
91
|
+
}));
|
|
92
|
+
const barConfig = {
|
|
93
|
+
revenue: { label: t.charts.revenue, color: "hsl(221 83% 53%)" }, // i18n-literal-ok (chart color)
|
|
94
|
+
actualCost: { label: t.charts.actualCost, color: "hsl(0 72% 51%)" }, // i18n-literal-ok (chart color)
|
|
95
|
+
profit: { label: t.charts.profit, color: "hsl(142 71% 45%)" }, // i18n-literal-ok (chart color)
|
|
96
|
+
};
|
|
97
|
+
const pieConfig = Object.fromEntries(serviceTypeData.map((d) => [d.serviceType, { label: d.label, color: d.fill }]));
|
|
98
|
+
const money = (cents) => formatInvoiceAmount(cents, activeCurrency);
|
|
99
|
+
const periodLabel = data?.scope.from || data?.scope.to
|
|
100
|
+
? `${data?.scope.from ?? "…"} – ${data?.scope.to ?? "…"}`
|
|
101
|
+
: t.portal.allTime;
|
|
102
|
+
const exportUrl = (report) => `${apiBaseUrl}/v1/public/finance/accountant/${encodeURIComponent(token)}/export/${report}`;
|
|
103
|
+
const downloadUrl = (kind, invoiceId, attachmentId) => `${apiBaseUrl}/v1/public/finance/accountant/${encodeURIComponent(token)}/invoices/${invoiceId}/attachments/${attachmentId}/download?kind=${kind}`;
|
|
104
|
+
if (summary.isError) {
|
|
105
|
+
return (_jsx("div", { className: cn("mx-auto max-w-2xl p-6", className), children: _jsx(Card, { children: _jsx(CardContent, { className: "py-12 text-center text-muted-foreground", children: t.portal.gone }) }) }));
|
|
106
|
+
}
|
|
107
|
+
const invoiceRows = invoices.data?.data ?? [];
|
|
108
|
+
return (_jsxs("div", { className: cn("mx-auto flex max-w-6xl flex-col gap-6 p-6", className), children: [_jsxs("div", { className: "flex flex-wrap items-end justify-between gap-3", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-2xl font-bold tracking-tight", children: t.portal.title }), _jsxs("p", { className: "text-sm text-muted-foreground", children: [periodLabel, " \u00B7 ", t.portal.subtitle] })] }), _jsxs("div", { className: "flex flex-wrap items-end gap-3", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs(Label, { className: "flex items-center gap-1.5", children: [_jsx(Globe, { className: "size-3.5" }), t.portal.language] }), _jsxs(Select, { value: locale, onValueChange: (v) => onLocaleChange(v ?? "en"), children: [_jsx(SelectTrigger, { className: "w-36", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: LOCALES.map((code) => (_jsx(SelectItem, { value: code, children: LOCALE_NAMES[code] ?? code.toUpperCase() }, code))) })] })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: t.filters.product }), _jsx(AsyncCombobox, { className: "w-56", placeholder: t.filters.allProducts, value: productId || null, onChange: (v) => {
|
|
109
|
+
setProductId(v ?? "");
|
|
110
|
+
setDepartureId("");
|
|
111
|
+
}, search: localOptionSearch(productOptions.map((p) => ({ value: p.id, label: p.name }))) })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: t.filters.departure }), _jsx(AsyncCombobox, { className: "w-56", placeholder: t.filters.allDepartures, value: departureId || null, onChange: (v) => setDepartureId(v ?? ""), search: localOptionSearch(departureOptions.map((d) => ({ value: d.id, label: d.label }))) })] }), !baseMode && currencies.length > 1 ? (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: t.filters.currency }), _jsxs(Select, { value: activeCurrency, onValueChange: (v) => setCurrency(v ?? ""), children: [_jsx(SelectTrigger, { className: "w-32", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: currencies.map((c) => (_jsx(SelectItem, { value: c, children: c }, c))) })] })] })) : null, _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { htmlFor: "accountant-consolidate", children: t.filters.baseCurrency }), _jsxs("div", { className: "flex h-9 items-center gap-2", children: [_jsx(Checkbox, { id: "accountant-consolidate", checked: consolidate, onCheckedChange: (v) => setConsolidate(v === true) }), _jsx(Label, { htmlFor: "accountant-consolidate", className: "font-normal", children: baseCurrencyCode || t.filters.baseCurrency })] })] })] })] }), baseMode && (departures?.base?.unconvertibleCurrencies.length ?? 0) > 0 ? (_jsx("p", { className: "text-sm text-amber-600 dark:text-amber-500", children: formatMessage(t.unconvertibleNote, {
|
|
112
|
+
currencies: (departures?.base?.unconvertibleCurrencies ?? []).join(", "),
|
|
113
|
+
}) })) : null, _jsxs("div", { className: "grid gap-4 sm:grid-cols-2 lg:grid-cols-4", children: [_jsx(Kpi, { label: t.kpis.revenue, value: money(totals.revenue) }), _jsx(Kpi, { label: t.kpis.actualCost, value: money(totals.actual) }), _jsx(Kpi, { label: t.kpis.profit, value: money(totals.profit), accent: totals.profit >= 0 ? "positive" : "negative" }), _jsx(Kpi, { label: t.kpis.margin, value: marginText(totals.margin) })] }), _jsxs("div", { className: "grid gap-4 lg:grid-cols-2", children: [_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { className: "text-base", children: t.charts.departurePnl }) }), _jsx(CardContent, { children: chartData.length ? (_jsx(ChartContainer, { config: barConfig, className: "h-[300px] w-full", children: _jsxs(BarChart, { data: chartData, margin: { top: 10, right: 10, left: 0, bottom: 0 }, children: [_jsx(CartesianGrid, { vertical: false }), _jsx(XAxis, { dataKey: "name", tickLine: false, axisLine: false, tickMargin: 8, tickFormatter: (v) => (v.length > 14 ? `${v.slice(0, 13)}…` : v) }), _jsx(YAxis, { tickLine: false, axisLine: false, tickMargin: 8, width: 56 }), _jsx(ChartTooltip, { content: _jsx(ChartTooltipContent, {}) }), _jsx(ChartLegend, { content: _jsx(ChartLegendContent, {}) }), _jsx(Bar, { dataKey: "revenue", fill: "var(--color-revenue)", radius: 2 }), _jsx(Bar, { dataKey: "actualCost", fill: "var(--color-actualCost)", radius: 2 }), _jsx(Bar, { dataKey: "profit", fill: "var(--color-profit)", radius: 2 })] }) })) : (_jsx("p", { className: "py-10 text-center text-sm text-muted-foreground", children: t.departures.none })) })] }), _jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { className: "text-base", children: t.charts.costByServiceType }) }), _jsx(CardContent, { children: serviceTypeData.length ? (_jsx(ChartContainer, { config: pieConfig, className: "mx-auto h-[300px] w-full", children: _jsxs(PieChart, { children: [_jsx(ChartTooltip, { content: _jsx(ChartTooltipContent, { nameKey: "label", hideLabel: true }) }), _jsx(Pie, { data: serviceTypeData, dataKey: "amount", nameKey: "label", cx: "50%", cy: "50%", innerRadius: 60, outerRadius: 100, paddingAngle: 2, children: serviceTypeData.map((entry) => (_jsx(Cell, { fill: entry.fill }, entry.serviceType))) }), _jsx(ChartLegend, { content: _jsx(ChartLegendContent, { nameKey: "label" }) })] }) })) : (_jsx("p", { className: "py-10 text-center text-sm text-muted-foreground", children: t.empty })) })] })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between", children: [_jsx(CardTitle, { className: "text-base", children: t.departures.title }), _jsx("a", { href: exportUrl("departures"), target: "_blank", rel: "noopener noreferrer", children: _jsxs(Button, { variant: "outline", size: "sm", children: [_jsx(Download, { className: "size-4" }), t.exportCsv] }) })] }), _jsx(CardContent, { className: "overflow-x-auto", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t.departures.columns.departure }), _jsx(TableHead, { children: t.departures.columns.date }), _jsx(TableHead, { className: "text-right", children: t.departures.columns.revenue }), _jsx(TableHead, { className: "text-right", children: t.departures.columns.actualCost }), _jsx(TableHead, { className: "text-right", children: t.departures.columns.profit }), _jsx(TableHead, { className: "text-right", children: t.departures.columns.margin })] }) }), _jsx(TableBody, { children: departureRows.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 6, className: "text-center text-muted-foreground", children: t.departures.none }) })) : (departureRows.map((row) => (_jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: row.departureLabel ?? row.departureId }), _jsx(TableCell, { className: "text-muted-foreground", children: row.departureDate ?? t.noDate }), _jsx(TableCell, { className: "text-right tabular-nums", children: money(row.revenueCents) }), _jsx(TableCell, { className: "text-right tabular-nums", children: money(row.actualCostCents) }), _jsx(TableCell, { className: cn("text-right tabular-nums", row.profitCents < 0 && "text-destructive"), children: money(row.profitCents) }), _jsx(TableCell, { className: "text-right tabular-nums", children: marginText(row.marginPercent) })] }, `${row.departureId}:${row.currency}`)))) })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between", children: [_jsx(CardTitle, { className: "text-base", children: t.products.title }), _jsx("a", { href: exportUrl("products"), target: "_blank", rel: "noopener noreferrer", children: _jsxs(Button, { variant: "outline", size: "sm", children: [_jsx(Download, { className: "size-4" }), t.exportCsv] }) })] }), _jsx(CardContent, { className: "overflow-x-auto", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t.products.columns.product }), _jsx(TableHead, { className: "text-right", children: t.products.columns.departures }), _jsx(TableHead, { className: "text-right", children: t.products.columns.revenue }), _jsx(TableHead, { className: "text-right", children: t.products.columns.actualCost }), _jsx(TableHead, { className: "text-right", children: t.products.columns.profit }), _jsx(TableHead, { className: "text-right", children: t.products.columns.margin })] }) }), _jsx(TableBody, { children: productRows.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 6, className: "text-center text-muted-foreground", children: t.products.none }) })) : (productRows.map((row) => (_jsxs(TableRow, { children: [_jsx(TableCell, { className: "font-medium", children: row.productName ?? row.productId }), _jsx(TableCell, { className: "text-right tabular-nums", children: row.departureCount }), _jsx(TableCell, { className: "text-right tabular-nums", children: money(row.revenueCents) }), _jsx(TableCell, { className: "text-right tabular-nums", children: money(row.actualCostCents) }), _jsx(TableCell, { className: cn("text-right tabular-nums", row.profitCents < 0 && "text-destructive"), children: money(row.profitCents) }), _jsx(TableCell, { className: "text-right tabular-nums", children: marginText(row.marginPercent) })] }, `${row.productId}:${row.currency}`)))) })] }) })] }), _jsxs(Card, { children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between", children: [_jsx(CardTitle, { className: "text-base", children: t.portal.invoices }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("a", { href: `${apiBaseUrl}/v1/public/finance/accountant/${encodeURIComponent(token)}/invoices/download-all`, target: "_blank", rel: "noopener noreferrer", children: _jsxs(Button, { variant: "outline", size: "sm", children: [_jsx(Download, { className: "size-4" }), t.portal.downloadAll] }) }), _jsx("a", { href: exportUrl("invoices"), target: "_blank", rel: "noopener noreferrer", children: _jsxs(Button, { variant: "outline", size: "sm", children: [_jsx(Download, { className: "size-4" }), t.exportCsv] }) })] })] }), _jsx(CardContent, { className: "overflow-x-auto", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t.portal.columns.type }), _jsx(TableHead, { children: t.portal.columns.invoice }), _jsx(TableHead, { children: t.portal.columns.status }), _jsx(TableHead, { children: t.portal.columns.issueDate }), _jsx(TableHead, { className: "text-right", children: t.portal.columns.total }), _jsx(TableHead, { className: "text-right", children: t.portal.columns.balanceDue }), _jsx(TableHead, { children: t.portal.columns.attachments })] }) }), _jsx(TableBody, { children: invoiceRows.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 7, className: "text-center text-muted-foreground", children: t.portal.invoicesNone }) })) : (invoiceRows.map((inv) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: _jsx(Badge, { variant: inv.kind === "supplier" ? "secondary" : "outline", children: inv.kind === "supplier" ? t.portal.kindSupplier : t.portal.kindClient }) }), _jsx(TableCell, { className: "font-medium", children: inv.invoiceNumber }), _jsx(TableCell, { children: _jsx(Badge, { variant: "outline", children: inv.status }) }), _jsx(TableCell, { className: "text-muted-foreground", children: inv.issueDate }), _jsx(TableCell, { className: "text-right tabular-nums", children: formatInvoiceAmount(inv.totalCents, inv.currency) }), _jsx(TableCell, { className: "text-right tabular-nums", children: formatInvoiceAmount(inv.balanceDueCents, inv.currency) }), _jsx(TableCell, { children: inv.attachments.length === 0 ? (_jsx("span", { className: "text-muted-foreground", children: t.portal.noFile })) : (_jsx("div", { className: "flex flex-wrap gap-2", children: inv.attachments.map((att) => att.hasFile ? (_jsxs("a", { href: downloadUrl(inv.kind, inv.id, att.id), target: "_blank", rel: "noopener noreferrer", className: "inline-flex items-center gap-1 text-sm text-primary underline-offset-2 hover:underline", children: [_jsx(Download, { className: "size-3.5" }), att.name] }, att.id)) : (_jsx("span", { className: "text-sm text-muted-foreground", children: att.name }, att.id))) })) })] }, `${inv.kind}:${inv.id}`)))) })] }) })] })] }));
|
|
114
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DepartureProfitabilityReport } from "../../index.js";
|
|
2
|
+
export declare function serviceTypeChart(departures: DepartureProfitabilityReport | undefined, baseMode: boolean, activeCurrency: string, labels: Record<string, string>): {
|
|
3
|
+
serviceType: string;
|
|
4
|
+
label: string;
|
|
5
|
+
amount: number;
|
|
6
|
+
fill: string | undefined;
|
|
7
|
+
}[];
|
|
8
|
+
export declare function Kpi({ label, value, accent, }: {
|
|
9
|
+
label: string;
|
|
10
|
+
value: string;
|
|
11
|
+
accent?: "positive" | "negative";
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=widgets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widgets.d.ts","sourceRoot":"","sources":["../../../src/components/accountant-portal/widgets.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAalE,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,4BAA4B,GAAG,SAAS,EACpD,QAAQ,EAAE,OAAO,EACjB,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;IAW/B;AAED,wBAAgB,GAAG,CAAC,EAClB,KAAK,EACL,KAAK,EACL,MAAM,GACP,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,UAAU,GAAG,UAAU,CAAA;CACjC,2CAiBA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Card, CardDescription, CardHeader, CardTitle } from "@voyant-travel/ui/components";
|
|
3
|
+
import { cn } from "@voyant-travel/ui/lib/utils";
|
|
4
|
+
const PIE_COLORS = [
|
|
5
|
+
"hsl(221 83% 53%)",
|
|
6
|
+
"hsl(142 71% 45%)",
|
|
7
|
+
"hsl(38 92% 50%)",
|
|
8
|
+
"hsl(0 72% 51%)",
|
|
9
|
+
"hsl(199 89% 48%)",
|
|
10
|
+
"hsl(280 65% 60%)",
|
|
11
|
+
"hsl(160 60% 45%)",
|
|
12
|
+
"hsl(28 80% 52%)",
|
|
13
|
+
];
|
|
14
|
+
export function serviceTypeChart(departures, baseMode, activeCurrency, labels) {
|
|
15
|
+
const source = baseMode
|
|
16
|
+
? (departures?.base?.costByServiceType ?? [])
|
|
17
|
+
: (departures?.costByServiceType ?? []).filter((c) => c.currency === activeCurrency);
|
|
18
|
+
return source.map((c, index) => ({
|
|
19
|
+
serviceType: c.serviceType,
|
|
20
|
+
label: labels[c.serviceType] ?? c.serviceType,
|
|
21
|
+
amount: c.amountCents / 100,
|
|
22
|
+
fill: PIE_COLORS[index % PIE_COLORS.length],
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
export function Kpi({ label, value, accent, }) {
|
|
26
|
+
return (_jsx(Card, { children: _jsxs(CardHeader, { className: "pb-2", children: [_jsx(CardDescription, { children: label }), _jsx(CardTitle, { className: cn("text-2xl tabular-nums", accent === "positive" && "text-emerald-600 dark:text-emerald-500", accent === "negative" && "text-destructive"), children: value })] }) }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface AccountantPortalProps {
|
|
2
|
+
token: string;
|
|
3
|
+
/** Absolute API origin used for the public portal endpoints + download links. */
|
|
4
|
+
apiBaseUrl: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
/** Initial language (operator's configured locale); the accountant can switch. */
|
|
7
|
+
defaultLocale?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function AccountantPortal({ defaultLocale, ...props }: AccountantPortalProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=accountant-portal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountant-portal.d.ts","sourceRoot":"","sources":["../../src/components/accountant-portal.tsx"],"names":[],"mappings":"AAqBA,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAA;IACb,iFAAiF;IACjF,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,aAAa,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,2CAelF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo, useState } from "react";
|
|
4
|
+
import { FinanceUiMessagesProvider, financeUiMessageDefinitions, getFinanceUiI18n, } from "../i18n/index.js";
|
|
5
|
+
import { AccountantPortalBody } from "./accountant-portal/body.js";
|
|
6
|
+
const LOCALES = Object.keys(financeUiMessageDefinitions);
|
|
7
|
+
function initialLocale(defaultLocale) {
|
|
8
|
+
const candidates = [defaultLocale, typeof navigator !== "undefined" ? navigator.language : null];
|
|
9
|
+
for (const c of candidates) {
|
|
10
|
+
const code = c?.toLowerCase().split("-")[0];
|
|
11
|
+
if (code && LOCALES.includes(code))
|
|
12
|
+
return code;
|
|
13
|
+
}
|
|
14
|
+
return "en";
|
|
15
|
+
}
|
|
16
|
+
export function AccountantPortal({ defaultLocale, ...props }) {
|
|
17
|
+
const [locale, setLocale] = useState(() => initialLocale(defaultLocale));
|
|
18
|
+
// Resolve messages directly from the chosen locale and pass them down, so the
|
|
19
|
+
// portal localizes regardless of any ambient FinanceUiMessagesProvider locale.
|
|
20
|
+
const messages = useMemo(() => getFinanceUiI18n({ locale }).messages, [locale]);
|
|
21
|
+
return (_jsx(FinanceUiMessagesProvider, { locale: locale, children: _jsx(AccountantPortalBody, { ...props, messages: messages, locale: locale, onLocaleChange: setLocale }) }));
|
|
22
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface AccountantShareDialogProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
onOpenChange: (open: boolean) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare function AccountantShareDialog({ open, onOpenChange }: AccountantShareDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=accountant-share-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountant-share-dialog.d.ts","sourceRoot":"","sources":["../../src/components/accountant-share-dialog.tsx"],"names":[],"mappings":"AAoBA,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;CACtC;AAED,wBAAgB,qBAAqB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,0BAA0B,2CA4IvF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { formatMessage } from "@voyant-travel/i18n";
|
|
4
|
+
import { Button, Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle, Input, Label, } from "@voyant-travel/ui/components";
|
|
5
|
+
import { CurrencyCombobox } from "@voyant-travel/ui/components/currency-combobox";
|
|
6
|
+
import { DatePicker } from "@voyant-travel/ui/components/date-picker";
|
|
7
|
+
import { Check, Copy, Plus, Trash2 } from "lucide-react";
|
|
8
|
+
import { useState } from "react";
|
|
9
|
+
import { useFinanceUiMessagesOrDefault } from "../i18n/index.js";
|
|
10
|
+
import { useAccountantShareMutation, useAccountantShares } from "../index.js";
|
|
11
|
+
export function AccountantShareDialog({ open, onOpenChange }) {
|
|
12
|
+
const t = useFinanceUiMessagesOrDefault().profitability.share;
|
|
13
|
+
const shares = useAccountantShares();
|
|
14
|
+
const { create, revoke } = useAccountantShareMutation();
|
|
15
|
+
const [from, setFrom] = useState("");
|
|
16
|
+
const [to, setTo] = useState("");
|
|
17
|
+
const [baseCurrency, setBaseCurrency] = useState("");
|
|
18
|
+
const [ttlDays, setTtlDays] = useState("30");
|
|
19
|
+
// The token is only known at creation (only its hash is stored), so the link
|
|
20
|
+
// is shown once here; the list below can't reconstruct it.
|
|
21
|
+
const [created, setCreated] = useState(null);
|
|
22
|
+
const [copied, setCopied] = useState(false);
|
|
23
|
+
const submit = () => {
|
|
24
|
+
create.mutate({
|
|
25
|
+
from: from || undefined,
|
|
26
|
+
to: to || undefined,
|
|
27
|
+
baseCurrency: baseCurrency || undefined,
|
|
28
|
+
ttlDays: ttlDays ? Number(ttlDays) : undefined,
|
|
29
|
+
}, {
|
|
30
|
+
onSuccess: (share) => {
|
|
31
|
+
if (!share?.url)
|
|
32
|
+
return;
|
|
33
|
+
setCreated({ url: share.url });
|
|
34
|
+
setCopied(false);
|
|
35
|
+
if (navigator.clipboard) {
|
|
36
|
+
void navigator.clipboard.writeText(share.url).then(() => setCopied(true));
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const copyCreated = () => {
|
|
42
|
+
if (!created || !navigator.clipboard)
|
|
43
|
+
return;
|
|
44
|
+
void navigator.clipboard.writeText(created.url).then(() => setCopied(true));
|
|
45
|
+
};
|
|
46
|
+
const rows = shares.data?.data ?? [];
|
|
47
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "sm:max-w-lg", children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: t.title }) }), _jsxs(DialogBody, { className: "flex flex-col gap-5", children: [_jsx("p", { className: "text-sm text-muted-foreground", children: t.description }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: t.from }), _jsx(DatePicker, { value: from || null, onChange: (v) => setFrom(v ?? ""), className: "w-full" })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: t.to }), _jsx(DatePicker, { value: to || null, onChange: (v) => setTo(v ?? ""), className: "w-full" })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: t.baseCurrency }), _jsx(CurrencyCombobox, { value: baseCurrency || null, onChange: (v) => setBaseCurrency(v ?? ""), className: "w-full" })] }), _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { children: t.ttlDays }), _jsx(Input, { inputMode: "numeric", value: ttlDays, onChange: (e) => setTtlDays(e.target.value.replace(/[^0-9]/g, "")) })] })] }), _jsxs(Button, { type: "button", onClick: submit, disabled: create.isPending, className: "self-start", children: [_jsx(Plus, { className: "size-4" }), create.isPending ? t.creating : t.create] }), created ? (_jsxs("div", { className: "flex items-center gap-2 rounded-md border bg-muted/40 p-2", children: [_jsx("code", { className: "min-w-0 flex-1 truncate text-xs", children: created.url }), _jsxs(Button, { variant: "outline", size: "sm", onClick: copyCreated, children: [copied ? _jsx(Check, { className: "size-4" }) : _jsx(Copy, { className: "size-4" }), copied ? t.copied : t.copy] })] })) : null, _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("span", { className: "text-sm font-medium", children: t.active }), rows.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: t.none })) : (_jsx("ul", { className: "flex flex-col divide-y rounded-md border", children: rows.map((share) => {
|
|
48
|
+
const period = share.from || share.to ? `${share.from ?? "…"} – ${share.to ?? "…"}` : t.allTime;
|
|
49
|
+
return (_jsxs("li", { className: "flex items-center justify-between gap-2 p-2 text-sm", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "font-medium", children: [period, share.baseCurrency ? ` · ${share.baseCurrency}` : ""] }), _jsxs("div", { className: "text-xs text-muted-foreground", children: [formatMessage(t.expires, { date: share.expiresAt.slice(0, 10) }), " \u00B7", " ", share.accessCount > 0
|
|
50
|
+
? formatMessage(t.opened, { count: share.accessCount })
|
|
51
|
+
: t.neverOpened] })] }), _jsx(Button, { variant: "ghost", size: "icon-sm", onClick: () => revoke.mutate(share.id), disabled: revoke.isPending, children: _jsx(Trash2, { className: "size-4 text-destructive" }) })] }, share.id));
|
|
52
|
+
}) }))] })] })] }) }));
|
|
53
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface AsyncComboboxOption {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
}
|
|
5
|
+
/** Client-side typeahead over already-loaded options (no server round-trip). */
|
|
6
|
+
export declare const localOptionSearch: (options: AsyncComboboxOption[]) => (query: string) => Promise<AsyncComboboxOption[]>;
|
|
7
|
+
export interface AsyncComboboxProps {
|
|
8
|
+
value: string | null | undefined;
|
|
9
|
+
onChange: (value: string | null) => void;
|
|
10
|
+
/** Resolve options for a query (debounced). */
|
|
11
|
+
search: (query: string) => Promise<AsyncComboboxOption[]>;
|
|
12
|
+
/**
|
|
13
|
+
* When set, an inline "create" row appears for the current query (unless it
|
|
14
|
+
* exactly matches an existing option). Returns the new option to select, or
|
|
15
|
+
* null to cancel.
|
|
16
|
+
*/
|
|
17
|
+
onCreate?: (query: string) => Promise<AsyncComboboxOption | null>;
|
|
18
|
+
/** Label for the inline create row; receives the trimmed query. */
|
|
19
|
+
createLabel?: (query: string) => string;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
emptyText?: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A generic search-as-you-type combobox backed by an async resolver. Keeps a
|
|
27
|
+
* label cache so a previously-selected value still renders a friendly label
|
|
28
|
+
* (falls back to the raw value when unknown). Used for picking departures /
|
|
29
|
+
* products / bookings by search rather than typing a raw id.
|
|
30
|
+
*/
|
|
31
|
+
export declare function AsyncCombobox({ value, onChange, search, onCreate, createLabel, placeholder, // i18n-literal-ok (generic fallback; callers pass localized copy)
|
|
32
|
+
emptyText, disabled, className, }: AsyncComboboxProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
//# sourceMappingURL=async-combobox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async-combobox.d.ts","sourceRoot":"","sources":["../../src/components/async-combobox.tsx"],"names":[],"mappings":"AAcA,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,gFAAgF;AAChF,eAAO,MAAM,iBAAiB,GAC3B,SAAS,mBAAmB,EAAE,MAC9B,OAAO,MAAM,KAAG,OAAO,CAAC,mBAAmB,EAAE,CAG7C,CAAA;AAEH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;IACxC,+CAA+C;IAC/C,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;IACzD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAA;IACjE,mEAAmE;IACnE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAID;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,WAAW,EACX,WAAuB,EAAE,kEAAkE;AAC3F,SAAyB,EACzB,QAAQ,EACR,SAAS,GACV,EAAE,kBAAkB,2CAyHpB"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Combobox, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList, } from "@voyant-travel/ui/components/combobox";
|
|
4
|
+
import { Plus } from "lucide-react";
|
|
5
|
+
import { useEffect, useRef, useState } from "react";
|
|
6
|
+
/** Client-side typeahead over already-loaded options (no server round-trip). */
|
|
7
|
+
export const localOptionSearch = (options) => (query) => {
|
|
8
|
+
const q = query.trim().toLowerCase();
|
|
9
|
+
return Promise.resolve(q ? options.filter((o) => o.label.toLowerCase().includes(q)) : options);
|
|
10
|
+
};
|
|
11
|
+
const CREATE_SENTINEL = "__async_combobox_create__";
|
|
12
|
+
/**
|
|
13
|
+
* A generic search-as-you-type combobox backed by an async resolver. Keeps a
|
|
14
|
+
* label cache so a previously-selected value still renders a friendly label
|
|
15
|
+
* (falls back to the raw value when unknown). Used for picking departures /
|
|
16
|
+
* products / bookings by search rather than typing a raw id.
|
|
17
|
+
*/
|
|
18
|
+
export function AsyncCombobox({ value, onChange, search, onCreate, createLabel, placeholder = "Search…", // i18n-literal-ok (generic fallback; callers pass localized copy)
|
|
19
|
+
emptyText = "No results.", disabled, className, }) {
|
|
20
|
+
const [query, setQuery] = useState("");
|
|
21
|
+
const [options, setOptions] = useState([]);
|
|
22
|
+
const [labels, setLabels] = useState({});
|
|
23
|
+
const [inputValue, setInputValue] = useState("");
|
|
24
|
+
const [creating, setCreating] = useState(false);
|
|
25
|
+
const onCreateRef = useRef(onCreate);
|
|
26
|
+
onCreateRef.current = onCreate;
|
|
27
|
+
// Latest search fn via ref so the debounce effect only re-runs on query.
|
|
28
|
+
const searchRef = useRef(search);
|
|
29
|
+
searchRef.current = search;
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
let active = true;
|
|
32
|
+
const handle = setTimeout(() => {
|
|
33
|
+
searchRef
|
|
34
|
+
.current(query)
|
|
35
|
+
.then((results) => {
|
|
36
|
+
if (!active)
|
|
37
|
+
return;
|
|
38
|
+
setOptions(results);
|
|
39
|
+
setLabels((prev) => {
|
|
40
|
+
const next = { ...prev };
|
|
41
|
+
for (const o of results)
|
|
42
|
+
next[o.value] = o.label;
|
|
43
|
+
return next;
|
|
44
|
+
});
|
|
45
|
+
})
|
|
46
|
+
.catch(() => {
|
|
47
|
+
if (active)
|
|
48
|
+
setOptions([]);
|
|
49
|
+
});
|
|
50
|
+
}, 200);
|
|
51
|
+
return () => {
|
|
52
|
+
active = false;
|
|
53
|
+
clearTimeout(handle);
|
|
54
|
+
};
|
|
55
|
+
}, [query]);
|
|
56
|
+
// Reflect the selected value's label (or raw id) in the input.
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
setInputValue(value ? (labels[value] ?? value) : "");
|
|
59
|
+
}, [value, labels]);
|
|
60
|
+
const trimmed = query.trim();
|
|
61
|
+
const hasExactMatch = options.some((o) => o.label.toLowerCase() === trimmed.toLowerCase());
|
|
62
|
+
const showCreate = Boolean(onCreate) && trimmed.length > 0 && !hasExactMatch && !creating;
|
|
63
|
+
const createRowLabel = (createLabel ?? ((q) => `Create "${q}"`))(trimmed);
|
|
64
|
+
const items = showCreate
|
|
65
|
+
? [...options.map((o) => o.value), CREATE_SENTINEL]
|
|
66
|
+
: options.map((o) => o.value);
|
|
67
|
+
const create = () => {
|
|
68
|
+
const fn = onCreateRef.current;
|
|
69
|
+
if (!fn)
|
|
70
|
+
return;
|
|
71
|
+
const name = query.trim();
|
|
72
|
+
if (!name)
|
|
73
|
+
return;
|
|
74
|
+
setCreating(true);
|
|
75
|
+
fn(name)
|
|
76
|
+
.then((opt) => {
|
|
77
|
+
if (!opt)
|
|
78
|
+
return;
|
|
79
|
+
setLabels((prev) => ({ ...prev, [opt.value]: opt.label }));
|
|
80
|
+
onChange(opt.value);
|
|
81
|
+
setInputValue(opt.label);
|
|
82
|
+
setQuery("");
|
|
83
|
+
})
|
|
84
|
+
.finally(() => setCreating(false));
|
|
85
|
+
};
|
|
86
|
+
return (_jsxs(Combobox, { items: items, value: value ?? null, inputValue: inputValue, autoHighlight: true, disabled: disabled || creating, itemToStringValue: (v) => v === CREATE_SENTINEL ? createRowLabel : (labels[v] ?? v), onInputValueChange: (next) => {
|
|
87
|
+
setInputValue(next);
|
|
88
|
+
setQuery(next);
|
|
89
|
+
if (!next)
|
|
90
|
+
onChange(null);
|
|
91
|
+
}, onValueChange: (next) => {
|
|
92
|
+
const v = next ?? null;
|
|
93
|
+
if (v === CREATE_SENTINEL) {
|
|
94
|
+
create();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
onChange(v);
|
|
98
|
+
setInputValue(v ? (labels[v] ?? v) : "");
|
|
99
|
+
}, children: [_jsx(ComboboxInput, { className: className ?? "w-full", placeholder: placeholder, disabled: disabled || creating, showClear: Boolean(value) && !disabled && !creating }), _jsxs(ComboboxContent, { children: [_jsx(ComboboxEmpty, { children: emptyText }), _jsx(ComboboxList, { children: _jsx(ComboboxCollection, { children: (v) => v === CREATE_SENTINEL ? (_jsxs(ComboboxItem, { value: CREATE_SENTINEL, children: [_jsx(Plus, { className: "size-4 shrink-0" }), _jsx("span", { className: "truncate", children: createRowLabel })] }, CREATE_SENTINEL)) : (_jsx(ComboboxItem, { value: v, children: _jsx("span", { className: "truncate", children: labels[v] ?? v }) }, v)) }) })] })] }));
|
|
100
|
+
}
|