@ecomplus/storefront-components 1.0.0-beta.19 → 1.0.0-beta.191

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.
Files changed (125) hide show
  1. package/.version +0 -0
  2. package/CHANGELOG.md +1333 -135
  3. package/all.js +3 -1
  4. package/dist/1.storefront-components.min.js +2 -0
  5. package/dist/1.storefront-components.min.js.map +1 -0
  6. package/dist/2.storefront-components.min.js +5 -0
  7. package/dist/2.storefront-components.min.js.map +1 -0
  8. package/dist/3.storefront-components.min.js +5 -0
  9. package/dist/3.storefront-components.min.js.map +1 -0
  10. package/dist/storefront-components.min.js +33 -12
  11. package/dist/storefront-components.min.js.map +1 -1
  12. package/package.json +17 -12
  13. package/src/APagination.vue +2 -0
  14. package/src/AShare.vue +2 -0
  15. package/src/AccountAddresses.vue +3 -0
  16. package/src/AccountForm.vue +3 -0
  17. package/src/AccountPoints.vue +3 -0
  18. package/src/BuyTogether.vue +3 -0
  19. package/src/EarnPointsProgress.vue +3 -0
  20. package/src/ItemCustomizations.vue +2 -0
  21. package/src/KitProductVariations.vue +3 -0
  22. package/src/PointsApplier.vue +2 -0
  23. package/src/ProductQuickview.vue +3 -0
  24. package/src/QuantitySelector.vue +3 -0
  25. package/src/RecommendedItems.vue +3 -0
  26. package/src/ShippingLine.vue +1 -0
  27. package/src/TheCart.vue +3 -0
  28. package/src/html/APagination.html +90 -0
  29. package/src/html/APrices.html +24 -4
  30. package/src/html/AShare.html +31 -0
  31. package/src/html/AccountAddresses.html +90 -0
  32. package/src/html/AccountForm.html +269 -0
  33. package/src/html/AccountPoints.html +39 -0
  34. package/src/html/AddressForm.html +9 -7
  35. package/src/html/BuyTogether.html +60 -0
  36. package/src/html/CartItem.html +86 -38
  37. package/src/html/CartQuickview.html +28 -5
  38. package/src/html/DiscountApplier.html +3 -3
  39. package/src/html/EarnPointsProgress.html +28 -0
  40. package/src/html/InputDate.html +1 -1
  41. package/src/html/InputDocNumber.html +1 -0
  42. package/src/html/InputPhone.html +1 -1
  43. package/src/html/InstantSearch.html +3 -3
  44. package/src/html/ItemCustomizations.html +14 -0
  45. package/src/html/KitProductVariations.html +92 -0
  46. package/src/html/LoginBlock.html +34 -32
  47. package/src/html/LoginModal.html +9 -4
  48. package/src/html/PaymentOption.html +7 -5
  49. package/src/html/PointsApplier.html +26 -0
  50. package/src/html/ProductCard.html +68 -8
  51. package/src/html/ProductGallery.html +21 -3
  52. package/src/html/ProductQuickview.html +64 -0
  53. package/src/html/ProductVariations.html +30 -3
  54. package/src/html/QuantitySelector.html +85 -0
  55. package/src/html/RecommendedItems.html +48 -0
  56. package/src/html/SearchEngine.html +101 -24
  57. package/src/html/ShippingCalculator.html +84 -3
  58. package/src/html/ShippingLine.html +5 -2
  59. package/src/html/TheAccount.html +43 -9
  60. package/src/html/TheCart.html +156 -0
  61. package/src/html/TheProduct.html +416 -138
  62. package/src/js/APagination.js +74 -0
  63. package/src/js/APicture.js +27 -7
  64. package/src/js/APrices.js +80 -41
  65. package/src/js/AShare.js +83 -0
  66. package/src/js/AccountAddresses.js +201 -0
  67. package/src/js/AccountForm.js +312 -0
  68. package/src/js/AccountPoints.js +63 -0
  69. package/src/js/AddressForm.js +80 -35
  70. package/src/js/BuyTogether.js +246 -0
  71. package/src/js/CartItem.js +67 -14
  72. package/src/js/CartQuickview.js +20 -1
  73. package/src/js/DiscountApplier.js +181 -50
  74. package/src/js/EarnPointsProgress.js +77 -0
  75. package/src/js/InputDate.js +8 -8
  76. package/src/js/InputDocNumber.js +20 -0
  77. package/src/js/ItemCustomizations.js +10 -0
  78. package/src/js/KitProductVariations.js +218 -0
  79. package/src/js/LoginBlock.js +47 -6
  80. package/src/js/LoginModal.js +18 -10
  81. package/src/js/PaymentOption.js +28 -1
  82. package/src/js/PointsApplier.js +110 -0
  83. package/src/js/ProductCard.js +115 -11
  84. package/src/js/ProductGallery.js +32 -12
  85. package/src/js/ProductQuickview.js +72 -0
  86. package/src/js/ProductVariations.js +76 -19
  87. package/src/js/QuantitySelector.js +175 -0
  88. package/src/js/RecommendedItems.js +178 -0
  89. package/src/js/SearchEngine.js +185 -55
  90. package/src/js/ShippingCalculator.js +176 -35
  91. package/src/js/ShippingLine.js +44 -5
  92. package/src/js/TheAccount.js +97 -6
  93. package/src/js/TheCart.js +146 -0
  94. package/src/js/TheProduct.js +387 -43
  95. package/src/js/helpers/add-idle-callback.js +7 -0
  96. package/src/js/helpers/check-form-validity.js +3 -0
  97. package/src/js/helpers/favorite-products.js +24 -0
  98. package/src/js/helpers/scroll-to-element.js +10 -0
  99. package/src/js/helpers/sort-apps.js +14 -0
  100. package/src/js/helpers/wait-storefront-info.js +21 -0
  101. package/src/scss/APicture.scss +2 -0
  102. package/src/scss/APrices.scss +13 -1
  103. package/src/scss/AccountAddresses.scss +27 -0
  104. package/src/scss/AccountForm.scss +5 -0
  105. package/src/scss/AccountPoints.scss +17 -0
  106. package/src/scss/BuyTogether.scss +38 -0
  107. package/src/scss/CartItem.scss +17 -1
  108. package/src/scss/EarnPointsProgress.scss +6 -0
  109. package/src/scss/InstantSearch.scss +1 -0
  110. package/src/scss/KitProductVariations.scss +72 -0
  111. package/src/scss/LoginBlock.scss +5 -0
  112. package/src/scss/PaymentOption.scss +10 -1
  113. package/src/scss/ProductCard.scss +63 -25
  114. package/src/scss/ProductGallery.scss +4 -2
  115. package/src/scss/ProductQuickview.scss +36 -0
  116. package/src/scss/ProductVariations.scss +20 -4
  117. package/src/scss/QuantitySelector.scss +39 -0
  118. package/src/scss/RecommendedItems.scss +28 -0
  119. package/src/scss/SearchEngine.scss +9 -5
  120. package/src/scss/ShippingCalculator.scss +42 -1
  121. package/src/scss/ShippingLine.scss +24 -0
  122. package/src/scss/TheAccount.scss +4 -0
  123. package/src/scss/TheCart.scss +54 -0
  124. package/src/scss/TheProduct.scss +146 -1
  125. package/webpack.config.js +20 -6
