PageSourceSearch

https://icaas.org/assets/useCustomization-Bxxc4ExQ.js

js icaas.org collected 2026-10-05 19:49:51 UTC 4,074 bytes, 1 lines download raw bytes

1import{n as e,s as t,t as n}from"./jsx-runtime-CKh-7KOC.js";import{t as r}from"./api-C36ujMwF.js";var i=t(e());n();var a=`/api`,o=`customization_cache`,s=600*1e3,c=()=>{try{let e=sessionStorage.getItem(o);if(!e)return null;let t=JSON.parse(e);return!t?.cachedAt||!t?.data||Date.now()-Number(t.cachedAt)>s?(sessionStorage.removeItem(o),null):t.data}catch{return null}},l=(e,t)=>{try{sessionStorage.setItem(o,JSON.stringify({cachedAt:t,data:e}))}catch{}},u=null,d=0,f=(e=!1)=>{let t=Date.now()-d>s;return(e||!u||t)&&(u=r.get(`/customization/public`),d=Date.now(),u.catch(()=>{u=null})),u},p=()=>{f()},m=`login_bg_url`,h=`login_bg_url_cached_at`,g=(e,t)=>{try{let n=e?.background;if((n?.type||`image`)===`image`){let e=S(n?.imageUrl)||_.background.imageUrl;localStorage.setItem(m,e),localStorage.setItem(h,String(t))}else localStorage.removeItem(m),localStorage.removeItem(h)}catch{}},_={background:{type:`image`,imageUrl:`https://images.unsplash.com/photo-1522071820081-009f0129c71c?q=80&w=2070&auto=format&fit=crop`,solidColor:`#1e293b`,gradient:{direction:`to-br`,from:`#1e293b`,to:`#3b82f6`},overlayColor:`#1e293b`,overlayOpacity:.3,imageFit:`cover`,imagePositionX:50,imagePositionY:50},logo:{show:!0,imageUrl:null,size:`medium`,shape:`circle`},colors:{primaryButton:`#2563eb`,primaryButtonText:`#ffffff`,headingText:`#ffffff`,bodyText:`#e2e8f0`,linkText:`#60a5fa`},text:{headline:`Memberlytic`,tagline:`Access your premium dashboard, connect with peers, and unlock exclusive resources.`}},v={organizationName:`Memberlytic`,tagline:`Membership Management Platform`,logo:{fullUrl:null,iconUrl:null},supportEmail:null,socialLinks:{linkedin:null,twitter:null,facebook:null,instagram:null}},y=(0,i.createContext)(null),b=()=>{let e=(0,i.useRef)(c()).current,[t,n]=(0,i.useState)(e||{login:_,branding:v,eventsEnabled:!1,merchandiseEnabled:!1,fundraisingEnabled:!1,membershipEnabled:!0,hasPublishedHome:!1}),[r,a]=(0,i.useState)(!e),[o,s]=(0,i.useState)(null),u=(0,i.useCallback)(async(t=!1)=>{e||a(!0),s(null);try{let e=await f(t===!0);if(e.data.success){let{login:t,branding:r,eventsEnabled:i,merchandiseEnabled:a,fundraisingEnabled:o,membershipEnabled:s,hasPublishedHome:c}=e.data.data,u={login:t||_,branding:r||v,eventsEnabled:i||!1,merchandiseEnabled:a||!1,fundraisingEnabled:o||!1,membershipEnabled:s!==!1,hasPublishedHome:c===!0};n(u),l(u,d),g(u.login,d)}}catch(e){console.error(`Failed to load customization:`,e),s(e.message)}finally{a(!1)}},[e]);return(0,i.useEffect)(()=>{u()},[u]),{customization:t,login:t.login,branding:t.branding,eventsEnabled:t.eventsEnabled,merchandiseEnabled:t.merchandiseEnabled,fundraisingEnabled:t.fundraisingEnabled,membershipEnabled:t.membershipEnabled,hasPublishedHome:t.hasPublishedHome,isLoading:r,error:o,refresh:()=>u(!0)}},x=()=>{let e=(0,i.useContext)(y),t=b();return e||t},S=e=>{if(!e)return null;if(e.startsWith(`http`)){if(typeof window<`u`)try{let t=new URL(e);if(new Set([`localhost`,`127.0.0.1`,`0.0.0.0`,`::1`]).has(t.hostname)){let e=t.port?`:${t.port}`:``;return`${window.location.protocol}//${window.location.hostname}${e}${t.pathname}${t.search}${t.hash}`}}catch{}return e}return`${a.replace(`/api`,``)||``}${e}`},C=(e,t=50)=>{let n=Number(e);return Number.isFinite(n)?Math.max(0,Math.min(100,n)):t},w=e=>{let t=e?.background||_.background;if(t.type===`solid`)return{backgroundColor:t.solidColor};if(t.type===`gradient`)return{background:`linear-gradient(${{"to-r":`to right`,"to-l":`to left`,"to-b":`to bottom`,"to-t":`to top`,"to-br":`to bottom right`,"to-bl":`to bottom left`,"to-tr":`to top right`,"to-tl":`to top left`}[t.gradient?.direction]||`to bottom right`}, ${t.gradient?.from||`#1e293b`}, ${t.gradient?.to||`#3b82f6`})`};let n=S(t.imageUrl)||_.background.imageUrl,r=C(t.imagePositionX,_.background.imagePositionX),i=C(t.imagePositionY,_.background.imagePositionY);return{backgroundImage:`url(${n})`,backgroundSize:t.imageFit||`cover`,backgroundPosition:`${r}% ${i}%`}},T=e=>({small:48,medium:64,large:80})[e]||64,E=e=>e===`circle`?`50%`:e===`square`?`12px`:`0`;export{p as a,T as i,S as n,x as o,E as r,w as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.