PageSourceSearch

https://id.wisepops.com/assets/push-D-L9L3kJ.js

js wisepops.com collected 2026-10-02 02:16:36 UTC 8,458 bytes, 67 lines download raw bytes

1import{J as se,g as q,f as U,a1 as j,a2 as v,a8 as te,r as n,e as ae,a as $,w as ne,a9 as ie,e7 as oe,j as e,c as N,aC as re,q as i,h as w,c7 as ce,ag as ue,dG as le,e8 as de,e9 as pe,b as ge,ea as be,eb as he,aM as me,ec as fe,n as ye,dQ as xe,O as A,ad as Se,ae as Ce,P as we}from"./index-Bk9gjvYU.js";import{c as We}from"./useTableManagement-CUBc54yh.js";import{W as Pe}from"./WebsiteAlertBanner-Bhe8YIkt.js";import{F as _e,M as Me,C as je}from"./CampaignTable-BfIXuHSy.js";import"./CampaignThumbnail-CcAXbZmU.js";import"./DataTable-CJdSrEAa.js";import"./Multi-CziV2FYy.js";import"./Tag-SKF_uW8K.js";import"./SearchInput-yD90E6OE.js";import"./useInvalidateCampaigns-EnpGolmw.js";import"./index-CLjZYYJj.js";import"./ButtonsToggleField-kA3Ii3eu.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},t=new Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="c60bd3c5-6823-44d0-b049-06d470730d7d",s._sentryDebugIdIdentifier="sentry-dbid-c60bd3c5-6823-44d0-b049-06d470730d7d")}catch{}})();const ve=U(`
2    query WebsitePushSubscriberCount($id: Int!) {
3        website(id: $id) {
4            push_subscriber_count
5        }
6    }
7`),Te=6e4,Ee=s=>[j.WEBSITES,v.Query.WebsitePushSubscriberCount,s],Ie=(s,t)=>se({queryKey:Ee(s),queryFn:async({signal:o})=>(await q.request({document:ve,variables:s,signal:o})).website,staleTime:Te,...t}),ke=s=>{const t=te(),o=n.useCallback(a=>{t.setQueryData([j.WEBSITES,v.Query.WebsitePushSettings,{id:a.id}],c=>{if(c!==void 0)return{...c,settings:{push:{enabled:a.enabled}}}})},[t]);return ae({...s,mutationFn:async a=>{o(a);const{updateWebsite:c}=await q.request({document:U(`
8                    mutation UpdateWebsitePushSettings(
9                        $id: Int!
10                        $enabled: Boolean
11                    ) {
12                        updateWebsite(
13                            id: $id
14                            input: { settings: { push: { enabled: $enabled } } }
15                        ) {
16                            __typename
17                            ... on WebsiteType {
18                                id
19                                settings {
20                                    push {
21                                        enabled
22                                    }
23                                }
24                            }
25                        }
26                    }
27                `),variables:a});return t.invalidateQueries({queryKey:[j.WEBSITES,v.Query.WebsiteInstallation,{id:a.id}]}),c}})},Le="https://support.wisepops.com/en/articles/10021111-install-web-push-module",Ae=i.div`
28    align-items: center;
29    background: var(--color-grayscale-2);
30    border-radius: var(--space-sm);
31    display: flex;
32    gap: var(--space-md);
33    justify-content: space-between;
34    padding: var(--space-md);
35`,Fe=i.div`
36    display: flex;
37    flex-direction: column;
38    gap: var(--space-xs);
39`,Qe=i.label`
40    ${w.style.Body}
41    cursor: pointer;
42    font-weight: 500;
43    width: fit-content;
44`,Re=i(w.Body)`
45    color: var(--color-grayscale-5);
46`,Be=()=>{const s=$(),t=ne(),o=n.useId(),{createToast:a}=ie(),{data:c,isPending:W}=oe({id:t??0},{enabled:typeof t=="number"}),d=c?.settings?.push?.enabled??!1,{mutate:p,isPending:m}=ke({onSuccess:(y,g)=>{a("success",g.enabled?s.formatMessage({id:"push_campaigns.toggle.enabled",description:"Web push toggle - enabled success message",defaultMessage:"Web push has been enabled on your website."}):s.formatMessage({id:"push_campaigns.toggle.disabled",description:"Web push toggle - disabled success message",defaultMessage:"Web push has been disabled on your website."}))}}),f=n.useCallback(()=>{t!==void 0&&p({id:t,enabled:!d})},[t,d,p]);return t===void 0?null:e.jsxs(Ae,{children:[e.jsxs(Fe,{children:[e.jsx(Qe,{htmlFor:o,children:s.formatMessage({id:"push_campaigns.toggle.label",description:"Web push toggle label",defaultMessage:"Allow Web push on my website."})}),e.jsxs(Re,{children:[s.formatMessage({id:"push_campaigns.toggle.setup_hint",description:"Web push toggle - reminder that the module has to be installed on the website",defaultMessage:"Visitors can only subscribe once the Web Push module is installed on your website."})," ",e.jsx(N,{href:Le,kind:"action",target:"_blank",children:s.formatMessage({id:"push_campaigns.toggle.setup_link",description:"Web push toggle - link to the module installation guide",defaultMessage:"Install the Web Push module"})})]})]}),e.jsx(re,{disabled:W,id:o,onChange:f,readOnly:m,value:d})]})},De=10,F=i(we)`
47    display: flex;
48    flex-direction: column;
49    gap: 24px;
50    padding: 24px;
51`,Q=i(w.H2)`
52    font-weight: 500;
53`,R=i.div`
54    align-items: baseline;
55    display: flex;
56    gap: 8px;
57`,B=i(w.Body)`
58    color: var(--color-text-secondary);
59`,D=i.header`
60    align-items: center;
61    display: flex;
62    justify-content: space-between;
63`,qe=i.div`
64    align-items: center;
65    display: flex;
66    gap: 8px;
67`,Ue=()=>{const s=$(),t=ce(),{website:o}=ue({strict:!1}),a=Number(o),c=le({id:a},{enabled:Number.isFinite(a)}),{data:W,isLoading:d}=Ie({id:a}),p=W?.push_subscriber_count??0,{page:m=1,search:f,statuses:y,sort:g,direction:P,format:T=pe.Absolute}=de.useSearch(),O=ge({strict:!1}),x=n.useMemo(()=>be(y),[y]),H=n.useMemo(()=>x.length>0?x:void 0,[x]),[b,E]=n.useState(!1),{data:h,isFetching:S,isError:K}=he({websiteId:a,channel:me.Push,page:m,perPage:De,search:f,states:H,includeMetrics:b,sort:g,direction:P});n.useEffect(()=>{h&&!S&&!b&&E(!0)},[h,S,b]),n.useEffect(()=>{E(!1)},[m,f,y,g,P]);const V=n.useCallback(r=>{t({to:".",search:l=>{const u={...l},L=fe(r);return L===void 0?delete u.statuses:u.statuses=L,delete u.page,u}})},[t]),G=n.useCallback((r,l)=>{t({to:".",search:u=>({...u,sort:r,direction:l,page:void 0})})},[t]),z=n.useCallback(r=>{t({to:".",search:l=>({...l,format:r})})},[t]),{selected:J,setSelected:_,handleSelectAll:I,handleUnselectAll:X}=We(),C=O.campaigns,k=n.useRef(C);n.useEffect(()=>{k.current!==void 0&&C===void 0&&_([]),k.current=C},[C,_]);const M=n.useCallback(r=>r.type==="campaign",[]),Y=n.useCallback((r,l)=>{const u=r.filter(M);I(u,l)},[I,M]),Z=S&&!b,ee=S&&b;return K?e.jsx(ye,{}):c.data?.is_template_source===!0?e.jsxs(e.Fragment,{children:[e.jsxs(F,{title:s.formatMessage({description:"Web push campaigns page website title",id:"page.title.push_campaigns",defaultMessage:"Web Push - Wisepops"}),children:[e.jsx(D,{children:e.jsx(R,{children:e.jsx(Q,{children:s.formatMessage({id:"push_campaigns.header",description:"Web push campaigns page header",defaultMessage:"Web Push"})})})}),e.jsx(xe,{description:s.formatMessage({id:"campaigns.team_template_website.notice.formats",description:"Notice body explaining team templates are unavailable for feed and web push",defaultMessage:"The Team templates website is a design space for building templates your team can reuse. Team templates aren't available for feed and web push campaigns yet."})})]}),e.jsx(A,{})]}):e.jsxs(e.Fragment,{children:[e.jsxs(F,{title:s.formatMessage({description:"Web push campaigns page website title",id:"page.title.push_campaigns",defaultMessage:"Web Push - Wisepops"}),children:[e.jsxs(D,{children:[e.jsxs(R,{children:[e.jsx(Q,{children:s.formatMessage({id:"push_campaigns.header",description:"Web push campaigns page header",defaultMessage:"Web Push"})}),d?e.jsx(B,{children:e.jsx(Se,{height:14,width:14})}):p>0&&e.jsx(B,{children:s.formatMessage({id:"push_campaigns.subscriber_count",description:"Subscriber count next to Web Push title",defaultMessage:"· {count} {count, plural, one {subscriber} other {subscribers}}"},{count:p})})]}),e.jsxs(qe,{children:[e.jsx(N,{to:"subscribers",children:s.formatMessage({id:"campaigns.push.subscribers.button",description:"Link on the push campaigns list page header that opens the subscribers list view",defaultMessage:"View subscribers"})}),e.jsx(Ce,{kind:"primary",size:"medium",to:"new",children:s.formatMessage({id:"push_campaigns.create_campaign",description:"Create campaign button",defaultMessage:"Create campaign"})})]})]}),e.jsx(Be,{}),e.jsx(Pe,{}),e.jsx(_e,{value:T,children:e.jsx(Me,{value:ee,children:e.jsx(je,{campaigns:h?.items??[],channel:"push",currentPage:h?.currentPage??1,direction:P,format:T,isRowSelectable:M,loading:Z,onAllSelect:Y,onFormatChange:z,onSelect:_,onSortChange:G,onStatusChange:V,onUnselectAll:X,selected:J,sort:g,statuses:x,totalPages:h?.lastPage??1,websiteId:a})})})]}),e.jsx(A,{})]})},es=Ue;export{es as component};

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.