@dropins/storefront-company-management 1.0.0-beta3 → 1.0.0-beta4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as a,jsxs as g,Fragment as J}from"@dropins/tools/preact-jsx-runtime.js";import{classes as ee,Slot as fe}from"@dropins/tools/lib.js";import{Card as G,Button as X,Field as $,Input as P,Picker as ue,Header as pe,InLineAlert as ye,ProgressSpinner as ve,Skeleton as Ae,SkeletonRow as K}from"@dropins/tools/components.js";import{useState as I,useEffect as Z,useMemo as U,useRef as Q,useCallback as F}from"@dropins/tools/preact-hooks.js";import{g as ge,v as Ce,a as Ne,u as _e}from"../chunks/getCountries.js";import{useText as W}from"@dropins/tools/i18n.js";import*as V from"@dropins/tools/preact-compat.js";import"@dropins/tools/event-bus.js";import"@dropins/tools/fetch-graphql.js";const be=({company:t,slots:e,showEditForm:l,handleShowEditForm:u})=>{const o=W({editButton:"Company.shared.buttons.edit",noDataMessage:"Company.CompanyProfile.companyProfileCard.noDataMessage",companyName:"Company.shared.fields.companyName",email:"Company.shared.fields.email",legalName:"Company.shared.fields.legalName",vatTaxId:"Company.shared.fields.vatTaxId",resellerId:"Company.shared.fields.resellerId",legalAddress:"Company.shared.fields.legalAddress",contacts:"Company.CompanyProfile.companyProfileCard.contacts",companyAdministrator:"Company.CompanyProfile.companyProfileCard.companyAdministrator",salesRepresentative:"Company.CompanyProfile.companyProfileCard.salesRepresentative",paymentInformation:"Company.CompanyProfile.companyProfileCard.paymentInformation",shippingInformation:"Company.CompanyProfile.companyProfileCard.shippingInformation",availablePaymentMethods:"Company.CompanyProfile.companyProfileCard.availablePaymentMethods",availableShippingMethods:"Company.CompanyProfile.companyProfileCard.availableShippingMethods",noPaymentMethods:"Company.CompanyProfile.companyProfileCard.noPaymentMethods",noShippingMethods:"Company.CompanyProfile.companyProfileCard.noShippingMethods"});if(!t)return a(G,{variant:"secondary",className:"account-company-profile-card",children:a("div",{className:"account-company-profile-card__wrapper",children:a("div",{className:"account-company-profile-card__content",children:a("div",{className:"account-company-profile-card__no-data",children:a("p",{children:o.noDataMessage})})})})});const n=t.permissionsFlags||{canViewAccount:!0,canViewAddress:!0,canViewContacts:!0,canViewPaymentInformation:!0,canViewShippingInformation:!0},r=[n.canViewAccount?{name:"name",label:o.companyName,value:t.name||""}:null,n.canViewAccount?{name:"email",label:o.email,value:t.email||""}:null,n.canViewAccount?{name:"legalName",label:o.legalName,value:t.legalName||""}:null,n.canViewAccount?{name:"vatTaxId",label:o.vatTaxId,value:t.vatTaxId||""}:null,n.canViewAccount?{name:"resellerId",label:o.resellerId,value:t.resellerId||""}:null].filter(Boolean);return a(G,{variant:"secondary",className:ee(["account-company-profile-card",["account-company-profile-card-short",l]]),children:g("div",{className:"account-company-profile-card__wrapper",children:[a("div",{className:"account-company-profile-card__actions",children:(t.canEditAccount||t.canEditAddress)&&a(X,{type:"button",variant:"tertiary",onClick:u,children:o.editButton})}),a("div",{className:"account-company-profile-card__content",children:(()=>{var f,s;const A=g(J,{children:[r.map((i,p)=>{if(!i.value)return null;const v=i.label?`${i.label}: ${i.value}`:i.value;return a("p",{"data-testid":`${i.name}_${p}`,children:v},`${i.name}_${p}`)}),n.canViewAddress&&t.legalAddress&&g("div",{className:"company-legal-address",children:[a("p",{children:g("strong",{children:[o.legalAddress,":"]})}),(f=t.legalAddress.street)==null?void 0:f.map((i,p)=>a("p",{children:i},p)),g("p",{children:[t.legalAddress.city,", ",(s=t.legalAddress.region)==null?void 0:s.region," ",t.legalAddress.postcode]}),a("p",{children:t.legalAddress.countryCode}),t.legalAddress.telephone&&g("p",{children:["Phone: ",t.legalAddress.telephone]})]}),n.canViewContacts&&(t.companyAdmin||t.salesRepresentative)&&g("div",{className:"company-contacts",children:[a("p",{children:g("strong",{children:[o.contacts,":"]})}),t.companyAdmin&&g("div",{className:"company-contact",children:[a("p",{children:g("strong",{children:[o.companyAdministrator,":"]})}),g("p",{children:[t.companyAdmin.firstname," ",t.companyAdmin.lastname]}),t.companyAdmin.jobTitle&&a("p",{children:t.companyAdmin.jobTitle}),a("p",{children:t.companyAdmin.email})]}),t.salesRepresentative&&g("div",{className:"company-contact",children:[a("p",{children:g("strong",{children:[o.salesRepresentative,":"]})}),g("p",{children:[t.salesRepresentative.firstname," ",t.salesRepresentative.lastname]}),a("p",{children:t.salesRepresentative.email})]})]}),n.canViewPaymentInformation&&g("div",{className:"company-payment-methods",children:[a("p",{children:g("strong",{children:[o.paymentInformation,":"]})}),t.availablePaymentMethods&&t.availablePaymentMethods.length>0?g(J,{children:[a("p",{children:g("strong",{children:[o.availablePaymentMethods,":"]})}),a("ul",{className:"payment-methods-list",children:t.availablePaymentMethods.map((i,p)=>a("li",{children:i.title},`payment_${p}`))})]}):a("div",{className:"message message-notice notice",children:a("div",{children:o.noPaymentMethods})})]}),n.canViewShippingInformation&&g("div",{className:"company-shipping-methods",children:[a("p",{children:g("strong",{children:[o.shippingInformation,":"]})}),t.availableShippingMethods&&t.availableShippingMethods.length>0?g(J,{children:[a("p",{children:g("strong",{children:[o.availableShippingMethods,":"]})}),a("ul",{className:"shipping-methods-list",children:t.availableShippingMethods.map((i,p)=>a("li",{children:i.title},`shipping_${p}`))})]}):a("div",{className:"message message-notice notice",children:a("div",{children:o.noShippingMethods})})]})]});return e!=null&&e.CompanyData?a(fe,{name:"CompanyData",slot:e.CompanyData,context:{companyData:r,Default:A}}):A})()})]})})},Ee=t=>{const[e,l]=I(null),[u,o]=I(!0);Z(()=>{let s=!0;return ge().then(({availableCountries:i,countriesWithRequiredRegion:p,optionalZipCountries:v})=>{s&&(l({availableCountries:i,countriesWithRequiredRegion:p,optionalZipCountries:v}),o(!1))}).catch(()=>{s&&o(!1)}),()=>{s=!1}},[]);const n=U(()=>(e==null?void 0:e.availableCountries)||[],[e]),r=U(()=>{if(!t||!e)return[];const s=e.availableCountries.find(i=>i.value===t);return!(s!=null&&s.availableRegions)||s.availableRegions.length===0?[]:s.availableRegions.map(i=>({text:i.name,value:`${i.code},${i.id}`}))},[t,e]),A=U(()=>!t||!e?!1:e.countriesWithRequiredRegion.includes(t),[t,e]),f=U(()=>r.length>0,[r]);return{countryOptions:n,regionOptions:r,isRegionRequired:A,hasRegionOptions:f,loadingCountries:u}},we=({loading:t,value:e,errors:l,touched:u,onChange:o,onBlur:n,namePrefix:r="",fieldPathPrefix:A=""})=>{const f=W({companyName:"Company.shared.fields.companyName",email:"Company.shared.fields.email",legalName:"Company.shared.fields.legalName",vatTaxId:"Company.shared.fields.vatTaxId",resellerId:"Company.shared.fields.resellerId"}),s=r?`${r}_`:"",i=p=>A?`${A}.${p}`:p;return g("div",{className:"account-edit-company-profile-form__group",children:[a($,{label:f.companyName,required:!0,className:"account-edit-company-profile-form__field",error:u.name&&l.name?l.name:void 0,children:a(P,{name:`${s}name`,type:"text",value:e.name,onValue:o(i("name")),onBlur:()=>n(i("name")),disabled:!!t,variant:"primary",size:"medium"})}),a($,{label:f.email,required:!0,className:"account-edit-company-profile-form__field",error:u.email&&l.email?l.email:void 0,children:a(P,{name:`${s}email`,type:"email",value:e.email,onValue:o(i("email")),onBlur:()=>n(i("email")),disabled:!!t,variant:"primary",size:"medium"})}),a($,{label:f.legalName,className:"account-edit-company-profile-form__field",children:a(P,{name:`${s}legalName`,type:"text",value:e.legalName,onValue:o(i("legalName")),disabled:!!t,variant:"primary",size:"medium"})}),a($,{label:f.vatTaxId,className:"account-edit-company-profile-form__field",children:a(P,{name:`${s}vatTaxId`,type:"text",value:e.vatTaxId,onValue:o(i("vatTaxId")),disabled:!!t,variant:"primary",size:"medium"})}),a($,{label:f.resellerId,className:"account-edit-company-profile-form__field",children:a(P,{name:`${s}resellerId`,type:"text",value:e.resellerId,onValue:o(i("resellerId")),disabled:!!t,variant:"primary",size:"medium"})})]})},Ie=({loading:t,loadingCountries:e,value:l,errors:u,touched:o,onChange:n,onBlur:r,countryOptions:A,regionOptions:f,isRegionRequired:s,hasRegionOptions:i,namePrefix:p="legalAddress",fieldPathPrefix:v="legalAddress",requiredConfig:C})=>{var B;const w=W({legalAddress:"Company.shared.fields.legalAddress",streetAddress:"Company.shared.fields.streetAddress",city:"Company.shared.fields.city",country:"Company.shared.fields.country",stateProvince:"Company.shared.fields.stateProvince",zipPostalCode:"Company.shared.fields.zipPostalCode",phoneNumber:"Company.shared.fields.phoneNumber"}),M={street:`${p}_street`,street2:`${p}_street2`,city:`${p}_city`,countryCode:`${p}_countryCode`,region:`${p}_region`,postcode:`${p}_postcode`,telephone:`${p}_telephone`},m={street:`${v}.street`,street2:`${v}.street2`,city:`${v}.city`,countryCode:`${v}.countryCode`,region:`${v}.region`,regionCode:`${v}.regionCode`,postcode:`${v}.postcode`,telephone:`${v}.telephone`},x={street:(C==null?void 0:C.street)??!0,city:(C==null?void 0:C.city)??!0,postcode:(C==null?void 0:C.postcode)??!0,telephone:(C==null?void 0:C.telephone)??!0};return g("div",{className:"account-edit-company-profile-form__section",children:[a("h3",{className:"account-edit-company-profile-form__section-title",children:w.legalAddress}),a($,{label:w.streetAddress,required:x.street,className:"account-edit-company-profile-form__field",error:o[m.street]&&u[m.street]?u[m.street]:void 0,children:a(P,{name:M.street,type:"text",value:l.street,onValue:n(m.street),onBlur:()=>r(m.street),disabled:!!t,variant:"primary",size:"medium"})}),a($,{label:`${w.streetAddress} 2`,className:"account-edit-company-profile-form__field",children:a(P,{name:M.street2,type:"text",value:l.street2,onValue:n(m.street2),disabled:!!t,variant:"primary",size:"medium"})}),a($,{label:w.city,required:x.city,className:"account-edit-company-profile-form__field",error:o[m.city]&&u[m.city]?u[m.city]:void 0,children:a(P,{name:M.city,type:"text",value:l.city,onValue:n(m.city),onBlur:()=>r(m.city),disabled:!!t,variant:"primary",size:"medium"})}),a($,{label:w.country,required:!0,className:"account-edit-company-profile-form__field",error:o[m.countryCode]&&u[m.countryCode]?u[m.countryCode]:void 0,children:a(ue,{name:M.countryCode,floatingLabel:`${w.country} *`,placeholder:w.country,options:A,value:l.countryCode,handleSelect:b=>{const R=b.target;n(m.countryCode)(R.value)},onBlur:()=>r(m.countryCode),disabled:!!t||e})}),a($,{label:w.stateProvince,required:s,className:"account-edit-company-profile-form__field",error:o["legalAddress.region"]&&u["legalAddress.region"]?u["legalAddress.region"]:void 0,children:i?a(ue,{name:"legalAddress_region",floatingLabel:`${w.stateProvince} ${s?"*":""}`,placeholder:w.stateProvince,options:f,value:l.regionCode&&((B=f.find(b=>b.value.split(",")[0]===l.regionCode))==null?void 0:B.value)||"",handleSelect:b=>{var H;const R=b.target,[D]=R.value.split(","),z=((H=f.find(T=>T.value===R.value))==null?void 0:H.text)||"";n(m.region)(z),n(m.regionCode)(D)},onBlur:()=>r(m.region),disabled:!!t||e},`region_picker_${l.countryCode}`):a(P,{name:M.region,type:"text",value:l.region,onValue:n(m.region),onBlur:()=>r(m.region),disabled:!!t||e,variant:"primary",size:"medium"},`region_input_${l.countryCode}`)}),a($,{label:w.zipPostalCode,required:x.postcode,className:"account-edit-company-profile-form__field",error:o[m.postcode]&&u[m.postcode]?u[m.postcode]:void 0,children:a(P,{name:M.postcode,type:"text",value:l.postcode,onValue:n(m.postcode),onBlur:()=>r(m.postcode),disabled:!!t,variant:"primary",size:"medium"})}),a($,{label:w.phoneNumber,required:x.telephone,className:"account-edit-company-profile-form__field",error:o[m.telephone]&&u[m.telephone]?u[m.telephone]:void 0,children:a(P,{name:M.telephone,type:"tel",value:l.telephone,onValue:n(m.telephone),onBlur:()=>r(m.telephone),disabled:!!t,variant:"primary",size:"medium"})})]})},Ve=({inLineAlertProps:t,company:e,loading:l=!1,onSubmit:u,onCancel:o})=>{var T,O,j,Y,q,y,S,te,ae,re,se,le,ne,ie;const n=W({title:"Company.EditCompanyProfile.title",cancel:"Company.shared.buttons.cancel",save:"Company.shared.buttons.save",saving:"Company.shared.buttons.saving",required:"Company.shared.validation.required",invalidEmail:"Company.shared.validation.invalidEmail",companyNameRequired:"Company.shared.validation.companyNameRequired",emailRequired:"Company.shared.validation.emailRequired",emailNotAvailable:"Company.shared.validation.emailNotAvailable"}),[r,A]=I({name:(e==null?void 0:e.name)||"",email:(e==null?void 0:e.email)||"",legalName:(e==null?void 0:e.legalName)||"",vatTaxId:(e==null?void 0:e.vatTaxId)||"",resellerId:(e==null?void 0:e.resellerId)||"",legalAddress:{street:((O=(T=e==null?void 0:e.legalAddress)==null?void 0:T.street)==null?void 0:O[0])||"",street2:((Y=(j=e==null?void 0:e.legalAddress)==null?void 0:j.street)==null?void 0:Y[1])||"",city:((q=e==null?void 0:e.legalAddress)==null?void 0:q.city)||"",region:((S=(y=e==null?void 0:e.legalAddress)==null?void 0:y.region)==null?void 0:S.region)||"",regionCode:((ae=(te=e==null?void 0:e.legalAddress)==null?void 0:te.region)==null?void 0:ae.regionCode)||"",countryCode:((re=e==null?void 0:e.legalAddress)==null?void 0:re.countryCode)||"",postcode:((se=e==null?void 0:e.legalAddress)==null?void 0:se.postcode)||"",telephone:((le=e==null?void 0:e.legalAddress)==null?void 0:le.telephone)||""}}),[f,s]=I({}),[i,p]=I({}),v=((ne=e==null?void 0:e.permissionsFlags)==null?void 0:ne.canEditAccount)===!0,C=((ie=e==null?void 0:e.permissionsFlags)==null?void 0:ie.canEditAddress)===!0,{countryOptions:w,regionOptions:M,isRegionRequired:m,hasRegionOptions:x,loadingCountries:B}=Ee(r.legalAddress.countryCode),b=(c,h)=>c==="name"?h.trim()?null:n.companyNameRequired:c==="email"?h.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(h)?null:n.invalidEmail:n.emailRequired:c==="legalAddress.street"||c==="legalAddress.city"||c==="legalAddress.postcode"||c==="legalAddress.telephone"||c==="legalAddress.countryCode"?h.trim()?null:n.required:c==="legalAddress.region"&&m&&!h.trim()?n.required:null,R=()=>{var k,E;const c={};let h=!0;const L=((k=e==null?void 0:e.permissionsFlags)==null?void 0:k.canEditAccount)===!0,N=((E=e==null?void 0:e.permissionsFlags)==null?void 0:E.canEditAddress)===!0;if(L){const d=b("name",r.name);d&&(c.name=d,h=!1);const _=b("email",r.email);_&&(c.email=_,h=!1)}if(N){const d=b("legalAddress.street",r.legalAddress.street);d&&(c["legalAddress.street"]=d,h=!1);const _=b("legalAddress.city",r.legalAddress.city);_&&(c["legalAddress.city"]=_,h=!1);const oe=b("legalAddress.postcode",r.legalAddress.postcode);oe&&(c["legalAddress.postcode"]=oe,h=!1);const de=b("legalAddress.telephone",r.legalAddress.telephone);de&&(c["legalAddress.telephone"]=de,h=!1);const ce=b("legalAddress.countryCode",r.legalAddress.countryCode);ce&&(c["legalAddress.countryCode"]=ce,h=!1);const me=b("legalAddress.region",r.legalAddress.region);me&&(c["legalAddress.region"]=me,h=!1)}return s(c),h},D=async c=>{var k,E;c.preventDefault();const h=((k=e==null?void 0:e.permissionsFlags)==null?void 0:k.canEditAccount)===!0,L=((E=e==null?void 0:e.permissionsFlags)==null?void 0:E.canEditAddress)===!0,N={};if(h&&(N.name=!0,N.email=!0,N.legalName=!0,N.vatTaxId=!0,N.resellerId=!0),L&&(N["legalAddress.street"]=!0,N["legalAddress.street2"]=!0,N["legalAddress.city"]=!0,N["legalAddress.region"]=!0,N["legalAddress.regionCode"]=!0,N["legalAddress.countryCode"]=!0,N["legalAddress.postcode"]=!0,N["legalAddress.telephone"]=!0),p(N),!!R()){if(h&&r.email!==(e==null?void 0:e.email)){const d=await Ce(r.email);if(!d.isValid){s(_=>({..._,email:d.error||n.emailNotAvailable}));return}}if(u){const d={};h&&(d.name=r.name,d.email=r.email,d.legalName=r.legalName,d.vatTaxId=r.vatTaxId,d.resellerId=r.resellerId),L&&(d.legalAddress={street:[r.legalAddress.street,r.legalAddress.street2].filter(Boolean),city:r.legalAddress.city,region:{region:r.legalAddress.region,regionCode:r.legalAddress.regionCode},countryCode:r.legalAddress.countryCode,postcode:r.legalAddress.postcode,telephone:r.legalAddress.telephone}),await u(d)}}},z=c=>h=>{const L=new Set(["name","email","legalName","vatTaxId","resellerId"]),N=c.startsWith("legalAddress.");if(!(L.has(c)&&!v||N&&!C)){if(c.startsWith("legalAddress.")){const E=c.split(".")[1];E==="countryCode"?(A(d=>({...d,legalAddress:{...d.legalAddress,[E]:h,region:"",regionCode:""}})),s(d=>{const _={...d};return delete _["legalAddress.region"],delete _["legalAddress.regionCode"],_}),p(d=>{const _={...d};return delete _["legalAddress.region"],delete _["legalAddress.regionCode"],_})):A(E==="region"?d=>({...d,legalAddress:{...d.legalAddress,region:h,regionCode:x?d.legalAddress.regionCode:h}}):d=>({...d,legalAddress:{...d.legalAddress,[E]:h}}))}else A(E=>({...E,[c]:h}));f[c]&&s(E=>{const d={...E};return delete d[c],d})}},H=c=>{const h=new Set(["name","email","legalName","vatTaxId","resellerId"]),L=c.startsWith("legalAddress.");if(h.has(c)&&!v||L&&!C)return;p(d=>({...d,[c]:!0}));let k="";if(c.startsWith("legalAddress.")){const d=c.split(".")[1],_=r.legalAddress[d];k=typeof _=="string"?_:""}else{const d=r[c];k=typeof d=="string"?d:""}const E=b(c,k);E&&s(d=>({...d,[c]:E}))};return g(G,{variant:"secondary",className:"account-edit-company-profile",children:[a(pe,{title:n.title,divider:!1,className:"account-edit-company-profile__title"}),t!=null&&t.text?a(ye,{className:"account-edit-company-profile__notification",type:t.type,variant:"secondary",heading:t.text,icon:t.icon,"data-testid":"editCompanyInLineAlert"}):null,g("form",{className:"account-edit-company-profile-form",onSubmit:D,children:[v&&a(we,{loading:l,value:{name:r.name,email:r.email,legalName:r.legalName,vatTaxId:r.vatTaxId,resellerId:r.resellerId},errors:f,touched:i,onChange:z,onBlur:H}),C&&a(Ie,{loading:l,loadingCountries:B,value:r.legalAddress,errors:f,touched:i,onChange:z,onBlur:H,countryOptions:w,regionOptions:M,isRegionRequired:m,hasRegionOptions:x}),g("div",{className:"account-edit-company-profile__actions",children:[a(X,{disabled:l,type:"button",variant:"secondary",onClick:()=>o==null?void 0:o(),children:n.cancel}),a(X,{disabled:l||!v&&!C,type:"submit",variant:"primary",children:n.save})]})]}),l&&g("div",{className:"account-edit-company-profile__loading-overlay","data-testid":"editCompanyLoadingOverlay",children:[a(ve,{size:"large"}),a("div",{className:"account-edit-company-profile__loading-text",children:n.saving})]})]})},xe=({testId:t,withCard:e=!0})=>{const l=g(Ae,{"data-testid":t||"companySkeletonLoader",children:[a(K,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),a(K,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),a(K,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return e?l:a(G,{variant:"secondary",className:ee(["company-company-loaders","company-company-loaders--card-loader"]),children:l})};var he=(t=>(t.EDIT_COMPANY_EVENT="edit-company",t))(he||{});const Te={EDIT_COMPANY_EVENT:"edit-company"},$e=()=>(window.adobeDataLayer||(window.adobeDataLayer=[]),window.adobeDataLayer),Me=t=>{$e().push(l=>{const u=l.getState?l.getState():{};l.push({event:t,context:u})})},Pe=(t,e)=>{if(!Te[t])return null;switch(t){case"edit-company":Me({type:"company",eventType:"edit",companyData:e});break;default:return null}},Fe=({handleSetInLineAlert:t})=>{const e=W({companySuccess:"Company.CompanyProfile.editCompanyProfile.companySuccess",companyError:"Company.CompanyProfile.editCompanyProfile.companyError",loadError:"Company.CompanyProfile.messages.loadError",updateError:"Company.CompanyProfile.messages.updateError"}),{companySuccess:l,companyError:u,loadError:o,updateError:n}=e,[r,A]=I(null),[f,s]=I(!0),[i,p]=I(!1),[v,C]=I(!1),[w,M]=I([]),[m,x]=I({}),[B,b]=I(""),R=Q(t),D=Q(!1),z=Q(!1);Z(()=>{R.current=t},[t]);const H=F(y=>{x(y)},[]),T=F((y,S)=>{t&&(y==="success"?t({type:"success",text:S??l}):y==="error"?t({type:"error",text:S??u}):t(),p(!1))},[t,l,u]),O=F(()=>{D.current||(D.current=!0,s(!0),Ne().then(y=>{y&&(A(y),b("")),s(!1)}).catch(y=>{console.error("Failed to load company:",y),s(!1),R.current&&R.current({type:"error",text:o})}).finally(()=>{D.current=!1}))},[o]);Z(()=>{z.current||(z.current=!0,O())},[O]),Z(()=>{ge().then(y=>{M(y.availableCountries)}).catch(y=>{console.error("Failed to load countries:",y)})},[]);const j=F(()=>{C(!0),T("success",""),x({})},[T]),Y=F(y=>{y==null||y(),C(!1),x({})},[]),q=F(async y=>{try{if(p(!0),!y){T("error","No data to update");return}const S=await _e(y);A(S),C(!1),x({}),T("success"),Pe(he.EDIT_COMPANY_EVENT,{...y,companyId:r==null?void 0:r.id})}catch(S){console.error("Failed to update company:",S),T("error",S.message||n)}finally{p(!1)}},[r,T,n]);return{company:r,countries:w,createdAt:B,loading:f,submitLoading:i,showEditForm:v,inputChange:m,handleShowEditForm:j,handleHideEditForm:Y,handleUpdateCompany:q,handleInputChange:H,renderAlertMessage:T,saving:i}},Re=t=>V.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},V.createElement("g",{clipPath:"url(#clip0_841_1324)"},V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),V.createElement("defs",null,V.createElement("clipPath",{id:"clip0_841_1324"},V.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),Se=t=>V.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),ke=t=>V.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),Le={success:a(Se,{}),warning:a(Re,{}),error:a(ke,{})},De=()=>{const[t,e]=I({}),[l,u]=I(null),o=F(()=>{e({}),l&&(clearTimeout(l),u(null))},[l]),n=F(s=>{if(l&&(clearTimeout(l),u(null)),!(s!=null&&s.type)){e({});return}const i=Le[s.type];if(e({type:s.type,text:s.text,icon:i}),s.autoHide!==!1){const p=s.autoHideDelay||(s.type==="success"?3e3:5e3),v=setTimeout(()=>{e({}),u(null)},p);u(v)}},[l]),r=F((s,i=!0)=>{n({type:"success",text:s,autoHide:i})},[n]),A=F((s,i=!1)=>{n({type:"warning",text:s,autoHide:i})},[n]),f=F((s,i=!1)=>{n({type:"error",text:s,autoHide:i})},[n]);return Z(()=>()=>{l&&clearTimeout(l)},[l]),{inLineAlertProps:t,handleSetInLineAlert:n,clearAlert:o,showSuccess:r,showWarning:A,showError:f}},qe=({className:t,withHeader:e=!0,slots:l})=>{const u=W({containerTitle:"Company.CompanyProfile.containerTitle"}),{inLineAlertProps:o,handleSetInLineAlert:n}=De(),{company:r,loading:A,saving:f,showEditForm:s,handleShowEditForm:i,handleHideEditForm:p,handleUpdateCompany:v}=Fe({handleSetInLineAlert:n});return A?a("div",{"data-testid":"companyProfileLoader",children:a(xe,{withCard:!0})}):g("div",{className:ee(["account-company-profile",t]),children:[e?a(pe,{title:u.containerTitle,divider:!1,className:"company-profile__title"}):null,a(be,{company:r,slots:l,showEditForm:s,handleShowEditForm:i}),s?a(Ve,{inLineAlertProps:o,company:r,loading:f,onSubmit:v,onCancel:p}):null]})};export{qe as CompanyProfile,qe as default};
3
+ import{jsx as a,jsxs as g,Fragment as U}from"@dropins/tools/preact-jsx-runtime.js";import{classes as Q,Slot as ye}from"@dropins/tools/lib.js";import{Card as q,Button as K,Field as M,Input as F,Picker as ue,Header as ge,InLineAlert as ve,ProgressSpinner as Ae,Skeleton as Ce,SkeletonRow as G}from"@dropins/tools/components.js";import{useState as T,useEffect as B,useMemo as Y,useRef as J,useCallback as R}from"@dropins/tools/preact-hooks.js";import{events as pe}from"@dropins/tools/event-bus.js";import{g as he,v as Ne,a as _e,u as Ee}from"../chunks/getCountries.js";import{useText as W}from"@dropins/tools/i18n.js";import*as V from"@dropins/tools/preact-compat.js";import"@dropins/tools/fetch-graphql.js";const be=({company:t,slots:e,showEditForm:l,handleShowEditForm:u})=>{const o=W({editButton:"Company.shared.buttons.edit",noDataMessage:"Company.CompanyProfile.companyProfileCard.noDataMessage",companyName:"Company.shared.fields.companyName",email:"Company.shared.fields.email",legalName:"Company.shared.fields.legalName",vatTaxId:"Company.shared.fields.vatTaxId",resellerId:"Company.shared.fields.resellerId",legalAddress:"Company.shared.fields.legalAddress",contacts:"Company.CompanyProfile.companyProfileCard.contacts",companyAdministrator:"Company.CompanyProfile.companyProfileCard.companyAdministrator",salesRepresentative:"Company.CompanyProfile.companyProfileCard.salesRepresentative",paymentInformation:"Company.CompanyProfile.companyProfileCard.paymentInformation",shippingInformation:"Company.CompanyProfile.companyProfileCard.shippingInformation",availablePaymentMethods:"Company.CompanyProfile.companyProfileCard.availablePaymentMethods",availableShippingMethods:"Company.CompanyProfile.companyProfileCard.availableShippingMethods",noPaymentMethods:"Company.CompanyProfile.companyProfileCard.noPaymentMethods",noShippingMethods:"Company.CompanyProfile.companyProfileCard.noShippingMethods"});if(!t)return a(q,{variant:"secondary",className:"account-company-profile-card",children:a("div",{className:"account-company-profile-card__wrapper",children:a("div",{className:"account-company-profile-card__content",children:a("div",{className:"account-company-profile-card__no-data",children:a("p",{children:o.noDataMessage})})})})});const n=t.permissionsFlags||{canViewAccount:!0,canViewAddress:!0,canViewContacts:!0,canViewPaymentInformation:!0,canViewShippingInformation:!0},r=[n.canViewAccount?{name:"name",label:o.companyName,value:t.name||""}:null,n.canViewAccount?{name:"email",label:o.email,value:t.email||""}:null,n.canViewAccount?{name:"legalName",label:o.legalName,value:t.legalName||""}:null,n.canViewAccount?{name:"vatTaxId",label:o.vatTaxId,value:t.vatTaxId||""}:null,n.canViewAccount?{name:"resellerId",label:o.resellerId,value:t.resellerId||""}:null].filter(Boolean);return a(q,{variant:"secondary",className:Q(["account-company-profile-card",["account-company-profile-card-short",l]]),children:g("div",{className:"account-company-profile-card__wrapper",children:[a("div",{className:"account-company-profile-card__actions",children:(t.canEditAccount||t.canEditAddress)&&a(K,{type:"button",variant:"tertiary",onClick:u,children:o.editButton})}),a("div",{className:"account-company-profile-card__content",children:(()=>{var y,s;const C=g(U,{children:[r.map((i,p)=>{if(!i.value)return null;const v=i.label?`${i.label}: ${i.value}`:i.value;return a("p",{"data-testid":`${i.name}_${p}`,children:v},`${i.name}_${p}`)}),n.canViewAddress&&t.legalAddress&&g("div",{className:"company-legal-address",children:[a("p",{children:g("strong",{children:[o.legalAddress,":"]})}),(y=t.legalAddress.street)==null?void 0:y.map((i,p)=>a("p",{children:i},p)),g("p",{children:[t.legalAddress.city,", ",(s=t.legalAddress.region)==null?void 0:s.region," ",t.legalAddress.postcode]}),a("p",{children:t.legalAddress.countryCode}),t.legalAddress.telephone&&g("p",{children:["Phone: ",t.legalAddress.telephone]})]}),n.canViewContacts&&(t.companyAdmin||t.salesRepresentative)&&g("div",{className:"company-contacts",children:[a("p",{children:g("strong",{children:[o.contacts,":"]})}),t.companyAdmin&&g("div",{className:"company-contact",children:[a("p",{children:g("strong",{children:[o.companyAdministrator,":"]})}),g("p",{children:[t.companyAdmin.firstname," ",t.companyAdmin.lastname]}),t.companyAdmin.jobTitle&&a("p",{children:t.companyAdmin.jobTitle}),a("p",{children:t.companyAdmin.email})]}),t.salesRepresentative&&g("div",{className:"company-contact",children:[a("p",{children:g("strong",{children:[o.salesRepresentative,":"]})}),g("p",{children:[t.salesRepresentative.firstname," ",t.salesRepresentative.lastname]}),a("p",{children:t.salesRepresentative.email})]})]}),n.canViewPaymentInformation&&g("div",{className:"company-payment-methods",children:[a("p",{children:g("strong",{children:[o.paymentInformation,":"]})}),t.availablePaymentMethods&&t.availablePaymentMethods.length>0?g(U,{children:[a("p",{children:g("strong",{children:[o.availablePaymentMethods,":"]})}),a("ul",{className:"payment-methods-list",children:t.availablePaymentMethods.map((i,p)=>a("li",{children:i.title},`payment_${p}`))})]}):a("div",{className:"message message-notice notice",children:a("div",{children:o.noPaymentMethods})})]}),n.canViewShippingInformation&&g("div",{className:"company-shipping-methods",children:[a("p",{children:g("strong",{children:[o.shippingInformation,":"]})}),t.availableShippingMethods&&t.availableShippingMethods.length>0?g(U,{children:[a("p",{children:g("strong",{children:[o.availableShippingMethods,":"]})}),a("ul",{className:"shipping-methods-list",children:t.availableShippingMethods.map((i,p)=>a("li",{children:i.title},`shipping_${p}`))})]}):a("div",{className:"message message-notice notice",children:a("div",{children:o.noShippingMethods})})]})]});return e!=null&&e.CompanyData?a(ye,{name:"CompanyData",slot:e.CompanyData,context:{companyData:r,Default:C}}):C})()})]})})},we=t=>{const[e,l]=T(null),[u,o]=T(!0);B(()=>{let s=!0;return he().then(({availableCountries:i,countriesWithRequiredRegion:p,optionalZipCountries:v})=>{s&&(l({availableCountries:i,countriesWithRequiredRegion:p,optionalZipCountries:v}),o(!1))}).catch(()=>{s&&o(!1)}),()=>{s=!1}},[]);const n=Y(()=>(e==null?void 0:e.availableCountries)||[],[e]),r=Y(()=>{if(!t||!e)return[];const s=e.availableCountries.find(i=>i.value===t);return!(s!=null&&s.availableRegions)||s.availableRegions.length===0?[]:s.availableRegions.map(i=>({text:i.name,value:`${i.code},${i.id}`}))},[t,e]),C=Y(()=>!t||!e?!1:e.countriesWithRequiredRegion.includes(t),[t,e]),y=Y(()=>r.length>0,[r]);return{countryOptions:n,regionOptions:r,isRegionRequired:C,hasRegionOptions:y,loadingCountries:u}},Ie=({loading:t,value:e,errors:l,touched:u,onChange:o,onBlur:n,namePrefix:r="",fieldPathPrefix:C=""})=>{const y=W({companyName:"Company.shared.fields.companyName",email:"Company.shared.fields.email",legalName:"Company.shared.fields.legalName",vatTaxId:"Company.shared.fields.vatTaxId",resellerId:"Company.shared.fields.resellerId"}),s=r?`${r}_`:"",i=p=>C?`${C}.${p}`:p;return g("div",{className:"account-edit-company-profile-form__group",children:[a(M,{label:y.companyName,required:!0,className:"account-edit-company-profile-form__field",error:u.name&&l.name?l.name:void 0,children:a(F,{name:`${s}name`,type:"text",value:e.name,onValue:o(i("name")),onBlur:()=>n(i("name")),disabled:!!t,variant:"primary",size:"medium"})}),a(M,{label:y.email,required:!0,className:"account-edit-company-profile-form__field",error:u.email&&l.email?l.email:void 0,children:a(F,{name:`${s}email`,type:"email",value:e.email,onValue:o(i("email")),onBlur:()=>n(i("email")),disabled:!!t,variant:"primary",size:"medium"})}),a(M,{label:y.legalName,className:"account-edit-company-profile-form__field",children:a(F,{name:`${s}legalName`,type:"text",value:e.legalName,onValue:o(i("legalName")),disabled:!!t,variant:"primary",size:"medium"})}),a(M,{label:y.vatTaxId,className:"account-edit-company-profile-form__field",children:a(F,{name:`${s}vatTaxId`,type:"text",value:e.vatTaxId,onValue:o(i("vatTaxId")),disabled:!!t,variant:"primary",size:"medium"})}),a(M,{label:y.resellerId,className:"account-edit-company-profile-form__field",children:a(F,{name:`${s}resellerId`,type:"text",value:e.resellerId,onValue:o(i("resellerId")),disabled:!!t,variant:"primary",size:"medium"})})]})},xe=({loading:t,loadingCountries:e,value:l,errors:u,touched:o,onChange:n,onBlur:r,countryOptions:C,regionOptions:y,isRegionRequired:s,hasRegionOptions:i,namePrefix:p="legalAddress",fieldPathPrefix:v="legalAddress",requiredConfig:A})=>{var z;const w=W({legalAddress:"Company.shared.fields.legalAddress",streetAddress:"Company.shared.fields.streetAddress",city:"Company.shared.fields.city",country:"Company.shared.fields.country",stateProvince:"Company.shared.fields.stateProvince",zipPostalCode:"Company.shared.fields.zipPostalCode",phoneNumber:"Company.shared.fields.phoneNumber"}),P={street:`${p}_street`,street2:`${p}_street2`,city:`${p}_city`,countryCode:`${p}_countryCode`,region:`${p}_region`,postcode:`${p}_postcode`,telephone:`${p}_telephone`},m={street:`${v}.street`,street2:`${v}.street2`,city:`${v}.city`,countryCode:`${v}.countryCode`,region:`${v}.region`,regionCode:`${v}.regionCode`,postcode:`${v}.postcode`,telephone:`${v}.telephone`},x={street:(A==null?void 0:A.street)??!0,city:(A==null?void 0:A.city)??!0,postcode:(A==null?void 0:A.postcode)??!0,telephone:(A==null?void 0:A.telephone)??!0};return g("div",{className:"account-edit-company-profile-form__section",children:[a("h3",{className:"account-edit-company-profile-form__section-title",children:w.legalAddress}),a(M,{label:w.streetAddress,required:x.street,className:"account-edit-company-profile-form__field",error:o[m.street]&&u[m.street]?u[m.street]:void 0,children:a(F,{name:P.street,type:"text",value:l.street,onValue:n(m.street),onBlur:()=>r(m.street),disabled:!!t,variant:"primary",size:"medium"})}),a(M,{label:`${w.streetAddress} 2`,className:"account-edit-company-profile-form__field",children:a(F,{name:P.street2,type:"text",value:l.street2,onValue:n(m.street2),disabled:!!t,variant:"primary",size:"medium"})}),a(M,{label:w.city,required:x.city,className:"account-edit-company-profile-form__field",error:o[m.city]&&u[m.city]?u[m.city]:void 0,children:a(F,{name:P.city,type:"text",value:l.city,onValue:n(m.city),onBlur:()=>r(m.city),disabled:!!t,variant:"primary",size:"medium"})}),a(M,{label:w.country,required:!0,className:"account-edit-company-profile-form__field",error:o[m.countryCode]&&u[m.countryCode]?u[m.countryCode]:void 0,children:a(ue,{name:P.countryCode,floatingLabel:`${w.country} *`,placeholder:w.country,options:C,value:l.countryCode,handleSelect:N=>{const D=N.target;n(m.countryCode)(D.value)},onBlur:()=>r(m.countryCode),disabled:!!t||e})}),a(M,{label:w.stateProvince,required:s,className:"account-edit-company-profile-form__field",error:o["legalAddress.region"]&&u["legalAddress.region"]?u["legalAddress.region"]:void 0,children:i?a(ue,{name:"legalAddress_region",floatingLabel:`${w.stateProvince} ${s?"*":""}`,placeholder:w.stateProvince,options:y,value:l.regionCode&&((z=y.find(N=>N.value.split(",")[0]===l.regionCode))==null?void 0:z.value)||"",handleSelect:N=>{var S;const D=N.target,[O]=D.value.split(","),$=((S=y.find(H=>H.value===D.value))==null?void 0:S.text)||"";n(m.region)($),n(m.regionCode)(O)},onBlur:()=>r(m.region),disabled:!!t||e},`region_picker_${l.countryCode}`):a(F,{name:P.region,type:"text",value:l.region,onValue:n(m.region),onBlur:()=>r(m.region),disabled:!!t||e,variant:"primary",size:"medium"},`region_input_${l.countryCode}`)}),a(M,{label:w.zipPostalCode,required:x.postcode,className:"account-edit-company-profile-form__field",error:o[m.postcode]&&u[m.postcode]?u[m.postcode]:void 0,children:a(F,{name:P.postcode,type:"text",value:l.postcode,onValue:n(m.postcode),onBlur:()=>r(m.postcode),disabled:!!t,variant:"primary",size:"medium"})}),a(M,{label:w.phoneNumber,required:x.telephone,className:"account-edit-company-profile-form__field",error:o[m.telephone]&&u[m.telephone]?u[m.telephone]:void 0,children:a(F,{name:P.telephone,type:"tel",value:l.telephone,onValue:n(m.telephone),onBlur:()=>r(m.telephone),disabled:!!t,variant:"primary",size:"medium"})})]})},Ve=({inLineAlertProps:t,company:e,loading:l=!1,onSubmit:u,onCancel:o})=>{var H,Z,j,h,I,X,ee,te,ae,re,se,le,ne,ie;const n=W({title:"Company.EditCompanyProfile.title",cancel:"Company.shared.buttons.cancel",save:"Company.shared.buttons.save",saving:"Company.shared.buttons.saving",required:"Company.shared.validation.required",invalidEmail:"Company.shared.validation.invalidEmail",companyNameRequired:"Company.shared.validation.companyNameRequired",emailRequired:"Company.shared.validation.emailRequired",emailNotAvailable:"Company.shared.validation.emailNotAvailable"}),[r,C]=T({name:(e==null?void 0:e.name)||"",email:(e==null?void 0:e.email)||"",legalName:(e==null?void 0:e.legalName)||"",vatTaxId:(e==null?void 0:e.vatTaxId)||"",resellerId:(e==null?void 0:e.resellerId)||"",legalAddress:{street:((Z=(H=e==null?void 0:e.legalAddress)==null?void 0:H.street)==null?void 0:Z[0])||"",street2:((h=(j=e==null?void 0:e.legalAddress)==null?void 0:j.street)==null?void 0:h[1])||"",city:((I=e==null?void 0:e.legalAddress)==null?void 0:I.city)||"",region:((ee=(X=e==null?void 0:e.legalAddress)==null?void 0:X.region)==null?void 0:ee.region)||"",regionCode:((ae=(te=e==null?void 0:e.legalAddress)==null?void 0:te.region)==null?void 0:ae.regionCode)||"",countryCode:((re=e==null?void 0:e.legalAddress)==null?void 0:re.countryCode)||"",postcode:((se=e==null?void 0:e.legalAddress)==null?void 0:se.postcode)||"",telephone:((le=e==null?void 0:e.legalAddress)==null?void 0:le.telephone)||""}}),[y,s]=T({}),[i,p]=T({}),v=((ne=e==null?void 0:e.permissionsFlags)==null?void 0:ne.canEditAccount)===!0,A=((ie=e==null?void 0:e.permissionsFlags)==null?void 0:ie.canEditAddress)===!0,{countryOptions:w,regionOptions:P,isRegionRequired:m,hasRegionOptions:x,loadingCountries:z}=we(r.legalAddress.countryCode),N=(c,f)=>c==="name"?f.trim()?null:n.companyNameRequired:c==="email"?f.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(f)?null:n.invalidEmail:n.emailRequired:c==="legalAddress.street"||c==="legalAddress.city"||c==="legalAddress.postcode"||c==="legalAddress.telephone"||c==="legalAddress.countryCode"?f.trim()?null:n.required:c==="legalAddress.region"&&m&&!f.trim()?n.required:null,D=()=>{var k,b;const c={};let f=!0;const L=((k=e==null?void 0:e.permissionsFlags)==null?void 0:k.canEditAccount)===!0,_=((b=e==null?void 0:e.permissionsFlags)==null?void 0:b.canEditAddress)===!0;if(L){const d=N("name",r.name);d&&(c.name=d,f=!1);const E=N("email",r.email);E&&(c.email=E,f=!1)}if(_){const d=N("legalAddress.street",r.legalAddress.street);d&&(c["legalAddress.street"]=d,f=!1);const E=N("legalAddress.city",r.legalAddress.city);E&&(c["legalAddress.city"]=E,f=!1);const oe=N("legalAddress.postcode",r.legalAddress.postcode);oe&&(c["legalAddress.postcode"]=oe,f=!1);const de=N("legalAddress.telephone",r.legalAddress.telephone);de&&(c["legalAddress.telephone"]=de,f=!1);const ce=N("legalAddress.countryCode",r.legalAddress.countryCode);ce&&(c["legalAddress.countryCode"]=ce,f=!1);const me=N("legalAddress.region",r.legalAddress.region);me&&(c["legalAddress.region"]=me,f=!1)}return s(c),f},O=async c=>{var k,b;c.preventDefault();const f=((k=e==null?void 0:e.permissionsFlags)==null?void 0:k.canEditAccount)===!0,L=((b=e==null?void 0:e.permissionsFlags)==null?void 0:b.canEditAddress)===!0,_={};if(f&&(_.name=!0,_.email=!0,_.legalName=!0,_.vatTaxId=!0,_.resellerId=!0),L&&(_["legalAddress.street"]=!0,_["legalAddress.street2"]=!0,_["legalAddress.city"]=!0,_["legalAddress.region"]=!0,_["legalAddress.regionCode"]=!0,_["legalAddress.countryCode"]=!0,_["legalAddress.postcode"]=!0,_["legalAddress.telephone"]=!0),p(_),!!D()){if(f&&r.email!==(e==null?void 0:e.email)){const d=await Ne(r.email);if(!d.isValid){s(E=>({...E,email:d.error||n.emailNotAvailable}));return}}if(u){const d={};f&&(d.name=r.name,d.email=r.email,d.legalName=r.legalName,d.vatTaxId=r.vatTaxId,d.resellerId=r.resellerId),L&&(d.legalAddress={street:[r.legalAddress.street,r.legalAddress.street2].filter(Boolean),city:r.legalAddress.city,region:{region:r.legalAddress.region,regionCode:r.legalAddress.regionCode},countryCode:r.legalAddress.countryCode,postcode:r.legalAddress.postcode,telephone:r.legalAddress.telephone}),await u(d)}}},$=c=>f=>{const L=new Set(["name","email","legalName","vatTaxId","resellerId"]),_=c.startsWith("legalAddress.");if(!(L.has(c)&&!v||_&&!A)){if(c.startsWith("legalAddress.")){const b=c.split(".")[1];b==="countryCode"?(C(d=>({...d,legalAddress:{...d.legalAddress,[b]:f,region:"",regionCode:""}})),s(d=>{const E={...d};return delete E["legalAddress.region"],delete E["legalAddress.regionCode"],E}),p(d=>{const E={...d};return delete E["legalAddress.region"],delete E["legalAddress.regionCode"],E})):C(b==="region"?d=>({...d,legalAddress:{...d.legalAddress,region:f,regionCode:x?d.legalAddress.regionCode:f}}):d=>({...d,legalAddress:{...d.legalAddress,[b]:f}}))}else C(b=>({...b,[c]:f}));y[c]&&s(b=>{const d={...b};return delete d[c],d})}},S=c=>{const f=new Set(["name","email","legalName","vatTaxId","resellerId"]),L=c.startsWith("legalAddress.");if(f.has(c)&&!v||L&&!A)return;p(d=>({...d,[c]:!0}));let k="";if(c.startsWith("legalAddress.")){const d=c.split(".")[1],E=r.legalAddress[d];k=typeof E=="string"?E:""}else{const d=r[c];k=typeof d=="string"?d:""}const b=N(c,k);b&&s(d=>({...d,[c]:b}))};return g(q,{variant:"secondary",className:"account-edit-company-profile",children:[a(ge,{title:n.title,divider:!1,className:"account-edit-company-profile__title"}),t!=null&&t.text?a(ve,{className:"account-edit-company-profile__notification",type:t.type,variant:"secondary",heading:t.text,icon:t.icon,"data-testid":"editCompanyInLineAlert"}):null,g("form",{className:"account-edit-company-profile-form",onSubmit:O,children:[v&&a(Ie,{loading:l,value:{name:r.name,email:r.email,legalName:r.legalName,vatTaxId:r.vatTaxId,resellerId:r.resellerId},errors:y,touched:i,onChange:$,onBlur:S}),A&&a(xe,{loading:l,loadingCountries:z,value:r.legalAddress,errors:y,touched:i,onChange:$,onBlur:S,countryOptions:w,regionOptions:P,isRegionRequired:m,hasRegionOptions:x}),g("div",{className:"account-edit-company-profile__actions",children:[a(K,{disabled:l,type:"button",variant:"secondary",onClick:()=>o==null?void 0:o(),children:n.cancel}),a(K,{disabled:l||!v&&!A,type:"submit",variant:"primary",children:n.save})]})]}),l&&g("div",{className:"account-edit-company-profile__loading-overlay","data-testid":"editCompanyLoadingOverlay",children:[a(Ae,{size:"large"}),a("div",{className:"account-edit-company-profile__loading-text",children:n.saving})]})]})},Te=({testId:t,withCard:e=!0})=>{const l=g(Ce,{"data-testid":t||"companySkeletonLoader",children:[a(G,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),a(G,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),a(G,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return e?l:a(q,{variant:"secondary",className:Q(["company-company-loaders","company-company-loaders--card-loader"]),children:l})};var fe=(t=>(t.EDIT_COMPANY_EVENT="edit-company",t))(fe||{});const $e={EDIT_COMPANY_EVENT:"edit-company"},Me=()=>(window.adobeDataLayer||(window.adobeDataLayer=[]),window.adobeDataLayer),Pe=t=>{Me().push(l=>{const u=l.getState?l.getState():{};l.push({event:t,context:u})})},Fe=(t,e)=>{if(!$e[t])return null;switch(t){case"edit-company":Pe({type:"company",eventType:"edit",companyData:e});break;default:return null}},Re=({handleSetInLineAlert:t})=>{const e=W({companySuccess:"Company.CompanyProfile.editCompanyProfile.companySuccess",companyError:"Company.CompanyProfile.editCompanyProfile.companyError",loadError:"Company.CompanyProfile.messages.loadError",updateError:"Company.CompanyProfile.messages.updateError"}),{companySuccess:l,companyError:u,loadError:o,updateError:n}=e,[r,C]=T(null),[y,s]=T(!0),[i,p]=T(!1),[v,A]=T(!1),[w,P]=T([]),[m,x]=T({}),z=J(t),N=J(!1),D=J(!1);B(()=>{z.current=t},[t]);const O=R(h=>{x(h)},[]),$=R((h,I)=>{t&&(h==="success"?t({type:"success",text:I??l}):h==="error"?t({type:"error",text:I??u}):t(),p(!1))},[t,l,u]),S=R(async()=>{if(N.current)return null;N.current=!0,s(!0);try{const h=await _e();return h&&C(h),s(!1),h}catch(h){return console.error("Failed to load company:",h),s(!1),z.current&&z.current({type:"error",text:o}),null}finally{N.current=!1}},[o]);B(()=>{D.current||(D.current=!0,S())},[S]),B(()=>{const h=()=>{s(!0),A(!1),x({}),S()},I=pe.on("companyContext/changed",h,{eager:!0});return()=>{I==null||I.off()}},[S]),B(()=>{he().then(h=>{P(h.availableCountries)}).catch(h=>{console.error("Failed to load countries:",h)})},[]);const H=R(()=>{A(!0),$("success",""),x({})},[$]),Z=R(h=>{h==null||h(),A(!1),x({})},[]),j=R(async h=>{try{if(p(!0),!h){$("error","No data to update");return}const I=await Ee(h);C(I),A(!1),x({}),$("success"),Fe(fe.EDIT_COMPANY_EVENT,{...h,companyId:r==null?void 0:r.id}),pe.emit("company/updated",{company:I})}catch(I){console.error("Failed to update company:",I),$("error",I.message||n)}finally{p(!1)}},[r,$,n]);return{company:r,countries:w,loading:y,submitLoading:i,showEditForm:v,inputChange:m,handleShowEditForm:H,handleHideEditForm:Z,handleUpdateCompany:j,handleInputChange:O,renderAlertMessage:$,saving:i}},Se=t=>V.createElement("svg",{id:"Icon_Warning_Base",width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},V.createElement("g",{clipPath:"url(#clip0_841_1324)"},V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})),V.createElement("defs",null,V.createElement("clipPath",{id:"clip0_841_1324"},V.createElement("rect",{width:24,height:21,fill:"white",transform:"translate(0 1.5)"})))),ke=t=>V.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M6.75 12.762L10.2385 15.75L17.25 9",stroke:"currentColor"})),De=t=>V.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z",stroke:"currentColor"}),V.createElement("path",{vectorEffect:"non-scaling-stroke",d:"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z",stroke:"currentColor"})),Le={success:a(ke,{}),warning:a(Se,{}),error:a(De,{})},ze=()=>{const[t,e]=T({}),[l,u]=T(null),o=R(()=>{e({}),l&&(clearTimeout(l),u(null))},[l]),n=R(s=>{if(l&&(clearTimeout(l),u(null)),!(s!=null&&s.type)){e({});return}const i=Le[s.type];if(e({type:s.type,text:s.text,icon:i}),s.autoHide!==!1){const p=s.autoHideDelay||(s.type==="success"?3e3:5e3),v=setTimeout(()=>{e({}),u(null)},p);u(v)}},[l]),r=R((s,i=!0)=>{n({type:"success",text:s,autoHide:i})},[n]),C=R((s,i=!1)=>{n({type:"warning",text:s,autoHide:i})},[n]),y=R((s,i=!1)=>{n({type:"error",text:s,autoHide:i})},[n]);return B(()=>()=>{l&&clearTimeout(l)},[l]),{inLineAlertProps:t,handleSetInLineAlert:n,clearAlert:o,showSuccess:r,showWarning:C,showError:y}},Ue=({className:t,withHeader:e=!0,slots:l})=>{const u=W({containerTitle:"Company.CompanyProfile.containerTitle"}),{inLineAlertProps:o,handleSetInLineAlert:n}=ze(),{company:r,loading:C,saving:y,showEditForm:s,handleShowEditForm:i,handleHideEditForm:p,handleUpdateCompany:v}=Re({handleSetInLineAlert:n});return C?a("div",{"data-testid":"companyProfileLoader",children:a(Te,{withCard:!0})}):g("div",{className:Q(["account-company-profile",t]),children:[e?a(ge,{title:u.containerTitle,divider:!1,className:"company-profile__title"}):null,a(be,{company:r,slots:l,showEditForm:s,handleShowEditForm:i}),s?a(Ve,{inLineAlertProps:o,company:r,loading:y,onSubmit:v,onCancel:p}):null]})};export{Ue as CompanyProfile,Ue as default};
4
4
  //# sourceMappingURL=CompanyProfile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CompanyProfile.js","sources":["/@dropins/storefront-company-management/src/components/CompanyProfileCard/CompanyProfileCard.tsx","/@dropins/storefront-company-management/src/hooks/useCountries.ts","/@dropins/storefront-company-management/src/components/EditCompanyProfile/CompanyAccountFields.tsx","/@dropins/storefront-company-management/src/components/EditCompanyProfile/LegalAddressFields.tsx","/@dropins/storefront-company-management/src/components/EditCompanyProfile/EditCompanyProfile.tsx","/@dropins/storefront-company-management/src/components/CompanyLoaders/CompanyLoaders.tsx","/@dropins/storefront-company-management/src/lib/acdl.ts","/@dropins/storefront-company-management/src/hooks/containers/useCompanyProfile.tsx","../../node_modules/@adobe-commerce/elsie/src/icons/Warning.svg","../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","../../node_modules/@adobe-commerce/elsie/src/icons/WarningWithCircle.svg","/@dropins/storefront-company-management/src/hooks/useInLineAlert.tsx","/@dropins/storefront-company-management/src/containers/CompanyProfile/CompanyProfile.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { FunctionComponent } from 'preact';\nimport { Card, Button } from '@adobe-commerce/elsie/components';\nimport { classes, Slot } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { CompanyProfileCardProps } from '../../types/companyProfile.types';\nimport './CompanyProfileCard.css';\n\nexport const CompanyProfileCard: FunctionComponent<CompanyProfileCardProps> = ({\n company,\n slots,\n showEditForm,\n handleShowEditForm,\n}) => {\n const translations = useText({\n editButton: 'Company.shared.buttons.edit',\n noDataMessage: 'Company.CompanyProfile.companyProfileCard.noDataMessage',\n companyName: 'Company.shared.fields.companyName',\n email: 'Company.shared.fields.email',\n legalName: 'Company.shared.fields.legalName',\n vatTaxId: 'Company.shared.fields.vatTaxId',\n resellerId: 'Company.shared.fields.resellerId',\n legalAddress: 'Company.shared.fields.legalAddress',\n contacts: 'Company.CompanyProfile.companyProfileCard.contacts',\n companyAdministrator: 'Company.CompanyProfile.companyProfileCard.companyAdministrator',\n salesRepresentative: 'Company.CompanyProfile.companyProfileCard.salesRepresentative',\n paymentInformation: 'Company.CompanyProfile.companyProfileCard.paymentInformation',\n shippingInformation: 'Company.CompanyProfile.companyProfileCard.shippingInformation',\n availablePaymentMethods: 'Company.CompanyProfile.companyProfileCard.availablePaymentMethods',\n availableShippingMethods: 'Company.CompanyProfile.companyProfileCard.availableShippingMethods',\n noPaymentMethods: 'Company.CompanyProfile.companyProfileCard.noPaymentMethods',\n noShippingMethods: 'Company.CompanyProfile.companyProfileCard.noShippingMethods',\n });\n \n if (!company) {\n return (\n <Card variant=\"secondary\" className=\"account-company-profile-card\">\n <div className=\"account-company-profile-card__wrapper\">\n <div className=\"account-company-profile-card__content\">\n <div className=\"account-company-profile-card__no-data\">\n <p>{translations.noDataMessage}</p>\n </div>\n </div>\n </div>\n </Card>\n );\n }\n\n const perms = company.permissionsFlags || {\n canViewAccount: true,\n canEditAccount: false,\n canViewAddress: true,\n canEditAddress: false,\n canViewContacts: true,\n canViewPaymentInformation: true,\n canViewShippingInformation: true,\n };\n\n const companyData = [\n perms.canViewAccount ? { name: 'name', label: translations.companyName, value: company.name || '' } : null,\n perms.canViewAccount ? { name: 'email', label: translations.email, value: company.email || '' } : null,\n perms.canViewAccount ? { name: 'legalName', label: translations.legalName, value: company.legalName || '' } : null,\n perms.canViewAccount ? { name: 'vatTaxId', label: translations.vatTaxId, value: company.vatTaxId || '' } : null,\n perms.canViewAccount ? { name: 'resellerId', label: translations.resellerId, value: company.resellerId || '' } : null,\n ].filter(Boolean) as { name: string; label: string; value: string }[];\n\n return (\n <Card\n variant=\"secondary\"\n className={classes([\n 'account-company-profile-card',\n [\n 'account-company-profile-card-short',\n showEditForm,\n ],\n ])}\n >\n <div className=\"account-company-profile-card__wrapper\">\n <div className=\"account-company-profile-card__actions\">\n {(company.canEditAccount || company.canEditAddress) && (\n <Button\n // @ts-ignore\n type=\"button\"\n variant=\"tertiary\"\n onClick={handleShowEditForm}\n >\n {translations.editButton}\n </Button>\n )}\n </div>\n <div className=\"account-company-profile-card__content\">\n {(() => {\n const Default = (\n <>\n {companyData.map((el, index) => {\n if (!el.value) return null;\n const value = !el.label\n ? el.value\n : `${el.label}: ${el.value}`;\n\n return (\n <p\n key={`${el.name}_${index}`}\n data-testid={`${el.name}_${index}`}\n >\n {value}\n </p>\n );\n })}\n\n {perms.canViewAddress && company.legalAddress && (\n <div className=\"company-legal-address\">\n <p><strong>{translations.legalAddress}:</strong></p>\n {company.legalAddress.street?.map((line: string, i: number) => (\n <p key={i}>{line}</p>\n ))}\n <p>\n {company.legalAddress.city}, {company.legalAddress.region?.region} {company.legalAddress.postcode}\n </p>\n <p>{company.legalAddress.countryCode}</p>\n {company.legalAddress.telephone && (\n <p>Phone: {company.legalAddress.telephone}</p>\n )}\n </div>\n )}\n\n {perms.canViewContacts && (company.companyAdmin || company.salesRepresentative) && (\n <div className=\"company-contacts\">\n <p><strong>{translations.contacts}:</strong></p>\n \n {company.companyAdmin && (\n <div className=\"company-contact\">\n <p><strong>{translations.companyAdministrator}:</strong></p>\n <p>{company.companyAdmin.firstname} {company.companyAdmin.lastname}</p>\n {company.companyAdmin.jobTitle && <p>{company.companyAdmin.jobTitle}</p>}\n <p>{company.companyAdmin.email}</p>\n </div>\n )}\n\n {company.salesRepresentative && (\n <div className=\"company-contact\">\n <p><strong>{translations.salesRepresentative}:</strong></p>\n <p>{company.salesRepresentative.firstname} {company.salesRepresentative.lastname}</p>\n <p>{company.salesRepresentative.email}</p>\n </div>\n )}\n </div>\n )}\n\n {perms.canViewPaymentInformation && (\n <div className=\"company-payment-methods\">\n <p><strong>{translations.paymentInformation}:</strong></p>\n {company.availablePaymentMethods && company.availablePaymentMethods.length > 0 ? (\n <>\n <p><strong>{translations.availablePaymentMethods}:</strong></p>\n <ul className=\"payment-methods-list\">\n {company.availablePaymentMethods.map((m, index) => (\n <li key={`payment_${index}`}>{m.title}</li>\n ))}\n </ul>\n </>\n ) : (\n <div className=\"message message-notice notice\">\n <div>{translations.noPaymentMethods}</div>\n </div>\n )}\n </div>\n )}\n\n {perms.canViewShippingInformation && (\n <div className=\"company-shipping-methods\">\n <p><strong>{translations.shippingInformation}:</strong></p>\n {company.availableShippingMethods && company.availableShippingMethods.length > 0 ? (\n <>\n <p><strong>{translations.availableShippingMethods}:</strong></p>\n <ul className=\"shipping-methods-list\">\n {company.availableShippingMethods.map((m, index) => (\n <li key={`shipping_${index}`}>{m.title}</li>\n ))}\n </ul>\n </>\n ) : (\n <div className=\"message message-notice notice\">\n <div>{translations.noShippingMethods}</div>\n </div>\n )}\n </div>\n )}\n </>\n );\n if (slots?.CompanyData) {\n return (\n <Slot name=\"CompanyData\" slot={slots.CompanyData} context={{ companyData, Default }} />\n );\n }\n return Default;\n })()}\n </div>\n </div>\n </Card>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { useEffect, useMemo, useState } from 'preact/hooks';\nimport { getCountries } from '../api';\nimport type { Country } from '../data/models';\n\ninterface UseCountriesResult {\n countryOptions: Country[];\n regionOptions: { text: string; value: string }[];\n isRegionRequired: boolean;\n hasRegionOptions: boolean;\n loadingCountries: boolean;\n}\n\nexport const useCountries = (selectedCountryCode: string | undefined): UseCountriesResult => {\n const [countriesData, setCountriesData] = useState<{\n availableCountries: Country[];\n countriesWithRequiredRegion: string[];\n optionalZipCountries: string[];\n } | null>(null);\n const [loadingCountries, setLoadingCountries] = useState<boolean>(true);\n\n useEffect(() => {\n let isMounted = true;\n getCountries()\n .then(({ availableCountries, countriesWithRequiredRegion, optionalZipCountries }) => {\n if (!isMounted) return;\n setCountriesData({ availableCountries, countriesWithRequiredRegion, optionalZipCountries });\n setLoadingCountries(false);\n })\n .catch(() => {\n if (!isMounted) return;\n setLoadingCountries(false);\n });\n return () => {\n isMounted = false;\n };\n }, []);\n\n const countryOptions = useMemo(() => {\n return countriesData?.availableCountries || [];\n }, [countriesData]);\n\n const regionOptions = useMemo(() => {\n if (!selectedCountryCode || !countriesData) return [] as { text: string; value: string }[];\n const selectedCountry = countriesData.availableCountries.find((country) => country.value === selectedCountryCode);\n if (!selectedCountry?.availableRegions || selectedCountry.availableRegions.length === 0) return [];\n return selectedCountry.availableRegions.map((region) => ({ text: region.name, value: `${region.code},${region.id}` }));\n }, [selectedCountryCode, countriesData]);\n\n const isRegionRequired = useMemo(() => {\n if (!selectedCountryCode || !countriesData) return false;\n return countriesData.countriesWithRequiredRegion.includes(selectedCountryCode);\n }, [selectedCountryCode, countriesData]);\n\n const hasRegionOptions = useMemo(() => regionOptions.length > 0, [regionOptions]);\n\n return {\n countryOptions,\n regionOptions,\n isRegionRequired,\n hasRegionOptions,\n loadingCountries,\n };\n};\n\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { FunctionComponent } from 'preact';\nimport { Field, Input } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\ninterface CompanyAccountFieldsProps {\n loading?: boolean;\n value: {\n name: string;\n email: string;\n legalName: string;\n vatTaxId: string;\n resellerId: string;\n };\n errors: Record<string, string>;\n touched: Record<string, boolean>;\n onChange: (field: string) => (value: string) => void;\n onBlur: (field: string) => void;\n /** Optional input name prefix for DOM names (defaults to none) */\n namePrefix?: string;\n /** Optional field path prefix used for change/blur handlers (defaults to none) */\n fieldPathPrefix?: string;\n}\n\nexport const CompanyAccountFields: FunctionComponent<CompanyAccountFieldsProps> = ({\n loading,\n value,\n errors,\n touched,\n onChange,\n onBlur,\n namePrefix = '',\n fieldPathPrefix = '',\n}) => {\n const translations = useText({\n companyName: 'Company.shared.fields.companyName',\n email: 'Company.shared.fields.email',\n legalName: 'Company.shared.fields.legalName',\n vatTaxId: 'Company.shared.fields.vatTaxId',\n resellerId: 'Company.shared.fields.resellerId',\n });\n const prefix = namePrefix ? `${namePrefix}_` : '';\n const path = (f: string) => (fieldPathPrefix ? `${fieldPathPrefix}.${f}` : f);\n return (\n <div className=\"account-edit-company-profile-form__group\">\n <Field \n label={translations.companyName} \n required\n className=\"account-edit-company-profile-form__field\"\n error={touched.name && errors.name ? errors.name : undefined}\n >\n <Input\n name={`${prefix}name`}\n type=\"text\"\n value={value.name}\n onValue={onChange(path('name'))}\n onBlur={() => onBlur(path('name'))}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field \n label={translations.email} \n required\n className=\"account-edit-company-profile-form__field\"\n error={touched.email && errors.email ? errors.email : undefined}\n >\n <Input\n name={`${prefix}email`}\n type=\"email\"\n value={value.email}\n onValue={onChange(path('email'))}\n onBlur={() => onBlur(path('email'))}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field label={translations.legalName} className=\"account-edit-company-profile-form__field\">\n <Input\n name={`${prefix}legalName`}\n type=\"text\"\n value={value.legalName}\n onValue={onChange(path('legalName'))}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field label={translations.vatTaxId} className=\"account-edit-company-profile-form__field\">\n <Input\n name={`${prefix}vatTaxId`}\n type=\"text\"\n value={value.vatTaxId}\n onValue={onChange(path('vatTaxId'))}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field label={translations.resellerId} className=\"account-edit-company-profile-form__field\">\n <Input\n name={`${prefix}resellerId`}\n type=\"text\"\n value={value.resellerId}\n onValue={onChange(path('resellerId'))}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n </div>\n );\n};\n\nexport default CompanyAccountFields;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { FunctionComponent } from 'preact';\nimport { Field, Input, Picker } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\ninterface LegalAddressFieldsProps {\n loading?: boolean;\n loadingCountries: boolean;\n value: {\n street: string;\n street2: string;\n city: string;\n region: string;\n regionCode: string;\n countryCode: string;\n postcode: string;\n telephone: string;\n };\n errors: Record<string, string>;\n touched: Record<string, boolean>;\n onChange: (field: string) => (value: string) => void;\n onBlur: (field: string) => void;\n countryOptions: { text: string; value: string }[];\n regionOptions: { text: string; value: string }[];\n isRegionRequired: boolean;\n hasRegionOptions: boolean;\n /**\n * Optional input name prefix for DOM names (defaults to 'legal_address')\n */\n namePrefix?: string;\n /**\n * Optional field path prefix used for change/blur handlers (defaults to 'legal_address')\n */\n fieldPathPrefix?: string;\n /**\n * Optional per-field required overrides for non-edit flows\n */\n requiredConfig?: Partial<{\n street: boolean;\n city: boolean;\n postcode: boolean;\n telephone: boolean;\n }>;\n}\n\nexport const LegalAddressFields: FunctionComponent<LegalAddressFieldsProps> = ({\n loading,\n loadingCountries,\n value,\n errors,\n touched,\n onChange,\n onBlur,\n countryOptions,\n regionOptions,\n isRegionRequired,\n hasRegionOptions,\n namePrefix = 'legalAddress',\n fieldPathPrefix = 'legalAddress',\n requiredConfig,\n}) => {\n const translations = useText({\n legalAddress: 'Company.shared.fields.legalAddress',\n streetAddress: 'Company.shared.fields.streetAddress',\n city: 'Company.shared.fields.city',\n country: 'Company.shared.fields.country',\n stateProvince: 'Company.shared.fields.stateProvince',\n zipPostalCode: 'Company.shared.fields.zipPostalCode',\n phoneNumber: 'Company.shared.fields.phoneNumber',\n });\n const names = {\n street: `${namePrefix}_street`,\n street2: `${namePrefix}_street2`,\n city: `${namePrefix}_city`,\n countryCode: `${namePrefix}_countryCode`,\n region: `${namePrefix}_region`,\n postcode: `${namePrefix}_postcode`,\n telephone: `${namePrefix}_telephone`,\n } as const;\n\n const paths = {\n street: `${fieldPathPrefix}.street`,\n street2: `${fieldPathPrefix}.street2`,\n city: `${fieldPathPrefix}.city`,\n countryCode: `${fieldPathPrefix}.countryCode`,\n region: `${fieldPathPrefix}.region`,\n regionCode: `${fieldPathPrefix}.regionCode`,\n postcode: `${fieldPathPrefix}.postcode`,\n telephone: `${fieldPathPrefix}.telephone`,\n } as const;\n\n const isRequired = {\n street: requiredConfig?.street ?? true,\n city: requiredConfig?.city ?? true,\n postcode: requiredConfig?.postcode ?? true,\n telephone: requiredConfig?.telephone ?? true,\n } as const;\n\n return (\n <div className=\"account-edit-company-profile-form__section\">\n <h3 className=\"account-edit-company-profile-form__section-title\">{translations.legalAddress}</h3>\n\n <Field \n label={translations.streetAddress} \n required={isRequired.street}\n className=\"account-edit-company-profile-form__field\"\n error={touched[paths.street] && errors[paths.street] ? errors[paths.street] : undefined}\n >\n <Input\n name={names.street}\n type=\"text\"\n value={value.street}\n onValue={onChange(paths.street)}\n onBlur={() => onBlur(paths.street)}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field \n label={`${translations.streetAddress} 2`} \n className=\"account-edit-company-profile-form__field\"\n >\n <Input\n name={names.street2}\n type=\"text\"\n value={value.street2}\n onValue={onChange(paths.street2)}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field \n label={translations.city} \n required={isRequired.city}\n className=\"account-edit-company-profile-form__field\"\n error={touched[paths.city] && errors[paths.city] ? errors[paths.city] : undefined}\n >\n <Input\n name={names.city}\n type=\"text\"\n value={value.city}\n onValue={onChange(paths.city)}\n onBlur={() => onBlur(paths.city)}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field \n label={translations.country} \n required\n className=\"account-edit-company-profile-form__field\"\n error={touched[paths.countryCode] && errors[paths.countryCode] ? errors[paths.countryCode] : undefined}\n >\n <Picker\n name={names.countryCode}\n floatingLabel={`${translations.country} *`}\n placeholder={translations.country}\n options={countryOptions}\n value={value.countryCode}\n handleSelect={(event: Event) => {\n const target = event.target as HTMLSelectElement;\n onChange(paths.countryCode)(target.value);\n }}\n onBlur={() => onBlur(paths.countryCode)}\n disabled={!!loading || loadingCountries}\n />\n </Field>\n\n <Field \n label={translations.stateProvince} \n required={isRegionRequired}\n className=\"account-edit-company-profile-form__field\"\n error={touched['legalAddress.region'] && errors['legalAddress.region'] ? errors['legalAddress.region'] : undefined}\n >\n {hasRegionOptions ? (\n <Picker\n key={`region_picker_${value.countryCode}`}\n name=\"legalAddress_region\"\n floatingLabel={`${translations.stateProvince} ${isRegionRequired ? '*' : ''}`}\n placeholder={translations.stateProvince}\n options={regionOptions}\n value={value.regionCode ? (regionOptions.find(r => r.value.split(',')[0] === value.regionCode)?.value || '') : ''}\n handleSelect={(event: Event) => {\n const target = event.target as HTMLSelectElement;\n const [regionCode] = target.value.split(',');\n const regionName = regionOptions.find(r => r.value === target.value)?.text || '';\n onChange(paths.region)(regionName);\n onChange(paths.regionCode)(regionCode);\n }}\n onBlur={() => onBlur(paths.region)}\n disabled={!!loading || loadingCountries}\n />\n ) : (\n <Input\n key={`region_input_${value.countryCode}`}\n name={names.region}\n type=\"text\"\n value={value.region}\n onValue={onChange(paths.region)}\n onBlur={() => onBlur(paths.region)}\n disabled={!!loading || loadingCountries}\n variant=\"primary\"\n size=\"medium\"\n />\n )}\n </Field>\n\n <Field \n label={translations.zipPostalCode} \n required={isRequired.postcode}\n className=\"account-edit-company-profile-form__field\"\n error={touched[paths.postcode] && errors[paths.postcode] ? errors[paths.postcode] : undefined}\n >\n <Input\n name={names.postcode}\n type=\"text\"\n value={value.postcode}\n onValue={onChange(paths.postcode)}\n onBlur={() => onBlur(paths.postcode)}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field \n label={translations.phoneNumber} \n required={isRequired.telephone}\n className=\"account-edit-company-profile-form__field\"\n error={touched[paths.telephone] && errors[paths.telephone] ? errors[paths.telephone] : undefined}\n >\n <Input\n name={names.telephone}\n type=\"tel\"\n value={value.telephone}\n onValue={onChange(paths.telephone)}\n onBlur={() => onBlur(paths.telephone)}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n </div>\n );\n};\n\nexport default LegalAddressFields;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { FunctionComponent } from 'preact';\nimport { useState } from 'preact/hooks';\nimport {\n Button,\n Card,\n Header,\n InLineAlert,\n ProgressSpinner,\n} from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { validateCompanyEmail } from '../../api';\nimport { EditCompanyProfileProps } from '../../types/companyProfile.types';\nimport './EditCompanyProfile.css';\nimport { useCountries } from '../../hooks/useCountries';\nimport { CompanyAccountFields } from './CompanyAccountFields';\nimport { LegalAddressFields } from './LegalAddressFields';\n\nexport const EditCompanyProfile: FunctionComponent<EditCompanyProfileProps> = ({\n inLineAlertProps,\n company,\n loading = false,\n onSubmit,\n onCancel,\n}) => {\n const translations = useText({\n title: 'Company.EditCompanyProfile.title',\n cancel: 'Company.shared.buttons.cancel',\n save: 'Company.shared.buttons.save',\n saving: 'Company.shared.buttons.saving',\n required: 'Company.shared.validation.required',\n invalidEmail: 'Company.shared.validation.invalidEmail',\n companyNameRequired: 'Company.shared.validation.companyNameRequired',\n emailRequired: 'Company.shared.validation.emailRequired',\n emailNotAvailable: 'Company.shared.validation.emailNotAvailable',\n });\n \n const [formData, setFormData] = useState({\n name: company?.name || '',\n email: company?.email || '',\n legalName: company?.legalName || '',\n vatTaxId: company?.vatTaxId || '',\n resellerId: company?.resellerId || '',\n legalAddress: {\n street: company?.legalAddress?.street?.[0] || '',\n street2: company?.legalAddress?.street?.[1] || '',\n city: company?.legalAddress?.city || '',\n region: company?.legalAddress?.region?.region || '',\n regionCode: company?.legalAddress?.region?.regionCode || '',\n countryCode: company?.legalAddress?.countryCode || '',\n postcode: company?.legalAddress?.postcode || '',\n telephone: company?.legalAddress?.telephone || '',\n },\n });\n\n const [errors, setErrors] = useState<Record<string, string>>({});\n const [touched, setTouched] = useState<Record<string, boolean>>({});\n\n // Permission flags for editing\n // Strictly gate by granular permissions; do not fallback to overall canEdit here\n const canEditAccount = company?.permissionsFlags?.canEditAccount === true;\n const canEditAddress = company?.permissionsFlags?.canEditAddress === true;\n \n // Country and region data via hook\n const {\n countryOptions,\n regionOptions,\n isRegionRequired,\n hasRegionOptions,\n loadingCountries,\n } = useCountries(formData.legalAddress.countryCode);\n\n // Validation functions\n const validateField = (name: string, value: string): string | null => {\n if (name === 'name') {\n if (!value.trim()) return translations.companyNameRequired;\n return null;\n }\n if (name === 'email') {\n if (!value.trim()) return translations.emailRequired;\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n if (!emailRegex.test(value)) return translations.invalidEmail;\n return null;\n }\n if (\n name === 'legalAddress.street' ||\n name === 'legalAddress.city' ||\n name === 'legalAddress.postcode' ||\n name === 'legalAddress.telephone' ||\n name === 'legalAddress.countryCode'\n ) {\n if (!value.trim()) return translations.required;\n return null;\n }\n if (name === 'legalAddress.region') {\n if (isRegionRequired && !value.trim()) return translations.required;\n return null;\n }\n return null;\n };\n\n const validateForm = (): boolean => {\n const newErrors: Record<string, string> = {};\n let isValid = true;\n\n // Determine permissions for editing\n const canEditAccount = company?.permissionsFlags?.canEditAccount === true;\n const canEditAddress = company?.permissionsFlags?.canEditAddress === true;\n\n // Validate required account fields only if editing account is allowed\n if (canEditAccount) {\n const nameError = validateField('name', formData.name);\n if (nameError) {\n newErrors.name = nameError;\n isValid = false;\n }\n\n const emailError = validateField('email', formData.email);\n if (emailError) {\n newErrors.email = emailError;\n isValid = false;\n }\n }\n\n // Validate required address fields only if editing address is allowed\n if (canEditAddress) {\n const streetError = validateField('legalAddress.street', formData.legalAddress.street);\n if (streetError) {\n newErrors['legalAddress.street'] = streetError;\n isValid = false;\n }\n\n const cityError = validateField('legalAddress.city', formData.legalAddress.city);\n if (cityError) {\n newErrors['legalAddress.city'] = cityError;\n isValid = false;\n }\n\n const postcodeError = validateField('legalAddress.postcode', formData.legalAddress.postcode);\n if (postcodeError) {\n newErrors['legalAddress.postcode'] = postcodeError;\n isValid = false;\n }\n\n const telephoneError = validateField('legalAddress.telephone', formData.legalAddress.telephone);\n if (telephoneError) {\n newErrors['legalAddress.telephone'] = telephoneError;\n isValid = false;\n }\n\n const countryError = validateField('legalAddress.countryCode', formData.legalAddress.countryCode);\n if (countryError) {\n newErrors['legalAddress.countryCode'] = countryError;\n isValid = false;\n }\n\n // Validate region field\n const regionError = validateField('legalAddress.region', formData.legalAddress.region);\n if (regionError) {\n newErrors['legalAddress.region'] = regionError;\n isValid = false;\n }\n }\n\n setErrors(newErrors);\n return isValid;\n };\n\n const handleSubmit = async (event: Event) => {\n event.preventDefault();\n \n // Mark only editable fields as touched\n // Use granular permission flags defined for this session\n const canEditAccount = company?.permissionsFlags?.canEditAccount === true;\n const canEditAddress = company?.permissionsFlags?.canEditAddress === true;\n const touchedFields: Record<string, boolean> = {};\n if (canEditAccount) {\n touchedFields.name = true;\n touchedFields.email = true;\n touchedFields.legalName = true;\n touchedFields.vatTaxId = true;\n touchedFields.resellerId = true;\n }\n if (canEditAddress) {\n touchedFields['legalAddress.street'] = true;\n touchedFields['legalAddress.street2'] = true;\n touchedFields['legalAddress.city'] = true;\n touchedFields['legalAddress.region'] = true;\n touchedFields['legalAddress.regionCode'] = true;\n touchedFields['legalAddress.countryCode'] = true;\n touchedFields['legalAddress.postcode'] = true;\n touchedFields['legalAddress.telephone'] = true;\n }\n setTouched(touchedFields);\n\n if (!validateForm()) {\n return;\n }\n\n // Check if email has changed and validate availability (only if allowed to edit account)\n if (canEditAccount && formData.email !== company?.email) {\n const emailValidation = await validateCompanyEmail(formData.email);\n if (!emailValidation.isValid) {\n setErrors(prev => ({\n ...prev,\n email: emailValidation.error || translations.emailNotAvailable,\n }));\n return;\n }\n }\n\n if (onSubmit) {\n // Transform form data to match API expectations\n const transformedData: any = {};\n if (canEditAccount) {\n transformedData.name = formData.name;\n transformedData.email = formData.email;\n transformedData.legalName = formData.legalName;\n transformedData.vatTaxId = formData.vatTaxId;\n transformedData.resellerId = formData.resellerId;\n }\n if (canEditAddress) {\n transformedData.legalAddress = {\n street: [formData.legalAddress.street, formData.legalAddress.street2].filter(Boolean),\n city: formData.legalAddress.city,\n region: {\n region: formData.legalAddress.region,\n regionCode: formData.legalAddress.regionCode,\n },\n countryCode: formData.legalAddress.countryCode,\n postcode: formData.legalAddress.postcode,\n telephone: formData.legalAddress.telephone,\n };\n }\n await onSubmit(transformedData);\n }\n };\n\n const handleInputChange = (field: string) => (value: string) => {\n // Permission guard: block changes to forbidden fields even if events fire\n const accountFields = new Set(['name', 'email', 'legalName', 'vatTaxId', 'resellerId']);\n const isAddress = field.startsWith('legalAddress.');\n const isAccount = accountFields.has(field);\n if ((isAccount && !canEditAccount) || (isAddress && !canEditAddress)) {\n return;\n }\n if (field.startsWith('legalAddress.')) {\n const addressField = field.split('.')[1];\n \n // Special handling for country change - reset region when country changes\n if (addressField === 'countryCode') {\n setFormData(prev => ({\n ...prev,\n legalAddress: {\n ...prev.legalAddress,\n [addressField]: value,\n region: '', // Reset region text\n regionCode: '', // Reset region code\n },\n }));\n \n // Clear region errors when country changes\n setErrors(prev => {\n const newErrors = { ...prev };\n delete newErrors['legalAddress.region'];\n delete newErrors['legalAddress.regionCode'];\n return newErrors;\n });\n \n // Clear region touched state when country changes\n setTouched(prev => {\n const newTouched = { ...prev };\n delete newTouched['legalAddress.region'];\n delete newTouched['legalAddress.regionCode'];\n return newTouched;\n });\n } else if (addressField === 'region') {\n // Handle region field (both text input and dropdown use this)\n setFormData(prev => ({\n ...prev,\n legalAddress: {\n ...prev.legalAddress,\n region: value,\n // For text input regions, use the same value for regionCode\n // For dropdown regions, this gets overridden in the handleSelect\n regionCode: hasRegionOptions ? prev.legalAddress.regionCode : value,\n },\n }));\n } else {\n setFormData(prev => ({\n ...prev,\n legalAddress: {\n ...prev.legalAddress,\n [addressField]: value,\n },\n }));\n }\n } else {\n setFormData(prev => ({ ...prev, [field]: value }));\n }\n \n // Clear error when user starts typing\n if (errors[field]) {\n setErrors(prev => {\n const newErrors = { ...prev };\n delete newErrors[field];\n return newErrors;\n });\n }\n };\n\n const handleBlur = (field: string) => {\n // Prevent marking forbidden fields as touched\n const accountFields = new Set(['name', 'email', 'legalName', 'vatTaxId', 'resellerId']);\n const isAddress = field.startsWith('legalAddress.');\n const isAccount = accountFields.has(field);\n if ((isAccount && !canEditAccount) || (isAddress && !canEditAddress)) {\n return;\n }\n setTouched(prev => ({ ...prev, [field]: true }));\n \n let value = '';\n if (field.startsWith('legalAddress.')) {\n const addressField = field.split('.')[1];\n const addressValue = formData.legalAddress[addressField as keyof typeof formData.legalAddress];\n value = typeof addressValue === 'string' ? addressValue : '';\n } else {\n const fieldValue = formData[field as keyof typeof formData];\n value = typeof fieldValue === 'string' ? fieldValue : '';\n }\n \n const error = validateField(field, value);\n \n if (error) {\n setErrors(prev => ({ ...prev, [field]: error }));\n }\n };\n\n return (\n <Card variant=\"secondary\" className={'account-edit-company-profile'}>\n <Header\n title={translations.title}\n divider={false}\n className={'account-edit-company-profile__title'}\n />\n {inLineAlertProps?.text ? (\n <InLineAlert\n className=\"account-edit-company-profile__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n data-testid=\"editCompanyInLineAlert\"\n />\n ) : null}\n <form\n className=\"account-edit-company-profile-form\"\n onSubmit={handleSubmit}\n >\n {canEditAccount && (\n <CompanyAccountFields\n loading={loading}\n value={{\n name: formData.name,\n email: formData.email,\n legalName: formData.legalName,\n vatTaxId: formData.vatTaxId,\n resellerId: formData.resellerId,\n }}\n errors={errors}\n touched={touched}\n onChange={handleInputChange}\n onBlur={handleBlur}\n />\n )}\n\n {/* Legal Address Section */}\n {canEditAddress && (\n <LegalAddressFields\n loading={loading}\n loadingCountries={loadingCountries}\n value={formData.legalAddress}\n errors={errors}\n touched={touched}\n onChange={handleInputChange}\n onBlur={handleBlur}\n countryOptions={countryOptions}\n regionOptions={regionOptions}\n isRegionRequired={isRegionRequired}\n hasRegionOptions={hasRegionOptions}\n />\n )}\n\n <div className=\"account-edit-company-profile__actions\">\n <Button\n disabled={loading}\n // @ts-ignore\n type=\"button\"\n variant=\"secondary\"\n onClick={() => onCancel?.()}\n >\n {translations.cancel}\n </Button>\n <Button disabled={loading || (!canEditAccount && !canEditAddress)} type=\"submit\" variant=\"primary\">\n {translations.save}\n </Button>\n </div>\n </form>\n \n {/* Loading overlay that covers the entire form */}\n {loading && (\n <div \n className=\"account-edit-company-profile__loading-overlay\"\n data-testid=\"editCompanyLoadingOverlay\"\n >\n <ProgressSpinner size=\"large\" />\n <div className=\"account-edit-company-profile__loading-text\">\n {translations.saving}\n </div>\n </div>\n )}\n </Card>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { Skeleton, SkeletonRow, Card } from '@adobe-commerce/elsie/components';\nimport './CompanyLoaders.css';\nimport { classes } from '@adobe-commerce/elsie/lib';\n\nexport const CompanyCardLoader = ({\n testId,\n withCard = true,\n}: {\n testId?: string;\n withCard?: boolean;\n}) => {\n const defaultSkeleton = (\n <Skeleton data-testid={testId || 'companySkeletonLoader'}>\n <SkeletonRow\n variant=\"heading\"\n size=\"xlarge\"\n fullWidth={false}\n lines={1}\n />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n </Skeleton>\n );\n\n if (withCard) {\n return defaultSkeleton;\n }\n\n return (\n <Card\n variant=\"secondary\"\n className={classes([\n 'company-company-loaders',\n 'company-company-loaders--card-loader',\n ])}\n >\n {defaultSkeleton}\n </Card>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\ndeclare global {\n interface Window {\n adobeDataLayer: any[];\n }\n}\n\nenum EventsList {\n EDIT_COMPANY_EVENT = 'edit-company',\n}\n\nconst EVENTS_MAPPING = {\n EDIT_COMPANY_EVENT: EventsList.EDIT_COMPANY_EVENT,\n};\n\n/**\n * Set and return the Adobe Client Data Layer (ACDL)\n * @returns ACDL instance or an empty array if it doesn't exist\n */\nconst getAdobeDataLayer = () => {\n if (!window.adobeDataLayer) {\n window.adobeDataLayer = [];\n }\n return window.adobeDataLayer;\n};\n\n/**\n * Sets a context in the Adobe Client Data Layer (ACDL)\n * @param context - The context object to set\n */\nconst setContext = (context: Record<string, any>) => {\n const adobeDataLayer = getAdobeDataLayer();\n adobeDataLayer.push({\n context,\n });\n};\n\n/**\n * Pushes an event to the Adobe Client Data Layer (ACDL)\n * @param event - The event object to push\n */\nconst pushEvent = (event: Record<string, any>) => {\n const adobeDataLayer = getAdobeDataLayer();\n \n adobeDataLayer.push((acdl: any) => {\n const state = acdl.getState ? acdl.getState() : {};\n \n acdl.push({\n event,\n context: state,\n });\n });\n};\n\n/**\n * Publishes events to the Adobe Client Data Layer (ACDL)\n * @param eventType - The type of event to publish\n * @param eventParams - Parameters associated with the event\n * @returns null if the event type is not recognized\n */\nconst publishEvents = (eventType: string, eventParams: any) => {\n if (!EVENTS_MAPPING[eventType as keyof typeof EVENTS_MAPPING]) {\n return null;\n }\n\n switch (eventType) {\n case EventsList.EDIT_COMPANY_EVENT:\n pushEvent({\n type: 'company',\n eventType: 'edit',\n companyData: eventParams,\n });\n break;\n default:\n return null;\n }\n};\n\nexport { EventsList, publishEvents, pushEvent, setContext };","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { getCompany, updateCompany, getCountries } from '../../api';\nimport { CompanyModel } from '../../data/models';\nimport { Country } from '../../data/models/country';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { EventsList, publishEvents } from '../../lib/acdl';\n\nexport interface UseCompanyProfileProps {\n handleSetInLineAlert?: (alert?: { type: 'success' | 'error'; text: string }) => void;\n}\n\nexport const useCompanyProfile = ({ \n handleSetInLineAlert \n}: UseCompanyProfileProps) => {\n const translations = useText({\n companySuccess: 'Company.CompanyProfile.editCompanyProfile.companySuccess',\n companyError: 'Company.CompanyProfile.editCompanyProfile.companyError',\n loadError: 'Company.CompanyProfile.messages.loadError',\n updateError: 'Company.CompanyProfile.messages.updateError',\n });\n const { companySuccess, companyError, loadError, updateError } = translations;\n\n const [company, setCompany] = useState<CompanyModel | null>(null);\n const [loading, setLoading] = useState<boolean>(true);\n const [submitLoading, setSubmitLoading] = useState<boolean>(false);\n const [showEditForm, setShowEditForm] = useState<boolean>(false);\n const [countries, setCountries] = useState<Country[]>([]);\n const [inputChange, setInputChange] = useState<Record<string, string | number | boolean>>({});\n const [createdAt, setCreatedAt] = useState<string>('');\n\n // Keep stable references to avoid re-creating callbacks/effects and double fetch\n const alertFnRef = useRef<UseCompanyProfileProps['handleSetInLineAlert']>(handleSetInLineAlert);\n const inFlightRef = useRef<boolean>(false);\n const didInitialFetchRef = useRef<boolean>(false);\n useEffect(() => {\n alertFnRef.current = handleSetInLineAlert;\n }, [handleSetInLineAlert]);\n\n const handleInputChange = useCallback(\n (value: Record<string, string | number | boolean>) => {\n setInputChange(value);\n },\n []\n );\n\n const renderAlertMessage = useCallback(\n (type: 'success' | 'error', message?: string) => {\n if (!handleSetInLineAlert) return;\n\n if (type === 'success') {\n handleSetInLineAlert({\n type: 'success',\n text: message ?? companySuccess,\n });\n } else if (type === 'error') {\n handleSetInLineAlert({\n type: 'error',\n text: message ?? companyError,\n });\n } else {\n handleSetInLineAlert();\n }\n\n setSubmitLoading(false);\n },\n [handleSetInLineAlert, companySuccess, companyError]\n );\n\n const fetchCompany = useCallback(() => {\n if (inFlightRef.current) {\n return;\n }\n inFlightRef.current = true;\n setLoading(true);\n \n getCompany()\n .then((companyData: CompanyModel | null) => {\n if (companyData) {\n setCompany(companyData);\n setCreatedAt('');\n }\n setLoading(false);\n })\n .catch((error) => {\n console.error('Failed to load company:', error);\n setLoading(false);\n // Use stable ref to avoid changing dependencies\n if (alertFnRef.current) {\n alertFnRef.current({ type: 'error', text: loadError });\n }\n })\n .finally(() => {\n inFlightRef.current = false;\n });\n }, [loadError]);\n\n useEffect(() => {\n if (!didInitialFetchRef.current) {\n didInitialFetchRef.current = true;\n fetchCompany();\n }\n // Intentionally depend only on loadError through fetchCompany to avoid re-fetching on alert changes\n }, [fetchCompany]);\n\n useEffect(() => {\n getCountries().then((countriesResponse) => {\n setCountries(countriesResponse.availableCountries);\n }).catch((error) => {\n console.error('Failed to load countries:', error);\n });\n }, []);\n\n const handleShowEditForm = useCallback(() => {\n setShowEditForm(true);\n renderAlertMessage('success', ''); // Clear any existing alerts\n setInputChange({});\n }, [renderAlertMessage]);\n\n const handleHideEditForm = useCallback((clearStates?: () => void) => {\n clearStates?.();\n setShowEditForm(false);\n setInputChange({});\n }, []);\n\n const handleUpdateCompany = useCallback(async (data: Partial<CompanyModel>) => {\n try {\n setSubmitLoading(true);\n \n if (!data) {\n renderAlertMessage('error', 'No data to update');\n return;\n }\n \n const updatedCompany = await updateCompany(data as any);\n \n // Permissions are now correctly set by transformCompany based on role data\n \n setCompany(updatedCompany);\n setShowEditForm(false);\n setInputChange({});\n \n renderAlertMessage('success');\n \n // Publish analytics event\n publishEvents(EventsList.EDIT_COMPANY_EVENT, {\n ...data,\n companyId: company?.id,\n });\n \n // No need to refresh - updateCompany already returns complete updated data\n \n } catch (error: any) {\n console.error('Failed to update company:', error);\n renderAlertMessage('error', error.message || updateError);\n } finally {\n setSubmitLoading(false);\n }\n }, [company, renderAlertMessage, updateError]);\n\n return {\n // Core data\n company,\n countries,\n createdAt,\n \n // Loading states\n loading,\n submitLoading,\n \n // UI states\n showEditForm,\n \n // Form data\n inputChange,\n \n // Actions\n handleShowEditForm,\n handleHideEditForm,\n handleUpdateCompany,\n handleInputChange,\n renderAlertMessage,\n \n // Legacy support (deprecated - use submitLoading instead)\n saving: submitLoading,\n };\n};\n","import * as React from \"react\";\nconst SvgWarning = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Warning_Base\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_841_1324)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_841_1324\" }, /* @__PURE__ */ React.createElement(\"rect\", { width: 24, height: 21, fill: \"white\", transform: \"translate(0 1.5)\" }))));\nexport default SvgWarning;\n","import * as React from \"react\";\nconst SvgCheckWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.75 12.762L10.2385 15.75L17.25 9\", stroke: \"currentColor\" }));\nexport default SvgCheckWithCircle;\n","import * as React from \"react\";\nconst SvgWarningWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z\", stroke: \"currentColor\" }));\nexport default SvgWarningWithCircle;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { useState, useCallback, useEffect } from 'preact/hooks';\nimport { InLineAlertProps } from '../types/companyProfile.types';\nimport {\n CheckWithCircle as Success,\n Warning,\n WarningWithCircle as Error,\n} from '@adobe-commerce/elsie/icons';\n\nexport type AlertType = 'success' | 'warning' | 'error';\n\nexport interface AlertOptions {\n type: AlertType;\n text: string;\n autoHide?: boolean;\n autoHideDelay?: number;\n}\n\nexport interface UseInLineAlertReturn {\n inLineAlertProps: InLineAlertProps;\n handleSetInLineAlert: (notification?: AlertOptions) => void;\n clearAlert: () => void;\n showSuccess: (text: string, autoHide?: boolean) => void;\n showWarning: (text: string, autoHide?: boolean) => void;\n showError: (text: string, autoHide?: boolean) => void;\n}\n\nconst iconsList = {\n success: <Success />,\n warning: <Warning />,\n error: <Error />,\n};\n\nexport const useInLineAlert = (): UseInLineAlertReturn => {\n const [inLineAlertProps, setInLineAlertProps] = useState<InLineAlertProps>({});\n const [autoHideTimer, setAutoHideTimer] = useState<ReturnType<typeof setTimeout> | null>(null);\n\n const clearAlert = useCallback(() => {\n setInLineAlertProps({});\n if (autoHideTimer) {\n clearTimeout(autoHideTimer);\n setAutoHideTimer(null);\n }\n }, [autoHideTimer]);\n\n const handleSetInLineAlert = useCallback(\n (notification?: AlertOptions) => {\n // Clear existing timer\n if (autoHideTimer) {\n clearTimeout(autoHideTimer);\n setAutoHideTimer(null);\n }\n\n if (!notification?.type) {\n setInLineAlertProps({});\n return;\n }\n\n const icon = iconsList[notification.type];\n\n setInLineAlertProps({\n type: notification.type,\n text: notification.text,\n icon,\n });\n\n // Auto-hide if requested\n if (notification.autoHide !== false) {\n const delay = notification.autoHideDelay || (notification.type === 'success' ? 3000 : 5000);\n const timer = setTimeout(() => {\n setInLineAlertProps({});\n setAutoHideTimer(null);\n }, delay);\n setAutoHideTimer(timer);\n }\n },\n [autoHideTimer]\n );\n\n const showSuccess = useCallback(\n (text: string, autoHide: boolean = true) => {\n handleSetInLineAlert({ type: 'success', text, autoHide });\n },\n [handleSetInLineAlert]\n );\n\n const showWarning = useCallback(\n (text: string, autoHide: boolean = false) => {\n handleSetInLineAlert({ type: 'warning', text, autoHide });\n },\n [handleSetInLineAlert]\n );\n\n const showError = useCallback(\n (text: string, autoHide: boolean = false) => {\n handleSetInLineAlert({ type: 'error', text, autoHide });\n },\n [handleSetInLineAlert]\n );\n\n // Cleanup timer on unmount\n useEffect(() => {\n return () => {\n if (autoHideTimer) {\n clearTimeout(autoHideTimer);\n }\n };\n }, [autoHideTimer]);\n\n return {\n inLineAlertProps,\n handleSetInLineAlert,\n clearAlert,\n showSuccess,\n showWarning,\n showError,\n };\n};\n\nexport default useInLineAlert;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { Header } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { CompanyProfileCard } from '../../components/CompanyProfileCard';\nimport { EditCompanyProfile } from '../../components/EditCompanyProfile';\nimport { CompanyCardLoader } from '../../components/CompanyLoaders';\nimport { useCompanyProfile } from '../../hooks/containers/useCompanyProfile';\nimport { useInLineAlert } from '../../hooks/useInLineAlert';\nimport { CompanyProfileProps } from '../../types/companyProfile.types';\n\nexport const CompanyProfile: Container<CompanyProfileProps> = ({\n className,\n withHeader = true,\n slots,\n}) => {\n const translations = useText({\n containerTitle: 'Company.CompanyProfile.containerTitle',\n });\n const { inLineAlertProps, handleSetInLineAlert } = useInLineAlert();\n const {\n company,\n loading,\n saving,\n showEditForm,\n handleShowEditForm,\n handleHideEditForm,\n handleUpdateCompany,\n } = useCompanyProfile({ handleSetInLineAlert });\n\n if (loading)\n return (\n <div data-testid=\"companyProfileLoader\">\n <CompanyCardLoader withCard />\n </div>\n );\n\n return (\n <div className={classes(['account-company-profile', className])}>\n {withHeader ? (\n <Header\n title={translations.containerTitle}\n divider={false}\n className={'company-profile__title'}\n />\n ) : null}\n <CompanyProfileCard\n company={company}\n slots={slots}\n showEditForm={showEditForm}\n handleShowEditForm={handleShowEditForm}\n />\n {showEditForm ? (\n <EditCompanyProfile\n inLineAlertProps={inLineAlertProps}\n company={company}\n loading={saving}\n onSubmit={handleUpdateCompany}\n onCancel={handleHideEditForm}\n />\n ) : null}\n </div>\n );\n};\n"],"names":["CompanyProfileCard","company","slots","showEditForm","handleShowEditForm","translations","useText","jsx","Card","perms","companyData","classes","jsxs","Button","Default","Fragment","el","index","value","_a","line","i","_b","m","Slot","useCountries","selectedCountryCode","countriesData","setCountriesData","useState","loadingCountries","setLoadingCountries","useEffect","isMounted","getCountries","availableCountries","countriesWithRequiredRegion","optionalZipCountries","countryOptions","useMemo","regionOptions","selectedCountry","country","region","isRegionRequired","hasRegionOptions","CompanyAccountFields","loading","errors","touched","onChange","onBlur","namePrefix","fieldPathPrefix","prefix","path","f","Field","Input","LegalAddressFields","requiredConfig","names","paths","isRequired","Picker","event","target","r","regionCode","regionName","EditCompanyProfile","inLineAlertProps","onSubmit","onCancel","formData","setFormData","_d","_c","_e","_g","_f","_i","_h","_j","_k","_l","setErrors","setTouched","canEditAccount","_m","canEditAddress","_n","validateField","name","validateForm","newErrors","isValid","nameError","emailError","streetError","cityError","postcodeError","telephoneError","countryError","regionError","handleSubmit","touchedFields","emailValidation","validateCompanyEmail","prev","transformedData","handleInputChange","field","accountFields","isAddress","addressField","newTouched","handleBlur","addressValue","fieldValue","error","Header","InLineAlert","ProgressSpinner","CompanyCardLoader","testId","withCard","defaultSkeleton","Skeleton","SkeletonRow","EventsList","EVENTS_MAPPING","getAdobeDataLayer","pushEvent","acdl","state","publishEvents","eventType","eventParams","useCompanyProfile","handleSetInLineAlert","companySuccess","companyError","loadError","updateError","setCompany","setLoading","submitLoading","setSubmitLoading","setShowEditForm","countries","setCountries","inputChange","setInputChange","createdAt","setCreatedAt","alertFnRef","useRef","inFlightRef","didInitialFetchRef","useCallback","renderAlertMessage","type","message","fetchCompany","getCompany","countriesResponse","handleHideEditForm","clearStates","handleUpdateCompany","data","updatedCompany","updateCompany","SvgWarning","props","React","SvgCheckWithCircle","SvgWarningWithCircle","iconsList","Success","Warning","Error","useInLineAlert","setInLineAlertProps","autoHideTimer","setAutoHideTimer","clearAlert","notification","icon","delay","timer","showSuccess","text","autoHide","showWarning","showError","CompanyProfile","className","withHeader","saving"],"mappings":"grBAuBO,MAAMA,GAAiE,CAAC,CAC7E,QAAAC,EACA,MAAAC,EACA,aAAAC,EACA,mBAAAC,CACF,IAAM,CACJ,MAAMC,EAAeC,EAAQ,CAC3B,WAAY,8BACZ,cAAe,0DACf,YAAa,oCACb,MAAO,8BACP,UAAW,kCACX,SAAU,iCACV,WAAY,mCACZ,aAAc,qCACd,SAAU,qDACV,qBAAsB,iEACtB,oBAAqB,gEACrB,mBAAoB,+DACp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C,iBAAAC,EACA,QAAAtE,EACA,QAASsM,EACT,SAAU9B,EACV,SAAUF,CAAA,CAAA,EAEV,IAAA,EACN,CAEJ","x_google_ignoreList":[8,9,10]}
1
+ {"version":3,"file":"CompanyProfile.js","sources":["/@dropins/storefront-company-management/src/components/CompanyProfileCard/CompanyProfileCard.tsx","/@dropins/storefront-company-management/src/hooks/useCountries.ts","/@dropins/storefront-company-management/src/components/EditCompanyProfile/CompanyAccountFields.tsx","/@dropins/storefront-company-management/src/components/EditCompanyProfile/LegalAddressFields.tsx","/@dropins/storefront-company-management/src/components/EditCompanyProfile/EditCompanyProfile.tsx","/@dropins/storefront-company-management/src/components/CompanyLoaders/CompanyLoaders.tsx","/@dropins/storefront-company-management/src/lib/acdl.ts","/@dropins/storefront-company-management/src/hooks/containers/useCompanyProfile.tsx","../../node_modules/@adobe-commerce/elsie/src/icons/Warning.svg","../../node_modules/@adobe-commerce/elsie/src/icons/CheckWithCircle.svg","../../node_modules/@adobe-commerce/elsie/src/icons/WarningWithCircle.svg","/@dropins/storefront-company-management/src/hooks/useInLineAlert.tsx","/@dropins/storefront-company-management/src/containers/CompanyProfile/CompanyProfile.tsx"],"sourcesContent":["/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { FunctionComponent } from 'preact';\nimport { Card, Button } from '@adobe-commerce/elsie/components';\nimport { classes, Slot } from '@adobe-commerce/elsie/lib';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { CompanyProfileCardProps } from '../../types/companyProfile.types';\nimport './CompanyProfileCard.css';\n\nexport const CompanyProfileCard: FunctionComponent<CompanyProfileCardProps> = ({\n company,\n slots,\n showEditForm,\n handleShowEditForm,\n}) => {\n const translations = useText({\n editButton: 'Company.shared.buttons.edit',\n noDataMessage: 'Company.CompanyProfile.companyProfileCard.noDataMessage',\n companyName: 'Company.shared.fields.companyName',\n email: 'Company.shared.fields.email',\n legalName: 'Company.shared.fields.legalName',\n vatTaxId: 'Company.shared.fields.vatTaxId',\n resellerId: 'Company.shared.fields.resellerId',\n legalAddress: 'Company.shared.fields.legalAddress',\n contacts: 'Company.CompanyProfile.companyProfileCard.contacts',\n companyAdministrator: 'Company.CompanyProfile.companyProfileCard.companyAdministrator',\n salesRepresentative: 'Company.CompanyProfile.companyProfileCard.salesRepresentative',\n paymentInformation: 'Company.CompanyProfile.companyProfileCard.paymentInformation',\n shippingInformation: 'Company.CompanyProfile.companyProfileCard.shippingInformation',\n availablePaymentMethods: 'Company.CompanyProfile.companyProfileCard.availablePaymentMethods',\n availableShippingMethods: 'Company.CompanyProfile.companyProfileCard.availableShippingMethods',\n noPaymentMethods: 'Company.CompanyProfile.companyProfileCard.noPaymentMethods',\n noShippingMethods: 'Company.CompanyProfile.companyProfileCard.noShippingMethods',\n });\n \n if (!company) {\n return (\n <Card variant=\"secondary\" className=\"account-company-profile-card\">\n <div className=\"account-company-profile-card__wrapper\">\n <div className=\"account-company-profile-card__content\">\n <div className=\"account-company-profile-card__no-data\">\n <p>{translations.noDataMessage}</p>\n </div>\n </div>\n </div>\n </Card>\n );\n }\n\n const perms = company.permissionsFlags || {\n canViewAccount: true,\n canEditAccount: false,\n canViewAddress: true,\n canEditAddress: false,\n canViewContacts: true,\n canViewPaymentInformation: true,\n canViewShippingInformation: true,\n };\n\n const companyData = [\n perms.canViewAccount ? { name: 'name', label: translations.companyName, value: company.name || '' } : null,\n perms.canViewAccount ? { name: 'email', label: translations.email, value: company.email || '' } : null,\n perms.canViewAccount ? { name: 'legalName', label: translations.legalName, value: company.legalName || '' } : null,\n perms.canViewAccount ? { name: 'vatTaxId', label: translations.vatTaxId, value: company.vatTaxId || '' } : null,\n perms.canViewAccount ? { name: 'resellerId', label: translations.resellerId, value: company.resellerId || '' } : null,\n ].filter(Boolean) as { name: string; label: string; value: string }[];\n\n return (\n <Card\n variant=\"secondary\"\n className={classes([\n 'account-company-profile-card',\n [\n 'account-company-profile-card-short',\n showEditForm,\n ],\n ])}\n >\n <div className=\"account-company-profile-card__wrapper\">\n <div className=\"account-company-profile-card__actions\">\n {(company.canEditAccount || company.canEditAddress) && (\n <Button\n // @ts-ignore\n type=\"button\"\n variant=\"tertiary\"\n onClick={handleShowEditForm}\n >\n {translations.editButton}\n </Button>\n )}\n </div>\n <div className=\"account-company-profile-card__content\">\n {(() => {\n const Default = (\n <>\n {companyData.map((el, index) => {\n if (!el.value) return null;\n const value = !el.label\n ? el.value\n : `${el.label}: ${el.value}`;\n\n return (\n <p\n key={`${el.name}_${index}`}\n data-testid={`${el.name}_${index}`}\n >\n {value}\n </p>\n );\n })}\n\n {perms.canViewAddress && company.legalAddress && (\n <div className=\"company-legal-address\">\n <p><strong>{translations.legalAddress}:</strong></p>\n {company.legalAddress.street?.map((line: string, i: number) => (\n <p key={i}>{line}</p>\n ))}\n <p>\n {company.legalAddress.city}, {company.legalAddress.region?.region} {company.legalAddress.postcode}\n </p>\n <p>{company.legalAddress.countryCode}</p>\n {company.legalAddress.telephone && (\n <p>Phone: {company.legalAddress.telephone}</p>\n )}\n </div>\n )}\n\n {perms.canViewContacts && (company.companyAdmin || company.salesRepresentative) && (\n <div className=\"company-contacts\">\n <p><strong>{translations.contacts}:</strong></p>\n \n {company.companyAdmin && (\n <div className=\"company-contact\">\n <p><strong>{translations.companyAdministrator}:</strong></p>\n <p>{company.companyAdmin.firstname} {company.companyAdmin.lastname}</p>\n {company.companyAdmin.jobTitle && <p>{company.companyAdmin.jobTitle}</p>}\n <p>{company.companyAdmin.email}</p>\n </div>\n )}\n\n {company.salesRepresentative && (\n <div className=\"company-contact\">\n <p><strong>{translations.salesRepresentative}:</strong></p>\n <p>{company.salesRepresentative.firstname} {company.salesRepresentative.lastname}</p>\n <p>{company.salesRepresentative.email}</p>\n </div>\n )}\n </div>\n )}\n\n {perms.canViewPaymentInformation && (\n <div className=\"company-payment-methods\">\n <p><strong>{translations.paymentInformation}:</strong></p>\n {company.availablePaymentMethods && company.availablePaymentMethods.length > 0 ? (\n <>\n <p><strong>{translations.availablePaymentMethods}:</strong></p>\n <ul className=\"payment-methods-list\">\n {company.availablePaymentMethods.map((m, index) => (\n <li key={`payment_${index}`}>{m.title}</li>\n ))}\n </ul>\n </>\n ) : (\n <div className=\"message message-notice notice\">\n <div>{translations.noPaymentMethods}</div>\n </div>\n )}\n </div>\n )}\n\n {perms.canViewShippingInformation && (\n <div className=\"company-shipping-methods\">\n <p><strong>{translations.shippingInformation}:</strong></p>\n {company.availableShippingMethods && company.availableShippingMethods.length > 0 ? (\n <>\n <p><strong>{translations.availableShippingMethods}:</strong></p>\n <ul className=\"shipping-methods-list\">\n {company.availableShippingMethods.map((m, index) => (\n <li key={`shipping_${index}`}>{m.title}</li>\n ))}\n </ul>\n </>\n ) : (\n <div className=\"message message-notice notice\">\n <div>{translations.noShippingMethods}</div>\n </div>\n )}\n </div>\n )}\n </>\n );\n if (slots?.CompanyData) {\n return (\n <Slot name=\"CompanyData\" slot={slots.CompanyData} context={{ companyData, Default }} />\n );\n }\n return Default;\n })()}\n </div>\n </div>\n </Card>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { useEffect, useMemo, useState } from 'preact/hooks';\nimport { getCountries } from '../api';\nimport type { Country } from '../data/models';\n\ninterface UseCountriesResult {\n countryOptions: Country[];\n regionOptions: { text: string; value: string }[];\n isRegionRequired: boolean;\n hasRegionOptions: boolean;\n loadingCountries: boolean;\n}\n\nexport const useCountries = (selectedCountryCode: string | undefined): UseCountriesResult => {\n const [countriesData, setCountriesData] = useState<{\n availableCountries: Country[];\n countriesWithRequiredRegion: string[];\n optionalZipCountries: string[];\n } | null>(null);\n const [loadingCountries, setLoadingCountries] = useState<boolean>(true);\n\n useEffect(() => {\n let isMounted = true;\n getCountries()\n .then(({ availableCountries, countriesWithRequiredRegion, optionalZipCountries }) => {\n if (!isMounted) return;\n setCountriesData({ availableCountries, countriesWithRequiredRegion, optionalZipCountries });\n setLoadingCountries(false);\n })\n .catch(() => {\n if (!isMounted) return;\n setLoadingCountries(false);\n });\n return () => {\n isMounted = false;\n };\n }, []);\n\n const countryOptions = useMemo(() => {\n return countriesData?.availableCountries || [];\n }, [countriesData]);\n\n const regionOptions = useMemo(() => {\n if (!selectedCountryCode || !countriesData) return [] as { text: string; value: string }[];\n const selectedCountry = countriesData.availableCountries.find((country) => country.value === selectedCountryCode);\n if (!selectedCountry?.availableRegions || selectedCountry.availableRegions.length === 0) return [];\n return selectedCountry.availableRegions.map((region) => ({ text: region.name, value: `${region.code},${region.id}` }));\n }, [selectedCountryCode, countriesData]);\n\n const isRegionRequired = useMemo(() => {\n if (!selectedCountryCode || !countriesData) return false;\n return countriesData.countriesWithRequiredRegion.includes(selectedCountryCode);\n }, [selectedCountryCode, countriesData]);\n\n const hasRegionOptions = useMemo(() => regionOptions.length > 0, [regionOptions]);\n\n return {\n countryOptions,\n regionOptions,\n isRegionRequired,\n hasRegionOptions,\n loadingCountries,\n };\n};\n\n\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { FunctionComponent } from 'preact';\nimport { Field, Input } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\ninterface CompanyAccountFieldsProps {\n loading?: boolean;\n value: {\n name: string;\n email: string;\n legalName: string;\n vatTaxId: string;\n resellerId: string;\n };\n errors: Record<string, string>;\n touched: Record<string, boolean>;\n onChange: (field: string) => (value: string) => void;\n onBlur: (field: string) => void;\n /** Optional input name prefix for DOM names (defaults to none) */\n namePrefix?: string;\n /** Optional field path prefix used for change/blur handlers (defaults to none) */\n fieldPathPrefix?: string;\n}\n\nexport const CompanyAccountFields: FunctionComponent<CompanyAccountFieldsProps> = ({\n loading,\n value,\n errors,\n touched,\n onChange,\n onBlur,\n namePrefix = '',\n fieldPathPrefix = '',\n}) => {\n const translations = useText({\n companyName: 'Company.shared.fields.companyName',\n email: 'Company.shared.fields.email',\n legalName: 'Company.shared.fields.legalName',\n vatTaxId: 'Company.shared.fields.vatTaxId',\n resellerId: 'Company.shared.fields.resellerId',\n });\n const prefix = namePrefix ? `${namePrefix}_` : '';\n const path = (f: string) => (fieldPathPrefix ? `${fieldPathPrefix}.${f}` : f);\n return (\n <div className=\"account-edit-company-profile-form__group\">\n <Field \n label={translations.companyName} \n required\n className=\"account-edit-company-profile-form__field\"\n error={touched.name && errors.name ? errors.name : undefined}\n >\n <Input\n name={`${prefix}name`}\n type=\"text\"\n value={value.name}\n onValue={onChange(path('name'))}\n onBlur={() => onBlur(path('name'))}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field \n label={translations.email} \n required\n className=\"account-edit-company-profile-form__field\"\n error={touched.email && errors.email ? errors.email : undefined}\n >\n <Input\n name={`${prefix}email`}\n type=\"email\"\n value={value.email}\n onValue={onChange(path('email'))}\n onBlur={() => onBlur(path('email'))}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field label={translations.legalName} className=\"account-edit-company-profile-form__field\">\n <Input\n name={`${prefix}legalName`}\n type=\"text\"\n value={value.legalName}\n onValue={onChange(path('legalName'))}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field label={translations.vatTaxId} className=\"account-edit-company-profile-form__field\">\n <Input\n name={`${prefix}vatTaxId`}\n type=\"text\"\n value={value.vatTaxId}\n onValue={onChange(path('vatTaxId'))}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field label={translations.resellerId} className=\"account-edit-company-profile-form__field\">\n <Input\n name={`${prefix}resellerId`}\n type=\"text\"\n value={value.resellerId}\n onValue={onChange(path('resellerId'))}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n </div>\n );\n};\n\nexport default CompanyAccountFields;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { FunctionComponent } from 'preact';\nimport { Field, Input, Picker } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\n\ninterface LegalAddressFieldsProps {\n loading?: boolean;\n loadingCountries: boolean;\n value: {\n street: string;\n street2: string;\n city: string;\n region: string;\n regionCode: string;\n countryCode: string;\n postcode: string;\n telephone: string;\n };\n errors: Record<string, string>;\n touched: Record<string, boolean>;\n onChange: (field: string) => (value: string) => void;\n onBlur: (field: string) => void;\n countryOptions: { text: string; value: string }[];\n regionOptions: { text: string; value: string }[];\n isRegionRequired: boolean;\n hasRegionOptions: boolean;\n /**\n * Optional input name prefix for DOM names (defaults to 'legal_address')\n */\n namePrefix?: string;\n /**\n * Optional field path prefix used for change/blur handlers (defaults to 'legal_address')\n */\n fieldPathPrefix?: string;\n /**\n * Optional per-field required overrides for non-edit flows\n */\n requiredConfig?: Partial<{\n street: boolean;\n city: boolean;\n postcode: boolean;\n telephone: boolean;\n }>;\n}\n\nexport const LegalAddressFields: FunctionComponent<LegalAddressFieldsProps> = ({\n loading,\n loadingCountries,\n value,\n errors,\n touched,\n onChange,\n onBlur,\n countryOptions,\n regionOptions,\n isRegionRequired,\n hasRegionOptions,\n namePrefix = 'legalAddress',\n fieldPathPrefix = 'legalAddress',\n requiredConfig,\n}) => {\n const translations = useText({\n legalAddress: 'Company.shared.fields.legalAddress',\n streetAddress: 'Company.shared.fields.streetAddress',\n city: 'Company.shared.fields.city',\n country: 'Company.shared.fields.country',\n stateProvince: 'Company.shared.fields.stateProvince',\n zipPostalCode: 'Company.shared.fields.zipPostalCode',\n phoneNumber: 'Company.shared.fields.phoneNumber',\n });\n const names = {\n street: `${namePrefix}_street`,\n street2: `${namePrefix}_street2`,\n city: `${namePrefix}_city`,\n countryCode: `${namePrefix}_countryCode`,\n region: `${namePrefix}_region`,\n postcode: `${namePrefix}_postcode`,\n telephone: `${namePrefix}_telephone`,\n } as const;\n\n const paths = {\n street: `${fieldPathPrefix}.street`,\n street2: `${fieldPathPrefix}.street2`,\n city: `${fieldPathPrefix}.city`,\n countryCode: `${fieldPathPrefix}.countryCode`,\n region: `${fieldPathPrefix}.region`,\n regionCode: `${fieldPathPrefix}.regionCode`,\n postcode: `${fieldPathPrefix}.postcode`,\n telephone: `${fieldPathPrefix}.telephone`,\n } as const;\n\n const isRequired = {\n street: requiredConfig?.street ?? true,\n city: requiredConfig?.city ?? true,\n postcode: requiredConfig?.postcode ?? true,\n telephone: requiredConfig?.telephone ?? true,\n } as const;\n\n return (\n <div className=\"account-edit-company-profile-form__section\">\n <h3 className=\"account-edit-company-profile-form__section-title\">{translations.legalAddress}</h3>\n\n <Field \n label={translations.streetAddress} \n required={isRequired.street}\n className=\"account-edit-company-profile-form__field\"\n error={touched[paths.street] && errors[paths.street] ? errors[paths.street] : undefined}\n >\n <Input\n name={names.street}\n type=\"text\"\n value={value.street}\n onValue={onChange(paths.street)}\n onBlur={() => onBlur(paths.street)}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field \n label={`${translations.streetAddress} 2`} \n className=\"account-edit-company-profile-form__field\"\n >\n <Input\n name={names.street2}\n type=\"text\"\n value={value.street2}\n onValue={onChange(paths.street2)}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field \n label={translations.city} \n required={isRequired.city}\n className=\"account-edit-company-profile-form__field\"\n error={touched[paths.city] && errors[paths.city] ? errors[paths.city] : undefined}\n >\n <Input\n name={names.city}\n type=\"text\"\n value={value.city}\n onValue={onChange(paths.city)}\n onBlur={() => onBlur(paths.city)}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field \n label={translations.country} \n required\n className=\"account-edit-company-profile-form__field\"\n error={touched[paths.countryCode] && errors[paths.countryCode] ? errors[paths.countryCode] : undefined}\n >\n <Picker\n name={names.countryCode}\n floatingLabel={`${translations.country} *`}\n placeholder={translations.country}\n options={countryOptions}\n value={value.countryCode}\n handleSelect={(event: Event) => {\n const target = event.target as HTMLSelectElement;\n onChange(paths.countryCode)(target.value);\n }}\n onBlur={() => onBlur(paths.countryCode)}\n disabled={!!loading || loadingCountries}\n />\n </Field>\n\n <Field \n label={translations.stateProvince} \n required={isRegionRequired}\n className=\"account-edit-company-profile-form__field\"\n error={touched['legalAddress.region'] && errors['legalAddress.region'] ? errors['legalAddress.region'] : undefined}\n >\n {hasRegionOptions ? (\n <Picker\n key={`region_picker_${value.countryCode}`}\n name=\"legalAddress_region\"\n floatingLabel={`${translations.stateProvince} ${isRegionRequired ? '*' : ''}`}\n placeholder={translations.stateProvince}\n options={regionOptions}\n value={value.regionCode ? (regionOptions.find(r => r.value.split(',')[0] === value.regionCode)?.value || '') : ''}\n handleSelect={(event: Event) => {\n const target = event.target as HTMLSelectElement;\n const [regionCode] = target.value.split(',');\n const regionName = regionOptions.find(r => r.value === target.value)?.text || '';\n onChange(paths.region)(regionName);\n onChange(paths.regionCode)(regionCode);\n }}\n onBlur={() => onBlur(paths.region)}\n disabled={!!loading || loadingCountries}\n />\n ) : (\n <Input\n key={`region_input_${value.countryCode}`}\n name={names.region}\n type=\"text\"\n value={value.region}\n onValue={onChange(paths.region)}\n onBlur={() => onBlur(paths.region)}\n disabled={!!loading || loadingCountries}\n variant=\"primary\"\n size=\"medium\"\n />\n )}\n </Field>\n\n <Field \n label={translations.zipPostalCode} \n required={isRequired.postcode}\n className=\"account-edit-company-profile-form__field\"\n error={touched[paths.postcode] && errors[paths.postcode] ? errors[paths.postcode] : undefined}\n >\n <Input\n name={names.postcode}\n type=\"text\"\n value={value.postcode}\n onValue={onChange(paths.postcode)}\n onBlur={() => onBlur(paths.postcode)}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n\n <Field \n label={translations.phoneNumber} \n required={isRequired.telephone}\n className=\"account-edit-company-profile-form__field\"\n error={touched[paths.telephone] && errors[paths.telephone] ? errors[paths.telephone] : undefined}\n >\n <Input\n name={names.telephone}\n type=\"tel\"\n value={value.telephone}\n onValue={onChange(paths.telephone)}\n onBlur={() => onBlur(paths.telephone)}\n disabled={!!loading}\n variant=\"primary\"\n size=\"medium\"\n />\n </Field>\n </div>\n );\n};\n\nexport default LegalAddressFields;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { FunctionComponent } from 'preact';\nimport { useState } from 'preact/hooks';\nimport {\n Button,\n Card,\n Header,\n InLineAlert,\n ProgressSpinner,\n} from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { validateCompanyEmail } from '../../api';\nimport { EditCompanyProfileProps } from '../../types/companyProfile.types';\nimport './EditCompanyProfile.css';\nimport { useCountries } from '../../hooks/useCountries';\nimport { CompanyAccountFields } from './CompanyAccountFields';\nimport { LegalAddressFields } from './LegalAddressFields';\n\nexport const EditCompanyProfile: FunctionComponent<EditCompanyProfileProps> = ({\n inLineAlertProps,\n company,\n loading = false,\n onSubmit,\n onCancel,\n}) => {\n const translations = useText({\n title: 'Company.EditCompanyProfile.title',\n cancel: 'Company.shared.buttons.cancel',\n save: 'Company.shared.buttons.save',\n saving: 'Company.shared.buttons.saving',\n required: 'Company.shared.validation.required',\n invalidEmail: 'Company.shared.validation.invalidEmail',\n companyNameRequired: 'Company.shared.validation.companyNameRequired',\n emailRequired: 'Company.shared.validation.emailRequired',\n emailNotAvailable: 'Company.shared.validation.emailNotAvailable',\n });\n \n const [formData, setFormData] = useState({\n name: company?.name || '',\n email: company?.email || '',\n legalName: company?.legalName || '',\n vatTaxId: company?.vatTaxId || '',\n resellerId: company?.resellerId || '',\n legalAddress: {\n street: company?.legalAddress?.street?.[0] || '',\n street2: company?.legalAddress?.street?.[1] || '',\n city: company?.legalAddress?.city || '',\n region: company?.legalAddress?.region?.region || '',\n regionCode: company?.legalAddress?.region?.regionCode || '',\n countryCode: company?.legalAddress?.countryCode || '',\n postcode: company?.legalAddress?.postcode || '',\n telephone: company?.legalAddress?.telephone || '',\n },\n });\n\n const [errors, setErrors] = useState<Record<string, string>>({});\n const [touched, setTouched] = useState<Record<string, boolean>>({});\n\n // Permission flags for editing\n // Strictly gate by granular permissions; do not fallback to overall canEdit here\n const canEditAccount = company?.permissionsFlags?.canEditAccount === true;\n const canEditAddress = company?.permissionsFlags?.canEditAddress === true;\n \n // Country and region data via hook\n const {\n countryOptions,\n regionOptions,\n isRegionRequired,\n hasRegionOptions,\n loadingCountries,\n } = useCountries(formData.legalAddress.countryCode);\n\n // Validation functions\n const validateField = (name: string, value: string): string | null => {\n if (name === 'name') {\n if (!value.trim()) return translations.companyNameRequired;\n return null;\n }\n if (name === 'email') {\n if (!value.trim()) return translations.emailRequired;\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n if (!emailRegex.test(value)) return translations.invalidEmail;\n return null;\n }\n if (\n name === 'legalAddress.street' ||\n name === 'legalAddress.city' ||\n name === 'legalAddress.postcode' ||\n name === 'legalAddress.telephone' ||\n name === 'legalAddress.countryCode'\n ) {\n if (!value.trim()) return translations.required;\n return null;\n }\n if (name === 'legalAddress.region') {\n if (isRegionRequired && !value.trim()) return translations.required;\n return null;\n }\n return null;\n };\n\n const validateForm = (): boolean => {\n const newErrors: Record<string, string> = {};\n let isValid = true;\n\n // Determine permissions for editing\n const canEditAccount = company?.permissionsFlags?.canEditAccount === true;\n const canEditAddress = company?.permissionsFlags?.canEditAddress === true;\n\n // Validate required account fields only if editing account is allowed\n if (canEditAccount) {\n const nameError = validateField('name', formData.name);\n if (nameError) {\n newErrors.name = nameError;\n isValid = false;\n }\n\n const emailError = validateField('email', formData.email);\n if (emailError) {\n newErrors.email = emailError;\n isValid = false;\n }\n }\n\n // Validate required address fields only if editing address is allowed\n if (canEditAddress) {\n const streetError = validateField('legalAddress.street', formData.legalAddress.street);\n if (streetError) {\n newErrors['legalAddress.street'] = streetError;\n isValid = false;\n }\n\n const cityError = validateField('legalAddress.city', formData.legalAddress.city);\n if (cityError) {\n newErrors['legalAddress.city'] = cityError;\n isValid = false;\n }\n\n const postcodeError = validateField('legalAddress.postcode', formData.legalAddress.postcode);\n if (postcodeError) {\n newErrors['legalAddress.postcode'] = postcodeError;\n isValid = false;\n }\n\n const telephoneError = validateField('legalAddress.telephone', formData.legalAddress.telephone);\n if (telephoneError) {\n newErrors['legalAddress.telephone'] = telephoneError;\n isValid = false;\n }\n\n const countryError = validateField('legalAddress.countryCode', formData.legalAddress.countryCode);\n if (countryError) {\n newErrors['legalAddress.countryCode'] = countryError;\n isValid = false;\n }\n\n // Validate region field\n const regionError = validateField('legalAddress.region', formData.legalAddress.region);\n if (regionError) {\n newErrors['legalAddress.region'] = regionError;\n isValid = false;\n }\n }\n\n setErrors(newErrors);\n return isValid;\n };\n\n const handleSubmit = async (event: Event) => {\n event.preventDefault();\n \n // Mark only editable fields as touched\n // Use granular permission flags defined for this session\n const canEditAccount = company?.permissionsFlags?.canEditAccount === true;\n const canEditAddress = company?.permissionsFlags?.canEditAddress === true;\n const touchedFields: Record<string, boolean> = {};\n if (canEditAccount) {\n touchedFields.name = true;\n touchedFields.email = true;\n touchedFields.legalName = true;\n touchedFields.vatTaxId = true;\n touchedFields.resellerId = true;\n }\n if (canEditAddress) {\n touchedFields['legalAddress.street'] = true;\n touchedFields['legalAddress.street2'] = true;\n touchedFields['legalAddress.city'] = true;\n touchedFields['legalAddress.region'] = true;\n touchedFields['legalAddress.regionCode'] = true;\n touchedFields['legalAddress.countryCode'] = true;\n touchedFields['legalAddress.postcode'] = true;\n touchedFields['legalAddress.telephone'] = true;\n }\n setTouched(touchedFields);\n\n if (!validateForm()) {\n return;\n }\n\n // Check if email has changed and validate availability (only if allowed to edit account)\n if (canEditAccount && formData.email !== company?.email) {\n const emailValidation = await validateCompanyEmail(formData.email);\n if (!emailValidation.isValid) {\n setErrors(prev => ({\n ...prev,\n email: emailValidation.error || translations.emailNotAvailable,\n }));\n return;\n }\n }\n\n if (onSubmit) {\n // Transform form data to match API expectations\n const transformedData: any = {};\n if (canEditAccount) {\n transformedData.name = formData.name;\n transformedData.email = formData.email;\n transformedData.legalName = formData.legalName;\n transformedData.vatTaxId = formData.vatTaxId;\n transformedData.resellerId = formData.resellerId;\n }\n if (canEditAddress) {\n transformedData.legalAddress = {\n street: [formData.legalAddress.street, formData.legalAddress.street2].filter(Boolean),\n city: formData.legalAddress.city,\n region: {\n region: formData.legalAddress.region,\n regionCode: formData.legalAddress.regionCode,\n },\n countryCode: formData.legalAddress.countryCode,\n postcode: formData.legalAddress.postcode,\n telephone: formData.legalAddress.telephone,\n };\n }\n await onSubmit(transformedData);\n }\n };\n\n const handleInputChange = (field: string) => (value: string) => {\n // Permission guard: block changes to forbidden fields even if events fire\n const accountFields = new Set(['name', 'email', 'legalName', 'vatTaxId', 'resellerId']);\n const isAddress = field.startsWith('legalAddress.');\n const isAccount = accountFields.has(field);\n if ((isAccount && !canEditAccount) || (isAddress && !canEditAddress)) {\n return;\n }\n if (field.startsWith('legalAddress.')) {\n const addressField = field.split('.')[1];\n \n // Special handling for country change - reset region when country changes\n if (addressField === 'countryCode') {\n setFormData(prev => ({\n ...prev,\n legalAddress: {\n ...prev.legalAddress,\n [addressField]: value,\n region: '', // Reset region text\n regionCode: '', // Reset region code\n },\n }));\n \n // Clear region errors when country changes\n setErrors(prev => {\n const newErrors = { ...prev };\n delete newErrors['legalAddress.region'];\n delete newErrors['legalAddress.regionCode'];\n return newErrors;\n });\n \n // Clear region touched state when country changes\n setTouched(prev => {\n const newTouched = { ...prev };\n delete newTouched['legalAddress.region'];\n delete newTouched['legalAddress.regionCode'];\n return newTouched;\n });\n } else if (addressField === 'region') {\n // Handle region field (both text input and dropdown use this)\n setFormData(prev => ({\n ...prev,\n legalAddress: {\n ...prev.legalAddress,\n region: value,\n // For text input regions, use the same value for regionCode\n // For dropdown regions, this gets overridden in the handleSelect\n regionCode: hasRegionOptions ? prev.legalAddress.regionCode : value,\n },\n }));\n } else {\n setFormData(prev => ({\n ...prev,\n legalAddress: {\n ...prev.legalAddress,\n [addressField]: value,\n },\n }));\n }\n } else {\n setFormData(prev => ({ ...prev, [field]: value }));\n }\n \n // Clear error when user starts typing\n if (errors[field]) {\n setErrors(prev => {\n const newErrors = { ...prev };\n delete newErrors[field];\n return newErrors;\n });\n }\n };\n\n const handleBlur = (field: string) => {\n // Prevent marking forbidden fields as touched\n const accountFields = new Set(['name', 'email', 'legalName', 'vatTaxId', 'resellerId']);\n const isAddress = field.startsWith('legalAddress.');\n const isAccount = accountFields.has(field);\n if ((isAccount && !canEditAccount) || (isAddress && !canEditAddress)) {\n return;\n }\n setTouched(prev => ({ ...prev, [field]: true }));\n \n let value = '';\n if (field.startsWith('legalAddress.')) {\n const addressField = field.split('.')[1];\n const addressValue = formData.legalAddress[addressField as keyof typeof formData.legalAddress];\n value = typeof addressValue === 'string' ? addressValue : '';\n } else {\n const fieldValue = formData[field as keyof typeof formData];\n value = typeof fieldValue === 'string' ? fieldValue : '';\n }\n \n const error = validateField(field, value);\n \n if (error) {\n setErrors(prev => ({ ...prev, [field]: error }));\n }\n };\n\n return (\n <Card variant=\"secondary\" className={'account-edit-company-profile'}>\n <Header\n title={translations.title}\n divider={false}\n className={'account-edit-company-profile__title'}\n />\n {inLineAlertProps?.text ? (\n <InLineAlert\n className=\"account-edit-company-profile__notification\"\n type={inLineAlertProps.type}\n variant=\"secondary\"\n heading={inLineAlertProps.text}\n icon={inLineAlertProps.icon}\n data-testid=\"editCompanyInLineAlert\"\n />\n ) : null}\n <form\n className=\"account-edit-company-profile-form\"\n onSubmit={handleSubmit}\n >\n {canEditAccount && (\n <CompanyAccountFields\n loading={loading}\n value={{\n name: formData.name,\n email: formData.email,\n legalName: formData.legalName,\n vatTaxId: formData.vatTaxId,\n resellerId: formData.resellerId,\n }}\n errors={errors}\n touched={touched}\n onChange={handleInputChange}\n onBlur={handleBlur}\n />\n )}\n\n {/* Legal Address Section */}\n {canEditAddress && (\n <LegalAddressFields\n loading={loading}\n loadingCountries={loadingCountries}\n value={formData.legalAddress}\n errors={errors}\n touched={touched}\n onChange={handleInputChange}\n onBlur={handleBlur}\n countryOptions={countryOptions}\n regionOptions={regionOptions}\n isRegionRequired={isRegionRequired}\n hasRegionOptions={hasRegionOptions}\n />\n )}\n\n <div className=\"account-edit-company-profile__actions\">\n <Button\n disabled={loading}\n // @ts-ignore\n type=\"button\"\n variant=\"secondary\"\n onClick={() => onCancel?.()}\n >\n {translations.cancel}\n </Button>\n <Button disabled={loading || (!canEditAccount && !canEditAddress)} type=\"submit\" variant=\"primary\">\n {translations.save}\n </Button>\n </div>\n </form>\n \n {/* Loading overlay that covers the entire form */}\n {loading && (\n <div \n className=\"account-edit-company-profile__loading-overlay\"\n data-testid=\"editCompanyLoadingOverlay\"\n >\n <ProgressSpinner size=\"large\" />\n <div className=\"account-edit-company-profile__loading-text\">\n {translations.saving}\n </div>\n </div>\n )}\n </Card>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { Skeleton, SkeletonRow, Card } from '@adobe-commerce/elsie/components';\nimport './CompanyLoaders.css';\nimport { classes } from '@adobe-commerce/elsie/lib';\n\nexport const CompanyCardLoader = ({\n testId,\n withCard = true,\n}: {\n testId?: string;\n withCard?: boolean;\n}) => {\n const defaultSkeleton = (\n <Skeleton data-testid={testId || 'companySkeletonLoader'}>\n <SkeletonRow\n variant=\"heading\"\n size=\"xlarge\"\n fullWidth={false}\n lines={1}\n />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n <SkeletonRow variant=\"heading\" size=\"xlarge\" fullWidth={true} lines={1} />\n </Skeleton>\n );\n\n if (withCard) {\n return defaultSkeleton;\n }\n\n return (\n <Card\n variant=\"secondary\"\n className={classes([\n 'company-company-loaders',\n 'company-company-loaders--card-loader',\n ])}\n >\n {defaultSkeleton}\n </Card>\n );\n};\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\ndeclare global {\n interface Window {\n adobeDataLayer: any[];\n }\n}\n\nenum EventsList {\n EDIT_COMPANY_EVENT = 'edit-company',\n}\n\nconst EVENTS_MAPPING = {\n EDIT_COMPANY_EVENT: EventsList.EDIT_COMPANY_EVENT,\n};\n\n/**\n * Set and return the Adobe Client Data Layer (ACDL)\n * @returns ACDL instance or an empty array if it doesn't exist\n */\nconst getAdobeDataLayer = () => {\n if (!window.adobeDataLayer) {\n window.adobeDataLayer = [];\n }\n return window.adobeDataLayer;\n};\n\n/**\n * Sets a context in the Adobe Client Data Layer (ACDL)\n * @param context - The context object to set\n */\nconst setContext = (context: Record<string, any>) => {\n const adobeDataLayer = getAdobeDataLayer();\n adobeDataLayer.push({\n context,\n });\n};\n\n/**\n * Pushes an event to the Adobe Client Data Layer (ACDL)\n * @param event - The event object to push\n */\nconst pushEvent = (event: Record<string, any>) => {\n const adobeDataLayer = getAdobeDataLayer();\n \n adobeDataLayer.push((acdl: any) => {\n const state = acdl.getState ? acdl.getState() : {};\n \n acdl.push({\n event,\n context: state,\n });\n });\n};\n\n/**\n * Publishes events to the Adobe Client Data Layer (ACDL)\n * @param eventType - The type of event to publish\n * @param eventParams - Parameters associated with the event\n * @returns null if the event type is not recognized\n */\nconst publishEvents = (eventType: string, eventParams: any) => {\n if (!EVENTS_MAPPING[eventType as keyof typeof EVENTS_MAPPING]) {\n return null;\n }\n\n switch (eventType) {\n case EventsList.EDIT_COMPANY_EVENT:\n pushEvent({\n type: 'company',\n eventType: 'edit',\n companyData: eventParams,\n });\n break;\n default:\n return null;\n }\n};\n\nexport { EventsList, publishEvents, pushEvent, setContext };","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { useCallback, useEffect, useRef, useState } from 'preact/hooks';\nimport { events } from '@adobe-commerce/event-bus';\nimport { getCompany, updateCompany, getCountries } from '../../api';\nimport { CompanyModel } from '../../data/models';\nimport { Country } from '../../data/models/country';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { EventsList, publishEvents } from '../../lib/acdl';\n\nexport interface UseCompanyProfileProps {\n handleSetInLineAlert?: (alert?: { type: 'success' | 'error'; text: string }) => void;\n}\n\nexport const useCompanyProfile = ({ \n handleSetInLineAlert \n}: UseCompanyProfileProps) => {\n const translations = useText({\n companySuccess: 'Company.CompanyProfile.editCompanyProfile.companySuccess',\n companyError: 'Company.CompanyProfile.editCompanyProfile.companyError',\n loadError: 'Company.CompanyProfile.messages.loadError',\n updateError: 'Company.CompanyProfile.messages.updateError',\n });\n const { companySuccess, companyError, loadError, updateError } = translations;\n\n const [company, setCompany] = useState<CompanyModel | null>(null);\n const [loading, setLoading] = useState<boolean>(true);\n const [submitLoading, setSubmitLoading] = useState<boolean>(false);\n const [showEditForm, setShowEditForm] = useState<boolean>(false);\n const [countries, setCountries] = useState<Country[]>([]);\n const [inputChange, setInputChange] = useState<Record<string, string | number | boolean>>({});\n\n // Keep stable references to avoid re-creating callbacks/effects and double fetch\n const alertFnRef = useRef<UseCompanyProfileProps['handleSetInLineAlert']>(handleSetInLineAlert);\n const inFlightRef = useRef<boolean>(false);\n const didInitialFetchRef = useRef<boolean>(false);\n useEffect(() => {\n alertFnRef.current = handleSetInLineAlert;\n }, [handleSetInLineAlert]);\n\n const handleInputChange = useCallback(\n (value: Record<string, string | number | boolean>) => {\n setInputChange(value);\n },\n []\n );\n\n const renderAlertMessage = useCallback(\n (type: 'success' | 'error', message?: string) => {\n if (!handleSetInLineAlert) return;\n\n if (type === 'success') {\n handleSetInLineAlert({\n type: 'success',\n text: message ?? companySuccess,\n });\n } else if (type === 'error') {\n handleSetInLineAlert({\n type: 'error',\n text: message ?? companyError,\n });\n } else {\n handleSetInLineAlert();\n }\n\n setSubmitLoading(false);\n },\n [handleSetInLineAlert, companySuccess, companyError]\n );\n\n const fetchCompany = useCallback(async (): Promise<CompanyModel | null> => {\n if (inFlightRef.current) {\n return null;\n }\n inFlightRef.current = true;\n setLoading(true);\n \n try {\n const companyData = await getCompany();\n if (companyData) {\n setCompany(companyData);\n }\n setLoading(false);\n return companyData;\n } catch (error) {\n console.error('Failed to load company:', error);\n setLoading(false);\n if (alertFnRef.current) {\n alertFnRef.current({ type: 'error', text: loadError });\n }\n return null;\n } finally {\n inFlightRef.current = false;\n }\n }, [loadError]);\n\n useEffect(() => {\n if (!didInitialFetchRef.current) {\n didInitialFetchRef.current = true;\n fetchCompany();\n }\n // Intentionally depend only on loadError through fetchCompany to avoid re-fetching on alert changes\n }, [fetchCompany]);\n\n // Re-fetch company when company context changes/restores (e.g., user switches company)\n useEffect(() => {\n const onCompanyContextChanged = () => {\n setLoading(true);\n setShowEditForm(false);\n setInputChange({});\n // Re-fetch with updated GraphQL headers\n fetchCompany();\n };\n\n const subChanged = events.on('companyContext/changed', onCompanyContextChanged, { eager: true });\n\n return () => {\n subChanged?.off();\n };\n }, [fetchCompany]);\n\n useEffect(() => {\n getCountries().then((countriesResponse) => {\n setCountries(countriesResponse.availableCountries);\n }).catch((error) => {\n console.error('Failed to load countries:', error);\n });\n }, []);\n\n const handleShowEditForm = useCallback(() => {\n setShowEditForm(true);\n renderAlertMessage('success', ''); // Clear any existing alerts\n setInputChange({});\n }, [renderAlertMessage]);\n\n const handleHideEditForm = useCallback((clearStates?: () => void) => {\n clearStates?.();\n setShowEditForm(false);\n setInputChange({});\n }, []);\n\n const handleUpdateCompany = useCallback(async (data: Partial<CompanyModel>) => {\n try {\n setSubmitLoading(true);\n \n if (!data) {\n renderAlertMessage('error', 'No data to update');\n return;\n }\n \n const updatedCompany = await updateCompany(data as any);\n \n // Permissions are now correctly set by transformCompany based on role data\n \n setCompany(updatedCompany);\n setShowEditForm(false);\n setInputChange({});\n \n renderAlertMessage('success');\n \n // Publish analytics event\n publishEvents(EventsList.EDIT_COMPANY_EVENT, {\n ...data,\n companyId: company?.id,\n });\n \n // No need to refresh - updateCompany already returns complete updated data\n \n // Notify other components that company was updated (emit complete data if available)\n events.emit('company/updated', { company: updatedCompany });\n \n } catch (error: any) {\n console.error('Failed to update company:', error);\n renderAlertMessage('error', error.message || updateError);\n } finally {\n setSubmitLoading(false);\n }\n }, [company, renderAlertMessage, updateError]);\n\n return {\n // Core data\n company,\n countries,\n \n // Loading states\n loading,\n submitLoading,\n \n // UI states\n showEditForm,\n \n // Form data\n inputChange,\n \n // Actions\n handleShowEditForm,\n handleHideEditForm,\n handleUpdateCompany,\n handleInputChange,\n renderAlertMessage,\n \n // Legacy support (deprecated - use submitLoading instead)\n saving: submitLoading,\n };\n};\n","import * as React from \"react\";\nconst SvgWarning = (props) => /* @__PURE__ */ React.createElement(\"svg\", { id: \"Icon_Warning_Base\", width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"g\", { clipPath: \"url(#clip0_841_1324)\" }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.9949 2.30237L0.802734 21.6977H23.1977L11.9949 2.30237Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M12.4336 10.5504L12.3373 14.4766H11.6632L11.5669 10.5504V9.51273H12.4336V10.5504ZM11.5883 18.2636V17.2687H12.4229V18.2636H11.5883Z\", stroke: \"currentColor\", strokeLinecap: \"round\", strokeLinejoin: \"round\" })), /* @__PURE__ */ React.createElement(\"defs\", null, /* @__PURE__ */ React.createElement(\"clipPath\", { id: \"clip0_841_1324\" }, /* @__PURE__ */ React.createElement(\"rect\", { width: 24, height: 21, fill: \"white\", transform: \"translate(0 1.5)\" }))));\nexport default SvgWarning;\n","import * as React from \"react\";\nconst SvgCheckWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M6.75 12.762L10.2385 15.75L17.25 9\", stroke: \"currentColor\" }));\nexport default SvgCheckWithCircle;\n","import * as React from \"react\";\nconst SvgWarningWithCircle = (props) => /* @__PURE__ */ React.createElement(\"svg\", { width: 24, height: 24, viewBox: \"0 0 24 24\", fill: \"none\", xmlns: \"http://www.w3.org/2000/svg\", ...props }, /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M0.75 12C0.75 5.78421 5.78421 0.75 12 0.75C18.2158 0.75 23.25 5.78421 23.25 12C23.25 18.2158 18.2158 23.25 12 23.25C5.78421 23.25 0.75 18.2158 0.75 12Z\", stroke: \"currentColor\" }), /* @__PURE__ */ React.createElement(\"path\", { vectorEffect: \"non-scaling-stroke\", d: \"M11.75 5.88423V4.75H12.25V5.88423L12.0485 13.0713H11.9515L11.75 5.88423ZM11.7994 18.25V16.9868H12.2253V18.25H11.7994Z\", stroke: \"currentColor\" }));\nexport default SvgWarningWithCircle;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { useState, useCallback, useEffect } from 'preact/hooks';\nimport { InLineAlertProps } from '../types/companyProfile.types';\nimport {\n CheckWithCircle as Success,\n Warning,\n WarningWithCircle as Error,\n} from '@adobe-commerce/elsie/icons';\n\nexport type AlertType = 'success' | 'warning' | 'error';\n\nexport interface AlertOptions {\n type: AlertType;\n text: string;\n autoHide?: boolean;\n autoHideDelay?: number;\n}\n\nexport interface UseInLineAlertReturn {\n inLineAlertProps: InLineAlertProps;\n handleSetInLineAlert: (notification?: AlertOptions) => void;\n clearAlert: () => void;\n showSuccess: (text: string, autoHide?: boolean) => void;\n showWarning: (text: string, autoHide?: boolean) => void;\n showError: (text: string, autoHide?: boolean) => void;\n}\n\nconst iconsList = {\n success: <Success />,\n warning: <Warning />,\n error: <Error />,\n};\n\nexport const useInLineAlert = (): UseInLineAlertReturn => {\n const [inLineAlertProps, setInLineAlertProps] = useState<InLineAlertProps>({});\n const [autoHideTimer, setAutoHideTimer] = useState<ReturnType<typeof setTimeout> | null>(null);\n\n const clearAlert = useCallback(() => {\n setInLineAlertProps({});\n if (autoHideTimer) {\n clearTimeout(autoHideTimer);\n setAutoHideTimer(null);\n }\n }, [autoHideTimer]);\n\n const handleSetInLineAlert = useCallback(\n (notification?: AlertOptions) => {\n // Clear existing timer\n if (autoHideTimer) {\n clearTimeout(autoHideTimer);\n setAutoHideTimer(null);\n }\n\n if (!notification?.type) {\n setInLineAlertProps({});\n return;\n }\n\n const icon = iconsList[notification.type];\n\n setInLineAlertProps({\n type: notification.type,\n text: notification.text,\n icon,\n });\n\n // Auto-hide if requested\n if (notification.autoHide !== false) {\n const delay = notification.autoHideDelay || (notification.type === 'success' ? 3000 : 5000);\n const timer = setTimeout(() => {\n setInLineAlertProps({});\n setAutoHideTimer(null);\n }, delay);\n setAutoHideTimer(timer);\n }\n },\n [autoHideTimer]\n );\n\n const showSuccess = useCallback(\n (text: string, autoHide: boolean = true) => {\n handleSetInLineAlert({ type: 'success', text, autoHide });\n },\n [handleSetInLineAlert]\n );\n\n const showWarning = useCallback(\n (text: string, autoHide: boolean = false) => {\n handleSetInLineAlert({ type: 'warning', text, autoHide });\n },\n [handleSetInLineAlert]\n );\n\n const showError = useCallback(\n (text: string, autoHide: boolean = false) => {\n handleSetInLineAlert({ type: 'error', text, autoHide });\n },\n [handleSetInLineAlert]\n );\n\n // Cleanup timer on unmount\n useEffect(() => {\n return () => {\n if (autoHideTimer) {\n clearTimeout(autoHideTimer);\n }\n };\n }, [autoHideTimer]);\n\n return {\n inLineAlertProps,\n handleSetInLineAlert,\n clearAlert,\n showSuccess,\n showWarning,\n showError,\n };\n};\n\nexport default useInLineAlert;\n","/********************************************************************\n * ADOBE CONFIDENTIAL\n * __________________\n *\n * Copyright 2025 Adobe\n * All Rights Reserved.\n *\n * NOTICE: All information contained herein is, and remains\n * the property of Adobe and its suppliers, if any. The intellectual\n * and technical concepts contained herein are proprietary to Adobe\n * and its suppliers and are protected by all applicable intellectual\n * property laws, including trade secret and copyright laws.\n * Dissemination of this information or reproduction of this material\n * is strictly forbidden unless prior written permission is obtained\n * from Adobe.\n *******************************************************************/\nimport { classes, Container } from '@adobe-commerce/elsie/lib';\nimport { Header } from '@adobe-commerce/elsie/components';\nimport { useText } from '@adobe-commerce/elsie/i18n';\nimport { CompanyProfileCard } from '../../components/CompanyProfileCard';\nimport { EditCompanyProfile } from '../../components/EditCompanyProfile';\nimport { CompanyCardLoader } from '../../components/CompanyLoaders';\nimport { useCompanyProfile } from '../../hooks/containers/useCompanyProfile';\nimport { useInLineAlert } from '../../hooks/useInLineAlert';\nimport { CompanyProfileProps } from '../../types/companyProfile.types';\n\nexport const CompanyProfile: Container<CompanyProfileProps> = ({\n className,\n withHeader = true,\n slots,\n}) => {\n const translations = useText({\n containerTitle: 'Company.CompanyProfile.containerTitle',\n });\n const { inLineAlertProps, handleSetInLineAlert } = useInLineAlert();\n const {\n company,\n loading,\n saving,\n showEditForm,\n handleShowEditForm,\n handleHideEditForm,\n handleUpdateCompany,\n } = useCompanyProfile({ handleSetInLineAlert });\n\n if (loading)\n return (\n <div data-testid=\"companyProfileLoader\">\n <CompanyCardLoader withCard />\n </div>\n );\n\n return (\n <div className={classes(['account-company-profile', className])}>\n {withHeader ? (\n <Header\n title={translations.containerTitle}\n divider={false}\n className={'company-profile__title'}\n />\n ) : null}\n <CompanyProfileCard\n company={company}\n slots={slots}\n showEditForm={showEditForm}\n handleShowEditForm={handleShowEditForm}\n />\n {showEditForm ? (\n <EditCompanyProfile\n inLineAlertProps={inLineAlertProps}\n company={company}\n loading={saving}\n onSubmit={handleUpdateCompany}\n onCancel={handleHideEditForm}\n />\n ) : null}\n </div>\n );\n};\n"],"names":["CompanyProfileCard","company","slots","showEditForm","handleShowEditForm","translations","useText","jsx","Card","perms","companyData","classes","jsxs","Button","Default","Fragment","el","index","value","_a","line","i","_b","m","Slot","useCountries","selectedCountryCode","countriesData","setCountriesData","useState","loadingCountries","setLoadingCountries","useEffect","isMounted","getCountries","availableCountries","countriesWithRequiredRegion","optionalZipCountries","countryOptions","useMemo","regionOptions","selectedCountry","country","region","isRegionRequired","hasRegionOptions","CompanyAccountFields","loading","errors","touched","onChange","onBlur","namePrefix","fieldPathPrefix","prefix","path","f","Field","Input","LegalAddressFields","requiredConfig","names","paths","isRequired","Picker","event","target","r","regionCode","regionName","EditCompanyProfile","inLineAlertProps","onSubmit","onCancel","formData","setFormData","_d","_c","_e","_g","_f","_i","_h","_j","_k","_l","setErrors","setTouched","canEditAccount","_m","canEditAddress","_n","validateField","name","validateForm","newErrors","isValid","nameError","emailError","streetError","cityError","postcodeError","telephoneError","countryError","regionError","handleSubmit","touchedFields","emailValidation","validateCompanyEmail","prev","transformedData","handleInputChange","field","accountFields","isAddress","addressField","newTouched","handleBlur","addressValue","fieldValue","error","Header","InLineAlert","ProgressSpinner","CompanyCardLoader","testId","withCard","defaultSkeleton","Skeleton","SkeletonRow","EventsList","EVENTS_MAPPING","getAdobeDataLayer","pushEvent","acdl","state","publishEvents","eventType","eventParams","useCompanyProfile","handleSetInLineAlert","companySuccess","companyError","loadError","updateError","setCompany","setLoading","submitLoading","setSubmitLoading","setShowEditForm","countries","setCountries","inputChange","setInputChange","alertFnRef","useRef","inFlightRef","didInitialFetchRef","useCallback","renderAlertMessage","type","message","fetchCompany","getCompany","onCompanyContextChanged","subChanged","events","countriesResponse","handleHideEditForm","clearStates","handleUpdateCompany","data","updatedCompany","updateCompany","SvgWarning","props","React","SvgCheckWithCircle","SvgWarningWithCircle","iconsList","Success","Warning","Error","useInLineAlert","setInLineAlertProps","autoHideTimer","setAutoHideTimer","clearAlert","notification","icon","delay","timer","showSuccess","text","autoHide","showWarning","showError","CompanyProfile","className","withHeader","saving"],"mappings":"isBAuBO,MAAMA,GAAiE,CAAC,CAC7E,QAAAC,EACA,MAAAC,EACA,aAAAC,EACA,mBAAAC,CACF,IAAM,CACJ,MAAMC,EAAeC,EAAQ,CAC3B,WAAY,8BACZ,cAAe,0DACf,YAAa,oCACb,MAAO,8BACP,UAAW,kCACX,SAAU,iCACV,WAAY,mCACZ,aAAc,qCACd,SAAU,qDACV,qBAAsB,iEACtB,oBAAqB,gEACrB,mBAAoB,+DACpB,oBAAqB,gEACrB,wBAAyB,oEACzB,yBAA0B,qEAC1B,iBAAkB,6DAClB,kBAAmB,6DAAA,CACpB,EAED,GAAI,CAACL,EACH,OACEM,EAACC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AA,CAAA,EAEX,KACJE,EAACP,GAAA,CACC,QAAAC,EACA,MAAAC,EACA,aAAAC,EACA,mBAAAC,CAAA,CAAA,EAEDD,EACCI,EAAC+D,GAAA,CACC,iBAAAC,EACA,QAAAtE,EACA,QAASuM,EACT,SAAU9B,EACV,SAAUF,CAAA,CAAA,EAEV,IAAA,EACN,CAEJ","x_google_ignoreList":[8,9,10]}
@@ -10,7 +10,6 @@ export interface UseCompanyProfileProps {
10
10
  export declare const useCompanyProfile: ({ handleSetInLineAlert }: UseCompanyProfileProps) => {
11
11
  company: CompanyModel | null;
12
12
  countries: Country[];
13
- createdAt: string;
14
13
  loading: boolean;
15
14
  submitLoading: boolean;
16
15
  showEditForm: boolean;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-company-management", "version": "1.0.0-beta3", "@dropins/tools": "^1.3.0", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/storefront-company-management", "version": "1.0.0-beta4", "@dropins/tools": "^1.3.0", "license": "SEE LICENSE IN LICENSE.md"}