@usethrottle/catalog 1.4.0 → 1.4.1

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/admin.cjs +16 -16
  3. package/dist/admin.d.cts +2 -2
  4. package/dist/admin.d.ts +2 -2
  5. package/dist/admin.js +1 -1
  6. package/dist/{catalog-error-BKN5hNWP.d.cts → catalog-error-bG1XHquN.d.cts} +1 -1
  7. package/dist/{catalog-error-BnabMMEy.d.ts → catalog-error-c3BVgU6k.d.ts} +1 -1
  8. package/dist/{chunk-J2GHGQY6.cjs → chunk-2ODFFMZ4.cjs} +1 -1
  9. package/dist/{chunk-PZ3SFYH4.cjs → chunk-5AJS3CX5.cjs} +8 -8
  10. package/dist/{chunk-3FX2HISB.js → chunk-6K7H7HBD.js} +1 -1
  11. package/dist/{chunk-SN6STYPW.js → chunk-P3ABGAF5.js} +1 -1
  12. package/dist/{chunk-VJHA7J7B.js → chunk-STNQNHNZ.js} +1 -1
  13. package/dist/{chunk-OKWXS3FD.cjs → chunk-VOOX3WJY.cjs} +8 -8
  14. package/dist/{client-terkEl6u.d.cts → client-CGGlbacq.d.cts} +1 -1
  15. package/dist/{client-B6CsU_v9.d.ts → client-CNsVr2lR.d.ts} +1 -1
  16. package/dist/{contract-types-D2-SSPM9.d.cts → contract-types-BJMeJSTz.d.cts} +40 -1
  17. package/dist/{contract-types-D2-SSPM9.d.ts → contract-types-BJMeJSTz.d.ts} +40 -1
  18. package/dist/index.cjs +2 -2
  19. package/dist/index.d.cts +5 -5
  20. package/dist/index.d.ts +5 -5
  21. package/dist/index.js +1 -1
  22. package/dist/next.cjs +6 -6
  23. package/dist/next.js +2 -2
  24. package/dist/react-extras.cjs +10 -10
  25. package/dist/react-extras.d.cts +3 -3
  26. package/dist/react-extras.d.ts +3 -3
  27. package/dist/react-extras.js +2 -2
  28. package/dist/react.cjs +14 -14
  29. package/dist/react.d.cts +4 -4
  30. package/dist/react.d.ts +4 -4
  31. package/dist/react.js +2 -2
  32. package/dist/server.cjs +17 -17
  33. package/dist/server.d.cts +1 -1
  34. package/dist/server.d.ts +1 -1
  35. package/dist/server.js +2 -2
  36. package/dist/{types-jNpOwEUw.d.cts → types-BtBxMbM5.d.cts} +1 -1
  37. package/dist/{types-z57bkjjB.d.ts → types-dKvIfrVH.d.ts} +1 -1
  38. package/dist/url.d.cts +1 -1
  39. package/dist/url.d.ts +1 -1
  40. package/dist/{use-query-H1xgL3_e.d.cts → use-query-C2rfTJd4.d.cts} +1 -1
  41. package/dist/{use-query-COqRZJnC.d.ts → use-query-DeCj1hXt.d.ts} +1 -1
  42. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @usethrottle/catalog
2
2
 
3
+ ## 1.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c3f11bd: Throttle Builder preparation. The SDK exports the answer types of two new public storefront routes, `StorefrontLookupAnswer` (`GET /v1/storefront/lookup`: the current handle and title of catalog ids, public items only) and `StorefrontLatestReviewsAnswer` (`GET /v1/storefront/reviews`: the latest approved reviews across public products, each with its product). `settings.product.sections[].pageHandle` of `/config` can now be the slug of a Throttle Builder page (the product page `shipping` section's new `builderPageHandle`); its type is unchanged.
8
+ - a3baea5: Money range aligned with `@usethrottle/money` 1.1 so stores install one copy.
9
+
3
10
  ## 1.4.0
4
11
 
5
12
  ### Minor Changes
package/dist/admin.cjs CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
 
13
- var _chunkJ2GHGQY6cjs = require('./chunk-J2GHGQY6.cjs');
13
+ var _chunk2ODFFMZ4cjs = require('./chunk-2ODFFMZ4.cjs');
14
14
  require('./chunk-ETV4XYOV.cjs');
15
15
 
16
16
  // src/generated/push-types.ts
@@ -45,7 +45,7 @@ var MAX_IDEMPOTENCY_KEY = 200;
45
45
  var HEADER_SAFE = /^[\x21-\x7e]+$/u;
46
46
  var MAX_RETRY_AFTER_S = 86400;
