1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4168],{3270:(e,t,r)=>{"use strict";r.d(t,{k5:()=>d});var n=r(7761),a={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},s=n.createContext&&n.createContext(a),o=["attr","size","title"];function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach(function(t){var n,a,s;n=e,a=t,s=r[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in n?Object.defineProperty(n,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[a]=s}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function d(e){return t=>n.createElement(u,l({attr:c({},e.attr)},t),function e(t){return t&&t.map((t,r)=>n.createElement(t.tag,c({key:r},t.attr),e(t.child)))}(e.child))}function u(e){var t=t=>{var r,{attr:a,size:s,title:i}=e,d=function(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r={};for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){if(t.indexOf(n)>=0)continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++)r=s[n],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(e,o),u=s||t.size||"1em";return t.className&&(r=t.className),e.className&&(r=(r?r+" ":"")+e.className),n.createElement("svg",l({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},t.attr,a,d,{className:r,style:c(c({color:e.color||t.color},t.style),e.style),height:u,width:u,xmlns:"http://www.w3.org/2000/svg"}),i&&n.createElement("title",null,i),e.children)};return void 0!==s?n.createElement(s.Consumer,null,e=>t(e)):t(a)}},3779:(e,t,r)=>{"use strict";r.d(t,{SignedIn:()=>s});var n=r(24309),a=r(23959);function s(e){let{children:t}=e,{status:r}=(0,a.wV)();return"authenticated"!==r?null:(0,n.jsx)(n.Fragment,{children:t})}},5905:(e,t,r)=>{"use strict";r.d(t,{S:()=>a,Y:()=>n});let n=e=>e?new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}):"No date",a=e=>e?new Date(e).toLocaleDateString("de-DE"):"No date"},8051:(e,t,r)=>{"use strict";function n(){let e="pk_live_70636d33e7c66f1cac4fbb3b3f07484d6aa79988";return{openPayment:function(t){let{accessCode:r,email:n,amount:a,currency:s,planCode:o,onSuccess:l,onCancel:i}=t;return e?window.PaystackPop?(new window.PaystackPop().checkout({key:e,accessCode:r,...n&&{email:n},...a&&{amount:a},...s&&{currency:s},...o&&{plan:o},onSuccess:e=>{l(e.reference)},onCancel:i}).catch(e=>{console.error("Paystack checkout error",e)}),!0):(console.error("Paystack script is not loaded yet"),!1):(console.error("NEXT_PUBLIC_PAYSTACK_PUBLIC_KEY is not set"),!1)},openPaymentRequest:async function(t){let{reference:r,email:n,amount:a,currency:s,containerId:o,otherChannelsButtonId:l,onSuccess:i,onCancel:c}=t;if(!e)return console.error("NEXT_PUBLIC_PAYSTACK_PUBLIC_KEY is not set"),!1;if(!window.PaystackPop)return console.error("Paystack script is not loaded yet"),!1;let d=new window.PaystackPop;return await d.paymentRequest({key:e,email:n,amount:a,currency:s,ref:r,container:o,...l&&{loadPaystackCheckoutButton:l},style:{theme:"light",applePay:{width:"100%",type:"subscribe",locale:"en"}},onSuccess:e=>{i(e.reference)},onError:()=>{console.error("Apple Pay payment request error")},onCancel:c}),!0}}}r.d(t,{Q:()=>n})},16198:(e,t,r)=>{"use strict";r.d(t,{SignedOut:()=>s});var n=r(24309),a=r(23959);function s(e){let{children:t}=e,{status:r}=(0,a.wV)();return"unauthenticated"!==r?null:(0,n.jsx)(n.Fragment,{children:t})}},26953:(e,t,r)=>{"use strict";r.d(t,{A_:()=>d,C4:()=>l,Nj:()=>i,cI:()=>m,el:()=>u,nZ:()=>o});var n=r(81980),a=r(74950);let s="tcs_gift_attribution";function o(){return new URLSearchParams(window.location.search).get("gift")}async function l(e,t){try{let r=await fetch("/api/gift-links/redeem",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:e,articleSlug:t,deviceId:(0,n.I)()})});if(!r.ok)return{valid:!1,reason:"invalid"};return await r.json()}catch(e){return{valid:!1,reason:"invalid"}}}function i(e,t){try{let r={ref:e,articleSlug:t,openedAt:Date.now()};localStorage.setItem(s,JSON.stringify(r))}catch(e){}}function c(){try{let e=localStorage.getItem(s);if(!e)return null;let t=JSON.parse(e);if(Date.now()-t.openedAt>2592e6)return localStorage.removeItem(s),null;return t}catch(e){return null}}function d(){let e=c();return e?{gift_ref:e.ref}:{}}function u(e){let t=c();t&&(0,a.sx)(a.sV.GIFT_SIGNUP,{plan:e,gift_ref:t.ref,article:t.articleSlug})}function m(e,t){let r=c();if(r){(0,a.sx)(a.sV.GIFT_CONVERSION,{plan:e,gift_ref:r.ref,article:r.articleSlug,..."number"==typeof t&&{_value:t}});try{localStorage.removeItem(s)}catch(e){}}}},33925:(e,t,r)=>{"use strict";r.d(t,{ArticleContentGate:()=>_});
1var n=r(24309),a=r(7761),s=r(72883),o=r(23959),l=r(81980),i=r(90593),c=r(88135),d=r(71905),u=r(8051),m=r(42329),x=r(31784),f=r(51017),h=r(1158),b=r(56036),p=r.n(b),g=r(63752),y=r(74950),v=r(5905);function w(e){let{gifterName:t,expiresAt:r,giftRef:a,variant:s}=e,o=(0,n.jsx)(p(),{href:"/subscribe",onClick:()=>(0,y.sx)(y.sV.GIFT_RECIPIENT_CTA_CLICKED,{gift_ref:a,placement:s}),className:"top"===s?"shrink-0 bg-white text-primary font-semibold font-roboto text-sm px-4 py-2 rounded-md hover:bg-gray-100 transition-colors":"inline-block bg-white text-primary font-semibold font-roboto px-6 py-3 rounded-md hover:bg-gray-100 transition-colors",children:"SUBSCRIBE"});return"top"===s?(0,n.jsxs)("div",{className:"w-full flex flex-col sm:flex-row sm:items-center gap-3 bg-csGreen text-white rounded-lg px-5 py-4 my-4",children:[(0,n.jsx)(g.A,{size:24,className:"shrink-0 hidden sm:block"}),(0,n.jsxs)("p",{className:"flex-1 font-roboto text-sm",children:[t?"".concat(t,", a Common Sense subscriber,"):"A Common Sense subscriber"," has gifted you this article. It's free to read until"," ",(0,v.Y)(r),"."]}),o]}):(0,n.jsxs)("div",{className:"flex flex-col items-center text-center py-10 px-6 mt-8 bg-csGreen shadow-xl rounded-lg text-white",children:[(0,n.jsx)("h2",{className:"text-2xl sm:text-3xl font-bold mb-4",children:"Enjoyed this gift?"}),(0,n.jsx)("p",{className:"mb-6 max-w-xl font-roboto",children:"Subscribe for unlimited access to our investigative stories, analysis and commentary, and gift articles to your own friends and family."}),o]})}var j=r(26953);let N={expired:"This gift link has expired.",revoked:"This gift link is no longer active.",exhausted:"This gift link has reached its limit of readers.",invalid:"This gift link isn't valid."};function C(e){let{email:t,setEmail:r,onSubscribe:a,onSignIn:o,onSelectPlan:l,subscriptionTier:i}=e,c="paid"===i||"premium"===i;return(0,n.jsxs)("div",{className:"flex flex-col items-center text-center py-10 px-6 -mt-4 bg-csGreen shadow-xl rounded-lg",children:[(0,n.jsx)("h2",{className:"text-2xl sm:text-3xl font-bold text-white mb-4",children:c?"Subscribe to unlock this article":"Enjoying the story?"}),(0,n.jsx)("p",{className:"mb-8 max-w-xl text-white",children:c?"To support our journalism, and unlock all of our investigative stories and provocative commentary, subscribe below.":"Enter your email to read this article and receive our daily newsletter."}),c?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 w-full max-w-2xl",children:["paid"===i&&(0,n.jsxs)("div",{className:"flex-1 border border-white/30 rounded-lg p-6 flex flex-col items-center bg-white/10",children:[(0,n.jsx)("h3",{className:"text-xl font-bold text-white mb-1",children:"Common Sense Plus"}),(0,n.jsx)("p",{className:"text-2xl font-bold text-white mb-3",children:"R99 / month"}),(0,n.jsx)("p",{className:"text-white/80 font-roboto text-sm mb-6",children:"Full access to insight, analysis, and data."}),(0,n.jsx)("button",{type:"button",onClick:()=>l("standard"),className:"mt-auto w-full bg-white text-primary font-semibold font-roboto px-4 py-3 rounded-md hover:bg-gray-100 transition-colors",children:"SUBSCRIBE"})]}),(0,n.jsxs)("div",{className:"flex-1 border border-white/30 rounded-lg p-6 flex flex-col items-center bg-white/20",children:[(0,n.jsx)("h3",{className:"text-xl font-bold text-white mb-1",children:"Common Sense Member"}),(0,n.jsx)("p",{className:"text-2xl font-bold text-white mb-3",children:"R349 / month"}),(0,n.jsx)("p",{className:"text-white/80 font-roboto text-sm mb-6",children:"Help shape an organisation committed to our values."}),(0,n.jsx)("button",{type:"button",onClick:()=>l("premium"),className:"mt-auto w-full bg-white text-primary font-semibold font-roboto px-4 py-3 rounded-md hover:bg-gray-100 transition-colors",children:"SUBSCRIBE"})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 mt-6",children:[(0,n.jsx)("span",{className:"font-roboto text-sm text-white",children:"ALREADY HAVE AN ACCOUNT?"}),(0,n.jsx)(s.hZ,{onClick:o,children:(0,n.jsx)("button",{className:"text-white font-semibold text-sm transition-colors font-roboto",children:"SIGN IN"})})]})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 w-full max-w-md",children:[(0,n.jsx)("input",{type:"email",value:t,onChange:e=>r(e.target.value),placeholder:"Enter your email",className:"flex-1 px-4 py-3 border border-primary rounded-md font-roboto text-sm focus:outline-none focus:ring-2 focus:ring-jaffa bg-white"}),(0,n.jsx)("button",{type:"button",onClick:a,className:"bg-black text-white font-semibold font-roboto px-4 py-2 hover:bg-primary/90 transition-colors",children:"SIGN UP"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 mt-6",children:[(0,n.jsx)("span",{className:"font-roboto text-sm text-white",children:"ALREADY HAVE AN ACCOUNT?"}),(0,n.jsx)(s.hZ,{onClick:o,children:(0,n.jsx)("button",{className:"text-white font-semibold text-sm transition-colors font-roboto",children:"SIGN IN"})})]})]})]})}function S(e){let{onSelectPlan:t,callbackUrl:r,userPlan:a,subscriptionTier:o}=e,l="693f6c36-76bf-4150-930f-1004b6600888",i=a===l||"standard"===a,c=i||"premium"===o;return(0,n.jsxs)("div",{className:"flex flex-col items-center text-center py-10 px-6 -mt-4 bg-white shadow-xl rounded-lg",children:[(0,n.jsx)("h2",{className:"text-2xl sm:text-3xl font-bold text-gray-900 mb-4",children:"Upgrade to unlock all our content"}),(0,n.jsx)("p",{className:"text-gray-700 font-roboto mb-8 max-w-xl",children:"To support our journalism, and unlock all of our investigative stories and provocative commentary about South Africa and the world as it actually is, subscribe below."}),(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 w-full max-w-2xl",children:[(0,n.jsxs)("div",{className:"flex-1 border border-primary rounded-lg p-6 flex flex-col items-center ".concat(c?"opacity-40":""),children:[(0,n.jsx)("h3",{className:"text-xl font-bold mb-1",children:"Common Sense Plus"}),(0,n.jsx)("p",{className:"text-2xl font-bold text-primary mb-3",children:"R99 / month"}),(0,n.jsx)("p",{className:"text-gray-600 font-roboto text-sm mb-6",children:"Full access to insight, analysis, and data."}),c?(0,n.jsx)("p",{className:"mt-auto w-full text-center text-gray-400 font-semibold font-roboto py-3",children:i?"CURRENT PLAN":"This piece is only available to Common Sense Members"}):(0,n.jsx)("button",{type:"button",onClick:()=>t(l),className:"mt-auto w-full bg-primary text-white font-semibold font-roboto px-4 py-3 rounded-md hover:bg-primary/90 transition-colors",children:"SUBSCRIBE"})]}),(0,n.jsxs)("div",{className:"flex-1 border border-primary rounded-lg p-6 flex flex-col items-center bg-primary text-white",children:[(0,n.jsx)("h3",{className:"text-xl font-bold mb-1",children:"Common Sense Member"}),(0,n.jsx)("p",{className:"text-2xl font-bold mb-3",children:"R349 / month"}),(0,n.jsx)("p",{className:"text-white/80 font-roboto text-sm mb-6",children:"Help shape an organisation committed to our values."}),(0,n.jsx)("button",{type:"button",onClick:()=>t("14522150-3be2-4dce-8cc7-56c4c3ca290d"),className:"mt-auto w-full bg-white text-primary font-semibold font-roboto px-4 py-3 rounded-md hover:bg-gray-100 transition-colors",children:"SUBSCRIBE"})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2 mt-6",children:[(0,n.jsx)("span",{className:"font-roboto text-sm text-gray-600",children:"Already have an account?"}),(0,n.jsx)(s.hZ,{callbackUrl:r,children:(0,n.jsx)("button",{className:"text-orange-600 font-semibold text-sm hover:text-orange-700 transition-colors font-roboto",children:"Sign in"})})]})]})}function _(e){let{children:t,url:r,articleSlug:s,subscriptionTier:b,tags:p}=e,[g,v]=(0,a.useState)(!1),[_,k]=(0,a.useState)({status:"none"}),[E,I]=(0,a.useState)({isOpen:!1,initialMode:"signup"}),[A,P]=(0,a.useState)(!1),[T,O]=(0,a.useState)(""),[R,L]=(0,a.useState)("free"),{data:U,status:D}=(0,o.wV)(),G="authenticated"===D,F="loading"!==D,B=async()=>null==U?void 0:U.accessToken,{user:K,refreshUser:M}=(0,i.ur)(),{openPayment:z}=(0,u.Q)(),V=(0,f.usePathname)();(0,a.useEffect)(()=>{async function e(){if(!F)return;let e=(0,j.nZ)();if(e){let t=await (0,j.C4)(e,s);
1if(t.valid){k({...t,status:"valid"}),v(!1),(0,j.Nj)(t.ref,s),(0,y.sx)(y.sV.GIFT_LINK_OPENED,{gift_ref:t.ref,article:s,signed_in:G});return}k({status:"rejected",reason:t.reason}),(0,y.sx)(y.sV.GIFT_LINK_REJECTED,{reason:t.reason,article:s})}else k({status:"none"});if(G)return void v(!1);try{(await (0,l.P)(r)).limit_reached&&v(!0)}catch(e){console.log(e),v(!1)}}P(!1),F&&(0,j.nZ)()&&k({status:"checking"}),"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>e()):setTimeout(()=>e(),0)},[r,s,G,F]);let q=p&&p.includes("free"),Y=G?!K||(0,c.zl)(K,b):q,Z="free"!==b&&!q&&!Y||g,H=G&&!!K&&(0,c.zl)(K,b);if("valid"===_.status)return H?(0,n.jsx)(n.Fragment,{children:t}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(w,{gifterName:_.gifterName,expiresAt:_.expiresAt,giftRef:_.ref,variant:"top"}),t,(0,n.jsx)(w,{gifterName:_.gifterName,expiresAt:_.expiresAt,giftRef:_.ref,variant:"end"})]});if(!Z)return(0,n.jsx)(n.Fragment,{children:t});if("checking"===_.status)return(0,n.jsxs)("div",{className:"relative overflow-hidden max-h-[500px]",children:[t,(0,n.jsx)("div",{className:"absolute inset-x-0 bottom-0 h-[70%] bg-gradient-to-b from-transparent via-background/80 to-background pointer-events-none"}),(0,n.jsx)("p",{className:"absolute inset-x-0 bottom-6 text-center font-roboto text-sm text-gray-600",children:"Unlocking your gift article..."})]});let W=async e=>{let t=await B();if(!t)return void h.o.error("Your session has expired. Please sign in again.");try{var r,n,a;let{access_code:s,email:o,amount:l,currency:i,plan_code:c}=null!=(a=null==(r=(await x.A.post("".concat("https://core-api-lvyu.onrender.com","/api/payments/v1/payments/subscribe-to-plan/"),{plan:e,email:null!=(n=null==K?void 0:K.email)?n:"",callback_url:V,...(0,j.A_)()},{headers:{Authorization:"Bearer ".concat(t)}})).data)?void 0:r.data)?a:{};if(!s)throw Error("No access code returned from payment API");z({accessCode:s,email:o,amount:l,currency:i,planCode:c,onSuccess:t=>{(0,m.Du)(l,i,t),(0,j.cI)(e,l),setTimeout(()=>M(),2e3)},onCancel:()=>{}})}catch(e){h.o.error("Something went wrong starting the payment. Please try again.")}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"relative",children:["rejected"===_.status&&(0,n.jsxs)("p",{className:"mb-4 font-roboto text-sm text-gray-700 bg-stone-50 border-l-4 border-jaffa px-4 py-3 rounded-r-lg",children:[N[_.reason]," Ask the person who shared it for a new one, or subscribe below for full access."]}),(0,n.jsxs)("div",{className:"relative overflow-hidden max-h-[500px]",children:[t,(0,n.jsx)("div",{className:"absolute inset-x-0 bottom-0 h-[70%] bg-gradient-to-b from-transparent via-background/80 to-background pointer-events-none"})]}),G?(0,n.jsx)(S,{onSelectPlan:W,callbackUrl:V,userPlan:null==K?void 0:K.plan,subscriptionTier:b}):A?(0,n.jsxs)("div",{className:"flex flex-col items-center text-center py-10 px-6 -mt-4 bg-csGreen shadow-xl rounded-lg",children:[(0,n.jsx)("h2",{className:"text-2xl sm:text-3xl font-bold text-white mb-4",children:"Welcome!"}),(0,n.jsx)("p",{className:"max-w-xl text-white font-roboto",children:"To finish signing up, please click the magic link sent to your email. You'll be brought straight back to this article."})]}):(0,n.jsx)(C,{email:T,setEmail:O,onSubscribe:()=>{L("free"),I({isOpen:!0,initialMode:"signup"})},onSignIn:()=>I({isOpen:!0,initialMode:"signin"}),onSelectPlan:e=>{L(e),I({isOpen:!0,initialMode:"signup"})},subscriptionTier:b})]}),(0,n.jsx)(d.M,{isOpen:E.isOpen,onClose:()=>I(e=>({...e,isOpen:!1})),isSubmitted:e=>P(e),initialMode:E.initialMode,email:T,setEmail:O,plan:R,callbackUrl:V})]})}},42329:(e,t,r)=>{"use strict";r.d(t,{Du:()=>o,H1:()=>n,mu:()=>s});let n="1533506967853380",a={free:{value:"0.00",currency:"ZAR"},standard:{value:"99.00",currency:"ZAR"},premium:{value:"349.00",currency:"ZAR"}};function s(e){var t;if(!window.fbq)return;let{value:r,currency:n}=null!=(t=a[e])?t:a.free;window.fbq("track","Subscribe",{value:r,currency:n,predicted_ltv:r})}function o(e,t,r){window.fbq&&("number"!=typeof e||Number.isNaN(e)||window.fbq("track","Purchase",{value:(e/100).toFixed(2),currency:t||"ZAR"},r?{eventID:r}:void 0))}},43081:(e,t,r)=>{"use strict";r.d(t,{UserButton:()=>i});var n=r(24309),a=r(23959),s=r(7761),o=r(56036),l=r.n(o);function i(){var e,t;let{data:r}
1=(0,a.wV)(),[o,i]=(0,s.useState)(!1);if(!(null==r?void 0:r.user))return null;let c=null!=(t=null==(e=r.user.email)?void 0:e.charAt(0).toUpperCase())?t:"U";return(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("button",{onClick:()=>i(!o),className:"w-8 h-8 rounded-full bg-jaffa text-white font-bold text-sm flex items-center justify-center cursor-pointer","aria-label":"User menu",children:c}),o&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"fixed inset-0 z-40",onClick:()=>i(!1)}),(0,n.jsxs)("div",{className:"absolute right-0 top-10 bg-white shadow-xl border border-gray-200 rounded-lg w-48 z-50 p-2",children:[(0,n.jsx)("p",{className:"text-xs text-gray-500 font-roboto px-3 py-2 truncate",children:r.user.email}),(0,n.jsx)("hr",{className:"border-gray-200 my-1"}),(0,n.jsx)(l(),{href:"/account",onClick:()=>i(!1),className:"block px-3 py-2 text-sm font-roboto text-gray-700 hover:bg-gray-100 rounded",children:"Your account"}),(0,n.jsx)("button",{onClick:()=>(0,a.CI)({callbackUrl:"/"}),className:"w-full text-left px-3 py-2 text-sm font-roboto text-gray-700 hover:bg-gray-100 rounded",children:"Sign out"})]})]})]})}},54375:(e,t,r)=>{"use strict";r.d(t,{AuthSessionProvider:()=>s});var n=r(24309),a=r(23959);function s(e){let{children:t}=e;return(0,n.jsx)(a.CP,{children:t})}},63752:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(86112).A)("gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]])},72883:(e,t,r)=>{"use strict";r.d(t,{Bl:()=>a.SignedOut,hZ:()=>s.SignInButton,iB:()=>n.SignedIn,uF:()=>o.UserButton});var n=r(3779),a=r(16198),s=r(94515),o=r(43081);r(54375)},74950:(e,t,r)=>{"use strict";r.d(t,{e7:()=>l,sV:()=>s,sx:()=>a,zS:()=>o});var n=r(44659);let a=(e,t)=>{n.sx(e,t)},s={SUBSCRIBE_CLICKED:"Subscribe Button Clicked",SIGN_IN_CLICKED:"Sign In Button Clicked",FREE_PLAN_CLICKED:"Free Plan",STANDARD_PLAN_CLICKED:"Standard Plan",PREMIUM_PLAN_CLICKED:"Premium Plan",EMAIL_SUBMITTED:"Email Submitted",PAYMENT_STARTED:"Payment Flow Started",SUBSCRIPTION_COMPLETED:"Subscription Completed",CATEGORY_CLICKED:"Category Clicked",SEARCH_PERFORMED:"Search Performed",SEARCH_RESULT_CLICKED:"Search Result Clicked",GIFT_BUTTON_CLICKED:"Gift Button Clicked",GIFT_UPSELL_SHOWN:"Gift Upsell Shown",GIFT_LINK_CREATED:"Gift Link Created",GIFT_LINK_SHARED:"Gift Link Shared",GIFT_QUOTA_REACHED:"Gift Quota Reached",GIFT_LINK_OPENED:"Gift Link Opened",GIFT_LINK_REJECTED:"Gift Link Rejected",GIFT_RECIPIENT_CTA_CLICKED:"Gift Recipient CTA Clicked",GIFT_SIGNUP:"Gift Recipient Signed Up",GIFT_CONVERSION:"Gift Recipient Subscribed"},o={trackSubscribe:()=>a(s.SUBSCRIBE_CLICKED),trackSignIn:()=>a(s.SIGN_IN_CLICKED),trackFree:()=>a(s.FREE_PLAN_CLICKED),trackStandard:()=>a(s.STANDARD_PLAN_CLICKED),trackPremium:()=>a(s.PREMIUM_PLAN_CLICKED),trackEmailSubmit:()=>a(s.EMAIL_SUBMITTED),trackPaymentStart:(e,t)=>a(s.PAYMENT_STARTED,{plan:e,_value:t}),trackSubscriptionComplete:(e,t)=>a(s.SUBSCRIPTION_COMPLETED,{plan:e,_value:t}),trackCategory:e=>a(s.CATEGORY_CLICKED,{category:e})},l=()=>{n.Hh("XEYBNEKW",{includedDomains:[window.location.hostname],spa:"auto"})}},81980:(e,t,r)=>{"use strict";function n(){if("undefined"==typeof localStorage||"function"!=typeof localStorage.getItem)return"";try{let e=localStorage.getItem("device_id");return e||(e=crypto.randomUUID(),localStorage.setItem("device_id",e)),e}catch(e){return""}}async function a(){try{let e=await fetch("https://api.ipify.org?format=json",{signal:AbortSignal.timeout(5e3)});return(await e.json()).ip}catch(e){return console.warn("Failed to fetch IP address, using fallback:",e),"127.0.0.1"}}async function s(e){try{let t=await a(),r=n(),s=navigator.userAgent,o=await fetch("".concat("https://core-api-lvyu.onrender.com","/api/authentication/v1/user-artifact-views/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ip_address:t,device_id:r,user_agent:s,action:"view",url:e})});if(!o.ok){let e=await o.text();return console.error("API Error Response:",{status:o.status,statusText:o.statusText,body:e}),{allowed:!0,limit_reached:!1}}let l=await o.json();return{allowed:!l.limit_reached,limit_reached:l.limit_reached}}catch(e){return console.log(e),{allowed:!0,limit_reached:!1}}}r.d(t,{I:()=>n,P:()=>s})},86683:(e,t,r)=>{"use strict";r.d(t,{ArticleBody:()=>E});
1var n=r(24309),a=r(7761),s=r(69348),o=r(98111),l=r(97565),i=r(1420);let c=(r(83805),r(55036)).env.NEXT_PUBLIC_SITE_URL||"https://www.thecommonsense.co.za",d=()=>(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,n.jsxs)("a",{href:"https://www.google.com/preferences/source?q=".concat(c,"/"),target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 rounded-full border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-900 font-roboto shadow-md transition-all duration-200 hover:shadow-lg hover:bg-gray-50 focus-visible:outline-2 focus-visible:outline-offset-2",children:[(0,n.jsx)(i.F4b,{size:20,"aria-hidden":!0}),"Add as a preferred source on Google"]}),""]});var u=r(56036),m=r.n(u),x=r(23959),f=r(686),h=r(7927),b=r(8312),p=r(75213),g=r(14838),y=r(63752),v=r(40814),w=r(90593),j=r(88135),N=r(74950),C=r(5905);let S={quota_exceeded:"You've used all of your gift articles for this month.",tier_insufficient:"This piece is only available to Common Sense Members, so it can only be gifted by Members.",subscription_required:"Gifting articles is a subscriber benefit.",sign_in_required:"Your session has expired. Please sign in again.",unavailable:"We couldn't create a gift link right now. Please try again."};function _(e){let{articleSlug:t,title:r}=e,{status:s}=(0,x.wV)(),{user:o}=(0,w.ur)(),[l,i]=(0,a.useState)("closed"),[c,d]=(0,a.useState)(null),[u,_]=(0,a.useState)(null),[k,E]=(0,a.useState)(null),[I,A]=(0,a.useState)(null),[P,T]=(0,a.useState)(!1),[O,R]=(0,a.useState)(!1);if("authenticated"!==s)return null;let L=async()=>{try{let e=await fetch("/api/gift-links",{cache:"no-store"});if(!e.ok)return;let t=await e.json();"number"==typeof t.ttlDays&&d(t.ttlDays),t.quota&&_(t.quota),!1===t.eligible&&i("upsell")}catch(e){}},U=async()=>{T(!0),A(null);try{let e=await fetch("/api/gift-links",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({articleSlug:t})}),r=await e.json().catch(()=>({}));if(!e.ok){let e=r.error in S?r.error:"unavailable";r.quota&&_(r.quota),"quota_exceeded"===e&&(0,N.sx)(N.sV.GIFT_QUOTA_REACHED),"subscription_required"===e&&((0,N.sx)(N.sV.GIFT_UPSELL_SHOWN),i("upsell")),A(e);return}E({url:r.url,expiresAt:r.expiresAt}),r.quota&&_(r.quota),(0,N.sx)(N.sV.GIFT_LINK_CREATED,{article:t})}catch(e){A("unavailable")}finally{T(!1)}},D=e=>(0,N.sx)(N.sV.GIFT_LINK_SHARED,{channel:e,article:t}),G=async()=>{if(k)try{await navigator.clipboard.writeText(k.url),R(!0),D("copy"),setTimeout(()=>R(!1),2e3)}catch(e){console.error("Failed to copy:",e)}},F="I thought you'd enjoy this article from The Common Sense: ".concat(r),B=k?[{name:O?"Copied!":"Copy link",icon:O?f.A:h.A,color:"bg-gray-100 hover:bg-gray-200 text-gray-700",action:G},{name:"WhatsApp",icon:b.A,color:"bg-green-500 hover:bg-green-600 text-white",action:()=>{D("whatsapp"),window.open("https://wa.me/?text=".concat(encodeURIComponent("".concat(F," ").concat(k.url))),"_blank")}},{name:"Email",icon:p.A,color:"bg-gray-600 hover:bg-gray-700 text-white",action:()=>{D("email"),window.location.href="mailto:?subject=".concat(encodeURIComponent("A gift article: ".concat(r)),"&body=").concat(encodeURIComponent("".concat(F,"\n\n").concat(k.url)))}},..."undefined"!=typeof navigator&&"share"in navigator?[{name:"More",icon:g.A,color:"bg-gray-500 hover:bg-gray-600 text-white",action:async()=>{try{await navigator.share({title:r,text:F,url:k.url}),D("native")}catch(e){}}}]:[]]:[],K=()=>i("closed");return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{onClick:()=>{if((0,N.sx)(N.sV.GIFT_BUTTON_CLICKED,{plan:null==o?void 0:o.plan}),A(null),o&&1>(0,j._Y)(o)){(0,N.sx)(N.sV.GIFT_UPSELL_SHOWN),i("upsell");return}i("gift"),L()},className:"flex items-center gap-2 px-4 py-2 rounded-full border border-primary bg-white text-primary transition-all duration-200 shadow-md hover:shadow-lg hover:bg-primary/5","aria-label":"Gift this article",children:[(0,n.jsx)(y.A,{size:18}),(0,n.jsx)("span",{className:"font-medium",children:"Gift"})]}),"closed"!==l&&(0,n.jsxs)("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center p-4",children:[(0,n.jsx)("div",{className:"absolute inset-0 bg-black/30",onClick:K}),(0,n.jsxs)("div",{role:"dialog","aria-modal":"true","aria-labelledby":"gift-dialog-title",className:"relative w-full max-w-md max-h-[85vh] overflow-y-auto bg-white rounded-2xl shadow-2xl border border-gray-200",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-gray-100",children:[(0,n.jsxs)("h3",{id:"gift-dialog-title",className:"text-lg font-semibold text-gray-900 flex items-center gap-2",children:[(0,n.jsx)(y.A,{size:20,className:"text-jaffa"}),"upsell"===l?"Gift articles with a subscription":"Gift this article"]}),(0,n.jsx)("button",{onClick:K,className:"p-2 hover:bg-gray-100 rounded-full transition-colors","aria-label":"Close",children:(0,n.jsx)(v.A,{size:18,className:"text-gray-500"})})]}),"upsell"===l?(0,n.jsxs)("div",{className:"p-5 font-roboto text-sm text-gray-700 space-y-4",children:[(0,n.jsx)("p",{children:"Common Sense Plus and Common Sense Member subscribers can share any article with friends and family, free to read with no subscription needed."}),(0,n.jsx)(m(),{href:"/subscribe",onClick:()=>(0,N.sx)(N.sV.SUBSCRIBE_CLICKED,{source:"gift_upsell"}),className:"block w-full text-center bg-primary text-white font-semibold px-4 py-3 rounded-md hover:bg-primary/90 transition-colors",children:"SEE SUBSCRIPTION OPTIONS"})]}):(0,n.jsxs)("div",{className:"p-5 font-roboto text-sm text-gray-700 space-y-4",children:[(0,n.jsxs)("p",{children:["Anyone with the link can read this article for free",c?" for ".concat(c," days"):"",", even without a subscription."]}),u&&(0,n.jsxs)("p",{className:"text-gray-500",children:["You have"," ",(0,n.jsx)("span",{className:"font-bold text-gray-900",children:u.remaining})," ","of ",u.limit," gift articles left this month",u.resetsAt?" (resets ".concat((0,C.Y)(u.resetsAt),")"):"","."]}),I&&(0,n.jsx)("p",{className:"text-red-600",role:"alert",children:S[I]}),k?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"grid grid-cols-4 gap-3",children:B.map(e=>{let t=e.icon;return(0,n.jsxs)("button",{onClick:e.action,className:"flex flex-col items-center gap-2 p-2 hover:bg-gray-50 rounded-xl transition-all duration-200",children:[(0,n.jsx)("div",{className:"w-12 h-12 rounded-full flex items-center justify-center ".concat(e.color," shadow-md"),children:(0,n.jsx)(t,{size:20})}),(0,n.jsx)("span",{className:"text-xs font-medium text-gray-700 text-center",children:e.name})]},e.name)})}),(0,n.jsx)("input",{type:"text",value:k.url,readOnly:!0,onFocus:e=>e.currentTarget.select(),className:"w-full px-3 py-2 text-xs bg-gray-50 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-jaffa"}),(0,n.jsxs)("p",{className:"text-xs text-gray-500",children:["This link expires on ",(0,C.Y)(k.expiresAt),"."]})]}):"quota_exceeded"!==I&&"tier_insufficient"!==I&&(0,n.jsx)("button",{onClick:U,disabled:P,className:"w-full bg-jaffa text-white font-semibold px-4 py-3 rounded-md hover:bg-primary transition-colors disabled:opacity-60",children:P?"Creating link...":"CREATE GIFT LINK"})]})]})]})]})}let k=[{value:"xs",previewClass:"text-xs"},{value:"sm",previewClass:"text-sm"},{value:"md",previewClass:"text-base"},{value:"lg",previewClass:"text-lg"},{value:"xl",previewClass:"text-xl"},{value:"2xl",previewClass:"text-2xl"}],E=e=>{let{content:t,summary:r,article:i,articleUrl:c}=e,[u,m]=(0,a.useState)("lg"),[x,f]=(0,a.useState)(!0),[h,b]=(0,a.useState)(!1),p=(0,a.useRef)(null);(0,a.useEffect)(()=>{let e=e=>{p.current&&!p.current.contains(e.target)&&b(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]);let g=(0,a.useMemo)(()=>t.findIndex(e=>"block"===e._type&&(!e.style||"normal"===e.style)),[t]),y=(0,o.f)({fontSize:u,dropCapIndex:g});return(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2 my-6",children:[r&&r.length>0&&(0,n.jsx)("button",{onClick:()=>f(e=>!e),className:"flex items-center gap-2 px-4 py-2 text-sm font-roboto rounded-full transition-all duration-200 shadow-md hover:shadow-lg ".concat(x?"bg-primary text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"),children:x?"Hide summary":"Show summary"}),(0,n.jsxs)("div",{ref:p,className:"relative",children:[(0,n.jsxs)("button",{onClick:()=>b(e=>!e),className:"flex items-center gap-2 px-4 py-2 rounded-full border border-primary bg-white text-primary transition-all duration-200 shadow-md hover:shadow-lg hover:bg-primary/5",children:[(0,n.jsx)("span",{className:"font-bold font-roboto text-sm",children:"Aa"}),(0,n.jsx)("span",{className:"font-roboto text-sm font-normal",children:"TEXT"})]}),h&&(0,n.jsx)("div",{className:"absolute top-full left-0 mt-1 flex flex-row items-end gap-3 bg-white shadow-xl rounded-xl px-4 py-3 z-10",children:k.map(e=>{let{value:t,previewClass:r}=e;return(0,n.jsx)("button",{onClick:()=>{m(t),b(!1)},className:"font-roboto leading-none transition-colors ".concat(r," ").concat(u===t?"text-primary border p-2 border-primary rounded-full":"text-gray-300 hover:text-primary/60 border p-2 border-gray-300 rounded-full"),children:"Aa"},t)})})]}
1),(0,n.jsx)(l.default,{title:i.title,description:i.blurb,url:c}),(0,n.jsx)(_,{articleSlug:i.slug.current,title:i.title}),(0,n.jsx)(d,{})]}),r&&r.length>0&&x&&(0,n.jsxs)("div",{className:"w-full border-l-4 border-primary bg-stone-50 px-5 py-4 rounded-r-lg mb-6",children:[(0,n.jsx)("p",{className:"font-roboto font-bold text-xs uppercase tracking-widest text-primary mb-3",children:"Summary"}),(0,n.jsx)("div",{className:"font-roboto text-sm text-gray-700 [&_ul]:list-disc [&_ul]:pl-5 [&_ul]:space-y-1 [&_p]:mb-1",children:(0,n.jsx)(s.RK,{value:r})})]}),(0,n.jsx)("div",{className:"mt-2",children:(0,n.jsx)(s.RK,{value:t,components:y})})]})}},90019:(e,t,r)=>{Promise.resolve().then(r.bind(r,74060)),Promise.resolve().then(r.bind(r,89883)),Promise.resolve().then(r.bind(r,69774)),Promise.resolve().then(r.t.bind(r,56036,23)),Promise.resolve().then(r.t.bind(r,95909,23)),Promise.resolve().then(r.bind(r,86683)),Promise.resolve().then(r.bind(r,33925)),Promise.resolve().then(r.bind(r,52123))},94515:(e,t,r)=>{"use strict";r.d(t,{SignInButton:()=>s});var n=r(24309),a=r(51017);function s(e){let{children:t,callbackUrl:r,onClick:s}=e,o=(0,a.useRouter)(),l=r?"/sign-in?callbackUrl=".concat(encodeURIComponent(r)):"/sign-in",i=null!=s?s:()=>o.push(l);return(0,n.jsx)("span",{onClick:i,children:t})}},98111:(e,t,r)=>{"use strict";r.d(t,{f:()=>h});var n=r(24309),a=r(7761),s=r(60749),o=r(52542),l=r.n(o),i=r(55036);let c=(0,s.UU)({projectId:"7o9a8q5w",dataset:"production",token:i.env.SANITY_TOKEN,apiVersion:"2024-01-01",useCdn:!0,timeout:3e5}),d=l()(c);var u=r(24520),m=r(94401),x=r(52123);let f={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-lg",xl:"text-xl","2xl":"text-2xl"},h=function(){let{className:e="",fontSize:t="lg",dropCapIndex:r=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=f[t];return{block:{h1:t=>{let{children:r}=t;return(0,n.jsx)("h1",{className:"text-4xl font-extrabold leading-tight mb-4 mt-10 ".concat(e),children:r})},h2:t=>{let{children:r}=t;return(0,n.jsx)("h2",{className:"text-3xl font-bold leading-snug mb-3 mt-8 ".concat(e),children:r})},h3:t=>{let{children:r}=t;return(0,n.jsx)("h3",{className:"text-2xl font-semibold leading-snug mb-2 mt-6 ".concat(e),children:r})},h4:t=>{let{children:r}=t;return(0,n.jsx)("h4",{className:"text-xl font-medium leading-snug mb-1 mt-4 ".concat(e),children:r})},normal:t=>{let{children:o,index:l}=t;return l===r&&o&&function e(t){return!!t&&("string"==typeof t?t.trim().length>0:"number"==typeof t||(Array.isArray(t)?t.some(t=>e(t)):!!a.isValidElement(t)&&e(t.props.children)))}(o)?(0,n.jsx)("p",{className:"".concat(s," mb-4 first-letter:text-6xl first-letter:font-bold first-letter:text-primary first-letter:float-left first-letter:mr-2 first-letter:mt-1 first-letter:leading-[0.8] ").concat(e),children:o}):(0,n.jsx)("p",{className:"".concat(s," mb-4 ").concat(e),children:o})},blockquote:t=>{let{children:r}=t;return(0,n.jsx)("blockquote",{className:"border-l-4 border-gray-300 pl-4 italic text-gray-700 my-3 ".concat(e),children:r})}},list:{bullet:e=>{let{children:t}=e;return(0,n.jsx)("ul",{className:"list-none ml-6 my-4 space-y-2",children:t})},number:e=>{let{children:t}=e;return(0,n.jsx)("ol",{className:"list-decimal list-outside ml-6 my-4 space-y-2",children:t})}},listItem:{bullet:e=>{let{children:t}=e;return(0,n.jsxs)("li",{className:"pl-2 relative flex items-start",children:[(0,n.jsx)("span",{className:"text-primary text-4xl font-bold mr-3",children:"â¢"}),(0,n.jsx)("span",{className:"text-black flex-1 mt-2 ".concat(s),children:t})]})},number:e=>{let{children:t}=e;return(0,n.jsx)("li",{className:"pl-2",children:t})}},marks:{strong:t=>{let{children:r}=t;return(0,n.jsx)("strong",{className:"font-bold ".concat(e),children:r})},em:t=>{let{children:r}=t;return(0,n.jsx)("em",{className:"italic ".concat(e),children:r})},link:t=>{let{children:r,value:a}=t;return(0,n.jsx)("a",{href:null==a?void 0:a.href,target:"_blank",rel:"noopener noreferrer",className:"text-jaffa underline hover:text-primary font-bold ".concat(e),children:r})}},types:{image:t=>{var r;let{value:a}=t,s=(r=a.asset,d.image(r).url());if(s)return(0,n.jsx)(x.default,{src:s,alt:a.alt||"Article image",caption:a.caption,className:e})},videoEmbed:e=>{let{value:t}=e,r=null==t?void 0:t.url;if(!r)return null;let a=function(e){if(!e||"string"!=typeof e)return null;for(let t of(e=e.trim(),[/(?:https?:\/\/)?(?:www\.)?youtube\.com\/watch\?(?:.*&)?v=([a-zA-Z0-9_-]{11}
1)(?:&.*)?$/,/(?:https?:\/\/)?(?:www\.)?youtu\.be\/([a-zA-Z0-9_-]{11})(?:\?.*)?$/,/(?:https?:\/\/)?(?:www\.)?youtube\.com\/embed\/([a-zA-Z0-9_-]{11})(?:\?.*)?$/,/(?:https?:\/\/)?(?:www\.)?youtube\.com\/shorts\/([a-zA-Z0-9_-]{11})(?:\?.*)?$/])){let r=e.match(t);if(r&&r[1])return r[1]}return null}(r);if(a)return(0,n.jsx)(u.VideoEmbed,{type:"youtube",videoId:a});let s=function(e){if(!e||"string"!=typeof e)return null;for(let t of(e=e.trim(),[/(?:https?:\/\/)?player\.mux\.com\/([a-zA-Z0-9]+)/,/(?:https?:\/\/)?stream\.mux\.com\/([a-zA-Z0-9]+)/,/(?:https?:\/\/)?test-streams\.mux\.dev\/([a-zA-Z0-9]+)/,/(?:https?:\/\/)?image\.mux\.com\/([a-zA-Z0-9]+)/])){let r=e.match(t);if(r&&r[1])return r[1]}return null}(r);return s?(0,n.jsx)(u.VideoEmbed,{type:"mux",videoId:s}):(0,n.jsx)("div",{className:"my-6",children:(0,n.jsx)("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-jaffa underline hover:text-primary font-bold",children:r})})},audioEmbed:e=>{let{value:t}=e;return(0,n.jsx)(m.AudioEmbed,{audioFile:null==t?void 0:t.audioFile,audioUrl:null==t?void 0:t.audioUrl,caption:null==t?void 0:t.caption})}}}}}},e=>{var t=t=>e(e.s=t);e.O(0,[1327,423,2371,2995,5855,6036,9855,5909,8680,2128,4815,4929,1180,9947,6154,7358],()=>t(90019)),_N_E=e.O()}]);
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.