"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8743],{81791:function(e,t,o){o.d(t,{PC:function(){return a},Vb:function(){return l},rt:function(){return i}});let i=()=>!!localStorage.getItem("usedAddedDigitalCoupon"),a=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];e?localStorage.setItem("usedAddedDigitalCoupon","true"):localStorage.removeItem("usedAddedDigitalCoupon")},l=(e,t)=>{switch(e){case"ALREADY_AVAILED":return t.ALREADY_AVAILED;case"INVALID_INCENTIVE":return t.INVALID_INCENTIVE;case"INVENTORY_OUT_OF_STOCK":return t.INVENTORY_OUT_OF_STOCK;case"INCENTIVE_EXPIRED":return t.INCENTIVE_EXPIRED;case"CONSUMER_NOT_ELIGIBLE":return t.CONSUMER_NOT_ELIGIBLE;case"INVALID_PROMOCODE ":return t.INVALID_PROMOCODE;case"TRY_AGAIN":return t.TRY_AGAIN;default:return t.GENERIC_ERROR}}},58743:function(e,t,o){o.d(t,{N1:function(){return F},hN:function(){return A},qk:function(){return O},vV:function(){return _}});var i=o(11163),a=o.n(i),l=o(3127),n=o(63266),r=o(26934),u=o(25411),d=o(19567),s=o(94382),p=o(86618),c=o(50298),f=o.n(c),g=o(3868),m=o(36232),v=o(38032),S=o(81791),h=o(18830),w=o(14343),I=o(12086),P=o(63404),C=o(83454);let{REWARD:y,REWARD_CATALOG:T,OFFER_CATALOG:E}=u.OFFER_TYPE,Z=null,D=async e=>{await w.Z.fetchMemberHistoryAction();let t=w.Z.issuedRewards&&w.Z.issuedRewards.filter(t=>t.rewardTypeExternalReference===e);return!((null==t?void 0:t.length)>0)},A=e=>{var t;return new Date(null==e?void 0:null===(t=e.optIns)||void 0===t?void 0:t.find(e=>["115_12"].includes(null==e?void 0:e.optId)).optChoiceDate.substring(0,10))<new Date("2020-01-01")},N=async(e,t)=>{let o=localStorage.getItem("pendingfor");if(s.default.showCompleteProfile20OrBuildYourProfileSurvey=!1,"completeProfileSurvey"===o)s.default.pendingFor=o,localStorage.removeItem("pendingfor");else if(null==o?void 0:o.includes("PAHCouponId")){let[,e]=o.split("-");s.default.pendingFor=Number(e),s.default.pendingForSignup=Number(e),n.Z.addToBasketPendingWithLogin=!0}if("tapjoy"===t&&!0===s.default.videoGating)(0,m.ZP)(f().earnPoints,f().earnPoints),localStorage.setItem("disableCompleteProfileOverlay","true");else if((null==t?void 0:t.includes("video-gating"))&&!0===s.default.videoGating)(0,m.ZP)(f().earnPoints,f().earnPoints);else if((null==t?void 0:t.includes(u.iohVideoGatingCampaign))&&!0===s.default.iohVideoGating)(0,m.ZP)(f().earnPoints,f().earnPoints);else if(s.default.pendingFor){if(s.default.pendingForSignup=!1,n.Z.addToBasketPendingWithLogin)n.Z.addToBasket(s.default.pendingFor),!(0,S.rt)()&&s.default.rewardStatus&&(n.Z.postLoginOneTimeAddPrompt=!0,(0,S.PC)());else if(l.Z.addToBasketPendingWithLogin){var i,d;await (null===l.Z||void 0===l.Z?void 0:l.Z.fetchdigitalCoupons()),await (null===l.Z||void 0===l.Z?void 0:l.Z.addToBasket(s.default.pendingFor)),s.default.addToBasketPendingWithRegistration=!1;let e=await (null===l.Z||void 0===l.Z?void 0:null===(i=l.Z.couponsToDisplay)||void 0===i?void 0:i.filter(e=>(null==e?void 0:e.id)===(null===s.default||void 0===s.default?void 0:s.default.pendingFor))[0]);(null==e?void 0:e.id)===(null===s.default||void 0===s.default?void 0:s.default.pendingFor)&&void 0!==e&&!(0,S.rt)()&&s.default.rewardStatus&&0!==l.Z.couponsToDisplay.length&&(l.Z.postLoginOneTimeAddPrompt=!0,null===(d=document.getElementById("howDoesitworksD"))||void 0===d||d.scrollIntoView(),(0,S.PC)(),l.Z.clippedCouponerrorScreen=!1)}else l.Z.sendDownloadLinkPendingwithLogin?l.Z.sendDownloadLinkPendingwithLogin():l.Z.linkAccountPendingwithLogin?l.Z.linkAccountPendingwithLogin():"completeProfileSurvey"===s.default.pendingFor?(0,v.zO)():a().push(s.default.pendingFor)}else"coupons"===t?(0,m.ZP)(f().coupons,f().couponsWithEndSlash):"dawn"===(0,m.ak)("utm_campaign_coupon")?(localStorage.setItem("disableCompleteProfileOverlay","true"),(0,m.ZP)(!0,f().coupons)):"sweepstakes"===t?(0,m.ZP)(f().earnPoints,f().earnPoints):"twogether-music-festival"===t?await D("Twogether_Passes")===!0?(await (0,r.jA)(u.enrollmentLocationExternalReference.twogetherMusicFestival),s.default.loginFlowPopup="SuccessfulPromoContent",(0,m.ZP)(f().earnPoints,f().earnPoints),s.default.showTwogetherThanksPopUp=!0,s.default.loginFlowPopup="TmfModalMessageTrue"):(sessionStorage.removeItem("campaignSource"),s.default.loginFlowPopup="IneligiblePromoContent"):"swiffer-coupons"===t?(0,m.ZP)(f().coupons,f().swifferCoupons):"gillette-coupons"===t?(0,m.ZP)(f().coupons,f().gilleteCoupons):"olay-coupons"===t?(0,m.ZP)(f().coupons,f().olayCoupons):t===c.myCoupons?((0,m.ZP)(f().coupons,f().coupons),s.default.showCompleteProfile20Survey=!1,s.default.showCompleteProfile20OrBuildYourProfileSurvey=!1,sessionStorage.setItem("digital-coupons","true")):(0,h.ML)().indexOf(t)>=0?(0,m.ZP)(f().earnPoints,f().earnPoints):"sustainability"===t?(await (0,r.X9)(["Sweep_YO_PG_Complete","Survey_TellMe"])&&(s.default.OpenCampaignSpecificSurvey="1360"),(0,m.ZP)(f().earnPoints,f().earnPoints)):"undefined"!=typeof sessionStorage&&sessionStorage.getItem("brandName")?(0,m.ZP)(!0,f().coupons):s.default.checkLoginStatus?"LoginPage"===e&&!0===s.default.simplifiedSignupFlow?a().push(s.default.redirectionUrlAfterSimplifiedSignup):"LoginPage"===e&&a().push("/"):a().push("/");s.default.rewardStatus=!0,s.default.userLoggedIn=!0,s.default.showSignInPopup=!1,s.default.simplifiedSignupFlow=!1,s.default.simplifiedSignupFlowWithCompleteProfileSurvey=!1,localStorage.removeItem("alreadyRegisteredEmail")},L=(e,t)=>{var o;let i;return null==e||null===(o=e.items)||void 0===o||o.map(e=>((null==e?void 0:e.name)===t&&(i=null==e?void 0:e.isSpecialIncentive),i)),i},F=async(e,t,o)=>{try{let F=s.default.profileData;if(s.default.profileData=F.profile,s.default.traitCampaignName=o,(0,g.WZ)(),F.profile.emailVerified||!C.env.EMAIL_VERIFICATION){var i,n,d,m,v,S,h,w,I,Z,D;if(s.default.charityID=(null===(n=F.profile)||void 0===n?void 0:null===(i=n.traitCharitableCause)||void 0===i?void 0:i.traitValue)===null||(null===(m=F.profile)||void 0===m?void 0:null===(d=m.traitCharitableCause)||void 0===d?void 0:d.traitValue)==="018GPK"?u.defaultCharity:null===(S=F.profile)||void 0===S?void 0:null===(v=S.traitCharitableCause)||void 0===v?void 0:v.traitValue,["downy-unstopables-sample","cascade-platinum-plus-sample","redeem-sample","redeem-offer-sample","swiffer-powermop-sample","cascade-digital-coupons","always-coupon","always-discreet-coupon","cincinnati-music-festiva","hbcyou","dawn-ducks","gillette-labs-coupon","old-spice-coupon","always-discreet-coupon-special-offer","gain-coupon-3","gain-coupon-5"].indexOf(o)>=0){if(F.enrolledForRewards){if(o.includes("-sample")){let t=await (0,g.Nj)(e,o);if((null==t?void 0:null===(h=t.categories)||void 0===h?void 0:h.includes(y))&&((null==t?void 0:null===(w=t.customTags)||void 0===w?void 0:w.includes(T))||(null==t?void 0:null===(I=t.customTags)||void 0===I?void 0:I.includes(E))&&L(e.campaignSamplesIdCollection,o))){let e="/account-setup/".concat(o,"/"),{reRoutePath:t}=s.default;if(t){let o=t&&t.split("?")[1];e+=o?"?".concat(o):""}a().push(e)}else(null==t?void 0:null===(Z=t.categories)||void 0===Z?void 0:Z.includes(y))&&(null==t?void 0:null===(D=t.customTags)||void 0===D?void 0:D.includes(E))&&(s.default.userLoggedIn=!0,s.default.rewardStatus=!0,localStorage.setItem("loggedIn",!0),await (0,r.tH)(),s.default.triggerTrakers="login-success",(0,p.NM)(),s.default.loginFlowPopup="IneligiblePromoContent")}else if(P.revtraxDigitalCouponsCampaign.includes(o)){s.default.cascadeDigitalCampaignName=!0;let e="/account-setup/".concat(o,"/");if(o.includes(c.gainCoupon)){let t=localStorage.getItem("content_id");e="/account-setup/".concat(o,"/?content_id=").concat(t)}a().push(e),s.default.userLoggedIn=!0,s.default.rewardStatus=!0,localStorage.setItem("loggedIn",!0),s.default.triggerTrakers="login-success"}else sessionStorage.removeItem("campaignSource"),s.default.loginFlowPopup="IneligiblePromoContent"}else if(o.includes("-sample")){let e="/account-setup/".concat(o,"/"),{reRoutePath:t}=s.default;if(t){let o=t&&t.split("?")[1];e+=o?"?".concat(o):""}a().push(e)}else sessionStorage.removeItem("campaignSource"),s.default.loginFlowPopup="IneligiblePromoContent"}else F.enrolledForRewards?(s.default.userLoggedIn=!0,s.default.rewardStatus=!0,localStorage.setItem("loggedIn",!0),await (0,r.tH)(),s.default.triggerTrakers="login-success",(0,p.NM)(),s.default.getLoginCount=(0,p.BR)(),N(t,o),window.location.pathname.includes("/email-verification")&&a().push("/")):A(s.default.profileData)?(s.default.traitCampaignName=o,(0,g.h7)(e,a(),F.pggeUser)?s.default.triggerTrakers="campaign":(s.default.showErrorModal=!0,a().push(f().homepage))):((0,g.MI)(a()),(!0===l.Z.addToBasketPendingWithLogin||!0===s.default.sendOTPPendingWithRegistration)&&(s.default.PGEUserLoginTriggeredFromDigitalCoupons=!0))}else s.default.showErrorModal=!0,a().push(f().homepage)}catch(e){s.default.showErrorModal=!0,a().push(f().homepage)}},O=e=>{if(!(0,d.oZ)("localStorage")){s.default.showCookiesDisabledodal=!0;return}if(!e&&window.location.href.includes("?receiptscan")&&(a().push("/earn-points"),localStorage.removeItem("pendingfor")),e){if(window.location.href.includes("ioh-video-gating")&&s.default.iohVideoGating){a().push("".concat(f().login).concat(window.location.search));return}window.location.href.includes("signup")?a().push(f().login):(localStorage.removeItem("alreadyRegisteredEmail"),s.default.context=u.loginContextText.generic,s.default.showSignInPopup=e)}else s.default.showSignInPopup=e,s.default.openFeedbackSurvey=e,s.default.openSurvey=e,sessionStorage.removeItem("surveyId"),localStorage.removeItem("open-surveyId");e||(s.default.pendingFor=!1)},_=async(e,t,o)=>{let i=s.default.profileData,l=(0,g.JF)(e,t),n=await (0,d.uK)(l);if(console.info(await n.json()),200===n.status){s.default.redirectionUrlAfterSimplifiedSignup=localStorage.getItem("redirectionUrlAfterSimplifiedSignup"),localStorage.removeItem("redirectionUrlAfterSimplifiedSignup"),s.default.simplifiedSignupFlowWithCompleteProfileSurvey=localStorage.getItem("simplifiedSignupFlowWithCompleteProfileSurvey"),localStorage.removeItem("simplifiedSignupFlowWithCompleteProfileSurvey");let e=localStorage.getItem("showSurveyAfterCampaignSignup");localStorage.removeItem("showSurveyAfterCampaignSignup"),Z=localStorage.getItem("redirectionUrlAfterSkipping2Screen"),localStorage.removeItem("redirectionUrlAfterSkipping2Screen"),s.default.traitCampaignName=t,s.default.profileData=i.profile,s.default.charityID=s.default.profileData.traitCharitableCause.traitValue=l,"simplified-signup"===(0,m.ak)("flow")&&s.default.simplifiedSignupFlowWithCompleteProfileSurvey?(Z=s.default.redirectionUrlAfterSimplifiedSignup,s.default.showCompleteProfile20Survey=!0):"simplified-signup"===(0,m.ak)("flow")?(Z=s.default.redirectionUrlAfterSimplifiedSignup,s.default.showCompleteProfile20Survey=!0):!0===s.default.videoGating?(s.default.charityID=s.default.profileData.traitCharitableCause.traitValue=u.defaultCharity,Z=f().earnPoints,localStorage.setItem("disableCompleteProfileOverlay","true")):!0===s.default.iohVideoGating?(s.default.charityID=s.default.profileData.traitCharitableCause.traitValue=u.defaultCharity,Z=f().earnPoints):P.revtraxDigitalCouponsCampaign.includes(t)?(s.default.cascadeDigitalCampaignName=!0,Z="/account-setup/".concat(t,"/")):"hbcyou"===t?Z=f().coupons:e?(localStorage.setItem("disableCompleteProfileOverlay","true"),s.default.OpenCampaignSpecificSurvey=(0,I.Z)(e.split("-")[1])):!s.default.addToBasketPendingWithRegistration&&!s.default.sendOTPPendingWithRegistration&&(null==t?void 0:t.includes("account-setup"))&&(Z=f().earnPoints,s.default.openTellMeAboutSurvey=!0),s.default.rewardStatus=!0,s.default.userLoggedIn=!0,localStorage.setItem("loggedIn",!0),"global-citizen"===t||"its-our-home"===t||"its-our-home2"===t||("cincinnati-music-festival"===t?(await (0,r.XZ)(u.enrollmentLocationExternalReference.cincinnatiMusicFestival,1,"Sweeps"),s.default.showCincinnatiThanksPopUp=!0):t===c.myCoupons&&(sessionStorage.setItem("digital-coupons","true"),s.default.showCompleteProfile20Survey=!1)),s.default.triggerTrakers="campaign",(0,g.MI)(a(),Z,o)}else s.default.showErrorModal=!0,a().push(f().homepage);(0,g.WZ)()}}}]);