{"version":3,"file":"DynamicPageTitle.B0fPRdDc.mjs","names":[],"sources":["https:/framerusercontent.com/modules/PS7so0skozQ0fWA1qpah/8tqkx7Rk91TZ0LQjqzIl/DynamicPageTitle.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function DynamicPageTitle(props){const{title=\"Welcome to Cellular, {{firstName}}\",fallbackTitle=\"Welcome to Cellular\",storageKey=\"firstName\"}=props;useEffect(()=>{const updateTitle=()=>{const savedValue=localStorage.getItem(storageKey);// If no value in localStorage, use the fallback title\nif(!savedValue){document.title=fallbackTitle;return;}// Replace {{variableName}} with the actual value\nconst variablePattern=/\\{\\{(\\w+)\\}\\}/g;const newTitle=title.replace(variablePattern,(match,varName)=>{if(varName===storageKey){return savedValue;}return match;});document.title=newTitle;};// Initial update\nupdateTitle();const handleStorageChange=e=>{if(e.key===storageKey){updateTitle();}};window.addEventListener(\"storage\",handleStorageChange);return()=>{window.removeEventListener(\"storage\",handleStorageChange);};},[title,fallbackTitle,storageKey]);// Return an empty div since Framer components need to render something\nreturn /*#__PURE__*/_jsx(\"div\",{style:{display:\"none\"}});}addPropertyControls(DynamicPageTitle,{title:{type:ControlType.String,title:\"Page Title\",defaultValue:\"Welcome to Cellular, {{firstName}}\",description:\"Use {{variableName}} to insert dynamic values\",displayTextArea:false},fallbackTitle:{type:ControlType.String,title:\"Fallback Title\",defaultValue:\"Welcome to Cellular\",description:\"Title to use when localStorage value is not available\",displayTextArea:false},storageKey:{type:ControlType.String,title:\"Storage Key\",defaultValue:\"firstName\",description:\"The localStorage key to read the value from\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DynamicPageTitle\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DynamicPageTitle.map"],"mappings":"wLAGG,SAAwB,EAAiB,EAAM,CAAC,GAAK,CAAC,QAAM,qCAAqC,gBAAc,sBAAsB,aAAW,aAAa,EAIhK,OAJsK,MAAc,CAAC,IAAM,MAAgB,CAAC,IAAM,EAAW,aAAa,QAAQ,EAAW,CAC7P,GAAG,CAAC,EAAW,CAAC,SAAS,MAAM,EAAc,OACN,IAAM,EAAS,EAAM,QAAtC,kBAA+D,EAAM,IAAc,IAAU,EAAmB,EAAmB,EAAQ,CAAC,SAAS,MAAM,GACjL,GAAa,CAAC,IAAM,EAAoB,GAAG,CAAI,EAAE,MAAM,GAAY,GAAa,EAA2D,OAAvD,EAAO,iBAAiB,UAAU,EAAoB,KAAW,CAAC,EAAO,oBAAoB,UAAU,EAAoB,GAAK,CAAC,EAAM,EAAc,EAAW,CAAC,CACjO,EAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,OAAO,CAAC,CAAC,sBAPb,IAA6B,IAAoD,CAOlE,EAAoB,EAAiB,CAAC,MAAM,CAAC,KAAK,EAAY,OAAO,MAAM,aAAa,aAAa,qCAAqC,YAAY,gDAAgD,gBAAgB,GAAM,CAAC,cAAc,CAAC,KAAK,EAAY,OAAO,MAAM,iBAAiB,aAAa,sBAAsB,YAAY,wDAAwD,gBAAgB,GAAM,CAAC,WAAW,CAAC,KAAK,EAAY,OAAO,MAAM,cAAc,aAAa,YAAY,YAAY,8CAA8C,CAAC,CAAC"}