@wikala/spmkt 2.31.0 → 3.0.0-beta.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.
Files changed (124) hide show
  1. package/MIGRATION_GUIDE.md +261 -0
  2. package/api/product.js +1 -0
  3. package/api/request.js +9 -4
  4. package/api/user.js +1 -1
  5. package/components/Account/AccountDashboard.vue +101 -101
  6. package/components/Account/AccountStore.js +57 -31
  7. package/components/Account/AffiliateReport.vue +56 -60
  8. package/components/Account/{OrderDetail.vue → Orders/OrderDetail.vue} +44 -30
  9. package/components/Account/Orders/Orders.vue +124 -0
  10. package/components/Account/{AccountSettings.vue → Settings/AccountSettings.vue} +4 -4
  11. package/components/Account/Settings/ChangeEmail.vue +136 -0
  12. package/components/Account/Settings/ChangeName.vue +82 -0
  13. package/components/Account/Settings/ChangePassword.vue +91 -0
  14. package/components/Address/Address.vue +38 -57
  15. package/components/Address/AddressBook.vue +77 -57
  16. package/components/Address/AddressSelect.vue +94 -87
  17. package/components/Address/Edit.vue +253 -265
  18. package/components/Address/PostalCode.vue +22 -21
  19. package/components/AgeGate.vue +11 -5
  20. package/components/Auth/Login.vue +62 -44
  21. package/components/Auth/Register.vue +82 -60
  22. package/components/Auth/ResetPassword.vue +45 -30
  23. package/components/Cart/AgeVerification/AgeChecker.vue +3 -3
  24. package/components/Cart/CartBadge.vue +15 -4
  25. package/components/Cart/CartBox.vue +19 -11
  26. package/components/Cart/CartItem.vue +3 -3
  27. package/components/Cart/CartMode.vue +6 -5
  28. package/components/Cart/CartPreview.vue +24 -18
  29. package/components/Cart/Coupon.vue +4 -5
  30. package/components/Cart/CreditCard/Everyware.vue +10 -10
  31. package/components/Cart/CreditCard/ExtendedCreditCard.vue +5 -5
  32. package/components/Cart/CreditCard/SquarePay.vue +18 -16
  33. package/components/Cart/CreditCard/StandardCreditCard.vue +9 -9
  34. package/components/Cart/Delivery/Delivery.vue +16 -12
  35. package/components/Cart/Delivery/DeliveryAddress.vue +1 -1
  36. package/components/Cart/Delivery/DeliveryMethods.vue +1 -1
  37. package/components/Cart/Delivery/DeliveryOptions.vue +15 -9
  38. package/components/Cart/Delivery/DeliveryTypes.vue +8 -5
  39. package/components/Cart/Delivery/ReservationSlots.vue +14 -8
  40. package/components/Cart/Disclaimer.vue +1 -1
  41. package/components/Cart/OrderConfirmation.vue +1 -1
  42. package/components/Cart/Payment/Payment.vue +37 -33
  43. package/components/Cart/Payment/PaymentMethods.vue +6 -4
  44. package/components/Cart/ReviewAndSubmit.vue +9 -7
  45. package/components/Cart/ShoppingCart.vue +42 -31
  46. package/components/Cart/Store/actions.js +1 -1
  47. package/components/Cart/Store/getters.js +2 -1
  48. package/components/Cart/Store/index.js +1 -1
  49. package/components/Cart/Store/mutations.js +7 -5
  50. package/components/Cart/UserIdentity.vue +1 -1
  51. package/components/Category/CategoryFilter.vue +128 -114
  52. package/components/Category/CategorySort.vue +44 -32
  53. package/components/Category/LoadMore.vue +39 -23
  54. package/components/DeliverTo.vue +10 -15
  55. package/components/DeliveryNotice.vue +72 -68
  56. package/components/DobInput.vue +23 -23
  57. package/components/Gmaps/GmapsAutocomplete.vue +139 -78
  58. package/components/Gmaps/GmapsLocations.vue +1 -1
  59. package/components/Gmaps/GmapsSingleLocation.vue +121 -87
  60. package/components/ModalContainer/ModalContainer.vue +12 -9
  61. package/components/ModalContainer/index.js +61 -18
  62. package/components/Product/AddToCart.vue +237 -221
  63. package/components/Product/BoxAddToCart.vue +114 -86
  64. package/components/Product/Compare.vue +68 -48
  65. package/components/Product/CompareBox.vue +128 -123
  66. package/components/Product/Lookup.vue +92 -65
  67. package/components/Product/Photo.vue +105 -66
  68. package/components/Product/Price.vue +64 -43
  69. package/components/Product/ProductAutocomplete.vue +52 -57
  70. package/components/Product/ProductBox.vue +61 -38
  71. package/components/Product/ProductImages.vue +83 -86
  72. package/components/Product/Quantity.vue +115 -53
  73. package/components/Product/QuickView.vue +52 -45
  74. package/components/Product/RelatedProducts.vue +88 -23
  75. package/components/Product/SKU.vue +27 -8
  76. package/components/Product/Variants.vue +335 -341
  77. package/components/Product/reviews-questions/ProductQuestions.vue +226 -198
  78. package/components/Product/reviews-questions/ProductReviews.vue +122 -107
  79. package/components/Product/reviews-questions/Review.vue +54 -59
  80. package/components/Product/reviews-questions/ReviewForm.vue +222 -170
  81. package/components/Product/reviews-questions/ReviewImages.vue +197 -216
  82. package/components/Product/reviews-questions/Vote.vue +83 -57
  83. package/components/QuantityInput.vue +18 -8
  84. package/components/RangeInput.vue +15 -8
  85. package/components/Recaptcha.vue +8 -1
  86. package/components/SelectShippingCountry.vue +81 -62
  87. package/components/TimedOffer.vue +59 -74
  88. package/composables/globals.js +53 -0
  89. package/config.js +5 -2
  90. package/index.js +41 -10
  91. package/install.js +75 -0
  92. package/locales/en.json +2 -1
  93. package/locales/sr.json +2 -1
  94. package/package.json +43 -30
  95. package/utils/directives.js +28 -45
  96. package/utils/event-bus.js +56 -0
  97. package/utils/filters.js +24 -7
  98. package/utils/{gmaps.js → google/gmaps.js} +43 -10
  99. package/utils/{google-analytics-eec.js → google/google-analytics-eec.js} +7 -7
  100. package/babel.config.js +0 -5
  101. package/components/Account/ChangeEmail.vue +0 -133
  102. package/components/Account/ChangeName.vue +0 -92
  103. package/components/Account/ChangePassword.vue +0 -94
  104. package/components/Account/CreditCards.vue +0 -18
  105. package/components/Account/Orders.vue +0 -110
  106. package/components/Account/Settings.vue +0 -18
  107. package/components/Cart/Delivery/DeliveryAddressGuest.spec.js +0 -128
  108. package/components/Cart/Delivery/DeliveryTypes.spec.js +0 -83
  109. package/components/Cart/PCIBadge/SecurityMetrics.vue +0 -11
  110. package/components/Instagram.vue +0 -49
  111. package/components/ProductImageModal.vue +0 -41
  112. package/jest.config.js +0 -16
  113. package/test/e2e/.babelrc.js +0 -8
  114. package/test/e2e/.eslintrc.js +0 -11
  115. package/test/e2e/accAuth.spec.js +0 -64
  116. package/test/e2e/ageGate.spec.js +0 -26
  117. package/test/e2e/checkout.spec.js +0 -106
  118. package/test/e2e/compare.spec.js +0 -52
  119. package/test/e2e/config/data.js +0 -21
  120. package/test/e2e/config/routes.js +0 -11
  121. package/test/e2e/region.spec.js +0 -46
  122. package/test/e2e/search.spec.js +0 -32
  123. package/tests/vueBuefy.js +0 -4
  124. package/tsconfig.json +0 -8
