@01.software/sdk 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
- import { c as Cart, d as CartItem, O as Order, e as Product } from './payload-types-DeLBmtzd.cjs';
2
- export { A as Article, f as ArticleAuthor, g as ArticleCategory, h as ArticleTag, D as Document, I as Image, P as Post, i as PostCategory, j as ProductVariant, T as Tenant, V as Video } from './payload-types-DeLBmtzd.cjs';
3
- import { C as CustomerAuth, a as CustomerAuthOptions, S as StockCheckParams, b as StockCheckResponse, L as ListingGroupsParams, P as ProductListingGroupsResponse, A as AddItemParams, U as UpdateItemParams, R as RemoveItemParams, c as ApplyDiscountParams, d as RemoveDiscountParams, e as ClearCartParams, f as CheckoutParams, g as PayloadFindResponse, V as ValidateDiscountParams, h as ValidateDiscountResult, i as CalculateShippingParams, j as CalculateShippingResult, k as ApiQueryOptions, l as ProductListingGroupsQueryOptions, m as ClientConfig, n as CommunityClient, o as ReadOnlyQueryHooks, p as ReadOnlyCollectionClient, q as ClientState } from './server-BcQr-nGn.cjs';
4
- export { v as ApiError, z as AuthError, aT as BanCustomerParams, af as BaseApi, ap as BulkImportFulfillmentsParams, aq as BulkImportFulfillmentsResponse, aB as CartApi, aC as CartApiOptions, ac as ClientMetadata, ab as ClientServerConfig, aK as CollectionClient, b1 as CollectionDetailQueryParams, b7 as CollectionHooks, b2 as CollectionInfiniteQueryParams, aI as CollectionQueryBuilder, b0 as CollectionQueryParams, aS as CommunityBan, aO as CommunityClientOptions, aP as CommunityPost, w as ConfigError, H as ConflictError, au as CreateFulfillmentParams, an as CreateOrderParams, ar as CreateReturnParams, aV as CustomerAuthResponse, b8 as CustomerHooks, a_ as CustomerLoginData, aY as CustomerProfile, aW as CustomerRefreshResponse, aZ as CustomerRegisterData, aX as CustomerRegisterResponse, ak as CustomerSnapshot, r as DebugConfig, D as DeepPartial, ax as DiscountApi, ay as DiscountApiOptions, E as ExtractArrayType, aL as GenerateMetadataOptions, G as GoneError, b5 as InfiniteQueryOptions, aQ as ModerationApi, aR as ModerationApiOptions, N as NetworkError, F as NotFoundError, ai as OrderApi, aj as OrderApiOptions, ad as PaginationMeta, ae as PayloadMutationResponse, B as PermissionError, aD as ProductApi, aE as ProductApiOptions, bj as ProductListingGroup, aF as ProductListingGroupSummary, aG as ProductListingGroupsItem, bd as ProductListingProductShape, bi as ProductListingProjection, bh as ProductOptionMatrix, bf as ProductOptionMatrixOption, be as ProductOptionMatrixValue, bg as ProductOptionMatrixVariant, bb as ProductOptionShape, ba as ProductOptionValueShape, bc as ProductVariantShape, b9 as QueryHooks, b3 as QueryOptions, I as RateLimitError, aJ as ReadOnlyQueryBuilder, ah as RequestOptions, s as RetryConfig, am as ReturnItem, al as ReturnReason, av as ReturnWithRefundParams, t as SDKError, ag as ServerApiOptions, a9 as ServerClient, a9 as ServerClientType, aM as ServerCommerceClient, aN as ServerCommerceClientOptions, x as ServiceUnavailableError, az as ShippingApi, aA as ShippingApiOptions, aH as StockCheckResult, b6 as SuspenseInfiniteQueryOptions, b4 as SuspenseQueryOptions, T as TimeoutError, aU as UnbanCustomerParams, aw as UpdateFulfillmentParams, ao as UpdateOrderParams, a$ as UpdateProfileData, as as UpdateReturnParams, at as UpdateTransactionParams, y as UsageLimitError, u as ValidationError, bq as buildProductListingGroupsByOption, bp as buildProductListingProjection, bk as buildProductOptionMatrix, a3 as createAuthError, a6 as createConflictError, a5 as createNotFoundError, a4 as createPermissionError, a7 as createRateLimitError, a8 as createServerClient, bn as getAvailableOptionValues, bl as getSelectedValueByOptionId, O as isApiError, _ as isAuthError, Q as isConfigError, a1 as isConflictError, X as isGoneError, K as isNetworkError, a0 as isNotFoundError, $ as isPermissionError, a2 as isRateLimitError, J as isSDKError, Y as isServiceUnavailableError, W as isTimeoutError, Z as isUsageLimitError, M as isValidationError, bm as normalizeSelectedValueIds, aa as resolveApiUrl, bo as resolveVariantForSelection } from './server-BcQr-nGn.cjs';
1
+ import { d as Cart, e as CartItem, O as Order, f as Product } from './payload-types-D8-G1PiT.cjs';
2
+ export { A as Article, g as ArticleAuthor, h as ArticleCategory, i as ArticleTag, D as Document, I as Image, P as Post, j as PostCategory, k as ProductVariant, T as Tenant, V as Video } from './payload-types-D8-G1PiT.cjs';
3
+ import { C as CustomerAuth, a as CustomerAuthOptions, S as StockCheckParams, b as StockCheckResponse, L as ListingGroupsParams, P as ProductListingGroupsResponse, A as AddItemParams, U as UpdateItemParams, R as RemoveItemParams, c as ApplyDiscountParams, d as RemoveDiscountParams, e as ClearCartParams, f as CheckoutParams, g as PayloadFindResponse, V as ValidateDiscountParams, h as ValidateDiscountResult, i as CalculateShippingParams, j as CalculateShippingResult, k as ApiQueryOptions, l as ProductListingGroupsQueryOptions, m as ClientConfig, n as CommunityClient, o as ReadOnlyQueryHooks, p as ReadOnlyCollectionClient, q as ClientState } from './server-DJcDyOmM.cjs';
4
+ export { v as ApiError, z as AuthError, aV as BanCustomerParams, af as BaseApi, ap as BulkImportFulfillmentsParams, aq as BulkImportFulfillmentsResponse, aB as CartApi, aC as CartApiOptions, ac as ClientMetadata, ab as ClientServerConfig, aL as CollectionClient, b3 as CollectionDetailQueryParams, b9 as CollectionHooks, b4 as CollectionInfiniteQueryParams, aI as CollectionQueryBuilder, b2 as CollectionQueryParams, aU as CommunityBan, aQ as CommunityClientOptions, aR as CommunityPost, w as ConfigError, H as ConflictError, au as CreateFulfillmentParams, an as CreateOrderParams, ar as CreateReturnParams, aX as CustomerAuthResponse, ba as CustomerHooks, b0 as CustomerLoginData, a_ as CustomerProfile, aY as CustomerRefreshResponse, a$ as CustomerRegisterData, aZ as CustomerRegisterResponse, ak as CustomerSnapshot, r as DebugConfig, D as DeepPartial, ax as DiscountApi, ay as DiscountApiOptions, E as ExtractArrayType, aN as GenerateMetadataOptions, G as GoneError, b7 as InfiniteQueryOptions, aS as ModerationApi, aT as ModerationApiOptions, N as NetworkError, F as NotFoundError, ai as OrderApi, aj as OrderApiOptions, ad as PaginationMeta, ae as PayloadMutationResponse, B as PermissionError, aD as ProductApi, aE as ProductApiOptions, bl as ProductListingGroup, aF as ProductListingGroupSummary, aG as ProductListingGroupsItem, bf as ProductListingProductShape, bk as ProductListingProjection, bj as ProductOptionMatrix, bh as ProductOptionMatrixOption, bg as ProductOptionMatrixValue, bi as ProductOptionMatrixVariant, bd as ProductOptionShape, bc as ProductOptionValueShape, be as ProductVariantShape, bb as QueryHooks, b5 as QueryOptions, I as RateLimitError, aK as ReadOnlyQueryBuilder, ah as RequestOptions, s as RetryConfig, am as ReturnItem, al as ReturnReason, av as ReturnWithRefundParams, t as SDKError, ag as ServerApiOptions, a9 as ServerClient, a9 as ServerClientType, aM as ServerCollectionClient, aJ as ServerCollectionQueryBuilder, aO as ServerCommerceClient, aP as ServerCommerceClientOptions, x as ServiceUnavailableError, az as ShippingApi, aA as ShippingApiOptions, aH as StockCheckResult, b8 as SuspenseInfiniteQueryOptions, b6 as SuspenseQueryOptions, T as TimeoutError, aW as UnbanCustomerParams, aw as UpdateFulfillmentParams, ao as UpdateOrderParams, b1 as UpdateProfileData, as as UpdateReturnParams, at as UpdateTransactionParams, y as UsageLimitError, u as ValidationError, bs as buildProductListingGroupsByOption, br as buildProductListingProjection, bm as buildProductOptionMatrix, a3 as createAuthError, a6 as createConflictError, a5 as createNotFoundError, a4 as createPermissionError, a7 as createRateLimitError, a8 as createServerClient, bp as getAvailableOptionValues, bn as getSelectedValueByOptionId, O as isApiError, _ as isAuthError, Q as isConfigError, a1 as isConflictError, X as isGoneError, K as isNetworkError, a0 as isNotFoundError, $ as isPermissionError, a2 as isRateLimitError, J as isSDKError, Y as isServiceUnavailableError, W as isTimeoutError, Z as isUsageLimitError, M as isValidationError, bo as normalizeSelectedValueIds, aa as resolveApiUrl, bq as resolveVariantForSelection } from './server-DJcDyOmM.cjs';
5
5
  import { QueryClient } from '@tanstack/react-query';
