@kigi/components 1.61.0-beta.1 → 1.62.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kigi/components",
3
- "version": "1.61.0-beta.1",
3
+ "version": "1.62.0",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -51,7 +51,8 @@ class MbgAddressController {
51
51
  public $timeout,
52
52
  public mbgAddressService: MbgAddressService,
53
53
  public $uibModal,
54
- ) {}
54
+ ) {
55
+ }
55
56
 
56
57
  $onInit() {
57
58
  if (this.capitalize && this.address) {
@@ -95,8 +96,8 @@ class MbgAddressController {
95
96
  state: this.address.state
96
97
  ? this.address.state
97
98
  : this.address.uf && this.address.uf.initial
98
- ? this.address.uf.initial
99
- : '',
99
+ ? this.address.uf.initial
100
+ : '',
100
101
  }
101
102
  if (this.ngModel) {
102
103
  this.ngModel.EX = (this.ngModel.country || '').toLowerCase() !== 'brasil'
@@ -206,11 +207,11 @@ class MbgAddressController {
206
207
  return elmWidth - inputElmWidth - marginRight + 'px'
207
208
  }
208
209
 
209
- onChangeCep() {
210
+ async onChangeCep() {
210
211
  this.resetAddress()
211
212
  this.updateSteps()
212
213
  if (this.address.zipCode) {
213
- this.searchAddressByCEP()
214
+ await this.searchAddressByCEP()
214
215
  } else {
215
216
  this.fullAddress = ``
216
217
  }
@@ -372,7 +373,11 @@ class MbgAddressController {
372
373
  ibgeCode = responseIbge && responseIbge.data && responseIbge.data.id.toString()
373
374
  }
374
375
 
375
- const uf = getStatesBR().filter((state) => state.initial === response.data.uf)[0]
376
+ const uf = getStatesBR().filter((state) => {
377
+ const currUf = state.initial || state
378
+ const resUf = response.data.uf || response.data.state
379
+ return currUf === resUf
380
+ })[0]
376
381
  const formalCode = ibgeCode || ''
377
382
  const premisse = this.formatFromPremisse(street)
378
383
 
@@ -39,8 +39,9 @@ class MbgAddressService {
39
39
  }
40
40
 
41
41
  async getIbgeCode(municipio: string) {
42
+ const normalizedMunicipio = municipio.normalize('NFD').replace(/[\u0300-\u036f]/g, '')
42
43
  try {
43
- return await this.$http.get(`${this.ibgeGovAPI}/${municipio}`)
44
+ return await this.$http.get(`${this.ibgeGovAPI}/${normalizedMunicipio}`)
44
45
  } catch (e) {
45
46
  console.log(`Erro ao obter código do IBGE`)
46
47
  }