@teamnovu/kit-shopware-composables 0.0.1 → 0.0.3
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/dist/cart/useCartAddItemMutation.d.ts +12 -0
- package/dist/cart/useCartQueryOptions.d.ts +9 -0
- package/dist/cart/useCartRemoveItemMutation.d.ts +7 -0
- package/dist/cart/useCartUpdateItemMutation.d.ts +12 -0
- package/dist/context/useContextOptions.d.ts +9 -0
- package/dist/context/useContextUpdate.d.ts +4 -0
- package/dist/general/useSeoUrl.d.ts +10 -0
- package/dist/index.d.ts +223 -0
- package/dist/index.mjs +304 -0
- package/dist/inject.d.ts +5 -0
- package/dist/keys.d.ts +27 -0
- package/dist/products/useCategoryQueryOptions.d.ts +17 -0
- package/dist/products/useProductListingQueryOptions.d.ts +19 -0
- package/dist/products/useProductListingQueryOptions.test.d.ts +1 -0
- package/dist/products/useProductPrice.d.ts +49 -0
- package/dist/products/useProductQueryOptions.d.ts +19 -0
- package/dist/products/useProductVariantForOptions.d.ts +276 -0
- package/dist/types/query.d.ts +7 -0
- package/dist/usePagination.d.ts +21 -0
- package/dist/util/url.d.ts +2 -0
- package/docker/boot_end.sh +0 -0
- package/docker/types.sh +0 -0
- package/package.json +9 -9
- package/src/cart/useCartAddItemMutation.ts +48 -0
- package/src/cart/useCartQueryOptions.ts +19 -0
- package/src/cart/useCartRemoveItemMutation.ts +32 -0
- package/src/cart/useCartUpdateItemMutation.ts +48 -0
- package/src/index.ts +8 -0
- package/src/keys.ts +4 -0
- package/src/products/useProductListingQueryOptions.ts +1 -0
- package/src/products/useProductPrice.ts +3 -2
- package/src/products/useProductQueryOptions.ts +1 -0
- package/src/products/useProductVariantForOptions.ts +8 -2
- package/eslint.config.mjs +0 -84
|
@@ -7,6 +7,7 @@ import { productKeys } from '../keys'
|
|
|
7
7
|
import type { OperationBody, OperationKey } from '../types/query'
|
|
8
8
|
import { relativizeSeoUrl } from '../util/url'
|
|
9
9
|
|
|
10
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
10
11
|
const readListingOperation = 'readCompactProductListing post /novu/headless/product-listing/{seoUrl}' satisfies OperationKey
|
|
11
12
|
|
|
12
13
|
export function useProductListingQueryOptions<Operations extends operations>(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copied from:
|
|
3
|
-
* https://github.com/shopware/frontends/blob/main/packages/composables/src/useProductPrice/useProductPrice.ts
|
|
3
|
+
* https://github.com/shopware/frontends/blob/main/packages/composables/src/useProductPrice/useProductPrice.ts
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import type { Schemas } from '#store-types'
|
|
@@ -51,7 +51,8 @@ export type UseProductPriceReturn = {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
* The purpose of the `useProductPrice` function is to abstract the logic
|
|
54
|
+
* The purpose of the `useProductPrice` function is to abstract the logic
|
|
55
|
+
* to expose most useful helpers for price displaying.
|
|
55
56
|
*
|
|
56
57
|
* @public
|
|
57
58
|
* @category Product
|
|
@@ -7,6 +7,7 @@ import { productKeys } from '../keys'
|
|
|
7
7
|
import type { OperationBody, OperationKey } from '../types/query'
|
|
8
8
|
import { relativizeSeoUrl } from '../util/url'
|
|
9
9
|
|
|
10
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
10
11
|
const readCustomProductDetailOperation = 'readCustomProductDetail post /novu/headless/product/{seoUrl}' satisfies OperationKey
|
|
11
12
|
|
|
12
13
|
export function useProductQueryOptions<Operations extends operations>(
|
|
@@ -4,7 +4,10 @@ import { computed, unref } from 'vue'
|
|
|
4
4
|
|
|
5
5
|
type DetailProduct<S extends Schemas> = S['CustomProductDetailResponse']['product']
|
|
6
6
|
|
|
7
|
-
export function getProductVariantForOptions<S extends Schemas>(
|
|
7
|
+
export function getProductVariantForOptions<S extends Schemas>(
|
|
8
|
+
product: DetailProduct<S>,
|
|
9
|
+
optionIds: string[],
|
|
10
|
+
) {
|
|
8
11
|
const variants = product.extensions?.variants
|
|
9
12
|
|
|
10
13
|
if (optionIds.length === 0) {
|
|
@@ -16,6 +19,9 @@ export function getProductVariantForOptions<S extends Schemas>(product: DetailPr
|
|
|
16
19
|
return variants?.find(v => v.optionIds?.every(optId => optionIds.includes(optId)))
|
|
17
20
|
}
|
|
18
21
|
|
|
19
|
-
export function useProductVariantForOptions<S extends Schemas>(
|
|
22
|
+
export function useProductVariantForOptions<S extends Schemas>(
|
|
23
|
+
product: MaybeRef<DetailProduct<S>>,
|
|
24
|
+
optionIds: MaybeRef<string[]>,
|
|
25
|
+
) {
|
|
20
26
|
return computed(() => getProductVariantForOptions(unref(product), unref(optionIds)))
|
|
21
27
|
}
|
package/eslint.config.mjs
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js'
|
|
2
|
-
import pluginStylistic from '@stylistic/eslint-plugin'
|
|
3
|
-
import tseslint from 'typescript-eslint'
|
|
4
|
-
|
|
5
|
-
export default tseslint.config(
|
|
6
|
-
js.configs.recommended,
|
|
7
|
-
tseslint.configs.recommended,
|
|
8
|
-
pluginStylistic.configs['recommended'],
|
|
9
|
-
{
|
|
10
|
-
rules: {
|
|
11
|
-
// stylistic
|
|
12
|
-
// ********************
|
|
13
|
-
'@stylistic/newline-per-chained-call': [
|
|
14
|
-
'error',
|
|
15
|
-
{ ignoreChainWithDepth: 2 },
|
|
16
|
-
],
|
|
17
|
-
'@stylistic/nonblock-statement-body-position': 'error',
|
|
18
|
-
'@stylistic/one-var-declaration-per-line': 'error',
|
|
19
|
-
'@stylistic/operator-linebreak': [
|
|
20
|
-
'error',
|
|
21
|
-
'before',
|
|
22
|
-
{ overrides: { '=': 'none' } },
|
|
23
|
-
],
|
|
24
|
-
'@stylistic/function-paren-newline': ['error', 'multiline-arguments'],
|
|
25
|
-
'@stylistic/dot-location': ['error', 'property'],
|
|
26
|
-
'@stylistic/no-mixed-operators': ['error', { allowSamePrecedence: true }],
|
|
27
|
-
'@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
|
28
|
-
'@stylistic/array-bracket-newline': ['error', { multiline: true }],
|
|
29
|
-
'@stylistic/array-element-newline': [
|
|
30
|
-
'error',
|
|
31
|
-
{
|
|
32
|
-
multiline: true,
|
|
33
|
-
consistent: true,
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
'@stylistic/max-len': [
|
|
37
|
-
'warn',
|
|
38
|
-
{
|
|
39
|
-
code: 150,
|
|
40
|
-
tabWidth: 2,
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
'@stylistic/object-curly-newline': [
|
|
44
|
-
'error',
|
|
45
|
-
{
|
|
46
|
-
multiline: true,
|
|
47
|
-
consistent: true,
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
'@stylistic/object-property-newline': [
|
|
51
|
-
'error',
|
|
52
|
-
{ allowAllPropertiesOnSameLine: false },
|
|
53
|
-
],
|
|
54
|
-
|
|
55
|
-
// common
|
|
56
|
-
// ********************
|
|
57
|
-
'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
58
|
-
'prefer-destructuring': [
|
|
59
|
-
'error',
|
|
60
|
-
{
|
|
61
|
-
array: false,
|
|
62
|
-
object: true,
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
'no-unused-vars': 'off',
|
|
66
|
-
'eqeqeq': ['error', 'smart'],
|
|
67
|
-
'no-undef': 'off', // done by typescript
|
|
68
|
-
'@typescript-eslint/consistent-type-imports': 'error',
|
|
69
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
70
|
-
'@typescript-eslint/no-unused-vars': [
|
|
71
|
-
'error',
|
|
72
|
-
{
|
|
73
|
-
args: 'all',
|
|
74
|
-
argsIgnorePattern: '^_',
|
|
75
|
-
caughtErrors: 'all',
|
|
76
|
-
caughtErrorsIgnorePattern: '^_',
|
|
77
|
-
destructuredArrayIgnorePattern: '^_',
|
|
78
|
-
varsIgnorePattern: '^_',
|
|
79
|
-
ignoreRestSiblings: true,
|
|
80
|
-
},
|
|
81
|
-
],
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
)
|