{"version":3,"file":"SponsorButton.DPeORLpm.mjs","names":["useMemo"],"sources":["https:/framerusercontent.com/modules/z85gb9T8hk9IW85T7cn6/mi1LXL7o5BEgq9IuFzz3/useParamsNew.js","https:/framer.com/m/useParamsNew-fsOR.js@mi1LXL7o5BEgq9IuFzz3","https:/framerusercontent.com/modules/6bbtcRHcRVnSrPoIHywp/WbNStViUvwxCOF5IeqkJ/SponsorButton.js"],"sourcesContent":["import{useMemo}from\"react\";export const useResolveLinkWithQueryParams=(link,trackedParams,scrollToId,shouldResolveAsSlug)=>{const linkWithQueryParams=useMemo(()=>{const url=new URL(window.location.href);const params=new URLSearchParams(url.search);if(shouldResolveAsSlug){// Extract the value of the first tracked parameter\nconst slugValue=params.get(trackedParams[0]);if(slugValue){// Append the parameter value as a slug to the link\nreturn`${link.replace(/\\/$/,\"\")}/${encodeURIComponent(slugValue)}`;}return link// Fallback to the original link if no parameter value exists\n;}// Resolve query parameters\nconst resolvedParams=trackedParams.map(paramName=>{const paramValue=params.get(paramName);return paramValue?`${paramName}=${encodeURIComponent(paramValue)}`:null;}).filter(Boolean).join(\"&\");// Determine if `link` already has query parameters\nconst hasExistingParams=link.includes(\"?\");// Construct the final query string\nconst queryString=resolvedParams.length>0?`${hasExistingParams?\"&\":\"?\"}${resolvedParams}`:\"\";// Append hash and scroll ID if provided\nconst finalHash=scrollToId?`#${scrollToId}`:url.hash;// Return the constructed link\nreturn`${link}${queryString}${finalHash}`;},[link,trackedParams,scrollToId,shouldResolveAsSlug]);return linkWithQueryParams;};export const useGetParamValues=trackedParams=>{const paramsObject=useMemo(()=>{const params=new URLSearchParams(window.location.search);return trackedParams.reduce((acc,paramName)=>{const paramValue=params.get(paramName);if(paramValue){acc[paramName]=decodeURIComponent(paramValue);}return acc;},{});},[trackedParams]);return paramsObject;}//LAST WORKING Prior to above\n// import { useMemo } from \"react\"\n// export const useResolveLinkWithQueryParams = (\n//     link: string,\n//     trackedParams: string[],\n//     isNewQueryParam: boolean,\n//     scrollToId: string,\n//     shouldResolveAsSlug: boolean,\n// ) => {\n//     const linkWithQueryParams = useMemo(() => {\n//         // Create a URL object for the current window location\n//         const url = new URL(window.location.href)\n//         // Extract the query parameters from the current URL\n//         const params = new URLSearchParams(url.search)\n//         // Build an array of query parameters to include in the new link\n//         const resolvedParams = trackedParams\n//             ? trackedParams\n//                   .map((paramName) => {\n//                       const paramValue = params.get(paramName)\n//                       return paramValue\n//                           ? `${paramName}=${encodeURIComponent(paramValue)}`\n//                           : null\n//                   })\n//                   .filter(Boolean)\n//                   .join(\"&\")\n//             : []\n//         // Determine the parameter prefix\n//         const paramPrefix = isNewQueryParam ? \"?\" : \"&\"\n//         // Construct the query string with the appropriate prefix\n//         const queryString =\n//             resolvedParams.length > 0 ? `${paramPrefix}${resolvedParams}` : \"\"\n//         // Return the formatted URL with the resolved parameters and current hash\n//         return `${link}${queryString}${url.hash}${scrollToId}`\n//     }, [link, trackedParams, isNewQueryParam])\n//     return linkWithQueryParams\n// }\n// export const useGetParamValues = (trackedParams) => {\n//     const paramsObject = useMemo(() => {\n//         const params = new URLSearchParams(window.location.search)\n//         return trackedParams.reduce((acc, paramName) => {\n//             const paramValue = params.get(paramName)\n//             if (paramValue) {\n//                 acc[paramName] = decodeURIComponent(paramValue)\n//             }\n//             return acc\n//         }, {})\n//     }, [trackedParams])\n//     return paramsObject\n// }\n;\nexport const __FramerMetadata__ = {\"exports\":{\"useGetParamValues\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useResolveLinkWithQueryParams\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./useParamsNew.map","/*\n * useParamsNew\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/z85gb9T8hk9IW85T7cn6/mi1LXL7o5BEgq9IuFzz3/useParamsNew.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{motion}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";import{useGetParamValues,useResolveLinkWithQueryParams}from\"https://framer.com/m/useParamsNew-fsOR.js@mi1LXL7o5BEgq9IuFzz3\";// useParamsNew.ts\n/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/docs/guides/auto-sizing\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function Button(props){const{title,color,fill,isOutline,gradient,radius,padding,style,fontSize,onClick,linkurl,trackedParams,disableParams,// isNewQueryParam,\nshouldResolveAsSlug,openNewTab,scrollToId}=props;const linkWithQueryParams=useResolveLinkWithQueryParams(linkurl,trackedParams,scrollToId,shouldResolveAsSlug);// const linkWithQueryParams = useResolveLinkWithQueryParams(\n//     linkurl,\n//     trackedParams,\n//     isNewQueryParam,\n//     scrollToId\n// )\n// This hook returns an object with the trackedQueryParams as key value pairs, this will allow you to run extra validation on each param if needed.\nconst params=useGetParamValues(trackedParams);const resolveButtonGradient=()=>{switch(gradient){case\"promptings\":return\"linear-gradient(281deg, #00e0e0 0%, rgb(5, 197, 235) 100%)\";case\"portal\":return\"linear-gradient()\";default:return fill;}};const shouldResolveLink=!!disableParams||!!trackedParams;const resolveButtonLink=()=>shouldResolveLink?linkWithQueryParams:linkurl;return /*#__PURE__*/_jsx(motion.a,{style:{cursor:\"pointer\",textDecoration:\"none\",display:\"block\"},href:resolveButtonLink(),target:openNewTab?\"_blank\":\"initial\",children:/*#__PURE__*/_jsx(motion.div,{style:{...style,...containerStyle},children:/*#__PURE__*/_jsx(motion.div,{style:{padding:padding,borderRadius:radius,background:gradient!==\"none\"?resolveButtonGradient():isOutline?\"transparent\":fill,color:color,border:isOutline?`2px solid ${fill}`:\"none\",fontSize:fontSize,fontWeight:\"bold\",cursor:\"pointer\"},whileHover:{scale:1.01},children:title})})});}Button.defaultProps={background:{solid:\"#09F\",gradient:\"promptings\"},title:\"New Button\",link:{url:\"/opportunity\",shouldOpenNewTab:false,isLinkDynamic:true,trackedParams:[\"sponsor\"],paramStartType:\"?\",scrollToId:\"\"}};addPropertyControls(Button,{title:{title:\"Title\",type:ControlType.String},padding:{title:\"Padding\",defaultValue:\"15px 30px\",type:ControlType.String},fontSize:{title:\"Font Size Override\",defaultValue:\"18px\",type:ControlType.String},radius:{title:\"Radius\",defaultValue:13,type:ControlType.Number},color:{title:\"Text Color\",type:ControlType.Color,defaultValue:\"#FFF\"},fill:{title:\"Fill\",type:ControlType.Color},isOutline:{title:\"Outline Button\",type:ControlType.Boolean,defaultValue:false},gradient:{title:\"Gradient Background\",type:ControlType.Enum,defaultValue:\"none\",displaySegmentedControl:true,segmentedControlDirection:\"vertical\",options:[\"none\",\"promptings\"],optionTitles:[\"No Gradient\",\"Promptings Gradient\"]},linkurl:{type:ControlType.String,defaultValue:\"https://app.sendoutcards.com/pricing\",description:\"Supports both full url and /pagename slugs, to use a full url the value of this field must start with http or https:// \"},trackedParams:{type:ControlType.Array,control:{type:ControlType.String},defaultValue:[],description:\"Provide the names of the url params you want to track. ex('sponsor', 'cartId', 'sessionId')\"},shouldResolveAsSlug:{type:ControlType.Boolean,defaultValue:false,description:\"This will only take the first tracked param and set it to a slug /{trackedParam[0]}\"},scrollToId:{type:ControlType.String,defaultValue:\"\",description:\"Will insert scrollTo has to the end of the formated url\"},disableParams:{type:ControlType.Boolean,defaultValue:false,description:\"This should only be true if using this button for other purposes, like UI changes\"},// isNewQueryParam: { type: ControlType.Boolean, defaultValue: true },\nopenNewTab:{type:ControlType.Boolean,defaultValue:true}});const containerStyle={display:\"flex\",justifyContent:\"start\",alignItems:\"center\",overflow:\"hidden\"};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Button\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SponsorButton.map"],"mappings":"kQ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