@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, components, GenericRecord } from '../../../api-types/storeApiTypes.d.ts';
1
+ import { Schemas } from '../../query/types/operations';
2
2
  import { MaybeRef, ComputedRef } from 'vue';
3
- type DetailProduct<S extends Schemas> = S['CustomProductDetailResponse']['product'];
4
- export declare function getProductVariantForOptions<S extends Schemas>(product: DetailProduct<S>, optionIds: string[]): {
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 Schemas>(product: MaybeRef<DetailProduct<S>>, optionIds: MaybeRef<string[]>): ComputedRef<{
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamnovu/kit-shopware-composables",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "A collection of composables for the Shopware API",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",
@@ -1,11 +1,11 @@
1
- import type { Schemas } from '#store-types'
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<S extends Schemas> = S['CustomProductDetailResponse']['product']
5
+ type DetailProduct = Schemas['CustomProductDetailResponse']['product']
6
6
 
7
- export function getProductVariantForOptions<S extends Schemas>(
8
- product: DetailProduct<S>,
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 Schemas>(
23
- product: MaybeRef<DetailProduct<S>>,
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)))