@scayle/storefront-nuxt 7.77.0 → 7.77.2

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.77.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix basket count calculation for basktets including item groups
8
+
9
+ ## 7.77.1
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+ - @scayle/storefront-core@7.58.2
15
+
3
16
  ## 7.77.0
4
17
 
5
18
  ### Minor Changes
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "7.76.6",
3
+ "version": "7.77.1",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -64,7 +64,7 @@ export default {
64
64
  }`;
65
65
  }
66
66
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
67
- const PACKAGE_VERSION = "7.76.6";
67
+ const PACKAGE_VERSION = "7.77.1";
68
68
  const logger = createConsola({
69
69
  fancy: true,
70
70
  formatOptions: {
@@ -116,13 +116,40 @@ export function useBasket({
116
116
  () => data.value?.items.map((item) => item.product) || []
117
117
  );
118
118
  const count = computed(
119
- () => data.value?.items?.reduce((prev, current) => prev + current.quantity, 0)
119
+ () => {
120
+ return data.value?.items?.reduce((prev, current) => {
121
+ if (current.itemGroup?.id && !current.itemGroup.isMainItem) {
122
+ return prev;
123
+ }
124
+ return prev + current.quantity;
125
+ }, 0);
126
+ }
120
127
  );
121
128
  const countWithoutSoldOutItems = computed(
122
- () => data.value?.items?.reduce(
123
- (prev, current) => prev + (current.product.isSoldOut ? 0 : current.quantity),
124
- 0
125
- )
129
+ () => {
130
+ const mainItemQuantities = /* @__PURE__ */ new Map();
131
+ const soldOutItemGroups = /* @__PURE__ */ new Set();
132
+ let count2 = data.value?.items?.reduce((prev, current) => {
133
+ if (current.itemGroup?.id) {
134
+ if (current.itemGroup.isMainItem) {
135
+ mainItemQuantities.set(current.itemGroup.id, current.quantity);
136
+ } else {
137
+ if (current.product.isSoldOut && current.itemGroup.isRequired) {
138
+ soldOutItemGroups.add(current.itemGroup.id);
139
+ }
140
+ return prev;
141
+ }
142
+ }
143
+ if (current.product.isSoldOut) {
144
+ return prev;
145
+ }
146
+ return prev + current.quantity;
147
+ }, 0);
148
+ soldOutItemGroups.forEach((itemGroupId) => {
149
+ count2 -= mainItemQuantities.get(itemGroupId) || 0;
150
+ });
151
+ return count2;
152
+ }
126
153
  );
127
154
  const items = computed(() => data.value?.items);
128
155
  const cost = computed(() => data.value?.cost);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.77.0",
4
+ "version": "7.77.2",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -60,7 +60,7 @@
60
60
  "@nuxt/kit": "3.11.2",
61
61
  "@opentelemetry/api": "1.9.0",
62
62
  "@scayle/h3-session": "0.4.0",
63
- "@scayle/storefront-core": "7.58.1",
63
+ "@scayle/storefront-core": "7.58.2",
64
64
  "@scayle/unstorage-compression-driver": "0.1.3",
65
65
  "@vueuse/core": "10.11.0",
66
66
  "consola": "3.2.3",
@@ -85,18 +85,18 @@
85
85
  "@nuxt/test-utils": "3.13.1",
86
86
  "@scayle/eslint-config-storefront": "4.2.0",
87
87
  "@scayle/eslint-plugin-vue-composable": "0.2.0",
88
- "@types/node": "20.14.6",
88
+ "@types/node": "20.14.8",
89
89
  "dprint": "0.46.3",
90
90
  "eslint": "9.5.0",
91
91
  "eslint-formatter-gitlab": "5.1.0",
92
92
  "fishery": "2.2.2",
93
93
  "h3": "1.12.0",
94
- "node-mocks-http": "1.14.1",
94
+ "node-mocks-http": "1.15.0",
95
95
  "nuxi": "3.12.0",
96
96
  "nuxt": "3.11.2",
97
97
  "publint": "0.2.8",
98
98
  "vitest": "1.6.0",
99
- "vue-tsc": "2.0.21"
99
+ "vue-tsc": "2.0.22"
100
100
  },
101
101
  "peerDependencies": {
102
102
  "h3": "^1.10.0",
@@ -111,6 +111,6 @@
111
111
  "@nuxt/schema": "3.11.2"
112
112
  },
113
113
  "volta": {
114
- "node": "20.14.0"
114
+ "node": "20.15.0"
115
115
  }
116
116
  }