@usethrottle/catalog 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +135 -24
- package/dist/admin.cjs +16 -16
- package/dist/admin.d.cts +6 -2
- package/dist/admin.d.ts +6 -2
- package/dist/admin.js +1 -1
- package/dist/{catalog-error-s1BINNkt.d.cts → catalog-error-BOaSKgY3.d.cts} +12 -2
- package/dist/{catalog-error-C_zLOtYA.d.ts → catalog-error-CSoPS0-d.d.ts} +12 -2
- package/dist/{chunk-4ORXUW2U.cjs → chunk-2YQNMBDI.cjs} +119 -33
- package/dist/{chunk-JK2UY4CD.js → chunk-3DLH56OX.js} +99 -13
- package/dist/chunk-CADIHOIR.js +496 -0
- package/dist/chunk-GU63WFXI.cjs +496 -0
- package/dist/{client-c2F-eCaL.d.ts → client-6j1Iz-iJ.d.cts} +2 -9
- package/dist/{client-BAoq6jmM.d.cts → client-B3mL2-xJ.d.ts} +2 -9
- package/dist/{contract-types-DhiThMEr.d.cts → contract-types-BRyonOYH.d.cts} +23 -21
- package/dist/{contract-types-DhiThMEr.d.ts → contract-types-BRyonOYH.d.ts} +23 -21
- package/dist/index.cjs +24 -2
- package/dist/index.d.cts +13 -7
- package/dist/index.d.ts +13 -7
- package/dist/index.js +25 -3
- package/dist/react-extras.cjs +42 -0
- package/dist/react-extras.d.cts +23 -0
- package/dist/react-extras.d.ts +23 -0
- package/dist/react-extras.js +42 -0
- package/dist/react.cjs +286 -491
- package/dist/react.d.cts +44 -38
- package/dist/react.d.ts +44 -38
- package/dist/react.js +289 -494
- package/dist/server.cjs +19 -14
- package/dist/server.d.cts +4 -3
- package/dist/server.d.ts +4 -3
- package/dist/server.js +7 -2
- package/dist/{types-DsjoG8ce.d.cts → types-BfveENg1.d.ts} +76 -3
- package/dist/{types-xQLID-4j.d.ts → types-D0PywKnN.d.cts} +76 -3
- package/dist/url.d.cts +2 -1
- package/dist/url.d.ts +2 -1
- package/dist/use-query-CR7r5tam.d.ts +40 -0
- package/dist/use-query-UWf6Pi5g.d.cts +40 -0
- package/dist/version-ev3p03v2.d.cts +8 -0
- package/dist/version-ev3p03v2.d.ts +8 -0
- package/package.json +13 -2
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { CurrencyCode } from '@usethrottle/money';
|
|
2
|
+
|
|
1
3
|
type CartCheckAnswer = {
|
|
2
4
|
priceContext?: 'anonymous' | 'customer' | 'email_unverified' | 'anonymous_fallback' | undefined;
|
|
3
5
|
items: {
|
|
@@ -5,7 +7,7 @@ type CartCheckAnswer = {
|
|
|
5
7
|
ok: boolean;
|
|
6
8
|
code?: 'NOT_FOUND' | 'NOT_PURCHASABLE' | 'OUT_OF_STOCK' | 'QUANTITY_UNAVAILABLE' | 'BELOW_MIN' | 'ABOVE_MAX' | 'NO_PRICE_IN_CURRENCY' | 'PRICE_SOURCE_MISMATCH' | undefined;
|
|
7
9
|
unitPriceMinor: number | null;
|
|
8
|
-
currency:
|
|
10
|
+
currency: CurrencyCode | null;
|
|
9
11
|
maxQuantity?: number | undefined;
|
|
10
12
|
}[];
|
|
11
13
|
};
|
|
@@ -29,7 +31,7 @@ type CartCreateAnswer = {
|
|
|
29
31
|
unitPriceMinor: number;
|
|
30
32
|
imageUrl: string | null;
|
|
31
33
|
}[];
|
|
32
|
-
currency:
|
|
34
|
+
currency: CurrencyCode;
|
|
33
35
|
subtotalMinor: number;
|
|
34
36
|
};
|
|
35
37
|
returnUrlApplied?: boolean | undefined;
|
|
@@ -102,7 +104,7 @@ type StorefrontCollectionAnswer = ({
|
|
|
102
104
|
mediaId?: string | undefined;
|
|
103
105
|
width?: number | undefined;
|
|
104
106
|
height?: number | undefined;
|
|
105
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
107
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
106
108
|
} | null;
|
|
107
109
|
seo: {
|
|
108
110
|
title: string | null;
|
|
@@ -126,7 +128,7 @@ type StorefrontCollectionsAnswer = {
|
|
|
126
128
|
mediaId?: string | undefined;
|
|
127
129
|
width?: number | undefined;
|
|
128
130
|
height?: number | undefined;
|
|
129
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
131
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
130
132
|
} | null;
|
|
131
133
|
productCount: number;
|
|
132
134
|
}[];
|
|
@@ -218,7 +220,7 @@ type StorefrontListAnswer = {
|
|
|
218
220
|
ignored?: string[] | undefined;
|
|
219
221
|
};
|
|
220
222
|
sort: 'relevance' | 'featured' | 'manual' | 'title_asc' | 'title_desc' | 'price_asc' | 'price_desc' | 'newest' | 'updated' | 'best_rated';
|
|
221
|
-
currency:
|
|
223
|
+
currency: CurrencyCode | null;
|
|
222
224
|
locale: string | null;
|
|
223
225
|
priceContext?: 'anonymous' | 'customer' | 'email_unverified' | 'anonymous_fallback' | undefined;
|
|
224
226
|
indexing?: true | undefined;
|
|
@@ -234,24 +236,24 @@ type StorefrontListProduct = {
|
|
|
234
236
|
mediaId?: string | undefined;
|
|
235
237
|
width?: number | undefined;
|
|
236
238
|
height?: number | undefined;
|
|
237
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
239
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
238
240
|
}[]) | ({
|
|
239
241
|
url: string;
|
|
240
242
|
altText?: string | undefined;
|
|
241
243
|
mediaId?: string | undefined;
|
|
242
244
|
width?: number | undefined;
|
|
243
245
|
height?: number | undefined;
|
|
244
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
246
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
245
247
|
}[]) | undefined;
|
|
246
248
|
priceRange?: ({
|
|
247
249
|
minMinor: number;
|
|
248
250
|
maxMinor: number;
|
|
249
|
-
currency:
|
|
251
|
+
currency: CurrencyCode;
|
|
250
252
|
compareAtMinMinor: number | null;
|
|
251
253
|
} | null) | ({
|
|
252
254
|
minMinor: number;
|
|
253
255
|
maxMinor: number;
|
|
254
|
-
currency:
|
|
256
|
+
currency: CurrencyCode;
|
|
255
257
|
} | null) | undefined;
|
|
256
258
|
availability?: ('in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null) | ('in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null) | undefined;
|
|
257
259
|
lowStock?: (boolean) | (boolean) | undefined;
|
|
@@ -296,7 +298,7 @@ type StorefrontListProduct = {
|
|
|
296
298
|
options: Record<string, string> | null;
|
|
297
299
|
priceMinor: number | null;
|
|
298
300
|
salePriceMinor: number | null;
|
|
299
|
-
currency:
|
|
301
|
+
currency: CurrencyCode | null;
|
|
300
302
|
availability: 'in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null;
|
|
301
303
|
gtin: string | null;
|
|
302
304
|
mpn: string | null;
|
|
@@ -306,7 +308,7 @@ type StorefrontListProduct = {
|
|
|
306
308
|
mediaId?: string | undefined;
|
|
307
309
|
width?: number | undefined;
|
|
308
310
|
height?: number | undefined;
|
|
309
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
311
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
310
312
|
}[];
|
|
311
313
|
attributes: Record<string, (string) | (number) | (boolean)>;
|
|
312
314
|
compareAtPriceMinor?: number | null | undefined;
|
|
@@ -320,7 +322,7 @@ type StorefrontListProduct = {
|
|
|
320
322
|
mediaId?: string | undefined;
|
|
321
323
|
width?: number | undefined;
|
|
322
324
|
height?: number | undefined;
|
|
323
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
325
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
324
326
|
} | null | undefined;
|
|
325
327
|
fitment?: {
|
|
326
328
|
yearFrom: number;
|
|
@@ -405,12 +407,12 @@ type StorefrontProductAnswer = {
|
|
|
405
407
|
mediaId?: string | undefined;
|
|
406
408
|
width?: number | undefined;
|
|
407
409
|
height?: number | undefined;
|
|
408
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
410
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
409
411
|
}[];
|
|
410
412
|
priceRange: {
|
|
411
413
|
minMinor: number;
|
|
412
414
|
maxMinor: number;
|
|
413
|
-
currency:
|
|
415
|
+
currency: CurrencyCode;
|
|
414
416
|
} | null;
|
|
415
417
|
availability: 'in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null;
|
|
416
418
|
variants: {
|
|
@@ -419,7 +421,7 @@ type StorefrontProductAnswer = {
|
|
|
419
421
|
options: Record<string, string> | null;
|
|
420
422
|
priceMinor: number | null;
|
|
421
423
|
salePriceMinor: number | null;
|
|
422
|
-
currency:
|
|
424
|
+
currency: CurrencyCode | null;
|
|
423
425
|
availability: 'in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null;
|
|
424
426
|
gtin: string | null;
|
|
425
427
|
mpn: string | null;
|
|
@@ -429,7 +431,7 @@ type StorefrontProductAnswer = {
|
|
|
429
431
|
mediaId?: string | undefined;
|
|
430
432
|
width?: number | undefined;
|
|
431
433
|
height?: number | undefined;
|
|
432
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
434
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
433
435
|
}[];
|
|
434
436
|
attributes: Record<string, (string) | (number) | (boolean)>;
|
|
435
437
|
compareAtPriceMinor?: number | null | undefined;
|
|
@@ -443,7 +445,7 @@ type StorefrontProductAnswer = {
|
|
|
443
445
|
mediaId?: string | undefined;
|
|
444
446
|
width?: number | undefined;
|
|
445
447
|
height?: number | undefined;
|
|
446
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
448
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
447
449
|
} | null | undefined;
|
|
448
450
|
fitment?: {
|
|
449
451
|
yearFrom: number;
|
|
@@ -557,12 +559,12 @@ type StorefrontSuggestAnswer = {
|
|
|
557
559
|
mediaId?: string | undefined;
|
|
558
560
|
width?: number | undefined;
|
|
559
561
|
height?: number | undefined;
|
|
560
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
562
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
561
563
|
}[];
|
|
562
564
|
priceRange: {
|
|
563
565
|
minMinor: number;
|
|
564
566
|
maxMinor: number;
|
|
565
|
-
currency:
|
|
567
|
+
currency: CurrencyCode;
|
|
566
568
|
compareAtMinMinor: number | null;
|
|
567
569
|
} | null;
|
|
568
570
|
availability: 'in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null;
|
|
@@ -594,6 +596,6 @@ type StorefrontTagsAnswer = {
|
|
|
594
596
|
productCount: number;
|
|
595
597
|
}[];
|
|
596
598
|
};
|
|
597
|
-
type CatalogContractErrorCode = 'INVALID_REQUEST' | 'AUTHENTICATION_FAILED' | 'INFRASTRUCTURE_UNAVAILABLE' | 'PROVIDER_UNAVAILABLE' | 'INTERNAL_ERROR' | 'CUSTOMER_TOKEN_INVALID' | 'ORIGIN_NOT_ALLOWED' | 'SERVER_KEY_IN_BROWSER' | 'NOT_FOUND' | 'RATE_LIMITED' | 'STOREFRONT_UNAVAILABLE' | 'REQUEST_BODY_TOO_LARGE' | 'CART_CURRENCY_REQUIRED' | 'CART_CURRENCY_NOT_ENABLED' | 'CHECKOUT_NOT_CONFIGURED' | 'EXTENSION_UPGRADE_REQUIRED' | 'CART_ITEMS_INVALID' | 'CART_REJECTED' | 'CART_UNAVAILABLE' | 'CHECKOUT_UNAVAILABLE' | 'RETURN_URL_NOT_ALLOWED' | 'CHECKOUT_TOTAL_TOO_LARGE' | 'CHECKOUT_CART_MISMATCH' | 'CHECKOUT_ITEMS_INVALID' | 'CHECKOUT_REJECTED' | 'CURRENCY_NOT_ENABLED' | 'STOREFRONT_INDEXING' | 'EMAIL_NOT_VERIFIED' | 'NOT_VERIFIED_BUYER' | 'PURCHASE_REFUNDED' | 'ALREADY_REVIEWED' | 'REVIEW_QUEUE_FULL' | 'REVIEW_VERIFICATION_UNAVAILABLE';
|
|
599
|
+
type CatalogContractErrorCode = 'INVALID_REQUEST' | 'AUTHENTICATION_FAILED' | 'INFRASTRUCTURE_UNAVAILABLE' | 'PROVIDER_UNAVAILABLE' | 'INTERNAL_ERROR' | 'CUSTOMER_TOKEN_INVALID' | 'ORIGIN_NOT_ALLOWED' | 'SERVER_KEY_IN_BROWSER' | 'KEY_NOT_ALLOWED_IN_URL' | 'NOT_FOUND' | 'RATE_LIMITED' | 'STOREFRONT_UNAVAILABLE' | 'REQUEST_BODY_TOO_LARGE' | 'CART_CURRENCY_REQUIRED' | 'CART_CURRENCY_NOT_ENABLED' | 'CHECKOUT_NOT_CONFIGURED' | 'EXTENSION_UPGRADE_REQUIRED' | 'CART_ITEMS_INVALID' | 'CART_REJECTED' | 'CART_UNAVAILABLE' | 'CHECKOUT_UNAVAILABLE' | 'RETURN_URL_NOT_ALLOWED' | 'CHECKOUT_TOTAL_TOO_LARGE' | 'CHECKOUT_CART_MISMATCH' | 'CHECKOUT_ITEMS_INVALID' | 'CHECKOUT_REJECTED' | 'CURRENCY_NOT_ENABLED' | 'STOREFRONT_INDEXING' | 'EMAIL_NOT_VERIFIED' | 'NOT_VERIFIED_BUYER' | 'PURCHASE_REFUNDED' | 'ALREADY_REVIEWED' | 'REVIEW_QUEUE_FULL' | 'REVIEW_VERIFICATION_UNAVAILABLE';
|
|
598
600
|
|
|
599
|
-
export type { CartCheckAnswer as C,
|
|
601
|
+
export type { CartCheckAnswer as C, ReviewSubmitAnswer as R, StorefrontCategoryNode as S, ReviewSubmitInput as a, StorefrontListAnswer as b, StorefrontListProduct as c, ReviewEligibilityAnswer as d, StorefrontProductAnswer as e, CartCheckRequest as f, CartCreateAnswer as g, CartCreateRequest as h, CatalogContractErrorCode as i, StorefrontCategoriesAnswer as j, StorefrontCategoryAnswer as k, StorefrontCollectionAnswer as l, StorefrontCollectionsAnswer as m, StorefrontConfigAnswer as n, StorefrontFilterValuesAnswer as o, StorefrontRelatedAnswer as p, StorefrontReviewsAnswer as q, StorefrontSuggestAnswer as r, StorefrontTagsAnswer as s };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { CurrencyCode } from '@usethrottle/money';
|
|
2
|
+
|
|
1
3
|
type CartCheckAnswer = {
|
|
2
4
|
priceContext?: 'anonymous' | 'customer' | 'email_unverified' | 'anonymous_fallback' | undefined;
|
|
3
5
|
items: {
|
|
@@ -5,7 +7,7 @@ type CartCheckAnswer = {
|
|
|
5
7
|
ok: boolean;
|
|
6
8
|
code?: 'NOT_FOUND' | 'NOT_PURCHASABLE' | 'OUT_OF_STOCK' | 'QUANTITY_UNAVAILABLE' | 'BELOW_MIN' | 'ABOVE_MAX' | 'NO_PRICE_IN_CURRENCY' | 'PRICE_SOURCE_MISMATCH' | undefined;
|
|
7
9
|
unitPriceMinor: number | null;
|
|
8
|
-
currency:
|
|
10
|
+
currency: CurrencyCode | null;
|
|
9
11
|
maxQuantity?: number | undefined;
|
|
10
12
|
}[];
|
|
11
13
|
};
|
|
@@ -29,7 +31,7 @@ type CartCreateAnswer = {
|
|
|
29
31
|
unitPriceMinor: number;
|
|
30
32
|
imageUrl: string | null;
|
|
31
33
|
}[];
|
|
32
|
-
currency:
|
|
34
|
+
currency: CurrencyCode;
|
|
33
35
|
subtotalMinor: number;
|
|
34
36
|
};
|
|
35
37
|
returnUrlApplied?: boolean | undefined;
|
|
@@ -102,7 +104,7 @@ type StorefrontCollectionAnswer = ({
|
|
|
102
104
|
mediaId?: string | undefined;
|
|
103
105
|
width?: number | undefined;
|
|
104
106
|
height?: number | undefined;
|
|
105
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
107
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
106
108
|
} | null;
|
|
107
109
|
seo: {
|
|
108
110
|
title: string | null;
|
|
@@ -126,7 +128,7 @@ type StorefrontCollectionsAnswer = {
|
|
|
126
128
|
mediaId?: string | undefined;
|
|
127
129
|
width?: number | undefined;
|
|
128
130
|
height?: number | undefined;
|
|
129
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
131
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
130
132
|
} | null;
|
|
131
133
|
productCount: number;
|
|
132
134
|
}[];
|
|
@@ -218,7 +220,7 @@ type StorefrontListAnswer = {
|
|
|
218
220
|
ignored?: string[] | undefined;
|
|
219
221
|
};
|
|
220
222
|
sort: 'relevance' | 'featured' | 'manual' | 'title_asc' | 'title_desc' | 'price_asc' | 'price_desc' | 'newest' | 'updated' | 'best_rated';
|
|
221
|
-
currency:
|
|
223
|
+
currency: CurrencyCode | null;
|
|
222
224
|
locale: string | null;
|
|
223
225
|
priceContext?: 'anonymous' | 'customer' | 'email_unverified' | 'anonymous_fallback' | undefined;
|
|
224
226
|
indexing?: true | undefined;
|
|
@@ -234,24 +236,24 @@ type StorefrontListProduct = {
|
|
|
234
236
|
mediaId?: string | undefined;
|
|
235
237
|
width?: number | undefined;
|
|
236
238
|
height?: number | undefined;
|
|
237
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
239
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
238
240
|
}[]) | ({
|
|
239
241
|
url: string;
|
|
240
242
|
altText?: string | undefined;
|
|
241
243
|
mediaId?: string | undefined;
|
|
242
244
|
width?: number | undefined;
|
|
243
245
|
height?: number | undefined;
|
|
244
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
246
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
245
247
|
}[]) | undefined;
|
|
246
248
|
priceRange?: ({
|
|
247
249
|
minMinor: number;
|
|
248
250
|
maxMinor: number;
|
|
249
|
-
currency:
|
|
251
|
+
currency: CurrencyCode;
|
|
250
252
|
compareAtMinMinor: number | null;
|
|
251
253
|
} | null) | ({
|
|
252
254
|
minMinor: number;
|
|
253
255
|
maxMinor: number;
|
|
254
|
-
currency:
|
|
256
|
+
currency: CurrencyCode;
|
|
255
257
|
} | null) | undefined;
|
|
256
258
|
availability?: ('in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null) | ('in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null) | undefined;
|
|
257
259
|
lowStock?: (boolean) | (boolean) | undefined;
|
|
@@ -296,7 +298,7 @@ type StorefrontListProduct = {
|
|
|
296
298
|
options: Record<string, string> | null;
|
|
297
299
|
priceMinor: number | null;
|
|
298
300
|
salePriceMinor: number | null;
|
|
299
|
-
currency:
|
|
301
|
+
currency: CurrencyCode | null;
|
|
300
302
|
availability: 'in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null;
|
|
301
303
|
gtin: string | null;
|
|
302
304
|
mpn: string | null;
|
|
@@ -306,7 +308,7 @@ type StorefrontListProduct = {
|
|
|
306
308
|
mediaId?: string | undefined;
|
|
307
309
|
width?: number | undefined;
|
|
308
310
|
height?: number | undefined;
|
|
309
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
311
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
310
312
|
}[];
|
|
311
313
|
attributes: Record<string, (string) | (number) | (boolean)>;
|
|
312
314
|
compareAtPriceMinor?: number | null | undefined;
|
|
@@ -320,7 +322,7 @@ type StorefrontListProduct = {
|
|
|
320
322
|
mediaId?: string | undefined;
|
|
321
323
|
width?: number | undefined;
|
|
322
324
|
height?: number | undefined;
|
|
323
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
325
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
324
326
|
} | null | undefined;
|
|
325
327
|
fitment?: {
|
|
326
328
|
yearFrom: number;
|
|
@@ -405,12 +407,12 @@ type StorefrontProductAnswer = {
|
|
|
405
407
|
mediaId?: string | undefined;
|
|
406
408
|
width?: number | undefined;
|
|
407
409
|
height?: number | undefined;
|
|
408
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
410
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
409
411
|
}[];
|
|
410
412
|
priceRange: {
|
|
411
413
|
minMinor: number;
|
|
412
414
|
maxMinor: number;
|
|
413
|
-
currency:
|
|
415
|
+
currency: CurrencyCode;
|
|
414
416
|
} | null;
|
|
415
417
|
availability: 'in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null;
|
|
416
418
|
variants: {
|
|
@@ -419,7 +421,7 @@ type StorefrontProductAnswer = {
|
|
|
419
421
|
options: Record<string, string> | null;
|
|
420
422
|
priceMinor: number | null;
|
|
421
423
|
salePriceMinor: number | null;
|
|
422
|
-
currency:
|
|
424
|
+
currency: CurrencyCode | null;
|
|
423
425
|
availability: 'in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null;
|
|
424
426
|
gtin: string | null;
|
|
425
427
|
mpn: string | null;
|
|
@@ -429,7 +431,7 @@ type StorefrontProductAnswer = {
|
|
|
429
431
|
mediaId?: string | undefined;
|
|
430
432
|
width?: number | undefined;
|
|
431
433
|
height?: number | undefined;
|
|
432
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
434
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
433
435
|
}[];
|
|
434
436
|
attributes: Record<string, (string) | (number) | (boolean)>;
|
|
435
437
|
compareAtPriceMinor?: number | null | undefined;
|
|
@@ -443,7 +445,7 @@ type StorefrontProductAnswer = {
|
|
|
443
445
|
mediaId?: string | undefined;
|
|
444
446
|
width?: number | undefined;
|
|
445
447
|
height?: number | undefined;
|
|
446
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
448
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
447
449
|
} | null | undefined;
|
|
448
450
|
fitment?: {
|
|
449
451
|
yearFrom: number;
|
|
@@ -557,12 +559,12 @@ type StorefrontSuggestAnswer = {
|
|
|
557
559
|
mediaId?: string | undefined;
|
|
558
560
|
width?: number | undefined;
|
|
559
561
|
height?: number | undefined;
|
|
560
|
-
sizes?: Partial<Record<'400' | '800' | '2048', string>> | undefined;
|
|
562
|
+
sizes?: Partial<Record<'400' | '640' | '800' | '2048', string>> | undefined;
|
|
561
563
|
}[];
|
|
562
564
|
priceRange: {
|
|
563
565
|
minMinor: number;
|
|
564
566
|
maxMinor: number;
|
|
565
|
-
currency:
|
|
567
|
+
currency: CurrencyCode;
|
|
566
568
|
compareAtMinMinor: number | null;
|
|
567
569
|
} | null;
|
|
568
570
|
availability: 'in_stock' | 'out_of_stock' | 'preorder' | 'backorder' | null;
|
|
@@ -594,6 +596,6 @@ type StorefrontTagsAnswer = {
|
|
|
594
596
|
productCount: number;
|
|
595
597
|
}[];
|
|
596
598
|
};
|
|
597
|
-
type CatalogContractErrorCode = 'INVALID_REQUEST' | 'AUTHENTICATION_FAILED' | 'INFRASTRUCTURE_UNAVAILABLE' | 'PROVIDER_UNAVAILABLE' | 'INTERNAL_ERROR' | 'CUSTOMER_TOKEN_INVALID' | 'ORIGIN_NOT_ALLOWED' | 'SERVER_KEY_IN_BROWSER' | 'NOT_FOUND' | 'RATE_LIMITED' | 'STOREFRONT_UNAVAILABLE' | 'REQUEST_BODY_TOO_LARGE' | 'CART_CURRENCY_REQUIRED' | 'CART_CURRENCY_NOT_ENABLED' | 'CHECKOUT_NOT_CONFIGURED' | 'EXTENSION_UPGRADE_REQUIRED' | 'CART_ITEMS_INVALID' | 'CART_REJECTED' | 'CART_UNAVAILABLE' | 'CHECKOUT_UNAVAILABLE' | 'RETURN_URL_NOT_ALLOWED' | 'CHECKOUT_TOTAL_TOO_LARGE' | 'CHECKOUT_CART_MISMATCH' | 'CHECKOUT_ITEMS_INVALID' | 'CHECKOUT_REJECTED' | 'CURRENCY_NOT_ENABLED' | 'STOREFRONT_INDEXING' | 'EMAIL_NOT_VERIFIED' | 'NOT_VERIFIED_BUYER' | 'PURCHASE_REFUNDED' | 'ALREADY_REVIEWED' | 'REVIEW_QUEUE_FULL' | 'REVIEW_VERIFICATION_UNAVAILABLE';
|
|
599
|
+
type CatalogContractErrorCode = 'INVALID_REQUEST' | 'AUTHENTICATION_FAILED' | 'INFRASTRUCTURE_UNAVAILABLE' | 'PROVIDER_UNAVAILABLE' | 'INTERNAL_ERROR' | 'CUSTOMER_TOKEN_INVALID' | 'ORIGIN_NOT_ALLOWED' | 'SERVER_KEY_IN_BROWSER' | 'KEY_NOT_ALLOWED_IN_URL' | 'NOT_FOUND' | 'RATE_LIMITED' | 'STOREFRONT_UNAVAILABLE' | 'REQUEST_BODY_TOO_LARGE' | 'CART_CURRENCY_REQUIRED' | 'CART_CURRENCY_NOT_ENABLED' | 'CHECKOUT_NOT_CONFIGURED' | 'EXTENSION_UPGRADE_REQUIRED' | 'CART_ITEMS_INVALID' | 'CART_REJECTED' | 'CART_UNAVAILABLE' | 'CHECKOUT_UNAVAILABLE' | 'RETURN_URL_NOT_ALLOWED' | 'CHECKOUT_TOTAL_TOO_LARGE' | 'CHECKOUT_CART_MISMATCH' | 'CHECKOUT_ITEMS_INVALID' | 'CHECKOUT_REJECTED' | 'CURRENCY_NOT_ENABLED' | 'STOREFRONT_INDEXING' | 'EMAIL_NOT_VERIFIED' | 'NOT_VERIFIED_BUYER' | 'PURCHASE_REFUNDED' | 'ALREADY_REVIEWED' | 'REVIEW_QUEUE_FULL' | 'REVIEW_VERIFICATION_UNAVAILABLE';
|
|
598
600
|
|
|
599
|
-
export type { CartCheckAnswer as C,
|
|
601
|
+
export type { CartCheckAnswer as C, ReviewSubmitAnswer as R, StorefrontCategoryNode as S, ReviewSubmitInput as a, StorefrontListAnswer as b, StorefrontListProduct as c, ReviewEligibilityAnswer as d, StorefrontProductAnswer as e, CartCheckRequest as f, CartCreateAnswer as g, CartCreateRequest as h, CatalogContractErrorCode as i, StorefrontCategoriesAnswer as j, StorefrontCategoryAnswer as k, StorefrontCollectionAnswer as l, StorefrontCollectionsAnswer as m, StorefrontConfigAnswer as n, StorefrontFilterValuesAnswer as o, StorefrontRelatedAnswer as p, StorefrontReviewsAnswer as q, StorefrontSuggestAnswer as r, StorefrontTagsAnswer as s };
|
package/dist/index.cjs
CHANGED
|
@@ -10,7 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
var _chunk2YQNMBDIcjs = require('./chunk-2YQNMBDI.cjs');
|
|
14
25
|
require('./chunk-ETV4XYOV.cjs');
|
|
15
26
|
|
|
16
27
|
|
|
@@ -24,4 +35,15 @@ require('./chunk-ETV4XYOV.cjs');
|
|
|
24
35
|
|
|
25
36
|
|
|
26
37
|
|
|
27
|
-
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
exports.CURRENCIES = _chunk2YQNMBDIcjs.CURRENCIES; exports.CartLineError = _chunk2YQNMBDIcjs.CartLineError; exports.CatalogError = _chunk2YQNMBDIcjs.CatalogError; exports.CustomerTokenInvalidError = _chunk2YQNMBDIcjs.CustomerTokenInvalidError; exports.FeatureUnavailableError = _chunk2YQNMBDIcjs.FeatureUnavailableError; exports.NetworkError = _chunk2YQNMBDIcjs.NetworkError; exports.OriginNotAllowedError = _chunk2YQNMBDIcjs.OriginNotAllowedError; exports.RateLimitedError = _chunk2YQNMBDIcjs.RateLimitedError; exports.SDK_VERSION = _chunk2YQNMBDIcjs.SDK_VERSION; exports.TimeoutError = _chunk2YQNMBDIcjs.TimeoutError; exports.UnknownCurrencyError = _chunk2YQNMBDIcjs.UnknownCurrencyError; exports.createCatalogClient = _chunk2YQNMBDIcjs.createCatalogClient; exports.currencySymbol = _chunk2YQNMBDIcjs.currencySymbol; exports.formatMoney = _chunk2YQNMBDIcjs.formatMoney; exports.isCatalogError = _chunk2YQNMBDIcjs.isCatalogError; exports.isKnownCurrency = _chunk2YQNMBDIcjs.isKnownCurrency; exports.minorUnitsOf = _chunk2YQNMBDIcjs.minorUnitsOf; exports.money = _chunk2YQNMBDIcjs.money; exports.moneyValue = _chunk2YQNMBDIcjs.moneyValue; exports.parseMoney = _chunk2YQNMBDIcjs.parseMoney; exports.toDecimalString = _chunk2YQNMBDIcjs.toDecimalString; exports.toMinor = _chunk2YQNMBDIcjs.toMinor;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { S as StorefrontCategoryNode,
|
|
2
|
-
export { C as CartCheckAnswer,
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
export {
|
|
1
|
+
import { S as StorefrontCategoryNode, b as StorefrontListAnswer, c as StorefrontListProduct, d as ReviewEligibilityAnswer, e as StorefrontProductAnswer } from './contract-types-BRyonOYH.cjs';
|
|
2
|
+
export { C as CartCheckAnswer, f as CartCheckRequest, g as CartCreateAnswer, h as CartCreateRequest, i as CatalogContractErrorCode, R as ReviewSubmitAnswer, a as ReviewSubmitInput, j as StorefrontCategoriesAnswer, k as StorefrontCategoryAnswer, l as StorefrontCollectionAnswer, m as StorefrontCollectionsAnswer, n as StorefrontConfigAnswer, o as StorefrontFilterValuesAnswer, p as StorefrontRelatedAnswer, q as StorefrontReviewsAnswer, r as StorefrontSuggestAnswer, s as StorefrontTagsAnswer } from './contract-types-BRyonOYH.cjs';
|
|
3
|
+
export { S as SDK_VERSION } from './version-ev3p03v2.cjs';
|
|
4
|
+
import * as money from '@usethrottle/money';
|
|
5
|
+
export { money };
|
|
6
|
+
export { CURRENCIES, CurrencyCode, MoneyValue, UnknownCurrencyError, currencySymbol, formatMoney, isKnownCurrency, minorUnitsOf, moneyValue, parseMoney, toDecimalString, toMinor } from '@usethrottle/money';
|
|
7
|
+
export { C as CatalogClient, c as createCatalogClient } from './client-6j1Iz-iJ.cjs';
|
|
8
|
+
export { c as CallOptions, d as CartAbsorb, e as CartCheckout, f as CartCheckoutInput, g as CartSession, h as CartSessionBranding, i as CartSessionDetail, j as CartSessionSnapshot, b as CartWarning, k as CartsNamespace, l as CatalogClientOptions, m as CatalogHttpCache, n as CatalogHttpCacheEntry, o as CatalogNamespaces, p as CategoriesNamespace, a as CategoryTreeDepth, q as CollectionsNamespace, C as CustomerCartSource, r as CustomerTokenSource, F as FieldsOption, s as FiltersNamespace, N as NextFetchOptions, O as OpenCartRef, t as ProductsNamespace, P as ProductsQuery, R as Redirect, u as ReviewsNamespace, S as SessionCallOptions, v as StorefrontSort, w as TagsNamespace, T as ThrottleCart, x as ThrottleLine } from './types-D0PywKnN.cjs';
|
|
9
|
+
export { C as CartLineError, a as CartLineProblem, b as CatalogError, c as CatalogErrorCode, d as CatalogErrorInit, e as CatalogErrorIssue, f as CatalogErrorSource, g as ClientErrorCode, h as CustomerTokenInvalidError, F as FeatureUnavailableError, N as NetworkError, O as OriginNotAllowedError, R as RateLimitedError, j as ThrottleCartCode, T as TimeoutError, i as isCatalogError } from './catalog-error-BOaSKgY3.cjs';
|
|
6
10
|
|
|
11
|
+
/** The answer of `reviews.eligibility`. */
|
|
12
|
+
type ReviewEligibility = ReviewEligibilityAnswer;
|
|
7
13
|
/** A product as `products.get` answers it (the full projection). */
|
|
8
14
|
type StorefrontProduct = StorefrontProductAnswer['product'];
|
|
9
15
|
/** A product in a list answer. */
|
|
@@ -13,5 +19,5 @@ type Filter = NonNullable<StorefrontListAnswer['filters']>[number];
|
|
|
13
19
|
/** One node of the category tree. */
|
|
14
20
|
type CategoryNode = StorefrontCategoryNode;
|
|
15
21
|
|
|
16
|
-
export { StorefrontCategoryNode, StorefrontListAnswer, StorefrontListProduct, StorefrontProductAnswer };
|
|
17
|
-
export type { CategoryNode, Filter, ListProduct, StorefrontProduct };
|
|
22
|
+
export { ReviewEligibilityAnswer, StorefrontCategoryNode, StorefrontListAnswer, StorefrontListProduct, StorefrontProductAnswer };
|
|
23
|
+
export type { CategoryNode, Filter, ListProduct, ReviewEligibility, StorefrontProduct };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { S as StorefrontCategoryNode,
|
|
2
|
-
export { C as CartCheckAnswer,
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
export {
|
|
1
|
+
import { S as StorefrontCategoryNode, b as StorefrontListAnswer, c as StorefrontListProduct, d as ReviewEligibilityAnswer, e as StorefrontProductAnswer } from './contract-types-BRyonOYH.js';
|
|
2
|
+
export { C as CartCheckAnswer, f as CartCheckRequest, g as CartCreateAnswer, h as CartCreateRequest, i as CatalogContractErrorCode, R as ReviewSubmitAnswer, a as ReviewSubmitInput, j as StorefrontCategoriesAnswer, k as StorefrontCategoryAnswer, l as StorefrontCollectionAnswer, m as StorefrontCollectionsAnswer, n as StorefrontConfigAnswer, o as StorefrontFilterValuesAnswer, p as StorefrontRelatedAnswer, q as StorefrontReviewsAnswer, r as StorefrontSuggestAnswer, s as StorefrontTagsAnswer } from './contract-types-BRyonOYH.js';
|
|
3
|
+
export { S as SDK_VERSION } from './version-ev3p03v2.js';
|
|
4
|
+
import * as money from '@usethrottle/money';
|
|
5
|
+
export { money };
|
|
6
|
+
export { CURRENCIES, CurrencyCode, MoneyValue, UnknownCurrencyError, currencySymbol, formatMoney, isKnownCurrency, minorUnitsOf, moneyValue, parseMoney, toDecimalString, toMinor } from '@usethrottle/money';
|
|
7
|
+
export { C as CatalogClient, c as createCatalogClient } from './client-B3mL2-xJ.js';
|
|
8
|
+
export { c as CallOptions, d as CartAbsorb, e as CartCheckout, f as CartCheckoutInput, g as CartSession, h as CartSessionBranding, i as CartSessionDetail, j as CartSessionSnapshot, b as CartWarning, k as CartsNamespace, l as CatalogClientOptions, m as CatalogHttpCache, n as CatalogHttpCacheEntry, o as CatalogNamespaces, p as CategoriesNamespace, a as CategoryTreeDepth, q as CollectionsNamespace, C as CustomerCartSource, r as CustomerTokenSource, F as FieldsOption, s as FiltersNamespace, N as NextFetchOptions, O as OpenCartRef, t as ProductsNamespace, P as ProductsQuery, R as Redirect, u as ReviewsNamespace, S as SessionCallOptions, v as StorefrontSort, w as TagsNamespace, T as ThrottleCart, x as ThrottleLine } from './types-BfveENg1.js';
|
|
9
|
+
export { C as CartLineError, a as CartLineProblem, b as CatalogError, c as CatalogErrorCode, d as CatalogErrorInit, e as CatalogErrorIssue, f as CatalogErrorSource, g as ClientErrorCode, h as CustomerTokenInvalidError, F as FeatureUnavailableError, N as NetworkError, O as OriginNotAllowedError, R as RateLimitedError, j as ThrottleCartCode, T as TimeoutError, i as isCatalogError } from './catalog-error-CSoPS0-d.js';
|
|
6
10
|
|
|
11
|
+
/** The answer of `reviews.eligibility`. */
|
|
12
|
+
type ReviewEligibility = ReviewEligibilityAnswer;
|
|
7
13
|
/** A product as `products.get` answers it (the full projection). */
|
|
8
14
|
type StorefrontProduct = StorefrontProductAnswer['product'];
|
|
9
15
|
/** A product in a list answer. */
|
|
@@ -13,5 +19,5 @@ type Filter = NonNullable<StorefrontListAnswer['filters']>[number];
|
|
|
13
19
|
/** One node of the category tree. */
|
|
14
20
|
type CategoryNode = StorefrontCategoryNode;
|
|
15
21
|
|
|
16
|
-
export { StorefrontCategoryNode, StorefrontListAnswer, StorefrontListProduct, StorefrontProductAnswer };
|
|
17
|
-
export type { CategoryNode, Filter, ListProduct, StorefrontProduct };
|
|
22
|
+
export { ReviewEligibilityAnswer, StorefrontCategoryNode, StorefrontListAnswer, StorefrontListProduct, StorefrontProductAnswer };
|
|
23
|
+
export type { CategoryNode, Filter, ListProduct, ReviewEligibility, StorefrontProduct };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CURRENCIES,
|
|
2
3
|
CartLineError,
|
|
3
4
|
CatalogError,
|
|
4
5
|
CustomerTokenInvalidError,
|
|
@@ -8,11 +9,22 @@ import {
|
|
|
8
9
|
RateLimitedError,
|
|
9
10
|
SDK_VERSION,
|
|
10
11
|
TimeoutError,
|
|
12
|
+
UnknownCurrencyError,
|
|
11
13
|
createCatalogClient,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
currencySymbol,
|
|
15
|
+
formatMoney,
|
|
16
|
+
isCatalogError,
|
|
17
|
+
isKnownCurrency,
|
|
18
|
+
minorUnitsOf,
|
|
19
|
+
money,
|
|
20
|
+
moneyValue,
|
|
21
|
+
parseMoney,
|
|
22
|
+
toDecimalString,
|
|
23
|
+
toMinor
|
|
24
|
+
} from "./chunk-3DLH56OX.js";
|
|
14
25
|
import "./chunk-PKBMQBKP.js";
|
|
15
26
|
export {
|
|
27
|
+
CURRENCIES,
|
|
16
28
|
CartLineError,
|
|
17
29
|
CatalogError,
|
|
18
30
|
CustomerTokenInvalidError,
|
|
@@ -22,6 +34,16 @@ export {
|
|
|
22
34
|
RateLimitedError,
|
|
23
35
|
SDK_VERSION,
|
|
24
36
|
TimeoutError,
|
|
37
|
+
UnknownCurrencyError,
|
|
25
38
|
createCatalogClient,
|
|
26
|
-
|
|
39
|
+
currencySymbol,
|
|
40
|
+
formatMoney,
|
|
41
|
+
isCatalogError,
|
|
42
|
+
isKnownCurrency,
|
|
43
|
+
minorUnitsOf,
|
|
44
|
+
money,
|
|
45
|
+
moneyValue,
|
|
46
|
+
parseMoney,
|
|
47
|
+
toDecimalString,
|
|
48
|
+
toMinor
|
|
27
49
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkGU63WFXIcjs = require('./chunk-GU63WFXI.cjs');
|
|
7
|
+
require('./chunk-2YQNMBDI.cjs');
|
|
8
|
+
require('./chunk-ETV4XYOV.cjs');
|
|
9
|
+
|
|
10
|
+
// src/react/extras/index.ts
|
|
11
|
+
function useTags(options = {}) {
|
|
12
|
+
const extra = _chunkGU63WFXIcjs.defined.call(void 0, { q: options.q, limit: options.limit });
|
|
13
|
+
return _chunkGU63WFXIcjs.useQuery.call(void 0,
|
|
14
|
+
"tags",
|
|
15
|
+
extra,
|
|
16
|
+
(client, call) => client.tags.list({ ...call, ...extra }),
|
|
17
|
+
options
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function useCollections(options = {}) {
|
|
21
|
+
const extra = _chunkGU63WFXIcjs.defined.call(void 0, { limit: options.limit, cursor: options.cursor });
|
|
22
|
+
return _chunkGU63WFXIcjs.useQuery.call(void 0,
|
|
23
|
+
"collections",
|
|
24
|
+
extra,
|
|
25
|
+
(client, call) => client.collections.list({ ...call, ...extra }),
|
|
26
|
+
options
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
function useReviewEligibility(handle, options = {}) {
|
|
30
|
+
const customerKey = _chunkGU63WFXIcjs.useCustomerKey.call(void 0, );
|
|
31
|
+
return _chunkGU63WFXIcjs.useQuery.call(void 0,
|
|
32
|
+
"review-eligibility",
|
|
33
|
+
{ handle },
|
|
34
|
+
handle === null || customerKey === null ? null : (client, call) => client.reviews.eligibility(handle, call),
|
|
35
|
+
{ ...options, staleTimeMs: _nullishCoalesce(options.staleTimeMs, () => ( 0)) }
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
exports.useCollections = useCollections; exports.useReviewEligibility = useReviewEligibility; exports.useTags = useTags;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CatalogClient } from './index.cjs';
|
|
2
|
+
import { QueryOptions, QueryResult } from './react.cjs';
|
|
3
|
+
import './types-D0PywKnN.cjs';
|
|
4
|
+
import '@usethrottle/money';
|
|
5
|
+
import './contract-types-BRyonOYH.cjs';
|
|
6
|
+
import './catalog-error-BOaSKgY3.cjs';
|
|
7
|
+
|
|
8
|
+
type Answer<F extends (...args: never[]) => unknown> = Awaited<ReturnType<F>>;
|
|
9
|
+
declare function useTags(options?: QueryOptions<Answer<CatalogClient['tags']['list']>> & {
|
|
10
|
+
q?: string;
|
|
11
|
+
limit?: number;
|
|
12
|
+
}): QueryResult<Answer<CatalogClient['tags']['list']>>;
|
|
13
|
+
declare function useCollections(options?: QueryOptions<Answer<CatalogClient['collections']['list']>> & {
|
|
14
|
+
limit?: number;
|
|
15
|
+
cursor?: string;
|
|
16
|
+
}): QueryResult<Answer<CatalogClient['collections']['list']>>;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the signed-in customer may review the product. No request while
|
|
19
|
+
* signed out; asks on every mount (`staleTimeMs` 0).
|
|
20
|
+
*/
|
|
21
|
+
declare function useReviewEligibility(handle: string | null, options?: QueryOptions<Answer<CatalogClient['reviews']['eligibility']>>): QueryResult<Answer<CatalogClient['reviews']['eligibility']>>;
|
|
22
|
+
|
|
23
|
+
export { useCollections, useReviewEligibility, useTags };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CatalogClient } from './index.js';
|
|
2
|
+
import { QueryOptions, QueryResult } from './react.js';
|
|
3
|
+
import './types-BfveENg1.js';
|
|
4
|
+
import '@usethrottle/money';
|
|
5
|
+
import './contract-types-BRyonOYH.js';
|
|
6
|
+
import './catalog-error-CSoPS0-d.js';
|
|
7
|
+
|
|
8
|
+
type Answer<F extends (...args: never[]) => unknown> = Awaited<ReturnType<F>>;
|
|
9
|
+
declare function useTags(options?: QueryOptions<Answer<CatalogClient['tags']['list']>> & {
|
|
10
|
+
q?: string;
|
|
11
|
+
limit?: number;
|
|
12
|
+
}): QueryResult<Answer<CatalogClient['tags']['list']>>;
|
|
13
|
+
declare function useCollections(options?: QueryOptions<Answer<CatalogClient['collections']['list']>> & {
|
|
14
|
+
limit?: number;
|
|
15
|
+
cursor?: string;
|
|
16
|
+
}): QueryResult<Answer<CatalogClient['collections']['list']>>;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the signed-in customer may review the product. No request while
|
|
19
|
+
* signed out; asks on every mount (`staleTimeMs` 0).
|
|
20
|
+
*/
|
|
21
|
+
declare function useReviewEligibility(handle: string | null, options?: QueryOptions<Answer<CatalogClient['reviews']['eligibility']>>): QueryResult<Answer<CatalogClient['reviews']['eligibility']>>;
|
|
22
|
+
|
|
23
|
+
export { useCollections, useReviewEligibility, useTags };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
defined,
|
|
4
|
+
useCustomerKey,
|
|
5
|
+
useQuery
|
|
6
|
+
} from "./chunk-CADIHOIR.js";
|
|
7
|
+
import "./chunk-3DLH56OX.js";
|
|
8
|
+
import "./chunk-PKBMQBKP.js";
|
|
9
|
+
|
|
10
|
+
// src/react/extras/index.ts
|
|
11
|
+
function useTags(options = {}) {
|
|
12
|
+
const extra = defined({ q: options.q, limit: options.limit });
|
|
13
|
+
return useQuery(
|
|
14
|
+
"tags",
|
|
15
|
+
extra,
|
|
16
|
+
(client, call) => client.tags.list({ ...call, ...extra }),
|
|
17
|
+
options
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function useCollections(options = {}) {
|
|
21
|
+
const extra = defined({ limit: options.limit, cursor: options.cursor });
|
|
22
|
+
return useQuery(
|
|
23
|
+
"collections",
|
|
24
|
+
extra,
|
|
25
|
+
(client, call) => client.collections.list({ ...call, ...extra }),
|
|
26
|
+
options
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
function useReviewEligibility(handle, options = {}) {
|
|
30
|
+
const customerKey = useCustomerKey();
|
|
31
|
+
return useQuery(
|
|
32
|
+
"review-eligibility",
|
|
33
|
+
{ handle },
|
|
34
|
+
handle === null || customerKey === null ? null : (client, call) => client.reviews.eligibility(handle, call),
|
|
35
|
+
{ ...options, staleTimeMs: options.staleTimeMs ?? 0 }
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
useCollections,
|
|
40
|
+
useReviewEligibility,
|
|
41
|
+
useTags
|
|
42
|
+
};
|