@ecomplus/widget-product-card 1.0.0-beta.18 → 1.0.0-beta.180
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/CHANGELOG.md +603 -34
- package/cms.config.js +1 -0
- package/dist/public/widget-product-card.1.min.js +2 -0
- package/dist/public/widget-product-card.1.min.js.map +1 -0
- package/dist/public/widget-product-card.2.min.js +2 -0
- package/dist/public/widget-product-card.2.min.js.map +1 -0
- package/dist/public/widget-product-card.3.min.js +5 -0
- package/dist/public/widget-product-card.3.min.js.map +1 -0
- package/dist/public/widget-product-card.4.min.js +5 -0
- package/dist/public/widget-product-card.4.min.js.map +1 -0
- package/dist/public/widget-product-card.var.min.js +1 -1
- package/dist/public/widget-product-card.var.min.js.map +1 -1
- package/dist/widget-product-card.1.min.js +2 -0
- package/dist/widget-product-card.1.min.js.map +1 -0
- package/dist/widget-product-card.2.min.js +2 -0
- package/dist/widget-product-card.2.min.js.map +1 -0
- package/dist/widget-product-card.3.min.js +5 -0
- package/dist/widget-product-card.3.min.js.map +1 -0
- package/dist/widget-product-card.4.min.js +5 -0
- package/dist/widget-product-card.4.min.js.map +1 -0
- package/dist/widget-product-card.min.js +1 -1
- package/dist/widget-product-card.min.js.map +1 -1
- package/package.json +3 -3
- package/src/index.js +18 -11
- package/webpack.config.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecomplus/widget-product-card",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.180",
|
|
4
4
|
"description": "Storefront plugin with Vue component for product cards",
|
|
5
5
|
"module": "src/index.js",
|
|
6
6
|
"browser": "dist/widget-product-card.min.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"jsdelivr": "dist/public/widget-product-card.var.min.js",
|
|
9
9
|
"unpkg": "dist/public/widget-product-card.var.min.js",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "NODE_ENV=production webpack",
|
|
11
|
+
"build": "cross-env NODE_ENV=production webpack",
|
|
12
12
|
"serve": "webpack-dev-server"
|
|
13
13
|
},
|
|
14
14
|
"repository": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"vue": ">=2 <4"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@ecomplus/storefront-components": "^1.0.0-beta.
|
|
39
|
+
"@ecomplus/storefront-components": "^1.0.0-beta.181"
|
|
40
40
|
},
|
|
41
41
|
"webpackOutput": {
|
|
42
42
|
"library": "widgetProductCard",
|
package/src/index.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import Vue from 'vue'
|
|
8
8
|
import lozad from 'lozad'
|
|
9
|
+
import { inStock as checkInStock } from '@ecomplus/utils'
|
|
9
10
|
import EcomSearch from '@ecomplus/search-engine'
|
|
10
11
|
import ProductCard from '#components/ProductCard.vue'
|
|
11
12
|
|
|
@@ -24,7 +25,7 @@ export default (options = {}, elClass = 'product-card') => {
|
|
|
24
25
|
const setupComponent = ($productCard, productId, sku, product, isLoaded) => {
|
|
25
26
|
new Vue({
|
|
26
27
|
render: h => h(ProductCard, {
|
|
27
|
-
class: elClass,
|
|
28
|
+
class: elClass !== 'product-card' ? elClass : null,
|
|
28
29
|
attrs: {
|
|
29
30
|
'data-product-id': productId,
|
|
30
31
|
'data-sku': sku
|
|
@@ -33,7 +34,8 @@ export default (options = {}, elClass = 'product-card') => {
|
|
|
33
34
|
...options.props,
|
|
34
35
|
productId,
|
|
35
36
|
product,
|
|
36
|
-
isLoaded
|
|
37
|
+
isLoaded,
|
|
38
|
+
transitionClass: null
|
|
37
39
|
},
|
|
38
40
|
scopedSlots: typeof getScopedSlots === 'function'
|
|
39
41
|
? getScopedSlots($productCard, h)
|
|
@@ -54,13 +56,12 @@ export default (options = {}, elClass = 'product-card') => {
|
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
let preFetchPromise
|
|
57
|
-
if (productIds.length >=
|
|
59
|
+
if (productIds.length >= 4 && productIds.length <= 70 && !options.skipSearchApi) {
|
|
58
60
|
const search = new EcomSearch()
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
preFetchPromise = search.fetch({ timeout: 5000 })
|
|
61
|
+
preFetchPromise = search
|
|
62
|
+
.setPageSize(productIds.length)
|
|
63
|
+
.setProductIds(productIds)
|
|
64
|
+
.fetch(true, { timeout: 5000 })
|
|
64
65
|
.then(() => {
|
|
65
66
|
const items = search.getItems()
|
|
66
67
|
for (let i = 0; i < 2; i++) {
|
|
@@ -92,10 +93,16 @@ export default (options = {}, elClass = 'product-card') => {
|
|
|
92
93
|
let isLoaded
|
|
93
94
|
if (product) {
|
|
94
95
|
isLoaded = true
|
|
96
|
+
if (!product.available || !product.visible || !checkInStock(product)) {
|
|
97
|
+
const $cardLi = $productCard.parentNode && $productCard.parentNode.parentNode
|
|
98
|
+
if ($cardLi && $cardLi.tagName === 'LI') {
|
|
99
|
+
$cardLi.parentNode.appendChild($cardLi)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
95
102
|
} else {
|
|
96
|
-
const $
|
|
97
|
-
if ($
|
|
98
|
-
product = $
|
|
103
|
+
const $productItem = $productCard.parentNode
|
|
104
|
+
if ($productItem) {
|
|
105
|
+
product = $productItem.dataset.product
|
|
99
106
|
if (typeof product === 'string') {
|
|
100
107
|
try {
|
|
101
108
|
product = JSON.parse(product)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../../webpack.config')
|