@@ -16,7 +16,7 @@
16
16
  <div>{{ formatMoney(item.price, { precision: 2 }) }}</div>
17
17
  </div>
18
18
  <div class="ci-qty">
19
- <quantity-input :value="itemQty" @input="changeQty($event, item.id)"></quantity-input>
19
+ <quantity-input :modelValue="itemQty" @update:modelValue="changeQty($event, item.id)"></quantity-input>
20
20
  </div>
21
21
  </div>
22
22
  <div v-if="item.error" :class="{ 'ci-error-msg': item.error }">
@@ -29,7 +29,7 @@
29
29
  import { mapState, mapMutations } from 'vuex'
30
30
 
31
31
  import { formatMoney } from '../../utils/filters'
32
- import GoogleAnalyticsEEC from '../../utils/google-analytics-eec.js'
32
+ import GoogleAnalyticsEEC from '../../utils/google/google-analytics-eec.js'
33
33
 
34
34
  import { Cart } from '../../api'
35
35
  import QuantityInput from '../../components/QuantityInput'
@@ -81,7 +81,7 @@ export default {
81
81
  variant: this.item.variant
82
82
  })
83
83
  }
84
- this.$bus.$emit('updateTotalQty', response.data.sumQty)
84
+ this.$bus.emit('updateTotalQty', response.data.sumQty)
85
85
  cqLoading.close()
86
86
  let responseItem = response.data.items.find(item => item.id === productId)
