{"version":3,"file":"URLParams.n6RSP9SV.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx","useRef"],"sources":["https:/framerusercontent.com/modules/0sJjnndpjKIFi2kpBySf/Grnz9afzX6mkiZLeVCZm/URLParams.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useRef}from\"react\";/* ─── Helper: pull a query-param and decode it ─── */function qp(key,fallback=\"\"){if(typeof window===\"undefined\")return fallback;const raw=new URLSearchParams(window.location.search).get(key);return decodeURIComponent(raw??fallback);}/* ─── Helper: turn any React child tree into a plain string ─── */function toText(node){if(node==null)return\"\";if(typeof node===\"string\"||typeof node===\"number\")return String(node);if(Array.isArray(node))return node.map(toText).join(\"\");// React element → dig into its children\n// @ts-ignore – we only care about .props.children if it exists\nreturn toText(node.props?.children);}/* ─── Override that writes the deep‑link into a Link layer ─── */export const PersonaliseLink=props=>{// pull referral code\nconst code=qp(\"code\",\"\");// your base URL (could also read props.href if you’ve already set it in the canvas)\nconst baseUrl=props.href||\"https://click.shuffle.finance/S2sK/mk1e1q2v\";// build deferred deep link\nconst href=`${baseUrl}/?ref=${encodeURIComponent(code)}`;// Framer Link layers use `href` to navigate\nreturn{href};};/* ─── Robust personalised override with verbose logging ─── */export const DebugPersonalise=props=>{/* Cache the original canvas text exactly once */const template=useRef();if(template.current===undefined){template.current=toText(props.text)||// new-style Text layers\ntoText(props.children)||// legacy Text layers\n\"\";console.log(\"%c[Personalise] Template captured:\",\"color:dodgerblue;font-weight:bold\",`\"${template.current}\"`);}/* Pull params every render (cheap) */const name=qp(\"name\",\"Your friend\");const code=qp(\"code\",\"—\");console.log(\"[Personalise] Query params →\",{name,code});/* Swap all tokens (case-insensitive, any number of times) */const personalised=template.current.replace(/\\[Name\\]/gi,name).replace(/\\[Code\\]/gi,code);console.log(\"%c[Personalise] Final string:\",\"color:seagreen;font-weight:bold\",`\"${personalised}\"`);if(!/\\[Name\\]/i.test(template.current)&&!/\\[Code\\]/i.test(template.current)){console.warn(\"%c[Personalise] WARNING:\",\"color:orange;font-weight:bold\",\"No [Name] or [Code] tokens found in the template.\");}/* Framer still wants a `text` prop to update the layer */return{text:personalised}// Framer docs: text prop replaces content :contentReference[oaicite:0]{index=0}\n;};import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withPersonaliseLink(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...PersonaliseLink(props)});};}withPersonaliseLink.displayName=\"PersonaliseLink\";export function withDebugPersonalise(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...DebugPersonalise(props)});};}withDebugPersonalise.displayName=\"DebugPersonalise\";\nexport const __FramerMetadata__ = {\"exports\":{\"withPersonaliseLink\":{\"type\":\"reactHoc\",\"name\":\"withPersonaliseLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"DebugPersonalise\":{\"type\":\"override\",\"name\":\"DebugPersonalise\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"PersonaliseLink\":{\"type\":\"override\",\"name\":\"PersonaliseLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withDebugPersonalise\":{\"type\":\"reactHoc\",\"name\":\"withDebugPersonalise\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./URLParams.map"],"mappings":"mLAA2H,SAAS,EAAG,EAAI,EAAS,GAAG,CAAC,GAAU,IAAS,OAAY,OAAO,EAAS,IAAM,EAAI,IAAI,gBAAgB,EAAO,SAAS,MAAM,CAAC,CAAC,IAAI,CAAG,EAAE,OAAO,mBAAmB,GAAK,CAAQ,CAAE,CAAoE,SAAS,EAAO,EAAK,CAExY,OAF4Y,GAAM,KAAW,GAAM,OAAO,GAAO,UAAU,OAAO,GAAO,SAAgB,OAAO,CAAI,EAAK,MAAM,QAAQ,CAAI,EAAS,E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