import{fetchInvoice as e,fetchInvoiceHtml as i}from"./lib/api-helpers.js";import{defineSmartComponent as n}from"./lib/define-smart-component.js";import"./cc-smart-container.js";import"./cc-invoice.js";n({selector:"cc-invoice",params:{apiConfig:{type:Object},ownerId:{type:String},invoiceNumber:{type:String}},onContextUpdate({context:n,updateComponent:o,signal:t}){const{apiConfig:r,ownerId:a,invoiceNumber:m}=n;o("state",{type:"loading",number:m}),function({apiConfig:n,signal:o,ownerId:t,invoiceNumber:r}){return Promise.all([e({apiConfig:n,signal:o,ownerId:t,invoiceNumber:r}),i({apiConfig:n,signal:o,ownerId:t,invoiceNumber:r})]).then((([e,i])=>({...e,invoiceHtml:i})))}({apiConfig:r,signal:t,ownerId:a,invoiceNumber:m}).then((e=>{o("state",{type:"loaded",number:m,downloadUrl:e.downloadUrl,emissionDate:e.emissionDate,amount:e.total.amount,invoiceHtml:e.invoiceHtml})})).catch((e=>{console.error(e),o("state",{type:"error",number:m})}))}});
//# sourceMappingURL=cc-invoice.smart.js.map