87
87
  if(responseItem) {
@@ -47,7 +47,7 @@
47
47
  type="password"
48
48
  v-model="userIdentity.password"
49
49
  :placeholder="$t('auth.passwordInfo')"
50
- @input="clearError('password')"
50
+ @update:model-value="clearError('password')"
51
51
  @focus="clearError('password')"
52
52
  />
53
53
  </b-field>
@@ -63,7 +63,7 @@
63
63
  name="password_confirmation"
64
64
  type="password"
65
65
  v-model="userIdentity.password_confirmation"
66
- @input="clearError('password_confirmation')"
66
+ @update:model-value="clearError('password_confirmation')"
67
67
  @focus="clearError('password_confirmation')"
68
68
  />
69
69
  </b-field>
@@ -78,7 +78,7 @@
78
78
  </div>
79
79
  </template>
80
80
 
81
- <b-modal :active="showLoginModal" @close="showLoginModal = false" custom-class="wkl-modal-container" :can-cancel="['escape', 'outside']">
81
+ <b-modal v-model="showLoginModal" custom-class="wkl-modal-container" :can-cancel="['escape', 'outside']">
82
82
  <Login
83
83
  :title="initialState.loginTitle"
84
84
  :createAccountTitle="initialState.createAccountTitle"
@@ -97,10 +97,11 @@ import { mapMutations, mapState } from 'vuex'
97
97
  import { request } from '../../api'
98
98
 
99
99
  import UserIdentity from './UserIdentity'
100
+ import Login from '../Auth/Login'
100
101
 
101
102
  export default {
102
103
  name: 'CartMode',
103
- components: { UserIdentity },
104
+ components: { UserIdentity, Login },
104
105
 
105
106
  data() {
106
107
  return {
@@ -166,7 +167,7 @@ export default {
166
167
  let hasErrors = false
167
168
  for(let field in fields) {
168
169
  if (!this.userIdentity[field]) {
169
- this.$set(this.userIdentityErrors, field, fields[field])
170
+ this.userIdentityErrors[field] = fields[field]
170
171
  }
171
172
  if(this.userIdentityErrors[field]) {
172
173
  hasErrors = true
@@ -77,6 +77,20 @@ export default {
77
77
  methods: {
78
78
  ...mapMutations(['setActiveStep', 'setCartStep', 'setGuestMode']),
79
79
 
80
+ onUpdateTotalQty(totalItems) {
81
+ totalItems < 1 ? (this.emptyCart = true) : (this.emptyCart = false)
82
+ },
83
+
84
+ onGuestMode(flag) {
85
+ if (flag === 'On') {
86
+ this.setGuestMode(true)
87
+ this.closeModal()
88
+ this.$bus.emit('setStep', this.steps.delivery)
89
+ } else {
90
+ this.setGuestMode(false)
91
+ }
92
+ },
93
+
80
94
  loginSuccessful() {
81
95
  window.location.href = '/shopping-cart?step=delivery'
82
96
  },
@@ -90,7 +104,7 @@ export default {
90
104
  })
91
105
  return false
92
106
  }
93
- this.$bus.$emit('nextStep')
107
+ this.$bus.emit('nextStep')
94
108
  /*if (!User.isLogged() && !this.guestMode) {
95
109
  this.openModal('Login', {
96
110
  title: this.$t('cart.proceedToCheckoutLoginTitle'),
@@ -101,9 +115,9 @@ export default {
101
115
  } else {
102
116
  if (User.isLogged()) {
103
117
  this.setGuestMode(false)
104
- this.$bus.$emit('nextStep')
118
+ this.$bus.emit('nextStep')
105
119
  } else if (this.guestMode) {
106
- this.$bus.$emit('nextStep')
120
+ this.$bus.emit('nextStep')
107
121
  }
108
122
  }*/
109
123
  }
@@ -116,7 +130,7 @@ export default {
116
130
  Cart.update({ id: productId, qty: 0 })
117
131
  .then((response) => {
118
132
  //vm.cart = response.data
119
- //vm.$bus.$emit('updateCart', response.data)
133
+ //vm.$bus.emit('updateCart', response.data)
120
134
  loading.close()
121
135
  this.$store.commit('setCart', response.data)
122
136
  window.location.reload()
@@ -138,23 +152,15 @@ export default {
138
152
  },
139
153
 
140
154
  mounted() {
141
- let vm = this
142
-
143
155
  this.initialState.cart.sumQty < 1 ? (this.emptyCart = true) : (this.emptyCart = false)
144
156
 
145
- this.$bus.$on('updateTotalQty', (totalItems) => {
146
- totalItems < 1 ? (this.emptyCart = true) : (this.emptyCart = false)
147
- })
157
+ this.$bus.on('updateTotalQty', this.onUpdateTotalQty)
158
+ this.$bus.on('guestMode', this.onGuestMode)
159
+ },
148
160
 
149
- this.$bus.$on('guestMode', (flag) => {
150
- if (flag === 'On') {
151
- vm.setGuestMode(true)
152
- vm.closeModal()
153
- vm.$bus.$emit('setStep', this.steps.delivery)
154
- } else {
155
- vm.setGuestMode(false)
156
- }
157
- })
161
+ beforeUnmount() {
162
+ this.$bus.off('updateTotalQty', this.onUpdateTotalQty)
163
+ this.$bus.off('guestMode', this.onGuestMode)
158
164
  }
159
165
  }
160
166
  </script>
@@ -6,10 +6,10 @@
6
6
  <button name="enter_coupon" @click="applyCoupon" class="button is-small" :class="{ 'is-loading': acLoading }">{{ $t('cart.applyCoupon') }}</button>
7
7
  </div>
8
8
  <!-- Coupon the shop offers to this customer, passed by the server in initial state as offered_coupon -->
9
- <div v-if="showOfferedCoupon" class="pc-offer" data-test="offered-coupon">
9
+ <div v-if="offeredCoupon" class="pc-offer" data-test="offered-coupon">
10
10
  <div>
11
11
  {{ $t('cart.offeredCoupon') }}: <strong class="pc-offer-code">{{ offeredCoupon.code }}</strong>
12
- <button type="button" name="apply_offered_coupon" class="button is-small pc-offer-apply" @click="applyCode(offeredCoupon.code)">{{ $t('cart.applyOfferedCoupon') }}</button>
12
+ <button v-if="!offeredCouponApplied" type="button" name="apply_offered_coupon" class="button is-small pc-offer-apply" @click="applyCode(offeredCoupon.code)">{{ $t('cart.applyOfferedCoupon') }}</button>
13
13
  </div>
14
14
  <div class="pc-offer-details">
15
15
  {{ offeredCoupon.description }}
@@ -61,9 +61,8 @@ export default {
61
61
  computed: {
62
62
  ...mapState(['cart']),
63
63
 
64
- showOfferedCoupon() {
65
- return this.offeredCoupon !== null
66
- && String(this.cart.coupon_code || '').toUpperCase() !== this.offeredCoupon.code.toUpperCase()
64
+ offeredCouponApplied() {
65
+ return String(this.cart.coupon_code || '').toUpperCase() === this.offeredCoupon.code.toUpperCase()
67
66
  }
68
67
  },
69
68
  methods: {
@@ -14,8 +14,8 @@
14
14
  type="tel"
15
15
  v-model="cardNumber"
16
16
  :maxlength="cardNumberMaxLength"
17
- @input="changeCardNumber"
18
- @paste.native="pasteCardNumber"
17
+ @update:model-value="changeCardNumber"
18
+ @paste="pasteCardNumber"
19
19
  novalidate
20
20
  ></b-input>
21
21
  </b-field>
@@ -62,8 +62,8 @@
62
62
  ref="phone"
63
63
  type="tel"
64
64
  v-model="maskedPhoneNumber"
65
- @input="changePhone"
66
- @paste.native="changePhone"
65
+ @update:model-value="changePhone"
66
+ @paste="changePhone"
67
67
  maxlength="14"
68
68
  :has-counter="false"
69
69
  >
@@ -208,13 +208,13 @@ export default {
208
208
  if (!this.cardData.card_number) {
209
209
  console.log('no cc')
210
210
  hasErrors = true
211
- this.$set(this.validationErrors, 'card_number', 'Enter your credit card number')
211
+ this.validationErrors['card_number'] = 'Enter your credit card number'
212
212
  }
213
213
 
214
214
  /*if(!this.isCardNumberValid()) {
215
215
  console.log('invalid card', this.cardNumber)
216
216
  hasErrors = true
217
- this.$set(this.validationErrors, 'card_number', 'Enter valid credit card number')
217
+ this.validationErrors['card_number'] = 'Enter valid credit card number'
218
218
  //this.validationErrors.card_number = 'Enter valid credit card number'
219
219
  console.log(this.validationErrors)
220
220
  }*/
@@ -222,25 +222,25 @@ export default {
222
222
  if (!this.cardData.card_expiry_month) {
223
223
  console.log('no expm')
224
224
  hasErrors = true
225
- this.$set(this.validationErrors, 'card_expiry_month', 'Expiry month')
225
+ this.validationErrors['card_expiry_month'] = 'Expiry month'
226
226
  }
227
227
 
228
228
  if (!this.cardData.card_expiry_year) {
229
229
  console.log('no expy')
230
230
  hasErrors = true
231
- this.$set(this.validationErrors, 'card_expiry_year', 'Expiry year')
231
+ this.validationErrors['card_expiry_year'] = 'Expiry year'
232
232
  }
233
233
 
234
234
  if (!this.cardData.card_cvv) {
235
235
  console.log('no cvv')
236
236
  hasErrors = true
237
- this.$set(this.validationErrors, 'card_cvv', 'Enter your card verification number')
237
+ this.validationErrors['card_cvv'] = 'Enter your card verification number'
238
238
  }
239
239
 
240
240
  if (!this.cardData.cell_phone) {
241
241
  console.log('no cellphone')
242
242
  hasErrors = true
243
- this.$set(this.validationErrors, 'cell_phone', 'Enter your cell phone number')
243
+ this.validationErrors['cell_phone'] = 'Enter your cell phone number'
244
244
  }
245
245
 
246
246
  if (hasErrors) {
@@ -14,8 +14,8 @@
14
14
  type="tel"
15
15
  v-model="cardNumber"
16
16
  :maxlength="cardNumberMaxLength"
17
- @input="changeCardNumber"
18
- @paste.native="pasteCardNumber"
17
+ @update:model-value="changeCardNumber"
18
+ @paste="pasteCardNumber"
19
19
  novalidate
20
20
  />
21
21
  </b-field>
@@ -59,7 +59,7 @@
59
59
  maxlength="4"
60
60
  :has-counter="false"
61
61
  v-model="cardData.card_cvv"
62
- @input="changeCVV"
62
+ @update:model-value="changeCVV"
63
63
  ></b-input>
64
64
  </b-field>
65
65
  <b-icon v-if="!errors.card_cvv" icon="lock-alt"></b-icon>
@@ -222,9 +222,9 @@ export default {
222
222
  for(let field in fields) {
223
223
  if(!this.cardData[field]) {
224
224
  hasErrors = true
225
- this.$set(this.errors, field, fields[field])
225
+ this.errors[field] = fields[field]
226
226
  } else {
227
- this.$set(this.errors, field, '')
227
+ this.errors[field] = ''
228
228
  }
229
229
  }
230
230
 
@@ -157,24 +157,20 @@ export default {
157
157
  this.paymentForm.requestCardNonce()
158
158
  },
159
159
 
160
- processEvents() {
161
- this.$bus.$on('shippingAddressChange', (address) => {
162
- if (typeof this.paymentForm.setPostalCode === 'function' && this.squareLoading === false) {
163
- this.paymentForm.setPostalCode(address.postcode)
164
- }
165
- })
160
+ onAddressChange(address) {
161
+ this.onPostalCodeChange(address.postcode)
162
+ },
166
163
 
167
- this.$bus.$on('billingAddressChange', (address) => {
168
- if (typeof this.paymentForm.setPostalCode === 'function' && this.squareLoading === false) {
169
- this.paymentForm.setPostalCode(address.postcode)
170
- }
171
- })
164
+ onPostalCodeChange(postalCode) {
165
+ if (typeof this.paymentForm.setPostalCode === 'function' && this.squareLoading === false) {
166
+ this.paymentForm.setPostalCode(postalCode)
167
+ }
168
+ },
172
169
 
173
- this.$bus.$on('postalCodeChange', (postalCode) => {
174
- if (typeof this.paymentForm.setPostalCode === 'function' && this.squareLoading === false) {
175
- this.paymentForm.setPostalCode(postalCode)
176
- }
177
- })
170
+ processEvents() {
171
+ this.$bus.on('shippingAddressChange', this.onAddressChange)
172
+ this.$bus.on('billingAddressChange', this.onAddressChange)
173
+ this.$bus.on('postalCodeChange', this.onPostalCodeChange)
178
174
  },
179
175
 
180
176
  checkPaymentFormTimeout() {
@@ -242,6 +238,12 @@ export default {
242
238
  this.checkPaymentFormTimeout()
243
239
 
244
240
  this.processEvents()
241
+ },
242
+
243
+ beforeUnmount() {
244
+ this.$bus.off('shippingAddressChange', this.onAddressChange)
245
+ this.$bus.off('billingAddressChange', this.onAddressChange)
246
+ this.$bus.off('postalCodeChange', this.onPostalCodeChange)
245
247
  }
246
248
  }
247
249
  </script>
@@ -14,8 +14,8 @@
14
14
  type="tel"
15
15
  v-model="cardNumber"
16
16
  :maxlength="cardNumberMaxLength"
17
- @input="changeCardNumber"
18
- @paste.native="pasteCardNumber"
17
+ @update:model-value="changeCardNumber"
18
+ @paste="pasteCardNumber"
19
19
  novalidate
20
20
  autocomplete="cc-number"
21
21
  ></b-input>
@@ -58,7 +58,7 @@
58
58
  maxlength="4"
59
59
  :has-counter="false"
60
60
  v-model="cardData.card_cvv"
61
- @input="changeCVV"
61
+ @update:model-value="changeCVV"
62
62
  autocomplete="cc-csc"
63
63
  ></b-input>
64
64
  </b-field>
@@ -196,37 +196,37 @@ export default {
196
196
  if (!this.cardData.card_number) {
197
197
  console.log('no cc')
198
198
  hasErrors = true
199
- this.$set(this.validationErrors, 'card_number', 'Enter your credit card number')
199
+ this.validationErrors['card_number'] = 'Enter your credit card number'
200
200
  }
201
201
 
202
202
  /*if(!this.isCardNumberValid()) {
203
203
  console.log('invalid card')
204
204
  hasErrors = true
205
- this.$set(this.validationErrors, 'card_number', 'Enter valid credit card number')
205
+ this.validationErrors['card_number'] = 'Enter valid credit card number'
206
206
  }*/
207
207
 
208
208
  if (!this.cardData.card_expiry_month) {
209
209
  console.log('no expm')
210
210
  hasErrors = true
211
- this.$set(this.validationErrors, 'card_expiry_month', 'Expiry month')
211
+ this.validationErrors['card_expiry_month'] = 'Expiry month'
212
212
  }
213
213
 
214
214
  if (!this.cardData.card_expiry_year) {
215
215
  console.log('no expy')
216
216
  hasErrors = true
217
- this.$set(this.validationErrors, 'card_expiry_year', 'Expiry year')
217
+ this.validationErrors['card_expiry_year'] = 'Expiry year'
218
218
  }
219
219
 
220
220
  if (!this.cardData.card_cvv) {
221
221
  console.log('no cvv')
222
222
  hasErrors = true
223
- this.$set(this.validationErrors, 'card_cvv', 'Enter your card verification number')
223
+ this.validationErrors['card_cvv'] = 'Enter your card verification number'
224
224
  }
225
225
 
226
226
  if (!this.cardData.name_on_card) {
227
227
  console.log('no name on card')
228
228
  hasErrors = true
229
- this.$set(this.validationErrors, 'name_on_card', 'Enter name on card')
229
+ this.validationErrors['name_on_card'] = 'Enter name on card'
230
230
  }
231
231
 
232
232
  if (hasErrors) {
@@ -12,9 +12,9 @@
12
12
  <div v-if="['user', 'guest'].includes(cartMode)">
13
13
  <DeliveryTypes
14
14
  v-if="deliveryTypes.length > 0"
15
- v-model="deliveryType"
15
+ :modelValue="deliveryType"
16
16
  :error="deliveryTypeError"
17
- @input="onDeliveryTypeInput"
17
+ @update:modelValue="onDeliveryTypeInput"
18
18
  />
19
19
  </div>
20
20
 
@@ -193,21 +193,25 @@ export default {
193
193
 
194
194
  async onDeliveryTypeInput(pl) {
195
195
  //console.log('onDeliveryTypeInput', pl, this.deliveryTypes)
196
- let deliveryMethods = _.findWhere(this.deliveryTypes, { type: pl })['methods']
197
- if(deliveryMethods || deliveryMethods.length === 1) {
198
- //console.log('setDeliveryMethodId to', deliveryMethods[0]['id'])
199
- this.setDeliveryMethodId(deliveryMethods[0]['id'])
196
+ // DeliveryTypes re-emits the current type when this step remounts (e.g. moving
197
+ // back from payment); only a real change resets the entered delivery data
198
+ let typeChanged = this.deliveryType !== pl
199
+ if(typeChanged) {
200
+ this.resetDeliveryOptions()
201
+ this.deliveryType = pl
200
202
  }
201
203
 
202
- if(this.deliveryType === pl) {
203
- return
204
+ let deliveryType = _.findWhere(this.deliveryTypes, { type: pl })
205
+ if(deliveryType && deliveryType.methods.length > 0) {
206
+ //console.log('setDeliveryMethodId to', deliveryType.methods[0]['id'])
207
+ this.setDeliveryMethodId(deliveryType.methods[0]['id'])
204
208
  }
205
209
 
206
- this.resetDeliveryOptions()
207
-
208
210
  if(pl === 'pickup') {
209
211
  this.addressValid = true
210
- await this.getReservationSlots()
212
+ if(typeChanged || this.reservationSlots.length === 0) {
213
+ await this.getReservationSlots()
214
+ }
211
215
  }
212
216
  },
213
217
 
@@ -298,7 +302,7 @@ export default {
298
302
  await this.getPaymentMethods(pmreq)
299
303
  this.continueButtonLoading = false
300
304
  this.setActiveStep(this.steps.payment)
301
- //this.$bus.$emit('nextStep')
305
+ //this.$bus.emit('nextStep')
302
306
  },
303
307
 
304
308
  continueToPayment() {
@@ -167,7 +167,7 @@ export default {
167
167
  /*
168
168
  checkSelectedDelivery() {
169
169
  if (this.selectedAddressId || this.cart.free_delivery) {
170
- this.$bus.$emit('nextStep')
170
+ this.$bus.emit('nextStep')
171
171
  } else {
172
172
  this.$buefy.dialog.alert({
173
173
  title: this.$t('global.delivery'),
@@ -9,8 +9,8 @@
9
9
  <div class="delivery-method" v-for="(deliveryCost, smIndex) in locationMethods.delivery_costs" :key="smIndex">
10
10
  <div class="sm-label">
11
11
  <b-radio
12
- @change.native="selectDeliveryOption(deliveryCost)"
13
12
  v-model="selectedDeliveryCost"
13
+ @update:model-value="selectDeliveryOption(deliveryCost)"
14
14
  :native-value="deliveryCost.id"
15
15
  name="deliverymethod"
16
16
  >
@@ -27,8 +27,8 @@
27
27
  <div class="delivery-method" v-for="(deliveryMethod, smIndex) in sellerDeliveryMethod.delivery_methods" :key="smIndex">
28
28
  <div class="sm-label">
29
29
  <b-radio
30
- @change.native="selectDeliveryOption(sellerDeliveryMethod.id, deliveryMethod)"
31
30
  v-model="selectedDeliveryMethod[sellerDeliveryMethod.id]"
31
+ @update:model-value="selectDeliveryOption(sellerDeliveryMethod.id, deliveryMethod)"
32
32
  :native-value="deliveryMethod.id"
33
33
  >
34
34
  {{ deliveryMethod.name }}
@@ -98,7 +98,7 @@ export default {
98
98
  })
99
99
  })
100
100
  this.setDeliveryMethod(reqMethods)
101
- this.$bus.$emit('deliveryMethodSelected', reqMethods)
101
+ this.$bus.emit('deliveryMethodSelected', reqMethods)
102
102
  }
103
103
  },
104
104
 
@@ -130,7 +130,7 @@ export default {
130
130
 
131
131
  selectDeliveryOption(sellerId, deliveryMethod) {
132
132
  if (deliveryMethod.delivery_estimate) {
133
- this.$set(this.estimatedDelivery, sellerId, deliveryMethod.delivery_estimate.join(' - '))
133
+ this.estimatedDelivery[sellerId] = deliveryMethod.delivery_estimate.join(' - ')
134
134
  }
135
135
  if (!this.selectedDeliveryMethod[sellerId]) {
136
136
  this.selectedDeliveryMethod[sellerId] = deliveryMethod.id
@@ -143,23 +143,29 @@ export default {
143
143
  if (!this.selectedDeliveryMethod[sm.id] && sm.delivery_methods.length > 0) {
144
144
  //console.log('preselecting', sm.id)
145
145
  this.selectedDeliveryMethod[sm.id] = sm.delivery_methods[0]['id']
146
- this.$set(this.estimatedDelivery, sm.id, sm.delivery_methods[0]['delivery_estimate'].join(' - '))
146
+ this.estimatedDelivery[sm.id] = sm.delivery_methods[0]['delivery_estimate'].join(' - ')
147
147
  }
148
148
  })
149
149
  setTimeout(() => {
150
150
  this.emitSelected()
151
151
  }, 500)
152
+ },
153
+
154
+ onResetDeliveryOptions() {
155
+ this.selectedDeliveryMethod = {}
156
+ this.estimatedDelivery = {}
157
+ this.preselect()
152
158
  }
153
159
  },
154
160
 
155
161
  mounted() {
156
162
  this.preselect()
157
163
 
158
- this.$bus.$on('resetDeliveryOptions', () => {
159
- this.selectedDeliveryMethod = {}
160
- this.estimatedDelivery = {}
161
- this.preselect()
162
- })
164
+ this.$bus.on('resetDeliveryOptions', this.onResetDeliveryOptions)
165
+ },
166
+
167
+ beforeUnmount() {
168
+ this.$bus.off('resetDeliveryOptions', this.onResetDeliveryOptions)
163
169
  }
164
170
  }
165
171
  </script>
@@ -5,8 +5,8 @@
5
5
  <b-radio
6
6
  v-for="(dm, index) in deliveryTypes"
7
7
  :key="'_dm_' + index"
8
- :value="value"
9
- @input="$emit('input', $event)"
8
+ :model-value="modelValue"
9
+ @update:model-value="$emit('update:modelValue', $event)"
10
10
  name="deliverytype"
11
11
  :native-value="dm.type"
12
12
  :style="{
@@ -17,7 +17,7 @@
17
17
  borderBottom: '1px #ddd solid',
18
18
  marginRight: 0
19
19
  }"
20
- :class="[{ 'dm-selected': value === dm.type }]"
20
+ :class="[{ 'dm-selected': modelValue === dm.type }]"
21
21
  >
22
22
  <div>{{ dm.name }}</div>
23
23
  <div style="font-size: 0.8rem">{{ dm.description }}</div>
@@ -34,7 +34,7 @@ import { mapState } from 'vuex'
34
34
  export default {
35
35
  name: 'DeliveryTypes',
36
36
  props: {
37
- value: {
37
+ modelValue: {
38
38
  type: String
39
39
  },
40
40
  error: {
@@ -43,13 +43,16 @@ export default {
43
43
  }
44
44
  },
45
45
 
46
+ emits: ['update:modelValue'],
47
+
46
48
  computed: {
47
49
  ...mapState(['deliveryTypes'])
48
50
  },
49
51
 
50
52
  mounted() {
51
53
  if (this.deliveryTypes && this.deliveryTypes.length > 0) {
52
- this.$emit('input', this.deliveryTypes[0].type)
54
+ // Keep a type chosen earlier in the checkout, otherwise preselect the first one
55
+ this.$emit('update:modelValue', this.modelValue || this.deliveryTypes[0].type)
53
56
  }
54
57
  }
55
58
  }
@@ -3,9 +3,9 @@
3
3
  <div class="is-flex">
4
4
  <div class="mr-3">
5
5
  <b-field :label="isMobileiOS ? '' : 'Select date'" label-position="inside">
6
- <b-select v-model="selectedDate" @input="rsInput" placeholder="Select date" class="rs-date">
6
+ <b-select v-model="selectedDate" @update:model-value="rsInput" placeholder="Select date" class="rs-date">
7
7
  <option v-if="isMobileiOS" value="">Select date</option>
8
- <option v-for="rcDay in slots" v-if="rcDay.slots.length > 0" :value="rcDay" :key="rcDay.id">
8
+ <option v-for="rcDay in availableSlots" :value="rcDay" :key="rcDay.id">
9
9
  {{ rcDay.dayName }}
10
10
  </option>
11
11
  </b-select>
@@ -13,7 +13,7 @@
13
13
  </div>
14
14
  <div>
15
15
  <b-field :label="isMobileiOS ? '' : 'Select time'" label-position="inside" class="rs-time">
16
- <b-select v-model="selectedTime" @input="rsInput" placeholder="Select time" reservation-slot>
16
+ <b-select v-model="selectedTime" @update:model-value="rsInput" placeholder="Select time" reservation-slot>
17
17
  <option v-if="isMobileiOS" value="">Select time</option>
18
18
  <option v-for="ts in selectedDate.slots" :value="ts" :key="ts.start" :disabled="!ts.available">
19
19
  {{ ts.label }}
@@ -33,7 +33,7 @@ import _ from 'underscore'
33
33
  export default {
34
34
  name: 'ReservationSlots',
35
35
  props: {
36
- value: {
36
+ modelValue: {
37
37
  type: String,
38
38
  default: ''
39
39
  },
@@ -48,12 +48,18 @@ export default {
48
48
  default: ''
49
49
  }
50
50
  },
51
+ emits: ['update:modelValue'],
51
52
  data() {
52
53
  return {
53
54
  selectedDate: '',
54
55
  selectedTime: ''
55
56
  }
56
57
  },
58
+ computed: {
59
+ availableSlots() {
60
+ return this.slots.filter((rcDay) => rcDay.slots.length > 0)
61
+ }
62
+ },
57
63
  watch: {
58
64
  slots: function(v) {
59
65
  if(!this.slots || this.slots.length === 0) {
@@ -66,15 +72,15 @@ export default {
66
72
  rsInput(val) {
67
73
  if(this.selectedDate && this.selectedTime) {
68
74
  //console.log('rs slots emitting', this.selectedDate.day+' '+this.selectedTime.start)
69
- this.$emit('input', this.selectedDate.day+' '+this.selectedTime.start+':00')
75
+ this.$emit('update:modelValue', this.selectedDate.day+' '+this.selectedTime.start+':00')
70
76
  }
71
77
  }
72
78
  },
73
79
  mounted() {
74
- if(this.value && this.slots) {
75
- this.selectedDate = _.findWhere(this.slots, { day: this.value.substr(0, this.value.indexOf(' '))} )
80
+ if(this.modelValue && this.slots) {
81
+ this.selectedDate = _.findWhere(this.slots, { day: this.modelValue.substr(0, this.modelValue.indexOf(' '))} )
76
82
  if(this.selectedDate) {
77
- this.selectedTime = _.findWhere(this.selectedDate.slots, { start: this.value.substr(this.value.indexOf(' ')+1, 5) })
83
+ this.selectedTime = _.findWhere(this.selectedDate.slots, { start: this.modelValue.substr(this.modelValue.indexOf(' ')+1, 5) })
78
84
  }
79
85
  }
80
86
  }
@@ -1,4 +1,4 @@
1
- <template functional>
1
+ <template>
2
2
  <div style="background: #fdfdfd; border: 1px #ddd solid; padding: 1rem; font-size: 0.95em; border-radius: 5px; margin-top: 3rem">
3
3
  <p class="mb-2">You <strong>MUST</strong> show your ID and credit card used for the purchase at the time of Pick Up or Delivery.</p>
4
4
  <p class="mb-2">Delivery orders (for applicable locations) must be placed by 6:00 pm for Same Day Delivery.</p>