(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[33099],{593559:(e,o,t)=>{t.d(o,{Z:()=>c});var n=t(667294),i=t(124580),s=t(223815),a=t(662730),l=t(883119),r=t(785893);function c({children:e,headingNode:o,heading:t,onDismiss:c,size:d}){return(0,n.useEffect)((()=>(i.Z.pause(),function(){i.Z.resume()})),[]),(0,r.jsx)(l.mh,{zIndex:a.C,children:(0,r.jsx)(s.Z,{allowEsc:!0,children:(0,r.jsx)(l.u_,{accessibilityModalLabel:t,heading:o||t,onDismiss:()=>{i.Z.resume(),c()},role:"alertdialog",size:d||"md",padding:"none",children:e})})})}},743678:(e,o,t)=>{t.d(o,{Z:()=>l});var n=t(593559),i=t(898781),s=t(883119),a=t(785893);function l({onClose:e}){const o=(0,i.ZP)();return(0,a.jsxs)(n.Z,{heading:o.bt("Too many login attempts", "Oops! Too many login attempts", "LoginRateLimitedModal.Modal.Heading", undefined, true),onDismiss:e,size:"sm",headingNode:(0,a.jsxs)(s.xu,{children:[(0,a.jsx)(s.xu,{padding:6,justifyContent:"center",display:"flex",children:(0,a.jsx)(s.JO,{icon:"pinterest",accessibilityLabel:o.bt("Pinterest logo", "Pinterest logo", "Accessibility label for Pinterest icon", undefined, true),color:"brandPrimary",size:40})}),(0,a.jsx)(s.X6,{align:"center",size:"500",accessibilityLevel:1,children:o.bt("Too many login attempts", "Oops! Too many login attempts", "LoginRateLimitedModal.Modal.Heading", undefined, true)})]}),children:[(0,a.jsx)(s.xu,{paddingX:12,marginTop:4,marginBottom:12,children:(0,a.jsx)(s.xv,{align:"center",children:o.bt("You have reached the maximum number of login attempts. Try again in 30 minutes.", "You have reached the maximum number of login attempts. Try again in 30 minutes.", "LoginRateLimitedModal.Modal.Heading", undefined, true)})}),(0,a.jsx)(s.xu,{paddingX:12,marginBottom:8,justifyContent:"center",display:"flex",children:(0,a.jsx)(s.zx,{fullWidth:!0,color:"red",text:o.bt("OK", "Okay", "LoginRateLimitedModal.Modal.OkButton", undefined, true),onClick:e})})]})}},996438:(e,o,t)=>{t.d(o,{Z:()=>B});var n=t(667294),i=t(379913),s=t(803491),a=t(199324),l=t(336882),r=t(935879),c=t(910702),d=t(883119),u=t(785893);function _({anchor:e,message:o,children:t}){const[i,s]=(0,n.useState)(!!o);return(0,n.useEffect)((()=>{s(!!o)}),[o]),i&&o?(0,u.jsx)(d.J2,{anchor:e,color:"darkGray",idealDirection:"right",onDismiss:()=>s(!0),shouldFocus:!1,size:"md",children:(0,u.jsx)(d.xu,{column:12,padding:3,children:t?(0,u.jsx)("span",{children:t}):(0,u.jsx)("span",{dangerouslySetInnerHTML:{__html:o},style:{overflowWrap:"break-word",wordWrap:"break-word",color:"white",fontWeight:"bold"}})})}):null}var h=t(989392),g=t(290148),p=t(830269),b=t(174382),m=t(70212),w=t(85334),f=t(19121),x=t(901656),y=t(45169),k=t(905171),v=t(773285),C=t(402201);const S=({onError:e,onEventReceived:o,onSuccess:n,rerequestFacebookEmail:i,viewer:s})=>{let a=null;const l=t=>{const i=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");if(t.origin!==i)return;if("social-connect-complete"!==t.data.type&&"social-connect-error"!==t.data.type)return;const s=t.data;"facebook"===s.network&&(o(),clearInterval(a),"social-connect-error"===s.type?e("OTHER_ERROR"):n({type:"PROFILE",profile:s.profile}))};if(window.addEventListener("message",l),i)t.e(51798).then(t.bind(t,107193)).then((({default:o})=>{o((o=>{o.login((o=>{var t;"connected"===o.status&&((null===(t=o.authResponse.grantedScopes)||void 0===t?void 0:t.split(","))||[]).includes("email")?n({type:"ACCESS_TOKEN",id:o.authResponse.userID,access_token:o.authResponse.accessToken}):e("OTHER_ERROR")}),{scope:"email",auth_type:"rerequest",return_scopes:!0})}),s)}));else{const o=(0,C.Z)(),t=window.open("/connect/facebook/","",o);t?a=setInterval((()=>{t.closed&&(clearInterval(a),e("OTHER_ERROR"))}),1e3):e("POPUP_DISABLED")}return{unsubscribe:()=>{window.removeEventListener("message",l)}}};var A=t(898781),P=t(467570),j=t(867820),E=t(233211),z=t(584595),F=t(780280),L=t(903095);function M(e,o,t){return o in e?Object.defineProperty(e,o,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[o]=t,e}class Z extends n.Component{constructor(...e){var o;super(...e),o=this,M(this,"state",{showModal:!1}),M(this,"unsubscribeThisButton",null),M(this,"loginWithFacebook",(({facebookConnectData:e,isFromStatusChange:o,isAccountSwitch:t,handlePostSuccessConnect:n,loadingIndicatorCallback:s})=>{const{checkExperiment:a,container:l,desktopCoreLoginContext:{getDeviceAppTypeString:r},i18n:c,login:d,onLoginWithMfa:u,onLoginWithSuspended:_,pageContext:h,showResponseMessageModal:p,showLoginRateLimited:b,socialSignupCallbacks:w}=this.props,f={container:l,page:null==h?void 0:h.pageType},x="PROFILE"===(y=e).type?{facebook_id:y.profile.id}:{facebook_id:y.id,facebook_token:y.access_token};var y;d({creds:x,loggingOptions:{loggingData:f,loginAttemptContextEvent:this.signupLoginContextEvent(7534)},isAccountSwitch:t}).then((e=>{var o,s;const c=null==e||null===(o=e.resource_response)||void 0===o||null===(s=o.data)||void 0===s?void 0:s.user;t&&c&&(0,i.Z)(c,"facebook",l),(0,j.My)("login.facebook."+r()),p?p(!0):g.ZP.handleRedirect(this.props.nextUrlParam||g.ZP.defaultSocialLoginRedirectUrl()),null==n||n(),a("m10n_measurement_pinterest_tag_us").anyEnabled&&(0,m.Z)()}),(t=>{var n;t.api_error_code===z.Zn?(null==s||s(!1),(0,j.My)("login.facebook."+r()),null==u||u(x,{phoneNumberEnd:null===(n=t.data)||void 0===n?void 0:n.phone_number_end})):t.api_error_code===z.xN||t.api_error_code===z.lg?"ACCOUNT_RECOVERY"===w.type?w.switchToAccountRecoverySignupFlow("facebook"):this.registerWithFacebook({facebookConnectData:e,loggingData:f,isFromStatusChange:o,switchToSocialSignupWithAgeFlow:w.switchToSocialSignupWithAgeFlow}):[z.ik].includes(t.api_error_code)?null==b||b():(t.api_error_code&&(0,j.My)(`facebook_button.failed_login_${t.api_error_code}`),t.api_error_code===z.an&&_?_():(0,k.x)(c.bt("Sorry, we can't log you in.", "Sorry, we can't log you in.", "error message when user failed to login caused by suspend/deactivated etc.", undefined, true)))}))})),M(this,"statusChangeCallback",(e=>{var o,t;null===(o=(t=this.props).onClick)||void 0===o||o.call(t);const{connectErrorMessage:n,handlePostSuccessConnect:i,isAccountSwitch:s,loadingIndicatorCallback:a}=this.props;let l;if("connected"===e.status){const{authResponse:o}=e;(0,j.My)("web.facebook_connect_button.login_status.connected"),null==a||a(!0),this.loginWithFacebook({facebookConnectData:{type:"ACCESS_TOKEN",id:o.userID,access_token:o.accessToken},isFromStatusChange:!0,isAccountSwitch:s,handlePostSuccessConnect:i,loadingIndicatorCallback:a}),l="success"}else"not_authorized"===e.status?((0,j.My)("web.facebook_connect_button.cancel.not_authorized"),(0,k.x)(n),l="not_authorized"):((0,j.My)("web.facebook_connect_button.cancel.unknown"),(0,k.x)(n),l="other_error");const{handlePostConnectClick:r}=this.props;null==r||r(l)})),M(this,"showDefaultError",(()=>{const{i18n:e,loadingIndicatorCallback:o}=this.props;null==o||o(!1),(0,k.x)(e.bt("Email address required for registration.", "Email required for registration.", " - ", undefined, true))})),M(this,"registerWithFacebook",(async function({facebookConnectData:e,loggingData:t,isFromStatusChange:n,switchToSocialSignupWithAgeFlow:i}){const{desktopCoreLoginContext:{register:s},disablePostSignupNextUrl:a,loadingIndicatorCallback:l,nextUrlParam:r,onFBMissingEmail:d,onFBPhoneOnlyConnectVerified:u,showResponseMessageModal:_,showSignupWelcomeLoadingFn:p}=o.props,b=()=>{o.showDefaultError(),n||(o.rerequestFacebookEmail=!0)};let m=null;if("PROFILE"===e.type)m={...e.profile};else try{m=await(0,P.MI)(e.access_token)}catch(v){b()}if(!m)return;const w=(0,c.Z)(m),f={type:"facebook",context:t,signupOptions:w};if(!m.email)return void(u?(n||null==l||l(!1),u(f)):n&&d?d(f):b());const x={birthday_source_site:y.E_.FACEBOOK,email_source_site:y.E_.FACEBOOK};if(!n)return void i(f);const{birthday:k}=w;if(void 0===k||!(0,h.Z)(k))return null==l||l(!1),void i({...f,signupOptions:{...f.signupOptions,email_source_site:y.E_.FACEBOOK}});_||null==p||p(!0);try{await s({...w,...x,birthday:k},{signupContext:t,signupAttemptContextEvent:o.signupLoginContextEvent(7537)})}catch(v){b()}_?_(!0):g.ZP.handleSignupRedirect(n?r:r||window.location.pathname,a)}))}componentDidMount(){if(this.props.webFacebookDisabled)return;"undefined"!=typeof window&&(window.statusChangeCallback=this.statusChangeCallback,window.checkLoginState=()=>this.checkLoginState(),window.fbConnectButtonContainerStack?window.fbConnectButtonContainerStack.push(this.props.container):window.fbConnectButtonContainerStack=[this.props.container],window.nextUrlParam=this.props.nextUrlParam,window.fbButtonMounted=window.fbButtonMounted?window.fbButtonMounted+1:1);const{requestContext:{userAgent:{platform:e}}}=this.props;if(["ios","ipad"].includes(e))if(window.fb_init!==l.Z.STARTED&&window.fb_init!==l.Z.FINISHED)this.initializeFB();else if(window.fb_init===l.Z.FINISHED&&window.FB.XFBML)window.FB.XFBML.parse();else{const e=setInterval((()=>{window.fb_init===l.Z.FINISHED&&window.FB.XFBML&&(window.FB.XFBML.parse(),clearInterval(e))}),100)}else setTimeout((()=>{window.__branchRedirectToStore||!window.__branchPinterestStarted?this.initializeFB():window.onbeforeunload=()=>{window.__branchRedirectToStore&&this.initializeFB()}}),50);var o,t,n,i;this.props.isRerequest&&(null===(o=(t=this.props).loadingIndicatorCallback)||void 0===o||o.call(t,!1),null===(n=(i=this.props).showSignupWelcomeLoadingFn)||void 0===n||n.call(i,!1))}componentDidUpdate(){window.nextUrlParam=this.props.nextUrlParam}componentWillUnmount(){if("undefined"!=typeof window){if(window.fbButtonMounted-=1,window.fbConnectButtonContainerStack){const e=window.fbConnectButtonContainerStack.indexOf(this.props.container);e>=0&&window.fbConnectButtonContainerStack.splice(e,1)}0===window.fbButtonMounted&&(delete window.statusChangeCallback,delete window.checkLoginState,delete window.nextUrlParam)}}initializeFB(){const{requestContext:{locale:e}}=this.props;null!==this.profilePicButton&&(void 0!==window.FB&&null!==window.FB?window.FB.XFBML.parse():(window.fbAsyncInit=()=>(0,P.sl)(),((o,t,n)=>{const i=o.getElementsByTagName(t)[0];if(o.getElementById(n))return;const s=o.createElement(t);s.id=n,s.src=(0,r.Z)(e),i&&i.parentNode&&i.parentNode.insertBefore(s,i)})(document,"script","facebook-jssdk")))}checkLoginState(){window.FB.getLoginStatus((function(e){this.statusChangeCallback&&this.statusChangeCallback(e)}))}signupLoginContextEvent(e){const{desktopCoreLoginContext:{viewer:o}}=this.props;return{event_type:e,aux_data:{...(0,x.Z)(o.type),signup_login_method:p.Z.FACEBOOK}}}renderProfilePicButtonWithFallback(){const{i18n:e,isRerequest:o,showFallback:t}=this.props;return(0,u.jsxs)(d.xu,{"data-test-id":"facebook-connect-button",ref:e=>{this._fallbackButton=e},children:[(0,u.jsx)(s.Z,{onClick:()=>{var e;const{connectErrorMessage:o,desktopCoreLoginContext:{getDeviceAppTypeString:t},i18n:n,webFacebookDisabled:i,viewer:s}=this.props;if(i)return void this.setState({showModal:!0});(0,j.My)("fallback_facebook_button.click"),(0,j.NC)("press_facebook_login_fallback"),(0,j.My)("unauth_web.facebook_connect.manual.attempt"),(0,j.My)(`unauth_web.social_connect.facebook.${t()}`),null===(e=this.unsubscribeThisButton)||void 0===e||e.call(this);const{unsubscribe:a}=S({onSuccess:e=>{(0,j.My)("unauth_web.facebook_connect.manual.success"),this.loginWithFacebook({facebookConnectData:e,isFromStatusChange:!1})},onError:e=>{(0,j.My)("unauth_web.facebook_connect.manual.failure"),(0,k.x)("POPUP_DISABLED"===e?n.bt("You must enable pop-ups.", "You must enable popups!", " - ", undefined, true):o)},onEventReceived:()=>{var e;null===(e=this.unsubscribeThisButton)||void 0===e||e.call(this)},rerequestFacebookEmail:this.rerequestFacebookEmail,viewer:s});this.unsubscribeThisButton=()=>{a(),this.unsubscribeThisButton=null}},styleOverrides:{backgroundClip:"padding-box",backgroundColor:"#1877F2",display:"block",fontWeight:"normal",height:"40px",marginTop:"0px",padding:"0px 0px 0px 8px",position:t?"relative":"absolute",textAlign:"left",transition:"opacity .2s linear",width:"100%",borderRadius:"20px"},tabIndex:-1,children:(0,u.jsxs)(d.kC,{alignItems:"stretch",justifyContent:"start",children:[(0,u.jsx)(d.xu,{color:"default",rounding:"circle",marginStart:1,dangerouslySetInlineStyle:{__style:{paddingTop:4,paddingBottom:3,paddingRight:3,paddingLeft:3}},height:24,width:24,children:(0,u.jsx)(d.JO,{accessibilityLabel:e.bt("Facebook", "facebook", "accessible label for facebook icon", undefined, true),color:"shopping",icon:"facebook",inline:!0,size:19})}),(0,u.jsx)("span",{style:{color:"#fff",display:"inline-block",fontFamily:a.Z,fontSize:"16px",fontWeight:"bold",letterSpacing:"0.1px",lineHeight:"15px",marginRight:"24px",marginLeft:"15px",paddingTop:"4px",textAlign:"center",verticalAlign:"text-bottom",WebkitFontSmoothing:"auto",whiteSpace:"normal",width:"88%"},children:e.bt("Continue with Facebook", "Continue with Facebook", " - ", undefined, true)})]})}),!t&&(0,u.jsx)(d.xu,{height:40,dangerouslySetInlineStyle:{__style:{textAlign:"left"}},ref:e=>{this.profilePicButton=e},children:(0,u.jsx)("div",{className:"fb-login-button","data-auth-type":o?"rerequest":void 0,"data-button-type":"continue_with","data-layout":"rounded","data-onlogin":"checkLoginState","data-scope":P.$.join(","),"data-size":"large","data-use-continue-as":"true","data-width":"268px"})})]})}render(){const{tooltip:e}=this.props;return(0,u.jsxs)("div",{style:{position:"relative"},children:[this.renderProfilePicButtonWithFallback(),!!e&&(0,u.jsx)(_,{anchor:this._fallbackButton,message:e}),this.state.showModal&&(0,u.jsx)(b.Z,{type:"facebook",onDismiss:()=>this.setState({showModal:!1})})]})}}function B(e){const o=(0,A.ZP)(),t=(0,F.B)(),n=(0,E.B$)(),i=(0,L.lO)(),{checkExperiment:s}=(0,v.F)(),{anyEnabled:a}=s("web_facebook_disabled"),l=(0,f.Z)();return(0,u.jsx)(Z,{...e,connectErrorMessage:o.bt("Couldn't connect. You need to authorise Pinterest.", "Couldn't connect. You must authorize Pinterest.", " - ", undefined, true),desktopCoreLoginContext:n,i18n:o,login:(0,w.Z)(),requestContext:t,pageContext:i,webFacebookDisabled:a,viewer:l,checkExperiment:s})}},611683:(e,o,t)=>{t.d(o,{Z:()=>E});var n=t(667294),i=t(379913),s=t(711781),a=t(803491),l=t(472644),r=t(174382),c=t(640672),d=t(898781),u=t(883119),_=t(785893);function h(e){const o=(0,d.ZP)(),{tooltip:t}=e,[i,s]=(0,n.useState)();return(0,_.jsxs)(u.xu,{"data-test-id":"google-connect-button",position:"relative",children:[(0,_.jsx)(a.Z,{onClick:()=>s(!0),type:"button",styleOverrides:{width:"100%",borderRadius:"20px",border:"0px solid"},children:(0,_.jsxs)(u.kC,{alignItems:"center",justifyContent:"center",children:[(0,_.jsx)(u.xu,{height:24,width:24,marginTop:1,children:(0,_.jsx)(l.Z,{size:20})}),(0,_.jsx)(u.xu,{marginStart:2,children:(0,_.jsx)(u.xv,{weight:"bold",children:o.bt("Connect with Google", "Connect with Google", "googleConnectButtonWithDisabledSDK.buttonText", undefined, true)})})]})}),!!t&&(0,_.jsx)(u.xu,{position:"absolute",dangerouslySetInlineStyle:{__style:{top:"12px",left:"100%"}},children:(0,_.jsx)(c.Z,{message:t})}),i&&(0,_.jsx)(r.Z,{type:"google",onDismiss:()=>s(!1)})]})}var g=t(290148),p=t(830269),b=t(70212),m=t(85334),w=t(829407),f=t(901656),x=t(905171),y=t(233211),k=t(773285),v=t(524172),C=t(903095),S=t(780280),A=t(83969),P=t(584595);const j=({container:e,isAccountSwitch:o,nextUrlParam:t,onLoginWithMfa:a,onLoginWithSuspended:l,onLoginWithVoluntarilyDeactivated:r,showResponseMessageModal:h,socialSignupCallbacks:j,tooltip:E,showLoginRateLimited:z,onClick:F})=>{const{viewer:{type:L}}=(0,y.B$)(),M=(0,m.Z)(),Z=(0,C.lO)(),B=(0,d.ZP)(),{checkExperiment:O}=(0,k.F)(),D=(0,v.M)(),I=(0,n.useRef)(null),T=O("dweb_google_button_locale_fix").anyEnabled,{locale:R}=(0,S.B)(),N=T?R:void 0;return(0,w.Z)((()=>(window.googleConnectButtonContainer=e||"",()=>{delete window.googleConnectButtonContainer}))),(0,w.Z)((()=>{const n=({credential:n,select_by:c})=>{const d=(0,A.mK)((0,A.PL)(c));M({creds:{google_open_id_token:n},loggingOptions:{loggingData:{container:window.googleConnectButtonContainer,page:null==Z?void 0:Z.pageType,trigger:d},loginAttemptContextEvent:{event_type:7534,element:12981,aux_data:{...(0,f.Z)(L),signup_login_method:p.Z.GPLUS}}},isAccountSwitch:o}).then((n=>{var s,a;const l=null==n||null===(s=n.resource_response)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.user;o&&l&&(0,i.Z)(l,"google",e),h?h(!1):g.ZP.handleRedirect(t||g.ZP.defaultSocialLoginRedirectUrl()),O("m10n_measurement_pinterest_tag_us").anyEnabled&&(0,b.Z)()}),(e=>{switch(P.ik.includes(e.api_error_code)&&(null==z||z()),e.api_error_code){case P.E6:null==r||r(e.message);break;case P.Zn:var o;null==a||a({google_open_id_token:n},{phoneNumberEnd:null===(o=e.data)||void 0===o?void 0:o.phone_number_end});break;case P.xN:if("ACCOUNT_RECOVERY"===j.type)j.switchToAccountRecoverySignupFlow("google");else{const e=(0,s.Z)(n),o={container:window.googleConnectButtonContainer,page:null==Z?void 0:Z.pageType,trigger:d},t={type:"google",google_open_id_token:n,first_name:e.given_name,last_name:e.family_name,image_url:e.picture};j.switchToSocialSignupWithAgeFlow({type:"google",context:o,signupOptions:{...t}})}break;default:e.api_error_code===P.an&&l?l():(0,x.x)(B.bt("Sorry, we can't log you in.", "Sorry, we can't log you in.", "error message when user failed to login caused by suspend/deactivated etc.", undefined, true))}}))};return(async()=>{await(null==D?void 0:D.ensureInit("button",n)),(0,A.ru)({buttonRef:I,isDesktop:!0,locale:N})})(),()=>{null==D||D.removeButtonCallback(n)}})),(0,_.jsxs)(u.xu,{"data-test-id":"google-connect-button",position:"relative",children:[(0,_.jsx)(u.xu,{height:44,children:(0,_.jsx)("div",{ref:I,style:{position:"absolute",width:"100%"},onClick:()=>{null==F||F()}})}),!!E&&(0,_.jsx)(u.xu,{position:"absolute",dangerouslySetInlineStyle:{__style:{top:"12px",left:"100%"}},children:(0,_.jsx)(c.Z,{message:E})})]})};function E(e){const{checkExperiment:o}=(0,k.F)(),{anyEnabled:t}=o("web_google_disabled");return t?(0,_.jsx)(h,{tooltip:e.tooltip}):(0,_.jsx)(j,{...e})}},174382:(e,o,t)=>{t.d(o,{Z:()=>l});var n=t(121151),i=t(898781),s=t(883119),a=t(785893);function l({type:e,onDismiss:o}){const t=(0,i.ZP)(),l="facebook"===e?t.bt("Facebook isn't available", "Oops! Facebook isn't available", "socialAuthDisabled.facebook.title", undefined, true):t.bt("Google isn't available", "Oops! Google isn't available", "socialAuthDisabled.google.title", undefined, true),r="facebook"===e?t.bt("It looks as though Facebook isn't available at the moment. Give another option a try or refresh the page and try again later.", "Looks like Facebook isn't available right now. Give another option a try or refresh the page and try again later.", "socialAuthDisabled.facebook.description", undefined, true):t.bt("It looks as though Google isn't available at the moment. Give another option a try or refresh the page and try again later.", "Looks like Google isn't available right now. Give another option a try or refresh the page and try again later.", "socialAuthDisabled.google.description", undefined, true);return(0,a.jsx)(n.ZP,{accessibilityModalLabel:l,footer:(0,a.jsx)(s.kC,{alignItems:"center",justifyContent:"center",children:(0,a.jsx)(s.xu,{paddingX:1,children:(0,a.jsx)(s.zx,{color:"red",onClick:o,text:t.bt("OK", "OK", "socialAuthDisabled.okButton", undefined, true),size:"md"})})}),heading:l,onDismiss:o,children:(0,a.jsx)(s.xu,{paddingX:5,children:(0,a.jsx)(s.xv,{align:"center",children:r})})})}},841957:(e,o,t)=>{t.r(o),t.d(o,{default:()=>S});var n=t(667294),i=t(116303),s=t(996438),a=t(611683),l=t(755742),r=t(743678),c=t(622096),d=t(563387),u=t(898781),_=t(52022),h=t(8573),g=t(183007),p=t(867820),b=t(407043),m=t(773285),w=t(385740),f=t(780280),x=t(780679),y=t(883119),k=t(785893);const v=new y.H3([g.N]),C={attributionLabel:"unauth_hybrid_banner",source:"login",container:"bottom.right.upsell.email",reason:"CLICK_LOGIN_OR_SIGNUP"};function S({inviter:e,shouldShowBanner:o,bottomRightUpsellV2ExpGroup:t,setHasDismissedBottomRightUpsellForPage:g}){const{isRTL:S}=(0,f.B)(),A=(0,u.ZP)(),{checkExperiment:P}=(0,m.F)(),j=(0,x.g)(),E=e&&(e.first_name||e.full_name)||"",[z,F]=(0,n.useState)(!1),{logContextEvent:L}=(0,b.v)(),M=(0,_.Z)(),{viewType:Z,viewParameter:B}=(0,w.SU)(),O=t.startsWith("enabled_dismissible"),D=e=>{L({view_type:Z,view_parameter:B,component:14216,element:e,event_type:10441,aux_data:{upsell_reason:"scroll_down"}})},I=()=>{const e=P("pcons_bottom_right_upsell_copy").group;return E?{header:(A.bt("Join {{ name }} on Pinterest for more ideas", "Join {{ name }} on Pinterest for more ideas", "dweb.unauth.bottom_right_upsell.header_copy_from_sender_{{ name }}", undefined, true)).replace("{{ name }}",E),subheader:A.bt("Sign in to get the best experience", "Sign in to get the best experience", "dweb.unauth.bottom_right_upsell.subheader_copy", undefined, true)}:"enabled_save"===e?{header:A.bt("Save ideas you see", "Save ideas you see", "dweb.unauth.bottom_right_upsell.header_copy", undefined, true),subheader:A.bt("Sign in to your account", "Sign into your account", "dweb.unauth.bottom_right_upsell.subheader_copy", undefined, true)}:"enabled_browse"===e?{header:A.bt("Browse better", "Browse better", "dweb.unauth.bottom_right_upsell.header_copy", undefined, true),subheader:A.bt("Sign in to your Pinterest account", "Sign into your Pinterest account", "dweb.unauth.bottom_right_upsell.subheader_copy", undefined, true)}:{header:A.bt("You are signed out", "You are signed out", "dweb.unauth.bottom_right_upsell.header_copy", undefined, true),subheader:A.bt("Sign in to get the best experience", "Sign in to get the best experience", "dweb.unauth.bottom_right_upsell.subheader_copy", undefined, true)}};return(0,k.jsxs)("div",{"data-test-id":"giftWrap",style:{position:"fixed",zIndex:3},onKeyDown:e=>{e.keyCode===l.Z.ESCAPE&&(0,p.My)("unauth.authentication_modal.esc_key_click.NOT_NOW_BUTTON.signupOrPersonalizedLogin")},role:"dialog","aria-label":"Hybrid banner gift wrap",children:[z&&(0,k.jsx)(r.Z,{onClose:()=>F(!1)}),(0,k.jsxs)(y.xu,{"data-test-id":"bottom-right-upsell",alignItems:"center",bottom:!0,left:S,right:!S,direction:"column",display:"flex",color:"default",paddingX:8,paddingY:8,position:"fixed",rounding:6,marginBottom:6,marginEnd:6,marginStart:6,maxWidth:350,zIndex:v,dangerouslySetInlineStyle:{__style:{boxShadow:"0 1px 20px 0 rgba(0, 0, 0, 0.1)",transition:"all 0.3s ease-in-out",transform:o?"translateY(0)":"translateY(370px)"}},children:[O&&(0,k.jsx)(y.xu,{width:"100%",children:(0,k.jsx)(y.xu,{position:"absolute",top:!0,right:!0,marginTop:1,marginEnd:1,children:(0,k.jsx)(y.hU,{accessibilityLabel:A.bt("Close bottom right upsell", "Close Bottom Right Upsell", "close.bottom.right.upsell", undefined, true),icon:"cancel",iconColor:"darkGray",onClick:()=>{g(!0),t.startsWith("enabled_dismissible_for_session")&&c.Z.setItem(h.h,!0),(0,p.My)(`unauth.dweb.bottom_right_upsell.close_button.click.${t}`),L({event_type:10243,element:13319,component:14216,aux_data:{upsell_reason:"scroll_down"}}),(0,p.My)("bottom.right.upsell.dismiss.by.click.close.button")},size:"md"})})}),(0,k.jsx)(y.xu,{flex:"grow",children:e&&!e.is_default_image&&o?(0,k.jsxs)(y.xu,{"data-test-id":"invite_banner",display:"flex",justifyContent:"between",alignItems:"center",direction:"column",alignContent:"center",children:[(0,k.jsx)(y.xu,{marginBottom:4,children:(0,k.jsx)(i.Z,{name:e.full_name,size:"sm",src:e.image_medium_url,outline:!0})}),(0,k.jsx)(y.xu,{marginBottom:4,children:(0,k.jsx)(y.X6,{overflow:"normal",size:"400",align:"center",children:I().header})})]}):(0,k.jsxs)(y.xu,{marginBottom:6,children:[(0,k.jsx)(y.xu,{marginBottom:2,children:(0,k.jsx)(y.X6,{overflow:"normal",size:"400",align:"center",accessibilityLevel:2,children:I().header})}),(0,k.jsx)(y.xv,{overflow:"normal",align:"center",children:I().subheader})]})}),(0,k.jsxs)(y.kC,{alignItems:"stretch",justifyContent:"center",direction:"column",children:[(0,k.jsx)(y.xu,{"data-test-id":"emailSignUpButton",children:(0,k.jsx)(y.zx,{fullWidth:!0,text:A.bt("Continue with email", "Continue with email", "unauth.dweb.continue.with.email.button.text", undefined, true),color:"red",onClick:()=>{D(13506),(0,p.My)("bottom.right.upsell.email.button.click"),M({action:"click",item:"email-signup-button",within:"bottom-right-upsell"}),null==j||j.showDesktopSignupModal({...C,signupFlow:{type:"login"}})}})}),(0,k.jsx)(y.xu,{marginTop:1,children:(0,k.jsx)(a.Z,{onClick:()=>{D(13504),(0,p.My)("bottom.right.upsell.google.button.click")},showLoginRateLimited:()=>F(!0),socialSignupCallbacks:{type:"SOCIAL_SIGNUP_WITH_AGE",switchToSocialSignupWithAgeFlow:e=>{null==j||j.showDesktopSignupModal({...C,attributionLabel:"unauth_hybrid_banner_google",signupFlow:{type:"socialSignupWithAge",registrationCredentials:e}})}}})}),(0,k.jsx)(s.Z,{onClick:()=>{D(13505),(0,p.My)("bottom.right.upsell.facebook.button.click")},showLoginRateLimited:()=>F(!0),socialSignupCallbacks:{type:"SOCIAL_SIGNUP_WITH_AGE",switchToSocialSignupWithAgeFlow:e=>{null==j||j.showDesktopSignupModal({...C,attributionLabel:"scroll_down",signupFlow:{type:"socialSignupWithAge",registrationCredentials:e}})}}}),(0,k.jsx)(y.xu,{dangerouslySetInlineStyle:{__style:{textAlign:"center"}},children:(0,k.jsx)(d.Z,{dark:!0})})]})]})]})}},910702:(e,o,t)=>{t.d(o,{Z:()=>i});var n=t(816068);const i=e=>({type:"facebook",first_name:e.first_name,last_name:e.last_name,email:e.email,gender:e.gender,image_url:e.picture&&!e.picture.data.is_silhouette?e.picture.data.url:void 0,facebook_id:e.id,facebook_token:e.access_token,birthday:e.birthday?(0,n.Z)(e.birthday):void 0})},70212:(e,o,t)=>{t.d(o,{Z:()=>i});var n=t(214494);const i=async()=>{try{var e,o,t,i;const s=await n.Z.create("ApiResource",{url:"/v3/users/me/"}).callGet(),a=(null===(e=s.resource_response)||void 0===e||null===(o=e.data)||void 0===o?void 0:o.email)||(null===(t=((null===(i=s.resource_response)||void 0===i?void 0:i.client_context)||Object.freeze({})).user)||void 0===t?void 0:t.email);"undefined"!=typeof window&&window.pintrk("track","custom",{lead_type:"Pinterest Login",em:a})}catch(s){}}},85334:(e,o,t)=>{t.d(o,{Z:()=>y});var n=t(667294),i=t(231486),s=t(807998),a=t(383690),l=t(69642),r=t(584595),c=t(330102),d=t(290148),u=t(817656),_=t(532975),h=t(762752),g=t(407043),p=t(283943),b=t(214494),m=t(995146),w=t(867820),f=t(226198),x=t(529195);function y(){const e=(0,p.hq)(),o=(0,a.Z)(),{logContextEvent:t}=(0,g.v)(),y=(0,l.Z)();return(0,n.useCallback)((({creds:n,isAccountSwitch:a,loggingOptions:{loggingData:l=Object.freeze({}),loginAttemptContextEvent:g},recaptchaV2Token:p,recaptchaV3Token:k})=>{o();const v=!(!n.facebook_autologin&&!n.autologin),C=(0,d.eD)(n),S=e=>{const o=n.google_open_id_token?"google":"facebook";v&&(0,w.dy)({event:e,provider:o})};t({...g,event_type:7534}),y({action:v?"autologin":"login",event:"attempt",trigger:l.trigger,type:C});const A=e=>{let o="referrer_unknown";try{const e=document.referrer;o=e?e.indexOf("/t.co/")>-1?"twitter":e.indexOf("google.")>-1?"google":e.indexOf("bing.")>-1?"bing":e.indexOf("facebook.")>-1?"facebook":"other":"direct"}catch(r){}const i=l===Object(l)?l.container:"container_unknown";(0,w.My)("login.referrer."+o+"."+C),(0,w.My)("login.container."+String(i)+"."+C),(0,w.My)("login.type."+C);const s=C||"method_unknown",a=l.page||"page_unknown";n.facebook_autologin?((0,w.My)("web_autologin_facebook"),(0,w.My)("new_web_autologin_facebook",{page:a,referrer:o,container:i})):((0,w.My)(`web_login.${s}.success.${a}.${String(i)}.${o}.tier1`),(0,w.My)(`new_web_login.${s}.success`,{page:a,referrer:o,container:i})),(0,c.ko)({country:null==e?void 0:e.country,countryFromHostName:null==e?void 0:e.countryFromHostName,countryFromIp:null==e?void 0:e.countryFromIp,regionFromIp:null==e?void 0:e.regionFromIp,deviceType:"Desktop",eventCategory:"Logins"}),t({...g,event_type:7536}),y({action:v?"autologin":"login",event:"success",trigger:l&&l.trigger,type:C})},P=({error:e,isCrossDomain:o})=>{if(!e)return;const n=e.http_status===u.Ej?u.Ej:e.api_error_code;let i=n;n&&r.qF.has(n)&&(i=r.qF.get(n));const{container:s,trigger:a}=l;(0,w.My)(`${o?"unauth_web_client_cctld_login_api_error":"unauth_web_client_login_api_error"}.${String(i)}.${s||"unknow_container"}.${C}`),t({...g,event_type:7535}),y({action:v?"autologin":"login",event:"fail",trigger:a,type:C})};if(n.username_or_email&&!n.mfa_resend&&e&&-1!==s.Z.indexOf(e.origin)){const o=e=>(0,w.My)(`web_cross_domain_login.${e}.${(0,d.eD)(n)}`);o("attempt");const{referrer:t,facebookToken:i,unauthId:s}=e;return(0,m.pH)(n,{recaptchaV3Token:k,referrer:t,facebookToken:i,unauthId:s}).then((e=>{const t=e&&e.data;if(t)return o("success_with_token"),(0,m.kv)(t).then((e=>(o("success_token_exchanged"),A(),Promise.resolve())),(e=>{throw o("success_token_not_exchanged"),e}));throw o("success_without_token"),new Error}),(e=>{throw o("failure"),P({error:e,isCrossDomain:!0}),e}))}S("login_api_call_start");const j=(0,x.OJ)();return b.Z.create("UserSessionResource",{...n,...j?{referrer:j}:Object.freeze({}),get_user:n.get_user||n.switch_account&&a,app_type_from_client:7===e.appType?7:5,visited_pages_before_login:(0,x.t_)()||null,recaptchaV2Token:p,recaptchaV3Token:k}).callCreate({showError:!1,async:!0}).then((e=>{const{country:o,country_from_hostname:t,country_from_ip:n,region_from_ip:s}=(null==e?void 0:e.client_context)||Object.freeze({});return A({country:o,countryFromHostName:t,countryFromIp:n,regionFromIp:s}),S("login_api_call_success"),(0,_.B)(!1),i.zN(f.e7.name),i.zN(f.x3.name),(0,h.D)("login").then((()=>e))}),(e=>(P({error:e,isCrossDomain:!1}),S("login_api_call_failure"),Promise.reject(e))))}),[e,o,t,y])}},901656:(e,o,t)=>{t.d(o,{Z:()=>i});var n=t(432300);const i=e=>"UNAUTH"===e?Object.freeze({}):{login_state:"LIMITED_LOGIN"===e?n.Z.LIMITED:n.Z.DEFAULT}},903095:(e,o,t)=>{t.d(o,{Mi:()=>i,lO:()=>s});var n=t(425288);const{Provider:i,useMaybeHook:s}=(0,n.Z)("pageContext")},402201:(e,o,t)=>{t.d(o,{Z:()=>n});const n=e=>{const[o,t]=[(null==e?void 0:e.width)||580,(null==e?void 0:e.height)||400],[n,i]=[window.screen.width,window.screen.height];return["scrollbars=yes","resizable=yes","toolbar=no","location=yes",`width=${o}`,`height=${t}`,`left=${Math.round((n-o)/2)}`,`top=${i>t?Math.round((i-t)/2):0}`].join(",")}},379913:(e,o,t)=>{t.d(o,{Z:()=>a});var n=t(407159),i=t(884732);const s=e=>{var o;const t={id:e.id,username:e.username,email:e.email,fullName:e.fullName||e.full_name,imageMediumUrl:e.imageMediumUrl||e.image_medium_url,imageLargeUrl:e.imageLargeUrl||e.image_large_url};return t.fullName&&t.imageMediumUrl&&t.imageLargeUrl||(0,n.Z)("utils.incomplete_user_values"),null!==(o=e.partner)&&void 0!==o&&o.is_create?{...t,partner:{is_create:!0}}:t},a=(e,o,t)=>{(0,i.r8)({...(0,i.rl)(),[e.id]:s(e)}),o&&t&&(0,n.Z)("new_account_add_success",{method:o,user_added:e.id},t)}},407159:(e,o,t)=>{t.d(o,{Z:()=>a});var n=t(867820),i=t(172045),s=t(884732);const a=(e,o,t)=>{let a=(0,s.yW)();a||(a=(()=>{const e=(0,i.Z)();return(0,n.tj)("web_account_switcher.utils.group_created",{group_id:e,group_count:(0,s.lv)()}),e})(),(0,s.M3)(a));const l={group_count:(0,s.lv)()};let r="";t&&(r="account_switcher_modal"===t?"modal.":"flyout."),(0,n.tj)(`web_account_switcher.${r}${e}`,{...o,...l})}},336882:(e,o,t)=>{t.d(o,{Z:()=>n});const n={STARTED:1,FINISHED:2}}}]);
//# sourceMappingURL=https://sm.pinimg.com/webapp/UnauthHybridBannerSignupModal.en_AU-fc769c6cd9fe8ba5.mjs.map