PageSourceSearch

https://vidapeps.com/assets/AccountNotifications-CbEBzxU-.js

js vidapeps.com collected 2026-10-04 08:09:40 UTC 7,292 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-query-CniT1WJL.js";import{u as w,r as p}from"./vendor-react-69GsFwrV.js";import{u as N,bx as P,by as S,bz as T,F as C,q as g,f as E,P as A,bA as x,bB as I,bC as _,bD as B,bE as V,V as v,bF as q,bG as L,m as O}from"./index-KjAD5lCC.js";import{A as W}from"./AccountNav-CGK2802V.js";import{A as D,b as j}from"./AccountSection-B7Ueu1lP.js";import{B as m,be as F,s as $,aX as R,a0 as z}from"./vendor-ui-Ad3ANzF6.js";import"./vendor-forms-q6h4WU-p.js";const G=[{type:"order_paid",label:"Order confirmations",hint:"When your order is placed and paid."},{type:"order_shipped",label:"Shipping updates",hint:"When your order ships and tracking is ready."},{type:"order_in_transit",label:"In transit updates",hint:"Carrier scans while your package is on the way."},{type:"order_delivered",label:"Delivery updates",hint:"When a package is marked delivered."},{type:"order_exception",label:"Delivery issues",hint:"If a package is returned to sender or needs attention."},{type:"restock",label:"Back in stock",hint:"When a compound you follow returns."},{type:"club_run",label:"VidaPeps Club",hint:"Group-order runs, deadlines, and payment windows."},{type:"loyalty",label:"Vida Points",hint:"Points earned, tier changes, and rewards."},{type:"price_drop",label:"Price drops",hint:"When something you viewed gets cheaper."},{type:"promo",label:"Promotions",hint:"Sales, codes, and limited offers."},{type:"account",label:"Account & security",hint:"Sign-in alerts and important account changes."},{type:"system",label:"System",hint:"Service notices and required updates."}],y="Install VidaPeps to your Home Screen (Share, then Add to Home Screen) to get notifications.";function H(){const{toast:i}=O(),[a,n]=p.useState("loading"),[l,r]=p.useState(!1),d=async()=>{if(!I()){n("unsupported");return}if(_()){n("install-required");return}if(V()==="denied"){n("blocked");return}const f=await B();n(f?"enabled":"not-enabled")};p.useEffect(()=>{d()},[]);const c=async()=>{r(!0);const b=await L();if(r(!1),b.ok){i({title:"Notifications enabled",description:"This device is set up to receive alerts."}),n("enabled");return}const f={denied:"Permission was blocked. Re-enable notifications for this site in your browser settings.","not-configured":"Notifications are not available right now. Please try again later.","save-failed":"We couldn't save your subscription. Please try again.","push-service-error":"Your browser's push service refused the request. This often happens in Brave or with strict privacy/ad-blocking settings - try Chrome, Edge, or Firefox, or allow Google services for push.",unsupported:"This browser doesn't support push notifications.","install-required":y};b.reason==="denied"&&n("blocked"),i({title:"Couldn't enable notifications",description:f[b.reason]??"Please try again.",variant:"destructive"})},u=async()=>{r(!0),await q(),r(!1),n("not-enabled"),i({title:"Notifications turned off",description:"This device will stop receiving alerts."})};let t=m,s={label:"Not enabled",variant:"neutral"},o=null,h=null;a==="loading"?o=e.jsx(g,{className:"h-10 w-full rounded-xl"}):a==="unsupported"?(t=F,s={label:"Unavailable",variant:"neutral"},o=e.jsx("p",{className:"text-sm text-ink-2",children:"This browser doesn't support push notifications. You can still see every alert in your inbox on this page and in the bell menu."})):a==="install-required"?(t=$,s={label:"Install required",variant:"gold"},o=e.jsx("p",{className:"text-sm text-ink-2",children:y})):a==="blocked"?(t=R,s={label:"Blocked",variant:"neutral"},o=e.jsx("p",{className:"text-sm text-ink-2",children:"Notifications are blocked for this site. To turn them back on, open your browser's site settings for VidaPeps and allow notifications, then return here."})):a==="enabled"?(t=z,s={label:"Enabled",variant:"mint"},o=e.jsx("p",{className:"text-sm text-ink-2",children:"This device is set up to receive push notifications. Choose what you hear about below."}),h=e.jsx(v,{variant:"ghost",size:"sm",onClick:u,disabled:l,"data-testid":"push-disable",children:l?"Turning off…":"Turn off on this device"})):(t=m,s={label:"Not enabled",variant:"neutral"},o=e.jsx("p",{className:"text-sm text-ink-2",children:"Turn on push notifications to get order, shipping, and restock alerts on this device."}),h=e.jsx(v,{variant:"primary",size:"sm",onClick:c,disabled:l,"data-testid":"push-enable",children:l?"Enabling…":"Enable on this device"}));const k=t;return e.jsx(j,{icon:k,overline:"This device",title:"Push notifications",sub:"Push alerts are tied to the browser or installed app you enable them in.",action:a==="loading"?void 0:e.jsx(A,{variant:s.variant,children:s.label}),"data-testid":"card-push-device",children:e.jsxs("div",{className:"space-y-3",children:[o,h?e.jsx("div",{children:h}):null]})})}
1function Y({type:i,label:a,hint:n,prefs:l,onToggle:r,pending:d}){const c=l?.find(s=>s.type===i),u=c?c.pushEnabled:!0,t=c?c.inboxEnabled:!0;return e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 rounded-xl bg-bone px-3 py-3","data-testid":`pref-row-${i}`,children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-sm font-semibold text-ink",children:a}),e.jsx("p",{className:"mt-0.5 text-caption text-ink-3",children:n})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("span",{className:"text-overline uppercase tracking-wide text-ink-3","aria-hidden":"true",children:"Inbox"}),e.jsx(x,{checked:t,disabled:d,onCheckedChange:s=>r(i,"inboxEnabled",s),"aria-label":`${a} inbox notifications`,"data-testid":`pref-${i}-inbox`})]}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("span",{className:"text-overline uppercase tracking-wide text-ink-3","aria-hidden":"true",children:"Push"}),e.jsx(x,{checked:u,disabled:d,onCheckedChange:s=>r(i,"pushEnabled",s),"aria-label":`${a} push notifications`,"data-testid":`pref-${i}-push`})]})]})]})}function ee(){const{isAuthenticated:i,isLoading:a}=N(),[,n]=w();p.useEffect(()=>{!a&&!i&&n("/login")},[a,i,n]),p.useEffect(()=>{P()},[]);const{data:l,isLoading:r}=S(i),d=T();if(!i)return null;const c=l?.preferences,u=(t,s,o)=>{d.mutate({type:t,[s]:o})};return e.jsxs(e.Fragment,{children:[e.jsx(W,{}),e.jsx(C,{className:"pb-8 pt-6 md:pb-12",children:e.jsx("div",{className:"mx-auto max-w-3xl",children:e.jsxs(D,{children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"font-display text-t1 text-ink",children:"Notifications"}),e.jsx("p",{className:"mt-1 text-body text-ink-2",children:"Choose how VidaPeps keeps you posted about your orders, the Club, and rewards."})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(H,{}),e.jsx(j,{icon:m,overline:"Preferences",title:"What you get notified about",sub:"Push delivers to your devices. Inbox keeps a copy in your notification list.","data-testid":"card-preferences",children:r?e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((t,s)=>e.jsx(g,{className:"h-16 w-full rounded-xl"},s))}):e.jsx("div",{className:E("space-y-2",d.isPending&&"opacity-90"),children:G.map(t=>e.jsx(Y,{type:t.type,label:t.label,hint:t.hint,prefs:c,onToggle:u,pending:d.isPending},t.type))})})]})]})})})]})}export{ee as default};

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.