@tiledev/sdk-shopify 0.2.5

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.
Files changed (84) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +269 -0
  3. package/dist/blogs.d.ts +3 -0
  4. package/dist/blogs.d.ts.map +1 -0
  5. package/dist/blogs.js +72 -0
  6. package/dist/blogs.js.map +1 -0
  7. package/dist/cart.d.ts +3 -0
  8. package/dist/cart.d.ts.map +1 -0
  9. package/dist/cart.js +96 -0
  10. package/dist/cart.js.map +1 -0
  11. package/dist/cartPolicy.d.ts +15 -0
  12. package/dist/cartPolicy.d.ts.map +1 -0
  13. package/dist/cartPolicy.js +74 -0
  14. package/dist/cartPolicy.js.map +1 -0
  15. package/dist/client.d.ts +15 -0
  16. package/dist/client.d.ts.map +1 -0
  17. package/dist/client.js +130 -0
  18. package/dist/client.js.map +1 -0
  19. package/dist/collections.d.ts +3 -0
  20. package/dist/collections.d.ts.map +1 -0
  21. package/dist/collections.js +44 -0
  22. package/dist/collections.js.map +1 -0
  23. package/dist/customer.d.ts +3 -0
  24. package/dist/customer.d.ts.map +1 -0
  25. package/dist/customer.js +124 -0
  26. package/dist/customer.js.map +1 -0
  27. package/dist/errors.d.ts +19 -0
  28. package/dist/errors.d.ts.map +1 -0
  29. package/dist/errors.js +63 -0
  30. package/dist/errors.js.map +1 -0
  31. package/dist/index.d.ts +11 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +56 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/messages.d.ts +24 -0
  36. package/dist/messages.d.ts.map +1 -0
  37. package/dist/messages.js +81 -0
  38. package/dist/messages.js.map +1 -0
  39. package/dist/money.d.ts +18 -0
  40. package/dist/money.d.ts.map +1 -0
  41. package/dist/money.js +93 -0
  42. package/dist/money.js.map +1 -0
  43. package/dist/products.d.ts +6 -0
  44. package/dist/products.d.ts.map +1 -0
  45. package/dist/products.js +193 -0
  46. package/dist/products.js.map +1 -0
  47. package/dist/queries.d.ts +55 -0
  48. package/dist/queries.d.ts.map +1 -0
  49. package/dist/queries.js +582 -0
  50. package/dist/queries.js.map +1 -0
  51. package/dist/react/ShopifyProvider.d.ts +181 -0
  52. package/dist/react/ShopifyProvider.d.ts.map +1 -0
  53. package/dist/react/ShopifyProvider.js +785 -0
  54. package/dist/react/ShopifyProvider.js.map +1 -0
  55. package/dist/react/index.d.ts +3 -0
  56. package/dist/react/index.d.ts.map +1 -0
  57. package/dist/react/index.js +14 -0
  58. package/dist/react/index.js.map +1 -0
  59. package/dist/react/useTileCredit.d.ts +34 -0
  60. package/dist/react/useTileCredit.d.ts.map +1 -0
  61. package/dist/react/useTileCredit.js +96 -0
  62. package/dist/react/useTileCredit.js.map +1 -0
  63. package/dist/shopify.d.ts +3 -0
  64. package/dist/shopify.d.ts.map +1 -0
  65. package/dist/shopify.js +54 -0
  66. package/dist/shopify.js.map +1 -0
  67. package/dist/tileCredit.d.ts +64 -0
  68. package/dist/tileCredit.d.ts.map +1 -0
  69. package/dist/tileCredit.js +274 -0
  70. package/dist/tileCredit.js.map +1 -0
  71. package/dist/types.d.ts +785 -0
  72. package/dist/types.d.ts.map +1 -0
  73. package/dist/types.js +25 -0
  74. package/dist/types.js.map +1 -0
  75. package/dist/variants.d.ts +3 -0
  76. package/dist/variants.d.ts.map +1 -0
  77. package/dist/variants.js +67 -0
  78. package/dist/variants.js.map +1 -0
  79. package/dist/wishlist.d.ts +4 -0
  80. package/dist/wishlist.d.ts.map +1 -0
  81. package/dist/wishlist.js +232 -0
  82. package/dist/wishlist.js.map +1 -0
  83. package/package.json +63 -0
  84. package/react/package.json +6 -0
