@faststore/api 2.0.79-alpha.0 → 2.0.91-alpha.0
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/__generated__/schema.d.ts +6 -2
- package/dist/api.cjs.development.js +8 -9
- package/dist/api.cjs.development.js.map +1 -1
- package/dist/api.cjs.production.min.js +1 -1
- package/dist/api.cjs.production.min.js.map +1 -1
- package/dist/api.esm.js +8 -9
- package/dist/api.esm.js.map +1 -1
- package/package.json +4 -4
- package/src/__generated__/schema.ts +6 -2
- package/src/platforms/vtex/resolvers/skuVariations.ts +2 -6
- package/src/typeDefs/skuVariants.graphql +13 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/api",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.91-alpha.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"p-limit": "^3.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@faststore/eslint-config": "^2.0.
|
|
34
|
-
"@faststore/shared": "^2.0.
|
|
33
|
+
"@faststore/eslint-config": "^2.0.91-alpha.0",
|
|
34
|
+
"@faststore/shared": "^2.0.91-alpha.0",
|
|
35
35
|
"@graphql-codegen/cli": "2.2.0",
|
|
36
36
|
"@graphql-codegen/typescript": "2.2.2",
|
|
37
37
|
"@types/express": "^4.17.16",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"graphql": "^15.6.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "837e0d4445c0366c8f99750eed611091e5d68933"
|
|
53
53
|
}
|
|
@@ -503,24 +503,28 @@ export type SkuVariants = {
|
|
|
503
503
|
* `dominantVariantName` property. Returns all available options for the
|
|
504
504
|
* dominant property, and only options that can be combined with its current
|
|
505
505
|
* value for other properties.
|
|
506
|
+
* If `dominantVariantName` is not present, the first variant will be
|
|
507
|
+
* considered the dominant one.
|
|
506
508
|
*/
|
|
507
509
|
availableVariations?: Maybe<Scalars['FormattedVariants']>;
|
|
508
510
|
/**
|
|
509
511
|
* Maps property value combinations to their respective SKU's slug. Enables
|
|
510
512
|
* us to retrieve the slug for the SKU that matches the currently selected
|
|
511
513
|
* variations in O(1) time.
|
|
514
|
+
* If `dominantVariantName` is not present, the first variant will be
|
|
515
|
+
* considered the dominant one.
|
|
512
516
|
*/
|
|
513
517
|
slugsMap?: Maybe<Scalars['SlugsMap']>;
|
|
514
518
|
};
|
|
515
519
|
|
|
516
520
|
|
|
517
521
|
export type SkuVariantsAvailableVariationsArgs = {
|
|
518
|
-
dominantVariantName
|
|
522
|
+
dominantVariantName?: Maybe<Scalars['String']>;
|
|
519
523
|
};
|
|
520
524
|
|
|
521
525
|
|
|
522
526
|
export type SkuVariantsSlugsMapArgs = {
|
|
523
|
-
dominantVariantName
|
|
527
|
+
dominantVariantName?: Maybe<Scalars['String']>;
|
|
524
528
|
};
|
|
525
529
|
|
|
526
530
|
/** Aggregate offer information, for a given SKU that is available to be fulfilled by multiple sellers. */
|
|
@@ -22,16 +22,12 @@ export const SkuVariants: Record<string, Resolver<Root>> = {
|
|
|
22
22
|
slugsMap: (root, args) =>
|
|
23
23
|
createSlugsMap(
|
|
24
24
|
root.isVariantOf.items,
|
|
25
|
-
|
|
26
|
-
// access it.
|
|
27
|
-
(args as SlugsMapArgs).dominantVariantName,
|
|
25
|
+
(args as SlugsMapArgs).dominantVariantName ?? root.variations[0]?.name,
|
|
28
26
|
root.isVariantOf.linkText
|
|
29
27
|
),
|
|
30
28
|
|
|
31
29
|
availableVariations: (root, args) => {
|
|
32
|
-
|
|
33
|
-
// access it.
|
|
34
|
-
const dominantVariantName = (args as SlugsMapArgs).dominantVariantName
|
|
30
|
+
const dominantVariantName = (args as SlugsMapArgs).dominantVariantName ?? root.variations[0]?.name
|
|
35
31
|
const activeVariations = getActiveSkuVariations(root.variations)
|
|
36
32
|
|
|
37
33
|
const activeDominantVariationValue = activeVariations[dominantVariantName]
|
|
@@ -11,22 +11,26 @@ type SkuVariants {
|
|
|
11
11
|
Maps property value combinations to their respective SKU's slug. Enables
|
|
12
12
|
us to retrieve the slug for the SKU that matches the currently selected
|
|
13
13
|
variations in O(1) time.
|
|
14
|
+
If `dominantVariantName` is not present, the first variant will be
|
|
15
|
+
considered the dominant one.
|
|
14
16
|
"""
|
|
15
|
-
slugsMap(dominantVariantName: String
|
|
17
|
+
slugsMap(dominantVariantName: String): SlugsMap
|
|
16
18
|
"""
|
|
17
19
|
Available options for each varying SKU property, taking into account the
|
|
18
|
-
`dominantVariantName` property. Returns all available options for the
|
|
20
|
+
`dominantVariantName` property. Returns all available options for the
|
|
19
21
|
dominant property, and only options that can be combined with its current
|
|
20
22
|
value for other properties.
|
|
23
|
+
If `dominantVariantName` is not present, the first variant will be
|
|
24
|
+
considered the dominant one.
|
|
21
25
|
"""
|
|
22
|
-
availableVariations(dominantVariantName: String
|
|
26
|
+
availableVariations(dominantVariantName: String): FormattedVariants
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
"""
|
|
26
|
-
Example:
|
|
30
|
+
Example:
|
|
27
31
|
|
|
28
32
|
```json
|
|
29
|
-
{
|
|
33
|
+
{
|
|
30
34
|
'Color-Red-Size-40': 'classic-shoes-37'
|
|
31
35
|
}
|
|
32
36
|
```
|
|
@@ -54,18 +58,18 @@ Example:
|
|
|
54
58
|
"""
|
|
55
59
|
scalar VariantsByName
|
|
56
60
|
"""
|
|
57
|
-
Example:
|
|
61
|
+
Example:
|
|
58
62
|
|
|
59
63
|
```json
|
|
60
64
|
{
|
|
61
65
|
Color: [
|
|
62
|
-
{
|
|
66
|
+
{
|
|
63
67
|
src: "https://storecomponents.vtexassets.com/...",
|
|
64
68
|
alt: "...",
|
|
65
69
|
label: "...",
|
|
66
70
|
value: "..."
|
|
67
71
|
},
|
|
68
|
-
{
|
|
72
|
+
{
|
|
69
73
|
src: "https://storecomponents.vtexassets.com/...",
|
|
70
74
|
alt: "...",
|
|
71
75
|
label: "...",
|
|
@@ -73,7 +77,7 @@ Example:
|
|
|
73
77
|
}
|
|
74
78
|
],
|
|
75
79
|
Size: [
|
|
76
|
-
{
|
|
80
|
+
{
|
|
77
81
|
src: "https://storecomponents.vtexassets.com/...",
|
|
78
82
|
alt: "...",
|
|
79
83
|
label: "...",
|
|
@@ -84,4 +88,3 @@ Example:
|
|
|
84
88
|
```
|
|
85
89
|
"""
|
|
86
90
|
scalar FormattedVariants
|
|
87
|
-
|