47
47
  function invalidRequest(message) {
48
- return new (0, _chunkJ2GHGQY6cjs.CatalogError)({
48
+ return new (0, _chunk2ODFFMZ4cjs.CatalogError)({
49
49
  code: "INVALID_REQUEST",
50
50
  message,
51
51
  statusCode: 0,
@@ -54,7 +54,7 @@ function invalidRequest(message) {
54
54
  });
55
55
  }
56
56
  function clientError(code, message) {
57
- return new (0, _chunkJ2GHGQY6cjs.CatalogError)({
57
+ return new (0, _chunk2ODFFMZ4cjs.CatalogError)({
58
58
  code,
59
59
  message,
60
60
  statusCode: 0,
@@ -126,13 +126,13 @@ function toError(status, headers, text) {
126
126
  requestId
127
127
  };
128
128
  if (status === 429) {
129
- return new (0, _chunkJ2GHGQY6cjs.RateLimitedError)({
129
+ return new (0, _chunk2ODFFMZ4cjs.RateLimitedError)({
130
130
  ...init,
131
131
  retryable: true,
132
- retryAfterSeconds: retryAfter !== null && retryAfter >= 1 ? retryAfter : _chunkJ2GHGQY6cjs.RATE_LIMIT_DEFAULT_RETRY_S
132
+ retryAfterSeconds: retryAfter !== null && retryAfter >= 1 ? retryAfter : _chunk2ODFFMZ4cjs.RATE_LIMIT_DEFAULT_RETRY_S
133
133
  });
134
134
  }
135
- return new (0, _chunkJ2GHGQY6cjs.CatalogError)(init);
135
+ return new (0, _chunk2ODFFMZ4cjs.CatalogError)(init);
136
136
  }
137
137
  function guarded(work, callerSignal, timeoutMs) {
138
138
  if (_optionalChain([callerSignal, 'optionalAccess', _8 => _8.aborted])) return Promise.reject(callerSignal.reason);
@@ -151,7 +151,7 @@ function guarded(work, callerSignal, timeoutMs) {
151
151
  const timer = setTimeout(() => {
152
152
  finish();
153
153
  controller.abort();
154
- reject(new (0, _chunkJ2GHGQY6cjs.TimeoutError)({ timeoutMs }));
154
+ reject(new (0, _chunk2ODFFMZ4cjs.TimeoutError)({ timeoutMs }));
155
155
  }, timeoutMs);
156
156
  _optionalChain([callerSignal, 'optionalAccess', _12 => _12.addEventListener, 'call', _13 => _13("abort", onAbort, { once: true })]);
157
157
  work(controller.signal).then(
@@ -194,7 +194,7 @@ function createHttp(key, baseUrl, fetchFn, timeoutMs) {
194
194
  signal
195
195
  });
196
196
  } catch (cause) {
197
- throw new (0, _chunkJ2GHGQY6cjs.NetworkError)({ cause });
197
+ throw new (0, _chunk2ODFFMZ4cjs.NetworkError)({ cause });
198
198
  }
199
199
  try {
200
200
  return {
@@ -203,14 +203,14 @@ function createHttp(key, baseUrl, fetchFn, timeoutMs) {
203
203
  text: await response.text()
204
204
  };
205
205
  } catch (cause) {
206
- throw new (0, _chunkJ2GHGQY6cjs.NetworkError)({ cause });
206
+ throw new (0, _chunk2ODFFMZ4cjs.NetworkError)({ cause });
207
207
  }
208
208
  },
209
209
  spec.signal,
210
210
  timeoutMs
211
211
  );
212
212
  } catch (error) {
213
- if (error instanceof _chunkJ2GHGQY6cjs.NetworkError && attempt < attempts) continue;
213
+ if (error instanceof _chunk2ODFFMZ4cjs.NetworkError && attempt < attempts) continue;
214
214
  throw error;
215
215
  }
216
216
  }
@@ -223,7 +223,7 @@ function createHttp(key, baseUrl, fetchFn, timeoutMs) {
223
223
  throw toError(answer.status, answer.headers, answer.text);
224
224
  const parsed = parseJson(answer.text);
225
225
  if (parsed === void 0)
226
- throw new (0, _chunkJ2GHGQY6cjs.CatalogError)({
226
+ throw new (0, _chunk2ODFFMZ4cjs.CatalogError)({
227
227
  code: "INVALID_RESPONSE",
228
228
  message: "The server answered with a body that is not JSON.",
229
229
  statusCode: answer.status,
@@ -278,7 +278,7 @@ function refQuery(ref) {
278
278
  return [[field, value]];
279
279
  }
280
280
  function unreadable() {
281
- return new (0, _chunkJ2GHGQY6cjs.CatalogError)({
281
+ return new (0, _chunk2ODFFMZ4cjs.CatalogError)({
282
282
  code: "INVALID_RESPONSE",
283
283
  message: "The server answered with an unexpected shape.",
284
284
  statusCode: 200,
@@ -367,7 +367,7 @@ async function pollUntil(read, done, options = {}) {
367
367
  const value = await read(options.signal);
368
368
  if (done(value)) return value;
369
369
  const remaining = deadline - Date.now();
370
- if (remaining <= 0) throw new (0, _chunkJ2GHGQY6cjs.TimeoutError)({ timeoutMs });
370
+ if (remaining <= 0) throw new (0, _chunk2ODFFMZ4cjs.TimeoutError)({ timeoutMs });
371
371
  await sleep(Math.min(intervalMs, remaining), options.signal);
372
372
  }
373
373
  }
@@ -452,7 +452,7 @@ function createJobs(http) {
452
452
  await handle.send(rows, { idempotencyKey });
453
453
  return;
454
454
  } catch (error) {
455
- if (!(error instanceof _chunkJ2GHGQY6cjs.RateLimitedError) || retry >= QUEUE_RETRIES)
455
+ if (!(error instanceof _chunk2ODFFMZ4cjs.RateLimitedError) || retry >= QUEUE_RETRIES)
456
456
  throw error;
457
457
  await sleep(error.retryAfterSeconds * 1e3, signal);
458
458
  }
@@ -589,7 +589,7 @@ function assertServer() {
589
589
  function createCatalogAdmin(options) {
590
590
  assertServer();
591
591
  const key = checkKey(options.key);
592
- const baseUrl = (_nullishCoalesce(options.baseUrl, () => ( _chunkJ2GHGQY6cjs.DEFAULT_BASE_URL))).replace(/\/+$/u, "");
592
+ const baseUrl = (_nullishCoalesce(options.baseUrl, () => ( _chunk2ODFFMZ4cjs.DEFAULT_BASE_URL))).replace(/\/+$/u, "");
593
593
  if (!/^https?:\/\/[^\s/]+/iu.test(baseUrl))
594
594
  throw invalidRequest("baseUrl must be an absolute http or https URL.");
595
595
  const http = createHttp(
@@ -678,4 +678,4 @@ async function verifyCatalogWebhook(input) {
678
678
 
679
679
 
680
680
 
681
- exports.CartLineError = _chunkJ2GHGQY6cjs.CartLineError; exports.CatalogError = _chunkJ2GHGQY6cjs.CatalogError; exports.CustomerTokenInvalidError = _chunkJ2GHGQY6cjs.CustomerTokenInvalidError; exports.FeatureUnavailableError = _chunkJ2GHGQY6cjs.FeatureUnavailableError; exports.NetworkError = _chunkJ2GHGQY6cjs.NetworkError; exports.OriginNotAllowedError = _chunkJ2GHGQY6cjs.OriginNotAllowedError; exports.RateLimitedError = _chunkJ2GHGQY6cjs.RateLimitedError; exports.TimeoutError = _chunkJ2GHGQY6cjs.TimeoutError; exports.createCatalogAdmin = createCatalogAdmin; exports.isCatalogError = _chunkJ2GHGQY6cjs.isCatalogError; exports.verifyCatalogWebhook = verifyCatalogWebhook;
681
+ exports.CartLineError = _chunk2ODFFMZ4cjs.CartLineError; exports.CatalogError = _chunk2ODFFMZ4cjs.CatalogError; exports.CustomerTokenInvalidError = _chunk2ODFFMZ4cjs.CustomerTokenInvalidError; exports.FeatureUnavailableError = _chunk2ODFFMZ4cjs.FeatureUnavailableError; exports.NetworkError = _chunk2ODFFMZ4cjs.NetworkError; exports.OriginNotAllowedError = _chunk2ODFFMZ4cjs.OriginNotAllowedError; exports.RateLimitedError = _chunk2ODFFMZ4cjs.RateLimitedError; exports.TimeoutError = _chunk2ODFFMZ4cjs.TimeoutError; exports.createCatalogAdmin = createCatalogAdmin; exports.isCatalogError = _chunk2ODFFMZ4cjs.isCatalogError; exports.verifyCatalogWebhook = verifyCatalogWebhook;
package/dist/admin.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- 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, T as TimeoutError, i as isCatalogError } from './catalog-error-BKN5hNWP.cjs';
2
- import './contract-types-D2-SSPM9.cjs';
1
+ 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, T as TimeoutError, i as isCatalogError } from './catalog-error-bG1XHquN.cjs';
2
+ import './contract-types-BJMeJSTz.cjs';
3
3
  import '@usethrottle/money';
4
4
 
5
5
  type JobBatchAnswer = {
package/dist/admin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- 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, T as TimeoutError, i as isCatalogError } from './catalog-error-BnabMMEy.js';
2
- import './contract-types-D2-SSPM9.js';
1
+ 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, T as TimeoutError, i as isCatalogError } from './catalog-error-c3BVgU6k.js';
2
+ import './contract-types-BJMeJSTz.js';
3
3
  import '@usethrottle/money';
4
4
 
5
5
  type JobBatchAnswer = {
package/dist/admin.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  RateLimitedError,
11
11
  TimeoutError,
12
12
  isCatalogError
13
- } from "./chunk-VJHA7J7B.js";
13
+ } from "./chunk-STNQNHNZ.js";
14
14
  import "./chunk-PKBMQBKP.js";
15
15
 
16
16
  // src/generated/push-types.ts
@@ -1,4 +1,4 @@
1
- import { k as CatalogContractErrorCode } from './contract-types-D2-SSPM9.cjs';
1
+ import { k as CatalogContractErrorCode } from './contract-types-BJMeJSTz.cjs';
2
2
 
3
3
  /**
4
4
  * Shared error type for every Throttle SDK.
@@ -1,4 +1,4 @@
1
- import { k as CatalogContractErrorCode } from './contract-types-D2-SSPM9.js';
1
+ import { k as CatalogContractErrorCode } from './contract-types-BJMeJSTz.js';
2
2
 
3
3
  /**
4
4
  * Shared error type for every Throttle SDK.
@@ -3,7 +3,7 @@
3
3
  var _chunkETV4XYOVcjs = require('./chunk-ETV4XYOV.cjs');
4
4
 
5
5
  // src/version.ts
6
- var SDK_VERSION = true ? "1.4.0" : "0.0.0-dev";
6
+ var SDK_VERSION = true ? "1.4.1" : "0.0.0-dev";
7
7
 
8
8
  // src/index.ts
9
9
  var _money = require('@usethrottle/money'); var money = _interopRequireWildcard(_money);
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkJ2GHGQY6cjs = require('./chunk-J2GHGQY6.cjs');
5
+ var _chunk2ODFFMZ4cjs = require('./chunk-2ODFFMZ4.cjs');
6
6
 
7
7
  // src/server/cache-policy.ts
8
8
  var UNTIL_CHANGED_REVALIDATE_S = 3600;
@@ -89,7 +89,7 @@ function policyToNext(policy) {
89
89
  return { revalidate: UNTIL_CHANGED_REVALIDATE_S };
90
90
  const match = typeof policy === "string" ? DURATION.exec(policy) : null;
91
91
  if (match === null) {
92
- throw new (0, _chunkJ2GHGQY6cjs.CatalogError)({
92
+ throw new (0, _chunk2ODFFMZ4cjs.CatalogError)({
93
93
  code: "INVALID_REQUEST",
94
94
  message: "A cache policy is 'until-changed', 'no-store' or a duration such as '90s' or '5m'.",
95
95
  statusCode: 0,
@@ -129,10 +129,10 @@ function familyOf(route) {
129
129
  return route === "pages" || route === "page" ? "pages" : "data";
130
130
  }
131
131
  function catalogTags(route, handle) {
132
- const tags = [_chunkJ2GHGQY6cjs.CACHE_TAG, `${_chunkJ2GHGQY6cjs.CACHE_TAG}:${familyOf(route)}`];
133
- if (route !== familyOf(route)) tags.push(`${_chunkJ2GHGQY6cjs.CACHE_TAG}:${route}`);
134
- if (handle !== void 0) tags.push(`${_chunkJ2GHGQY6cjs.CACHE_TAG}:${route}:${handle}`);
135
- return tags.filter((tag) => tag.length <= _chunkJ2GHGQY6cjs.TAG_MAX_CHARS);
132
+ const tags = [_chunk2ODFFMZ4cjs.CACHE_TAG, `${_chunk2ODFFMZ4cjs.CACHE_TAG}:${familyOf(route)}`];
133
+ if (route !== familyOf(route)) tags.push(`${_chunk2ODFFMZ4cjs.CACHE_TAG}:${route}`);
134
+ if (handle !== void 0) tags.push(`${_chunk2ODFFMZ4cjs.CACHE_TAG}:${route}:${handle}`);
135
+ return tags.filter((tag) => tag.length <= _chunk2ODFFMZ4cjs.TAG_MAX_CHARS);
136
136
  }
137
137
  function tagsForUrl(url, storefront) {
138
138
  const path = _nullishCoalesce(url.split(/[?#]/u, 1)[0], () => ( ""));
@@ -140,7 +140,7 @@ function tagsForUrl(url, storefront) {
140
140
  const found = storefrontRoute(path.slice(storefront.length));
141
141
  return found === null ? null : catalogTags(found.route, found.handle);
142
142
  }
143
- var family = (name) => `${_chunkJ2GHGQY6cjs.CACHE_TAG}:${name}`;
143
+ var family = (name) => `${_chunk2ODFFMZ4cjs.CACHE_TAG}:${name}`;
144
144
  function tagsForScope(scope) {
145
145
  const colon = scope.indexOf(":");
146
146
  const name = colon < 0 ? scope : scope.slice(0, colon);
@@ -172,7 +172,7 @@ function scopesToTags(scopes) {
172
172
  const out = /* @__PURE__ */ new Set();
173
173
  for (const scope of scopes) {
174
174
  for (const tag of tagsForScope(scope)) {
175
- if (tag.length <= _chunkJ2GHGQY6cjs.TAG_MAX_CHARS) out.add(tag);
175
+ if (tag.length <= _chunk2ODFFMZ4cjs.TAG_MAX_CHARS) out.add(tag);
176
176
  }
177
177
  }
178
178
  return [...out];
@@ -6,7 +6,7 @@ import {
6
6
  STALE_MS,
7
7
  SUGGEST_DEBOUNCE_MS,
8
8
  SUGGEST_MIN_CHARS
9
- } from "./chunk-VJHA7J7B.js";
9
+ } from "./chunk-STNQNHNZ.js";
10
10
 
11
11
  // src/react/provider.tsx
12
12
  import {
@@ -2,7 +2,7 @@ import {
2
2
  CACHE_TAG,
3
3
  CatalogError,
4
4
  TAG_MAX_CHARS
5
- } from "./chunk-VJHA7J7B.js";
5
+ } from "./chunk-STNQNHNZ.js";
6
6
 
7
7
  // src/server/cache-policy.ts
8
8
  var UNTIL_CHANGED_REVALIDATE_S = 3600;
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-PKBMQBKP.js";
4
4
 
5
5
  // src/version.ts
6
- var SDK_VERSION = true ? "1.4.0" : "0.0.0-dev";
6
+ var SDK_VERSION = true ? "1.4.1" : "0.0.0-dev";
7
7
 
8
8
  // src/index.ts
9
9
  import * as money from "@usethrottle/money";
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- var _chunkJ2GHGQY6cjs = require('./chunk-J2GHGQY6.cjs');
9
+ var _chunk2ODFFMZ4cjs = require('./chunk-2ODFFMZ4.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, _chunkJ2GHGQY6cjs.RateLimitedError)({
35
+ const pausedError = () => new (0, _chunk2ODFFMZ4cjs.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 < _chunkJ2GHGQY6cjs.CACHE_MAX_ENTRIES) break;
57
+ if (entries.size < _chunk2ODFFMZ4cjs.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 = _chunkJ2GHGQY6cjs.STALE_MS } = {}) {
76
+ function fetchKey(key, run, { force = false, staleMs = _chunk2ODFFMZ4cjs.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, _chunkJ2GHGQY6cjs.INDEXING_REVALIDATE_MS);
128
+ if (!entry.indexing) later(key, entry, _chunk2ODFFMZ4cjs.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, () => ( _chunkJ2GHGQY6cjs.RATE_LIMIT_DEFAULT_RETRY_S))) * 1e3;
141
+ const retryMs = (_nullishCoalesce(error.retryAfterSeconds, () => ( _chunk2ODFFMZ4cjs.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") {
@@ -433,9 +433,9 @@ function useDebounced(q, ms) {
433
433
  return _react.useSyncExternalStore.call(void 0, box.subscribe, box.get, box.get);
434
434
  }
435
435
  function useSuggest(q, options = {}) {
436
- const settled = useDebounced(q, _nullishCoalesce(options.debounceMs, () => ( _chunkJ2GHGQY6cjs.SUGGEST_DEBOUNCE_MS)));
436
+ const settled = useDebounced(q, _nullishCoalesce(options.debounceMs, () => ( _chunk2ODFFMZ4cjs.SUGGEST_DEBOUNCE_MS)));
437
437
  const extra = defined({ limit: options.limit });
438
- const long = (value) => value.trim().length >= _chunkJ2GHGQY6cjs.SUGGEST_MIN_CHARS;
438
+ const long = (value) => value.trim().length >= _chunk2ODFFMZ4cjs.SUGGEST_MIN_CHARS;
439
439
  return useQuery(
440
440
  "suggest",
441
441
  { q: settled, ...extra },
@@ -1,4 +1,4 @@
1
- import { D as RequestSpec, c as CallOptions, o as CatalogNamespaces, l as CatalogClientOptions } from './types-jNpOwEUw.cjs';
1
+ import { D as RequestSpec, c as CallOptions, o as CatalogNamespaces, l as CatalogClientOptions } from './types-BtBxMbM5.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 { D as RequestSpec, c as CallOptions, o as CatalogNamespaces, l as CatalogClientOptions } from './types-z57bkjjB.js';
1
+ import { D as RequestSpec, c as CallOptions, o as CatalogNamespaces, l as CatalogClientOptions } from './types-dKvIfrVH.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> = {
@@ -185,6 +185,28 @@ type StorefrontFilterValuesAnswer = {
185
185
  } | undefined;
186
186
  more: boolean;
187
187
  };
188
+ type StorefrontLatestReviewsAnswer = {
189
+ items: {
190
+ id: string;
191
+ rating: number;
192
+ title: string | null;
193
+ body: string;
194
+ displayName: string;
195
+ verified: boolean;
196
+ imported: boolean;
197
+ createdAt: string;
198
+ reply: {
199
+ body: string;
200
+ updatedAt: string;
201
+ } | null;
202
+ product: {
203
+ id: number;
204
+ handle: string;
205
+ title: string;
206
+ };
207
+ }[];
208
+ nextCursor: string | null;
209
+ };
188
210
  type StorefrontListAnswer = {
189
211
  products: StorefrontListProduct[];
190
212
  page: {
@@ -401,6 +423,23 @@ type StorefrontListProduct = {
401
423
  supersededBy?: string[] | undefined;
402
424
  supersedes?: string[] | undefined;
403
425
  };
426
+ type StorefrontLookupAnswer = {
427
+ collections: {
428
+ id: number;
429
+ handle: string;
430
+ title: string;
431
+ }[];
432
+ categories: {
433
+ id: string;
434
+ handle: string;
435
+ title: string;
436
+ }[];
437
+ products: {
438
+ id: number;
439
+ handle: string;
440
+ title: string;
441
+ }[];
442
+ };
404
443
  type StorefrontMenuItem = {
405
444
  label: string;
406
445
  target: {
@@ -826,4 +865,4 @@ type StorefrontTagsAnswer = {
826
865
  };
827
866
  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' | 'PAGE_NOT_FOUND' | 'PREVIEW_EXPIRED';
828
867
 
829
- export type { CartCheckAnswer as C, ReviewSubmitAnswer as R, StorefrontSettings as S, ReviewSubmitInput as a, StorefrontMenuItem as b, StorefrontCategoryNode as c, StorefrontListAnswer as d, StorefrontListProduct as e, ReviewEligibilityAnswer as f, StorefrontProductAnswer as g, CartCheckRequest as h, CartCreateAnswer as i, CartCreateRequest as j, CatalogContractErrorCode as k, StorefrontCategoriesAnswer as l, StorefrontCategoryAnswer as m, StorefrontCollectionAnswer as n, StorefrontCollectionsAnswer as o, StorefrontConfigAnswer as p, StorefrontFilterDefinition as q, StorefrontFilterValuesAnswer as r, StorefrontPageAnswer as s, StorefrontPagesAnswer as t, StorefrontRelatedAnswer as u, StorefrontReviewsAnswer as v, StorefrontSuggestAnswer as w, StorefrontTagsAnswer as x };
868
+ export type { CartCheckAnswer as C, ReviewSubmitAnswer as R, StorefrontSettings as S, ReviewSubmitInput as a, StorefrontMenuItem as b, StorefrontCategoryNode as c, StorefrontListAnswer as d, StorefrontListProduct as e, ReviewEligibilityAnswer as f, StorefrontProductAnswer as g, CartCheckRequest as h, CartCreateAnswer as i, CartCreateRequest as j, CatalogContractErrorCode as k, StorefrontCategoriesAnswer as l, StorefrontCategoryAnswer as m, StorefrontCollectionAnswer as n, StorefrontCollectionsAnswer as o, StorefrontConfigAnswer as p, StorefrontFilterDefinition as q, StorefrontFilterValuesAnswer as r, StorefrontLatestReviewsAnswer as s, StorefrontLookupAnswer as t, StorefrontPageAnswer as u, StorefrontPagesAnswer as v, StorefrontRelatedAnswer as w, StorefrontReviewsAnswer as x, StorefrontSuggestAnswer as y, StorefrontTagsAnswer as z };
@@ -185,6 +185,28 @@ type StorefrontFilterValuesAnswer = {
185
185
  } | undefined;
186
186
  more: boolean;
187
187
  };
188
+ type StorefrontLatestReviewsAnswer = {
189
+ items: {
190
+ id: string;
191
+ rating: number;
192
+ title: string | null;
193
+ body: string;
194
+ displayName: string;
195
+ verified: boolean;
196
+ imported: boolean;
197
+ createdAt: string;
198
+ reply: {
199
+ body: string;
200
+ updatedAt: string;
201
+ } | null;
202
+ product: {
203
+ id: number;
204
+ handle: string;
205
+ title: string;
206
+ };
207
+ }[];
208
+ nextCursor: string | null;
209
+ };
188
210
  type StorefrontListAnswer = {
189
211
  products: StorefrontListProduct[];
190
212
  page: {
@@ -401,6 +423,23 @@ type StorefrontListProduct = {
401
423
  supersededBy?: string[] | undefined;
402
424
  supersedes?: string[] | undefined;
403
425
  };
426
+ type StorefrontLookupAnswer = {
427
+ collections: {
428
+ id: number;
429
+ handle: string;
430
+ title: string;
431
+ }[];
432
+ categories: {
433
+ id: string;
434
+ handle: string;
435
+ title: string;
436
+ }[];
437
+ products: {
438
+ id: number;
439
+ handle: string;
440
+ title: string;
441
+ }[];
442
+ };
404
443
  type StorefrontMenuItem = {
405
444
  label: string;
406
445
  target: {
@@ -826,4 +865,4 @@ type StorefrontTagsAnswer = {
826
865
  };
827
866
  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' | 'PAGE_NOT_FOUND' | 'PREVIEW_EXPIRED';
828
867
 
829
- export type { CartCheckAnswer as C, ReviewSubmitAnswer as R, StorefrontSettings as S, ReviewSubmitInput as a, StorefrontMenuItem as b, StorefrontCategoryNode as c, StorefrontListAnswer as d, StorefrontListProduct as e, ReviewEligibilityAnswer as f, StorefrontProductAnswer as g, CartCheckRequest as h, CartCreateAnswer as i, CartCreateRequest as j, CatalogContractErrorCode as k, StorefrontCategoriesAnswer as l, StorefrontCategoryAnswer as m, StorefrontCollectionAnswer as n, StorefrontCollectionsAnswer as o, StorefrontConfigAnswer as p, StorefrontFilterDefinition as q, StorefrontFilterValuesAnswer as r, StorefrontPageAnswer as s, StorefrontPagesAnswer as t, StorefrontRelatedAnswer as u, StorefrontReviewsAnswer as v, StorefrontSuggestAnswer as w, StorefrontTagsAnswer as x };
868
+ export type { CartCheckAnswer as C, ReviewSubmitAnswer as R, StorefrontSettings as S, ReviewSubmitInput as a, StorefrontMenuItem as b, StorefrontCategoryNode as c, StorefrontListAnswer as d, StorefrontListProduct as e, ReviewEligibilityAnswer as f, StorefrontProductAnswer as g, CartCheckRequest as h, CartCreateAnswer as i, CartCreateRequest as j, CatalogContractErrorCode as k, StorefrontCategoriesAnswer as l, StorefrontCategoryAnswer as m, StorefrontCollectionAnswer as n, StorefrontCollectionsAnswer as o, StorefrontConfigAnswer as p, StorefrontFilterDefinition as q, StorefrontFilterValuesAnswer as r, StorefrontLatestReviewsAnswer as s, StorefrontLookupAnswer as t, StorefrontPageAnswer as u, StorefrontPagesAnswer as v, StorefrontRelatedAnswer as w, StorefrontReviewsAnswer as x, StorefrontSuggestAnswer as y, StorefrontTagsAnswer as z };
package/dist/index.cjs CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
 
28
28
 
29
- var _chunkJ2GHGQY6cjs = require('./chunk-J2GHGQY6.cjs');
29
+ var _chunk2ODFFMZ4cjs = require('./chunk-2ODFFMZ4.cjs');
30
30
  require('./chunk-ETV4XYOV.cjs');
31
31
 
32
32
 
@@ -56,4 +56,4 @@ require('./chunk-ETV4XYOV.cjs');
56
56
 
57
57
 
58
58
 
59
- exports.CURRENCIES = _chunkJ2GHGQY6cjs.CURRENCIES; exports.CartLineError = _chunkJ2GHGQY6cjs.CartLineError; exports.CatalogError = _chunkJ2GHGQY6cjs.CatalogError; exports.CustomerTokenInvalidError = _chunkJ2GHGQY6cjs.CustomerTokenInvalidError; exports.DEFAULT_STRINGS = _chunkJ2GHGQY6cjs.DEFAULT_STRINGS; exports.FeatureUnavailableError = _chunkJ2GHGQY6cjs.FeatureUnavailableError; exports.NetworkError = _chunkJ2GHGQY6cjs.NetworkError; exports.OriginNotAllowedError = _chunkJ2GHGQY6cjs.OriginNotAllowedError; exports.RateLimitedError = _chunkJ2GHGQY6cjs.RateLimitedError; exports.SDK_VERSION = _chunkJ2GHGQY6cjs.SDK_VERSION; exports.TimeoutError = _chunkJ2GHGQY6cjs.TimeoutError; exports.UnknownCurrencyError = _chunkJ2GHGQY6cjs.UnknownCurrencyError; exports.createCatalogClient = _chunkJ2GHGQY6cjs.createCatalogClient; exports.currencySymbol = _chunkJ2GHGQY6cjs.currencySymbol; exports.fontStylesheetHref = _chunkJ2GHGQY6cjs.fontStylesheetHref; exports.formatMoney = _chunkJ2GHGQY6cjs.formatMoney; exports.isCatalogError = _chunkJ2GHGQY6cjs.isCatalogError; exports.isKnownCurrency = _chunkJ2GHGQY6cjs.isKnownCurrency; exports.minorUnitsOf = _chunkJ2GHGQY6cjs.minorUnitsOf; exports.money = _chunkJ2GHGQY6cjs.money; exports.moneyValue = _chunkJ2GHGQY6cjs.moneyValue; exports.parseMoney = _chunkJ2GHGQY6cjs.parseMoney; exports.resolveMenuTarget = _chunkJ2GHGQY6cjs.resolveMenuTarget; exports.t = _chunkJ2GHGQY6cjs.t; exports.toAuthAppearance = _chunkJ2GHGQY6cjs.toAuthAppearance; exports.toDecimalString = _chunkJ2GHGQY6cjs.toDecimalString; exports.toMinor = _chunkJ2GHGQY6cjs.toMinor;
59
+ exports.CURRENCIES = _chunk2ODFFMZ4cjs.CURRENCIES; exports.CartLineError = _chunk2ODFFMZ4cjs.CartLineError; exports.CatalogError = _chunk2ODFFMZ4cjs.CatalogError; exports.CustomerTokenInvalidError = _chunk2ODFFMZ4cjs.CustomerTokenInvalidError; exports.DEFAULT_STRINGS = _chunk2ODFFMZ4cjs.DEFAULT_STRINGS; exports.FeatureUnavailableError = _chunk2ODFFMZ4cjs.FeatureUnavailableError; exports.NetworkError = _chunk2ODFFMZ4cjs.NetworkError; exports.OriginNotAllowedError = _chunk2ODFFMZ4cjs.OriginNotAllowedError; exports.RateLimitedError = _chunk2ODFFMZ4cjs.RateLimitedError; exports.SDK_VERSION = _chunk2ODFFMZ4cjs.SDK_VERSION; exports.TimeoutError = _chunk2ODFFMZ4cjs.TimeoutError; exports.UnknownCurrencyError = _chunk2ODFFMZ4cjs.UnknownCurrencyError; exports.createCatalogClient = _chunk2ODFFMZ4cjs.createCatalogClient; exports.currencySymbol = _chunk2ODFFMZ4cjs.currencySymbol; exports.fontStylesheetHref = _chunk2ODFFMZ4cjs.fontStylesheetHref; exports.formatMoney = _chunk2ODFFMZ4cjs.formatMoney; exports.isCatalogError = _chunk2ODFFMZ4cjs.isCatalogError; exports.isKnownCurrency = _chunk2ODFFMZ4cjs.isKnownCurrency; exports.minorUnitsOf = _chunk2ODFFMZ4cjs.minorUnitsOf; exports.money = _chunk2ODFFMZ4cjs.money; exports.moneyValue = _chunk2ODFFMZ4cjs.moneyValue; exports.parseMoney = _chunk2ODFFMZ4cjs.parseMoney; exports.resolveMenuTarget = _chunk2ODFFMZ4cjs.resolveMenuTarget; exports.t = _chunk2ODFFMZ4cjs.t; exports.toAuthAppearance = _chunk2ODFFMZ4cjs.toAuthAppearance; exports.toDecimalString = _chunk2ODFFMZ4cjs.toDecimalString; exports.toMinor = _chunk2ODFFMZ4cjs.toMinor;
package/dist/index.d.cts CHANGED
@@ -1,12 +1,12 @@
1
- import { S as StorefrontSettings, b as StorefrontMenuItem, c as StorefrontCategoryNode, d as StorefrontListAnswer, e as StorefrontListProduct, f as ReviewEligibilityAnswer, g as StorefrontProductAnswer } from './contract-types-D2-SSPM9.cjs';
2
- export { C as CartCheckAnswer, h as CartCheckRequest, i as CartCreateAnswer, j as CartCreateRequest, k as CatalogContractErrorCode, R as ReviewSubmitAnswer, a as ReviewSubmitInput, l as StorefrontCategoriesAnswer, m as StorefrontCategoryAnswer, n as StorefrontCollectionAnswer, o as StorefrontCollectionsAnswer, p as StorefrontConfigAnswer, q as StorefrontFilterDefinition, r as StorefrontFilterValuesAnswer, s as StorefrontPageAnswer, t as StorefrontPagesAnswer, u as StorefrontRelatedAnswer, v as StorefrontReviewsAnswer, w as StorefrontSuggestAnswer, x as StorefrontTagsAnswer } from './contract-types-D2-SSPM9.cjs';
1
+ import { S as StorefrontSettings, b as StorefrontMenuItem, c as StorefrontCategoryNode, d as StorefrontListAnswer, e as StorefrontListProduct, f as ReviewEligibilityAnswer, g as StorefrontProductAnswer } from './contract-types-BJMeJSTz.cjs';
2
+ export { C as CartCheckAnswer, h as CartCheckRequest, i as CartCreateAnswer, j as CartCreateRequest, k as CatalogContractErrorCode, R as ReviewSubmitAnswer, a as ReviewSubmitInput, l as StorefrontCategoriesAnswer, m as StorefrontCategoryAnswer, n as StorefrontCollectionAnswer, o as StorefrontCollectionsAnswer, p as StorefrontConfigAnswer, q as StorefrontFilterDefinition, r as StorefrontFilterValuesAnswer, s as StorefrontLatestReviewsAnswer, t as StorefrontLookupAnswer, u as StorefrontPageAnswer, v as StorefrontPagesAnswer, w as StorefrontRelatedAnswer, x as StorefrontReviewsAnswer, y as StorefrontSuggestAnswer, z as StorefrontTagsAnswer } from './contract-types-BJMeJSTz.cjs';
3
3
  export { S as SDK_VERSION } from './version-ev3p03v2.cjs';
4
4
  import * as money from '@usethrottle/money';
5
5
  export { money };
6
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-terkEl6u.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 PagesNamespace, u as ProductsNamespace, P as ProductsQuery, R as Redirect, v as ReviewsNamespace, S as SessionCallOptions, w as SettingsCallOptions, x as SettingsNamespace, y as StorefrontSettingsResult, z as StorefrontSort, A as TagsNamespace, T as ThrottleCart, B as ThrottleLine } from './types-jNpOwEUw.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-BKN5hNWP.cjs';
7
+ export { C as CatalogClient, c as createCatalogClient } from './client-CGGlbacq.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 PagesNamespace, u as ProductsNamespace, P as ProductsQuery, R as Redirect, v as ReviewsNamespace, S as SessionCallOptions, w as SettingsCallOptions, x as SettingsNamespace, y as StorefrontSettingsResult, z as StorefrontSort, A as TagsNamespace, T as ThrottleCart, B as ThrottleLine } from './types-BtBxMbM5.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-bG1XHquN.cjs';
10
10
 
11
11
  /** The settings document as `/config` answers it: text resolved, targets as handles. */
12
12
  type ResolvedStorefrontSettings = StorefrontSettings;
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { S as StorefrontSettings, b as StorefrontMenuItem, c as StorefrontCategoryNode, d as StorefrontListAnswer, e as StorefrontListProduct, f as ReviewEligibilityAnswer, g as StorefrontProductAnswer } from './contract-types-D2-SSPM9.js';
2
- export { C as CartCheckAnswer, h as CartCheckRequest, i as CartCreateAnswer, j as CartCreateRequest, k as CatalogContractErrorCode, R as ReviewSubmitAnswer, a as ReviewSubmitInput, l as StorefrontCategoriesAnswer, m as StorefrontCategoryAnswer, n as StorefrontCollectionAnswer, o as StorefrontCollectionsAnswer, p as StorefrontConfigAnswer, q as StorefrontFilterDefinition, r as StorefrontFilterValuesAnswer, s as StorefrontPageAnswer, t as StorefrontPagesAnswer, u as StorefrontRelatedAnswer, v as StorefrontReviewsAnswer, w as StorefrontSuggestAnswer, x as StorefrontTagsAnswer } from './contract-types-D2-SSPM9.js';
1
+ import { S as StorefrontSettings, b as StorefrontMenuItem, c as StorefrontCategoryNode, d as StorefrontListAnswer, e as StorefrontListProduct, f as ReviewEligibilityAnswer, g as StorefrontProductAnswer } from './contract-types-BJMeJSTz.js';
2
+ export { C as CartCheckAnswer, h as CartCheckRequest, i as CartCreateAnswer, j as CartCreateRequest, k as CatalogContractErrorCode, R as ReviewSubmitAnswer, a as ReviewSubmitInput, l as StorefrontCategoriesAnswer, m as StorefrontCategoryAnswer, n as StorefrontCollectionAnswer, o as StorefrontCollectionsAnswer, p as StorefrontConfigAnswer, q as StorefrontFilterDefinition, r as StorefrontFilterValuesAnswer, s as StorefrontLatestReviewsAnswer, t as StorefrontLookupAnswer, u as StorefrontPageAnswer, v as StorefrontPagesAnswer, w as StorefrontRelatedAnswer, x as StorefrontReviewsAnswer, y as StorefrontSuggestAnswer, z as StorefrontTagsAnswer } from './contract-types-BJMeJSTz.js';
3
3
  export { S as SDK_VERSION } from './version-ev3p03v2.js';
4
4
  import * as money from '@usethrottle/money';
5
5
  export { money };
6
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-B6CsU_v9.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 PagesNamespace, u as ProductsNamespace, P as ProductsQuery, R as Redirect, v as ReviewsNamespace, S as SessionCallOptions, w as SettingsCallOptions, x as SettingsNamespace, y as StorefrontSettingsResult, z as StorefrontSort, A as TagsNamespace, T as ThrottleCart, B as ThrottleLine } from './types-z57bkjjB.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-BnabMMEy.js';
7
+ export { C as CatalogClient, c as createCatalogClient } from './client-CNsVr2lR.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 PagesNamespace, u as ProductsNamespace, P as ProductsQuery, R as Redirect, v as ReviewsNamespace, S as SessionCallOptions, w as SettingsCallOptions, x as SettingsNamespace, y as StorefrontSettingsResult, z as StorefrontSort, A as TagsNamespace, T as ThrottleCart, B as ThrottleLine } from './types-dKvIfrVH.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-c3BVgU6k.js';
10
10
 
11
11
  /** The settings document as `/config` answers it: text resolved, targets as handles. */
12
12
  type ResolvedStorefrontSettings = StorefrontSettings;
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  toAuthAppearance,
27
27
  toDecimalString,
28
28
  toMinor
29
- } from "./chunk-VJHA7J7B.js";
29
+ } from "./chunk-STNQNHNZ.js";
30
30
  import "./chunk-PKBMQBKP.js";
31
31
  export {
32
32
  CURRENCIES,
package/dist/next.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
3
 
4
- var _chunkPZ3SFYH4cjs = require('./chunk-PZ3SFYH4.cjs');
4
+ var _chunk5AJS3CX5cjs = require('./chunk-5AJS3CX5.cjs');
5
5
 
6
6
 
7
7
 
8
- var _chunkJ2GHGQY6cjs = require('./chunk-J2GHGQY6.cjs');
8
+ var _chunk2ODFFMZ4cjs = require('./chunk-2ODFFMZ4.cjs');
9
9
  require('./chunk-ETV4XYOV.cjs');
10
10
 
11
11
  // src/next/verify.ts
@@ -106,7 +106,7 @@ function parseNotice(rawBody) {
106
106
  const event = value;
107
107
  const { generation, scopes } = event;
108
108
  if (event.type !== "storefront.changed" || typeof generation !== "number" || !Number.isSafeInteger(generation) || generation < 0 || !Array.isArray(scopes) || scopes.length === 0 || !scopes.every(
109
- (scope) => typeof scope === "string" && scope.length > 0 && scope.length <= _chunkJ2GHGQY6cjs.TAG_MAX_CHARS
109
+ (scope) => typeof scope === "string" && scope.length > 0 && scope.length <= _chunk2ODFFMZ4cjs.TAG_MAX_CHARS
110
110
  ) || event.test !== void 0 && typeof event.test !== "boolean")
111
111
  return null;
112
112
  return {
@@ -139,10 +139,10 @@ function createRevalidateHandler(options) {
139
139
  const notice = parseNotice(rawBody);
140
140
  if (notice === null) return json(400, { error: "invalid body" });
141
141
  if (notice.test) return json(200, { revalidated: [] });
142
- const tags = _chunkPZ3SFYH4cjs.scopesToTags.call(void 0, notice.scopes);
142
+ const tags = _chunk5AJS3CX5cjs.scopesToTags.call(void 0, notice.scopes);
143
143
  const revalidate = await _asyncNullishCoalesce(options.revalidateTag, async () => ( await defaultRevalidateTag()));
144
144
  for (const tag of tags) revalidate(tag);
145
- _chunkPZ3SFYH4cjs.noteMinGeneration.call(void 0, notice.generation, options.floorKey);
145
+ _chunk5AJS3CX5cjs.noteMinGeneration.call(void 0, notice.generation, options.floorKey);
146
146
  return json(200, { revalidated: tags });
147
147
  };
148
148
  }
@@ -177,4 +177,4 @@ async function getPreviewToken() {
177
177
 
178
178
 
179
179
 
180
- exports.SDK_VERSION = _chunkJ2GHGQY6cjs.SDK_VERSION; exports.createRevalidateHandler = createRevalidateHandler; exports.getPreviewToken = getPreviewToken; exports.noteMinGeneration = _chunkPZ3SFYH4cjs.noteMinGeneration; exports.previewMiddleware = previewMiddleware;
180
+ exports.SDK_VERSION = _chunk2ODFFMZ4cjs.SDK_VERSION; exports.createRevalidateHandler = createRevalidateHandler; exports.getPreviewToken = getPreviewToken; exports.noteMinGeneration = _chunk5AJS3CX5cjs.noteMinGeneration; exports.previewMiddleware = previewMiddleware;
package/dist/next.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  noteMinGeneration,
3
3
  scopesToTags
4
- } from "./chunk-SN6STYPW.js";
4
+ } from "./chunk-P3ABGAF5.js";
5
5
  import {
6
6
  SDK_VERSION,
7
7
  TAG_MAX_CHARS
8
- } from "./chunk-VJHA7J7B.js";
8
+ } from "./chunk-STNQNHNZ.js";
9
9
  import "./chunk-PKBMQBKP.js";
10
10
 
11
11
  // src/next/verify.ts
@@ -3,14 +3,14 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkOKWXS3FDcjs = require('./chunk-OKWXS3FD.cjs');
7
- require('./chunk-J2GHGQY6.cjs');
6
+ var _chunkVOOX3WJYcjs = require('./chunk-VOOX3WJY.cjs');
7
+ require('./chunk-2ODFFMZ4.cjs');
8
8
  require('./chunk-ETV4XYOV.cjs');
9
9
 
10
10
  // src/react/extras/index.ts
11
11
  function useTags(options = {}) {
12
- const extra = _chunkOKWXS3FDcjs.defined.call(void 0, { q: options.q, limit: options.limit });
13
- return _chunkOKWXS3FDcjs.useQuery.call(void 0,
12
+ const extra = _chunkVOOX3WJYcjs.defined.call(void 0, { q: options.q, limit: options.limit });
13
+ return _chunkVOOX3WJYcjs.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 = _chunkOKWXS3FDcjs.defined.call(void 0, { limit: options.limit, cursor: options.cursor });
22
- return _chunkOKWXS3FDcjs.useQuery.call(void 0,
21
+ const extra = _chunkVOOX3WJYcjs.defined.call(void 0, { limit: options.limit, cursor: options.cursor });
22
+ return _chunkVOOX3WJYcjs.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 = _chunkOKWXS3FDcjs.useCustomerKey.call(void 0, );
31
- return _chunkOKWXS3FDcjs.useQuery.call(void 0,
30
+ const customerKey = _chunkVOOX3WJYcjs.useCustomerKey.call(void 0, );
31
+ return _chunkVOOX3WJYcjs.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),
@@ -36,7 +36,7 @@ function useReviewEligibility(handle, options = {}) {
36
36
  );
37
37
  }
38
38
  function usePages(options) {
39
- return _chunkOKWXS3FDcjs.useQuery.call(void 0,
39
+ return _chunkVOOX3WJYcjs.useQuery.call(void 0,
40
40
  "pages",
41
41
  null,
42
42
  (client, call) => client.pages.list(call),
@@ -44,7 +44,7 @@ function usePages(options) {
44
44
  );
45
45
  }
46
46
  function usePage(handle, options) {
47
- return _chunkOKWXS3FDcjs.useQuery.call(void 0,
47
+ return _chunkVOOX3WJYcjs.useQuery.call(void 0,
48
48
  "page",
49
49
  { handle },
50
50
  handle === null ? null : (client, call) => client.pages.get(handle, call),
@@ -1,9 +1,9 @@
1
1
  import { CatalogClient } from './index.cjs';
2
2
  import { QueryOptions, QueryResult } from './react.cjs';
3
- import './types-jNpOwEUw.cjs';
3
+ import './types-BtBxMbM5.cjs';
4
4
  import '@usethrottle/money';
5
- import './contract-types-D2-SSPM9.cjs';
6
- import './catalog-error-BKN5hNWP.cjs';
5
+ import './contract-types-BJMeJSTz.cjs';
6
+ import './catalog-error-bG1XHquN.cjs';
7
7
 
8
8
  type Answer<F extends (...args: never[]) => unknown> = Awaited<ReturnType<F>>;
9
9
  declare function useTags(options?: QueryOptions<Answer<CatalogClient['tags']['list']>> & {
@@ -1,9 +1,9 @@
1
1
  import { CatalogClient } from './index.js';
2
2
  import { QueryOptions, QueryResult } from './react.js';
3
- import './types-z57bkjjB.js';
3
+ import './types-dKvIfrVH.js';
4
4
  import '@usethrottle/money';
5
- import './contract-types-D2-SSPM9.js';
6
- import './catalog-error-BnabMMEy.js';
5
+ import './contract-types-BJMeJSTz.js';
6
+ import './catalog-error-c3BVgU6k.js';
7
7
 
8
8
  type Answer<F extends (...args: never[]) => unknown> = Awaited<ReturnType<F>>;
9
9
  declare function useTags(options?: QueryOptions<Answer<CatalogClient['tags']['list']>> & {
@@ -3,8 +3,8 @@ import {
3
3
  defined,
4
4
  useCustomerKey,
5
5
  useQuery
6
- } from "./chunk-3FX2HISB.js";
7
- import "./chunk-VJHA7J7B.js";
6
+ } from "./chunk-6K7H7HBD.js";
7
+ import "./chunk-STNQNHNZ.js";
8
8
  import "./chunk-PKBMQBKP.js";
9
9
 
10
10
  // src/react/extras/index.ts
package/dist/react.cjs CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
 
19
19
 
20
- var _chunkOKWXS3FDcjs = require('./chunk-OKWXS3FD.cjs');
20
+ var _chunkVOOX3WJYcjs = require('./chunk-VOOX3WJY.cjs');
21
21
 
22
22
 
23
23
 
@@ -25,7 +25,7 @@ var _chunkOKWXS3FDcjs = require('./chunk-OKWXS3FD.cjs');
25
25
 
26
26
 
27
27
 
28
- var _chunkJ2GHGQY6cjs = require('./chunk-J2GHGQY6.cjs');
28
+ var _chunk2ODFFMZ4cjs = require('./chunk-2ODFFMZ4.cjs');
29
29
  require('./chunk-ETV4XYOV.cjs');
30
30
 
31
31
  // src/react/use-cart.ts
@@ -42,7 +42,7 @@ function newKey() {
42
42
  return out;
43
43
  }
44
44
  function refuse(message, path) {
45
- return new (0, _chunkJ2GHGQY6cjs.CatalogError)({
45
+ return new (0, _chunk2ODFFMZ4cjs.CatalogError)({
46
46
  code: "INVALID_REQUEST",
47
47
  message,
48
48
  statusCode: 0,
@@ -55,7 +55,7 @@ var UNSAFE = /[\x00-\x20\x7f]/u;
55
55
  function isHttpUrl(value) {
56
56
  return typeof value === "string" && /^https?:\/\/[^/?#\\]/iu.test(value) && !UNSAFE.test(value);
57
57
  }
58
- var wrap = (error) => _chunkJ2GHGQY6cjs.isCatalogError.call(void 0, error) ? error : new (0, _chunkJ2GHGQY6cjs.CatalogError)({
58
+ var wrap = (error) => _chunk2ODFFMZ4cjs.isCatalogError.call(void 0, error) ? error : new (0, _chunk2ODFFMZ4cjs.CatalogError)({
59
59
  code: "CLIENT_ERROR",
60
60
  message: "The action failed.",
61
61
  statusCode: 0,
@@ -66,7 +66,7 @@ var wrap = (error) => _chunkJ2GHGQY6cjs.isCatalogError.call(void 0, error) ? err
66
66
  function checkPause(store) {
67
67
  const until = store.pausedUntil();
68
68
  if (until > 0) {
69
- throw new (0, _chunkJ2GHGQY6cjs.RateLimitedError)({
69
+ throw new (0, _chunk2ODFFMZ4cjs.RateLimitedError)({
70
70
  code: "RATE_LIMITED",
71
71
  message: "Too many requests.",
72
72
  statusCode: 429,
@@ -76,7 +76,7 @@ function checkPause(store) {
76
76
  }
77
77
  }
78
78
  function notePause(store, error) {
79
- if (error instanceof _chunkJ2GHGQY6cjs.RateLimitedError && error.source === "catalog" && error.code === "RATE_LIMITED")
79
+ if (error instanceof _chunk2ODFFMZ4cjs.RateLimitedError && error.source === "catalog" && error.code === "RATE_LIMITED")
80
80
  store.pause(Date.now() + error.retryAfterSeconds * 1e3, error);
81
81
  }
82
82
  function createBox(initial) {
@@ -111,7 +111,7 @@ var ENDED = /* @__PURE__ */ new Set([
111
111
  "cart_not_open",
112
112
  "cart_not_found"
113
113
  ]);
114
- var ended = (error) => _chunkJ2GHGQY6cjs.isCatalogError.call(void 0, error) && ENDED.has(error.code);
114
+ var ended = (error) => _chunk2ODFFMZ4cjs.isCatalogError.call(void 0, error) && ENDED.has(error.code);
115
115
  var converted = (error) => _optionalChain([error, 'access', _2 => _2.details, 'optionalAccess', _3 => _3.reason]) === "converted";
116
116
  function itemsOf(cart) {
117
117
  const items = /* @__PURE__ */ new Map();
@@ -155,7 +155,7 @@ function createController(home) {
155
155
  throttleBaseUrl === void 0 ? void 0 : { throttleBaseUrl }
156
156
  );
157
157
  };
158
- const fallbackUrl = (id) => `${(_nullishCoalesce(ctx().throttleCheckoutUrl, () => ( _chunkJ2GHGQY6cjs.THROTTLE_CHECKOUT_URL))).replace(/\/+$/u, "")}/cart/${encodeURIComponent(id)}`;
158
+ const fallbackUrl = (id) => `${(_nullishCoalesce(ctx().throttleCheckoutUrl, () => ( _chunk2ODFFMZ4cjs.THROTTLE_CHECKOUT_URL))).replace(/\/+$/u, "")}/cart/${encodeURIComponent(id)}`;
159
159
  const live = async (signal, value) => {
160
160
  const out = await value;
161
161
  if (signal.aborted) throw signal.reason;
@@ -617,7 +617,7 @@ function createController(home) {
617
617
  };
618
618
  }
619
619
  function useCart(options = {}) {
620
- const context = _chunkOKWXS3FDcjs.useCatalogContext.call(void 0, );
620
+ const context = _chunkVOOX3WJYcjs.useCatalogContext.call(void 0, );
621
621
  const home = context.cart;
622
622
  const controller = _nullishCoalesce(home.current, () => ( (home.current = createController(home))));
623
623
  const state = _react.useSyncExternalStore.call(void 0,
@@ -691,7 +691,7 @@ function useCart(options = {}) {
691
691
  { signal: callSignal }
692
692
  );
693
693
  } catch (error) {
694
- const repriced = _chunkJ2GHGQY6cjs.isCatalogError.call(void 0, error) && error.code === "cart_prices_changed" ? _optionalChain([error, 'access', _41 => _41.details, 'optionalAccess', _42 => _42.cart]) : void 0;
694
+ const repriced = _chunk2ODFFMZ4cjs.isCatalogError.call(void 0, error) && error.code === "cart_prices_changed" ? _optionalChain([error, 'access', _41 => _41.details, 'optionalAccess', _42 => _42.cart]) : void 0;
695
695
  if (!callSignal.aborted && typeof repriced === "object" && repriced !== null)
696
696
  controller.box.set({ cart: repriced });
697
697
  throw error;
@@ -711,7 +711,7 @@ function useCart(options = {}) {
711
711
  if (out === void 0)
712
712
  throw _nullishCoalesce(met, () => ( refuse("There is no cart to check out.")));
713
713
  if (!isHttpUrl(out.checkoutUrl))
714
- throw new (0, _chunkJ2GHGQY6cjs.CatalogError)({
714
+ throw new (0, _chunk2ODFFMZ4cjs.CatalogError)({
715
715
  code: "INVALID_RESPONSE",
716
716
  message: "Throttle answered a checkout URL that is not http or https.",
717
717
  statusCode: 200,
@@ -729,7 +729,7 @@ function useCart(options = {}) {
729
729
  const owner = controller.owner();
730
730
  const view = owner !== void 0 && owner !== null && owner !== customerKey ? { ...EMPTY, pending: state.pending } : state;
731
731
  const shownCurrency = _nullishCoalesce(_nullishCoalesce(_optionalChain([view, 'access', _43 => _43.cart, 'optionalAccess', _44 => _44.currency]), () => ( controller.wanted(options))), () => ( ""));
732
- const format = (minor) => _chunkJ2GHGQY6cjs.formatMoney.call(void 0, minor, shownCurrency);
732
+ const format = (minor) => _chunk2ODFFMZ4cjs.formatMoney.call(void 0, minor, shownCurrency);
733
733
  return { ...view, ...actions, format };
734
734
  }
735
735
 
@@ -741,7 +741,7 @@ var IDLE = {
741
741
  result: void 0
742
742
  };
743
743
  function useSubmitReview(handle) {
744
- const { client, store, customerKey } = _chunkOKWXS3FDcjs.useCatalogContext.call(void 0, );
744
+ const { client, store, customerKey } = _chunkVOOX3WJYcjs.useCatalogContext.call(void 0, );
745
745
  const scope = _react.useMemo.call(void 0,
746
746
  () => ({
747
747
  box: createBox(IDLE),
@@ -814,4 +814,4 @@ function useSubmitReview(handle) {
814
814
 
815
815
 
816
816
 
817
- exports.CatalogProvider = _chunkOKWXS3FDcjs.CatalogProvider; exports.SDK_VERSION = _chunkJ2GHGQY6cjs.SDK_VERSION; exports.catalogQueryKey = _chunkOKWXS3FDcjs.catalogQueryKey; exports.createMemoryCartStorage = _chunkOKWXS3FDcjs.createMemoryCartStorage; exports.useCart = useCart; exports.useCatalog = _chunkOKWXS3FDcjs.useCatalog; exports.useCategories = _chunkOKWXS3FDcjs.useCategories; exports.useCollection = _chunkOKWXS3FDcjs.useCollection; exports.useConfig = _chunkOKWXS3FDcjs.useConfig; exports.useCustomerKey = _chunkOKWXS3FDcjs.useCustomerKey; exports.useFilterValues = _chunkOKWXS3FDcjs.useFilterValues; exports.useGenerationWatch = _chunkOKWXS3FDcjs.useGenerationWatch; exports.useProduct = _chunkOKWXS3FDcjs.useProduct; exports.useProducts = _chunkOKWXS3FDcjs.useProducts; exports.useRelated = _chunkOKWXS3FDcjs.useRelated; exports.useReviews = _chunkOKWXS3FDcjs.useReviews; exports.useStorefrontSettings = _chunkOKWXS3FDcjs.useStorefrontSettings; exports.useSubmitReview = useSubmitReview; exports.useSuggest = _chunkOKWXS3FDcjs.useSuggest;
817
+ exports.CatalogProvider = _chunkVOOX3WJYcjs.CatalogProvider; exports.SDK_VERSION = _chunk2ODFFMZ4cjs.SDK_VERSION; exports.catalogQueryKey = _chunkVOOX3WJYcjs.catalogQueryKey; exports.createMemoryCartStorage = _chunkVOOX3WJYcjs.createMemoryCartStorage; exports.useCart = useCart; exports.useCatalog = _chunkVOOX3WJYcjs.useCatalog; exports.useCategories = _chunkVOOX3WJYcjs.useCategories; exports.useCollection = _chunkVOOX3WJYcjs.useCollection; exports.useConfig = _chunkVOOX3WJYcjs.useConfig; exports.useCustomerKey = _chunkVOOX3WJYcjs.useCustomerKey; exports.useFilterValues = _chunkVOOX3WJYcjs.useFilterValues; exports.useGenerationWatch = _chunkVOOX3WJYcjs.useGenerationWatch; exports.useProduct = _chunkVOOX3WJYcjs.useProduct; exports.useProducts = _chunkVOOX3WJYcjs.useProducts; exports.useRelated = _chunkVOOX3WJYcjs.useRelated; exports.useReviews = _chunkVOOX3WJYcjs.useReviews; exports.useStorefrontSettings = _chunkVOOX3WJYcjs.useStorefrontSettings; exports.useSubmitReview = useSubmitReview; exports.useSuggest = _chunkVOOX3WJYcjs.useSuggest;
package/dist/react.d.cts CHANGED
@@ -1,11 +1,11 @@
1
1
  export { ReviewEligibility } from './index.cjs';
2
2
  import { ReactNode } from 'react';
3
3
  import { CatalogClient } from './index.cjs';
4
- import { C as CustomerCartSource } from './types-jNpOwEUw.cjs';
4
+ import { C as CustomerCartSource } from './types-BtBxMbM5.cjs';
5
5
  import { CategoryTreeDepth, ProductsQuery, ThrottleCart, CartWarning } from './index.cjs';
6
- export { O as OpenCartRef } from './types-jNpOwEUw.cjs';
7
- import { Q as QueryOptions, a as QueryResult } from './use-query-H1xgL3_e.cjs';
8
- export { c as catalogQueryKey } from './use-query-H1xgL3_e.cjs';
6
+ export { O as OpenCartRef } from './types-BtBxMbM5.cjs';
7
+ import { Q as QueryOptions, a as QueryResult } from './use-query-C2rfTJd4.cjs';
8
+ export { c as catalogQueryKey } from './use-query-C2rfTJd4.cjs';
9
9
  import { CatalogError } from './admin.cjs';
10
10
  import { ReviewSubmitAnswer, ReviewSubmitInput } from './index.cjs';
11
11
  export { S as SDK_VERSION } from './version-ev3p03v2.cjs';
package/dist/react.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export { ReviewEligibility } from './index.js';
2
2
  import { ReactNode } from 'react';
3
3
  import { CatalogClient } from './index.js';
4
- import { C as CustomerCartSource } from './types-z57bkjjB.js';
4
+ import { C as CustomerCartSource } from './types-dKvIfrVH.js';
5
5
  import { CategoryTreeDepth, ProductsQuery, ThrottleCart, CartWarning } from './index.js';
6
- export { O as OpenCartRef } from './types-z57bkjjB.js';
7
- import { Q as QueryOptions, a as QueryResult } from './use-query-COqRZJnC.js';
8
- export { c as catalogQueryKey } from './use-query-COqRZJnC.js';
6
+ export { O as OpenCartRef } from './types-dKvIfrVH.js';
7
+ import { Q as QueryOptions, a as QueryResult } from './use-query-DeCj1hXt.js';
8
+ export { c as catalogQueryKey } from './use-query-DeCj1hXt.js';
9
9
  import { CatalogError } from './admin.js';
10
10
  import { ReviewSubmitAnswer, ReviewSubmitInput } from './index.js';
11
11
  export { S as SDK_VERSION } from './version-ev3p03v2.js';
package/dist/react.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  useReviews,
18
18
  useStorefrontSettings,
19
19
  useSuggest
20
- } from "./chunk-3FX2HISB.js";
20
+ } from "./chunk-6K7H7HBD.js";
21
21
  import {
22
22
  CatalogError,
23
23
  RateLimitedError,
@@ -25,7 +25,7 @@ import {
25
25
  THROTTLE_CHECKOUT_URL,
26
26
  formatMoney,
27
27
  isCatalogError
28
- } from "./chunk-VJHA7J7B.js";
28
+ } from "./chunk-STNQNHNZ.js";
29
29
  import "./chunk-PKBMQBKP.js";
30
30
 
31
31
  // src/react/use-cart.ts
package/dist/server.cjs CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkPZ3SFYH4cjs = require('./chunk-PZ3SFYH4.cjs');
11
+ var _chunk5AJS3CX5cjs = require('./chunk-5AJS3CX5.cjs');
12
12
 
13
13
 
14
14
 
@@ -17,17 +17,17 @@ var _chunkPZ3SFYH4cjs = require('./chunk-PZ3SFYH4.cjs');
17
17
 
18
18
 
19
19
 
20
- var _chunkJ2GHGQY6cjs = require('./chunk-J2GHGQY6.cjs');
20
+ var _chunk2ODFFMZ4cjs = require('./chunk-2ODFFMZ4.cjs');
21
21
  require('./chunk-ETV4XYOV.cjs');
22
22
 
23
23
  // src/server/client.ts
24
24
  function serverInit(url, init, storefront, policies, extraTags) {
25
25
  const { next, ...rest } = init;
26
- const tags = rest.method === "GET" ? _chunkPZ3SFYH4cjs.tagsForUrl.call(void 0, url, storefront) : null;
26
+ const tags = rest.method === "GET" ? _chunk5AJS3CX5cjs.tagsForUrl.call(void 0, url, storefront) : null;
27
27
  if (tags === null || rest.cache === "no-store")
28
28
  return { ...rest, cache: "no-store" };
29
29
  if (next !== void 0) return init;
30
- const kind = _chunkPZ3SFYH4cjs.cacheKindForPath.call(void 0, url.slice(storefront.length));
30
+ const kind = _chunk5AJS3CX5cjs.cacheKindForPath.call(void 0, url.slice(storefront.length));
31
31
  const policy = kind === null ? "no-store" : policies(kind);
32
32
  if (policy === "no-store") return { ...rest, cache: "no-store" };
33
33
  return {
@@ -47,16 +47,16 @@ function createServerCatalogClient(options) {
47
47
  const named = /* @__PURE__ */ new Map();
48
48
  for (const [kind, policy] of Object.entries(_nullishCoalesce(cachePolicy, () => ( {}))))
49
49
  if (policy !== void 0)
50
- named.set(kind, _chunkPZ3SFYH4cjs.policyToNext.call(void 0, policy));
51
- const policies = (kind) => _nullishCoalesce(named.get(kind), () => ( (_optionalChain([next, 'optionalAccess', _ => _.revalidate]) === void 0 ? _chunkPZ3SFYH4cjs.policyToNext.call(void 0, _chunkPZ3SFYH4cjs.DEFAULT_CACHE_POLICY[kind]) : { revalidate: next.revalidate })));
50
+ named.set(kind, _chunk5AJS3CX5cjs.policyToNext.call(void 0, policy));
51
+ const policies = (kind) => _nullishCoalesce(named.get(kind), () => ( (_optionalChain([next, 'optionalAccess', _ => _.revalidate]) === void 0 ? _chunk5AJS3CX5cjs.policyToNext.call(void 0, _chunk5AJS3CX5cjs.DEFAULT_CACHE_POLICY[kind]) : { revalidate: next.revalidate })));
52
52
  const floorKey = _nullishCoalesce(namedFloorKey, () => ( rest.publishableKey));
53
53
  const extraTags = _nullishCoalesce(_optionalChain([next, 'optionalAccess', _2 => _2.tags]), () => ( []));
54
- const storefront = `${(_nullishCoalesce(rest.baseUrl, () => ( _chunkJ2GHGQY6cjs.DEFAULT_BASE_URL))).replace(/\/+$/u, "")}/v1/storefront/`;
54
+ const storefront = `${(_nullishCoalesce(rest.baseUrl, () => ( _chunk2ODFFMZ4cjs.DEFAULT_BASE_URL))).replace(/\/+$/u, "")}/v1/storefront/`;
55
55
  const base = rest.fetch;
56
56
  const serverFetch = (input, init = {}) => {
57
57
  let target = String(input);
58
- const isConfig = init.method === "GET" && target.startsWith(storefront) && _optionalChain([_chunkPZ3SFYH4cjs.storefrontRoute.call(void 0, target.slice(storefront.length)), 'optionalAccess', _3 => _3.route]) === "config";
59
- const floor = isConfig ? _chunkPZ3SFYH4cjs.pendingMinGeneration.call(void 0, floorKey) : void 0;
58
+ const isConfig = init.method === "GET" && target.startsWith(storefront) && _optionalChain([_chunk5AJS3CX5cjs.storefrontRoute.call(void 0, target.slice(storefront.length)), 'optionalAccess', _3 => _3.route]) === "config";
59
+ const floor = isConfig ? _chunk5AJS3CX5cjs.pendingMinGeneration.call(void 0, floorKey) : void 0;
60
60
  if (floor !== void 0 && !target.includes("minGeneration="))
61
61
  target += `${target.includes("?") ? "&" : "?"}minGeneration=${floor}`;
62
62
  const out = serverInit(
@@ -71,7 +71,7 @@ function createServerCatalogClient(options) {
71
71
  return answer.then(async (response) => {
72
72
  if (response.ok)
73
73
  try {
74
- _chunkPZ3SFYH4cjs.observeGeneration.call(void 0,
74
+ _chunk5AJS3CX5cjs.observeGeneration.call(void 0,
75
75
  (await response.clone().json()).generation,
76
76
  floorKey
77
77
  );
@@ -80,7 +80,7 @@ function createServerCatalogClient(options) {
80
80
  return response;
81
81
  });
82
82
  };
83
- return _chunkJ2GHGQY6cjs.createCatalogClient.call(void 0, {
83
+ return _chunk2ODFFMZ4cjs.createCatalogClient.call(void 0, {
84
84
  ...rest,
85
85
  fetch: serverFetch
86
86
  });
@@ -100,16 +100,16 @@ async function syncCatalogGeneration(input) {
100
100
 
101
101
  // src/server/paging.ts
102
102
  function bounds(opts) {
103
- const pageSize = _nullishCoalesce(opts.pageSize, () => ( _chunkJ2GHGQY6cjs.LIST_PAGE_SIZE));
104
- const max = _nullishCoalesce(opts.max, () => ( _chunkJ2GHGQY6cjs.LIST_MAX_HANDLES));
105
- if (!Number.isInteger(pageSize) || pageSize < 1 || pageSize > _chunkJ2GHGQY6cjs.LIST_PAGE_SIZE)
103
+ const pageSize = _nullishCoalesce(opts.pageSize, () => ( _chunk2ODFFMZ4cjs.LIST_PAGE_SIZE));
104
+ const max = _nullishCoalesce(opts.max, () => ( _chunk2ODFFMZ4cjs.LIST_MAX_HANDLES));
105
+ if (!Number.isInteger(pageSize) || pageSize < 1 || pageSize > _chunk2ODFFMZ4cjs.LIST_PAGE_SIZE)
106
106
  throw invalid("pageSize must be a whole number from 1 to 100.");
107
107
  if (!Number.isInteger(max) || max < 0)
108
108
  throw invalid("max must be a whole number of 0 or more.");
109
109
  return { pageSize, max };
110
110
  }
111
111
  function invalid(message) {
112
- return new (0, _chunkJ2GHGQY6cjs.CatalogError)({
112
+ return new (0, _chunk2ODFFMZ4cjs.CatalogError)({
113
113
  code: "INVALID_REQUEST",
114
114
  message,
115
115
  statusCode: 0,
@@ -179,7 +179,7 @@ function listAllCollectionHandles(client, opts = {}) {
179
179
  }
180
180
  async function listAllCategoryHandles(client, opts = {}) {
181
181
  const { categories } = await client.categories.tree({
182
- depth: _chunkJ2GHGQY6cjs.CATEGORY_TREE_MAX_DEPTH,
182
+ depth: _chunk2ODFFMZ4cjs.CATEGORY_TREE_MAX_DEPTH,
183
183
  ...call(opts.signal)
184
184
  });
185
185
  const out = [];
@@ -205,4 +205,4 @@ async function listAllCategoryHandles(client, opts = {}) {
205
205
 
206
206
 
207
207
 
208
- exports.DEFAULT_CACHE_POLICY = _chunkPZ3SFYH4cjs.DEFAULT_CACHE_POLICY; exports.SDK_VERSION = _chunkJ2GHGQY6cjs.SDK_VERSION; exports.cacheKindForPath = _chunkPZ3SFYH4cjs.cacheKindForPath; exports.catalogTags = _chunkPZ3SFYH4cjs.catalogTags; exports.createServerCatalogClient = createServerCatalogClient; exports.listAllCategoryHandles = listAllCategoryHandles; exports.listAllCollectionHandles = listAllCollectionHandles; exports.listAllProductHandles = listAllProductHandles; exports.policyToNext = _chunkPZ3SFYH4cjs.policyToNext; exports.scopesToTags = _chunkPZ3SFYH4cjs.scopesToTags; exports.staticProductParams = staticProductParams; exports.syncCatalogGeneration = syncCatalogGeneration;
208
+ exports.DEFAULT_CACHE_POLICY = _chunk5AJS3CX5cjs.DEFAULT_CACHE_POLICY; exports.SDK_VERSION = _chunk2ODFFMZ4cjs.SDK_VERSION; exports.cacheKindForPath = _chunk5AJS3CX5cjs.cacheKindForPath; exports.catalogTags = _chunk5AJS3CX5cjs.catalogTags; exports.createServerCatalogClient = createServerCatalogClient; exports.listAllCategoryHandles = listAllCategoryHandles; exports.listAllCollectionHandles = listAllCollectionHandles; exports.listAllProductHandles = listAllProductHandles; exports.policyToNext = _chunk5AJS3CX5cjs.policyToNext; exports.scopesToTags = _chunk5AJS3CX5cjs.scopesToTags; exports.staticProductParams = staticProductParams; exports.syncCatalogGeneration = syncCatalogGeneration;
package/dist/server.d.cts CHANGED
@@ -2,7 +2,7 @@ export { S as SDK_VERSION } from './version-ev3p03v2.cjs';
2
2
  import { CatalogClient } from './index.cjs';
3
3
  import { CatalogClientOptions, NextFetchOptions } from './index.cjs';
4
4
  import '@usethrottle/money';
5
- import './contract-types-D2-SSPM9.cjs';
5
+ import './contract-types-BJMeJSTz.cjs';
6
6
 
7
7
  /** A kind of storefront data, each with its own cache policy. */
8
8
  type CacheKind = 'settings' | 'navigation' | 'pages' | 'listings' | 'facets' | 'product' | 'related' | 'reviews' | 'search';
package/dist/server.d.ts CHANGED
@@ -2,7 +2,7 @@ export { S as SDK_VERSION } from './version-ev3p03v2.js';
2
2
  import { CatalogClient } from './index.js';
3
3
  import { CatalogClientOptions, NextFetchOptions } from './index.js';
4
4
  import '@usethrottle/money';
5
- import './contract-types-D2-SSPM9.js';
5
+ import './contract-types-BJMeJSTz.js';
6
6
 
7
7
  /** A kind of storefront data, each with its own cache policy. */
8
8
  type CacheKind = 'settings' | 'navigation' | 'pages' | 'listings' | 'facets' | 'product' | 'related' | 'reviews' | 'search';
package/dist/server.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  scopesToTags,
9
9
  storefrontRoute,
10
10
  tagsForUrl
11
- } from "./chunk-SN6STYPW.js";
11
+ } from "./chunk-P3ABGAF5.js";
12
12
  import {
13
13
  CATEGORY_TREE_MAX_DEPTH,
14
14
  CatalogError,
@@ -17,7 +17,7 @@ import {
17
17
  LIST_PAGE_SIZE,
18
18
  SDK_VERSION,
19
19
  createCatalogClient
20
- } from "./chunk-VJHA7J7B.js";
20
+ } from "./chunk-STNQNHNZ.js";
21
21
  import "./chunk-PKBMQBKP.js";
22
22
 
23
23
  // src/server/client.ts
@@ -1,5 +1,5 @@
1
1
  import { CurrencyCode } from '@usethrottle/money';
2
- import { C as CartCheckAnswer, j as CartCreateRequest, i as CartCreateAnswer, d as StorefrontListAnswer, g as StorefrontProductAnswer, u as StorefrontRelatedAnswer, r as StorefrontFilterValuesAnswer, l as StorefrontCategoriesAnswer, m as StorefrontCategoryAnswer, x as StorefrontTagsAnswer, o as StorefrontCollectionsAnswer, n as StorefrontCollectionAnswer, w as StorefrontSuggestAnswer, p as StorefrontConfigAnswer, S as StorefrontSettings, t as StorefrontPagesAnswer, s as StorefrontPageAnswer, v as StorefrontReviewsAnswer, f as ReviewEligibilityAnswer, a as ReviewSubmitInput, R as ReviewSubmitAnswer } from './contract-types-D2-SSPM9.cjs';
2
+ import { C as CartCheckAnswer, j as CartCreateRequest, i as CartCreateAnswer, d as StorefrontListAnswer, g as StorefrontProductAnswer, w as StorefrontRelatedAnswer, r as StorefrontFilterValuesAnswer, l as StorefrontCategoriesAnswer, m as StorefrontCategoryAnswer, z as StorefrontTagsAnswer, o as StorefrontCollectionsAnswer, n as StorefrontCollectionAnswer, y as StorefrontSuggestAnswer, p as StorefrontConfigAnswer, S as StorefrontSettings, v as StorefrontPagesAnswer, u as StorefrontPageAnswer, x as StorefrontReviewsAnswer, f as ReviewEligibilityAnswer, a as ReviewSubmitInput, R as ReviewSubmitAnswer } from './contract-types-BJMeJSTz.cjs';
3
3
 
4
4
  type QueryPairs = [string, string][];
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { CurrencyCode } from '@usethrottle/money';
2
- import { C as CartCheckAnswer, j as CartCreateRequest, i as CartCreateAnswer, d as StorefrontListAnswer, g as StorefrontProductAnswer, u as StorefrontRelatedAnswer, r as StorefrontFilterValuesAnswer, l as StorefrontCategoriesAnswer, m as StorefrontCategoryAnswer, x as StorefrontTagsAnswer, o as StorefrontCollectionsAnswer, n as StorefrontCollectionAnswer, w as StorefrontSuggestAnswer, p as StorefrontConfigAnswer, S as StorefrontSettings, t as StorefrontPagesAnswer, s as StorefrontPageAnswer, v as StorefrontReviewsAnswer, f as ReviewEligibilityAnswer, a as ReviewSubmitInput, R as ReviewSubmitAnswer } from './contract-types-D2-SSPM9.js';
2
+ import { C as CartCheckAnswer, j as CartCreateRequest, i as CartCreateAnswer, d as StorefrontListAnswer, g as StorefrontProductAnswer, w as StorefrontRelatedAnswer, r as StorefrontFilterValuesAnswer, l as StorefrontCategoriesAnswer, m as StorefrontCategoryAnswer, z as StorefrontTagsAnswer, o as StorefrontCollectionsAnswer, n as StorefrontCollectionAnswer, y as StorefrontSuggestAnswer, p as StorefrontConfigAnswer, S as StorefrontSettings, v as StorefrontPagesAnswer, u as StorefrontPageAnswer, x as StorefrontReviewsAnswer, f as ReviewEligibilityAnswer, a as ReviewSubmitInput, R as ReviewSubmitAnswer } from './contract-types-BJMeJSTz.js';
3
3
 
4
4
  type QueryPairs = [string, string][];
5
5
 
package/dist/url.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ProductsQuery } from './index.cjs';
2
2
  import '@usethrottle/money';
3
- import './contract-types-D2-SSPM9.cjs';
3
+ import './contract-types-BJMeJSTz.cjs';
4
4
 
5
5
  /** The shop page's selection as URL state (P6-R16). */
6
6
  type ShopQuery = {
package/dist/url.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ProductsQuery } from './index.js';
2
2
  import '@usethrottle/money';
3
- import './contract-types-D2-SSPM9.js';
3
+ import './contract-types-BJMeJSTz.js';
4
4
 
5
5
  /** The shop page's selection as URL state (P6-R16). */
6
6
  type ShopQuery = {
@@ -1,4 +1,4 @@
1
- import { b as CatalogError } from './catalog-error-BKN5hNWP.cjs';
1
+ import { b as CatalogError } from './catalog-error-bG1XHquN.cjs';
2
2
 
3
3
  type QueryResult<T> = {
4
4
  data: T | undefined;
@@ -1,4 +1,4 @@
1
- import { b as CatalogError } from './catalog-error-BnabMMEy.js';
1
+ import { b as CatalogError } from './catalog-error-c3BVgU6k.js';
2
2
 
3
3
  type QueryResult<T> = {
4
4
  data: T | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usethrottle/catalog",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Storefront SDK for the Throttle Product Catalog: a typed client, React hooks, server helpers and URL helpers.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -99,7 +99,7 @@
99
99
  },
100
100
  "dependencies": {
101
101
  "@usethrottle/errors": "^1.1.0",
102
- "@usethrottle/money": "^1.0.0"
102
+ "@usethrottle/money": "^1.1.0"
103
103
  },
104
104
  "peerDependencies": {
105
105
  "next": ">=14",