import{useCurrentVariant as e,useFeaturedImageGlobal as r,useProductStore as t}from"@gem-sdk/core";import{useMemo as a,useEffect as m}from"react";let useFeatureImagePostPurchase=u=>{let{gallery:d}=u,o=e(),i=r(),s=t(e=>e.setProductFeaturedImage),n=a(()=>{if(!i)return 0;let e=d.findIndex(e=>e.id===i.id);return -1!==e?e:0},[i,d]);return m(()=>{o?.media&&"IMAGE"===o.media.contentType&&s(o.media)},[o,s]),{idxActive:n}};export{useFeatureImagePostPurchase};