6
- export { C as CollectionType } from './types-D7iFEsPc.cjs';
7
- import { P as PublicCollection } from './const-DraU44bA.cjs';
8
- export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS } from './const-DraU44bA.cjs';
6
+ export { C as CollectionType } from './types-C_kwEIvY.cjs';
7
+ import { P as PublicCollection } from './const-Cgd4op4V.cjs';
8
+ export { b as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS, e as InternalCollection, d as SERVER_COLLECTIONS, c as SERVER_ONLY_COLLECTIONS, S as ServerCollection, a as ServerOnlyCollection } from './const-Cgd4op4V.cjs';
9
9
  export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.cjs';
10
10
  export { CUSTOMER_PASSWORD_RESET_OPERATION, CustomerAuthWebhookEvent, CustomerAuthWebhookHandlers, CustomerPasswordResetWebhookData, CustomerPasswordResetWebhookEvent, WebhookEvent, WebhookHandler, WebhookOperation, WebhookOptions, createCustomerAuthWebhookHandler, createTypedWebhookHandler, handleWebhook, isCustomerPasswordResetWebhookEvent, isValidWebhookEvent } from './webhook.cjs';
11
11
  export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.cjs';
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { c as Cart, d as CartItem, O as Order, e as Product } from './payload-types-DeLBmtzd.js';
2
- export { A as Article, f as ArticleAuthor, g as ArticleCategory, h as ArticleTag, D as Document, I as Image, P as Post, i as PostCategory, j as ProductVariant, T as Tenant, V as Video } from './payload-types-DeLBmtzd.js';
3
- import { C as CustomerAuth, a as CustomerAuthOptions, S as StockCheckParams, b as StockCheckResponse, L as ListingGroupsParams, P as ProductListingGroupsResponse, A as AddItemParams, U as UpdateItemParams, R as RemoveItemParams, c as ApplyDiscountParams, d as RemoveDiscountParams, e as ClearCartParams, f as CheckoutParams, g as PayloadFindResponse, V as ValidateDiscountParams, h as ValidateDiscountResult, i as CalculateShippingParams, j as CalculateShippingResult, k as ApiQueryOptions, l as ProductListingGroupsQueryOptions, m as ClientConfig, n as CommunityClient, o as ReadOnlyQueryHooks, p as ReadOnlyCollectionClient, q as ClientState } from './server-BARh_6zH.js';
4
- export { v as ApiError, z as AuthError, aT as BanCustomerParams, af as BaseApi, ap as BulkImportFulfillmentsParams, aq as BulkImportFulfillmentsResponse, aB as CartApi, aC as CartApiOptions, ac as ClientMetadata, ab as ClientServerConfig, aK as CollectionClient, b1 as CollectionDetailQueryParams, b7 as CollectionHooks, b2 as CollectionInfiniteQueryParams, aI as CollectionQueryBuilder, b0 as CollectionQueryParams, aS as CommunityBan, aO as CommunityClientOptions, aP as CommunityPost, w as ConfigError, H as ConflictError, au as CreateFulfillmentParams, an as CreateOrderParams, ar as CreateReturnParams, aV as CustomerAuthResponse, b8 as CustomerHooks, a_ as CustomerLoginData, aY as CustomerProfile, aW as CustomerRefreshResponse, aZ as CustomerRegisterData, aX as CustomerRegisterResponse, ak as CustomerSnapshot, r as DebugConfig, D as DeepPartial, ax as DiscountApi, ay as DiscountApiOptions, E as ExtractArrayType, aL as GenerateMetadataOptions, G as GoneError, b5 as InfiniteQueryOptions, aQ as ModerationApi, aR as ModerationApiOptions, N as NetworkError, F as NotFoundError, ai as OrderApi, aj as OrderApiOptions, ad as PaginationMeta, ae as PayloadMutationResponse, B as PermissionError, aD as ProductApi, aE as ProductApiOptions, bj as ProductListingGroup, aF as ProductListingGroupSummary, aG as ProductListingGroupsItem, bd as ProductListingProductShape, bi as ProductListingProjection, bh as ProductOptionMatrix, bf as ProductOptionMatrixOption, be as ProductOptionMatrixValue, bg as ProductOptionMatrixVariant, bb as ProductOptionShape, ba as ProductOptionValueShape, bc as ProductVariantShape, b9 as QueryHooks, b3 as QueryOptions, I as RateLimitError, aJ as ReadOnlyQueryBuilder, ah as RequestOptions, s as RetryConfig, am as ReturnItem, al as ReturnReason, av as ReturnWithRefundParams, t as SDKError, ag as ServerApiOptions, a9 as ServerClient, a9 as ServerClientType, aM as ServerCommerceClient, aN as ServerCommerceClientOptions, x as ServiceUnavailableError, az as ShippingApi, aA as ShippingApiOptions, aH as StockCheckResult, b6 as SuspenseInfiniteQueryOptions, b4 as SuspenseQueryOptions, T as TimeoutError, aU as UnbanCustomerParams, aw as UpdateFulfillmentParams, ao as UpdateOrderParams, a$ as UpdateProfileData, as as UpdateReturnParams, at as UpdateTransactionParams, y as UsageLimitError, u as ValidationError, bq as buildProductListingGroupsByOption, bp as buildProductListingProjection, bk as buildProductOptionMatrix, a3 as createAuthError, a6 as createConflictError, a5 as createNotFoundError, a4 as createPermissionError, a7 as createRateLimitError, a8 as createServerClient, bn as getAvailableOptionValues, bl as getSelectedValueByOptionId, O as isApiError, _ as isAuthError, Q as isConfigError, a1 as isConflictError, X as isGoneError, K as isNetworkError, a0 as isNotFoundError, $ as isPermissionError, a2 as isRateLimitError, J as isSDKError, Y as isServiceUnavailableError, W as isTimeoutError, Z as isUsageLimitError, M as isValidationError, bm as normalizeSelectedValueIds, aa as resolveApiUrl, bo as resolveVariantForSelection } from './server-BARh_6zH.js';
1
+ import { d as Cart, e as CartItem, O as Order, f as Product } from './payload-types-D8-G1PiT.js';
2
+ export { A as Article, g as ArticleAuthor, h as ArticleCategory, i as ArticleTag, D as Document, I as Image, P as Post, j as PostCategory, k as ProductVariant, T as Tenant, V as Video } from './payload-types-D8-G1PiT.js';
3
+ import { C as CustomerAuth, a as CustomerAuthOptions, S as StockCheckParams, b as StockCheckResponse, L as ListingGroupsParams, P as ProductListingGroupsResponse, A as AddItemParams, U as UpdateItemParams, R as RemoveItemParams, c as ApplyDiscountParams, d as RemoveDiscountParams, e as ClearCartParams, f as CheckoutParams, g as PayloadFindResponse, V as ValidateDiscountParams, h as ValidateDiscountResult, i as CalculateShippingParams, j as CalculateShippingResult, k as ApiQueryOptions, l as ProductListingGroupsQueryOptions, m as ClientConfig, n as CommunityClient, o as ReadOnlyQueryHooks, p as ReadOnlyCollectionClient, q as ClientState } from './server-D7FcHj7J.js';
4
+ export { v as ApiError, z as AuthError, aV as BanCustomerParams, af as BaseApi, ap as BulkImportFulfillmentsParams, aq as BulkImportFulfillmentsResponse, aB as CartApi, aC as CartApiOptions, ac as ClientMetadata, ab as ClientServerConfig, aL as CollectionClient, b3 as CollectionDetailQueryParams, b9 as CollectionHooks, b4 as CollectionInfiniteQueryParams, aI as CollectionQueryBuilder, b2 as CollectionQueryParams, aU as CommunityBan, aQ as CommunityClientOptions, aR as CommunityPost, w as ConfigError, H as ConflictError, au as CreateFulfillmentParams, an as CreateOrderParams, ar as CreateReturnParams, aX as CustomerAuthResponse, ba as CustomerHooks, b0 as CustomerLoginData, a_ as CustomerProfile, aY as CustomerRefreshResponse, a$ as CustomerRegisterData, aZ as CustomerRegisterResponse, ak as CustomerSnapshot, r as DebugConfig, D as DeepPartial, ax as DiscountApi, ay as DiscountApiOptions, E as ExtractArrayType, aN as GenerateMetadataOptions, G as GoneError, b7 as InfiniteQueryOptions, aS as ModerationApi, aT as ModerationApiOptions, N as NetworkError, F as NotFoundError, ai as OrderApi, aj as OrderApiOptions, ad as PaginationMeta, ae as PayloadMutationResponse, B as PermissionError, aD as ProductApi, aE as ProductApiOptions, bl as ProductListingGroup, aF as ProductListingGroupSummary, aG as ProductListingGroupsItem, bf as ProductListingProductShape, bk as ProductListingProjection, bj as ProductOptionMatrix, bh as ProductOptionMatrixOption, bg as ProductOptionMatrixValue, bi as ProductOptionMatrixVariant, bd as ProductOptionShape, bc as ProductOptionValueShape, be as ProductVariantShape, bb as QueryHooks, b5 as QueryOptions, I as RateLimitError, aK as ReadOnlyQueryBuilder, ah as RequestOptions, s as RetryConfig, am as ReturnItem, al as ReturnReason, av as ReturnWithRefundParams, t as SDKError, ag as ServerApiOptions, a9 as ServerClient, a9 as ServerClientType, aM as ServerCollectionClient, aJ as ServerCollectionQueryBuilder, aO as ServerCommerceClient, aP as ServerCommerceClientOptions, x as ServiceUnavailableError, az as ShippingApi, aA as ShippingApiOptions, aH as StockCheckResult, b8 as SuspenseInfiniteQueryOptions, b6 as SuspenseQueryOptions, T as TimeoutError, aW as UnbanCustomerParams, aw as UpdateFulfillmentParams, ao as UpdateOrderParams, b1 as UpdateProfileData, as as UpdateReturnParams, at as UpdateTransactionParams, y as UsageLimitError, u as ValidationError, bs as buildProductListingGroupsByOption, br as buildProductListingProjection, bm as buildProductOptionMatrix, a3 as createAuthError, a6 as createConflictError, a5 as createNotFoundError, a4 as createPermissionError, a7 as createRateLimitError, a8 as createServerClient, bp as getAvailableOptionValues, bn as getSelectedValueByOptionId, O as isApiError, _ as isAuthError, Q as isConfigError, a1 as isConflictError, X as isGoneError, K as isNetworkError, a0 as isNotFoundError, $ as isPermissionError, a2 as isRateLimitError, J as isSDKError, Y as isServiceUnavailableError, W as isTimeoutError, Z as isUsageLimitError, M as isValidationError, bo as normalizeSelectedValueIds, aa as resolveApiUrl, bq as resolveVariantForSelection } from './server-D7FcHj7J.js';
5
5
  import { QueryClient } from '@tanstack/react-query';
