@01.software/sdk 0.2.9-dev.260306.4e16dd4 → 0.2.9-dev.260310.cf511cb

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/dist/index.js CHANGED
@@ -113,6 +113,19 @@ var TimeoutError = class extends SDKError {
113
113
  this.name = "TimeoutError";
114
114
  }
115
115
  };
116
+ var GoneError = class extends SDKError {
117
+ constructor(message = "The requested resource is no longer available.", details, userMessage, suggestion) {
118
+ super("GONE_ERROR", message, 410, details, userMessage, suggestion);
119
+ this.name = "GoneError";
120
+ }
121
+ };
122
+ var ServiceUnavailableError = class extends SDKError {
123
+ constructor(message = "Service temporarily unavailable.", retryAfter, details, userMessage, suggestion) {
124
+ super("SERVICE_UNAVAILABLE_ERROR", message, 503, details, userMessage, suggestion);
125
+ this.name = "ServiceUnavailableError";
126
+ this.retryAfter = retryAfter;
127
+ }
128
+ };
116
129
  var UsageLimitError = class extends SDKError {
117
130
  constructor(message, usage, details, userMessage, suggestion) {
118
131
  super("USAGE_LIMIT_ERROR", message, 429, details, userMessage, suggestion);
@@ -143,6 +156,12 @@ function isConfigError(error) {
143
156
  function isTimeoutError(error) {
144
157
  return error instanceof TimeoutError;
145
158
  }
159
+ function isGoneError(error) {
160
+ return error instanceof GoneError;
161
+ }
162
+ function isServiceUnavailableError(error) {
163
+ return error instanceof ServiceUnavailableError;
164
+ }
146
165
  function isUsageLimitError(error) {
147
166
  return error instanceof UsageLimitError;
148
167
  }
@@ -156,8 +175,8 @@ var createUsageLimitError = (message, usage, details, userMessage, suggestion) =
156
175
  // src/core/client/types.ts
157
176
  var API_URLS = {
158
177
  local: "http://localhost:3000",
159
- development: "https://dev.01.software",
160
- staging: "https://stg.01.software",
178
+ development: "https://api-dev.01.software",
179
+ staging: "https://api-stg.01.software",
161
180
  production: "https://api.01.software"
162
181
  };
163
182
  function resolveApiUrl(config) {
@@ -286,7 +305,8 @@ function _fetch(url, options) {
286
305
  timeout = DEFAULT_TIMEOUT,
287
306
  baseUrl = API_URLS.production,
288
307
  debug,
289
- retry
308
+ retry,
309
+ onUnauthorized
290
310
  } = _a, requestInit = __objRest(_a, [
291
311
  "clientKey",
292
312
  "secretKey",
@@ -294,7 +314,8 @@ function _fetch(url, options) {
294
314
  "timeout",
295
315
  "baseUrl",
296
316
  "debug",
297
- "retry"
317
+ "retry",
318
+ "onUnauthorized"
298
319
  ]);
299
320
  const retryConfig = {
300
321
  maxRetries: (_b = retry == null ? void 0 : retry.maxRetries) != null ? _b : 3,
@@ -308,6 +329,7 @@ function _fetch(url, options) {
308
329
  authToken = customerToken;
309
330
  }
310
331
  let lastError;
332
+ let hasRetried401 = false;
311
333
  for (let attempt = 0; attempt <= retryConfig.maxRetries; attempt++) {
312
334
  try {
313
335
  const headers = new Headers(requestInit.headers);
@@ -355,6 +377,17 @@ function _fetch(url, options) {
355
377
  "Upgrade your tenant plan to increase the monthly API call limit."
356
378
  );
357
379
  }
380
+ if (response.status === 401 && onUnauthorized && customerToken && !hasRetried401) {
381
+ hasRetried401 = true;
382
+ try {
383
+ const newToken = yield onUnauthorized();
384
+ if (newToken) {
385
+ authToken = newToken;
386
+ continue;
387
+ }
388
+ } catch (e) {
389
+ }
390
+ }
358
391
  if (NON_RETRYABLE_STATUSES.includes(response.status)) {
359
392
  throw createNetworkError(
360
393
  `HTTP ${response.status}: ${response.statusText}`,
@@ -507,6 +540,9 @@ var OrderApi = class {
507
540
  createFulfillment(params) {
508
541
  return this.request("/api/orders/create-fulfillment", params);
509
542
  }
543
+ updateFulfillment(params) {
544
+ return this.request("/api/orders/update-fulfillment", params);
545
+ }
510
546
  returnWithRefund(params) {
511
547
  return this.request("/api/returns/return-refund", params);
512
548
  }
@@ -516,6 +552,18 @@ var OrderApi = class {
516
552
  updateReturn(params) {
517
553
  return this.request("/api/returns/update", params);
518
554
  }
555
+ validateDiscount(params) {
556
+ return this.request("/api/discounts/validate", params);
557
+ }
558
+ calculateShipping(params) {
559
+ return this.request("/api/shipping-policies/calculate", params);
560
+ }
561
+ createExchange(params) {
562
+ return this.request("/api/exchanges/create", params);
563
+ }
564
+ updateExchange(params) {
565
+ return this.request("/api/exchanges/update", params);
566
+ }
519
567
  };
520
568
 
521
569
  // src/core/api/cart-api.ts
@@ -531,18 +579,18 @@ var CartApi = class {
531
579
  this.secretKey = options.secretKey;
532
580
  this.customerToken = options.customerToken;
533
581
  this.baseUrl = options.baseUrl;
582
+ this.onUnauthorized = options.onUnauthorized;
534
583
  }
535
- request(endpoint, body) {
584
+ execute(endpoint, method, body) {
536
585
  return __async(this, null, function* () {
537
586
  const token = typeof this.customerToken === "function" ? this.customerToken() : this.customerToken;
538
- const response = yield _fetch(endpoint, {
539
- method: "POST",
587
+ const response = yield _fetch(endpoint, __spreadValues(__spreadValues({
588
+ method,
540
589
  clientKey: this.clientKey,
541
590
  secretKey: this.secretKey,
542
591
  customerToken: token != null ? token : void 0,
543
- baseUrl: this.baseUrl,
544
- body: JSON.stringify(body)
545
- });
592
+ baseUrl: this.baseUrl
593
+ }, token && this.onUnauthorized && { onUnauthorized: this.onUnauthorized }), body !== void 0 && { body: JSON.stringify(body) }));
546
594
  let data;
547
595
  try {
548
596
  data = yield response.json();
@@ -568,14 +616,26 @@ var CartApi = class {
568
616
  return data;
569
617
  });
570
618
  }
619
+ getCart(cartId) {
620
+ return this.execute(`/api/carts/${cartId}`, "GET");
621
+ }
571
622
  addItem(params) {
572
- return this.request("/api/carts/add-item", params);
623
+ return this.execute("/api/carts/add-item", "POST", params);
573
624
  }
574
625
  updateItem(params) {
575
- return this.request("/api/carts/update-item", params);
626
+ return this.execute("/api/carts/update-item", "POST", params);
576
627
  }
577
628
  removeItem(params) {
578
- return this.request("/api/carts/remove-item", params);
629
+ return this.execute("/api/carts/remove-item", "POST", params);
630
+ }
631
+ applyDiscount(params) {
632
+ return this.execute("/api/carts/apply-discount", "POST", params);
633
+ }
634
+ removeDiscount(params) {
635
+ return this.execute("/api/carts/remove-discount", "POST", params);
636
+ }
637
+ clearCart(params) {
638
+ return this.execute("/api/carts/clear", "POST", params);
579
639
  }
580
640
  };
581
641
 
@@ -633,42 +693,44 @@ var ProductApi = class {
633
693
 
634
694
  // src/utils/types.ts
635
695
  var resolveRelation = (ref) => {
636
- if (typeof ref === "string" || ref === null || ref === void 0)
696
+ if (typeof ref === "string" || typeof ref === "number" || ref === null || ref === void 0)
637
697
  return null;
638
698
  return ref;
639
699
  };
640
- var objectFor = resolveRelation;
641
700
 
642
701
  // src/core/metadata/index.ts
643
- var COLLECTION_META_FIELDS = {
644
- products: { description: "subtitle", image: "thumbnail" },
645
- posts: { description: "excerpt", image: "thumbnail" },
646
- documents: { description: "summary", image: "" },
647
- playlists: { description: "description", image: "image" }
648
- };
649
- var DEFAULT_META_FIELDS = { description: "description", image: "thumbnail" };
650
- function extractMetaFields(collection, doc) {
651
- var _a, _b, _c, _d;
652
- const mapping = (_a = COLLECTION_META_FIELDS[collection]) != null ? _a : DEFAULT_META_FIELDS;
702
+ function extractSeo(doc) {
703
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
704
+ const seo = (_a = doc.seo) != null ? _a : {};
705
+ const og = (_b = seo.openGraph) != null ? _b : {};
653
706
  return {
654
- title: (_b = doc.title) != null ? _b : null,
655
- description: mapping.description ? (_c = doc[mapping.description]) != null ? _c : null : null,
656
- image: mapping.image ? (_d = doc[mapping.image]) != null ? _d : null : null
707
+ title: (_d = (_c = seo.title) != null ? _c : doc.title) != null ? _d : null,
708
+ description: (_e = seo.description) != null ? _e : null,
709
+ noIndex: (_f = seo.noIndex) != null ? _f : null,
710
+ canonical: (_g = seo.canonical) != null ? _g : null,
711
+ openGraph: {
712
+ title: (_h = og.title) != null ? _h : null,
713
+ description: (_i = og.description) != null ? _i : null,
714
+ image: (_j = og.image) != null ? _j : null
715
+ }
657
716
  };
658
717
  }
659
718
  function generateMetadata(input, options) {
660
- var _a, _b, _c, _d;
661
- const title = (_b = (_a = input.title) != null ? _a : options == null ? void 0 : options.title) != null ? _b : void 0;
662
- const description = (_d = (_c = input.description) != null ? _c : options == null ? void 0 : options.description) != null ? _d : void 0;
663
- const image = resolveMetaImage(input.image);
664
- return {
719
+ var _a, _b, _c, _d, _e, _f, _g;
720
+ const title = (_a = input.title) != null ? _a : void 0;
721
+ const description = (_b = input.description) != null ? _b : void 0;
722
+ const ogTitle = (_d = (_c = input.openGraph) == null ? void 0 : _c.title) != null ? _d : title;
723
+ const ogDescription = (_f = (_e = input.openGraph) == null ? void 0 : _e.description) != null ? _f : description;
724
+ const image = resolveMetaImage((_g = input.openGraph) == null ? void 0 : _g.image);
725
+ return __spreadProps(__spreadValues(__spreadValues({
665
726
  title,
666
- description,
667
- openGraph: __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, title && { title }), description && { description }), (options == null ? void 0 : options.siteName) && { siteName: options.siteName }), image && { images: [image] }),
727
+ description
728
+ }, input.noIndex && { robots: { index: false, follow: false } }), input.canonical && { alternates: { canonical: input.canonical } }), {
729
+ openGraph: __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, ogTitle && { title: ogTitle }), ogDescription && { description: ogDescription }), (options == null ? void 0 : options.siteName) && { siteName: options.siteName }), image && { images: [image] }),
668
730
  twitter: __spreadValues(__spreadValues(__spreadValues({
669
731
  card: image ? "summary_large_image" : "summary"
670
- }, title && { title }), description && { description }), image && { images: [image.url] })
671
- };
732
+ }, ogTitle && { title: ogTitle }), ogDescription && { description: ogDescription }), image && { images: [image.url] })
733
+ });
672
734
  }
673
735
  function resolveMetaImage(ref) {
674
736
  var _a;
@@ -778,7 +840,7 @@ var CollectionQueryBuilder = class {
778
840
  const doc = docs[0];
779
841
  if (!doc) return null;
780
842
  return generateMetadata(
781
- extractMetaFields(String(this.collection), doc),
843
+ extractSeo(doc),
782
844
  metadataOptions
783
845
  );
784
846
  });
@@ -792,7 +854,7 @@ var CollectionQueryBuilder = class {
792
854
  return __async(this, null, function* () {
793
855
  const doc = yield this.findById(id, { depth: 1 });
794
856
  return generateMetadata(
795
- extractMetaFields(String(this.collection), doc),
857
+ extractSeo(doc),
796
858
  metadataOptions
797
859
  );
798
860
  });
@@ -840,7 +902,7 @@ var CollectionQueryBuilder = class {
840
902
  // src/core/collection/http-client.ts
841
903
  import { stringify } from "qs-esm";
842
904
  var HttpClient = class {
843
- constructor(clientKey, secretKey, baseUrl, getCustomerToken) {
905
+ constructor(clientKey, secretKey, baseUrl, getCustomerToken, onUnauthorized) {
844
906
  if (!clientKey) {
845
907
  throw createValidationError("clientKey is required.");
846
908
  }
@@ -848,6 +910,7 @@ var HttpClient = class {
848
910
  this.secretKey = secretKey;
849
911
  this.baseUrl = baseUrl;
850
912
  this.getCustomerToken = getCustomerToken;
913
+ this.onUnauthorized = onUnauthorized;
851
914
  }
852
915
  get defaultOptions() {
853
916
  var _a;
@@ -855,6 +918,9 @@ var HttpClient = class {
855
918
  const token = (_a = this.getCustomerToken) == null ? void 0 : _a.call(this);
856
919
  if (token) {
857
920
  opts.customerToken = token;
921
+ if (this.onUnauthorized) {
922
+ opts.onUnauthorized = this.onUnauthorized;
923
+ }
858
924
  }
859
925
  return opts;
860
926
  }
@@ -896,6 +962,7 @@ var HttpClient = class {
896
962
  nextPage: (_b = jsonData.nextPage) != null ? _b : null
897
963
  };
898
964
  } catch (error) {
965
+ if (error instanceof SDKError) throw error;
899
966
  throw createApiError("Failed to parse response.", response.status, {
900
967
  contentType,
901
968
  error: error instanceof Error ? error.message : error
@@ -922,6 +989,7 @@ var HttpClient = class {
922
989
  errors: jsonData.errors
923
990
  };
924
991
  } catch (error) {
992
+ if (error instanceof SDKError) throw error;
925
993
  throw createApiError("Failed to parse response.", response.status, {
926
994
  contentType,
927
995
  error: error instanceof Error ? error.message : error
@@ -941,6 +1009,7 @@ var HttpClient = class {
941
1009
  const jsonData = yield response.json();
942
1010
  return jsonData;
943
1011
  } catch (error) {
1012
+ if (error instanceof SDKError) throw error;
944
1013
  throw createApiError("Failed to parse response.", response.status, {
945
1014
  contentType,
946
1015
  error: error instanceof Error ? error.message : error
@@ -960,8 +1029,8 @@ function buildPayloadFormData(data, file, filename) {
960
1029
  return formData;
961
1030
  }
962
1031
  var CollectionClient = class extends HttpClient {
963
- constructor(clientKey, secretKey, baseUrl, getCustomerToken) {
964
- super(clientKey, secretKey, baseUrl, getCustomerToken);
1032
+ constructor(clientKey, secretKey, baseUrl, getCustomerToken, onUnauthorized) {
1033
+ super(clientKey, secretKey, baseUrl, getCustomerToken, onUnauthorized);
965
1034
  }
966
1035
  from(collection) {
967
1036
  return new CollectionQueryBuilder(this, collection);
@@ -1136,9 +1205,23 @@ var COLLECTIONS = [
1136
1205
  "post-images",
1137
1206
  "playlists",
1138
1207
  "playlist-images",
1208
+ "playlist-categories",
1139
1209
  "musics",
1210
+ "galleries",
1211
+ "gallery-images",
1212
+ "gallery-categories",
1213
+ "gallery-tags",
1140
1214
  "flows",
1141
1215
  "flow-images",
1216
+ "flow-node-types",
1217
+ "flow-edge-types",
1218
+ "flow-tags",
1219
+ "videos",
1220
+ "video-images",
1221
+ "video-categories",
1222
+ "video-tags",
1223
+ "live-streams",
1224
+ "live-stream-images",
1142
1225
  "forms",
1143
1226
  "form-submissions",
1144
1227
  "media"
@@ -1148,6 +1231,7 @@ var COLLECTIONS = [
1148
1231
  var DEFAULT_TIMEOUT2 = 15e3;
1149
1232
  var CustomerAuth = class {
1150
1233
  constructor(clientKey, baseUrl, options) {
1234
+ this.refreshPromise = null;
1151
1235
  var _a, _b;
1152
1236
  this.clientKey = clientKey;
1153
1237
  this.baseUrl = baseUrl;
@@ -1194,6 +1278,17 @@ var CustomerAuth = class {
1194
1278
  refreshToken() {
1195
1279
  return __async(this, null, function* () {
1196
1280
  if (!this.token) throw new ApiError("Not authenticated", 401);
1281
+ if (this.refreshPromise) return this.refreshPromise;
1282
+ this.refreshPromise = this._doRefreshToken();
1283
+ try {
1284
+ return yield this.refreshPromise;
1285
+ } finally {
1286
+ this.refreshPromise = null;
1287
+ }
1288
+ });
1289
+ }
1290
+ _doRefreshToken() {
1291
+ return __async(this, null, function* () {
1197
1292
  const result = yield this.requestJson("/api/customers/refresh", {
1198
1293
  method: "POST",
1199
1294
  headers: { Authorization: `Bearer ${this.token}` }
@@ -1252,6 +1347,20 @@ var CustomerAuth = class {
1252
1347
  });
1253
1348
  });
1254
1349
  }
1350
+ /**
1351
+ * Update the authenticated customer's profile (name, phone, marketingConsent)
1352
+ */
1353
+ updateProfile(data) {
1354
+ return __async(this, null, function* () {
1355
+ if (!this.token) throw new ApiError("Not authenticated", 401);
1356
+ const result = yield this.requestJson("/api/customers/me", {
1357
+ method: "PATCH",
1358
+ headers: { Authorization: `Bearer ${this.token}` },
1359
+ body: JSON.stringify(data)
1360
+ });
1361
+ return result.customer;
1362
+ });
1363
+ }
1255
1364
  /**
1256
1365
  * Change the password of the currently authenticated customer
1257
1366
  */
@@ -1276,6 +1385,23 @@ var CustomerAuth = class {
1276
1385
  });
1277
1386
  });
1278
1387
  }
1388
+ /**
1389
+ * Get the authenticated customer's orders with pagination and optional status filter
1390
+ */
1391
+ getMyOrders(options) {
1392
+ return __async(this, null, function* () {
1393
+ if (!this.token) throw new ApiError("Not authenticated", 401);
1394
+ const params = new URLSearchParams();
1395
+ if (options == null ? void 0 : options.page) params.set("page", String(options.page));
1396
+ if (options == null ? void 0 : options.limit) params.set("limit", String(options.limit));
1397
+ if (options == null ? void 0 : options.status) params.set("status", options.status);
1398
+ const qs = params.toString();
1399
+ return this.requestJson(`/api/customers/me/orders${qs ? `?${qs}` : ""}`, {
1400
+ method: "GET",
1401
+ headers: { Authorization: `Bearer ${this.token}` }
1402
+ });
1403
+ });
1404
+ }
1279
1405
  /**
1280
1406
  * Get the current token (or null if not authenticated)
1281
1407
  */
@@ -1550,7 +1676,7 @@ var QueryHooks = class {
1550
1676
  }),
1551
1677
  onSuccess: (data) => {
1552
1678
  var _a;
1553
- this.queryClient.invalidateQueries({ queryKey: collectionKeys(collection).lists() });
1679
+ this.queryClient.invalidateQueries({ queryKey: collectionKeys(collection).all });
1554
1680
  (_a = options == null ? void 0 : options.onSuccess) == null ? void 0 : _a.call(options, data);
1555
1681
  },
1556
1682
  onError: options == null ? void 0 : options.onError,
@@ -1713,6 +1839,20 @@ var QueryHooks = class {
1713
1839
  onSettled: options == null ? void 0 : options.onSettled
1714
1840
  });
1715
1841
  }
1842
+ useCustomerUpdateProfile(options) {
1843
+ return useMutationOriginal({
1844
+ mutationFn: (data) => __async(this, null, function* () {
1845
+ return yield this.ensureCustomerAuth().updateProfile(data);
1846
+ }),
1847
+ onSuccess: (data) => {
1848
+ var _a;
1849
+ this.queryClient.invalidateQueries({ queryKey: customerKeys.me() });
1850
+ (_a = options == null ? void 0 : options.onSuccess) == null ? void 0 : _a.call(options, data);
1851
+ },
1852
+ onError: options == null ? void 0 : options.onError,
1853
+ onSettled: options == null ? void 0 : options.onSettled
1854
+ });
1855
+ }
1716
1856
  useCustomerChangePassword(options) {
1717
1857
  return useMutationOriginal({
1718
1858
  mutationFn: (data) => __async(this, null, function* () {
@@ -1751,16 +1891,27 @@ var BrowserClient = class {
1751
1891
  this.state = { metadata };
1752
1892
  this.queryClient = getQueryClient();
1753
1893
  this.customer = new CustomerAuth(this.config.clientKey, this.baseUrl, options.customer);
1894
+ const onUnauthorized = () => __async(this, null, function* () {
1895
+ var _a2;
1896
+ try {
1897
+ const result = yield this.customer.refreshToken();
1898
+ return (_a2 = result.token) != null ? _a2 : null;
1899
+ } catch (e) {
1900
+ return null;
1901
+ }
1902
+ });
1754
1903
  this.cart = new CartApi({
1755
1904
  clientKey: this.config.clientKey,
1756
1905
  customerToken: () => this.customer.getToken(),
1757
- baseUrl: this.baseUrl
1906
+ baseUrl: this.baseUrl,
1907
+ onUnauthorized
1758
1908
  });
1759
1909
  this.collections = new CollectionClient(
1760
1910
  this.config.clientKey,
1761
1911
  void 0,
1762
1912
  this.baseUrl,
1763
- () => this.customer.getToken()
1913
+ () => this.customer.getToken(),
1914
+ onUnauthorized
1764
1915
  );
1765
1916
  this.query = new QueryHooks(this.queryClient, this.collections, this.customer);
1766
1917
  }
@@ -1770,6 +1921,9 @@ var BrowserClient = class {
1770
1921
  getState() {
1771
1922
  return __spreadValues({}, this.state);
1772
1923
  }
1924
+ getConfig() {
1925
+ return __spreadValues({}, this.config);
1926
+ }
1773
1927
  };
1774
1928
  function createBrowserClient(options) {
1775
1929
  return new BrowserClient(options);
@@ -1834,7 +1988,7 @@ function createServerClient(options) {
1834
1988
  return new ServerClient(options);
1835
1989
  }
1836
1990
 
1837
- // src/core/webhook/index.tsx
1991
+ // src/core/webhook/index.ts
1838
1992
  function isValidWebhookEvent(data) {
1839
1993
  if (typeof data !== "object" || data === null) return false;
1840
1994
  const obj = data;
@@ -1987,12 +2141,46 @@ var generateOrderNumber = () => {
1987
2141
  };
1988
2142
 
1989
2143
  // src/utils/order/formatOrderName.ts
1990
- var formatOrderName = (options) => {
2144
+ var formatOrderName = (items) => {
1991
2145
  var _a, _b;
1992
- if (options.length === 0) return "";
1993
- const firstTitle = ((_b = resolveRelation((_a = options[0]) == null ? void 0 : _a.product)) == null ? void 0 : _b.title) || "";
1994
- return options.length === 1 ? firstTitle : `${firstTitle} \uC678 ${options.length - 1}\uAC74`;
2146
+ if (items.length === 0) return "";
2147
+ const firstTitle = ((_b = resolveRelation((_a = items[0]) == null ? void 0 : _a.product)) == null ? void 0 : _b.title) || "";
2148
+ return items.length === 1 ? firstTitle : `${firstTitle} \uC678 ${items.length - 1}\uAC74`;
1995
2149
  };
2150
+
2151
+ // src/utils/video.ts
2152
+ var MUX_IMAGE_BASE = "https://image.mux.com";
2153
+ var MUX_STREAM_BASE = "https://stream.mux.com";
2154
+ function getVideoThumbnail(playbackId, options) {
2155
+ var _a;
2156
+ const params = new URLSearchParams();
2157
+ params.set("width", String((_a = options == null ? void 0 : options.width) != null ? _a : 640));
2158
+ if (options == null ? void 0 : options.height) params.set("height", String(options.height));
2159
+ if ((options == null ? void 0 : options.time) != null) params.set("time", String(options.time));
2160
+ if (options == null ? void 0 : options.fitMode) params.set("fit_mode", options.fitMode);
2161
+ if (options == null ? void 0 : options.flipH) params.set("flip_h", "true");
2162
+ if (options == null ? void 0 : options.flipV) params.set("flip_v", "true");
2163
+ if (options == null ? void 0 : options.rotate) params.set("rotate", String(options.rotate));
2164
+ return `${MUX_IMAGE_BASE}/${playbackId}/thumbnail.jpg?${params}`;
2165
+ }
2166
+ function getVideoGif(playbackId, options) {
2167
+ var _a;
2168
+ const params = new URLSearchParams();
2169
+ params.set("width", String((_a = options == null ? void 0 : options.width) != null ? _a : 320));
2170
+ if ((options == null ? void 0 : options.start) != null) params.set("start", String(options.start));
2171
+ if ((options == null ? void 0 : options.end) != null) params.set("end", String(options.end));
2172
+ if (options == null ? void 0 : options.fps) params.set("fps", String(options.fps));
2173
+ return `${MUX_IMAGE_BASE}/${playbackId}/animated.gif?${params}`;
2174
+ }
2175
+ function getVideoStoryboard(playbackId) {
2176
+ return `${MUX_IMAGE_BASE}/${playbackId}/storyboard.vtt`;
2177
+ }
2178
+ function getVideoStreamUrl(playbackId) {
2179
+ return `${MUX_STREAM_BASE}/${playbackId}.m3u8`;
2180
+ }
2181
+ function getVideoMp4Url(playbackId, resolution = "high") {
2182
+ return `${MUX_STREAM_BASE}/${playbackId}/${resolution}.mp4`;
2183
+ }
1996
2184
  export {
1997
2185
  ApiError,
1998
2186
  BrowserClient,
@@ -2002,12 +2190,15 @@ export {
2002
2190
  CollectionQueryBuilder,
2003
2191
  ConfigError,
2004
2192
  CustomerAuth,
2193
+ GoneError,
2005
2194
  IMAGE_SIZES,
2006
2195
  NetworkError,
2007
2196
  OrderApi,
2008
2197
  ProductApi,
2009
2198
  QueryHooks,
2199
+ SDKError,
2010
2200
  ServerClient,
2201
+ ServiceUnavailableError,
2011
2202
  TimeoutError,
2012
2203
  UsageLimitError,
2013
2204
  ValidationError,
@@ -2027,16 +2218,22 @@ export {
2027
2218
  getImageSrcSet,
2028
2219
  getImageUrl,
2029
2220
  getQueryClient,
2221
+ getVideoGif,
2222
+ getVideoMp4Url,
2223
+ getVideoStoryboard,
2224
+ getVideoStreamUrl,
2225
+ getVideoThumbnail,
2030
2226
  handleWebhook,
2031
2227
  isApiError,
2032
2228
  isConfigError,
2229
+ isGoneError,
2033
2230
  isNetworkError,
2034
2231
  isSDKError,
2232
+ isServiceUnavailableError,
2035
2233
  isTimeoutError,
2036
2234
  isUsageLimitError,
2037
2235
  isValidWebhookEvent,
2038
2236
  isValidationError,
2039
- objectFor,
2040
2237
  parseApiKey,
2041
2238
  resolveRelation,
2042
2239
  verifyServerToken