{"version":3,"file":"UserData.DrAzZx2Z.mjs","names":["p"],"sources":["https:/framerusercontent.com/modules/4cjYt2eaOniz8oLZmQk4/1kR4u1btIkoJEMPe7b42/UserData.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{fetchUserData,hasTier}from\"https://framerusercontent.com/modules/SLx2xfWAXovN7llsgFwe/q3W2zyIUPHCXUxB77B8D/api.js\";import{apiFeux}from\"https://framerusercontent.com/modules/SLx2xfWAXovN7llsgFwe/q3W2zyIUPHCXUxB77B8D/api.js\";export const withLogout=Component=>props=>/*#__PURE__*/_jsx(Component,{...props,onClick:()=>{apiFeux.logout();}});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});};export const withFirstName=Component=>props=>{const{loggedIn,userData}=fetchUserData();return!loggedIn||!userData?/*#__PURE__*/_jsx(Component,{...props,text:\"First Name\",style:{...props.style}}):/*#__PURE__*/_jsx(Component,{...props,text:userData?.name?.split(\" \")[0]??\"-\",style:{...props.style}});};export const withFirstLetter=Component=>props=>{const{loggedIn,userData}=fetchUserData();return!loggedIn||!userData?/*#__PURE__*/_jsx(Component,{...props,text:\"A\",style:{...props.style}}):/*#__PURE__*/_jsx(Component,{...props,text:userData?.name?.charAt(0)??\"-\",style:{...props.style}});};export const withFullName=Component=>props=>{const{loggedIn,userData}=fetchUserData();return!loggedIn||!userData?/*#__PURE__*/_jsx(Component,{...props,text:\"Full Name\",style:{...props.style}}):/*#__PURE__*/_jsx(Component,{...props,text:userData?.name,style:{...props.style}});};export const withEmail=Component=>props=>{const{loggedIn,userData}=fetchUserData();return!loggedIn||!userData?/*#__PURE__*/_jsx(Component,{...props,text:\"example@feux.academy\",style:{...props.style}}):/*#__PURE__*/_jsx(Component,{...props,text:userData?.email,style:{...props.style}});};export const planName=Component=>props=>{const{loggedIn,userData}=fetchUserData();return!loggedIn||!userData?/*#__PURE__*/_jsx(Component,{...props,text:\"B\\xe1sico\",style:{...props.style}}):/*#__PURE__*/_jsx(Component,{...props,text:userData?.products.filter(p=>p.type===\"subscription\")[0].name||\"Sem assinatura\",style:{...props.style}});};export const planDate=Component=>props=>{const{loggedIn,userData}=fetchUserData();return!loggedIn||!userData?/*#__PURE__*/_jsx(Component,{...props,text:\"2025-01-01\",style:{...props.style}}):/*#__PURE__*/_jsx(Component,{...props,text:userData?.products[0]?.date||\"-\",style:{...props.style}});};export const createdAt=Component=>props=>{const{loggedIn,userData}=fetchUserData();return!loggedIn||!userData?/*#__PURE__*/_jsx(Component,{...props,text:\"2025-01-01\",style:{...props.style}}):/*#__PURE__*/_jsx(Component,{...props,text:userData?.created_at,style:{...props.style}});};export const totalPoints=Component=>props=>{const{loggedIn,userData}=fetchUserData();return!loggedIn||!userData?/*#__PURE__*/_jsx(Component,{...props,text:\"0\",style:{...props.style}}):/*#__PURE__*/_jsx(Component,{...props,text:(userData?.total_points||0).toString(),style:{...props.style}});};export const planManage=Component=>props=>{const{loggedIn,userData}=fetchUserData();const onSubmit=()=>{apiFeux.fetchWithBearer(\"/members/create-manage-subscription-session\",\"POST\",{}).then(responseBody=>{window.open(responseBody.sessionUrl,\"_self\");}).catch(err=>{if(err.redirect_url)window.location.href=err.redirect_url;});};return!loggedIn||!userData?/*#__PURE__*/_jsx(Component,{...props,text:\"Gerenciar Assinatura\",style:{...props.style}}):/*#__PURE__*/_jsx(Component,{...props,onClick:onSubmit});};export const stripeUserManage=Component=>props=>{const{loggedIn,userData}=fetchUserData();const onSubmit=()=>{apiFeux.fetchWithBearer(\"/members/create-manage-subscription-session\",\"POST\",{}).then(responseBody=>{window.open(responseBody.sessionUrl+\"/customer/update\",\"_self\");}).catch(err=>{if(err.redirect_url)window.location.href=err.redirect_url;});};return!loggedIn||!userData?/*#__PURE__*/_jsx(Component,{...props,text:\"Editar Informa\\xe7\\xf5es\",style:{...props.style}}):/*#__PURE__*/_jsx(Component,{...props,onClick:onSubmit});};export const withLastName=Component=>props=>{const{loggedIn,userData}=fetchUserData();return!loggedIn||!userData?/*#__PURE__*/_jsx(Component,{...props,text:\"Last Name\",style:{...props.style}}):/*#__PURE__*/_jsx(Component,{...props,text:userData?.name?.split(\" \").slice(1).join(\" \")||\"-\",style:{...props.style}});};export const invitesCount=Component=>props=>{const{loggedIn,userData}=fetchUserData();return!loggedIn||!userData?/*#__PURE__*/_jsx(Component,{...props,text:\"0\",style:{...props.style}}):/*#__PURE__*/_jsx(Component,{...props,text:(userData?.metadata?.invite_count||0).toString(),style:{...props.style}});};export const ShowWhenSubscribed=Component=>({subscriptionID=\"d3a7f3fc-0655-4dd4-bf2d-0da7d94ff2eb\",...props})=>{const{loggedIn,userData}=fetchUserData();const hasAccess=hasTier([subscriptionID]);return loggedIn&&userData&&hasAccess?/*#__PURE__*/_jsx(Component,{...props}):null;};export const HideWhenSubscribed=Component=>({subscriptionID=\"d3a7f3fc-0655-4dd4-bf2d-0da7d94ff2eb\",...props})=>{const{loggedIn,userData}=fetchUserData();const hasAccess=hasTier([subscriptionID]);return loggedIn&&userData&&!hasAccess?/*#__PURE__*/_jsx(Component,{...props}):null;};\nexport const __FramerMetadata__ = {\"exports\":{\"invitesCount\":{\"type\":\"reactHoc\",\"name\":\"invitesCount\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShowWhenSubscribed\":{\"type\":\"reactHoc\",\"name\":\"ShowWhenSubscribed\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFullName\":{\"type\":\"reactHoc\",\"name\":\"withFullName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"stripeUserManage\":{\"type\":\"reactHoc\",\"name\":\"stripeUserManage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"planDate\":{\"type\":\"reactHoc\",\"name\":\"planDate\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"planName\":{\"type\":\"reactHoc\",\"name\":\"planName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"createdAt\":{\"type\":\"reactHoc\",\"name\":\"createdAt\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"showWhenLoggedIn\":{\"type\":\"reactHoc\",\"name\":\"showWhenLoggedIn\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"totalPoints\":{\"type\":\"reactHoc\",\"name\":\"totalPoints\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFirstLetter\":{\"type\":\"reactHoc\",\"name\":\"withFirstLetter\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFirstName\":{\"type\":\"reactHoc\",\"name\":\"withFirstName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"planManage\":{\"type\":\"reactHoc\",\"name\":\"planManage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withEmail\":{\"type\":\"reactHoc\",\"name\":\"withEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"HideWhenSubscribed\":{\"type\":\"reactHoc\",\"name\":\"HideWhenSubscribed\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hideWhenLoggedIn\":{\"type\":\"reactHoc\",\"name\":\"hideWhenLoggedIn\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLastName\":{\"type\":\"reactHoc\",\"name\":\"withLastName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLogout\":{\"type\":\"reactHoc\",\"name\":\"withLogout\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./UserData.map"],"mappings":"iTAA2C,IAA0H,CAAyH,EAAW,GAAW,GAAoB,EAAK,EAAU,CAAC,GAAG,EAAM,YAAY,CAAC,EAAQ,QAAQ,EAAG,CAAC,CAA8S,EAAc,GAAW,GAAO,CAAC,GAAK,CAAC,WAAS,YAAU,GAAe,CAAC,MAAM,CAAC,GAAU,CAAC,EAAsB,EAAK,EAAU,CAAC,GAAG,EAAM,KAAK,aAAa,M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