1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6592],{18943:function(e,t,r){"use strict";r.d(t,{Y:function(){return D}});var i=r(72517),a=r(92250),o=r(27439),n=r(74832),l=r(30797),d=r(40757),s=r(84954),c=r(54369),u=r(4589),E=r(9903),R=r(98444),f=r(80839),_=r(35657),m=r(15749),p=r(32395),v=r(69993),C=r(48322);let{Offers:{CANCEL_REWARDS_ERROR_MESSAGE:I}}=i.default,A=e=>{let t={source:m.SOURCE_TYPES.FETCH,errorType:m.ERROR_TYPES.NETWORK,error:e};(0,p.H)(m.LOGGER_EVENTS.ACCOUNT_REWARDS_CANCEL_CERTIFICATE_ERROR,t),(0,v.oF)(C.o.ACCOUNT_REWARDS_CANCEL_CERTIFICATE_ERROR_TOTAL,1,{source:t.source,errorType:t.errorType})},D=()=>{let e=(0,d.TL)(),t=(0,R.F)(),r=(0,u.Z)(),{isLWLEnabledForUser:i}=(0,E.L)(),{currentLocation:m}=(0,o.Z)(),{actions:p}=(0,n.Z)(),{actions:v}=(0,l.Z)(),{actions:{enqueueError:C}}=(0,a.Z)(),D=e=>{i?v.setRewardV2Status({id:e,status:c.Qx.PENDING_CANCELLATION}):p.setRewardStatus({rewardId:e,status:c.Qx.PENDING_CANCELLATION})};return{cancelCertificate:async a=>{try{if(i&&r){let{locationId:e,deviceDateTime:t}=(0,s.d)(m);await r.removeCertificatesV2(a,{locationId:e,deviceDateTime:t})}else await t.cancelCertificate({rewardId:a});return D(a),!0}catch(t){var o;return A({message:t.message,code:t.code}),i&&e({type:f.R3,payload:{error_category:_.fz.REWARDS,error_description:"Failed to cancel certificate",error_description_vendor:t.message||t.code}}),C({message:null!==(o=t.message)&&void 0!==o?o:I,presentation:t.presentation}),!1}}}}},15385:function(e,t,r){"use strict";r.d(t,{U:function(){return d}});var i=r(67294),a=r(85980),o=r(49094),n=r(34443),l=r(76031);let d=()=>{let{isLWLInstoreRewardsEnabled:e}=(0,l.e)(),{attachedRewards:t,actions:r}=(0,o.Z)(),{account:d}=(0,a.Z)();return{detachFromInstoreCode:(0,i.useCallback)(i=>{if(!e||!(null==t?void 0:t.length)||!t.some(e=>e.offerId===i))return;let a=t.filter(e=>e.offerId!==i);r.setAttachedRewards(a),r.clearInstoreCode(),(0,n.eH)(null==d?void 0:d.idpCustomerId),a.length>0?(0,n.mT)(a,null==d?void 0:d.idpCustomerId):(r.clearAttachedRewards(),(0,n.SD)(null==d?void 0:d.idpCustomerId))},[e,t,r,null==d?void 0:d.idpCustomerId])}}},35205:function(e,t,r){"use strict";r.d(t,{J:function(){return a}});var i=r(67294);let a=()=>{let e=(0,i.useRef)(null),t=()=>{let t=e.current;t&&(clearInterval(t),e.current=null)};return(0,i.useEffect)(()=>()=>{t()},[]),{safeTimer:(t,r,i)=>{t(r);let a=setInterval(()=>{t(e=>0===e?(i(),clearInterval(a),0):e-1)},1e3);return e.current=a,a},clearTimer:t}}},9940:function(e,t,r){"use strict";r.d(t,{M:function(){return a},W:function(){return h}});var i,a,o=r(67294),n=r(65678),l=r(34443);let d=(e,t,r,i,a)=>{if(!e)return;let o=(0,l.Qq)(e);if(o){if((0,n.V)(o.expirationDateTime)>0){if(t&&t.offerCode===o.offerId||r({hasActivated:!0,qrCode:"",offerCustomCode:o.offerCode,assignedDateTime:"",expirationDateTime:o.expirationDateTime,offerCode:o.offerId}),a){let t=(0,l.RU)(e),r=i||[],o=(null==t?void 0:t.length)===r.length&&t.every((e,t)=>{var i,a;return e.offerId===(null===(i=r[t])||void 0===i?void 0:i.offerId)&&e.type===(null===(a=r[t])||void 0===a?void 0:a.type)});t&&!o&&a(t)}}else(0,l.eH)(e),(0,l.SD)(e)}};var s=r(80429),c=r(85980),u=r(49094),E=r(40757),R=r(67755),f=r(80839),_=r(35657),m=r(88582),p=r(91886),v=r(77717),C=r(76399),I=r(10395),A=r(66974);class D{postInstoreOfferCode(e){return this.postInstoreCodeForOfferApi({loyaltyOffersRedemptionRequestV2DtoModel:e,xSessionId:(0,A.W2)(),xChannel:v.GV,xDeviceId:(0,A.W2)()})}constructor(e){let t=(0,C.Um)(p._C8,{withJwt:e});this.postInstoreCodeForOfferApi=(0,I.ZP)("postInstoreOfferCode",t.loyaltyV2ControllerGetOffersRedemptionByIdV2V2.bind(t))}}var T=r(47081);let N=()=>{let{idToken:e,isLoading:t}=(0,T.P)();return{service:(0,o.useMemo)(()=>new D((0,m.VH)(e)),[e]),isReady:!t}},O=e=>!!(null==e?void 0:e.offerCustomCode),y=()=>{let{service:e,isReady:t}=N(),r=(0,E.TL)(),{instoreCodeLoading:i,actions:{setInstoreCodeLoading:a,setInstoreCode:n}}=(0,u.Z)(),{account:d}=(0,c.Z)(),s=(null==d?void 0:d.idpCustomerId)||"",[m,p]=(0,o.useState)("");return{error:m,instoreCodeLoading:i,inStoreRedemptionCode:async t=>{a({offerId:null==t?void 0:t.offerCode,isLoading:!0}),p("");try{let r=await e.postInstoreOfferCode({...t});O(r)&&(n({...r,hasActivated:!0}),(0,l.Tr)({offerId:null==r?void 0:r.offerCode,offerCode:null==r?void 0:r.offerCustomCode,expirationDateTime:null==r?void 0:r.expirationDateTime},s))}catch(e){if(e.presentation){var i,o;let t=(0,R.G)(e.presentation);p(t.message);let a={error_category:_.fz.REWARDS,error_description:t.message,error_description_vendor:null==e?void 0:null===(o=e.errors)||void 0===o?void 0:null===(i=o[0])||void 0===i?void 0:i.code};a.error_category&&a.error_category.trim()&&"string"==typeof a.error_description&&a.error_description.trim()&&r({type:f.R3,payload:a})}}finally{a({offerId:"",isLoading:!1})}},isServiceReady:t}};var S=r(35205),g=r(73658),w=r(98758);(i=a||(a={})).ERROR_INSTORE="ERROR_INSTORE",i.MAX_REWARDS_REACHED="MAX_REWARDS_REACHED",i.CONFIRM_MOVE_TO_INSTORE="CONFIRM_MOVE_TO_INSTORE",i.CONFIRM_MOVE_TO_BAG="CONFIRM_MOVE_TO_BAG";let h=()=>{var e;let{inStoreRedemptionCode:t,error:r,instoreCodeLoading:i,isServiceReady:a}=y(),{handleInStoreRewardsAnalytics:E,handleInStoreErrorAnalytics:R}=(0,w.E)(),{safeTimer:f,clearTimer:m}=(0,S.J)(),{checkRewards:p}=(0,s.A)(),{account:v}=(0,c.Z)(),C=(null==v?void 0:v.idpCustomerId)||"",{instoreCode:I,attachedRewards:A,actions:D}=(0,u.Z)(),{setInstoreCode:T,clearInstoreCode:N,setAttachedRewards:O,clearAttachedRewards:h}=D,M=(0,g.Z)(),[x,b]=(0,o.useState)(null),[L,F]=(0,o.useState)(null),[k,B]=(0,o.useState)(0),[W,V]=(0,o.useState)(!1),P=(0,o.useRef)(!1),[Y,Z]=(0,o.useState)(!1),j=(0,o.useRef)(null),G=(0,o.useRef)(!1),H=(0,o.useRef)(""),U=(0,n.V)(null==I?void 0:I.expirationDateTime),Q=(0,o.useCallback)((e,t)=>{var r;let i=(e||[]).filter(e=>e.type===_.Yr.REWARD).map(e=>({certificateNumber:e.offerId})),a=null==e?void 0:null===(r=e.find(e=>e.type===_.Yr.OFFER))||void 0===r?void 0:r.offerId,o=t||a;return o||0!==i.length?{offerCode:o,certificates:i.length>0?i:void 0}:{}},[]),X=(0,o.useCallback)(async()=>{m(),(0,l.eH)(C),B(0),V(!0)},[m,C]),z=(0,o.useCallback)(async()=>
1{if(!i.isLoading&&!P.current){P.current=!0,Z(!0),b(null);try{A.forEach(e=>{E({reward_placement:_.id.REACTIVATE_SCREEN,reward_engagement:_.Ic.REFRESH,reward_type:e.type,offer_name:e.name||"",reward_redemption:_.Fp.REDEEM_REWARDS_INSTORE})}),await p(),V(!1),B((0,n.V)(null==I?void 0:I.expirationDateTime));let e=Q(A);await t(e)}catch(e){R({error_category:_.yM.CODE_REFRESH,error_description:_.RX[_.yM.CODE_REFRESH],error_description_vendor:null==e?void 0:e.message}),b("ERROR_INSTORE")}finally{P.current=!1,Z(!1)}}},[A,Q,p,E,R,t,null==I?void 0:I.expirationDateTime,i.isLoading]);(0,o.useEffect)(()=>{C&&H.current!==C&&(H.current=C,d(C,I,T,A,O))},[C,I,T,A,O]),(0,o.useEffect)(()=>{(null==I?void 0:I.hasActivated)&&(null==I?void 0:I.offerCustomCode)&&(V(!1),B(Math.floor((0,n.V)(I.expirationDateTime)/1e3)))},[null==I?void 0:I.offerCustomCode,null==I?void 0:I.expirationDateTime,null==I?void 0:I.hasActivated]),(0,o.useEffect)(()=>{(null==I?void 0:I.hasActivated)&&(null==I?void 0:I.expirationDateTime)&&U<=0&&!W&&X()},[X,null==I?void 0:I.expirationDateTime,null==I?void 0:I.hasActivated,U,W]),(0,o.useEffect)(()=>{let e=()=>{F(document.visibilityState)};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[]),(0,o.useEffect)(()=>{if(U>0&&(null==I?void 0:I.hasActivated)){let e="visible"===L?U:(0,n.V)(null==I?void 0:I.expirationDateTime);e>0?(m(),f(B,Math.floor(e/1e3),X)):X()}},[L,U,null==I?void 0:I.hasActivated,null==I?void 0:I.expirationDateTime,m,f,X]),(0,o.useEffect)(()=>{r&&(R({error_category:_.yM.CODE_GENERATION,error_description:_.RX[_.yM.CODE_GENERATION],error_description_vendor:r}),b("ERROR_INSTORE"))},[r,R]),(0,o.useEffect)(()=>{if(P.current&&!i.isLoading){let e=setTimeout(()=>{!P.current||(P.current=!1,(null==I?void 0:I.hasActivated)||r||b("ERROR_INSTORE"))},100);return()=>clearTimeout(e)}},[i.isLoading,null==I?void 0:I.hasActivated,r]),(0,o.useEffect)(()=>{if((null==I?void 0:I.hasActivated)&&(null==I?void 0:I.offerCustomCode)){var e;null===(e=j.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"})}},[null==I?void 0:I.hasActivated,null==I?void 0:I.offerCustomCode]),(0,o.useEffect)(()=>{if(!a||G.current||P.current||i.isLoading)return;let e=!!((null==I?void 0:I.hasActivated)&&(null==I?void 0:I.offerCustomCode))||!!(C&&(0,l.Qq)(C));G.current=!0,e||t(Q(A))},[A,Q,t,a,i.isLoading,null==I?void 0:I.hasActivated,null==I?void 0:I.offerCustomCode,C]),(0,o.useEffect)(()=>{G.current=!1},[C]);let q=(0,o.useCallback)(async e=>{if(e.offerId){P.current=!0,Z(!0),b(null);try{var r,i;if(null==A?void 0:A.some(t=>t.offerId===e.offerId)){null===(i=j.current)||void 0===i||i.scrollIntoView({behavior:"smooth",block:"start"});return}let a=A.find(e=>e.type===_.Yr.OFFER),o=A.filter(e=>e.type===_.Yr.REWARD).length,n=e.rewardType===_.Yr.REWARD,d=e.rewardType===_.Yr.OFFER&&!!a;if(n&&o>=5){b("MAX_REWARDS_REACHED");return}V(!1);let s=(()=>{let t={offerId:e.offerId,name:e.offerName,imageUrl:e.imageUrl,type:e.rewardType,displayExpirationDate:e.displayExpirationDate};return e.rewardType===_.Yr.OFFER&&a?[...A.filter(e=>e.type!==_.Yr.OFFER),t]:[...A,t]})();O(s),(0,l.mT)(s,C),((null==I?void 0:I.hasActivated)||e.rewardType===_.Yr.OFFER&&a)&&(N(),m()),d||E({reward_placement:_.id.EARN_POINTS,reward_engagement:e.rewardEngagement||_.Ic.REDEEM,reward_type:e.rewardType,offer_name:e.offerName,reward_redemption:e.rewardRedemption||_.Fp.REDEEM_REWARDS_INSTORE}),((null==M?void 0:M.dealId)||(null==M?void 0:null===(r=M.certificateIds)||void 0===r?void 0:r.length)>0)&&M.actions.clearBag();let c=Q(s);await t(c)}catch(r){let t=e.rewardType===_.Yr.OFFER?_.yM.OFFER_ERROR:_.yM.REWARD_ERROR;R({error_category:t,error_description:_.RX[t],error_description_vendor:null==r?void 0:r.message}),b("ERROR_INSTORE")}finally{P.current=!1,Z(!1)}}},[A,null==I?void 0:I.hasActivated,E,R,null==M?void 0:M.dealId,null==M?void 0:null===(e=M.certificateIds)||void 0===e?void 0:e.length,M.actions,Q,t,N,m,C,O]),J=(0,o.useCallback)(function(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_.Ic.REDEEM,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:_.Fp.REDEEM_REWARDS_INSTORE,a=(null==e?void 0:e.certificateNumber)||(null==e?void 0:e.rewardCode);a&&q({offerId:a,offerName:e.title||"",rewardType:_.Yr.REWARD,rewardEngagement:r,rewardRedemption:i,imageUrl:null===(t=e.media)||void 0===t?void 0:t.imageUrl,displayExpirationDate:e.displayExpirationDate})},[q]),K=(0,o.useCallback)(function(e,t,r,i){let a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:_.Ic.REDEEM,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:_.Fp.REDEEM_REWARDS_INSTORE;e&&(A.find(e=>e.type===_.Yr.OFFER)&&E({reward_placement:_.id.SWAP_MODAL,reward_engagement:_.Ic.SWAP_DEAL,reward_type:_.Yr.OFFER,offer_name:t,reward_redemption:_.Fp.REDEEM_REWARDS_INSTORE}),q({offerId:e,offerName:t,rewardType:_.Yr.OFFER,rewardEngagement:a,rewardRedemption:o,imageUrl:r,displayExpirationDate:i}))},[q,A,E]),$=(0,o.useCallback)(()=>{b(null)},[]),ee=(0,o.useCallback)(async e=>{let r=A.find(t=>t.offerId===e),i=A.filter(t=>t.offerId!==e);O(i),(0,l.mT)(i,C),r&&E({reward_placement:_.id.EARN_POINTS,reward_engagement:_.Ic.REMOVE_REWARD,reward_type:r.type,offer_name:r.name}),m(),V(!1),N(),P.current=!0;try{let e=Q(i);await t(e)}catch(e){R({error_category:_.yM.DEAL_CODE_REDEMPTION,error_description:_.RX[_.yM.DEAL_CODE_REDEMPTION],error_description_vendor:null==e?void 0:e.message}),P.current=!1,b("ERROR_INSTORE")}0===i.length&&(h(),(0,l.SD)(C))},[A,C,O,N,m,h,Q,t,E,R]);return{activeModal:x,handleRedeemReward:J,handleRedeemOffer:K,closeModal:$,errorMessage:r||"",countdown:k,instoreCode:I,instoreCodeLoading:i,isInstoreCodeExpired:W,handleInstoreCodeExpiredCta:z,dealsCodeRef:j,attachedRewards:A,removeAttachedReward:ee,isRedeemingLoading:Y}}},22742:function(e,t,r){"use strict";r.d(t,{e:function(){return y}});
1var i=r(85893),a=r(83814),o=r(94184),n=r.n(o),l=r(73935),d=r(72517),s=r(9940),c=r(8349),u=r.n(c);let E={CENTER:"center"},R={CENTER:"center"},{Offers:{ERROR_INSTORE_CODE_MODAL_BUTTON_TEXT:f,ERROR_INSTORE_CODE_MODAL_TITLE:_,INSTORE_MAX_REWARDS_MODAL_TITLE:m,INSTORE_MAX_REWARDS_MODAL_TEXT:p,CANCEL_BUTTON_TEXT:v,CONFIRM_BUTTON_TEXT:C,REDEEM_ONLINE_TITLE:I,REDEEM_INSTORE_REWARD_MODAL_TEXT:A,REDEEM_INSTORE_TITLE:D,REDEEM_ONLINE_REWARD_MODAL_TEXT:T,REWARD_TEXT:N},Location:{ORDER_MODAL_BUTTON_TEXT:O}}=d.default,y=e=>{let{activeModal:t,errorMessage:r,modalSubtitle:o=N,moveToInstoreDescription:d=A,moveToBagDescription:c=T,onClose:y,onConfirm:S}=e,g=e=>{var t;(null===(t=e.detail)||void 0===t?void 0:t.value)===v?y():S()},w=t===s.M.CONFIRM_MOVE_TO_INSTORE,h=t===s.M.CONFIRM_MOVE_TO_BAG;return t===s.M.ERROR_INSTORE?(0,l.createPortal)((0,i.jsx)(a.Rj8,{isOpen:!0,showCloseIcon:!0,horizontalPosition:E.CENTER,verticalPosition:R.CENTER,modalStyle:u().modalContainer,onCloseModal:y,children:(0,i.jsxs)("div",{className:u().errorContent,children:[(0,i.jsx)(a.BEz,{variant:"colorful",icon:"informational",size:"xl",iconClass:u().errorIcon}),(0,i.jsx)(a.ZIf,{text:_,tag:"p","aria-label":"modal-header",className:n()("ty-heading-blocktype-medium",u().modalHeader)}),(0,i.jsx)(a.ZIf,{text:r,tag:"p","aria-label":"modal-data",className:n()("ty-body-1",u().modalBody)}),(0,i.jsx)("div",{className:u().buttonRow,children:(0,i.jsx)(a.H9b,{label:f,value:f,"variant-type":"primary",variant:"standard",buttonClass:u().modalBtn,onButtonCoreClicked:y})})]})}),document.body):t===s.M.MAX_REWARDS_REACHED?(0,l.createPortal)((0,i.jsx)(a.Rj8,{isOpen:!0,showCloseIcon:!0,horizontalPosition:E.CENTER,verticalPosition:R.CENTER,modalStyle:u().modalContainer,onCloseModal:y,children:(0,i.jsxs)("div",{className:u().errorContent,children:[(0,i.jsx)(a.BEz,{variant:"colorful",icon:"informational",size:"xl",iconClass:u().errorIcon}),(0,i.jsx)(a.ZIf,{text:m,tag:"p","aria-label":"modal-header",className:n()("ty-heading-blocktype-medium",u().modalHeader)}),(0,i.jsx)(a.ZIf,{text:p,tag:"p","aria-label":"modal-data",className:n()("ty-body-1",u().modalBody)}),(0,i.jsx)("div",{className:u().buttonRow,children:(0,i.jsx)(a.H9b,{label:O,value:O,"variant-type":"primary",variant:"standard",buttonClass:u().modalBtn,onButtonCoreClicked:y})})]})}),document.body):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.Onn,{isOpen:w,alignment:"center",modalSubtitle:o,modalTitle:D,dialogDescription:d,primaryButtonText:C,primaryButtonValue:C,secondaryButtonText:v,secondaryButtonValue:v,onDialogModalButtonClicked:g,onDialogModalClose:y}),(0,i.jsx)(a.Onn,{isOpen:h,alignment:"center",modalSubtitle:o,modalTitle:I,dialogDescription:c,primaryButtonText:C,primaryButtonValue:C,secondaryButtonText:v,secondaryButtonValue:v,onDialogModalButtonClicked:g,onDialogModalClose:y})]})}},86592:function(e,t,r){"use strict";r.d(t,{O:function(){return R}});var i=r(85893),a=r(83814),o=r(25418),n=r(72517),l=r(89717),d=r(24133),s=r(22742),c=r(23049),u=r(51173),E=r.n(u);let R=e=>{let{limit:t,excludePendingRefund:r,primaryCtaLabelOverride:u,onPrimaryCtaOverride:R,onInstoreModalPrimaryCtaOverride:f,attachedInstoreRewardIds:_,excludedIds:m,enableInstoreRewardsModal:p}=e,{formattedCertificates:v,isModalOpen:C,modalProps:I,modalConstants:A,formattingConstants:D,actions:T,switchModal:N,onSwitchModalConfirm:O,onSwitchModalClose:y}=(0,c.F)({limit:t,excludePendingRefund:r,primaryCtaLabelOverride:u,onPrimaryCtaOverride:R,onInstoreModalPrimaryCtaOverride:f,attachedInstoreRewardIds:_,excludedIds:m,...void 0!==p&&{enableInstoreRewardsModal:p}}),{Account:{REWARD_REFUND_STATUS_ACTIVE:S}}=n.default,g=I.showRefundLink?A.secondaryActionText:I.isSecondaryButtonDisabled?"":I.priceInPoints?A.secondaryActionText:"";return(0,i.jsxs)("div",{children:[(0,i.jsx)("ul",{className:E().container,children:v.map(e=>(0,i.jsx)("li",{className:E().listItem,children:(0,i.jsx)(a.Asj,{id:e.certificateNumber,label:e.title,variant:e.variant,description:e.description,imageUrl:(0,o.O9)(e.media.imageUrl),imageAlt:e.title||"",primaryCtaLabel:e.primaryCtaLabel,viewDetailsLabel:D.viewDetailsLabel,tooltipLabel:e.tooltipLabel,tooltipContent:e.tooltipContent,tooltipIcon:"star",showTooltip:e.showTooltip,onRewardsAndOffersCardRedeemed:()=>T.handleRewardRefund(e),onRewardsAndOffersCardViewDetailsClicked:()=>T.handleViewDetailsClick(e.certificateNumber)})},e.certificateNumber))}),(0,i.jsx)(l.Z,{isOpen:C,modalTitle:I.modalTitle,modalSubtitle:A.modalSubtitle,imageUrl:(0,o.O9)(I.imageUrl),dialogTitle:I.dialogTitle,dialogDescription:I.dialogDescription,badgeText:I.badgeText,expiry:I.expiry,additionalText:I.additionalText,additionalTextClass:I.showAdditionalClass&&E().additionalText,primaryButtonText:A.primaryActionText,primaryButtonValue:d.GZ.PRIMARY_ACTION,isPrimaryButtonDisabled:I.isPrimaryButtonDisabled,secondaryButtonText:g,secondaryButtonValue:d.GZ.SECONDARY_ACTION,isSecondaryButtonDisabled:I.isSecondaryButtonDisabled,showSecondaryVariant:I.showRefundLink,refundLinkText:I.showRefundLink?S:"",refundLinkClassName:E().refundLink,onRefundLinkClicked:T.handleRefundLinkClick,onOffersModalClose:T.closeViewDetailsModal,onOffersModalButtonClicked:T.handleModalButtonClick,alertText:I.alertText,alertBannerText:I.alertBannerText,alertBannerIcon:I.alertBannerIcon}),(0,i.jsx)(s.e,{activeModal:N,errorMessage:"",onClose:y,onConfirm:O})]})}},23049:function(e,t,r){"use strict";r.d(t,{F:function(){return Q}});var i=r(11163),a=r(67294),o=r(54463),n=r(44241),l=r(96175),d=r(54369),s=r(76031),c=r(18943),u=r(15385),E=r(53324),R=r
1(79328),f=r(32249),_=r(35657),m=r(72517),p=r(73658),v=r(82516),C=r(30797),I=r(25456),A=r(98758),D=r(87097),T=r(37988),N=r(24133),O=r(9940),y=r(11088);let{Account:{REWARD_STATUS_BADGE_ACTIVE:S,REWARD_EXPIRATION_LABEL:g,REWARD_REFUND_STATUS_ACTIVE:w,REWARD_REFUND_STATUS_PENDING:h,REWARD_DETAILS_MODAL_SUBTITLE:M,REWARD_DETAILS_MODAL_TITLE:x,REWARD_DETAILS_MODAL_PRIMARY_ACTION_TEXT:b,REWARD_DETAILS_MODAL_SECONDARY_ACTION_TEXT:L,REWARD_REDEEM_TEXT:F,REWARD_VIEW_DETAILS_TEXT:k,REWARD_PENDING_CANCELLATION_TEXT:B,REWARD_DETAILS_MODAL_PENDING_CTA:W,REWARD_ADDED_TO_BAG_TOAST_TEXT:V,TERMS_AND_CONDITIONS:P,REWARD_PENDING_TOOLTIP_TEXT:Y,REWARD_PENDING_TOOLTIP_DESCRIPTION:Z},Loyalty:{SUSPENDED_ACCOUNT_BANNER_MESSAGE:j},Offers:{INSTORE_BUTTON_TEXT:G,OFFER_DETAILS_MODAL_PRIMARY_ACTION_TEXT:H,INSTORE_CODE_BUTTON_TEXT:U}}=m.default,Q=e=>{var t,r;let{limit:m,excludePendingRefund:Q,primaryCtaLabelOverride:X,onPrimaryCtaOverride:z,onInstoreModalPrimaryCtaOverride:q,attachedInstoreRewardIds:J,excludedIds:K,enableInstoreRewardsModal:$}=null!=e?e:{},ee=(0,i.useRouter)(),{isMobile:et}=(0,f.E)(),{getLoyaltyAdvisoryMessage:er}=(0,E.Q)(),{certificates:ei,sortedCertificates:ea,isLoading:eo}=(0,C.Z)(),{cancelCertificate:en}=(0,c.Y)(),{handleRewardsAnalytics:el,handleModalAnalytics:ed,handleInStoreModalAnalytics:es,handleInStoreRewardsAnalytics:ec}=(0,A.E)(),eu=(0,s.e)(),{isLWLRewardApplyPlpFlowEnabled:eE,isLWLInstoreRewardsEnabled:eR,isRewardsEnabledAtLocation:ef}=eu,{handleRewardBuilderNavigation:e_}=(0,D.q)(),{toast:em}=(0,R.E)(),{loyaltyV2:{isSuspended:ep}}=(0,v.Z)(),{certificateIds:ev,actions:{removeCertificateFromBag:eC}}=(0,p.Z)(),{handleCertificateApplication:eI}=(0,y.v)(),{detachFromInstoreCode:eA}=(0,u.U)(),[eD,eT]=(0,a.useState)(null),[eN,eO]=(0,a.useState)(null),ey=(0,a.useRef)(null),eS=ea.filter(e=>(!Q||e.status!==d.Qx.PENDING_CANCELLATION)&&!(null==K?void 0:K.includes(e.certificateNumber))),eg=m?eS.slice(0,m):eS,ew=eD?ei.find(e=>e.certificateNumber===eD):null,eh=null!=ew&&!!ew.certificateNumber&&(null==ev?void 0:ev.includes(ew.certificateNumber)),eM=(null==ew?void 0:ew.status)===d.Qx.PENDING_CANCELLATION,ex=et&&eR&&!!$,eb=ex&&!eM,eL=(null==ew?void 0:ew.certificateNumber)||(null==ew?void 0:ew.rewardCode),eF=!!eL&&!!(null==J?void 0:J.includes(eL)),ek={expirationLabel:g,refundStatusActive:X||w,refundStatusPending:h,statusBadgeActive:S,viewDetailsLabel:k,pendingCancellationText:B},eB="";!eb&&(eM?eB=ek.pendingCancellationText:(null==ew?void 0:ew.termsAndConditions)&&(eB=(null==ew?void 0:ew.description)||""));let eW=er({config:eu,context:l.j.REWARDS,showShortMessage:!1}),eV={modalTitle:(null==ew?void 0:ew.title)||"",imageUrl:(null==ew?void 0:null===(t=ew.media)||void 0===t?void 0:t.imageUrl)||"",dialogTitle:(null==ew?void 0:ew.termsAndConditions)?P:x,dialogDescription:null!==(r=null==ew?void 0:ew.termsAndConditions)&&void 0!==r?r:null==ew?void 0:ew.description,badgeText:eM||ep?"":ek.statusBadgeActive,additionalText:eB,showAdditionalClass:!(null==ew?void 0:ew.termsAndConditions),expiry:(null==ew?void 0:ew.expirationDate)?(0,n._)(ek.expirationLabel,{"{date}":(0,o.oZ)(ew.expirationDate,T.S)}):"",isPrimaryButtonDisabled:eM||eh,isSecondaryButtonDisabled:eM,priceInPoints:null==ew?void 0:ew.priceInPoints,showRefundLink:eb,alertText:eW,alertBannerText:ep?j:void 0,alertBannerIcon:ep||!ef?"informational":void 0},eP=async function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!e)return;let{certificateNumber:i,status:a,title:o}=e;if(i&&a!==d.Qx.PENDING_CANCELLATION){if(z&&!r){z(e);return}t||el({reward_placement:_.id.MY_REWARDS,reward_engagement:_.Ic.REFUND,reward_type:_.Yr.REWARD,offer_name:o||""}),await en(i)&&eC({id:i})}},eY=()=>{eT(null)},eZ=()=>{if(ew){if(eI({certificate:ew}),em.show({toastText:V,variant:"success",icon:"checkmark"}),eY(),eE){var e;e_(null!==(e=ew.certificateNumber)&&void 0!==e?e:"")}else ee.push("/menu")}},ej=b;ep||!ef?ej="":eb?ej=H:eM&&(ej=W);let eG=L;ef?eb?eG=eF?U:"".concat(F," ").concat(G):eM&&(eG=""):eG="";let eH=(0,a.useCallback)(()=>{let e=ey.current;ey.current=null,eO(null),null==e||e()},[]),eU=(0,a.useCallback)(()=>{eO(null),ey.current=null},[]),eQ=eg.map(e=>{let t=I.QN.DETAILS_ONLY;
1e.status===d.Qx.PENDING_CANCELLATION&&(t=I.QN.AVAILABLE),z&&e.status!==d.Qx.PENDING_CANCELLATION&&(t=I.QN.AVAILABLE),ef||(t=I.QN.DETAILS_ONLY);let r=e.status===d.Qx.PENDING_CANCELLATION?ek.refundStatusPending:ek.refundStatusActive;return{...e,description:(0,n._)(ek.expirationLabel,{"{date}":(0,o.oZ)(e.expirationDate,T.S)}),primaryCtaLabel:ef?r:"",tooltipLabel:Y,tooltipContent:Z,showTooltip:e.status===d.Qx.PENDING_CANCELLATION,variant:t}});return{certificates:eg,formattedCertificates:eQ,selectedReward:ew,isModalOpen:!!eD,isLoading:eo,modalProps:eV,modalConstants:{modalSubtitle:M,primaryActionText:ej,secondaryActionText:eG},formattingConstants:ek,actions:{handleRewardRefund:eP,handleViewDetailsClick:e=>{if(e){let t=ei.find(t=>t.certificateNumber===e);ex&&"function"==typeof es&&es({modal_interaction:_.Q3.IMPRESSION,modal_name:_.Kr.REWARD_DETAILS_MODAL,modal_type:_.FV.REWARDS}),ex||el({reward_placement:_.id.MY_REWARDS,reward_engagement:_.Ic.VIEW_REWARD_DETAILS,reward_type:_.Yr.REWARD,offer_name:(null==t?void 0:t.title)||""}),eT(e)}},closeViewDetailsModal:e=>{"function"==typeof ed&&ed({modal_interaction:_.SH.CTAClick,modal_name:_.Kr.REWARD_DETAILS_MODAL,modal_type:_.pr.REWARDS,link_text:_.XN.CLOSE}),eY()},handleModalButtonClick:e=>{var t;if(ew)switch(null===(t=e.detail)||void 0===t?void 0:t.value){case N.GZ.SECONDARY_ACTION:if(eb){if(eh){ey.current=()=>{eC({id:ew.certificateNumber}),q?q(ew,_.Ic.REDEEM_IN_STORE,_.Fp.REDEEM_REWARDS_INSTORE):z?z(ew,_.Ic.REDEEM_IN_STORE,_.Fp.REDEEM_REWARDS_INSTORE):(ec({reward_placement:_.id.EARN_POINTS,reward_engagement:_.Ic.REDEEM_IN_STORE,reward_type:_.Yr.REWARD,offer_name:ew.title||"",reward_redemption:_.Fp.REDEEM_REWARDS_INSTORE}),ee.push("/account/rewards/in-store")),eY()},eO(O.M.CONFIRM_MOVE_TO_INSTORE);break}q?(q(ew,_.Ic.REDEEM_IN_STORE,_.Fp.REDEEM_REWARDS_INSTORE),eY()):z?(z(ew,_.Ic.REDEEM_IN_STORE,_.Fp.REDEEM_REWARDS_INSTORE),eY()):(ec({reward_placement:_.id.EARN_POINTS,reward_engagement:_.Ic.REDEEM_IN_STORE,reward_type:_.Yr.REWARD,offer_name:ew.title||"",reward_redemption:_.Fp.REDEEM_REWARDS_INSTORE}),eY(),ee.push("/account/rewards/in-store"));break}el({reward_placement:_.id.MY_REWARDS_MODAL,reward_engagement:_.Ic.REFUND_REWARD,reward_type:_.Yr.REWARD,offer_name:ew.title||""}),eP(ew,!0),eY();break;case N.GZ.PRIMARY_ACTION:if(eb){if(ec({reward_placement:_.id.EARN_POINTS,reward_engagement:_.Ic.REDEEM_ONLINE,reward_type:_.Yr.REWARD,offer_name:ew.title||"",reward_redemption:_.Fp.REDEEM_REWARDS_ONLINE}),eF){ey.current=()=>{let e=ew.certificateNumber||ew.rewardCode;e&&eA(e),eZ()},eO(O.M.CONFIRM_MOVE_TO_BAG);break}eZ();break}el({reward_placement:_.id.MY_REWARDS_MODAL,reward_engagement:_.Ic.ADD_TO_BAG,reward_type:_.Yr.REWARD,offer_name:ew.title||""}),eZ();break;default:eY()}},handleRefundLinkClick:()=>{ew&&eb&&(el({reward_placement:_.id.MY_REWARDS_MODAL,reward_engagement:_.Ic.REFUND_REWARD,reward_type:_.Yr.REWARD,offer_name:ew.title||""}),eP(ew,!0,!0),eY())}},switchModal:eN,onSwitchModalConfirm:eH,onSwitchModalClose:eU}}},37988:function(e,t,r){"use strict";r.d(t,{S:function(){return a},r:function(){return i}});let i=[{months:1},{months:3},{months:6},{months:9},{months:12}],a="MM/dd/yyyy"},8349:function(e){e.exports={modalContainer:"instoreRedemptionModal_modalContainer__p0mGJ",modalHeader:"instoreRedemptionModal_modalHeader__476SC",modalBody:"instoreRedemptionModal_modalBody__1HRxN",errorContent:"instoreRedemptionModal_errorContent__19LZQ",errorIcon:"instoreRedemptionModal_errorIcon__7wUOK",buttonRow:"instoreRedemptionModal_buttonRow__AM8HN",modalButtons:"instoreRedemptionModal_modalButtons___JRDV",modalBtn:"instoreRedemptionModal_modalBtn__O_hnL"}},51173:function(e){e.exports={container:"list_container__sehIr",additionalText:"list_additionalText__YhQol",refundLink:"list_refundLink__lk4pu",listItem:"list_listItem__pSSU6",toast:"list_toast__Dg3nA"}}}]); 2//# sourceMappingURL=6592-e8c71843dead9c29.js.map
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.