@ecomplus/storefront-components 1.0.0-beta.193 → 1.0.0-beta.194

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-beta.194](https://github.com/ecomplus/storefront/compare/@ecomplus/storefront-components@1.0.0-beta.193...@ecomplus/storefront-components@1.0.0-beta.194) (2026-02-16)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **components/address-form:** switch CEP API to BrasilAPI with viaCEP fallback ([6d2a356](https://github.com/ecomplus/storefront/commit/6d2a356f47c3486925e637c491a968f212e371e9))
11
+
6
12
  # [1.0.0-beta.193](https://github.com/ecomplus/storefront/compare/@ecomplus/storefront-components@1.0.0-beta.192...@ecomplus/storefront-components@1.0.0-beta.193) (2026-02-08)
7
13
 
8
14
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecomplus/storefront-components",
3
- "version": "1.0.0-beta.193",
3
+ "version": "1.0.0-beta.194",
4
4
  "description": "Vue components for E-Com Plus Storefront",
5
5
  "main": "dist/storefront-components.min.js",
6
6
  "scripts": {
@@ -113,37 +113,55 @@ export default {
113
113
  }
114
114
  },
115
115
 
116
- fetchAddressInfo (zipCode, isRetry = false) {
116
+ setAddressFields (zipCode, fields) {
117
+ if (zipCode === this.localAddress.zip) {
118
+ fields.forEach(([field, value]) => {
119
+ this.$set(this.localAddress, field, value || '')
120
+ this.$set(this.addressFromZip, field, Boolean(value))
121
+ })
122
+ this.$nextTick(() => {
123
+ setTimeout(() => {
124
+ if (this.$refs.inputNumber) {
125
+ this.$refs.inputNumber.select()
126
+ }
127
+ }, 300)
128
+ })
129
+ }
130
+ },
131
+
132
+ fetchAddressInfo (zipCode) {
117
133
  if (zipCode === this.localAddress.zip) {
118
134
  this.zipLoading = zipCode
119
- axios.get(`https://viacep.com.br/ws/${zipCode}/json/`, { timeout: 4000 })
135
+ axios.get(`https://brasilapi.com.br/api/cep/v2/${zipCode}`, { timeout: 4000 })
120
136
  .then(({ data }) => {
121
- if (!data.erro && zipCode === this.localAddress.zip) {
122
- ;[
123
- ['province_code', data.uf],
124
- ['city', data.localidade],
125
- ['borough', data.bairro],
126
- ['street', data.logradouro]
127
- ].forEach(([field, value]) => {
128
- this.$set(this.localAddress, field, value || '')
129
- this.$set(this.addressFromZip, field, Boolean(value))
130
- })
131
- this.$nextTick(() => {
132
- setTimeout(() => {
133
- if (this.$refs.inputNumber) {
134
- this.$refs.inputNumber.select()
135
- }
136
- }, 300)
137
- })
138
- }
137
+ this.setAddressFields(zipCode, [
138
+ ['province_code', data.state],
139
+ ['city', data.city],
140
+ ['borough', data.neighborhood],
141
+ ['street', data.street]
142
+ ])
139
143
  })
140
144
  .catch(err => {
141
145
  console.error(err)
142
- if (!isRetry) {
143
- setTimeout(() => {
144
- this.fetchAddressInfo(zipCode, true)
145
- }, 300)
146
- }
146
+ setTimeout(() => {
147
+ axios.get(`https://viacep.com.br/ws/${zipCode}/json/`, { timeout: 4000 })
148
+ .then(({ data }) => {
149
+ if (!data.erro) {
150
+ this.setAddressFields(zipCode, [
151
+ ['province_code', data.uf],
152
+ ['city', data.localidade],
153
+ ['borough', data.bairro],
154
+ ['street', data.logradouro]
155
+ ])
156
+ }
157
+ })
158
+ .catch(e => console.error(e))
159
+ .finally(() => {
160
+ if (zipCode === this.zipLoading) {
161
+ this.zipLoading = null
162
+ }
163
+ })
164
+ }, 300)
147
165
  })
148
166
  .finally(() => {
149
167
  if (zipCode === this.zipLoading) {