@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,18 @@
1
+ import type { Money } from './types';
2
+ import { getMoneyFormat } from './client';
3
+ /** Applies a `moneyFormat` template, e.g. `"Rs. {{amount}}"`. */
4
+ export declare function applyMoneyFormat(template: string, amount: number): string;
5
+ /** Falls back to a leading currency symbol until the shop's template has loaded. */
6
+ export declare function formatMoney(money: Money | null | undefined): string;
7
+ declare function loadCountryCode(): Promise<string | null>;
8
+ /** Fetch shop-level money settings and cache them for synchronous formatting. */
9
+ export declare const shop: {
10
+ load(): Promise<{
11
+ moneyFormat: string | null;
12
+ currencyCode: string | null;
13
+ }>;
14
+ moneyFormat: typeof getMoneyFormat;
15
+ countryCode: typeof loadCountryCode;
16
+ };
17
+ export {};
18
+ //# sourceMappingURL=money.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../src/money.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAW,cAAc,EAAe,MAAM,UAAU,CAAC;AA4BhE,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAQnE;AAKD,iBAAe,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAYvD;AAED,iFAAiF;AACjF,eAAO,MAAM,IAAI;YACD,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;;;CAenF,CAAC"}
package/dist/money.js ADDED
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.shop = void 0;
4
+ exports.applyMoneyFormat = applyMoneyFormat;
5
+ exports.formatMoney = formatMoney;
6
+ const client_1 = require("./client");
7
+ const queries_1 = require("./queries");
8
+ const SYMBOLS = {
9
+ USD: '$', EUR: '€', GBP: '£', INR: '₹', JPY: '¥', CAD: '$', AUD: '$',
10
+ };
11
+ function group(intPart, sep) {
12
+ return intPart.replace(/\B(?=(\d{3})+(?!\d))/g, sep);
13
+ }
14
+ /** Renders one Liquid money placeholder, honouring Shopify's money_format tokens. */
15
+ function renderAmount(amount, token) {
16
+ const noDecimals = /no_decimals/.test(token);
17
+ const decimals = noDecimals ? 0 : 2;
18
+ const fixed = amount.toFixed(decimals);
19
+ let [int, frac] = fixed.split('.');
20
+ let thousands = ',';
21
+ let decimalSep = '.';
22
+ if (/comma_separator/.test(token)) {
23
+ thousands = '.';
24
+ decimalSep = ',';
25
+ }
26
+ else if (/apostrophe_separator/.test(token)) {
27
+ thousands = "'";
28
+ decimalSep = '.';
29
+ }
30
+ else if (/space_separator/.test(token)) {
31
+ thousands = ' ';
32
+ decimalSep = ',';
33
+ }
34
+ const grouped = group(int, thousands);
35
+ return frac ? `${grouped}${decimalSep}${frac}` : grouped;
36
+ }
37
+ /** Applies a `moneyFormat` template, e.g. `"Rs. {{amount}}"`. */
38
+ function applyMoneyFormat(template, amount) {
39
+ return template.replace(/\{\{\s*([a-z_]+)\s*\}\}/gi, (_m, token) => renderAmount(amount, token));
40
+ }
41
+ /** Falls back to a leading currency symbol until the shop's template has loaded. */
42
+ function formatMoney(money) {
43
+ var _a;
44
+ if (!money)
45
+ return '';
46
+ const num = Number(money.amount);
47
+ const template = (0, client_1.getMoneyFormat)();
48
+ if (template && !Number.isNaN(num))
49
+ return applyMoneyFormat(template, num);
50
+ const symbol = (_a = SYMBOLS[money.currencyCode]) !== null && _a !== void 0 ? _a : `${money.currencyCode} `;
51
+ if (Number.isNaN(num))
52
+ return `${symbol}${money.amount}`;
53
+ return `${symbol}${num.toFixed(2)}`;
54
+ }
55
+ /** Shop's IP-localized country (e.g. `"US"`). Fetched once on demand and
56
+ * cached — used as the fallback countryCode for gift-card apply. */
57
+ let cachedCountryCode = null;
58
+ async function loadCountryCode() {
59
+ var _a, _b, _c;
60
+ if (cachedCountryCode)
61
+ return cachedCountryCode;
62
+ try {
63
+ const data = await (0, client_1.request)(
64
+ // Inlined so this file doesn't create a queries.ts dep cycle.
65
+ `query ShopLocalization { localization { country { isoCode } } }`);
66
+ cachedCountryCode = (_c = (_b = (_a = data.localization) === null || _a === void 0 ? void 0 : _a.country) === null || _b === void 0 ? void 0 : _b.isoCode) !== null && _c !== void 0 ? _c : null;
67
+ return cachedCountryCode;
68
+ }
69
+ catch {
70
+ return null;
71
+ }
72
+ }
73
+ /** Fetch shop-level money settings and cache them for synchronous formatting. */
74
+ exports.shop = {
75
+ async load() {
76
+ var _a, _b, _c, _d, _e;
77
+ try {
78
+ const data = await (0, client_1.request)(queries_1.SHOP_QUERY);
79
+ const info = {
80
+ moneyFormat: (_b = (_a = data.shop) === null || _a === void 0 ? void 0 : _a.moneyFormat) !== null && _b !== void 0 ? _b : null,
81
+ currencyCode: (_e = (_d = (_c = data.shop) === null || _c === void 0 ? void 0 : _c.paymentSettings) === null || _d === void 0 ? void 0 : _d.currencyCode) !== null && _e !== void 0 ? _e : null,
82
+ };
83
+ (0, client_1.setShopInfo)(info);
84
+ return info;
85
+ }
86
+ catch {
87
+ return { moneyFormat: null, currencyCode: null };
88
+ }
89
+ },
90
+ moneyFormat: client_1.getMoneyFormat,
91
+ countryCode: loadCountryCode,
92
+ };
93
+ //# sourceMappingURL=money.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"money.js","sourceRoot":"","sources":["../src/money.ts"],"names":[],"mappings":";;;AA8BA,4CAEC;AAGD,kCAQC;AA1CD,qCAAgE;AAChE,uCAAuC;AAEvC,MAAM,OAAO,GAA2B;IACtC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;CACrE,CAAC;AAEF,SAAS,KAAK,CAAC,OAAe,EAAE,GAAW;IACzC,OAAO,OAAO,CAAC,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;AACvD,CAAC;AAED,qFAA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;YACnI,MAAM,IAAI,GAAG;gBACX,WAAW,EAAE,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,WAAW,mCAAI,IAAI;gBAC3C,YAAY,EAAE,MAAA,MAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,eAAe,0CAAE,YAAY,mCAAI,IAAI;aAC/D,CAAC;YACF,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;YAClB,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;QACnD,CAAC;IACH,CAAC;IACD,WAAW,EAAE,uBAAc;IAC3B,WAAW,EAAE,eAAe;CAC7B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { Product, ShopifyProductsAPI } from './types';
2
+ /** Exported so `variants.ts` decides on a play badge by the same rule. */
3
+ export declare function hasVideoContentType(mediaContentTypes: string[]): boolean;
4
+ export declare function normalizeProduct(p: any): Product;
5
+ export declare const products: ShopifyProductsAPI;
6
+ //# sourceMappingURL=products.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../src/products.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAKV,OAAO,EAGP,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAmBjB,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,EAAE,GAAG,OAAO,CAExE;AA+GD,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,CAqChD;AAED,eAAO,MAAM,QAAQ,EAAE,kBAkDtB,CAAC"}
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.products = void 0;
4
+ exports.hasVideoContentType = hasVideoContentType;
5
+ exports.normalizeProduct = normalizeProduct;
6
+ const client_1 = require("./client");
7
+ const types_1 = require("./types");
8
+ const queries_1 = require("./queries");
9
+ const VIDEO_CONTENT_TYPES = new Set(['VIDEO', 'EXTERNAL_VIDEO']);
10
+ /** Exported so `variants.ts` decides on a play badge by the same rule. */
11
+ function hasVideoContentType(mediaContentTypes) {
12
+ return mediaContentTypes.some((type) => VIDEO_CONTENT_TYPES.has(type));
13
+ }
14
+ /** Prefer the largest mp4 — HLS/DASH manifests need a streaming player. */
15
+ function pickVideoUrl(sources) {
16
+ var _a, _b;
17
+ if (!(sources === null || sources === void 0 ? void 0 : sources.length))
18
+ return null;
19
+ const mp4 = sources
20
+ .filter((source) => source.mimeType === 'video/mp4')
21
+ .sort((a, b) => b.width - a.width);
22
+ return (_b = (_a = mp4[0]) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : sources[0].url;
23
+ }
24
+ function toMediaKind(mediaContentType) {
25
+ if (mediaContentType === 'EXTERNAL_VIDEO')
26
+ return 'external-video';
27
+ if (mediaContentType === 'VIDEO')
28
+ return 'video';
29
+ if (mediaContentType === 'MODEL_3D')
30
+ return 'model-3d';
31
+ return 'image';
32
+ }
33
+ /**
34
+ * Ordered videos → images → 3D models: Shopify appends video after the images, but a
35
+ * PDP gallery leads with it. Models keep their own `kind` so a consumer that cannot
36
+ * render one doesn't show its preview still as a photo. Unresolvable URLs are dropped.
37
+ */
38
+ function toMedia(nodes) {
39
+ const videos = [];
40
+ const images = [];
41
+ const models = [];
42
+ nodes.forEach((node, index) => {
43
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
44
+ if (!node)
45
+ return;
46
+ const kind = toMediaKind(node.mediaContentType);
47
+ const item = {
48
+ id: (_a = node.id) !== null && _a !== void 0 ? _a : `${node.mediaContentType}-${index}`,
49
+ kind,
50
+ alt: (_d = (_b = node.alt) !== null && _b !== void 0 ? _b : (_c = node.image) === null || _c === void 0 ? void 0 : _c.altText) !== null && _d !== void 0 ? _d : null,
51
+ posterUrl: (_h = (_f = (_e = node.image) === null || _e === void 0 ? void 0 : _e.url) !== null && _f !== void 0 ? _f : (_g = node.previewImage) === null || _g === void 0 ? void 0 : _g.url) !== null && _h !== void 0 ? _h : null,
52
+ videoUrl: kind === 'video' ? pickVideoUrl(node.sources) : null,
53
+ embeddedUrl: kind === 'external-video' ? ((_j = node.embeddedUrl) !== null && _j !== void 0 ? _j : null) : null,
54
+ };
55
+ if (kind === 'image') {
56
+ if (item.posterUrl)
57
+ images.push(item);
58
+ return;
59
+ }
60
+ if (kind === 'model-3d') {
61
+ if (item.posterUrl)
62
+ models.push(item);
63
+ return;
64
+ }
65
+ if (item.videoUrl || item.embeddedUrl || item.posterUrl)
66
+ videos.push(item);
67
+ });
68
+ return [...videos, ...images, ...models];
69
+ }
70
+ // The `search` root sorts by `SearchSortKeys`, a much smaller set than the `ProductSortKeys`
71
+ // `list` takes. Anything else throws rather than silently returning relevance order.
72
+ const SEARCH_SORT_KEYS = new Set(['RELEVANCE', 'PRICE']);
73
+ function toSearchSortKey(sortKey) {
74
+ if (sortKey === undefined)
75
+ return undefined;
76
+ const key = sortKey.toUpperCase();
77
+ if (!SEARCH_SORT_KEYS.has(key)) {
78
+ throw new types_1.ShopifyError(`products.search cannot sort by '${sortKey}'. The Storefront search root accepts only ` +
79
+ `${[...SEARCH_SORT_KEYS].join(' or ')}; for the full ProductSortKeys set use ` +
80
+ `products.list({ query }) or collections.products().`);
81
+ }
82
+ return key;
83
+ }
84
+ async function byIds(ids, opts) {
85
+ var _a;
86
+ if (!ids.length)
87
+ return [];
88
+ // 100 keeps a batch under Shopify's per-call query cost ceiling for this fragment.
89
+ const batchSize = Math.max(1, Math.min(250, (_a = opts === null || opts === void 0 ? void 0 : opts.batchSize) !== null && _a !== void 0 ? _a : 100));
90
+ const out = [];
91
+ for (let i = 0; i < ids.length; i += batchSize) {
92
+ const chunk = ids.slice(i, i + batchSize);
93
+ const data = await (0, client_1.request)(queries_1.NODES_AS_PRODUCTS_QUERY, { ids: chunk });
94
+ const nodes = Array.isArray(data.nodes) ? data.nodes : [];
95
+ for (let j = 0; j < chunk.length; j++) {
96
+ const node = nodes[j];
97
+ // `nodes(ids:)` answers positionally, with null for anything unreadable.
98
+ if (node && node.__typename === 'Product')
99
+ out.push(normalizeProduct(node));
100
+ else if (opts === null || opts === void 0 ? void 0 : opts.keepMissing)
101
+ out.push(null);
102
+ }
103
+ }
104
+ return out;
105
+ }
106
+ function normalizeProduct(p) {
107
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
108
+ const mediaTypes = ((_b = (_a = p.media) === null || _a === void 0 ? void 0 : _a.nodes) !== null && _b !== void 0 ? _b : [])
109
+ .map((node) => node === null || node === void 0 ? void 0 : node.mediaContentType)
110
+ .filter((type) => typeof type === 'string');
111
+ return {
112
+ id: p.id,
113
+ handle: p.handle,
114
+ title: p.title,
115
+ description: p.description,
116
+ descriptionHtml: p.descriptionHtml,
117
+ vendor: p.vendor,
118
+ productType: p.productType,
119
+ tags: (_c = p.tags) !== null && _c !== void 0 ? _c : [],
120
+ totalInventory: (_d = p.totalInventory) !== null && _d !== void 0 ? _d : null,
121
+ availableForSale: p.availableForSale,
122
+ priceRange: {
123
+ min: p.priceRange.minVariantPrice,
124
+ max: p.priceRange.maxVariantPrice,
125
+ },
126
+ compareAtPriceRange: ((_e = p.compareAtPriceRange) === null || _e === void 0 ? void 0 : _e.minVariantPrice)
127
+ ? {
128
+ min: p.compareAtPriceRange.minVariantPrice,
129
+ max: p.compareAtPriceRange.maxVariantPrice,
130
+ }
131
+ : null,
132
+ options: (_f = p.options) !== null && _f !== void 0 ? _f : [],
133
+ variants: (_h = (_g = p.variants) === null || _g === void 0 ? void 0 : _g.nodes) !== null && _h !== void 0 ? _h : [],
134
+ images: (_k = (_j = p.images) === null || _j === void 0 ? void 0 : _j.nodes) !== null && _k !== void 0 ? _k : [],
135
+ featuredImage: (_l = p.featuredImage) !== null && _l !== void 0 ? _l : null,
136
+ onlineStoreUrl: (_m = p.onlineStoreUrl) !== null && _m !== void 0 ? _m : null,
137
+ mediaContentTypes: mediaTypes,
138
+ hasVideo: mediaTypes.some((type) => VIDEO_CONTENT_TYPES.has(type)),
139
+ media: toMedia((_p = (_o = p.media) === null || _o === void 0 ? void 0 : _o.nodes) !== null && _p !== void 0 ? _p : []),
140
+ updatedAt: p.updatedAt,
141
+ createdAt: p.createdAt,
142
+ };
143
+ }
144
+ exports.products = {
145
+ async list(opts) {
146
+ var _a, _b;
147
+ const data = await (0, client_1.request)(queries_1.PRODUCTS_LIST_QUERY, {
148
+ first: (_a = opts === null || opts === void 0 ? void 0 : opts.first) !== null && _a !== void 0 ? _a : 20,
149
+ after: opts === null || opts === void 0 ? void 0 : opts.after,
150
+ query: opts === null || opts === void 0 ? void 0 : opts.query,
151
+ sortKey: opts === null || opts === void 0 ? void 0 : opts.sortKey,
152
+ reverse: (_b = opts === null || opts === void 0 ? void 0 : opts.reverse) !== null && _b !== void 0 ? _b : false,
153
+ });
154
+ return {
155
+ nodes: data.products.nodes.map(normalizeProduct),
156
+ pageInfo: data.products.pageInfo,
157
+ };
158
+ },
159
+ async byHandle(handle) {
160
+ const data = await (0, client_1.request)(queries_1.PRODUCT_BY_HANDLE_QUERY, { handle });
161
+ return data.product ? normalizeProduct(data.product) : null;
162
+ },
163
+ async byId(id) {
164
+ const data = await (0, client_1.request)(queries_1.PRODUCT_BY_ID_QUERY, { id });
165
+ return data.product ? normalizeProduct(data.product) : null;
166
+ },
167
+ byIds: byIds,
168
+ async search(query, opts) {
169
+ var _a, _b, _c;
170
+ const data = await (0, client_1.request)(queries_1.SEARCH_PRODUCTS_QUERY, {
171
+ query,
172
+ first: (_a = opts === null || opts === void 0 ? void 0 : opts.first) !== null && _a !== void 0 ? _a : 20,
173
+ after: opts === null || opts === void 0 ? void 0 : opts.after,
174
+ productFilters: opts === null || opts === void 0 ? void 0 : opts.filters,
175
+ sortKey: toSearchSortKey(opts === null || opts === void 0 ? void 0 : opts.sortKey),
176
+ reverse: opts === null || opts === void 0 ? void 0 : opts.reverse,
177
+ });
178
+ return {
179
+ // `types: [PRODUCT]` still yields a union: a non-Product arrives as an empty object
180
+ // rather than being dropped, and would map to a card with no title and no price.
181
+ nodes: ((_b = data.search.nodes) !== null && _b !== void 0 ? _b : []).filter((node) => node && 'id' in node).map(normalizeProduct),
182
+ pageInfo: data.search.pageInfo,
183
+ filters: (_c = data.search.productFilters) !== null && _c !== void 0 ? _c : [],
184
+ totalCount: data.search.totalCount,
185
+ };
186
+ },
187
+ async recommended(productId) {
188
+ var _a;
189
+ const data = await (0, client_1.request)(queries_1.PRODUCT_RECOMMENDATIONS_QUERY, { productId });
190
+ return ((_a = data.productRecommendations) !== null && _a !== void 0 ? _a : []).map(normalizeProduct);
191
+ },
192
+ };
193
+ //# sourceMappingURL=products.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"products.js","sourceRoot":"","sources":["../src/products.ts"],"names":[],"mappings":";;;AAuCA,kDAEC;AA+GD,4CAqCC;AA7LD,qCAAmC;AACnC,mCAAuC;AACvC,uCAOmB;AA2BnB,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEjE,0EAA0E;AAC1E,SAAgB,mBAAmB,CAAC,iBAA2B;IAC7D,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AACzE,CAAC;AASD,2EAA2E;AAC3E,SAAS,YAAY,CAAC,OAA4C;;IAChE,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAA;QAAE,OAAO,IAAI,CAAC;IAClC,MAAM,GAAG,GAAG,OAAO;SAChB,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;SACnD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,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AC,QAAQ;YAC9B,OAAO,EAAE,MAAA,IAAI,CAAC,MAAM,CAAC,cAAc,mCAAI,EAAE;YACzC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU;SACnC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,SAAiB;;QACjC,MAAM,IAAI,GAAG,MAAM,IAAA,gBAAO,EAAiB,uCAA6B,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;QACzF,OAAO,CAAC,MAAA,IAAI,CAAC,sBAAsB,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACnE,CAAC;CACF,CAAC"}
@@ -0,0 +1,55 @@
1
+ export declare const MONEY_FRAGMENT = "\n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n";
2
+ export declare const IMAGE_FRAGMENT = "\n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n";
3
+ export declare const VARIANT_FRAGMENT = "\n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n";
4
+ /**
5
+ * For the card-only paths — collection products, search, `byIds`, recommendations. Media is
6
+ * reduced to content types, which is all a grid asks of it (the play badge), rather than every
7
+ * product in the grid carrying video sources and preview images. `ProductFields` has both.
8
+ */
9
+ export declare const PRODUCT_CARD_FRAGMENT = "\n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n fragment ProductCoreFields on Product {\n id\n handle\n title\n description\n descriptionHtml\n vendor\n productType\n tags\n totalInventory\n availableForSale\n priceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n compareAtPriceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n options { id name values }\n variants(first: 100) { nodes { ...VariantFields } }\n images(first: 20) { nodes { ...ImageFields } }\n featuredImage { ...ImageFields }\n onlineStoreUrl\n updatedAt\n createdAt\n }\n\n fragment ProductCardFields on Product {\n ...ProductCoreFields\n media(first: 250) { nodes { mediaContentType } }\n }\n";
10
+ export declare const PRODUCT_FRAGMENT = "\n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n fragment ProductCoreFields on Product {\n id\n handle\n title\n description\n descriptionHtml\n vendor\n productType\n tags\n totalInventory\n availableForSale\n priceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n compareAtPriceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n options { id name values }\n variants(first: 100) { nodes { ...VariantFields } }\n images(first: 20) { nodes { ...ImageFields } }\n featuredImage { ...ImageFields }\n onlineStoreUrl\n updatedAt\n createdAt\n }\n\n fragment ProductFields on Product {\n ...ProductCoreFields\n # Videos are appended after images, so a small window misses them entirely.\n media(first: 250) {\n nodes {\n mediaContentType\n alt\n previewImage { url }\n ... on MediaImage { id image { url altText } }\n # mimeType tells the usable mp4s from the HLS/DASH manifests Shopify also returns.\n ... on Video { id sources { url mimeType width height } }\n ... on ExternalVideo { id embeddedUrl host }\n }\n }\n }\n";
11
+ export declare const COLLECTION_FRAGMENT = "\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment CollectionFields on Collection {\n id\n handle\n title\n description\n descriptionHtml\n image { ...ImageFields }\n }\n";
12
+ export declare const CART_FRAGMENT = "\n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n }\n discountCodes { code applicable }\n appliedGiftCards {\n id\n lastCharacters\n presentmentAmountUsed { ...MoneyFields }\n balance { ...MoneyFields }\n amountUsed { ...MoneyFields }\n }\n createdAt\n updatedAt\n lines(first: 250) {\n nodes {\n id\n quantity\n attributes { key value }\n cost {\n totalAmount { ...MoneyFields }\n amountPerQuantity { ...MoneyFields }\n compareAtAmountPerQuantity { ...MoneyFields }\n }\n merchandise {\n ... on ProductVariant {\n ...VariantFields\n product { id title handle }\n }\n }\n }\n }\n }\n";
13
+ export declare const ADDRESS_FRAGMENT = "\n fragment AddressFields on MailingAddress {\n id\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n phone\n }\n";
14
+ export declare const CUSTOMER_FRAGMENT = "\n \n fragment AddressFields on MailingAddress {\n id\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n phone\n }\n\n fragment CustomerFields on Customer {\n id\n email\n firstName\n lastName\n phone\n acceptsMarketing\n defaultAddress { ...AddressFields }\n }\n";
15
+ export declare const PRODUCTS_LIST_QUERY = "\n \n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n fragment ProductCoreFields on Product {\n id\n handle\n title\n description\n descriptionHtml\n vendor\n productType\n tags\n totalInventory\n availableForSale\n priceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n compareAtPriceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n options { id name values }\n variants(first: 100) { nodes { ...VariantFields } }\n images(first: 20) { nodes { ...ImageFields } }\n featuredImage { ...ImageFields }\n onlineStoreUrl\n updatedAt\n createdAt\n }\n\n fragment ProductFields on Product {\n ...ProductCoreFields\n # Videos are appended after images, so a small window misses them entirely.\n media(first: 250) {\n nodes {\n mediaContentType\n alt\n previewImage { url }\n ... on MediaImage { id image { url altText } }\n # mimeType tells the usable mp4s from the HLS/DASH manifests Shopify also returns.\n ... on Video { id sources { url mimeType width height } }\n ... on ExternalVideo { id embeddedUrl host }\n }\n }\n }\n\n query Products($first: Int!, $after: String, $query: String, $sortKey: ProductSortKeys, $reverse: Boolean) {\n products(first: $first, after: $after, query: $query, sortKey: $sortKey, reverse: $reverse) {\n nodes { ...ProductFields }\n pageInfo { hasNextPage hasPreviousPage startCursor endCursor }\n }\n }\n";
16
+ export declare const PRODUCT_BY_HANDLE_QUERY = "\n \n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n fragment ProductCoreFields on Product {\n id\n handle\n title\n description\n descriptionHtml\n vendor\n productType\n tags\n totalInventory\n availableForSale\n priceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n compareAtPriceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n options { id name values }\n variants(first: 100) { nodes { ...VariantFields } }\n images(first: 20) { nodes { ...ImageFields } }\n featuredImage { ...ImageFields }\n onlineStoreUrl\n updatedAt\n createdAt\n }\n\n fragment ProductFields on Product {\n ...ProductCoreFields\n # Videos are appended after images, so a small window misses them entirely.\n media(first: 250) {\n nodes {\n mediaContentType\n alt\n previewImage { url }\n ... on MediaImage { id image { url altText } }\n # mimeType tells the usable mp4s from the HLS/DASH manifests Shopify also returns.\n ... on Video { id sources { url mimeType width height } }\n ... on ExternalVideo { id embeddedUrl host }\n }\n }\n }\n\n query ProductByHandle($handle: String!) {\n product(handle: $handle) { ...ProductFields }\n }\n";
17
+ export declare const PRODUCT_BY_ID_QUERY = "\n \n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n fragment ProductCoreFields on Product {\n id\n handle\n title\n description\n descriptionHtml\n vendor\n productType\n tags\n totalInventory\n availableForSale\n priceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n compareAtPriceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n options { id name values }\n variants(first: 100) { nodes { ...VariantFields } }\n images(first: 20) { nodes { ...ImageFields } }\n featuredImage { ...ImageFields }\n onlineStoreUrl\n updatedAt\n createdAt\n }\n\n fragment ProductFields on Product {\n ...ProductCoreFields\n # Videos are appended after images, so a small window misses them entirely.\n media(first: 250) {\n nodes {\n mediaContentType\n alt\n previewImage { url }\n ... on MediaImage { id image { url altText } }\n # mimeType tells the usable mp4s from the HLS/DASH manifests Shopify also returns.\n ... on Video { id sources { url mimeType width height } }\n ... on ExternalVideo { id embeddedUrl host }\n }\n }\n }\n\n query ProductById($id: ID!) {\n product(id: $id) { ...ProductFields }\n }\n";
18
+ export declare const PRODUCT_RECOMMENDATIONS_QUERY = "\n \n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n fragment ProductCoreFields on Product {\n id\n handle\n title\n description\n descriptionHtml\n vendor\n productType\n tags\n totalInventory\n availableForSale\n priceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n compareAtPriceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n options { id name values }\n variants(first: 100) { nodes { ...VariantFields } }\n images(first: 20) { nodes { ...ImageFields } }\n featuredImage { ...ImageFields }\n onlineStoreUrl\n updatedAt\n createdAt\n }\n\n fragment ProductCardFields on Product {\n ...ProductCoreFields\n media(first: 250) { nodes { mediaContentType } }\n }\n\n query Recommended($productId: ID!) {\n productRecommendations(productId: $productId) { ...ProductCardFields }\n }\n";
19
+ export declare const COLLECTIONS_LIST_QUERY = "\n \n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment CollectionFields on Collection {\n id\n handle\n title\n description\n descriptionHtml\n image { ...ImageFields }\n }\n\n query Collections($first: Int!, $after: String, $query: String, $sortKey: CollectionSortKeys, $reverse: Boolean) {\n collections(first: $first, after: $after, query: $query, sortKey: $sortKey, reverse: $reverse) {\n nodes { ...CollectionFields }\n pageInfo { hasNextPage hasPreviousPage startCursor endCursor }\n }\n }\n";
20
+ export declare const COLLECTION_BY_HANDLE_QUERY = "\n \n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment CollectionFields on Collection {\n id\n handle\n title\n description\n descriptionHtml\n image { ...ImageFields }\n }\n\n query CollectionByHandle($handle: String!) {\n collection(handle: $handle) { ...CollectionFields }\n }\n";
21
+ export declare const COLLECTION_PRODUCTS_QUERY = "\n \n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n fragment ProductCoreFields on Product {\n id\n handle\n title\n description\n descriptionHtml\n vendor\n productType\n tags\n totalInventory\n availableForSale\n priceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n compareAtPriceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n options { id name values }\n variants(first: 100) { nodes { ...VariantFields } }\n images(first: 20) { nodes { ...ImageFields } }\n featuredImage { ...ImageFields }\n onlineStoreUrl\n updatedAt\n createdAt\n }\n\n fragment ProductCardFields on Product {\n ...ProductCoreFields\n media(first: 250) { nodes { mediaContentType } }\n }\n\n query CollectionProducts($handle: String!, $first: Int!, $after: String, $sortKey: ProductCollectionSortKeys, $reverse: Boolean, $filters: [ProductFilter!]) {\n collection(handle: $handle) {\n handle\n title\n products(first: $first, after: $after, sortKey: $sortKey, reverse: $reverse, filters: $filters) {\n nodes { ...ProductCardFields }\n pageInfo { hasNextPage hasPreviousPage startCursor endCursor }\n filters {\n id\n label\n type\n values { id label count input }\n }\n }\n }\n }\n";
22
+ export declare const SEARCH_PRODUCTS_QUERY = "\n \n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n fragment ProductCoreFields on Product {\n id\n handle\n title\n description\n descriptionHtml\n vendor\n productType\n tags\n totalInventory\n availableForSale\n priceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n compareAtPriceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n options { id name values }\n variants(first: 100) { nodes { ...VariantFields } }\n images(first: 20) { nodes { ...ImageFields } }\n featuredImage { ...ImageFields }\n onlineStoreUrl\n updatedAt\n createdAt\n }\n\n fragment ProductCardFields on Product {\n ...ProductCoreFields\n media(first: 250) { nodes { mediaContentType } }\n }\n\n query SearchProducts(\n $query: String!\n $first: Int!\n $after: String\n $productFilters: [ProductFilter!]\n # SearchSortKeys, NOT ProductSortKeys \u2014 only RELEVANCE and PRICE exist here.\n $sortKey: SearchSortKeys\n $reverse: Boolean\n ) {\n search(\n query: $query\n first: $first\n after: $after\n types: [PRODUCT]\n productFilters: $productFilters\n sortKey: $sortKey\n reverse: $reverse\n ) {\n totalCount\n nodes {\n ... on Product { ...ProductCardFields }\n }\n pageInfo { hasNextPage hasPreviousPage startCursor endCursor }\n productFilters {\n id\n label\n type\n values { id label count input }\n }\n }\n }\n";
23
+ export declare const CART_CREATE_MUTATION = "\n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n }\n discountCodes { code applicable }\n appliedGiftCards {\n id\n lastCharacters\n presentmentAmountUsed { ...MoneyFields }\n balance { ...MoneyFields }\n amountUsed { ...MoneyFields }\n }\n createdAt\n updatedAt\n lines(first: 250) {\n nodes {\n id\n quantity\n attributes { key value }\n cost {\n totalAmount { ...MoneyFields }\n amountPerQuantity { ...MoneyFields }\n compareAtAmountPerQuantity { ...MoneyFields }\n }\n merchandise {\n ... on ProductVariant {\n ...VariantFields\n product { id title handle }\n }\n }\n }\n }\n }\n\n mutation CartCreate($input: CartInput) {\n cartCreate(input: $input) {\n cart { ...CartFields }\n userErrors { field message code }\n }\n }\n";
24
+ export declare const CART_GET_QUERY = "\n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n }\n discountCodes { code applicable }\n appliedGiftCards {\n id\n lastCharacters\n presentmentAmountUsed { ...MoneyFields }\n balance { ...MoneyFields }\n amountUsed { ...MoneyFields }\n }\n createdAt\n updatedAt\n lines(first: 250) {\n nodes {\n id\n quantity\n attributes { key value }\n cost {\n totalAmount { ...MoneyFields }\n amountPerQuantity { ...MoneyFields }\n compareAtAmountPerQuantity { ...MoneyFields }\n }\n merchandise {\n ... on ProductVariant {\n ...VariantFields\n product { id title handle }\n }\n }\n }\n }\n }\n\n query CartGet($id: ID!) {\n cart(id: $id) { ...CartFields }\n }\n";
25
+ export declare const CART_LINES_ADD_MUTATION = "\n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n }\n discountCodes { code applicable }\n appliedGiftCards {\n id\n lastCharacters\n presentmentAmountUsed { ...MoneyFields }\n balance { ...MoneyFields }\n amountUsed { ...MoneyFields }\n }\n createdAt\n updatedAt\n lines(first: 250) {\n nodes {\n id\n quantity\n attributes { key value }\n cost {\n totalAmount { ...MoneyFields }\n amountPerQuantity { ...MoneyFields }\n compareAtAmountPerQuantity { ...MoneyFields }\n }\n merchandise {\n ... on ProductVariant {\n ...VariantFields\n product { id title handle }\n }\n }\n }\n }\n }\n\n mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {\n cartLinesAdd(cartId: $cartId, lines: $lines) {\n cart { ...CartFields }\n userErrors { field message code }\n }\n }\n";
26
+ export declare const CART_LINES_UPDATE_MUTATION = "\n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n }\n discountCodes { code applicable }\n appliedGiftCards {\n id\n lastCharacters\n presentmentAmountUsed { ...MoneyFields }\n balance { ...MoneyFields }\n amountUsed { ...MoneyFields }\n }\n createdAt\n updatedAt\n lines(first: 250) {\n nodes {\n id\n quantity\n attributes { key value }\n cost {\n totalAmount { ...MoneyFields }\n amountPerQuantity { ...MoneyFields }\n compareAtAmountPerQuantity { ...MoneyFields }\n }\n merchandise {\n ... on ProductVariant {\n ...VariantFields\n product { id title handle }\n }\n }\n }\n }\n }\n\n mutation CartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) {\n cartLinesUpdate(cartId: $cartId, lines: $lines) {\n cart { ...CartFields }\n userErrors { field message code }\n }\n }\n";
27
+ export declare const CART_LINES_REMOVE_MUTATION = "\n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n }\n discountCodes { code applicable }\n appliedGiftCards {\n id\n lastCharacters\n presentmentAmountUsed { ...MoneyFields }\n balance { ...MoneyFields }\n amountUsed { ...MoneyFields }\n }\n createdAt\n updatedAt\n lines(first: 250) {\n nodes {\n id\n quantity\n attributes { key value }\n cost {\n totalAmount { ...MoneyFields }\n amountPerQuantity { ...MoneyFields }\n compareAtAmountPerQuantity { ...MoneyFields }\n }\n merchandise {\n ... on ProductVariant {\n ...VariantFields\n product { id title handle }\n }\n }\n }\n }\n }\n\n mutation CartLinesRemove($cartId: ID!, $lineIds: [ID!]!) {\n cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {\n cart { ...CartFields }\n userErrors { field message code }\n }\n }\n";
28
+ export declare const CART_DISCOUNT_CODES_UPDATE_MUTATION = "\n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n }\n discountCodes { code applicable }\n appliedGiftCards {\n id\n lastCharacters\n presentmentAmountUsed { ...MoneyFields }\n balance { ...MoneyFields }\n amountUsed { ...MoneyFields }\n }\n createdAt\n updatedAt\n lines(first: 250) {\n nodes {\n id\n quantity\n attributes { key value }\n cost {\n totalAmount { ...MoneyFields }\n amountPerQuantity { ...MoneyFields }\n compareAtAmountPerQuantity { ...MoneyFields }\n }\n merchandise {\n ... on ProductVariant {\n ...VariantFields\n product { id title handle }\n }\n }\n }\n }\n }\n\n mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart { ...CartFields }\n userErrors { field message code }\n }\n }\n";
29
+ export declare const CART_BUYER_IDENTITY_UPDATE_MUTATION = "\n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n }\n discountCodes { code applicable }\n appliedGiftCards {\n id\n lastCharacters\n presentmentAmountUsed { ...MoneyFields }\n balance { ...MoneyFields }\n amountUsed { ...MoneyFields }\n }\n createdAt\n updatedAt\n lines(first: 250) {\n nodes {\n id\n quantity\n attributes { key value }\n cost {\n totalAmount { ...MoneyFields }\n amountPerQuantity { ...MoneyFields }\n compareAtAmountPerQuantity { ...MoneyFields }\n }\n merchandise {\n ... on ProductVariant {\n ...VariantFields\n product { id title handle }\n }\n }\n }\n }\n }\n\n mutation CartBuyerIdentityUpdate($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {\n cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {\n cart { ...CartFields }\n userErrors { field message code }\n }\n }\n";
30
+ export declare const CART_GIFT_CARD_CODES_UPDATE_MUTATION = "\n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n }\n discountCodes { code applicable }\n appliedGiftCards {\n id\n lastCharacters\n presentmentAmountUsed { ...MoneyFields }\n balance { ...MoneyFields }\n amountUsed { ...MoneyFields }\n }\n createdAt\n updatedAt\n lines(first: 250) {\n nodes {\n id\n quantity\n attributes { key value }\n cost {\n totalAmount { ...MoneyFields }\n amountPerQuantity { ...MoneyFields }\n compareAtAmountPerQuantity { ...MoneyFields }\n }\n merchandise {\n ... on ProductVariant {\n ...VariantFields\n product { id title handle }\n }\n }\n }\n }\n }\n\n mutation CartGiftCardCodesUpdate($cartId: ID!, $giftCardCodes: [String!]!) {\n cartGiftCardCodesUpdate(cartId: $cartId, giftCardCodes: $giftCardCodes) {\n cart { ...CartFields }\n userErrors { field message code }\n }\n }\n";
31
+ export declare const CART_GIFT_CARD_CODES_REMOVE_MUTATION = "\n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n }\n discountCodes { code applicable }\n appliedGiftCards {\n id\n lastCharacters\n presentmentAmountUsed { ...MoneyFields }\n balance { ...MoneyFields }\n amountUsed { ...MoneyFields }\n }\n createdAt\n updatedAt\n lines(first: 250) {\n nodes {\n id\n quantity\n attributes { key value }\n cost {\n totalAmount { ...MoneyFields }\n amountPerQuantity { ...MoneyFields }\n compareAtAmountPerQuantity { ...MoneyFields }\n }\n merchandise {\n ... on ProductVariant {\n ...VariantFields\n product { id title handle }\n }\n }\n }\n }\n }\n\n mutation CartGiftCardCodesRemove($cartId: ID!, $appliedGiftCardIds: [ID!]!) {\n cartGiftCardCodesRemove(cartId: $cartId, appliedGiftCardIds: $appliedGiftCardIds) {\n cart { ...CartFields }\n userErrors { field message code }\n }\n }\n";
32
+ /** Shop's IP-localized country (e.g. `"US"`). We use this as the fallback
33
+ * countryCode when applying a gift card so the cart has a payment tender. */
34
+ export declare const SHOP_LOCALIZATION_QUERY = "\n query ShopLocalization {\n localization {\n country { isoCode name }\n }\n }\n";
35
+ export declare const CUSTOMER_CREATE_MUTATION = "\n \n \n fragment AddressFields on MailingAddress {\n id\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n phone\n }\n\n fragment CustomerFields on Customer {\n id\n email\n firstName\n lastName\n phone\n acceptsMarketing\n defaultAddress { ...AddressFields }\n }\n\n mutation CustomerCreate($input: CustomerCreateInput!) {\n customerCreate(input: $input) {\n customer { ...CustomerFields }\n customerUserErrors { field message code }\n }\n }\n";
36
+ export declare const CUSTOMER_ACCESS_TOKEN_CREATE_MUTATION = "\n mutation CustomerAccessTokenCreate($input: CustomerAccessTokenCreateInput!) {\n customerAccessTokenCreate(input: $input) {\n customerAccessToken { accessToken expiresAt }\n customerUserErrors { field message code }\n }\n }\n";
37
+ export declare const CUSTOMER_ACCESS_TOKEN_DELETE_MUTATION = "\n mutation CustomerAccessTokenDelete($customerAccessToken: String!) {\n customerAccessTokenDelete(customerAccessToken: $customerAccessToken) {\n deletedAccessToken\n userErrors { field message }\n }\n }\n";
38
+ export declare const CUSTOMER_QUERY = "\n \n \n fragment AddressFields on MailingAddress {\n id\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n phone\n }\n\n fragment CustomerFields on Customer {\n id\n email\n firstName\n lastName\n phone\n acceptsMarketing\n defaultAddress { ...AddressFields }\n }\n\n query Customer($accessToken: String!) {\n customer(customerAccessToken: $accessToken) { ...CustomerFields }\n }\n";
39
+ export declare const CUSTOMER_RECOVER_MUTATION = "\n mutation CustomerRecover($email: String!) {\n customerRecover(email: $email) {\n customerUserErrors { field message code }\n }\n }\n";
40
+ export declare const CUSTOMER_UPDATE_MUTATION = "\n \n \n fragment AddressFields on MailingAddress {\n id\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n phone\n }\n\n fragment CustomerFields on Customer {\n id\n email\n firstName\n lastName\n phone\n acceptsMarketing\n defaultAddress { ...AddressFields }\n }\n\n mutation CustomerUpdate($accessToken: String!, $customer: CustomerUpdateInput!) {\n customerUpdate(customerAccessToken: $accessToken, customer: $customer) {\n customer { ...CustomerFields }\n customerUserErrors { field message code }\n }\n }\n";
41
+ export declare const ORDER_FRAGMENT = "\n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n \n fragment AddressFields on MailingAddress {\n id\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n phone\n }\n\n fragment OrderFields on Order {\n id\n orderNumber\n name\n processedAt\n fulfillmentStatus\n financialStatus\n statusUrl\n currencyCode\n email\n phone\n totalPrice { ...MoneyFields }\n subtotalPrice { ...MoneyFields }\n totalShippingPrice { ...MoneyFields }\n totalTax { ...MoneyFields }\n totalRefunded { ...MoneyFields }\n shippingAddress { ...AddressFields }\n lineItems(first: 50) {\n nodes {\n title\n quantity\n originalTotalPrice { ...MoneyFields }\n discountedTotalPrice { ...MoneyFields }\n variant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n }\n }\n }\n";
42
+ export declare const CUSTOMER_ORDERS_QUERY = "\n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n \n fragment AddressFields on MailingAddress {\n id\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n phone\n }\n\n fragment OrderFields on Order {\n id\n orderNumber\n name\n processedAt\n fulfillmentStatus\n financialStatus\n statusUrl\n currencyCode\n email\n phone\n totalPrice { ...MoneyFields }\n subtotalPrice { ...MoneyFields }\n totalShippingPrice { ...MoneyFields }\n totalTax { ...MoneyFields }\n totalRefunded { ...MoneyFields }\n shippingAddress { ...AddressFields }\n lineItems(first: 50) {\n nodes {\n title\n quantity\n originalTotalPrice { ...MoneyFields }\n discountedTotalPrice { ...MoneyFields }\n variant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n }\n }\n }\n\n query CustomerOrders($accessToken: String!, $first: Int!, $after: String) {\n customer(customerAccessToken: $accessToken) {\n orders(first: $first, after: $after, sortKey: PROCESSED_AT, reverse: true) {\n nodes { ...OrderFields }\n pageInfo { hasNextPage hasPreviousPage startCursor endCursor }\n }\n }\n }\n";
43
+ export declare const CUSTOMER_ORDER_BY_ID_QUERY = "\n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n \n fragment AddressFields on MailingAddress {\n id\n firstName\n lastName\n address1\n address2\n city\n province\n country\n zip\n phone\n }\n\n fragment OrderFields on Order {\n id\n orderNumber\n name\n processedAt\n fulfillmentStatus\n financialStatus\n statusUrl\n currencyCode\n email\n phone\n totalPrice { ...MoneyFields }\n subtotalPrice { ...MoneyFields }\n totalShippingPrice { ...MoneyFields }\n totalTax { ...MoneyFields }\n totalRefunded { ...MoneyFields }\n shippingAddress { ...AddressFields }\n lineItems(first: 50) {\n nodes {\n title\n quantity\n originalTotalPrice { ...MoneyFields }\n discountedTotalPrice { ...MoneyFields }\n variant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n }\n }\n }\n\n query CustomerOrderById($accessToken: String!) {\n customer(customerAccessToken: $accessToken) {\n orders(first: 250, sortKey: PROCESSED_AT, reverse: true) {\n nodes { ...OrderFields }\n }\n }\n }\n";
44
+ export declare const BLOG_FRAGMENT = "\n fragment BlogFields on Blog {\n id\n handle\n title\n }\n";
45
+ export declare const ARTICLE_FRAGMENT = "\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n \n fragment BlogFields on Blog {\n id\n handle\n title\n }\n\n fragment ArticleFields on Article {\n id\n handle\n title\n content\n contentHtml\n excerpt\n excerptHtml\n publishedAt\n tags\n image { ...ImageFields }\n authorV2 {\n name\n email\n bio\n }\n blog { ...BlogFields }\n }\n";
46
+ export declare const BLOGS_LIST_QUERY = "\n \n fragment BlogFields on Blog {\n id\n handle\n title\n }\n\n query Blogs($first: Int!, $after: String, $query: String, $sortKey: BlogSortKeys, $reverse: Boolean) {\n blogs(first: $first, after: $after, query: $query, sortKey: $sortKey, reverse: $reverse) {\n nodes { ...BlogFields }\n pageInfo { hasNextPage hasPreviousPage startCursor endCursor }\n }\n }\n";
47
+ export declare const BLOG_BY_HANDLE_QUERY = "\n \n fragment BlogFields on Blog {\n id\n handle\n title\n }\n\n query BlogByHandle($handle: String!) {\n blog(handle: $handle) { ...BlogFields }\n }\n";
48
+ export declare const BLOG_ARTICLES_QUERY = "\n \n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n \n fragment BlogFields on Blog {\n id\n handle\n title\n }\n\n fragment ArticleFields on Article {\n id\n handle\n title\n content\n contentHtml\n excerpt\n excerptHtml\n publishedAt\n tags\n image { ...ImageFields }\n authorV2 {\n name\n email\n bio\n }\n blog { ...BlogFields }\n }\n\n query BlogArticles($handle: String!, $first: Int!, $after: String, $sortKey: ArticleSortKeys, $reverse: Boolean) {\n blog(handle: $handle) {\n articles(first: $first, after: $after, sortKey: $sortKey, reverse: $reverse) {\n nodes { ...ArticleFields }\n pageInfo { hasNextPage hasPreviousPage startCursor endCursor }\n }\n }\n }\n";
49
+ export declare const BLOG_ARTICLE_BY_HANDLE_QUERY = "\n \n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n \n fragment BlogFields on Blog {\n id\n handle\n title\n }\n\n fragment ArticleFields on Article {\n id\n handle\n title\n content\n contentHtml\n excerpt\n excerptHtml\n publishedAt\n tags\n image { ...ImageFields }\n authorV2 {\n name\n email\n bio\n }\n blog { ...BlogFields }\n }\n\n query BlogArticleByHandle($blogHandle: String!, $articleHandle: String!) {\n blog(handle: $blogHandle) {\n articleByHandle(handle: $articleHandle) { ...ArticleFields }\n }\n }\n";
50
+ /** Deleted or access-denied products come back as `null`, position-preserved. */
51
+ export declare const NODES_AS_PRODUCTS_QUERY = "\n \n \n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n fragment ProductCoreFields on Product {\n id\n handle\n title\n description\n descriptionHtml\n vendor\n productType\n tags\n totalInventory\n availableForSale\n priceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n compareAtPriceRange {\n minVariantPrice { ...MoneyFields }\n maxVariantPrice { ...MoneyFields }\n }\n options { id name values }\n variants(first: 100) { nodes { ...VariantFields } }\n images(first: 20) { nodes { ...ImageFields } }\n featuredImage { ...ImageFields }\n onlineStoreUrl\n updatedAt\n createdAt\n }\n\n fragment ProductCardFields on Product {\n ...ProductCoreFields\n media(first: 250) { nodes { mediaContentType } }\n }\n\n query WishlistNodes($ids: [ID!]!) {\n nodes(ids: $ids) {\n __typename\n ... on Product { ...ProductCardFields }\n }\n }\n";
52
+ export declare const SHOP_QUERY = "\n query ShopInfo {\n shop {\n name\n moneyFormat\n paymentSettings {\n currencyCode\n }\n }\n }\n";
53
+ /** Each variant carries enough of its parent product to render a card without a second trip. */
54
+ export declare const NODES_AS_VARIANTS_QUERY = "\n \n \n fragment MoneyFields on MoneyV2 {\n amount\n currencyCode\n }\n\n \n fragment ImageFields on Image {\n url\n altText\n width\n height\n }\n\n fragment VariantFields on ProductVariant {\n id\n title\n sku\n availableForSale\n quantityAvailable\n price { ...MoneyFields }\n compareAtPrice { ...MoneyFields }\n selectedOptions { name value }\n image { ...ImageFields }\n }\n\n query VariantNodes($ids: [ID!]!) {\n nodes(ids: $ids) {\n __typename\n ... on ProductVariant {\n ...VariantFields\n sellingPlanAllocations(first: 1) {\n nodes {\n sellingPlan { id name }\n remainingBalanceChargeAmount { ...MoneyFields }\n }\n }\n product {\n id\n title\n handle\n featuredImage { ...ImageFields }\n media(first: 250) { nodes { mediaContentType } }\n }\n }\n }\n }\n";
55
+ //# sourceMappingURL=queries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,+EAK1B,CAAC;AAEF,eAAO,MAAM,cAAc,4FAO1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,mbAc5B,CAAC;AAkCF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,6sCAMjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,8mDAiB5B,CAAC;AAEF,eAAO,MAAM,mBAAmB,uPAU/B,CAAC;AAEF,eAAO,MAAM,aAAa,85CAyCzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,oLAa5B,CAAC;AAEF,eAAO,MAAM,iBAAiB,kWAW7B,CAAC;AAIF,eAAO,MAAM,mBAAmB,27DAQ/B,CAAC;AAEF,eAAO,MAAM,uBAAuB,ytDAKnC,CAAC;AAEF,eAAO,MAAM,mBAAmB,qsDAK/B,CAAC;AAEF,eAAO,MAAM,6BAA6B,40CAKzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,glBAQlC,CAAC;AAEF,eAAO,MAAM,0BAA0B,2WAKtC,CAAC;AAEF,eAAO,MAAM,yBAAyB,yxDAkBrC,CAAC;AAEF,eAAO,MAAM,qBAAqB,u8DAiCjC,CAAC;AAEF,eAAO,MAAM,oBAAoB,okDAQhC,CAAC;AAEF,eAAO,MAAM,cAAc,2+CAK1B,CAAC;AAEF,eAAO,MAAM,uBAAuB,+mDAQnC,CAAC;AAEF,eAAO,MAAM,0BAA0B,2nDAQtC,CAAC;AAEF,eAAO,MAAM,0BAA0B,gnDAQtC,CAAC;AAEF,eAAO,MAAM,mCAAmC,qpDAQ/C,C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