6
- export { C as CollectionType } from './types-KkuKwsli.js';
7
- import { P as PublicCollection } from './const-CfcjPbOu.js';
8
- export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS } from './const-CfcjPbOu.js';
6
+ export { C as CollectionType } from './types-BQqfXbB2.js';
7
+ import { P as PublicCollection } from './const-CMdmNgEs.js';
8
+ export { b as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS, e as InternalCollection, d as SERVER_COLLECTIONS, c as SERVER_ONLY_COLLECTIONS, S as ServerCollection, a as ServerOnlyCollection } from './const-CMdmNgEs.js';
9
9
  export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.js';
10
10
  export { CUSTOMER_PASSWORD_RESET_OPERATION, CustomerAuthWebhookEvent, CustomerAuthWebhookHandlers, CustomerPasswordResetWebhookData, CustomerPasswordResetWebhookEvent, WebhookEvent, WebhookHandler, WebhookOperation, WebhookOptions, createCustomerAuthWebhookHandler, createTypedWebhookHandler, handleWebhook, isCustomerPasswordResetWebhookEvent, isValidWebhookEvent } from './webhook.js';
11
11
  export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.js';
package/dist/index.js CHANGED
@@ -234,6 +234,8 @@ var CollectionQueryBuilder = class {
234
234
  );
