@sixtyninecommerce/client 0.7.0 → 0.8.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/README.md +96 -0
- package/dist/commerce/cart.d.ts +5 -0
- package/dist/commerce/cart.d.ts.map +1 -1
- package/dist/commerce/cart.js +22 -1
- package/dist/commerce/cart.js.map +1 -1
- package/dist/commerce/customer.d.ts +13 -6
- package/dist/commerce/customer.d.ts.map +1 -1
- package/dist/commerce/customer.js +45 -2
- package/dist/commerce/customer.js.map +1 -1
- package/dist/commerce/products.d.ts +3 -1
- package/dist/commerce/products.d.ts.map +1 -1
- package/dist/commerce/products.js +14 -1
- package/dist/commerce/products.js.map +1 -1
- package/dist/commerce/queries.d.ts +17 -11
- package/dist/commerce/queries.d.ts.map +1 -1
- package/dist/commerce/queries.js +76 -7
- package/dist/commerce/queries.js.map +1 -1
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +2 -0
- package/dist/core/context.js.map +1 -1
- package/dist/credit/credit-status.d.ts.map +1 -1
- package/dist/credit/credit-status.js +1 -0
- package/dist/credit/credit-status.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +3 -0
- package/dist/media/index.js.map +1 -1
- package/dist/pricing/format.d.ts.map +1 -1
- package/dist/pricing/format.js +1 -1
- package/dist/pricing/format.js.map +1 -1
- package/dist/pricing/index.d.ts.map +1 -1
- package/dist/pricing/index.js +17 -2
- package/dist/pricing/index.js.map +1 -1
- package/dist/types.d.ts +84 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -145,6 +145,102 @@ const data = await client.graphql(`query { activeChannel { id } }`);
|
|
|
145
145
|
| `media` | CDN URLs, preset URLs, responsive image data (pure functions) |
|
|
146
146
|
| `currency` | Exchange rates, currency conversion |
|
|
147
147
|
|
|
148
|
+
## Passwordless (Magic Link) Login
|
|
149
|
+
|
|
150
|
+
Customers can sign in without a password. `requestMagicLink` emails a one-tap
|
|
151
|
+
**link** _and_ a 6-digit **code**; consuming either starts a session. It coexists
|
|
152
|
+
with password login (`login`) — both are available. For unknown emails the server
|
|
153
|
+
creates a verified account on first sign-in (when the channel enables signup).
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
// 1. Request — always resolves (anti-enumeration). Show "check your inbox" regardless.
|
|
157
|
+
await client.commerce.requestMagicLink(email);
|
|
158
|
+
|
|
159
|
+
// 2a. Consume the LINK (token from the emailed URL's ?token= param)
|
|
160
|
+
const user = await client.commerce.loginWithMagicLink(token);
|
|
161
|
+
|
|
162
|
+
// 2b. …or consume the 6-digit CODE (cross-device: typed on the same tab that requested it)
|
|
163
|
+
const user = await client.commerce.loginWithMagicCode(email, code);
|
|
164
|
+
// Either path starts a session and fires onAuthToken — no extra token handling needed.
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Errors thrown (via `MutationError.errorCode`): `MAGIC_LINK_INVALID_ERROR`,
|
|
168
|
+
`MAGIC_LINK_EXPIRED_ERROR`, `MAGIC_LINK_LOCKED_ERROR` (too many wrong codes).
|
|
169
|
+
|
|
170
|
+
### Reference UI (storefront)
|
|
171
|
+
|
|
172
|
+
Two pages. **Request page** — collect the email, then offer the code field:
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
function MagicLinkRequest() {
|
|
176
|
+
const [email, setEmail] = useState('');
|
|
177
|
+
const [status, setStatus] = useState<'idle' | 'sent'>('idle');
|
|
178
|
+
const [code, setCode] = useState('');
|
|
179
|
+
|
|
180
|
+
async function request(e: React.FormEvent) {
|
|
181
|
+
e.preventDefault();
|
|
182
|
+
await client.commerce.requestMagicLink(email.trim()); // never reveals existence
|
|
183
|
+
setStatus('sent'); // always advance — even if no account exists
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async function submitCode(e: React.FormEvent) {
|
|
187
|
+
e.preventDefault();
|
|
188
|
+
try {
|
|
189
|
+
await client.commerce.loginWithMagicCode(email.trim(), code.trim());
|
|
190
|
+
window.location.assign('/account');
|
|
191
|
+
} catch {
|
|
192
|
+
/* show "invalid or expired code — request a new link" */
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (status === 'sent') {
|
|
197
|
+
return (
|
|
198
|
+
<form onSubmit={submitCode}>
|
|
199
|
+
<p>If an account exists for <b>{email}</b>, we’ve emailed a sign-in link and code.</p>
|
|
200
|
+
{/* npx shadcn add input-otp */}
|
|
201
|
+
<input inputMode="numeric" maxLength={6} value={code} onChange={(e) => setCode(e.target.value)} />
|
|
202
|
+
<button type="submit">Sign in</button>
|
|
203
|
+
</form>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
return (
|
|
207
|
+
<form onSubmit={request}>
|
|
208
|
+
<input type="email" value={email} onChange={(e) => setEmail(e.target.value)} required />
|
|
209
|
+
<button type="submit">Email me a sign-in link</button>
|
|
210
|
+
</form>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
**Callback page** (`/sign-in/magic?token=…`) — **do not auto-consume on load.** Require
|
|
216
|
+
a click. Email-security scanners pre-fetch links (which would burn the single-use
|
|
217
|
+
token), and React StrictMode double-mounts effects. A confirm button avoids both:
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
function MagicLinkCallback() {
|
|
221
|
+
const token = new URLSearchParams(location.search).get('token');
|
|
222
|
+
const [state, setState] = useState<'confirm' | 'working' | 'invalid'>('confirm');
|
|
223
|
+
|
|
224
|
+
if (!token) return <p>Invalid sign-in link.</p>;
|
|
225
|
+
|
|
226
|
+
async function confirm() {
|
|
227
|
+
setState('working');
|
|
228
|
+
try {
|
|
229
|
+
await client.commerce.loginWithMagicLink(token!);
|
|
230
|
+
window.location.assign('/account'); // session token already captured via onAuthToken
|
|
231
|
+
} catch {
|
|
232
|
+
setState('invalid');
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
if (state === 'invalid') return <p>This link expired or was already used. <a href="/sign-in/magic">Request a new one</a>.</p>;
|
|
237
|
+
return <button disabled={state === 'working'} onClick={confirm}>Sign in</button>;
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
> **Cross-device note:** opening the link on a phone signs in the *phone*. To sign
|
|
242
|
+
> in the desktop tab that started checkout, enter the 6-digit **code** there instead.
|
|
243
|
+
|
|
148
244
|
## Price Lists & Volume Pricing
|
|
149
245
|
|
|
150
246
|
Every variant fragment returned by `commerce.getProduct`, `searchProducts`, `getCollection`, `getMyFavorites`, and `getProductRecommendations` already includes the price-list metadata:
|
package/dist/commerce/cart.d.ts
CHANGED
|
@@ -3,8 +3,13 @@ import type { Order } from '../types.js';
|
|
|
3
3
|
export declare function createCartMethods(http: HttpClient): {
|
|
4
4
|
getActiveOrder(): Promise<Order | null>;
|
|
5
5
|
addToCart(variantId: string, quantity: number): Promise<Order>;
|
|
6
|
+
addItemsToCart(items: Array<{
|
|
7
|
+
productVariantId: string;
|
|
8
|
+
quantity: number;
|
|
9
|
+
}>): Promise<Order>;
|
|
6
10
|
updateCartLine(lineId: string, quantity: number): Promise<Order>;
|
|
7
11
|
removeFromCart(lineId: string): Promise<Order>;
|
|
12
|
+
clearCart(): Promise<Order>;
|
|
8
13
|
applyCouponCode(code: string): Promise<Order>;
|
|
9
14
|
removeCouponCode(code: string): Promise<Order>;
|
|
10
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../../src/commerce/cart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../../src/commerce/cart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAuBzC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU;sBAEtB,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;yBAKlB,MAAM,YAAY,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;0BAS3D,KAAK,CAAC;QAAE,gBAAgB,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,GAC3D,OAAO,CAAC,KAAK,CAAC;2BA2BY,MAAM,YAAY,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;2BAQzC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;iBAOjC,OAAO,CAAC,KAAK,CAAC;0BAKL,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;2BAKtB,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;EAOvD"}
|
package/dist/commerce/cart.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MutationError } from '../errors.js';
|
|
2
|
-
import { ACTIVE_ORDER, ADD_TO_CART, ADJUST_ORDER_LINE, APPLY_COUPON, REMOVE_COUPON, REMOVE_ORDER_LINE, } from './queries.js';
|
|
2
|
+
import { ACTIVE_ORDER, ADD_ITEMS_TO_CART, ADD_TO_CART, ADJUST_ORDER_LINE, APPLY_COUPON, REMOVE_ALL_ORDER_LINES, REMOVE_COUPON, REMOVE_ORDER_LINE, } from './queries.js';
|
|
3
3
|
function unwrapOrderResult(data, operationField) {
|
|
4
4
|
const result = data[operationField];
|
|
5
5
|
if (!result) {
|
|
@@ -23,6 +23,23 @@ export function createCartMethods(http) {
|
|
|
23
23
|
});
|
|
24
24
|
return unwrapOrderResult(data, 'addItemToOrder');
|
|
25
25
|
},
|
|
26
|
+
async addItemsToCart(items) {
|
|
27
|
+
const data = await http.graphql(ADD_ITEMS_TO_CART, { inputs: items });
|
|
28
|
+
const result = data.addItemsToOrder;
|
|
29
|
+
if (!result) {
|
|
30
|
+
throw new MutationError('UNKNOWN_ERROR', 'No result from addItemsToOrder');
|
|
31
|
+
}
|
|
32
|
+
const firstError = result.errorResults[0];
|
|
33
|
+
if (firstError) {
|
|
34
|
+
throw new MutationError(firstError.errorCode, firstError.message, {
|
|
35
|
+
errorCode: firstError.errorCode,
|
|
36
|
+
message: firstError.message,
|
|
37
|
+
order: result.order,
|
|
38
|
+
errorResults: result.errorResults,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return result.order;
|
|
42
|
+
},
|
|
26
43
|
async updateCartLine(lineId, quantity) {
|
|
27
44
|
const data = await http.graphql(ADJUST_ORDER_LINE, {
|
|
28
45
|
lineId,
|
|
@@ -36,6 +53,10 @@ export function createCartMethods(http) {
|
|
|
36
53
|
});
|
|
37
54
|
return unwrapOrderResult(data, 'removeOrderLine');
|
|
38
55
|
},
|
|
56
|
+
async clearCart() {
|
|
57
|
+
const data = await http.graphql(REMOVE_ALL_ORDER_LINES);
|
|
58
|
+
return unwrapOrderResult(data, 'removeAllOrderLines');
|
|
59
|
+
},
|
|
39
60
|
async applyCouponCode(code) {
|
|
40
61
|
const data = await http.graphql(APPLY_COUPON, { code });
|
|
41
62
|
return unwrapOrderResult(data, 'applyCouponCode');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.js","sourceRoot":"","sources":["../../src/commerce/cart.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EACL,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,SAAS,iBAAiB,CAAC,IAA6B,EAAE,cAAsB;IAC9E,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAA4B,CAAC;IAC/D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,I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B,EAAE;gBAC1E,MAAM;aACP,CAAC,CAAC;YACH,OAAO,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;QACpD,CAAC;QAED,KAAK,CAAC,SAAS;YACb,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAA0B,sBAAsB,CAAC,CAAC;YACjF,OAAO,iBAAiB,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;QACxD,CAAC;QAED,KAAK,CAAC,eAAe,CAAC,IAAY;YAChC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAA0B,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;YACjF,OAAO,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;QACpD,CAAC;QAED,KAAK,CAAC,gBAAgB,CAAC,IAAY;YACjC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAA8B,aAAa,EAAE;gBAC1E,IAAI;aACL,CAAC,CAAC;YACH,OAAO,IAAI,CAAC,gBAAgB,CAAC;QAC/B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { HttpClient } from '../core/http.js';
|
|
2
|
-
import type { ActiveChannel, AddressInput, Country, Customer, CustomerAddress, CustomerInvoice, CustomerInvoicePdf, Order, OrderListOptions, OrderSummary, PaginatedList, RegisterInput, ReorderSkipped, UpdateAddressInput, UpdateCustomerInput } from '../types.js';
|
|
1
|
+
import type { HttpClient, RequestOptions } from '../core/http.js';
|
|
2
|
+
import type { ActiveChannel, AddressInput, Country, Customer, CustomerAddress, CustomerInvoice, CustomerInvoicePdf, CustomerPriceList, LoginResult, Order, OrderListOptions, OrderSummary, PaginatedList, RegisterInput, ReorderSkipped, UpdateAddressInput, UpdateCustomerInput } from '../types.js';
|
|
3
3
|
export declare function createCustomerMethods(http: HttpClient): {
|
|
4
|
-
login(email: string, password: string): Promise<
|
|
5
|
-
id: string;
|
|
6
|
-
identifier: string;
|
|
7
|
-
}>;
|
|
4
|
+
login(email: string, password: string): Promise<LoginResult>;
|
|
8
5
|
register(input: RegisterInput): Promise<{
|
|
9
6
|
success: boolean;
|
|
10
7
|
}>;
|
|
@@ -14,6 +11,15 @@ export declare function createCustomerMethods(http: HttpClient): {
|
|
|
14
11
|
identifier: string;
|
|
15
12
|
}>;
|
|
16
13
|
refreshVerification(emailAddress: string): Promise<void>;
|
|
14
|
+
requestMagicLink(emailAddress: string): Promise<void>;
|
|
15
|
+
loginWithMagicLink(token: string): Promise<{
|
|
16
|
+
id: string;
|
|
17
|
+
identifier: string;
|
|
18
|
+
}>;
|
|
19
|
+
loginWithMagicCode(emailAddress: string, code: string): Promise<{
|
|
20
|
+
id: string;
|
|
21
|
+
identifier: string;
|
|
22
|
+
}>;
|
|
17
23
|
updatePassword(currentPassword: string, newPassword: string): Promise<void>;
|
|
18
24
|
requestPasswordReset(emailAddress: string): Promise<void>;
|
|
19
25
|
resetPassword(token: string, password: string): Promise<{
|
|
@@ -23,6 +29,7 @@ export declare function createCustomerMethods(http: HttpClient): {
|
|
|
23
29
|
requestEmailUpdate(password: string, newEmailAddress: string): Promise<void>;
|
|
24
30
|
updateEmail(token: string): Promise<void>;
|
|
25
31
|
getCurrentCustomer(): Promise<Customer | null>;
|
|
32
|
+
getActiveCustomerPriceLists(options?: RequestOptions): Promise<CustomerPriceList[]>;
|
|
26
33
|
updateCustomer(input: UpdateCustomerInput): Promise<Customer>;
|
|
27
34
|
getCustomerOrders(options?: OrderListOptions): Promise<PaginatedList<OrderSummary>>;
|
|
28
35
|
createAddress(input: AddressInput): Promise<CustomerAddress>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.d.ts","sourceRoot":"","sources":["../../src/commerce/customer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"customer.d.ts","sourceRoot":"","sources":["../../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,CAAC,IAAI,CAAC;uBAQzD,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;0BAOnB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;0CAYR,cAAc,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;0BAS7D,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC;gCAKjC,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;yBAiB9D,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;yBAOvC,kBAAkB,GAAG,OAAO,CAAC,eAAe,CAAC;sBAOhD,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;6BAMf,OAAO,CAAC,OAAO,EAAE,CAAC;yBAKtB,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;kCASd,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;+BAatC,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;uBAexD,MAAM,GAChB,OAAO,CAAC;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,cAAc,EAAE,CAAA;KAAE,CAAC;wBAqCjD,OAAO,CAAC,aAAa,CAAC;EAKnD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MutationError } from '../errors.js';
|
|
2
|
-
import { ADD_TO_CART, AVAILABLE_COUNTRIES, CREATE_ADDRESS, DELETE_ADDRESS, GET_ACTIVE_CHANNEL, GET_CURRENT_CUSTOMER, GET_CUSTOMER_ORDERS, LOGIN, LOGOUT, MY_INVOICE_PDF, MY_ORDER_INVOICES, ORDER_BY_CODE, REFRESH_VERIFICATION, REGISTER, REQUEST_EMAIL_UPDATE, REQUEST_PASSWORD_RESET, RESET_PASSWORD, UPDATE_ADDRESS, UPDATE_CUSTOMER, UPDATE_EMAIL, UPDATE_PASSWORD, VERIFY_ACCOUNT, } from './queries.js';
|
|
2
|
+
import { ACTIVE_CUSTOMER_PRICE_LISTS, ADD_TO_CART, AVAILABLE_COUNTRIES, CREATE_ADDRESS, DELETE_ADDRESS, GET_ACTIVE_CHANNEL, GET_CURRENT_CUSTOMER, GET_CUSTOMER_ORDERS, LOGIN, LOGIN_WITH_MAGIC_CODE, LOGIN_WITH_MAGIC_LINK, LOGOUT, MY_INVOICE_PDF, MY_ORDER_INVOICES, ORDER_BY_CODE, REFRESH_VERIFICATION, REGISTER, REQUEST_EMAIL_UPDATE, REQUEST_MAGIC_LINK, REQUEST_PASSWORD_RESET, RESET_PASSWORD, UPDATE_ADDRESS, UPDATE_CUSTOMER, UPDATE_EMAIL, UPDATE_PASSWORD, VERIFY_ACCOUNT, } from './queries.js';
|
|
3
3
|
function unwrapResult(data, field) {
|
|
4
4
|
const result = data[field];
|
|
5
5
|
if (!result) {
|
|
@@ -14,7 +14,26 @@ export function createCustomerMethods(http) {
|
|
|
14
14
|
return {
|
|
15
15
|
async login(email, password) {
|
|
16
16
|
const data = await http.graphql(LOGIN, { email, password });
|
|
17
|
-
|
|
17
|
+
const result = data.login;
|
|
18
|
+
if (!result) {
|
|
19
|
+
throw new MutationError('UNKNOWN_ERROR', 'No result from login');
|
|
20
|
+
}
|
|
21
|
+
if ('errorCode' in result) {
|
|
22
|
+
const errorCode = result.errorCode;
|
|
23
|
+
const authenticationError = typeof result.authenticationError === 'string' ? result.authenticationError : undefined;
|
|
24
|
+
if (authenticationError === 'PASSWORD_RESET_REQUIRED') {
|
|
25
|
+
return { status: 'password_reset_required' };
|
|
26
|
+
}
|
|
27
|
+
if (authenticationError === 'ACCOUNT_NOT_VERIFIED' || errorCode === 'NOT_VERIFIED_ERROR') {
|
|
28
|
+
return { status: 'account_not_verified' };
|
|
29
|
+
}
|
|
30
|
+
throw new MutationError(errorCode, result.message, result);
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
status: 'success',
|
|
34
|
+
id: result.id,
|
|
35
|
+
identifier: result.identifier,
|
|
36
|
+
};
|
|
18
37
|
},
|
|
19
38
|
async register(input) {
|
|
20
39
|
const data = await http.graphql(REGISTER, { input });
|
|
@@ -36,6 +55,26 @@ export function createCustomerMethods(http) {
|
|
|
36
55
|
});
|
|
37
56
|
unwrapResult(data, 'refreshCustomerVerification');
|
|
38
57
|
},
|
|
58
|
+
async requestMagicLink(emailAddress) {
|
|
59
|
+
const data = await http.graphql(REQUEST_MAGIC_LINK, {
|
|
60
|
+
emailAddress,
|
|
61
|
+
});
|
|
62
|
+
const result = data.requestMagicLink;
|
|
63
|
+
if (result && 'errorCode' in result) {
|
|
64
|
+
throw new MutationError(result.errorCode, result.message, result);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
async loginWithMagicLink(token) {
|
|
68
|
+
const data = await http.graphql(LOGIN_WITH_MAGIC_LINK, { token });
|
|
69
|
+
return unwrapResult(data, 'loginWithMagicLink');
|
|
70
|
+
},
|
|
71
|
+
async loginWithMagicCode(emailAddress, code) {
|
|
72
|
+
const data = await http.graphql(LOGIN_WITH_MAGIC_CODE, {
|
|
73
|
+
emailAddress,
|
|
74
|
+
code,
|
|
75
|
+
});
|
|
76
|
+
return unwrapResult(data, 'loginWithMagicCode');
|
|
77
|
+
},
|
|
39
78
|
async updatePassword(currentPassword, newPassword) {
|
|
40
79
|
const data = await http.graphql(UPDATE_PASSWORD, {
|
|
41
80
|
currentPassword,
|
|
@@ -74,6 +113,10 @@ export function createCustomerMethods(http) {
|
|
|
74
113
|
const data = await http.graphql(GET_CURRENT_CUSTOMER);
|
|
75
114
|
return data.activeCustomer;
|
|
76
115
|
},
|
|
116
|
+
async getActiveCustomerPriceLists(options) {
|
|
117
|
+
const data = await http.graphql(ACTIVE_CUSTOMER_PRICE_LISTS, undefined, options);
|
|
118
|
+
return data.activeCustomerPriceLists;
|
|
119
|
+
},
|
|
77
120
|
async updateCustomer(input) {
|
|
78
121
|
const data = await http.graphql(UPDATE_CUSTOMER, { input });
|
|
79
122
|
return data.updateCustomer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.js","sourceRoot":"","sources":["../../src/commerce/customer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"customer.js","sourceRoot":"","sources":["../../src/commerce/customer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAoB7C,OAAO,EACL,2BAA2B,EAC3B,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,KAAK,EACL,qBAAqB,EACrB,qBAAqB,EACrB,MAAM,EACN,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,QAAQ,EACR,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,SAAS,YAAY,CAAC,IAA6B,EAAE,KAAa;IAChE,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAwC,CAAC;IAClE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,aAAa,CAAC,eAAe,EAAE,kBAAkB,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,IAAI,WAAW,IAAI,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,aAAa,CAAC,MAAM,CAAC,SAAmB,EAAE,MAAM,CAAC,OAAiB,EAAE,MAAM,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAgB;IACpD,OAAO;QAiBL,KAAK,CAAC,KAAK,CAAC,KAAa,EAAE,QAAgB;YACzC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAA0B,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;Y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AAC,KAAK,EAAE,CAAC;gBAClC,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC;gBACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;gBAC/B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAA8C,WAAW,EAAE;oBACxF,SAAS;oBACT,QAAQ;iBACT,CAAC,CAAC;gBACH,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC;gBACnC,IAAI,MAAM,IAAI,WAAW,IAAI,MAAM,EAAE,CAAC;oBACpC,OAAO,CAAC,IAAI,CAAC;wBACX,SAAS;wBACT,QAAQ;wBACR,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;wBACnC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;qBACtC,CAAC,CAAC;oBACH,SAAS;gBACX,CAAC;gBACD,WAAW,GAAG,MAA0B,CAAC;gBACzC,UAAU,IAAI,CAAC,CAAC;YAClB,CAAC;YAED,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,MAAM,IAAI,aAAa,CACrB,wBAAwB,EACxB,qCAAqC,SAAS,EAAE,EAChD,EAAE,OAAO,EAAE,CACZ,CAAC;YACJ,CAAC;YACD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;QACrD,CAAC;QAED,KAAK,CAAC,gBAAgB;YACpB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAmC,kBAAkB,CAAC,CAAC;YACtF,OAAO,IAAI,CAAC,aAAa,CAAC;QAC5B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HttpClient } from '../core/http.js';
|
|
2
|
-
import type { Collection, CollectionDetail, CollectionListOptions, Facet, PaginatedList, Product, ProductListOptions, ProductPropertyGroupValues, ProductSummary, PropertyGroup, RequestOptions } from '../types.js';
|
|
2
|
+
import type { Collection, CollectionDetail, CollectionListOptions, Facet, PaginatedList, Product, ProductListOptions, ProductPropertyGroupValues, ProductPropertyRecord, ProductSummary, PropertyGroup, RequestOptions } from '../types.js';
|
|
3
|
+
export declare function mapProductProperties(groups: ProductPropertyGroupValues[]): ProductPropertyRecord;
|
|
3
4
|
export declare function createProductMethods(http: HttpClient): {
|
|
4
5
|
getProduct(slug: string, options?: RequestOptions): Promise<Product>;
|
|
5
6
|
getProductById(id: string, options?: RequestOptions): Promise<Product>;
|
|
@@ -9,5 +10,6 @@ export declare function createProductMethods(http: HttpClient): {
|
|
|
9
10
|
getCollection(slug: string, options?: RequestOptions): Promise<CollectionDetail>;
|
|
10
11
|
getPropertyGroups(options?: RequestOptions): Promise<PropertyGroup[]>;
|
|
11
12
|
getProductProperties(productId: string, options?: RequestOptions): Promise<ProductPropertyGroupValues[]>;
|
|
13
|
+
mapProductProperties: typeof mapProductProperties;
|
|
12
14
|
};
|
|
13
15
|
//# sourceMappingURL=products.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../src/commerce/products.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,EACL,aAAa,EACb,OAAO,EACP,kBAAkB,EAClB,0BAA0B,EAC1B,cAAc,EACd,aAAa,EACb,cAAc,EAEf,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../src/commerce/products.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,KAAK,EACL,aAAa,EACb,OAAO,EACP,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,cAAc,EAEf,MAAM,aAAa,CAAC;AA2FrB,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,0BAA0B,EAAE,GAAG,qBAAqB,CAUhG;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,UAAU;qBAE1B,MAAM,YAAY,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;uBAKjD,MAAM,YAAY,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;8BAM5D,kBAAkB,YACtB,cAAc,GACvB,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;wBA4Cf,cAAc,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;iCAU3C,qBAAqB,YACzB,cAAc,GACvB,OAAO,CAAC,UAAU,EAAE,CAAC;wBAWE,MAAM,YAAY,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;gCASpD,cAAc,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;oCAU9D,MAAM,YACP,cAAc,GACvB,OAAO,CAAC,0BAA0B,EAAE,CAAC;;EAS3C"}
|
|
@@ -28,7 +28,7 @@ function searchItemToProductSummary(item) {
|
|
|
28
28
|
: null,
|
|
29
29
|
variants: [
|
|
30
30
|
{
|
|
31
|
-
id: item.
|
|
31
|
+
id: item.productVariantId,
|
|
32
32
|
name: item.productName,
|
|
33
33
|
sku: '',
|
|
34
34
|
price,
|
|
@@ -48,6 +48,18 @@ function priceValueOrMin(value) {
|
|
|
48
48
|
return value.min;
|
|
49
49
|
return 0;
|
|
50
50
|
}
|
|
51
|
+
export function mapProductProperties(groups) {
|
|
52
|
+
const record = {};
|
|
53
|
+
for (const { group, values } of groups) {
|
|
54
|
+
const slugByPropertyId = new Map(group.properties.map((p) => [p.id, p.slug]));
|
|
55
|
+
for (const value of values) {
|
|
56
|
+
const slug = slugByPropertyId.get(value.propertyId);
|
|
57
|
+
if (slug !== undefined)
|
|
58
|
+
record[slug] = value.value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return record;
|
|
62
|
+
}
|
|
51
63
|
export function createProductMethods(http) {
|
|
52
64
|
return {
|
|
53
65
|
async getProduct(slug, options) {
|
|
@@ -109,6 +121,7 @@ export function createProductMethods(http) {
|
|
|
109
121
|
const data = await http.graphql(PRODUCT_PROPERTIES, { productId }, options);
|
|
110
122
|
return data.productPropertyValues;
|
|
111
123
|
},
|
|
124
|
+
mapProductProperties,
|
|
112
125
|
};
|
|
113
126
|
}
|
|
114
127
|
//# sourceMappingURL=products.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/commerce/products.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAA2B,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/commerce/products.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAA2B,MAAM,2BAA2B,CAAC;AAgB1F,OAAO,EACL,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,eAAe,GAChB,MAAM,cAAc,CAAC;AAMtB,SAAS,sBAAsB,CAAC,OAAgB;IAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,QAA4D,CAAC;IACjF,OAAO,EAAE,GAAG,OAAO,EAAE,QAAQ,EAAE,oBAAoB,CAAC,GAAG,IAAI,IAAI,CAAC,EAAE,CAAC;AACrE,CAAC;AASD,SAAS,0BAA0B,CAAC,IAA4C;IAC9E,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC;IAC9C,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,SAA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AI,CAAC,MAAM,CAAC,KAAK,CAAC;QAC3B,CAAC;QAED,KAAK,CAAC,cAAc,CAClB,WAAmC,EACnC,OAAwB;YAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAC7B,gBAAgB,EAChB;gBACE,OAAO,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,IAAI,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,IAAI,CAAC,EAAE;aAC1E,EACD,OAAO,CACR,CAAC;YACF,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;QAChC,CAAC;QAED,KAAK,CAAC,aAAa,CAAC,IAAY,EAAE,OAAwB;YACxD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAC7B,cAAc,EACd,EAAE,IAAI,EAAE,EACR,OAAO,CACR,CAAC;YACF,OAAO,IAAI,CAAC,UAAU,CAAC;QACzB,CAAC;QAED,KAAK,CAAC,iBAAiB,CAAC,OAAwB;YAC9C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAC7B,eAAe,EACf,SAAS,EACT,OAAO,CACR,CAAC;YACF,OAAO,IAAI,CAAC,qBAAqB,CAAC;QACpC,CAAC;QAED,KAAK,CAAC,oBAAoB,CACxB,SAAiB,EACjB,OAAwB;YAExB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAE5B,kBAAkB,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;YAC/C,OAAO,IAAI,CAAC,qBAAqB,CAAC;QACpC,CAAC;QAED,oBAAoB;KACrB,CAAC;AACJ,CAAC"}
|
|
@@ -4,13 +4,15 @@ export declare const LIST_PRODUCTS = "\n query ListProducts($options: ProductLi
|
|
|
4
4
|
export declare const LIST_FACETS = "\n query ListFacets {\n facets {\n items {\n id name code\n values { id name code }\n }\n totalItems\n }\n }\n";
|
|
5
5
|
export declare const LIST_COLLECTIONS = "\n query ListCollections($options: CollectionListOptions) {\n collections(options: $options) {\n items {\n id name slug description\n breadcrumbs { id name slug }\n featuredAsset {\n source\n presets { xs { url webpUrl } m { url webpUrl } }\n }\n parent { id name slug }\n children { id name slug }\n }\n totalItems\n }\n }\n";
|
|
6
6
|
export declare const GET_COLLECTION = "\n query GetCollection($slug: String!) {\n collection(slug: $slug) {\n id name slug description\n featuredAsset {\n source\n presets { l { url webpUrl } xl { url webpUrl } }\n }\n breadcrumbs { id name slug }\n children { id name slug }\n productVariants(options: { take: 20 }) {\n items {\n id\n product {\n id name slug\n featuredAsset { source presets { m { url webpUrl } } }\n }\n price priceWithTax currencyCode stockLevel\n stockOnHand stockAllocated saleable\n priceListName retailPrice retailPriceWithTax\n priceTiers { minQuantity price priceWithTax discountLabel }\n availabilityByLocation { locationId locationName inStock }\n customFields { minOrderQuantity salesUnit position }\n }\n totalItems\n }\n }\n }\n";
|
|
7
|
-
export declare const SEARCH_PRODUCTS = "\n query SearchProducts($input: SearchInput!) {\n search(input: $input) {\n items {\n productId productName slug description\n price { ... on SinglePrice { value } ... on PriceRange { min max } }\n priceWithTax { ... on SinglePrice { value } ... on PriceRange { min max } }\n currencyCode\n productAsset { preview focalPoint { x y } }\n collectionIds\n inStock\n }\n totalItems\n facetValues { facetValue { id name code facet { id name code } } count }\n }\n }\n";
|
|
8
|
-
export declare const ACTIVE_ORDER = "\n query ActiveOrder {\n activeOrder { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n }\n";
|
|
9
|
-
export declare const ADD_TO_CART = "\n mutation AddToCart($variantId: ID!, $quantity: Int!) {\n addItemToOrder(productVariantId: $variantId, quantity: $quantity) {\n ... on Order { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n ... on OrderModificationError { errorCode message }\n ... on OrderLimitError { errorCode message maxItems }\n ... on NegativeQuantityError { errorCode message }\n ... on InsufficientStockError { errorCode message quantityAvailable order { id } }\n }\n }\n";
|
|
10
|
-
export declare const ADJUST_ORDER_LINE = "\n mutation AdjustOrderLine($lineId: ID!, $quantity: Int!) {\n adjustOrderLine(orderLineId: $lineId, quantity: $quantity) {\n ... on Order { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n ... on OrderModificationError { errorCode message }\n ... on OrderLimitError { errorCode message maxItems }\n ... on NegativeQuantityError { errorCode message }\n ... on InsufficientStockError { errorCode message quantityAvailable }\n }\n }\n";
|
|
11
|
-
export declare const REMOVE_ORDER_LINE = "\n mutation RemoveOrderLine($lineId: ID!) {\n removeOrderLine(orderLineId: $lineId) {\n ... on Order { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n ... on OrderModificationError { errorCode message }\n }\n }\n";
|
|
12
|
-
export declare const APPLY_COUPON = "\n mutation ApplyCoupon($code: String!) {\n applyCouponCode(couponCode: $code) {\n ... on Order { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n ... on CouponCodeExpiredError { errorCode message couponCode }\n ... on CouponCodeInvalidError { errorCode message couponCode }\n ... on CouponCodeLimitError { errorCode message couponCode limit }\n }\n }\n";
|
|
13
|
-
export declare const REMOVE_COUPON = "\n mutation RemoveCoupon($code: String!) {\n removeCouponCode(couponCode: $code) { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n }\n";
|
|
7
|
+
export declare const SEARCH_PRODUCTS = "\n query SearchProducts($input: SearchInput!) {\n search(input: $input) {\n items {\n productId productVariantId productName slug description\n price { ... on SinglePrice { value } ... on PriceRange { min max } }\n priceWithTax { ... on SinglePrice { value } ... on PriceRange { min max } }\n currencyCode\n productAsset { preview focalPoint { x y } }\n collectionIds\n inStock\n }\n totalItems\n facetValues { facetValue { id name code facet { id name code } } count }\n }\n }\n";
|
|
8
|
+
export declare const ACTIVE_ORDER = "\n query ActiveOrder {\n activeOrder { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingLines { shippingMethod { id name code } priceWithTax }\n payments { id method amount state transactionId }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n }\n";
|
|
9
|
+
export declare const ADD_TO_CART = "\n mutation AddToCart($variantId: ID!, $quantity: Int!) {\n addItemToOrder(productVariantId: $variantId, quantity: $quantity) {\n ... on Order { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingLines { shippingMethod { id name code } priceWithTax }\n payments { id method amount state transactionId }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n ... on OrderModificationError { errorCode message }\n ... on OrderLimitError { errorCode message maxItems }\n ... on NegativeQuantityError { errorCode message }\n ... on InsufficientStockError { errorCode message quantityAvailable order { id } }\n }\n }\n";
|
|
10
|
+
export declare const ADJUST_ORDER_LINE = "\n mutation AdjustOrderLine($lineId: ID!, $quantity: Int!) {\n adjustOrderLine(orderLineId: $lineId, quantity: $quantity) {\n ... on Order { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingLines { shippingMethod { id name code } priceWithTax }\n payments { id method amount state transactionId }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n ... on OrderModificationError { errorCode message }\n ... on OrderLimitError { errorCode message maxItems }\n ... on NegativeQuantityError { errorCode message }\n ... on InsufficientStockError { errorCode message quantityAvailable }\n }\n }\n";
|
|
11
|
+
export declare const REMOVE_ORDER_LINE = "\n mutation RemoveOrderLine($lineId: ID!) {\n removeOrderLine(orderLineId: $lineId) {\n ... on Order { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingLines { shippingMethod { id name code } priceWithTax }\n payments { id method amount state transactionId }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n ... on OrderModificationError { errorCode message }\n }\n }\n";
|
|
12
|
+
export declare const APPLY_COUPON = "\n mutation ApplyCoupon($code: String!) {\n applyCouponCode(couponCode: $code) {\n ... on Order { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingLines { shippingMethod { id name code } priceWithTax }\n payments { id method amount state transactionId }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n ... on CouponCodeExpiredError { errorCode message couponCode }\n ... on CouponCodeInvalidError { errorCode message couponCode }\n ... on CouponCodeLimitError { errorCode message couponCode limit }\n }\n }\n";
|
|
13
|
+
export declare const REMOVE_COUPON = "\n mutation RemoveCoupon($code: String!) {\n removeCouponCode(couponCode: $code) { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingLines { shippingMethod { id name code } priceWithTax }\n payments { id method amount state transactionId }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n }\n";
|
|
14
|
+
export declare const REMOVE_ALL_ORDER_LINES = "\n mutation RemoveAllOrderLines {\n removeAllOrderLines {\n ... on Order { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingLines { shippingMethod { id name code } priceWithTax }\n payments { id method amount state transactionId }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n ... on OrderModificationError { errorCode message }\n }\n }\n";
|
|
15
|
+
export declare const ADD_ITEMS_TO_CART = "\n mutation AddItemsToCart($inputs: [AddItemInput!]!) {\n addItemsToOrder(inputs: $inputs) {\n order { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingLines { shippingMethod { id name code } priceWithTax }\n payments { id method amount state transactionId }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n errorResults {\n ... on OrderModificationError { errorCode message }\n ... on OrderLimitError { errorCode message maxItems }\n ... on NegativeQuantityError { errorCode message }\n ... on InsufficientStockError { errorCode message quantityAvailable }\n ... on OrderInterceptorError { errorCode message interceptorError }\n }\n }\n }\n";
|
|
14
16
|
export declare const SET_CUSTOMER = "\n mutation SetCustomer($input: CreateCustomerInput!) {\n setCustomerForOrder(input: $input) {\n ... on Order {\n id customer { id firstName lastName emailAddress }\n }\n ... on AlreadyLoggedInError { errorCode message }\n ... on EmailAddressConflictError { errorCode message }\n ... on GuestCheckoutError { errorCode message }\n ... on NoActiveOrderError { errorCode message }\n }\n }\n";
|
|
15
17
|
export declare const SET_SHIPPING_ADDRESS = "\n mutation SetShippingAddress($input: CreateAddressInput!) {\n setOrderShippingAddress(input: $input) {\n ... on Order {\n id shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n }\n ... on NoActiveOrderError { errorCode message }\n }\n }\n";
|
|
16
18
|
export declare const SET_BILLING_ADDRESS = "\n mutation SetBillingAddress($input: CreateAddressInput!) {\n setOrderBillingAddress(input: $input) {\n ... on Order {\n id\n }\n ... on NoActiveOrderError { errorCode message }\n }\n }\n";
|
|
@@ -29,13 +31,17 @@ export declare const CREATE_MOLLIE_PAYMENT_INTENT = "\n mutation CreateMolliePa
|
|
|
29
31
|
export declare const SYNC_MOLLIE_PAYMENT_STATUS = "\n mutation SyncMolliePaymentStatus($orderCode: String!) {\n syncMolliePaymentStatus(orderCode: $orderCode) {\n id\n code\n state\n }\n }\n";
|
|
30
32
|
export declare const LOGIN = "\n mutation Login($email: String!, $password: String!) {\n login(username: $email, password: $password) {\n ... on CurrentUser { id identifier }\n ... on InvalidCredentialsError { errorCode message authenticationError }\n ... on NotVerifiedError { errorCode message }\n ... on NativeAuthStrategyError { errorCode message }\n }\n }\n";
|
|
31
33
|
export declare const REGISTER = "\n mutation Register($input: RegisterCustomerInput!) {\n registerCustomerAccount(input: $input) {\n ... on Success { success }\n ... on MissingPasswordError { errorCode message }\n ... on PasswordValidationError { errorCode message validationErrorMessage }\n ... on NativeAuthStrategyError { errorCode message }\n }\n }\n";
|
|
32
|
-
export declare const GET_CURRENT_CUSTOMER = "\n query Me {\n activeCustomer {\n id firstName lastName emailAddress phoneNumber\n addresses {\n id fullName streetLine1 streetLine2 city province postalCode\n country { code name }\n defaultShippingAddress defaultBillingAddress\n }\n orders(options: { take: 10, sort: { createdAt: DESC } }) {\n items {\n id code state totalWithTax createdAt\n
|
|
33
|
-
export declare const
|
|
34
|
+
export declare const GET_CURRENT_CUSTOMER = "\n query Me {\n activeCustomer {\n id firstName lastName emailAddress phoneNumber\n groups { id name }\n addresses {\n id fullName streetLine1 streetLine2 city province postalCode\n country { code name }\n defaultShippingAddress defaultBillingAddress\n }\n orders(options: { take: 10, sort: { createdAt: DESC } }) {\n items {\n \n id code state totalWithTax createdAt\n lines {\n id quantity linePriceWithTax\n productVariant {\n id name sku\n product { slug featuredAsset { preview presets { xs { webpUrl } } } }\n }\n }\n \n fulfillments {\n id state method trackingCode createdAt updatedAt\n lines { orderLineId quantity }\n }\n\n\n }\n totalItems\n }\n }\n }\n";
|
|
35
|
+
export declare const ACTIVE_CUSTOMER_PRICE_LISTS = "\n query ActiveCustomerPriceLists {\n activeCustomerPriceLists { id name isContract }\n }\n";
|
|
36
|
+
export declare const GET_CUSTOMER_ORDERS = "\n query CustomerOrders($options: OrderListOptions) {\n activeCustomer {\n orders(options: $options) {\n items {\n \n id code state totalWithTax createdAt\n lines {\n id quantity linePriceWithTax\n productVariant {\n id name sku\n product { slug featuredAsset { preview presets { xs { webpUrl } } } }\n }\n }\n \n fulfillments {\n id state method trackingCode createdAt updatedAt\n lines { orderLineId quantity }\n }\n\n\n }\n totalItems\n }\n }\n }\n";
|
|
34
37
|
export declare const LOGOUT = "\n mutation Logout {\n logout { success }\n }\n";
|
|
35
38
|
export declare const UPDATE_CUSTOMER = "\n mutation UpdateCustomer($input: UpdateCustomerInput!) {\n updateCustomer(input: $input) {\n id firstName lastName emailAddress phoneNumber\n }\n }\n";
|
|
36
39
|
export declare const UPDATE_PASSWORD = "\n mutation UpdatePassword($currentPassword: String!, $newPassword: String!) {\n updateCustomerPassword(currentPassword: $currentPassword, newPassword: $newPassword) {\n ... on Success { success }\n ... on InvalidCredentialsError { errorCode message }\n ... on PasswordValidationError { errorCode message validationErrorMessage }\n ... on NativeAuthStrategyError { errorCode message }\n }\n }\n";
|
|
37
40
|
export declare const REQUEST_PASSWORD_RESET = "\n mutation RequestPasswordReset($emailAddress: String!) {\n requestPasswordReset(emailAddress: $emailAddress) {\n ... on Success { success }\n ... on NativeAuthStrategyError { errorCode message }\n }\n }\n";
|
|
38
41
|
export declare const RESET_PASSWORD = "\n mutation ResetPassword($token: String!, $password: String!) {\n resetPassword(token: $token, password: $password) {\n ... on CurrentUser { id identifier }\n ... on PasswordResetTokenInvalidError { errorCode message }\n ... on PasswordResetTokenExpiredError { errorCode message }\n ... on PasswordValidationError { errorCode message validationErrorMessage }\n ... on NativeAuthStrategyError { errorCode message }\n ... on NotVerifiedError { errorCode message }\n }\n }\n";
|
|
42
|
+
export declare const REQUEST_MAGIC_LINK = "\n mutation RequestMagicLink($emailAddress: String!) {\n requestMagicLink(emailAddress: $emailAddress) {\n ... on Success { success }\n ... on NativeAuthStrategyError { errorCode message }\n }\n }\n";
|
|
43
|
+
export declare const LOGIN_WITH_MAGIC_LINK = "\n mutation LoginWithMagicLink($token: String!) {\n loginWithMagicLink(token: $token) {\n ... on CurrentUser { id identifier }\n ... on MagicLinkInvalidError { errorCode message }\n ... on MagicLinkExpiredError { errorCode message }\n ... on MagicLinkLockedError { errorCode message }\n ... on NotVerifiedError { errorCode message }\n ... on NativeAuthStrategyError { errorCode message }\n }\n }\n";
|
|
44
|
+
export declare const LOGIN_WITH_MAGIC_CODE = "\n mutation LoginWithMagicCode($emailAddress: String!, $code: String!) {\n loginWithMagicCode(emailAddress: $emailAddress, code: $code) {\n ... on CurrentUser { id identifier }\n ... on MagicLinkInvalidError { errorCode message }\n ... on MagicLinkExpiredError { errorCode message }\n ... on MagicLinkLockedError { errorCode message }\n ... on NotVerifiedError { errorCode message }\n ... on NativeAuthStrategyError { errorCode message }\n }\n }\n";
|
|
39
45
|
export declare const REQUEST_EMAIL_UPDATE = "\n mutation RequestEmailUpdate($password: String!, $newEmailAddress: String!) {\n requestUpdateCustomerEmailAddress(password: $password, newEmailAddress: $newEmailAddress) {\n ... on Success { success }\n ... on InvalidCredentialsError { errorCode message }\n ... on EmailAddressConflictError { errorCode message }\n ... on NativeAuthStrategyError { errorCode message }\n }\n }\n";
|
|
40
46
|
export declare const UPDATE_EMAIL = "\n mutation UpdateEmail($token: String!) {\n updateCustomerEmailAddress(token: $token) {\n ... on Success { success }\n ... on IdentifierChangeTokenInvalidError { errorCode message }\n ... on IdentifierChangeTokenExpiredError { errorCode message }\n ... on NativeAuthStrategyError { errorCode message }\n }\n }\n";
|
|
41
47
|
export declare const VERIFY_ACCOUNT = "\n mutation VerifyAccount($token: String!, $password: String) {\n verifyCustomerAccount(token: $token, password: $password) {\n ... on CurrentUser { id identifier }\n ... on VerificationTokenInvalidError { errorCode message }\n ... on VerificationTokenExpiredError { errorCode message }\n ... on MissingPasswordError { errorCode message }\n ... on PasswordAlreadySetError { errorCode message }\n ... on PasswordValidationError { errorCode message validationErrorMessage }\n ... on NativeAuthStrategyError { errorCode message }\n }\n }\n";
|
|
@@ -44,7 +50,7 @@ export declare const CREATE_ADDRESS = "\n mutation CreateAddress($input: Create
|
|
|
44
50
|
export declare const UPDATE_ADDRESS = "\n mutation UpdateAddress($input: UpdateAddressInput!) {\n updateCustomerAddress(input: $input) {\n id fullName streetLine1 streetLine2 city province postalCode\n country { code name }\n defaultShippingAddress defaultBillingAddress\n }\n }\n";
|
|
45
51
|
export declare const DELETE_ADDRESS = "\n mutation DeleteAddress($id: ID!) {\n deleteCustomerAddress(id: $id) {\n success\n }\n }\n";
|
|
46
52
|
export declare const AVAILABLE_COUNTRIES = "\n query AvailableCountries {\n availableCountries {\n id code name\n }\n }\n";
|
|
47
|
-
export declare const ORDER_BY_CODE = "\n query OrderByCode($code: String!) {\n orderByCode(code: $code) {\n \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n\n \n fulfillments {\n id state method trackingCode createdAt updatedAt\n lines { orderLineId quantity }\n }\n\n }\n }\n";
|
|
53
|
+
export declare const ORDER_BY_CODE = "\n query OrderByCode($code: String!) {\n orderByCode(code: $code) {\n \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingLines { shippingMethod { id name code } priceWithTax }\n payments { id method amount state transactionId }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n\n \n fulfillments {\n id state method trackingCode createdAt updatedAt\n lines { orderLineId quantity }\n }\n\n }\n }\n";
|
|
48
54
|
export declare const FAVORITE_VARIANT_IDS = "\n query FavoriteVariantIds {\n favoriteProductVariantIds\n }\n";
|
|
49
55
|
export declare const MY_FAVORITES = "\n query MyFavorites($options: FavoriteListOptions) {\n myFavorites(options: $options) {\n items {\n id\n productVariantId\n createdAt\n productVariant {\n id name sku\n price priceWithTax currencyCode stockLevel\n stockOnHand stockAllocated saleable\n priceListName retailPrice retailPriceWithTax\n priceTiers { minQuantity price priceWithTax discountLabel }\n availabilityByLocation { locationId locationName inStock }\n product {\n id name slug\n featuredAsset {\n source\n customFields { altText }\n presets { xs { url webpUrl } m { url webpUrl } l { url webpUrl } }\n }\n }\n options { id name group { name } }\n customFields { minOrderQuantity salesUnit position }\n }\n }\n totalItems\n }\n }\n";
|
|
50
56
|
export declare const TOGGLE_FAVORITE = "\n mutation ToggleFavorite($productVariantId: ID!) {\n toggleFavorite(productVariantId: $productVariantId)\n }\n";
|
|
@@ -62,7 +68,7 @@ export declare const CONVERT_TO_MULTIPLE = "\n query ConvertToMultiple($amount:
|
|
|
62
68
|
export declare const MY_QUOTES = "\n query MyQuotes($options: QuoteListOptions) {\n myQuotes(options: $options) {\n items { \n id code channelId customerId currencyCode status\n expiresAt salesRepUserId customerNotes convertedOrderId\n createdAt updatedAt\n lines {\n id productVariantId quantity unitPrice discountLabel position\n createdAt updatedAt\n }\n }\n totalItems\n }\n }\n";
|
|
63
69
|
export declare const MY_QUOTE = "\n query MyQuote($id: ID!) {\n myQuote(id: $id) { \n id code channelId customerId currencyCode status\n expiresAt salesRepUserId customerNotes convertedOrderId\n createdAt updatedAt\n lines {\n id productVariantId quantity unitPrice discountLabel position\n createdAt updatedAt\n }\n }\n }\n";
|
|
64
70
|
export declare const CREATE_QUOTE_REQUEST = "\n mutation CreateQuoteRequest($input: CreateQuoteRequestInput!) {\n createQuoteRequest(input: $input) { \n id code channelId customerId currencyCode status\n expiresAt salesRepUserId customerNotes convertedOrderId\n createdAt updatedAt\n lines {\n id productVariantId quantity unitPrice discountLabel position\n createdAt updatedAt\n }\n }\n }\n";
|
|
65
|
-
export declare const ACCEPT_QUOTE = "\n mutation AcceptQuote($id: ID!) {\n acceptQuote(id: $id) { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n }\n";
|
|
71
|
+
export declare const ACCEPT_QUOTE = "\n mutation AcceptQuote($id: ID!) {\n acceptQuote(id: $id) { \n id code state active\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax\n linePrice linePriceWithTax\n discountedLinePrice discountedLinePriceWithTax\n discounts { adjustmentSource type description amount amountWithTax }\n productVariant {\n id name sku\n product { id name slug }\n options { id name group { name } }\n }\n featuredAsset { source presets { xs { url webpUrl } } }\n }\n discounts { adjustmentSource type description amount amountWithTax }\n taxSummary { description taxRate taxBase taxTotal }\n promotions { id name couponCode description }\n shippingLines { shippingMethod { id name code } priceWithTax }\n payments { id method amount state transactionId }\n shippingAddress { fullName streetLine1 streetLine2 city province postalCode countryCode }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n }\n";
|
|
66
72
|
export declare const CANCEL_MY_QUOTE = "\n mutation CancelMyQuote($id: ID!, $reason: String) {\n cancelMyQuote(id: $id, reason: $reason) { \n id code channelId customerId currencyCode status\n expiresAt salesRepUserId customerNotes convertedOrderId\n createdAt updatedAt\n lines {\n id productVariantId quantity unitPrice discountLabel position\n createdAt updatedAt\n }\n }\n }\n";
|
|
67
73
|
export declare const GET_BRANDING = "\n query GetBranding($ids: [ID!]!) {\n activeChannel {\n id\n defaultLanguageCode\n availableLanguageCodes\n defaultCurrencyCode\n }\n fontResources {\n id\n identifier\n kind\n family\n weights\n files {\n id\n source\n preview\n mimeType\n }\n }\n brandingAssets(ids: $ids) {\n id\n source\n preview\n mimeType\n }\n }\n";
|
|
68
74
|
export declare const ACTIVE_CHANNEL_ORDER_CONSTRAINTS = "\n query ActiveChannelOrderConstraints {\n activeChannelOrderConstraints {\n minOrderAmountGross\n fulfillmentMinOrderNet\n currencyCode\n customerIsExempt\n }\n }\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/commerce/queries.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,WAAW,khFAwDvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,4gFAwD7B,CAAC;AAEF,eAAO,MAAM,aAAa,ikCA+BzB,CAAC;AAEF,eAAO,MAAM,WAAW,wJAUvB,CAAC;AAIF,eAAO,MAAM,gBAAgB,6ZAgB5B,CAAC;AAEF,eAA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