1"use strict";(this.webpackChunkFusion_components=this.webpackChunkFusion_components||[]).push([[8927],{88505:function(e,t,n){n.r(t);var r=n(86780),s=n.n(r),l=n(87983),a=n.n(l),i=n(40809),o=n(78299),c=n(69167),u=n(58758),d=n(68771),m=n(80918),b=n(20484),p=n(41697),g=n(18109),h=n(11),f=n(20),w=n(40761),y=n(12675),_=n(2912),x=n(85349);function k(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function j(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?k(Object(n),!0).forEach(function(t){v(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):k(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function v(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const N=(0,y.A)("[NewsletterUnsubscribeForm]"),C={messaging:s().string};function S({messaging:e=""}){const{support:t}=a()("tgam"),n=(0,m.Nw)("/svgs/radio-on.svg",!0),r=(0,g.A)(),s=(0,p.A)(),{user:l}=(0,b.J)(),y=(0,d.e)(),{sendAmplitudeEvent:k}=(0,u.l)(),[v,C]=(0,i.useState)({email:null,newsletterName:null,newsletterCode:null,groupCode:null,unsubToken:null}),[S,O]=(0,i.useState)({unknown:null,newsletter:null,marketing:null,all:null}),[T,U]=(0,i.useState)(""),[A,P]=(0,i.useState)({text:"Please wait",disabled:!0}),[E,F]=(0,i.useState)({text:"Sign Up",disabled:!1}),[$,Z]=(0,i.useState)({form:!0,error:!1,sub:!1,unsub:!1,resub:!1}),[z,q]=(0,i.useState)("");(0,i.useEffect)(()=>{v.email&&(0,f.Jz)(v.email).then(e=>{q(e),P({text:"Unsubscribe",disabled:!1})}).catch(e=>{N.error("email decrypt failed:",e),Z(e=>j(j({},e),{},{error:!0})),P({text:"Error",disabled:!0})})},[v.email]),(0,i.useEffect)(()=>{const e=new URLSearchParams(window.location.search),t=(e.get("emailAddress")??e.get("amp;emailAddress"))?.trim(),n=e.get("newsletterName")??e.get("amp;newsletterName"),r=e.get("newsletterCode")??e.get("amp;newsletterCode"),s=e.get("groupCode")??e.get("amp;groupCode"),l=e.get("unsub_token")??e.get("amp;unsub_token"),a=[t,n,l].every(e=>!(0,w.ZS)(e)),i=a&&!(0,w.ZS)(r)&&(0,w.ZS)(s),o=a&&(0,w.ZS)(r)&&!(0,w.ZS)(s),c=!(0,w.ZS)(t)&&!(0,w.ZS)(l)&&(0,w.ZS)(r)&&(0,w.ZS)(s),u={unknown:!i&&!o&&!c,newsletter:i,marketing:o,all:c};N.info("params:",u),O(u);const d={email:t,newsletterName:(0,f.LO)(n),newsletterCode:r,groupCode:s,unsubToken:l};N.info("scenario:",d),C(d)},[]);const D=$.form&&e.length?"* ":"",I=S.newsletter?v.newsletterCode:v.groupCode,M="all",G=T===M?"all":`${I} - ${v.newsletterName}`.toLowerCase(),L=(0,i.useCallback)(e=>{N.info("radio change event:",e),U(e.target.value)},[]),R=(0,i.useCallback)(e=>{N.info("sub click event:",e),I&&z&&(F({text:"Signing up...",disabled:!0}),(0,f.ZG)({newsletterCode:I,email:z}).then(()=>{y({event:"newsletterEvent",newsletterEvent:{action:"subscribe",name:G,type:"resubscribe",frequency:null}}),k({event:h.zc.newsletterSignup,data:{"newsletter frequency":null,"newsletter name":G}}),Z(e=>j(j({},e),{},{error:!1,resub:!1,sub:!0,unsub:!1})),F({text:"Signed Up",disabled:!0})}).catch(e=>{N.error("re-subscribe error:",e),Z(e=>j(j({},e),{},{error:!0})),F({text:"Sign Up",disabled:!1})}))},[z,G,I,k,y]),J=(0,i.useCallback)(()=>(0,f.U9)({emailAddress:z,unsubToken:v.unsubToken}),[z,v.unsubToken]),Y=(0,i.useCallback)(()=>(0,f.hM)({emailAddress:z,unsubToken:v.unsubToken,marketingGroupCodes:I}),[z,v.unsubToken,I]),B=(0,i.useCallback)(()=>(0,f.vh)({email:z,unsubToken:v.unsubToken,newsletterCode:I}),[z,v.unsubToken,I]),Q=T===M?J:S.marketing?Y:S.newsletter?B:null,H=S.newsletter&&T!==M,K=(0,i.useCallback)(e=>{e.preventDefault(),Q&&(P({text:"Unsubscribing...",disabled:!0}),Q().then(()=>{y({event:"newsletterEvent",newsletterEvent:{action:"unsubscribe",name:G,type:"simple"}}),k({event:h.zc.newsletterUnsubscribe,data:{"newsletter frequency":null,"newsletter name":G,"click feature":"end-of-article-newsletter"}}),Z(e=>j(j({},e),{},{form:!1,error:!1,unsub:!0,resub:H}))}).catch(e=>{N.error("unsubscribe error:",e),Z(e=>j(j({},e),{},{form:!0,error:!0,unsub:!1}))}).then(()=>{P({text:"Unsubscribe",disabled:!1})}))},[H,G,k,y,Q]);return(0,x.jsxs)("div",{className:"news-unsub-form",children:[!1===S.unknown?(0,x.jsxs)(x.Fragment,{children:[$.error?(0,x.jsx)("p",{className:"c-form__global-error",children:"There was a problem processing your request. Please try again or c
1ontact the support email."}):null,$.sub?(0,x.jsx)("p",{className:"c-static-page__text",children:(0,x.jsxs)("strong",{children:[z," has been subscribed to ",v.newsletterName,"."]})}):null,$.unsub?(0,x.jsx)("p",{className:"c-static-page__text",children:(0,x.jsxs)("strong",{children:[z," has been unsubscribed from"," ",T===M?"all Globe and Mail email":v.newsletterName,"."]})}):null,$.resub?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)("p",{className:"c-static-page__text",children:["If this was an error, you may sign up immediately to ",v.newsletterName," by clicking the button below:"]}),(0,x.jsx)(o.Ay,{disabled:E.disabled,onClick:R,type:"button",variant:"outline",children:E.text}),(0,x.jsx)("p",{className:"c-utility-body--secondary__text",children:"Your interest in this newsletter may be used by The Globe and Mail to deliver more relevant content, advertising and email promotions. You can unsubscribe at any time."}),(0,x.jsxs)("p",{className:"c-utility-body--micetype__text",children:["By signing up, you will be subject to our"," ",(0,x.jsx)("a",{href:"/privacy-terms/terms-and-conditions/",className:"c-utility-body--micetype__link",children:"Terms and Conditions"}),". See also our"," ",(0,x.jsx)("a",{href:"/privacy-terms/privacy-policy/",className:"c-utility-body--micetype__link",children:"Privacy Policy"})," ","and"," ",(0,x.jsx)("a",{href:`${t.helpcentre}article/Email-newsletters`,className:"c-utility-body--micetype__link",children:"FAQs"}),"."]})]}):null,$.form?(0,x.jsx)("p",{className:"c-static-page__text",children:(0,x.jsxs)("strong",{children:["To unsubscribe ",z,", please choose one of the following*:"]})}):null,$.form?(0,x.jsxs)("form",{className:"c-form",action:"#","aria-live":"polite",onSubmit:K,children:[(0,x.jsxs)("div",{className:"c-form__field c-form__field--radios",children:[S.newsletter||S.marketing?(0,x.jsxs)("div",{className:"c-form__field c-form__field--radio",children:[(0,x.jsx)(c.sx,{id:"radio-1",name:"radio-group-1",type:"radio",className:"c-form__control c-form__control--radio",checked:T===I,value:I,onChange:L,"data-icon-url":n}),(0,x.jsx)("label",{htmlFor:"radio-1",className:"c-form__label c-form__label--pointer",children:S.newsletter?(0,x.jsxs)(x.Fragment,{children:["Unsubscribe me from the ",v.newsletterName," newsletter"]}):(0,x.jsxs)(x.Fragment,{children:["Unsubscribe me from ",v.newsletterName]})})]}):null,(0,x.jsxs)("div",{className:"c-form__field c-form__field--radio",children:[(0,x.jsx)(c.sx,{id:"radio-2",name:"radio-group-1",type:"radio",className:"c-form__control c-form__control--radio",checked:T===M,value:M,onChange:L,"data-icon-url":n}),(0,x.jsx)("label",{htmlFor:"radio-2",className:"c-form__label c-form__label--pointer",children:"Unsubscribe me from all Globe and Mail emails, including all newsletters and investing alerts"})]})]}),(0,x.jsx)("div",{className:"c-form__field c-form__field--button",children:(0,x.jsx)(o.Ay,{disabled:A.disabled||!T,theme:"red",type:"submit",children:A.text})})]}):null]}):null,S.unknown?(0,x.jsxs)(x.Fragment,{children:[l.anonymous?(0,x.jsxs)("div",{children:[(0,x.jsxs)("p",{className:"c-static-page__text",children:["To manage your newsletter preferences,"," ",(0,x.jsx)("a",{href:s,className:"c-static-page__link",children:"log in"})," ","and go to My Account - Newsletters."]}),(0,x.jsx)(o.Ay,{className:"mr-16",href:s,children:"Log in"}),(0,x.jsx)(o.Ay,{href:r,children:"Register"})]}):null,l.loggedIn?(0,x.jsx)("div",{children:(0,x.jsxs)("p",{className:"c-static-page__text",children:["To manage your newsletter preferences please go to"," ",(0,x.jsx)("a",{href:"/newsletters/",className:"c-static-page__link",children:"My Account - Newsletters."})]})}):null]}):null,(0,x.jsx)(_.A,{as:"p",className:"c-static-page__text mt-32",content:`${D}${e}`,id:"raw-html-newsletter-unsubscribe-form",staticOnly:!1})]})}S.displayName="NewsletterUnsubscribeForm",S.propTypes=C,t.default=S},69167:function(e,t,n){n.d(t,{Sc:function(){return a},sx:function(){return i}});var r=n(21143),s=n.n(r),l=n(30137);s().select.withConfig({displayName:"inputs__Select",componentId:"sc-1hx7mqz-0"})(['&&&{background-image:url("','");}'],e=>e["data-icon-url"]);const a=s().input.withConfig({displayName:"inputs__Checkbox",componentId:"sc-1hx7mqz-1"})(['&&&{background-image:url("','");background-size:auto;}'],e=>e["data-icon-url"]),i=(s().input.attrs(e=>({$iconChecked:e.$iconChecked,$iconUnchecked:e.$iconUnchecked})).withConfig({displayName:"inputs__StyledCheckbox",componentId:"sc-1hx7mqz-2"})(["width:",";height:",';appearance:none;border:none;background-size:auto;background-position:center;background-repeat:no-repeat;background-image:url("','");&:checked{background-image:url("','");}&:focus{outline:none;}&:focus-visible{outline:2px solid var(--color-alias-focus-ring-default);}'],(0,l.D0)(20),(0,l.D0)(20),e=>e.$iconUnchecked,e=>e.$iconChecked),s().input.withConfig({displayName:"inputs__Radio",componentId:"sc-1hx7mqz-3"})(['&&&{background-image:url("','");}'],e=>e["data-icon-url"]))}}]);
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.