(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1165],{10291:function(e,n,r){"use strict";r.d(n,{m:function(){return S}});var t,o,a=r(95235),i=r(2784),c=r(660),l=r(18412),s=r(41857),d=r(58406),u=r(28316),m=r(3176),b=r(52322),y=i.forwardRef(function(e,n){var r,t,o,a;return"undefined"!=typeof document&&document.body?u.createPortal((t=e.onVerify,o=e.siteKey,a=e.size,(0,b.jsx)(m.Z,{ref:n,size:a,onChange:t,sitekey:o})),null!==(r=e.containerRef)&&void 0!==r&&r.current?e.containerRef.current:document.body):null}),f=r(72370),R=((t=R||{}).LIST_ATTACK_STRATEGY_RECAPTCHA_VISIBLE="VISIBLE-RECAPTCHA",t.LIST_ATTACK_STRATEGY_RECAPTCHA_INVISIBLE="INVISIBLE-RECAPTCHA",t.LIST_ATTACK_STRATEGY_HCAPTCHA="HCAPTCHA",t.LIST_ATTACK_STRATEGY_TURNSTILE="TURNSTILE",t),p=(o={},(0,a.Z)(o,R.LIST_ATTACK_STRATEGY_RECAPTCHA_VISIBLE,f.QZ.RECAPTCHA_BYPASS_TYPE_VISIBLE),(0,a.Z)(o,R.LIST_ATTACK_STRATEGY_RECAPTCHA_INVISIBLE,f.QZ.RECAPTCHA_BYPASS_TYPE_INVISIBLE),(0,a.Z)(o,R.LIST_ATTACK_STRATEGY_HCAPTCHA,f.QZ.HCAPTCHA_BYPASS_TYPE),(0,a.Z)(o,R.LIST_ATTACK_STRATEGY_TURNSTILE,f.QZ.TURNSTILE_BYPASS_TYPE),o),S=function(e){var n=(0,d.Mu)(),r=(0,s.ND)(),t=i.useRef(null),o=i.useRef(null),a=i.useRef(),u=r.enableRecaptchaNet,m=r.invisibleReCaptchaSharedSiteKey,S=i.useCallback(function(e){e&&a.current&&a.current(e)},[]);return i.useEffect(function(){u&&(window.recaptchaOptions={useRecaptchaNet:!0})},[]),i.useEffect(function(){var n={count:0,maxRetries:5,interval:200};e.onLoad&&function r(){if(null!==(o=e.containerRef)&&void 0!==o&&o.current)try{var t,o,a,i=new MutationObserver(function(n){n.forEach(function(n){if("childList"===n.type){var r,t;(null===(r=e.containerRef)||void 0===r||null===(r=r.current)||void 0===r?void 0:r.querySelector("iframe"))&&(null===(t=e.onLoad)||void 0===t||t.call(e),i.disconnect())}})});return i.observe(e.containerRef.current,{childList:!0,subtree:!0}),function(){return i.disconnect()}}catch(n){null===(a=e.onError)||void 0===a||a.call(e,n)}else n.count
"))||"";return(0,eY.jsxs)(ei,{children:[s&&(0,eY.jsx)(el,{"data-testid":"main-title",children:s}),e.mainSubtitle&&(0,eY.jsx)(es,{"data-testid":"main-subtitle",content:null==d?void 0:d[0]}),e.mainSubtitle&&(null==d?void 0:d[1])&&(0,eY.jsx)(ed,{"data-testid":"secondary-subtitle",content:null==d?void 0:d[1]}),(0,eY.jsxs)(ec,{children:[(0,eY.jsxs)(eu,{children:[(0,eY.jsx)(em,{children:l.referralsTitle}),(0,eY.jsxs)(eb,{children:[(0,eY.jsxs)(ey,{children:[(0,eY.jsx)(ef,{children:l.balanceTitle}),(0,eY.jsx)(eR,{children:e.customerCreditBalance})]}),(0,eY.jsxs)(ey,{children:[(0,eY.jsx)(ef,{children:l.countTitle}),(0,eY.jsx)(eR,{children:e.customerReferralCount})]})]}),e.balanceNote&&(0,eY.jsx)(ep,{"data-testid":"balance-note",children:e.balanceNote})]}),(0,eY.jsx)(eS,{children:l.shareTitle}),e.customerReferralLink&&(0,eY.jsxs)(j.Fragment,{children:[(0,eY.jsxs)(eA,{"data-testid":"customer-referral-link",children:[(0,eY.jsx)(eT,{type:"text",readOnly:!0,placeholder:e.customerReferralLink}),(0,eY.jsx)(ev,{"data-testid":"copy-referral-link",ariaLabel:l.shareTitle,sizing:"micro",onClick:(0,q.Z)(ee().mark(function n(){var r;return ee().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(n.t0=e.customerReferralLink,!n.t0){n.next=4;break}return n.next=4,null===(r=window)||void 0===r||null===(r=r.navigator)||void 0===r||null===(r=r.clipboard)||void 0===r?void 0:r.writeText(e.customerReferralLink);case 4:case"end":return n.stop()}},n)})),children:(0,eY.jsx)(eG,{})})]}),(0,eY.jsx)(e0,{middleText:l.orText})]}),e.customerSocialReferralMethods&&e.customerSocialReferralMethods.length>0&&(0,eY.jsx)(j.Fragment,{children:(0,eY.jsx)("ul",{children:e.customerSocialReferralMethods.map(function(e,n){return(0,eY.jsx)(eC,{children:(0,eY.jsx)(ex,{href:e.url||"#","aria-label":e.type,onClick:function(n){n.preventDefault(),"EMAIL"===e.type?c(!0):window.open(e.url,"_blank","width=600, height=400")},"data-testid":"social-referral-".concat(e.type),children:e1(e.type)})},"social-referral-".concat(n))})})}),e.codeSubtitle&&e.customerReferralCode&&"true"===e.showYourCodeSection&&(0,eY.jsxs)(j.Fragment,{children:[(0,eY.jsx)(e0,{middleText:l.orText}),(0,eY.jsx)(eE,{"data-testid":"code-title",children:e.codeSubtitle}),(0,eY.jsx)(eN,{children:e.customerReferralCode})]})]}),(0,eY.jsx)(ew,{openModal:i,onClose:function(){return c(!1)}})]})},e5=r(84130);function e3(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,t)}return r}var e4=V.zo.div(_||(_=(0,O.Z)(["\n text-align: center;\n padding: "," 0;\n\n "," {\n padding: "," 0;\n }\n"])),(0,$.W0)(5),function(e){return(0,Q.mq)(e.theme.breakpointUtils.map,"md")},(0,$.W0)(6)),e8=V.zo.h2(B||(B=(0,O.Z)(["\n ",";\n margin-bottom: ",";\n"])),(0,X.xv)("xlarge1","alternate"),(0,$.W0)(3)),e7=V.zo.p(U||(U=(0,O.Z)(["\n ",";\n padding: 0 ",";\n"])),(0,X.xv)("bodyText","default"),(0,$.W0)(2)),e6=(0,V.zo)(eo.zx)(Z||(Z=(0,O.Z)(["\n margin-top: ",";\n"])),(0,$.W0)(3)),e9=function(){var e=j.useState(F.Z5.Login),n=(0,M.Z)(e,2),r=n[0],t=n[1],o={title:(0,Y.ag)("widget.dynamicreferral.loggedout.title.text"),subtitle:(0,Y.ag)("widget.dynamicreferral.loggedout.subtitle.text"),login:(0,Y.ag)("widget.dynamicreferral.loggedout.loginbutton.title")};return j.useEffect(function(){t("".concat(F.Z5.Login,"?returnTo=").concat(encodeURIComponent(window.location.href)))},[]),(0,eY.jsxs)(e4,{children:[(0,eY.jsx)(e8,{children:o.title}),(0,eY.jsx)(e7,{"data-testid":"main-subtitle",children:o.subtitle}),(0,eY.jsx)(e6,{renderedAs:"a",href:r,"data-testid":"login-button",children:o.login})]})},ne=function(e){var n,r,t,o=(0,H.D)(),a=(0,w.oU)(),i=(0,G.Dx)().defaultLocale,c=(0,W.aM)(e5.o,{variables:{currency:a.currency},fetchPolicy:"no-cache",ssr:!0,skip:!o}).data;if(!o||!(null!=c&&c.referrals))return(0,eY.jsx)(e9,{});var l=c.referrals,s=l.creditAccounts&&l.creditAccounts.find(function(e){return e.currency===a.currency}),d={customerCreditBalance:null!==(n=null==s||null===(r=s.balance)||void 0===r?void 0:r.displayValue)&&void 0!==n?n:(0,z.T)(a.currency,parseFloat("0.00"),void 0===i?"en_GB":i),customerFullName:l.fullName||void 0,customerReferralCount:l.referralCount||0,customerReferralCode:l.referralCode||void 0,customerSocialReferralMethods:null===(t=l.socialReferralMethods)||void 0===t?void 0:t.map(function(e){return{type:e.type,url:e.url||void 0}}),customerReferralLink:l.referralLink||void 0,mainTitle:e.mainTitle||void 0,mainSubtitle:e.mainSubtitle||void 0,balanceNote:e.balanceNote||void 0,showYourCodeSection:e.showYourCodeSection||void 0,codeSubtitle:e.codeSubtitle||void 0};return(0,eY.jsx)(e2,function(e){for(var n=1;n