@spaceinvoices/react-ui 0.4.11 → 0.4.31
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/cli/dist/index.js +1 -1
- package/package.json +3 -2
- package/registry.json +30 -31
- package/src/common/autocomplete.tsx +48 -26
- package/src/components/activities/locales/bg.ts +21 -0
- package/src/components/activities/locales/cs.ts +21 -0
- package/src/components/activities/locales/en.ts +21 -0
- package/src/components/activities/locales/et.ts +21 -0
- package/src/components/activities/locales/fi.ts +21 -0
- package/src/components/activities/locales/is.ts +21 -0
- package/src/components/activities/locales/nb.ts +21 -0
- package/src/components/activities/locales/sk.ts +21 -0
- package/src/components/activities/locales/sv.ts +21 -0
- package/src/components/advance-invoices/advance-invoices.hooks.ts +36 -46
- package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +452 -115
- package/src/components/advance-invoices/create/locales/bg.ts +56 -0
- package/src/components/advance-invoices/create/locales/cs.ts +56 -0
- package/src/components/advance-invoices/create/locales/de.ts +15 -7
- package/src/components/advance-invoices/create/locales/en.ts +56 -0
- package/src/components/advance-invoices/create/locales/es.ts +15 -7
- package/src/components/advance-invoices/create/locales/et.ts +56 -0
- package/src/components/advance-invoices/create/locales/fi.ts +56 -0
- package/src/components/advance-invoices/create/locales/fr.ts +16 -8
- package/src/components/advance-invoices/create/locales/hr.ts +29 -21
- package/src/components/advance-invoices/create/locales/is.ts +56 -0
- package/src/components/advance-invoices/create/locales/it.ts +15 -7
- package/src/components/advance-invoices/create/locales/nb.ts +56 -0
- package/src/components/advance-invoices/create/locales/nl.ts +15 -7
- package/src/components/advance-invoices/create/locales/pl.ts +17 -9
- package/src/components/advance-invoices/create/locales/pt.ts +16 -8
- package/src/components/advance-invoices/create/locales/sk.ts +56 -0
- package/src/components/advance-invoices/create/locales/sl.ts +23 -12
- package/src/components/advance-invoices/create/locales/sv.ts +56 -0
- package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +62 -2
- package/src/components/advance-invoices/list/list-row-actions.tsx +48 -16
- package/src/components/advance-invoices/list/list-table.tsx +35 -9
- package/src/components/advance-invoices/list/locales/bg.ts +51 -0
- package/src/components/advance-invoices/list/locales/cs.ts +51 -0
- package/src/components/advance-invoices/list/locales/en.ts +33 -2
- package/src/components/advance-invoices/list/locales/et.ts +51 -0
- package/src/components/advance-invoices/list/locales/fi.ts +51 -0
- package/src/components/advance-invoices/list/locales/hr.ts +15 -15
- package/src/components/advance-invoices/list/locales/is.ts +51 -0
- package/src/components/advance-invoices/list/locales/nb.ts +51 -0
- package/src/components/advance-invoices/list/locales/sk.ts +51 -0
- package/src/components/advance-invoices/list/locales/sv.ts +51 -0
- package/src/components/advance-invoices/list/use-advance-invoice-download.ts +3 -5
- package/src/components/common/autocomplete-locales.ts +101 -0
- package/src/components/company-registry/company-registry.hooks.ts +3 -7
- package/src/components/credit-notes/create/create-credit-note-form.tsx +437 -80
- package/src/components/credit-notes/create/locales/bg.ts +101 -0
- package/src/components/credit-notes/create/locales/cs.ts +101 -0
- package/src/components/credit-notes/create/locales/de.ts +20 -7
- package/src/components/credit-notes/create/locales/en.ts +101 -0
- package/src/components/credit-notes/create/locales/es.ts +20 -7
- package/src/components/credit-notes/create/locales/et.ts +101 -0
- package/src/components/credit-notes/create/locales/fi.ts +101 -0
- package/src/components/credit-notes/create/locales/fr.ts +21 -8
- package/src/components/credit-notes/create/locales/hr.ts +41 -28
- package/src/components/credit-notes/create/locales/is.ts +101 -0
- package/src/components/credit-notes/create/locales/it.ts +20 -7
- package/src/components/credit-notes/create/locales/nb.ts +101 -0
- package/src/components/credit-notes/create/locales/nl.ts +20 -7
- package/src/components/credit-notes/create/locales/pl.ts +22 -9
- package/src/components/credit-notes/create/locales/pt.ts +21 -8
- package/src/components/credit-notes/create/locales/sk.ts +101 -0
- package/src/components/credit-notes/create/locales/sl.ts +28 -14
- package/src/components/credit-notes/create/locales/sv.ts +101 -0
- package/src/components/credit-notes/create/prepare-credit-note-submission.ts +66 -0
- package/src/components/credit-notes/credit-notes.hooks.ts +34 -3
- package/src/components/credit-notes/list/list-row-actions.tsx +19 -7
- package/src/components/credit-notes/list/list-table.tsx +60 -8
- package/src/components/credit-notes/list/locales/bg.ts +48 -0
- package/src/components/credit-notes/list/locales/cs.ts +48 -0
- package/src/components/credit-notes/list/locales/en.ts +31 -2
- package/src/components/credit-notes/list/locales/et.ts +48 -0
- package/src/components/credit-notes/list/locales/fi.ts +48 -0
- package/src/components/credit-notes/list/locales/hr.ts +12 -12
- package/src/components/credit-notes/list/locales/is.ts +48 -0
- package/src/components/credit-notes/list/locales/nb.ts +48 -0
- package/src/components/credit-notes/list/locales/sk.ts +48 -0
- package/src/components/credit-notes/list/locales/sv.ts +48 -0
- package/src/components/credit-notes/list/use-credit-note-download.ts +3 -5
- package/src/components/customers/create-customer-form/locales/bg.ts +21 -0
- package/src/components/customers/create-customer-form/locales/cs.ts +21 -0
- package/src/components/customers/create-customer-form/locales/en.ts +21 -0
- package/src/components/customers/create-customer-form/locales/et.ts +21 -0
- package/src/components/customers/create-customer-form/locales/fi.ts +21 -0
- package/src/components/customers/create-customer-form/locales/hr.ts +11 -11
- package/src/components/customers/create-customer-form/locales/is.ts +21 -0
- package/src/components/customers/create-customer-form/locales/nb.ts +21 -0
- package/src/components/customers/create-customer-form/locales/sk.ts +21 -0
- package/src/components/customers/create-customer-form/locales/sv.ts +21 -0
- package/src/components/customers/customer-autocomplete.tsx +32 -4
- package/src/components/customers/customer-list-table/customer-list-table.tsx +8 -6
- package/src/components/customers/customer-list-table/locales/bg.ts +25 -0
- package/src/components/customers/customer-list-table/locales/cs.ts +25 -0
- package/src/components/customers/customer-list-table/locales/en.ts +17 -2
- package/src/components/customers/customer-list-table/locales/et.ts +25 -0
- package/src/components/customers/customer-list-table/locales/fi.ts +25 -0
- package/src/components/customers/customer-list-table/locales/hr.ts +11 -11
- package/src/components/customers/customer-list-table/locales/is.ts +25 -0
- package/src/components/customers/customer-list-table/locales/nb.ts +25 -0
- package/src/components/customers/customer-list-table/locales/sk.ts +25 -0
- package/src/components/customers/customer-list-table/locales/sv.ts +25 -0
- package/src/components/customers/customers.hooks.ts +14 -17
- package/src/components/customers/edit-customer-form/locales/bg.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/cs.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/en.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/et.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/fi.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/hr.ts +5 -5
- package/src/components/customers/edit-customer-form/locales/is.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/nb.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/sk.ts +13 -0
- package/src/components/customers/edit-customer-form/locales/sv.ts +13 -0
- package/src/components/dashboard/collection-rate-card/collection-rate-card.tsx +7 -6
- package/src/components/dashboard/collection-rate-card/locales/en.ts +3 -0
- package/src/components/dashboard/collection-rate-card/use-collection-rate.ts +8 -7
- package/src/components/dashboard/invoice-status-chart/invoice-status-chart.tsx +7 -4
- package/src/components/dashboard/invoice-status-chart/locales/bg.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/cs.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/de.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/en.ts +10 -0
- package/src/components/dashboard/invoice-status-chart/locales/es.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/et.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/fi.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/fr.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/hr.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/is.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/it.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/nb.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/nl.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/pl.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/pt.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/sk.ts +5 -5
- package/src/components/dashboard/invoice-status-chart/locales/sl.ts +1 -1
- package/src/components/dashboard/invoice-status-chart/locales/sv.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/locales/bg.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/locales/cs.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/locales/en.ts +12 -0
- package/src/components/dashboard/payment-methods-chart/locales/et.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/locales/fi.ts +6 -6
- package/src/components/dashboard/payment-methods-chart/locales/hr.ts +3 -3
- package/src/components/dashboard/payment-methods-chart/locales/is.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/locales/nb.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/locales/sk.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/locales/sv.ts +5 -5
- package/src/components/dashboard/payment-methods-chart/payment-methods-chart.tsx +4 -3
- package/src/components/dashboard/payment-trend-chart/locales/bg.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/locales/cs.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/locales/en.ts +6 -0
- package/src/components/dashboard/payment-trend-chart/locales/et.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/locales/fi.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/locales/is.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/locales/nb.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/locales/sk.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/locales/sv.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/payment-trend-chart.tsx +4 -3
- package/src/components/dashboard/payment-trend-chart/use-payment-trend.ts +12 -9
- package/src/components/dashboard/revenue-card.tsx +3 -3
- package/src/components/dashboard/revenue-trend-chart/locales/bg.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/locales/cs.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/locales/en.ts +6 -0
- package/src/components/dashboard/revenue-trend-chart/locales/et.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/locales/fi.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/locales/is.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/locales/nb.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/locales/sk.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/locales/sv.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/revenue-trend-chart.tsx +4 -3
- package/src/components/dashboard/revenue-trend-chart/use-revenue-trend.ts +4 -3
- package/src/components/dashboard/shared/local-date.ts +11 -0
- package/src/components/dashboard/shared/use-revenue-data.ts +6 -5
- package/src/components/dashboard/shared/use-stats-query.ts +7 -11
- package/src/components/dashboard/stat-card.tsx +3 -3
- package/src/components/dashboard/tax-collected-card/tax-collected-card.tsx +11 -9
- package/src/components/dashboard/tax-collected-card/use-tax-collected.ts +3 -2
- package/src/components/dashboard/top-customers-chart/locales/bg.ts +2 -2
- package/src/components/dashboard/top-customers-chart/locales/cs.ts +2 -2
- package/src/components/dashboard/top-customers-chart/locales/en.ts +7 -0
- package/src/components/dashboard/top-customers-chart/locales/et.ts +2 -2
- package/src/components/dashboard/top-customers-chart/locales/fi.ts +2 -2
- package/src/components/dashboard/top-customers-chart/locales/is.ts +2 -2
- package/src/components/dashboard/top-customers-chart/locales/nb.ts +2 -2
- package/src/components/dashboard/top-customers-chart/locales/sk.ts +2 -2
- package/src/components/dashboard/top-customers-chart/locales/sv.ts +2 -2
- package/src/components/dashboard/top-customers-chart/top-customers-chart.tsx +4 -3
- package/src/components/dashboard/top-customers-chart/use-top-customers.ts +7 -20
- package/src/components/delivery-notes/create/create-delivery-note-form.tsx +179 -47
- package/src/components/delivery-notes/create/locales/bg.ts +69 -0
- package/src/components/delivery-notes/create/locales/cs.ts +69 -0
- package/src/components/delivery-notes/create/locales/de.ts +1 -0
- package/src/components/delivery-notes/create/locales/en.ts +69 -0
- package/src/components/delivery-notes/create/locales/es.ts +1 -0
- package/src/components/delivery-notes/create/locales/et.ts +69 -0
- package/src/components/delivery-notes/create/locales/fi.ts +69 -0
- package/src/components/delivery-notes/create/locales/fr.ts +1 -0
- package/src/components/delivery-notes/create/locales/hr.ts +7 -6
- package/src/components/delivery-notes/create/locales/is.ts +69 -0
- package/src/components/delivery-notes/create/locales/it.ts +1 -0
- package/src/components/delivery-notes/create/locales/nb.ts +69 -0
- package/src/components/delivery-notes/create/locales/nl.ts +1 -0
- package/src/components/delivery-notes/create/locales/pl.ts +1 -0
- package/src/components/delivery-notes/create/locales/pt.ts +1 -0
- package/src/components/delivery-notes/create/locales/sk.ts +69 -0
- package/src/components/delivery-notes/create/locales/sl.ts +6 -5
- package/src/components/delivery-notes/create/locales/sv.ts +69 -0
- package/src/components/delivery-notes/create/prepare-delivery-note-submission.ts +34 -1
- package/src/components/delivery-notes/delivery-notes.hooks.ts +34 -3
- package/src/components/delivery-notes/list/list-row-actions.tsx +62 -16
- package/src/components/delivery-notes/list/list-table.tsx +44 -10
- package/src/components/delivery-notes/list/locales/bg.ts +40 -0
- package/src/components/delivery-notes/list/locales/cs.ts +40 -0
- package/src/components/delivery-notes/list/locales/et.ts +40 -0
- package/src/components/delivery-notes/list/locales/fi.ts +40 -0
- package/src/components/delivery-notes/list/locales/is.ts +40 -0
- package/src/components/delivery-notes/list/locales/nb.ts +40 -0
- package/src/components/delivery-notes/list/locales/sk.ts +40 -0
- package/src/components/delivery-notes/list/locales/sv.ts +40 -0
- package/src/components/delivery-notes/list/use-delivery-note-download.ts +3 -5
- package/src/components/documents/create/custom-create-template.ts +114 -0
- package/src/components/documents/create/document-add-item-form.tsx +266 -153
- package/src/components/documents/create/document-add-item-tax-rate-field.tsx +3 -3
- package/src/components/documents/create/document-date-validation.ts +111 -0
- package/src/components/documents/create/document-details-section.tsx +117 -54
- package/src/components/documents/create/document-form-item.ts +67 -0
- package/src/components/documents/create/document-item-validation.ts +54 -0
- package/src/components/documents/create/document-items-section.tsx +44 -6
- package/src/components/documents/create/document-recipient-section.tsx +10 -2
- package/src/components/documents/create/form-types.ts +2 -2
- package/src/components/documents/create/linked-documents-info.tsx +6 -14
- package/src/components/documents/create/live-preview.tsx +22 -18
- package/src/components/documents/create/mark-as-paid-section.tsx +80 -20
- package/src/components/documents/create/payment-rows.ts +321 -0
- package/src/components/documents/create/prepare-document-submission.ts +160 -109
- package/src/components/documents/create/prepare-preview-data.ts +12 -0
- package/src/components/documents/create/preserved-expected-total.ts +90 -0
- package/src/components/documents/create/scroll-to-first-invalid-field.ts +27 -0
- package/src/components/documents/create/smart-code-insert-button.tsx +5 -53
- package/src/components/documents/create/use-document-customer-form.ts +74 -25
- package/src/components/documents/documents.hooks.ts +3 -5
- package/src/components/documents/index.ts +1 -0
- package/src/components/documents/public/index.ts +1 -0
- package/src/components/documents/public/public-document-summary.tsx +336 -0
- package/src/components/documents/shared/document-preview-display.tsx +65 -39
- package/src/components/documents/shared/index.ts +6 -1
- package/src/components/documents/shared/scaled-document-preview.tsx +33 -19
- package/src/components/documents/types.ts +24 -0
- package/src/components/documents/view/document-actions-bar.tsx +251 -63
- package/src/components/documents/view/document-activities-list.tsx +23 -11
- package/src/components/documents/view/document-details-card.tsx +11 -39
- package/src/components/documents/view/document-payments-list.tsx +114 -57
- package/src/components/documents/view/document-relations-list.tsx +26 -6
- package/src/components/documents/view/document-sidebar.tsx +25 -3
- package/src/components/documents/view/document-version-history.tsx +137 -0
- package/src/components/documents/view/index.ts +1 -0
- package/src/components/documents/view/locales/bg.ts +143 -0
- package/src/components/documents/view/locales/cs.ts +143 -0
- package/src/components/documents/view/locales/de.ts +13 -0
- package/src/components/documents/view/locales/en.ts +143 -0
- package/src/components/documents/view/locales/es.ts +13 -0
- package/src/components/documents/view/locales/et.ts +143 -0
- package/src/components/documents/view/locales/fi.ts +143 -0
- package/src/components/documents/view/locales/fr.ts +13 -0
- package/src/components/documents/view/locales/hr.ts +18 -5
- package/src/components/documents/view/locales/is.ts +143 -0
- package/src/components/documents/view/locales/it.ts +13 -0
- package/src/components/documents/view/locales/nb.ts +143 -0
- package/src/components/documents/view/locales/nl.ts +13 -0
- package/src/components/documents/view/locales/pl.ts +13 -0
- package/src/components/documents/view/locales/pt.ts +13 -0
- package/src/components/documents/view/locales/sk.ts +143 -0
- package/src/components/documents/view/locales/sl.ts +21 -8
- package/src/components/documents/view/locales/sv.ts +143 -0
- package/src/components/documents/view/use-document-download.ts +18 -17
- package/src/components/entities/create-entity-form.tsx +200 -12
- package/src/components/entities/entities.hooks.ts +15 -7
- package/src/components/entities/entity-settings-form/entity-settings-form.tsx +121 -65
- package/src/components/entities/entity-settings-form/input-with-preview.tsx +28 -4
- package/src/components/entities/entity-settings-form/locales/bg.ts +206 -0
- package/src/components/entities/entity-settings-form/locales/cs.ts +206 -0
- package/src/components/entities/entity-settings-form/locales/de.ts +17 -3
- package/src/components/entities/entity-settings-form/locales/en.ts +206 -0
- package/src/components/entities/entity-settings-form/locales/es.ts +15 -3
- package/src/components/entities/entity-settings-form/locales/et.ts +205 -0
- package/src/components/entities/entity-settings-form/locales/fi.ts +206 -0
- package/src/components/entities/entity-settings-form/locales/fr.ts +15 -3
- package/src/components/entities/entity-settings-form/locales/hr.ts +23 -11
- package/src/components/entities/entity-settings-form/locales/is.ts +206 -0
- package/src/components/entities/entity-settings-form/locales/it.ts +15 -3
- package/src/components/entities/entity-settings-form/locales/nb.ts +206 -0
- package/src/components/entities/entity-settings-form/locales/nl.ts +15 -3
- package/src/components/entities/entity-settings-form/locales/pl.ts +15 -3
- package/src/components/entities/entity-settings-form/locales/pt.ts +15 -3
- package/src/components/entities/entity-settings-form/locales/sk.ts +206 -0
- package/src/components/entities/entity-settings-form/locales/sl.ts +31 -18
- package/src/components/entities/entity-settings-form/locales/sv.ts +212 -0
- package/src/components/entities/fina-settings-form/fina-operator-required-dialog.tsx +34 -9
- package/src/components/entities/fina-settings-form/fina-settings-form.tsx +2 -0
- package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +14 -45
- package/src/components/entities/fina-settings-form/locales/bg.ts +163 -0
- package/src/components/entities/fina-settings-form/locales/cs.ts +163 -0
- package/src/components/entities/fina-settings-form/locales/et.ts +163 -0
- package/src/components/entities/fina-settings-form/locales/fi.ts +163 -0
- package/src/components/entities/fina-settings-form/locales/hr.ts +11 -10
- package/src/components/entities/fina-settings-form/locales/is.ts +164 -0
- package/src/components/entities/fina-settings-form/locales/nb.ts +163 -0
- package/src/components/entities/fina-settings-form/locales/sk.ts +163 -0
- package/src/components/entities/fina-settings-form/locales/sl.ts +8 -7
- package/src/components/entities/fina-settings-form/locales/sv.ts +165 -0
- package/src/components/entities/furs-settings-form/furs-operator-required-dialog.tsx +34 -9
- package/src/components/entities/furs-settings-form/furs-settings-form.tsx +13 -1
- package/src/components/entities/furs-settings-form/furs-settings.hooks.ts +141 -42
- package/src/components/entities/furs-settings-form/locales/bg.ts +242 -0
- package/src/components/entities/furs-settings-form/locales/cs.ts +241 -0
- package/src/components/entities/furs-settings-form/locales/de.ts +42 -15
- package/src/components/entities/furs-settings-form/locales/en.ts +24 -0
- package/src/components/entities/furs-settings-form/locales/es.ts +42 -15
- package/src/components/entities/furs-settings-form/locales/et.ts +242 -0
- package/src/components/entities/furs-settings-form/locales/fi.ts +243 -0
- package/src/components/entities/furs-settings-form/locales/fr.ts +43 -15
- package/src/components/entities/furs-settings-form/locales/hr.ts +44 -19
- package/src/components/entities/furs-settings-form/locales/is.ts +242 -0
- package/src/components/entities/furs-settings-form/locales/it.ts +42 -15
- package/src/components/entities/furs-settings-form/locales/nb.ts +242 -0
- package/src/components/entities/furs-settings-form/locales/nl.ts +42 -15
- package/src/components/entities/furs-settings-form/locales/pl.ts +40 -15
- package/src/components/entities/furs-settings-form/locales/pt.ts +42 -15
- package/src/components/entities/furs-settings-form/locales/sk.ts +243 -0
- package/src/components/entities/furs-settings-form/locales/sl.ts +34 -10
- package/src/components/entities/furs-settings-form/locales/sv.ts +242 -0
- package/src/components/entities/furs-settings-form/sections/enable-fiscalization-section.tsx +11 -0
- package/src/components/entities/furs-settings-form/sections/furs-internal-act-download-card.tsx +111 -0
- package/src/components/entities/furs-settings-form/sections/general-settings-section.tsx +27 -0
- package/src/components/entities/furs-settings-form/sections/premises-management-section.tsx +23 -16
- package/src/components/entities/furs-settings-form/sections/register-premise-dialog.tsx +89 -31
- package/src/components/entities/settings/branding-settings-form.tsx +11 -30
- package/src/components/entities/settings/company-settings-form.tsx +2 -1
- package/src/components/entities/settings/defaults-settings-form.tsx +106 -3
- package/src/components/entities/settings/email-settings-form.tsx +245 -3
- package/src/components/entities/settings/eslog-settings-form.tsx +2 -1
- package/src/components/entities/settings/number-format-settings-form.tsx +2 -1
- package/src/components/entities/settings/pdf-template-selector/locales/bg.ts +20 -0
- package/src/components/entities/settings/pdf-template-selector/locales/cs.ts +20 -0
- package/src/components/entities/settings/pdf-template-selector/locales/en.ts +20 -0
- package/src/components/entities/settings/pdf-template-selector/locales/et.ts +19 -0
- package/src/components/entities/settings/pdf-template-selector/locales/fi.ts +20 -0
- package/src/components/entities/settings/pdf-template-selector/locales/is.ts +19 -0
- package/src/components/entities/settings/pdf-template-selector/locales/nb.ts +19 -0
- package/src/components/entities/settings/pdf-template-selector/locales/sk.ts +20 -0
- package/src/components/entities/settings/pdf-template-selector/locales/sv.ts +19 -0
- package/src/components/entities/settings/tax-rules-settings-form.tsx +57 -6
- package/src/components/estimates/create/create-estimate-form.tsx +250 -66
- package/src/components/estimates/create/locales/bg.ts +77 -0
- package/src/components/estimates/create/locales/cs.ts +77 -0
- package/src/components/estimates/create/locales/de.ts +4 -3
- package/src/components/estimates/create/locales/en.ts +77 -0
- package/src/components/estimates/create/locales/es.ts +4 -3
- package/src/components/estimates/create/locales/et.ts +77 -0
- package/src/components/estimates/create/locales/fi.ts +77 -0
- package/src/components/estimates/create/locales/fr.ts +4 -3
- package/src/components/estimates/create/locales/hr.ts +13 -12
- package/src/components/estimates/create/locales/is.ts +77 -0
- package/src/components/estimates/create/locales/it.ts +4 -3
- package/src/components/estimates/create/locales/nb.ts +77 -0
- package/src/components/estimates/create/locales/nl.ts +4 -3
- package/src/components/estimates/create/locales/pl.ts +4 -3
- package/src/components/estimates/create/locales/pt.ts +4 -3
- package/src/components/estimates/create/locales/sk.ts +77 -0
- package/src/components/estimates/create/locales/sl.ts +13 -12
- package/src/components/estimates/create/locales/sv.ts +77 -0
- package/src/components/estimates/create/prepare-estimate-submission.ts +41 -4
- package/src/components/estimates/estimates.hooks.ts +24 -3
- package/src/components/estimates/list/list-row-actions.tsx +34 -7
- package/src/components/estimates/list/list-table.tsx +89 -11
- package/src/components/estimates/list/locales/bg.ts +40 -0
- package/src/components/estimates/list/locales/cs.ts +40 -0
- package/src/components/estimates/list/locales/de.ts +2 -0
- package/src/components/estimates/list/locales/en.ts +29 -2
- package/src/components/estimates/list/locales/es.ts +2 -0
- package/src/components/estimates/list/locales/et.ts +40 -0
- package/src/components/estimates/list/locales/fi.ts +40 -0
- package/src/components/estimates/list/locales/fr.ts +2 -0
- package/src/components/estimates/list/locales/hr.ts +9 -7
- package/src/components/estimates/list/locales/is.ts +40 -0
- package/src/components/estimates/list/locales/it.ts +2 -0
- package/src/components/estimates/list/locales/nb.ts +40 -0
- package/src/components/estimates/list/locales/nl.ts +2 -0
- package/src/components/estimates/list/locales/pl.ts +2 -0
- package/src/components/estimates/list/locales/pt.ts +2 -0
- package/src/components/estimates/list/locales/sk.ts +40 -0
- package/src/components/estimates/list/locales/sl.ts +9 -7
- package/src/components/estimates/list/locales/sv.ts +40 -0
- package/src/components/estimates/list/use-estimate-download.ts +3 -5
- package/src/components/export/document-export-form.tsx +72 -15
- package/src/components/export/sales-per-item-export-form.tsx +3 -2
- package/src/components/invoices/create/create-invoice-form.tsx +500 -112
- package/src/components/invoices/create/eslog-validation.ts +97 -8
- package/src/components/invoices/create/locales/bg.ts +173 -0
- package/src/components/invoices/create/locales/cs.ts +173 -0
- package/src/components/invoices/create/locales/de.ts +41 -9
- package/src/components/invoices/create/locales/en.ts +173 -0
- package/src/components/invoices/create/locales/es.ts +42 -9
- package/src/components/invoices/create/locales/et.ts +173 -0
- package/src/components/invoices/create/locales/fi.ts +173 -0
- package/src/components/invoices/create/locales/fr.ts +42 -11
- package/src/components/invoices/create/locales/hr.ts +50 -18
- package/src/components/invoices/create/locales/is.ts +173 -0
- package/src/components/invoices/create/locales/it.ts +43 -11
- package/src/components/invoices/create/locales/nb.ts +173 -0
- package/src/components/invoices/create/locales/nl.ts +42 -10
- package/src/components/invoices/create/locales/pl.ts +42 -11
- package/src/components/invoices/create/locales/pt.ts +43 -10
- package/src/components/invoices/create/locales/sk.ts +173 -0
- package/src/components/invoices/create/locales/sl.ts +49 -18
- package/src/components/invoices/create/locales/sv.ts +175 -0
- package/src/components/invoices/create/prepare-invoice-submission.ts +73 -2
- package/src/components/invoices/invoices-furs.hooks.ts +11 -8
- package/src/components/invoices/invoices.hooks.ts +36 -10
- package/src/components/invoices/list/list-row-actions.tsx +54 -21
- package/src/components/invoices/list/list-table.tsx +94 -12
- package/src/components/invoices/list/locales/bg.ts +49 -0
- package/src/components/invoices/list/locales/cs.ts +49 -0
- package/src/components/invoices/list/locales/en.ts +34 -2
- package/src/components/invoices/list/locales/et.ts +49 -0
- package/src/components/invoices/list/locales/fi.ts +49 -0
- package/src/components/invoices/list/locales/is.ts +49 -0
- package/src/components/invoices/list/locales/nb.ts +49 -0
- package/src/components/invoices/list/locales/sk.ts +49 -0
- package/src/components/invoices/list/locales/sv.ts +49 -0
- package/src/components/invoices/list/use-invoice-download.ts +3 -5
- package/src/components/invoices/send-email-dialog/locales/bg.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/cs.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/de.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/en.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/es.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/et.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/fi.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/fr.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/hr.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/is.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/it.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/nb.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/nl.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/pl.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/pt.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/sk.ts +63 -0
- package/src/components/invoices/send-email-dialog/locales/sl.ts +26 -0
- package/src/components/invoices/send-email-dialog/locales/sv.ts +63 -0
- package/src/components/invoices/send-email-dialog/send-email-dialog.tsx +189 -93
- package/src/components/invoices/view/eslog-info-display.tsx +2 -0
- package/src/components/invoices/view/fiscalization-status-card.tsx +2 -0
- package/src/components/items/create-item-form/create-item-form.tsx +29 -0
- package/src/components/items/create-item-form/locales/bg.ts +13 -0
- package/src/components/items/create-item-form/locales/cs.ts +13 -0
- package/src/components/items/create-item-form/locales/et.ts +13 -0
- package/src/components/items/create-item-form/locales/fi.ts +13 -0
- package/src/components/items/create-item-form/locales/is.ts +13 -0
- package/src/components/items/create-item-form/locales/nb.ts +13 -0
- package/src/components/items/create-item-form/locales/sk.ts +13 -0
- package/src/components/items/create-item-form/locales/sv.ts +13 -0
- package/src/components/items/edit-item-form/edit-item-form.tsx +39 -1
- package/src/components/items/edit-item-form/locales/bg.ts +12 -0
- package/src/components/items/edit-item-form/locales/cs.ts +12 -0
- package/src/components/items/edit-item-form/locales/en.ts +12 -0
- package/src/components/items/edit-item-form/locales/et.ts +12 -0
- package/src/components/items/edit-item-form/locales/fi.ts +12 -0
- package/src/components/items/edit-item-form/locales/is.ts +12 -0
- package/src/components/items/edit-item-form/locales/nb.ts +12 -0
- package/src/components/items/edit-item-form/locales/sk.ts +12 -0
- package/src/components/items/edit-item-form/locales/sv.ts +12 -0
- package/src/components/items/item-combobox.tsx +55 -22
- package/src/components/items/item-list-table/item-list-table.tsx +47 -23
- package/src/components/items/item-list-table/locales/bg.ts +16 -0
- package/src/components/items/item-list-table/locales/cs.ts +16 -0
- package/src/components/items/item-list-table/locales/en.ts +4 -3
- package/src/components/items/item-list-table/locales/et.ts +16 -0
- package/src/components/items/item-list-table/locales/fi.ts +16 -0
- package/src/components/items/item-list-table/locales/is.ts +16 -0
- package/src/components/items/item-list-table/locales/nb.ts +16 -0
- package/src/components/items/item-list-table/locales/sk.ts +16 -0
- package/src/components/items/item-list-table/locales/sv.ts +16 -0
- package/src/components/items/items.hooks.ts +15 -15
- package/src/components/payments/create-payment-form/create-payment-form.tsx +16 -9
- package/src/components/payments/create-payment-form/locales/bg.ts +20 -0
- package/src/components/payments/create-payment-form/locales/cs.ts +20 -0
- package/src/components/payments/create-payment-form/locales/en.ts +20 -0
- package/src/components/payments/create-payment-form/locales/et.ts +20 -0
- package/src/components/payments/create-payment-form/locales/fi.ts +20 -0
- package/src/components/payments/create-payment-form/locales/hr.ts +2 -2
- package/src/components/payments/create-payment-form/locales/is.ts +20 -0
- package/src/components/payments/create-payment-form/locales/nb.ts +20 -0
- package/src/components/payments/create-payment-form/locales/sk.ts +20 -0
- package/src/components/payments/create-payment-form/locales/sl.ts +4 -4
- package/src/components/payments/create-payment-form/locales/sv.ts +20 -0
- package/src/components/payments/edit-payment-form/edit-payment-form.tsx +10 -2
- package/src/components/payments/edit-payment-form/locales/bg.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/cs.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/en.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/et.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/fi.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/hr.ts +2 -2
- package/src/components/payments/edit-payment-form/locales/is.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/nb.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/sk.ts +20 -0
- package/src/components/payments/edit-payment-form/locales/sl.ts +4 -4
- package/src/components/payments/edit-payment-form/locales/sv.ts +20 -0
- package/src/components/payments/list/list-row-actions.tsx +10 -2
- package/src/components/payments/list/list-table.tsx +51 -45
- package/src/components/payments/list/locales/bg.ts +42 -0
- package/src/components/payments/list/locales/cs.ts +42 -0
- package/src/components/payments/list/locales/de.ts +18 -0
- package/src/components/payments/list/locales/en.ts +37 -2
- package/src/components/payments/list/locales/es.ts +18 -0
- package/src/components/payments/list/locales/et.ts +42 -0
- package/src/components/payments/list/locales/fi.ts +42 -0
- package/src/components/payments/list/locales/fr.ts +18 -0
- package/src/components/payments/list/locales/hr.ts +18 -0
- package/src/components/payments/list/locales/is.ts +42 -0
- package/src/components/payments/list/locales/it.ts +18 -0
- package/src/components/payments/list/locales/nb.ts +42 -0
- package/src/components/payments/list/locales/nl.ts +18 -0
- package/src/components/payments/list/locales/pl.ts +18 -0
- package/src/components/payments/list/locales/pt.ts +18 -0
- package/src/components/payments/list/locales/sk.ts +42 -0
- package/src/components/payments/list/locales/sl.ts +18 -1
- package/src/components/payments/list/locales/sv.ts +42 -0
- package/src/components/payments/payments.hooks.ts +13 -6
- package/src/components/recurring-invoices/create-recurring-invoice-form/create-recurring-invoice-form.tsx +121 -39
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/bg.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/cs.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/en.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/et.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/fi.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/hr.ts +6 -6
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/is.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/nb.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/sk.ts +44 -0
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/sl.ts +4 -4
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/sv.ts +44 -0
- package/src/components/recurring-invoices/list/list-row-actions.tsx +12 -6
- package/src/components/recurring-invoices/list/list-table.tsx +63 -12
- package/src/components/recurring-invoices/list/locales/bg.ts +32 -0
- package/src/components/recurring-invoices/list/locales/cs.ts +32 -0
- package/src/components/recurring-invoices/list/locales/de.ts +4 -0
- package/src/components/recurring-invoices/list/locales/en.ts +27 -0
- package/src/components/recurring-invoices/list/locales/es.ts +4 -0
- package/src/components/recurring-invoices/list/locales/et.ts +32 -0
- package/src/components/recurring-invoices/list/locales/fi.ts +32 -0
- package/src/components/recurring-invoices/list/locales/fr.ts +4 -0
- package/src/components/recurring-invoices/list/locales/hr.ts +4 -0
- package/src/components/recurring-invoices/list/locales/is.ts +32 -0
- package/src/components/recurring-invoices/list/locales/it.ts +4 -0
- package/src/components/recurring-invoices/list/locales/nb.ts +32 -0
- package/src/components/recurring-invoices/list/locales/nl.ts +4 -0
- package/src/components/recurring-invoices/list/locales/pl.ts +4 -0
- package/src/components/recurring-invoices/list/locales/pt.ts +4 -0
- package/src/components/recurring-invoices/list/locales/sk.ts +32 -0
- package/src/components/recurring-invoices/list/locales/sl.ts +4 -0
- package/src/components/recurring-invoices/list/locales/sv.ts +32 -0
- package/src/components/recurring-invoices/recurring-invoices.hooks.ts +11 -8
- package/src/components/request-logs/request-log-detail.tsx +30 -23
- package/src/components/request-logs/request-log-list-table.tsx +88 -45
- package/src/components/table/README.md +47 -9
- package/src/components/table/data-table.tsx +232 -92
- package/src/components/table/filter-bar.tsx +1 -1
- package/src/components/table/filter-panel.tsx +51 -22
- package/src/components/table/hooks/use-table-state.ts +64 -11
- package/src/components/table/index.ts +3 -0
- package/src/components/table/locales.ts +119 -4
- package/src/components/table/selection-toolbar.tsx +65 -9
- package/src/components/table/sorting.ts +80 -0
- package/src/components/table/table-skeleton.tsx +15 -9
- package/src/components/table/types.ts +17 -0
- package/src/components/tax-reports/index.ts +8 -0
- package/src/components/tax-reports/kir-export-form.tsx +4 -5
- package/src/components/tax-reports/slovenia-accounting-mappings-fields.tsx +271 -0
- package/src/components/tax-reports/slovenia-tax-profile-step.tsx +25 -11
- package/src/components/tax-reports/slovenia-vod-export-form.tsx +452 -0
- package/src/components/tax-reports/slovenia-yearly-export-form.tsx +20 -16
- package/src/components/tax-reports/slovenia-yearly-review-step.tsx +42 -19
- package/src/components/taxes/create-tax-form/create-tax-form.tsx +48 -2
- package/src/components/taxes/create-tax-form/locales/bg.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/cs.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/et.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/fi.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/is.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/nb.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/sk.ts +8 -0
- package/src/components/taxes/create-tax-form/locales/sv.ts +8 -0
- package/src/components/taxes/edit-tax-form/edit-tax-form.tsx +80 -11
- package/src/components/taxes/edit-tax-form/locales/bg.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/cs.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/en.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/et.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/fi.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/is.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/nb.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/sk.ts +6 -0
- package/src/components/taxes/edit-tax-form/locales/sv.ts +6 -0
- package/src/components/taxes/tax-list-table/locales/bg.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/cs.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/en.ts +4 -3
- package/src/components/taxes/tax-list-table/locales/et.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/fi.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/is.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/nb.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/sk.ts +17 -0
- package/src/components/taxes/tax-list-table/locales/sv.ts +17 -0
- package/src/components/taxes/tax-list-table/tax-list-table.tsx +53 -19
- package/src/components/taxes/taxes.hooks.ts +53 -12
- package/src/components/ui/badge.tsx +1 -1
- package/src/components/ui/button.tsx +1 -1
- package/src/components/ui/drawer.tsx +2 -2
- package/src/components/ui/form.tsx +118 -10
- package/src/components/ui/progress.tsx +6 -4
- package/src/components/ui/select.tsx +118 -2
- package/src/components/ui/sidebar.tsx +2 -2
- package/src/components/ui/sonner.tsx +17 -36
- package/src/components/ui/sticky-form-footer.tsx +6 -1
- package/src/components/ui/tooltip.tsx +15 -2
- package/src/components/webhook-logs/webhook-delivery-detail.tsx +22 -22
- package/src/components/webhook-logs/webhook-delivery-list-table.tsx +92 -17
- package/src/components/wl-subscription/locked-feature.tsx +11 -10
- package/src/components/wl-subscription/paywall.tsx +184 -72
- package/src/components/wl-subscription/upgrade-modal.tsx +28 -31
- package/src/generate-schemas.ts +146 -103
- package/src/generated/schemas/acceptentityinvitation_body.ts +4 -3
- package/src/generated/schemas/accountwebhook.ts +63 -0
- package/src/generated/schemas/addentityuser_body.ts +4 -3
- package/src/generated/schemas/advanceinvoice.ts +167 -168
- package/src/generated/schemas/authorizeshopify_body.ts +4 -3
- package/src/generated/schemas/calculatedocumentpreview.ts +120 -0
- package/src/generated/schemas/checktransactiontype.ts +35 -0
- package/src/generated/schemas/creditnote.ts +203 -76
- package/src/generated/schemas/customadvanceinvoice.ts +172 -165
- package/src/generated/schemas/customcreditnote.ts +183 -155
- package/src/generated/schemas/customdeliverynote.ts +166 -0
- package/src/generated/schemas/customer.ts +4 -8
- package/src/generated/schemas/customestimate.ts +123 -97
- package/src/generated/schemas/customincomingpurchasedocument.ts +142 -0
- package/src/generated/schemas/custominvoice.ts +183 -154
- package/src/generated/schemas/deliverynote.ts +124 -79
- package/src/generated/schemas/einvoice.ts +19 -0
- package/src/generated/schemas/einvoicingsettings.ts +21 -0
- package/src/generated/schemas/einvoicingsupplier.ts +45 -0
- package/src/generated/schemas/entity.ts +267 -24
- package/src/generated/schemas/entityapikey.ts +1 -3
- package/src/generated/schemas/entityuserrole.ts +1 -3
- package/src/generated/schemas/estimate.ts +120 -127
- package/src/generated/schemas/exportsloveniavodxml_body.ts +17 -0
- package/src/generated/schemas/exportsloveniayearlynormiranireport_body.ts +4 -3
- package/src/generated/schemas/finadevice.ts +15 -0
- package/src/generated/schemas/finalizedocument.ts +52 -0
- package/src/generated/schemas/finapremise.ts +15 -0
- package/src/generated/schemas/finasettings.ts +1 -3
- package/src/generated/schemas/furselectronicdevice.ts +15 -0
- package/src/generated/schemas/furssettings.ts +2 -3
- package/src/generated/schemas/image.ts +15 -0
- package/src/generated/schemas/incomingpurchasedocument.ts +178 -0
- package/src/generated/schemas/incomingpurchasedocumentattachment.ts +15 -0
- package/src/generated/schemas/incomingpurchasedocumentpayment.ts +36 -0
- package/src/generated/schemas/index.ts +30 -5
- package/src/generated/schemas/invoice.ts +182 -183
- package/src/generated/schemas/item.ts +35 -3
- package/src/generated/schemas/legacymigrationauth.ts +18 -0
- package/src/generated/schemas/me.ts +4 -22
- package/src/generated/schemas/migrationjob.ts +20 -0
- package/src/generated/schemas/order.ts +6 -8
- package/src/generated/schemas/orderintegration.ts +12 -12
- package/src/generated/schemas/payment.ts +9 -8
- package/src/generated/schemas/ptatcudseries.ts +28 -0
- package/src/generated/schemas/queryentitystats.ts +15 -0
- package/src/generated/schemas/recurringinvoice.ts +4 -8
- package/src/generated/schemas/registerfursmovablepremise_body.ts +1 -3
- package/src/generated/schemas/registerfursrealestatepremise_body.ts +1 -3
- package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +42 -16
- package/src/generated/schemas/rendercreditnotepreview_body.ts +42 -16
- package/src/generated/schemas/renderdeliverynotepreview_body.ts +19 -8
- package/src/generated/schemas/renderestimatepreview_body.ts +45 -8
- package/src/generated/schemas/renderinvoicepreview_body.ts +46 -18
- package/src/generated/schemas/reviewsloveniayearlynormiranireport.ts +15 -0
- package/src/generated/schemas/searcheinvoicingcustomer.ts +18 -0
- package/src/generated/schemas/senddocument_body.ts +2 -3
- package/src/generated/schemas/sendemail_body.ts +48 -42
- package/src/generated/schemas/sloveniataxprofile.ts +98 -24
- package/src/generated/schemas/starteslogexport_body.ts +34 -0
- package/src/generated/schemas/startpdfexport_body.ts +18 -81
- package/src/generated/schemas/stripeappconnect_body.ts +4 -3
- package/src/generated/schemas/stripeappcreateinvoice_body.ts +4 -6
- package/src/generated/schemas/stripeappmarketplaceauthorize.ts +15 -0
- package/src/generated/schemas/stripeappupdatesettings_body.ts +6 -6
- package/src/generated/schemas/supplier.ts +55 -0
- package/src/generated/schemas/syncshopifyorders_body.ts +21 -0
- package/src/generated/schemas/tax.ts +8 -8
- package/src/generated/schemas/uploadfile_body.ts +2 -3
- package/src/generated/schemas/uploadfurscertificate_body.ts +6 -6
- package/src/generated/schemas/userfinasettings.ts +1 -3
- package/src/generated/schemas/userfurssettings.ts +1 -3
- package/src/generated/schemas/userptsettings.ts +24 -0
- package/src/generated/schemas/voidinvoice_body.ts +25 -0
- package/src/generated/schemas/webhook.ts +6 -8
- package/src/generated/schemas/wlsubscriptionbillingemail.ts +17 -0
- package/src/hooks/create-resource-hooks.ts +22 -19
- package/src/hooks/use-duplicate-document.ts +71 -38
- package/src/hooks/use-eslog-validation.ts +5 -1
- package/src/hooks/use-next-document-number.ts +13 -6
- package/src/hooks/use-resolved-entity-id.ts +14 -0
- package/src/hooks/use-resource-mutation.ts +11 -30
- package/src/hooks/use-transaction-type-check.ts +3 -8
- package/src/lib/browser-cookies.ts +1 -1
- package/src/lib/country-capabilities.ts +114 -0
- package/src/lib/date-fns-locale.ts +1 -20
- package/src/lib/date-only.ts +58 -0
- package/src/lib/document-display.ts +18 -0
- package/src/lib/eslog-export.ts +32 -0
- package/src/lib/fiscalization-options.ts +21 -1
- package/src/lib/formatting.ts +27 -0
- package/src/lib/furs-error-utils.ts +29 -0
- package/src/lib/locale.ts +4 -0
- package/src/lib/payment-display.ts +97 -0
- package/src/lib/pt-document-input.ts +67 -0
- package/src/lib/schemas/shared.ts +12 -0
- package/src/lib/template-variables.tsx +102 -4
- package/src/lib/translation.ts +51 -33
- package/src/lib/white-label-capabilities.ts +626 -0
- package/src/lib/zod-validation-message.ts +291 -0
- package/src/providers/entities-provider.tsx +32 -14
- package/src/providers/sdk-provider.tsx +112 -12
- package/src/providers/space-invoices-provider.tsx +129 -0
- package/src/providers/white-label-provider.tsx +96 -4
- package/src/providers/wl-subscription-provider.tsx +149 -10
- package/src/generated/schemas/previewadvanceinvoice_body.ts +0 -354
- package/src/generated/schemas/previewestimate_body.ts +0 -309
- package/src/generated/schemas/registerfinamovablepremise_body.ts +0 -26
- package/src/generated/schemas/registerfinarealestatepremise_body.ts +0 -37
- package/src/generated/schemas/renderdocument_body.ts +0 -594
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
AdvanceInvoice,
|
|
3
|
+
CalculateDocumentPreview,
|
|
3
4
|
CreateAdvanceInvoiceRequest,
|
|
4
5
|
CreateCreditNoteRequest,
|
|
5
6
|
CreateDeliveryNoteRequest,
|
|
@@ -11,9 +12,16 @@ import type {
|
|
|
11
12
|
Invoice,
|
|
12
13
|
} from "@spaceinvoices/js-sdk";
|
|
13
14
|
import { useQuery } from "@tanstack/react-query";
|
|
14
|
-
|
|
15
|
+
import { buildCustomCreateTemplateFromDocument } from "@/ui/components/documents/create/custom-create-template";
|
|
16
|
+
import { toDocumentFormItem } from "@/ui/components/documents/create/document-form-item";
|
|
17
|
+
import { totalsDifferByCents } from "@/ui/components/documents/create/preserved-expected-total";
|
|
15
18
|
import { useEntities } from "@/ui/providers/entities-context";
|
|
16
|
-
import {
|
|
19
|
+
import { advanceInvoices } from "../../../js-sdk/src/sdk/advance-invoices";
|
|
20
|
+
import { creditNotes } from "../../../js-sdk/src/sdk/credit-notes";
|
|
21
|
+
import { deliveryNotes } from "../../../js-sdk/src/sdk/delivery-notes";
|
|
22
|
+
import { documents } from "../../../js-sdk/src/sdk/documents";
|
|
23
|
+
import { estimates } from "../../../js-sdk/src/sdk/estimates";
|
|
24
|
+
import { invoices } from "../../../js-sdk/src/sdk/invoices";
|
|
17
25
|
|
|
18
26
|
const DUPLICATE_TIMING_EVENT = "si:duplicate-timing";
|
|
19
27
|
|
|
@@ -31,13 +39,32 @@ type CreateRequest =
|
|
|
31
39
|
| CreateAdvanceInvoiceRequest
|
|
32
40
|
| CreateDeliveryNoteRequest;
|
|
33
41
|
|
|
42
|
+
function shouldCheckForPreservedTotal(document: any): boolean {
|
|
43
|
+
return document?.creation_source === "custom" || Math.abs(document?.rounding_correction ?? 0) > 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function buildCalculatePayload(values: Partial<CreateRequest>): CalculateDocumentPreview | null {
|
|
47
|
+
if (!values.items?.length) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
items: values.items,
|
|
53
|
+
customer_id: (values as any).customer_id,
|
|
54
|
+
customer: (values as any).customer,
|
|
55
|
+
currency_code: (values as any).currency_code,
|
|
56
|
+
date: (values as any).date,
|
|
57
|
+
calculation_mode: (values as any).calculation_mode,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
34
61
|
/**
|
|
35
62
|
* Get document type from ID prefix
|
|
36
63
|
*/
|
|
37
64
|
export function getDocumentTypeFromId(id: string): DocumentType | null {
|
|
38
65
|
if (id.startsWith("inv_")) return "invoice";
|
|
39
66
|
if (id.startsWith("est_")) return "estimate";
|
|
40
|
-
if (id.startsWith("cn_")) return "credit_note";
|
|
67
|
+
if (id.startsWith("cre_") || id.startsWith("cn_")) return "credit_note";
|
|
41
68
|
if (id.startsWith("adv_")) return "advance_invoice";
|
|
42
69
|
if (id.startsWith("del_")) return "delivery_note";
|
|
43
70
|
return null;
|
|
@@ -68,34 +95,7 @@ export function getAllowedDuplicateTargets(sourceType: DocumentType): DocumentTy
|
|
|
68
95
|
* Copies relevant fields and resets computed/generated ones
|
|
69
96
|
*/
|
|
70
97
|
function transformDocumentForDuplication(source: Document, targetType: DocumentType): Partial<CreateRequest> {
|
|
71
|
-
|
|
72
|
-
// Use type assertion for items since all document item types share the same shape
|
|
73
|
-
const sourceItems = source.items as Array<{
|
|
74
|
-
type?: string | null;
|
|
75
|
-
name: string;
|
|
76
|
-
description: string | null;
|
|
77
|
-
quantity: number;
|
|
78
|
-
price: number;
|
|
79
|
-
gross_price?: number | null;
|
|
80
|
-
taxes: Array<{ tax_id?: string }>;
|
|
81
|
-
}>;
|
|
82
|
-
const items = sourceItems?.map((item) => ({
|
|
83
|
-
type: item.type ?? undefined,
|
|
84
|
-
name: item.name,
|
|
85
|
-
description: item.description,
|
|
86
|
-
// Separator items skip financial fields
|
|
87
|
-
...(item.type !== "separator"
|
|
88
|
-
? {
|
|
89
|
-
quantity: item.quantity,
|
|
90
|
-
// Use gross_price if set, otherwise use price. The form uses is_gross_price as a UI toggle.
|
|
91
|
-
price: item.gross_price ?? item.price,
|
|
92
|
-
// Copy tax references (tax_id), not computed tax data
|
|
93
|
-
taxes: item.taxes?.map((tax) => ({ tax_id: tax.tax_id })),
|
|
94
|
-
// Derive is_gross_price from whether gross_price is set
|
|
95
|
-
gross_price: item.gross_price ?? undefined,
|
|
96
|
-
}
|
|
97
|
-
: {}),
|
|
98
|
-
}));
|
|
98
|
+
const items = source.items?.map((item) => toDocumentFormItem(item as any));
|
|
99
99
|
|
|
100
100
|
// Build customer data - always copy if available (form needs this for display)
|
|
101
101
|
const customerData = source.customer
|
|
@@ -126,9 +126,14 @@ function transformDocumentForDuplication(source: Document, targetType: DocumentT
|
|
|
126
126
|
items: items as any,
|
|
127
127
|
// Currency
|
|
128
128
|
currency_code: source.currency_code,
|
|
129
|
+
calculation_mode: (source as any).calculation_mode ?? undefined,
|
|
129
130
|
// Notes
|
|
130
131
|
note: source.note,
|
|
131
132
|
payment_terms: source.payment_terms,
|
|
133
|
+
reference: (source as any).reference,
|
|
134
|
+
signature: (source as any).signature,
|
|
135
|
+
tax_clause: (source as any).tax_clause,
|
|
136
|
+
footer: (source as any).footer,
|
|
132
137
|
// Date - use today's date as ISO string
|
|
133
138
|
date: new Date().toISOString(),
|
|
134
139
|
// Number - leave empty for auto-generation
|
|
@@ -137,7 +142,6 @@ function transformDocumentForDuplication(source: Document, targetType: DocumentT
|
|
|
137
142
|
// Skip linking if source is a draft (drafts have no number/fiscalization)
|
|
138
143
|
...(isConversion && !(source as any).is_draft ? { linked_documents: [source.id] } : {}),
|
|
139
144
|
};
|
|
140
|
-
|
|
141
145
|
// Copy service dates when source is an invoice (available on invoices and credit notes)
|
|
142
146
|
if (sourceType === "invoice" || sourceType === "credit_note") {
|
|
143
147
|
const sourceDoc = source as any;
|
|
@@ -149,6 +153,20 @@ function transformDocumentForDuplication(source: Document, targetType: DocumentT
|
|
|
149
153
|
}
|
|
150
154
|
}
|
|
151
155
|
|
|
156
|
+
if (sourceType === "estimate") {
|
|
157
|
+
const sourceDoc = source as Estimate & { title_type?: "estimate" | "proforma_invoice" | null };
|
|
158
|
+
if (sourceDoc.title_type) {
|
|
159
|
+
(baseData as CreateEstimateRequest).title_type = sourceDoc.title_type;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (sourceType === "delivery_note") {
|
|
164
|
+
const sourceDoc = source as DeliveryNote & { hide_prices?: boolean | null };
|
|
165
|
+
if (sourceDoc.hide_prices !== undefined && sourceDoc.hide_prices !== null) {
|
|
166
|
+
(baseData as CreateDeliveryNoteRequest).hide_prices = sourceDoc.hide_prices;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
152
170
|
return baseData;
|
|
153
171
|
}
|
|
154
172
|
|
|
@@ -199,7 +217,6 @@ export function useDuplicateDocument({
|
|
|
199
217
|
targetType,
|
|
200
218
|
enabled = true,
|
|
201
219
|
}: UseDuplicateDocumentOptions): UseDuplicateDocumentResult {
|
|
202
|
-
const { sdk } = useSDK();
|
|
203
220
|
const { activeEntity } = useEntities();
|
|
204
221
|
|
|
205
222
|
const sourceType = sourceId ? getDocumentTypeFromId(sourceId) : null;
|
|
@@ -221,16 +238,16 @@ export function useDuplicateDocument({
|
|
|
221
238
|
// Fetch source document based on its type
|
|
222
239
|
let source: Document;
|
|
223
240
|
if (sourceType === "invoice") {
|
|
224
|
-
source = await
|
|
241
|
+
source = await invoices.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
225
242
|
} else if (sourceType === "estimate") {
|
|
226
|
-
source = await
|
|
243
|
+
source = await estimates.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
227
244
|
} else if (sourceType === "advance_invoice") {
|
|
228
|
-
source = await
|
|
245
|
+
source = await advanceInvoices.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
229
246
|
} else if (sourceType === "delivery_note") {
|
|
230
|
-
source = await
|
|
247
|
+
source = await deliveryNotes.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
231
248
|
} else {
|
|
232
249
|
// Credit note
|
|
233
|
-
source = await
|
|
250
|
+
source = await creditNotes.get(sourceId, undefined, { entity_id: activeEntity.id });
|
|
234
251
|
}
|
|
235
252
|
|
|
236
253
|
if (!source) {
|
|
@@ -238,6 +255,22 @@ export function useDuplicateDocument({
|
|
|
238
255
|
}
|
|
239
256
|
|
|
240
257
|
const initialValues = transformDocumentForDuplication(source, targetType);
|
|
258
|
+
if ((source as any).creation_source === "custom") {
|
|
259
|
+
(initialValues as any)._custom_create_template = buildCustomCreateTemplateFromDocument(source);
|
|
260
|
+
}
|
|
261
|
+
if (shouldCheckForPreservedTotal(source)) {
|
|
262
|
+
const calculatePayload = buildCalculatePayload(initialValues);
|
|
263
|
+
if (calculatePayload) {
|
|
264
|
+
const calculated = await documents.calculateDocumentPreview(
|
|
265
|
+
calculatePayload,
|
|
266
|
+
{ type: targetType },
|
|
267
|
+
{ entity_id: activeEntity.id },
|
|
268
|
+
);
|
|
269
|
+
if (totalsDifferByCents(calculated.total_with_tax, (source as any).total_with_tax)) {
|
|
270
|
+
(initialValues as any)._preserved_expected_total_with_tax = (source as any).total_with_tax;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
241
274
|
|
|
242
275
|
// Build source document summaries for conversions (different source → target type)
|
|
243
276
|
const isConversion = sourceType !== targetType;
|
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import { useEffect, useState } from "react";
|
|
9
9
|
|
|
10
|
-
type EslogError = {
|
|
10
|
+
type EslogError = {
|
|
11
|
+
field: string;
|
|
12
|
+
message: string;
|
|
13
|
+
params?: Record<string, number | string>;
|
|
14
|
+
};
|
|
11
15
|
|
|
12
16
|
type Entity = {
|
|
13
17
|
country_code?: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
|
|
3
|
-
import { useSDK } from "@/ui/providers/sdk-provider";
|
|
2
|
+
import { documents } from "../../../js-sdk/src/sdk/documents";
|
|
4
3
|
|
|
5
4
|
export const NEXT_DOCUMENT_NUMBER_CACHE_KEY = "next-document-number";
|
|
6
5
|
|
|
@@ -13,6 +12,16 @@ export type NextDocumentNumberResponse = {
|
|
|
13
12
|
business_premise_name: string;
|
|
14
13
|
electronic_device_name: string;
|
|
15
14
|
} | null;
|
|
15
|
+
fina?: {
|
|
16
|
+
business_premise_name: string;
|
|
17
|
+
electronic_device_name: string;
|
|
18
|
+
} | null;
|
|
19
|
+
pt?: {
|
|
20
|
+
series_id: string;
|
|
21
|
+
series_code: string;
|
|
22
|
+
validation_code: string;
|
|
23
|
+
manual?: boolean;
|
|
24
|
+
} | null;
|
|
16
25
|
};
|
|
17
26
|
|
|
18
27
|
/**
|
|
@@ -30,8 +39,6 @@ export function useNextDocumentNumber(
|
|
|
30
39
|
enabled?: boolean;
|
|
31
40
|
},
|
|
32
41
|
) {
|
|
33
|
-
const { sdk } = useSDK();
|
|
34
|
-
|
|
35
42
|
return useQuery<NextDocumentNumberResponse>({
|
|
36
43
|
queryKey: [
|
|
37
44
|
NEXT_DOCUMENT_NUMBER_CACHE_KEY,
|
|
@@ -41,7 +48,7 @@ export function useNextDocumentNumber(
|
|
|
41
48
|
options?.electronicDeviceName,
|
|
42
49
|
],
|
|
43
50
|
queryFn: async () => {
|
|
44
|
-
const response = await
|
|
51
|
+
const response = await documents.getNextNumber(
|
|
45
52
|
{
|
|
46
53
|
type: type as "invoice",
|
|
47
54
|
business_premise_name: options?.businessPremiseName,
|
|
@@ -51,7 +58,7 @@ export function useNextDocumentNumber(
|
|
|
51
58
|
);
|
|
52
59
|
return response;
|
|
53
60
|
},
|
|
54
|
-
enabled: options?.enabled !== false && !!entityId
|
|
61
|
+
enabled: options?.enabled !== false && !!entityId,
|
|
55
62
|
staleTime: 0, // Always refetch when form opens
|
|
56
63
|
});
|
|
57
64
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useEntitiesOptional } from "@/ui/providers/entities-context";
|
|
2
|
+
|
|
3
|
+
export function useResolvedEntityId(explicitEntityId?: string | null, consumerName = "Space Invoices component") {
|
|
4
|
+
const entitiesContext = useEntitiesOptional();
|
|
5
|
+
const resolvedEntityId = explicitEntityId ?? entitiesContext?.activeEntity?.id ?? null;
|
|
6
|
+
|
|
7
|
+
if (!resolvedEntityId) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
`${consumerName} requires an entity ID. Pass entityId explicitly or render it inside an EntitiesProvider with an active entity.`,
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return resolvedEntityId;
|
|
14
|
+
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import type SDK from "@spaceinvoices/js-sdk";
|
|
2
1
|
import type { SDKMethodOptions } from "@spaceinvoices/js-sdk";
|
|
3
2
|
import type { UseMutationOptions } from "@tanstack/react-query";
|
|
4
3
|
|
|
5
4
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
5
|
|
|
7
|
-
import { useSDK } from "@/ui/providers/sdk-provider";
|
|
8
|
-
|
|
9
6
|
type ResourceMutationOptions<TData, TError, TVariables, TContext> = {
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
7
|
+
/** Concrete SDK module method */
|
|
8
|
+
mutationFn: (...args: any[]) => Promise<TData>;
|
|
9
|
+
/** How to map TVariables to the mutationFn signature */
|
|
10
|
+
operation: "create" | "update" | "idOnly";
|
|
14
11
|
/** The cache key(s) to invalidate after successful mutation */
|
|
15
12
|
cacheKey: string | string[];
|
|
16
13
|
/** Entity ID for multi-tenant filtering */
|
|
@@ -34,14 +31,13 @@ type ResourceMutationOptions<TData, TError, TVariables, TContext> = {
|
|
|
34
31
|
* Automatically handles cache invalidation and error handling
|
|
35
32
|
*/
|
|
36
33
|
export function useResourceMutation<TData, TError = Error, TVariables = unknown, TContext = unknown>({
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
mutationFn,
|
|
35
|
+
operation,
|
|
39
36
|
cacheKey,
|
|
40
37
|
entityId,
|
|
41
38
|
accountId,
|
|
42
39
|
mutationOptions,
|
|
43
40
|
}: ResourceMutationOptions<TData, TError, TVariables, TContext>) {
|
|
44
|
-
const { sdk } = useSDK();
|
|
45
41
|
const queryClient = useQueryClient();
|
|
46
42
|
|
|
47
43
|
// Destructure to separate onSuccess/onError from other options
|
|
@@ -50,35 +46,20 @@ export function useResourceMutation<TData, TError = Error, TVariables = unknown,
|
|
|
50
46
|
return useMutation<TData, TError, TVariables, TContext>({
|
|
51
47
|
...otherOptions,
|
|
52
48
|
mutationFn: async (variables: TVariables) => {
|
|
53
|
-
// SDK is guaranteed non-null by provider - no need to check
|
|
54
|
-
const resource = sdk[resourceName] as Record<string, (...args: unknown[]) => Promise<unknown>>;
|
|
55
|
-
|
|
56
|
-
if (!resource || typeof resource[methodName] !== "function") {
|
|
57
|
-
throw new Error(`Method ${methodName} not found on resource ${String(resourceName)}`);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
49
|
// Build SDK options (entity_id, etc.)
|
|
61
50
|
const options: SDKMethodOptions | undefined = entityId ? { entity_id: entityId } : undefined;
|
|
62
51
|
|
|
63
|
-
|
|
64
|
-
const isUpdateMethod = methodName === "update";
|
|
65
|
-
const isIdOnlyMethod =
|
|
66
|
-
methodName === "delete" || methodName.startsWith("restore") || methodName.startsWith("permanentDelete");
|
|
67
|
-
|
|
68
|
-
if (isUpdateMethod) {
|
|
69
|
-
// Update: method(id, data, options)
|
|
52
|
+
if (operation === "update") {
|
|
70
53
|
const { id, data } = variables as { id: string; data: unknown };
|
|
71
|
-
return (await
|
|
54
|
+
return (await mutationFn(id, data, options)) as TData;
|
|
72
55
|
}
|
|
73
56
|
|
|
74
|
-
if (
|
|
75
|
-
// Delete/Restore/PermanentDelete: method(id, options)
|
|
57
|
+
if (operation === "idOnly") {
|
|
76
58
|
const { id } = variables as { id: string };
|
|
77
|
-
return (await
|
|
59
|
+
return (await mutationFn(id, options)) as TData;
|
|
78
60
|
}
|
|
79
61
|
|
|
80
|
-
|
|
81
|
-
return (await resource[methodName](variables, options)) as TData;
|
|
62
|
+
return (await mutationFn(variables, options)) as TData;
|
|
82
63
|
},
|
|
83
64
|
|
|
84
65
|
onSuccess: (data, variables, context) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { TransactionTypeCheckRequest, TransactionTypeCheckResponse } from "@spaceinvoices/js-sdk";
|
|
2
2
|
import { useQuery } from "@tanstack/react-query";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { transactionType } from "../../../js-sdk/src/sdk/transaction-type";
|
|
5
5
|
import { useDebounce } from "./use-debounce";
|
|
6
6
|
|
|
7
7
|
export const TRANSACTION_TYPE_CHECK_CACHE_KEY = "transaction-type-check";
|
|
@@ -77,8 +77,6 @@ export function useTransactionTypeCheck({
|
|
|
77
77
|
customerIsEndConsumer,
|
|
78
78
|
enabled = true,
|
|
79
79
|
}: UseTransactionTypeCheckParams): UseTransactionTypeCheckResult {
|
|
80
|
-
const { sdk } = useSDK();
|
|
81
|
-
|
|
82
80
|
// Build the request object
|
|
83
81
|
const requestData = useMemo((): TransactionTypeCheckRequest | null => {
|
|
84
82
|
// Need at least issuer info to make a check
|
|
@@ -120,12 +118,9 @@ export function useTransactionTypeCheck({
|
|
|
120
118
|
queryKey,
|
|
121
119
|
queryFn: async () => {
|
|
122
120
|
if (!debouncedRequest) throw new Error("No request data");
|
|
123
|
-
|
|
124
|
-
// (sdk.transactionType is not reliably available in Vite pre-bundled builds)
|
|
125
|
-
const checkFn = sdk.transactionType?.checkTransactionType ?? sdk.vies.checkVies;
|
|
126
|
-
return checkFn(debouncedRequest);
|
|
121
|
+
return transactionType.checkTransactionType(debouncedRequest);
|
|
127
122
|
},
|
|
128
|
-
enabled: enabled && !!
|
|
123
|
+
enabled: enabled && !!debouncedRequest,
|
|
129
124
|
staleTime: CHECK_STALE_TIME,
|
|
130
125
|
refetchOnWindowFocus: false,
|
|
131
126
|
});
|
|
@@ -64,7 +64,7 @@ export function deleteCookie(name: string, path = "/") {
|
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
// Also delete domain cookie (e.g. .spaceinvoices.com) if on spaceinvoices.com
|
|
67
|
-
const hostname = typeof window !== "undefined" ? window.location.hostname : globalThis.location?.hostname ?? "";
|
|
67
|
+
const hostname = typeof window !== "undefined" ? window.location.hostname : (globalThis.location?.hostname ?? "");
|
|
68
68
|
if (hostname === "spaceinvoices.com" || hostname.endsWith(".spaceinvoices.com")) {
|
|
69
69
|
setCookie(name, "", {
|
|
70
70
|
path,
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { AdvanceInvoice, CreditNote, DeliveryNote, Estimate, Invoice } from "@spaceinvoices/js-sdk";
|
|
2
|
+
|
|
3
|
+
import type { PdfTemplateId } from "@/ui/components/documents/create/live-preview";
|
|
4
|
+
import type { Entity } from "@/ui/providers/entities-context";
|
|
5
|
+
|
|
6
|
+
export const PORTUGAL_COUNTRY_CODE = "PT";
|
|
7
|
+
export const PORTUGAL_PDF_LOCALE = "pt-PT";
|
|
8
|
+
export const PORTUGAL_CANONICAL_PDF_TEMPLATE: PdfTemplateId = "classic";
|
|
9
|
+
const ACTIVE_ACCOUNT_COOKIE = "l.account";
|
|
10
|
+
const SUPPORT_ACCOUNT_ID = import.meta.env.VITE_SUPPORT_ACCOUNT_ID || "acc_000000000000000000000001";
|
|
11
|
+
|
|
12
|
+
export type CountryAwareDocument = Invoice | Estimate | CreditNote | AdvanceInvoice | DeliveryNote;
|
|
13
|
+
export type CountryAwareDocumentType = "invoice" | "estimate" | "credit_note" | "advance_invoice" | "delivery_note";
|
|
14
|
+
|
|
15
|
+
type CountryEntity = Pick<Entity, "country_code" | "settings"> | null | undefined;
|
|
16
|
+
|
|
17
|
+
export function isPortugalEntity(entity: CountryEntity): boolean {
|
|
18
|
+
return entity?.country_code === PORTUGAL_COUNTRY_CODE;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function getCookieValue(name: string) {
|
|
22
|
+
if (typeof document === "undefined") {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const cookiePrefix = `${name}=`;
|
|
27
|
+
const rawCookie = document.cookie
|
|
28
|
+
.split(";")
|
|
29
|
+
.map((cookie) => cookie.trim())
|
|
30
|
+
.find((cookie) => cookie.startsWith(cookiePrefix));
|
|
31
|
+
|
|
32
|
+
if (!rawCookie) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return decodeURIComponent(rawCookie.slice(cookiePrefix.length));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function hasPortugalUiAccess() {
|
|
39
|
+
if (typeof document === "undefined") {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const activeAccountId = getCookieValue(ACTIVE_ACCOUNT_COOKIE);
|
|
44
|
+
return !!SUPPORT_ACCOUNT_ID && activeAccountId === SUPPORT_ACCOUNT_ID;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function resolveDocumentPdfTemplate(entity: CountryEntity): PdfTemplateId {
|
|
48
|
+
if (isPortugalEntity(entity) && hasPortugalUiAccess()) {
|
|
49
|
+
return PORTUGAL_CANONICAL_PDF_TEMPLATE;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const settings = (entity?.settings as Record<string, unknown> | undefined) ?? {};
|
|
53
|
+
return (settings.pdf_template as PdfTemplateId) || "modern";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function getPortugalEditBlockedReason(entity: CountryEntity): string | undefined {
|
|
57
|
+
if (!isPortugalEntity(entity) || !hasPortugalUiAccess()) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return "Issued Portugal documents cannot be edited. Void the document instead.";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function getEntityCountryCapabilities(entity: CountryEntity) {
|
|
65
|
+
const isPortugal = isPortugalEntity(entity) && hasPortugalUiAccess();
|
|
66
|
+
const isSlovenia = entity?.country_code === "SI";
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
isPortugal,
|
|
70
|
+
isSlovenia,
|
|
71
|
+
usesFixedPdfTemplate: isPortugal,
|
|
72
|
+
showPtSaftExport: isPortugal,
|
|
73
|
+
showSloveniaVodExport: isSlovenia,
|
|
74
|
+
showPtAtcudSettings: isPortugal,
|
|
75
|
+
allowTemplateSettings: !isPortugal,
|
|
76
|
+
allowEmailSettings: !isPortugal,
|
|
77
|
+
showTemplatesSettings: !isPortugal,
|
|
78
|
+
showEmailSettings: !isPortugal,
|
|
79
|
+
allowPdfTemplateSelection: !isPortugal,
|
|
80
|
+
allowPdfLanguageSelection: !isPortugal,
|
|
81
|
+
allowDocumentDrafts: !isPortugal,
|
|
82
|
+
allowSavedItemFullEdit: !isPortugal,
|
|
83
|
+
resolvedPdfTemplate: resolveDocumentPdfTemplate(entity),
|
|
84
|
+
forcePdfLocale: isPortugal ? PORTUGAL_PDF_LOCALE : undefined,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function getDocumentCountryCapabilities(
|
|
89
|
+
entity: CountryEntity,
|
|
90
|
+
documentType: CountryAwareDocumentType,
|
|
91
|
+
document?: Partial<CountryAwareDocument> | null,
|
|
92
|
+
) {
|
|
93
|
+
const entityCapabilities = getEntityCountryCapabilities(entity);
|
|
94
|
+
const isDraft = document?.is_draft === true;
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
...entityCapabilities,
|
|
98
|
+
allowEmailSend: !entityCapabilities.isPortugal,
|
|
99
|
+
allowSendEmail: !entityCapabilities.isPortugal,
|
|
100
|
+
allowEditIssuedDocument: !entityCapabilities.isPortugal || isDraft,
|
|
101
|
+
allowEditDocument: !entityCapabilities.isPortugal || isDraft,
|
|
102
|
+
allowPaymentAction:
|
|
103
|
+
(documentType === "invoice" || documentType === "advance_invoice" || documentType === "credit_note") &&
|
|
104
|
+
!(entityCapabilities.isPortugal && documentType === "credit_note"),
|
|
105
|
+
allowPaymentActions:
|
|
106
|
+
(documentType === "invoice" || documentType === "advance_invoice" || documentType === "credit_note") &&
|
|
107
|
+
!(entityCapabilities.isPortugal && documentType === "credit_note"),
|
|
108
|
+
forceDocumentPdfLocale: entityCapabilities.forcePdfLocale,
|
|
109
|
+
isDraft,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export const getCountryUiCapabilities = getEntityCountryCapabilities;
|
|
114
|
+
export const getDocumentUiCapabilities = getDocumentCountryCapabilities;
|
|
@@ -1,24 +1,5 @@
|
|
|
1
1
|
import type { Locale } from "date-fns";
|
|
2
|
-
import {
|
|
3
|
-
bg,
|
|
4
|
-
cs,
|
|
5
|
-
de,
|
|
6
|
-
enUS,
|
|
7
|
-
es,
|
|
8
|
-
et,
|
|
9
|
-
fi,
|
|
10
|
-
fr,
|
|
11
|
-
hr,
|
|
12
|
-
is,
|
|
13
|
-
it,
|
|
14
|
-
nb,
|
|
15
|
-
nl,
|
|
16
|
-
pl,
|
|
17
|
-
pt,
|
|
18
|
-
sk,
|
|
19
|
-
sl,
|
|
20
|
-
sv,
|
|
21
|
-
} from "date-fns/locale";
|
|
2
|
+
import { bg, cs, de, enUS, es, et, fi, fr, hr, is, it, nb, nl, pl, pt, sk, sl, sv } from "date-fns/locale";
|
|
22
3
|
import { getLocaleLanguage } from "./locale";
|
|
23
4
|
|
|
24
5
|
const DATE_FNS_LOCALES: Record<string, Locale> = {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const DATE_ONLY_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
|
|
2
|
+
const LEADING_DATE_ONLY_PATTERN = /^(\d{4}-\d{2}-\d{2})(?:$|T)/;
|
|
3
|
+
|
|
4
|
+
export function toLocalDateOnlyString(date: Date): string {
|
|
5
|
+
const year = date.getFullYear();
|
|
6
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
7
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
8
|
+
return `${year}-${month}-${day}`;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function normalizeDateOnlyInput(value: string | undefined): string | undefined {
|
|
12
|
+
if (!value) return undefined;
|
|
13
|
+
if (DATE_ONLY_PATTERN.test(value)) return value;
|
|
14
|
+
|
|
15
|
+
const utcMidnightMatch = value.match(/^(\d{4}-\d{2}-\d{2})T00:00:00(?:\.000)?Z$/);
|
|
16
|
+
if (utcMidnightMatch) {
|
|
17
|
+
return utcMidnightMatch[1];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const date = new Date(value);
|
|
21
|
+
if (Number.isNaN(date.getTime())) {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return toLocalDateOnlyString(date);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function toUtcMidnightIsoString(value: string | undefined): string | undefined {
|
|
29
|
+
const dateOnly = normalizeDateOnlyInput(value);
|
|
30
|
+
return dateOnly ? `${dateOnly}T00:00:00.000Z` : undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function extractDateOnlyToken(value: string | undefined): string | undefined {
|
|
34
|
+
return value?.match(LEADING_DATE_ONLY_PATTERN)?.[1];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function formatDateOnlyForDisplay(
|
|
38
|
+
value: Date | string | null | undefined,
|
|
39
|
+
locale: string,
|
|
40
|
+
options: Intl.DateTimeFormatOptions = {
|
|
41
|
+
year: "numeric",
|
|
42
|
+
month: "short",
|
|
43
|
+
day: "numeric",
|
|
44
|
+
},
|
|
45
|
+
): string {
|
|
46
|
+
if (!value) return "-";
|
|
47
|
+
|
|
48
|
+
const normalized = typeof value === "string" ? normalizeDateOnlyInput(value) ?? extractDateOnlyToken(value) : undefined;
|
|
49
|
+
const dateOnly = normalized ?? (value instanceof Date ? toLocalDateOnlyString(value) : undefined);
|
|
50
|
+
|
|
51
|
+
if (!dateOnly) {
|
|
52
|
+
return typeof value === "string" ? value : "-";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return new Intl.DateTimeFormat(locale, { ...options, timeZone: "UTC" }).format(
|
|
56
|
+
new Date(`${dateOnly}T00:00:00.000Z`),
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type TranslateFn = (key: string) => string;
|
|
2
|
+
|
|
3
|
+
type DraftDocumentLike = {
|
|
4
|
+
number?: string | null;
|
|
5
|
+
is_draft?: boolean | null;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function isBackendDraftNumber(number: string | null | undefined): boolean {
|
|
9
|
+
return typeof number === "string" && number.trim().toLowerCase().startsWith("draft-");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function getDisplayDocumentNumber(document: DraftDocumentLike, t: TranslateFn, fallback = "-"): string {
|
|
13
|
+
if (document.is_draft || isBackendDraftNumber(document.number)) {
|
|
14
|
+
return t("Draft");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return document.number?.trim() || fallback;
|
|
18
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type EslogDocumentLike = {
|
|
2
|
+
eslog?: {
|
|
3
|
+
validation_status?: string | null;
|
|
4
|
+
} | null;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type EslogSelectionState = {
|
|
8
|
+
selectedCount: number;
|
|
9
|
+
eligibleCount: number;
|
|
10
|
+
hasEligibleDocuments: boolean;
|
|
11
|
+
hasIneligibleDocuments: boolean;
|
|
12
|
+
allEligible: boolean;
|
|
13
|
+
noneEligible: boolean;
|
|
14
|
+
partiallyEligible: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function getEslogSelectionState(documents: EslogDocumentLike[]): EslogSelectionState {
|
|
18
|
+
const selectedCount = documents.length;
|
|
19
|
+
const eligibleCount = documents.filter((document) => document.eslog?.validation_status === "valid").length;
|
|
20
|
+
const hasEligibleDocuments = eligibleCount > 0;
|
|
21
|
+
const hasIneligibleDocuments = eligibleCount < selectedCount;
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
selectedCount,
|
|
25
|
+
eligibleCount,
|
|
26
|
+
hasEligibleDocuments,
|
|
27
|
+
hasIneligibleDocuments,
|
|
28
|
+
allEligible: selectedCount > 0 && eligibleCount === selectedCount,
|
|
29
|
+
noneEligible: selectedCount > 0 && eligibleCount === 0,
|
|
30
|
+
partiallyEligible: eligibleCount > 0 && eligibleCount < selectedCount,
|
|
31
|
+
};
|
|
32
|
+
}
|