import{useEffect as e}from"react";import{usePageStore as t}from"@gem-sdk/core";let useCheckProductsSubscriptionExistence=({productId:i,elementUid:r,isSubscription:s,hasNoSellingPlanOptions:c,isDynamicProduct:o})=>{let u=t(e=>e.setSubscriptionVisible),n=t(e=>e.getSubscriptionVisible);e(()=>{if(!i||!s)return;let e=`${r}-${i}`,t=!(c||o),p=n()??{};if(!t){u({...p,[i]:(p[i]??[]).filter(t=>t!==e)});return}u({...p,[i]:[...p[i]??[],e]})},[r,n,c,o,s,i,u])};export{useCheckProductsSubscriptionExistence};
