@doswiftly/storefront-sdk 4.7.2 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +791 -0
- package/README.md +10 -10
- package/dist/core/auth/auth-client.d.ts +14 -8
- package/dist/core/auth/auth-client.d.ts.map +1 -1
- package/dist/core/auth/auth-client.js +26 -20
- package/dist/core/auth/handlers.d.ts +31 -0
- package/dist/core/auth/handlers.d.ts.map +1 -1
- package/dist/core/auth/handlers.js +69 -0
- package/dist/core/auth/types.d.ts +5 -5
- package/dist/core/auth/types.d.ts.map +1 -1
- package/dist/core/cache.d.ts +1 -1
- package/dist/core/cache.js +1 -1
- package/dist/core/cart/cart-client.d.ts +1 -1
- package/dist/core/cart/cart-client.js +1 -1
- package/dist/core/cart/types.d.ts +65 -45
- package/dist/core/cart/types.d.ts.map +1 -1
- package/dist/core/client/compose.d.ts +1 -1
- package/dist/core/client/compose.js +1 -1
- package/dist/core/client/create-client.d.ts +2 -2
- package/dist/core/client/create-client.js +2 -2
- package/dist/core/client/execute.d.ts.map +1 -1
- package/dist/core/client/execute.js +6 -0
- package/dist/core/client/types.js +1 -1
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/language/cookie-config.d.ts +7 -2
- package/dist/core/language/cookie-config.d.ts.map +1 -1
- package/dist/core/language/cookie-config.js +7 -2
- package/dist/core/operations/auth.d.ts +11 -5
- package/dist/core/operations/auth.d.ts.map +1 -1
- package/dist/core/operations/auth.js +22 -16
- package/dist/core/operations/cart.d.ts +8 -8
- package/dist/core/operations/cart.d.ts.map +1 -1
- package/dist/core/operations/cart.js +58 -42
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/react/hooks/use-auth.d.ts +4 -4
- package/dist/react/hooks/use-auth.d.ts.map +1 -1
- package/dist/react/hooks/use-auth.js +11 -18
- package/dist/react/hooks/use-cart-manager.d.ts +1 -1
- package/dist/react/hooks/use-cart-manager.js +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/stores/auth.store.d.ts +0 -2
- package/dist/react/stores/auth.store.d.ts.map +1 -1
- package/dist/react/stores/auth.store.js +10 -7
- package/package.json +2 -3
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Framework-agnostic — no React, no Zustand, 0 runtime dependencies.
|
|
5
5
|
*/
|
|
6
6
|
// ---------------------------------------------------------------------------
|
|
7
|
-
// TypedDocumentString (
|
|
7
|
+
// TypedDocumentString (graphql-codegen client-preset pattern)
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
9
9
|
/**
|
|
10
10
|
* A branded string carrying result & variable types.
|
package/dist/core/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export { FallbackBotProtectionManager } from './bot-protection/fallback-manager'
|
|
|
47
47
|
export { StorefrontError, ErrorCodes, type StorefrontErrorOptions } from './errors';
|
|
48
48
|
export { cacheNone, cacheShort, cacheLong, cachePrivate, cacheCustom, generateCacheControlHeader, type CacheOverrides, } from './cache';
|
|
49
49
|
export { CartClient } from './cart/cart-client';
|
|
50
|
-
export type { Cart, CartLine,
|
|
50
|
+
export type { Cart, CartLine, CartLineEdge, CartLineConnection, ProductVariant, ProductVariantWeight, ImageThumbnail, PageInfo, AttributeSelection, CartLineCost, CartCost, CartBuyerIdentity, CartDiscountCode, CartDiscountAllocation, CartLineInput, CartLineUpdateInput, CartCreateInput, CartBuyerIdentityInput, CartAttributeSelectionInput, SelectedOption, Money, } from './cart/types';
|
|
51
51
|
export { AuthClient } from './auth/auth-client';
|
|
52
52
|
export type { Customer, CustomerAccessToken, MailingAddress, AuthResult, CustomerCreateInput, } from './auth/types';
|
|
53
53
|
export { assertNoUserErrors } from './helpers/assert-no-user-errors';
|
|
@@ -59,7 +59,7 @@ export { LANGUAGE_COOKIE_NAME, LANGUAGE_COOKIE_MAX_AGE, LANGUAGE_HEADER_NAME } f
|
|
|
59
59
|
export { CURRENCY_COOKIE_NAME, CURRENCY_COOKIE_MAX_AGE, CURRENCY_HEADER_NAME } from './currency/cookie-config';
|
|
60
60
|
export { CART_COOKIE_NAME, CART_COOKIE_MAX_AGE } from './cart/cookie-config';
|
|
61
61
|
export { matchesRoute, type RouteProtectionConfig } from './auth/routes';
|
|
62
|
-
export { createSetTokenHandler, createClearTokenHandler } from './auth/handlers';
|
|
62
|
+
export { createSetTokenHandler, createClearTokenHandler, createWhoamiHandler } from './auth/handlers';
|
|
63
63
|
export { createAuthTokenClient, type AuthTokenClient } from './auth/token-client';
|
|
64
64
|
export { type ImageData, thumbHashToDataURL } from './image';
|
|
65
65
|
export { getOperationName } from './client/operation-name';
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,UAAU,EACV,SAAS,EACT,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,YAAY,EACZ,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,YAAY,GAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,KAAK,YAAY,EA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AM,gCAAgC,CAAC;AAGxC,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,UAAU,GAChB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,gBAAgB,GACtB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAG/G,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAG/G,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG7E,OAAO,EAAE,YAAY,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGzE,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtG,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGlF,OAAO,EAAE,KAAK,SAAS,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/core/index.js
CHANGED
|
@@ -71,7 +71,7 @@ export { CART_COOKIE_NAME, CART_COOKIE_MAX_AGE } from './cart/cookie-config';
|
|
|
71
71
|
// Auth route matching
|
|
72
72
|
export { matchesRoute } from './auth/routes';
|
|
73
73
|
// Auth cookie handlers (API route factories)
|
|
74
|
-
export { createSetTokenHandler, createClearTokenHandler } from './auth/handlers';
|
|
74
|
+
export { createSetTokenHandler, createClearTokenHandler, createWhoamiHandler } from './auth/handlers';
|
|
75
75
|
// Auth token client (client-side fetch helpers)
|
|
76
76
|
export { createAuthTokenClient } from './auth/token-client';
|
|
77
77
|
// Image types (loaders removed — GraphQL returns ready-to-use CDN URLs with transform params)
|
|
@@ -3,12 +3,17 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Used by:
|
|
5
5
|
* - SDK language store (client-side cookie read/write)
|
|
6
|
-
* - SDK language middleware (X-
|
|
6
|
+
* - SDK language middleware (X-Language header)
|
|
7
7
|
* - next-intl middleware `localeCookie.name` (server-side locale detection)
|
|
8
8
|
*
|
|
9
9
|
* Single cookie replaces both next-intl's NEXT_LOCALE and SDK's preferred-language.
|
|
10
|
+
*
|
|
11
|
+
* Header name `X-Language` matches backend `StorefrontContextBuilder.resolveLanguage`
|
|
12
|
+
* reader (`x-language` lowercased per Express normalization). Earlier `X-Lang` value
|
|
13
|
+
* was a documented mismatch that resulted in the SDK header being silently ignored
|
|
14
|
+
* by the backend.
|
|
10
15
|
*/
|
|
11
16
|
export declare const LANGUAGE_COOKIE_NAME = "preferred-language";
|
|
12
17
|
export declare const LANGUAGE_COOKIE_MAX_AGE: number;
|
|
13
|
-
export declare const LANGUAGE_HEADER_NAME = "X-
|
|
18
|
+
export declare const LANGUAGE_HEADER_NAME = "X-Language";
|
|
14
19
|
//# sourceMappingURL=cookie-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie-config.d.ts","sourceRoot":"","sources":["../../../src/core/language/cookie-config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"cookie-config.d.ts","sourceRoot":"","sources":["../../../src/core/language/cookie-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,uBAAuB,CAAC;AACzD,eAAO,MAAM,uBAAuB,QAAqB,CAAC;AAC1D,eAAO,MAAM,oBAAoB,eAAe,CAAC"}
|
|
@@ -3,11 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Used by:
|
|
5
5
|
* - SDK language store (client-side cookie read/write)
|
|
6
|
-
* - SDK language middleware (X-
|
|
6
|
+
* - SDK language middleware (X-Language header)
|
|
7
7
|
* - next-intl middleware `localeCookie.name` (server-side locale detection)
|
|
8
8
|
*
|
|
9
9
|
* Single cookie replaces both next-intl's NEXT_LOCALE and SDK's preferred-language.
|
|
10
|
+
*
|
|
11
|
+
* Header name `X-Language` matches backend `StorefrontContextBuilder.resolveLanguage`
|
|
12
|
+
* reader (`x-language` lowercased per Express normalization). Earlier `X-Lang` value
|
|
13
|
+
* was a documented mismatch that resulted in the SDK header being silently ignored
|
|
14
|
+
* by the backend.
|
|
10
15
|
*/
|
|
11
16
|
export const LANGUAGE_COOKIE_NAME = 'preferred-language';
|
|
12
17
|
export const LANGUAGE_COOKIE_MAX_AGE = 365 * 24 * 60 * 60; // 1 year
|
|
13
|
-
export const LANGUAGE_HEADER_NAME = 'X-
|
|
18
|
+
export const LANGUAGE_HEADER_NAME = 'X-Language';
|
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
* Auth/Customer GraphQL operations — manual query strings (no codegen).
|
|
3
3
|
*
|
|
4
4
|
* These match the backend storefront-graphql schema exactly.
|
|
5
|
+
*
|
|
6
|
+
* Mutation names (backend SSOT):
|
|
7
|
+
* - customerLogin(input: CustomerAccessTokenCreateInput!) → CustomerLoginPayload
|
|
8
|
+
* - customerLogout → CustomerLogoutPayload
|
|
9
|
+
* - customerRefreshToken → CustomerRefreshTokenPayload
|
|
10
|
+
* - customerSignup(input: CustomerCreateInput!) → CustomerSignupPayload
|
|
5
11
|
*/
|
|
6
|
-
export declare const CUSTOMER_LOGIN = "\n mutation CustomerLogin($input: CustomerAccessTokenCreateInput!) {\n
|
|
7
|
-
export declare const CUSTOMER_LOGOUT = "\n mutation CustomerLogout
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const CUSTOMER_QUERY = "\n query Customer
|
|
12
|
+
export declare const CUSTOMER_LOGIN = "\n mutation CustomerLogin($input: CustomerAccessTokenCreateInput!) {\n customerLogin(input: $input) {\n customerAccessToken { ...CustomerAccessTokenFields }\n userErrors { ...UserErrorFields }\n }\n }\n \n fragment CustomerAccessTokenFields on CustomerAccessToken {\n accessToken\n expiresAt\n }\n\n \n fragment UserErrorFields on UserError {\n message\n field\n code\n }\n\n";
|
|
13
|
+
export declare const CUSTOMER_LOGOUT = "\n mutation CustomerLogout {\n customerLogout {\n deletedAccessToken\n deletedCustomerAccessTokenId\n userErrors { ...UserErrorFields }\n }\n }\n \n fragment UserErrorFields on UserError {\n message\n field\n code\n }\n\n";
|
|
14
|
+
export declare const CUSTOMER_REFRESH_TOKEN = "\n mutation CustomerRefreshToken {\n customerRefreshToken {\n customerAccessToken { ...CustomerAccessTokenFields }\n userErrors { ...UserErrorFields }\n }\n }\n \n fragment CustomerAccessTokenFields on CustomerAccessToken {\n accessToken\n expiresAt\n }\n\n \n fragment UserErrorFields on UserError {\n message\n field\n code\n }\n\n";
|
|
15
|
+
export declare const CUSTOMER_SIGNUP = "\n mutation CustomerSignup($input: CustomerCreateInput!) {\n customerSignup(input: $input) {\n customer { ...CustomerFields }\n customerAccessToken { ...CustomerAccessTokenFields }\n userErrors { ...UserErrorFields }\n }\n }\n \n fragment CustomerFields on Customer {\n id\n email\n firstName\n lastName\n displayName\n phone\n emailVerified\n emailMarketingState\n defaultAddress {\n id\n streetLine1\n streetLine2\n city\n company\n country\n countryCode\n firstName\n lastName\n phone\n state\n stateCode\n postalCode\n isDefault\n }\n ordersCount\n totalSpent {\n amount\n currencyCode\n }\n createdAt\n updatedAt\n }\n\n \n fragment CustomerAccessTokenFields on CustomerAccessToken {\n accessToken\n expiresAt\n }\n\n \n fragment UserErrorFields on UserError {\n message\n field\n code\n }\n\n";
|
|
16
|
+
export declare const CUSTOMER_QUERY = "\n query Customer {\n customer {\n ...CustomerFields\n }\n }\n \n fragment CustomerFields on Customer {\n id\n email\n firstName\n lastName\n displayName\n phone\n emailVerified\n emailMarketingState\n defaultAddress {\n id\n streetLine1\n streetLine2\n city\n company\n country\n countryCode\n firstName\n lastName\n phone\n state\n stateCode\n postalCode\n isDefault\n }\n ordersCount\n totalSpent {\n amount\n currencyCode\n }\n createdAt\n updatedAt\n }\n\n";
|
|
11
17
|
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/core/operations/auth.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/core/operations/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA6DH,eAAO,MAAM,cAAc,maAS1B,CAAC;AAEF,eAAO,MAAM,eAAe,qQAS3B,CAAC;AAEF,eAAO,MAAM,sBAAsB,yXASlC,CAAC;AAEF,eAAO,MAAM,eAAe,+8BAW3B,CAAC;AAMF,eAAO,MAAM,cAAc,+lBAO1B,CAAC"}
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
* Auth/Customer GraphQL operations — manual query strings (no codegen).
|
|
3
3
|
*
|
|
4
4
|
* These match the backend storefront-graphql schema exactly.
|
|
5
|
+
*
|
|
6
|
+
* Mutation names (backend SSOT):
|
|
7
|
+
* - customerLogin(input: CustomerAccessTokenCreateInput!) → CustomerLoginPayload
|
|
8
|
+
* - customerLogout → CustomerLogoutPayload
|
|
9
|
+
* - customerRefreshToken → CustomerRefreshTokenPayload
|
|
10
|
+
* - customerSignup(input: CustomerCreateInput!) → CustomerSignupPayload
|
|
5
11
|
*/
|
|
6
12
|
// ---------------------------------------------------------------------------
|
|
7
13
|
// Fragments
|
|
@@ -31,8 +37,8 @@ const CUSTOMER_FRAGMENT = `
|
|
|
31
37
|
emailMarketingState
|
|
32
38
|
defaultAddress {
|
|
33
39
|
id
|
|
34
|
-
|
|
35
|
-
|
|
40
|
+
streetLine1
|
|
41
|
+
streetLine2
|
|
36
42
|
city
|
|
37
43
|
company
|
|
38
44
|
country
|
|
@@ -40,9 +46,9 @@ const CUSTOMER_FRAGMENT = `
|
|
|
40
46
|
firstName
|
|
41
47
|
lastName
|
|
42
48
|
phone
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
state
|
|
50
|
+
stateCode
|
|
51
|
+
postalCode
|
|
46
52
|
isDefault
|
|
47
53
|
}
|
|
48
54
|
ordersCount
|
|
@@ -59,7 +65,7 @@ const CUSTOMER_FRAGMENT = `
|
|
|
59
65
|
// ---------------------------------------------------------------------------
|
|
60
66
|
export const CUSTOMER_LOGIN = `
|
|
61
67
|
mutation CustomerLogin($input: CustomerAccessTokenCreateInput!) {
|
|
62
|
-
|
|
68
|
+
customerLogin(input: $input) {
|
|
63
69
|
customerAccessToken { ...CustomerAccessTokenFields }
|
|
64
70
|
userErrors { ...UserErrorFields }
|
|
65
71
|
}
|
|
@@ -68,8 +74,8 @@ export const CUSTOMER_LOGIN = `
|
|
|
68
74
|
${USER_ERROR_FRAGMENT}
|
|
69
75
|
`;
|
|
70
76
|
export const CUSTOMER_LOGOUT = `
|
|
71
|
-
mutation CustomerLogout
|
|
72
|
-
|
|
77
|
+
mutation CustomerLogout {
|
|
78
|
+
customerLogout {
|
|
73
79
|
deletedAccessToken
|
|
74
80
|
deletedCustomerAccessTokenId
|
|
75
81
|
userErrors { ...UserErrorFields }
|
|
@@ -77,9 +83,9 @@ export const CUSTOMER_LOGOUT = `
|
|
|
77
83
|
}
|
|
78
84
|
${USER_ERROR_FRAGMENT}
|
|
79
85
|
`;
|
|
80
|
-
export const
|
|
81
|
-
mutation
|
|
82
|
-
|
|
86
|
+
export const CUSTOMER_REFRESH_TOKEN = `
|
|
87
|
+
mutation CustomerRefreshToken {
|
|
88
|
+
customerRefreshToken {
|
|
83
89
|
customerAccessToken { ...CustomerAccessTokenFields }
|
|
84
90
|
userErrors { ...UserErrorFields }
|
|
85
91
|
}
|
|
@@ -87,9 +93,9 @@ export const CUSTOMER_TOKEN_RENEW = `
|
|
|
87
93
|
${CUSTOMER_ACCESS_TOKEN_FRAGMENT}
|
|
88
94
|
${USER_ERROR_FRAGMENT}
|
|
89
95
|
`;
|
|
90
|
-
export const
|
|
91
|
-
mutation
|
|
92
|
-
|
|
96
|
+
export const CUSTOMER_SIGNUP = `
|
|
97
|
+
mutation CustomerSignup($input: CustomerCreateInput!) {
|
|
98
|
+
customerSignup(input: $input) {
|
|
93
99
|
customer { ...CustomerFields }
|
|
94
100
|
customerAccessToken { ...CustomerAccessTokenFields }
|
|
95
101
|
userErrors { ...UserErrorFields }
|
|
@@ -103,8 +109,8 @@ export const CUSTOMER_CREATE = `
|
|
|
103
109
|
// Queries
|
|
104
110
|
// ---------------------------------------------------------------------------
|
|
105
111
|
export const CUSTOMER_QUERY = `
|
|
106
|
-
query Customer
|
|
107
|
-
customer
|
|
112
|
+
query Customer {
|
|
113
|
+
customer {
|
|
108
114
|
...CustomerFields
|
|
109
115
|
}
|
|
110
116
|
}
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Cart mutations always return full Cart + userErrors.
|
|
12
12
|
*/
|
|
13
|
-
export declare const CART_QUERY = "\n query Cart($id: ID!) {\n cart(id: $id) {\n ...Cart\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n
|
|
14
|
-
export declare const CART_CREATE = "\n mutation CartCreate($input: CartCreateInput) {\n cartCreate(input: $input) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n
|
|
15
|
-
export declare const CART_LINES_ADD = "\n mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {\n cartLinesAdd(cartId: $cartId, lines: $lines) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n
|
|
16
|
-
export declare const CART_LINES_UPDATE = "\n mutation CartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) {\n cartLinesUpdate(cartId: $cartId, lines: $lines) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n
|
|
17
|
-
export declare const CART_LINES_REMOVE = "\n mutation CartLinesRemove($cartId: ID!, $lineIds: [ID!]!) {\n cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n
|
|
18
|
-
export declare const CART_DISCOUNT_CODES_UPDATE = "\n mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n
|
|
19
|
-
export declare const CART_NOTE_UPDATE = "\n mutation CartNoteUpdate($cartId: ID!, $note: String!) {\n cartNoteUpdate(cartId: $cartId, note: $note) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n
|
|
20
|
-
export declare const CART_BUYER_IDENTITY_UPDATE = "\n mutation CartBuyerIdentityUpdate($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {\n cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n
|
|
13
|
+
export declare const CART_QUERY = "\n query Cart($id: ID!) {\n cart(id: $id) {\n ...Cart\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n cursor\n node { ... on CartLine { ...CartLine } }\n }\n nodes { ... on CartLine { ...CartLine } }\n pageInfo { ...PageInfo }\n totalCount\n }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...Money }\n subtotal { ...Money }\n totalTax { ...Money }\n totalDuty { ...Money }\n checkoutCharge { ...Money }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n attributeSelections { ...AttributeSelection }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...Money }\n subtotal { ...Money }\n total { ...Money }\n compareAtPricePerUnit { ...Money }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...Money }\n compareAtPrice { ...Money }\n isAvailable\n availableStock\n image { ...ImageThumbnail }\n selectedOptions { ...SelectedOption }\n barcode\n weight { value unit }\n sortOrder\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment ImageThumbnail on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n \n fragment AttributeSelection on AttributeSelection {\n attributeDefinitionId\n attributeName\n type\n fillingMode\n billingMode\n optionId\n optionLabel\n optionIds\n textValue\n surchargeAmount\n surchargeType\n taxClassId\n linkedVariantId\n }\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n isApplicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n \n fragment PageInfo on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n\n\n";
|
|
14
|
+
export declare const CART_CREATE = "\n mutation CartCreate($input: CartCreateInput) {\n cartCreate(input: $input) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n cursor\n node { ... on CartLine { ...CartLine } }\n }\n nodes { ... on CartLine { ...CartLine } }\n pageInfo { ...PageInfo }\n totalCount\n }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...Money }\n subtotal { ...Money }\n totalTax { ...Money }\n totalDuty { ...Money }\n checkoutCharge { ...Money }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n attributeSelections { ...AttributeSelection }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...Money }\n subtotal { ...Money }\n total { ...Money }\n compareAtPricePerUnit { ...Money }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...Money }\n compareAtPrice { ...Money }\n isAvailable\n availableStock\n image { ...ImageThumbnail }\n selectedOptions { ...SelectedOption }\n barcode\n weight { value unit }\n sortOrder\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment ImageThumbnail on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n \n fragment AttributeSelection on AttributeSelection {\n attributeDefinitionId\n attributeName\n type\n fillingMode\n billingMode\n optionId\n optionLabel\n optionIds\n textValue\n surchargeAmount\n surchargeType\n taxClassId\n linkedVariantId\n }\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n isApplicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n \n fragment PageInfo on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
|
|
15
|
+
export declare const CART_LINES_ADD = "\n mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {\n cartLinesAdd(cartId: $cartId, lines: $lines) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n cursor\n node { ... on CartLine { ...CartLine } }\n }\n nodes { ... on CartLine { ...CartLine } }\n pageInfo { ...PageInfo }\n totalCount\n }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...Money }\n subtotal { ...Money }\n totalTax { ...Money }\n totalDuty { ...Money }\n checkoutCharge { ...Money }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n attributeSelections { ...AttributeSelection }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...Money }\n subtotal { ...Money }\n total { ...Money }\n compareAtPricePerUnit { ...Money }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...Money }\n compareAtPrice { ...Money }\n isAvailable\n availableStock\n image { ...ImageThumbnail }\n selectedOptions { ...SelectedOption }\n barcode\n weight { value unit }\n sortOrder\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment ImageThumbnail on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n \n fragment AttributeSelection on AttributeSelection {\n attributeDefinitionId\n attributeName\n type\n fillingMode\n billingMode\n optionId\n optionLabel\n optionIds\n textValue\n surchargeAmount\n surchargeType\n taxClassId\n linkedVariantId\n }\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n isApplicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n \n fragment PageInfo on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
|
|
16
|
+
export declare const CART_LINES_UPDATE = "\n mutation CartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) {\n cartLinesUpdate(cartId: $cartId, lines: $lines) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n cursor\n node { ... on CartLine { ...CartLine } }\n }\n nodes { ... on CartLine { ...CartLine } }\n pageInfo { ...PageInfo }\n totalCount\n }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...Money }\n subtotal { ...Money }\n totalTax { ...Money }\n totalDuty { ...Money }\n checkoutCharge { ...Money }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n attributeSelections { ...AttributeSelection }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...Money }\n subtotal { ...Money }\n total { ...Money }\n compareAtPricePerUnit { ...Money }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...Money }\n compareAtPrice { ...Money }\n isAvailable\n availableStock\n image { ...ImageThumbnail }\n selectedOptions { ...SelectedOption }\n barcode\n weight { value unit }\n sortOrder\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment ImageThumbnail on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n \n fragment AttributeSelection on AttributeSelection {\n attributeDefinitionId\n attributeName\n type\n fillingMode\n billingMode\n optionId\n optionLabel\n optionIds\n textValue\n surchargeAmount\n surchargeType\n taxClassId\n linkedVariantId\n }\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n isApplicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n \n fragment PageInfo on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
|
|
17
|
+
export declare const CART_LINES_REMOVE = "\n mutation CartLinesRemove($cartId: ID!, $lineIds: [ID!]!) {\n cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n cursor\n node { ... on CartLine { ...CartLine } }\n }\n nodes { ... on CartLine { ...CartLine } }\n pageInfo { ...PageInfo }\n totalCount\n }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...Money }\n subtotal { ...Money }\n totalTax { ...Money }\n totalDuty { ...Money }\n checkoutCharge { ...Money }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n attributeSelections { ...AttributeSelection }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...Money }\n subtotal { ...Money }\n total { ...Money }\n compareAtPricePerUnit { ...Money }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...Money }\n compareAtPrice { ...Money }\n isAvailable\n availableStock\n image { ...ImageThumbnail }\n selectedOptions { ...SelectedOption }\n barcode\n weight { value unit }\n sortOrder\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment ImageThumbnail on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n \n fragment AttributeSelection on AttributeSelection {\n attributeDefinitionId\n attributeName\n type\n fillingMode\n billingMode\n optionId\n optionLabel\n optionIds\n textValue\n surchargeAmount\n surchargeType\n taxClassId\n linkedVariantId\n }\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n isApplicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n \n fragment PageInfo on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
|
|
18
|
+
export declare const CART_DISCOUNT_CODES_UPDATE = "\n mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n cursor\n node { ... on CartLine { ...CartLine } }\n }\n nodes { ... on CartLine { ...CartLine } }\n pageInfo { ...PageInfo }\n totalCount\n }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...Money }\n subtotal { ...Money }\n totalTax { ...Money }\n totalDuty { ...Money }\n checkoutCharge { ...Money }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n attributeSelections { ...AttributeSelection }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...Money }\n subtotal { ...Money }\n total { ...Money }\n compareAtPricePerUnit { ...Money }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...Money }\n compareAtPrice { ...Money }\n isAvailable\n availableStock\n image { ...ImageThumbnail }\n selectedOptions { ...SelectedOption }\n barcode\n weight { value unit }\n sortOrder\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment ImageThumbnail on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n \n fragment AttributeSelection on AttributeSelection {\n attributeDefinitionId\n attributeName\n type\n fillingMode\n billingMode\n optionId\n optionLabel\n optionIds\n textValue\n surchargeAmount\n surchargeType\n taxClassId\n linkedVariantId\n }\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n isApplicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n \n fragment PageInfo on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
|
|
19
|
+
export declare const CART_NOTE_UPDATE = "\n mutation CartNoteUpdate($cartId: ID!, $note: String!) {\n cartNoteUpdate(cartId: $cartId, note: $note) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n cursor\n node { ... on CartLine { ...CartLine } }\n }\n nodes { ... on CartLine { ...CartLine } }\n pageInfo { ...PageInfo }\n totalCount\n }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...Money }\n subtotal { ...Money }\n totalTax { ...Money }\n totalDuty { ...Money }\n checkoutCharge { ...Money }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n attributeSelections { ...AttributeSelection }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...Money }\n subtotal { ...Money }\n total { ...Money }\n compareAtPricePerUnit { ...Money }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...Money }\n compareAtPrice { ...Money }\n isAvailable\n availableStock\n image { ...ImageThumbnail }\n selectedOptions { ...SelectedOption }\n barcode\n weight { value unit }\n sortOrder\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment ImageThumbnail on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n \n fragment AttributeSelection on AttributeSelection {\n attributeDefinitionId\n attributeName\n type\n fillingMode\n billingMode\n optionId\n optionLabel\n optionIds\n textValue\n surchargeAmount\n surchargeType\n taxClassId\n linkedVariantId\n }\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n isApplicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n \n fragment PageInfo on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
|
|
20
|
+
export declare const CART_BUYER_IDENTITY_UPDATE = "\n mutation CartBuyerIdentityUpdate($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {\n cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n cursor\n node { ... on CartLine { ...CartLine } }\n }\n nodes { ... on CartLine { ...CartLine } }\n pageInfo { ...PageInfo }\n totalCount\n }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n total { ...Money }\n subtotal { ...Money }\n totalTax { ...Money }\n totalDuty { ...Money }\n checkoutCharge { ...Money }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n variant { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n attributeSelections { ...AttributeSelection }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n pricePerUnit { ...Money }\n subtotal { ...Money }\n total { ...Money }\n compareAtPricePerUnit { ...Money }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...Money }\n compareAtPrice { ...Money }\n isAvailable\n availableStock\n image { ...ImageThumbnail }\n selectedOptions { ...SelectedOption }\n barcode\n weight { value unit }\n sortOrder\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment ImageThumbnail on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n \n fragment AttributeSelection on AttributeSelection {\n attributeDefinitionId\n attributeName\n type\n fillingMode\n billingMode\n optionId\n optionLabel\n optionIds\n textValue\n surchargeAmount\n surchargeType\n taxClassId\n linkedVariantId\n }\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n isApplicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n \n fragment PageInfo on PageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
|
|
21
21
|
//# sourceMappingURL=cart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../../../src/core/operations/cart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../../../src/core/operations/cart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwLH,eAAO,MAAM,UAAU,iiFAOtB,CAAC;AAMF,eAAO,MAAM,WAAW,msFASvB,CAAC;AAEF,eAAO,MAAM,cAAc,wuFAS1B,CAAC;AAEF,eAAO,MAAM,iBAAiB,ovFAS7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,yuFAS7B,CAAC;AAEF,eAAO,MAAM,0BAA0B,+wFAStC,CAAC;AAEF,eAAO,MAAM,gBAAgB,+tFAS5B,CAAC;AAEF,eAAO,MAAM,0BAA0B,4xFAStC,CAAC"}
|
|
@@ -19,26 +19,8 @@ const MONEY_FRAGMENT = `
|
|
|
19
19
|
currencyCode
|
|
20
20
|
}
|
|
21
21
|
`;
|
|
22
|
-
const
|
|
23
|
-
fragment
|
|
24
|
-
amount
|
|
25
|
-
currencyCode
|
|
26
|
-
}
|
|
27
|
-
`;
|
|
28
|
-
const PRICE_MONEY_FRAGMENT = `
|
|
29
|
-
fragment PriceMoney on PriceMoney {
|
|
30
|
-
...Price
|
|
31
|
-
baseAmount
|
|
32
|
-
baseCurrencyCode
|
|
33
|
-
exchangeRate
|
|
34
|
-
marginApplied
|
|
35
|
-
rateTimestamp
|
|
36
|
-
isConverted
|
|
37
|
-
}
|
|
38
|
-
${PRICE_FRAGMENT}
|
|
39
|
-
`;
|
|
40
|
-
const IMAGE_FRAGMENT = `
|
|
41
|
-
fragment Image on Image {
|
|
22
|
+
const IMAGE_THUMBNAIL_FRAGMENT = `
|
|
23
|
+
fragment ImageThumbnail on Image {
|
|
42
24
|
id
|
|
43
25
|
url(transform: { maxWidth: 300 })
|
|
44
26
|
altText
|
|
@@ -53,6 +35,14 @@ const SELECTED_OPTION_FRAGMENT = `
|
|
|
53
35
|
value
|
|
54
36
|
}
|
|
55
37
|
`;
|
|
38
|
+
const PAGE_INFO_FRAGMENT = `
|
|
39
|
+
fragment PageInfo on PageInfo {
|
|
40
|
+
hasNextPage
|
|
41
|
+
hasPreviousPage
|
|
42
|
+
startCursor
|
|
43
|
+
endCursor
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
56
46
|
// ---------------------------------------------------------------------------
|
|
57
47
|
// Cart-specific fragments (matching SSOT fragments.graphql)
|
|
58
48
|
// ---------------------------------------------------------------------------
|
|
@@ -61,46 +51,62 @@ const PRODUCT_VARIANT_FRAGMENT = `
|
|
|
61
51
|
id
|
|
62
52
|
title
|
|
63
53
|
sku
|
|
64
|
-
price { ...
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
quantityAvailable
|
|
70
|
-
image { ...Image }
|
|
54
|
+
price { ...Money }
|
|
55
|
+
compareAtPrice { ...Money }
|
|
56
|
+
isAvailable
|
|
57
|
+
availableStock
|
|
58
|
+
image { ...ImageThumbnail }
|
|
71
59
|
selectedOptions { ...SelectedOption }
|
|
72
60
|
barcode
|
|
73
|
-
weight
|
|
74
|
-
|
|
61
|
+
weight { value unit }
|
|
62
|
+
sortOrder
|
|
75
63
|
}
|
|
76
|
-
${PRICE_MONEY_FRAGMENT}
|
|
77
64
|
${MONEY_FRAGMENT}
|
|
78
|
-
${
|
|
65
|
+
${IMAGE_THUMBNAIL_FRAGMENT}
|
|
79
66
|
${SELECTED_OPTION_FRAGMENT}
|
|
80
67
|
`;
|
|
81
68
|
const CART_COST_FRAGMENT = `
|
|
82
69
|
fragment CartCost on CartCost {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
70
|
+
total { ...Money }
|
|
71
|
+
subtotal { ...Money }
|
|
72
|
+
totalTax { ...Money }
|
|
73
|
+
totalDuty { ...Money }
|
|
74
|
+
checkoutCharge { ...Money }
|
|
87
75
|
}
|
|
88
76
|
`;
|
|
89
77
|
const CART_LINE_COST_FRAGMENT = `
|
|
90
78
|
fragment CartLineCost on CartLineCost {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
79
|
+
pricePerUnit { ...Money }
|
|
80
|
+
subtotal { ...Money }
|
|
81
|
+
total { ...Money }
|
|
82
|
+
compareAtPricePerUnit { ...Money }
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
const ATTRIBUTE_SELECTION_FRAGMENT = `
|
|
86
|
+
fragment AttributeSelection on AttributeSelection {
|
|
87
|
+
attributeDefinitionId
|
|
88
|
+
attributeName
|
|
89
|
+
type
|
|
90
|
+
fillingMode
|
|
91
|
+
billingMode
|
|
92
|
+
optionId
|
|
93
|
+
optionLabel
|
|
94
|
+
optionIds
|
|
95
|
+
textValue
|
|
96
|
+
surchargeAmount
|
|
97
|
+
surchargeType
|
|
98
|
+
taxClassId
|
|
99
|
+
linkedVariantId
|
|
95
100
|
}
|
|
96
101
|
`;
|
|
97
102
|
const CART_LINE_FRAGMENT = `
|
|
98
103
|
fragment CartLine on CartLine {
|
|
99
104
|
id
|
|
100
105
|
quantity
|
|
101
|
-
|
|
106
|
+
variant { ...ProductVariant }
|
|
102
107
|
cost { ...CartLineCost }
|
|
103
108
|
attributes { key value }
|
|
109
|
+
attributeSelections { ...AttributeSelection }
|
|
104
110
|
productId
|
|
105
111
|
productTitle
|
|
106
112
|
productHandle
|
|
@@ -108,6 +114,7 @@ const CART_LINE_FRAGMENT = `
|
|
|
108
114
|
}
|
|
109
115
|
${CART_LINE_COST_FRAGMENT}
|
|
110
116
|
${PRODUCT_VARIANT_FRAGMENT}
|
|
117
|
+
${ATTRIBUTE_SELECTION_FRAGMENT}
|
|
111
118
|
`;
|
|
112
119
|
const CART_BUYER_IDENTITY_FRAGMENT = `
|
|
113
120
|
fragment CartBuyerIdentity on CartBuyerIdentity {
|
|
@@ -119,7 +126,7 @@ const CART_BUYER_IDENTITY_FRAGMENT = `
|
|
|
119
126
|
const CART_DISCOUNT_CODE_FRAGMENT = `
|
|
120
127
|
fragment CartDiscountCode on CartDiscountCode {
|
|
121
128
|
code
|
|
122
|
-
|
|
129
|
+
isApplicable
|
|
123
130
|
}
|
|
124
131
|
`;
|
|
125
132
|
const CART_DISCOUNT_ALLOCATION_FRAGMENT = `
|
|
@@ -134,7 +141,15 @@ const CART_FRAGMENT = `
|
|
|
134
141
|
checkoutUrl
|
|
135
142
|
totalQuantity
|
|
136
143
|
cost { ...CartCost }
|
|
137
|
-
lines(first: 100) {
|
|
144
|
+
lines(first: 100) {
|
|
145
|
+
edges {
|
|
146
|
+
cursor
|
|
147
|
+
node { ... on CartLine { ...CartLine } }
|
|
148
|
+
}
|
|
149
|
+
nodes { ... on CartLine { ...CartLine } }
|
|
150
|
+
pageInfo { ...PageInfo }
|
|
151
|
+
totalCount
|
|
152
|
+
}
|
|
138
153
|
buyerIdentity { ...CartBuyerIdentity }
|
|
139
154
|
discountCodes { ...CartDiscountCode }
|
|
140
155
|
discountAllocations { ...CartDiscountAllocation }
|
|
@@ -148,6 +163,7 @@ const CART_FRAGMENT = `
|
|
|
148
163
|
${CART_BUYER_IDENTITY_FRAGMENT}
|
|
149
164
|
${CART_DISCOUNT_CODE_FRAGMENT}
|
|
150
165
|
${CART_DISCOUNT_ALLOCATION_FRAGMENT}
|
|
166
|
+
${PAGE_INFO_FRAGMENT}
|
|
151
167
|
`;
|
|
152
168
|
const USER_ERROR_FRAGMENT = `
|
|
153
169
|
fragment UserError on UserError {
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
export interface UseAuthOptions {
|
|
20
20
|
/**
|
|
21
|
-
* Called after successful login/
|
|
21
|
+
* Called after successful login/refreshToken with the new access token.
|
|
22
22
|
* Use to set httpOnly cookie via API route.
|
|
23
23
|
*/
|
|
24
24
|
onSetToken?: (token: string) => Promise<void>;
|
|
@@ -43,7 +43,7 @@ export interface LogoutResult {
|
|
|
43
43
|
field?: string[];
|
|
44
44
|
}>;
|
|
45
45
|
}
|
|
46
|
-
export interface
|
|
46
|
+
export interface TokenRefreshResult {
|
|
47
47
|
success: boolean;
|
|
48
48
|
userErrors: Array<{
|
|
49
49
|
message: string;
|
|
@@ -55,10 +55,10 @@ export interface TokenRenewResult {
|
|
|
55
55
|
export declare function useAuth(options?: UseAuthOptions): {
|
|
56
56
|
login: (email: string, password: string) => Promise<LoginResult>;
|
|
57
57
|
logout: () => Promise<LogoutResult>;
|
|
58
|
-
|
|
58
|
+
refreshToken: () => Promise<TokenRefreshResult>;
|
|
59
59
|
isLoggingIn: boolean;
|
|
60
60
|
isLoggingOut: boolean;
|
|
61
|
-
|
|
61
|
+
isRefreshingToken: boolean;
|
|
62
62
|
isLoading: boolean;
|
|
63
63
|
error: string | null;
|
|
64
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-auth.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AASH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,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