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