@tiledev/sdk-shopify 0.2.5 → 0.2.7
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/README.md +7 -7
- package/dist/cart.d.ts.map +1 -1
- package/dist/cart.js +25 -4
- package/dist/cart.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +44 -1
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/money.d.ts +10 -1
- package/dist/money.d.ts.map +1 -1
- package/dist/money.js +24 -4
- package/dist/money.js.map +1 -1
- package/dist/queries.d.ts +20 -10
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +22 -1
- package/dist/queries.js.map +1 -1
- package/dist/react/ShopifyProvider.d.ts +7 -0
- package/dist/react/ShopifyProvider.d.ts.map +1 -1
- package/dist/react/ShopifyProvider.js +58 -3
- package/dist/react/ShopifyProvider.js.map +1 -1
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +4 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/useCollectionProducts.d.ts +43 -0
- package/dist/react/useCollectionProducts.d.ts.map +1 -0
- package/dist/react/useCollectionProducts.js +151 -0
- package/dist/react/useCollectionProducts.js.map +1 -0
- package/dist/types.d.ts +28 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @tiledev/sdk-shopify
|
|
2
2
|
|
|
3
3
|
Type-safe Shopify Storefront API client. Zero deps beyond `fetch`.
|
|
4
4
|
|
|
@@ -7,13 +7,13 @@ Works in any JavaScript runtime — Node, browsers, React Native, Cloudflare Wor
|
|
|
7
7
|
Optional React helpers (provider + hooks) ship under a subpath so you only pay for `react` if you use them.
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npm i @
|
|
10
|
+
npm i @tiledev/sdk-shopify
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Pure SDK (framework-agnostic)
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
|
-
import { shopify } from '@
|
|
16
|
+
import { shopify } from '@tiledev/sdk-shopify';
|
|
17
17
|
|
|
18
18
|
await shopify.init({
|
|
19
19
|
storeDomain: 'my-store.myshopify.com',
|
|
@@ -80,7 +80,7 @@ shopify.wishlist.onChange(items => …); // subscribe
|
|
|
80
80
|
## Optional React helper
|
|
81
81
|
|
|
82
82
|
```ts
|
|
83
|
-
import { ShopifyProvider, useShopify, useCart, useWishlist } from '@
|
|
83
|
+
import { ShopifyProvider, useShopify, useCart, useWishlist } from '@tiledev/sdk-shopify/react';
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
Wrap your app once — one provider gives you SDK readiness + cart state + wishlist state:
|
|
@@ -203,7 +203,7 @@ const { reportOrderPlaced, reportPaymentFailed } = useCheckout();
|
|
|
203
203
|
Customer wallet + gift-card mint + one-shot apply to a Shopify cart.
|
|
204
204
|
|
|
205
205
|
```ts
|
|
206
|
-
import {shopify, centsToMoney} from '@
|
|
206
|
+
import {shopify, centsToMoney} from '@tiledev/sdk-shopify';
|
|
207
207
|
|
|
208
208
|
// Configure once per signed-in customer (rebuild on logout / new customer).
|
|
209
209
|
shopify.tileCredit.configure({
|
|
@@ -226,7 +226,7 @@ const {redeemed, cart} = await shopify.tileCredit.redeemAndApplyToCart({
|
|
|
226
226
|
React hook:
|
|
227
227
|
|
|
228
228
|
```tsx
|
|
229
|
-
import {useTileCredit} from '@
|
|
229
|
+
import {useTileCredit} from '@tiledev/sdk-shopify/react';
|
|
230
230
|
|
|
231
231
|
function WalletScreen() {
|
|
232
232
|
const {wallet, config, redeemAndApply, refresh, loading, error} = useTileCredit({
|
|
@@ -261,7 +261,7 @@ import type {
|
|
|
261
261
|
TileCreditRedeemInput, TileCreditRedeemResult,
|
|
262
262
|
TileCreditError, TileCreditErrorCode,
|
|
263
263
|
AppliedGiftCard,
|
|
264
|
-
} from '@
|
|
264
|
+
} from '@tiledev/sdk-shopify';
|
|
265
265
|
```
|
|
266
266
|
|
|
267
267
|
## License
|
package/dist/cart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../src/cart.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../src/cart.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAIV,cAAc,EAEf,MAAM,SAAS,CAAC;AA0CjB,eAAO,MAAM,IAAI,EAAE,cAuFlB,CAAC"}
|
package/dist/cart.js
CHANGED
|
@@ -4,12 +4,20 @@ exports.cart = void 0;
|
|
|
4
4
|
const client_1 = require("./client");
|
|
5
5
|
const queries_1 = require("./queries");
|
|
6
6
|
function normalize(c) {
|
|
7
|
-
var _a, _b, _c, _d;
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
8
8
|
return {
|
|
9
9
|
id: c.id,
|
|
10
10
|
checkoutUrl: c.checkoutUrl,
|
|
11
11
|
totalQuantity: c.totalQuantity,
|
|
12
|
-
|
|
12
|
+
// Shopify reports "no note" as an empty string; collapsed to null so callers have one falsy
|
|
13
|
+
// value to test rather than two.
|
|
14
|
+
note: c.note ? c.note : null,
|
|
15
|
+
buyerIdentity: {
|
|
16
|
+
countryCode: (_b = (_a = c.buyerIdentity) === null || _a === void 0 ? void 0 : _a.countryCode) !== null && _b !== void 0 ? _b : null,
|
|
17
|
+
email: (_d = (_c = c.buyerIdentity) === null || _c === void 0 ? void 0 : _c.email) !== null && _d !== void 0 ? _d : null,
|
|
18
|
+
phone: (_f = (_e = c.buyerIdentity) === null || _e === void 0 ? void 0 : _e.phone) !== null && _f !== void 0 ? _f : null,
|
|
19
|
+
},
|
|
20
|
+
lines: ((_h = (_g = c.lines) === null || _g === void 0 ? void 0 : _g.nodes) !== null && _h !== void 0 ? _h : []).map((line) => {
|
|
13
21
|
var _a, _b, _c;
|
|
14
22
|
return ({
|
|
15
23
|
id: line.id,
|
|
@@ -21,8 +29,8 @@ function normalize(c) {
|
|
|
21
29
|
});
|
|
22
30
|
}),
|
|
23
31
|
cost: c.cost,
|
|
24
|
-
discountCodes: (
|
|
25
|
-
appliedGiftCards: (
|
|
32
|
+
discountCodes: (_j = c.discountCodes) !== null && _j !== void 0 ? _j : [],
|
|
33
|
+
appliedGiftCards: (_k = c.appliedGiftCards) !== null && _k !== void 0 ? _k : [],
|
|
26
34
|
createdAt: c.createdAt,
|
|
27
35
|
updatedAt: c.updatedAt,
|
|
28
36
|
};
|
|
@@ -84,6 +92,19 @@ exports.cart = {
|
|
|
84
92
|
(0, client_1.assertNoUserErrors)('cartGiftCardCodesUpdate', data.cartGiftCardCodesUpdate.userErrors);
|
|
85
93
|
return normalize(data.cartGiftCardCodesUpdate.cart);
|
|
86
94
|
},
|
|
95
|
+
/**
|
|
96
|
+
* The shopper's order note — the free-text box on the cart, read by the merchant on the order.
|
|
97
|
+
*
|
|
98
|
+
* Its own mutation rather than a cart attribute: attributes are key/value metadata for the app's
|
|
99
|
+
* own bookkeeping (Cart Hold's expiry stamp is one), while the note is content the shopper wrote.
|
|
100
|
+
*/
|
|
101
|
+
async updateNote(cartId, note) {
|
|
102
|
+
// `?? ''` is load-bearing: the argument is `String!`, so a null variable fails the whole
|
|
103
|
+
// mutation rather than clearing the note.
|
|
104
|
+
const data = await (0, client_1.request)(queries_1.CART_NOTE_UPDATE_MUTATION, { cartId, note: note !== null && note !== void 0 ? note : '' });
|
|
105
|
+
(0, client_1.assertNoUserErrors)('cartNoteUpdate', data.cartNoteUpdate.userErrors);
|
|
106
|
+
return normalize(data.cartNoteUpdate.cart);
|
|
107
|
+
},
|
|
87
108
|
async removeGiftCardCodes(cartId, appliedGiftCardIds) {
|
|
88
109
|
const data = await (0, client_1.request)(queries_1.CART_GIFT_CARD_CODES_REMOVE_MUTATION, {
|
|
89
110
|
cartId,
|
package/dist/cart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.js","sourceRoot":"","sources":["../src/cart.ts"],"names":[],"mappings":";;;AAAA,qCAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"cart.js","sourceRoot":"","sources":["../src/cart.ts"],"names":[],"mappings":";;;AAAA,qCAAuD;AACvD,uCAWmB;AAoBnB,SAAS,SAAS,CAAC,CAAM;;IACvB,OAAO;QACL,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,aAAa,EAAE,CAAC,CAAC,aAAa;QAC9B,4FAA4F;QAC5F,iCAAiC;QACjC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;QAC5B,aAAa,EAAE;YACb,WAAW,EAAE,MAAA,MAAA,CAAC,CAAC,aAAa,0CAAE,WAAW,mCAAI,IAAI;YACjD,KAAK,EAAE,MAAA,MAAA,CAAC,CAAC,aAAa,0CAAE,KAAK,mCAAI,IAAI;YACrC,KAAK,EAAE,MAAA,MAAA,CAAC,CAAC,aAAa,0CAAE,KAAK,mCAAI,IAAI;SACtC;QACD,KAAK,EAAE,CAAC,MAAA,MAAA,CAAC,CAAC,KAAK,0CAAE,KAAK,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE;;YAAC,OAAA,CAAC;gBAChD,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,UAAU,EAAE,MAAA,IAAI,CAAC,UAAU,mCAAI,EAAE;gBACjC,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,OAAO,EAAE,MAAA,MAAA,IAAI,CAAC,WAAW,0CAAE,OAAO,mCAAI,IA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AAkB;SACnB,CAAC,CAAC;QACH,IAAA,2BAAkB,EAAC,yBAAyB,EAAE,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;QACvF,OAAO,SAAS,CAAC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;CACF,CAAC"}
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgB,SAAS,EAAE,MAAM,SAAS,CAAC;AAWjE,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAGrG;AAED,0CAA0C;AAC1C,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAE9C;AAED,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AAID,wBAAgB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAIrD;AAED,wBAAgB,SAAS,IAAI,aAAa,CAGzC;AAED,wBAAgB,YAAY,IAAI,OAAO,CAEtC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgB,SAAS,EAAE,MAAM,SAAS,CAAC;AAWjE,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,CAGrG;AAED,0CAA0C;AAC1C,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAE9C;AAED,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAE/C;AAID,wBAAgB,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAIrD;AAED,wBAAgB,SAAS,IAAI,aAAa,CAGzC;AAED,wBAAgB,YAAY,IAAI,OAAO,CAEtC;AAyGD,wBAAsB,OAAO,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAgCnG;AAED,gEAAgE;AAChE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAO9F"}
|
package/dist/client.js
CHANGED
|
@@ -91,9 +91,52 @@ function deduplicateFragments(operation) {
|
|
|
91
91
|
}
|
|
92
92
|
return result;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Applies the configured market to every operation via `@inContext`.
|
|
96
|
+
*
|
|
97
|
+
* Without it Shopify localizes by the **buyer's IP**, so `config.country` — documented as "for
|
|
98
|
+
* IP-localized prices" and set by every app — reached the API nowhere. The visible symptom is a cart
|
|
99
|
+
* in the shopper's local currency while the catalogue is in the shop's: a $149 product became a
|
|
100
|
+
* `14600.0 INR` cart line, rendered `$14,600.00` because the shop's money format is a dollar
|
|
101
|
+
* template. Prices, carts and checkout have to agree on one market, and this is the only place all
|
|
102
|
+
* three pass through.
|
|
103
|
+
*
|
|
104
|
+
* Injected here rather than written into each document so a new query cannot forget it.
|
|
105
|
+
*
|
|
106
|
+
* Three shapes have to be handled: a named operation (`query Foo($x: ID!) {`), an anonymous one
|
|
107
|
+
* (`query {`), and shorthand (`{ cart(...) }`), which becomes `query @inContext(...) { … }`. A
|
|
108
|
+
* `fragment` must never be touched — directives are not valid there, and the documents in this SDK
|
|
109
|
+
* lead with their fragments.
|
|
110
|
+
*/
|
|
111
|
+
function withContext(operation) {
|
|
112
|
+
const c = getConfig();
|
|
113
|
+
const country = (c.country || '').trim().toUpperCase();
|
|
114
|
+
const language = (c.language || '').trim().toUpperCase();
|
|
115
|
+
if (!country && !language)
|
|
116
|
+
return operation;
|
|
117
|
+
// Already carries one — a caller that set its own market wins.
|
|
118
|
+
if (/@inContext\b/.test(operation))
|
|
119
|
+
return operation;
|
|
120
|
+
const args = [
|
|
121
|
+
country ? `country: ${country}` : null,
|
|
122
|
+
language ? `language: ${language}` : null,
|
|
123
|
+
].filter(Boolean).join(', ');
|
|
124
|
+
const directive = `@inContext(${args})`;
|
|
125
|
+
// The operation definition, skipping any leading fragments.
|
|
126
|
+
const opMatch = operation.match(/(^|\n)[ \t]*(query|mutation)\b[ \t]*([A-Za-z_][A-Za-z0-9_]*)?[ \t]*(\([\s\S]*?\))?/);
|
|
127
|
+
if (opMatch) {
|
|
128
|
+
const insertAt = opMatch.index + opMatch[0].length;
|
|
129
|
+
return `${operation.slice(0, insertAt)} ${directive}${operation.slice(insertAt)}`;
|
|
130
|
+
}
|
|
131
|
+
// Shorthand: no keyword at all, so give it one.
|
|
132
|
+
const braceAt = operation.indexOf('{');
|
|
133
|
+
if (braceAt === -1)
|
|
134
|
+
return operation;
|
|
135
|
+
return `${operation.slice(0, braceAt)}query ${directive} ${operation.slice(braceAt)}`;
|
|
136
|
+
}
|
|
94
137
|
async function request(operation, variables) {
|
|
95
138
|
const c = getConfig();
|
|
96
|
-
const query = deduplicateFragments(operation);
|
|
139
|
+
const query = withContext(deduplicateFragments(operation));
|
|
97
140
|
const res = await fetch(endpoint(), {
|
|
98
141
|
method: 'POST',
|
|
99
142
|
headers: {
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;AAWA,kCAGC;AAGD,wCAEC;AAED,0CAEC;AAID,8BAIC;AAED,8BAGC;AAED,oCAEC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;AAWA,kCAGC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;QAChC,MAAM,IAAI,oBAAY,CACpB,GAAG,KAAK,YAAY,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAC7D,MAAM,CACP,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export { classifyAuthFailure, isOutOfStockError, isUserErrorRejection, userError
|
|
|
7
7
|
export { TileCreditClient, configureTileCredit, getTileCreditClient, redeemAndApplyToCart, centsToMoney, moneyToCents, } from './tileCredit';
|
|
8
8
|
export { TileCreditError } from './types';
|
|
9
9
|
export type * from './types';
|
|
10
|
-
export { ShopifyProvider, useShopify, useCart, useWishlist, useCustomer, useCheckout, useShopifyMessage, useTileCredit, type ShopifyProviderProps, type ShopifyEvent, type ShopifyEventType, type CartState, type WishlistState, type CustomerState, type CheckoutState, type UseTileCreditOptions, type UseTileCreditState, } from './react';
|
|
10
|
+
export { ShopifyProvider, useShopify, useCart, useWishlist, useCustomer, useCheckout, useShopifyMessage, useTileCredit, useCollectionProducts, COLLECTION_PAGE_SIZE, type ShopifyProviderProps, type ShopifyEvent, type ShopifyEventType, type CartState, type WishlistState, type CustomerState, type CheckoutState, type UseTileCreditOptions, type UseTileCreditState, type CollectionSort, type UseCollectionProductsOptions, type CollectionProductsState, type UseCollectionProductsResult, } from './react';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EACL,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,aAAa,EACb,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,YAAY,GACb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,mBAAmB,SAAS,CAAC;AAO7B,OAAO,EACL,eAAe,EACf,UAAU,EACV,OAAO,EACP,WAAW,EACX,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3D,OAAO,EACL,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,aAAa,EACb,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,YAAY,GACb,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,mBAAmB,SAAS,CAAC;AAO7B,OAAO,EACL,eAAe,EACf,UAAU,EACV,OAAO,EACP,WAAW,EACX,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,4BAA4B,EACjC,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,GACjC,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useTileCredit = exports.useShopifyMessage = exports.useCheckout = exports.useCustomer = exports.useWishlist = exports.useCart = exports.useShopify = exports.ShopifyProvider = exports.TileCreditError = exports.moneyToCents = exports.centsToMoney = exports.redeemAndApplyToCart = exports.getTileCreditClient = exports.configureTileCredit = exports.TileCreditClient = exports.userErrorsOf = exports.isUserErrorRejection = exports.isOutOfStockError = exports.classifyAuthFailure = exports.wouldExceedLineLimit = exports.projectedLineCount = exports.maxLineItems = exports.getCartPolicy = exports.setCartPolicy = exports.limitExceededMessage = exports.setMessageResolver = exports.patchMessages = exports.setMessages = exports.getMessages = exports.message = exports.DEFAULT_MESSAGES = exports.getCurrencyCode = exports.getMoneyFormat = exports.shop = exports.applyMoneyFormat = exports.formatMoney = exports.default = exports.shopify = void 0;
|
|
3
|
+
exports.COLLECTION_PAGE_SIZE = exports.useCollectionProducts = exports.useTileCredit = exports.useShopifyMessage = exports.useCheckout = exports.useCustomer = exports.useWishlist = exports.useCart = exports.useShopify = exports.ShopifyProvider = exports.TileCreditError = exports.moneyToCents = exports.centsToMoney = exports.redeemAndApplyToCart = exports.getTileCreditClient = exports.configureTileCredit = exports.TileCreditClient = exports.userErrorsOf = exports.isUserErrorRejection = exports.isOutOfStockError = exports.classifyAuthFailure = exports.wouldExceedLineLimit = exports.projectedLineCount = exports.maxLineItems = exports.getCartPolicy = exports.setCartPolicy = exports.limitExceededMessage = exports.setMessageResolver = exports.patchMessages = exports.setMessages = exports.getMessages = exports.message = exports.DEFAULT_MESSAGES = exports.getCurrencyCode = exports.getMoneyFormat = exports.shop = exports.applyMoneyFormat = exports.formatMoney = exports.default = exports.shopify = void 0;
|
|
4
4
|
var shopify_1 = require("./shopify");
|
|
5
5
|
Object.defineProperty(exports, "shopify", { enumerable: true, get: function () { return shopify_1.shopify; } });
|
|
6
6
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return shopify_1.shopify; } });
|
|
@@ -40,10 +40,10 @@ Object.defineProperty(exports, "moneyToCents", { enumerable: true, get: function
|
|
|
40
40
|
var types_1 = require("./types");
|
|
41
41
|
Object.defineProperty(exports, "TileCreditError", { enumerable: true, get: function () { return types_1.TileCreditError; } });
|
|
42
42
|
// React helpers re-exported from the ROOT entry so consumers can write
|
|
43
|
-
// import { useShopify, useTileCredit } from '@
|
|
43
|
+
// import { useShopify, useTileCredit } from '@tiledev/sdk-shopify'
|
|
44
44
|
// without paying for the `/react` subpath — the tile-packet-bundler only
|
|
45
45
|
// builds a single per-package bundle per platform, so requests to
|
|
46
|
-
// `@
|
|
46
|
+
// `@tiledev/sdk-shopify/react` return no bundle on web preview.
|
|
47
47
|
var react_1 = require("./react");
|
|
48
48
|
Object.defineProperty(exports, "ShopifyProvider", { enumerable: true, get: function () { return react_1.ShopifyProvider; } });
|
|
49
49
|
Object.defineProperty(exports, "useShopify", { enumerable: true, get: function () { return react_1.useShopify; } });
|
|
@@ -53,4 +53,6 @@ Object.defineProperty(exports, "useCustomer", { enumerable: true, get: function
|
|
|
53
53
|
Object.defineProperty(exports, "useCheckout", { enumerable: true, get: function () { return react_1.useCheckout; } });
|
|
54
54
|
Object.defineProperty(exports, "useShopifyMessage", { enumerable: true, get: function () { return react_1.useShopifyMessage; } });
|
|
55
55
|
Object.defineProperty(exports, "useTileCredit", { enumerable: true, get: function () { return react_1.useTileCredit; } });
|
|
56
|
+
Object.defineProperty(exports, "useCollectionProducts", { enumerable: true, get: function () { return react_1.useCollectionProducts; } });
|
|
57
|
+
Object.defineProperty(exports, "COLLECTION_PAGE_SIZE", { enumerable: true, get: function () { return react_1.COLLECTION_PAGE_SIZE; } });
|
|
56
58
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAAwD;AAA/C,kGAAA,OAAO,OAAA;AAAE,kGAAA,OAAO,OAAW;AACpC,iCAA8D;AAArD,oGAAA,WAAW,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAAE,6FAAA,IAAI,OAAA;AAC5C,mCAA2D;AAAlD,wGAAA,cAAc,OAAA;AAAE,yGAAA,eAAe,OAAA;AACxC,uCAQoB;AAPlB,4GAAA,gBAAgB,OAAA;AAChB,mGAAA,OAAO,OAAA;AACP,uGAAA,WAAW,OAAA;AACX,uGAAA,WAAW,OAAA;AACX,yGAAA,aAAa,OAAA;AACb,8GAAA,kBAAkB,OAAA;AAClB,gHAAA,oBAAoB,OAAA;AAEtB,2CAMsB;AALpB,2GAAA,aAAa,OAAA;AACb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ACjB,8GAAA,oBAAoB,OAAA;AACpB,sGAAA,YAAY,OAAA;AAEd,2CAOsB;AANpB,8GAAA,gBAAgB,OAAA;AAChB,iHAAA,mBAAmB,OAAA;AACnB,iHAAA,mBAAmB,OAAA;AACnB,kHAAA,oBAAoB,OAAA;AACpB,0GAAA,YAAY,OAAA;AACZ,0GAAA,YAAY,OAAA;AAEd,iCAA0C;AAAjC,wGAAA,eAAe,OAAA;AAGxB,uEAAuE;AACvE,qEAAqE;AACrE,yEAAyE;AACzE,kEAAkE;AAClE,gEAAgE;AAChE,iCAwBiB;AAvBf,wGAAA,eAAe,OAAA;AACf,mGAAA,UAAU,OAAA;AACV,gGAAA,OAAO,OAAA;AACP,oGAAA,WAAW,OAAA;AACX,oGAAA,WAAW,OAAA;AACX,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,8GAAA,qBAAqB,OAAA;AACrB,6GAAA,oBAAoB,OAAA"}
|
package/dist/money.d.ts
CHANGED
|
@@ -2,7 +2,16 @@ import type { Money } from './types';
|
|
|
2
2
|
import { getMoneyFormat } from './client';
|
|
3
3
|
/** Applies a `moneyFormat` template, e.g. `"Rs. {{amount}}"`. */
|
|
4
4
|
export declare function applyMoneyFormat(template: string, amount: number): string;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Falls back to a leading currency symbol until the shop's template has loaded — and for any money
|
|
7
|
+
* that is not in the shop's own currency.
|
|
8
|
+
*
|
|
9
|
+
* **The shop's `moneyFormat` hardcodes the shop's currency**: a USD store's is `${{amount}}`, with
|
|
10
|
+
* no token for the code. Applying it to a `Money` that carries another currency prints `$14,600.00`
|
|
11
|
+
* for `14600.0 INR` — a rupee amount wearing a dollar sign, which is worse than an unformatted
|
|
12
|
+
* number because it looks right. A cart's market is fixed when the cart is created, so a customer
|
|
13
|
+
* whose address puts them in another market really does get one of these.
|
|
14
|
+
*/
|
|
6
15
|
export declare function formatMoney(money: Money | null | undefined): string;
|
|
7
16
|
declare function loadCountryCode(): Promise<string | null>;
|
|
8
17
|
/** Fetch shop-level money settings and cache them for synchronous formatting. */
|
package/dist/money.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
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,EAAgC,MAAM,UAAU,CAAC;AAkCjF,iEAAiE;AACjE,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAgBnE;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
CHANGED
|
@@ -8,6 +8,11 @@ const queries_1 = require("./queries");
|
|
|
8
8
|
const SYMBOLS = {
|
|
9
9
|
USD: '$', EUR: '€', GBP: '£', INR: '₹', JPY: '¥', CAD: '$', AUD: '$',
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Symbols more than one currency uses. On a money that is not the shop's own, `$` alone repeats the
|
|
13
|
+
* very mistake the template path makes — so these carry their ISO code as well.
|
|
14
|
+
*/
|
|
15
|
+
const AMBIGUOUS_SYMBOLS = new Set(['$', '¥']);
|
|
11
16
|
function group(intPart, sep) {
|
|
12
17
|
return intPart.replace(/\B(?=(\d{3})+(?!\d))/g, sep);
|
|
13
18
|
}
|
|
@@ -38,19 +43,34 @@ function renderAmount(amount, token) {
|
|
|
38
43
|
function applyMoneyFormat(template, amount) {
|
|
39
44
|
return template.replace(/\{\{\s*([a-z_]+)\s*\}\}/gi, (_m, token) => renderAmount(amount, token));
|
|
40
45
|
}
|
|
41
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Falls back to a leading currency symbol until the shop's template has loaded — and for any money
|
|
48
|
+
* that is not in the shop's own currency.
|
|
49
|
+
*
|
|
50
|
+
* **The shop's `moneyFormat` hardcodes the shop's currency**: a USD store's is `${{amount}}`, with
|
|
51
|
+
* no token for the code. Applying it to a `Money` that carries another currency prints `$14,600.00`
|
|
52
|
+
* for `14600.0 INR` — a rupee amount wearing a dollar sign, which is worse than an unformatted
|
|
53
|
+
* number because it looks right. A cart's market is fixed when the cart is created, so a customer
|
|
54
|
+
* whose address puts them in another market really does get one of these.
|
|
55
|
+
*/
|
|
42
56
|
function formatMoney(money) {
|
|
43
57
|
var _a;
|
|
44
58
|
if (!money)
|
|
45
59
|
return '';
|
|
46
60
|
const num = Number(money.amount);
|
|
47
61
|
const template = (0, client_1.getMoneyFormat)();
|
|
48
|
-
|
|
62
|
+
const shopCurrency = (0, client_1.getCurrencyCode)();
|
|
63
|
+
// No code on either side means nothing to disagree about — the template is still the shop's own
|
|
64
|
+
// formatting, and is what renders before `shop.load()` resolves.
|
|
65
|
+
const isShopCurrency = !shopCurrency || !money.currencyCode || money.currencyCode === shopCurrency;
|
|
66
|
+
if (template && isShopCurrency && !Number.isNaN(num))
|
|
49
67
|
return applyMoneyFormat(template, num);
|
|
50
68
|
const symbol = (_a = SYMBOLS[money.currencyCode]) !== null && _a !== void 0 ? _a : `${money.currencyCode} `;
|
|
69
|
+
const suffix = !isShopCurrency && AMBIGUOUS_SYMBOLS.has(symbol) ? ` ${money.currencyCode}` : '';
|
|
51
70
|
if (Number.isNaN(num))
|
|
52
|
-
return `${symbol}${money.amount}`;
|
|
53
|
-
|
|
71
|
+
return `${symbol}${money.amount}${suffix}`;
|
|
72
|
+
// Grouped the way the template would have grouped it — `14600.00` is hard to read as a price.
|
|
73
|
+
return `${symbol}${renderAmount(num, 'amount')}${suffix}`;
|
|
54
74
|
}
|
|
55
75
|
/** Shop's IP-localized country (e.g. `"US"`). Fetched once on demand and
|
|
56
76
|
* cached — used as the fallback countryCode for gift-card apply. */
|
package/dist/money.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"money.js","sourceRoot":"","sources":["../src/money.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"money.js","sourceRoot":"","sources":["../src/money.ts"],"names":[],"mappings":";;;AAoCA,4CAEC;AAYD,kCAgBC;AAjED,qCAAiF;AACjF,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;;;GAGG;AACH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE9C,SAAS,KAAK,CAAC,OAAe,EAAE,GAAW;IACzC,OAAO,OAAO,CAAC,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;AACvD,CAAC;AAED,qFAAqF;AACrF,SAAS,YAAY,CAAC,MAAc,EAAE,KAAa;IACjD,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;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,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,iFAAiF;AACpE,QAAA,IAAI,GAAG;IAClB,KAAK,CAAC,IAAI;;QACR,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAA,gBAAO,EAA6F,oBAAU,CAAC,CAAC;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"}
|
package/dist/queries.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const VARIANT_FRAGMENT = "\n \n fragment MoneyFields on MoneyV2
|
|
|
9
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
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
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";
|
|
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 note\n buyerIdentity { countryCode email phone }\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n checkoutChargeAmount { ...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
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
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
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";
|
|
@@ -20,15 +20,25 @@ export declare const COLLECTIONS_LIST_QUERY = "\n \n \n fragment ImageFields
|
|
|
20
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
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
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
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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 note\n buyerIdentity { countryCode email phone }\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n checkoutChargeAmount { ...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 note\n buyerIdentity { countryCode email phone }\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n checkoutChargeAmount { ...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 note\n buyerIdentity { countryCode email phone }\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n checkoutChargeAmount { ...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 note\n buyerIdentity { countryCode email phone }\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n checkoutChargeAmount { ...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 note\n buyerIdentity { countryCode email phone }\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n checkoutChargeAmount { ...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 note\n buyerIdentity { countryCode email phone }\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n checkoutChargeAmount { ...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
|
+
/**
|
|
30
|
+
* The shopper's order note. It rides the cart to the order, where the merchant reads it beside the
|
|
31
|
+
* line items — so it is content, not a cart attribute, and Shopify gives it its own mutation.
|
|
32
|
+
*
|
|
33
|
+
* **`note` is `String!`, not `String`.** Declaring the variable nullable is rejected outright with
|
|
34
|
+
* `Nullability mismatch on variable $note and argument note` — the whole mutation fails, so this is
|
|
35
|
+
* not a case that only shows up when clearing. Clearing is the empty string, which is also what a
|
|
36
|
+
* cart with no note reads back as.
|
|
37
|
+
*/
|
|
38
|
+
export declare const CART_NOTE_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 note\n buyerIdentity { countryCode email phone }\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n checkoutChargeAmount { ...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 CartNoteUpdate($cartId: ID!, $note: String!) {\n cartNoteUpdate(cartId: $cartId, note: $note) {\n cart { ...CartFields }\n userErrors { field message code }\n }\n }\n";
|
|
39
|
+
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 note\n buyerIdentity { countryCode email phone }\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n checkoutChargeAmount { ...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";
|
|
40
|
+
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 note\n buyerIdentity { countryCode email phone }\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n checkoutChargeAmount { ...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";
|
|
41
|
+
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 note\n buyerIdentity { countryCode email phone }\n cost {\n subtotalAmount { ...MoneyFields }\n totalAmount { ...MoneyFields }\n totalTaxAmount { ...MoneyFields }\n checkoutChargeAmount { ...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
42
|
/** Shop's IP-localized country (e.g. `"US"`). We use this as the fallback
|
|
33
43
|
* countryCode when applying a gift card so the cart has a payment tender. */
|
|
34
44
|
export declare const SHOP_LOCALIZATION_QUERY = "\n query ShopLocalization {\n localization {\n country { isoCode name }\n }\n }\n";
|
package/dist/queries.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sour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ineProperty(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;
|
|
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_NOTE_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
4
|
exports.MONEY_FRAGMENT = `
|
|
5
5
|
fragment MoneyFields on MoneyV2 {
|
|
6
6
|
amount
|
|
@@ -109,10 +109,13 @@ exports.CART_FRAGMENT = `
|
|
|
109
109
|
id
|
|
110
110
|
checkoutUrl
|
|
111
111
|
totalQuantity
|
|
112
|
+
note
|
|
113
|
+
buyerIdentity { countryCode email phone }
|
|
112
114
|
cost {
|
|
113
115
|
subtotalAmount { ...MoneyFields }
|
|
114
116
|
totalAmount { ...MoneyFields }
|
|
115
117
|
totalTaxAmount { ...MoneyFields }
|
|
118
|
+
checkoutChargeAmount { ...MoneyFields }
|
|
116
119
|
}
|
|
117
120
|
discountCodes { code applicable }
|
|
118
121
|
appliedGiftCards {
|
|
@@ -317,6 +320,24 @@ exports.CART_DISCOUNT_CODES_UPDATE_MUTATION = `
|
|
|
317
320
|
}
|
|
318
321
|
}
|
|
319
322
|
`;
|
|
323
|
+
/**
|
|
324
|
+
* The shopper's order note. It rides the cart to the order, where the merchant reads it beside the
|
|
325
|
+
* line items — so it is content, not a cart attribute, and Shopify gives it its own mutation.
|
|
326
|
+
*
|
|
327
|
+
* **`note` is `String!`, not `String`.** Declaring the variable nullable is rejected outright with
|
|
328
|
+
* `Nullability mismatch on variable $note and argument note` — the whole mutation fails, so this is
|
|
329
|
+
* not a case that only shows up when clearing. Clearing is the empty string, which is also what a
|
|
330
|
+
* cart with no note reads back as.
|
|
331
|
+
*/
|
|
332
|
+
exports.CART_NOTE_UPDATE_MUTATION = `
|
|
333
|
+
${exports.CART_FRAGMENT}
|
|
334
|
+
mutation CartNoteUpdate($cartId: ID!, $note: String!) {
|
|
335
|
+
cartNoteUpdate(cartId: $cartId, note: $note) {
|
|
336
|
+
cart { ...CartFields }
|
|
337
|
+
userErrors { field message code }
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
`;
|
|
320
341
|
exports.CART_BUYER_IDENTITY_UPDATE_MUTATION = `
|
|
321
342
|
${exports.CART_FRAGMENT}
|
|
322
343
|
mutation CartBuyerIdentityUpdate($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {
|
package/dist/queries.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAiB;;;;;CAK3C,CAAC;AAEW,QAAA,cAAc,GAAiB;;;;;;;CAO3C,CAAC;AAEW,QAAA,gBAAgB,GAAiB;IAC1C,sBAAc;IACd,sBAAc;;;;;;;;;;;;CAYjB,CAAC;AAEF,gGAAgG;AAChG,MAAM,qBAAqB,GAAG,aAAa,CAAC;IACxC,wBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BnB,CAAC;AAEF;;;;GAIG;AACU,QAAA,qBAAqB,GAAiB;IAC/C,qBAAqB;;;;;CAKxB,CAAC;AAEW,QAAA,gBAAgB,GAAiB;IAC1C,qBAAqB;;;;;;;;;;;;;;;;CAgBxB,CAAC;AAEW,QAAA,mBAAmB,GAAiB;IAC7C,sBAAc;;;;;;;;;CASjB,CAAC;AAEW,QAAA,aAAa,GAAiB;IACvC,wBAAgB;IAChB,sBAAc
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAiB;;;;;CAK3C,CAAC;AAEW,QAAA,cAAc,GAAiB;;;;;;;CAO3C,CAAC;AAEW,QAAA,gBAAgB,GAAiB;IAC1C,sBAAc;IACd,sBAAc;;;;;;;;;;;;CAYjB,CAAC;AAEF,gGAAgG;AAChG,MAAM,qBAAqB,GAAG,aAAa,CAAC;IACxC,wBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BnB,CAAC;AAEF;;;;GAIG;AACU,QAAA,qBAAqB,GAAiB;IAC/C,qBAAqB;;;;;CAKxB,CAAC;AAEW,QAAA,gBAAgB,GAAiB;IAC1C,qBAAqB;;;;;;;;;;;;;;;;CAgBxB,CAAC;AAEW,Q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