@wikala/spmkt 2.14.0 → 2.16.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/api/address.js CHANGED
@@ -42,9 +42,6 @@ const Address = {
42
42
  if(!allowedTypes.includes(address.type)) {
43
43
  addressType = allowedTypes[0]
44
44
  }
45
- if(address.company_name && address.company_name !== '') {
46
- addressType = 'business'
47
- }
48
45
  return addressType
49
46
  },
50
47
 
@@ -516,7 +516,7 @@ export default {
516
516
  }
517
517
  }
518
518
 
519
- if(this.addressData.company_name || this.addressData.company_business_id || this.addressData.company_tax_id) {
519
+ if(this.addressData.type === 'business') {
520
520
  this.businessAddress = true
521
521
  this.onChangeIsBusiness(true)
522
522
  }
@@ -179,10 +179,9 @@ export default {
179
179
  if(!this.validate()) {
180
180
  return
181
181
  }
182
- //console.log('validate ok')
183
- this.scrollToElement('.cart-top')
184
182
  this.setGuestMode(true)
185
183
  this.setActiveStep(this.steps.delivery)
184
+ this.scrollToElement('.cart-top')
186
185
  },
187
186
 
188
187
  clearError(field) {
@@ -193,22 +193,22 @@ export default {
193
193
 
194
194
  async onDeliveryTypeInput(pl) {
195
195
  //console.log('onDeliveryTypeInput', pl, this.deliveryTypes)
196
-
197
- this.resetDeliveryOptions()
198
-
199
196
  let deliveryMethods = _.findWhere(this.deliveryTypes, { type: pl })['methods']
200
197
  if(deliveryMethods || deliveryMethods.length === 1) {
201
198
  //console.log('setDeliveryMethodId to', deliveryMethods[0]['id'])
202
199
  this.setDeliveryMethodId(deliveryMethods[0]['id'])
203
200
  }
204
201
 
205
- if(pl === 'pickup') {
206
- this.addressValid = true
202
+ if(this.deliveryType === pl) {
203
+ return
207
204
  }
208
205
 
209
- await this.getReservationSlots()
206
+ this.resetDeliveryOptions()
210
207
 
211
- //console.log('checkoutRequestData', JSON.parse(JSON.stringify(this.checkoutRequestData)))
208
+ if(pl === 'pickup') {
209
+ this.addressValid = true
210
+ await this.getReservationSlots()
211
+ }
212
212
  },
213
213
 
214
214
  resetDeliveryOptions() {
@@ -71,7 +71,7 @@ export default {
71
71
  return {
72
72
  addressValid: false,
73
73
  validationErrors: {},
74
- editAutocompleteAddress: false
74
+ editAutocompleteAddress: false,
75
75
  }
76
76
  },
77
77
 
@@ -117,7 +117,6 @@ export default {
117
117
  await this.validateAddress(this.checkoutRequestData.shipping_address)
118
118
  this.addressValid = true
119
119
  this.$emit('addressValidation', true)
120
- this.scrollToElement('.delivery-method')
121
120
  } catch (e) {
122
121
  this.validationErrors = e.errors
123
122
  this.$buefy.toast.open({
@@ -136,6 +135,7 @@ export default {
136
135
  this.setBillingAddress(this.checkoutRequestData.shipping_address)
137
136
  try {
138
137
  await this.getAvailableDeliveryMethods(this.checkoutRequestData.shipping_address)
138
+ this.scrollToElement('.delivery-method')
139
139
  } catch (error) {
140
140
  this.addressValid = false
141
141
  this.$emit('addressValidation', false)
@@ -185,10 +185,12 @@ export default {
185
185
  },
186
186
 
187
187
  setDeliveryAddressUserIdentity() {
188
- this.setDeliveryAddress(createLocalizedVersionAddress(this.initialState, this.$LC, this.countryList))
189
- this.checkoutRequestData.shipping_address.first_name = this.userIdentity.first_name
190
- this.checkoutRequestData.shipping_address.last_name = this.userIdentity.last_name
191
- this.checkoutRequestData.shipping_address.phone = this.userIdentity.phone
188
+ let shipping_address = this.checkoutRequestData.shipping_address;
189
+ let fields = ['first_name', 'last_name', 'phone']
190
+ if(fields.some(f => { return shipping_address[f] !== this.userIdentity[f]})) {
191
+ this.setDeliveryAddress(createLocalizedVersionAddress(this.initialState, this.$LC, this.countryList))
192
+ fields.forEach(f => { this.checkoutRequestData.shipping_address[f] = this.userIdentity[f] })
193
+ }
192
194
  }
193
195
 
194
196
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikala/spmkt",
3
- "version": "2.14.0",
3
+ "version": "2.16.0",
4
4
  "private": false,
5
5
  "description": "supermarket",
6
6
  "scripts": {
@@ -30,6 +30,7 @@
30
30
  "@babel/plugin-proposal-optional-chaining": "^7.14.5",
31
31
  "@vue/cli-plugin-babel": "^4.5.13",
32
32
  "@vue/cli-service": "^4.5.13",
33
+ "@vue/runtime-dom": "^3.3.8",
33
34
  "axios": "^0.21.1",
34
35
  "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
35
36
  "bootstrap-sass": "^3.4.1",
package/tsconfig.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "compilerOptions": {
3
+ // ...
4
+ },
5
+ "vueCompilerOptions": {
6
+ "target": 2, // For Vue version <= 2.6.14
7
+ }
8
+ }