{"version":3,"file":"UserDisplay.C5OPtCmB.mjs","names":["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,CAAC,EAAS,KAAK,CAAM,CAAC,EAAQ,EAAW,CAAC,GAAS,EAAK,CAChL,EAAU,IAAI,CAAC,GAAU,WAAqB,OAAO,IAAM,EAAS,EAAO,eAAe,GAAG,EAAS,CACtG,EAAS,KAAK,SAAS,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAA,EAAK,CAAC,QAAM,GAAG,CAAuD,AAAnD,GAAO,QAAQ,MAAM,sBAAsB,EAAM,CAAE,EAAgB,IAAI,CAAe,AAAd,EAAQA,EAAK,CAAC,GAAW,EAAM,AAAE,EAAC,AAAE,EAAC,CACrK,GAAK,CAAC,KAAK,CAAC,eAAa,CAAC,CAAC,EAAS,KAAK,kBAAkB,CAAC,EAAM,IAAU,CAAC,EAAgB,IAAI,CAA8B,AAA7B,EAAQ,GAAS,MAAM,KAAK,CAAC,GAAW,EAAM,AAAE,EAAC,AAAE,EAAC,CAAC,MAAM,IAAI,CAAC,GAAc,aAAa,AAAE,CAAE,MAAK,EAAgB,IAAI,GA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