@lancom/shared 0.0.473 → 0.0.475
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/assets/js/api/index.js
CHANGED
|
@@ -72,6 +72,9 @@ const api = {
|
|
|
72
72
|
fetchBanners(shop, params) {
|
|
73
73
|
return _get(`shop/${shop}/banners`, params);
|
|
74
74
|
},
|
|
75
|
+
fetchShopCategories(shop, params) {
|
|
76
|
+
return _get(`shop/${shop}/categories`, params);
|
|
77
|
+
},
|
|
75
78
|
fetchProductsKits(shop, params) {
|
|
76
79
|
return _get(`shop/${shop}/products-kit`, params);
|
|
77
80
|
},
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const IMAGE_VARIANTS = {
|
|
2
|
+
PUBLIC: 'public'
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
const DOMAIN = 'imagedelivery.net';
|
|
6
|
+
|
|
7
|
+
export function getCloudflareImageSrc(cloudflareImageId, variant = IMAGE_VARIANTS.PUBLIC) {
|
|
8
|
+
const accountHash = process.env.CLOUDFLARE_ACCOUNT_HASH;
|
|
9
|
+
const src = (cloudflareImageId || '').split("\n")[0].trim();
|
|
10
|
+
return src ? `https://${DOMAIN}/${accountHash}/${src}${src.includes('/') ? '' : `/${variant}`}` : null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function getCloudflareImageSrcset(cloudflareImageId) {
|
|
14
|
+
const lines = (cloudflareImageId || '').split("\n").map(l => l.trim()).filter(Boolean);
|
|
15
|
+
if (lines.length < 2) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return lines.map(line => {
|
|
20
|
+
const [idPart, descriptor] = line.split('|');
|
|
21
|
+
const src = getCloudflareImageSrc(idPart.trim());
|
|
22
|
+
return descriptor ? `${src} ${descriptor.trim()}` : src;
|
|
23
|
+
}).join(', ');
|
|
24
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<img
|
|
3
|
+
:src="resolvedSrc"
|
|
4
|
+
:srcset="resolvedSrcset || undefined"
|
|
5
|
+
:alt="alt"
|
|
6
|
+
:loading="loading"
|
|
7
|
+
:decoding="decoding"
|
|
8
|
+
:class="imgClass" />
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
import { getCloudflareImageSrc, getCloudflareImageSrcset } from '../../assets/js/utils/image';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
name: 'LancomImage',
|
|
16
|
+
props: {
|
|
17
|
+
image: {
|
|
18
|
+
type: Object,
|
|
19
|
+
default: null
|
|
20
|
+
},
|
|
21
|
+
overrideSrc: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: null
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: 'large'
|
|
28
|
+
},
|
|
29
|
+
alt: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ''
|
|
32
|
+
},
|
|
33
|
+
loading: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: 'lazy'
|
|
36
|
+
},
|
|
37
|
+
decoding: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'async'
|
|
40
|
+
},
|
|
41
|
+
imgClass: {
|
|
42
|
+
type: [String, Object, Array],
|
|
43
|
+
default: null
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
computed: {
|
|
47
|
+
resolvedSrc() {
|
|
48
|
+
if (this.overrideSrc) return this.overrideSrc;
|
|
49
|
+
if (!this.image) return null;
|
|
50
|
+
const { large, medium, small, thumb, origin, cloudflareImageId } = this.image;
|
|
51
|
+
return this.image[this.size] || large || medium || small || thumb || origin || getCloudflareImageSrc(cloudflareImageId);
|
|
52
|
+
},
|
|
53
|
+
resolvedSrcset() {
|
|
54
|
+
if (this.overrideSrc) return null;
|
|
55
|
+
return getCloudflareImageSrcset(this.image?.cloudflareImageId);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
</script>
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
}">
|
|
8
8
|
<div class="NumberInput__field">
|
|
9
9
|
<div
|
|
10
|
+
v-if="visibleSideControls"
|
|
10
11
|
class="NumberInput__side-control NumberInput__side-control--left"
|
|
11
12
|
:class="{ disabled, 'NumberInput__side-control--double': doubleSize }"
|
|
12
13
|
@click="model -= step">
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
:disabled="disabled"
|
|
26
27
|
@change="$emit('change', model)" />
|
|
27
28
|
<div
|
|
29
|
+
v-if="visibleSideControls"
|
|
28
30
|
class="NumberInput__side-control NumberInput__side-control--right"
|
|
29
31
|
:class="{ disabled, 'NumberInput__side-control--double': doubleSize }"
|
|
30
32
|
@click="model += step">
|
|
@@ -59,6 +61,10 @@ export default {
|
|
|
59
61
|
type: Boolean,
|
|
60
62
|
default: true
|
|
61
63
|
},
|
|
64
|
+
visibleSideControls: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: true
|
|
67
|
+
},
|
|
62
68
|
doubleSize: {
|
|
63
69
|
type: Boolean,
|
|
64
70
|
default: false
|