{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/jxI0K7eeDTqGC75Eh7DI/9UcS6WdkfLfyH6uMa2YP/Outseta.js"],
  "sourcesContent": ["/// VERSION 0.0.1\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";/////////////////// Button Overrides\nexport function withRegisterPopup(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,\"data-o-anonymous\":\"1\",\"data-o-auth\":\"1\",\"data-mode\":\"popup\",\"data-widget-mode\":\"register\"});};}export function asLoginPopupButton(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,\"data-o-anonymous\":\"1\",\"data-o-auth\":\"1\",\"data-mode\":\"popup\",\"data-widget-mode\":\"login\"});};}export function asProfilePopupButton(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,\"data-o-authenticated\":\"1\",\"data-o-profile\":\"1\",\"data-mode\":\"popup\"});};}export function asLogoutButton(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,\"data-o-authenticated\":\"1\",\"data-o-logout-link\":\"1\"});};}/////////////////// Visibility Overrides\nexport function showForAuthenticated(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,\"data-o-authenticated\":\"1\"});};}export function showForAnonymous(Component){return props=>{return /*#__PURE__*/_jsx(Component,{...props,\"data-o-anonymous\":\"1\"});};}/////////// Visibility Overrides Based on Plan Uid\n/////// Instruction\n// 1. Find the plan uid on the plan page in Outseta\n// 2. Replace aWxYEbmV in function name with the plan uid\n// 3. Replace the aWxYEbmV value of validPlanUid with the plan uid\n// Duplicate function for additional plan uids\nexport function showForSinglePlan_aWxYEbmV(Component){const validPlanUid=\"aWxYEbmV\";return props=>{try{const user=useUser();const value=user&&user[\"Account.CurrentSubscription.Plan.Uid\"];if(value===validPlanUid){return /*#__PURE__*/_jsx(Component,{...props});}return null;}catch(error){log(\"error in showForSinglePlan\",validPlanUid,error.message);return null;}};}/////////// Visibility Based on an Account Custom Property\n/////// Instruction\n// 1. Give the function as useful name\n// 2. Replace the \"PARTY\" value of validPropertyValue with the uppercase version of the value you want\n// 3. Replace MyCustomAccountProperty with the system name of your custom account property\n// Duplicate the functions for additional account properties and/or values\nexport function showForPartyAccounts(Component){const validPropertyValue=\"PARTY\";return props=>{try{var _user_AccountMyCustomAccountProperty;const user=useUser();const value=user&&((_user_AccountMyCustomAccountProperty=user[\"Account.MyCustomAccountProperty\"])===null||_user_AccountMyCustomAccountProperty===void 0?void 0:_user_AccountMyCustomAccountProperty.toUpperCase());if(value===validPropertyValue){return /*#__PURE__*/_jsx(Component,{...props});}return null;}catch(error){log(\"error in showForPartyPlan\",validPropertyValue,error.message);return null;}};}/////////// Visibility Based on an Person Custom Property\n/////// Instruction\n// 1. Give the function a useful name\n// 2. Replace the \"PARTY\" value of validPropertyValue with the uppercase version of the value you want\n// 3. Replace MyCustomPersonProperty with the system name of your custom person property\n// Duplicate the functions for additional account properties and/or values\nexport function showForPartyPeople(Component){const validPropertyValue=\"PARTY\";return props=>{try{var _user_MyCustomPersonProperty;const user=useUser();const value=user&&((_user_MyCustomPersonProperty=user[\"MyCustomPersonProperty\"])===null||_user_MyCustomPersonProperty===void 0?void 0:_user_MyCustomPersonProperty.toUpperCase());if(value===validPropertyValue){return /*#__PURE__*/_jsx(Component,{...props});}return null;}catch(error){log(\"error in showForPartyPeople\",validPropertyValue,error.message);return null;}};}/////////////////// Text Overrides\nexport function withUserFirstName(Component){return withProperty(\"FirstName\",Component);}export function withUserLastName(Component){return withProperty(\"LastName\",Component);}export function withUserFullName(Component){return withProperty(\"FullName\",Component);}export function withUserEmail(Component){return withProperty(\"Email\",Component);}export function withAccountName(Component){return withProperty(\"Account.Name\",Component);}export function withAccountSubscriptionUid(Component){return withProperty(\"Account.CurrentSubscription.Plan.Uid\",Component);}export function withAccountSubscriptionName(Component){return withProperty(\"Account.CurrentSubscription.Plan.Name\",Component);}export function withAccountSubscriptionDescription(Component){return withProperty(\"Account.CurrentSubscription.Plan.Description\",Component);}/////////////////// Image Overrides\nexport function withUserAvatar(Component){return withImageProperty(\"ProfileImageS3Url\",Component);}let user=null;const listeners=new Set;const fetchUser=async event=>{try{log(\"fetch user\",event);const userObject=await getOutseta().getUser();user=flattenObject(userObject);log(\"fetch user fulfilled\",event,userObject,user);notifyListeners();}catch(error){log(\"fetch user failed\",error);}};const clearUser=event=>{user=null;// Possible race condition that an earlier\nlog(\"cleared user\",event);notifyListeners();};const notifyListeners=()=>{listeners.forEach(listener=>listener(user));};export const subscribe=listener=>{listeners.add(listener);return()=>listeners.delete(listener);};export const getUser=()=>user;// Listen to global events that might change the user\nconst outsetaFetchUserEvents=[\"accessToken.set\",\"profile.update\",\"account.update\"];outsetaFetchUserEvents.forEach(event=>{var _getOutseta;(_getOutseta=getOutseta())===null||_getOutseta===void 0?void 0:_getOutseta.on(event,()=>fetchUser(event));});// Listen to global events that should clear the user\nconst outsetaClearUserEvents=[\"logout\"];outsetaClearUserEvents.forEach(event=>{var _getOutseta;(_getOutseta=getOutseta())===null||_getOutseta===void 0?void 0:_getOutseta.on(event,()=>clearUser(event));});/////////////////// User Hook\nfunction useUser(){const[user,setUser]=useState(getUser());useEffect(()=>{const updateData=newData=>setUser(newData);const unsubscribe=subscribe(updateData);return()=>{unsubscribe();};},[]);return user;}function getOutseta(){if(window&&window[\"Outseta\"]){return window[\"Outseta\"];}else if(window){console.log(\"Outseta is missing, have you added the Outseta Script and Options to the head of the site?\");alert(`We're sorry, but it seems that Outseta is missing. Please reach out to the owner of ${window.location.hostname} to let them know. Thank you for your understanding \uD83D\uDE4F`);}else{// Rendering on the server\n}}/////////////////// Helpers\nfunction withProperty(property,Component){return props=>{const user=useUser();if(!user)return null;return /*#__PURE__*/_jsx(Component,{...props,text:user[property]});};}function withImageProperty(property,Component){return props=>{var _props_background;const user=useUser();if(!user)return null;const imageSrc=user[property];log(\"avatar source\",user[property]);if(imageSrc){return /*#__PURE__*/_jsx(Component,{...props,background:{...props.background,src:imageSrc,srcSet:undefined}});}else if((_props_background=props.background)===null||_props_background===void 0?void 0:_props_background.src){// Component has image set, use as fallback\nreturn /*#__PURE__*/_jsx(Component,{...props});}else{// Component has no image set, remove\nreturn null;}};}function log(...props){var _getOutseta;(_getOutseta=getOutseta())===null||_getOutseta===void 0?void 0:_getOutseta.debug(\"outseta.framer.override.user\",...props);}function flattenObject(obj,parent=\"\",res={}){for(let key in obj){let propName=parent?`${parent}.${key}`:key;if(Array.isArray(obj[key])){obj[key].forEach((item,index)=>{flattenObject(item,`${propName}[${index}]`,res);});}else if(typeof obj[key]===\"object\"&&obj[key]!==null){flattenObject(obj[key],propName,res);}else{res[propName]=obj[key];}}return res;}\nexport const __FramerMetadata__ = {\"exports\":{\"withAccountSubscriptionDescription\":{\"type\":\"reactHoc\",\"name\":\"withAccountSubscriptionDescription\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withRegisterPopup\":{\"type\":\"reactHoc\",\"name\":\"withRegisterPopup\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getUser\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"showForSinglePlan_aWxYEbmV\":{\"type\":\"reactHoc\",\"name\":\"showForSinglePlan_aWxYEbmV\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"showForPartyPeople\":{\"type\":\"reactHoc\",\"name\":\"showForPartyPeople\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAccountSubscriptionUid\":{\"type\":\"reactHoc\",\"name\":\"withAccountSubscriptionUid\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withUserFullName\":{\"type\":\"reactHoc\",\"name\":\"withUserFullName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"showForAuthenticated\":{\"type\":\"reactHoc\",\"name\":\"showForAuthenticated\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"asProfilePopupButton\":{\"type\":\"reactHoc\",\"name\":\"asProfilePopupButton\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withUserAvatar\":{\"type\":\"reactHoc\",\"name\":\"withUserAvatar\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withUserFirstName\":{\"type\":\"reactHoc\",\"name\":\"withUserFirstName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withUserLastName\":{\"type\":\"reactHoc\",\"name\":\"withUserLastName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"subscribe\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAccountSubscriptionName\":{\"type\":\"reactHoc\",\"name\":\"withAccountSubscriptionName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"showForAnonymous\":{\"type\":\"reactHoc\",\"name\":\"showForAnonymous\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"asLogoutButton\":{\"type\":\"reactHoc\",\"name\":\"asLogoutButton\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"showForPartyAccounts\":{\"type\":\"reactHoc\",\"name\":\"showForPartyAccounts\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAccountName\":{\"type\":\"reactHoc\",\"name\":\"withAccountName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"asLoginPopupButton\":{\"type\":\"reactHoc\",\"name\":\"asLoginPopupButton\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withUserEmail\":{\"type\":\"reactHoc\",\"name\":\"withUserEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Outseta.map"],
  "mappings": "kFAE4kB,SAASA,EAAeC,EAAU,CAAC,OAAOC,GAA4BC,EAAKF,EAAU,CAAC,GAAGC,EAAM,uBAAuB,IAAI,qBAAqB,GAAG,CAAC,CAAI,CAC5tB,SAASE,EAAqBH,EAAU,CAAC,OAAOC,GAA4BC,EAAKF,EAAU,CAAC,GAAGC,EAAM,uBAAuB,GAAG,CAAC,CAAI,CAoBxC,IAAIG,EAAK,KAAWC,EAAU,IAAI,IAAUC,EAAU,MAAMC,GAAO,CAAC,GAAG,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AAQ,CAACE,EAAKC,IAAQ,CAACP,EAAcM,EAAK,GAAGD,CAAQ,IAAIE,CAAK,IAAIJ,CAAG,CAAE,CAAC,EAAW,OAAOF,EAAIG,CAAG,GAAI,UAAUH,EAAIG,CAAG,IAAI,KAAMJ,EAAcC,EAAIG,CAAG,EAAEC,EAASF,CAAG,EAAQA,EAAIE,CAAQ,EAAEJ,EAAIG,CAAG,CAAG,CAAC,OAAOD,CAAI",
  "names": ["asLogoutButton", "Component", "props", "p", "showForAuthenticated", "user", "listeners", "fetchUser", "event", "log", "userObject", "getOutseta", "flattenObject", "notifyListeners", "error", "clearUser", "listener", "outsetaFetchUserEvents", "event", "_getOutseta", "getOutseta", "fetchUser", "outsetaClearUserEvents", "clearUser", "getOutseta", "window", "log", "props", "_getOutseta", "getOutseta", "flattenObject", "obj", "parent", "res", "key", "propName", "item", "index"]
}
