@wikala/spmkt 2.25.8 → 2.26.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.
@@ -200,6 +200,7 @@ export default {
200
200
  },
201
201
 
202
202
  initHeadless() {
203
+ console.log('initHeadless addToCart')
203
204
  this.$bus.$on('externalAddToCart', async (product_id, e) => {
204
205
  let btn = e.target
205
206
  btn.classList.add('is-loading')
@@ -209,11 +210,23 @@ export default {
209
210
  })
210
211
  this.$emit('update', resp.data.product_resource)
211
212
  this.$nextTick(() => {
212
- if (this.product.id) {
213
- this.product_id = this.product.id
214
- if (this.product.variants.length > 0) {
215
- this.variantIds = _.pluck(this.product.variants, 'id')
216
- }
213
+ if (!this.product.id) {
214
+ return
215
+ }
216
+
217
+ this.product_id = this.product.id
218
+ if (this.product.variants.length > 0) {
219
+ this.$buefy.dialog.confirm({
220
+ title: 'Proizvod sa varijantama',
221
+ message: 'Otvorićemo stranicu proizvoda da biste odabrali varijantu.',
222
+ confirmText: 'Ok',
223
+ type: 'is-success',
224
+ onConfirm: () => {
225
+ window.location.href = '/'+this.product.slug;
226
+ }
227
+ })
228
+ btn.classList.remove('is-loading')
229
+ return
217
230
  }
218
231
  this.addToCart()
219
232
  btn.classList.remove('is-loading')
@@ -293,9 +306,6 @@ export default {
293
306
  })
294
307
 
295
308
  this.handleBusEvents()
296
-
297
-
298
-
299
309
  }
300
310
  }
301
311
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikala/spmkt",
3
- "version": "2.25.8",
3
+ "version": "2.26.0",
4
4
  "private": false,
5
5
  "description": "supermarket",
6
6
  "scripts": {
package/utils/animate.js CHANGED
@@ -3,6 +3,10 @@ import 'animate.css'
3
3
  function animateCSS(element, animationName, callback) {
4
4
 
5
5
  const node = element instanceof HTMLElement ? element : document.querySelector(element)
6
+
7
+ if(!node) {
8
+ return
9
+ }
6
10
 
7
11
  node.classList.add('animate__animated', 'animate__' + animationName)
8
12