@sixtyninecommerce/client 0.22.0 → 0.23.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 +51 -0
- package/dist/cache-tags.d.ts +8 -0
- package/dist/cache-tags.d.ts.map +1 -0
- package/dist/cache-tags.js +15 -0
- package/dist/cache-tags.js.map +1 -0
- package/dist/commerce/index.d.ts +160 -2
- package/dist/commerce/index.d.ts.map +1 -1
- package/dist/commerce/index.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 +33 -9
- package/dist/commerce/products.js.map +1 -1
- package/dist/commerce/queries.d.ts +1 -0
- package/dist/commerce/queries.d.ts.map +1 -1
- package/dist/commerce/queries.js +10 -4
- package/dist/commerce/queries.js.map +1 -1
- package/dist/commerce/search.d.ts +1 -1
- package/dist/commerce/search.d.ts.map +1 -1
- package/dist/commerce/search.js +7 -1
- package/dist/commerce/search.js.map +1 -1
- package/dist/content/index.d.ts +26 -2
- package/dist/content/index.d.ts.map +1 -1
- package/dist/content/index.js.map +1 -1
- package/dist/core/context.d.ts.map +1 -1
- package/dist/core/context.js +6 -0
- package/dist/core/context.js.map +1 -1
- package/dist/core/http.d.ts +6 -0
- package/dist/core/http.d.ts.map +1 -1
- package/dist/core/http.js +26 -2
- package/dist/core/http.js.map +1 -1
- package/dist/credit/index.d.ts +4 -2
- package/dist/credit/index.d.ts.map +1 -1
- package/dist/credit/index.js.map +1 -1
- package/dist/events/index.d.ts +8 -0
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +4 -0
- package/dist/events/index.js.map +1 -1
- package/dist/events/payloads.d.ts +154 -0
- package/dist/events/payloads.d.ts.map +1 -0
- package/dist/events/payloads.js +2 -0
- package/dist/events/payloads.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/navigation/routes.d.ts +2 -2
- package/dist/navigation/routes.d.ts.map +1 -1
- package/dist/navigation/routes.js +2 -1
- package/dist/navigation/routes.js.map +1 -1
- package/dist/next/artifact-handler.d.ts.map +1 -1
- package/dist/next/artifact-handler.js +5 -2
- package/dist/next/artifact-handler.js.map +1 -1
- package/dist/next/event-revalidate-handler.d.ts +14 -0
- package/dist/next/event-revalidate-handler.d.ts.map +1 -0
- package/dist/next/event-revalidate-handler.js +102 -0
- package/dist/next/event-revalidate-handler.js.map +1 -0
- package/dist/next/index.d.ts +5 -0
- package/dist/next/index.d.ts.map +1 -1
- package/dist/next/index.js +2 -0
- package/dist/next/index.js.map +1 -1
- package/dist/next/revalidate-handler.d.ts.map +1 -1
- package/dist/next/revalidate-handler.js.map +1 -1
- package/dist/revalidation/event-plan.d.ts +39 -0
- package/dist/revalidation/event-plan.d.ts.map +1 -0
- package/dist/revalidation/event-plan.js +223 -0
- package/dist/revalidation/event-plan.js.map +1 -0
- package/dist/revalidation/event-verify.d.ts +16 -0
- package/dist/revalidation/event-verify.d.ts.map +1 -0
- package/dist/revalidation/event-verify.js +74 -0
- package/dist/revalidation/event-verify.js.map +1 -0
- package/dist/revalidation/types.d.ts.map +1 -1
- package/dist/revalidation/url-context.d.ts +17 -0
- package/dist/revalidation/url-context.d.ts.map +1 -0
- package/dist/revalidation/url-context.js +49 -0
- package/dist/revalidation/url-context.js.map +1 -0
- package/dist/seo/url-builder.d.ts +2 -1
- package/dist/seo/url-builder.d.ts.map +1 -1
- package/dist/seo/url-builder.js +5 -2
- package/dist/seo/url-builder.js.map +1 -1
- package/dist/types.d.ts +13 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -325,6 +325,57 @@ Two language modes are transparent to the storefront — the resolver picks the
|
|
|
325
325
|
|
|
326
326
|
Visibility is gated server-side: `PUBLIC` (everyone), `AUTHENTICATED` (logged-in only), `CUSTOMER_GROUP` (allowlist of customer groups). Anonymous visitors only ever see PUBLIC docs.
|
|
327
327
|
|
|
328
|
+
## Next.js revalidation (platform events)
|
|
329
|
+
|
|
330
|
+
Create an event subscription (Dashboard → Settings → Event Subscriptions) pointing at
|
|
331
|
+
`{storefrontUrl}/api/revalidate/events`, and mount the handler there:
|
|
332
|
+
|
|
333
|
+
```typescript
|
|
334
|
+
// src/app/api/revalidate/events/route.ts
|
|
335
|
+
import { revalidatePath, revalidateTag } from 'next/cache';
|
|
336
|
+
import { createEventRevalidateHandler, urlContextFromClient } from '@sixtyninecommerce/client/next';
|
|
337
|
+
|
|
338
|
+
export const POST = createEventRevalidateHandler({
|
|
339
|
+
secret: process.env.REVALIDATE_EVENTS_SECRET!, // the subscription's signing secret
|
|
340
|
+
revalidatePath,
|
|
341
|
+
revalidateTag,
|
|
342
|
+
urls: urlContextFromClient(getClient()), // a client or a client promise
|
|
343
|
+
});
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
It verifies the signature over the raw body, checks `delivered_at` (never `occurred_at`) within
|
|
347
|
+
5 minutes, maps each event to paths and tags, and answers 200 for events it does not act on.
|
|
348
|
+
`revalidateTag` is called with the tag only — if your Next version wants a cache profile too,
|
|
349
|
+
pass a wrapper such as `(tag) => revalidateTag(tag, 'max')`.
|
|
350
|
+
|
|
351
|
+
**Cache tags.** Product and collection reads carry `next: { tags }`, and the handler purges the
|
|
352
|
+
same tags: `product:<id>` on `getProductById` / `getProductProperties`, `collection:<id>` on
|
|
353
|
+
`getCollectionById`, `getProductsInCollectionById` and `searchProducts({ collectionId })`. Load
|
|
354
|
+
pages by the id the routes manifest resolves:
|
|
355
|
+
|
|
356
|
+
```typescript
|
|
357
|
+
const route = await client.navigation.findRoute(path, locale);
|
|
358
|
+
if (route?.type === 'product') {
|
|
359
|
+
const product = await client.commerce.getProductById(route.id); // tagged product:<id>
|
|
360
|
+
}
|
|
361
|
+
if (route?.type === 'collection') {
|
|
362
|
+
const collection = await client.commerce.getCollectionById(route.id); // tagged collection:<id>
|
|
363
|
+
const listing = await client.commerce.getProductsInCollectionById(route.id);
|
|
364
|
+
}
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
`findRoute` also returns `route.cacheTags` for any other read on the page (and
|
|
368
|
+
`cacheTagsForRoute(entry)` covers `getRoutes()` entries). Raw slug reads (`getProduct(slug)`,
|
|
369
|
+
`getCollection(slug)`, `getProductsInCollection(slug)`) stay untagged — pass
|
|
370
|
+
`{ cacheTags: route.cacheTags }` if you must use one.
|
|
371
|
+
|
|
372
|
+
Opt out with `createStorefrontClient({ cacheTags: false })`, or pass a resolver
|
|
373
|
+
`(tags, { operation }) => tags` to rewrite them. The SDK never sets a cache policy.
|
|
374
|
+
|
|
375
|
+
`verifyEventDelivery`, `planRevalidation` and the payload types are exported from
|
|
376
|
+
`@sixtyninecommerce/client/events` for pull-feed consumers and custom handlers.
|
|
377
|
+
`createRevalidateHandler` (the legacy `/api/revalidate` SEO webhook) is deprecated and unchanged.
|
|
378
|
+
|
|
328
379
|
## Tree-Shakeable Imports
|
|
329
380
|
|
|
330
381
|
```typescript
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const SEO_ARTIFACT_TAG = "seo-artifact";
|
|
2
|
+
export declare function productCacheTag(productId: string): string;
|
|
3
|
+
export declare function collectionCacheTag(collectionId: string): string;
|
|
4
|
+
export declare function cacheTagsForRoute(route: {
|
|
5
|
+
readonly type: string;
|
|
6
|
+
readonly id: string;
|
|
7
|
+
}): string[];
|
|
8
|
+
//# sourceMappingURL=cache-tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-tags.d.ts","sourceRoot":"","sources":["../src/cache-tags.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAE/C,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE/D;AAOD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,EAAE,CAIjG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const SEO_ARTIFACT_TAG = 'seo-artifact';
|
|
2
|
+
export function productCacheTag(productId) {
|
|
3
|
+
return `product:${productId}`;
|
|
4
|
+
}
|
|
5
|
+
export function collectionCacheTag(collectionId) {
|
|
6
|
+
return `collection:${collectionId}`;
|
|
7
|
+
}
|
|
8
|
+
export function cacheTagsForRoute(route) {
|
|
9
|
+
if (route.type === 'product')
|
|
10
|
+
return [productCacheTag(route.id)];
|
|
11
|
+
if (route.type === 'collection')
|
|
12
|
+
return [collectionCacheTag(route.id)];
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=cache-tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-tags.js","sourceRoot":"","sources":["../src/cache-tags.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAE/C,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,OAAO,WAAW,SAAS,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,YAAoB;IACrD,OAAO,cAAc,YAAY,EAAE,CAAC;AACtC,CAAC;AAOD,MAAM,UAAU,iBAAiB,CAAC,KAAqD;IACrF,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IACjE,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IACvE,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/dist/commerce/index.d.ts
CHANGED
|
@@ -1,4 +1,162 @@
|
|
|
1
1
|
import type { HttpClient } from '../core/http.js';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function createCommerceModule(http: HttpClient, ctx: StoreContext):
|
|
2
|
+
import type { StoreContext } from '../types.js';
|
|
3
|
+
export declare function createCommerceModule(http: HttpClient, ctx: StoreContext): {
|
|
4
|
+
getBranding(options?: import("../types.js").RequestOptions): Promise<import("../types.js").BrandingInfo>;
|
|
5
|
+
subscribeToStockNotification(productVariantId: string, emailAddress?: string): Promise<import("../types.js").StockNotificationSubscriptionResult>;
|
|
6
|
+
unsubscribeFromStockNotification(token: string): Promise<boolean>;
|
|
7
|
+
getDropOffPoints(input: import("../types.js").DropOffPointInput): Promise<import("../types.js").DropOffPoint[]>;
|
|
8
|
+
getDeliveryOptions(input: import("../types.js").DeliveryOptionsInput): Promise<import("../types.js").DeliveryOption[]>;
|
|
9
|
+
trackShipment(barcode: string, postalCode: string): Promise<import("../types.js").ShipmentTrackingInfo | null>;
|
|
10
|
+
getMyVatValidationStatus(): Promise<import("../types.js").VatValidationResult | null>;
|
|
11
|
+
setMyVatNumber(vatNumber: string): Promise<import("../types.js").VatValidationResult>;
|
|
12
|
+
clearMyVatNumber(): Promise<boolean>;
|
|
13
|
+
getMyReturns(options?: import("../types.js").CustomerReturnListOptions): Promise<import("../types.js").CustomerReturnList>;
|
|
14
|
+
getMyReturn(id: string): Promise<import("../types.js").CustomerReturn | null>;
|
|
15
|
+
requestReturn(input: import("../types.js").RequestReturnInput): Promise<import("../types.js").CustomerReturn>;
|
|
16
|
+
cancelMyReturn(id: string): Promise<import("../types.js").CustomerReturn>;
|
|
17
|
+
getReturnableLinesForOrder(orderId: string): Promise<import("../types.js").CustomerReturnEligibility>;
|
|
18
|
+
getMyQuotes(options?: import("../types.js").QuoteListOptions): Promise<import("../types.js").QuoteList>;
|
|
19
|
+
getMyQuote(id: string): Promise<import("../types.js").Quote | null>;
|
|
20
|
+
createQuoteRequest(input: import("../types.js").CreateQuoteRequestInput): Promise<import("../types.js").Quote>;
|
|
21
|
+
acceptQuote(id: string): Promise<import("../types.js").Order>;
|
|
22
|
+
cancelMyQuote(id: string, reason?: string): Promise<import("../types.js").Quote>;
|
|
23
|
+
getMySubscriptions(): Promise<import("../types.js").CustomerSubscription[]>;
|
|
24
|
+
getSubscriptionPlans(): Promise<import("../types.js").SubscriptionPlanPublic[]>;
|
|
25
|
+
getMyPaymentMandates(): Promise<import("../types.js").MyPaymentMandate[]>;
|
|
26
|
+
setupPaymentMandate(input: {
|
|
27
|
+
provider: string;
|
|
28
|
+
redirectUrl: string;
|
|
29
|
+
}): Promise<import("../types.js").SetupPaymentMandateResult>;
|
|
30
|
+
createSubscription(planId: string, mandateId: string): Promise<import("../types.js").CustomerSubscription>;
|
|
31
|
+
pauseMySubscription(id: string, reason?: string): Promise<import("../types.js").CustomerSubscription>;
|
|
32
|
+
resumeMySubscription(id: string): Promise<import("../types.js").CustomerSubscription>;
|
|
33
|
+
cancelMySubscription(id: string, options?: {
|
|
34
|
+
reason?: string;
|
|
35
|
+
immediate?: boolean;
|
|
36
|
+
}): Promise<import("../types.js").CustomerSubscription>;
|
|
37
|
+
getAgeVerificationStatus(): Promise<import("../types.js").AgeVerificationStatus>;
|
|
38
|
+
submitDateOfBirth(dateOfBirth: string): Promise<import("../types.js").AgeVerificationStatus>;
|
|
39
|
+
confirmAge(): Promise<import("../types.js").AgeVerificationStatus>;
|
|
40
|
+
getProductReviews(productId: string, options?: import("../types.js").ReviewListOptions): Promise<{
|
|
41
|
+
items: import("../types.js").ProductReview[];
|
|
42
|
+
totalItems: number;
|
|
43
|
+
nextCursor: string | null;
|
|
44
|
+
}>;
|
|
45
|
+
getRecentProductReviews(options?: import("../types.js").RecentReviewsOptions): Promise<import("../types.js").ProductReview[]>;
|
|
46
|
+
getReviewRatingSummary(productId: string): Promise<import("../types.js").ReviewRatingSummary>;
|
|
47
|
+
getReviewAttributeAggregations(productId: string): Promise<import("../types.js").ReviewAttributeAggregation[]>;
|
|
48
|
+
getReviewAttributes(productId?: string): Promise<import("../types.js").ReviewAttribute[]>;
|
|
49
|
+
getMyReview(productId: string): Promise<import("../types.js").ProductReview | null>;
|
|
50
|
+
getReviewChannelConfig(): Promise<import("../types.js").ReviewChannelConfig>;
|
|
51
|
+
createReview(input: import("../types.js").CreateReviewInput): Promise<import("../types.js").CreateReviewResult>;
|
|
52
|
+
updateReview(id: string, input: import("../types.js").UpdateReviewInput): Promise<import("../types.js").ProductReview>;
|
|
53
|
+
deleteReview(id: string): Promise<boolean>;
|
|
54
|
+
voteReview(reviewId: string, isHelpful: boolean): Promise<boolean>;
|
|
55
|
+
reportReview(reviewId: string, reason: string): Promise<boolean>;
|
|
56
|
+
uploadReviewMedia(files: File[]): Promise<import("../types.js").ReviewMediaUploadResult[]>;
|
|
57
|
+
getProductRecommendations(productId: string, groupSlug?: string): Promise<import("../types.js").RecommendedProductGroup[]>;
|
|
58
|
+
getMySavedLists(): Promise<import("../types.js").SavedList[]>;
|
|
59
|
+
getMySavedList(id: string): Promise<import("../types.js").SavedList | null>;
|
|
60
|
+
createSavedList(name: string): Promise<import("../types.js").SavedList>;
|
|
61
|
+
renameSavedList(id: string, name: string): Promise<import("../types.js").SavedList>;
|
|
62
|
+
deleteSavedList(id: string): Promise<boolean>;
|
|
63
|
+
addItemToSavedList(listId: string, variantId: string, quantity: number): Promise<import("../types.js").SavedList>;
|
|
64
|
+
updateSavedListItem(listId: string, variantId: string, quantity: number): Promise<import("../types.js").SavedList>;
|
|
65
|
+
removeItemFromSavedList(listId: string, variantId: string): Promise<import("../types.js").SavedList>;
|
|
66
|
+
getFavoriteVariantIds(): Promise<string[]>;
|
|
67
|
+
getMyFavorites(options?: {
|
|
68
|
+
take?: number;
|
|
69
|
+
skip?: number;
|
|
70
|
+
}): Promise<import("../types.js").PaginatedList<import("../types.js").FavoriteItem>>;
|
|
71
|
+
toggleFavorite(productVariantId: string): Promise<boolean>;
|
|
72
|
+
removeFavorite(productVariantId: string): Promise<boolean>;
|
|
73
|
+
login(email: string, password: string): Promise<import("../types.js").LoginResult>;
|
|
74
|
+
register(input: import("../types.js").RegisterInput): Promise<{
|
|
75
|
+
success: boolean;
|
|
76
|
+
}>;
|
|
77
|
+
logout(): Promise<void>;
|
|
78
|
+
verifyAccount(token: string, password?: string): Promise<{
|
|
79
|
+
id: string;
|
|
80
|
+
identifier: string;
|
|
81
|
+
}>;
|
|
82
|
+
refreshVerification(emailAddress: string): Promise<void>;
|
|
83
|
+
requestMagicLink(emailAddress: string): Promise<void>;
|
|
84
|
+
loginWithMagicLink(token: string): Promise<{
|
|
85
|
+
id: string;
|
|
86
|
+
identifier: string;
|
|
87
|
+
}>;
|
|
88
|
+
loginWithMagicCode(emailAddress: string, code: string): Promise<{
|
|
89
|
+
id: string;
|
|
90
|
+
identifier: string;
|
|
91
|
+
}>;
|
|
92
|
+
updatePassword(currentPassword: string, newPassword: string): Promise<void>;
|
|
93
|
+
requestPasswordReset(emailAddress: string): Promise<void>;
|
|
94
|
+
resetPassword(token: string, password: string): Promise<{
|
|
95
|
+
id: string;
|
|
96
|
+
identifier: string;
|
|
97
|
+
}>;
|
|
98
|
+
requestEmailUpdate(password: string, newEmailAddress: string): Promise<void>;
|
|
99
|
+
updateEmail(token: string): Promise<void>;
|
|
100
|
+
getCurrentCustomer(): Promise<import("../types.js").Customer | null>;
|
|
101
|
+
getActiveCustomerPriceLists(options?: import("../core/http.js").RequestOptions): Promise<import("../types.js").CustomerPriceList[]>;
|
|
102
|
+
updateCustomer(input: import("../types.js").UpdateCustomerInput): Promise<import("../types.js").Customer>;
|
|
103
|
+
getCustomerOrders(options?: import("../types.js").OrderListOptions): Promise<import("../types.js").PaginatedList<import("../types.js").OrderSummary>>;
|
|
104
|
+
createAddress(input: import("../types.js").AddressInput): Promise<import("../types.js").CustomerAddress>;
|
|
105
|
+
updateAddress(input: import("../types.js").UpdateAddressInput): Promise<import("../types.js").CustomerAddress>;
|
|
106
|
+
deleteAddress(id: string): Promise<void>;
|
|
107
|
+
getAvailableCountries(): Promise<import("../types.js").Country[]>;
|
|
108
|
+
getOrderByCode(code: string): Promise<import("../types.js").Order>;
|
|
109
|
+
getMyOrderInvoices(orderCode: string): Promise<import("../types.js").CustomerInvoice[]>;
|
|
110
|
+
getMyInvoicePdf(invoiceId: string): Promise<import("../types.js").CustomerInvoicePdf>;
|
|
111
|
+
reorder(orderCode: string): Promise<{
|
|
112
|
+
order: import("../types.js").Order;
|
|
113
|
+
addedLines: number;
|
|
114
|
+
skipped: import("../types.js").ReorderSkipped[];
|
|
115
|
+
}>;
|
|
116
|
+
getActiveChannel(): Promise<import("../types.js").ActiveChannel>;
|
|
117
|
+
createStripePaymentIntent(options?: import("../types.js").RequestOptions): Promise<import("../types.js").StripePaymentIntentResult>;
|
|
118
|
+
getMolliePaymentMethods(input: import("../types.js").MolliePaymentMethodsInput, options?: import("../types.js").RequestOptions): Promise<import("../types.js").MolliePaymentMethod[]>;
|
|
119
|
+
getOrderedMolliePaymentMethods(paymentMethodCode: string, options?: import("../types.js").RequestOptions): Promise<import("../types.js").OrderedMollieMethod[]>;
|
|
120
|
+
createMolliePaymentIntent(input: import("../types.js").CreateMolliePaymentIntentInput, options?: import("../types.js").RequestOptions): Promise<import("../types.js").MolliePaymentIntentResult>;
|
|
121
|
+
syncMolliePaymentStatus(orderCode: string, options?: import("../types.js").RequestOptions): Promise<import("../types.js").MollieOrderStatusResult | null>;
|
|
122
|
+
setCustomerForOrder(input: import("../types.js").CustomerInput): Promise<import("../types.js").Order>;
|
|
123
|
+
setShippingAddress(input: import("../types.js").AddressInput): Promise<import("../types.js").Order>;
|
|
124
|
+
setBillingAddress(input: import("../types.js").AddressInput): Promise<import("../types.js").Order>;
|
|
125
|
+
getEligibleShippingMethods(): Promise<import("../types.js").ShippingMethod[]>;
|
|
126
|
+
getDeliveryTerms(options?: import("../core/http.js").RequestOptions): Promise<import("../types.js").CustomerDeliveryTerms | null>;
|
|
127
|
+
setShippingMethod(ids: string[]): Promise<import("../types.js").Order>;
|
|
128
|
+
applyPreferredShippingMethod(): Promise<import("../types.js").Order>;
|
|
129
|
+
getEligiblePaymentMethods(): Promise<import("../types.js").PaymentMethod[]>;
|
|
130
|
+
getOrderConstraints(): Promise<import("../types.js").ActiveChannelOrderConstraints>;
|
|
131
|
+
setPaymentIntent(intent: import("../types.js").OrderPaymentIntent): Promise<import("../types.js").Order>;
|
|
132
|
+
transitionToArrangingPayment(): Promise<import("../types.js").Order>;
|
|
133
|
+
addPayment(input: import("../types.js").PaymentInput): Promise<import("../types.js").Order>;
|
|
134
|
+
findPickupLocations(input: import("../types.js").PickupLocationSearchInput): Promise<import("../types.js").PickupLocation[]>;
|
|
135
|
+
selectPickupLocation(location: import("../types.js").PickupLocation): Promise<import("../types.js").Order>;
|
|
136
|
+
getActivePickupLocation(): Promise<import("../types.js").PickupLocation | null>;
|
|
137
|
+
getActiveOrder(): Promise<import("../types.js").Order | null>;
|
|
138
|
+
addToCart(variantId: string, quantity: number): Promise<import("../types.js").Order>;
|
|
139
|
+
addItemsToCart(items: Array<{
|
|
140
|
+
productVariantId: string;
|
|
141
|
+
quantity: number;
|
|
142
|
+
}>): Promise<import("../types.js").Order>;
|
|
143
|
+
updateCartLine(lineId: string, quantity: number): Promise<import("../types.js").Order>;
|
|
144
|
+
removeFromCart(lineId: string): Promise<import("../types.js").Order>;
|
|
145
|
+
clearCart(): Promise<import("../types.js").Order>;
|
|
146
|
+
applyCouponCode(code: string): Promise<import("../types.js").Order>;
|
|
147
|
+
removeCouponCode(code: string): Promise<import("../types.js").Order>;
|
|
148
|
+
searchProducts(input: import("../types.js").SearchInput, options?: import("../types.js").RequestOptions): Promise<import("../types.js").SearchResult>;
|
|
149
|
+
getProduct(slug: string, options?: import("../types.js").RequestOptions): Promise<import("../types.js").Product>;
|
|
150
|
+
getProductById(id: string, options?: import("../types.js").RequestOptions): Promise<import("../types.js").Product>;
|
|
151
|
+
getProducts(listOptions?: import("../types.js").ProductListOptions, options?: import("../types.js").RequestOptions): Promise<import("../types.js").PaginatedList<import("../types.js").ProductSummary>>;
|
|
152
|
+
getProductsInCollection(collectionSlug: string, listOptions?: import("../types.js").CollectionProductListOptions, options?: import("../types.js").RequestOptions): Promise<import("../types.js").PaginatedList<import("../types.js").CollectionProductSummary>>;
|
|
153
|
+
getProductsInCollectionById(collectionId: string, listOptions?: import("../types.js").CollectionProductListOptions, options?: import("../types.js").RequestOptions): Promise<import("../types.js").PaginatedList<import("../types.js").CollectionProductSummary>>;
|
|
154
|
+
getFacets(options?: import("../types.js").RequestOptions): Promise<import("../types.js").Facet[]>;
|
|
155
|
+
getCollections(listOptions?: import("../types.js").CollectionListOptions, options?: import("../types.js").RequestOptions): Promise<import("../types.js").Collection[]>;
|
|
156
|
+
getCollection(slug: string, options?: import("../types.js").RequestOptions): Promise<import("../types.js").CollectionDetail>;
|
|
157
|
+
getCollectionById(id: string, options?: import("../types.js").RequestOptions): Promise<import("../types.js").CollectionDetail>;
|
|
158
|
+
getPropertyGroups(options?: import("../types.js").RequestOptions): Promise<import("../types.js").PropertyGroup[]>;
|
|
159
|
+
getProductProperties(productId: string, options?: import("../types.js").RequestOptions): Promise<import("../types.js").ProductPropertyGroupValues[]>;
|
|
160
|
+
mapProductProperties: typeof import("./products.js").mapProductProperties;
|
|
161
|
+
};
|
|
4
162
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commerce/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commerce/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,aAAa,CAAC;AAoBhE,wBAAgB,oB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,OAAO;QACL,GAAG,QAAQ;QACX,GAAG,MAAM;QACT,GAAG,IAAI;QACP,GAAG,QAAQ;QACX,GAAG,QAAQ;QACX,GAAG,QAAQ;QACX,GAAG,SAAS;QACZ,GAAG,UAAU;QACb,GAAG,eAAe;QAClB,GAAG,OAAO;QACV,GAAG,eAAe;QAClB,GAAG,aAAa;QAChB,GAAG,MAAM;QACT,GAAG,OAAO;QACV,GAAG,aAAa;QAChB,GAAG,QAAQ;QACX,GAAG,kBAAkB;QACrB,GAAG,QAAQ;KACa,CAAC;AAC7B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type HttpClient } from '../core/http.js';
|
|
2
2
|
import type { Collection, CollectionDetail, CollectionListOptions, CollectionProductListOptions, CollectionProductSummary, Facet, PaginatedList, Product, ProductListOptions, ProductPropertyGroupValues, ProductPropertyRecord, ProductSummary, PropertyGroup, RequestOptions } from '../types.js';
|
|
3
3
|
export declare function mapProductProperties(groups: ProductPropertyGroupValues[]): ProductPropertyRecord;
|
|
4
4
|
export declare function createProductMethods(http: HttpClient): {
|
|
@@ -6,9 +6,11 @@ export declare function createProductMethods(http: HttpClient): {
|
|
|
6
6
|
getProductById(id: string, options?: RequestOptions): Promise<Product>;
|
|
7
7
|
getProducts(listOptions?: ProductListOptions, options?: RequestOptions): Promise<PaginatedList<ProductSummary>>;
|
|
8
8
|
getProductsInCollection(collectionSlug: string, listOptions?: CollectionProductListOptions, options?: RequestOptions): Promise<PaginatedList<CollectionProductSummary>>;
|
|
9
|
+
getProductsInCollectionById(collectionId: string, listOptions?: CollectionProductListOptions, options?: RequestOptions): Promise<PaginatedList<CollectionProductSummary>>;
|
|
9
10
|
getFacets(options?: RequestOptions): Promise<Facet[]>;
|
|
10
11
|
getCollections(listOptions?: CollectionListOptions, options?: RequestOptions): Promise<Collection[]>;
|
|
11
12
|
getCollection(slug: string, options?: RequestOptions): Promise<CollectionDetail>;
|
|
13
|
+
getCollectionById(id: string, options?: RequestOptions): Promise<CollectionDetail>;
|
|
12
14
|
getPropertyGroups(options?: RequestOptions): Promise<PropertyGroup[]>;
|
|
13
15
|
getProductProperties(productId: string, options?: RequestOptions): Promise<ProductPropertyGroupValues[]>;
|
|
14
16
|
mapProductProperties: typeof mapProductProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../src/commerce/products.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../../src/commerce/products.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAc,MAAM,iBAAiB,CAAC;AAG9D,OAAO,KAAK,EACV,UAAU,EACV,gBAAgB,EAChB,qBAAqB,EACrB,4BAA4B,EAC5B,wBAAwB,EACxB,KAAK,EACL,aAAa,EACb,OAAO,EACP,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,cAAc,EAEf,MAAM,aAAa,CAAC;AAyHrB,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;uBAYjD,MAAM,YAAY,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;8BA0B5D,kBAAkB,YACtB,cAAc,GACvB,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;4CA8EvB,MAAM,gBACR,4BAA4B,YAChC,cAAc,GACvB,OAAO,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAC;8CAsBnC,MAAM,gBACN,4BAA4B,YAChC,cAAc,GACvB,OAAO,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAC;wBAoBzB,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;0BAY1D,MAAM,YAAY,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;gCAYtD,cAAc,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;oCAU9D,MAAM,YACP,cAAc,GACvB,OAAO,CAAC,0BAA0B,EAAE,CAAC;;EAa3C"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { collectionCacheTag, productCacheTag } from '../cache-tags.js';
|
|
2
|
+
import { tagRequest } from '../core/http.js';
|
|
1
3
|
import { StorefrontError } from '../errors.js';
|
|
2
4
|
import { parseProductMetadata } from '../seo/metadata-parser.js';
|
|
3
|
-
import { GET_COLLECTION, GET_PRODUCT, GET_PRODUCT_BY_ID, LIST_COLLECTIONS, LIST_FACETS, LIST_PRODUCTS, PRODUCT_PROPERTIES, PROPERTY_GROUPS, SEARCH_PRODUCTS, } from './queries.js';
|
|
5
|
+
import { GET_COLLECTION, GET_COLLECTION_BY_ID, GET_PRODUCT, GET_PRODUCT_BY_ID, LIST_COLLECTIONS, LIST_FACETS, LIST_PRODUCTS, PRODUCT_PROPERTIES, PROPERTY_GROUPS, SEARCH_PRODUCTS, } from './queries.js';
|
|
4
6
|
function hydrateProductMetadata(product) {
|
|
5
7
|
const raw = product.metadata;
|
|
6
8
|
return { ...product, metadata: parseProductMetadata(raw ?? null) };
|
|
@@ -69,14 +71,14 @@ export function mapProductProperties(groups) {
|
|
|
69
71
|
export function createProductMethods(http) {
|
|
70
72
|
return {
|
|
71
73
|
async getProduct(slug, options) {
|
|
72
|
-
const data = await http.graphql(GET_PRODUCT, { slug }, options);
|
|
74
|
+
const data = await http.graphql(GET_PRODUCT, { slug }, tagRequest(options, 'getProduct'));
|
|
73
75
|
if (!data.product) {
|
|
74
76
|
throw new StorefrontError(`Product not found: ${slug}`, 'vendure', 404, 'NOT_FOUND');
|
|
75
77
|
}
|
|
76
78
|
return hydrateProductMetadata(data.product);
|
|
77
79
|
},
|
|
78
80
|
async getProductById(id, options) {
|
|
79
|
-
const data = await http.graphql(GET_PRODUCT_BY_ID, { id }, options);
|
|
81
|
+
const data = await http.graphql(GET_PRODUCT_BY_ID, { id }, tagRequest(options, 'getProductById', [productCacheTag(id)]));
|
|
80
82
|
if (!data.product) {
|
|
81
83
|
throw new StorefrontError(`Product not found: ${id}`, 'vendure', 404, 'NOT_FOUND');
|
|
82
84
|
}
|
|
@@ -92,7 +94,7 @@ export function createProductMethods(http) {
|
|
|
92
94
|
skip: listOptions.skip ?? 0,
|
|
93
95
|
...(listOptions.sort ? { sort: listOptions.sort } : {}),
|
|
94
96
|
},
|
|
95
|
-
}, options);
|
|
97
|
+
}, tagRequest(options, 'getProducts'));
|
|
96
98
|
return {
|
|
97
99
|
items: data.search.items.map(searchItemToProductSummary),
|
|
98
100
|
totalItems: data.search.totalItems,
|
|
@@ -118,7 +120,7 @@ export function createProductMethods(http) {
|
|
|
118
120
|
else {
|
|
119
121
|
queryOptions.filter = { enabled: { eq: listOptions?.enabled ?? true } };
|
|
120
122
|
}
|
|
121
|
-
const data = await http.graphql(LIST_PRODUCTS, { options: queryOptions }, options);
|
|
123
|
+
const data = await http.graphql(LIST_PRODUCTS, { options: queryOptions }, tagRequest(options, 'getProducts'));
|
|
122
124
|
return data.products;
|
|
123
125
|
},
|
|
124
126
|
async getProductsInCollection(collectionSlug, listOptions, options) {
|
|
@@ -130,7 +132,22 @@ export function createProductMethods(http) {
|
|
|
130
132
|
skip: listOptions?.skip ?? 0,
|
|
131
133
|
...(listOptions?.sort ? { sort: listOptions.sort } : {}),
|
|
132
134
|
},
|
|
133
|
-
}, options);
|
|
135
|
+
}, tagRequest(options, 'getProductsInCollection'));
|
|
136
|
+
return {
|
|
137
|
+
items: data.search.items.map(searchItemToCollectionProduct),
|
|
138
|
+
totalItems: data.search.totalItems,
|
|
139
|
+
};
|
|
140
|
+
},
|
|
141
|
+
async getProductsInCollectionById(collectionId, listOptions, options) {
|
|
142
|
+
const data = await http.graphql(SEARCH_PRODUCTS, {
|
|
143
|
+
input: {
|
|
144
|
+
term: '',
|
|
145
|
+
collectionId,
|
|
146
|
+
take: listOptions?.take ?? 20,
|
|
147
|
+
skip: listOptions?.skip ?? 0,
|
|
148
|
+
...(listOptions?.sort ? { sort: listOptions.sort } : {}),
|
|
149
|
+
},
|
|
150
|
+
}, tagRequest(options, 'getProductsInCollectionById', [collectionCacheTag(collectionId)]));
|
|
134
151
|
return {
|
|
135
152
|
items: data.search.items.map(searchItemToCollectionProduct),
|
|
136
153
|
totalItems: data.search.totalItems,
|
|
@@ -143,22 +160,29 @@ export function createProductMethods(http) {
|
|
|
143
160
|
async getCollections(listOptions, options) {
|
|
144
161
|
const data = await http.graphql(LIST_COLLECTIONS, {
|
|
145
162
|
options: { take: listOptions?.take ?? 100, skip: listOptions?.skip ?? 0 },
|
|
146
|
-
}, options);
|
|
163
|
+
}, tagRequest(options, 'getCollections'));
|
|
147
164
|
return data.collections.items;
|
|
148
165
|
},
|
|
149
166
|
async getCollection(slug, options) {
|
|
150
|
-
const data = await http.graphql(GET_COLLECTION, { slug }, options);
|
|
167
|
+
const data = await http.graphql(GET_COLLECTION, { slug }, tagRequest(options, 'getCollection'));
|
|
151
168
|
if (!data.collection) {
|
|
152
169
|
throw new StorefrontError(`Collection not found: ${slug}`, 'vendure', 404, 'NOT_FOUND');
|
|
153
170
|
}
|
|
154
171
|
return data.collection;
|
|
155
172
|
},
|
|
173
|
+
async getCollectionById(id, options) {
|
|
174
|
+
const data = await http.graphql(GET_COLLECTION_BY_ID, { id }, tagRequest(options, 'getCollectionById', [collectionCacheTag(id)]));
|
|
175
|
+
if (!data.collection) {
|
|
176
|
+
throw new StorefrontError(`Collection not found: ${id}`, 'vendure', 404, 'NOT_FOUND');
|
|
177
|
+
}
|
|
178
|
+
return data.collection;
|
|
179
|
+
},
|
|
156
180
|
async getPropertyGroups(options) {
|
|
157
181
|
const data = await http.graphql(PROPERTY_GROUPS, undefined, options);
|
|
158
182
|
return data.productPropertyGroups;
|
|
159
183
|
},
|
|
160
184
|
async getProductProperties(productId, options) {
|
|
161
|
-
const data = await http.graphql(PRODUCT_PROPERTIES, { productId }, options);
|
|
185
|
+
const data = await http.graphql(PRODUCT_PROPERTIES, { productId }, tagRequest(options, 'getProductProperties', [productCacheTag(productId)]));
|
|
162
186
|
return data.productPropertyValues;
|
|
163
187
|
},
|
|
164
188
|
mapProductProperties,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/commerce/products.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/commerce/products.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAmB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAA2B,MAAM,2BAA2B,CAAC;AAkB1F,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,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,6BAA6B,CACpC,IAA4C;IAE5C,MAAM,QAAQ,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IACzD,MAAM,YAAY,GAAG,kBAAkB,CAA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AAG,EAAE,WAAW,CAAC,CAAC;YAC1F,CAAC;YACD,OAAO,IAAI,CAAC,UAAU,CAAC;QACzB,CAAC;QAED,KAAK,CAAC,iBAAiB,CAAC,EAAU,EAAE,OAAwB;YAC1D,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAC7B,oBAAoB,EACpB,EAAE,EAAE,EAAE,EACN,UAAU,CAAC,OAAO,EAAE,mBAAmB,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC,CACnE,CAAC;YACF,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;gBACrB,MAAM,IAAI,eAAe,CAAC,yBAAyB,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC;YACxF,CAAC;YACD,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,CAG7B,kBAAkB,EAClB,EAAE,SAAS,EAAE,EACb,UAAU,CAAC,OAAO,EAAE,sBAAsB,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,CAC1E,CAAC;YACF,OAAO,IAAI,CAAC,qBAAqB,CAAC;QACpC,CAAC;QAED,oBAAoB;KACrB,CAAC;AACJ,CAAC"}
|
|
@@ -4,6 +4,7 @@ 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 width height\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 position\n featuredAsset {\n source width height\n presets { l { url webpUrl } xl { url webpUrl } }\n }\n breadcrumbs { id name slug }\n parent { id }\n children { id name slug }\n customFields {\n isRoutable\n isCanonical\n noindex\n nofollow\n metaRobotsMaxImagePreview\n socialImageId\n socialOgType\n twitterCardType\n }\n translations {\n languageCode\n name\n slug\n customFields {\n seoTitle\n seoDescription\n canonicalUrl\n socialTitle\n socialDescription\n socialImageAlt\n }\n }\n productVariants(options: { take: 20 }) {\n items {\n id\n product {\n id name slug\n featuredAsset { source width height presets { m { url webpUrl } } }\n }\n price priceWithTax currencyCode stockLevel\n stockOnHand stockAllocated saleable\n incomingStock projectedSaleable nextExpectedArrival\n priceListName retailPrice retailPriceWithTax taxRateApplied { value }\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 GET_COLLECTION_BY_ID = "\n query GetCollectionById($id: ID!) {\n collection(id: $id) {\n id name slug description position\n featuredAsset {\n source width height\n presets { l { url webpUrl } xl { url webpUrl } }\n }\n breadcrumbs { id name slug }\n parent { id }\n children { id name slug }\n customFields {\n isRoutable\n isCanonical\n noindex\n nofollow\n metaRobotsMaxImagePreview\n socialImageId\n socialOgType\n twitterCardType\n }\n translations {\n languageCode\n name\n slug\n customFields {\n seoTitle\n seoDescription\n canonicalUrl\n socialTitle\n socialDescription\n socialImageAlt\n }\n }\n productVariants(options: { take: 20 }) {\n items {\n id\n product {\n id name slug\n featuredAsset { source width height presets { m { url webpUrl } } }\n }\n price priceWithTax currencyCode stockLevel\n stockOnHand stockAllocated saleable\n incomingStock projectedSaleable nextExpectedArrival\n priceListName retailPrice retailPriceWithTax taxRateApplied { value }\n priceTiers { minQuantity price priceWithTax discountLabel }\n availabilityByLocation { locationId locationName inStock }\n customFields { minOrderQuantity salesUnit position }\n }\n totalItems\n }\n }\n }\n";
|
|
7
8
|
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
9
|
export declare const ACTIVE_ORDER = "\n query ActiveOrder {\n activeOrder { \n id code state active\n createdAt orderPlacedAt\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax taxRate\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 company streetLine1 streetLine2 city province postalCode countryCode phoneNumber }\n billingAddress { fullName company streetLine1 streetLine2 city province postalCode countryCode phoneNumber }\n customer { id firstName lastName emailAddress }\n couponCodes\n }\n }\n";
|
|
9
10
|
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 createdAt orderPlacedAt\n totalQuantity\n subTotal subTotalWithTax\n shipping shippingWithTax\n total totalWithTax\n currencyCode\n lines {\n id quantity\n unitPrice unitPriceWithTax taxRate\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 company streetLine1 streetLine2 city province postalCode countryCode phoneNumber }\n billingAddress { fullName company streetLine1 streetLine2 city province postalCode countryCode phoneNumber }\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 { \n errorCode message quantityAvailable\n productVariantId orderLineId sku productName productVariantName\n quantityRequested inputIndex\n order { id } }\n }\n }\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/commerce/queries.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,WAAW,mqFAyDvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,6pFAyD7B,CAAC;AAEF,eAAO,MAAM,aAAa,mrCAgCzB,CAAC;AAEF,eAAO,MAAM,WAAW,wJAUvB,CAAC;AAIF,eAAO,MAAM,gBAAgB,0aAgB5B,CAAC;
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/commerce/queries.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,WAAW,mqFAyDvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,6pFAyD7B,CAAC;AAEF,eAAO,MAAM,aAAa,mrCAgCzB,CAAC;AAEF,eAAO,MAAM,WAAW,wJAUvB,CAAC;AAIF,eAAO,MAAM,gBAAgB,0aAg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AAkB,8HAM9B,CAAC;AAOF,eAAO,MAAM,gBAAgB,sQAM5B,CAAC;AAEF,eAAO,MAAM,iBAAiB,uLAM7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,6PAM7B,CAAC;AAEF,eAAO,MAAM,eAAe,yPAM3B,CAAC;AAEF,eAAO,MAAM,mBAAmB,iNAM/B,CAAC;AAwDF,eAAO,MAAM,SAAS,QAAiC,CAAC;AACxD,eAAO,MAAM,gBAAgB,QAAwC,CAAC;AAEtE,eAAO,MAAM,QAAQ,QAAgC,CAAC;AACtD,eAAO,MAAM,eAAe,QAAuC,CAAC;AAEpE,eAAO,MAAM,oBAAoB,QAA2C,CAAC;AAC7E,eAAO,MAAM,2BAA2B,QAAkD,CAAC;AAE3F,eAAO,MAAM,YAAY,2tCAIxB,CAAC;AAEF,eAAO,MAAM,eAAe,QAAsC,CAAC;AACnE,eAAO,MAAM,sBAAsB,QAA6C,CAAC;AAOjF,eAAO,MAAM,YAAY,kcA4BxB,CAAC;AAIF,eAAO,MAAM,gCAAgC,uPAW5C,CAAC;AAIF,eAAO,MAAM,iBAAiB,qMAM7B,CAAC;AAEF,eAAO,MAAM,cAAc,4IAM1B,CAAC;AAwBF,eAAO,MAAM,UAAU,8kBAOtB,CAAC;AAEF,eAAO,MAAM,SAAS,wfAIrB,CAAC;AAEF,eAAO,MAAM,cAAc,k0BAgB1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,ugBAI5B,CAAC;AAEF,eAAO,MAAM,0BAA0B,oWAWtC,CAAC"}
|
package/dist/commerce/queries.js
CHANGED
|
@@ -202,9 +202,7 @@ export const LIST_COLLECTIONS = `
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
`;
|
|
205
|
-
|
|
206
|
-
query GetCollection($slug: String!) {
|
|
207
|
-
collection(slug: $slug) {
|
|
205
|
+
const COLLECTION_DETAIL_FIELDS = `
|
|
208
206
|
id name slug description position
|
|
209
207
|
featuredAsset {
|
|
210
208
|
source width height
|
|
@@ -253,7 +251,15 @@ export const GET_COLLECTION = `
|
|
|
253
251
|
}
|
|
254
252
|
totalItems
|
|
255
253
|
}
|
|
256
|
-
|
|
254
|
+
`;
|
|
255
|
+
export const GET_COLLECTION = `
|
|
256
|
+
query GetCollection($slug: String!) {
|
|
257
|
+
collection(slug: $slug) {${COLLECTION_DETAIL_FIELDS} }
|
|
258
|
+
}
|
|
259
|
+
`;
|
|
260
|
+
export const GET_COLLECTION_BY_ID = `
|
|
261
|
+
query GetCollectionById($id: ID!) {
|
|
262
|
+
collection(id: $id) {${COLLECTION_DETAIL_FIELDS} }
|
|
257
263
|
}
|
|
258
264
|
`;
|
|
259
265
|
export const SEARCH_PRODUCTS = `
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/commerce/queries.ts"],"names":[],"mappings":"AAQA,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BjC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAsDnB,yBAAyB;;;CAGhC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAsDzB,yBAAyB;;;CAGhC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC5B,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;CAU1B,CAAC;AAIF,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;CAgB/B,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/commerce/queries.ts"],"names":[],"mappings":"AAQA,MAAM,yBAAyB,GAAG;;;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aAAa;;CAEtC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;UAcpB,aAAa;;CAEtB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG;;gCAEA,aAAa;;CAE5C,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;;;;CAWzC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type HttpClient } from '../core/http.js';
|
|
2
2
|
import type { RequestOptions, SearchInput, SearchResult } from '../types.js';
|
|
3
3
|
export declare function createSearchMethods(http: HttpClient): {
|
|
4
4
|
searchProducts(input: SearchInput, options?: RequestOptions): Promise<SearchResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commerce/search.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commerce/search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAc,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG7E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU;0BAEpB,WAAW,YAAY,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;EA2B5F"}
|
package/dist/commerce/search.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { collectionCacheTag } from '../cache-tags.js';
|
|
2
|
+
import { tagRequest } from '../core/http.js';
|
|
1
3
|
import { SEARCH_PRODUCTS } from './queries.js';
|
|
2
4
|
export function createSearchMethods(http) {
|
|
3
5
|
return {
|
|
@@ -21,7 +23,11 @@ export function createSearchMethods(http) {
|
|
|
21
23
|
vars.skip = input.skip;
|
|
22
24
|
if (input.sort)
|
|
23
25
|
vars.sort = input.sort;
|
|
24
|
-
const
|
|
26
|
+
const collectionIds = [
|
|
27
|
+
...(input.collectionId ? [input.collectionId] : []),
|
|
28
|
+
...(input.collectionIds ?? []),
|
|
29
|
+
];
|
|
30
|
+
const data = await http.graphql(SEARCH_PRODUCTS, { input: vars }, tagRequest(options, 'searchProducts', collectionIds.map(collectionCacheTag)));
|
|
25
31
|
return data.search;
|
|
26
32
|
},
|
|
27
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commerce/search.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commerce/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAmB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,UAAU,mBAAmB,CAAC,IAAgB;IAClD,OAAO;QACL,KAAK,CAAC,cAAc,CAAC,KAAkB,EAAE,OAAwB;YAC/D,MAAM,IAAI,GAA4B,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;YAC3D,IAAI,KAAK,CAAC,cAAc;gBAAE,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;YACrE,IAAI,KAAK,CAAC,YAAY;gBAAE,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;YAG/D,IAAI,KAAK,CAAC,eAAe,EAAE,MAAM;gBAAE,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;YAChF,IAAI,KAAK,CAAC,aAAa,EAAE,MAAM;gBAAE,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;YAC1E,IAAI,KAAK,CAAC,aAAa,EAAE,MAAM;gBAAE,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;YAC1E,IAAI,KAAK,CAAC,i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