PageSourceSearch

https://www.lundsandbyerlys.com/static/js/WelcomeModal-AddNewAddress.8cce0134.chunk.js

js lundsandbyerlys.com collected 2026-09-24 10:24:44 UTC 50,479 bytes, 240 lines download raw bytes

1"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[6101],{93987:(e,t,s)=>{s.d(t,{Z:()=>i});let i=e=>({event:e.event,tab:e.tab,section:e.section,formField:e.formField})},28673:(e,t,s)=>{s.d(t,{Z:()=>i});let i=e=>({event:{click:{gtm:{event:e.event,tab:e.tab,section:e.section,linkText:e.linkText}}},events:["click"]})},12468:(e,t,s)=>{s.d(t,{Z:()=>c});var i=s(85893),a=s(29163),r=s(51667);let d=(0,a.ZP)(r.rU).withConfig({displayName:"EircodeLink",componentId:"-__sc-8b3c5961-1"})(["display:block;"]);var o=s(67294),n=s(73342),l=s(15158);let c=(0,s(86706).$j)(e=>({eircode:e.settings.services.eircode}))(e=>{let{t}=o.useContext(n.q),s=e.eircode.enabled&&!!e.eircode.url;return(0,l.Z)(()=>s?(0,i.jsx)(d,{href:e.eircode.url,target:"_blank",className:e.className,"data-testid":e["data-testid"]?e["data-testid"]:"Eircode-link-testId",children:t("modals.address.eircode")}):null,{componentName:"EircodeFinder"})})},43554:(e,t,s)=>{s.r(t),s.d(t,{default:()=>E});var i=s(85893),a=s(67294),r=s(86706),d=s(15158),o=s(29163),n=s(67979),l=s(1849),c=s(29039),h=s(55977),p=s(56407),u=s(12468),g=s(69272);let m=o.ZP.div.withConfig({displayName:"AddressFormWrapper",componentId:"-__sc-97205090-0"})(["text-align:left;padding:0 "," ",";","{padding:0 "," ",";}"],h.W0.lg,h.W0.lg,(0,n.Z)("sm"),h.W0.md,h.W0.md),y=o.ZP.div.withConfig({displayName:"Header",componentId:"-__sc-97205090-1"})(({theme:e,hideBorder:t})=>`
2  text-align: center;
3  align-items: center;
4  padding: ${h.W0.sm} ${h.W0.sm};
5  border-bottom: ${t?"none;":`1px solid ${e.colors.uiColors.greyscale2};`}
6  ${(0,n.Z)("lg")} {
7    padding: ${h.W0.sm} ${h.W0.lg};
8  }
9`),x=o.ZP.h2.withConfig({displayName:"Headline",componentId:"-__sc-97205090-2"})(({theme:e})=>`
10    margin: 0;
11    font-size: ${e.typography.text.fontLG.fontSize};
12  `),f=o.ZP.h4.withConfig({displayName:"HeadlineDetails",componentId:"-__sc-97205090-3"})(({theme:e})=>`
13  color: ${e.colors.uiColors.greyscale5};
14  font-weight: ${e.typography.weights.normal};
15  `),b=o.ZP.div.withConfig({displayName:"HeaderDetails",componentId:"-__sc-97205090-4"})(["padding-top:",";"],h.W0.md),I=(0,o.ZP)(u.Z).withConfig({displayName:"Eircode",componentId:"-__sc-97205090-5"})(()=>`
16  margin: ${h.W0.vsm} 0 ${h.W0.sm} ${h.W0.vsm};
17  `),C=o.ZP.div.withConfig({displayName:"IconContainer",componentId:"-__sc-97205090-6"})(({theme:e})=>`
18      margin: 0 auto;
19      display: flex;
20      justify-content: center;
21      align-items: center;
22      font-weight: ${e.typography.weights.bold};
23      line-height: ${e.typography.text.body.lineHeight};
24      color: ${e.colors.uiColors.greyscale5};
25      height: ${h.W0.xxl};
26      width: ${h.W0.xxl};
27      padding: 0 ${h.W0.xs};
28      background-color: ${e.modal.storeIcon.bgColor};
29      border-radius: 50%;
30      z-index: ${l.CJ};
31  `),v=(0,o.ZP)(g.G).withConfig({displayName:"IconHeaderWithStyle",componentId:"-__sc-97205090-7"})(({theme:e})=>`
32      fill: ${e.modal.storeIcon.color};
33    `),A=o.ZP.div.withConfig({displayName:"ErrorMessageBox",componentId:"-__sc-97205090-8"})(({theme:e})=>`
34      ${(0,c.E0)()}
35      display: flex;
36      width: 100%;
37      margin-bottom: ${h.W0.sm};
38      padding: ${h.W0.xs} ${h.W0.sm};
39      background-color: ${e.colors.uiColors.alertLight}
40    `),w=(0,o.ZP)(g.G).withConfig({displayName:"ErrorMessageIcon",componentId:"-__sc-97205090-9"})(({theme:e})=>`
41    svg {
42      fill: ${e.colors.uiColors.alert};
43    }
44  `),S=o.ZP.div.withConfig({displayName:"ErrorMessageText",componentId:"-__sc-97205090-10"})(({theme:e})=>`
45      margin-left: ${h.W0.xs};
46      font-size: ${e.typography.text.fontSM.fontSize};
47    `),F=(0,o.ZP)(p.f).withConfig({displayName:"AddNewAddressSpinner",componentId:"-__sc-97205090-11"})(()=>`
48  margin: ${h.W0.sm} auto;
49  svg {
50    overflow: visible;
51    circle {
52      stroke-width: ${h.W0.xxss};
53    }
54  }
55`);var N=s(73342),$=s(14278);let j=e=>{let{t}=a.useContext(N.q),s=t(e.editAddress?"modals.address.titleEdit":"modals.address.title"),r=e.editAddress?"addNewAddressForm-TitleEdit-TestId":"addNewAddressForm-Title-TestId";return(0,d.Z)(()=>(0,i.jsxs)(m,{"data-testid":"addNewAddressForm-TestId",children:[(0,i.jsxs)(y,{"data-testid":"addNewAddressForm-AddressFormHeader-TestId",children:[(0,i.jsx)(C,{children:(0,i.jsx)(v,{name:"Addresses",size:`${Number.parseInt(h.W0.lg,10)}`})}),(0,i.jsx)(b,{children:(0,i.jsx)(x,{"data-testid":r,children:s})})]}),(0,i.jsx)($.Z,{editAddress:!!e.editAddress,initialState:e.initialState,noInstructions:e.noInstructions,isCheckout:e.isCheckout,isBilling:e.isBilling,validatePostCo
55de:e.validatePostCode,closeModal:e.toggleModal,stepNavBack:e.stepNavBack})]}),{componentName:"AddressForm component"})};var _=s(90195),W=s(88010),Z=s(44519),k=s(91247),P=s(8618),B=s(85600),L=s(83477);let V={GetAddresses:W.g,addCustomerAddress:Z.fp,checkAddressDeliveryStatus:Z.vn},M=(0,r.$j)(e=>({customerDetails:e.customer.details,addressIntegrationV2:e.settings.retailer.addressIntegrationV2,addressConfirmationModal:e.settings.sharedSettings.general.addressConfirmationModal}),V)(e=>{let{t}=a.useContext(N.q),[s,r]=a.useState(null),[o,n]=a.useState(!1),[l,c]=a.useState(!1),[p,u]=a.useState(),g=()=>{r(t("modals.addressIntegration.addressFinderError")),n(!1)},j=async t=>{if(e.addressIntegrationV2){if(!t||t&&!t.latitude||t&&!t.longitude)return g()}else if(n(!0),!t||t&&!t.postCode||t&&!t.latitude||t&&!t.longitude)return g();let s=((e,t,s)=>{try{if("object"!=typeof e||!e.hasOwnProperty("addressLine1")||!e.hasOwnProperty("city")||!e.hasOwnProperty("province")||!e.hasOwnProperty("postCode")||!e.hasOwnProperty("longitude")||!e.hasOwnProperty("latitude"))return null;return{id:s(),firstName:t.firstName||"",familyName:t.lastName||"",addressFinderId:e.addressFinderId||"",addressLine1:e.addressLine1||"",addressLine2:e.addressLine2||"",city:e.city||"",longitude:e.longitude||"",latitude:e.latitude||"",countyProvinceState:e.province||"",postCode:e.postCode||"",country:"",phoneNumber:t.phone||""}}catch(s){return P.logger.error("AddressIntegrationGenerateAddress",s,{data:e,customerDetails:t}),null}})(t,e.customerDetails,k.Z);if(!s)return void g();if(e.addressIntegrationV2){if(u(s),!(s&&s.addressLine1&&s.postCode&&s.countyProvinceState&&s.city)||e.addressConfirmationModal)return c(!0);n(!0),c(!1)}(await e.addCustomerAddress(s,!1,!0),(e.validatePostCode||e.addressIntegrationV2)&&await e.checkAddressDeliveryStatus(s),e.stepNavBack)?e.stepNavBack():e.toggleModal()};return(0,d.Z)(()=>o?(0,i.jsxs)(y,{hideBorder:!0,"data-testid":"addNewAddressForm-Spinner-TestId",children:[(0,i.jsx)(x,{children:t("modals.addressIntegration.spinnerText")}),(0,i.jsx)(F,{})]}):(0,i.jsxs)(m,{"data-testid":"addNewAddressFrom-AddressFinder-TestId",children:[(0,i.jsxs)(y,{children:[(0,i.jsx)(C,{children:(0,i.jsx)(v,{name:"Addresses",size:h.W0.lg})}),(0,i.jsxs)(b,{children:[(0,i.jsx)(x,{children:t("modals.addressIntegration.title")}),(0,i.jsx)(f,{children:t("modals.addressIntegration.subTitle")})]})]}),!!s&&(0,i.jsxs)(A,{children:[(0,i.jsx)(w,{name:"Error",size:"16"}),(0,i.jsx)(S,{children:s})]}),!l&&(0,i.jsx)(B.Z,{"data-testid":"addNewAddressForm-AddressFinder-input-TestId",submitCallback:j}),l&&(0,i.jsx)($.Z,{noInstructions:!l,skipValidation:l,initialState:(0,L.a)(p,e.addressConfirmationModal),validatePostCode:!0,editAddress:!1,noCloseButton:!0,isCheckout:e.isCheckout,isBilling:e.isBilling,closeModal:e.toggleModal,stepNavBack:e.stepNavBack}),(0,i.jsx)(I,{"data-testid":"addNewAddressForm-AddressFinder-eircode-testid"})]}),{componentName:"AddressIntegrationNewAddressForm"})}),E=(0,r.$j)(e=>({newWfcAddress:e.settings.retailer.addresses.integration.addNewAddressUrl,editWfcAddress:e.settings.retailer.addresses.integration.editAddressUrl,useAddressIntegrationForm:e.settings.retailer.addresses.integration.enabled&&e.settings.retailer.addresses.integration.useForNewAddresses||e.settings.retailer.addressIntegrationV2}))(e=>(0,d.Z)(()=>{let{newWfcAddress:t,editWfcAddress:s,useAddressIntegrationForm:a,...r}=e;return t&&!e.editAddress?(0,i.jsx)(_.Z,{src:t,title:"Add new address",stepNavBack:e.stepNavBack}):s&&e.editAddress&&e.initialState?(0,i.jsx)(_.Z,{src:`${s}${e.initialState.id}`,title:"Edit existing address",stepNavBack:e.stepNavBack}):a&&!e.editAddress?(0,i.jsx)(M,{...r}):(0,i.jsx)(j,{...r})},{componentName:"AddNewAddress"}))},83477:(e,t,s)=>{s.d(t,{a:()=>i});let i=(e,t)=>{try{if(!e)return null;return t&&(e.firstName="",e.familyName="",e.phoneNumber=""),e}catch{return null}}},90195:(e,t,s)=>{s.d(t,{Z:()=>f});var i=s(85893),a=s(67294),r=s(51667),d=s(29163),o=s(67979);let n=d.ZP.iframe.withConfig({displayName:"WfcIframe",componentId:"-__sc-ce785af-0"})(({hide:e,isDeliverySectionCheckout:t})=>`
56  height: ${t?"1450px":"700px"};
57  width: ${t?"100%":"560px"};
58  border: hidden;
59  display: ${e?"none":"initial"};
60  
61  ${(0,o.Z)("sm")} {
62    width: 100%;
63  } 
64`);var l=s(15158),c=s(86706),h=s(39812),p=s(33526),u=s(44519),g=s(15009);function m(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class y extends a.Component{componentDidUpdate(){this.props.addressesHasBeenUpdated&&this._AddressLogic()}componentDidMount(){setTimeout(()=>this.setState({loading:!1}),2e3),window.addEventListener("message",this._closeModalAndCleanupState)}componentWillUnmount(){window.removeEventListener("message",this._closeModalAndCleanupState),this.clearFirebaseFailureFallback()}render(){return(0,l.Z)(()=>
64(0,i.jsxs)("span",{"data-testid":"wfc-iframeComponent-testId",children:[this.state.loading&&(0,i.jsx)(r.$j,{}),(0,i.jsx)(n,{hide:this.state.loading,src:this.props.src,title:this.props.title,isDeliverySectionCheckout:!!this.props.isDeliverySectionCheckout})]}),{componentName:"WfcIframeComponent"})}constructor(e){super(e),m(this,"firebaseFailureFallback",void 0),m(this,"setFirebaseFailureFallback",()=>{this.firebaseFailureFallback=setTimeout(()=>{this._AddressLogic()},5e3)}),m(this,"clearFirebaseFailureFallback",()=>clearTimeout(this.firebaseFailureFallback)),m(this,"_closeModalAndCleanupState",e=>{e.data&&'{"message":"success"}'===e.data&&(this.setState({loading:!0}),this.setFirebaseFailureFallback()),e.data&&'{"message":"cancel"}'===e.data&&(this.props.closeModal(),this.props.setCustomerAddressesUpdated(!1))}),m(this,"_AddressLogic",async()=>{let{isAddAddressIframe:e,isDeleteIframe:t,isEditIframe:s}=this.props;await this.props.getCustomerAddresses(),this.props.setCustomerAddressesUpdated(!1),this.props.isCheckoutPage?(this.props.CheckAllDeliveryStatuses(),(e||t||s)&&this.props.closeModal()):this.props.stepNavBack&&this.props.stepNavBack()}),this.state={loading:!0}}}let x={closeModal:()=>({type:p._DT}),openGlobalModal:h.f9,setCustomerAddressesUpdated:h.Lj,getCustomerAddresses:u.Gu,CheckAllDeliveryStatuses:u.ME},f=(0,c.$j)((e,t)=>{let{addNewAddressUrl:s,editAddressUrl:i,deleteAddressUrl:a}=e.settings.retailer.addresses.integration;return{isCheckoutPage:(0,g.Wt)(e),addressesHasBeenUpdated:e.ui.retailerUpdatedCustomerAddress,isAddAddressIframe:!!s&&t.src.includes(s),isEditIframe:!!i&&t.src.includes(i),isDeleteIframe:!!a&&t.src.includes(a)}},x)(y)},40036:(e,t,s)=>{s.d(t,{NG:()=>g,RT:()=>x,T0:()=>y,X2:()=>u,XJ:()=>n,cO:()=>l,h1:()=>c,qw:()=>f,s0:()=>h,uT:()=>p,z4:()=>m});var i=s(29163),a=s(55977),r=s(29039),d=s(51667),o=s(67979);s(9754);let n=(0,i.ZP)(d.$j).withConfig({displayName:"AddNewAddressSpinner",componentId:"-__sc-381a4c45-0"})(()=>`
65  margin: ${a.W0.sm} auto;
66  svg {
67    overflow: visible;
68    circle {
69      stroke-width: ${a.W0.xxss};
70    }
71  }
72`),l=i.ZP.div.withConfig({displayName:"ErrorMessageBox",componentId:"-__sc-381a4c45-1"})(({theme:e})=>`
73      ${(0,r.E0)()}
74      display: flex;
75      width: 100%;
76      margin-bottom: ${a.W0.sm};
77      padding: ${a.W0.xs} ${a.W0.sm};
78      background-color: ${e.colors.uiColors.alertLight}
79    `),c=i.ZP.div.withConfig({displayName:"ErrorMessageText",componentId:"-__sc-381a4c45-2"})(({theme:e})=>`
80      margin-left: ${a.W0.xs};
81      font-size: ${e.typography.text.fontSM.fontSize};
82    `);a.W0.lg,a.W0.vsm,a.W0.xs,a.W0.vxs,a.W0.lg,a.W0.vsm,a.W0.vsm,(0,i.ZP)(d.zx).withConfig({displayName:"AddressModCancelButton",componentId:"-__sc-381a4c45-16"})(["margin-right:",";"],a.W0.sm);let h=i.ZP.h2.withConfig({displayName:"Headline",componentId:"-__sc-381a4c45-20"})(({theme:e,fixingAddress:t})=>`
83  padding-top: ${t?a.W0.lg:a.W0.vxs};
84  text-align: center;
85  margin: 0;
86  font-size: ${e.typography.text.fontMD.fontSize};
87`),p=i.ZP.div.withConfig({displayName:"Body",componentId:"-__sc-381a4c45-22"})(["position:relative;width:100%;padding:"," ",";","{padding:"," ",";max-width:auto;}","{padding:"," ",";max-width:600px;}"],a.W0.sm,a.W0.sm,(0,o.Z)("md",{noUpper:!0}),a.W0.md,a.W0.sm,(0,o.Z)("lg"),a.W0.md,a.W0.lg),u=i.ZP.div.withConfig({displayName:"Row",componentId:"-__sc-381a4c45-23"})(({mobileFullWidth:e})=>`
88    display: flex;
89    ${(0,o.Z)("sm")} {
90      ${e&&`     
91        display:inline-block;
92        width:100%;
93        padding-right: ${a.W0.sm};`}}
94`),g=i.ZP.span.withConfig({displayName:"RequiredWarning",componentId:"-__sc-381a4c45-24"})(({theme:e})=>`
95  right: 45px;
96  font-size: ${e.typography.text.fontXS.fontSize};
97  position: absolute;
98
99  &:before {
100    color: ${e.colors.uiColors.alert};
101    content: '* ';
102    display: inline;
103  }
104
105  ${(0,o.Z)("sm")} {right: 25px;}`),m=i.ZP.div.withConfig({displayName:"RowField",componentId:"-__sc-381a4c45-25"})(({small:e,medium:t})=>`
106    width: 100%;
107    ${t&&"width: 50%;"};
108    margin-right: 10px;
109    margin-left: 10px;
110    margin-bottom: ${a.W0.xs};
111`),y=i.ZP.label.withConfig({displayName:"LabelField",componentId:"-__sc-381a4c45-26"})(({theme:e,required:t})=>`
112  display: block;
113  font-weight: ${e.typography.weights.bold};
114  font-size: ${e.typography.text.fontSM.fontSize};
115  margin-bottom: ${a.W0.xs};
116  ${t&&`&:after {
117        color: ${e.colors.uiColors.alert};
118        content: ' *';
119        display: inline;
120      };`}
121                
122`),x=i.ZP.span.withConfig({displayName:"RequiredStar",componentId:"-__sc-381a4c45-27"})(({theme:e})=>`
123    &:before {
124    color: ${e.colors.uiColors.alert};
125    content: '* ';
126    display: inline;
127  }
128    `),f=(0,i.ZP)(d.UP).withConfig({displayName:"InputFieldWithStyle",componentId:"-__sc-381a4c45-28"})(({heightProp:e,marginBottom:t})=>`   
129    max-height: ${e?a.W0.lg:a.W0.xl};
130    height: ${a.W0.xl};
131    padding: ${a.W0.sm};
132    margin-bottom: ${t||a.W0.sm};
133    width: 100%;
134  `);a.W0.sm},14278:(e,t,s)=>{s.d(t,{Z:()=>V});var i,a=s(85893),r=s(67294),d=s(91247),o=s(40036),n=s(86706),l=s(73342),c=s(24854),h=s(94792),p=s(87537),u=s(93987),g=s(15158),m=s(51667);let y=e=>(0,a.jsxs)(r.Fragment,{children:[e.canNotDeliver&&(0,a.jsxs)(o.cO,{children:[(0,a.jsx)(m.pA,{name:"Error",fillColor:e.theme.colors.uiColors.alert,size:"16"}),(0,a.jsx)(o.h1,{children:`We're sorry, we don't delivery to ${e.postCode} yet`})]}),e.addressValidationFailures.length>0&&e.addressValidationFailures.map(t=>(0,a.jsxs)(o.cO,{children:[(0,a.jsx)(m.pA,{name:"Error",fillColor:e.theme.colors.uiColors.alert,size:"16"}),(0,a.jsx)(o.h1,{children:`${e.parentState[t].value} does not match any known ${"postCode"===t?"postal codes":"addresses"}. Please try again.`})]},t))]});var x=s(467),f=s(12468),b=s(28673),I=s(29163),C=s(15009),v=s(4894),A=s(22157),w=s(8618),S=s(32865),F=s(44519),N=s(78394),$=s(63791);let j=(e,t=!1,s=!1,i=!1)=>{let a,r,d;return a=F.Gu,r=v.sg,d=w.logger,async(o,n)=>{try{let d=n();if(!(0,A.n)(d))return;if(d.settings.retailer.addressIntegrationV2||o(t||s?(0,F.F6)(e):(0,F.v6)(e)),await r.put(`customers/addresses/${e.id}`,e),!t&&d.settings.retailer.addressIntegrationV2){let t=d.stores.retailerStoreId;await (0,F.sq)(e,o,n,r),i||await (0,$.b4)(t,e.postCode,r)(o,n)}s&&d.settings.retailer.addressIntegrationV2&&await (0,F.sq)(e,o,n,r),await (0,N.Z)(o,a(),1500)}catch(t){d.httpCatch("UpdateCustomerAddress",t,{address:e}),o((0,S.e1)({address:e}))}}};var _=s(84258),W=s(48950),Z=s(35912),k=s(92888),P=s(55977);function B(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class L extends(i=r.Component){componentDidUpdate(e){this.props.use3rdPartyAddressValidation||e.addressValidationResponse!==this.props.addressValidationResponse&&Object.keys(this.props.addressValidationResponse).forEach(e
134=>{this.props.addressValidationResponse[e].find(t=>t.includes(this.state[e]))||this.state.addressValidationFailures.includes(e)?this.setState(t=>({addressValidationFailures:t.addressValidationFailures.filter(t=>t!==e)})):this.setState(t=>({addressValidationFailures:[...t.addressValidationFailures,e]}))})}componentDidMount(){let e=document.getElementById(k.df);if(e&&e.scrollIntoView(!0),this.props.addressIntegrationV2)if(this.props.skipValidation||this.props.editAddress||this.props.fixingAddress)return;else this.validateAll(!0)}render(){let e=!!Object.keys(this.props.inputValidation).map(e=>!!this.state[e]&&!!this.state[e].error||this.props.inputValidation[e].some(e=>"string"==typeof e&&"required"===e.toLowerCase())&&!!this.state[e]&&0===this.state[e].value.length||this.state.canNotDeliver).find(e=>e),t=!this.props.fixingAddress&&this.props.editAddress&&this.props.addressIntegration,s=this.props.fixingAddress||this.props.skipValidation;return(0,g.Z)(()=>(this.props.addressIntegrationV2||this.props.fixingAddress)&&this.state.showSpinner?(0,a.jsxs)(r.Fragment,{children:[(0,a.jsx)(o.s0,{fixingAddress:!!this.props.fixingAddress,children:this.props.fixingAddress?this.context.t("modals.fixAddressModal.spinnerText"):this.context.t("modals.addressIntegration.spinnerText")}),(0,a.jsx)(o.XJ,{})]}):(0,a.jsxs)(o.uT,{"data-testid":this.props["data-testid"]?this.props["data-testid"]:"addressFormBody-testId",children:[(0,a.jsx)(y,{postCode:this.state.postCode.value,canNotDeliver:this.state.canNotDeliver,theme:this.props.theme,addressValidationFailures:this.state.addressValidationFailures,parentState:this.state}),(0,a.jsxs)(r.Fragment,{children:[(0,a.jsx)(o.NG,{children:this.context.t("modals.address.requiredMessage")}),(0,a.jsxs)(o.X2,{mobileFullWidth:!0,children:[(0,a.jsx)(o.z4,{children:(0,a.jsx)(x.W,{marginBottom:P.W0.xs,"data-testid":"addressInput-firstName-testId",label:this.context.t("modals.address.first.label"),state:this.state.firstName,required:this.isRequiredField("firstName"),handleChange:this.handleChange,placeholder:this.context.t("modals.address.first.placeholder"),id:"firstName",type:"input",handleFocus:this.handleFocus,handleBlur:e=>this.handleBlur("firstName",this.context.t("modals.address.first.label"))})}),(0,a.jsx)(o.z4,{children:(0,a.jsx)(x.W,{marginBottom:P.W0.xs,"data-testid":"addressInput-surname-testId",label:this.context.t("modals.address.surname.label"),state:this.state.familyName,required:this.isRequiredField("familyName"),handleChange:this.handleChange,placeholder:this.context.t("modals.address.surname.placeholder"),id:"familyName",type:"input",handleFocus:this.handleFocus,handleBlur:e=>this.handleBlur("familyName",this.context.t("modals.address.surname.label"))})})]}),(0,a.jsx)(o.X2,{children:(0,a.jsx)(o.z4,{children:(0,a.jsx)(x.W,{marginBottom:P.W0.xs,"data-testid":"addressInput-addressLine1-testId",disabled:s&&!!this.props.initialState?.addressLine1||t,label:this.context.t("modals.address.line1.label"),state:this.state.addressLine1,required:this.isRequiredField("addressLine1"),handleChange:this.handleChange,placeholder:this.context.t("modals.address.line1.placeholder"),id:"addressLine1",type:"input",handleFocus:this.handleFocus,handleBlur:e=>this.handleBlur("addressLine1",this.context.t("modals.address.line1.label"))})})}),(0,a.jsx)(o.X2,{children:(0,a.jsx)(o.z4,{children:(0,a.jsx)(x.W,{marginBottom:P.W0.xs,"data-testid":"addressInput-addressLine2-testId",disabled:s&&!!this.props.initialState?.addressLine2||t,label:this.context.t("modals.address.line2.label"),state:this.state.addressLine2,handleChange:this.handleChange,placeholder:this.context.t("modals.address.line2.placeholder"),required:this.isRequiredField("addressLine2"),id:"addressLine2",type:"input",handleFocus:this.handleFocus,handleBlur:e=>this.handleBlur("addressLine2",this.context.t("modals.address.line2.label"))})})}),(0,a.jsx)(o.X2,{children:(0,a.jsx)(o.z4,{children:(0,a.jsx)(x.W,{marginBottom:P.W0.xs,"data-testid":"addressInput-city-testId",disabled:s&&!!this.props.initialState?.city||t,label:this.context.t("modals.address.city.label"),state:this.state.city,required:this.isRequiredField("city"),handleChange:this.handleChange,placeholder:this.context.t("modals.address.city.placeholder"),id:"city",type:"input",handleFocus:this.handleFocus,handleBlur:e=>this.handleBlur("city",this.context.t("modals.address.city.label"))})})}),(0,a.jsxs)(o.X2,{children:[(0,a.jsx)(o.z4,{medium:!0,children:(0,a.jsx)(x.W,{marginBottom:P.W0.xs,"data-testid":"addressInput-state-testId",disabled:s&&!!this.props.initialState?.countyProvinceState||t,label:this.context.t("modals.address.state.label"),state:this.state.countyProvinceState,required:this.isRequiredField("countyProvinceState"),handleChange:this.handleChange,placeholder:this.context.t("modals.address.state.placeholder"),id:"countyProvinceState",type:"input",handleFocus:this.handleFocus,handleBlur:e=>this.handleBlur("countyProvinceState",this.context.t("modals.address.state.label"))})}),(0,a.jsxs)(o.z4,{medium:!0,children:[(0,a.jsx)(x.W,{marginBottom:P.W0.xs,"data-testid":"addressInput-postCode-testId",disabled:s&&!!this.props.initialState?.postCode||t,label:this.context.t("modals.address.zip.label"),state:this.state.postCode,required:this.isRequiredField("postCode"),handleFocus:e=>{this.removeErrorAlert(),this.handleFocus(e,"postCode")},handleChange:this.handleChange,placeholder:this.context.t("modals.address.zip.placeholder"),id:"postCode",type:"input",handleBlur:e=>this.handleBlur("postCode",this.context.t("modals.address.zip.label"))}),!t&&!this.props.fixingAddress&&(0,a.jsx)(f.Z,{})]})]}),(0,a.jsx)(o.X2,{children:(0,a.jsx)(o.z4,{children:(0,a.jsx)(x.W,{marginBottom:P.W0.xs,"data-testid":"addressInput-phoneNumber-testId",label:this.context.t("modals.address.phone.label"),state:this.state.phoneNumber,required:this.isRequiredField("phoneNumber"),handleChange:this.handleChange,placeholder:this.context.t("modals.address.phone.placeholder"),id:"phoneNumber",type:"tel",handleFocus:this.handleFocus,handleBlur:e=>this.handleBlur("phoneNumber",this.context.t("modals.address.phone.label")),maxLength:30})})}),!this.props.noInstructions&&!this.props.isBilling&&(0,a.jsx)(o.X2,{children:(0,a.jsxs)(o.z4,{children:[(0,a.jsx)(o.T0,{htmlFor:"instructions",children:this.context.t("modals.address.instructions.label")}),(0,a.jsx)(m.Kx,{"data-testid":"addressInput-instructions-testId",name:"instructions",id:"instructions",state:this.state.instructions,handleChange:this.handleChange,placeholder:this.context.t("modals.address.instructions.placeholder"),type:"input",handleFocus:this.handleFocus,handleBlur:e=>this.handleBlur("instructions",this.context.t("modals.address.instructions.label")),maxLength:1800})]})}),(0,a.jsx)(o.X2,{children:(0,a.jsxs)(o.z4,{children:[!this.props.noCloseButton&&(0,a.jsxs)(r.Fragment,{children:[(0,a.jsx)(m.zx,{buttonStyle:"primaryLight",handleClick:this.handleCancel,analyticsEvents:(0,b.Z)({event:p.Hf,tab:this.context.t("myAccount.pillbtns.addresses"),section:this.context.t("myAccount.address.title"),linkText:this.context.t("modals.address.cancelBtn")}),"data-testid":"addressFormCloseBtnTestId",children:this.context.t("modals.address.cancelBtn")}),"\xa0"]}),(0,a.jsx)(m.zx,{buttonStyle:"primary",disabled:e||this.state.disabledWhileSaving,handleClick:this.saveAddress,analyticsEvents:(0,b.Z)({event:p.Hf,tab:this.context.t("myAccount.pillbtns.addresses"),section:this.context.t("myAccount.address.title"),linkText:this.context.t("modals.address.saveBtn")}),"data-testid":"addressFormSaveBtnTestId",children:this.context.t("modals.address.saveBtn")})]})})]})]}),{componentName:"AddressForm"})}constructor(e){super(e),B(this,"context",void 0),B(this,"StateKeyBuilder",(e,t,s=!1)=>({value:e&&e[t]?e[t]:"",touched:s,error:null})),B(this,"handleChange",async(e,t)=>{let s=e.target.value;("countyProvinceState"===t||"postCode"===t)&&(s=s.toString().toUpperCase()),this.setState(e=>({...e,[t]:{value:s,valueOnFocus:e[t].valueOnFocus,touched:!0}}),()=>this.validateAll())}),B(this,"validateAll",(e=!1)=>
134{Object.keys(this.props.inputValidation).forEach(t=>{let s=this.state[t];if(s&&(s.touched||e)){let e=(0,c.Z)(this.props.inputValidation[t],s.value,t);e?e.forEach(e=>{e.hasError&&this.setState(s=>({...s,[t]:{...s[t],error:e}}))}):this.setState(e=>({...e,[t]:{...e[t],error:null}}))}})}),B(this,"removeErrorAlert",()=>this.setState({canNotDeliver:!1})),B(this,"handleCancel",()=>{this.props.stepNavBack?this.props.stepNavBack():(this.props.closeModal&&this.props.closeModal(),this.scrollToTop())}),B(this,"scrollToTop",()=>{if(this.props.addressIntegrationV2){let e=document.getElementById("modal-content");e&&e.scrollTo(0,0)}let e=document.getElementById("step-heading");e&&e.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"})}),B(this,"spinnerCallback",()=>{this.setState({showSpinner:!1})}),B(this,"saveAddress",async()=>{this.props.addressIntegrationV2&&!this.props.fixingAddress&&(this.props.saveClick&&this.props.saveClick(),this.setState({showSpinner:!0}),this.scrollToTop()),this.props.fixingAddress&&(this.setState({showSpinner:!0}),this.scrollToTop());let{editAddress:e,retailerStoreId:t,sessionAddress:s,isCheckout:i,isBilling:a,validatePostCode:r}=this.props;this.setState({disabledWhileSaving:!0});let o={id:this.state.id.value||(0,d.Z)(),firstName:this.state.firstName.value,familyName:this.state.familyName.value,addressLine1:this.state.addressLine1.value,addressLine2:this.state.addressLine2.value,city:this.state.city.value,countyProvinceState:this.state.countyProvinceState.value,postCode:this.state.postCode.value,phoneNumber:this.state.phoneNumber.value,country:this.state.country.value,instructions:this.state.instructions.value};if(this.state.addressFinderId&&this.state.addressFinderId.value&&(o.addressFinderId=this.state.addressFinderId.value),(e||this.props.fixingAddress)&&this.props.initialState&&this.props.initialState.latitude&&this.props.initialState.longitude&&(o.latitude=this.props.initialState.latitude,o.longitude=this.props.initialState.longitude),await this.props.formAction(e,!!i,!!a,t,o,s,!!r,!!this.props.fixingAddress),this.setState({disabledWhileSaving:!1}),this.props.fixingAddress){this.props.saveClick&&this.props.saveClick(this.spinnerCallback);return}this.props.stepNavBack?this.props.stepNavBack():(this.props.closeModal&&this.props.closeModal(),this.scrollToTop(),this.props.callback&&this.props.callback(o),this.props.addressIntegrationV2||this.setState({showSpinner:!1}))}),B(this,"handleFocus",(e,t)=>{let s=e.target.value;this.setState(e=>({...e,[t]:{...e[t],valueOnFocus:s}}))}),B(this,"handleBlur",(e,t)=>{this.state[e].valueOnFocus!==this.state[e].value&&(0,h.I)((0,u.Z)({event:p.Or,tab:this.context.t("myAccount.pillbtns.addresses"),section:this.context.t("myAccount.address.title"),formField:t}))}),B(this,"isRequiredField",e=>{let t=this.props.inputValidation[e];return!!t&&t.includes("required")}),this.state={showSpinner:!1,id:this.StateKeyBuilder(e.initialState,"id",!0),addressFinderId:this.StateKeyBuilder(e.initialState,"addressFinderId",!0),firstName:this.StateKeyBuilder(e.initialState,"firstName"),familyName:this.StateKeyBuilder(e.initialState,"familyName"),addressLine1:this.StateKeyBuilder(e.initialState,"addressLine1"),addressLine2:this.StateKeyBuilder(e.initialState,"addressLine2"),city:this.StateKeyBuilder(e.initialState,"city"),countyProvinceState:this.StateKeyBuilder(e.initialState,"countyProvinceState"),postCode:this.StateKeyBuilder(e.initialState,"postCode"),country:this.StateKeyBuilder(e.initialState,"country"),phoneNumber:this.StateKeyBuilder(e.initialState,"phoneNumber"),instructions:this.StateKeyBuilder(e.initialState,"instructions"),canNotDeliver:!1,addressValidationFailures:[],disabledWhileSaving:!1}}}B(L,"contextType",l.q),B(L,"defaultProps",{noInstructions:!1});let V=(0,I.Zz)((0,n.$j)(e=>({addressValidationResponse:e.customer.addressValidationResponse,use3rdPartyAddressValidation:e.settings.retailer.useAddressValidation,inputValidation:e.settings.retailer.addresses.addressValidationTypes,retailerStoreId:e.stores.retailerStoreId,sessionAddress:(0,C.Ue)(e),addressIntegration:e.settings.retailer.addresses.integration.enabled||e.settings.retailer.addressIntegrationV2,addressIntegrationV2:e.settings.retailer.addressIntegrationV2}),e=>({formAction:async(t,s,i,a,r,d,o,n)=>{let l,c;return e((l=_.Z,c=F.ME,async(e,h)=>{let p=(0,W.Z)(r,!0,h()),u=d?d.id:"";if(t||n){await e(j(p,t,n)),u&&u!==p.id||e(l(p.postCode,a,p.id)),o&&!i&&e(c());return}(await e(j(p,!1,!1,s)),s||e(l(p.postCode,a,p.id)),i)?e((0,Z.t$)(p)):o&&e(c())}))}}))(L))},467:(e,t,s)=>{s.d(t,{W:()=>o,Z:()=>n});var i=s(85893),a=s(67294),r=s(40036),d=s(15158);let o=({showEmptyErrorMessage:e=!1,...t})=>(0,d.Z)(()=>(0,i.jsxs)(a.Fragment,{children:[t.label&&(0,i.jsxs)(r.T0,{htmlFor:t.i
134d,children:[t.label," ",t.required&&(0,i.jsx)(r.RT,{})]}),(0,i.jsx)(r.qw,{disabled:t.disabled,marginBottom:t.marginBottom,heightProp:!!t.heightProp,ariaLabel:t.ariaLabel,name:t.id,id:t.id,placeholder:t.placeholder,type:t.type,value:t.state.value,handleBlur:t.handleBlur,handleFocus:t.handleFocus,handleChange:t.handleChange,maxLength:t.maxLength,hasError:!!t.state.error&&t.state.error.hasError,errorMessage:t.state.error?t.state.error.errorMessage:"",showEmptyErrorMessage:e,errorTranslateProps:t.state.error?t.state.error.errorTranslateProps:{},"data-testid":t["data-testid"]})]}),{componentName:"FormField",placeholder:{color:"lightgrey",height:"40px"}}),n=o},85600:(e,t,s)=>{s.d(t,{Z:()=>P});var i,a=s(85893),r=s(67294),d=s(29163),o=s(29039),n=s(55977),l=s(42358),c=s(69272),h=s(1528);let p=d.ZP.div.withConfig({displayName:"AddressIntegrationWrapper",componentId:"-__sc-30c63c4e-0"})(["position:relative;"]),u=d.ZP.div.withConfig({displayName:"AddressIntegrationInputWrapper",componentId:"-__sc-30c63c4e-1"})(["position:relative;"]),g=(0,d.ZP)(h.s).withConfig({displayName:"AddressIntegrationInput",componentId:"-__sc-30c63c4e-2"})(["width:100%;padding:"," "," "," ",";"],n.W0.sm,n.W0.xxl,n.W0.sm,n.W0.sm),m=d.ZP.p.withConfig({displayName:"AddressInputHint",componentId:"-__sc-30c63c4e-3"})(["",";"],o.jy),y=(0,d.ZP)(l.bS).withConfig({displayName:"AddressIntegrationReset",componentId:"-__sc-30c63c4e-4"})(({theme:e})=>`
135    display: flex;
136    justify-content: center;
137    align-items: center;
138    width: ${n.W0.lg};
139    height: ${n.W0.lg};
140    position: absolute;
141    top: 50%;
142    right: calc(${n.W0.lg} + ${n.W0.xs});
143    transform: translateY(-50%);
144    cursor: pointer;
145    
146    ${(0,o.E0)()};
147  
148    svg {
149      fill: ${e.colors.uiColors.greyscale4};
150      transition: all 0.3s ease;
151    }
152  
153    &:hover {
154      svg {
155        transform: rotate(90deg);
156        fill: ${e.colors.uiColors.greyscale5};
157      }
158    }
159  `),x=(0,d.ZP)(l.bS).withConfig({displayName:"AddressIntegrationSubmitButton",componentId:"-__sc-30c63c4e-5"})(({theme:e})=>`
160        display: flex;
161        justify-content: center;
162        align-items: center;
163        width: ${n.W0.lg};
164        height: ${n.W0.lg};
165        position: absolute;
166        top: 50%;
167        right: ${n.W0.xs};
168        transform: translateY(-50%);
169        cursor: pointer;
170        font-size: ${e.typography.text.fontSM.fontSize};
171        min-width: ${n.W0.xs};
172       
173        color: inherit;
174        border: none;
175        padding: 0;
176    
177       
178    
179        ${(0,o.E0)()};
180    
181        svg {
182          margin: 0;
183        }`),f=d.ZP.div.withConfig({displayName:"AddressIntegrationAutosuggestionsWrapper",componentId:"-__sc-30c63c4e-6"})(({theme:e})=>`
184    border: none;
185    font-family: ${e.typography.text.fontSM.fontFamily};
186    box-shadow: ${o.q.medium};
187
188    svg {
189        fill: ${e.colors.uiColors.greyscale4};
190    }
191`),b=d.ZP.div.withConfig({displayName:"AddressAutosuggestion",componentId:"-__sc-30c63c4e-7"})(({theme:e,disabled:t})=>{let s=t?e.colors.uiColors.greyscale3:e.colors.uiColors.greyscale4;return`
192        display: flex;
193        align-items: center;
194        line-height: ${e.typography.text.fontSM.lineHeight};
195        font-size: ${e.typography.text.fontSM.fontSize};
196        font-weight: ${e.typography.text.fontSM.fontWeight};
197        padding: ${n.W0.xs} ${n.W0.sm};
198        color: ${s};
199        cursor: ${t?"default":"pointer"};
200        border: none;
201        min-height: ${n.W0.lgr};
202        text-align: left;
203   
204        svg {
205            fill: ${s};
206        }
207
208        ${!t?`&:hover {
209            color: ${e.colors.uiColors.greyscale6};
210            background-color: ${e.colors.brandColors.tertiary1};
211        }`:""}
212        `}),I=(0,d.ZP)(c.G).withConfig({displayName:"AddressAutosuggestionIcon",componentId:"-__sc-30c63c4e-8"})(["width:",";height:",";margin-right:",";"],n.W0.sm,n.W0.sm,n.W0.vsm),C=d.ZP.p.withConfig({displayName:"AddressDuplicateErrorMessage",componentId:"-__sc-30c63c4e-9"})(({theme:e})=>`
213    color: ${e.colors.uiColors.alert};
214    padding-top: ${n.W0.sm};
215    font-weight: ${e.typography.weights.bold};
216  `),v="AddressIntegrationSuggestionsWrapper-TestId";var A=s(73342),w=s(88010),S=s(86706),F=s(15158),N=s(48710);let $=e=>{let{t}=r.useContext(A.q);return(0,F.Z)(()=>e.searchingAddresses?(0,a.jsx)(f,{"data-testid":"AddressIntegrationSearching-TestId",...N.kf,children:(0,a.jsxs)(b,{disabled:!0,children:[(0,a.jsx)(I,{name:"Search"}),t("modals.addressIntegration.searchingAddress")]})}):(0,a.jsx)(f,{role:"listbox",id:v,"data-testid":v,...N.kf,children:e.autosuggestions.map((t,s)=>(0,a.jsxs)(b,{role:"option",onClick:()=>e.handleClick(t),"data-testid":`AddressIntegrationSuggestionField-TestId-${t.id}`,children:[(0,a.jsx)(I,{name:t.id===e.addressNotFound.id?"Warning":"LocationPin"}),t.address]},s))}),{componentName:"AddressIntegration/AutosuggestionField"})};var j=s(71328),_=s(86564);function W(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class Z extends(i=r.Component){componentDidMount(){(this.props.addressIntegrationV2||this.props.forceAddressFinder)&&this.checkBrowserGeolocationPermission(),this.props.initialValue&&this.searchAddress(this.props.initialValue)}constructor(e,t){super(e),W(this,"context",void 0),W(this,"autosuggestionTimeout",void 0),W(this,"addressNotFound",void 0),W(this,"submitCallback",e=>this.props.submitCallback&&this.props.submitCallback(e)),W(this,"autosuggestionsCallback",e=>this.props.autosuggestionsCallback&&this.props.autosuggestionsCallback(e)),W(this,"searchAddress",e=>{this.setState(()=>({inputValue:e,searchingAddresses:!1})),e&&e.length>=3&&(clearTimeout(this.autosuggestionTimeout),this.autosuggestionTimeout=setTimeout(async()=>{this.setState({searchingAddresses:!0});let t=await this.props.getAutosuggestions(e,this.props.forceAddressFinder,this.props.includeStreetLessResults);!t||t.length<=0?this.setState({autosuggestions:[this.addressNotFound],searchingAddresses:!1}):(this.setState({autosuggestions:t,searchingAddresses:!1,showDuplicateError:!1}),this.autosuggestionsCallback(t))},500))}),W(this,"handleChange",e=>
216{if(e.target){let{value:t}=e.target;this.searchAddress(t)}}),W(this,"triggerReset",()=>{this.setState({inputValue:"",autosuggestions:[],searchingAddresses:!1,showDuplicateError:!1}),this.props.resetCallback&&this.props.resetCallback()}),W(this,"handleSearch",async e=>{if(!e||"-1"===e.id)return;this.setState(()=>({inputValue:e.address,searchingAddresses:!0}));let t=await this.props.getAddressData(e),s=((e,t)=>{try{if(void 0===t)return!1;return Object.values(e).some(e=>e.addressFinderId===t)}catch{return!1}})(this.props.addressDictionary,t.addressFinderId);(this.props.addressIntegrationV2||this.props.forceAddressFinder)&&!this.props.duplicateCheckDisabled&&s?this.setState({autosuggestions:[],searchingAddresses:!1,showDuplicateError:!0}):Array.isArray(t)?this.setState({autosuggestions:t,searchingAddresses:!1}):(this.setState({autosuggestions:[],searchingAddresses:!1}),this.submitCallback(t))}),W(this,"searchForFirstSuggestion",()=>{this.state.autosuggestions?.length&&this.handleSearch(this.state.autosuggestions[0])}),W(this,"handleKeyDown",e=>{(13===e.which||13===e.keyCode)&&this.searchForFirstSuggestion()}),W(this,"checkBrowserGeolocationPermission",()=>{navigator&&navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(e=>{"denied"!==e.state&&this.setState(()=>({browserGeoEnabled:!0})),e.onchange=()=>{"denied"!==e.state&&this.setState(()=>({browserGeoEnabled:!0}))}}):this.setState(()=>({browserGeoEnabled:!1}))}),W(this,"useMyLocationHandler",()=>{this.state.browserGeoEnabled&&navigator&&navigator.geolocation&&(this.setState(()=>({inputValue:this.context.t("modals.addressIntegration.usingMyLocation")})),this.props.useMyLocationCallback&&this.props.useMyLocationCallback())}),W(this,"GetInputPlaceHolder",()=>this.props.inputPlaceHolderText?this.props.inputPlaceHolderText:this.context.t("modals.addressIntegration.addressPlaceholder")),W(this,"render",()=>(0,F.Z)(()=>(0,a.jsxs)(p,{"data-testid":this.props["data-testid"],children:[(0,a.jsxs)(u,{children:[(0,a.jsx)(g,{handleFocus:this.props.handleFocus,handleChange:this.handleChange,handleKeyDown:this.handleKeyDown,placeholder:this.GetInputPlaceHolder(),label:this.context.t("modals.addressIntegration.inputLabel"),floatingLabel:!0,value:this.state.inputValue,id:"addressIntegrationInput",name:"addressIntegrationInput",role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-expanded":this.state.autosuggestions?.length?"true":"false","aria-controls":this.state.autosuggestions?.length?v:void 0,"aria-describedby":"addressIntegrationInputHint","data-testid":"AddressIntegrationInputField-TestId"}),(0,a.jsx)(m,{id:"addressIntegrationInputHint",children:this.context.t("modals.addressIntegration.inputLabelDescribed")}),!!this.state.inputValue&&(0,a.jsx)(y,{ariaLabel:this.context.t("common.button.resetSearch"),buttonStyle:"iconTransparent",icon:"Clear",handleClick:this.triggerReset,role:"button","data-testid":"AddressIntegrationResetButton-TestId"}),(0,a.jsx)(x,{icon:"Search",iconPosition:"left",ariaLabel:this.context.t("common.button.submitSearch"),buttonStyle:"search",handleClick:this.searchForFirstSuggestion,"data-testid":"AddressIntegrationSubmitButton-TestId"})]}),!!this.state.autosuggestions?.length&&(0,a.jsx)($,{autosuggestions:this.state.autosuggestions,handleClick:this.handleSearch,searchingAddresses:this.state.searchingAddresses,addressNotFound:this.addressNotFound}),this.props.useMyLocation&&(0,a.jsx)(_.Z,{handleClick:()=>this.useMyLocationHandler(),locationEnabled:this.state.browserGeoEnabled}),this.state.showDuplicateError&&(0,a.jsx)(C,{children:this.context.t("modals.addressIntegration.duplicateErrorMessage")})]}),{componentName:"AddressIntegrationInput"})),this.state={autosuggestions:[],browserGeoEnabled:!1,inputValue:this.props.initialValue??"",searchingAddresses:!1,showDuplicateError:!1},this.addressNotFound={address:t.t("modals.addressIntegration.addressNotFound"),id:"-1"}}}W(Z,"contextType",A.q);let k={getAutosuggestions:w.g,getAddressData:j.o},P=(0,S.$j)(e=>({addressIntegrationV2:e.settings.retailer.addressIntegrationV2,addressDictionary:e.customer.addressDictionary}),k)(Z)},86564:(e,t,s)=>{s.d(t,{Z:()=>y});var i=s(85893),a=s(67294),r=s(29163),d=s(1849),o=s(29039),n=s(55977),l=s(51667);let c=r.ZP.div.withConfig({displayName:"UseMyLocation",componentId:"-__sc-eb37664c-0"})(["z-index:",";margin-top:",";width:100%;",""],d.gR,n.W0.xs,(0,o.E0)()),h=r.ZP.button.withConfig({displayName:"UseMyLocationButton",componentId:"-__sc-eb37664c-1"})(({theme:e,locationEnabled:t})=>`
217      background-color: transparent;
218      border: none;
219      text-align: left;
220      padding: ${n.W0.xs} ${n.W0.sm} ${n.W0.xs} 0;
221      color:${t?e.colors.uiColors.greyscale5:e.colors.uiColors.greyscale3};
222      font-weight: ${e.typography.weights.normal};
223      font-size: ${e.typography.text.fontSM.fontSize};
224      cursor: ${t?"pointer":"default"};
225      display: flex;
226      width: 100%;
227      align-items: center;
228      &:hover {
229        color:${t?e.colors.uiColors.greyscale6:e.colors.uiColors.greyscale3};  
230        text-decoration: ${t?"underline":"none"};  
231      }
232    `),p=(0,r.ZP)(l.pA).withConfig({displayName:"UseMyLocationIcon",componentId:"-__sc-eb37664c-2"})(({theme:e,locationEnabled:t})=>`
233    margin-right: ${n.W0.xxs};
234    svg {
235      fill: ${t?e.colors.uiColors.greyscale5:e.colors.uiColors.greyscale3};
236    }
237  `),u=r.ZP.span.withConfig({displayName:"UseMyLocationDisabled",componentId:"-__sc-eb37664c-3"})(({theme:e})=>`
238      color:${e.colors.uiColors.greyscale4};
239      padding: 0  ${n.W0.sm};
240    `);var g=s(73342),m=s(15158);let y=e=>{let{t}=a.useContext(g.q),{handleClick:s,locationEnabled:r}=e;return(0,m.Z)(()=>(0,i.jsx)(c,{"data-testid":"UseMyLocationTestId",children:(0,i.jsxs)(h,{"data-testid":"UseMyLocationButtonTestId",locationEnabled:r,onClick:s,disabled:!r,type:"button",children:[(0,i.jsx)(p,{"data-testid":"UseMyLocationIconTestId",locationEnabled:r,name:"Geolocate"}),t("modals.geolocation.UseMyGeoLocation.searchButton"),!r&&(0,i.jsx)(u,{"data-testid":"UseMyLocationDisabledTestId",children:t("modals.geolocation.UseMyGeoLocation.searchDisabled")})]})}),{componentName:"UseMyLocation"})}},8110:(e,t,s)=>{s.d(t,{jX:()=>g,tA:()=>m,yk:()=>y});var i=s(8618),a=s(4894),r=s(71387),d=s(91247),o=s(44519);let n=e=>{try{if(!e)return null;return{address:e.fullAddress||"",id:e.addressFinderId||"",addressFinderId:e.addressFinderId||"",postCode:e.postCode||"",latitude:e&&e.coordinates&&e.coordinates.latitude||"",longitude:e&&e.coordinates&&e.coordinates.longitude||"",addressLine1:e.addressLine1||"",addressLine2:e.addressLine2||"",city:e.city||"",province:e.countyProvinceState||""}}catch(t){return i.logger.error("AddressIntegrationV2_Addresses_Details_Mapper()",t,e||""),null}};var l=s(57415),c=s(33526),h=s(92762),p=s.n(h);let u=(e,t,s)=>{let{status:a,data:r}=!!e&&!!e.response&&e.response;(400===a||404===a)&&i.logger.error(s,{data:r,status:a}),t((0,l.g9)())},g=(e,t=!1,s=a.sg,l=r.Z,c=(0,d.Z)())=>async(a,r)=>{let d=r();try{let r=await s.post("v1/addressfinder?limit=10",{searchTerm:e,...t&&{includeStreetLessResults:t}},{headers:l(d,c,{Accept:"application/json"})}),h=(e=>{try{let t=[];
240return e&&e.data&&e.data.forEach(e=>{if(e){let s=n(e);s&&t.push(s)}}),t}catch(t){return i.logger.error("AddressIntegrationV2_Addresses_Mapper()",t,e?e.data:""),[]}})(r);return a((0,o.lu)(h)),h}catch(t){i.logger.error("Get_AddressIntegrationV2_Addresses() ",t,{searchTerm:e}),u(t,a,"AddressIntegrationV2_Get_Addresses")}return[]},m=(e,t=a.sg)=>async(s,a)=>{let d=a(),o=p().get(c.RSL.reqId);try{let s=await t.post(`v1/addressfinder/${e}`,{headers:(0,r.Z)(d,o,{Accept:"application/json"})});if(s&&s.data)return n({...s.data,addressFinderId:e})}catch(t){i.logger.error("Get_AddressIntegrationV2_Addresses() ",t,{addressFinderId:e}),u(t,s,"AddressIntegrationV2_Get_Addresses_Details")}return[]},y=e=>async t=>{try{let s=await t(g(e));if(s.length>1)return s;return await t(m(s[0].addressFinderId))}catch(t){i.logger.error("AddressIntegrationV2_Get_MatchAddress() ",t,{searchTerm:e})}return{}}},84258:(e,t,s)=>{s.d(t,{Z:()=>c});var i=s(63791),a=s(30949),r=s(8618),d=s(38791),o=s(15009),n=s(54732),l=s(41421);let c=(e,t,s)=>{let c,h,p,u,g;return c=n.ZP,h=a.Z,p=l.R7,u=d.N,g=r.logger,async(a,r)=>{try{let d=r(),n=!!(0,o.Ui)(d);a(p()),n&&a(u("/fulfilment")),a((0,i.dl)(!0)),a((0,i.XV)(s)),await c({retailerStoreId:t,zipCode:e,addressId:s}),await a(h()),a((0,i.dl)(!1))}catch(r){g.httpCatch("SelectAddress()",r,{zipCode:e,retailerStoreId:t,addressId:s}),a((0,i.dl)(!1))}}}},30949:(e,t,s)=>{s.d(t,{Z:()=>l});var i=s(4894),a=s(8618),r=s(71387),d=s(90034),o=s(63791),n=s(91247);let l=()=>((e,t,s=(0,n.Z)())=>async(i,a)=>{try{let t=await e.get("v1/sessions",{headers:(0,r.Z)(a(),s)}),n=(0,d.Z)(t);i((0,o.Fo)(n))}catch(e){t.httpCatch("getSessions() ",e)}})(i.sg,a.logger)},88010:(e,t,s)=>{s.d(t,{g:()=>o});var i=s(4894),a=s(8618),r=s(44519),d=s(8110);let o=(e,t=!1,s=!1)=>async(o,n)=>{let l=n();try{if(l.settings.retailer.addressIntegrationV2||t)return await (0,d.jX)(e,s)(o,n);let a=await i.sg.post(`${l.settings.env.APP_URL}/addresses`,{address:e}),c=a&&a.data&&a.data.map(e=>({id:e.id,address:e.address,params:e.params}));return o((0,r.lu)(c)),c}catch(t){a.logger.error("getAddressLocation",t,{address:e})}}},71328:(e,t,s)=>{s.d(t,{o:()=>d});var i=s(4894),a=s(8618),r=s(8110);let d=e=>async(t,s)=>{let d=s();if(d.settings.retailer.addresses.integration.enabled)try{return(await i.sg.post(`${d.settings.env.APP_URL}/postal-look-up`,{address:e})).data}catch(t){a.logger.error("getAddressLocation",t,{id:e.id})}else if(d.settings.retailer.addressIntegrationV2)return await (0,r.tA)(e.id,i.sg)(t,s);return{}}},44519:(e,t,s)=>{s.d(t,{ME:()=>W,v6:()=>L,F6:()=>T,fp:()=>N,vn:()=>Z,VR:()=>C,Gu:()=>_,sq:()=>j,lu:()=>M,Xo:()=>E,LG:()=>V,Vn:()=>b,rQ:()=>A,Ne:()=>w});var i=s(33526),a=s(32865),r=s(48950),d=s(8618),o=s(35912),n=s(78394);s(92762);var l=s(50187),c=s(71387),h=s(63791),p=s(22157),u=s(4894),g=s(91247),m=s(57415),y=s(15009),x=s(31039),f=s(54732);let b=(e,t=u.sg)=>async s=>{I(s,e,t),await (0,n.Z)(s,_(t),1500)},I=async(e,t,s=u.sg)=>{let i={primaryAddressId:t};try{await s.put("customers/primaryaddress",i),e(P(t))}catch(s){e((0,a.e1)({data:i})),d.logger.error("setPrimaryAddress() ",s,{customerAddressId:t})}},C=e=>async t=>{try{await u.sg.delete(`customers/addresses/${e}`),t(v(e)),await (0,n.Z)(t,_(),1500)}catch(s){await t((0,a.e1)()),d.logger.error("deleteCustomerAddress() ",s,{customerAddressId:e})}},v=e=>({customerAddressId:e,type:i.$aW}),A=(e,t)=>async(s,i)=>{try{let a={...i().customer.addressDictionary[e],instructions:t};await u.sg.put(`customers/addresses/${e}`,a),s(T(a)),await (0,n.Z)(s,_(),1500)}catch(i){await s((0,a.e1)()),d.logger.error("updateAddressInstructions() ",i,{addressId:e,instructions:t})}},w=e=>async(t,s)=>{let i=(0,r.Z)(e,!0,s());return await t(S(i,!0))},S=(e,t=!1,s=!0,i=u.sg)=>async(a,r)=>await F(a,r,e,t,s,i),F=async(e,t,s,i=!1,r=!0,o=u.sg)=>{try{let d=t(),l=d.ui&&d.ui.globalModal&&d.ui.globalModal.props&&d.ui.globalModal.props.isBilling;if(!(0,p.n)(d))return;let c={retailerStoreId:d.stores.retailerStoreId};if(!(s&&s.addressLine1&&s.postCode&&s.countyProvinceState&&s.city))return e((0,a.e1)({address:s},"updateAddressError")),!1;return await o.put(`customers/addresses/${s.id}`,s),e(i?T(s):L(s)),await j(s,e,t,o),i||l||d.checkout.isCheckout||(await I(e,s.id,o),r&&(c.zipCode=s.postCode,(d.settings.retailer.addressIntegrationV2||d.settings.retailer.addresses.integration.enabled)&&(c.addressId=s.id),e((0,h.dl)(!0)),await (0,f.ZP)(c),await e((0,h.Rx)()),e((0,h.dl)(!1)))),await (0,n.Z)(e,_(o),1500),!0}catch(t){return e((0,a.e1)({address:s})),d.logger.error("_updateCustomerAddressAPI() ",t,{address:s,update:i,updateZipSession:r}),!1}},N=(e,t=!1,s=!0)=>async(i,a)=>{await $(i,a,e,t,s,u.sg)},$=async(e,t,s,i=!1,a=!0,d=u.sg)=>{let n=t();if(!(0,p.n)(n))return;let l=(0,r.Z)(s,!n.settings.retailer.addressIntegrationV2,t());await F(e,t,l,!1,a,d),i&&await e((0,o.t$)(l))},j=async(e,t,s,i=u.sg)=>{if(s().settings.retailer.addressIntegrationV2){let s=e.id,r=e.addressFinderId||"";await ((e,t,s=u.sg)=>async i=>{try{await s.put(`customers/addresses/${e}/attributes`,{attributes:{addressFinderId:t}})}catch(s){await i((0,a.e1)({addressId:e})),d.logger.error("_addCustomerAddressFinderAttributesAPI() ",s,{addressId:e,addressFinderId:t})}})(s,r,i)(t),await ((e,t=u.sg)=>async s=>{try{await t.put(`v1/addressfinder/addresses/${e.addressId}/AddressFinderIds/${e.addressFinderId}`,e)}catch(t){d.logger.error("Post_AddressIntegrationV2_Addresses() ",t,{data:e}),((e,t)=>{let{status:s,data:i}=!!e&&!!e.response&&e.response;(400===s||404===s)&&d.logger.error("AddressIntegrationV2_Put_Addresses",{data:i,status:s}),t((0,m.g9)())})(t,s)}})({addressId:s,addressFinderId:r},i)(t)}},_=(e=u.sg)=>async(t,s)=>{try{let i=await e.get("customers/addresses"),{allAddresses:a,addressDictionary:o}=((e,t)=>{let s={},i=[];try{i=e&&e.data&&e.data.items.map(e=>(s[e.id]=(0,r.Z)(e,!0,t),e.id)),s=(0,l._)(s)}catch(t){d.logger.catchErr("CustomerAddressesMapper() ",t,{data:e.data})}return{allAddresses:i,addressDictionary:s}})(i,s());t(B(a,o))}catch(i){let{status:e}=!!i&&!!i.response&&i.response;404===e?(0,y.pu)(s())&&t(B([],{})):t((0,a.e1)()),d.logger.error("getCustomerAddresses() ",i)}},W=()=>async(e,t)=>{let s=Object.values(t().customer.addressDictionary),i=[];
240s.forEach(t=>i.push(e(Z(t)))),await Promise.allSettled(i)},Z=(e,t=u.sg,s=c.Z,i=(0,g.Z)())=>async(a,r)=>{try{let d=r(),o=d.stores.retailerStoreId,n=d.shoppingModes.selectedShoppingMode,l=(0,x.O)(d,e.id);return await t.head(`v1/code/${e.postCode}/ShoppingModes/${n.shoppingModeId}/Stores/${o}`,{headers:s(d,i,l)}),a(k(e.id,!0)),!0}catch(s){let{status:t}=!!s&&!!s.response&&s.response;return 404!==t&&d.logger.error("checkAddressDeliveryStatus()",s,{postCode:e.postCode}),a(k(e.id,!1)),!1}},k=(e,t)=>({type:i.gA4,addressId:e,canDeliver:t}),P=e=>({type:i.eg4,customerAddressId:e}),B=(e,t)=>({allAddresses:e,addressDictionary:t,type:i.xq0}),L=e=>({address:e,type:i.vtf}),V=e=>({address:e,type:i.YZb}),M=e=>({addresses:e,type:i.oj8}),E=e=>({existingDeliveryAddressId:e,type:i.HXS}),T=e=>({type:i.Dxh,address:e})},48950:(e,t,s)=>{s.d(t,{Z:()=>d});var i=s(8618),a=s(50187),r=s(91247);let d=(e,t=!0,s)=>{let d={id:"",addressFinderId:"",firstName:"",familyName:"",addressLine1:"",addressLine2:"",city:"",countyProvinceState:"",postCode:"",country:"",phoneNumber:"",attributes:null},o=s&&s.settings&&s.settings.retailer&&s.settings.retailer.defaultCountry||"",n=s?.customer?.addressDictionary[e.id]?.canDeliver;try{d={id:e.id||(0,r.Z)(),addressFinderId:e.addressFinderId||"",firstName:e.firstName||"",familyName:e.familyName||"",addressLine1:e.addressLine1||"",addressLine2:e.addressLine2||"",city:e.city||"",countyProvinceState:e.countyProvinceState||"",postCode:e.postCode||"",country:e.country||o||"",phoneNumber:e.phoneNumber||""},e.addressLine3&&(d.addressLine3=e.addressLine3),e.businessName&&(d.businessName=e.businessName),e.latitude&&t&&(d.latitude=e.latitude),e.longitude&&t&&(d.longitude=e.longitude),e.instructions&&(d.instructions=e.instructions),(e.canDeliver||n)&&(d.canDeliver=e.canDeliver??n),e.attributes&&(d.addressFinderId=e.attributes.addressFinderId),d=(0,a._)(d)}catch(t){i.logger.catchErr("CustomerAddressMapper() ",t,e)}return d}}}]);

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.