{"version":3,"file":"LinkWrapper.B3u4CEvV.mjs","names":["React.useState","React.useCallback"],"sources":["https:/framerusercontent.com/modules/s1l4VFxpaNKUUe9mOg4W/0I4L7153ZJ4vlxJqySdI/LinkWrapper.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";// Extracts the {code} segment from the current page URL when the path\n// looks like .../redeem/{code} (ignores any query string or hash).\nfunction getRedeemCodeFromUrl(){if(typeof window===\"undefined\")return\"\";const match=window.location.pathname.match(/\\/redeem\\/([^/?#]+)/i);return match?decodeURIComponent(match[1]):\"\";}export function LinkWrapper({children,url,code,linkType,openInNewTab}){const[isInApp,setIsInApp]=React.useState(false);React.useEffect(()=>{if(typeof window===\"undefined\")return;const ua=navigator.userAgent||navigator.vendor||\"\";setIsInApp(ua.includes(\"Instagram\")||ua.includes(\"FBAN\")||ua.includes(\"FBAV\")||ua.includes(\"FB_IAB\")||ua.includes(\"TikTok\"));},[]);const handleClick=React.useCallback(e=>{e.preventDefault();e.stopPropagation();if(linkType===\"regular\"){if(!url||url.trim()===\"\")return;if(openInNewTab){window.open(url,\"_blank\",\"noopener,noreferrer\");}else{window.location.href=url;}return;}if(isInApp){alert(\"In-app browser is blocking this link.\\n\\nTap ••• (top right) → 'Open in external browser' to continue, or copy and paste the link into Safari/Chrome.\");return;}if(linkType===\"deeplink\"){const redeemCode=code&&code.trim()!==\"\"?code.trim():\"\";if(!redeemCode)return;window.location.href=`umi://redeem/${redeemCode}`;}else if(linkType===\"universal\"){if(!url||url.trim()===\"\")return;window.location.href=url;}else if(linkType===\"redeemFromUrl\"){// Pull the code out of the current page URL (.../redeem/{code})\n// and open the universal link for it.\nconst redeemCode=getRedeemCodeFromUrl();if(!redeemCode)return;window.location.href=`https://reachumi.com/redeem/${redeemCode}`;}},[url,code,linkType,openInNewTab,isInApp]);return /*#__PURE__*/_jsx(\"div\",{onClick:handleClick,style:{display:\"inline-block\",width:\"fit-content\",cursor:\"pointer\"},children:children});}addPropertyControls(LinkWrapper,{children:{type:ControlType.ComponentInstance,title:\"Content\"},linkType:{type:ControlType.Enum,title:\"Link Type\",options:[\"regular\",\"deeplink\",\"universal\",\"redeemFromUrl\"],optionTitles:[\"Regular\",\"Deep Link\",\"Universal Link\",\"Redeem (from URL)\"],defaultValue:\"regular\"},url:{type:ControlType.String,title:\"URL\",defaultValue:\"\",hidden:props=>props.linkType===\"deeplink\"||props.linkType===\"redeemFromUrl\"},code:{type:ControlType.String,title:\"Code\",defaultValue:\"\",hidden:props=>props.linkType!==\"deeplink\"},openInNewTab:{type:ControlType.Boolean,title:\"New Tab\",defaultValue:false,hidden:props=>props.linkType!==\"regular\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"LinkWrapper\":{\"type\":\"reactComponent\",\"name\":\"LinkWrapper\",\"slots\":[\"children\"],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LinkWrapper.map"],"mappings":"6MAEA,SAAS,GAAsB,CAAC,GAAU,IAAS,OAAY,MAAM,GAAG,IAAM,EAAM,EAAO,SAAS,SAAS,MAAM,sBAAsB,EAAE,OAAO,EAAM,mBAAmB,EAAM,EAAE,EAAE,EAAG,CAAC,SAAgB,EAAY,CAAC,WAAS,MAAI,OAAK,WAAS,gBAAc,CAAC,GAAK,CAAC,EAAQ,GAAYA,EAAe,EAAK,EAElI,OAFoI,MAAoB,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAG,EAAU,WAAW,EAAU,QAAQ,GAAG,EAAW,EAAG,SAAS,WAAW,GAAG,EAAG,SAAS,MAAM,GAAG,EAAG,SAAS,MAAM,GAAG,EAAG,SAAS,QAAQ,GAAG,EAAG,SAAS,QAAQ,CAAC,CAAE,EAAE,CAAC,CAAC,EAE/V,EAAK,MAAM,CAAC,QAFuWC,EAAkB,GAAG,CAAwC,GAAvC,EAAE,eAAe,EAAE,EAAE,gBAAgB,E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