{"version":3,"file":"Show_when_.isKO1o7J.mjs","names":["useRef","_Fragment","useState","useMemo"],"sources":["https:/framerusercontent.com/modules/S9nnUOhZS575Kt2ac63u/S7ukolGEquq8wouxvkbi/LogOutButton.js","https:/framerusercontent.com/modules/cY7jJko3MCuTQvBA1qZ1/Hp1tilhknQaW6xKdsxGL/ThentyHelpers.js","https:/framer.com/m/ThentyHelpers-I0Oh.js","https:/framerusercontent.com/modules/AV3WwdA6bCfGskHfacuf/BVvHFLCVNnzBJt1mtJR9/Show_when_.js"],"sourcesContent":["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/CxleeUEblAvnlnlj53Yz/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\":{\"framerDisableUnlink\":\"\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"300\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect,useMemo}from\"react\";import{thentyAuth}from\"https://cdn.thenty.io/beta/thenty-sdk.min.js\";export const useThenty=()=>{const metaKey=thentyAuth.fetchMetadataKey();const authKey=thentyAuth.fetchAuthorizationKey();const[authorization,updateAuthorization]=useState(thentyAuth.fetchAuthorization());const[siteMeta,updateSiteMeta]=useState(thentyAuth.fetchMetadata());useEffect(()=>{// Event listener callback\nconst handleStorageChange=event=>{var _event_detail,_event_detail1;var _event_detail_key;const eventKey=(_event_detail_key=(_event_detail=event.detail)===null||_event_detail===void 0?void 0:_event_detail.key)!==null&&_event_detail_key!==void 0?_event_detail_key:event.key;var _event_detail_newValue;const eventNewValue=(_event_detail_newValue=(_event_detail1=event.detail)===null||_event_detail1===void 0?void 0:_event_detail1.newValue)!==null&&_event_detail_newValue!==void 0?_event_detail_newValue:event.newValue;if(eventKey===authKey){updateAuthorization(JSON.parse(eventNewValue));}if(eventKey===metaKey){updateSiteMeta(JSON.parse(eventNewValue));}};window.addEventListener(\"storage\",handleStorageChange);return()=>{window.removeEventListener(\"storage\",handleStorageChange);};},[]);return{authorization,siteMeta};};// TODO - Add to documentation section\nexport const hasTier=(productIds=[])=>{const{authorization}=useThenty();const canAccess=useMemo(()=>{return thentyAuth.checkForProduct(productIds);},[authorization,productIds]);return canAccess;};// TODO - Add to documentation section\nexport const hasProduct=(productIds=[])=>{return hasTier(productIds);};export const fetchUserData=()=>{const{authorization}=useThenty();const userData=useMemo(()=>{if(!authorization)return null;if(authorization===null||authorization===void 0?void 0:authorization.hasOwnProperty(\"member\")){return authorization===null||authorization===void 0?void 0:authorization.member;}else{return null;}},[authorization]);const loggedIn=useMemo(()=>{return!!userData;},[userData]);return{loggedIn,userData};};export const useSSO=planIdOverride=>{const[firstRender,setFirstRender]=useState(true);const ssoQueryParamHandler=()=>{var _window,_window_location,_window1;const searchParams=((_window=window)===null||_window===void 0?void 0:_window.location)?new URLSearchParams((_window1=window)===null||_window1===void 0?void 0:(_window_location=_window1.location)===null||_window_location===void 0?void 0:_window_location.search):{};if(thentyAuth.isGoogleRedirect(searchParams)){thentyAuth.fetchGoogleCallback(planIdOverride,searchParams).catch(err=>console.error(err));}};useEffect(()=>{if(firstRender){ssoQueryParamHandler();setFirstRender(false);}},[firstRender]);};export default function ThentyHelpers(){return /*#__PURE__*/_jsx(_Fragment,{});}\nexport const __FramerMetadata__ = {\"exports\":{\"hasProduct\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hasTier\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useThenty\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"fetchUserData\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useSSO\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"ThentyHelpers\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ThentyHelpers.map","/*\n * ThentyHelpers\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/cY7jJko3MCuTQvBA1qZ1/Hp1tilhknQaW6xKdsxGL/ThentyHelpers.js\"\nexport { default } from \"https://framerusercontent.com/modules/cY7jJko3MCuTQvBA1qZ1/Hp1tilhknQaW6xKdsxGL/ThentyHelpers.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{fetchUserData}from\"https://framer.com/m/ThentyHelpers-I0Oh.js\";export const showWhenLoggedIn=Component=>props=>{const{loggedIn}=fetchUserData();return!loggedIn?null:/*#__PURE__*/_jsx(Component,{...props});};export const hideWhenLoggedIn=Component=>props=>{const{loggedIn}=fetchUserData();return loggedIn?null:/*#__PURE__*/_jsx(Component,{...props});};\nexport const __FramerMetadata__ = {\"exports\":{\"hideWhenLoggedIn\":{\"type\":\"reactHoc\",\"name\":\"hideWhenLoggedIn\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"showWhenLoggedIn\":{\"type\":\"reactHoc\",\"name\":\"showWhenLoggedIn\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Show_when_.map"],"mappings":"oSAKG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,OAAK,eAAa,iBAAe,EAAY,EAAIA,EAAO,IAAI,EAAQ,EAAgBA,EAAO,IAAI,EAAQ,MAAY,CAAC,aAAa,WAAW,EAAW,sBAAsB,CAAC,EAAK,GAAc,EAAgB,QAAY,EAAc,EAAG,eAAe,CAAC,EAAgB,QAAQ,MAAM,CAAE,EAAE,EAAc,GAAG,EAAQ,EAAgB,QAAQ,MAAM,EAAa,EAAO,SAAS,OAAO,SAAS,mBAAmB,GAAG,EAAO,SAAS,OAAO,CAAG,EAAE,OAAoB,EAAMC,EAAU,CAAC,SAAS,CAAc,EAAK,EAAe,CAAK,MAAI,GAAG,EAAc,UAAQ,SAAS,CAAI,CAAC,EAAE,GAA2B,EAAK,EAAK,CAAC,IAAI,EAAgB,KAAK,EAAa,aAAa,GAAM,aAAa,GAAM,SAAsB,EAAK,IAAI,CAAC,MAAM,CAAC,QAAQ,MAAM,CAAC,CAA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