PageSourceSearch

https://printarex.com/assets/NotificationSettingsPage-DOZk9Dv9.js

js printarex.com collected 2026-10-02 06:28:49 UTC 13,869 bytes, 16 lines download raw bytes

1import{c as N,u as R,a as V,b as h,h as $,Y as S,j as e,B as u,M as j,ck as r,I as E,t as _,S as c}from"./index-COb3BWG8.js";import{L as b}from"./label-DNJsNNpl.js";import{S as C,a as A,b as U,c as T,d as P}from"./select-Y1pMYI5s.js";import{w as B,x as K,y as Y}from"./returns-CNCTRRtN.js";import{B as o}from"./bell-Dyv3Q0M1.js";import{C as Q}from"./circle-alert-CCGVUS_b.js";import{L as q}from"./loader-circle-OXwY4kRz.js";import{S as H}from"./save-D3i9k1oF.js";import{S as M}from"./smartphone-C_rdlJMT.js";import{C as I}from"./clock-BjT2jRP1.js";import{u as G}from"./useMutation-BQY-xsoU.js";import"./index-CD_9dLLA.js";import"./useIsomorphicLayoutEffect-D8rpVvO2.js";/**
2 * @license lucide-react v0.468.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const X=N("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
7 * @license lucide-react v0.468.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const J=N("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
12 * @license lucide-react v0.468.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const W=N("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]),Z=[{key:"OrderUpdates",label:"Order Updates",description:"Updates about your orders and shipments"},{key:"PaymentUpdates",label:"Payment Updates",description:"Payment confirmations and billing alerts"},{key:"SubscriptionUpdates",label:"Subscription",description:"Subscription changes and renewals"},{key:"SupportUpdates",label:"Support",description:"Responses to your support tickets"},{key:"SystemUpdates",label:"System Alerts",description:"Important system announcements"},{key:"Marketing",label:"Marketing",description:"Promotions, news, and special offers"}],ee=[{value:"UTC",label:"UTC"},{value:"America/New_York",label:"Eastern Time (ET)"},{value:"America/Chicago",label:"Central Time (CT)"},{value:"America/Denver",label:"Mountain Time (MT)"},{value:"America/Los_Angeles",label:"Pacific Time (PT)"},{value:"Europe/London",label:"London (GMT)"},{value:"Europe/Paris",label:"Paris (CET)"},{value:"Asia/Tokyo",label:"Tokyo (JST)"},{value:"Asia/Shanghai",label:"Shanghai (CST)"},{value:"Australia/Sydney",label:"Sydney (AEST)"}],se=()=>e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-2xl p-6 border border-slate-200 dark:border-slate-700",children:[e.jsx(c,{className:"h-6 w-48 mb-4"}),e.jsx("div",{className:"space-y-4",children:[1,2,3].map(i=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{className:"h-4 w-32"}),e.jsx(c,{className:"h-6 w-12 rounded-full"})]},`skeleton-${i}`))})]}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-2xl p-6 border border-slate-200 dark:border-slate-700",children:[e.jsx(c,{className:"h-6 w-48 mb-4"}),e.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4,5,6].map(i=>e.jsx(c,{className:"h-10 w-full"},`skeleton-${i}`))})]})]}),ue=()=>{const i=R(a=>a.user),{locale:L}=V(),t=a=>_(a,L),[f,y]=h.useState(!1),[F,g]=h.useState({}),{data:n,loading:O,error:D,refetch:k}=$(B,{variables:{userId:(i==null?void 0:i.id)||""},skip:!(i!=null&&i.id)}),[z,{loading:m}]=G(K,{onCompleted:()=>{S.success(t("Notification preferences saved")),y(!1),k()},onError:a=>{S.error(`${t("Failed to save preferences")}: ${a.message}`)}});h.useEffect(()=>{n!=null&&n.myNotificationPreferences&&g(n.myNotificationPreferences)},[n]);const s=F,l=(a,x)=>{g(p=>({...p,[a]:x})),y(!0)},v=()=>
16{i!=null&&i.id&&z({variables:{userId:i.id,input:{emailEnabled:s.emailEnabled,emailOrderUpdates:s.emailOrderUpdates,emailPaymentUpdates:s.emailPaymentUpdates,emailSubscriptionUpdates:s.emailSubscriptionUpdates,emailMarketing:s.emailMarketing,emailSupportUpdates:s.emailSupportUpdates,pushEnabled:s.pushEnabled,pushOrderUpdates:s.pushOrderUpdates,pushPaymentUpdates:s.pushPaymentUpdates,pushSubscriptionUpdates:s.pushSubscriptionUpdates,pushMarketing:s.pushMarketing,pushSupportUpdates:s.pushSupportUpdates,inAppEnabled:s.inAppEnabled,inAppOrderUpdates:s.inAppOrderUpdates,inAppPaymentUpdates:s.inAppPaymentUpdates,inAppSubscriptionUpdates:s.inAppSubscriptionUpdates,inAppSupportUpdates:s.inAppSupportUpdates,inAppSystemUpdates:s.inAppSystemUpdates,soundEnabled:s.soundEnabled,emailDigestFrequency:s.emailDigestFrequency,quietHoursEnabled:s.quietHoursEnabled,quietHoursStart:s.quietHoursStart||void 0,quietHoursEnd:s.quietHoursEnd||void 0,quietHoursTimezone:s.quietHoursTimezone}}})};return O?e.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[e.jsxs("h1",{className:"text-2xl font-bold text-slate-900 dark:text-white flex items-center gap-3 mb-6",children:[e.jsx(o,{className:"h-7 w-7 text-primary"}),t("Notification Settings")]}),e.jsx(se,{})]}):D?e.jsx("div",{className:"p-6 max-w-4xl mx-auto",children:e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-2xl p-8 border border-slate-200 dark:border-slate-700 text-center",children:[e.jsx(Q,{className:"h-12 w-12 text-red-400 mx-auto mb-3"}),e.jsx("p",{className:"text-slate-600 dark:text-slate-400",children:t("Failed to load notification preferences")}),e.jsx(u,{variant:"outline",className:"mt-4",onClick:()=>k(),children:t("Try Again")})]})}):e.jsxs("div",{className:"p-6 max-w-4xl mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("h1",{className:"text-2xl font-bold text-slate-900 dark:text-white flex items-center gap-3",children:[e.jsx(o,{className:"h-7 w-7 text-primary"}),t("Notification Settings")]}),f&&e.jsxs(u,{onClick:v,disabled:m,children:[m?e.jsx(q,{className:"h-4 w-4 me-2 animate-spin"}):e.jsx(H,{className:"h-4 w-4 me-2"}),t("Save Changes")]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-2xl p-6 border border-slate-200 dark:border-slate-700",children:[e.jsxs("h2",{className:"text-lg font-semibold text-slate-900 dark:text-white mb-4 flex items-center gap-2",children:[e.jsx(o,{className:"h-5 w-5"}),t("Notification Channels")]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(j,{className:"h-5 w-5 text-slate-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900 dark:text-white",children:t("Email Notifications")}),e.jsx("p",{className:"text-sm text-slate-500",children:t("Receive notifications via email")})]})]}),e.jsx(r,{checked:s.emailEnabled??!0,onCheckedChange:a=>l("emailEnabled",a)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(M,{className:"h-5 w-5 text-slate-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900 dark:text-white",children:t("Push Notifications")}),e.jsx("p",{className:"text-sm text-slate-500",children:t("Receive push notifications on your device")})]})]}),e.jsx(r,{checked:s.pushEnabled??!0,onCheckedChange:a=>l("pushEnabled",a)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(o,{className:"h-5 w-5 text-slate-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900 dark:text-white",children:t("In-App Notifications")}),e.jsx("p",{className:"text-sm text-slate-500",children:t("Show notifications within the app")})]})]}),e.jsx(r,{checked:s.inAppEnabled??!0,onCheckedChange:a=>l("inAppEnabled",a)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[s.soundEnabled?e.jsx(J,{className:"h-5 w-5 text-slate-500"}):e.jsx(W,{className:"h-5 w-5 text-slate-500"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900 dark:text-white",children:t("Notification Sounds")}),e.jsx("p",{className:"text-sm text-slate-500",children:t("Play sound when notifications arrive")})]})]}),e.jsx(r,{checked:s.soundEnabled??!0,onCheckedChange:a=>l("soundEnabled",a)})]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-2xl p-6 border border-slate-200 dark:border-slate-700",children:[e.jsx("h2",{className:"text-lg font-semibold text-slate-900 dark:text-white mb-4",children:t("Channel Preferences")}),e.jsx("p",{className:"text-sm text-slate-500 mb-4",children:t("Choose which notification types you want to re
16ceive for each channel.")}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-slate-200 dark:border-slate-700",children:[e.jsx("th",{className:"text-start py-3 px-4 font-medium text-slate-600 dark:text-slate-300",children:t("Category")}),e.jsxs("th",{className:"text-center py-3 px-4 font-medium text-slate-600 dark:text-slate-300",children:[e.jsx(j,{className:"h-4 w-4 mx-auto"}),e.jsx("span",{className:"text-xs",children:t("Email")})]}),e.jsxs("th",{className:"text-center py-3 px-4 font-medium text-slate-600 dark:text-slate-300",children:[e.jsx(M,{className:"h-4 w-4 mx-auto"}),e.jsx("span",{className:"text-xs",children:t("Push")})]}),e.jsxs("th",{className:"text-center py-3 px-4 font-medium text-slate-600 dark:text-slate-300",children:[e.jsx(o,{className:"h-4 w-4 mx-auto"}),e.jsx("span",{className:"text-xs",children:t("In-App")})]})]})}),e.jsx("tbody",{children:Z.map(a=>{const x=`email${a.key}`,p=`push${a.key}`,w=`inApp${a.key}`;return e.jsxs("tr",{className:"border-b border-slate-100 dark:border-slate-700/50",children:[e.jsxs("td",{className:"py-3 px-4",children:[e.jsx("p",{className:"font-medium text-slate-900 dark:text-white",children:t(a.label)}),e.jsx("p",{className:"text-xs text-slate-500",children:t(a.description)})]}),e.jsx("td",{className:"text-center py-3 px-4",children:a.key!=="SystemUpdates"&&e.jsx(r,{checked:s[x]??!0,onCheckedChange:d=>l(x,d),disabled:!s.emailEnabled})}),e.jsx("td",{className:"text-center py-3 px-4",children:e.jsx(r,{checked:s[p]??!0,onCheckedChange:d=>l(p,d),disabled:!s.pushEnabled})}),e.jsx("td",{className:"text-center py-3 px-4",children:e.jsx(r,{checked:s[w]??!0,onCheckedChange:d=>l(w,d),disabled:!s.inAppEnabled})})]},a.key)})})]})})]}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-2xl p-6 border border-slate-200 dark:border-slate-700",children:[e.jsxs("h2",{className:"text-lg font-semibold text-slate-900 dark:text-white mb-4 flex items-center gap-2",children:[e.jsx(j,{className:"h-5 w-5"}),t("Email Digest")]}),e.jsx("p",{className:"text-sm text-slate-500 mb-4",children:t("Choose how frequently you receive email notification digests.")}),e.jsxs(C,{value:s.emailDigestFrequency||"INSTANT",onValueChange:a=>l("emailDigestFrequency",a),children:[e.jsx(A,{className:"w-[200px]",children:e.jsx(U,{})}),e.jsx(T,{children:["INSTANT","DAILY","WEEKLY","NEVER"].map(a=>e.jsx(P,{value:a,children:t(Y(a))},a))})]})]}),e.jsxs("div",{className:"bg-white dark:bg-slate-800 rounded-2xl p-6 border border-slate-200 dark:border-slate-700",children:[e.jsxs("h2",{className:"text-lg font-semibold text-slate-900 dark:text-white mb-4 flex items-center gap-2",children:[e.jsx(X,{className:"h-5 w-5"}),t("Quiet Hours")]}),e.jsx("p",{className:"text-sm text-slate-500 mb-4",children:t("Pause notifications during specific hours.")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-slate-900 dark:text-white",children:t("Enable Quiet Hours")}),e.jsx("p",{className:"text-sm text-slate-500",children:t("No notifications during the specified time period")})]}),e.jsx(r,{checked:s.quietHoursEnabled??!1,onCheckedChange:a=>l("quietHoursEnabled",a)})]}),s.quietHoursEnabled&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 pt-4 border-t border-slate-100 dark:border-slate-700",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(b,{htmlFor:"start-time",className:"flex items-center gap-2",children:[e.jsx(I,{className:"h-4 w-4"}),t("Start Time")]}),e.jsx(E,{id:"start-time",type:"time",value:s.quietHoursStart||"22:00",onChange:a=>l("quietHoursStart",a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(b,{htmlFor:"end-time",className:"flex items-center gap-2",children:[e.jsx(I,{className:"h-4 w-4"}),t("End Time")]}),e.jsx(E,{id:"end-time",type:"time",value:s.quietHoursEnd||"08:00",onChange:a=>l("quietHoursEnd",a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(b,{htmlFor:"timezone",children:t("Timezone")}),e.jsxs(C,{value:s.quietHoursTimezone||"UTC",onValueChange:a=>l("quietHoursTimezone",a),children:[e.jsx(A,{id:"timezone",children:e.jsx(U,{})}),e.jsx(T,{children:ee.map(a=>e.jsx(P,{value:a.value,children:t(a.label)},a.value))})]})]})]})]})]}),f&&e.jsx("div",{className:"md:hidden",children:e.jsxs(u,{onClick:v,disabled:m,className:"w-full",children:[m?e.jsx(q,{className:"h-4 w-4 me-2 animate-spin"}):e.jsx(H,{className:"h-4 w-4 me-2"}),t("Save Changes")]})})]})]})};export{ue as NotificationSettingsPage,ue 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.