@usethrottle/catalog 1.2.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 +12 -0
- package/README.md +7 -7
- package/dist/admin.cjs +16 -16
- package/dist/admin.d.cts +3 -2
- package/dist/admin.d.ts +3 -2
- package/dist/admin.js +1 -1
- package/dist/{catalog-error-yTBMAdCv.d.cts → catalog-error-BOaSKgY3.d.cts} +11 -1
- package/dist/{catalog-error-7DCsTyB2.d.ts → catalog-error-CSoPS0-d.d.ts} +11 -1
- package/dist/{chunk-B2DYAHNR.cjs → chunk-2YQNMBDI.cjs} +78 -23
- package/dist/{chunk-55G4ZTD5.js → chunk-3DLH56OX.js} +58 -3
- package/dist/{chunk-JNBKKAMP.js → chunk-CADIHOIR.js} +9 -1
- package/dist/{chunk-TDMDOHD3.cjs → chunk-GU63WFXI.cjs} +16 -8
- package/dist/{client-BrHJCyBP.d.cts → client-6j1Iz-iJ.d.cts} +1 -1
- package/dist/{client-Dm6I4nAZ.d.ts → client-B3mL2-xJ.d.ts} +1 -1
- package/dist/{contract-types-BPSzY_Co.d.ts → contract-types-BRyonOYH.d.cts} +11 -9
- package/dist/{contract-types-BPSzY_Co.d.cts → contract-types-BRyonOYH.d.ts} +11 -9
- package/dist/index.cjs +24 -2
- package/dist/index.d.cts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.js +25 -3
- package/dist/react-extras.cjs +8 -8
- package/dist/react-extras.d.cts +4 -3
- package/dist/react-extras.d.ts +4 -3
- package/dist/react-extras.js +2 -2
- package/dist/react.cjs +126 -54
- package/dist/react.d.cts +34 -10
- package/dist/react.d.ts +34 -10
- package/dist/react.js +108 -36
- package/dist/server.cjs +13 -13
- package/dist/server.d.cts +2 -1
- package/dist/server.d.ts +2 -1
- package/dist/server.js +1 -1
- package/dist/{types-BTrqSprj.d.cts → types-BfveENg1.d.ts} +43 -7
- package/dist/{types-BlYCKzB8.d.ts → types-D0PywKnN.d.cts} +43 -7
- package/dist/url.d.cts +2 -1
- package/dist/url.d.ts +2 -1
- package/dist/{use-query-QOEBuYlp.d.ts → use-query-CR7r5tam.d.ts} +1 -1
- package/dist/{use-query-BZgjxGPO.d.cts → use-query-UWf6Pi5g.d.cts} +1 -1
- package/package.json +3 -2
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
STALE_MS,
|
|
7
7
|
SUGGEST_DEBOUNCE_MS,
|
|
8
8
|
SUGGEST_MIN_CHARS
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3DLH56OX.js";
|
|
10
10
|
|
|
11
11
|
// src/react/provider.tsx
|
|
12
12
|
import {
|
|
@@ -218,6 +218,7 @@ function createStore(client, options = {}) {
|
|
|
218
218
|
import { jsx } from "react/jsx-runtime";
|
|
219
219
|
function createMemoryCartStorage() {
|
|
220
220
|
let id = null;
|
|
221
|
+
const byCurrency = /* @__PURE__ */ new Map();
|
|
221
222
|
return {
|
|
222
223
|
get: () => id,
|
|
223
224
|
set: (value) => {
|
|
@@ -225,6 +226,13 @@ function createMemoryCartStorage() {
|
|
|
225
226
|
},
|
|
226
227
|
remove: () => {
|
|
227
228
|
id = null;
|
|
229
|
+
},
|
|
230
|
+
getFor: (currency) => byCurrency.get(currency) ?? null,
|
|
231
|
+
setFor: (currency, value) => {
|
|
232
|
+
byCurrency.set(currency, value);
|
|
233
|
+
},
|
|
234
|
+
removeFor: (currency) => {
|
|
235
|
+
byCurrency.delete(currency);
|
|
228
236
|
}
|
|
229
237
|
};
|
|
230
238
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunk2YQNMBDIcjs = require('./chunk-2YQNMBDI.cjs');
|
|
10
10
|
|
|
11
11
|
// src/react/provider.tsx
|
|
12
12
|
|
|
@@ -32,7 +32,7 @@ function createStore(client, options = {}) {
|
|
|
32
32
|
let until = 0;
|
|
33
33
|
let cause;
|
|
34
34
|
let pauseTimer;
|
|
35
|
-
const pausedError = () => new (0,
|
|
35
|
+
const pausedError = () => new (0, _chunk2YQNMBDIcjs.RateLimitedError)({
|
|
36
36
|
code: _nullishCoalesce(_optionalChain([cause, 'optionalAccess', _ => _.code]), () => ( "RATE_LIMITED")),
|
|
37
37
|
message: _nullishCoalesce(_optionalChain([cause, 'optionalAccess', _2 => _2.message]), () => ( "Too many requests.")),
|
|
38
38
|
statusCode: 429,
|
|
@@ -54,7 +54,7 @@ function createStore(client, options = {}) {
|
|
|
54
54
|
retries: 0
|
|
55
55
|
};
|
|
56
56
|
for (const [oldKey, old] of entries) {
|
|
57
|
-
if (entries.size <
|
|
57
|
+
if (entries.size < _chunk2YQNMBDIcjs.CACHE_MAX_ENTRIES) break;
|
|
58
58
|
if (old.subs.size === 0 && old.flight === void 0) {
|
|
59
59
|
clearTimeout(old.timer);
|
|
60
60
|
entries.delete(oldKey);
|
|
@@ -73,7 +73,7 @@ function createStore(client, options = {}) {
|
|
|
73
73
|
else entry.indexing = false;
|
|
74
74
|
}, ms);
|
|
75
75
|
};
|
|
76
|
-
function fetchKey(key, run, { force = false, staleMs =
|
|
76
|
+
function fetchKey(key, run, { force = false, staleMs = _chunk2YQNMBDIcjs.STALE_MS } = {}) {
|
|
77
77
|
const entry = touch(key);
|
|
78
78
|
entry.run = run;
|
|
79
79
|
if (entry.promise !== void 0 && !_optionalChain([entry, 'access', _4 => _4.flight, 'optionalAccess', _5 => _5.signal, 'access', _6 => _6.aborted]))
|
|
@@ -125,7 +125,7 @@ function createStore(client, options = {}) {
|
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
if (_optionalChain([result, 'access', _7 => _7.data, 'optionalAccess', _8 => _8.indexing]) === true) {
|
|
128
|
-
if (!entry.indexing) later(key, entry,
|
|
128
|
+
if (!entry.indexing) later(key, entry, _chunk2YQNMBDIcjs.INDEXING_REVALIDATE_MS);
|
|
129
129
|
} else {
|
|
130
130
|
entry.indexing = false;
|
|
131
131
|
}
|
|
@@ -138,7 +138,7 @@ function createStore(client, options = {}) {
|
|
|
138
138
|
},
|
|
139
139
|
(error) => {
|
|
140
140
|
if (!current()) return;
|
|
141
|
-
const retryMs = (_nullishCoalesce(error.retryAfterSeconds, () => (
|
|
141
|
+
const retryMs = (_nullishCoalesce(error.retryAfterSeconds, () => ( _chunk2YQNMBDIcjs.RATE_LIMIT_DEFAULT_RETRY_S))) * 1e3;
|
|
142
142
|
if (error.statusCode === 429 && error.code === "RATE_LIMITED")
|
|
143
143
|
pause(now() + retryMs, error);
|
|
144
144
|
else if (error.code === "STOREFRONT_INDEXING") {
|
|
@@ -218,6 +218,7 @@ function createStore(client, options = {}) {
|
|
|
218
218
|
var _jsxruntime = require('react/jsx-runtime');
|
|
219
219
|
function createMemoryCartStorage() {
|
|
220
220
|
let id = null;
|
|
221
|
+
const byCurrency = /* @__PURE__ */ new Map();
|
|
221
222
|
return {
|
|
222
223
|
get: () => id,
|
|
223
224
|
set: (value) => {
|
|
@@ -225,6 +226,13 @@ function createMemoryCartStorage() {
|
|
|
225
226
|
},
|
|
226
227
|
remove: () => {
|
|
227
228
|
id = null;
|
|
229
|
+
},
|
|
230
|
+
getFor: (currency) => _nullishCoalesce(byCurrency.get(currency), () => ( null)),
|
|
231
|
+
setFor: (currency, value) => {
|
|
232
|
+
byCurrency.set(currency, value);
|
|
233
|
+
},
|
|
234
|
+
removeFor: (currency) => {
|
|
235
|
+
byCurrency.delete(currency);
|
|
228
236
|
}
|
|
229
237
|
};
|
|
230
238
|
}
|
|
@@ -409,9 +417,9 @@ function useDebounced(q, ms) {
|
|
|
409
417
|
return _react.useSyncExternalStore.call(void 0, box.subscribe, box.get, box.get);
|
|
410
418
|
}
|
|
411
419
|
function useSuggest(q, options = {}) {
|
|
412
|
-
const settled = useDebounced(q, _nullishCoalesce(options.debounceMs, () => (
|
|
420
|
+
const settled = useDebounced(q, _nullishCoalesce(options.debounceMs, () => ( _chunk2YQNMBDIcjs.SUGGEST_DEBOUNCE_MS)));
|
|
413
421
|
const extra = defined({ limit: options.limit });
|
|
414
|
-
const long = (value) => value.trim().length >=
|
|
422
|
+
const long = (value) => value.trim().length >= _chunk2YQNMBDIcjs.SUGGEST_MIN_CHARS;
|
|
415
423
|
return useQuery(
|
|
416
424
|
"suggest",
|
|
417
425
|
{ q: settled, ...extra },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { y as RequestSpec, c as CallOptions, o as CatalogNamespaces, l as CatalogClientOptions } from './types-D0PywKnN.cjs';
|
|
2
2
|
|
|
3
3
|
/** A `304` is possible only when `ifNoneMatch` (not the client cache) sent `If-None-Match`. */
|
|
4
4
|
type TransportResult<T> = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { y as RequestSpec, c as CallOptions, o as CatalogNamespaces, l as CatalogClientOptions } from './types-BfveENg1.js';
|
|
2
2
|
|
|
3
3
|
/** A `304` is possible only when `ifNoneMatch` (not the client cache) sent `If-None-Match`. */
|
|
4
4
|
type TransportResult<T> = {
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -246,12 +248,12 @@ type StorefrontListProduct = {
|
|
|
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;
|
|
@@ -410,7 +412,7 @@ type StorefrontProductAnswer = {
|
|
|
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;
|
|
@@ -562,7 +564,7 @@ type StorefrontSuggestAnswer = {
|
|
|
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;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -246,12 +248,12 @@ type StorefrontListProduct = {
|
|
|
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;
|
|
@@ -410,7 +412,7 @@ type StorefrontProductAnswer = {
|
|
|
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;
|
|
@@ -562,7 +564,7 @@ type StorefrontSuggestAnswer = {
|
|
|
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;
|
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,12 @@
|
|
|
1
|
-
import { S as StorefrontCategoryNode, b as StorefrontListAnswer, c as StorefrontListProduct, d as ReviewEligibilityAnswer, e as StorefrontProductAnswer } from './contract-types-
|
|
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-
|
|
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
3
|
export { S as SDK_VERSION } from './version-ev3p03v2.cjs';
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
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';
|
|
7
10
|
|
|
8
11
|
/** The answer of `reviews.eligibility`. */
|
|
9
12
|
type ReviewEligibility = ReviewEligibilityAnswer;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { S as StorefrontCategoryNode, b as StorefrontListAnswer, c as StorefrontListProduct, d as ReviewEligibilityAnswer, e as StorefrontProductAnswer } from './contract-types-
|
|
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-
|
|
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
3
|
export { S as SDK_VERSION } from './version-ev3p03v2.js';
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
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';
|
|
7
10
|
|
|
8
11
|
/** The answer of `reviews.eligibility`. */
|
|
9
12
|
type ReviewEligibility = ReviewEligibilityAnswer;
|
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
|
};
|
package/dist/react-extras.cjs
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('./chunk-
|
|
6
|
+
var _chunkGU63WFXIcjs = require('./chunk-GU63WFXI.cjs');
|
|
7
|
+
require('./chunk-2YQNMBDI.cjs');
|
|
8
8
|
require('./chunk-ETV4XYOV.cjs');
|
|
9
9
|
|
|
10
10
|
// src/react/extras/index.ts
|
|
11
11
|
function useTags(options = {}) {
|
|
12
|
-
const extra =
|
|
13
|
-
return
|
|
12
|
+
const extra = _chunkGU63WFXIcjs.defined.call(void 0, { q: options.q, limit: options.limit });
|
|
13
|
+
return _chunkGU63WFXIcjs.useQuery.call(void 0,
|
|
14
14
|
"tags",
|
|
15
15
|
extra,
|
|
16
16
|
(client, call) => client.tags.list({ ...call, ...extra }),
|
|
@@ -18,8 +18,8 @@ function useTags(options = {}) {
|
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
function useCollections(options = {}) {
|
|
21
|
-
const extra =
|
|
22
|
-
return
|
|
21
|
+
const extra = _chunkGU63WFXIcjs.defined.call(void 0, { limit: options.limit, cursor: options.cursor });
|
|
22
|
+
return _chunkGU63WFXIcjs.useQuery.call(void 0,
|
|
23
23
|
"collections",
|
|
24
24
|
extra,
|
|
25
25
|
(client, call) => client.collections.list({ ...call, ...extra }),
|
|
@@ -27,8 +27,8 @@ function useCollections(options = {}) {
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
function useReviewEligibility(handle, options = {}) {
|
|
30
|
-
const customerKey =
|
|
31
|
-
return
|
|
30
|
+
const customerKey = _chunkGU63WFXIcjs.useCustomerKey.call(void 0, );
|
|
31
|
+
return _chunkGU63WFXIcjs.useQuery.call(void 0,
|
|
32
32
|
"review-eligibility",
|
|
33
33
|
{ handle },
|
|
34
34
|
handle === null || customerKey === null ? null : (client, call) => client.reviews.eligibility(handle, call),
|
package/dist/react-extras.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CatalogClient } from './index.cjs';
|
|
2
2
|
import { QueryOptions, QueryResult } from './react.cjs';
|
|
3
|
-
import './types-
|
|
4
|
-
import '
|
|
5
|
-
import './
|
|
3
|
+
import './types-D0PywKnN.cjs';
|
|
4
|
+
import '@usethrottle/money';
|
|
5
|
+
import './contract-types-BRyonOYH.cjs';
|
|
6
|
+
import './catalog-error-BOaSKgY3.cjs';
|
|
6
7
|
|
|
7
8
|
type Answer<F extends (...args: never[]) => unknown> = Awaited<ReturnType<F>>;
|
|
8
9
|
declare function useTags(options?: QueryOptions<Answer<CatalogClient['tags']['list']>> & {
|
package/dist/react-extras.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { CatalogClient } from './index.js';
|
|
2
2
|
import { QueryOptions, QueryResult } from './react.js';
|
|
3
|
-
import './types-
|
|
4
|
-
import '
|
|
5
|
-
import './
|
|
3
|
+
import './types-BfveENg1.js';
|
|
4
|
+
import '@usethrottle/money';
|
|
5
|
+
import './contract-types-BRyonOYH.js';
|
|
6
|
+
import './catalog-error-CSoPS0-d.js';
|
|
6
7
|
|
|
7
8
|
type Answer<F extends (...args: never[]) => unknown> = Awaited<ReturnType<F>>;
|
|
8
9
|
declare function useTags(options?: QueryOptions<Answer<CatalogClient['tags']['list']>> & {
|
package/dist/react-extras.js
CHANGED