PageSourceSearch

https://defector.com/_next/static/chunks/pages/_sites/[siteSlug]/gift/redeem/confirm-bbc0aa0d91b7ec7c.js

js defector.com collected 2026-09-24 08:31:23 UTC 16,419 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1521],{1567:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});var r=n(14232),a=n(4309),l=n(46217),i=n(8349),o=n(96043),c=n(17708);let s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onLoading:t,onError:n,onRedirect:s,collectAddress:u=!1,collectPhone:d=!1}=e,[p,m]=(0,r.useState)(!1),[h,f]=(0,r.useState)(null),y=(0,c.A)(),{userData:{customerId:g,email:_,productCart:w,productInterval:v,beaconSessionData:A}}=(0,a.u)(),x=(0,l.A)(),{publisherCurrency:b}=(0,o.A)(),j=(0,r.useCallback)(()=>{f(null)},[]),I=(0,r.useCallback)(async e=>{m(!0),f(null),null==t||t();try{let t=await fetch("/api/checkout/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteSlug:y,customerId:g,email:_,collectAddress:u,collectPhone:d,beaconUserTrackingId:null==A?void 0:A.userTrackingId,beaconSessionId:null==A?void 0:A.sessionId,beaconSessionSequence:null==A?void 0:A.sessionSequence,...e})});if(!t.ok){let e=(await t.json().catch(()=>({}))).message||"Failed to create checkout session";f(e),null==n||n(e),m(!1);return}let a=await t.json();if(!a.url){let e="No checkout URL returned";f(e),null==n||n(e),m(!1);return}if(x){let t={};if(w&&v){var r;let e=(0,i.A)(w,v,b||"usd");t.currency=e.currency,t.value=parseFloat((null==(r=e.price)?void 0:r.toString())||"0"),t.items=[e]}else e.donationAmount&&(t.currency=(b||"usd").toLowerCase(),t.value=e.donationAmount,t.items=[]);x("begin_checkout",t)}null==s||s(a.url),window.location.href=a.url}catch(t){let e=t instanceof Error?t.message:"An unexpected error occurred";f(e),null==n||n(e),m(!1)}},[y,g,_,u,d,A,t,n,s,x,w,v,b]),P=(0,r.useCallback)(async e=>{await I({productId:e.productId,interval:e.interval,couponCode:e.couponCode,applyTax:e.applyTax,successUrl:e.successUrl,cancelUrl:e.cancelUrl,saleKey:e.saleKey,...void 0!==e.collectAddress&&{collectAddress:e.collectAddress},...void 0!==e.shipToCountry&&{shipToCountry:e.shipToCountry},...void 0!==e.cyoAmount&&{cyoAmount:e.cyoAmount}})},[I]),C=(0,r.useCallback)(async e=>{await I({productId:e.productId,interval:e.interval,couponCode:e.couponCode,applyTax:e.applyTax,isGift:!0,giftRecipient:e.giftRecipient,email:e.email,successUrl:e.successUrl,cancelUrl:e.cancelUrl,saleKey:e.saleKey})},[I]),k=(0,r.useCallback)(async e=>{await I({isDonation:!0,donationAmount:e.amount,email:e.email,successUrl:e.successUrl,cancelUrl:e.cancelUrl,...void 0!==e.collectAddress&&{collectAddress:e.collectAddress}})},[I]),S=(0,r.useCallback)(async e=>{await I({isGiftRedemption:!0,promotionCode:e.promotionCode,stripePriceId:e.stripePriceId,applyTax:e.applyTax,successUrl:e.successUrl,cancelUrl:e.cancelUrl,...void 0!==e.collectAddress&&{collectAddress:e.collectAddress}})},[I]),N=(0,r.useCallback)(async e=>{m(!0),f(null),null==t||t();try{let t=await fetch("/api/checkout/portal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({siteSlug:y,customerId:g,...e})});if(!t.ok){let e=(await t.json().catch(()=>({}))).message||"Failed to create portal session";f(e),null==n||n(e),m(!1);return}let r=await t.json();if(!r.url){let e="No portal URL returned";f(e),null==n||n(e),m(!1);return}null==s||s(r.url),window.location.href=r.url}catch(t){let e=t instanceof Error?t.message:"An unexpected error occurred";f(e),null==n||n(e),m(!1)}},[y,g,t,n,s]);return{isLoading:p,error:h,startCheckout:P,startGiftCheckout:C,startDonationCheckout:k,startGiftRedemptionCheckout:S,startUpgradePortal:(0,r.useCallback)(async e=>{await N({flow:"subscription_update",subscriptionId:e.subscriptionId,returnUrl:e.returnUrl})},[N]),startPaymentMethodUpdate:(0,r.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};await N({flow:"payment_method_update",subscriptionId:e.subscriptionId,returnUrl:e.returnUrl})},[N]),clearError:j}}},7126:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(e,t,n)=>{let r=0,a=parseFloat(t),l=parseFloat(n);if(0===a&&0===l)return e.toString();a>0&&(r=e-a),l>0&&(r=e*(1-l/100));let i=Math.round(1e10*r)/1e10;return Math.round(i)!==i?i>1?(Math.floor(100*i)/100).toFixed(2):(Math.round(100*i)/100).toFixed(2):i>0?i.toString():"0"}}
1,8349:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=(e,t,n)=>{var r;let a="annual"===t||"one-time"===t?e.annualPrice:e.monthlyPrice;return{item_id:(null==e||null==(r=e.id)?void 0:r.toString())||null,item_name:null==e?void 0:e.name,item_variant:t,currency:n,price:parseFloat(a),quantity:1}}},18401:(e,t,n)=>{"use strict";function r(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=e.toLowerCase(),n="$";return e?n="gbp"===t?"\xa3":"$":n}n.d(t,{A:()=>r})},21783:(e,t,n)=>{"use strict";n.r(t),n.d(t,{__N_SSP:()=>C,default:()=>k});var r=n(37876),a=n(14232),l=n(37062),i=n(40880),o=n(71004),c=n(89099),s=n(17708),u=n(4309),d=n(1567),p=n(67685),m=n(98777),h=n(50287),f=n(81249),y=n(52066),g=n(51410),_=n(99639),w=n(34776),v=n(10346),A=n(40958),x=n(20884),b=n(86663),j=n.n(b);let I=async(e,t,n)=>{try{let r=await fetch((0,l.c)("gift/subscription/getData"),{method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify({siteSlug:e,email:t,giftCode:n})});return"string"==typeof r&&(0,i.v)(Error(r),{}),r.json()}catch(e){(0,i.v)(e,{})}return null},P=async(e,t,n,r,a,o,c,s,u)=>{try{let d;if((d=u?await fetch((0,l.c)("subscriptionSchedule"),{method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify({siteSlug:e,order:u,newProduct:o,newInterval:c,promotionCodeId:s})}):await fetch((0,l.c)("gift/subscription/create"),{method:"POST",headers:{"Content-type":"application/json"},body:JSON.stringify({siteSlug:e,email:t,isBulk:n,giftPriceId:r,promotionCodeId:s,invoiceId:a,existingOrder:u})})).ok)return d.json();let p=await d.text();return(0,i.v)(Error(p),{}),p}catch(e){(0,i.v)(e,{})}return null};var C=!0;let k=e=>{var t;let{globalData:n}=e,{siteTitle:l,publisherCurrency:b,publisher:{adminEmail:C},publisherFeatureFlags:{streetAddressCollection:k=!1,phoneNumberCollection:S=!1}}=n,N=(0,s.A)(),{userData:{order:T,productCart:D,productInterval:U,email:M,hydrated:X,gift:F},updateUserData:E}=(0,u.u)(),{code:L}=F,{push:O}=(0,c.useRouter)(),[B,W]=(0,a.useState)({giftPriceId:null,promotionCodeId:null,giftProduct:null,giftProductInterval:null,giftInvoiceId:null,isBulk:!1,bestOrder:null}),[R,Y]=(0,a.useState)(""),[G,q]=(0,a.useState)(null),[J,$]=(0,a.useState)(!0),{startGiftRedemptionCheckout:H,isLoading:K}=(0,d.A)({onError:e=>{Y(e),q(h.A.Error),$(!1)},collectAddress:k,collectPhone:S}),V=(null==B?void 0:B.giftPriceId)===((null==B||null==(t=B.giftProduct)?void 0:t.annualPriceStripeId)||"")?p.IX.Annual:p.IX.Monthly;(0,a.useEffect)(()=>{X&&M&&L&&($(!0),I(N,M,L).then(e=>{if(!e||!e.giftInvoiceId&&!e.isBulk){q("error"),Y("An error occurred retrieving your subscription, please try again or contact support."),$(!1);return}let{giftProduct:t,giftProductInterval:n,existingOrder:r}=e,a={productCart:t,productInterval:n};r&&(a.order=r),E(a),W(e),$(!1)}).catch(e=>{(0,i.R)(e,{email:M,giftCode:L}),q("error"),Y("An error occurred retrieving your subscription, please try again or contact support."),$(!1)}))},[N,X,M,L,E]);let z=(0,a.useCallback)(async()=>{let{isBulk:e,giftPriceId:t,giftInvoiceId:n,giftProduct:r,giftProductInterval:a,promotionCodeId:l}=B||{};if(!t||!l||!n&&!e){Y("No subscription data found. Please try again."),q(h.A.Error),$(!1);return}if(T){await P(N,M,e,t,n,r,a,l,T),O("/gift/redeem/complete");return}await H({promotionCode:l,stripePriceId:t,applyTax:!0})},[N,M,B,O,T,H]),Q=T&&T.product,Z=Q&&T.product.name!==(null==D?void 0:D.name);return(0,r.jsx)(f.A,{...n,title:"".concat(l," | Gift Confirmation"),headerTheme:"simple",footerTheme:"simple",hideAds:!0,children:(0,r.jsxs)("div",{className:j().pageWrapper,children:[(0,r.jsx)("h1",{className:j().pageTitle,children:"Confirm Your Gift"}),(0,r.jsx)(y.A,{step:k?3:2,total:k?3:2}),(0,r.jsx)(x.A,{href:"/gift/redeem",className:j().backLink,children:(0,r.jsx)("span",{children:"← Enter different code"})}),J?(0,r.jsx)(A.A,{variant:m.A.Inline}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(w.A,{children:[(0,r.jsxs)("div",{className:j().productDetails,children:[(0,r.jsxs)("p",{children:[(0,r.jsx)("span",{children:"Product "}),null==D?void 0:D.displayName]}),(0,r.jsxs)("p",{children:[(0,r.jsx)("span",{children:"Term"}),V]})]}),Z?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:j().finePrint,children:["You currently have a ",(0,r.jsx)("strong",{children:T.product.displayName})," subscription renewing ",(0,r.jsx)("strong",{children:(0,o.vy)(T.interval)}),". Redeeming this gift will transition you to a ",(0,r.jsx)("strong",{children:D.displayName})," subscription for a free ",(0,r.jsx)("strong",{children:(0,o.oA)(U)})," at the end of your current term, after which your subscription will automatically renew ",(0,r.jsx)("strong",{children:(0,o.vy)(U)})," at ",(0,r.jsx)("strong",{children:(0,o.Nx)(b,(0,o.$g)(D,U))}),"."]}),(0,r.jsx)("p",{className:j().finePrint,children:(0,r.jsx)(_.A,{})})]}):(0,r.jsx)(g.A,{interval:U,product:D,applyCoupon:!1,futureGift:Q}),Q?(0,r.jsx)("p",{className:j().finePrint,children:"Redeeming this gift will cancel any pen
1ding subscription upgrades or downgrades you have initiated."}):null,(0,r.jsx)("p",{className:j().finePrint,children:"A payment method is required to enable auto-renewal. You can add a payment method upon completion of this process via your Account page."}),(0,r.jsxs)("p",{className:j().finePrint,children:["If you encounter issues or have questions, please contact support at ",(0,r.jsx)(x.A,{href:"mailto:".concat(C),children:C}),"."]})]}),R?(0,r.jsx)(v.A,{msg:R,status:G}):null,(0,r.jsx)("form",{className:j().form,method:"post",onSubmit:e=>{e.preventDefault(),$(!0),z()},children:(0,r.jsx)("button",{type:"submit",disabled:G===h.A.Error||K,className:j().paymentBtn,children:K?"Loading...":"Got it!"})})]})]})})}},25619:e=>{e.exports={wrapper:"LegalNotice_wrapper__IkdC9"}},33021:e=>{e.exports={wrapper:"Card_wrapper__jebqb",filled:"Card_filled__eBthr Card_wrapper__jebqb"}},34776:(e,t,n)=>{"use strict";n.d(t,{A:()=>c});var r=n(37876),a=n(49995),l=n(83193),i=n(33021),o=n.n(i);let c=e=>{let{children:t,variant:n=l.A.Default}=e;return(0,r.jsx)("div",{className:(0,a.A)({[o().wrapper]:n===l.A.Default,[o().filled]:n===l.A.Filled}),children:t})}},37035:e=>{e.exports={wrapper:"ProgressMeter_wrapper__tX6xX",text:"ProgressMeter_text__DHWBl"}},39459:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(67685);let a=(e,t)=>t===r.IX.Annual?parseFloat(e.annualPrice):t===r.IX.Monthly?parseFloat(e.monthlyPrice):0},48220:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(67685);let a=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e)return null;if(n){let a=e.find(e=>e.id===n&&(e.interval===t||e.interval===r.IX.All));if(a)return a}let a=e.filter(e=>e.automatic).filter(e=>e.interval===t||e.interval===r.IX.All).filter(e=>new Date(e.expirationDate)>new Date).filter(e=>!e.startDate||new Date(e.startDate)<new Date).filter(e=>!(e.introPrice&&e.nextPrice)).filter(e=>!e.gift);return 0===a.length?null:a[0]}},49085:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=e=>!!e.couponApplied&&("forever"===e.coupon.duration||"repeating"===e.coupon.duration&&(e=>{let t=new Date(Date.now()),n=new Date(e),r=(t.getFullYear()-n.getFullYear())*12;return r-=n.getMonth(),(r+=t.getMonth())>0?r:0})(e.purchaseDate)<=e.coupon.durationMonths)},51410:(e,t,n)=>{"use strict";n.d(t,{A:()=>m});var r=n(37876),a=n(48220),l=n(7126),i=n(71004),o=n(39459),c=n(67685),s=n(63037),u=n(25619),d=n.n(u),p=n(99639);let m=e=>{let{interval:t,product:n,futureGift:u=!1,applyCoupon:m=!0,customerEnteredCouponId:h=null,priceOverride:f=null}=e,{publisherCurrency:y,promoSettings:g}=(0,s.Xe)();if(!t||!n)return null;let _=null!=f?f:(0,o.A)(n,t),w=m&&!u?(0,a.A)(n.coupons,t,h):null,v=(0,i.vy)(t),A=null!=f?"".concat(f,"/").concat((0,i.oA)(t)):(0,i.$g)(n,t),x=e=>e>1?"s":"",b=(0,i.Nx)(y,A),j=null==g?void 0:g.promoDescriptionDisplay,I="".concat(v," at ").concat(b);if(w&&(null==w?void 0:w.duration)!=="once"){let e=(0,l.A)(_,w.discountAmount,w.discountPercent),n=(0,i.Nx)(y,e);switch(w.duration){case"forever":I="".concat(v," at ").concat(n);break;case"repeating":if(t===c.IX.Monthly&&(I="".concat(v," for ").concat(w.durationMonths," month").concat(x(w.durationMonths)," at ").concat(n,", then will automatically renew ").concat(t," at ").concat(b)),t===c.IX.Annual&&w.durationMonths>12){let e=Math.floor(w.durationMonths/12);I="".concat(v," for ").concat(e," year").concat(x(e)," at ").concat(n,", then will automatically renew ").concat(t," at ").concat(b)}}}if(w&&w.nextPrice){let e=c.IX.Annual,t=(0,i.vy)(e),r=(0,i.$g)(n,e),a=(0,i.Nx)(y,r);I="".concat(t," at ").concat(a)}return u&&(I="for a free ".concat(t===c.IX.Annual?"year":"month",", then will automatically renew ").concat(v," at ").concat(b)),(0,r.jsxs)("div",{className:d().wrapper,children:[t&&_&&!j?(0,r.jsxs)("p",{children:["After your initial term, your subscription will automatically renew ",I,". ",(0,r.jsx)(p.A,{})]}):null,t&&_&&j?(0,r.jsx)("p",{children:"After your initial term, your subscription will automatically renew. Your subscription continues until you cancel, and the term and rate may change. Before any annual renewal, we will send a reminder with the term and rate. If you do nothing, we will charge the payment method you selected."}):null]})}},52066:(e,t,n)=>{"use strict";n.d(t,{A:()=>
1o});var r=n(37876),a=n(96043),l=n(37035),i=n.n(l);let o=e=>{let{step:t,total:n}=e,{hideCheckoutProgress:l=!1}=(0,a.A)();return l?null:(0,r.jsx)("div",{className:i().wrapper,children:(0,r.jsxs)("p",{className:i().text,children:["Step ",t," of ",n]})})}},65105:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_sites/[siteSlug]/gift/redeem/confirm",function(){return n(21783)}])},71004:(e,t,n)=>{"use strict";n.d(t,{nn:()=>d,vy:()=>s,$g:()=>u,SE:()=>h,Nx:()=>f,Ds:()=>m,TT:()=>c,_M:()=>p,oA:()=>o});var r=n(49085),a=n(7126),l=n(67685),i=n(18401);let o=e=>e===l.IX.Annual?"year":"month",c=e=>e===l.IX.Annual?"renewing annually":e===l.IX.Monthly?"renewing monthly":"",s=e=>e===l.IX.Annual?"annually":e===l.IX.Monthly?"monthly":"",u=(e,t)=>t===l.IX.Annual?"".concat(e.annualPrice,"/year"):t===l.IX.Monthly?"".concat(e.monthlyPrice,"/month"):"",d=e=>({amex:"American Express",diners:"Diners Club",discover:"Discover",jcb:"JCB",mastercard:"MasterCard",unionpay:"UnionPay",visa:"VISA",unknown:"unknown"})[e],p=e=>{if(!e)return"";switch(e.type){case"card":return"".concat(d(e.brand)||e.brand," card ending in ").concat(e.last4);case"us_bank_account":return"".concat(e.bankName||"bank"," account ending in ").concat(e.last4);case"link":return e.email?"Stripe Link account (".concat(e.email,")"):"Stripe Link account";default:return"saved payment method"}},m=e=>{let t=(e=>{let t="annual"===e.interval?e.product.annualPrice:e.product.monthlyPrice;return(0,r.A)(e)?(0,a.A)(t,e.coupon.discountAmount,e.coupon.discountPercent):t})(e);return"".concat(t,"/").concat(o(e.interval))},h=e=>"number"==typeof e?e%1!=0?e.toFixed(2):String(e):String(e).replace(/^\d+(\.\d+)?/,e=>{let t=parseFloat(e);return t%1!=0?t.toFixed(2):e}),f=(e,t)=>{if(!t)return null;let n=(0,i.A)(e);return"".concat(n).concat(h(t))}},83193:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=function(e){return e.Default="default",e.Filled="filled",e}(r||{});let a=r},86663:e=>{e.exports={pageWrapper:"redeem_pageWrapper__5BoIL",pageWrapperComplete:"redeem_pageWrapperComplete__6sa__",pageTitle:"redeem_pageTitle__SWHWH",pageSubtitle:"redeem_pageSubtitle__9GQ_l",paymentBtn:"redeem_paymentBtn__5fVJp",backLink:"redeem_backLink__xyWh_",form:"redeem_form__m934T",inputWrapper:"redeem_inputWrapper___zxwH",labelText:"redeem_labelText__BGRtm",input:"redeem_input__ayTXe",productDetails:"redeem_productDetails__HS5XB",finePrint:"redeem_finePrint__4vCeY",finePrintCentered:"redeem_finePrintCentered__nWpOX redeem_finePrint__4vCeY",navList:"redeem_navList__k_6cd",inner:"redeem_inner__nbx71",confirmationMessage:"redeem_confirmationMessage__vkcN_"}},99639:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var r=n(37876);let a=()=>(0,r.jsx)(r.Fragment,{children:"Your subscription continues until you cancel, and after your first renewal the term and rate may change. Before any annual renewal, we will send a reminder with the term and rate. If you do nothing, we will charge the payment method you selected."})}},e=>{e.O(0,[1596,6071,1249,636,6593,8792],()=>e(e.s=65105)),_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.