@@ -69,6 +69,8 @@ export default {
69
69
  data () {
70
70
  return {
71
71
  sources: [],
72
+ imgWidth: 0,
73
+ imgHeight: 0,
72
74
  height: null,
73
75
  opacity: null
74
76
  }
@@ -89,7 +91,8 @@ export default {
89
91
  }
90
92
  const fixedSrc = typeof src === 'object'
91
93
  ? src.zoom
92
- ? src.zoom.url : defaultImgObj.url
94
+ ? src.zoom.url
95
+ : defaultImgObj.url
93
96
  : src
94
97
  return fixedSrc ? fixedSrc.replace(/\.webp$/, '') : this.placeholder
95
98
  },
@@ -115,10 +118,13 @@ export default {
115
118
  const imgObj = this.src[thumb]
116
119
  const { url, size } = (imgObj || this.defaultImgObj)
117
120
  srcset = url
118
- if (clientWidth && size && this.canCalcHeight) {
119
- const [width, height] = size.split('x').map(px => parseInt(px, 10))
120
- if (height) {
121
- this.height = `${(clientWidth >= width ? height : clientWidth * height / width)}px`
121
+ if (size) {
122
+ [this.imgWidth, this.imgHeight] = size.split('x').map(px => parseInt(px, 10))
123
+ if (clientWidth && this.imgHeight && this.canCalcHeight) {
124
+ this.height = (clientWidth >= this.imgWidth
125
+ ? this.imgHeight
126
+ : clientWidth * this.imgHeight / this.imgWidth) +
127
+ 'px'
122
128
  }
123
129
  }
124
130
  } else {
@@ -130,8 +136,18 @@ export default {
130
136
  srcset,
131
137
  type: 'image/webp'
132
138
  }, {
133
- srcset: srcset.replace(/\.webp$/, ''),
134
- type: `image/${(srcset.substr(-9, 4) === 'png' ? 'png' : 'jpeg')}`
139
+ srcset: /\/imgs\/[0-9]{3}px/.test(srcset)
140
+ ? srcset.replace(/\/imgs\/[0-9]{3}px/, '')
141
+ : srcset.replace(/\.webp$/, ''),
142
+ type: `image/${(srcset.substr(-9, 4) === '.png' ? 'png' : 'jpeg')}`
143
+ })
144
+ } else if (srcset.endsWith('.avif')) {
145
+ sources.push({
146
+ srcset,
147
+ type: 'image/avif'
148
+ }, {
149
+ srcset: srcset.replace('.avif', '.webp'),
150
+ type: 'image/webp'
135
151
  })
136
152
  } else {
137
153
  sources.push({ srcset })
@@ -151,6 +167,10 @@ export default {
151
167
  const { localFallbackSrc } = this
152
168
  const $img = $el.tagName === 'IMG' ? $el : $el.lastChild
153
169
  $img.style.opacity = 0
170
+ if (this.imgHeight) {
171
+ $img.height = this.imgHeight
172
+ $img.width = this.imgWidth
173
+ }
154
174
  $img.onerror = function () {
155
175
  console.error(new Error('Image load error'), this)
156
176
  $el.style.display = 'none'
package/src/js/APrices.js CHANGED
@@ -4,7 +4,8 @@ import {
4
4
  i19interestFree,
5
5
  i19of,
6
6
  i19to,
7
- i19upTo
7
+ i19upTo,
8
+ i19youEarn
8
9
  } from '@ecomplus/i18n'
9
10
 
10
11
  import {
@@ -14,14 +15,18 @@ import {
14
15
  formatMoney
15
16
  } from '@ecomplus/utils'
16
17
 
18
+ import waitStorefrontInfo from './helpers/wait-storefront-info'
19
+
17
20
  const getPriceWithDiscount = (price, discount) => {
18
21
  const { type, value } = discount
22
+ let priceWithDiscount
19
23
  if (value) {
20
24
  if (type === 'percentage') {
21
- return price * (100 - value) / 100
25
+ priceWithDiscount = price * (100 - value) / 100
22
26
  } else {
23
- return price - value
27
+ priceWithDiscount = price - value
24
28
  }
29
+ return priceWithDiscount > 0 ? priceWithDiscount : 0
25
30
  }
26
31
  }
27
32
 
@@ -35,11 +40,16 @@ export default {
35
40
  },
36
41
  isLiteral: Boolean,
37
42
  isBig: Boolean,
43
+ isAmountTotal: Boolean,
38
44
  installmentsOption: Object,
39
45
  discountOption: Object,
40
46
  discountText: {
41
47
  type: [String, Boolean],
42
48
  default: ''
49
+ },
50
+ canShowPriceOptions: {
51
+ type: Boolean,
52
+ default: true
43
53
  }
44
54
  },
45
55
 
@@ -53,9 +63,13 @@ export default {
53
63
  },
54
64
  extraDiscount: {
55
65
  type: null,
56
- value: 0
66
+ value: 0,
67
+ min_amount: 0
57
68
  },
58
- discountLabel: this.discountText
69
+ discountLabel: this.discountText,
70
+ pointsProgramName: null,
71
+ pointsMinPrice: 0,
72
+ earnPointsFactor: 0
59
73
  }
60
74
  },
61
75
 
@@ -66,10 +80,14 @@ export default {
66
80
  i19of: () => i18n(i19of),
67
81
  i19to: () => i18n(i19to),
68
82
  i19upTo: () => i18n(i19upTo),
83
+ i19youEarn: () => i18n(i19youEarn),
69
84
 
70
85
  price () {
71
86
  const price = getPrice(this.product)
72
- if (this.extraDiscount.value) {
87
+ if (
88
+ this.extraDiscount.value &&
89
+ (!this.extraDiscount.min_amount || price > this.extraDiscount.min_amount)
90
+ ) {
73
91
  return getPriceWithDiscount(price, this.extraDiscount)
74
92
  }
75
93
  return price
@@ -83,12 +101,29 @@ export default {
83
101
  }
84
102
  },
85
103
 
104
+ hasVariedPrices () {
105
+ const { variations } = this.product
106
+ if (variations) {
107
+ const productPrice = getPrice(this.product)
108
+ for (let i = 0; i < variations.length; i++) {
109
+ const price = getPrice({
110
+ ...this.product,
111
+ ...variations[i]
112
+ })
113
+ if (price > productPrice) {
114
+ return true
115
+ }
116
+ }
117
+ }
118
+ return false
119
+ },
120
+
86
121
  priceWithDiscount () {
87
- return getPriceWithDiscount(this.price, this.discount)
122
+ return this.canShowPriceOptions && getPriceWithDiscount(this.price, this.discount)
88
123
  },
89
124
 
90
125
  installmentValue () {
91
- if (this.installmentsNumber >= 2) {
126
+ if (this.canShowPriceOptions && this.installmentsNumber >= 2) {
92
127
  if (!this.monthlyInterest) {
93
128
  return this.price / this.installmentsNumber
94
129
  } else {
@@ -114,7 +149,11 @@ export default {
114
149
  },
115
150
 
116
151
  updateDiscount (discount) {
117
- if (discount && (!discount.min_amount || discount.min_amount <= this.price)) {
152
+ if (
153
+ discount &&
154
+ (!discount.min_amount || discount.min_amount <= this.price) &&
155
+ (!this.isAmountTotal || discount.apply_at === 'total')
156
+ ) {
118
157
  this.discount = discount
119
158
  if (!this.discountText && this.discountText !== false && discount.label) {
120
159
  this.discountLabel = `via ${discount.label}`
@@ -133,39 +172,39 @@ export default {
133
172
  },
134
173
 
135
174
  created () {
136
- const storefront = typeof window === 'object' && window.storefront
137
- if (this.discountOption) {
138
- this.updateDiscount(this.discountOption)
139
- } else if (storefront) {
140
- const getExtraDiscount = () => {
141
- const discountCampaign = storefront.info && storefront.info.apply_discount
142
- if (discountCampaign) {
143
- const discount = discountCampaign.available_extra_discount
144
- if (discount) {
145
- this.extraDiscount = discount
146
- }
147
- return Object.keys(discountCampaign).length > 0
148
- }
149
- return false
150
- }
151
- if (!getExtraDiscount()) {
152
- storefront.on('info:apply_discount', getExtraDiscount)
153
- }
154
- }
155
- if (this.installmentsOption) {
156
- this.updateInstallments(this.installmentsOption)
157
- } else if (storefront) {
158
- const getPaymentInfo = () => {
159
- const paymentInfo = storefront.info && storefront.info.list_payments
160
- if (paymentInfo) {
161
- this.updateInstallments(paymentInfo.installments_option)
162
- this.updateDiscount(paymentInfo.discount_option)
163
- return Object.keys(paymentInfo).length > 0
164
- }
165
- return false
175
+ if (this.canShowPriceOptions) {
176
+ if (this.discountOption) {
177
+ this.updateDiscount(this.discountOption)
178
+ } else {
179
+ waitStorefrontInfo('apply_discount')
180
+ .then(discountCampaign => {
181
+ if (discountCampaign.available_extra_discount) {
182
+ this.extraDiscount = discountCampaign.available_extra_discount
183
+ }
184
+ })
166
185
  }
167
- if (!getPaymentInfo()) {
168
- storefront.on('info:list_payments', getPaymentInfo)
186
+ if (this.installmentsOption) {
187
+ this.updateInstallments(this.installmentsOption)
188
+ } else {
189
+ waitStorefrontInfo('list_payments')
190
+ .then(paymentInfo => {
191
+ this.updateInstallments(paymentInfo.installments_option)
192
+ this.updateDiscount(paymentInfo.discount_option)
193
+ const pointsPrograms = paymentInfo.loyalty_points_programs
194
+ if (this.isLiteral && pointsPrograms) {
195
+ this.$nextTick(() => {
196
+ for (const programId in pointsPrograms) {
197
+ const pointsProgram = pointsPrograms[programId]
198
+ if (pointsProgram && pointsProgram.earn_percentage > 0) {
199
+ this.pointsMinPrice = pointsProgram.min_subtotal_to_earn
200
+ this.pointsProgramName = pointsProgram.name
201
+ this.earnPointsFactor = pointsProgram.earn_percentage / 100
202
+ break
203
+ }
204
+ }
205
+ })
206
+ }
207
+ })
169
208
  }
170
209
  }
171
210
  }
@@ -0,0 +1,83 @@
1
+ import {
2
+ i19email,
3
+ i19on,
4
+ i19share
5
+ } from '@ecomplus/i18n'
6
+
7
+ import { i18n } from '@ecomplus/utils'
8
+ import { ShareNetwork } from 'vue-social-sharing'
9
+
10
+ const shareNetworks = [
11
+ {
12
+ network: 'whatsapp',
13
+ name: 'WhatsApp',
14
+ icon: 'i-whatsapp',
15
+ color: '#25d366'
16
+ },
17
+ {
18
+ network: 'facebook',
19
+ name: 'Facebook',
20
+ icon: 'i-facebook',
21
+ color: '#1877f2'
22
+ },
23
+ {
24
+ network: 'twitter',
25
+ name: 'Twitter',
26
+ icon: 'i-twitter',
27
+ color: '#1da1f2'
28
+ },
29
+ {
30
+ network: 'telegram',
31
+ name: 'Telegram',
32
+ icon: 'i-telegram',
33
+ color: '#0088cc'
34
+ },
35
+ {
36
+ network: 'pinterest',
37
+ name: 'Pinterest',
38
+ icon: 'i-pinterest',
39
+ color: '#bd081c'
40
+ },
41
+ {
42
+ network: 'email',
43
+ name: 'Email',
44
+ icon: 'i-envelope',
45
+ color: '#333333'
46
+ },
47
+ {
48
+ network: 'sms',
49
+ name: 'SMS',
50
+ color: '#333333'
51
+ }
52
+ ]
53
+
54
+ export default {
55
+ name: 'TheProduct',
56
+
57
+ components: {
58
+ ShareNetwork
59
+ },
60
+
61
+ props: {
62
+ url: {
63
+ type: String,
64
+ required: true
65
+ },
66
+ title: String,
67
+ description: String
68
+ },
69
+
70
+ computed: {
71
+ i19email: () => i18n(i19email),
72
+ i19on: () => i18n(i19on).toLowerCase(),
73
+ i19share: () => i18n(i19share),
74
+ shareNetworks: () => shareNetworks,
75
+
76
+ localUrl () {
77
+ if (typeof window === 'object' && !this.url.startsWith('http')) {
78
+ return `https://${window.location.hostname}${this.url}`
79
+ }
80
+ return this.url
81
+ }
82
+ }
83
+ }
@@ -0,0 +1,201 @@
1
+ import {
2
+ i19edit,
3
+ i19newAddress,
4
+ i19noNumber,
5
+ i19remove
6
+ } from '@ecomplus/i18n'
7
+
8
+ import {
9
+ i18n,
10
+ fullName as getFullName,
11
+ randomObjectId
12
+ } from '@ecomplus/utils'
13
+
14
+ import AddressForm from './../AddressForm.vue'
15
+
16
+ const { sessionStorage } = window
17
+ const storageKey = 'ecomCustomerAddress'
18
+
19
+ export default {
20
+ name: 'AccountAddresses',
21
+
22
+ components: {
23
+ AddressForm
24
+ },
25
+
26
+ props: {
27
+ customer: {
28
+ type: Object,
29
+ default () {
30
+ return {}
31
+ }
32
+ },
33
+ zipCode: String,
34
+ formBtnText: String,
35
+ canShowForm: {
36
+ type: Boolean,
37
+ default: true
38
+ }
39
+ },
40
+
41
+ data () {
42
+ return {
43
+ isForm: false,
44
+ isNewAddress: false,
45
+ editAddressIndex: -1
46
+ }
47
+ },
48
+
49
+ computed: {
50
+ i19edit: () => i18n(i19edit),
51
+ i19newAddress: () => i18n(i19newAddress),
52
+ i19remove: () => i18n(i19remove),
53
+ i19noNumber: () => i18n(i19noNumber),
54
+
55
+ addresses () {
56
+ if (this.customer.addresses) {
57
+ return this.customer.addresses.map((addr) => {
58
+ if (!addr._id) {
59
+ addr._id = randomObjectId()
60
+ }
61
+ return addr
62
+ })
63
+ }
64
+ return []
65
+ },
66
+
67
+ localAddress: {
68
+ get () {
69
+ let address = this.addresses[this.editAddressIndex]
70
+ if (!address) {
71
+ address = {}
72
+ if (this.zipCode) {
73
+ address.zip = this.zipCode
74
+ }
75
+ if (this.customer.name) {
76
+ address.name = getFullName(this.customer).substr(0, 70)
77
+ }
78
+ }
79
+ return address
80
+ },
81
+ set (address) {
82
+ const addresses = [].concat(this.addresses)
83
+ addresses[this.editAddressIndex] = address
84
+ this.$emit('update:customer', {
85
+ ...this.customer,
86
+ addresses
87
+ })
88
+ if (address.zip) {
89
+ this.isNewAddress = false
90
+ this.selectAddress(address)
91
+ }
92
+ this.isForm = false
93
+ }
94
+ }
95
+ },
96
+
97
+ methods: {
98
+ getLineAddress (address) {
99
+ if (address.line_address) {
100
+ return address.line_address
101
+ } else {
102
+ let lineAddress = `${address.street} ${(address.number || this.i19noNumber)}`
103
+ if (address.complement) {
104
+ lineAddress += ` - ${address.complement}`
105
+ }
106
+ if (address.borough) {
107
+ lineAddress += `, ${address.borough}`
108
+ }
109
+ return lineAddress
110
+ }
111
+ },
112
+
113
+ selectAddress (address) {
114
+ this.$emit('select-address', address._id)
115
+ sessionStorage.setItem(storageKey, JSON.stringify(address))
116
+ },
117
+
118
+ removeAddress (index) {
119
+ const addresses = [].concat(this.addresses)
120
+ addresses.splice(index, 1)
121
+ this.$emit('update:customer', {
122
+ ...this.customer,
123
+ addresses
124
+ })
125
+ }
126
+ },
127
+
128
+ watch: {
129
+ addresses (newList, oldList) {
130
+ if (!oldList.length) {
131
+ if (newList.length && this.isNewAddress) {
132
+ this.isForm = this.isNewAddress = false
133
+ }
134
+ } else if (!newList.length) {
135
+ this.isForm = this.isNewAddress = true
136
+ }
137
+ },
138
+
139
+ isNewAddress (isAddAddress) {
140
+ if (isAddAddress) {
141
+ this.editAddressIndex = this.addresses.length
142
+ this.isForm = true
143
+ }
144
+ },
145
+
146
+ editAddressIndex (index) {
147
+ if (index > -1) {
148
+ const address = this.addresses[index]
149
+ if (address) {
150
+ this.selectAddress(address)
151
+ }
152
+ this.isForm = true
153
+ }
154
+ },
155
+
156
+ isForm (isVisible) {
157
+ this.$emit('show-form', isVisible)
158
+ if (!isVisible) {
159
+ this.editAddressIndex = -1
160
+ }
161
+ }
162
+ },
163
+
164
+ created () {
165
+ if (!this.addresses.length) {
166
+ this.isNewAddress = true
167
+ const sessionAddress = JSON.parse(sessionStorage.getItem(storageKey))
168
+ if (sessionAddress) {
169
+ const address = {}
170
+ for (const field in sessionAddress) {
171
+ if (sessionAddress[field]) {
172
+ address[field] = sessionAddress[field]
173
+ }
174
+ }
175
+ if (address._id && address.zip && address.street) {
176
+ this.editAddressIndex = 0
177
+ this.$nextTick(() => {
178
+ this.localAddress = address
179
+ })
180
+ }
181
+ }
182
+ } else {
183
+ let addressIndex
184
+ if (this.zipCode) {
185
+ addressIndex = this.addresses.findIndex(addr => addr.zip === this.zipCode)
186
+ }
187
+ if (!(addressIndex >= 0)) {
188
+ addressIndex = this.addresses.findIndex(addr => addr.default)
189
+ if (addressIndex === -1) {
190
+ addressIndex = 0
191
+ }
192
+ }
193
+ const address = this.addresses[addressIndex]
194
+ if (address.name && ((address.street && address.city) || address.name.endsWith('*'))) {
195
+ this.selectAddress(address)
196
+ } else {
197
+ this.editAddressIndex = addressIndex
198
+ }
199
+ }
200
+ }
201
+ }