1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1686],{86068:function(e,i,r){"use strict";r.d(i,{Z:function(){return d},o:function(){return b}});var n=r(70865),s=r(96670),t=r(52322),a=r(51603),l=r(12524),o=r.n(l),c=r(63397);function d(e){var i=e.name,r=e.className,l=e.isRequired,d=void 0===l||l,u=e.label,m=void 0===u?"Account Number":u,h=e.placeholder,p=void 0===h?"e.g. 5866378432":h,g=e.tooltip,f=e.tooltipInfoIcon,b=void 0!==f&&f,x=e.tooltipHallowIcon,j=void 0!==x&&x,N=e.tooltipInfoCircleIcon,v=void 0!==N&&N,_=e.tooltipFillColor,w=e.errorClassName,y=e.hint,M=e.isNewBrand,R=void 0!==M&&M,k=e.maxLength,I=void 0===k?10:k;return(0,t.jsx)(c.gN,{name:i,type:"input",children:function(e){var i=e.field,l=e.form,u=e.meta;return(0,t.jsx)(a.af,(0,s.Z)((0,n.Z)({groupClassName:o()("group--wide",r)},i),{isRequired:d,placeholder:p,label:m,maxLength:I,isNumeric:!0,touched:u.touched,error:(0,c.u9)(l.errors,i.name),tooltip:g,tooltipFillColor:_,tooltipInfoIcon:b,tooltipHallowIcon:j,tooltipInfoCircleIcon:v,errorClassName:w,hint:y,isNewBrand:R}))}})}r(50974);var u=r(26297),m=r(89177),h=r(25128),p=r(2784),g=function(e){var i=e.field,r=e.form,l=e.meta,d=(0,u.Z)(e,["field","form","meta"]),g=(0,h.QL)(),f=g.mprnGprnState,b=g.gprnValidation,x=d.className,j=d.isRequired,N=d.label,v=d.placeholder,_=d.tooltip,w=d.tooltipInfoIcon,y=d.tooltipHallowIcon,M=d.errorClassName,R=f.gprnValidationState===m.JH2.VALIDATING||f.gprnValidationState===m.JH2.VALID;(0,p.useEffect)(function(){f.gprnValidationState===m.JH2.VALIDATING&&((0,c.u9)(r.touched,i.name)||r.setFieldTouched(i.name,!0,!0),r.setFieldError(i.name,f.gprnValidationMessage)),f.gprnValidationState===m.JH2.INVALID&&r.setFieldError(i.name,f.gprnValidationMessage),f.gprnValidationState===m.JH2.VALID&&(0,c.u9)(r.errors,i.name)&&r.setFieldError(i.name,void 0)},[f.gprnValidationState,r.errors]);var k=l.touched;return(0,t.jsx)(a.af,(0,s.Z)((0,n.Z)({},i),{isRequired:void 0===j||j,placeholder:void 0===v?"e.g. 5866378432":v,label:void 0===N?"Account Number":N,maxLength:10,isNumeric:!0,touched:k,error:!R&&(0,c.u9)(r.errors,i.name),tooltip:_,tooltipInfoIcon:void 0!==w&&w,tooltipHallowIcon:void 0!==y&&y,errorClassName:o()({errorClassName:M,"validating-error":f.gprnValidationState===m.JH2.VALIDATING}),onChange:function(e){i.onChange(e),b.apiValidationReset()},groupClassName:o()("group--wide",x)}))},f=function(e){var i=e.field,r=e.form,l=e.meta,d=(0,u.Z)(e,["field","form","meta"]),g=(0,h.QL)(),f=g.mprnGprnState,b=g.mprnValidation,x=d.className,j=d.isRequired,N=d.label,v=d.placeholder,_=d.tooltip,w=d.tooltipInfoIcon,y=d.tooltipHallowIcon,M=d.errorClassName,R=f.mprnValidationState===m.AwM.VALIDATING||f.mprnValidationState===m.AwM.VALID;(0,p.useEffect)(function(){f.mprnValidationState===m.AwM.VALIDATING&&((0,c.u9)(r.touched,i.name)||r.setFieldTouched(i.name,!0,!0),r.setFieldError(i.name,f.mprnValidationMessage)),f.mprnValidationState===m.AwM.INVALID&&r.setFieldError(i.name,f.mprnValidationMessage),f.mprnValidationState===m.AwM.VALID&&(0,c.u9)(r.errors,i.name)&&r.setFieldError(i.name,void 0)},[f.mprnValidationState,r.errors]);var k=l.touched;return(0,t.jsx)(a.af,(0,s.Z)((0,n.Z)({},i),{isRequired:void 0===j||j,placeholder:void 0===v?"e.g. 5866378432":v,label:void 0===N?"Account Number":N,maxLength:10,isNumeric:!0,touched:k,error:!R&&(0,c.u9)(r.errors,i.name),tooltip:_,tooltipInfoIcon:void 0!==w&&w,tooltipHallowIcon:void 0!==y&&y,errorClassName:o()({errorClassName:M,"validating-error":f.mprnValidationState===m.AwM.VALIDATING}),onChange:function(e){i.onChange(e),b.apiValidationReset()},groupClassName:o()("group--wide mprn-input",x)}))};function b(e){var i=e.name,r=e.accountType;return(0,t.jsx)(c.gN,{name:i,type:"input",children:function(i){var a=i.field,l=i.form,o=i.meta;return"gas"===r?(0,t.jsx)(g,(0,s.Z)((0,n.Z)({},e),{field:a,form:l,meta:o})):(0,t.jsx)(f,(0,s.Z)((0,n.Z)({},e),{field:a,form:l,meta:o}))}})}},91686:function(e,i,r){"use strict";r.d(i,{Kk:function(){return Y},Ay:function(){return z},fM:function(){return ea},Dl:function(){return es},_s:function(){return J},Iz:function(){return H},Ad:function(){return O},Ih:function(){return Q},R2:function(){return n.R},df:function(){return X},KJ:function(){return et},e3:function(){return h}});var n=r(6997),s=r(70865),t=r(52322),a=r(86068),l=r(84134),o=r(61403),c=r(30717),d=r(37049),u=r(79045),m=r(2784);function h(e){var i=e.product,r=e.mprnIsValid,n=e.gprnIsValid,s=e.currentFormStatus,t=(0,o.rV)(),a=t.serviceDown,l=t.confirmed,c=t.serviceActive,d=(0,o.uV)(),h=d.serviceDown,p=d.confirmed,g=d.serviceActive,f=(0,m.useState)(!0),b=f[0],x=f[1],j=(0,m.useRef)(!0),N=(0,m.useRef)(!0),v=(0,m.useCallback)(function(){(0,u.CT)(i)?x(N.current||j.current):(0,u.U)(i)?x(j.current):(0,u.bH)(i)&&x(N.current)},[j,N,i]);return(0,m.useEffect)(function(){!1===c?j.current=!1:!0===s.submitted?j.current=!1:j.current=!0!==l&&(!1===r&&null===r||!1===a),v()},[r,a,l,v,c,s.submitted]),(0,m.useEffect)(function(){!1===g?N.current=!1:!0===s.submitted?N.current=!1:N.current=!0!==p&&(!1===n&&null===n||!1===h),v()},[n,h,p,v,g,s.submitted]),b}var p=r(45797),g=r(84597),f=r(67107),b=r(13922),x=r(6228),j=r(79962),N=r(12524),v=r.n(N),_=r(63397),w=r(72670),y=r.n(w),M=r(29051),R=function(e){var i=e.notification,r=e.showNotification,n=e.title,s=e.subTitle,a=e.tooltip,l=e.toggle,o=(0,j.kh)(),c=o.isTablet,d=o.isMobile||c?24:40,u=(0,M.useSelector)(f.cN,M.shallowEqual);return(0,t.jsxs)("div",{className:v()("microgen-sell-electricity",{"microgen-sell-electricity--padding":!r}),children:[(0,t.jsxs)("div",{className:"microgen-sell-electricity--toggle",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(b.Ui,{width:d,height:d,className:"microgen-icon",fillColour:"#6eaa39"}),(0,t.jsx)("span",{className:"microgen-title",children:n}),(0,t.jsx)(g.u,{className:"microgen-tooltip",title:a,position:"top-start",trigger:"mouseenter",infoIcon:!0,isHallowIcon:!0,fillColor:"#00306a"})]}),(0,t.jsxs)("div",{children:[s&&(0,t.jsx)("span",{className:"microgen-sell-electricity--subTitle",children:y()(s,(0,x.RG)("p"))}),l&&(0,t.jsx)(_.gN,{name:"electricityDetails.isSellElectricity",id:"electricityDetails.isSellElectricity",component:p.q,label:l,className:"microgen-tickbox"})]})]}),u&&u.isShowMicrogenNotifications&&r&&(0,t.jsx)("div",{className:"microgen-sell-electricity--notification",children:y()(i,(0,x.RG)("p"))})]})},k=r(35961),I=r(96670),C=r(92377),D=r(51603),F=r(38425),V=function(e){var i=e.label,r=e.fieldName,n=e.required,s=e.className,a=e.helpTooltip,l=e.isNewBrand,o=void 0!==l&&l,c=e.isUpsell,d=(0,m.useState)(!1),u=d[0],h=d[1];return(0,t.jsxs)("div",{className:void 0===s?"":s,children:[(0,t.jsxs)("label",{htmlFor:r,children:[i,void 0!==n&&n&&(0,t.jsx)(D.RT,{})]}),a&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{onKeyDown:function(){return h(!0)},onClick:function(){return h(!0)},role:"button",tabIndex:0,"data-testid":"form-label-tooltip",className:"gprn-check__icon__wrapper",children:void 0!==c&&c?(0,t.jsx)(F.Z,{height:24,width:24,fillColour:"#00306a"}):(0,t.jsx)(b.fm,{})}),(0,t.jsx)(C.DY,{children:(0,t.jsx)(C.u_,{isNewBrand:o,singleAction:!1,hideCallback:function(){return h(!1)},shown:u,head:(0,t.jsx)("h4",{children:(null==a?void 0:a.head)&&y()(null==a?void 0:a.head,(0,x.RG)("p"))}),body:(null==a?void 0:a.body)&&y()(null==a?void 0:a.body),footer:(0,t.jsx)("div",{className:"align-right",children:(0,t.jsx)("button",{onClick:function(){return h(!1)},className:v()({"button primary-sub":!o,"button primary":o}),children:"Close"})})})})]})]})},L=r(89177),T=r(86679),S=r(68080),A=r(47934),E=r(50902),U=r(50862),B=r(83883),Z=r.n(B),G=function(e,i,r){return e?function(e){e.preventDefault(),e.key===L.Eph&&Z().location.assign(i)}:function(e){e.key===L.Eph&&r(!1)}},q=function(e){var i=e.ineligible,r=e.mprn,n=r.smartModal,s=r.smartMeterFaqUrl,a=r.ourPlansRedirectUrl,l=r.ineligibleSmartNewCustomerModal,c=l.modalContent,d=c.title,u=c.paragraph,m=l.cancelButtonText,h=l.proceedButtonText,p=l.proceedButtonUrl,g=e.isUpsell,f=void 0!==g&&g,b=e.shown,x=(0,o.rV)(),j=x.showError,N=x.cancelReturnToOffers,_=x.errorActions,w=function(){(null==_?void 0:_.onInEligibleSmart)&&_.onInEligibleSmart(),j(!1)};return(0,t.jsx)(C.u_,{shown:b,head:f?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:d}):(0,t.jsx)("h4",{children:(0,t.jsx)("strong",{children:i?d:n.title})}),body:(0,t.jsx)("div",{className:v()({"upsell__bge-dialog__paragraph":f}),children:y()(i?u:n.paragraph)}),keyPress:G(N,a,w),singleAction:!1,footer:(0,t.jsxs)("div",{className:"bge-modal__footer__ctas",children:[N?(0,t.jsx)(E.j,{url:a,className:"tertiary",label:"Close",isWide:!1,isWideMobile:!1}
1):(0,t.jsx)("button",{onClick:w,className:"button tertiary",children:i?m:"Close"}),(0,t.jsx)(E.j,{url:i?p:s,className:"primary arrow inline",label:"".concat(i?h:"Smart meter FAQ"),isWide:!1,isWideMobile:!1})]}),isNewBrand:!0,isUpsell:f})},P=function(e){var i=e.mprn,r=i.ourPlansRedirectUrl,n=i.dynamicIneligibleCtfModal,s=n.modalContent,a=s.title,l=s.paragraph,c=n.cancelButtonText,d=n.proceedButtonText,u=n.proceedButtonUrl,m=e.isUpsell,h=void 0!==m&&m,p=e.shown,g=(0,o.rV)(),f=g.showError,b=g.cancelReturnToOffers;return(0,t.jsx)(C.u_,{shown:p,head:h?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:a}):(0,t.jsx)("h4",{children:(0,t.jsx)("strong",{children:a})}),body:(0,t.jsx)("div",{className:v()({"upsell__bge-dialog__paragraph":h}),children:y()(l)}),keyPress:G(b,r,f),singleAction:!1,footer:(0,t.jsxs)("div",{className:"bge-modal__footer__ctas",children:[b?(0,t.jsx)(E.j,{url:r,className:"tertiary",label:"Close",isWide:!1,isWideMobile:!1}):(0,t.jsx)("button",{onClick:function(){return f(!1)},className:"button tertiary",children:c}),(0,t.jsx)(E.j,{url:u,className:"primary arrow inline",label:d,isWide:!1,isWideMobile:!1})]}),isNewBrand:!0,isUpsell:h})},H=function(e){var i=e.mprn,r=e.onConfirmAddress,n=e.onDismissServiceDownModal,s=e.confirmAddressLabel,a=e.isUpsell,l=e.isCTFFourRequired,d=void 0!==l&&l,u=(0,M.useSelector)(f.cN,M.shallowEqual),h=(0,o.rV)(),p=h.shouldShowError,g=h.showError,b=h.isLoading,x=h.information,j=h.confirmed,N=h.confirmAddress,_=h.removeInformation,w=h.serviceDown,R=h.dismissServiceDownModal,k=h.showServiceDownModal,I=h.checkSmart,D=h.isValidOfferForGivenMprn,F=function(){N(r)},V=function(){window.location.assign("/business")},T=function(){R(),n&&n()};(0,m.useEffect)(function(){!b&&p&&(0,A.s9)()},[b,p]),(0,m.useEffect)(function(){!b&&!0===w&&k&&(0,A.q_)()},[b,w,k]),(0,m.useEffect)(function(){!b&&x&&(!0===p&&!1===x.isSmartEnabled&&I||!0===p&&!D)&&(0,A.qA)()},[I,x,b,D,p]);var S=(0,m.useMemo)(function(){var e,i;return(null===(i=null==x?void 0:null===(e=x.eligibility)||void 0===e?void 0:e.find(function(e){return e.type===c.E7.SMART}))||void 0===i?void 0:i.status)===c.Pr.IneligibleSmartMeterNewCustomer},[x]);if(b){var B=i.waitingModal;return(0,t.jsx)(C.u_,{singleAction:!0,shown:b,head:a?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:B.title}):(0,t.jsx)("strong",{className:"bge-dialog__title--waiting",children:B.title}),body:(0,t.jsxs)(m.Fragment,{children:[y()(B.paragraph),(0,t.jsx)(U.a,{className:"large-dark"})]}),isNewBrand:!0,isUpsell:a})}if(x&&!0===p&&!1===x.valid){var Z=i.invalidMprn;return(0,t.jsx)(C.u_,{singleAction:!0,shown:x&&!0===p&&!1===x.valid,head:a?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:Z.title}):(0,t.jsx)("h4",{children:(0,t.jsx)("strong",{children:Z.title})}),body:(0,t.jsx)(m.Fragment,{children:y()(Z.paragraph)}),footer:(0,t.jsx)("div",{className:v()({"align-right":a,"align-center":!a}),children:(0,t.jsx)("button",{onClick:function(){return g(!1)},className:"button primary",children:"Close"})}),isNewBrand:!0,isUpsell:a})}if(x&&!0===p&&x.duosGroup&&(x.duosGroup===L.x2n.DG6||x.duosGroup===L.x2n.DG5)){var G=i.dgMeterModal;return(0,t.jsx)(C.u_,{singleAction:!1,shown:Boolean(x&&!0===p&&x.duosGroup&&(x.duosGroup===L.x2n.DG6||x.duosGroup===L.x2n.DG5)),head:a?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:G.title}):(0,t.jsx)("h4",{children:(0,t.jsx)("strong",{children:G.title})}),body:(0,t.jsx)("div",{className:v()({"upsell__bge-dialog__paragraph":a}),children:y()(G.paragraph)}),footer:(0,t.jsxs)("div",{className:"bge-modal__footer__ctas",children:[(0,t.jsx)("button",{onClick:V,className:"button secondary arrow",children:"Business home page"}),(0,t.jsx)("button",{onClick:function(){return g(!1)},className:"button primary",children:"Try again"})]}),isNewBrand:!0,isUpsell:a})}if(!0===w&&!0===k){var H=i.serviceDownModal;return(0,t.jsx)(C.u_,{singleAction:!0,shown:!0===w&&!0===k,head:a?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:H.title}):(0,t.jsx)("strong",{className:"bge-dialog__title--waiting",children:H.title}),body:y()(H.paragraph),footer:(0,t.jsx)("div",{className:v()({"align-right":a,"align-center":!a}),children:(0,t.jsx)("button",{onClick:T,className:"button primary",children:"Close"})}),isNewBrand:!0,isUpsell:a})}if(x&&!0===p&&!0===x.payg){var W=i.paygModal;return(0,t.jsx)(C.u_,{singleAction:!0,shown:x&&!0===p&&!0===x.payg,head:a?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:W.title}):(0,t.jsx)("h4",{children:(0,t.jsx)("strong",{children:W.title})}),body:(0,t.jsx)(m.Fragment,{children:y()(W.paragraph)}),footer:(0,t.jsx)("div",{className:v()({"align-right":a,"align-center":!a}),children:(0,t.jsx)("button",{onClick:function(){return g(!1)},className:"button primary",children:"Close"})}),isNewBrand:!0,isUpsell:a})}if(x&&!0===p&&!0===x.terminated){var O=i.terminatedModal;return(0,t.jsx)(C.u_,{singleAction:!0,shown:x&&!0===p&&!0===x.terminated,head:a?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:O.title}):(0,t.jsx)("h4",{children:(0,t.jsx)("strong",{children:O.title})}),body:(0,t.jsx)(m.Fragment,{children:y()(O.paragraph)}),footer:(0,t.jsx)("div",{className:v()({"align-right":a,"align-center":!a}),children:(0,t.jsx)("button",{onClick:function(){return g(!1)},className:"button primary",children:"Close"})}),isNewBrand:!0,isUpsell:a})}if(x&&!0===p&&!1===x.isSmartEnabled&&I)return(0,t.jsx)(q,{ineligible:u&&u.isShowMicrogenNotifications&&S,mprn:i,isUpsell:a,shown:x&&!0===p&&!1===x.isSmartEnabled&&I});if(x&&!0===p&&!D){var K=i.invalidMeterForOfferModal,X=K.modalContent,Y=X.title,J=X.paragraph,$=K.cancelButtonText,Q=K.
1cancelButtonUrl,z=K.proceedButtonText,ee=K.proceedButtonUrl;return(0,t.jsx)(C.u_,{shown:x&&!0===p&&!D,head:a?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:Y}):(0,t.jsx)("h4",{children:(0,t.jsx)("strong",{children:Y})}),keyPress:function(e){e.key===L.Eph&&(window.location.href=Q,e.preventDefault())},body:(0,t.jsx)("div",{className:v()({"upsell__bge-dialog__paragraph":a}),children:y()(J)}),singleAction:!1,footer:(0,t.jsxs)("div",{className:"bge-modal__footer__ctas",children:[(0,t.jsx)(E.j,{url:Q,className:"tertiary",label:$,isWide:!1,isWideMobile:!1}),(0,t.jsx)(E.j,{url:ee,className:"primary arrow inline",label:z,isWide:!1,isWideMobile:!1})]}),isNewBrand:!0,isUpsell:a})}if(x&&!0===x.valid&&!1===j&&!1===x.payg&&!1===x.terminated&&x.duosGroup!==L.x2n.DG5&&x.duosGroup!==L.x2n.DG6&&(!1===I||!0===x.isSmartEnabled)){var ei=x.address,er=i.confirmAddressModal;return(0,t.jsx)(C.u_,{shown:x&&!0===x.valid&&!1===j&&!1===x.payg&&!1===x.terminated&&x.duosGroup!==L.x2n.DG5&&x.duosGroup!==L.x2n.DG6&&(!1===I||!0===x.isSmartEnabled),head:a?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:er.title}):(0,t.jsx)("h4",{children:(0,t.jsx)("strong",{children:er.title})}),body:a?(0,t.jsxs)("div",{className:"upsell__bge-dialog__paragraph",children:[y()(er.paragraph),ei&&(0,t.jsx)("p",{"data-cs-mask":!0,children:Object.keys(ei).map(function(e){return(0,t.jsxs)(m.Fragment,{children:[(0,t.jsx)("strong",{children:ei[e]})," "]},e)})})]}):(0,t.jsxs)(m.Fragment,{children:[y()(er.paragraph),ei&&(0,t.jsx)("p",{"data-cs-mask":!0,children:Object.keys(ei).map(function(e){return(0,t.jsxs)(m.Fragment,{children:[(0,t.jsx)("strong",{children:ei[e]}),(0,t.jsx)("br",{})]},e)})})]}),singleAction:!1,footer:(0,t.jsxs)("div",{className:"bge-modal__footer__ctas",children:[(0,t.jsx)("button",{onClick:_,className:"button tertiary",children:"No, I'll try again"}),(0,t.jsx)("button",{onClick:F,className:"button primary",children:void 0===s?"Yes, this is correct":s})]}),isNewBrand:!0,isUpsell:a})}return d&&x&&(null==x?void 0:x.commsTechnicallyFeasible)&&(null==x?void 0:x.commsTechnicallyFeasible)!==L.PXv.FOUR?(0,t.jsx)(P,{mprn:i,isUpsell:a,shown:d&&x&&(null==x?void 0:x.commsTechnicallyFeasible)&&(null==x?void 0:x.commsTechnicallyFeasible)!==L.PXv.FOUR}):null},W=function(e){var i=e.fieldName,r=e.label,n=e.placeholder,a=e.mprn,l=e.maxLength,c=e.helpLink,d=e.disabled,u=e.onConfirm,h=e.onCancel,p=e.helpTooltip,g=e.optional,f=e.offerId,b=e.setIsValidating,x=e.isNewBrand,j=void 0!==x&&x,N=e.isSubmitOnComplete,v=void 0!==N&&N,w=e.isUpsell,y=void 0!==w&&w,R=(0,m.useState)(!0),k=R[0],F=R[1],E=(0,m.useState)(!1),U=E[0],B=E[1],Z=(0,M.useSelector)((0,S.selectProductListItemIsDynamicById)(f)),G=(0,o.rV)(),q=G.validateMprnViaSalesforce,P=G.isLoading,W=G.serviceDown,O=G.serviceTimeout,K=G.serviceActive,X=(0,M.useDispatch)(),Y=(0,_.u6)(),J=Y.values,$=Y.errors,Q=function(e,i){(i&&i.information&&!0===i.information.valid||i.serviceTimeout&&!0===i.serviceTimeout)&&e.setFieldValue("mprnIsValid",!0),i&&i.information&&!1===i.information.valid&&!0!==i.serviceTimeout&&(e.setFieldValue("mprnIsValid",!1),h&&h())},z=(0,_.u9)(e.formik.touched,i),ee=(0,_.u9)(e.formik.errors,i);return(0,m.useEffect)(function(){z&&ee&&(X((0,T.L)("".concat(L.eEW.MPRN," ").concat(i),{description:String(ee)})),(0,A.Ob)())},[z,ee]),(0,m.useEffect)(function(){g&&F(!1)},[g]),(0,m.useEffect)(function(){return function(){null==b||b(!1)}},[]),(0,m.useEffect)(function(){var e,i,r;K&&(!U||v&&y)&&J&&!J.mprnIsValid&&(null==J?void 0:null===(e=J.electricityDetails)||void 0===e?void 0:e.mprn)&&(null==J?void 0:null===(i=J.electricityDetails)||void 0===i?void 0:i.mprn.length)===11&&!(null==$?void 0:null===(r=$.electricityDetails)||void 0===r?void 0:r.mprn)?(q(J.electricityDetails.mprn,f),B(!0)):K||B(!0)},[J.mprnIsValid,J.electricityDetails,$.electricityDetails,U,v,K,]),(0,t.jsx)(m.Fragment,{children:(0,t.jsx)(C.DY,{children:(0,t.jsx)(_.gN,{name:i,children:function(e){var i=e.field,o=e.form,m=e.meta,h=(0,_.u9)(o.errors,i.name)||!i.value||i.value.length!==L.j07,g=!!(0,_.u9)(o.errors,i.name),x=(0,_.u9)(o.errors,"mprnIsValid"),N=x&&null!==o.values.mprnIsValid;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(H,{isCTFFourRequired:Z,mprn:a,onConfirmAddress:function(){o.setFieldValue("mprnIsValid",!0),u&&u()},onDismissServiceDownModal:function(){o.setFieldValue("mprnIsValid",!0),u&&u()},isUpsell:y}
1),(0,t.jsx)("div",{className:"group group--wider",children:(0,t.jsxs)("div",{className:"submit-reading mprm-submit-reading",children:[(0,t.jsxs)("div",{className:"submit-reading__wrapper",children:[(0,t.jsx)(V,{isNewBrand:j,label:r,fieldName:i.name,required:k,className:"label-wrapper",helpTooltip:p,isUpsell:y}),(0,t.jsx)("div",{className:"submit-reading__inner",children:(0,t.jsxs)("div",{className:"input-section input-meter mprn-low-connectivity",children:[(0,t.jsx)(D.II,(0,I.Z)((0,s.Z)({},i),{onChange:function(e){K&&o.setFieldValue("mprnIsValid",null),i.value.length<L.j07&&null!==o.values.mprnIsValid&&(W||O?o.setFieldValue("mprnIsValid",!0):o.setFieldValue("mprnIsValid",null)),i.onChange(e)},onKeyUp:function(){K&&o.validateField(i.name)},maxLength:l,isNumeric:!0,placeholder:n,error:(0,_.u9)(o.errors,i.name)&&m.touched||N,disabled:P})),(0,t.jsx)("span",{className:"bar"}),!0!==W&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(_.Bc,{name:i.name,children:function(e){return(0,t.jsx)("span",{className:"error-text",children:e})}}),N&&!1===g&&(0,t.jsx)("span",{className:"error-text",children:x})]})]})})]}),!v&&(0,t.jsx)("div",{className:"submit-reading__wrapper submit-button",children:(0,t.jsxs)("div",{className:"submit-reading__inner",children:[K&&(0,t.jsx)("button",{type:"button","data-testid":"validate-button",onClick:function(){null==b||b(!0),q(o.values.electricityDetails.mprn,f).then(function(e){Q(o,e)}).catch(function(){o.setFieldValue("mprnIsValid",null),null==b||b(!1)})},disabled:!!h||!!O||!0===d,className:"button primary arrow submit-reading__inner__check-meter",children:"Check Meter"}),(0,t.jsx)("a",{rel:"noopener noreferrer",href:c,target:"_blank",type:"button",className:"button tertiary submit-reading__inner__help",onClick:function(){return X((0,T.L)(L.eEW.MPRN_HELP))},children:"Help"})]})})]})})]})}})})})},O=(0,_.$j)(W),K=r(65413),X=function(e){var i=e.mprnContext,r=e.productIsExistingElectricity,n=e.accountNumberSchema,t=i.serviceDown,a=function(e){return function(i){return!0!==this.parent[e]||!0===t||!!i}};return(0,s.Z)({mprn:d.KO.required((0,l.q8)("MPRN")),submitStorageMeterReading:(0,K.Xg)(),submitDayMeterReading:(0,K.Xg)(),submitNightMeterReading:(0,K.Xg)(),submitPeakMeterReading:(0,K.Xg)(),submitTwentyFourHourMeterReding:(0,K.Xg)()},!r&&{dayMeterReading:(0,K.Z_)().test("required","Meter reading is required",a("submitDayMeterReading")),nightMeterReading:(0,K.Z_)().test("required","Meter reading is required",a("submitNightMeterReading")),peakMeterReading:(0,K.Z_)().test("required","Meter reading is required",a("submitPeakMeterReading")),storageMeterReading:(0,K.Z_)().test("required","Meter reading is required",a("submitStorageMeterReading")),twentyFourHourMeterReading:(0,K.Z_)().test("required","Meter reading is required",a("submitTwentyFourHourMeterReding"))},r&&{existingElectricityAccountNumber:n})},Y=function(e){var i=e.formikProps,r=i.values,n=r.gprnIsValid,s=r.mprnIsValid,l=r.electricityDetails,d=l.submitMeterReadings,u=l.submitDayMeterReading,p=l.submitNightMeterReading,g=l.submitStorageMeterReading,f=l.submitTwentyFourHourMeterReding,b=l.submitPeakMeterReading,x=i.setFieldValue,j=e.meterReadingUrl,N=e.prnUrl,v=e.submitReadingsText,_=e.mprn,w=e.product,y=e.productIsExistingElectricity,M=e.electricityTitle,I=e.currentFormStatus,C=e.showMprnReading,D=e.electricityMicrogenTitle,F=e.electricityMicrogenToogle,V=e.electricityMicrogenNotification,L=e.electricityMicrogenSignUpNotification,T=e.showElectricityMicrogenNotification,S=e.electricityMicrogenTooltip,A=e.mprnTooltipModalHead,E=e.mprnTooltipModalBody,U=e.isApiValidated,B=e.isNewBrand,Z=void 0!==B&&B,G=(0,o.rV)(),q=G.confirmed,P=G.information,H=G.serviceDown,W=G.exportStatus,K=h({gprnIsValid:n,mprnIsValid:s,product:w,currentFormStatus:I}),X=P&&P.isSmartEnabled&&P.isLowConnectivity,Y=!!P&&!!P.meterReadings&&(!0===d||!!X)&&P.meterReadings.dayMeter,J=!!P&&!!P.meterReadings&&(!0===d||!!X)&&P.meterReadings.nightMeter,$=!!P&&!!P.meterReadings&&(!0===d||!!X)&&P.meterReadings.peakMeter,Q=!!P&&!!P.meterReadings&&(!0===d||!!X)&&P.meterReadings.storageMeter,z=!!P&&!!P.meterReadings&&(!0===d||!!X)&&P.meterReadings.twentyFourHourMeter;(0,m.useEffect)(function(){y||x("electricityDetails.submitDayMeterReading",Y)},[Y,x,y]),(0,m.useEffect)(function(){y||x("electricityDetails.submitNightMeterReading",J)},[J,x,y]),(0,m.useEffect)(function(){y||x("electricityDetails.submitPeakMeterReading",$)},[$,x,y]),(0,m.useEffect)(function(){y||x("electricityDetails.submitStorageMeterReading",Q)},[Q,x,y]),(0,m.useEffect)(function(){y||x("electricityDetails.submitTwentyFourHourMeterReding",z)},[z,x,y]);var ee=w.isAvailableWithExport&&s&&q&&W===c.Pr.Eligible,ei=w.isAvailableWithExport&&s&&q&&W===c.Pr.IneligibleIncorrectMeterConfig;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("header",{children:(0,t.jsx)("h4",{className:"join__subtitle join__subtitle-electricity",children:M})}),(0,t.jsxs)("main",{"data-testid":"mprn",children:[(void 0===C||C)&&(0,t.jsx)(O,{placeholder:"eg. 12345678910",label:"MPRN",helpLink:void 0===N?"":N,maxLength:11,fieldName:"electricityDetails.mprn",mprn:_,offerId:w.id,disabled:H,helpTooltip:{head:A,body:E},isNewBrand:Z}),ee&&(0,t.jsx)(R,{showNotification:T,notification:V,title:D,tooltip:S,toggle:F}),ei&&(0,t.jsx)(R,{showNotification:!0,notification:L,title:D,tooltip:S,subTitle:F}),y?(0,t.jsx)(t.Fragment,{children:void 0!==U&&U?(0,t.jsx)(a.o,{className:"group--m-t-24-mobile",name:"electricityDetails.existingElectricityAccountNumber",label:e.accountNumberLabel,accountType:"electricity"}):(0,t.jsx)(a.Z,{className:"group--m-t-24-mobile",name:"electricityDetails.existingElectricityAccountNumber",label:e.accountNumberLabel})}):(0,t.jsx)(k.ZP,{serviceDown:H,confirmed:q,information:P,submitReadingsText:v,disabledFields:K,isLowConnectivitySmartMeter:X,isNewBrand:Z,submitMeterReadings:d,submitDayMeterReading:u,submitNightMeterReading:p,submitStorageMeterReading:g,submitTwentyFourHourMeterReding:f,submitPeakMeterReading:b,meterReadingUrl:void 0===j?"":j})]})]})};r(26306);var J=(0,m.forwardRef)(function(e,i){var r=e.fieldName,n=e.placeholder,a=void 0===n?"":n,l=e.isDisabled,c=e.label,d=void 0===c?"MPRN":c,u=e.showRequired,h=void 0!==u&&u,p=e.closeLabel,g=e.modal,f=e.showModal,x=e.showErrorMessage,j=void 0===x||x,N=e.mprnSmartSuccessLabel,w=e.mprnStandardSuccessLabel,M=e.isNewMprnCheckField,R=void 0!==M&&M,k=(0,o.rV)(),F=k.confirmed,V=k.information,L=V&&V.valid&&V.isSmartEnabled,T=V&&V.valid&&!V.isSmartEnabled,S=L?void 0===N?"":N:void 0===w?"":w,A=(0,m.useState)({showModal:!1}),E=A[0],U=A[1],B=function(e){U(function(i){return(0,I.Z)((0,s.Z)({},i),{showModal:e})})};return(0,t.jsx)("div",{className:"mprn-check",children:(0,t.jsx)(_.gN,{name:r,type:"input",children:function(e){var r=e.field,n=e.meta,o=e.form,c=(L||T)&&!n.error;return(0,t.jsxs)("div",{className:"group mprn-check__field",children:[(0,t.jsxs)("span",{className:"mprn-check__hide",id:"".concat(r.name,"-label"),children:[d,!0===h&&(0,t.jsx)(D.RT,{})]}),R?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:v()("new-mprn-checker-input",{"mprn-error":n.error,"mprn-check--input__success":c}),children:[(0,t.jsx)(D.II,(0,I.Z)((0,s.Z)({},r),{id:r.name,isRequired:!0,maxLength:11,minLength:11,placeholder:a,error:(0,_.u9)(o.errors,r.name)&&n.touched,isNumeric:!0,hiddenLabel:!0,disabled:l,ref:i})),n.error&&(0,t.jsx)("span",{className:"is-new-smart",children:(0,t.jsx)(b.bG,{fillColour:"#b70030",height:24,width:24})}),c&&(0,t.jsx)("span",{className:"is-new-smart",children:(0,t.jsx)(b.R$,{fillColour:"#5a8b2e",height:24,width:24})})]}),(0,t.jsx)("span",{className:"bar"}),n.touched&&n.error&&j&&(0,t.jsx)("span",{className:"mprn-check__error new-error-text",children:n.error}),c&&(0,t.jsx)("div",{className:"new-success-text",children:S})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(D.II,(0,I.Z)((0,s.Z)({},r),{id:r.name,isRequired:!0,maxLength:11,minLength:11,placeholder:a,error:(0,_.u9)(o.errors,r.name)&&n.touched,isNumeric:!0,hiddenLabel:!0,disabled:l,ref:i,className:v()({"mprn-check--input__success":F&&!n.error})})),F&&!n.error&&(0,t.jsx)("span",{className:"is-smart",children:(0,t.jsx)(b.dR,{fillColour:"#5a8b2e"})}),(0,t.jsx)("span",{className:"bar"}),n.touched&&n.error&&j&&(0,t.jsx)("span",{className:"error-text mprn-check__error",children:n.error})]}),f&&g&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{onKeyDown:function(){return B(!0)},onClick:function(){return B(!0)},role:"button",tabIndex:0,className:"mprn-check__icon__wrapper",children:(0,t.jsx)(b.fm,{className:"mprn-check__icon"})}),(0,t.jsx)(C.u_,{footer:(0,t.jsx)("div",{className:"align-right",children:(0,t.jsx)("button",{onClick:function(){return B(!1)},className:"button primary-sub",children:p})}),singleAction:!1,shown:E.showModal,body:y()(g.paragraph),head:(0,t.jsx)("h5",{className:"bge-dialog__title--info",children:g.title}),isNewBrand:!0})]})]})}})})}),$=r(24398);function Q(e){var i=e.fieldName,r=e.placeholder,n=e.options,a=e.onChange,l=e.isDisabled,c=(0,o.rV)().confirmed;return(0,t.jsx)("div",{className:"mprn-check",children:(0,t.jsx)(_.gN,{name:i,type:"input",children:function(e){var i=e.field,o=e.meta;return(0,t.jsxs)("div",{className:"group mprn-check__field",children:[(0,t.jsx)("span",{className:"mprn-check__hide",id:"".concat(i.name,"-label"),children:"MPRN"}),(0,t.jsx)($.Ph,(0,I.Z)((0,s.Z)({},i),{options:n,placeholder:r,disabled:l,className:v()("bge-select__select",{"error bge-select__select--error":o.touched&&o.error},c?"mprn-check--select__success":""),onChange:a})),(0,t.jsx)("span",{className:v()({"bge-select__bar--error":o.touched&&o.error},"bar")}),o.touched&&o.error&&(0,t.jsx)("span",{className:"error-text mprn-check__error",children:o.error})]})}})})}var z=7,ee=r(2021);r(89038);var ei=r(46363),er=function(e){var i=e.gprn,r=e.onConfirmAddress,n=e.onRejectAddress,s=e.onDismissServiceDownModal,a=(0,o.uV)(),l=a.shouldShowError,c=a.showError,d=a.isLoading,u=a.information,h=a.confirmed,p=a.confirmAddress,g=a.removeInformation,f=
1a.serviceDown,b=a.showServiceDownModal,x=a.dismissServiceDownModal,j=a.shouldBlockWhenServiceDown,N=void 0!==j&&j,_=a.reset,w=function(){p(r)},M=function(){s&&(s(),x())};if(d){var R=i.waitingModal;return(0,t.jsx)(C.u_,{isNewBrand:e.isNewBrand,singleAction:!0,shown:d,head:e.isUpsell?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:R.title}):(0,t.jsx)("strong",{className:"bge-dialog__title--waiting",children:R.title}),body:(0,t.jsxs)(m.Fragment,{children:[y()(R.paragraph),(0,t.jsx)(U.a,{className:"large-dark"})]}),isUpsell:e.isUpsell})}if(N&&u&&f){var k=i.blockWhenServiceDownModal,I=i.blockWhenServiceDownLabel,D=i.blockWhenServiceDownUrl;return(0,t.jsx)(C.u_,{isNewBrand:e.isNewBrand,singleAction:!0,shown:N&&u&&f,head:e.isUpsell?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:k.title}):(0,t.jsx)("strong",{className:"bge-dialog__title--waiting",children:k.title}),body:y()(k.paragraph),footer:(0,t.jsx)("span",{className:"block-when-down__footer-container",children:(0,t.jsxs)("div",{className:"align-right",children:[(0,t.jsx)("button",{onClick:_,className:"button secondary",children:"Close"}),(0,t.jsx)(ei.rU,{href:D,onClick:M,className:"button primary",children:I})]})}),isUpsell:e.isUpsell})}if(f&&b){var F=i.serviceDownModal;return(0,t.jsx)(C.u_,{isNewBrand:e.isNewBrand,singleAction:!0,shown:f&&b,head:e.isUpsell?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:F.title}):(0,t.jsx)("strong",{className:"bge-dialog__title--waiting",children:F.title}),body:y()(F.paragraph),footer:(0,t.jsx)("div",{className:v()({"align-right":e.isUpsell,"align-center":!e.isUpsell}),children:(0,t.jsx)("button",{onClick:M,className:"button primary",children:"Close"})}),isUpsell:e.isUpsell})}if(u&&!0===l&&!0===u.payg){var V=i.paygModal;return(0,t.jsx)(C.u_,{isNewBrand:e.isNewBrand,singleAction:!0,shown:u&&!0===l&&!0===u.payg,head:e.isUpsell?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:V.title}):(0,t.jsx)("h4",{children:(0,t.jsx)("strong",{children:V.title})}),body:(0,t.jsx)(m.Fragment,{children:y()(V.paragraph)}),footer:(0,t.jsx)("div",{className:v()({"align-right":e.isUpsell,"align-center":!e.isUpsell}),children:(0,t.jsx)("button",{onClick:function(){return c(!1)},className:"button primary",children:"Close"})}),isUpsell:e.isUpsell})}if(u&&!0===l&&!0===u.safetyLockedMeter){var L=i.lockedModal;return(0,t.jsx)(C.u_,{isNewBrand:e.isNewBrand,singleAction:!0,shown:u&&!0===l&&!0===u.safetyLockedMeter,head:e.isUpsell?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:L.title}):(0,t.jsx)("h4",{children:(0,t.jsx)("strong",{children:L.title})}),body:(0,t.jsx)(m.Fragment,{children:y()(L.paragraph)}),footer:(0,t.jsx)("div",{className:v()({"align-right":e.isUpsell,"align-center":!e.isUpsell}),children:(0,t.jsx)("button",{onClick:function(){return c(!1)},className:"button primary",children:"Close"})}),isUpsell:e.isUpsell})}if(u&&!0===u.valid&&!1===h&&!1===u.payg&&!1===u.safetyLockedMeter){var T=u.address,S=i.confirmAddressModal;return(0,t.jsx)(C.u_,{isNewBrand:e.isNewBrand,shown:u&&!0===u.valid&&!1===h&&!1===u.payg&&!1===u.safetyLockedMeter,head:e.isUpsell?(0,t.jsx)("span",{className:"upsell__bge-dialog__title",children:S.title}):(0,t.jsx)("h4",{children:(0,t.jsx)("strong",{children:S.title})}),body:e.isUpsell?(0,t.jsxs)("div",{className:"upsell__bge-dialog__paragraph",children:[y()(S.paragraph),T&&(0,t.jsx)("p",{"data-cs-mask":!0,children:Object.keys(T).map(function(e){return(0,t.jsxs)(m.Fragment,{children:[(0,t.jsx)("strong",{children:T[e]})," "]},e)})})]}):(0,t.jsxs)(m.Fragment,{children:[y()(S.paragraph),T&&(0,t.jsx)("p",{"data-cs-mask":!0,children:Object.keys(T).map(function(e){return(0,t.jsxs)(m.Fragment,{children:[(0,t.jsx)("strong",{children:T[e]}),(0,t.jsx)("br",{})]},e)})})]}),singleAction:!1,footer:(0,t.jsxs)("div",{className:"bge-modal__footer__ctas",children:[(0,t.jsx)("button",{onClick:function(){g(),n&&n()},className:"button tertiary",children:"No, I'll try again"}),(0,t.jsx)("button",{"data-testid":"gprn_confirm_btn",onClick:w,className:"button primary",children:"Yes, this is correct"})]}),isUpsell:e.isUpsell})}return null},en=function(e){var i=e.fieldName,r=e.label,n=e.placeholder,a=e.gprn,l=e.maxLength,c=e.helpLink,d=e.disabled,u=e.helpLinkText,h=void 0===u?"Help":u,p=e.checkMeterButtonText,g=void 0===p?"Check Meter":p,f=e.onConfirm,x=e.onCancelGPRNConfirmation,j=e.onCancel,N=e.className,w=void 0===N?"":N,R=e.isSubmitOnComplete,k=void 0!==R&&R,F=e.isFindAPlan,S=void 0!==F&&F,E=e.modal,U=e.closeLabel,B=e.showModal,Z=e.hiddenLabel,G=void 0!==Z&&Z,q=e.setIsValidating,P=e.isUpsell,H=void 0!==P&&P,W=e.isNewBrand,O=void 0!==W&&W,K=e.helpTooltip,X=(0,o.uV)(),Y=X.confirmed,J=X.validateGprn,$=X.isLoading,Q=X.serviceDown,ee=X.serviceTimeout,ei=X.serviceActive,en=(0,M.useDispatch)(),es=(0,_.u9)(e.formik.touched,i),et=(0,_.u9)(e.formik.errors,i),ea=(0,m.useState)({showModal:!1}),el=ea[0],eo=ea[1],ec=function(e){eo(function(i){return(0,I.Z)((0,s.Z)({},i),{showModal:e})})};return(0,m.useEffect)(function(){es&&et&&(en((0,T.L)("".concat(L.eEW.GPRN," ").concat(i),{description:String(et)})),(0,A.qe)())},[es,et]),(0,m.useEffect)(function(){return function(){null==q||q(!1)}},[]),(0,t.jsx)("span",{className:v()({"new-brand":O}),children:(0,t.jsx)(C.DY,{children:(0,t.jsx)(_.gN,{name:i,children:function(e){var i=e.field,o=e.form,u=e.meta,p=(0,_.u9)(o.errors,i.name)||i.value.length<z,N=!!(0,_.u9)(o.errors,i.name),M=(0,_.u9)(o.errors,"gprnIsValid"),R=M&&u.touched&&null!==o.values.gprnIsValid,F=function(){o.setFieldValue("gprnIsValid",null),j&&j()},A=function(e){null==q||q(!0),e.length===z&&J(e).then(function(e){var i=e.isValid,r=e.requiresMeterReading,n=e.serviceTimeout;(!0===i||!0===n)&&o.setFieldValue("gprnIsValid",!0),!1===i&&!0!==n&&(o.setFieldTouched("gasDetails.gprn",!0),o.setFieldValue("gprnIsValid",!1)),!0===r&&o.setFieldValue("gasDetails.submitMeterReadings",!0)}).catch(function(){F(),null==q||q(!1)})};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(er,{isNewBrand:O,gprn:a,onConfirmAddress:function(){o.setFieldValue("gprnIsValid",!0),f&&f()},onRejectAddress:function(){x&&x()},onDismissServiceDownModal:function(){o.setFieldValue("gprnIsValid",!0),f&&f()},isUpsell:H}),(0,t.jsx)("div",{className:"group group--wider",children:(0,t.jsxs)("div",{className:v()({"submit-reading":!k}),children:[(0,t.jsx)("div",{className:v()({"submit-reading__wrapper":!k}),children:(0,t.jsx)("div",{className:v()({"submit-reading__inner":!k}),children:(0,t.jsxs)("div",{className:v()({"input-section":!H},"input-meter",w),children:[!H&&S&&(0,t.jsxs)("span",{id:"".concat(i.name,"-label"),children:[r,(0,t.jsx)(D.RT,{})]}),(0,t.jsx)(D.II,(0,I.Z)((0,s.Z)({},i),{onChange:function(e){i.value.length<z&&null!==o.values.gprnIsValid&&
1(Q||ee?o.setFieldValue("gprnIsValid",!0):H?o.setFieldValue("gprnIsValid",null):F()),i.onChange(e),k&&A(e.target.value)},maxLength:l,isNumeric:!0,placeholder:n,error:(0,_.u9)(o.errors,i.name)&&u.touched||R&&u.touched&&!Q,disabled:(S?d:$)||d,className:Y?"gprn-check--input__success":"",hiddenLabel:G})),Y&&S&&(0,t.jsx)("span",{className:"is-smart",children:(0,t.jsx)(b.dR,{fillColour:"#5a8b2e"})}),(0,t.jsx)("span",{className:"bar"}),(0,t.jsxs)(m.Fragment,{children:[(0,t.jsx)(_.Bc,{name:i.name,children:function(e){return(0,t.jsx)("span",{className:"error-text",children:e})}}),R&&!Q&&!1===N&&(0,t.jsx)("span",{className:"error-text",children:M})]}),H?(0,t.jsx)("label",{htmlFor:i.name,className:"upsell__tooltip__gas",children:(0,t.jsx)(V,{isNewBrand:O,label:r,fieldName:i.name,required:!0,className:"label-wrapper",helpTooltip:K,isUpsell:H})}):(0,t.jsx)(t.Fragment,{children:!S&&(0,t.jsxs)("label",{htmlFor:i.name,children:[r,(0,t.jsx)(D.RT,{})]})})]})})}),!k&&(0,t.jsx)("div",{className:"submit-reading__wrapper",children:(0,t.jsxs)("div",{className:"submit-reading__inner",children:[ei&&(0,t.jsx)("button",{type:"button",onClick:function(){return A(o.values.gasDetails.gprn)},disabled:!!p||!!ee||!0===d,className:"button primary arrow submit-reading__inner__check-meter",children:g}),(0,t.jsx)("a",{rel:"noopener noreferrer",href:c,target:"_blank",type:"button",className:"button tertiary submit-reading__inner__help",onClick:function(){return en((0,T.L)(L.eEW.GPRN_HELP))},children:h})]})}),B&&E&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{onKeyDown:function(){return ec(!0)},onClick:function(){return ec(!0)},role:"button",tabIndex:0,className:"gprn-check__icon__wrapper",children:(0,t.jsx)(b.fm,{className:"gprn-check__icon"})}),(0,t.jsx)(C.u_,{isNewBrand:O,footer:(0,t.jsx)("div",{className:"align-right",children:(0,t.jsx)("button",{onClick:function(){return ec(!1)},className:"button primary-sub",children:U})}),singleAction:!1,shown:el.showModal,body:y()(E.paragraph),head:(0,t.jsx)("h5",{className:"bge-dialog__title--info",children:E.title})})]})]})})]})}})})})},es=(0,_.$j)(en),et=function(e){var i=e.isProductGasForExistingCustomer,r=e.accountNumberSchema;return(0,s.Z)({gprn:(0,K.Z_)().min(7,(0,l.kY)("GPRN",7)).matches(ee.Lh,(0,l.lv)("GPRN")).required((0,l.q8)("GPRN")),submitMeterReadings:(0,K.Xg)()},!i&&{gasMeterReading:(0,K.Z_)().when("submitMeterReadings",{is:!0,then:(0,n.v)("Meter reading",6)})},i&&{existingGasAccountNumber:r})},ea=function(e){var i=e.formikProps.setFieldValue,r=e.meterReadingUrl,s=e.prnUrl,l=e.gprn,c=e.productIsExistingGas,d=e.gasTitle,u=e.showGprnReading,h=e.isApiValidated,p=(0,o.uV)(),g=p.confirmed,f=p.information,b=p.serviceDown,x=!!f&&!!f.gasMeterRead&&f.gasMeterRead;return(0,m.useEffect)(function(){c||i("gasDetails.submitMeterReadings",!!b||x)},[x,i,b,c]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("header",{children:(0,t.jsx)("h4",{className:"join__subtitle join__subtitle-gas",children:d})}),(0,t.jsxs)("main",{"data-testid":"gprn",children:[(void 0===u||u)&&(0,t.jsx)(es,{maxLength:7,placeholder:"eg. 1234567",label:"GPRN",helpLink:void 0===s?"":s,fieldName:"gasDetails.gprn",gprn:l,disabled:b}),c?(0,t.jsx)(t.Fragment,{children:void 0!==h&&h?(0,t.jsx)(a.o,{className:"group--m-t-24-mobile",name:"gasDetails.existingGasAccountNumber",label:e.accountNumberLabel,accountType:"gas"}):(0,t.jsx)(a.Z,{className:"group--m-t-24-mobile",name:"gasDetails.existingGasAccountNumber",label:e.accountNumberLabel})}):(0,t.jsx)(t.Fragment,{children:(!0===b||!0===g&&!0===x)&&(0,t.jsx)(n.R,{placeholder:"123456",label:"Gas Meter read",helpLink:void 0===r?"":r,maxLength:6,fieldName:"gasDetails.gasMeterReading"})})]})]})}},6997:function(e,i,r){"use strict";r.d(i,{R:function(){return x},v:function(){return f}});var n=r(70865),s=r(96670),t=r(52322);r(68630);var a=r(51603),l=r(89177),o=r(84134),c=r(86679),d=r(47934),u=r(2021),m=r(63397),h=r(2784),p=r(29051),g=r(65413),f=function(e,i){return(0,g.Z_)().max(i,(0,o.k0)(e,i)).matches(u.Lh,(0,o.lv)(e)).required((0,o.q8)(e))},b=function(e){var i=e.fieldName,r=e.label,o=e.placeholder,u=e.maxLength,g=e.helpLink,f=e.required,b=void 0===f||f,x=(0,m.u9)(e.formik.touched,i),j=(0,m.u9)(e.formik.errors,i),N=(0,p.useDispatch)();return(0,h.useEffect)(function(){x&&j&&(N((0,c.L)("".concat(l.eEW.METER_READING," ").concat(i),{description:String(j)})),(0,d.sZ)())},[x,j]),(0,t.jsx)(m.gN,{name:i,children:function(e){var i=e.field,l=e.form,c=e.meta;return(0,t.jsx)("div",{className:"group group--wider",children:(0,t.jsxs)("div",{className:"submit-reading",children:[(0,t.jsx)("div",{className:"submit-reading__wrapper",children:(0,t.jsx)("div",{className:"submit-reading__inner",children:(0,t.jsxs)("div",{className:"input-section",children:[(0,t.jsx)(a.II,(0,s.Z)((0,n.Z)({},i),{maxLength:u,isNumeric:!0,placeholder:o,error:(0,m.u9)(l.errors,i.name)&&c.touched})),(0,t.jsx)("span",{className:"bar"}),(0,t.jsx)(m.Bc,{name:i.name,children:function(e){return(0,t.jsx)("span",{className:"error-text",children:e})}}),(0,t.jsxs)("label",{htmlFor:i.name,children:[r,!0===b&&(0,t.jsx)(a.RT,{})]})]})})}),(0,t.jsx)("div",{className:"submit-reading__wrapper",children:(0,t.jsx)("div",{className:"submit-reading__inner submit-reading__spacer",children:(0,t.jsx)("a",{rel:"noopener noreferrer",href:g,target:"_blank",type:"button",className:"button tert
1iary arrow",children:"Help with this"})})})]})})}})},x=(0,m.$j)(b)},35961:function(e,i,r){"use strict";var n=r(52322),s=r(45797),t=r(6228),a=r(6997),l=r(63397),o=r(72670),c=r.n(o),d=function(e){if(!e||!e.meterReadings)return!1;var i=e.meterReadings,r=i.twentyFourHourMeter,n=i.dayMeter,s=i.nightMeter,t=i.storageMeter,a=i.peakMeter;return r||n||s||t||a},u=function(e){var i=e.serviceDown,r=e.confirmed,o=e.information,u=e.submitReadingsText,m=e.disabledFields,h=e.isLowConnectivitySmartMeter,p=void 0!==h&&h,g=e.isNewBrand,f=e.submitMeterReadings,b=e.submitDayMeterReading,x=e.submitNightMeterReading,j=e.submitStorageMeterReading,N=e.submitTwentyFourHourMeterReding,v=e.submitPeakMeterReading,_=e.meterReadingUrl,w=(!0===i||!0===r)&&d(o),y=o&&o.meterReadings&&(f||p);return w||y?(0,n.jsxs)(n.Fragment,{children:[w&&(0,n.jsx)("div",{className:"input-section",children:(0,n.jsx)("div",{className:"group group--fullwidth",children:p?(0,n.jsx)("p",{className:"submit-meter-reading",children:c()(u,(0,t.RG)("p"))}):(0,n.jsx)(l.gN,{isNewBrand:void 0!==g&&g,name:"electricityDetails.submitMeterReadings",component:s.q,id:"electricityDetails.submitMeterReadings",label:"I want to submit an Electricity Meter reading",disabled:m})})}),y&&(0,n.jsxs)(n.Fragment,{children:[N&&(0,n.jsx)(a.R,{placeholder:"1234567",label:"24 hour meter reading",helpLink:_,maxLength:7,fieldName:"electricityDetails.twentyFourHourMeterReading",required:!i}),b&&(0,n.jsx)(a.R,{placeholder:"1234567",label:"Day meter reading",helpLink:_,maxLength:7,fieldName:"electricityDetails.dayMeterReading",required:!i}),x&&(0,n.jsx)(a.R,{placeholder:"1234567",label:"Night meter reading",helpLink:_,maxLength:7,fieldName:"electricityDetails.nightMeterReading",required:!i}),j&&(0,n.jsx)(a.R,{placeholder:"1234567",label:"Night storage meter reading",helpLink:_,maxLength:7,fieldName:"electricityDetails.storageMeterReading",required:!i}),v&&(0,n.jsx)(a.R,{placeholder:"1234567",label:"Peak meter reading",helpLink:_,maxLength:7,fieldName:"electricityDetails.peakMeterReading",required:!0})]})]}):null};i.ZP=u},45797:function(e,i,r){"use strict";r.d(i,{B:function(){return m},q:function(){return g}});var n=r(26297),s=r(52322);r(91771);var t=r(84597),a=r(6228),l=r(47842),o=r(70865),c=r(13922),d=r(12524),u=r.n(d),m=function(e){var i=e.field,r=e.id,n=e.noTick,t=e.className,a=e.disabled,d=void 0!==a&&a,m=e.isNewBrand,h=void 0!==m&&m,p=e.ariaLabel,g=i.name,f=i.onChange,b=i.onBlur,x=i.value;return(0,s.jsxs)("div",{className:u()("checkbox",t,{"new-brand-checkboxtick":h}),children:[(0,s.jsx)("input",(0,o.Z)({name:g,onChange:f,onBlur:b,value:g,id:r||g,type:"checkbox",checked:x,disabled:d,"data-testid":"".concat((r||g).toLowerCase(),"-checkbox")},p&&(0,l.Z)({},"aria-label",p))),(0,s.jsx)("label",{htmlFor:r||g,children:d&&!h?(0,s.jsx)("small",{className:"disabledTick"}):(0,s.jsx)("small",{className:d?"disabledTick":"enabledTick",children:!n&&(0,s.jsx)(c.dR,{className:"checkbox__tick",fillColour:"#FFFFFF"})})})]})},h=r(72670),p=r.n(h),g=function(e){var i=e.field,r=e.id,l=e.label,o=e.noTick,c=e.className,d=e.isNewBrand,h=e.topToolTip,g=e.isWide,f=void 0===g||g,b=(0,n.Z)(e,["field","id","label","noTick","className","isNewBrand","topToolTip","isWide"]);return(0,s.jsxs)("div",{className:u()("checkbox-container",c,{"new-brand-tickbox":d}),children:[(0,s.jsxs)("div",{className:"top-row",children:[(0,s.jsxs)("div",{className:u()("label-container",{"float-tooltip":h}),children:[(0,s.jsx)("label",{htmlFor:r||i.name,className:"label",children:p()(l,(0,a.Em)({replaceTagNames:"p"}))}),!f&&(0,s.jsx)(m,{field:i,id:r,noTick:o,disabled:b.disabled,isNewBrand:d}),b.tooltip&&(0,s.jsx)(t.u,{isNewBrand:d,title:b.tooltip,position:"bottom",trigger:"mouseenter",isInfoCircleIcon:d,infoIcon:d})]}),f&&(0,s.jsx)(m,{field:i,id:r,noTick:o,disabled:b.disabled,isNewBrand:d})]}),b.description&&(0,s.jsx)("p",{children:p()(b.description,(0,a.RG)("p"))})]})}},37049:function(e,i,r){"use strict";r.d(i,{KO:function(){return c},OZ:function(){return m},es:function(){return d},vT:function(){return u}});var n=r(87394),s=r(84134),t=r(2021),a=r(52294),l=r(65413),o=function(e){if(!e)return!0;var i=(0,n.Z)(a.verhoeff.parse(e),2),r=i[0],s=i[1];return"string"==typeof e&&t.TC.test(e)&&a.verhoeff.validate("".concat(r.split("").reverse().join("")).concat(s))},c=(0,l.Z_)().min(11,(0,s.kY)("MPRN",11)).test("is-vehoeff","MPRN is not val
1id",o),d=(0,l.Z_)().min(11,"Please enter 11 digits").test("is-vehoeff","MPRN is not valid",o),u=(0,l.Z_)().test("is-vehoeff","MPRN is not valid",o),m=(0,l.Z_)().min(7,(0,s.kY)("GPRN",7)).matches(t.Lh,(0,s.lv)("GPRN")).required((0,s.q8)("GPRN"))},50974:function(){},68630:function(){},89038:function(){},26306:function(){},91771:function(){}}]);
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.