@graphcommerce/magento-graphql 8.1.0-canary.9 → 9.0.0-canary.101
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 +194 -0
- package/Config.graphqls +7 -0
- package/graphqlErrorByCategory.ts +7 -7
- package/mesh/attributeValueResolver.ts +31 -0
- package/mesh/customAttributeMetadataV2.ts +68 -0
- package/mesh/customAttributeV2Resolver.ts +47 -0
- package/package.json +6 -5
- package/plugins/magentoGraphqlConfig.ts +7 -7
- package/plugins/meshConfigAttrValue.ts +24 -0
- package/schema/AttributeValueInterface-attribute.graphqls +9 -0
- package/schema/ProductInterface-custom_attribute.graphqls +49 -0
- package/schema-246/CartAddressInput-vat_id.graphqls +15 -0
- package/schema-246/Mutation-deleteCustomer.graphqls +6 -0
- package/schema-246/OrderItem-gift_message.graphqls +27 -0
- package/schema-246/SelectedShippingMethod.graphqls +4 -0
- package/schema-247/Cart-itemsV2.graphqls +72 -0
- package/schema-247/CartAddress.graphqls +56 -0
- package/schema-247/CustomAttributesV2.graphqls +266 -0
- package/schema-247/Mutation-cancelOrder.graphqls +49 -0
- package/schema-247/Mutation-confirmEmail.graphqls +55 -0
- package/schema-247/Mutation-contactUs.graphqls +40 -0
- package/schema-247/Mutation-createGuestCart.graphqls +21 -0
- package/schema-247/Mutation-estimateShippingMethods.graphqls +44 -0
- package/schema-247/Mutation-estimateTotals.graphqls +21 -0
- package/schema-247/Mutation-placeOrder.graphqls +10 -0
- package/schema-247/ProductAttributeFilterInput-category_url_path.graphqls +3 -0
- package/schema-247/Query-attributesList.graphqls +450 -0
- package/schema-247/Query-customAttributeMetadataV2.graphqls +7 -0
- package/schema-247/Query-guestOrder.graphqls +31 -0
- package/schema-247/Query-guestOrderByToken.graphqls +30 -0
- package/schema-247/Query-recaptchaV3Config.graphqls +53 -0
- package/typePolicies.ts +5 -5
- package/schema/Magento243to245.graphqls +0 -52
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,199 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 9.0.0-canary.101
|
|
4
|
+
|
|
5
|
+
## 9.0.0-canary.100
|
|
6
|
+
|
|
7
|
+
## 9.0.0-canary.99
|
|
8
|
+
|
|
9
|
+
### Minor Changes
|
|
10
|
+
|
|
11
|
+
- [#2416](https://github.com/graphcommerce-org/graphcommerce/pull/2416) [`651eea0`](https://github.com/graphcommerce-org/graphcommerce/commit/651eea0bdda1ed0f46f4c73d7edf52c8c1da5b54) - Created a new field for products: `custom_attribute(attribute_code: "attribute_code")` to retrieve attribute option value labels. This field is only available in Magento 2.4.7 and up. ([@paales](https://github.com/paales))
|
|
12
|
+
|
|
13
|
+
- [#2416](https://github.com/graphcommerce-org/graphcommerce/pull/2416) [`53af256`](https://github.com/graphcommerce-org/graphcommerce/commit/53af25671d3aca7f3daa2dd45ccd2237697e9254) - Added an `attribute`-field to `AttributeValueInterface` to be able to retrieve attribute metadata from the value of an attribute. ([@paales](https://github.com/paales))
|
|
14
|
+
|
|
15
|
+
## 9.0.0-canary.98
|
|
16
|
+
|
|
17
|
+
## 9.0.0-canary.97
|
|
18
|
+
|
|
19
|
+
## 9.0.0-canary.96
|
|
20
|
+
|
|
21
|
+
## 9.0.0-canary.95
|
|
22
|
+
|
|
23
|
+
## 9.0.0-canary.94
|
|
24
|
+
|
|
25
|
+
## 9.0.0-canary.93
|
|
26
|
+
|
|
27
|
+
## 9.0.0-canary.92
|
|
28
|
+
|
|
29
|
+
## 9.0.0-canary.91
|
|
30
|
+
|
|
31
|
+
## 9.0.0-canary.90
|
|
32
|
+
|
|
33
|
+
## 9.0.0-canary.89
|
|
34
|
+
|
|
35
|
+
## 9.0.0-canary.88
|
|
36
|
+
|
|
37
|
+
## 9.0.0-canary.87
|
|
38
|
+
|
|
39
|
+
## 9.0.0-canary.86
|
|
40
|
+
|
|
41
|
+
## 9.0.0-canary.85
|
|
42
|
+
|
|
43
|
+
## 9.0.0-canary.84
|
|
44
|
+
|
|
45
|
+
## 9.0.0-canary.83
|
|
46
|
+
|
|
47
|
+
## 9.0.0-canary.82
|
|
48
|
+
|
|
49
|
+
## 9.0.0-canary.81
|
|
50
|
+
|
|
51
|
+
## 9.0.0-canary.80
|
|
52
|
+
|
|
53
|
+
## 9.0.0-canary.79
|
|
54
|
+
|
|
55
|
+
## 9.0.0-canary.78
|
|
56
|
+
|
|
57
|
+
## 9.0.0-canary.77
|
|
58
|
+
|
|
59
|
+
## 9.0.0-canary.76
|
|
60
|
+
|
|
61
|
+
## 9.0.0-canary.75
|
|
62
|
+
|
|
63
|
+
## 9.0.0-canary.74
|
|
64
|
+
|
|
65
|
+
## 9.0.0-canary.73
|
|
66
|
+
|
|
67
|
+
## 9.0.0-canary.72
|
|
68
|
+
|
|
69
|
+
## 9.0.0-canary.71
|
|
70
|
+
|
|
71
|
+
## 9.0.0-canary.70
|
|
72
|
+
|
|
73
|
+
## 9.0.0-canary.69
|
|
74
|
+
|
|
75
|
+
## 9.0.0-canary.68
|
|
76
|
+
|
|
77
|
+
## 9.0.0-canary.67
|
|
78
|
+
|
|
79
|
+
## 9.0.0-canary.66
|
|
80
|
+
|
|
81
|
+
## 9.0.0-canary.65
|
|
82
|
+
|
|
83
|
+
## 9.0.0-canary.64
|
|
84
|
+
|
|
85
|
+
## 9.0.0-canary.63
|
|
86
|
+
|
|
87
|
+
## 9.0.0-canary.62
|
|
88
|
+
|
|
89
|
+
## 9.0.0-canary.61
|
|
90
|
+
|
|
91
|
+
## 9.0.0-canary.60
|
|
92
|
+
|
|
93
|
+
## 9.0.0-canary.59
|
|
94
|
+
|
|
95
|
+
## 9.0.0-canary.58
|
|
96
|
+
|
|
97
|
+
## 9.0.0-canary.57
|
|
98
|
+
|
|
99
|
+
## 9.0.0-canary.56
|
|
100
|
+
|
|
101
|
+
## 9.0.0-canary.55
|
|
102
|
+
|
|
103
|
+
## 9.0.0-canary.54
|
|
104
|
+
|
|
105
|
+
## 8.1.0-canary.53
|
|
106
|
+
|
|
107
|
+
## 8.1.0-canary.52
|
|
108
|
+
|
|
109
|
+
## 8.1.0-canary.51
|
|
110
|
+
|
|
111
|
+
## 8.1.0-canary.50
|
|
112
|
+
|
|
113
|
+
## 8.1.0-canary.49
|
|
114
|
+
|
|
115
|
+
## 8.1.0-canary.48
|
|
116
|
+
|
|
117
|
+
## 8.1.0-canary.47
|
|
118
|
+
|
|
119
|
+
## 8.1.0-canary.46
|
|
120
|
+
|
|
121
|
+
## 8.1.0-canary.45
|
|
122
|
+
|
|
123
|
+
## 8.1.0-canary.44
|
|
124
|
+
|
|
125
|
+
## 8.1.0-canary.43
|
|
126
|
+
|
|
127
|
+
## 8.1.0-canary.42
|
|
128
|
+
|
|
129
|
+
## 8.1.0-canary.41
|
|
130
|
+
|
|
131
|
+
## 8.1.0-canary.40
|
|
132
|
+
|
|
133
|
+
## 8.1.0-canary.39
|
|
134
|
+
|
|
135
|
+
## 8.1.0-canary.38
|
|
136
|
+
|
|
137
|
+
## 8.1.0-canary.37
|
|
138
|
+
|
|
139
|
+
## 8.1.0-canary.36
|
|
140
|
+
|
|
141
|
+
## 8.1.0-canary.35
|
|
142
|
+
|
|
143
|
+
## 8.1.0-canary.34
|
|
144
|
+
|
|
145
|
+
## 8.1.0-canary.33
|
|
146
|
+
|
|
147
|
+
## 8.1.0-canary.32
|
|
148
|
+
|
|
149
|
+
### Patch Changes
|
|
150
|
+
|
|
151
|
+
- [#2299](https://github.com/graphcommerce-org/graphcommerce/pull/2299) [`c6ac45b`](https://github.com/graphcommerce-org/graphcommerce/commit/c6ac45b8ff41dcaa47f1e5d40d04e120990870aa) - Added a magentoVersion configuration value to be able to differentiate features based on the Magento version ([@paales](https://github.com/paales))
|
|
152
|
+
|
|
153
|
+
## 8.1.0-canary.31
|
|
154
|
+
|
|
155
|
+
## 8.1.0-canary.30
|
|
156
|
+
|
|
157
|
+
## 8.1.0-canary.29
|
|
158
|
+
|
|
159
|
+
## 8.1.0-canary.28
|
|
160
|
+
|
|
161
|
+
## 8.1.0-canary.27
|
|
162
|
+
|
|
163
|
+
## 8.1.0-canary.26
|
|
164
|
+
|
|
165
|
+
## 8.1.0-canary.25
|
|
166
|
+
|
|
167
|
+
## 8.1.0-canary.24
|
|
168
|
+
|
|
169
|
+
## 8.1.0-canary.23
|
|
170
|
+
|
|
171
|
+
## 8.1.0-canary.22
|
|
172
|
+
|
|
173
|
+
## 8.1.0-canary.21
|
|
174
|
+
|
|
175
|
+
## 8.1.0-canary.20
|
|
176
|
+
|
|
177
|
+
## 8.1.0-canary.19
|
|
178
|
+
|
|
179
|
+
## 8.1.0-canary.18
|
|
180
|
+
|
|
181
|
+
## 8.1.0-canary.17
|
|
182
|
+
|
|
183
|
+
## 8.1.0-canary.16
|
|
184
|
+
|
|
185
|
+
## 8.1.0-canary.15
|
|
186
|
+
|
|
187
|
+
## 8.1.0-canary.14
|
|
188
|
+
|
|
189
|
+
## 8.1.0-canary.13
|
|
190
|
+
|
|
191
|
+
## 8.1.0-canary.12
|
|
192
|
+
|
|
193
|
+
## 8.1.0-canary.11
|
|
194
|
+
|
|
195
|
+
## 8.1.0-canary.10
|
|
196
|
+
|
|
3
197
|
## 8.1.0-canary.9
|
|
4
198
|
|
|
5
199
|
## 8.1.0-canary.8
|
package/Config.graphqls
CHANGED
|
@@ -6,6 +6,13 @@ extend input GraphCommerceConfig {
|
|
|
6
6
|
- https://magento2.test/graphql
|
|
7
7
|
"""
|
|
8
8
|
magentoEndpoint: String!
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
Version of the Magento backend.
|
|
12
|
+
|
|
13
|
+
Values: 245, 246, 247 for Magento 2.4.5, 2.4.6, 2.4.7 respectively.
|
|
14
|
+
"""
|
|
15
|
+
magentoVersion: Int!
|
|
9
16
|
}
|
|
10
17
|
|
|
11
18
|
extend input GraphCommerceStorefrontConfig {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApolloError } from '@graphcommerce/graphql'
|
|
2
|
-
import type { GraphQLError } from 'graphql'
|
|
2
|
+
import type { GraphQLError, GraphQLFormattedError } from 'graphql'
|
|
3
3
|
|
|
4
4
|
export type ErrorCategory =
|
|
5
5
|
| 'internal'
|
|
@@ -28,14 +28,15 @@ export type GraphQLErrorByCategoryPropsNoExtract = Omit<GraphQLErrorByCategoryPr
|
|
|
28
28
|
*/
|
|
29
29
|
export function graphqlErrorByCategory(
|
|
30
30
|
props: GraphQLErrorByCategoryPropsNoExtract,
|
|
31
|
-
): [ApolloError,
|
|
31
|
+
): [ApolloError, GraphQLFormattedError | undefined]
|
|
32
32
|
export function graphqlErrorByCategory(
|
|
33
33
|
props: GraphQLErrorByCategoryProps,
|
|
34
|
-
): [ApolloError | undefined,
|
|
34
|
+
): [ApolloError | undefined, GraphQLFormattedError | undefined]
|
|
35
35
|
export function graphqlErrorByCategory(
|
|
36
36
|
props: GraphQLErrorByCategoryProps | GraphQLErrorByCategoryPropsNoExtract,
|
|
37
|
-
): [ApolloError | undefined,
|
|
37
|
+
): [ApolloError | undefined, GraphQLFormattedError | undefined] {
|
|
38
38
|
const { category, error, extract = true, mask } = props
|
|
39
|
+
|
|
39
40
|
if (!error) return [error, undefined]
|
|
40
41
|
|
|
41
42
|
const newError = new ApolloError({
|
|
@@ -45,10 +46,9 @@ export function graphqlErrorByCategory(
|
|
|
45
46
|
),
|
|
46
47
|
})
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
let graphqlError = error.graphQLErrors.find((err) => err?.extensions?.category === category)
|
|
49
50
|
if (mask && graphqlError) {
|
|
50
|
-
|
|
51
|
-
graphqlError.message = mask
|
|
51
|
+
graphqlError = { ...graphqlError, message: mask }
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
return newError.graphQLErrors.length === 0 && !newError.networkError
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import fragments from '@graphcommerce/graphql/generated/fragments.json'
|
|
2
|
+
import type {
|
|
3
|
+
AttributeValueInterfaceResolvers,
|
|
4
|
+
MeshContext,
|
|
5
|
+
Resolvers,
|
|
6
|
+
} from '@graphcommerce/graphql-mesh'
|
|
7
|
+
import { customAttributeMetadataV2 } from './customAttributeMetadataV2'
|
|
8
|
+
|
|
9
|
+
type AttributeValueResolver = Pick<AttributeValueInterfaceResolvers<MeshContext>, 'attribute'>
|
|
10
|
+
|
|
11
|
+
const attributeValueResolver: AttributeValueResolver = {
|
|
12
|
+
attribute: {
|
|
13
|
+
selectionSet: `{ code }`,
|
|
14
|
+
resolve: async (root, _, context) =>
|
|
15
|
+
root.attribute ??
|
|
16
|
+
(await customAttributeMetadataV2(
|
|
17
|
+
{ attribute_code: root.code, entity_type: 'catalog_product' },
|
|
18
|
+
context,
|
|
19
|
+
)),
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type AttributeValueTypes = NonNullable<
|
|
24
|
+
Awaited<ReturnType<AttributeValueInterfaceResolvers['__resolveType']>>
|
|
25
|
+
>
|
|
26
|
+
const attributeValueTypes = fragments.possibleTypes.AttributeValueInterface as AttributeValueTypes[]
|
|
27
|
+
const resolvers: Resolvers = {}
|
|
28
|
+
attributeValueTypes.forEach((attributeValueType) => {
|
|
29
|
+
if (!resolvers[attributeValueType]) resolvers[attributeValueType] = attributeValueResolver
|
|
30
|
+
})
|
|
31
|
+
export default resolvers
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { MeshContext, CustomAttributeMetadataInterface } from '@graphcommerce/graphql-mesh'
|
|
2
|
+
|
|
3
|
+
export type CustomAttributeInput = { attribute_code: string; entity_type: 'catalog_product' }
|
|
4
|
+
|
|
5
|
+
export async function customAttributeMetadataV2(
|
|
6
|
+
input: CustomAttributeInput,
|
|
7
|
+
context: MeshContext,
|
|
8
|
+
): Promise<CustomAttributeMetadataInterface | null> {
|
|
9
|
+
const cacheKey = `customAttributeMetadata-${input.entity_type}-${input.attribute_code}`
|
|
10
|
+
const cached = await context.cache.get(cacheKey)
|
|
11
|
+
if (cached) return cached
|
|
12
|
+
|
|
13
|
+
if (input.entity_type !== 'catalog_product')
|
|
14
|
+
throw Error('Only catalog_product is supported at this moment')
|
|
15
|
+
|
|
16
|
+
if (
|
|
17
|
+
!('customAttributeMetadataV2' in context.m2.Query) ||
|
|
18
|
+
typeof context.m2.Query.customAttributeMetadataV2 !== 'function'
|
|
19
|
+
)
|
|
20
|
+
throw Error('This field is only available in Magento 2.4.7 and up')
|
|
21
|
+
|
|
22
|
+
const attribute = await context.m2.Query.customAttributeMetadataV2({
|
|
23
|
+
context,
|
|
24
|
+
key: input,
|
|
25
|
+
argsFromKeys: (attributes) => ({ attributes }),
|
|
26
|
+
selectionSet: /* GraphQL */ `
|
|
27
|
+
{
|
|
28
|
+
items {
|
|
29
|
+
__typename
|
|
30
|
+
code
|
|
31
|
+
label
|
|
32
|
+
default_value
|
|
33
|
+
entity_type
|
|
34
|
+
frontend_class
|
|
35
|
+
frontend_input
|
|
36
|
+
is_required
|
|
37
|
+
is_unique
|
|
38
|
+
label
|
|
39
|
+
... on CatalogAttributeMetadata {
|
|
40
|
+
apply_to
|
|
41
|
+
is_comparable
|
|
42
|
+
is_filterable
|
|
43
|
+
is_filterable_in_search
|
|
44
|
+
is_html_allowed_on_front
|
|
45
|
+
is_searchable
|
|
46
|
+
is_used_for_price_rules
|
|
47
|
+
is_used_for_promo_rules
|
|
48
|
+
is_visible_in_advanced_search
|
|
49
|
+
is_visible_on_front
|
|
50
|
+
is_wysiwyg_enabled
|
|
51
|
+
used_in_product_listing
|
|
52
|
+
}
|
|
53
|
+
options {
|
|
54
|
+
label
|
|
55
|
+
is_default
|
|
56
|
+
value
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
`,
|
|
61
|
+
valuesFromResults: (res, attributes) =>
|
|
62
|
+
attributes.map((attr) => res.items?.find((v) => v?.code === attr.attribute_code)),
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
// Cache for 1 hour
|
|
66
|
+
await context.cache.set(cacheKey, attribute, { ttl: 60 * 60 })
|
|
67
|
+
return attribute ?? null
|
|
68
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import fragments from '@graphcommerce/graphql/generated/fragments.json'
|
|
2
|
+
import type { MeshContext, ProductInterfaceResolvers, Resolvers } from '@graphcommerce/graphql-mesh'
|
|
3
|
+
import { Kind } from 'graphql'
|
|
4
|
+
import { CustomAttributeInput, customAttributeMetadataV2 } from './customAttributeMetadataV2'
|
|
5
|
+
|
|
6
|
+
type CustomAttributeV2Resolver = Pick<ProductInterfaceResolvers<MeshContext>, 'custom_attributeV2'>
|
|
7
|
+
|
|
8
|
+
const customAttributeV2Resolver: CustomAttributeV2Resolver = {
|
|
9
|
+
custom_attributeV2: {
|
|
10
|
+
selectionSet: (fieldNode) => ({
|
|
11
|
+
kind: Kind.SELECTION_SET,
|
|
12
|
+
selections: (fieldNode.arguments ?? [])
|
|
13
|
+
.map((arg) => arg.value)
|
|
14
|
+
.filter((value) => value.kind === Kind.STRING)
|
|
15
|
+
.map((value) => ({ kind: Kind.FIELD, name: { kind: Kind.NAME, value: value.value } })),
|
|
16
|
+
}),
|
|
17
|
+
resolve: async (root, { attribute_code: code }, context) => {
|
|
18
|
+
const value = String(root[code] ?? '')
|
|
19
|
+
const input: CustomAttributeInput = { attribute_code: code, entity_type: 'catalog_product' }
|
|
20
|
+
const attribute = await customAttributeMetadataV2(input, context)
|
|
21
|
+
|
|
22
|
+
if (!attribute || !value) return null
|
|
23
|
+
|
|
24
|
+
if (
|
|
25
|
+
attribute?.frontend_input &&
|
|
26
|
+
['SELECT', 'MULTISELECT'].includes(attribute.frontend_input)
|
|
27
|
+
) {
|
|
28
|
+
const values = attribute.frontend_input === 'SELECT' ? [value] : value.split(',')
|
|
29
|
+
const selected_options = values.map((v) => {
|
|
30
|
+
const found = attribute.options?.find((o) => o?.value === v || o?.label === v)
|
|
31
|
+
if (!found) return null
|
|
32
|
+
return { ...found, __typename: 'AttributeSelectedOption' }
|
|
33
|
+
})
|
|
34
|
+
return { __typename: 'AttributeSelectedOptions', code, selected_options, attribute }
|
|
35
|
+
}
|
|
36
|
+
return { __typename: 'AttributeValue', code, value, attribute }
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type ProductTypes = NonNullable<Awaited<ReturnType<ProductInterfaceResolvers['__resolveType']>>>
|
|
42
|
+
const productInterfaceTypes = fragments.possibleTypes.ProductInterface as ProductTypes[]
|
|
43
|
+
const resolvers: Resolvers = {}
|
|
44
|
+
productInterfaceTypes.forEach((productType) => {
|
|
45
|
+
if (!resolvers[productType]) resolvers[productType] = customAttributeV2Resolver
|
|
46
|
+
})
|
|
47
|
+
export default resolvers
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/magento-graphql",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "9.0.0-canary.101",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "index.ts",
|
|
8
8
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
@@ -13,10 +13,11 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@graphcommerce/eslint-config-pwa": "^
|
|
17
|
-
"@graphcommerce/graphql": "^
|
|
18
|
-
"@graphcommerce/prettier-config-pwa": "^
|
|
19
|
-
"@graphcommerce/typescript-config-pwa": "^
|
|
16
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.101",
|
|
17
|
+
"@graphcommerce/graphql": "^9.0.0-canary.101",
|
|
18
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.101",
|
|
19
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.101",
|
|
20
|
+
"graphql": "^16.0.0",
|
|
20
21
|
"next": "*",
|
|
21
22
|
"react": "^18.2.0",
|
|
22
23
|
"react-dom": "^18.2.0"
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { graphqlConfig } from '@graphcommerce/graphql'
|
|
2
|
-
import type { FunctionPlugin } from '@graphcommerce/next-config'
|
|
1
|
+
import { graphqlConfig as graphqlConfigType } from '@graphcommerce/graphql'
|
|
2
|
+
import type { FunctionPlugin, PluginConfig } from '@graphcommerce/next-config'
|
|
3
3
|
import { magentoTypePolicies } from '../typePolicies'
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
|
|
5
|
+
export const config: PluginConfig = {
|
|
6
|
+
type: 'function',
|
|
7
|
+
module: '@graphcommerce/graphql',
|
|
8
|
+
}
|
|
7
9
|
|
|
8
|
-
const
|
|
10
|
+
export const graphqlConfig: FunctionPlugin<typeof graphqlConfigType> = (prev, config) => {
|
|
9
11
|
const results = prev(config)
|
|
10
12
|
return { ...results, policies: [magentoTypePolicies, ...results.policies] }
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
export const plugin = magentoGraphqlConfig
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { meshConfig as meshConfigBase } from '@graphcommerce/graphql-mesh/meshConfig'
|
|
2
|
+
import type { FunctionPlugin, PluginConfig } from '@graphcommerce/next-config'
|
|
3
|
+
|
|
4
|
+
export const config: PluginConfig = {
|
|
5
|
+
module: '@graphcommerce/graphql-mesh/meshConfig',
|
|
6
|
+
type: 'function',
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const meshConfig: FunctionPlugin<typeof meshConfigBase> = (
|
|
10
|
+
prev,
|
|
11
|
+
baseConfig,
|
|
12
|
+
graphCommerceConfig,
|
|
13
|
+
) =>
|
|
14
|
+
prev(
|
|
15
|
+
{
|
|
16
|
+
...baseConfig,
|
|
17
|
+
additionalResolvers: [
|
|
18
|
+
...(baseConfig.additionalResolvers ?? []),
|
|
19
|
+
'@graphcommerce/magento-graphql/mesh/customAttributeV2Resolver.ts',
|
|
20
|
+
'@graphcommerce/magento-graphql/mesh/attributeValueResolver.ts',
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
graphCommerceConfig,
|
|
24
|
+
)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
extend interface AttributeValueInterface {
|
|
2
|
+
attribute: CustomAttributeMetadataInterface
|
|
3
|
+
}
|
|
4
|
+
extend type AttributeValue {
|
|
5
|
+
attribute: CustomAttributeMetadataInterface
|
|
6
|
+
}
|
|
7
|
+
extend type AttributeSelectedOptions {
|
|
8
|
+
attribute: CustomAttributeMetadataInterface
|
|
9
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
extend interface ProductInterface {
|
|
2
|
+
"""
|
|
3
|
+
This is the singular version of the custom_attributesV2 and allows selecting a single attribute option value.
|
|
4
|
+
Available only after Magento 2.4.7 as it relies on the customAttributesV2 query.
|
|
5
|
+
"""
|
|
6
|
+
custom_attributeV2(attribute_code: String!): AttributeValueInterface
|
|
7
|
+
}
|
|
8
|
+
extend type SimpleProduct {
|
|
9
|
+
"""
|
|
10
|
+
This is the singular version of the custom_attributesV2 and allows selecting a single attribute option value.
|
|
11
|
+
Available only after Magento 2.4.7 as it relies on the customAttributesV2 query.
|
|
12
|
+
"""
|
|
13
|
+
custom_attributeV2(attribute_code: String!): AttributeValueInterface
|
|
14
|
+
}
|
|
15
|
+
extend type ConfigurableProduct {
|
|
16
|
+
"""
|
|
17
|
+
This is the singular version of the custom_attributesV2 and allows selecting a single attribute option value.
|
|
18
|
+
Available only after Magento 2.4.7 as it relies on the customAttributesV2 query.
|
|
19
|
+
"""
|
|
20
|
+
custom_attributeV2(attribute_code: String!): AttributeValueInterface
|
|
21
|
+
}
|
|
22
|
+
extend type BundleProduct {
|
|
23
|
+
"""
|
|
24
|
+
This is the singular version of the custom_attributesV2 and allows selecting a single attribute option value.
|
|
25
|
+
Available only after Magento 2.4.7 as it relies on the customAttributesV2 query.
|
|
26
|
+
"""
|
|
27
|
+
custom_attributeV2(attribute_code: String!): AttributeValueInterface
|
|
28
|
+
}
|
|
29
|
+
extend type DownloadableProduct {
|
|
30
|
+
"""
|
|
31
|
+
This is the singular version of the custom_attributesV2 and allows selecting a single attribute option value.
|
|
32
|
+
Available only after Magento 2.4.7 as it relies on the customAttributesV2 query.
|
|
33
|
+
"""
|
|
34
|
+
custom_attributeV2(attribute_code: String!): AttributeValueInterface
|
|
35
|
+
}
|
|
36
|
+
extend type VirtualProduct {
|
|
37
|
+
"""
|
|
38
|
+
This is the singular version of the custom_attributesV2 and allows selecting a single attribute option value.
|
|
39
|
+
Available only after Magento 2.4.7 as it relies on the customAttributesV2 query.
|
|
40
|
+
"""
|
|
41
|
+
custom_attributeV2(attribute_code: String!): AttributeValueInterface
|
|
42
|
+
}
|
|
43
|
+
extend type GroupedProduct {
|
|
44
|
+
"""
|
|
45
|
+
This is the singular version of the custom_attributesV2 and allows selecting a single attribute option value.
|
|
46
|
+
Available only after Magento 2.4.7 as it relies on the customAttributesV2 query.
|
|
47
|
+
"""
|
|
48
|
+
custom_attributeV2(attribute_code: String!): AttributeValueInterface
|
|
49
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
input CartAddressInput {
|
|
2
|
+
vat_id: String @deprecated(reason: "Magento >= 2.4.6")
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
interface CartAddressInterface {
|
|
6
|
+
vat_id: String @deprecated(reason: "Magento >= 2.4.6")
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type ShippingCartAddress implements CartAddressInterface {
|
|
10
|
+
vat_id: String @deprecated(reason: "Magento >= 2.4.6")
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type BillingCartAddress {
|
|
14
|
+
vat_id: String @deprecated(reason: "Magento >= 2.4.6")
|
|
15
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
interface OrderItemInterface {
|
|
2
|
+
"""
|
|
3
|
+
The selected gift message for the order item
|
|
4
|
+
"""
|
|
5
|
+
gift_message: GiftMessage @deprecated(reason: "Magento >= 2.4.6")
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
type OrderItem {
|
|
9
|
+
"""
|
|
10
|
+
The selected gift message for the order item
|
|
11
|
+
"""
|
|
12
|
+
gift_message: GiftMessage @deprecated(reason: "Magento >= 2.4.6")
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type BundleOrderItem {
|
|
16
|
+
"""
|
|
17
|
+
The selected gift message for the order item
|
|
18
|
+
"""
|
|
19
|
+
gift_message: GiftMessage @deprecated(reason: "Magento >= 2.4.6")
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type DownloadableOrderItem {
|
|
23
|
+
"""
|
|
24
|
+
The selected gift message for the order item
|
|
25
|
+
"""
|
|
26
|
+
gift_message: GiftMessage @deprecated(reason: "Magento >= 2.4.6")
|
|
27
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
type CartItems {
|
|
2
|
+
"""
|
|
3
|
+
An array of products that have been added to the cart.
|
|
4
|
+
"""
|
|
5
|
+
items: [CartItemInterface]!
|
|
6
|
+
"""
|
|
7
|
+
Metadata for pagination rendering.
|
|
8
|
+
"""
|
|
9
|
+
page_info: SearchResultPageInfo
|
|
10
|
+
"""
|
|
11
|
+
The number of returned cart items.
|
|
12
|
+
"""
|
|
13
|
+
total_count: Int!
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
"""
|
|
17
|
+
Specifies the field to use for sorting quote items
|
|
18
|
+
"""
|
|
19
|
+
enum SortQuoteItemsEnum {
|
|
20
|
+
ITEM_ID
|
|
21
|
+
CREATED_AT
|
|
22
|
+
UPDATED_AT
|
|
23
|
+
PRODUCT_ID
|
|
24
|
+
SKU
|
|
25
|
+
NAME
|
|
26
|
+
DESCRIPTION
|
|
27
|
+
WEIGHT
|
|
28
|
+
QTY
|
|
29
|
+
PRICE
|
|
30
|
+
BASE_PRICE
|
|
31
|
+
CUSTOM_PRICE
|
|
32
|
+
DISCOUNT_PERCENT
|
|
33
|
+
DISCOUNT_AMOUNT
|
|
34
|
+
BASE_DISCOUNT_AMOUNT
|
|
35
|
+
TAX_PERCENT
|
|
36
|
+
TAX_AMOUNT
|
|
37
|
+
BASE_TAX_AMOUNT
|
|
38
|
+
ROW_TOTAL
|
|
39
|
+
BASE_ROW_TOTAL
|
|
40
|
+
ROW_TOTAL_WITH_DISCOUNT
|
|
41
|
+
ROW_WEIGHT
|
|
42
|
+
PRODUCT_TYPE
|
|
43
|
+
BASE_TAX_BEFORE_DISCOUNT
|
|
44
|
+
TAX_BEFORE_DISCOUNT
|
|
45
|
+
ORIGINAL_CUSTOM_PRICE
|
|
46
|
+
PRICE_INC_TAX
|
|
47
|
+
BASE_PRICE_INC_TAX
|
|
48
|
+
ROW_TOTAL_INC_TAX
|
|
49
|
+
BASE_ROW_TOTAL_INC_TAX
|
|
50
|
+
DISCOUNT_TAX_COMPENSATION_AMOUNT
|
|
51
|
+
BASE_DISCOUNT_TAX_COMPENSATION_AMOUNT
|
|
52
|
+
FREE_SHIPPING
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
"""
|
|
56
|
+
Specifies the field to use for sorting quote items
|
|
57
|
+
"""
|
|
58
|
+
input QuoteItemsSortInput {
|
|
59
|
+
"""
|
|
60
|
+
Specifies the quote items field to sort by
|
|
61
|
+
"""
|
|
62
|
+
field: SortQuoteItemsEnum!
|
|
63
|
+
"""
|
|
64
|
+
Specifies the order of quote items' sorting
|
|
65
|
+
"""
|
|
66
|
+
order: SortEnum!
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type Cart {
|
|
70
|
+
itemsV2(pageSize: Int = 20, currentPage: Int = 1, sort: QuoteItemsSortInput): CartItems
|
|
71
|
+
@deprecated(reason: "Magento >= 2.4.7")
|
|
72
|
+
}
|