{"version":3,"file":"UserDisplay.D6obSmNK.mjs","names":["useState","user"],"sources":["https:/framerusercontent.com/modules/OmBIMXYsW3sWfHl1fcYH/6TWLi25suri0lPXTwDQf/UserDisplay.js"],"sourcesContent":["// User authentication component with dynamic Supabase loading\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * User Display Component\n * \n * Shows the name of the currently logged in user via Supabase authentication.\n * Dynamically loads Supabase and displays fallback text when no user is logged in.\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function UserDisplay(props){const{fallbackText,textColor,font,prefix,suffix}=props;const[user,setUser]=useState(null);const[loading,setLoading]=useState(true);// Initialize Supabase client\nuseEffect(()=>{if(typeof window===\"undefined\")return;const supabase=window.supabaseClient;if(supabase){// Get current user\nsupabase.auth.getUser().then(({data:{user},error})=>{if(error){console.error(\"Error getting user:\",error);}startTransition(()=>{setUser(user);setLoading(false);});});// Listen for auth changes\nconst{data:{subscription}}=supabase.auth.onAuthStateChange((event,session)=>{startTransition(()=>{setUser(session?.user||null);setLoading(false);});});return()=>{subscription?.unsubscribe();};}else{startTransition(()=>setLoading(false));}},[]);const fullName=user?.user_metadata?.full_name||user?.user_metadata?.name;const displayName=fullName?fullName.split(\" \")[0]:user?.email?.split(\"@\")[0]||user?.email;const isFixedWidth=props?.style&&props.style.width===\"100%\";return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,...isFixedWidth?{...props?.style}:{minWidth:\"max-content\"},backgroundColor:\"transparent\",display:\"flex\",alignItems:\"center\",...font,color:textColor},children:/*#__PURE__*/_jsx(\"span\",{style:{flex:1},children:loading?fallbackText:displayName?`${prefix}${displayName}${suffix}`:fallbackText})});}addPropertyControls(UserDisplay,{fallbackText:{type:ControlType.String,title:\"Fallback Text\",defaultValue:\"Not logged in\",placeholder:\"Text when no user is logged in\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"Hello, \",placeholder:\"Text before name\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\",placeholder:\"Text after name\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},controls:\"extended\",defaultFontType:\"sans-serif\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"UserDisplay\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./UserDisplay.map"],"mappings":"yTASG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,eAAa,YAAU,OAAK,SAAO,SAAO,CAAC,EAAW,CAAC,EAAK,EAAQ,CAACA,EAAS,MAAW,CAAC,EAAQ,EAAW,CAACA,EAAS,IAC3K,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAS,EAAO,eAAe,GAAG,EAAS,CACtG,EAAS,KAAK,UAAU,MAAM,CAAC,KAAK,CAAC,KAAA,EAAK,CAAC,QAAM,GAAG,CAAI,GAAO,QAAQ,MAAM,sBAAsB,GAAQ,MAAoB,CAAC,EAAQC,GAAM,EAAW,GAAQ,EAAG,GACpK,GAAK,CAAC,KAAK,CAAC,eAAa,CAAC,CAAC,EAAS,KAAK,mBAAmB,EAAM,IAAU,CAAC,MAAoB,CAAC,EAAQ,GAAS,MAAM,MAAM,EAAW,GAAQ,EAAG,GAAE,UAAU,CAAC,GAAc,aAAe,CAAE,MAAK,MAAoB,EAAW,IAAU,EAAC,EAAE,EAAE,IAAM,EAAS,GAAM,eAAe,WAAW,GAAM,eAAe,KAAW,EAAY,EAAS,EAAS,MAAM,KAAK,GAAG,GAAM,OAAO,MAAM,K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