@teamnovu/kit-shopware-composables 0.0.13 → 0.0.14
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.
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Schemas
|
|
1
|
+
import { Schemas } from '../../query/types/operations';
|
|
2
2
|
import { MaybeRef, ComputedRef } from 'vue';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { components, GenericRecord } from '../../../api-types/storeApiTypes';
|
|
4
|
+
type DetailProduct = Schemas['CustomProductDetailResponse']['product'];
|
|
5
|
+
export declare function getProductVariantForOptions<S extends DetailProduct>(product: S, optionIds: string[]): {
|
|
5
6
|
active?: boolean;
|
|
6
7
|
apiAlias: "product";
|
|
7
8
|
readonly available?: boolean;
|
|
@@ -137,7 +138,7 @@ export declare function getProductVariantForOptions<S extends Schemas>(product:
|
|
|
137
138
|
weight?: number;
|
|
138
139
|
width?: number;
|
|
139
140
|
} | undefined;
|
|
140
|
-
export declare function useProductVariantForOptions<S extends
|
|
141
|
+
export declare function useProductVariantForOptions<S extends DetailProduct>(product: MaybeRef<S>, optionIds: MaybeRef<string[]>): ComputedRef<{
|
|
141
142
|
active?: boolean;
|
|
142
143
|
apiAlias: "product";
|
|
143
144
|
readonly available?: boolean;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Schemas } from '
|
|
1
|
+
import type { Schemas } from '../../query/types/operations'
|
|
2
2
|
import type { MaybeRef } from 'vue'
|
|
3
3
|
import { computed, unref } from 'vue'
|
|
4
4
|
|
|
5
|
-
type DetailProduct
|
|
5
|
+
type DetailProduct = Schemas['CustomProductDetailResponse']['product']
|
|
6
6
|
|
|
7
|
-
export function getProductVariantForOptions<S extends
|
|
8
|
-
product:
|
|
7
|
+
export function getProductVariantForOptions<S extends DetailProduct>(
|
|
8
|
+
product: S,
|
|
9
9
|
optionIds: string[],
|
|
10
10
|
) {
|
|
11
11
|
const variants = product.extensions?.variants
|
|
@@ -19,8 +19,8 @@ export function getProductVariantForOptions<S extends Schemas>(
|
|
|
19
19
|
return variants?.find(v => v.optionIds?.every(optId => optionIds.includes(optId)))
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export function useProductVariantForOptions<S extends
|
|
23
|
-
product: MaybeRef<
|
|
22
|
+
export function useProductVariantForOptions<S extends DetailProduct>(
|
|
23
|
+
product: MaybeRef<S>,
|
|
24
24
|
optionIds: MaybeRef<string[]>,
|
|
25
25
|
) {
|
|
26
26
|
return computed(() => getProductVariantForOptions(unref(product), unref(optionIds)))
|