@kigi/components 1.63.3-beta.1 → 1.63.4-beta.1

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.63.3-beta.1",
3
+ "version": "1.63.4-beta.1",
4
4
  "description": "@kigi/components",
5
5
  "main": "src/components/index.ts",
6
6
  "scripts": {
@@ -95,8 +95,8 @@ class MbgAddressController {
95
95
  state: this.address.state
96
96
  ? this.address.state
97
97
  : this.address.uf && this.address.uf.initial
98
- ? this.address.uf.initial
99
- : '',
98
+ ? this.address.uf.initial
99
+ : '',
100
100
  }
101
101
  if (this.ngModel) {
102
102
  this.ngModel.EX = (this.ngModel.country || '').toLowerCase() !== 'brasil'
@@ -311,17 +311,27 @@ class MbgAddressController {
311
311
  if (!this.ngModel) {
312
312
  return {}
313
313
  }
314
- const uf = getStatesBR().filter((state) => state.initial === this.ngModel.state)[0]
314
+ const currentStateSignal =
315
+ this.ngModel.state ||
316
+ (this.address && this.address.state) ||
317
+ (this.address && this.address.uf && this.address.uf.initial)
318
+
319
+ const uf = getStatesBR().filter((state) => state.initial === currentStateSignal)[0]
320
+
315
321
  return {
316
322
  EX: (this.ngModel.country || '').toLowerCase() !== 'brasil',
317
323
  country: this.ngModel.country || this.address.country,
318
- state: this.ngModel.state,
324
+ state: this.ngModel.state || (uf ? uf.initial : ''),
319
325
  countryCode: this.ngModel.countryCode,
320
- zipCode: this.address.zipCode ? this.address.zipCode : this.ngModel.zipCode.replace('-', ''),
326
+ zipCode: this.address.zipCode
327
+ ? this.address.zipCode
328
+ : this.ngModel.zipCode
329
+ ? this.ngModel.zipCode.replace('-', '')
330
+ : '',
321
331
  neighbourhood: this.address.neighbourhood
322
332
  ? this.address.neighbourhood
323
333
  : this.ngModel.neighbourhood,
324
- localization: this.ngModel.localization,
334
+ localization: this.ngModel.localization || (this.address ? this.address.localization : ''),
325
335
  premisse: this.address.premisse
326
336
  ? this.address.premisse
327
337
  : this.formatFromPremisse(this.ngModel.premisse),