235
235
  }
236
236
  };
237
+ var ServerCollectionQueryBuilder = class extends CollectionQueryBuilder {
238
+ };
237
239
 
238
240
  // src/core/collection/http-client.ts
239
241
  import { stringify } from "qs-esm";
@@ -1072,6 +1074,11 @@ var CollectionClient = class extends HttpClient {
1072
1074
  return this.parseMutationResponse(response);
1073
1075
  }
1074
1076
  };
1077
+ var ServerCollectionClient = class extends CollectionClient {
1078
+ from(collection) {
1079
+ return new ServerCollectionQueryBuilder(this, collection);
1080
+ }
1081
+ };
1075
1082
  var ReadOnlyCollectionClient = class extends HttpClient {
1076
1083
  from(collection) {
1077
1084
  return new ReadOnlyCollectionQueryBuilder(this, collection);
@@ -1153,8 +1160,8 @@ var COLLECTIONS = [
1153
1160
  "transactions",
1154
1161
  "customers",
1155
1162
  "customer-profiles",
1163
+ "customer-profile-lists",
1156
1164
  "customer-addresses",
1157
- "customer-groups",
1158
1165
  "carts",
1159
1166
  "cart-items",
1160
1167
  "discounts",
@@ -1210,6 +1217,11 @@ var COLLECTIONS = [
1210
1217
  "event-occurrences",
1211
1218
  "event-tags"
1212
1219
  ];
1220
+ var SERVER_ONLY_COLLECTIONS = ["customer-groups"];
1221
+ var SERVER_COLLECTIONS = [
1222
+ ...COLLECTIONS,
1223
+ ...SERVER_ONLY_COLLECTIONS
1224
+ ];
1213
1225
 
1214
1226
  // src/core/api/parse-response.ts
1215
1227
  async function parseApiResponse(response, endpoint) {
@@ -2628,7 +2640,7 @@ var ServerClient = class {
2628
2640
  unbanCustomer: moderationApi.unbanCustomer.bind(moderationApi)
2629
2641
  }
2630
2642
  });
2631
- this.collections = new CollectionClient(
2643
+ this.collections = new ServerCollectionClient(
2632
2644
  this.config.publishableKey,
2633
2645
  this.config.secretKey,
2634
2646
  void 0,
@@ -2950,12 +2962,24 @@ function getVariantPrimaryImage(variant) {
2950
2962
  if (!variant) return null;
2951
2963
  return extractEntityId(variant.thumbnail) ?? getFirstMediaId(variant.images);
2952
2964
  }
2965
+ function getFirstAvailableVariantPrimaryImage(variants) {
2966
+ const orderedVariants = [...variants].sort(compareVariantOrder);
2967
+ for (const variant of orderedVariants) {
2968
+ if (!isVariantAvailableForSale(variant)) continue;
2969
+ const image = getVariantPrimaryImage(variant);
2970
+ if (image != null) return image;
2971
+ }
2972
+ return null;
2973
+ }
2953
2974
  function normalizeOptionValue(value, fallbackOptionId) {
2954
2975
  return {
2955
2976
  id: String(value.id),
2956
2977
  optionId: getRelationID(value.option) ?? fallbackOptionId,
2957
2978
  label: value.value || value.slug || String(value.id),
2958
2979
  slug: value.slug ?? null,
2980
+ swatchColor: value.swatchColor ?? null,
2981
+ thumbnail: value.thumbnail ?? null,
2982
+ images: value.images ?? null,
2959
2983
  order: value._order ?? value["_product-option-values_values_order"] ?? ""
2960
2984
  };
2961
2985
  }
@@ -2984,7 +3008,10 @@ function buildProductOptionMatrix({
2984
3008
  const valuesById = /* @__PURE__ */ new Map();
2985
3009
  for (const rawValue of option.values?.docs ?? []) {
2986
3010
  if (!isProductOptionValueDoc(rawValue)) continue;
2987
- const normalizedValue = normalizeOptionValue(rawValue, String(option.id));
3011
+ const normalizedValue = normalizeOptionValue(
3012
+ rawValue,
3013
+ String(option.id)
3014
+ );
2988
3015
  valuesById.set(normalizedValue.id, normalizedValue);
2989
3016
  }
2990
3017
  return {
@@ -2996,7 +3023,9 @@ function buildProductOptionMatrix({
2996
3023
  )
2997
3024
  };
2998
3025
  }).sort((left, right) => compareOrder(left.order, right.order));
2999
- const optionById = new Map(normalizedOptions.map((option) => [option.id, option]));
3026
+ const optionById = new Map(
3027
+ normalizedOptions.map((option) => [option.id, option])
3028
+ );
3000
3029
  const valueById = /* @__PURE__ */ new Map();
3001
3030
  const valueToOptionId = /* @__PURE__ */ new Map();
3002
3031
  for (const option of normalizedOptions) {
@@ -3075,10 +3104,12 @@ function compareVariantOrder(a, b) {
3075
3104
  function isVariantAvailableForSale(variant) {
3076
3105
  if (variant.isActive === false) return false;
3077
3106
  if (variant.isUnlimited) return true;
3078
- return (variant.stock ?? 0) > 0;
3107
+ return (variant.stock ?? 0) - (variant.reservedStock ?? 0) > 0;
3079
3108
  }
3080
3109
  function getMinMax(values) {
3081
- const numbers = values.filter((value) => typeof value === "number");
3110
+ const numbers = values.filter(
3111
+ (value) => typeof value === "number"
3112
+ );
3082
3113
  if (numbers.length === 0) {
3083
3114
  return { min: null, max: null };
3084
3115
  }
@@ -3089,7 +3120,9 @@ function getMinMax(values) {
3089
3120
  }
3090
3121
  function buildProductListingProjection(product, variants) {
3091
3122
  const orderedVariants = [...variants].sort(compareVariantOrder);
3092
- const activeVariants = orderedVariants.filter((variant) => variant.isActive !== false);
3123
+ const activeVariants = orderedVariants.filter(
3124
+ (variant) => variant.isActive !== false
3125
+ );
3093
3126
  const availableVariants = activeVariants.filter(isVariantAvailableForSale);
3094
3127
  const selectionHintVariant = availableVariants[0] ?? activeVariants[0] ?? null;
3095
3128
  const { min: minPrice, max: maxPrice } = getMinMax(
@@ -3128,7 +3161,9 @@ function buildProductListingGroupsByOption(args) {
3128
3161
  return [];
3129
3162
  }
3130
3163
  const listingBase = buildProductListingProjection(void 0, variants);
3164
+ const optionValuePrimaryImage = extractEntityId(value.thumbnail) ?? getFirstMediaId(value.images);
3131
3165
  const productFallbackImage = extractEntityId(args.product?.thumbnail) ?? getFirstMediaId(args.product?.images);
3166
+ const groupPrimaryImage = getFirstAvailableVariantPrimaryImage(variants) ?? optionValuePrimaryImage ?? productFallbackImage;
3132
3167
  return [
3133
3168
  {
3134
3169
  optionId: primaryOption.id,
@@ -3136,12 +3171,15 @@ function buildProductListingGroupsByOption(args) {
3136
3171
  optionValueId: value.id,
3137
3172
  optionValueLabel: value.label,
3138
3173
  optionValueSlug: value.slug,
3174
+ optionValueSwatchColor: value.swatchColor ?? null,
3175
+ optionValueThumbnail: value.thumbnail ?? null,
3176
+ optionValueImages: value.images ?? null,
3139
3177
  variantIds: variants.map((variant) => String(variant.id)),
3140
3178
  variantCount: variants.length,
3141
3179
  variants,
3142
3180
  listing: {
3143
3181
  ...listingBase,
3144
- primaryImage: listingBase.primaryImage ?? productFallbackImage
3182
+ primaryImage: groupPrimaryImage
3145
3183
  }
3146
3184
  }
3147
3185
  ];
@@ -3465,7 +3503,11 @@ export {
3465
3503
  ReadOnlyCollectionClient,
3466
3504
  RealtimeConnection,
3467
3505
  SDKError,
3506
+ SERVER_COLLECTIONS,
3507
+ SERVER_ONLY_COLLECTIONS,
3468
3508
  ServerClient,
3509
+ ServerCollectionClient,
3510
+ ServerCollectionQueryBuilder,
3469
3511
  ServerCommerceClient,
3470
3512
  ServiceUnavailableError,
3471
3513
  ShippingApi,