diff --git a/CHANGELOG.md b/CHANGELOG.md index da7f7bc1..cf08c292 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [1.28.0] - 2024-07-09 + +- Disable country edition for addresses saved at the profile + ## [1.27.1] - 2024-02-15 ### Fixed diff --git a/manifest.json b/manifest.json index fc138e8c..b8613d00 100644 --- a/manifest.json +++ b/manifest.json @@ -1,12 +1,10 @@ { "name": "my-account", "vendor": "vtex", - "version": "1.27.1", + "version": "1.28.0", "title": "My Account", "description": "User's my account page.", - "registries": [ - "smartcheckout" - ], + "registries": ["smartcheckout"], "dependencies": { "vtex.my-cards": "1.x", "vtex.my-orders-app": "3.x", diff --git a/react/components/Addresses/AddressForm.tsx b/react/components/Addresses/AddressForm.tsx index b037ccd2..c1a4d02b 100644 --- a/react/components/Addresses/AddressForm.tsx +++ b/react/components/Addresses/AddressForm.tsx @@ -147,14 +147,28 @@ class AddressForm extends Component { public render() { const { address } = this.state - const { intl, submitLabelId, isLoading, googleMapsApiKey, useGeolocation } = - this.props + const { + intl, + submitLabelId, + isLoading, + googleMapsApiKey, + useGeolocation, + isExistingAddress, + } = this.props const shipCountries = this.translateCountries() const hasGeoCoords = this.hasGeoCoords() const hasValidPostalCode = this.hasValidPostalCode() const hasAutoCompletedFields = this.hasAutoCompletedFields() + const enhancedAddress = { + ...address, + country: { + ...address.country, + disabled: !!isExistingAddress, + }, + } + return ( { useGeolocation={useGeolocation} > void onSubmit: (address: Address) => void + isExistingAddress?: boolean } type Props = InnerProps & OuterProps diff --git a/react/components/pages/AddressEdit.tsx b/react/components/pages/AddressEdit.tsx index c93e06b3..b73d648c 100644 --- a/react/components/pages/AddressEdit.tsx +++ b/react/components/pages/AddressEdit.tsx @@ -68,6 +68,7 @@ class AddressEdit extends Component { isLoading={isLoading} submitLabelId="vtex.store-messages@0.x::addresses.saveAddress" address={normalizedAddress} + isExistingAddress={!!addressId} onSubmit={this.handleSave} onError={this.props.handleError} /> diff --git a/react/typings/global.d.ts b/react/typings/global.d.ts index 055fccdb..e21e8f13 100644 --- a/react/typings/global.d.ts +++ b/react/typings/global.d.ts @@ -70,6 +70,7 @@ declare global { interface AddressFormFields { [key: string]: { + disabled: boolean value: null | string | number | number[] valid?: boolean geolocationAutoCompleted?: boolean