PageSourceSearch

https://www.makegoodfood.ca/_next/static/chunks/pages/profile/payment/edit-1b061ae2b780a2b5.js

js makegoodfood.ca collected 2026-10-03 20:40:31 UTC 15,421 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[19335],{6295:(e,t,r)=>{"use strict";r.d(t,{$:()=>a,S:()=>i});var s=r(12938);let i=()=>{var e,t;let r=(0,s.useUserCard)(),i=(null==r?void 0:r.isSuccess)?null==r||null==(e=r.data)?void 0:e.data:[];return null!=(t=null==i?void 0:i[0])?t:{}},a=()=>{var e,t;let r=(0,s.useUserCard)();return(null==r?void 0:r.isSuccess)&&!!(null==r||null==(t=r.data)||null==(e=t.data)?void 0:e[0])}},28286:(e,t,r)=>{"use strict";r.d(t,{F:()=>s,W:()=>i});let s={applePay:"applePay",googlePay:"googlePay"},i={[s.applePay]:"Apple Pay",[s.googlePay]:"Google Pay"}},52099:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var s=r(2860),i=r(56121),a=r.n(i),n=r(26486);let l=e=>{let{className:t="",fieldName:r,value:i,valueTestId:a}=e;return(0,s.jsxs)("div",{className:"space-y-1 mb-5 items-center ".concat(t),"data-testid":"profile-display-text-pair",children:[(0,s.jsx)(n.default,{className:"text-xs",children:r}),(0,s.jsx)(n.default,{className:"text-sm font-bold",testId:a,children:i})]})};l.propTypes={className:a().string,fieldName:a().string,value:a().string,valueTestId:a().string};let o=l},55508:(e,t,r)=>{"use strict";r.d(t,{s:()=>n});var s=r(55729),i=r(81278),a=r(69372);let n=()=>{let e=(0,i.useRouter)(),t=(0,s.useRef)(!0);return(0,s.useEffect)(()=>{let r=()=>{(null==t?void 0:t.current)&&(0,a.deleteUserAddressFromSessionStorage)()};return e.events.on("routeChangeStart",r),window.addEventListener("beforeunload",r),()=>{e.events.off("routeChangeStart",r),window.removeEventListener("beforeunload",r)}},[e.events]),t}},76183:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/profile/payment/edit",function(){return r(92468)}])},80531:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});var s=r(54242);let i=e=>{let t=(0,s.A)("Stripe.errors"),r=(e=>{var t,r,s,i;return null==e||null==(i=e.response)||null==(s=i.data)||null==(r=s.entityError)||null==(t=r.meta)?void 0:t.errorCode})(e);return r?t(r):null}},85644:(e,t,r)=>{"use strict";r.d(t,{E:()=>o,v:()=>d});var s,i=r(55729);"function"==typeof SuppressedError&&SuppressedError;var a=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((s=t.length)!=r.length)return!1;for(i=s;0!=i--;)if(!e(t[i],r[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((s=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(i=s;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,a[i]))return!1;for(i=s;0!=i--;){var s,i,a,n=a[i];if(!e(t[n],r[n]))return!1}return!0}return t!=t&&r!=r});let n="__googleMapsScriptId";!function(e){e[e.INITIALIZED=0]="INITIALIZED",e[e.LOADING=1]="LOADING",e[e.SUCCESS=2]="SUCCESS",e[e.FAILURE=3]="FAILURE"}(s||(s={}));class l{constructor({apiKey:e,authReferrerPolicy:t,channel:r,client:s,id:i=n,language:o,libraries:d=[],mapIds:c,nonce:u,region:h,retries:p=3,url:g="https://maps.googleapis.com/maps/api/js",version:f}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=e,this.authReferrerPolicy=t,this.channel=r,this.client=s,this.id=i||n,this.language=o,this.libraries=d,this.mapIds=c,this.nonce=u,this.region=h,this.retries=p,this.url=g,this.version=f,l.instance){if(!a(this.options,l.instance.options))throw Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(l.instance.options)}`);return l.instance}l.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?s.FAILURE:this.done?s.SUCCESS:this.loading?s.LOADING:s.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let e=this.url;return e+="?callback=__googleMapsCallback&loading=async",this.apiKey&&(e+=`&key=${this.apiKey}`),this.channel&&(e+=`&channel=${this.channel}`),this.client&&(e+=`&client=${this.client}`),this.libraries.length>0&&(e+=`&libraries=${this.libraries.join(",")}`),this.language&&(e+=`&language=${this.language}`),this.region&&(e+=`&region=${this.region}`),this.version&&(e+=`&v=${this.version}`),this.mapIds&&(e+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(e+=`&auth_referrer_policy=${this.authReferrerPolicy}`),e}deleteScript(){let e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((e,t)=>
1{this.loadCallback(r=>{r?t(r.error):e(window.google)})})}importLibrary(e){return this.execute(),google.maps.importLibrary(e)}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){var e,t;if(document.getElementById(this.id))return void this.callback();let r={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(r).forEach(e=>!r[e]&&delete r[e]),(null==(t=null==(e=null==window?void 0:window.google)?void 0:e.maps)?void 0:t.importLibrary)||(e=>{let t,r,s,i="The Google Maps JavaScript API",a="google",n="importLibrary",l="__ib__",o=document,d=window,c=(d=d[a]||(d[a]={})).maps||(d.maps={}),u=new Set,h=new URLSearchParams,p=()=>t||(t=new Promise((n,d)=>{var p,g,f,m;return p=this,g=void 0,f=void 0,m=function*(){var p;for(s in yield r=o.createElement("script"),r.id=this.id,h.set("libraries",[...u]+""),e)h.set(s.replace(/[A-Z]/g,e=>"_"+e[0].toLowerCase()),e[s]);h.set("callback",a+".maps."+l),r.src=this.url+"?"+h,c[l]=n,r.onerror=()=>t=d(Error(i+" could not load.")),r.nonce=this.nonce||(null==(p=o.querySelector("script[nonce]"))?void 0:p.nonce)||"",o.head.append(r)},new(f||(f=Promise))(function(e,t){function r(e){try{i(m.next(e))}catch(e){t(e)}}function s(e){try{i(m.throw(e))}catch(e){t(e)}}function i(t){var i;t.done?e(t.value):((i=t.value)instanceof f?i:new f(function(e){e(i)})).then(r,s)}i((m=m.apply(p,g||[])).next())})}));c[n]?console.warn(i+" only loads once. Ignoring:",e):c[n]=(e,...t)=>u.add(e)&&p().then(()=>c[n](e,...t))})(r);let s=this.libraries.map(e=>this.importLibrary(e));s.length||s.push(this.importLibrary("core")),Promise.all(s).then(()=>this.callback(),e=>{let t=new ErrorEvent("error",{error:e});this.loadErrorCallback(t)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){let e=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${e} ms.`),setTimeout(()=>{this.deleteScript(),this.setScript()},e)}else this.onerrorEvent=e,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(e=>{e(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading||(this.loading=!0,this.setScript())}}}let o={LOADING:"loading",SUCCESS:"success",FAILURE:"failure"};function d(){let[e,t]=(0,i.useState)(o.LOADING);return(0,i.useEffect)(()=>{new l({apiKey:"AIzaSyAStZDt07OdhoKdv9z9ar5gaCltKfwcCVQ",version:"weekly",libraries:["places"]}).load().then(e=>{t(o.SUCCESS)}).catch(e=>{t(o.FAILURE)})},[]),e}},88540:(e,t,r)=>{"use strict";r.d(t,{A:()=>y});var s=r(2860),i=r(56121),a=r.n(i),n=r(60260),l=r(26486),o=r(13518),d=r(67327),c=r(4436),u=r(65660),h=r(83461),p=r(90730),g=r(39379);let f="wallet-tile-section",m=e=>{let{activeDiscount:t,className:r="",currentWeekCartStatus:i,isWithinContentfulGrid:a=!1,isStandaloneCard:m=!1,storeCredit:y="",isLoading:v}=e,b=(0,o.useTranslations)("ProfilePage.WalletSection"),{number:S}=(0,o.useFormatter)(),x=g.ORDER_STATUS_MAPPING[i]===g.ORDER_STATUS.SCHEDULED;return(0,s.jsxs)("div",{className:(0,n.default)("relative flex flex-col text-center bg-yellow-100 w-full px-4 lg:px-6 pt-4 pb-5 ".concat(r),{"lg:w-3/5":!a&&!m,"lg:w-full mr-14":a&&!m,"lg:w-1/2":a&&m}),"data-testid":f,children:[a&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.A,{className:"absolute -left-8 -top-12"}),(0,s.jsx)(h.A,{className:"absolute right-0 top-8"})]}),(0,s.jsxs)("div",{className:"flex py-3",children:[(0,s.jsxs)("div",{className:"flex flex-col w-full pr-2 whitespace-nowrap bg-yellow-100 z-10",children:[(0,s.jsx)(l.default,{className:"text-sm",children:b("yourCredits")}),(0,s.jsx)(l.default,{className:(0,n.default)("text-black font-semibold",{"text-2xl md:text-4xl":a,"text-2xl":!a}),testId:"".concat(f,"-your-credits-value"),children:S(y,{style:"currency",currency:"CAD",currencyDisplay:"narrowSymbol"})})]}),(0,s.jsx)("div",{className:"flex flex-col border-l border-gray-300 pl-2 whitespace-nowrap w-full bg-yellow-100 z-10",children:v?(0,s.jsx)(p.A,{className:"w-6 h-6 text-teal"}):t?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.default,{className:"text-sm",children:b("activeDiscount")}
1),(0,s.jsx)(l.default,{className:(0,n.default)("text-black font-semibold",{"text-2xl md:text-4xl":a,"text-2xl":!a}),testId:"".concat(f,"__active-discount"),children:b("discount",{discount:t})})]}):(0,s.jsx)(d.NextLink,{className:"text-teal text-sm pt-2 pb-3 ml-4",href:c.PROFILE_SHARE_URL,linkType:d.VARIANTS.UNDERLINE,testId:"".concat(f,"__earn-credits"),children:b("earnCredits")})})]}),(0,s.jsx)(d.NextLink,{className:(0,n.default)("mb-0 absolute",{rounded:!a,"w-3/4 mx-auto rounded-full top-0":a}),href:x?c.MEALKIT_GROCERIES_URL:c.MEALKIT_RECIPES_URL,linkType:d.VARIANTS.CTA_BUTTON,testId:"".concat(f,"__shop"),children:b("shopNowCTA")})]})};m.propTypes={activeDiscount:a().string,className:a().string,currentWeekCartStatus:a().string,storeCredit:a().number,isLoading:a().bool,isWithinContentfulGrid:a().bool,isStandaloneCard:a().bool};let y=m},92468:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__N_SSP:()=>U,default:()=>D});var s=r(2860),i=r(56121),a=r.n(i),n=r(81278),l=r(95676),o=r(54242),d=r(55729),c=r(1909),u=r(44981),h=r(80187),p=r(51144),g=r(29071),f=r(63159),m=r(17402);let{NONE:y,CREATE:v,COMPLETED:b}=p.STRIPE_PAYMENT_ACTION,S=e=>{let{isGoogleAPILoaded:t,locale:r,payment:i,userId:a,paymentError:n,saveButtonText:l,showPrivacyText:o,onSave:p,onCancel:S,isLoading:x}=e,[A,I]=(0,d.useState)(i),[E,w]=(0,d.useState)(y),[_,N]=(0,d.useState)(!1),[P,C]=(0,d.useState)(!1),{billing_address:L={}}=i,j={addressLine1:L.address_line1,addressLine2:L.address_line2,city:L.address_city,provinceCode:L.address_state,country:L.address_country,postalCode:L.address_zip},T=(0,c.mN)({resolver:(0,u.t)(h.SCHEMA_PAYMENT)}),{handleSubmit:R,formState:{errors:O}}=T,k=async(e,t)=>{let{message:r,data:s}=t;C(!1),w(e),e===b&&(null==s?void 0:s.id)&&(await p(s.id,a),C(!1),_&&N(!1))};return(0,s.jsx)(c.Op,{...T,children:(0,s.jsxs)("form",{className:"max-w-lg mb-7","data-testid":"payment-edit",onSubmit:R(e=>{let{address:t,nameOnCard:r}=e,{addressLine1:s,addressLine2:i,city:a,provinceCode:n,postalCode:l,countryCode:o}=t;C(!0),0===Object.keys(O).length&&(I({...A,name:r,billing_address:{address_line1:s,address_line2:i,address_city:a,address_state:n,address_country:o,address_zip:l}}),w(v),_||N(!0))},()=>{_||(N(!0),w(v))}),children:[(0,s.jsx)(m.A,{defaultAddress:j,handleStripeResult:k,isGoogleAPILoaded:t,isSaveButtonLoading:x||P,locale:r,payment:{...i,...A},saveButtonTestId:"profile-payment-cta",saveButtonText:l,showPrivacyText:o,showStripeError:_,stripeAction:E,userId:a,onSave:p}),n&&(0,s.jsx)("div",{className:"-mt-3 mb-5",children:(0,s.jsx)(g.default,{children:n})}),(0,s.jsx)(f.default,{isLoading:x||P,onCancel:S})]})})};S.propTypes={isGoogleAPILoaded:a().bool,locale:a().oneOf(["en-CA","fr-CA"]),payment:a().object,paymentError:a().string,userId:a().string,saveButtonText:a().string,showPrivacyText:a().bool,onSave:a().func,onCancel:a().func,isLoading:a().bool};var x=r(52099),A=r(92731),I=r(62056);let E=e=>{let{isLoading:t,isGoogleAPILoaded:r,locale:i,payment:a,paymentError:n,userId:d,onSave:c,onCancel:u,pendingUserAddressData:h}=e,p=(0,o.A)("ProfilePage.Payment"),{last4:g}=a;return(0,s.jsxs)(A.A,{children:[(0,s.jsx)("div",{className:"mb-2",children:(0,s.jsx)(I.A,{href:"/profile/payment",isAdd:!1,isEdit:!1,
1children:p("Information.heading")})}),!!h&&(0,s.jsx)(l.ToastWithoutHeader,{className:"!w-full max-w-lg",closable:!1,type:l.TOAST_TYPE.INFORMATION,children:p("cardDetailsSecurityMessage")}),!h&&g&&(0,s.jsx)(x.A,{fieldName:p("currentCreditCard"),value:"**** **** **** ".concat(g)}),(0,s.jsx)(S,{isGoogleAPILoaded:r,isLoading:t,locale:i,payment:a,paymentError:n,saveButtonText:p("save"),showPrivacyText:!1,userId:d,onCancel:u,onSave:c})]})};E.propTypes={isLoading:a().bool,isGoogleAPILoaded:a().bool,locale:a().oneOf(["en-CA","fr-CA"]),payment:a().object,paymentError:a().string,userId:a().string,onSave:a().func,onCancel:a().func,pendingUserAddressData:a().object};var w=r(6295),_=r(85644),N=r(47742),P=r(4436),C=r(55508),L=r(87424),j=r(69372),T=r(12938),R=r(80531),O=r(38538);let k=e=>{var t,r;let{updateProfileCallback:i}=e,a=(0,T.useUser)(),o=(0,n.useRouter)(),d=(0,O.w)(),c=(0,_.v)(),u=(0,w.S)(),h=(0,j.getUserAddressFromSessionStorage)(),p=(0,C.s)(),g=()=>{d(P.PROFILE_PAYMENT),(0,l.showToast)()},f=(0,L.yB)({onSuccess:g}),m=(0,L.Iv)({useMutationOptions:{onSuccess:function(){var e,t;let{pendingUserAddressData:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},s=null==r||null==(t=r.addressInfo)||null==(e=t.body)?void 0:e.postal_code;if(!s)return g();i(s)}},updateUserAndAddressMutationOptions:{onError:()=>{p.current=!1,d(P.PROFILE_USER_ADDRESS)}}}),y=(0,w.$)(),v=async(e,t)=>{try{if(y)await m.mutateAsync({cardInfo:{paymentId:null==u?void 0:u.id,cardToken:e}});else{if(!t)return console.error("Unable to save card: User has no card on profile and no valid user ID"),!1;await f.mutateAsync({user_id:t,stripe_card_token:e})}return!0}catch(e){return console.error("Failed to save card:",e),!1}},b=(0,R.A)((null==f?void 0:f.error)||(null==m?void 0:m.error));return(0,s.jsx)(E,{isGoogleAPILoaded:_.E.SUCCESS===c,isLoading:(null==f?void 0:f.isPending)||(null==m?void 0:m.isPending),locale:o.locale,payment:u,paymentError:b,pendingUserAddressData:h,userId:null==a||null==(r=a.data)||null==(t=r.data)?void 0:t.id,onCancel:()=>d(P.PROFILE_PAYMENT),onSave:v})};k.propTypes={updateProfileCallback:a().func};var U=!0;let D=(0,N.A)(k)},92731:(e,t,r)=>{"use strict";r.d(t,{A:()=>l});var s=r(2860),i=r(56121),a=r.n(i);let n=e=>{let{children:t,className:r="",testId:i="item"}=e;return(0,s.jsx)("section",{className:"px-4 lg:px-10 mb-6 last:mb-0 border border-gray-300 last:border-0 border-t-hidden border-l-hidden border-r-hidden ".concat(r),"data-testid":"".concat("profile-subsection","__").concat(i),children:t})};n.propTypes={children:a().node,className:a().string,testId:a().string};let l=n}},e=>{e.O(0,[67116,90371,10054,90636,46593,38792],()=>e(e.s=76183)),_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.