"use strict";var e=require("@gem-sdk/core"),t=require("react");exports.useDispatchCustomEvent=({product:e,currentVariant:a,quantity:r})=>t.useCallback(()=>{let t=new CustomEvent("gp:add-to-cart-success",{detail:{data:{product:e,variant:a,quantity:r}}});window.dispatchEvent(t)},[e,a,r]),exports.useDispatchInteractionEvent=a=>{let{trigger:r}=e.useInteraction();return t.useCallback(()=>{let e=document.querySelector(`[data-id="${a}"]`);if(!e)return;let t=JSON.parse(e?.getAttribute("gp-interaction-after-submit")??"{}");Object.keys(t).length<=0||Object.entries(t).forEach(([t])=>{r({event:"gp:after-submit",selector:`[data-id="${a}"]`,data:Number(t),element:e})})},[a,r])};
