{"version":3,"file":"LogOutButton.Di7Xo3M4.mjs","names":["textOptions","useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/mPGYIZ8yu9ABZPVltftl/eIsfCGXRAh3mrjzv9uRj/UserDataLabel.js","https:/framerusercontent.com/modules/S9nnUOhZS575Kt2ac63u/86E3ZbSGPB7g9fm1SI5V/LogOutButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,withCSS}from\"framer\";import{textOptions,textOptionsToStyles,fetchUserData}from\"https://framerusercontent.com/modules/diyk5889JEo4mM5y5sJr/k488EAt1FhWtVFD0n6vD/ThentyShared.js\";function UserDataLabelComponent({type,customFieldName,font,color,prefix,suffix,whenEmpty,emptyText,textOptions,style}){const Tag=textOptions.tag||\"p\";const{loggedIn,userData}=fetchUserData();let text=\"\";if(loggedIn&&userData){switch(type){case\"firstName\":text=userData.name?.split(\" \")[0]??\"\";break;case\"lastName\":text=userData.name?.split(\" \").slice(1).join(\" \")??\"\";break;case\"fullName\":text=userData.name;break;case\"email\":text=userData.email;break;case\"customField\":text=userData[customFieldName.startsWith(\"custom:\")?customFieldName:`custom:${customFieldName}`];break;}}if(!text){if(whenEmpty===\"hide\"){return /*#__PURE__*/_jsx(\"div\",{className:\"thenty-hide-element\"});}else{text=emptyText;}}return /*#__PURE__*/_jsxs(Tag,{style:{color,margin:0,whiteSpace:style?.width?undefined:\"nowrap\",fontWeight:400,textAlign:\"center\",...textOptionsToStyles(textOptions),...font,...style},children:[prefix,text,suffix]});}/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerDisableUnlink\n */const UserDataLabel=withCSS(UserDataLabelComponent,[\".thenty-hide-element { display: none; }\",\"div:has(> .thenty-hide-element) { display: none; }\"],\"thenty\");export default UserDataLabel;UserDataLabel.displayName=\"User Data Label\";addPropertyControls(UserDataLabel,{type:{type:ControlType.Enum,options:[\"firstName\",\"lastName\",\"fullName\",\"email\",\"customField\"],optionTitles:[\"First Name\",\"Last Name\",\"Full Name\",\"Email\",\"Custom Field\"],defaultValue:\"firstName\"},customFieldName:{type:ControlType.String,defaultValue:\"custom:\",title:\"Field Name\",placeholder:\"Custom Field Name\",hidden:props=>props.type!==\"customField\"},font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1.4,textAlign:\"center\"}},color:{type:ControlType.Color,defaultValue:\"#000000\"},prefix:{type:ControlType.String,defaultValue:\"\"},suffix:{type:ControlType.String,defaultValue:\"\"},whenEmpty:{type:ControlType.Enum,defaultValue:\"text\",options:[\"hide\",\"text\"],optionTitles:[\"Hide\",\"Text\"],displaySegmentedControl:true,title:\"Empty\"},emptyText:{type:ControlType.String,defaultValue:\"Empty\",title:\"Text\",placeholder:\"Empty State Text\",hidden:props=>props.whenEmpty!==\"text\"},textOptions:textOptions()});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"UserDataLabel\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,Link}from\"framer\";import{useRef}from\"react\";import{StandardButton,standardButtonPropertyControls}from\"https://framerusercontent.com/modules/diyk5889JEo4mM5y5sJr/k488EAt1FhWtVFD0n6vD/ThentyShared.js\";import{thentyAuth}from\"https://cdn.thenty.io/beta/thenty-sdk.min.js\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 300\n * @framerDisableUnlink\n */export default function LogOutButton(props){const{text,redirectLink,redirectDelay}=props;const ref=useRef(null);const redirectLinkRef=useRef(null);const onClick=()=>{localStorage.removeItem(thentyAuth.fetchAuthorizationKey());if(redirectLink&&redirectLinkRef.current){if(redirectDelay>0){setTimeout(()=>{redirectLinkRef.current.click();},redirectDelay*1e3);}else{redirectLinkRef.current.click();}}else if(!window.location.origin.endsWith(\".framercanvas.com\")){window.location.reload();}};return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(StandardButton,{ref:ref,...props,onClick:onClick,children:text}),redirectLink&&/*#__PURE__*/_jsx(Link,{ref:redirectLinkRef,href:redirectLink,openInNewTab:false,smoothScroll:false,children:/*#__PURE__*/_jsx(\"a\",{style:{display:\"none\"}})})]});}LogOutButton.displayName=\"Log Out Button\";addPropertyControls(LogOutButton,{text:{type:ControlType.String,placeholder:\"Button Text\",defaultValue:\"Log Out\"},redirectLink:{type:ControlType.Link,title:\"Redirect\"},redirectDelay:{type:ControlType.Number,defaultValue:0,min:0,step:.1,displayStepper:true,title:\"Delay\"},...standardButtonPropertyControls({})});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LogOutButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"300\",\"framerSupportedLayoutHeight\":\"any\",\"framerDisableUnlink\":\"\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"iTAAgR,SAAS,EAAuB,CAAC,OAAK,kBAAgB,OAAK,QAAM,SAAO,SAAO,YAAU,YAAU,YAAA,EAAY,SAAO,CAAC,IAAM,EAAIA,EAAY,KAAK,IAAS,CAAC,WAAS,YAAU,GAAe,CAAK,EAAK,GAAG,GAAG,GAAU,EAAU,OAAO,EAAP,CAAa,IAAI,YAAY,EAAK,EAAS,MAAM,MAAM,IAAI,CAAC,IAAI,GAAG,MAAM,IAAI,WAAW,EAAK,EAAS,MAAM,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,EAAE,GAAG,MAAM,IAAI,WAAW,EAAK,EAAS,KAAK,M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