{"version":3,"file":"PersonalizedText.BTChNKF9.mjs","names":["useMemo"],"sources":["https:/framerusercontent.com/modules/D71NSMEH3xxUHCNbHdXB/QKo5nFAom7sB40QXNU0h/PersonalizedText.js"],"sourcesContent":["// Personalization text component that reads a URL parameter and displays it dynamically\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useMemo}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Personalization Text\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function PersonalizedText(props){const{paramName,fallbackText,prefix,suffix,textColor,font,sizingMode,hideIfNoParam,style}=props;const{paramValue,hasParam}=useMemo(()=>{if(typeof window!==\"undefined\"){const urlParams=new URLSearchParams(window.location.search);const value=urlParams.get(paramName);return{paramValue:value?decodeURIComponent(value):fallbackText,hasParam:value!==null};}return{paramValue:fallbackText,hasParam:false};},[paramName,fallbackText]);// Hide component if hideIfNoParam is true and no param was found\nif(hideIfNoParam&&!hasParam){return null;}const displayText=`${prefix}${paramValue}${suffix}`;const getWidthStyle=()=>{if(sizingMode===\"fill\"){return{width:\"100%\"};}else if(sizingMode===\"fit\"){return{width:\"max-content\"};}else{// fixed mode - use the style width from Framer\nreturn{};}};return /*#__PURE__*/_jsx(\"div\",{style:{...style,position:\"relative\",color:textColor,...getWidthStyle(),...font},children:displayText});}addPropertyControls(PersonalizedText,{paramName:{type:ControlType.String,title:\"URL Parameter\",defaultValue:\"name\",placeholder:\"e.g., name, city, product\"},hideIfNoParam:{type:ControlType.Boolean,title:\"Hide if No Param\",defaultValue:false,enabledTitle:\"Hide\",disabledTitle:\"Show\"},fallbackText:{type:ControlType.String,title:\"Fallback Text\",defaultValue:\"Guest\",placeholder:\"Default text if param not found\"},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"Hello, \",placeholder:\"Text before parameter\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"!\",placeholder:\"Text after parameter\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"32px\",variant:\"Semibold\",letterSpacing:\"-0.03em\",lineHeight:\"1em\"}},sizingMode:{type:ControlType.Enum,title:\"Width\",options:[\"fill\",\"fit\",\"fixed\"],optionTitles:[\"Fill\",\"Fit\",\"Fixed\"],defaultValue:\"fit\",displaySegmentedControl:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PersonalizedText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PersonalizedText.map"],"mappings":"oLAMG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,YAAU,eAAa,SAAO,SAAO,YAAU,OAAK,aAAW,gBAAc,SAAO,EAAW,CAAC,aAAW,YAAUA,MAAY,CAAC,GAAU,IAAS,OAAY,CAA6D,IAAM,EAAlD,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAAuB,IAAI,EAAU,CAAC,MAAM,CAAC,WAAW,EAAM,mBAAmB,EAAM,CAAC,EAAa,SAAS,IAAQ,KAAK,CAAE,MAAM,CAAC,WAAW,EAAa,SAAS,GAAM,EAAG,CAAC,EAAU,EAAa,CAAC,CAC7d,GAAG,GAAe,CAAC,EAAU,OAAO,KAAM,IAAM,EAAY,GAAG,IAAS,IAAa,IAAe,MAAsB,IAAa,OAAc,CAAC,MAAM,OAAO,CAAU,IAAa,MAAa,CAAC,MAAM,cAAc,CACtN,EAAE,CAAI,OAAoB,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,SAAS,WAAW,MAAM,EAAU,GAAG,GAAe,CAAC,GAAG,EAAK,CAAC,SAAS,EAAY,CAAC,sBAPvG,IAA2B,IAAoD,CAO0B,EAAoB,EAAiB,CAAC,UAAU,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