PageSourceSearch

https://www.consumer.org.nz/assets/errors-D7szRyiy.js

js consumer.org.nz collected 2026-09-24 17:47:06 UTC 4,978 bytes, 1 lines download raw bytes

1import{j as B}from"./jsx-runtime-u17CrQMm.js";import{r as n}from"./chunk-62JRHF6Z-CLG6XeTw.js";const T={bronze:["all_users","members_unpaid","all_unpaid"],silver:["all_users","members_paid"],gold:["all_users","members_paid"],corporate:["all_users","members_paid"],googlebot:["all_users","members_paid"],guest:["all_users","guests","all_unpaid"]};Object.entries(T).filter(([,e])=>e.includes("members_paid")).map(([e])=>e);const I=["JoinCtaBlockRecord","BenefitsCtaBlockRecord"];function D(e){return!!(e&&e!=="guest")}function G(e){return D(e)&&e!=="bronze"}function z(e,o="guest"){if(!e)return!1;const t="reusableContentBlock"in e?e.reusableContentBlock.block:e;if(!t)return!1;const r=t.__typename,a=T[o]||T.guest;if(I.includes(r)&&a.includes("members_paid"))return!1;const p=("blockSettings"in t?t.blockSettings:t)?.accessTier||"all_users";return!!a.includes(p)}const N={membershipTier:"guest",displayName:"...",loggedIn:!1,paid:!1,canContribute:!1,loggedInButNotGooglebot:!1},U=n.createContext(N);function $(e){const{children:o,membershipTier:t}=e,[r,a]=n.useState(null),[u,p]=n.useState(!1),i=r?.membership_tier||t||"guest",_=r?.id,w=r?.name||"...",g=D(i),C=g&&i!=="googlebot",d=G(i),f=d&&i!=="corporate";async function S(){if(t==="googlebot"){p(!0),a({membership_tier:"googlebot"});return}const c=await fetch("/api/session");if(c.ok){const{data:s}=await c.json();a(s),(s?.membership_tier||"guest")===(t||"guest")&&p(!0)}}n.useEffect(()=>{if(u){const c=g?d?"Current":"Lapsed":"Guest",s=i.charAt(0).toUpperCase()+i.slice(1);window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"member_status",status:c,member_tier:s})}},[u]),n.useEffect(()=>{S()},[]);const y=n.useMemo(()=>({membershipTier:i,memberId:_,displayName:w,loggedIn:g,paid:d,canContribute:f,loggedInButNotGooglebot:C}),[i,_,w,g,d,f,C]);return B.jsx(U.Provider,{value:y,children:o})}function j(){const{environment:e}=n.useContext(L);return function(t,r={}){R(t,r,e)}}function R(e,o={},t){t!=="production"&&console.error("Client error caught:",e,o);try{if(typeof window>"u")return;window.rg4js("getRaygunInstance",r=>{r.send(e,{customData:o})})}catch(r){t!=="production"&&console.error(r,"Error sending Raygun client error")}}function F(){const e=j();return async function(t,r,a={}){await Y(e,t,r,a)}}async function Y(e,o,t,r={}){let a;try{throw a=await o.text(),new Error(`Unexpected client response from action ${t}`)}catch(u){e(u,{status:o.status,response:a,action:t,...r})}}const P={environment:"production",logClientError:()=>{},footerColumns:[{id:"footer-1",items:[]},{id:"footer-2",items:[]},{id:"footer-3",items:[]}],primaryMenuSections:[{id:"primary-1",label:"Product reviews",secondaryMenuSections:[]},{id:"primary-2",label:"Campaigns & your rights",secondaryMenuSections:[]},{id:"primary-3",label:"About us",secondaryMenuSections:[]}],ctaDefaults:{},ctaPopupBannerReady:!1,setCtaPopupBannerReady:()=>{},allowCtaPopupDisplay:()=>{},setCookieBannerShown:()=>{},displayTiming:"page_load",globalSeo:{}},L=n.createContext(P);function J(e){const{children:o,environment:t,globalContent:r}=e,{navigation:a,ctaDefaults:u}=r||{},p=r?.site?.globalSeo,{footerColumns:i=P.footerColumns,primaryMenuSections:_=P.primaryMenuSections}=a||{};function w(b,E={}){R&&R(b,E,t)}const g=3e3,C=1e4,[d,f]=n.useState(!1),[S,y]=n.useState("page_load"),c=n.useRef(null),s=n.useRef(null),l=n.useRef(null),h=n.useRef(!1),m=n.useRef(!1),v=n.useCallback(()=>{h.current=!0},[]),k=n.useCallback(()=>{const b=window.scrollY,E=document.documentElement.scrollHeight-window.innerHeight;return(E>0?b/E*100:0)>=50},[]),x=n.useCallback(()=>{c.current!==null&&(clearTimeout(c.current),c.current=null),s.current!==null&&(clearTimeout(s.current),s.current=null),l.current&&(window.removeEventListener("scroll",l.current),l.current=null)},[]),M=n.useCallback(()=>{if(!m.current){if(!h.current){m.current=!0,y("page_load"),f(!0);return}c.current=window.setTimeout(()=>{c.current=null;const b=()=>{m.current||k()&&(m.current=!0,y("scroll_after_cookie_banner"),f(!0),l.current&&(window.removeEventListener("scroll",l.current),l.current=null),s.current!==null&&(clearTimeout(s.current),s.current=null))};l.current=b,window.addEventListener("scroll",b,{passive:!0}),s.current=window.setTimeout(()=>{m.current||(m.current=!0,s.current=null,y("delay_after_cookie_banner"),f(!0),l.current&&(window.removeEventListener("scroll",l.current),l.current=null))},C)},g)}},[k]);n.useEffect(()=>()=>{x()},[x]);const A=n.useMemo(()=>({environment:t,logClientError:w,footerColumns:i,primaryMenuSections:_,ctaDefaults:u??{},ctaPopupBannerReady:d,setCtaPopupBannerReady:f,allowCtaPopupDisplay:M,setCo
1okieBannerShown:v,displayTiming:S,globalSeo:p??{}}),[t,i,_,u,d,M,v,S]);return B.jsx(L.Provider,{value:A,children:o})}const K="An unexpected error occurred. The team has been notified. Please try again later.",W="An unexpected error occurred. The team has been notified. Please try again.";export{L as G,U as M,W as T,K as U,j as a,J as b,$ as c,z as d,F as u};

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.