PageSourceSearch

https://www.straitstimes.com/assets/NewsletterUnsubscribePage-BlWhhCeG.js

js straitstimes.com collected 2026-09-24 07:43:19 UTC 5,842 bytes, 1 lines download raw bytes

1import{A as e,I as t,j as n,k as r}from"./chunk-KS7C4IRE-DIkipulk.js";import{t as i}from"./jsx-runtime-CsaOnxTR.js";import{$i as a,$r as o,Ba as s,E as c,Fn as l,Gi as u,Ha as d,Na as f,Pr as p,Qr as m,S as h,Va as g,_,aa as v,b as y,ea as b,fa as x,g as S,ia as C,m as w,ni as T,ta as E,zn as D}from"./Elements-BJgAzht_.js";import{t as O}from"./withFeatureGate-C6wb3ko-.js";import{n as k}from"./ssr-CJ2n4bG3.js";import{t as A}from"./PageLayout-VSFjvclv.js";var j=t(n(),1),M=i(),N=e(function(){let[e,t]=(0,j.useState)(`DEFAULT`),[n,i]=(0,j.useState)(``),[k,N]=(0,j.useState)(null),[I,L]=(0,j.useState)(500),R=(0,j.useRef)(null),[z,B]=(0,j.useState)(!0),V=(0,j.useRef)(null),{target:H,identifier:U}=r(),W=O(f.CONSENT_UNSUBSCRIBE,async()=>{if(!(!U||!H||!R.current))try{let e=await p(`consent/withdraw`,`POST`,{identifier:U,target:R.current.consent_name,legacy:y(H)===`LEGACY`});e.success?(B(!1),i(e.identifier),L(200)):(B(!1),L(500))}catch{B(!1),L(500)}}),G=O(f.CONSENT_UNSUBSCRIBE,async()=>{if(!(!U||!H)){y(H)===`LEGACY`?(R.current=_(H),N(R.current),V.current=`/newsletter-manage/${U}/1`):(R.current=S(H),N(R.current),V.current=`/newsletter-manage/${U}`);try{let e=await p(`consent/legacy`,`POST`,{identifier:U,legacy:y(H)===`LEGACY`});e.success?w(e.data.consents,`active`).filter(e=>e.consent_name===R.current?.consent_name).length<=0?(L(500),B(!1)):await W():(B(!1),L(500))}catch{B(!1),L(500)}}}),K=(0,j.useRef)(!1);return(0,j.useEffect)(()=>{!U||!H||h(H)&&(K.current||(K.current=!0,G()))},[U,H,G]),(0,M.jsx)(A,{children:(0,M.jsxs)(D,{enabled:f.CONSENT_UNSUBSCRIBE,fallback:(0,M.jsx)(P,{}),children:[(0,M.jsx)(`div`,{className:s(`container sticky top-72 mt-10 right-00 h-00 z-1000`,e===`DEFAULT`?`hidden`:`block`),id:`newsletter-toast`,children:(0,M.jsx)(m,{type:e===o.SUCCESS?o.SUCCESS:e===o.ERROR?o.ERROR:o.INFORMATION,message:e===o.SUCCESS?c.TOAST_SUCCESS:e===o.ERROR?c.TOAST_FAILED:c.TOAST_NO_INTERNET,descriptionMessage:e===o.SUCCESS?c.TOAST_SUCCESS_DESCRIPTION:e===o.ERROR?c.TOAST_FAILED_DESCRIPTION:c.TOAST_NO_INTERNET_DESCRIPTION,duration:3e3,className:`absolute right-00 w-full tablet:w-fit tablet:mt-10`,handler:()=>{t(`DEFAULT`)}})}),(0,M.jsx)(`div`,{className:s(`container py-32`),"data-testid":`unsubscribe-container-test-id`,children:z?F():(0,M.jsx)(`div`,{className:s(`grid items-start self-stretch justify-center gap-32`),children:(0,M.jsxs)(j.Suspense,{fallback:F(),children:[(0,M.jsxs)(`div`,{className:s(`col-span-full tablet:col-start-3 tablet:col-end-11 desktop:col-start-6 desktop:col-end-20 flex flex-col items-center justify-center self-stretch gap-16 desktop:gap-24`),children:[(0,M.jsxs)(`div`,{className:s(`flex gap-08`),children:[(0,M.jsx)(`div`,{className:s(`items-center justify-center self-stretch p-2`,I===200?`flex`:`hidden`),children:(0,M.jsx)(T,{iconName:g.STATUS_SUCCESS_FILLED,iconWidth:d.LARGE,className:s(`status-success-icon`)})}),(0,M.jsx)(u,{category:a.TITLE,size:b.XL,style:E.BOLD,className:s(`text-primary`),children:I===200?`Unsubscribed successfully`:`You're already unsubscribed`})]}),(0,M.jsx)(l,{src:k?.thumbnail,className:s(`rounded-xl`),wrapperClassName:`w-full items-center justify-center self-stretch`}),(0,M.jsx)(`div`,{className:`flex items-start justify-center w-full text-center gap-04`,children:I===200?(0,M.jsx)(M.Fragment,{children:(0,M.jsxs)(u,{category:a.LABEL,size:b.LG,style:E.REGULAR,className:s(`text-secondary`),children:[`We've removed\xA0`,(0,M.jsx)(u,{category:a.LABEL,size:b.LG,style:E.SEMIBOLD,className:s(`inline-flex`),element:`span`,children:x(n)}),`\xA0from the\xA0`,(0,M.jsx)(u,{category:a.LABEL,size:b.LG,style:E.SEMIBOLD,className:s(`inline-flex`),element:`span`,children:k===null?`Newsletter`:k.name})]})}):(0,M.jsx)(u,{category:a.LABEL,size:b.LG,style:E.REGULAR,className:s(`text-secondary`),children:`This email address has already been removed from our newsletter mailing list.`})}),(0,M.jsx)(`div`,{className:s(`self-stretch items-start justify-center`,I===200?`flex`:`hidden`),children:(0,M.jsxs)(u,{category:a.LABEL,size:b.MD,style:E.REGULAR,className:s(`text-secondary inline-flex gap-04`),children:[`Made a mistake?`,(0,M.jsx)(C,{type:v.CUSTOM,url:`/newsletter-signup`,className:`link-default`,children:`Resubscribe`})]})})]}),(0,M.jsxs)(`div`,{className:s(`flex gap-16 items-center justify-center self-stretch`,`flex-col desktop:flex-row`,`col-span-full tablet:col-start-4 tablet:col-end-10 desktop:col-start-6 desktop:col-end-20`),children:[(0,M.jsx)(C,{url:`/newsletter-signup`,className:s(`layer-one border-default border py-12 px-24 rounded-lg w-full items-center justify-center`),t
1ype:v.CUSTOM,children:(0,M.jsx)(u,{category:a.LABEL,size:b.LG,style:E.SEMIBOLD,children:`Browse newsletters`})}),(0,M.jsx)(C,{url:V.current??`/newsletter-manage`,className:s(`button-primary py-12 px-24 rounded-lg text-inverse w-full items-center justify-center`),type:v.CUSTOM,children:(0,M.jsx)(u,{category:a.LABEL,size:b.LG,style:E.SEMIBOLD,children:`Manage subscriptions`})})]})]})})})]})})}),P=()=>(0,M.jsxs)(`div`,{className:`h-200 container`,children:[`You are not subscribed to any ST Newsletters at the moment. Click`,` `,(0,M.jsx)(C,{url:`newsletter-signup`,children:`here`}),` to subscribe.`]}),F=()=>(0,M.jsx)(M.Fragment,{children:(0,M.jsx)(`div`,{className:`col-span-4 tablet:col-span-12 desktop:col-span-full w-full flex items-center justify-center h-524`,children:(0,M.jsx)(T,{iconName:g.LOADER,className:`icon-disabled`,iconWidth:`28`,symmetric:!0})})});async function I(e){let t=await k(e);if(!t.context)return console.error(`Error occurred during client-side routing for mbo, returning server Loader Data`),await e.serverLoader();let n=t.context;return(!n||typeof n!=`object`||!(`payload`in n)||typeof n.payload!=`object`)&&console.error(`Client Loader: fetchContext() returned an invalid payload for home`),n}export{I as clientLoader,N 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.