@decocms/apps 0.20.1
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/.github/workflows/release.yml +34 -0
- package/.releaserc.json +25 -0
- package/commerce/components/Image.tsx +209 -0
- package/commerce/components/JsonLd.tsx +285 -0
- package/commerce/sdk/analytics.ts +24 -0
- package/commerce/sdk/formatPrice.ts +23 -0
- package/commerce/sdk/url.ts +9 -0
- package/commerce/sdk/useOffer.ts +75 -0
- package/commerce/sdk/useVariantPossibilities.ts +43 -0
- package/commerce/types/commerce.ts +1105 -0
- package/commerce/utils/canonical.ts +11 -0
- package/commerce/utils/constants.ts +9 -0
- package/commerce/utils/filters.ts +10 -0
- package/commerce/utils/productToAnalyticsItem.ts +67 -0
- package/commerce/utils/stateByZip.ts +50 -0
- package/knip.json +19 -0
- package/package.json +77 -0
- package/shopify/actions/cart/addItems.ts +37 -0
- package/shopify/actions/cart/updateCoupons.ts +32 -0
- package/shopify/actions/cart/updateItems.ts +32 -0
- package/shopify/actions/user/signIn.ts +45 -0
- package/shopify/actions/user/signUp.ts +36 -0
- package/shopify/client.ts +58 -0
- package/shopify/index.ts +32 -0
- package/shopify/init.ts +40 -0
- package/shopify/loaders/ProductDetailsPage.ts +35 -0
- package/shopify/loaders/ProductList.ts +101 -0
- package/shopify/loaders/ProductListingPage.ts +180 -0
- package/shopify/loaders/RelatedProducts.ts +45 -0
- package/shopify/loaders/cart.ts +73 -0
- package/shopify/loaders/shop.ts +40 -0
- package/shopify/loaders/user.ts +44 -0
- package/shopify/utils/admin/admin.ts +57 -0
- package/shopify/utils/admin/queries.ts +29 -0
- package/shopify/utils/cart.ts +28 -0
- package/shopify/utils/cookies.ts +85 -0
- package/shopify/utils/enums.ts +438 -0
- package/shopify/utils/graphql.ts +69 -0
- package/shopify/utils/storefront/queries.ts +530 -0
- package/shopify/utils/storefront/storefront.graphql.gen.ts +113 -0
- package/shopify/utils/transform.ts +436 -0
- package/shopify/utils/types.ts +191 -0
- package/shopify/utils/user.ts +23 -0
- package/shopify/utils/utils.ts +164 -0
- package/tsconfig.json +11 -0
- package/vtex/README.md +6 -0
- package/vtex/actions/address.ts +211 -0
- package/vtex/actions/auth.ts +337 -0
- package/vtex/actions/checkout.ts +497 -0
- package/vtex/actions/index.ts +11 -0
- package/vtex/actions/masterData.ts +170 -0
- package/vtex/actions/misc.ts +196 -0
- package/vtex/actions/newsletter.ts +108 -0
- package/vtex/actions/orders.ts +37 -0
- package/vtex/actions/profile.ts +119 -0
- package/vtex/actions/session.ts +87 -0
- package/vtex/actions/trigger.ts +43 -0
- package/vtex/actions/wishlist.ts +116 -0
- package/vtex/client.ts +423 -0
- package/vtex/hooks/index.ts +4 -0
- package/vtex/hooks/useAutocomplete.ts +89 -0
- package/vtex/hooks/useCart.ts +219 -0
- package/vtex/hooks/useUser.ts +78 -0
- package/vtex/hooks/useWishlist.ts +119 -0
- package/vtex/index.ts +14 -0
- package/vtex/inline-loaders/productDetailsPage.ts +75 -0
- package/vtex/inline-loaders/productList.ts +163 -0
- package/vtex/inline-loaders/productListingPage.ts +447 -0
- package/vtex/inline-loaders/relatedProducts.ts +83 -0
- package/vtex/inline-loaders/suggestions.ts +49 -0
- package/vtex/inline-loaders/workflowProducts.ts +68 -0
- package/vtex/invoke.ts +202 -0
- package/vtex/loaders/address.ts +120 -0
- package/vtex/loaders/brands.ts +51 -0
- package/vtex/loaders/cart.ts +49 -0
- package/vtex/loaders/catalog.ts +165 -0
- package/vtex/loaders/collections.ts +57 -0
- package/vtex/loaders/index.ts +19 -0
- package/vtex/loaders/legacy.ts +671 -0
- package/vtex/loaders/logistics.ts +115 -0
- package/vtex/loaders/navbar.ts +29 -0
- package/vtex/loaders/orders.ts +103 -0
- package/vtex/loaders/pageType.ts +62 -0
- package/vtex/loaders/payment.ts +107 -0
- package/vtex/loaders/profile.ts +138 -0
- package/vtex/loaders/promotion.ts +33 -0
- package/vtex/loaders/search.ts +127 -0
- package/vtex/loaders/session.ts +91 -0
- package/vtex/loaders/user.ts +89 -0
- package/vtex/loaders/wishlist.ts +89 -0
- package/vtex/loaders/wishlistProducts.ts +81 -0
- package/vtex/loaders/workflow.ts +323 -0
- package/vtex/logo.png +0 -0
- package/vtex/middleware.ts +229 -0
- package/vtex/types.ts +248 -0
- package/vtex/utils/batch.ts +21 -0
- package/vtex/utils/cookies.ts +76 -0
- package/vtex/utils/enrichment.ts +540 -0
- package/vtex/utils/fetchCache.ts +150 -0
- package/vtex/utils/index.ts +17 -0
- package/vtex/utils/intelligentSearch.ts +84 -0
- package/vtex/utils/legacy.ts +155 -0
- package/vtex/utils/pickAndOmit.ts +30 -0
- package/vtex/utils/proxy.ts +196 -0
- package/vtex/utils/resourceRange.ts +10 -0
- package/vtex/utils/segment.ts +163 -0
- package/vtex/utils/similars.ts +38 -0
- package/vtex/utils/sitemap.ts +133 -0
- package/vtex/utils/slugCache.ts +32 -0
- package/vtex/utils/slugify.ts +13 -0
- package/vtex/utils/transform.ts +1331 -0
- package/vtex/utils/types.ts +1884 -0
- package/vtex/utils/vtexId.ts +103 -0
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
import { gql } from "../graphql";
|
|
2
|
+
|
|
3
|
+
const ProductVariant = gql`
|
|
4
|
+
fragment ProductVariant on ProductVariant {
|
|
5
|
+
availableForSale
|
|
6
|
+
barcode
|
|
7
|
+
compareAtPrice {
|
|
8
|
+
amount
|
|
9
|
+
currencyCode
|
|
10
|
+
}
|
|
11
|
+
currentlyNotInStock
|
|
12
|
+
id
|
|
13
|
+
image {
|
|
14
|
+
altText
|
|
15
|
+
url
|
|
16
|
+
}
|
|
17
|
+
price {
|
|
18
|
+
amount
|
|
19
|
+
currencyCode
|
|
20
|
+
}
|
|
21
|
+
quantityAvailable
|
|
22
|
+
requiresShipping
|
|
23
|
+
selectedOptions {
|
|
24
|
+
name
|
|
25
|
+
value
|
|
26
|
+
}
|
|
27
|
+
sku
|
|
28
|
+
title
|
|
29
|
+
unitPrice {
|
|
30
|
+
amount
|
|
31
|
+
currencyCode
|
|
32
|
+
}
|
|
33
|
+
unitPriceMeasurement {
|
|
34
|
+
measuredType
|
|
35
|
+
quantityValue
|
|
36
|
+
referenceUnit
|
|
37
|
+
quantityUnit
|
|
38
|
+
}
|
|
39
|
+
weight
|
|
40
|
+
weightUnit
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
const Collection = gql`
|
|
45
|
+
fragment Collection on Collection {
|
|
46
|
+
description
|
|
47
|
+
descriptionHtml
|
|
48
|
+
handle
|
|
49
|
+
id
|
|
50
|
+
image {
|
|
51
|
+
altText
|
|
52
|
+
url
|
|
53
|
+
}
|
|
54
|
+
title
|
|
55
|
+
updatedAt
|
|
56
|
+
}`;
|
|
57
|
+
|
|
58
|
+
const Product = gql`
|
|
59
|
+
fragment Product on Product {
|
|
60
|
+
availableForSale
|
|
61
|
+
createdAt
|
|
62
|
+
description
|
|
63
|
+
descriptionHtml
|
|
64
|
+
featuredImage {
|
|
65
|
+
altText
|
|
66
|
+
url
|
|
67
|
+
}
|
|
68
|
+
handle
|
|
69
|
+
id
|
|
70
|
+
images(first: 10) {
|
|
71
|
+
nodes {
|
|
72
|
+
altText
|
|
73
|
+
url
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
isGiftCard
|
|
77
|
+
media(first: 10) {
|
|
78
|
+
nodes {
|
|
79
|
+
alt
|
|
80
|
+
previewImage {
|
|
81
|
+
altText
|
|
82
|
+
url
|
|
83
|
+
}
|
|
84
|
+
mediaContentType
|
|
85
|
+
... on Video {
|
|
86
|
+
alt
|
|
87
|
+
sources {
|
|
88
|
+
url
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
onlineStoreUrl
|
|
94
|
+
options {
|
|
95
|
+
name
|
|
96
|
+
values
|
|
97
|
+
}
|
|
98
|
+
priceRange {
|
|
99
|
+
minVariantPrice {
|
|
100
|
+
amount
|
|
101
|
+
currencyCode
|
|
102
|
+
}
|
|
103
|
+
maxVariantPrice {
|
|
104
|
+
amount
|
|
105
|
+
currencyCode
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
productType
|
|
109
|
+
publishedAt
|
|
110
|
+
requiresSellingPlan
|
|
111
|
+
seo {
|
|
112
|
+
title
|
|
113
|
+
description
|
|
114
|
+
}
|
|
115
|
+
tags
|
|
116
|
+
title
|
|
117
|
+
totalInventory
|
|
118
|
+
updatedAt
|
|
119
|
+
variants(first: 250) {
|
|
120
|
+
nodes {
|
|
121
|
+
...ProductVariant
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
vendor
|
|
125
|
+
collections(first: 250) {
|
|
126
|
+
nodes {
|
|
127
|
+
...Collection
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
metafields(identifiers: $identifiers) {
|
|
131
|
+
description
|
|
132
|
+
key
|
|
133
|
+
namespace
|
|
134
|
+
type
|
|
135
|
+
value
|
|
136
|
+
reference {
|
|
137
|
+
... on MediaImage {
|
|
138
|
+
image {
|
|
139
|
+
url
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
references(first: 250) {
|
|
144
|
+
edges {
|
|
145
|
+
node {
|
|
146
|
+
... on MediaImage {
|
|
147
|
+
image {
|
|
148
|
+
url
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
`;
|
|
157
|
+
|
|
158
|
+
const Filter = gql`
|
|
159
|
+
fragment Filter on Filter{
|
|
160
|
+
id
|
|
161
|
+
label
|
|
162
|
+
type
|
|
163
|
+
values {
|
|
164
|
+
count
|
|
165
|
+
id
|
|
166
|
+
input
|
|
167
|
+
label
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
`;
|
|
171
|
+
|
|
172
|
+
const Cart = gql`
|
|
173
|
+
fragment Cart on Cart {
|
|
174
|
+
id
|
|
175
|
+
checkoutUrl
|
|
176
|
+
totalQuantity
|
|
177
|
+
lines(first: 100) {
|
|
178
|
+
nodes {
|
|
179
|
+
id
|
|
180
|
+
quantity
|
|
181
|
+
merchandise {
|
|
182
|
+
...on ProductVariant {
|
|
183
|
+
id
|
|
184
|
+
title
|
|
185
|
+
image {
|
|
186
|
+
url
|
|
187
|
+
altText
|
|
188
|
+
}
|
|
189
|
+
product {
|
|
190
|
+
title
|
|
191
|
+
onlineStoreUrl
|
|
192
|
+
handle
|
|
193
|
+
}
|
|
194
|
+
price {
|
|
195
|
+
amount
|
|
196
|
+
currencyCode
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
discountAllocations {
|
|
201
|
+
...on CartCodeDiscountAllocation {
|
|
202
|
+
code
|
|
203
|
+
discountedAmount {
|
|
204
|
+
amount
|
|
205
|
+
currencyCode
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
cost {
|
|
210
|
+
totalAmount {
|
|
211
|
+
amount
|
|
212
|
+
currencyCode
|
|
213
|
+
}
|
|
214
|
+
subtotalAmount {
|
|
215
|
+
amount
|
|
216
|
+
currencyCode
|
|
217
|
+
}
|
|
218
|
+
amountPerQuantity {
|
|
219
|
+
amount
|
|
220
|
+
currencyCode
|
|
221
|
+
}
|
|
222
|
+
compareAtAmountPerQuantity {
|
|
223
|
+
amount
|
|
224
|
+
currencyCode
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
cost {
|
|
230
|
+
totalTaxAmount {
|
|
231
|
+
amount
|
|
232
|
+
currencyCode
|
|
233
|
+
}
|
|
234
|
+
subtotalAmount {
|
|
235
|
+
amount
|
|
236
|
+
currencyCode
|
|
237
|
+
}
|
|
238
|
+
totalAmount {
|
|
239
|
+
amount
|
|
240
|
+
currencyCode
|
|
241
|
+
}
|
|
242
|
+
checkoutChargeAmount {
|
|
243
|
+
amount
|
|
244
|
+
currencyCode
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
discountCodes {
|
|
248
|
+
code
|
|
249
|
+
applicable
|
|
250
|
+
}
|
|
251
|
+
discountAllocations {
|
|
252
|
+
discountedAmount {
|
|
253
|
+
amount
|
|
254
|
+
currencyCode
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}`;
|
|
258
|
+
|
|
259
|
+
const Customer = gql`
|
|
260
|
+
fragment Customer on Customer {
|
|
261
|
+
id
|
|
262
|
+
email
|
|
263
|
+
firstName
|
|
264
|
+
lastName
|
|
265
|
+
}
|
|
266
|
+
`;
|
|
267
|
+
|
|
268
|
+
export const CreateCart = {
|
|
269
|
+
query: gql`mutation CreateCart {
|
|
270
|
+
payload: cartCreate {
|
|
271
|
+
cart { id }
|
|
272
|
+
}
|
|
273
|
+
}`,
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
export const GetCart = {
|
|
277
|
+
fragments: [Cart],
|
|
278
|
+
query: gql`query GetCart($id: ID!) { cart(id: $id) { ...Cart } }`,
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
export const GetProduct = {
|
|
282
|
+
fragments: [Product, ProductVariant, Collection],
|
|
283
|
+
query:
|
|
284
|
+
gql`query GetProduct($handle: String, $identifiers: [HasMetafieldsIdentifier!]!) {
|
|
285
|
+
product(handle: $handle) { ...Product }
|
|
286
|
+
}`,
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
export const ListProducts = {
|
|
290
|
+
fragments: [Product, ProductVariant, Collection],
|
|
291
|
+
query:
|
|
292
|
+
gql`query ListProducts($first: Int, $after: String, $query: String, $identifiers: [HasMetafieldsIdentifier!]!) {
|
|
293
|
+
products(first: $first, after: $after, query: $query) {
|
|
294
|
+
nodes {
|
|
295
|
+
...Product
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}`,
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
export const SearchProducts = {
|
|
302
|
+
fragments: [Product, ProductVariant, Filter, Collection],
|
|
303
|
+
query: gql`query searchWithFilters(
|
|
304
|
+
$first: Int,
|
|
305
|
+
$last: Int,
|
|
306
|
+
$after: String,
|
|
307
|
+
$before: String,
|
|
308
|
+
$query: String!,
|
|
309
|
+
$productFilters: [ProductFilter!]
|
|
310
|
+
$sortKey: SearchSortKeys,
|
|
311
|
+
$reverse: Boolean,
|
|
312
|
+
$identifiers: [HasMetafieldsIdentifier!]!
|
|
313
|
+
){
|
|
314
|
+
search(
|
|
315
|
+
first: $first,
|
|
316
|
+
last: $last,
|
|
317
|
+
after: $after,
|
|
318
|
+
before: $before,
|
|
319
|
+
query: $query,
|
|
320
|
+
productFilters: $productFilters,
|
|
321
|
+
types: PRODUCT,
|
|
322
|
+
sortKey: $sortKey,
|
|
323
|
+
reverse: $reverse,
|
|
324
|
+
){
|
|
325
|
+
totalCount
|
|
326
|
+
pageInfo {
|
|
327
|
+
hasNextPage
|
|
328
|
+
hasPreviousPage
|
|
329
|
+
endCursor
|
|
330
|
+
startCursor
|
|
331
|
+
}
|
|
332
|
+
productFilters {
|
|
333
|
+
...Filter
|
|
334
|
+
}
|
|
335
|
+
nodes {
|
|
336
|
+
...Product
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}`,
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
export const ProductsByCollection = {
|
|
343
|
+
fragments: [Product, ProductVariant, Collection, Filter],
|
|
344
|
+
query: gql`query AllProducts(
|
|
345
|
+
$first: Int,
|
|
346
|
+
$last: Int,
|
|
347
|
+
$after: String,
|
|
348
|
+
$before: String,
|
|
349
|
+
$handle: String,
|
|
350
|
+
$sortKey: ProductCollectionSortKeys,
|
|
351
|
+
$reverse: Boolean,
|
|
352
|
+
$filters: [ProductFilter!],
|
|
353
|
+
$identifiers: [HasMetafieldsIdentifier!]!
|
|
354
|
+
){
|
|
355
|
+
collection(handle: $handle) {
|
|
356
|
+
handle
|
|
357
|
+
description
|
|
358
|
+
title
|
|
359
|
+
products(
|
|
360
|
+
first: $first,
|
|
361
|
+
last: $last,
|
|
362
|
+
after: $after,
|
|
363
|
+
before: $before,
|
|
364
|
+
sortKey: $sortKey,
|
|
365
|
+
reverse: $reverse,
|
|
366
|
+
filters: $filters
|
|
367
|
+
){
|
|
368
|
+
pageInfo {
|
|
369
|
+
hasNextPage
|
|
370
|
+
hasPreviousPage
|
|
371
|
+
endCursor
|
|
372
|
+
startCursor
|
|
373
|
+
}
|
|
374
|
+
filters {
|
|
375
|
+
...Filter
|
|
376
|
+
}
|
|
377
|
+
nodes {
|
|
378
|
+
...Product
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}`,
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
export const ProductRecommendations = {
|
|
386
|
+
fragments: [Product, ProductVariant, Collection],
|
|
387
|
+
query:
|
|
388
|
+
gql`query productRecommendations($productId: ID!, $identifiers: [HasMetafieldsIdentifier!]!) {
|
|
389
|
+
productRecommendations(productId: $productId) {
|
|
390
|
+
...Product
|
|
391
|
+
}
|
|
392
|
+
}`,
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
export const GetShopInfo = {
|
|
396
|
+
query: gql`query GetShopInfo($identifiers: [HasMetafieldsIdentifier!]!) {
|
|
397
|
+
shop {
|
|
398
|
+
name
|
|
399
|
+
description
|
|
400
|
+
privacyPolicy {
|
|
401
|
+
title
|
|
402
|
+
body
|
|
403
|
+
}
|
|
404
|
+
refundPolicy {
|
|
405
|
+
title
|
|
406
|
+
body
|
|
407
|
+
}
|
|
408
|
+
shippingPolicy {
|
|
409
|
+
title
|
|
410
|
+
body
|
|
411
|
+
}
|
|
412
|
+
subscriptionPolicy {
|
|
413
|
+
title
|
|
414
|
+
body
|
|
415
|
+
}
|
|
416
|
+
termsOfService {
|
|
417
|
+
title
|
|
418
|
+
body
|
|
419
|
+
}
|
|
420
|
+
metafields(identifiers: $identifiers) {
|
|
421
|
+
description
|
|
422
|
+
key
|
|
423
|
+
namespace
|
|
424
|
+
type
|
|
425
|
+
value
|
|
426
|
+
reference {
|
|
427
|
+
... on MediaImage {
|
|
428
|
+
image {
|
|
429
|
+
url
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
references(first: 250) {
|
|
434
|
+
edges {
|
|
435
|
+
node {
|
|
436
|
+
... on MediaImage {
|
|
437
|
+
image {
|
|
438
|
+
url
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}`,
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
export const FetchCustomerInfo = {
|
|
450
|
+
fragments: [Customer],
|
|
451
|
+
query: gql`query FetchCustomerInfo($customerAccessToken: String!) {
|
|
452
|
+
customer(customerAccessToken: $customerAccessToken) {
|
|
453
|
+
...Customer
|
|
454
|
+
}
|
|
455
|
+
}`,
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
export const AddItemToCart = {
|
|
459
|
+
fragments: [Cart],
|
|
460
|
+
query: gql`mutation AddItemToCart($cartId: ID!, $lines: [CartLineInput!]!) {
|
|
461
|
+
payload: cartLinesAdd(cartId: $cartId, lines: $lines) {
|
|
462
|
+
cart { ...Cart }
|
|
463
|
+
}
|
|
464
|
+
}`,
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
export const RegisterAccount = {
|
|
468
|
+
query: gql`mutation RegisterAccount(
|
|
469
|
+
$email: String!,
|
|
470
|
+
$password: String!,
|
|
471
|
+
$firstName: String,
|
|
472
|
+
$lastName: String,
|
|
473
|
+
$acceptsMarketing: Boolean = false
|
|
474
|
+
) {
|
|
475
|
+
customerCreate(input: {
|
|
476
|
+
email: $email,
|
|
477
|
+
password: $password,
|
|
478
|
+
firstName: $firstName,
|
|
479
|
+
lastName: $lastName,
|
|
480
|
+
acceptsMarketing: $acceptsMarketing,
|
|
481
|
+
}) {
|
|
482
|
+
customer {
|
|
483
|
+
id
|
|
484
|
+
}
|
|
485
|
+
customerUserErrors {
|
|
486
|
+
code
|
|
487
|
+
message
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}`,
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
export const AddCoupon = {
|
|
494
|
+
fragments: [Cart],
|
|
495
|
+
query: gql`mutation AddCoupon($cartId: ID!, $discountCodes: [String!]!) {
|
|
496
|
+
payload: cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
497
|
+
cart { ...Cart }
|
|
498
|
+
userErrors {
|
|
499
|
+
field
|
|
500
|
+
message
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}`,
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
export const UpdateItems = {
|
|
507
|
+
fragments: [Cart],
|
|
508
|
+
query:
|
|
509
|
+
gql`mutation UpdateItems($cartId: ID!, $lines: [CartLineUpdateInput!]!) {
|
|
510
|
+
payload: cartLinesUpdate(cartId: $cartId, lines: $lines) {
|
|
511
|
+
cart { ...Cart }
|
|
512
|
+
}
|
|
513
|
+
}`,
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
export const SignInWithEmailAndPassword = {
|
|
517
|
+
query:
|
|
518
|
+
gql`mutation SignInWithEmailAndPassword($email: String!, $password: String!) {
|
|
519
|
+
customerAccessTokenCreate(input: { email: $email, password: $password }) {
|
|
520
|
+
customerAccessToken {
|
|
521
|
+
accessToken
|
|
522
|
+
expiresAt
|
|
523
|
+
}
|
|
524
|
+
customerUserErrors {
|
|
525
|
+
code
|
|
526
|
+
message
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
}`,
|
|
530
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shopify Storefront API GraphQL type stubs.
|
|
3
|
+
* These replace the auto-generated types from the original deco-cx/apps.
|
|
4
|
+
* Types are simplified but maintain the interface contract.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Cart types
|
|
8
|
+
export type CartFragment = {
|
|
9
|
+
id: string;
|
|
10
|
+
checkoutUrl: string;
|
|
11
|
+
totalQuantity: number;
|
|
12
|
+
lines: {
|
|
13
|
+
nodes: Array<{
|
|
14
|
+
id: string;
|
|
15
|
+
quantity: number;
|
|
16
|
+
merchandise: {
|
|
17
|
+
__typename?: string;
|
|
18
|
+
id: string;
|
|
19
|
+
title: string;
|
|
20
|
+
image?: { url: string; altText?: string | null } | null;
|
|
21
|
+
product: { title: string; handle: string; onlineStoreUrl?: string | null };
|
|
22
|
+
price: { amount: string; currencyCode: string };
|
|
23
|
+
compareAtPrice?: { amount: string; currencyCode: string } | null;
|
|
24
|
+
};
|
|
25
|
+
discountAllocations?: Array<{
|
|
26
|
+
__typename?: string;
|
|
27
|
+
code?: string;
|
|
28
|
+
}>;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
cost: {
|
|
32
|
+
totalAmount: { amount: string; currencyCode: string };
|
|
33
|
+
subtotalAmount: { amount: string; currencyCode: string };
|
|
34
|
+
};
|
|
35
|
+
discountCodes?: Array<{ applicable: boolean; code: string }>;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Mutation types
|
|
39
|
+
export type AddItemToCartMutation = { cart?: CartFragment | null };
|
|
40
|
+
export type AddItemToCartMutationVariables = { cartId: string; lines: any };
|
|
41
|
+
export type UpdateItemsMutation = { cart?: CartFragment | null };
|
|
42
|
+
export type UpdateItemsMutationVariables = { cartId: string; lines: any };
|
|
43
|
+
export type AddCouponMutation = { cart?: CartFragment | null };
|
|
44
|
+
export type AddCouponMutationVariables = { cartId: string; discountCodes: string[] };
|
|
45
|
+
|
|
46
|
+
// Product types
|
|
47
|
+
export type ProductFragment = any;
|
|
48
|
+
export type ProductVariantFragment = any;
|
|
49
|
+
export type GetProductQuery = { product?: any };
|
|
50
|
+
export type GetProductQueryVariables = { handle?: string; identifiers?: any[] };
|
|
51
|
+
export type ProductRecommendationsQuery = { productRecommendations?: any[] };
|
|
52
|
+
export type ProductRecommendationsQueryVariables = { productId: string };
|
|
53
|
+
|
|
54
|
+
// Search/Collection types
|
|
55
|
+
export type InputMaybe<T> = T | null | undefined;
|
|
56
|
+
export type ProductCollectionSortKeys = string;
|
|
57
|
+
export type SearchSortKeys = string;
|
|
58
|
+
export type ProductFilter = any;
|
|
59
|
+
|
|
60
|
+
// Customer types
|
|
61
|
+
export type Customer = {
|
|
62
|
+
id: string;
|
|
63
|
+
firstName?: string | null;
|
|
64
|
+
lastName?: string | null;
|
|
65
|
+
email?: string | null;
|
|
66
|
+
phone?: string | null;
|
|
67
|
+
acceptsMarketing?: boolean;
|
|
68
|
+
defaultAddress?: any;
|
|
69
|
+
addresses?: { nodes: any[] };
|
|
70
|
+
orders?: { nodes: any[] };
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type CustomerAccessTokenCreateInput = {
|
|
74
|
+
email: string;
|
|
75
|
+
password: string;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type CustomerAccessTokenCreateWithMultipassPayload = {
|
|
79
|
+
customerAccessToken?: { accessToken: string; expiresAt: string } | null;
|
|
80
|
+
customerUserErrors?: Array<{ message: string; code?: string }>;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export type CustomerCreateInput = {
|
|
84
|
+
email: string;
|
|
85
|
+
password: string;
|
|
86
|
+
firstName?: string;
|
|
87
|
+
lastName?: string;
|
|
88
|
+
acceptsMarketing?: boolean;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export type CustomerCreatePayload = {
|
|
92
|
+
customer?: Customer | null;
|
|
93
|
+
customerUserErrors?: Array<{ message: string; code?: string }>;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// Shop types
|
|
97
|
+
export type Shop = {
|
|
98
|
+
name: string;
|
|
99
|
+
description?: string;
|
|
100
|
+
shipsToCountries?: string[];
|
|
101
|
+
refundPolicy?: { body: string; title: string; url: string };
|
|
102
|
+
privacyPolicy?: { body: string; title: string; url: string };
|
|
103
|
+
termsOfService?: { body: string; title: string; url: string };
|
|
104
|
+
metafields?: Array<{ key: string; value: string; namespace: string } | null>;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export type ShopMetafieldsArgs = {
|
|
108
|
+
identifiers: Array<{ namespace: string; key: string }>;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// Order/Admin types
|
|
112
|
+
export type CountryCode = string;
|
|
113
|
+
export type Maybe<T> = T | null;
|