@doswiftly/storefront-sdk 5.0.0 → 7.1.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 +185 -0
- package/README.md +10 -10
- package/dist/core/auth/auth-client.d.ts +4 -5
- package/dist/core/auth/auth-client.d.ts.map +1 -1
- package/dist/core/auth/auth-client.js +14 -15
- 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 +64 -44
- package/dist/core/cart/types.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/operations/auth.d.ts +10 -4
- package/dist/core/operations/auth.d.ts.map +1 -1
- package/dist/core/operations/auth.js +14 -8
- 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 +57 -41
- 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 +7 -7
- 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/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,190 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 7.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0399ef8: Auto-generated, drift-proof docs and AI-agent context shipped inside the package.
|
|
8
|
+
|
|
9
|
+
The package now ships three new files alongside the `.graphql` sources, all
|
|
10
|
+
generated automatically and kept in sync with the schema:
|
|
11
|
+
- **`AGENTS.md`** — entry point for AI coding agents (Cursor, Claude Code,
|
|
12
|
+
GitHub Copilot, Codex, Aider, Gemini CLI, …). Critical conventions and
|
|
13
|
+
anti-hallucination notes — load this once per session.
|
|
14
|
+
- **`llms-full.txt`** — full operation reference: descriptions, typed variables,
|
|
15
|
+
ready-to-execute GraphQL bodies, fragment cross-references.
|
|
16
|
+
- **`operations.json`** — same operations as structured JSON for MCP servers
|
|
17
|
+
and programmatic tools.
|
|
18
|
+
|
|
19
|
+
The `Available Operations` section in `README.md` is now also auto-generated,
|
|
20
|
+
so it can never drift from the actual schema again.
|
|
21
|
+
|
|
22
|
+
**Anti-hallucination conventions** documented in `AGENTS.md`:
|
|
23
|
+
- Cart mutations are `cartAddLines` / `cartUpdateLines` / `cartRemoveLines`
|
|
24
|
+
(NOT the `cart<Object><Verb>` aliases — they do not exist in this API).
|
|
25
|
+
- `userErrors[].code` is a `String`, not an enum. Domain-typed enums exist
|
|
26
|
+
separately for warnings (`CartWarningCode`, `DiscountErrorCode`, etc.).
|
|
27
|
+
- Authentication uses **either** the `customerAccessToken` cookie **or** the
|
|
28
|
+
`Authorization: Bearer` header — never both.
|
|
29
|
+
- `Money.amount` is a string (decimal precision), not a number.
|
|
30
|
+
|
|
31
|
+
No code changes for existing consumers — `schema.graphql`, `queries.graphql`,
|
|
32
|
+
`mutations.graphql`, and `fragments.graphql` are unchanged in surface (only
|
|
33
|
+
non-functional `#` description comments were added in the operation files).
|
|
34
|
+
Codegen continues to produce identical typed documents.
|
|
35
|
+
|
|
36
|
+
## 7.0.0
|
|
37
|
+
|
|
38
|
+
### Major Changes
|
|
39
|
+
|
|
40
|
+
- 1efbaab: # Storefront SDK 7.0 — sync z `@doswiftly/storefront-operations@7.0.0`
|
|
41
|
+
|
|
42
|
+
Major bump synchronizujący SDK z schematem GraphQL 7.0. Od tej wersji oba pakiety są publishowane synchronicznie — masz zainstalowaną tę samą wersję obu, niezgodne kombinacje są blokowane.
|
|
43
|
+
|
|
44
|
+
## Breaking changes
|
|
45
|
+
|
|
46
|
+
### Cart cost — `Money` zamiast `PriceMoney`, dodany `checkoutCharge`
|
|
47
|
+
|
|
48
|
+
Pola w `CartCost` i `CartLineCost` zwracają teraz `Money` (default scalar — `amount`, `currencyCode`) zamiast `PriceMoney` (currency-conversion transparency: `baseAmount`, `exchangeRate`, `marginApplied`, etc.). Konwersja waluty pozostaje w opt-in `*WithConversion` polach po stronie serwera dla potrzebujących UI'ów (storefront landing page price, hero promo).
|
|
49
|
+
|
|
50
|
+
Plus `CartCost` dostał nowe nullable pole `checkoutCharge: Money` — kwota pre-auth dla bramek płatniczych z separate authorization step.
|
|
51
|
+
|
|
52
|
+
### Cart lines — Relay Connection (edges/nodes/pageInfo/totalCount)
|
|
53
|
+
|
|
54
|
+
`Cart.lines` zwraca teraz `CartLineConnection` zamiast flat `[CartLine!]`. Klienci czytają `cart.lines.nodes` (preferowane) lub iterują `cart.lines.edges[].node`.
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
// Przed (5.x)
|
|
58
|
+
for (const line of cart.lines) { ... }
|
|
59
|
+
const count = cart.lines.length;
|
|
60
|
+
|
|
61
|
+
// Po (7.0)
|
|
62
|
+
for (const line of cart.lines.nodes) { ... }
|
|
63
|
+
const count = cart.lines.totalCount;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Cart line input/output — `variantId` zamiast `merchandiseId`, `variant` zamiast `merchandise`
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
// Przed (5.x)
|
|
70
|
+
await cartClient.addItems(cartId, [{ merchandiseId: "var-1", quantity: 1 }]);
|
|
71
|
+
console.log(cart.lines[0].merchandise.title);
|
|
72
|
+
|
|
73
|
+
// Po (7.0)
|
|
74
|
+
await cartClient.addItems(cartId, [{ variantId: "var-1", quantity: 1 }]);
|
|
75
|
+
console.log(cart.lines.nodes[0].variant.title);
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Cart cost field rename — bezsufiksowo
|
|
79
|
+
|
|
80
|
+
| 5.x | 7.0 |
|
|
81
|
+
| ----------------------------------------- | --------------------------------- |
|
|
82
|
+
| `CartCost.totalAmount` | `total` |
|
|
83
|
+
| `CartCost.subtotalAmount` | `subtotal` |
|
|
84
|
+
| `CartCost.totalTaxAmount` | `totalTax` |
|
|
85
|
+
| `CartCost.totalDutyAmount` | `totalDuty` |
|
|
86
|
+
| (brak) | `checkoutCharge` (nowe, nullable) |
|
|
87
|
+
| `CartLineCost.amountPerQuantity` | `pricePerUnit` |
|
|
88
|
+
| `CartLineCost.subtotalAmount` | `subtotal` |
|
|
89
|
+
| `CartLineCost.totalAmount` | `total` |
|
|
90
|
+
| `CartLineCost.compareAtAmountPerQuantity` | `compareAtPricePerUnit` |
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
// Przed
|
|
94
|
+
const total = cart.cost.totalAmount.amount;
|
|
95
|
+
const linePrice = cart.lines[0].cost.amountPerQuantity.amount;
|
|
96
|
+
|
|
97
|
+
// Po
|
|
98
|
+
const total = cart.cost.total.amount;
|
|
99
|
+
const linePrice = cart.lines.nodes[0].cost.pricePerUnit.amount;
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### ProductVariant — przebudowane pola
|
|
103
|
+
|
|
104
|
+
| 5.x | 7.0 |
|
|
105
|
+
| ----------------------------------------- | ----------------------------------------------------------------------------- |
|
|
106
|
+
| `available: boolean` | `isAvailable: boolean` |
|
|
107
|
+
| `quantityAvailable: number` | `availableStock: number` |
|
|
108
|
+
| `position: number` | `sortOrder: number` |
|
|
109
|
+
| `weight: number` (scalar) | `weight: { value: number, unit: string }` |
|
|
110
|
+
| `image: Image` (custom shape) | `image: ImageThumbnail` (spread `id, url, altText, width, height, thumbhash`) |
|
|
111
|
+
| `originalPrice`, `originalCompareAtPrice` | (usunięte — opt-in `*WithConversion` jeśli potrzebujesz konwersji) |
|
|
112
|
+
|
|
113
|
+
### CartLine — dodane `attributeSelections`
|
|
114
|
+
|
|
115
|
+
Customer-filled konfigurator (`AttributeType` z surcharge snapshot — Faza 1 R5). Distinct od `attributes` (raw key/value Line Item Properties).
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
const line = cart.lines.nodes[0];
|
|
119
|
+
console.log(line.attributes); // [{ key: 'gift_message', value: '...' }]
|
|
120
|
+
console.log(line.attributeSelections); // [{ attributeName, optionLabel, surchargeAmount, ... }]
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### CartDiscountCode — `isApplicable` zamiast `applicable`
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
// Przed
|
|
127
|
+
if (code.applicable) { ... }
|
|
128
|
+
|
|
129
|
+
// Po
|
|
130
|
+
if (code.isApplicable) { ... }
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Auth mutations — sync z domeną backend
|
|
134
|
+
|
|
135
|
+
Mutacje GraphQL nazewnictwo zmienione zgodne z naszą domeną:
|
|
136
|
+
|
|
137
|
+
| 5.x mutation | 7.0 mutation |
|
|
138
|
+
| --------------------------- | ---------------------- |
|
|
139
|
+
| `customerAccessTokenCreate` | `customerLogin` |
|
|
140
|
+
| `customerAccessTokenDelete` | `customerLogout` |
|
|
141
|
+
| `customerAccessTokenRenew` | `customerRefreshToken` |
|
|
142
|
+
| `customerCreate` | `customerSignup` |
|
|
143
|
+
|
|
144
|
+
Używając wysokopoziomowego API (`authClient.login()`, `authClient.register()`) — **nie wymaga zmian** w Twoim kodzie. Surowe queries przez `client.mutate(QUERY_STRING)` — wymagają update'u nazw mutacji.
|
|
145
|
+
|
|
146
|
+
### Method rename — `renewToken` → `refreshToken`
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
// Przed
|
|
150
|
+
await authClient.renewToken();
|
|
151
|
+
const { renewToken, isRenewingToken } = useAuth();
|
|
152
|
+
|
|
153
|
+
// Po
|
|
154
|
+
await authClient.refreshToken();
|
|
155
|
+
const { refreshToken, isRefreshingToken } = useAuth();
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Typ `TokenRenewResult` → `TokenRefreshResult`.
|
|
159
|
+
|
|
160
|
+
### `AuthClient.getCustomer()` — drop `accessToken` argument
|
|
161
|
+
|
|
162
|
+
Już od 5.x auth context resolved server-side z httpOnly cookie / `Authorization: Bearer`. W 5.x `getCustomer(accessToken)` był legacy override z 4.x — w 7.0 usunięty całkowicie:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
// Przed (5.x — działało, ale ignorowało argument)
|
|
166
|
+
const customer = await authClient.getCustomer(accessToken);
|
|
167
|
+
|
|
168
|
+
// Po (7.0)
|
|
169
|
+
const customer = await authClient.getCustomer();
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Compatibility matrix
|
|
173
|
+
|
|
174
|
+
| SDK | Backend (operations) |
|
|
175
|
+
| --- | -------------------------- |
|
|
176
|
+
| 7.x | 7.x (linked synchroniczne) |
|
|
177
|
+
| 5.x | 4.x, 5.x, 6.x |
|
|
178
|
+
| 4.x | 4.x |
|
|
179
|
+
|
|
180
|
+
Eksporty SDK (`@doswiftly/storefront-sdk`, `/react`, `/react/server`, `/cache`) bez zmian. Provider API (StorefrontProvider, store factories, middleware pipeline) bez zmian.
|
|
181
|
+
|
|
182
|
+
## Nowe eksporty typów
|
|
183
|
+
|
|
184
|
+
Dodatkowe typy publicznie dostępne dla template'ów które chcą strict typing po cart sub-strukturach:
|
|
185
|
+
|
|
186
|
+
`CartLineEdge`, `CartLineConnection`, `ProductVariant`, `ProductVariantWeight`, `ImageThumbnail`, `PageInfo`, `AttributeSelection`, `CartAttributeSelectionInput`, `SelectedOption`.
|
|
187
|
+
|
|
3
188
|
## 5.0.0
|
|
4
189
|
|
|
5
190
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ const logMiddleware: Middleware = async (req, next) => {
|
|
|
147
147
|
const cartClient = new CartClient(client);
|
|
148
148
|
|
|
149
149
|
const cart = await cartClient.create();
|
|
150
|
-
const updated = await cartClient.addItems(cartId, [{
|
|
150
|
+
const updated = await cartClient.addItems(cartId, [{ variantId: 'v-123', quantity: 1 }]);
|
|
151
151
|
await cartClient.updateItems(cartId, [{ id: 'line-1', quantity: 3 }]);
|
|
152
152
|
await cartClient.removeItems(cartId, ['line-1']);
|
|
153
153
|
await cartClient.updateDiscountCodes(cartId, ['SAVE10']);
|
|
@@ -164,10 +164,10 @@ Auto-throws `StorefrontError` with code `USER_ERROR` on validation failures.
|
|
|
164
164
|
const authClient = new AuthClient(client);
|
|
165
165
|
|
|
166
166
|
const { accessToken, expiresAt } = await authClient.login('user@example.com', 'pass');
|
|
167
|
-
await authClient.logout(
|
|
168
|
-
const renewed = await authClient.
|
|
169
|
-
const { accessToken, customer } = await authClient.register({ email, password, firstName });
|
|
170
|
-
const
|
|
167
|
+
await authClient.logout();
|
|
168
|
+
const renewed = await authClient.refreshToken();
|
|
169
|
+
const { accessToken: regToken, customer } = await authClient.register({ email, password, firstName });
|
|
170
|
+
const me = await authClient.getCustomer();
|
|
171
171
|
```
|
|
172
172
|
|
|
173
173
|
### StorefrontError
|
|
@@ -312,10 +312,10 @@ cacheCustom({ maxAge: 300, swr: 600 }) // 5min + 10min swr
|
|
|
312
312
|
|
|
313
313
|
```typescript
|
|
314
314
|
const {
|
|
315
|
-
login,
|
|
316
|
-
logout,
|
|
317
|
-
|
|
318
|
-
isLoggingIn, isLoggingOut,
|
|
315
|
+
login, // (email, password) => Promise<LoginResult>
|
|
316
|
+
logout, // () => Promise<LogoutResult>
|
|
317
|
+
refreshToken, // () => Promise<TokenRefreshResult>
|
|
318
|
+
isLoggingIn, isLoggingOut, isRefreshingToken, isLoading,
|
|
319
319
|
error,
|
|
320
320
|
} = useAuth({
|
|
321
321
|
onSetToken: async (token) => { /* set httpOnly cookie via server route */ },
|
|
@@ -418,7 +418,7 @@ const authHydrated = useAuthHydrated(); // true after localStorage rehydration
|
|
|
418
418
|
// Currency
|
|
419
419
|
const { currency, baseCurrency, supportedCurrencies, setCurrency, isLoaded } = useCurrencyStore();
|
|
420
420
|
|
|
421
|
-
// For .getState() in callbacks (e.g. logout,
|
|
421
|
+
// For .getState() in callbacks (e.g. logout, refreshToken)
|
|
422
422
|
import { useAuthStoreApi, useCurrencyStoreApi } from '@doswiftly/storefront-sdk/react';
|
|
423
423
|
const authStore = useAuthStoreApi();
|
|
424
424
|
const token = authStore.getState().accessToken;
|
|
@@ -27,17 +27,16 @@ export declare class AuthClient {
|
|
|
27
27
|
login(email: string, password: string): Promise<AuthResult>;
|
|
28
28
|
/**
|
|
29
29
|
* Logout — invalidates auth cookie on backend (server clears Set-Cookie via Apollo plugin).
|
|
30
|
-
* Token previously passed jako mutation arg → drop'd w Iteracja 2 (auth konsolidacja).
|
|
31
30
|
* Auth context czytany przez backend `StorefrontShopGuard` z httpOnly cookie lub
|
|
32
31
|
* `Authorization: Bearer` header (gdy ustawione przez SDK auth middleware).
|
|
33
32
|
* Does not throw on failure (token may already be expired).
|
|
34
33
|
*/
|
|
35
34
|
logout(): Promise<void>;
|
|
36
35
|
/**
|
|
37
|
-
*
|
|
36
|
+
* Refresh access token — extends expiry. Auth context czytany przez backend
|
|
38
37
|
* z cookie / Authorization Bearer (jak inne authenticated mutations).
|
|
39
38
|
*/
|
|
40
|
-
|
|
39
|
+
refreshToken(): Promise<AuthResult>;
|
|
41
40
|
/**
|
|
42
41
|
* Register new customer account.
|
|
43
42
|
* Returns access token + customer data.
|
|
@@ -45,8 +44,8 @@ export declare class AuthClient {
|
|
|
45
44
|
register(input: CustomerCreateInput): Promise<AuthResult>;
|
|
46
45
|
/**
|
|
47
46
|
* Fetch customer data — auth context z cookie / Authorization Bearer.
|
|
48
|
-
*
|
|
49
|
-
*
|
|
47
|
+
* Browser uses cookie auto-sent; non-browser klient passes Bearer header
|
|
48
|
+
* via SDK auth middleware (`setAuthToken`).
|
|
50
49
|
*/
|
|
51
50
|
getCustomer(): Promise<Customer | null>;
|
|
52
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-client.d.ts","sourceRoot":"","sources":["../../../src/core/auth/auth-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAUzE,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,gBAAgB;IAErD;;;OAGG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAiBjE
|
|
1
|
+
{"version":3,"file":"auth-client.d.ts","sourceRoot":"","sources":["../../../src/core/auth/auth-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAUzE,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,gBAAgB;IAErD;;;OAGG;IACG,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAiBjE;;;;;OAKG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAa7B;;;OAGG;IACG,YAAY,IAAI,OAAO,CAAC,UAAU,CAAC;IAiBzC;;;OAGG;IACG,QAAQ,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;IAmB/D;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;CAO9C"}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
18
|
import { assertNoUserErrors } from '../helpers/assert-no-user-errors';
|
|
19
|
-
import { CUSTOMER_LOGIN, CUSTOMER_LOGOUT,
|
|
19
|
+
import { CUSTOMER_LOGIN, CUSTOMER_LOGOUT, CUSTOMER_REFRESH_TOKEN, CUSTOMER_SIGNUP, CUSTOMER_QUERY, } from '../operations/auth';
|
|
20
20
|
export class AuthClient {
|
|
21
21
|
client;
|
|
22
22
|
constructor(client) {
|
|
@@ -28,8 +28,8 @@ export class AuthClient {
|
|
|
28
28
|
*/
|
|
29
29
|
async login(email, password) {
|
|
30
30
|
const data = await this.client.mutate(CUSTOMER_LOGIN, { input: { email, password } });
|
|
31
|
-
assertNoUserErrors(data.
|
|
32
|
-
const token = data.
|
|
31
|
+
assertNoUserErrors(data.customerLogin);
|
|
32
|
+
const token = data.customerLogin.customerAccessToken;
|
|
33
33
|
return {
|
|
34
34
|
accessToken: token.accessToken,
|
|
35
35
|
expiresAt: token.expiresAt,
|
|
@@ -37,7 +37,6 @@ export class AuthClient {
|
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
39
|
* Logout — invalidates auth cookie on backend (server clears Set-Cookie via Apollo plugin).
|
|
40
|
-
* Token previously passed jako mutation arg → drop'd w Iteracja 2 (auth konsolidacja).
|
|
41
40
|
* Auth context czytany przez backend `StorefrontShopGuard` z httpOnly cookie lub
|
|
42
41
|
* `Authorization: Bearer` header (gdy ustawione przez SDK auth middleware).
|
|
43
42
|
* Does not throw on failure (token may already be expired).
|
|
@@ -51,13 +50,13 @@ export class AuthClient {
|
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
/**
|
|
54
|
-
*
|
|
53
|
+
* Refresh access token — extends expiry. Auth context czytany przez backend
|
|
55
54
|
* z cookie / Authorization Bearer (jak inne authenticated mutations).
|
|
56
55
|
*/
|
|
57
|
-
async
|
|
58
|
-
const data = await this.client.mutate(
|
|
59
|
-
assertNoUserErrors(data.
|
|
60
|
-
const renewed = data.
|
|
56
|
+
async refreshToken() {
|
|
57
|
+
const data = await this.client.mutate(CUSTOMER_REFRESH_TOKEN);
|
|
58
|
+
assertNoUserErrors(data.customerRefreshToken);
|
|
59
|
+
const renewed = data.customerRefreshToken.customerAccessToken;
|
|
61
60
|
return {
|
|
62
61
|
accessToken: renewed.accessToken,
|
|
63
62
|
expiresAt: renewed.expiresAt,
|
|
@@ -68,19 +67,19 @@ export class AuthClient {
|
|
|
68
67
|
* Returns access token + customer data.
|
|
69
68
|
*/
|
|
70
69
|
async register(input) {
|
|
71
|
-
const data = await this.client.mutate(
|
|
72
|
-
assertNoUserErrors(data.
|
|
73
|
-
const token = data.
|
|
70
|
+
const data = await this.client.mutate(CUSTOMER_SIGNUP, { input });
|
|
71
|
+
assertNoUserErrors(data.customerSignup);
|
|
72
|
+
const token = data.customerSignup.customerAccessToken;
|
|
74
73
|
return {
|
|
75
74
|
accessToken: token.accessToken,
|
|
76
75
|
expiresAt: token.expiresAt,
|
|
77
|
-
customer: data.
|
|
76
|
+
customer: data.customerSignup.customer ?? undefined,
|
|
78
77
|
};
|
|
79
78
|
}
|
|
80
79
|
/**
|
|
81
80
|
* Fetch customer data — auth context z cookie / Authorization Bearer.
|
|
82
|
-
*
|
|
83
|
-
*
|
|
81
|
+
* Browser uses cookie auto-sent; non-browser klient passes Bearer header
|
|
82
|
+
* via SDK auth middleware (`setAuthToken`).
|
|
84
83
|
*/
|
|
85
84
|
async getCustomer() {
|
|
86
85
|
const data = await this.client.query(CUSTOMER_QUERY);
|
|
@@ -10,78 +10,98 @@ export interface Money {
|
|
|
10
10
|
amount: string;
|
|
11
11
|
currencyCode: string;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
rateTimestamp: string | null;
|
|
27
|
-
isConverted: boolean;
|
|
13
|
+
export interface ImageThumbnail {
|
|
14
|
+
id: string | null;
|
|
15
|
+
url: string;
|
|
16
|
+
altText: string | null;
|
|
17
|
+
width: number | null;
|
|
18
|
+
height: number | null;
|
|
19
|
+
thumbhash: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface PageInfo {
|
|
22
|
+
hasNextPage: boolean;
|
|
23
|
+
hasPreviousPage: boolean;
|
|
24
|
+
startCursor: string | null;
|
|
25
|
+
endCursor: string | null;
|
|
28
26
|
}
|
|
29
27
|
export interface CartCost {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
total: Money;
|
|
29
|
+
subtotal: Money;
|
|
30
|
+
totalTax: Money | null;
|
|
31
|
+
totalDuty: Money | null;
|
|
32
|
+
checkoutCharge: Money | null;
|
|
34
33
|
}
|
|
35
34
|
export interface CartLineCost {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
pricePerUnit: Money;
|
|
36
|
+
subtotal: Money;
|
|
37
|
+
total: Money;
|
|
38
|
+
compareAtPricePerUnit: Money | null;
|
|
40
39
|
}
|
|
41
40
|
export interface SelectedOption {
|
|
42
41
|
name: string;
|
|
43
42
|
value: string;
|
|
44
43
|
}
|
|
45
|
-
export interface
|
|
44
|
+
export interface ProductVariantWeight {
|
|
45
|
+
value: number;
|
|
46
|
+
unit: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ProductVariant {
|
|
46
49
|
id: string;
|
|
47
50
|
title: string;
|
|
48
51
|
sku: string | null;
|
|
49
|
-
price:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
quantityAvailable: number | null;
|
|
55
|
-
image: {
|
|
56
|
-
id: string | null;
|
|
57
|
-
url: string;
|
|
58
|
-
altText: string | null;
|
|
59
|
-
width: number | null;
|
|
60
|
-
height: number | null;
|
|
61
|
-
thumbhash: string | null;
|
|
62
|
-
} | null;
|
|
52
|
+
price: Money;
|
|
53
|
+
compareAtPrice: Money | null;
|
|
54
|
+
isAvailable: boolean;
|
|
55
|
+
availableStock: number | null;
|
|
56
|
+
image: ImageThumbnail | null;
|
|
63
57
|
selectedOptions: SelectedOption[];
|
|
64
58
|
barcode: string | null;
|
|
65
|
-
weight:
|
|
66
|
-
|
|
59
|
+
weight: ProductVariantWeight | null;
|
|
60
|
+
sortOrder: number | null;
|
|
61
|
+
}
|
|
62
|
+
export interface AttributeSelection {
|
|
63
|
+
attributeDefinitionId: string;
|
|
64
|
+
attributeName: string;
|
|
65
|
+
type: string;
|
|
66
|
+
fillingMode: string;
|
|
67
|
+
billingMode: string | null;
|
|
68
|
+
optionId: string | null;
|
|
69
|
+
optionLabel: string | null;
|
|
70
|
+
optionIds: string[] | null;
|
|
71
|
+
textValue: string | null;
|
|
72
|
+
surchargeAmount: number;
|
|
73
|
+
surchargeType: string | null;
|
|
74
|
+
taxClassId: string | null;
|
|
75
|
+
linkedVariantId: string | null;
|
|
67
76
|
}
|
|
68
77
|
export interface CartLine {
|
|
69
78
|
id: string;
|
|
70
79
|
quantity: number;
|
|
71
|
-
|
|
80
|
+
variant: ProductVariant;
|
|
72
81
|
cost: CartLineCost;
|
|
73
82
|
attributes: Array<{
|
|
74
83
|
key: string;
|
|
75
84
|
value: string | null;
|
|
76
85
|
}>;
|
|
86
|
+
attributeSelections: AttributeSelection[];
|
|
77
87
|
productId: string | null;
|
|
78
88
|
productTitle: string | null;
|
|
79
89
|
productHandle: string | null;
|
|
80
90
|
productType: string | null;
|
|
81
91
|
}
|
|
92
|
+
export interface CartLineEdge {
|
|
93
|
+
cursor: string;
|
|
94
|
+
node: CartLine;
|
|
95
|
+
}
|
|
96
|
+
export interface CartLineConnection {
|
|
97
|
+
edges: CartLineEdge[];
|
|
98
|
+
nodes: CartLine[];
|
|
99
|
+
pageInfo: PageInfo;
|
|
100
|
+
totalCount: number;
|
|
101
|
+
}
|
|
82
102
|
export interface CartDiscountCode {
|
|
83
103
|
code: string;
|
|
84
|
-
|
|
104
|
+
isApplicable: boolean;
|
|
85
105
|
}
|
|
86
106
|
export interface CartDiscountAllocation {
|
|
87
107
|
discountCode: string;
|
|
@@ -100,7 +120,7 @@ export interface Cart {
|
|
|
100
120
|
createdAt: string;
|
|
101
121
|
updatedAt: string;
|
|
102
122
|
cost: CartCost;
|
|
103
|
-
lines:
|
|
123
|
+
lines: CartLineConnection;
|
|
104
124
|
buyerIdentity: CartBuyerIdentity | null;
|
|
105
125
|
discountCodes: CartDiscountCode[];
|
|
106
126
|
discountAllocations: CartDiscountAllocation[];
|
|
@@ -126,7 +146,7 @@ export interface CartAttributeSelectionInput {
|
|
|
126
146
|
textValue?: string | null;
|
|
127
147
|
}
|
|
128
148
|
export interface CartLineInput {
|
|
129
|
-
|
|
149
|
+
variantId: string;
|
|
130
150
|
quantity?: number;
|
|
131
151
|
/** Raw Line Item Properties (gift messages, engraving notes, etc.). */
|
|
132
152
|
attributes?: Array<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/cart/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/cart/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB;AAMD,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAMD,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,OA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;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,uFAAuF;IACvF,mBAAmB,CAAC,EAAE,2BAA2B,EAAE,CAAC;CACrD;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,uFAAuF;IACvF,mBAAmB,CAAC,EAAE,2BAA2B,EAAE,GAAG,IAAI,CAAC;CAC5D;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
|
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';
|
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,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EA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AgB,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"}
|
|
@@ -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 {\n
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
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";
|
|
10
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
|
|
@@ -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
|
}
|
|
@@ -69,7 +75,7 @@ export const CUSTOMER_LOGIN = `
|
|
|
69
75
|
`;
|
|
70
76
|
export const CUSTOMER_LOGOUT = `
|
|
71
77
|
mutation CustomerLogout {
|
|
72
|
-
|
|
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 }
|
|
@@ -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 total { ...
|
|
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 total { ...
|
|
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 total { ...
|
|
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 total { ...
|
|
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 total { ...
|
|
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 total { ...
|
|
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 total { ...
|
|
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 total { ...
|
|
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,37 +51,52 @@ 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
|
-
total { ...
|
|
84
|
-
subtotal { ...
|
|
85
|
-
totalTax { ...
|
|
86
|
-
totalDuty { ...
|
|
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
|
-
pricePerUnit { ...
|
|
92
|
-
subtotal { ...
|
|
93
|
-
total { ...
|
|
94
|
-
compareAtPricePerUnit { ...
|
|
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 = `
|
|
@@ -101,6 +106,7 @@ const CART_LINE_FRAGMENT = `
|
|
|
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 {
|
|
@@ -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,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;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27,7 +27,7 @@ export function useAuth(options = {}) {
|
|
|
27
27
|
const authStore = useAuthStoreApi();
|
|
28
28
|
const [isLoggingIn, setIsLoggingIn] = useState(false);
|
|
29
29
|
const [isLoggingOut, setIsLoggingOut] = useState(false);
|
|
30
|
-
const [
|
|
30
|
+
const [isRefreshingToken, setIsRenewingToken] = useState(false);
|
|
31
31
|
const [error, setError] = useState(null);
|
|
32
32
|
const login = useCallback(async (email, password) => {
|
|
33
33
|
setError(null);
|
|
@@ -107,13 +107,13 @@ export function useAuth(options = {}) {
|
|
|
107
107
|
setIsLoggingOut(false);
|
|
108
108
|
}
|
|
109
109
|
}, [authClient, clearAuth, options, authStore]);
|
|
110
|
-
const
|
|
110
|
+
const refreshToken = useCallback(async () => {
|
|
111
111
|
setError(null);
|
|
112
112
|
setIsRenewingToken(true);
|
|
113
113
|
try {
|
|
114
114
|
// Auth context resolved server-side from cookie/Bearer — no token arg needed.
|
|
115
|
-
// If no active session, backend will return 401 and
|
|
116
|
-
const result = await authClient.
|
|
115
|
+
// If no active session, backend will return 401 and refreshToken throws.
|
|
116
|
+
const result = await authClient.refreshToken();
|
|
117
117
|
// Update httpOnly cookie
|
|
118
118
|
if (options.onSetToken) {
|
|
119
119
|
await options.onSetToken(result.accessToken);
|
|
@@ -151,11 +151,11 @@ export function useAuth(options = {}) {
|
|
|
151
151
|
return {
|
|
152
152
|
login,
|
|
153
153
|
logout,
|
|
154
|
-
|
|
154
|
+
refreshToken,
|
|
155
155
|
isLoggingIn,
|
|
156
156
|
isLoggingOut,
|
|
157
|
-
|
|
158
|
-
isLoading: isLoggingIn || isLoggingOut ||
|
|
157
|
+
isRefreshingToken,
|
|
158
|
+
isLoading: isLoggingIn || isLoggingOut || isRefreshingToken,
|
|
159
159
|
error,
|
|
160
160
|
};
|
|
161
161
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* ```tsx
|
|
10
10
|
* const { addItem, updateQuantity, removeItem, isLoading } = useCartManager();
|
|
11
11
|
*
|
|
12
|
-
* await addItem([{
|
|
12
|
+
* await addItem([{ variantId: 'variant-123', quantity: 1 }]);
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
15
|
import type { Cart, CartLineInput, CartLineUpdateInput } from '../../core/cart/types';
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* ```tsx
|
|
10
10
|
* const { addItem, updateQuantity, removeItem, isLoading } = useCartManager();
|
|
11
11
|
*
|
|
12
|
-
* await addItem([{
|
|
12
|
+
* await addItem([{ variantId: 'variant-123', quantity: 1 }]);
|
|
13
13
|
* ```
|
|
14
14
|
*/
|
|
15
15
|
'use client';
|
package/dist/react/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export { StorefrontProvider, type StorefrontProviderProps } from './providers/st
|
|
|
15
15
|
export { StorefrontClientProvider, type StorefrontClientProviderProps } from './providers/storefront-client-provider';
|
|
16
16
|
export { CurrencyProvider, type CurrencyProviderProps } from './providers/currency-provider';
|
|
17
17
|
export { LanguageProvider, type LanguageProviderProps } from './providers/language-provider';
|
|
18
|
-
export { useAuth, type UseAuthOptions, type LoginResult, type LogoutResult, type
|
|
18
|
+
export { useAuth, type UseAuthOptions, type LoginResult, type LogoutResult, type TokenRefreshResult } from './hooks/use-auth';
|
|
19
19
|
export { useCartManager } from './hooks/use-cart-manager';
|
|
20
20
|
export { useStorefrontClient } from './hooks/use-storefront-client';
|
|
21
21
|
export { useCurrency } from './hooks/use-currency';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AACnG,OAAO,EAAE,wBAAwB,EAAE,KAAK,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACtH,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,+BAA+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yBAAyB,CAAC;AAC7D,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACxH,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAGlI,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAGrH,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGhE,OAAO,EACL,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,SAAS,EACT,eAAe,EACf,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,aAAa,EACb,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doswiftly/storefront-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Storefront runtime SDK for DoSwiftly Commerce — layered transport, middleware pipeline, React providers, Zustand stores, cache strategies. 0 runtime dependencies in core.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|