@spaceinvoices/react-ui 0.4.12 → 0.4.32
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 +1 -1
- package/src/common/autocomplete.tsx +7 -1
- package/src/components/advance-invoices/advance-invoices.hooks.ts +35 -44
- package/src/components/advance-invoices/create/create-advance-invoice-form.tsx +190 -73
- package/src/components/advance-invoices/create/locales/bg.ts +17 -9
- package/src/components/advance-invoices/create/locales/cs.ts +17 -9
- package/src/components/advance-invoices/create/locales/de.ts +15 -7
- package/src/components/advance-invoices/create/locales/en.ts +15 -7
- package/src/components/advance-invoices/create/locales/es.ts +15 -7
- package/src/components/advance-invoices/create/locales/et.ts +17 -9
- package/src/components/advance-invoices/create/locales/fi.ts +18 -10
- package/src/components/advance-invoices/create/locales/fr.ts +16 -8
- package/src/components/advance-invoices/create/locales/hr.ts +15 -7
- package/src/components/advance-invoices/create/locales/is.ts +17 -9
- package/src/components/advance-invoices/create/locales/it.ts +15 -7
- package/src/components/advance-invoices/create/locales/nb.ts +17 -9
- 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 +17 -9
- package/src/components/advance-invoices/create/locales/sl.ts +14 -5
- package/src/components/advance-invoices/create/locales/sv.ts +17 -9
- package/src/components/advance-invoices/create/prepare-advance-invoice-submission.ts +47 -1
- package/src/components/advance-invoices/list/list-table.tsx +2 -1
- package/src/components/credit-notes/create/create-credit-note-form.tsx +254 -85
- package/src/components/credit-notes/create/locales/bg.ts +22 -8
- package/src/components/credit-notes/create/locales/cs.ts +22 -8
- package/src/components/credit-notes/create/locales/de.ts +20 -7
- package/src/components/credit-notes/create/locales/en.ts +19 -5
- package/src/components/credit-notes/create/locales/es.ts +20 -7
- package/src/components/credit-notes/create/locales/et.ts +22 -8
- package/src/components/credit-notes/create/locales/fi.ts +23 -9
- package/src/components/credit-notes/create/locales/fr.ts +21 -8
- package/src/components/credit-notes/create/locales/hr.ts +20 -7
- package/src/components/credit-notes/create/locales/is.ts +22 -8
- package/src/components/credit-notes/create/locales/it.ts +20 -7
- package/src/components/credit-notes/create/locales/nb.ts +22 -8
- 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 +22 -8
- package/src/components/credit-notes/create/locales/sl.ts +19 -5
- package/src/components/credit-notes/create/locales/sv.ts +22 -8
- package/src/components/credit-notes/create/prepare-credit-note-submission.ts +35 -1
- package/src/components/credit-notes/credit-notes.hooks.ts +21 -2
- package/src/components/credit-notes/list/list-table.tsx +2 -1
- package/src/components/delivery-notes/create/create-delivery-note-form.tsx +133 -30
- package/src/components/delivery-notes/create/locales/bg.ts +1 -0
- package/src/components/delivery-notes/create/locales/cs.ts +1 -0
- package/src/components/delivery-notes/create/locales/de.ts +1 -0
- package/src/components/delivery-notes/create/locales/en.ts +1 -0
- package/src/components/delivery-notes/create/locales/es.ts +1 -0
- package/src/components/delivery-notes/create/locales/et.ts +1 -0
- package/src/components/delivery-notes/create/locales/fi.ts +1 -0
- package/src/components/delivery-notes/create/locales/fr.ts +1 -0
- package/src/components/delivery-notes/create/locales/hr.ts +1 -0
- package/src/components/delivery-notes/create/locales/is.ts +1 -0
- package/src/components/delivery-notes/create/locales/it.ts +1 -0
- package/src/components/delivery-notes/create/locales/nb.ts +1 -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 +1 -0
- package/src/components/delivery-notes/create/locales/sl.ts +1 -0
- package/src/components/delivery-notes/create/locales/sv.ts +1 -0
- package/src/components/delivery-notes/create/prepare-delivery-note-submission.ts +34 -1
- package/src/components/delivery-notes/delivery-notes.hooks.ts +15 -1
- package/src/components/delivery-notes/list/list-table.tsx +2 -1
- package/src/components/documents/create/custom-create-template.ts +151 -0
- package/src/components/documents/create/document-add-item-form.tsx +12 -8
- package/src/components/documents/create/document-add-item-tax-rate-field.tsx +1 -2
- package/src/components/documents/create/document-date-validation.ts +111 -0
- package/src/components/documents/create/document-details-section.tsx +93 -48
- package/src/components/documents/create/document-form-item.ts +67 -0
- package/src/components/documents/create/document-item-validation.ts +6 -2
- package/src/components/documents/create/form-types.ts +2 -2
- package/src/components/documents/create/linked-documents-info.tsx +2 -11
- package/src/components/documents/create/live-preview.tsx +3 -3
- package/src/components/documents/create/mark-as-paid-section.tsx +14 -11
- package/src/components/documents/create/payment-rows.ts +30 -0
- package/src/components/documents/create/prepare-document-submission.ts +143 -103
- 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/public/public-document-summary.tsx +6 -13
- package/src/components/documents/view/document-actions-bar.tsx +10 -1
- package/src/components/documents/view/document-details-card.tsx +4 -12
- package/src/components/documents/view/document-relations-list.tsx +4 -4
- package/src/components/documents/view/locales/bg.ts +8 -8
- package/src/components/documents/view/locales/cs.ts +8 -8
- package/src/components/documents/view/locales/de.ts +1 -1
- package/src/components/documents/view/locales/en.ts +14 -14
- package/src/components/documents/view/locales/es.ts +1 -1
- package/src/components/documents/view/locales/et.ts +8 -8
- package/src/components/documents/view/locales/fi.ts +10 -10
- package/src/components/documents/view/locales/fr.ts +1 -1
- package/src/components/documents/view/locales/hr.ts +6 -6
- package/src/components/documents/view/locales/is.ts +8 -8
- package/src/components/documents/view/locales/it.ts +1 -1
- package/src/components/documents/view/locales/nb.ts +8 -8
- package/src/components/documents/view/locales/nl.ts +1 -1
- package/src/components/documents/view/locales/pl.ts +1 -1
- package/src/components/documents/view/locales/pt.ts +1 -1
- package/src/components/documents/view/locales/sk.ts +8 -8
- package/src/components/documents/view/locales/sl.ts +9 -9
- package/src/components/documents/view/locales/sv.ts +1 -1
- package/src/components/documents/view/use-document-download.ts +2 -2
- package/src/components/entities/entity-settings-form/locales/bg.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/cs.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/de.ts +9 -0
- package/src/components/entities/entity-settings-form/locales/en.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/es.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/et.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/fi.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/fr.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/hr.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/is.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/it.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/nb.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/nl.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/pl.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/pt.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/sk.ts +7 -0
- package/src/components/entities/entity-settings-form/locales/sl.ts +12 -4
- package/src/components/entities/entity-settings-form/locales/sv.ts +7 -0
- package/src/components/entities/settings/tax-rules-settings-form.tsx +36 -0
- package/src/components/estimates/create/create-estimate-form.tsx +196 -47
- package/src/components/estimates/create/locales/bg.ts +6 -5
- package/src/components/estimates/create/locales/cs.ts +6 -5
- package/src/components/estimates/create/locales/de.ts +4 -3
- package/src/components/estimates/create/locales/en.ts +4 -3
- package/src/components/estimates/create/locales/es.ts +4 -3
- package/src/components/estimates/create/locales/et.ts +6 -5
- package/src/components/estimates/create/locales/fi.ts +9 -8
- package/src/components/estimates/create/locales/fr.ts +4 -3
- package/src/components/estimates/create/locales/hr.ts +7 -6
- package/src/components/estimates/create/locales/is.ts +6 -5
- package/src/components/estimates/create/locales/it.ts +4 -3
- package/src/components/estimates/create/locales/nb.ts +6 -5
- 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 +6 -5
- package/src/components/estimates/create/locales/sl.ts +7 -6
- package/src/components/estimates/create/locales/sv.ts +6 -5
- package/src/components/estimates/create/prepare-estimate-submission.ts +37 -3
- package/src/components/estimates/estimates.hooks.ts +11 -2
- package/src/components/estimates/list/list-table.tsx +11 -1
- package/src/components/estimates/list/locales/bg.ts +2 -0
- package/src/components/estimates/list/locales/cs.ts +2 -0
- package/src/components/estimates/list/locales/de.ts +2 -0
- package/src/components/estimates/list/locales/en.ts +2 -0
- package/src/components/estimates/list/locales/es.ts +2 -0
- package/src/components/estimates/list/locales/et.ts +2 -0
- package/src/components/estimates/list/locales/fi.ts +2 -0
- package/src/components/estimates/list/locales/fr.ts +2 -0
- package/src/components/estimates/list/locales/hr.ts +7 -5
- package/src/components/estimates/list/locales/is.ts +2 -0
- package/src/components/estimates/list/locales/it.ts +2 -0
- package/src/components/estimates/list/locales/nb.ts +2 -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 +2 -0
- package/src/components/estimates/list/locales/sl.ts +9 -7
- package/src/components/estimates/list/locales/sv.ts +2 -0
- package/src/components/invoices/create/create-invoice-form.tsx +231 -60
- package/src/components/invoices/create/locales/bg.ts +23 -14
- package/src/components/invoices/create/locales/cs.ts +23 -14
- package/src/components/invoices/create/locales/de.ts +17 -9
- package/src/components/invoices/create/locales/en.ts +16 -7
- package/src/components/invoices/create/locales/es.ts +18 -9
- package/src/components/invoices/create/locales/et.ts +23 -14
- package/src/components/invoices/create/locales/fi.ts +24 -15
- package/src/components/invoices/create/locales/fr.ts +19 -11
- package/src/components/invoices/create/locales/hr.ts +18 -9
- package/src/components/invoices/create/locales/is.ts +23 -14
- package/src/components/invoices/create/locales/it.ts +19 -11
- package/src/components/invoices/create/locales/nb.ts +23 -14
- package/src/components/invoices/create/locales/nl.ts +19 -10
- package/src/components/invoices/create/locales/pl.ts +19 -11
- package/src/components/invoices/create/locales/pt.ts +19 -10
- package/src/components/invoices/create/locales/sk.ts +23 -14
- package/src/components/invoices/create/locales/sl.ts +17 -9
- package/src/components/invoices/create/locales/sv.ts +17 -8
- package/src/components/invoices/create/prepare-invoice-submission.ts +55 -1
- package/src/components/invoices/invoices.hooks.ts +11 -2
- package/src/components/invoices/list/list-table.tsx +2 -1
- package/src/components/invoices/send-email-dialog/locales/bg.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/cs.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/de.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/en.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/es.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/et.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/fi.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/fr.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/hr.ts +8 -3
- package/src/components/invoices/send-email-dialog/locales/is.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/it.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/nb.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/nl.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/pl.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/pt.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/sk.ts +5 -0
- package/src/components/invoices/send-email-dialog/locales/sl.ts +8 -3
- package/src/components/invoices/send-email-dialog/locales/sv.ts +5 -0
- package/src/components/invoices/send-email-dialog/send-email-dialog.tsx +2 -1
- package/src/components/items/item-combobox.tsx +4 -4
- package/src/components/payments/create-payment-form/create-payment-form.tsx +5 -2
- package/src/components/payments/edit-payment-form/edit-payment-form.tsx +5 -1
- package/src/components/recurring-invoices/create-recurring-invoice-form/create-recurring-invoice-form.tsx +98 -22
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/bg.ts +26 -26
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/cs.ts +25 -25
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/et.ts +26 -26
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/fi.ts +36 -36
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/is.ts +26 -26
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/nb.ts +26 -26
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/sk.ts +25 -25
- package/src/components/recurring-invoices/create-recurring-invoice-form/locales/sv.ts +26 -26
- package/src/components/recurring-invoices/list/list-row-actions.tsx +9 -1
- package/src/components/recurring-invoices/list/list-table.tsx +53 -5
- package/src/components/recurring-invoices/list/locales/bg.ts +4 -0
- package/src/components/recurring-invoices/list/locales/cs.ts +4 -0
- package/src/components/recurring-invoices/list/locales/de.ts +4 -0
- package/src/components/recurring-invoices/list/locales/en.ts +4 -0
- package/src/components/recurring-invoices/list/locales/es.ts +4 -0
- package/src/components/recurring-invoices/list/locales/et.ts +4 -0
- package/src/components/recurring-invoices/list/locales/fi.ts +4 -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 +4 -0
- package/src/components/recurring-invoices/list/locales/it.ts +4 -0
- package/src/components/recurring-invoices/list/locales/nb.ts +4 -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 +4 -0
- package/src/components/recurring-invoices/list/locales/sl.ts +4 -0
- package/src/components/recurring-invoices/list/locales/sv.ts +4 -0
- package/src/components/tax-reports/slovenia-tax-profile-step.tsx +4 -1
- package/src/components/tax-reports/slovenia-yearly-export-form.tsx +3 -0
- package/src/components/tax-reports/slovenia-yearly-review-step.tsx +2 -1
- package/src/components/ui/form.tsx +5 -13
- package/src/components/ui/select.tsx +0 -1
- package/src/components/ui/sidebar.tsx +2 -2
- package/src/generate-schemas.ts +132 -99
- package/src/generated/schemas/acceptentityinvitation_body.ts +4 -3
- package/src/generated/schemas/accountwebhook.ts +4 -8
- 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 +44 -40
- 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 +4 -3
- 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 +1 -3
- package/src/generated/schemas/image.ts +15 -0
- package/src/generated/schemas/incomingpurchasedocument.ts +7 -27
- package/src/generated/schemas/incomingpurchasedocumentattachment.ts +15 -0
- package/src/generated/schemas/incomingpurchasedocumentpayment.ts +1 -3
- package/src/generated/schemas/index.ts +20 -5
- package/src/generated/schemas/invoice.ts +182 -183
- package/src/generated/schemas/item.ts +6 -10
- package/src/generated/schemas/legacymigrationauth.ts +18 -0
- package/src/generated/schemas/me.ts +2 -24
- package/src/generated/schemas/migrationjob.ts +20 -0
- package/src/generated/schemas/order.ts +4 -8
- package/src/generated/schemas/orderintegration.ts +4 -8
- package/src/generated/schemas/payment.ts +4 -8
- package/src/generated/schemas/ptatcudseries.ts +1 -3
- 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 +10 -16
- package/src/generated/schemas/rendercreditnotepreview_body.ts +10 -16
- package/src/generated/schemas/renderdeliverynotepreview_body.ts +9 -5
- package/src/generated/schemas/renderestimatepreview_body.ts +11 -7
- package/src/generated/schemas/renderinvoicepreview_body.ts +10 -16
- package/src/generated/schemas/reviewsloveniayearlynormiranireport.ts +15 -0
- package/src/generated/schemas/searcheinvoicingcustomer.ts +18 -0
- package/src/generated/schemas/senddocument_body.ts +1 -3
- package/src/generated/schemas/sendemail_body.ts +2 -24
- package/src/generated/schemas/sloveniataxprofile.ts +8 -10
- package/src/generated/schemas/starteslogexport_body.ts +4 -3
- package/src/generated/schemas/startpdfexport_body.ts +8 -87
- 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 +4 -8
- package/src/generated/schemas/syncshopifyorders_body.ts +4 -3
- package/src/generated/schemas/tax.ts +6 -8
- package/src/generated/schemas/uploadfile_body.ts +1 -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 +1 -3
- package/src/generated/schemas/voidinvoice_body.ts +8 -3
- package/src/generated/schemas/webhook.ts +4 -8
- package/src/generated/schemas/wlsubscriptionbillingemail.ts +17 -0
- package/src/hooks/use-duplicate-document.ts +74 -32
- package/src/lib/date-only.ts +58 -0
- package/src/lib/document-display.ts +18 -0
- package/src/lib/payment-display.ts +5 -3
- package/src/lib/schemas/shared.ts +11 -0
- package/src/providers/wl-subscription-provider.tsx +5 -0
- package/src/generated/schemas/account_webhook.ts +0 -43
- 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
|
@@ -14,53 +14,13 @@ const PdfExportByDocumentIds = z
|
|
|
14
14
|
document_ids: z.array(z.string()).min(1),
|
|
15
15
|
locale: z
|
|
16
16
|
.union([
|
|
17
|
-
z.enum([
|
|
18
|
-
"en-US",
|
|
19
|
-
"de-DE",
|
|
20
|
-
"it-IT",
|
|
21
|
-
"fr-FR",
|
|
22
|
-
"es-ES",
|
|
23
|
-
"sl-SI",
|
|
24
|
-
"pt-PT",
|
|
25
|
-
"nl-NL",
|
|
26
|
-
"pl-PL",
|
|
27
|
-
"hr-HR",
|
|
28
|
-
"sv-SE",
|
|
29
|
-
"fi-FI",
|
|
30
|
-
"et-EE",
|
|
31
|
-
"bg-BG",
|
|
32
|
-
"cs-CZ",
|
|
33
|
-
"sk-SK",
|
|
34
|
-
"nb-NO",
|
|
35
|
-
"is-IS",
|
|
36
|
-
null,
|
|
37
|
-
]),
|
|
17
|
+
z.union([z.enum(["en-US", "de-DE", "it-IT", "fr-FR", "es-ES", "sl-SI", "pt-PT", "nl-NL", "pl-PL", "hr-HR", "sv-SE", "fi-FI", "et-EE", "bg-BG", "cs-CZ", "sk-SK", "nb-NO", "is-IS"]), z.null()]),
|
|
38
18
|
z.null(),
|
|
39
19
|
])
|
|
40
20
|
.optional(),
|
|
41
21
|
language: z
|
|
42
22
|
.union([
|
|
43
|
-
z.enum([
|
|
44
|
-
"en",
|
|
45
|
-
"de",
|
|
46
|
-
"sl",
|
|
47
|
-
"it",
|
|
48
|
-
"fr",
|
|
49
|
-
"es",
|
|
50
|
-
"pt",
|
|
51
|
-
"nl",
|
|
52
|
-
"pl",
|
|
53
|
-
"hr",
|
|
54
|
-
"sv",
|
|
55
|
-
"fi",
|
|
56
|
-
"et",
|
|
57
|
-
"bg",
|
|
58
|
-
"cs",
|
|
59
|
-
"sk",
|
|
60
|
-
"nb",
|
|
61
|
-
"is",
|
|
62
|
-
null,
|
|
63
|
-
]),
|
|
23
|
+
z.union([z.enum(["en", "de", "sl", "it", "fr", "es", "pt", "nl", "pl", "hr", "sv", "fi", "et", "bg", "cs", "sk", "nb", "is"]), z.null()]),
|
|
64
24
|
z.null(),
|
|
65
25
|
])
|
|
66
26
|
.optional(),
|
|
@@ -86,53 +46,13 @@ const PdfExportByDateRange = z
|
|
|
86
46
|
date_to: z.union([z.string(), z.null()]).optional(),
|
|
87
47
|
locale: z
|
|
88
48
|
.union([
|
|
89
|
-
z.enum([
|
|
90
|
-
"en-US",
|
|
91
|
-
"de-DE",
|
|
92
|
-
"it-IT",
|
|
93
|
-
"fr-FR",
|
|
94
|
-
"es-ES",
|
|
95
|
-
"sl-SI",
|
|
96
|
-
"pt-PT",
|
|
97
|
-
"nl-NL",
|
|
98
|
-
"pl-PL",
|
|
99
|
-
"hr-HR",
|
|
100
|
-
"sv-SE",
|
|
101
|
-
"fi-FI",
|
|
102
|
-
"et-EE",
|
|
103
|
-
"bg-BG",
|
|
104
|
-
"cs-CZ",
|
|
105
|
-
"sk-SK",
|
|
106
|
-
"nb-NO",
|
|
107
|
-
"is-IS",
|
|
108
|
-
null,
|
|
109
|
-
]),
|
|
49
|
+
z.union([z.enum(["en-US", "de-DE", "it-IT", "fr-FR", "es-ES", "sl-SI", "pt-PT", "nl-NL", "pl-PL", "hr-HR", "sv-SE", "fi-FI", "et-EE", "bg-BG", "cs-CZ", "sk-SK", "nb-NO", "is-IS"]), z.null()]),
|
|
110
50
|
z.null(),
|
|
111
51
|
])
|
|
112
52
|
.optional(),
|
|
113
53
|
language: z
|
|
114
54
|
.union([
|
|
115
|
-
z.enum([
|
|
116
|
-
"en",
|
|
117
|
-
"de",
|
|
118
|
-
"sl",
|
|
119
|
-
"it",
|
|
120
|
-
"fr",
|
|
121
|
-
"es",
|
|
122
|
-
"pt",
|
|
123
|
-
"nl",
|
|
124
|
-
"pl",
|
|
125
|
-
"hr",
|
|
126
|
-
"sv",
|
|
127
|
-
"fi",
|
|
128
|
-
"et",
|
|
129
|
-
"bg",
|
|
130
|
-
"cs",
|
|
131
|
-
"sk",
|
|
132
|
-
"nb",
|
|
133
|
-
"is",
|
|
134
|
-
null,
|
|
135
|
-
]),
|
|
55
|
+
z.union([z.enum(["en", "de", "sl", "it", "fr", "es", "pt", "nl", "pl", "hr", "sv", "fi", "et", "bg", "cs", "sk", "nb", "is"]), z.null()]),
|
|
136
56
|
z.null(),
|
|
137
57
|
])
|
|
138
58
|
.optional(),
|
|
@@ -140,10 +60,11 @@ const PdfExportByDateRange = z
|
|
|
140
60
|
.passthrough();
|
|
141
61
|
|
|
142
62
|
|
|
143
|
-
//
|
|
144
|
-
const
|
|
63
|
+
// Schema for startPdfExport operation
|
|
64
|
+
const startPdfExportSchemaDefinition = z.union([
|
|
145
65
|
PdfExportByDocumentIds,
|
|
146
66
|
PdfExportByDateRange,
|
|
147
67
|
]);
|
|
148
68
|
|
|
149
|
-
|
|
69
|
+
export type StartPdfExportSchema = z.infer<typeof startPdfExportSchemaDefinition>;
|
|
70
|
+
export const startPdfExportSchema = startPdfExportSchemaDefinition;
|
|
@@ -8,11 +8,12 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for stripeappconnect_body endpoints
|
|
10
10
|
|
|
11
|
-
//
|
|
12
|
-
const
|
|
11
|
+
// Schema for stripeAppConnect operation
|
|
12
|
+
const stripeAppConnectSchemaDefinition = z.object({
|
|
13
13
|
state: z.string().min(1),
|
|
14
14
|
entity_id: z.string().min(1),
|
|
15
15
|
force: z.boolean().optional(),
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
export type StripeAppConnectSchema = z.infer<typeof stripeAppConnectSchemaDefinition>;
|
|
19
|
+
export const stripeAppConnectSchema = stripeAppConnectSchemaDefinition;
|
|
@@ -8,13 +8,11 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for stripeappcreateinvoice_body endpoints
|
|
10
10
|
|
|
11
|
-
// Schema for
|
|
12
|
-
const
|
|
11
|
+
// Schema for stripeAppCreateInvoice operation
|
|
12
|
+
const stripeAppCreateInvoiceSchemaDefinition = z.object({
|
|
13
13
|
stripe_object_id: z.string().min(1),
|
|
14
14
|
note: z.string().max(2000).optional(),
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
export const createAppCreateInvoiceSchema = createAppCreateInvoiceSchemaDefinition;
|
|
17
|
+
export type StripeAppCreateInvoiceSchema = z.infer<typeof stripeAppCreateInvoiceSchemaDefinition>;
|
|
18
|
+
export const stripeAppCreateInvoiceSchema = stripeAppCreateInvoiceSchemaDefinition;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated using 'bun generate-schemas'.
|
|
3
|
+
* Do not edit this file manually. To update, run the generator again.
|
|
4
|
+
* @generated
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
// Schemas for stripeappmarketplaceauthorize endpoints
|
|
10
|
+
|
|
11
|
+
// Schema for stripeAppMarketplaceAuthorize operation
|
|
12
|
+
const stripeAppMarketplaceAuthorizeSchemaDefinition = z.object({ code: z.string(), message: z.string() }).passthrough();
|
|
13
|
+
|
|
14
|
+
export type StripeAppMarketplaceAuthorizeSchema = z.infer<typeof stripeAppMarketplaceAuthorizeSchemaDefinition>;
|
|
15
|
+
export const stripeAppMarketplaceAuthorizeSchema = stripeAppMarketplaceAuthorizeSchemaDefinition;
|
|
@@ -8,8 +8,8 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for stripeappupdatesettings_body endpoints
|
|
10
10
|
|
|
11
|
-
// Schema for
|
|
12
|
-
const
|
|
11
|
+
// Schema for stripeAppEntityUpdateSettings operation
|
|
12
|
+
const stripeAppEntityUpdateSettingsSchemaDefinition = z
|
|
13
13
|
.object({
|
|
14
14
|
auto_invoice_enabled: z.boolean(),
|
|
15
15
|
auto_invoice_events: z.array(
|
|
@@ -20,7 +20,7 @@ const updateAppUpdateSettingsSchemaDefinition = z
|
|
|
20
20
|
})
|
|
21
21
|
.partial();
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
export const
|
|
23
|
+
export type StripeAppEntityUpdateSettingsSchema = z.infer<typeof stripeAppEntityUpdateSettingsSchemaDefinition>;
|
|
24
|
+
export const stripeAppEntityUpdateSettingsSchema = stripeAppEntityUpdateSettingsSchemaDefinition;
|
|
25
|
+
export type StripeAppUpdateSettingsSchema = z.infer<typeof stripeAppEntityUpdateSettingsSchemaDefinition>;
|
|
26
|
+
export const stripeAppUpdateSettingsSchema = stripeAppEntityUpdateSettingsSchemaDefinition;
|
|
@@ -8,7 +8,7 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for supplier endpoints
|
|
10
10
|
|
|
11
|
-
// Schema for
|
|
11
|
+
// Schema for createSupplier operation
|
|
12
12
|
const createSupplierSchemaDefinition = z.object({
|
|
13
13
|
name: z.string().min(1),
|
|
14
14
|
address: z.union([z.string(), z.null()]).optional(),
|
|
@@ -27,11 +27,8 @@ const createSupplierSchemaDefinition = z.object({
|
|
|
27
27
|
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
// Type for create supplier operation
|
|
31
|
-
export type CreateSupplierSchema = z.infer<typeof createSupplierSchemaDefinition>;
|
|
32
|
-
|
|
33
30
|
|
|
34
|
-
// Schema for
|
|
31
|
+
// Schema for updateSupplier operation
|
|
35
32
|
const updateSupplierSchemaDefinition = z
|
|
36
33
|
.object({
|
|
37
34
|
name: z.string().min(1),
|
|
@@ -52,8 +49,7 @@ const updateSupplierSchemaDefinition = z
|
|
|
52
49
|
})
|
|
53
50
|
.partial();
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
export type UpdateSupplierSchema = z.infer<typeof updateSupplierSchemaDefinition>;
|
|
57
|
-
|
|
52
|
+
export type CreateSupplierSchema = z.infer<typeof createSupplierSchemaDefinition>;
|
|
58
53
|
export const createSupplierSchema = createSupplierSchemaDefinition;
|
|
54
|
+
export type UpdateSupplierSchema = z.infer<typeof updateSupplierSchemaDefinition>;
|
|
59
55
|
export const updateSupplierSchema = updateSupplierSchemaDefinition;
|
|
@@ -8,8 +8,8 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for syncshopifyorders_body endpoints
|
|
10
10
|
|
|
11
|
-
//
|
|
12
|
-
const
|
|
11
|
+
// Schema for syncShopifyOrders operation
|
|
12
|
+
const syncShopifyOrdersSchemaDefinition = z
|
|
13
13
|
.object({
|
|
14
14
|
updated_since: z.string().datetime({ offset: true }),
|
|
15
15
|
updated_until: z.string().datetime({ offset: true }),
|
|
@@ -17,4 +17,5 @@ const syncShopifyOrders_Body = z
|
|
|
17
17
|
})
|
|
18
18
|
.partial();
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
export type SyncShopifyOrdersSchema = z.infer<typeof syncShopifyOrdersSchemaDefinition>;
|
|
21
|
+
export const syncShopifyOrdersSchema = syncShopifyOrdersSchemaDefinition;
|
|
@@ -8,7 +8,7 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for tax endpoints
|
|
10
10
|
|
|
11
|
-
// Schema for
|
|
11
|
+
// Schema for createTax operation
|
|
12
12
|
const createTaxSchemaDefinition = z.object({
|
|
13
13
|
name: z.string().max(100).optional(),
|
|
14
14
|
tax_rates: z
|
|
@@ -26,11 +26,8 @@ const createTaxSchemaDefinition = z.object({
|
|
|
26
26
|
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
// Type for create tax operation
|
|
30
|
-
export type CreateTaxSchema = z.infer<typeof createTaxSchemaDefinition>;
|
|
31
|
-
|
|
32
29
|
|
|
33
|
-
// Schema for
|
|
30
|
+
// Schema for updateTax operation
|
|
34
31
|
const updateTaxSchemaDefinition = z.object({
|
|
35
32
|
tax_rates: z
|
|
36
33
|
.array(
|
|
@@ -43,8 +40,9 @@ const updateTaxSchemaDefinition = z.object({
|
|
|
43
40
|
is_default: z.boolean().optional(),
|
|
44
41
|
});
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
export type UpdateTaxSchema = z.infer<typeof updateTaxSchemaDefinition>;
|
|
48
|
-
|
|
43
|
+
export type CreateTaxSchema = z.infer<typeof createTaxSchemaDefinition>;
|
|
49
44
|
export const createTaxSchema = createTaxSchemaDefinition;
|
|
45
|
+
export type UpdateTaxSchema = z.infer<typeof updateTaxSchemaDefinition>;
|
|
50
46
|
export const updateTaxSchema = updateTaxSchemaDefinition;
|
|
47
|
+
export type ReplaceTaxSchema = z.infer<typeof createTaxSchemaDefinition>;
|
|
48
|
+
export const replaceTaxSchema = createTaxSchemaDefinition;
|
|
@@ -8,7 +8,7 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for uploadfile_body endpoints
|
|
10
10
|
|
|
11
|
-
// Schema for
|
|
11
|
+
// Schema for uploadFile operation
|
|
12
12
|
const uploadFileSchemaDefinition = z
|
|
13
13
|
.object({
|
|
14
14
|
file: z.instanceof(File).optional(),
|
|
@@ -18,7 +18,5 @@ const uploadFileSchemaDefinition = z
|
|
|
18
18
|
})
|
|
19
19
|
.passthrough();
|
|
20
20
|
|
|
21
|
-
// Type for upload file operation
|
|
22
21
|
export type UploadFileSchema = z.infer<typeof uploadFileSchemaDefinition>;
|
|
23
|
-
|
|
24
22
|
export const uploadFileSchema = uploadFileSchemaDefinition;
|
|
@@ -8,13 +8,13 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for uploadfurscertificate_body endpoints
|
|
10
10
|
|
|
11
|
-
// Schema for
|
|
12
|
-
const
|
|
11
|
+
// Schema for uploadFinaCertificate operation
|
|
12
|
+
const uploadFinaCertificateSchemaDefinition = z
|
|
13
13
|
.object({ file: z.instanceof(File), passphrase: z.string() })
|
|
14
14
|
.partial()
|
|
15
15
|
.passthrough();
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
export const uploadFursCertificateSchema =
|
|
17
|
+
export type UploadFinaCertificateSchema = z.infer<typeof uploadFinaCertificateSchemaDefinition>;
|
|
18
|
+
export const uploadFinaCertificateSchema = uploadFinaCertificateSchemaDefinition;
|
|
19
|
+
export type UploadFursCertificateSchema = z.infer<typeof uploadFinaCertificateSchemaDefinition>;
|
|
20
|
+
export const uploadFursCertificateSchema = uploadFinaCertificateSchemaDefinition;
|
|
@@ -8,12 +8,10 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for userfinasettings endpoints
|
|
10
10
|
|
|
11
|
-
// Schema for
|
|
11
|
+
// Schema for updateUserFinaSettings operation
|
|
12
12
|
const updateUserFinaSettingsSchemaDefinition = z
|
|
13
13
|
.object({ operator_oib: z.string(), operator_label: z.string() })
|
|
14
14
|
.partial();
|
|
15
15
|
|
|
16
|
-
// Type for update userfinasettings operation
|
|
17
16
|
export type UpdateUserFinaSettingsSchema = z.infer<typeof updateUserFinaSettingsSchemaDefinition>;
|
|
18
|
-
|
|
19
17
|
export const updateUserFinaSettingsSchema = updateUserFinaSettingsSchemaDefinition;
|
|
@@ -8,12 +8,10 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for userfurssettings endpoints
|
|
10
10
|
|
|
11
|
-
// Schema for
|
|
11
|
+
// Schema for updateUserFursSettings operation
|
|
12
12
|
const updateUserFursSettingsSchemaDefinition = z
|
|
13
13
|
.object({ operator_tax_number: z.string(), operator_label: z.string() })
|
|
14
14
|
.partial();
|
|
15
15
|
|
|
16
|
-
// Type for update userfurssettings operation
|
|
17
16
|
export type UpdateUserFursSettingsSchema = z.infer<typeof updateUserFursSettingsSchemaDefinition>;
|
|
18
|
-
|
|
19
17
|
export const updateUserFursSettingsSchema = updateUserFursSettingsSchemaDefinition;
|
|
@@ -8,7 +8,7 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for userptsettings endpoints
|
|
10
10
|
|
|
11
|
-
// Schema for
|
|
11
|
+
// Schema for updateUserPtSettings operation
|
|
12
12
|
const updateUserPtSettingsSchemaDefinition = z
|
|
13
13
|
.object({
|
|
14
14
|
operator_first_name: z.string(),
|
|
@@ -20,7 +20,5 @@ const updateUserPtSettingsSchemaDefinition = z
|
|
|
20
20
|
})
|
|
21
21
|
.partial();
|
|
22
22
|
|
|
23
|
-
// Type for update userptsettings operation
|
|
24
23
|
export type UpdateUserPtSettingsSchema = z.infer<typeof updateUserPtSettingsSchemaDefinition>;
|
|
25
|
-
|
|
26
24
|
export const updateUserPtSettingsSchema = updateUserPtSettingsSchemaDefinition;
|
|
@@ -8,8 +8,8 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for voidinvoice_body endpoints
|
|
10
10
|
|
|
11
|
-
//
|
|
12
|
-
const
|
|
11
|
+
// Schema for voidAdvanceInvoice operation
|
|
12
|
+
const voidAdvanceInvoiceSchemaDefinition = z
|
|
13
13
|
.object({
|
|
14
14
|
reason: z.string().min(1),
|
|
15
15
|
has_original_document: z.union([z.boolean(), z.null()]),
|
|
@@ -17,4 +17,9 @@ const voidInvoice_Body = z
|
|
|
17
17
|
.partial()
|
|
18
18
|
.passthrough();
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
export type VoidAdvanceInvoiceSchema = z.infer<typeof voidAdvanceInvoiceSchemaDefinition>;
|
|
21
|
+
export const voidAdvanceInvoiceSchema = voidAdvanceInvoiceSchemaDefinition;
|
|
22
|
+
export type VoidCreditNoteSchema = z.infer<typeof voidAdvanceInvoiceSchemaDefinition>;
|
|
23
|
+
export const voidCreditNoteSchema = voidAdvanceInvoiceSchemaDefinition;
|
|
24
|
+
export type VoidInvoiceSchema = z.infer<typeof voidAdvanceInvoiceSchemaDefinition>;
|
|
25
|
+
export const voidInvoiceSchema = voidAdvanceInvoiceSchemaDefinition;
|
|
@@ -8,7 +8,7 @@ import { z } from 'zod';
|
|
|
8
8
|
|
|
9
9
|
// Schemas for webhook endpoints
|
|
10
10
|
|
|
11
|
-
// Schema for
|
|
11
|
+
// Schema for createWebhook operation
|
|
12
12
|
const createWebhookSchemaDefinition = z.object({
|
|
13
13
|
url: z.string().max(2048).url(),
|
|
14
14
|
description: z.string().max(500).optional(),
|
|
@@ -104,11 +104,8 @@ const createWebhookSchemaDefinition = z.object({
|
|
|
104
104
|
metadata: z.union([z.record(z.string(), z.any()), z.null()]).optional(),
|
|
105
105
|
});
|
|
106
106
|
|
|
107
|
-
// Type for create webhook operation
|
|
108
|
-
export type CreateWebhookSchema = z.infer<typeof createWebhookSchemaDefinition>;
|
|
109
|
-
|
|
110
107
|
|
|
111
|
-
// Schema for
|
|
108
|
+
// Schema for updateWebhook operation
|
|
112
109
|
const updateWebhookSchemaDefinition = z
|
|
113
110
|
.object({
|
|
114
111
|
url: z.string().max(2048).url(),
|
|
@@ -206,8 +203,7 @@ const updateWebhookSchemaDefinition = z
|
|
|
206
203
|
})
|
|
207
204
|
.partial();
|
|
208
205
|
|
|
209
|
-
|
|
210
|
-
export type UpdateWebhookSchema = z.infer<typeof updateWebhookSchemaDefinition>;
|
|
211
|
-
|
|
206
|
+
export type CreateWebhookSchema = z.infer<typeof createWebhookSchemaDefinition>;
|
|
212
207
|
export const createWebhookSchema = createWebhookSchemaDefinition;
|
|
208
|
+
export type UpdateWebhookSchema = z.infer<typeof updateWebhookSchemaDefinition>;
|
|
213
209
|
export const updateWebhookSchema = updateWebhookSchemaDefinition;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was automatically generated using 'bun generate-schemas'.
|
|
3
|
+
* Do not edit this file manually. To update, run the generator again.
|
|
4
|
+
* @generated
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
// Schemas for wlsubscriptionbillingemail endpoints
|
|
10
|
+
|
|
11
|
+
// Schema for updateWLSubscriptionBillingEmail operation
|
|
12
|
+
const updateWLSubscriptionBillingEmailSchemaDefinition = z.object({
|
|
13
|
+
billing_email: z.union([z.string(), z.null()]),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export type UpdateWLSubscriptionBillingEmailSchema = z.infer<typeof updateWLSubscriptionBillingEmailSchemaDefinition>;
|
|
17
|
+
export const updateWLSubscriptionBillingEmailSchema = updateWLSubscriptionBillingEmailSchemaDefinition;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
AdvanceInvoice,
|
|
3
|
+
CalculateDocumentPreview,
|
|
3
4
|
CreateAdvanceInvoiceRequest,
|
|
4
5
|
CreateCreditNoteRequest,
|
|
5
6
|
CreateDeliveryNoteRequest,
|
|
@@ -11,10 +12,14 @@ import type {
|
|
|
11
12
|
Invoice,
|
|
12
13
|
} from "@spaceinvoices/js-sdk";
|
|
13
14
|
import { useQuery } from "@tanstack/react-query";
|
|
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";
|
|
14
18
|
import { useEntities } from "@/ui/providers/entities-context";
|
|
15
19
|
import { advanceInvoices } from "../../../js-sdk/src/sdk/advance-invoices";
|
|
16
20
|
import { creditNotes } from "../../../js-sdk/src/sdk/credit-notes";
|
|
17
21
|
import { deliveryNotes } from "../../../js-sdk/src/sdk/delivery-notes";
|
|
22
|
+
import { documents } from "../../../js-sdk/src/sdk/documents";
|
|
18
23
|
import { estimates } from "../../../js-sdk/src/sdk/estimates";
|
|
19
24
|
import { invoices } from "../../../js-sdk/src/sdk/invoices";
|
|
20
25
|
|
|
@@ -34,13 +39,32 @@ type CreateRequest =
|
|
|
34
39
|
| CreateAdvanceInvoiceRequest
|
|
35
40
|
| CreateDeliveryNoteRequest;
|
|
36
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
|
+
|
|
37
61
|
/**
|
|
38
62
|
* Get document type from ID prefix
|
|
39
63
|
*/
|
|
40
64
|
export function getDocumentTypeFromId(id: string): DocumentType | null {
|
|
41
65
|
if (id.startsWith("inv_")) return "invoice";
|
|
42
66
|
if (id.startsWith("est_")) return "estimate";
|
|
43
|
-
if (id.startsWith("cn_")) return "credit_note";
|
|
67
|
+
if (id.startsWith("cre_") || id.startsWith("cn_")) return "credit_note";
|
|
44
68
|
if (id.startsWith("adv_")) return "advance_invoice";
|
|
45
69
|
if (id.startsWith("del_")) return "delivery_note";
|
|
46
70
|
return null;
|
|
@@ -71,47 +95,27 @@ export function getAllowedDuplicateTargets(sourceType: DocumentType): DocumentTy
|
|
|
71
95
|
* Copies relevant fields and resets computed/generated ones
|
|
72
96
|
*/
|
|
73
97
|
function transformDocumentForDuplication(source: Document, targetType: DocumentType): Partial<CreateRequest> {
|
|
74
|
-
|
|
75
|
-
// Use type assertion for items since all document item types share the same shape
|
|
76
|
-
const sourceItems = source.items as Array<{
|
|
77
|
-
type?: string | null;
|
|
78
|
-
name: string;
|
|
79
|
-
description: string | null;
|
|
80
|
-
quantity: number;
|
|
81
|
-
price: number;
|
|
82
|
-
gross_price?: number | null;
|
|
83
|
-
taxes: Array<{ tax_id?: string }>;
|
|
84
|
-
}>;
|
|
85
|
-
const items = sourceItems?.map((item) => ({
|
|
86
|
-
type: item.type ?? undefined,
|
|
87
|
-
name: item.name,
|
|
88
|
-
description: item.description,
|
|
89
|
-
// Separator items skip financial fields
|
|
90
|
-
...(item.type !== "separator"
|
|
91
|
-
? {
|
|
92
|
-
quantity: item.quantity,
|
|
93
|
-
// Use gross_price if set, otherwise use price. The form uses is_gross_price as a UI toggle.
|
|
94
|
-
price: item.gross_price ?? item.price,
|
|
95
|
-
// Copy tax references (tax_id), not computed tax data
|
|
96
|
-
taxes: item.taxes?.map((tax) => ({ tax_id: tax.tax_id })),
|
|
97
|
-
// Derive is_gross_price from whether gross_price is set
|
|
98
|
-
gross_price: item.gross_price ?? undefined,
|
|
99
|
-
}
|
|
100
|
-
: {}),
|
|
101
|
-
}));
|
|
98
|
+
const items = source.items?.map((item) => toDocumentFormItem(item as any));
|
|
102
99
|
|
|
103
100
|
// Build customer data - always copy if available (form needs this for display)
|
|
104
101
|
const customerData = source.customer
|
|
105
102
|
? {
|
|
106
103
|
name: source.customer.name,
|
|
104
|
+
email: source.customer.email,
|
|
107
105
|
address: source.customer.address,
|
|
108
106
|
address_2: source.customer.address_2,
|
|
109
|
-
city: source.customer.city,
|
|
110
107
|
post_code: source.customer.post_code,
|
|
108
|
+
city: source.customer.city,
|
|
109
|
+
state: source.customer.state,
|
|
111
110
|
country: source.customer.country,
|
|
112
111
|
country_code: source.customer.country_code,
|
|
113
112
|
tax_number: source.customer.tax_number,
|
|
114
|
-
|
|
113
|
+
tax_number_2: source.customer.tax_number_2,
|
|
114
|
+
company_number: source.customer.company_number,
|
|
115
|
+
phone: source.customer.phone,
|
|
116
|
+
peppol_id: source.customer.peppol_id,
|
|
117
|
+
is_end_consumer: source.customer.is_end_consumer,
|
|
118
|
+
bank_account: source.customer.bank_account,
|
|
115
119
|
}
|
|
116
120
|
: undefined;
|
|
117
121
|
|
|
@@ -129,9 +133,14 @@ function transformDocumentForDuplication(source: Document, targetType: DocumentT
|
|
|
129
133
|
items: items as any,
|
|
130
134
|
// Currency
|
|
131
135
|
currency_code: source.currency_code,
|
|
136
|
+
calculation_mode: (source as any).calculation_mode ?? undefined,
|
|
132
137
|
// Notes
|
|
133
138
|
note: source.note,
|
|
134
139
|
payment_terms: source.payment_terms,
|
|
140
|
+
reference: (source as any).reference,
|
|
141
|
+
signature: (source as any).signature,
|
|
142
|
+
tax_clause: (source as any).tax_clause,
|
|
143
|
+
footer: (source as any).footer,
|
|
135
144
|
// Date - use today's date as ISO string
|
|
136
145
|
date: new Date().toISOString(),
|
|
137
146
|
// Number - leave empty for auto-generation
|
|
@@ -140,7 +149,6 @@ function transformDocumentForDuplication(source: Document, targetType: DocumentT
|
|
|
140
149
|
// Skip linking if source is a draft (drafts have no number/fiscalization)
|
|
141
150
|
...(isConversion && !(source as any).is_draft ? { linked_documents: [source.id] } : {}),
|
|
142
151
|
};
|
|
143
|
-
|
|
144
152
|
// Copy service dates when source is an invoice (available on invoices and credit notes)
|
|
145
153
|
if (sourceType === "invoice" || sourceType === "credit_note") {
|
|
146
154
|
const sourceDoc = source as any;
|
|
@@ -152,6 +160,20 @@ function transformDocumentForDuplication(source: Document, targetType: DocumentT
|
|
|
152
160
|
}
|
|
153
161
|
}
|
|
154
162
|
|
|
163
|
+
if (sourceType === "estimate") {
|
|
164
|
+
const sourceDoc = source as Estimate & { title_type?: "estimate" | "proforma_invoice" | null };
|
|
165
|
+
if (sourceDoc.title_type) {
|
|
166
|
+
(baseData as CreateEstimateRequest).title_type = sourceDoc.title_type;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
if (sourceType === "delivery_note") {
|
|
171
|
+
const sourceDoc = source as DeliveryNote & { hide_prices?: boolean | null };
|
|
172
|
+
if (sourceDoc.hide_prices !== undefined && sourceDoc.hide_prices !== null) {
|
|
173
|
+
(baseData as CreateDeliveryNoteRequest).hide_prices = sourceDoc.hide_prices;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
155
177
|
return baseData;
|
|
156
178
|
}
|
|
157
179
|
|
|
@@ -240,6 +262,26 @@ export function useDuplicateDocument({
|
|
|
240
262
|
}
|
|
241
263
|
|
|
242
264
|
const initialValues = transformDocumentForDuplication(source, targetType);
|
|
265
|
+
if ((source as any).creation_source === "custom") {
|
|
266
|
+
(initialValues as any)._custom_create_template = buildCustomCreateTemplateFromDocument(source);
|
|
267
|
+
}
|
|
268
|
+
if (shouldCheckForPreservedTotal(source)) {
|
|
269
|
+
const calculatePayload = buildCalculatePayload(initialValues);
|
|
270
|
+
if (calculatePayload) {
|
|
271
|
+
try {
|
|
272
|
+
const calculated = await documents.calculateDocumentPreview(
|
|
273
|
+
calculatePayload,
|
|
274
|
+
{ type: targetType },
|
|
275
|
+
{ entity_id: activeEntity.id },
|
|
276
|
+
);
|
|
277
|
+
if (totalsDifferByCents(calculated.total_with_tax, (source as any).total_with_tax)) {
|
|
278
|
+
(initialValues as any)._preserved_expected_total_with_tax = (source as any).total_with_tax;
|
|
279
|
+
}
|
|
280
|
+
} catch {
|
|
281
|
+
// Keep duplicate prefill data even if preview validation is temporarily unavailable.
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
243
285
|
|
|
244
286
|
// Build source document summaries for conversions (different source → target type)
|
|
245
287
|
const isConversion = sourceType !== targetType;
|