import{getAllAddonProviders as o}from"@clevercloud/client/esm/api/v2/product.js";import{ONE_DAY as r}from"@clevercloud/client/esm/with-cache.js";import{fetchPriceSystem as n}from"./lib/api-helpers.js";import{formatAddonProduct as t}from"./lib/product.js";import{sendToApi as e}from"./lib/send-to-api.js";import{defineSmartComponent as i}from"./lib/smart/define-smart-component.js";import"./cc-smart-container.js";import"./cc-pricing-product.js";function a({apiConfig:n,signal:t,productId:i}){return o().then(e({apiConfig:n,cacheDelay:r,signal:t})).then((o=>{const r=o.find((o=>o.id===i));if(null==r)throw new Error(`Unknown add-on provider ID: ${i}`);return r}))}i({selector:'cc-pricing-product[mode="addon"]',params:{apiConfig:{type:Object},addonFeatures:{type:Array,optional:!0},productId:{type:String},zoneId:{type:String,optional:!0},currency:{type:String,optional:!0}},onContextUpdate({context:o,updateComponent:r,signal:e}){const{apiConfig:i,productId:p,zoneId:c="par",addonFeatures:d,currency:s="EUR"}=o;r("state",{type:"loading"}),function({apiConfig:o,productId:r,zoneId:e,addonFeatures:i,currency:p,signal:c}){return Promise.all([a({apiConfig:o,productId:r,signal:c}),n({apiConfig:o,zoneId:e,currency:p,signal:c})]).then((([o,r])=>t(o,r,i)))}({apiConfig:i,zoneId:c,productId:p,addonFeatures:d,currency:s,signal:e}).then((o=>{r("state",{type:"loaded",name:o.name,productFeatures:o.productFeatures,plans:o.plans})})).catch((o=>{console.error(o),r("state",{type:"error"})}))}});
//# sourceMappingURL=cc-pricing-product.smart-addon.js.map
