spoko-design-system 0.2.69 → 0.2.71

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/index.ts CHANGED
@@ -25,8 +25,8 @@ export { default as ProductModels } from './src/components/Product/ProductModels
25
25
  export { default as ProductName } from './src/components/Product/ProductName.vue';
26
26
  export { default as ProductPositions } from './src/components/Product/ProductPositions.vue';
27
27
  export { default as ProductNumber } from './src/components/Product/ProductNumber.astro';
28
- export { default as ProductLink } from './src/components/Product/ProductLink.astro';
29
- export { default as ProductCarousel } from './src/components/Product/ProductCarousel.astro';
28
+ export { default as ProductLink } from './src/components/Product/ProductLink.vue';
29
+ // export { default as ProductCarousel } from './src/components/Product/ProductCarousel.astro';
30
30
 
31
31
 
32
32
  export { default as CategoryLink } from './src/components/Category/CategoryLink.vue';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoko-design-system",
3
- "version": "0.2.69",
3
+ "version": "0.2.71",
4
4
  "private": false,
5
5
  "main": "./index.ts",
6
6
  "module": "./index.ts",
@@ -90,12 +90,12 @@
90
90
  "i18next-vue": "^5.0.0",
91
91
  "swiper": "^11.1.14",
92
92
  "unocss": "^0.64.0",
93
- "vite": "^5.4.10",
93
+ "vite": "^5.4.11",
94
94
  "vue": "^3.5.12"
95
95
  },
96
96
  "devDependencies": {
97
97
  "@unocss/transformer-variant-group": "^0.64.0",
98
- "@vitejs/plugin-vue": "^5.1.4",
98
+ "@vitejs/plugin-vue": "^5.1.5",
99
99
  "astro": "^4.16.10",
100
100
  "unocss": "^0.60.0"
101
101
  },
@@ -22,6 +22,7 @@ CategoryObject.width = CategoryObject.width ?? 70;
22
22
  <a
23
23
  href={getTranslatedLink(`/${CategoryObject.slug}/`)}
24
24
  class="carousel-item"
25
+ data-astro-prefetch
25
26
  {...inputProps}
26
27
  >
27
28
  <Image
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  import { Image } from 'astro:assets'
3
-
3
+ import getEnvVariable from "./../../utils/getEnvVariable";
4
+ const API_URL = getEnvVariable('API_URL', 'https://default-api.com');
4
5
  interface ImageObject {
5
6
  src: string;
6
7
  alt?: string;
@@ -12,7 +13,7 @@ interface ImageObject {
12
13
  index?: number;
13
14
  }
14
15
 
15
- const { imageObject, imagesApiUrl } = Astro.props as { imageObject: ImageObject; imagesApiUrl: string };
16
+ const { imageObject } = Astro.props as { imageObject: ImageObject; };
16
17
 
17
18
  let inputProps = {};
18
19
 
@@ -28,7 +29,7 @@ if (imageObject.srcset && imageObject.srcset.length) {
28
29
 
29
30
  ---
30
31
  <Image
31
- src={`${imagesApiUrl}${imageObject.src}`}
32
+ src={`${API_URL}${imageObject.src}`}
32
33
  alt={imageObject.alt}
33
34
  height={imageObject.height}
34
35
  width={imageObject.width}
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <div class="product-link" itemscope itemtype="https://schema.org/Product">
3
+ <div :class="[
4
+ bigTile ? 'product-link--big-tile' : 'product-thumb--plp product-thumb--carousel'
5
+ ]">
6
+ <!-- Slot na ProductImage z Astro -->
7
+ <slot name="image">
8
+ <img src="/1x1.png" class="bg-gray-100/70" :alt="productName" />
9
+ </slot>
10
+ </div>
11
+
12
+ <div :class="[bigTile ? '' : 'sm:pl-4']">
13
+ <p v-if="price" class="block mb-2 font-600 font-headbold text-5">
14
+ {{ price }}
15
+ </p>
16
+
17
+ <a
18
+ class="product-link--url"
19
+ :href="url"
20
+ itemprop="url"
21
+ :title="productNumber"
22
+ v-html="nameFormatted"
23
+ />
24
+
25
+ <ProductNumber
26
+ :productNumber="productNumber"
27
+ :copyDisabled="true"
28
+ />
29
+
30
+ <template v-if="index !== null">
31
+ <meta itemprop="position" :content="index.toString()" />
32
+ <meta itemprop="name" :content="nameFormatted" />
33
+ </template>
34
+ </div>
35
+ </div>
36
+ </template>
37
+
38
+ <script setup lang="ts">
39
+ import { computed } from 'vue'
40
+ import { ProductNumber } from 'spoko-design-system'
41
+ import { removeSemicolon } from 'spoko-design-system'
42
+
43
+ interface Props {
44
+ productName: string
45
+ productNumber: string
46
+ url: string
47
+ price?: string
48
+ bigTile?: boolean
49
+ index?: number
50
+ }
51
+
52
+ const props = withDefaults(defineProps<Props>(), {
53
+ bigTile: false,
54
+ index: null,
55
+ })
56
+
57
+ const nameFormatted = computed(() => {
58
+ return removeSemicolon(props.productName.toString())
59
+ })
60
+ </script>
@@ -0,0 +1,15 @@
1
+ export default function getEnvVariable(key, defaultValue = null) {
2
+ // First we check import.meta.env (for ES6 environments)
3
+ if (typeof import.meta !== 'undefined' && typeof import.meta.env !== 'undefined') {
4
+ return import.meta.env[key] || defaultValue;
5
+ }
6
+
7
+ // Then check process.env (for Node.js environment)
8
+ if (typeof process !== 'undefined' && typeof process.env !== 'undefined') {
9
+ return process.env[key] || defaultValue;
10
+ }
11
+
12
+ // If no variable is found, the default value is returned
13
+ return defaultValue;
14
+ }
15
+