@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.cjs CHANGED
@@ -78,12 +78,15 @@ __export(src_exports, {
78
78
  CollectionQueryBuilder: () => CollectionQueryBuilder,
79
79
  ConfigError: () => ConfigError,
80
80
  CustomerAuth: () => CustomerAuth,
81
+ GoneError: () => GoneError,
81
82
  IMAGE_SIZES: () => IMAGE_SIZES,
82
83
  NetworkError: () => NetworkError,
83
84
  OrderApi: () => OrderApi,
84
85
  ProductApi: () => ProductApi,
85
86
  QueryHooks: () => QueryHooks,
87
+ SDKError: () => SDKError,
86
88
  ServerClient: () => ServerClient,
89
+ ServiceUnavailableError: () => ServiceUnavailableError,
87
90
  TimeoutError: () => TimeoutError,
88
91
  UsageLimitError: () => UsageLimitError,
89
92
  ValidationError: () => ValidationError,
@@ -103,16 +106,22 @@ __export(src_exports, {
103
106
  getImageSrcSet: () => getImageSrcSet,
104
107
  getImageUrl: () => getImageUrl,
105
108
  getQueryClient: () => getQueryClient,
109
+ getVideoGif: () => getVideoGif,
110
+ getVideoMp4Url: () => getVideoMp4Url,
111
+ getVideoStoryboard: () => getVideoStoryboard,
112
+ getVideoStreamUrl: () => getVideoStreamUrl,
113
+ getVideoThumbnail: () => getVideoThumbnail,
106
114
  handleWebhook: () => handleWebhook,
107
115
  isApiError: () => isApiError,
108
116
  isConfigError: () => isConfigError,
117
+ isGoneError: () => isGoneError,
109
118
  isNetworkError: () => isNetworkError,
110
119
  isSDKError: () => isSDKError,
120
+ isServiceUnavailableError: () => isServiceUnavailableError,
111
121
  isTimeoutError: () => isTimeoutError,
112
122
  isUsageLimitError: () => isUsageLimitError,
113
123
  isValidWebhookEvent: () => isValidWebhookEvent,
114
124
  isValidationError: () => isValidationError,
115
- objectFor: () => objectFor,
116
125
  parseApiKey: () => parseApiKey,
117
126
  resolveRelation: () => resolveRelation,
118
127
  verifyServerToken: () => verifyServerToken
@@ -181,6 +190,19 @@ var TimeoutError = class extends SDKError {
181
190
  this.name = "TimeoutError";
182
191
  }
183
192
  };
193
+ var GoneError = class extends SDKError {
194
+ constructor(message = "The requested resource is no longer available.", details, userMessage, suggestion) {
195
+ super("GONE_ERROR", message, 410, details, userMessage, suggestion);
196
+ this.name = "GoneError";
197
+ }
198
+ };
199
+ var ServiceUnavailableError = class extends SDKError {
200
+ constructor(message = "Service temporarily unavailable.", retryAfter, details, userMessage, suggestion) {
201
+ super("SERVICE_UNAVAILABLE_ERROR", message, 503, details, userMessage, suggestion);
202
+ this.name = "ServiceUnavailableError";
203
+ this.retryAfter = retryAfter;
204
+ }
205
+ };
184
206
  var UsageLimitError = class extends SDKError {
185
207
  constructor(message, usage, details, userMessage, suggestion) {
186
208
  super("USAGE_LIMIT_ERROR", message, 429, details, userMessage, suggestion);
@@ -211,6 +233,12 @@ function isConfigError(error) {
211
233
  function isTimeoutError(error) {
212
234
  return error instanceof TimeoutError;
213
235
  }
236
+ function isGoneError(error) {
237
+ return error instanceof GoneError;
238
+ }
239
+ function isServiceUnavailableError(error) {
240
+ return error instanceof ServiceUnavailableError;
241
+ }
214
242
  function isUsageLimitError(error) {
215
243
  return error instanceof UsageLimitError;
216
244
  }
@@ -224,8 +252,8 @@ var createUsageLimitError = (message, usage, details, userMessage, suggestion) =
224
252
  // src/core/client/types.ts
225
253
  var API_URLS = {
226
254
  local: "http://localhost:3000",
227
- development: "https://dev.01.software",
228
- staging: "https://stg.01.software",
255
+ development: "https://api-dev.01.software",
256
+ staging: "https://api-stg.01.software",
229
257
  production: "https://api.01.software"
230
258
  };
231
259
  function resolveApiUrl(config) {
@@ -354,7 +382,8 @@ function _fetch(url, options) {
354
382
  timeout = DEFAULT_TIMEOUT,
355
383
  baseUrl = API_URLS.production,
356
384
  debug,
357
- retry
385
+ retry,
386
+ onUnauthorized
358
387
  } = _a, requestInit = __objRest(_a, [
359
388
  "clientKey",
360
389
  "secretKey",
@@ -362,7 +391,8 @@ function _fetch(url, options) {
362
391
  "timeout",
363
392
  "baseUrl",
364
393
  "debug",
365
- "retry"
394
+ "retry",
395
+ "onUnauthorized"
366
396
  ]);
367
397
  const retryConfig = {
368
398
  maxRetries: (_b = retry == null ? void 0 : retry.maxRetries) != null ? _b : 3,
@@ -376,6 +406,7 @@ function _fetch(url, options) {
376
406
  authToken = customerToken;
377
407
  }
378
408
  let lastError;
409
+ let hasRetried401 = false;
379
410
  for (let attempt = 0; attempt <= retryConfig.maxRetries; attempt++) {
380
411
  try {
381
412
  const headers = new Headers(requestInit.headers);
@@ -423,6 +454,17 @@ function _fetch(url, options) {
423
454
  "Upgrade your tenant plan to increase the monthly API call limit."
424
455
  );
425
456
  }
457
+ if (response.status === 401 && onUnauthorized && customerToken && !hasRetried401) {
458
+ hasRetried401 = true;
459
+ try {
460
+ const newToken = yield onUnauthorized();
461
+ if (newToken) {
462
+ authToken = newToken;
463
+ continue;
464
+ }
465
+ } catch (e) {
466
+ }
467
+ }
426
468
  if (NON_RETRYABLE_STATUSES.includes(response.status)) {
427
469
  throw createNetworkError(
428
470
  `HTTP ${response.status}: ${response.statusText}`,
@@ -575,6 +617,9 @@ var OrderApi = class {
575
617
  createFulfillment(params) {
576
618
  return this.request("/api/orders/create-fulfillment", params);
577
619
  }
620
+ updateFulfillment(params) {
621
+ return this.request("/api/orders/update-fulfillment", params);
622
+ }
578
623
  returnWithRefund(params) {
579
624
  return this.request("/api/returns/return-refund", params);
580
625
  }
@@ -584,6 +629,18 @@ var OrderApi = class {
584
629
  updateReturn(params) {
585
630
  return this.request("/api/returns/update", params);
586
631
  }
632
+ validateDiscount(params) {
633
+ return this.request("/api/discounts/validate", params);
634
+ }
635
+ calculateShipping(params) {
636
+ return this.request("/api/shipping-policies/calculate", params);
637
+ }
638
+ createExchange(params) {
639
+ return this.request("/api/exchanges/create", params);
640
+ }
641
+ updateExchange(params) {
642
+ return this.request("/api/exchanges/update", params);
643
+ }
587
644
  };
588
645
 
589
646
  // src/core/api/cart-api.ts
@@ -599,18 +656,18 @@ var CartApi = class {
599
656
  this.secretKey = options.secretKey;
600
657
  this.customerToken = options.customerToken;
601
658
  this.baseUrl = options.baseUrl;
659
+ this.onUnauthorized = options.onUnauthorized;
602
660
  }
603
- request(endpoint, body) {
661
+ execute(endpoint, method, body) {
604
662
  return __async(this, null, function* () {
605
663
  const token = typeof this.customerToken === "function" ? this.customerToken() : this.customerToken;
606
- const response = yield _fetch(endpoint, {
607
- method: "POST",
664
+ const response = yield _fetch(endpoint, __spreadValues(__spreadValues({
665
+ method,
608
666
  clientKey: this.clientKey,
609
667
  secretKey: this.secretKey,
610
668
  customerToken: token != null ? token : void 0,
611
- baseUrl: this.baseUrl,
612
- body: JSON.stringify(body)
613
- });
669
+ baseUrl: this.baseUrl
670
+ }, token && this.onUnauthorized && { onUnauthorized: this.onUnauthorized }), body !== void 0 && { body: JSON.stringify(body) }));
614
671
  let data;
615
672
  try {
616
673
  data = yield response.json();
@@ -636,14 +693,26 @@ var CartApi = class {
636
693
  return data;
637
694
  });
638
695
  }
696
+ getCart(cartId) {
697
+ return this.execute(`/api/carts/${cartId}`, "GET");
698
+ }
639
699
  addItem(params) {
640
- return this.request("/api/carts/add-item", params);
700
+ return this.execute("/api/carts/add-item", "POST", params);
641
701
  }
642
702
  updateItem(params) {
643
- return this.request("/api/carts/update-item", params);
703
+ return this.execute("/api/carts/update-item", "POST", params);
644
704
  }
645
705
  removeItem(params) {
646
- return this.request("/api/carts/remove-item", params);
706
+ return this.execute("/api/carts/remove-item", "POST", params);
707
+ }
708
+ applyDiscount(params) {
709
+ return this.execute("/api/carts/apply-discount", "POST", params);
710
+ }
711
+ removeDiscount(params) {
712
+ return this.execute("/api/carts/remove-discount", "POST", params);
713
+ }
714
+ clearCart(params) {
715
+ return this.execute("/api/carts/clear", "POST", params);
647
716
  }
648
717
  };
649
718
 
@@ -701,42 +770,44 @@ var ProductApi = class {
701
770
 
702
771
  // src/utils/types.ts
703
772
  var resolveRelation = (ref) => {
704
- if (typeof ref === "string" || ref === null || ref === void 0)
773
+ if (typeof ref === "string" || typeof ref === "number" || ref === null || ref === void 0)
705
774
  return null;
706
775
  return ref;
707
776
  };
708
- var objectFor = resolveRelation;
709
777
 
710
778
  // src/core/metadata/index.ts
711
- var COLLECTION_META_FIELDS = {
712
- products: { description: "subtitle", image: "thumbnail" },
713
- posts: { description: "excerpt", image: "thumbnail" },
714
- documents: { description: "summary", image: "" },
715
- playlists: { description: "description", image: "image" }
716
- };
717
- var DEFAULT_META_FIELDS = { description: "description", image: "thumbnail" };
718
- function extractMetaFields(collection, doc) {
719
- var _a, _b, _c, _d;
720
- const mapping = (_a = COLLECTION_META_FIELDS[collection]) != null ? _a : DEFAULT_META_FIELDS;
779
+ function extractSeo(doc) {
780
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
781
+ const seo = (_a = doc.seo) != null ? _a : {};
782
+ const og = (_b = seo.openGraph) != null ? _b : {};
721
783
  return {
722
- title: (_b = doc.title) != null ? _b : null,
723
- description: mapping.description ? (_c = doc[mapping.description]) != null ? _c : null : null,
724
- image: mapping.image ? (_d = doc[mapping.image]) != null ? _d : null : null
784
+ title: (_d = (_c = seo.title) != null ? _c : doc.title) != null ? _d : null,
785
+ description: (_e = seo.description) != null ? _e : null,
786
+ noIndex: (_f = seo.noIndex) != null ? _f : null,
787
+ canonical: (_g = seo.canonical) != null ? _g : null,
788
+ openGraph: {
789
+ title: (_h = og.title) != null ? _h : null,
790
+ description: (_i = og.description) != null ? _i : null,
791
+ image: (_j = og.image) != null ? _j : null
792
+ }
725
793
  };
726
794
  }
727
795
  function generateMetadata(input, options) {
728
- var _a, _b, _c, _d;
729
- const title = (_b = (_a = input.title) != null ? _a : options == null ? void 0 : options.title) != null ? _b : void 0;
730
- const description = (_d = (_c = input.description) != null ? _c : options == null ? void 0 : options.description) != null ? _d : void 0;
731
- const image = resolveMetaImage(input.image);
732
- return {
796
+ var _a, _b, _c, _d, _e, _f, _g;
797
+ const title = (_a = input.title) != null ? _a : void 0;
798
+ const description = (_b = input.description) != null ? _b : void 0;
799
+ const ogTitle = (_d = (_c = input.openGraph) == null ? void 0 : _c.title) != null ? _d : title;
800
+ const ogDescription = (_f = (_e = input.openGraph) == null ? void 0 : _e.description) != null ? _f : description;
801
+ const image = resolveMetaImage((_g = input.openGraph) == null ? void 0 : _g.image);
802
+ return __spreadProps(__spreadValues(__spreadValues({
733
803
  title,
734
- description,
735
- openGraph: __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, title && { title }), description && { description }), (options == null ? void 0 : options.siteName) && { siteName: options.siteName }), image && { images: [image] }),
804
+ description
805
+ }, input.noIndex && { robots: { index: false, follow: false } }), input.canonical && { alternates: { canonical: input.canonical } }), {
806
+ openGraph: __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, ogTitle && { title: ogTitle }), ogDescription && { description: ogDescription }), (options == null ? void 0 : options.siteName) && { siteName: options.siteName }), image && { images: [image] }),
736
807
  twitter: __spreadValues(__spreadValues(__spreadValues({
737
808
  card: image ? "summary_large_image" : "summary"
738
- }, title && { title }), description && { description }), image && { images: [image.url] })
739
- };
809
+ }, ogTitle && { title: ogTitle }), ogDescription && { description: ogDescription }), image && { images: [image.url] })
810
+ });
740
811
  }
741
812
  function resolveMetaImage(ref) {
742
813
  var _a;
@@ -846,7 +917,7 @@ var CollectionQueryBuilder = class {
846
917
  const doc = docs[0];
847
918
  if (!doc) return null;
848
919
  return generateMetadata(
849
- extractMetaFields(String(this.collection), doc),
920
+ extractSeo(doc),
850
921
  metadataOptions
851
922
  );
852
923
  });
@@ -860,7 +931,7 @@ var CollectionQueryBuilder = class {
860
931
  return __async(this, null, function* () {
861
932
  const doc = yield this.findById(id, { depth: 1 });
862
933
  return generateMetadata(
863
- extractMetaFields(String(this.collection), doc),
934
+ extractSeo(doc),
864
935
  metadataOptions
865
936
  );
866
937
  });
@@ -908,7 +979,7 @@ var CollectionQueryBuilder = class {
908
979
  // src/core/collection/http-client.ts
909
980
  var import_qs_esm = require("qs-esm");
910
981
  var HttpClient = class {
911
- constructor(clientKey, secretKey, baseUrl, getCustomerToken) {
982
+ constructor(clientKey, secretKey, baseUrl, getCustomerToken, onUnauthorized) {
912
983
  if (!clientKey) {
913
984
  throw createValidationError("clientKey is required.");
914
985
  }
@@ -916,6 +987,7 @@ var HttpClient = class {
916
987
  this.secretKey = secretKey;
917
988
  this.baseUrl = baseUrl;
918
989
  this.getCustomerToken = getCustomerToken;
990
+ this.onUnauthorized = onUnauthorized;
919
991
  }
920
992
  get defaultOptions() {
921
993
  var _a;
@@ -923,6 +995,9 @@ var HttpClient = class {
923
995
  const token = (_a = this.getCustomerToken) == null ? void 0 : _a.call(this);
924
996
  if (token) {
925
997
  opts.customerToken = token;
998
+ if (this.onUnauthorized) {
999
+ opts.onUnauthorized = this.onUnauthorized;
1000
+ }
926
1001
  }
927
1002
  return opts;
928
1003
  }
@@ -964,6 +1039,7 @@ var HttpClient = class {
964
1039
  nextPage: (_b = jsonData.nextPage) != null ? _b : null
965
1040
  };
966
1041
  } catch (error) {
1042
+ if (error instanceof SDKError) throw error;
967
1043
  throw createApiError("Failed to parse response.", response.status, {
968
1044
  contentType,
969
1045
  error: error instanceof Error ? error.message : error
@@ -990,6 +1066,7 @@ var HttpClient = class {
990
1066
  errors: jsonData.errors
991
1067
  };
992
1068
  } catch (error) {
1069
+ if (error instanceof SDKError) throw error;
993
1070
  throw createApiError("Failed to parse response.", response.status, {
994
1071
  contentType,
995
1072
  error: error instanceof Error ? error.message : error
@@ -1009,6 +1086,7 @@ var HttpClient = class {
1009
1086
  const jsonData = yield response.json();
1010
1087
  return jsonData;
1011
1088
  } catch (error) {
1089
+ if (error instanceof SDKError) throw error;
1012
1090
  throw createApiError("Failed to parse response.", response.status, {
1013
1091
  contentType,
1014
1092
  error: error instanceof Error ? error.message : error
@@ -1028,8 +1106,8 @@ function buildPayloadFormData(data, file, filename) {
1028
1106
  return formData;
1029
1107
  }
1030
1108
  var CollectionClient = class extends HttpClient {
1031
- constructor(clientKey, secretKey, baseUrl, getCustomerToken) {
1032
- super(clientKey, secretKey, baseUrl, getCustomerToken);
1109
+ constructor(clientKey, secretKey, baseUrl, getCustomerToken, onUnauthorized) {
1110
+ super(clientKey, secretKey, baseUrl, getCustomerToken, onUnauthorized);
1033
1111
  }
1034
1112
  from(collection) {
1035
1113
  return new CollectionQueryBuilder(this, collection);
@@ -1204,9 +1282,23 @@ var COLLECTIONS = [
1204
1282
  "post-images",
1205
1283
  "playlists",
1206
1284
  "playlist-images",
1285
+ "playlist-categories",
1207
1286
  "musics",
1287
+ "galleries",
1288
+ "gallery-images",
1289
+ "gallery-categories",
1290
+ "gallery-tags",
1208
1291
  "flows",
1209
1292
  "flow-images",
1293
+ "flow-node-types",
1294
+ "flow-edge-types",
1295
+ "flow-tags",
1296
+ "videos",
1297
+ "video-images",
1298
+ "video-categories",
1299
+ "video-tags",
1300
+ "live-streams",
1301
+ "live-stream-images",
1210
1302
  "forms",
1211
1303
  "form-submissions",
1212
1304
  "media"
@@ -1216,6 +1308,7 @@ var COLLECTIONS = [
1216
1308
  var DEFAULT_TIMEOUT2 = 15e3;
1217
1309
  var CustomerAuth = class {
1218
1310
  constructor(clientKey, baseUrl, options) {
1311
+ this.refreshPromise = null;
1219
1312
  var _a, _b;
1220
1313
  this.clientKey = clientKey;
1221
1314
  this.baseUrl = baseUrl;
@@ -1262,6 +1355,17 @@ var CustomerAuth = class {
1262
1355
  refreshToken() {
1263
1356
  return __async(this, null, function* () {
1264
1357
  if (!this.token) throw new ApiError("Not authenticated", 401);
1358
+ if (this.refreshPromise) return this.refreshPromise;
1359
+ this.refreshPromise = this._doRefreshToken();
1360
+ try {
1361
+ return yield this.refreshPromise;
1362
+ } finally {
1363
+ this.refreshPromise = null;
1364
+ }
1365
+ });
1366
+ }
1367
+ _doRefreshToken() {
1368
+ return __async(this, null, function* () {
1265
1369
  const result = yield this.requestJson("/api/customers/refresh", {
1266
1370
  method: "POST",
1267
1371
  headers: { Authorization: `Bearer ${this.token}` }
@@ -1320,6 +1424,20 @@ var CustomerAuth = class {
1320
1424
  });
1321
1425
  });
1322
1426
  }
1427
+ /**
1428
+ * Update the authenticated customer's profile (name, phone, marketingConsent)
1429
+ */
1430
+ updateProfile(data) {
1431
+ return __async(this, null, function* () {
1432
+ if (!this.token) throw new ApiError("Not authenticated", 401);
1433
+ const result = yield this.requestJson("/api/customers/me", {
1434
+ method: "PATCH",
1435
+ headers: { Authorization: `Bearer ${this.token}` },
1436
+ body: JSON.stringify(data)
1437
+ });
1438
+ return result.customer;
1439
+ });
1440
+ }
1323
1441
  /**
1324
1442
  * Change the password of the currently authenticated customer
1325
1443
  */
@@ -1344,6 +1462,23 @@ var CustomerAuth = class {
1344
1462
  });
1345
1463
  });
1346
1464
  }
1465
+ /**
1466
+ * Get the authenticated customer's orders with pagination and optional status filter
1467
+ */
1468
+ getMyOrders(options) {
1469
+ return __async(this, null, function* () {
1470
+ if (!this.token) throw new ApiError("Not authenticated", 401);
1471
+ const params = new URLSearchParams();
1472
+ if (options == null ? void 0 : options.page) params.set("page", String(options.page));
1473
+ if (options == null ? void 0 : options.limit) params.set("limit", String(options.limit));
1474
+ if (options == null ? void 0 : options.status) params.set("status", options.status);
1475
+ const qs = params.toString();
1476
+ return this.requestJson(`/api/customers/me/orders${qs ? `?${qs}` : ""}`, {
1477
+ method: "GET",
1478
+ headers: { Authorization: `Bearer ${this.token}` }
1479
+ });
1480
+ });
1481
+ }
1347
1482
  /**
1348
1483
  * Get the current token (or null if not authenticated)
1349
1484
  */
@@ -1612,7 +1747,7 @@ var QueryHooks = class {
1612
1747
  }),
1613
1748
  onSuccess: (data) => {
1614
1749
  var _a;
1615
- this.queryClient.invalidateQueries({ queryKey: collectionKeys(collection).lists() });
1750
+ this.queryClient.invalidateQueries({ queryKey: collectionKeys(collection).all });
1616
1751
  (_a = options == null ? void 0 : options.onSuccess) == null ? void 0 : _a.call(options, data);
1617
1752
  },
1618
1753
  onError: options == null ? void 0 : options.onError,
@@ -1775,6 +1910,20 @@ var QueryHooks = class {
1775
1910
  onSettled: options == null ? void 0 : options.onSettled
1776
1911
  });
1777
1912
  }
1913
+ useCustomerUpdateProfile(options) {
1914
+ return (0, import_react_query2.useMutation)({
1915
+ mutationFn: (data) => __async(this, null, function* () {
1916
+ return yield this.ensureCustomerAuth().updateProfile(data);
1917
+ }),
1918
+ onSuccess: (data) => {
1919
+ var _a;
1920
+ this.queryClient.invalidateQueries({ queryKey: customerKeys.me() });
1921
+ (_a = options == null ? void 0 : options.onSuccess) == null ? void 0 : _a.call(options, data);
1922
+ },
1923
+ onError: options == null ? void 0 : options.onError,
1924
+ onSettled: options == null ? void 0 : options.onSettled
1925
+ });
1926
+ }
1778
1927
  useCustomerChangePassword(options) {
1779
1928
  return (0, import_react_query2.useMutation)({
1780
1929
  mutationFn: (data) => __async(this, null, function* () {
@@ -1813,16 +1962,27 @@ var BrowserClient = class {
1813
1962
  this.state = { metadata };
1814
1963
  this.queryClient = getQueryClient();
1815
1964
  this.customer = new CustomerAuth(this.config.clientKey, this.baseUrl, options.customer);
1965
+ const onUnauthorized = () => __async(this, null, function* () {
1966
+ var _a2;
1967
+ try {
1968
+ const result = yield this.customer.refreshToken();
1969
+ return (_a2 = result.token) != null ? _a2 : null;
1970
+ } catch (e) {
1971
+ return null;
1972
+ }
1973
+ });
1816
1974
  this.cart = new CartApi({
1817
1975
  clientKey: this.config.clientKey,
1818
1976
  customerToken: () => this.customer.getToken(),
1819
- baseUrl: this.baseUrl
1977
+ baseUrl: this.baseUrl,
1978
+ onUnauthorized
1820
1979
  });
1821
1980
  this.collections = new CollectionClient(
1822
1981
  this.config.clientKey,
1823
1982
  void 0,
1824
1983
  this.baseUrl,
1825
- () => this.customer.getToken()
1984
+ () => this.customer.getToken(),
1985
+ onUnauthorized
1826
1986
  );
1827
1987
  this.query = new QueryHooks(this.queryClient, this.collections, this.customer);
1828
1988
  }
@@ -1832,6 +1992,9 @@ var BrowserClient = class {
1832
1992
  getState() {
1833
1993
  return __spreadValues({}, this.state);
1834
1994
  }
1995
+ getConfig() {
1996
+ return __spreadValues({}, this.config);
1997
+ }
1835
1998
  };
1836
1999
  function createBrowserClient(options) {
1837
2000
  return new BrowserClient(options);
@@ -1896,7 +2059,7 @@ function createServerClient(options) {
1896
2059
  return new ServerClient(options);
1897
2060
  }
1898
2061
 
1899
- // src/core/webhook/index.tsx
2062
+ // src/core/webhook/index.ts
1900
2063
  function isValidWebhookEvent(data) {
1901
2064
  if (typeof data !== "object" || data === null) return false;
1902
2065
  const obj = data;
@@ -2049,10 +2212,44 @@ var generateOrderNumber = () => {
2049
2212
  };
2050
2213
 
2051
2214
  // src/utils/order/formatOrderName.ts
2052
- var formatOrderName = (options) => {
2215
+ var formatOrderName = (items) => {
2053
2216
  var _a, _b;
2054
- if (options.length === 0) return "";
2055
- const firstTitle = ((_b = resolveRelation((_a = options[0]) == null ? void 0 : _a.product)) == null ? void 0 : _b.title) || "";
2056
- return options.length === 1 ? firstTitle : `${firstTitle} \uC678 ${options.length - 1}\uAC74`;
2217
+ if (items.length === 0) return "";
2218
+ const firstTitle = ((_b = resolveRelation((_a = items[0]) == null ? void 0 : _a.product)) == null ? void 0 : _b.title) || "";
2219
+ return items.length === 1 ? firstTitle : `${firstTitle} \uC678 ${items.length - 1}\uAC74`;
2057
2220
  };
2221
+
2222
+ // src/utils/video.ts
2223
+ var MUX_IMAGE_BASE = "https://image.mux.com";
2224
+ var MUX_STREAM_BASE = "https://stream.mux.com";
2225
+ function getVideoThumbnail(playbackId, options) {
2226
+ var _a;
2227
+ const params = new URLSearchParams();
2228
+ params.set("width", String((_a = options == null ? void 0 : options.width) != null ? _a : 640));
2229
+ if (options == null ? void 0 : options.height) params.set("height", String(options.height));
2230
+ if ((options == null ? void 0 : options.time) != null) params.set("time", String(options.time));
2231
+ if (options == null ? void 0 : options.fitMode) params.set("fit_mode", options.fitMode);
2232
+ if (options == null ? void 0 : options.flipH) params.set("flip_h", "true");
2233
+ if (options == null ? void 0 : options.flipV) params.set("flip_v", "true");
2234
+ if (options == null ? void 0 : options.rotate) params.set("rotate", String(options.rotate));
2235
+ return `${MUX_IMAGE_BASE}/${playbackId}/thumbnail.jpg?${params}`;
2236
+ }
2237
+ function getVideoGif(playbackId, options) {
2238
+ var _a;
2239
+ const params = new URLSearchParams();
2240
+ params.set("width", String((_a = options == null ? void 0 : options.width) != null ? _a : 320));
2241
+ if ((options == null ? void 0 : options.start) != null) params.set("start", String(options.start));
2242
+ if ((options == null ? void 0 : options.end) != null) params.set("end", String(options.end));
2243
+ if (options == null ? void 0 : options.fps) params.set("fps", String(options.fps));
2244
+ return `${MUX_IMAGE_BASE}/${playbackId}/animated.gif?${params}`;
2245
+ }
2246
+ function getVideoStoryboard(playbackId) {
2247
+ return `${MUX_IMAGE_BASE}/${playbackId}/storyboard.vtt`;
2248
+ }
2249
+ function getVideoStreamUrl(playbackId) {
2250
+ return `${MUX_STREAM_BASE}/${playbackId}.m3u8`;
2251
+ }
2252
+ function getVideoMp4Url(playbackId, resolution = "high") {
2253
+ return `${MUX_STREAM_BASE}/${playbackId}/${resolution}.mp4`;
2254
+ }
2058
2255
  //# sourceMappingURL=index.cjs.map