@@ -0,0 +1,582 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NODES_AS_VARIANTS_QUERY = exports.SHOP_QUERY = exports.NODES_AS_PRODUCTS_QUERY = exports.BLOG_ARTICLE_BY_HANDLE_QUERY = exports.BLOG_ARTICLES_QUERY = exports.BLOG_BY_HANDLE_QUERY = exports.BLOGS_LIST_QUERY = exports.ARTICLE_FRAGMENT = exports.BLOG_FRAGMENT = exports.CUSTOMER_ORDER_BY_ID_QUERY = exports.CUSTOMER_ORDERS_QUERY = exports.ORDER_FRAGMENT = exports.CUSTOMER_UPDATE_MUTATION = exports.CUSTOMER_RECOVER_MUTATION = exports.CUSTOMER_QUERY = exports.CUSTOMER_ACCESS_TOKEN_DELETE_MUTATION = exports.CUSTOMER_ACCESS_TOKEN_CREATE_MUTATION = exports.CUSTOMER_CREATE_MUTATION = exports.SHOP_LOCALIZATION_QUERY = exports.CART_GIFT_CARD_CODES_REMOVE_MUTATION = exports.CART_GIFT_CARD_CODES_UPDATE_MUTATION = exports.CART_BUYER_IDENTITY_UPDATE_MUTATION = exports.CART_DISCOUNT_CODES_UPDATE_MUTATION = exports.CART_LINES_REMOVE_MUTATION = exports.CART_LINES_UPDATE_MUTATION = exports.CART_LINES_ADD_MUTATION = exports.CART_GET_QUERY = exports.CART_CREATE_MUTATION = exports.SEARCH_PRODUCTS_QUERY = exports.COLLECTION_PRODUCTS_QUERY = exports.COLLECTION_BY_HANDLE_QUERY = exports.COLLECTIONS_LIST_QUERY = exports.PRODUCT_RECOMMENDATIONS_QUERY = exports.PRODUCT_BY_ID_QUERY = exports.PRODUCT_BY_HANDLE_QUERY = exports.PRODUCTS_LIST_QUERY = exports.CUSTOMER_FRAGMENT = exports.ADDRESS_FRAGMENT = exports.CART_FRAGMENT = exports.COLLECTION_FRAGMENT = exports.PRODUCT_FRAGMENT = exports.PRODUCT_CARD_FRAGMENT = exports.VARIANT_FRAGMENT = exports.IMAGE_FRAGMENT = exports.MONEY_FRAGMENT = void 0;
4
+ exports.MONEY_FRAGMENT = `
5
+ fragment MoneyFields on MoneyV2 {
6
+ amount
7
+ currencyCode
8
+ }
9
+ `;
10
+ exports.IMAGE_FRAGMENT = `
11
+ fragment ImageFields on Image {
12
+ url
13
+ altText
14
+ width
15
+ height
16
+ }
17
+ `;
18
+ exports.VARIANT_FRAGMENT = `
19
+ ${exports.MONEY_FRAGMENT}
20
+ ${exports.IMAGE_FRAGMENT}
21
+ fragment VariantFields on ProductVariant {
22
+ id
23
+ title
24
+ sku
25
+ availableForSale
26
+ quantityAvailable
27
+ price { ...MoneyFields }
28
+ compareAtPrice { ...MoneyFields }
29
+ selectedOptions { name value }
30
+ image { ...ImageFields }
31
+ }
32
+ `;
33
+ /** Every product field except media, which is where the card and gallery selections diverge. */
34
+ const PRODUCT_CORE_FRAGMENT = /* GraphQL */ `
35
+ ${exports.VARIANT_FRAGMENT}
36
+ fragment ProductCoreFields on Product {
37
+ id
38
+ handle
39
+ title
40
+ description
41
+ descriptionHtml
42
+ vendor
43
+ productType
44
+ tags
45
+ totalInventory
46
+ availableForSale
47
+ priceRange {
48
+ minVariantPrice { ...MoneyFields }
49
+ maxVariantPrice { ...MoneyFields }
50
+ }
51
+ compareAtPriceRange {
52
+ minVariantPrice { ...MoneyFields }
53
+ maxVariantPrice { ...MoneyFields }
54
+ }
55
+ options { id name values }
56
+ variants(first: 100) { nodes { ...VariantFields } }
57
+ images(first: 20) { nodes { ...ImageFields } }
58
+ featuredImage { ...ImageFields }
59
+ onlineStoreUrl
60
+ updatedAt
61
+ createdAt
62
+ }
63
+ `;
64
+ /**
65
+ * For the card-only paths — collection products, search, `byIds`, recommendations. Media is
66
+ * reduced to content types, which is all a grid asks of it (the play badge), rather than every
67
+ * product in the grid carrying video sources and preview images. `ProductFields` has both.
68
+ */
69
+ exports.PRODUCT_CARD_FRAGMENT = `
70
+ ${PRODUCT_CORE_FRAGMENT}
71
+ fragment ProductCardFields on Product {
72
+ ...ProductCoreFields
73
+ media(first: 250) { nodes { mediaContentType } }
74
+ }
75
+ `;
76
+ exports.PRODUCT_FRAGMENT = `
77
+ ${PRODUCT_CORE_FRAGMENT}
78
+ fragment ProductFields on Product {
79
+ ...ProductCoreFields
80
+ # Videos are appended after images, so a small window misses them entirely.
81
+ media(first: 250) {
82
+ nodes {
83
+ mediaContentType
84
+ alt
85
+ previewImage { url }
86
+ ... on MediaImage { id image { url altText } }
87
+ # mimeType tells the usable mp4s from the HLS/DASH manifests Shopify also returns.
88
+ ... on Video { id sources { url mimeType width height } }
89
+ ... on ExternalVideo { id embeddedUrl host }
90
+ }
91
+ }
92
+ }
93
+ `;
94
+ exports.COLLECTION_FRAGMENT = `
95
+ ${exports.IMAGE_FRAGMENT}
96
+ fragment CollectionFields on Collection {
97
+ id
98
+ handle
99
+ title
100
+ description
101
+ descriptionHtml
102
+ image { ...ImageFields }
103
+ }
104
+ `;
105
+ exports.CART_FRAGMENT = `
106
+ ${exports.VARIANT_FRAGMENT}
107
+ ${exports.MONEY_FRAGMENT}
108
+ fragment CartFields on Cart {
109
+ id
110
+ checkoutUrl
111
+ totalQuantity
112
+ cost {
113
+ subtotalAmount { ...MoneyFields }
114
+ totalAmount { ...MoneyFields }
115
+ totalTaxAmount { ...MoneyFields }
116
+ }
117
+ discountCodes { code applicable }
118
+ appliedGiftCards {
119
+ id
120
+ lastCharacters
121
+ presentmentAmountUsed { ...MoneyFields }
122
+ balance { ...MoneyFields }
123
+ amountUsed { ...MoneyFields }
124
+ }
125
+ createdAt
126
+ updatedAt
127
+ lines(first: 250) {
128
+ nodes {
129
+ id
130
+ quantity
131
+ attributes { key value }
132
+ cost {
133
+ totalAmount { ...MoneyFields }
134
+ amountPerQuantity { ...MoneyFields }
135
+ compareAtAmountPerQuantity { ...MoneyFields }
136
+ }
137
+ merchandise {
138
+ ... on ProductVariant {
139
+ ...VariantFields
140
+ product { id title handle }
141
+ }
142
+ }
143
+ }
144
+ }
145
+ }
146
+ `;
147
+ exports.ADDRESS_FRAGMENT = `
148
+ fragment AddressFields on MailingAddress {
149
+ id
150
+ firstName
151
+ lastName
152
+ address1
153
+ address2
154
+ city
155
+ province
156
+ country
157
+ zip
158
+ phone
159
+ }
160
+ `;
161
+ exports.CUSTOMER_FRAGMENT = `
162
+ ${exports.ADDRESS_FRAGMENT}
163
+ fragment CustomerFields on Customer {
164
+ id
165
+ email
166
+ firstName
167
+ lastName
168
+ phone
169
+ acceptsMarketing
170
+ defaultAddress { ...AddressFields }
171
+ }
172
+ `;
173
+ // Operations
174
+ exports.PRODUCTS_LIST_QUERY = `
175
+ ${exports.PRODUCT_FRAGMENT}
176
+ query Products($first: Int!, $after: String, $query: String, $sortKey: ProductSortKeys, $reverse: Boolean) {
177
+ products(first: $first, after: $after, query: $query, sortKey: $sortKey, reverse: $reverse) {
178
+ nodes { ...ProductFields }
179
+ pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
180
+ }
181
+ }
182
+ `;
183
+ exports.PRODUCT_BY_HANDLE_QUERY = `
184
+ ${exports.PRODUCT_FRAGMENT}
185
+ query ProductByHandle($handle: String!) {
186
+ product(handle: $handle) { ...ProductFields }
187
+ }
188
+ `;
189
+ exports.PRODUCT_BY_ID_QUERY = `
190
+ ${exports.PRODUCT_FRAGMENT}
191
+ query ProductById($id: ID!) {
192
+ product(id: $id) { ...ProductFields }
193
+ }
194
+ `;
195
+ exports.PRODUCT_RECOMMENDATIONS_QUERY = `
196
+ ${exports.PRODUCT_CARD_FRAGMENT}
197
+ query Recommended($productId: ID!) {
198
+ productRecommendations(productId: $productId) { ...ProductCardFields }
199
+ }
200
+ `;
201
+ exports.COLLECTIONS_LIST_QUERY = `
202
+ ${exports.COLLECTION_FRAGMENT}
203
+ query Collections($first: Int!, $after: String, $query: String, $sortKey: CollectionSortKeys, $reverse: Boolean) {
204
+ collections(first: $first, after: $after, query: $query, sortKey: $sortKey, reverse: $reverse) {
205
+ nodes { ...CollectionFields }
206
+ pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
207
+ }
208
+ }
209
+ `;
210
+ exports.COLLECTION_BY_HANDLE_QUERY = `
211
+ ${exports.COLLECTION_FRAGMENT}
212
+ query CollectionByHandle($handle: String!) {
213
+ collection(handle: $handle) { ...CollectionFields }
214
+ }
215
+ `;
216
+ exports.COLLECTION_PRODUCTS_QUERY = `
217
+ ${exports.PRODUCT_CARD_FRAGMENT}
218
+ query CollectionProducts($handle: String!, $first: Int!, $after: String, $sortKey: ProductCollectionSortKeys, $reverse: Boolean, $filters: [ProductFilter!]) {
219
+ collection(handle: $handle) {
220
+ handle
221
+ title
222
+ products(first: $first, after: $after, sortKey: $sortKey, reverse: $reverse, filters: $filters) {
223
+ nodes { ...ProductCardFields }
224
+ pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
225
+ filters {
226
+ id
227
+ label
228
+ type
229
+ values { id label count input }
230
+ }
231
+ }
232
+ }
233
+ }
234
+ `;
235
+ exports.SEARCH_PRODUCTS_QUERY = `
236
+ ${exports.PRODUCT_CARD_FRAGMENT}
237
+ query SearchProducts(
238
+ $query: String!
239
+ $first: Int!
240
+ $after: String
241
+ $productFilters: [ProductFilter!]
242
+ # SearchSortKeys, NOT ProductSortKeys — only RELEVANCE and PRICE exist here.
243
+ $sortKey: SearchSortKeys
244
+ $reverse: Boolean
245
+ ) {
246
+ search(
247
+ query: $query
248
+ first: $first
249
+ after: $after
250
+ types: [PRODUCT]
251
+ productFilters: $productFilters
252
+ sortKey: $sortKey
253
+ reverse: $reverse
254
+ ) {
255
+ totalCount
256
+ nodes {
257
+ ... on Product { ...ProductCardFields }
258
+ }
259
+ pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
260
+ productFilters {
261
+ id
262
+ label
263
+ type
264
+ values { id label count input }
265
+ }
266
+ }
267
+ }
268
+ `;
269
+ exports.CART_CREATE_MUTATION = `
270
+ ${exports.CART_FRAGMENT}
271
+ mutation CartCreate($input: CartInput) {
272
+ cartCreate(input: $input) {
273
+ cart { ...CartFields }
274
+ userErrors { field message code }
275
+ }
276
+ }
277
+ `;
278
+ exports.CART_GET_QUERY = `
279
+ ${exports.CART_FRAGMENT}
280
+ query CartGet($id: ID!) {
281
+ cart(id: $id) { ...CartFields }
282
+ }
283
+ `;
284
+ exports.CART_LINES_ADD_MUTATION = `
285
+ ${exports.CART_FRAGMENT}
286
+ mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {
287
+ cartLinesAdd(cartId: $cartId, lines: $lines) {
288
+ cart { ...CartFields }
289
+ userErrors { field message code }
290
+ }
291
+ }
292
+ `;
293
+ exports.CART_LINES_UPDATE_MUTATION = `
294
+ ${exports.CART_FRAGMENT}
295
+ mutation CartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) {
296
+ cartLinesUpdate(cartId: $cartId, lines: $lines) {
297
+ cart { ...CartFields }
298
+ userErrors { field message code }
299
+ }
300
+ }
301
+ `;
302
+ exports.CART_LINES_REMOVE_MUTATION = `
303
+ ${exports.CART_FRAGMENT}
304
+ mutation CartLinesRemove($cartId: ID!, $lineIds: [ID!]!) {
305
+ cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {
306
+ cart { ...CartFields }
307
+ userErrors { field message code }
308
+ }
309
+ }
310
+ `;
311
+ exports.CART_DISCOUNT_CODES_UPDATE_MUTATION = `
312
+ ${exports.CART_FRAGMENT}
313
+ mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {
314
+ cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
315
+ cart { ...CartFields }
316
+ userErrors { field message code }
317
+ }
318
+ }
319
+ `;
320
+ exports.CART_BUYER_IDENTITY_UPDATE_MUTATION = `
321
+ ${exports.CART_FRAGMENT}
322
+ mutation CartBuyerIdentityUpdate($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {
323
+ cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
324
+ cart { ...CartFields }
325
+ userErrors { field message code }
326
+ }
327
+ }
328
+ `;
329
+ // Gift cards are a payment tender in Shopify (not a discount), so they stack
330
+ // past `combinesWith` rules. Apply requires `buyerIdentity.countryCode` on
331
+ // the cart — otherwise Shopify returns INVALID_PAYMENT. See tile-credit
332
+ // integration guide §5 for the full flow.
333
+ exports.CART_GIFT_CARD_CODES_UPDATE_MUTATION = `
334
+ ${exports.CART_FRAGMENT}
335
+ mutation CartGiftCardCodesUpdate($cartId: ID!, $giftCardCodes: [String!]!) {
336
+ cartGiftCardCodesUpdate(cartId: $cartId, giftCardCodes: $giftCardCodes) {
337
+ cart { ...CartFields }
338
+ userErrors { field message code }
339
+ }
340
+ }
341
+ `;
342
+ exports.CART_GIFT_CARD_CODES_REMOVE_MUTATION = `
343
+ ${exports.CART_FRAGMENT}
344
+ mutation CartGiftCardCodesRemove($cartId: ID!, $appliedGiftCardIds: [ID!]!) {
345
+ cartGiftCardCodesRemove(cartId: $cartId, appliedGiftCardIds: $appliedGiftCardIds) {
346
+ cart { ...CartFields }
347
+ userErrors { field message code }
348
+ }
349
+ }
350
+ `;
351
+ /** Shop's IP-localized country (e.g. `"US"`). We use this as the fallback
352
+ * countryCode when applying a gift card so the cart has a payment tender. */
353
+ exports.SHOP_LOCALIZATION_QUERY = `
354
+ query ShopLocalization {
355
+ localization {
356
+ country { isoCode name }
357
+ }
358
+ }
359
+ `;
360
+ exports.CUSTOMER_CREATE_MUTATION = `
361
+ ${exports.CUSTOMER_FRAGMENT}
362
+ mutation CustomerCreate($input: CustomerCreateInput!) {
363
+ customerCreate(input: $input) {
364
+ customer { ...CustomerFields }
365
+ customerUserErrors { field message code }
366
+ }
367
+ }
368
+ `;
369
+ exports.CUSTOMER_ACCESS_TOKEN_CREATE_MUTATION = `
370
+ mutation CustomerAccessTokenCreate($input: CustomerAccessTokenCreateInput!) {
371
+ customerAccessTokenCreate(input: $input) {
372
+ customerAccessToken { accessToken expiresAt }
373
+ customerUserErrors { field message code }
374
+ }
375
+ }
376
+ `;
377
+ exports.CUSTOMER_ACCESS_TOKEN_DELETE_MUTATION = `
378
+ mutation CustomerAccessTokenDelete($customerAccessToken: String!) {
379
+ customerAccessTokenDelete(customerAccessToken: $customerAccessToken) {
380
+ deletedAccessToken
381
+ userErrors { field message }
382
+ }
383
+ }
384
+ `;
385
+ exports.CUSTOMER_QUERY = `
386
+ ${exports.CUSTOMER_FRAGMENT}
387
+ query Customer($accessToken: String!) {
388
+ customer(customerAccessToken: $accessToken) { ...CustomerFields }
389
+ }
390
+ `;
391
+ exports.CUSTOMER_RECOVER_MUTATION = `
392
+ mutation CustomerRecover($email: String!) {
393
+ customerRecover(email: $email) {
394
+ customerUserErrors { field message code }
395
+ }
396
+ }
397
+ `;
398
+ exports.CUSTOMER_UPDATE_MUTATION = `
399
+ ${exports.CUSTOMER_FRAGMENT}
400
+ mutation CustomerUpdate($accessToken: String!, $customer: CustomerUpdateInput!) {
401
+ customerUpdate(customerAccessToken: $accessToken, customer: $customer) {
402
+ customer { ...CustomerFields }
403
+ customerUserErrors { field message code }
404
+ }
405
+ }
406
+ `;
407
+ // Orders
408
+ exports.ORDER_FRAGMENT = `
409
+ ${exports.MONEY_FRAGMENT}
410
+ ${exports.IMAGE_FRAGMENT}
411
+ ${exports.ADDRESS_FRAGMENT}
412
+ fragment OrderFields on Order {
413
+ id
414
+ orderNumber
415
+ name
416
+ processedAt
417
+ fulfillmentStatus
418
+ financialStatus
419
+ statusUrl
420
+ currencyCode
421
+ email
422
+ phone
423
+ totalPrice { ...MoneyFields }
424
+ subtotalPrice { ...MoneyFields }
425
+ totalShippingPrice { ...MoneyFields }
426
+ totalTax { ...MoneyFields }
427
+ totalRefunded { ...MoneyFields }
428
+ shippingAddress { ...AddressFields }
429
+ lineItems(first: 50) {
430
+ nodes {
431
+ title
432
+ quantity
433
+ originalTotalPrice { ...MoneyFields }
434
+ discountedTotalPrice { ...MoneyFields }
435
+ variant {
436
+ id
437
+ title
438
+ sku
439
+ availableForSale
440
+ quantityAvailable
441
+ price { ...MoneyFields }
442
+ compareAtPrice { ...MoneyFields }
443
+ selectedOptions { name value }
444
+ image { ...ImageFields }
445
+ }
446
+ }
447
+ }
448
+ }
449
+ `;
450
+ exports.CUSTOMER_ORDERS_QUERY = `
451
+ ${exports.ORDER_FRAGMENT}
452
+ query CustomerOrders($accessToken: String!, $first: Int!, $after: String) {
453
+ customer(customerAccessToken: $accessToken) {
454
+ orders(first: $first, after: $after, sortKey: PROCESSED_AT, reverse: true) {
455
+ nodes { ...OrderFields }
456
+ pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
457
+ }
458
+ }
459
+ }
460
+ `;
461
+ exports.CUSTOMER_ORDER_BY_ID_QUERY = `
462
+ ${exports.ORDER_FRAGMENT}
463
+ query CustomerOrderById($accessToken: String!) {
464
+ customer(customerAccessToken: $accessToken) {
465
+ orders(first: 250, sortKey: PROCESSED_AT, reverse: true) {
466
+ nodes { ...OrderFields }
467
+ }
468
+ }
469
+ }
470
+ `;
471
+ // Blogs / Articles
472
+ exports.BLOG_FRAGMENT = `
473
+ fragment BlogFields on Blog {
474
+ id
475
+ handle
476
+ title
477
+ }
478
+ `;
479
+ exports.ARTICLE_FRAGMENT = `
480
+ ${exports.IMAGE_FRAGMENT}
481
+ ${exports.BLOG_FRAGMENT}
482
+ fragment ArticleFields on Article {
483
+ id
484
+ handle
485
+ title
486
+ content
487
+ contentHtml
488
+ excerpt
489
+ excerptHtml
490
+ publishedAt
491
+ tags
492
+ image { ...ImageFields }
493
+ authorV2 {
494
+ name
495
+ email
496
+ bio
497
+ }
498
+ blog { ...BlogFields }
499
+ }
500
+ `;
501
+ exports.BLOGS_LIST_QUERY = `
502
+ ${exports.BLOG_FRAGMENT}
503
+ query Blogs($first: Int!, $after: String, $query: String, $sortKey: BlogSortKeys, $reverse: Boolean) {
504
+ blogs(first: $first, after: $after, query: $query, sortKey: $sortKey, reverse: $reverse) {
505
+ nodes { ...BlogFields }
506
+ pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
507
+ }
508
+ }
509
+ `;
510
+ exports.BLOG_BY_HANDLE_QUERY = `
511
+ ${exports.BLOG_FRAGMENT}
512
+ query BlogByHandle($handle: String!) {
513
+ blog(handle: $handle) { ...BlogFields }
514
+ }
515
+ `;
516
+ exports.BLOG_ARTICLES_QUERY = `
517
+ ${exports.ARTICLE_FRAGMENT}
518
+ query BlogArticles($handle: String!, $first: Int!, $after: String, $sortKey: ArticleSortKeys, $reverse: Boolean) {
519
+ blog(handle: $handle) {
520
+ articles(first: $first, after: $after, sortKey: $sortKey, reverse: $reverse) {
521
+ nodes { ...ArticleFields }
522
+ pageInfo { hasNextPage hasPreviousPage startCursor endCursor }
523
+ }
524
+ }
525
+ }
526
+ `;
527
+ exports.BLOG_ARTICLE_BY_HANDLE_QUERY = `
528
+ ${exports.ARTICLE_FRAGMENT}
529
+ query BlogArticleByHandle($blogHandle: String!, $articleHandle: String!) {
530
+ blog(handle: $blogHandle) {
531
+ articleByHandle(handle: $articleHandle) { ...ArticleFields }
532
+ }
533
+ }
534
+ `;
535
+ // Wishlist — batch product hydration by ID
536
+ /** Deleted or access-denied products come back as `null`, position-preserved. */
537
+ exports.NODES_AS_PRODUCTS_QUERY = `
538
+ ${exports.PRODUCT_CARD_FRAGMENT}
539
+ query WishlistNodes($ids: [ID!]!) {
540
+ nodes(ids: $ids) {
541
+ __typename
542
+ ... on Product { ...ProductCardFields }
543
+ }
544
+ }
545
+ `;
546
+ exports.SHOP_QUERY = `
547
+ query ShopInfo {
548
+ shop {
549
+ name
550
+ moneyFormat
551
+ paymentSettings {
552
+ currencyCode
553
+ }
554
+ }
555
+ }
556
+ `;
557
+ /** Each variant carries enough of its parent product to render a card without a second trip. */
558
+ exports.NODES_AS_VARIANTS_QUERY = `
559
+ ${exports.VARIANT_FRAGMENT}
560
+ query VariantNodes($ids: [ID!]!) {
561
+ nodes(ids: $ids) {
562
+ __typename
563
+ ... on ProductVariant {
564
+ ...VariantFields
565
+ sellingPlanAllocations(first: 1) {
566
+ nodes {
567
+ sellingPlan { id name }
568
+ remainingBalanceChargeAmount { ...MoneyFields }
569
+ }
570
+ }
571
+ product {
572
+ id
573
+ title
574
+ handle
575
+ featuredImage { ...ImageFields }
576
+ media(first: 250) { nodes { mediaContentType } }
577
+ }
578
+ }
579
+ }
580
+ }
581
+ `;
582
+ //# sourceMappingURL=queries.js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