@01.software/sdk 0.30.1 → 0.32.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.
Files changed (56) hide show
  1. package/README.md +160 -48
  2. package/dist/analytics/react.cjs.map +1 -1
  3. package/dist/analytics/react.js.map +1 -1
  4. package/dist/analytics.cjs.map +1 -1
  5. package/dist/analytics.js.map +1 -1
  6. package/dist/client.cjs +91 -62
  7. package/dist/client.cjs.map +1 -1
  8. package/dist/client.d.cts +6 -6
  9. package/dist/client.d.ts +6 -6
  10. package/dist/client.js +91 -62
  11. package/dist/client.js.map +1 -1
  12. package/dist/{collection-client-QPbwimkU.d.cts → collection-client-CORhppPb.d.cts} +3 -3
  13. package/dist/{collection-client-B9d9kr1d.d.ts → collection-client-DPGXnhoF.d.ts} +3 -3
  14. package/dist/{const-VZuk2tWc.d.cts → const-Brk2Ff0q.d.cts} +4 -4
  15. package/dist/{const-B75IFDRi.d.ts → const-DcY2_z9O.d.ts} +4 -4
  16. package/dist/{index-B2WbhEgT.d.cts → index-BGEhoDUs.d.cts} +1 -1
  17. package/dist/{index-B2WbhEgT.d.ts → index-BGEhoDUs.d.ts} +1 -1
  18. package/dist/index.cjs +214 -66
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +9 -9
  21. package/dist/index.d.ts +9 -9
  22. package/dist/index.js +214 -66
  23. package/dist/index.js.map +1 -1
  24. package/dist/{payload-types-DPjO_IbQ.d.cts → payload-types-DVK1QCeU.d.cts} +793 -531
  25. package/dist/{payload-types-DPjO_IbQ.d.ts → payload-types-DVK1QCeU.d.ts} +793 -531
  26. package/dist/query.cjs +63 -13
  27. package/dist/query.cjs.map +1 -1
  28. package/dist/query.d.cts +17 -17
  29. package/dist/query.d.ts +17 -17
  30. package/dist/query.js +63 -13
  31. package/dist/query.js.map +1 -1
  32. package/dist/realtime.cjs.map +1 -1
  33. package/dist/realtime.d.cts +2 -2
  34. package/dist/realtime.d.ts +2 -2
  35. package/dist/realtime.js.map +1 -1
  36. package/dist/server.cjs +176 -18
  37. package/dist/server.cjs.map +1 -1
  38. package/dist/server.d.cts +124 -7
  39. package/dist/server.d.ts +124 -7
  40. package/dist/server.js +176 -18
  41. package/dist/server.js.map +1 -1
  42. package/dist/{types-BwT0eeaz.d.cts → types-ByMrR_Z_.d.cts} +6 -2
  43. package/dist/{types-DuSKPiY5.d.ts → types-CAkWqIr6.d.cts} +82 -9
  44. package/dist/{types-Dlb2mwpX.d.cts → types-CYMSBkJC.d.ts} +82 -9
  45. package/dist/{types-1fBLrYU7.d.ts → types-DUPC7Xn6.d.ts} +6 -2
  46. package/dist/ui/form.d.cts +1 -1
  47. package/dist/ui/form.d.ts +1 -1
  48. package/dist/ui/video.d.cts +1 -1
  49. package/dist/ui/video.d.ts +1 -1
  50. package/dist/webhook.cjs +48 -1
  51. package/dist/webhook.cjs.map +1 -1
  52. package/dist/webhook.d.cts +73 -4
  53. package/dist/webhook.d.ts +73 -4
  54. package/dist/webhook.js +48 -1
  55. package/dist/webhook.js.map +1 -1
  56. package/package.json +3 -3
package/dist/index.d.cts CHANGED
@@ -1,15 +1,15 @@
1
- import { d as ClientConfig, h as RootClient } from './types-Dlb2mwpX.cjs';
2
- export { k as AddItemParams, A as ApiQueryOptions, l as ApplyDiscountParams, B as BaseApi, m as BulkImportFulfillmentsParams, n as BulkImportFulfillmentsResponse, o as CalculateShippingParams, p as CalculateShippingResult, q as CartApi, r as CartApiOptions, s as CheckoutParams, t as ClearCartParams, e as ClientMetadata, c as ClientState, C as CommerceClient, u as CommerceClientOptions, a as CommunityClient, v as CommunityClientOptions, w as CommunityPost, x as CompatibilityProductSelectionParamEvent, y as ConfirmPaymentParams, z as ConfirmPaymentResponse, F as CreateFulfillmentParams, G as CreateOrderParams, H as CreateReturnParams, I as CustomerAuth, J as CustomerAuthOptions, K as CustomerAuthResponse, L as CustomerLoginData, b as CustomerNamespace, M as CustomerProfile, N as CustomerRefreshResponse, O as CustomerRegisterData, Q as CustomerRegisterResponse, T as CustomerSnapshot, D as DebugConfig, f as DeepPartial, U as DiscountApi, V as DiscountApiOptions, E as ExtractArrayType, X as LegacyProductSelectionParamEvent, Y as ListingGroupsParams, Z as NormalizedProductSelection, _ as OrderApi, $ as OrderApiOptions, P as PayloadFindResponse, g as PayloadMutationResponse, a0 as ProductApi, a1 as ProductApiOptions, a2 as ProductDetail, a3 as ProductDetailBrand, a4 as ProductDetailCategory, a5 as ProductDetailImage, a6 as ProductDetailImageMedia, a7 as ProductDetailListing, a8 as ProductDetailMedia, a9 as ProductDetailOption, aa as ProductDetailOptionValue, ab as ProductDetailParams, ac as ProductDetailTag, ad as ProductDetailVariant, ae as ProductDetailVariantOptionValue, af as ProductDetailVideo, ag as ProductHrefGroup, ah as ProductHrefOptions, ai as ProductHrefProduct, aj as ProductListingGroup, ak as ProductListingGroupSummary, al as ProductListingGroupsItem, am as ProductListingGroupsResponse, an as ProductListingProductShape, ao as ProductListingProjection, ap as ProductOptionMatrix, aq as ProductOptionMatrixOption, ar as ProductOptionMatrixValue, as as ProductOptionMatrixVariant, at as ProductOptionShape, au as ProductOptionValueShape, av as ProductSelectionAvailableValue, aw as ProductSelectionByOptionValue, ax as ProductSelectionCodecError, ay as ProductSelectionCodecOptions, az as ProductSelectionInput, aA as ProductSelectionResolution, aB as ProductSelectionResolutionContext, aC as ProductVariantShape, aD as RemoveDiscountParams, aE as RemoveItemParams, aF as RequestOptions, R as RetryConfig, aG as ReturnItem, aH as ReturnReason, aI as ReturnWithRefundParams, i as RootCollectionClient, j as RootReadOnlyQueryBuilder, aJ as ServerApiOptions, aK as ShippingApi, aL as ShippingApiOptions, S as Sort, aM as StockCheckParams, aN as StockCheckResponse, aO as StockCheckResult, aP as UpdateFulfillmentParams, aQ as UpdateItemParams, aR as UpdateOrderParams, aS as UpdateProfileData, aT as UpdateReturnParams, aU as UpdateTransactionParams, aV as ValidateDiscountParams, aW as ValidateDiscountResult, W as Where, aX as buildProductHref, aY as buildProductListingGroupsByOption, aZ as buildProductListingProjection, a_ as buildProductOptionMatrix, a$ as buildProductOptionMatrixFromDetail, b0 as createProductSelectionCodec, b1 as getAvailableOptionValues, b2 as getProductSelectionImages, b3 as getSelectedValueByOptionId, b4 as normalizeProductSelection, b5 as normalizeProductSelectionFromMatrix, b6 as normalizeSelectedValueIds, b7 as parseProductSelection, b8 as resolveProductSelection, b9 as resolveProductSelectionFromMatrix, ba as resolveVariantForSelection, bb as stringifyProductSelection } from './types-Dlb2mwpX.cjs';
3
- import { d as Product } from './payload-types-DPjO_IbQ.cjs';
4
- export { A as Article, e as ArticleAuthor, f as ArticleCategory, g as ArticleTag, h as Cart, i as CartItem, D as Document, I as Image, O as Order, P as Post, j as PostCategory, k as ProductVariant, T as Tenant, V as Video } from './payload-types-DPjO_IbQ.cjs';
5
- export { C as CollectionType } from './types-BwT0eeaz.cjs';
6
- export { CUSTOMER_PASSWORD_RESET_OPERATION, CustomerAuthWebhookEvent, CustomerAuthWebhookHandlers, CustomerPasswordResetWebhookData, CustomerPasswordResetWebhookEvent, WebhookEvent, WebhookHandler, WebhookOperation, WebhookOptions, createCustomerAuthWebhookHandler, createTypedWebhookHandler, handleWebhook, isCustomerPasswordResetWebhookEvent, isValidWebhookEvent } from './webhook.cjs';
7
- export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS, P as PublicCollection, S as SERVER_COLLECTIONS, b as SERVER_ONLY_COLLECTIONS } from './const-VZuk2tWc.cjs';
1
+ import { d as ClientConfig, h as RootClient } from './types-CAkWqIr6.cjs';
2
+ export { k as AddItemParams, A as ApiQueryOptions, l as ApplyDiscountParams, B as BaseApi, m as BulkImportFulfillmentsParams, n as BulkImportFulfillmentsResponse, o as CalculateShippingParams, p as CalculateShippingResult, q as CartApi, r as CartApiOptions, s as CheckoutParams, t as ClearCartParams, e as ClientMetadata, c as ClientState, C as CommerceClient, u as CommerceClientOptions, a as CommunityClient, v as CommunityClientOptions, w as CommunityPost, x as CompatibilityProductSelectionParamEvent, y as ConfirmPaymentParams, z as ConfirmPaymentResponse, F as CreateFulfillmentParams, G as CreateOrderItem, H as CreateOrderParams, I as CreateReturnParams, J as CustomerAuth, K as CustomerAuthOptions, L as CustomerAuthResponse, M as CustomerLoginData, b as CustomerNamespace, N as CustomerProfile, O as CustomerRefreshResponse, Q as CustomerRegisterData, T as CustomerRegisterResponse, U as CustomerSnapshot, D as DebugConfig, f as DeepPartial, V as DiscountApi, X as DiscountApiOptions, E as ExtractArrayType, Y as LegacyProductSelectionParamEvent, Z as ListingGroupingState, _ as ListingGroupsParams, $ as NormalizedProductSelection, a0 as OrderApi, a1 as OrderApiOptions, P as PayloadFindResponse, g as PayloadMutationResponse, a2 as ProductApi, a3 as ProductApiOptions, a4 as ProductDetail, a5 as ProductDetailBrand, a6 as ProductDetailCategory, a7 as ProductDetailImage, a8 as ProductDetailImageMedia, a9 as ProductDetailListing, aa as ProductDetailMedia, ab as ProductDetailOption, ac as ProductDetailOptionValue, ad as ProductDetailParams, ae as ProductDetailTag, af as ProductDetailVariant, ag as ProductDetailVariantOptionValue, ah as ProductDetailVideo, ai as ProductHrefGroup, aj as ProductHrefOptions, ak as ProductHrefProduct, al as ProductListingCard, am as ProductListingCardPriceRange, an as ProductListingGroup, ao as ProductListingGroupSummary, ap as ProductListingGroupVariant, aq as ProductListingGroupsItem, ar as ProductListingGroupsProduct, as as ProductListingGroupsResponse, at as ProductListingProductShape, au as ProductListingProjection, av as ProductListingSwatch, aw as ProductOptionMatrix, ax as ProductOptionMatrixOption, ay as ProductOptionMatrixValue, az as ProductOptionMatrixVariant, aA as ProductOptionShape, aB as ProductOptionValueShape, aC as ProductSelectionAvailableValue, aD as ProductSelectionByOptionValue, aE as ProductSelectionCodecError, aF as ProductSelectionCodecOptions, aG as ProductSelectionInput, aH as ProductSelectionResolution, aI as ProductSelectionResolutionContext, aJ as ProductVariantShape, aK as RemoveDiscountParams, aL as RemoveItemParams, aM as RequestOptions, R as RetryConfig, aN as ReturnItem, aO as ReturnReason, aP as ReturnWithRefundParams, i as RootCollectionClient, j as RootReadOnlyQueryBuilder, aQ as ServerApiOptions, aR as ShippingApi, aS as ShippingApiOptions, S as Sort, aT as StockCheckParams, aU as StockCheckResponse, aV as StockCheckResult, aW as UpdateFulfillmentParams, aX as UpdateItemParams, aY as UpdateOrderParams, aZ as UpdateProfileData, a_ as UpdateReturnParams, a$ as UpdateTransactionParams, b0 as ValidateDiscountParams, b1 as ValidateDiscountResult, W as Where, b2 as buildProductHref, b3 as buildProductListingCard, b4 as buildProductListingGroupsByOption, b5 as buildProductListingProjection, b6 as buildProductOptionMatrix, b7 as buildProductOptionMatrixFromDetail, b8 as createProductSelectionCodec, b9 as getAvailableOptionValues, ba as getProductSelectionImages, bb as getSelectedValueByOptionId, bc as normalizeProductSelection, bd as normalizeProductSelectionFromMatrix, be as normalizeSelectedValueIds, bf as parseProductSelection, bg as resolveProductSelection, bh as resolveProductSelectionFromMatrix, bi as resolveVariantForSelection, bj as stringifyProductSelection } from './types-CAkWqIr6.cjs';
3
+ import { P as Product } from './payload-types-DVK1QCeU.cjs';
4
+ export { A as Article, f as ArticleAuthor, g as ArticleCategory, h as ArticleTag, i as Cart, j as CartItem, D as Document, I as Image, O as Order, c as Post, k as PostCategory, l as ProductVariant, T as Tenant, V as Video } from './payload-types-DVK1QCeU.cjs';
5
+ export { C as CollectionType, P as Product, a as ProductCollection } from './types-ByMrR_Z_.cjs';
6
+ export { CUSTOMER_PASSWORD_RESET_OPERATION, CollectionWebhookOperation, CustomerAuthWebhookEvent, CustomerAuthWebhookHandlers, CustomerPasswordResetWebhookData, CustomerPasswordResetWebhookEvent, ORDER_CHANGED_EVENT_TYPE, OrderChangedWebhookEvent, WebhookChange, WebhookEvent, WebhookHandler, WebhookKnownOperation, WebhookOperation, WebhookOptions, WebhookOrderChange, WebhookOrderMoved, WebhookOrderScope, createCustomerAuthWebhookHandler, createTypedWebhookHandler, handleWebhook, isCustomerPasswordResetWebhookEvent, isOrderChangedWebhookEvent, isValidWebhookEvent, isWebhookCollection, isWebhookOperation } from './webhook.cjs';
7
+ export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS, P as PublicCollection, S as SERVER_COLLECTIONS, b as SERVER_ONLY_COLLECTIONS } from './const-Brk2Ff0q.cjs';
8
8
  export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.cjs';
9
9
  export { a as IMAGE_SIZES, I as ImageData, b as ImagePalette, c as ImagePlaceholderOptions, g as getImageLqip, d as getImagePalette, e as getImagePlaceholderStyle, f as getImageSrcSet, h as getImageUrl } from './image-BDz2-AaO.cjs';
10
10
  export { V as VideoGifOptions, a as VideoThumbnailOptions, g as getVideoGif, b as getVideoMp4Url, c as getVideoStoryboard, d as getVideoStreamUrl, e as getVideoThumbnail } from './video-WR_TFO9a.cjs';
11
11
  export { Analytics, AnalyticsConfig, createAnalytics } from './analytics.cjs';
12
- export { A as ApiError, a as AuthError, C as ConfigError, b as ConflictError, G as GoneError, N as NetworkError, c as NotFoundError, P as PermissionError, R as RateLimitError, S as SDKError, d as ServiceUnavailableError, T as TimeoutError, U as UsageLimitError, V as ValidationError, e as createAuthError, f as createConflictError, g as createNotFoundError, h as createPermissionError, i as createRateLimitError, j as isApiError, k as isAuthError, l as isConfigError, m as isConflictError, n as isGoneError, o as isNetworkError, p as isNotFoundError, q as isPermissionError, r as isRateLimitError, s as isSDKError, t as isServiceUnavailableError, u as isTimeoutError, v as isUsageLimitError, w as isValidationError } from './index-B2WbhEgT.cjs';
12
+ export { A as ApiError, a as AuthError, C as ConfigError, b as ConflictError, G as GoneError, N as NetworkError, c as NotFoundError, P as PermissionError, R as RateLimitError, S as SDKError, d as ServiceUnavailableError, T as TimeoutError, U as UsageLimitError, V as ValidationError, e as createAuthError, f as createConflictError, g as createNotFoundError, h as createPermissionError, i as createRateLimitError, j as isApiError, k as isAuthError, l as isConfigError, m as isConflictError, n as isGoneError, o as isNetworkError, p as isNotFoundError, q as isPermissionError, r as isRateLimitError, s as isSDKError, t as isServiceUnavailableError, u as isTimeoutError, v as isUsageLimitError, w as isValidationError } from './index-BGEhoDUs.cjs';
13
13
 
14
14
  declare const generateOrderNumber: () => string;
15
15
 
@@ -31,4 +31,4 @@ declare const resolveRelation: <T>(ref: T | string | number | null | undefined)
31
31
 
32
32
  declare function createClient(options: ClientConfig): RootClient;
33
33
 
34
- export { RootClient as Client, ClientConfig, RootClient as ClientType, Product, RootClient, createClient, formatOrderName, generateOrderNumber, resolveRelation };
34
+ export { RootClient as Client, ClientConfig, RootClient as ClientType, RootClient, createClient, formatOrderName, generateOrderNumber, resolveRelation };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { d as ClientConfig, h as RootClient } from './types-DuSKPiY5.js';
2
- export { k as AddItemParams, A as ApiQueryOptions, l as ApplyDiscountParams, B as BaseApi, m as BulkImportFulfillmentsParams, n as BulkImportFulfillmentsResponse, o as CalculateShippingParams, p as CalculateShippingResult, q as CartApi, r as CartApiOptions, s as CheckoutParams, t as ClearCartParams, e as ClientMetadata, c as ClientState, C as CommerceClient, u as CommerceClientOptions, a as CommunityClient, v as CommunityClientOptions, w as CommunityPost, x as CompatibilityProductSelectionParamEvent, y as ConfirmPaymentParams, z as ConfirmPaymentResponse, F as CreateFulfillmentParams, G as CreateOrderParams, H as CreateReturnParams, I as CustomerAuth, J as CustomerAuthOptions, K as CustomerAuthResponse, L as CustomerLoginData, b as CustomerNamespace, M as CustomerProfile, N as CustomerRefreshResponse, O as CustomerRegisterData, Q as CustomerRegisterResponse, T as CustomerSnapshot, D as DebugConfig, f as DeepPartial, U as DiscountApi, V as DiscountApiOptions, E as ExtractArrayType, X as LegacyProductSelectionParamEvent, Y as ListingGroupsParams, Z as NormalizedProductSelection, _ as OrderApi, $ as OrderApiOptions, P as PayloadFindResponse, g as PayloadMutationResponse, a0 as ProductApi, a1 as ProductApiOptions, a2 as ProductDetail, a3 as ProductDetailBrand, a4 as ProductDetailCategory, a5 as ProductDetailImage, a6 as ProductDetailImageMedia, a7 as ProductDetailListing, a8 as ProductDetailMedia, a9 as ProductDetailOption, aa as ProductDetailOptionValue, ab as ProductDetailParams, ac as ProductDetailTag, ad as ProductDetailVariant, ae as ProductDetailVariantOptionValue, af as ProductDetailVideo, ag as ProductHrefGroup, ah as ProductHrefOptions, ai as ProductHrefProduct, aj as ProductListingGroup, ak as ProductListingGroupSummary, al as ProductListingGroupsItem, am as ProductListingGroupsResponse, an as ProductListingProductShape, ao as ProductListingProjection, ap as ProductOptionMatrix, aq as ProductOptionMatrixOption, ar as ProductOptionMatrixValue, as as ProductOptionMatrixVariant, at as ProductOptionShape, au as ProductOptionValueShape, av as ProductSelectionAvailableValue, aw as ProductSelectionByOptionValue, ax as ProductSelectionCodecError, ay as ProductSelectionCodecOptions, az as ProductSelectionInput, aA as ProductSelectionResolution, aB as ProductSelectionResolutionContext, aC as ProductVariantShape, aD as RemoveDiscountParams, aE as RemoveItemParams, aF as RequestOptions, R as RetryConfig, aG as ReturnItem, aH as ReturnReason, aI as ReturnWithRefundParams, i as RootCollectionClient, j as RootReadOnlyQueryBuilder, aJ as ServerApiOptions, aK as ShippingApi, aL as ShippingApiOptions, S as Sort, aM as StockCheckParams, aN as StockCheckResponse, aO as StockCheckResult, aP as UpdateFulfillmentParams, aQ as UpdateItemParams, aR as UpdateOrderParams, aS as UpdateProfileData, aT as UpdateReturnParams, aU as UpdateTransactionParams, aV as ValidateDiscountParams, aW as ValidateDiscountResult, W as Where, aX as buildProductHref, aY as buildProductListingGroupsByOption, aZ as buildProductListingProjection, a_ as buildProductOptionMatrix, a$ as buildProductOptionMatrixFromDetail, b0 as createProductSelectionCodec, b1 as getAvailableOptionValues, b2 as getProductSelectionImages, b3 as getSelectedValueByOptionId, b4 as normalizeProductSelection, b5 as normalizeProductSelectionFromMatrix, b6 as normalizeSelectedValueIds, b7 as parseProductSelection, b8 as resolveProductSelection, b9 as resolveProductSelectionFromMatrix, ba as resolveVariantForSelection, bb as stringifyProductSelection } from './types-DuSKPiY5.js';
3
- import { d as Product } from './payload-types-DPjO_IbQ.js';
4
- export { A as Article, e as ArticleAuthor, f as ArticleCategory, g as ArticleTag, h as Cart, i as CartItem, D as Document, I as Image, O as Order, P as Post, j as PostCategory, k as ProductVariant, T as Tenant, V as Video } from './payload-types-DPjO_IbQ.js';
5
- export { C as CollectionType } from './types-1fBLrYU7.js';
6
- export { CUSTOMER_PASSWORD_RESET_OPERATION, CustomerAuthWebhookEvent, CustomerAuthWebhookHandlers, CustomerPasswordResetWebhookData, CustomerPasswordResetWebhookEvent, WebhookEvent, WebhookHandler, WebhookOperation, WebhookOptions, createCustomerAuthWebhookHandler, createTypedWebhookHandler, handleWebhook, isCustomerPasswordResetWebhookEvent, isValidWebhookEvent } from './webhook.js';
7
- export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS, P as PublicCollection, S as SERVER_COLLECTIONS, b as SERVER_ONLY_COLLECTIONS } from './const-B75IFDRi.js';
1
+ import { d as ClientConfig, h as RootClient } from './types-CYMSBkJC.js';
2
+ export { k as AddItemParams, A as ApiQueryOptions, l as ApplyDiscountParams, B as BaseApi, m as BulkImportFulfillmentsParams, n as BulkImportFulfillmentsResponse, o as CalculateShippingParams, p as CalculateShippingResult, q as CartApi, r as CartApiOptions, s as CheckoutParams, t as ClearCartParams, e as ClientMetadata, c as ClientState, C as CommerceClient, u as CommerceClientOptions, a as CommunityClient, v as CommunityClientOptions, w as CommunityPost, x as CompatibilityProductSelectionParamEvent, y as ConfirmPaymentParams, z as ConfirmPaymentResponse, F as CreateFulfillmentParams, G as CreateOrderItem, H as CreateOrderParams, I as CreateReturnParams, J as CustomerAuth, K as CustomerAuthOptions, L as CustomerAuthResponse, M as CustomerLoginData, b as CustomerNamespace, N as CustomerProfile, O as CustomerRefreshResponse, Q as CustomerRegisterData, T as CustomerRegisterResponse, U as CustomerSnapshot, D as DebugConfig, f as DeepPartial, V as DiscountApi, X as DiscountApiOptions, E as ExtractArrayType, Y as LegacyProductSelectionParamEvent, Z as ListingGroupingState, _ as ListingGroupsParams, $ as NormalizedProductSelection, a0 as OrderApi, a1 as OrderApiOptions, P as PayloadFindResponse, g as PayloadMutationResponse, a2 as ProductApi, a3 as ProductApiOptions, a4 as ProductDetail, a5 as ProductDetailBrand, a6 as ProductDetailCategory, a7 as ProductDetailImage, a8 as ProductDetailImageMedia, a9 as ProductDetailListing, aa as ProductDetailMedia, ab as ProductDetailOption, ac as ProductDetailOptionValue, ad as ProductDetailParams, ae as ProductDetailTag, af as ProductDetailVariant, ag as ProductDetailVariantOptionValue, ah as ProductDetailVideo, ai as ProductHrefGroup, aj as ProductHrefOptions, ak as ProductHrefProduct, al as ProductListingCard, am as ProductListingCardPriceRange, an as ProductListingGroup, ao as ProductListingGroupSummary, ap as ProductListingGroupVariant, aq as ProductListingGroupsItem, ar as ProductListingGroupsProduct, as as ProductListingGroupsResponse, at as ProductListingProductShape, au as ProductListingProjection, av as ProductListingSwatch, aw as ProductOptionMatrix, ax as ProductOptionMatrixOption, ay as ProductOptionMatrixValue, az as ProductOptionMatrixVariant, aA as ProductOptionShape, aB as ProductOptionValueShape, aC as ProductSelectionAvailableValue, aD as ProductSelectionByOptionValue, aE as ProductSelectionCodecError, aF as ProductSelectionCodecOptions, aG as ProductSelectionInput, aH as ProductSelectionResolution, aI as ProductSelectionResolutionContext, aJ as ProductVariantShape, aK as RemoveDiscountParams, aL as RemoveItemParams, aM as RequestOptions, R as RetryConfig, aN as ReturnItem, aO as ReturnReason, aP as ReturnWithRefundParams, i as RootCollectionClient, j as RootReadOnlyQueryBuilder, aQ as ServerApiOptions, aR as ShippingApi, aS as ShippingApiOptions, S as Sort, aT as StockCheckParams, aU as StockCheckResponse, aV as StockCheckResult, aW as UpdateFulfillmentParams, aX as UpdateItemParams, aY as UpdateOrderParams, aZ as UpdateProfileData, a_ as UpdateReturnParams, a$ as UpdateTransactionParams, b0 as ValidateDiscountParams, b1 as ValidateDiscountResult, W as Where, b2 as buildProductHref, b3 as buildProductListingCard, b4 as buildProductListingGroupsByOption, b5 as buildProductListingProjection, b6 as buildProductOptionMatrix, b7 as buildProductOptionMatrixFromDetail, b8 as createProductSelectionCodec, b9 as getAvailableOptionValues, ba as getProductSelectionImages, bb as getSelectedValueByOptionId, bc as normalizeProductSelection, bd as normalizeProductSelectionFromMatrix, be as normalizeSelectedValueIds, bf as parseProductSelection, bg as resolveProductSelection, bh as resolveProductSelectionFromMatrix, bi as resolveVariantForSelection, bj as stringifyProductSelection } from './types-CYMSBkJC.js';
3
+ import { P as Product } from './payload-types-DVK1QCeU.js';
4
+ export { A as Article, f as ArticleAuthor, g as ArticleCategory, h as ArticleTag, i as Cart, j as CartItem, D as Document, I as Image, O as Order, c as Post, k as PostCategory, l as ProductVariant, T as Tenant, V as Video } from './payload-types-DVK1QCeU.js';
5
+ export { C as CollectionType, P as Product, a as ProductCollection } from './types-DUPC7Xn6.js';
6
+ export { CUSTOMER_PASSWORD_RESET_OPERATION, CollectionWebhookOperation, CustomerAuthWebhookEvent, CustomerAuthWebhookHandlers, CustomerPasswordResetWebhookData, CustomerPasswordResetWebhookEvent, ORDER_CHANGED_EVENT_TYPE, OrderChangedWebhookEvent, WebhookChange, WebhookEvent, WebhookHandler, WebhookKnownOperation, WebhookOperation, WebhookOptions, WebhookOrderChange, WebhookOrderMoved, WebhookOrderScope, createCustomerAuthWebhookHandler, createTypedWebhookHandler, handleWebhook, isCustomerPasswordResetWebhookEvent, isOrderChangedWebhookEvent, isValidWebhookEvent, isWebhookCollection, isWebhookOperation } from './webhook.js';
7
+ export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS, P as PublicCollection, S as SERVER_COLLECTIONS, b as SERVER_ONLY_COLLECTIONS } from './const-DcY2_z9O.js';
8
8
  export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.js';
9
9
  export { a as IMAGE_SIZES, I as ImageData, b as ImagePalette, c as ImagePlaceholderOptions, g as getImageLqip, d as getImagePalette, e as getImagePlaceholderStyle, f as getImageSrcSet, h as getImageUrl } from './image-BDz2-AaO.js';
10
10
  export { V as VideoGifOptions, a as VideoThumbnailOptions, g as getVideoGif, b as getVideoMp4Url, c as getVideoStoryboard, d as getVideoStreamUrl, e as getVideoThumbnail } from './video-WR_TFO9a.js';
11
11
  export { Analytics, AnalyticsConfig, createAnalytics } from './analytics.js';
12
- export { A as ApiError, a as AuthError, C as ConfigError, b as ConflictError, G as GoneError, N as NetworkError, c as NotFoundError, P as PermissionError, R as RateLimitError, S as SDKError, d as ServiceUnavailableError, T as TimeoutError, U as UsageLimitError, V as ValidationError, e as createAuthError, f as createConflictError, g as createNotFoundError, h as createPermissionError, i as createRateLimitError, j as isApiError, k as isAuthError, l as isConfigError, m as isConflictError, n as isGoneError, o as isNetworkError, p as isNotFoundError, q as isPermissionError, r as isRateLimitError, s as isSDKError, t as isServiceUnavailableError, u as isTimeoutError, v as isUsageLimitError, w as isValidationError } from './index-B2WbhEgT.js';
12
+ export { A as ApiError, a as AuthError, C as ConfigError, b as ConflictError, G as GoneError, N as NetworkError, c as NotFoundError, P as PermissionError, R as RateLimitError, S as SDKError, d as ServiceUnavailableError, T as TimeoutError, U as UsageLimitError, V as ValidationError, e as createAuthError, f as createConflictError, g as createNotFoundError, h as createPermissionError, i as createRateLimitError, j as isApiError, k as isAuthError, l as isConfigError, m as isConflictError, n as isGoneError, o as isNetworkError, p as isNotFoundError, q as isPermissionError, r as isRateLimitError, s as isSDKError, t as isServiceUnavailableError, u as isTimeoutError, v as isUsageLimitError, w as isValidationError } from './index-BGEhoDUs.js';
13
13
 
14
14
  declare const generateOrderNumber: () => string;
15
15
 
@@ -31,4 +31,4 @@ declare const resolveRelation: <T>(ref: T | string | number | null | undefined)
31
31
 
32
32
  declare function createClient(options: ClientConfig): RootClient;
33
33
 
34
- export { RootClient as Client, ClientConfig, RootClient as ClientType, Product, RootClient, createClient, formatOrderName, generateOrderNumber, resolveRelation };
34
+ export { RootClient as Client, ClientConfig, RootClient as ClientType, RootClient, createClient, formatOrderName, generateOrderNumber, resolveRelation };
package/dist/index.js CHANGED
@@ -45,8 +45,16 @@ var ValidationError = class extends SDKError {
45
45
  }
46
46
  };
47
47
  var ApiError = class extends SDKError {
48
- constructor(message, status, details, userMessage, suggestion) {
49
- super("API_ERROR", message, status, details, userMessage, suggestion);
48
+ constructor(message, status, details, userMessage, suggestion, requestId) {
49
+ super(
50
+ "API_ERROR",
51
+ message,
52
+ status,
53
+ details,
54
+ userMessage,
55
+ suggestion,
56
+ requestId
57
+ );
50
58
  this.name = "ApiError";
51
59
  }
52
60
  };
@@ -97,19 +105,43 @@ var UsageLimitError = class extends SDKError {
97
105
  };
98
106
  var AuthError = class extends SDKError {
99
107
  constructor(message, details, userMessage, suggestion, requestId) {
100
- super("auth_error", message, 401, details, userMessage, suggestion, requestId);
108
+ super(
109
+ "auth_error",
110
+ message,
111
+ 401,
112
+ details,
113
+ userMessage,
114
+ suggestion,
115
+ requestId
116
+ );
101
117
  this.name = "AuthError";
102
118
  }
103
119
  };
104
120
  var PermissionError = class extends SDKError {
105
121
  constructor(message, details, userMessage, suggestion, requestId) {
106
- super("permission_error", message, 403, details, userMessage, suggestion, requestId);
122
+ super(
123
+ "permission_error",
124
+ message,
125
+ 403,
126
+ details,
127
+ userMessage,
128
+ suggestion,
129
+ requestId
130
+ );
107
131
  this.name = "PermissionError";
108
132
  }
109
133
  };
110
134
  var NotFoundError = class extends SDKError {
111
135
  constructor(message, details, userMessage, suggestion, requestId) {
112
- super("not_found", message, 404, details, userMessage, suggestion, requestId);
136
+ super(
137
+ "not_found",
138
+ message,
139
+ 404,
140
+ details,
141
+ userMessage,
142
+ suggestion,
143
+ requestId
144
+ );
113
145
  this.name = "NotFoundError";
114
146
  }
115
147
  };
@@ -121,7 +153,15 @@ var ConflictError = class extends SDKError {
121
153
  };
122
154
  var RateLimitError = class extends SDKError {
123
155
  constructor(message, retryAfter, details, userMessage, suggestion, requestId) {
124
- super("rate_limit_exceeded", message, 429, details, userMessage, suggestion, requestId);
156
+ super(
157
+ "rate_limit_exceeded",
158
+ message,
159
+ 429,
160
+ details,
161
+ userMessage,
162
+ suggestion,
163
+ requestId
164
+ );
125
165
  this.name = "RateLimitError";
126
166
  this.retryAfter = retryAfter;
127
167
  }
@@ -170,7 +210,7 @@ function isRateLimitError(error) {
170
210
  }
171
211
  var createNetworkError = (message, status, details, userMessage, suggestion) => new NetworkError(message, status, details, userMessage, suggestion);
172
212
  var createValidationError = (message, details, userMessage, suggestion, status) => new ValidationError(message, details, userMessage, suggestion, status);
173
- var createApiError = (message, status, details, userMessage, suggestion) => new ApiError(message, status, details, userMessage, suggestion);
213
+ var createApiError = (message, status, details, userMessage, suggestion, requestId) => new ApiError(message, status, details, userMessage, suggestion, requestId);
174
214
  var createConfigError = (message, details, userMessage, suggestion) => new ConfigError(message, details, userMessage, suggestion);
175
215
  var createTimeoutError = (message, details, userMessage, suggestion) => new TimeoutError(message, details, userMessage, suggestion);
176
216
  var createUsageLimitError = (message, usage, details, userMessage, suggestion) => new UsageLimitError(message, usage, details, userMessage, suggestion);
@@ -178,7 +218,14 @@ var createAuthError = (message, details, userMessage, suggestion, requestId) =>
178
218
  var createPermissionError = (message, details, userMessage, suggestion, requestId) => new PermissionError(message, details, userMessage, suggestion, requestId);
179
219
  var createNotFoundError = (message, details, userMessage, suggestion, requestId) => new NotFoundError(message, details, userMessage, suggestion, requestId);
180
220
  var createConflictError = (message, details, userMessage, suggestion, requestId) => new ConflictError(message, details, userMessage, suggestion, requestId);
181
- var createRateLimitError = (message, retryAfter, details, userMessage, suggestion, requestId) => new RateLimitError(message, retryAfter, details, userMessage, suggestion, requestId);
221
+ var createRateLimitError = (message, retryAfter, details, userMessage, suggestion, requestId) => new RateLimitError(
222
+ message,
223
+ retryAfter,
224
+ details,
225
+ userMessage,
226
+ suggestion,
227
+ requestId
228
+ );
182
229
 
183
230
  // src/core/internal/utils/credentials.ts
184
231
  function requirePublishableKeyForSecret(apiName, publishableKey, secretKey) {
@@ -218,6 +265,22 @@ function debugLog(debug, type, message, data) {
218
265
  console.groupEnd();
219
266
  }
220
267
  }
268
+ function redactSensitiveHeader(value) {
269
+ const prefix = value.toLowerCase().startsWith("bearer ") ? "Bearer " : "";
270
+ return value.length > 20 ? `${prefix}...****${value.slice(-8)}` : "****";
271
+ }
272
+ function redactSensitiveHeaders(headers) {
273
+ const redacted = Object.fromEntries(headers.entries());
274
+ if (redacted.authorization) {
275
+ redacted.authorization = redactSensitiveHeader(redacted.authorization);
276
+ }
277
+ if (redacted["x-preview-token"]) {
278
+ redacted["x-preview-token"] = redactSensitiveHeader(
279
+ redacted["x-preview-token"]
280
+ );
281
+ }
282
+ return redacted;
283
+ }
221
284
  function getErrorSuggestion(status) {
222
285
  if (status === 400)
223
286
  return "The request data failed validation. Check field values and types.";
@@ -292,6 +355,12 @@ async function parseErrorBody(response) {
292
355
  return fallback;
293
356
  }
294
357
  }
358
+ function getParsedErrorSuggestion(status, parsed) {
359
+ if (status === 403 && parsed.reason === "origin_not_allowed") {
360
+ return "Add the request origin to the tenant Browser API origins, then retry the browser request.";
361
+ }
362
+ return getErrorSuggestion(status);
363
+ }
295
364
  async function delay(ms) {
296
365
  return new Promise((resolve) => setTimeout(resolve, ms));
297
366
  }
@@ -305,7 +374,7 @@ function createHttpStatusError(status, parsed, details, requestId) {
305
374
  ...parsed.errors && { errors: parsed.errors },
306
375
  ...parsed.body && { body: parsed.body }
307
376
  };
308
- const suggestion = getErrorSuggestion(status);
377
+ const suggestion = getParsedErrorSuggestion(status, parsed);
309
378
  if (status === 400 || status === 422) {
310
379
  return attachRequestId(
311
380
  createValidationError(
@@ -411,11 +480,7 @@ async function httpFetch(url, options) {
411
480
  if (!headers.has("Content-Type") && requestInit.body && !(requestInit.body instanceof FormData)) {
412
481
  headers.set("Content-Type", "application/json");
413
482
  }
414
- const redactedHeaders = Object.fromEntries(headers.entries());
415
- if (redactedHeaders["authorization"]) {
416
- const token = redactedHeaders["authorization"];
417
- redactedHeaders["authorization"] = token.length > 20 ? `Bearer ...****${token.slice(-8)}` : "****";
418
- }
483
+ const redactedHeaders = redactSensitiveHeaders(headers);
419
484
  debugLog(debug, "request", url, {
420
485
  method: requestInit.method || "GET",
421
486
  headers: redactedHeaders,
@@ -433,7 +498,7 @@ async function httpFetch(url, options) {
433
498
  debugLog(debug, "response", url, {
434
499
  status: response.status,
435
500
  statusText: response.statusText,
436
- headers: Object.fromEntries(response.headers.entries())
501
+ headers: redactSensitiveHeaders(response.headers)
437
502
  });
438
503
  if (!response.ok) {
439
504
  if (isUsageLimitExceededResponse(response)) {
@@ -866,7 +931,7 @@ async function parseApiResponse(response, endpoint) {
866
931
  if (reason === "validation_failed") {
867
932
  throw attachRequestId(createValidationError(errorMessage, data, errorMessage), requestId);
868
933
  }
869
- if (reason === "token_expired" || reason === "token_invalid" || reason === "key_invalid" || reason === "key_revoked") {
934
+ if (reason === "token_expired" || reason === "token_invalid" || reason === "preview_token_invalid" || reason === "preview_token_required" || reason === "key_invalid" || reason === "key_revoked") {
870
935
  throw attachRequestId(createAuthError(errorMessage, data, errorMessage), requestId);
871
936
  }
872
937
  if (reason === "forbidden") {
@@ -1161,7 +1226,7 @@ var CustomerAuth = class {
1161
1226
  );
1162
1227
  return data.customer ?? null;
1163
1228
  } catch (error) {
1164
- if (error instanceof ApiError && error.status === 401) {
1229
+ if (error instanceof SDKError && error.status === 401) {
1165
1230
  this.setToken(null);
1166
1231
  return null;
1167
1232
  }
@@ -1256,51 +1321,15 @@ var CustomerAuth = class {
1256
1321
  if (!headers.has("Content-Type") && init.body) {
1257
1322
  headers.set("Content-Type", "application/json");
1258
1323
  }
1259
- const controller = new AbortController();
1260
- const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT2);
1261
- let res;
1262
- try {
1263
- res = await fetch(`${this.baseUrl}${path}`, {
1264
- ...init,
1265
- headers,
1266
- signal: controller.signal
1267
- });
1268
- } catch (error) {
1269
- clearTimeout(timeoutId);
1270
- if (error instanceof Error && error.name === "AbortError") {
1271
- throw new TimeoutError(`Request timed out after ${DEFAULT_TIMEOUT2}ms`, {
1272
- url: path,
1273
- timeout: DEFAULT_TIMEOUT2
1274
- });
1275
- }
1276
- throw new NetworkError(
1277
- error instanceof Error ? error.message : "Network request failed",
1278
- void 0,
1279
- { url: path },
1280
- "Network connection failed.",
1281
- "Please check your internet connection and try again."
1282
- );
1283
- }
1284
- clearTimeout(timeoutId);
1285
- if (!res.ok) {
1286
- const body = await res.json().catch(() => ({}));
1287
- throw new ApiError(
1288
- body.error || `HTTP ${res.status}`,
1289
- res.status,
1290
- body.details,
1291
- body.error
1292
- );
1293
- }
1294
- try {
1295
- return await res.json();
1296
- } catch {
1297
- throw new ApiError(
1298
- "Invalid JSON response from server",
1299
- res.status,
1300
- void 0,
1301
- "INVALID_RESPONSE"
1302
- );
1303
- }
1324
+ const response = await httpFetch(path, {
1325
+ ...init,
1326
+ apiUrl: this.baseUrl,
1327
+ publishableKey: this.publishableKey,
1328
+ headers,
1329
+ timeout: DEFAULT_TIMEOUT2,
1330
+ retry: { maxRetries: 0 }
1331
+ });
1332
+ return parseApiResponse(response, path);
1304
1333
  }
1305
1334
  };
1306
1335
 
@@ -1637,7 +1666,7 @@ var ProductApi = class extends BaseApi {
1637
1666
  /**
1638
1667
  * Fetch full product detail by slug or id.
1639
1668
  * Returns `null` on 404 regardless of reason (`not_found` / `not_published` /
1640
- * `tenant_mismatch` / `feature_disabled`). For the reason behind a null,
1669
+ * `feature_disabled`). For the reason behind a null,
1641
1670
  * inspect `client.lastRequestId` against backend logs.
1642
1671
  */
1643
1672
  async detail(params) {
@@ -1660,11 +1689,54 @@ var ProductApi = class extends BaseApi {
1660
1689
  };
1661
1690
 
1662
1691
  // src/core/webhook/index.ts
1692
+ var ORDER_CHANGED_EVENT_TYPE = "collection.orderChanged";
1663
1693
  function isValidWebhookEvent(data) {
1664
1694
  if (typeof data !== "object" || data === null) return false;
1665
1695
  const obj = data;
1666
1696
  return typeof obj.collection === "string" && typeof obj.operation === "string" && obj.operation.length > 0 && typeof obj.data === "object" && obj.data !== null;
1667
1697
  }
1698
+ function isStringOrNumber(value) {
1699
+ return typeof value === "string" || typeof value === "number";
1700
+ }
1701
+ function isWebhookOrderScope(value) {
1702
+ if (!isRecord(value)) return false;
1703
+ if (value.kind === "collection") {
1704
+ return typeof value.collection === "string";
1705
+ }
1706
+ if (value.kind === "join") {
1707
+ return typeof value.collection === "string" && typeof value.field === "string" && isStringOrNumber(value.id);
1708
+ }
1709
+ return false;
1710
+ }
1711
+ function isWebhookOrderMoved(value) {
1712
+ if (!isRecord(value)) return false;
1713
+ return typeof value.collection === "string" && isStringOrNumber(value.id) && (value.relatedCollection === void 0 || typeof value.relatedCollection === "string") && (value.relatedId === void 0 || isStringOrNumber(value.relatedId));
1714
+ }
1715
+ function hasOptionalOrderValue(value, key) {
1716
+ return value[key] === void 0 || value[key] === null || typeof value[key] === "string";
1717
+ }
1718
+ function isWebhookOrderChange(value) {
1719
+ if (!isRecord(value)) return false;
1720
+ return value.type === "order" && value.source === "payload-orderable" && (value.orderableFieldName === void 0 || typeof value.orderableFieldName === "string") && hasOptionalOrderValue(value, "previousOrder") && hasOptionalOrderValue(value, "nextOrder") && isWebhookOrderScope(value.scope) && isWebhookOrderMoved(value.moved);
1721
+ }
1722
+ function isOrderChangedWebhookEvent(event) {
1723
+ if (!isValidWebhookEvent(event) || event.operation !== "update" || event.eventType !== ORDER_CHANGED_EVENT_TYPE || !isWebhookOrderChange(event.change)) {
1724
+ return false;
1725
+ }
1726
+ if (event.collection !== event.change.scope.collection) {
1727
+ return false;
1728
+ }
1729
+ if (event.change.scope.kind === "collection" && event.change.moved.collection !== event.change.scope.collection) {
1730
+ return false;
1731
+ }
1732
+ return true;
1733
+ }
1734
+ function isWebhookCollection(event, collection) {
1735
+ return isValidWebhookEvent(event) && event.collection === collection;
1736
+ }
1737
+ function isWebhookOperation(event, operation) {
1738
+ return isValidWebhookEvent(event) && event.operation === operation;
1739
+ }
1668
1740
  var CUSTOMER_PASSWORD_RESET_OPERATION = "password-reset";
1669
1741
  function isRecord(value) {
1670
1742
  return typeof value === "object" && value !== null;
@@ -1796,6 +1868,7 @@ var INTERNAL_COLLECTIONS = [
1796
1868
  "subscriptions",
1797
1869
  "billing-history",
1798
1870
  "inventory-reservations",
1871
+ "product-collection-items",
1799
1872
  "order-status-logs",
1800
1873
  "api-keys",
1801
1874
  "personal-access-tokens",
@@ -1831,7 +1904,6 @@ var COLLECTIONS = [
1831
1904
  "transactions",
1832
1905
  "customers",
1833
1906
  "customer-profiles",
1834
- "customer-profile-lists",
1835
1907
  "customer-addresses",
1836
1908
  "carts",
1837
1909
  "cart-items",
@@ -1879,6 +1951,7 @@ var COLLECTIONS = [
1879
1951
  "reaction-types",
1880
1952
  "bookmarks",
1881
1953
  "post-categories",
1954
+ "customer-profile-lists",
1882
1955
  // Events
1883
1956
  "event-calendars",
1884
1957
  "events",
@@ -2719,17 +2792,21 @@ function mediaArray(values) {
2719
2792
  return values.filter(isPresentMedia);
2720
2793
  }
2721
2794
  function buildSelectionMedia(detail, selectedVariant, matchingVariants, selectedValues) {
2795
+ const selectedVariantImages = mediaArray(selectedVariant?.images);
2722
2796
  const selectedValueImages = selectedValues.flatMap(
2723
2797
  (value) => mediaArray(value.images)
2724
2798
  );
2799
+ const matchingVariantImages = matchingVariants.flatMap(
2800
+ (variant) => mediaArray(variant.images)
2801
+ );
2725
2802
  const selectedValuePrimary = selectedValues.map((value) => firstMedia(value.thumbnail) ?? firstMedia(value.images)).find((value) => value != null) ?? null;
2726
2803
  const selectedVariantPrimary = firstMedia(selectedVariant?.thumbnail) ?? firstMedia(selectedVariant?.images);
2727
2804
  const matchingVariantPrimary = matchingVariants.map(
2728
2805
  (variant) => firstMedia(variant.thumbnail) ?? firstMedia(variant.images)
2729
2806
  ).find((value) => value != null) ?? null;
2730
2807
  const detailImages = mediaArray(detail.images);
2731
- const primaryImage = selectedVariantPrimary ?? selectedValuePrimary ?? firstMedia(detail.listing.primaryImage) ?? matchingVariantPrimary ?? firstMedia(detailImages);
2732
- const images = mediaArray(selectedVariant?.images).length > 0 ? mediaArray(selectedVariant?.images) : selectedValueImages.length > 0 ? selectedValueImages : detailImages;
2808
+ const primaryImage = selectedVariantPrimary ?? selectedValuePrimary ?? matchingVariantPrimary ?? firstMedia(detail.listing.primaryImage) ?? firstMedia(detailImages);
2809
+ const images = selectedVariantImages.length > 0 ? selectedVariantImages : selectedValueImages.length > 0 ? selectedValueImages : matchingVariantImages.length > 0 ? matchingVariantImages : detailImages;
2733
2810
  return {
2734
2811
  primaryImage,
2735
2812
  images
@@ -3020,6 +3097,72 @@ function buildProductListingProjection(product, variants) {
3020
3097
  availableForSale: availableVariants.length > 0
3021
3098
  };
3022
3099
  }
3100
+ function buildProductListingCard(item, options = {}) {
3101
+ const product = item.product;
3102
+ const groups = item.groups;
3103
+ const primaryImage = firstMedia(product.thumbnail) ?? firstMedia(product.images ?? null) ?? null;
3104
+ const priceRange = aggregateListingPriceRange(groups);
3105
+ const availableForSale = groups.some(
3106
+ (group) => group.listing.availableForSale
3107
+ );
3108
+ const swatches = groups.length > 1 ? groups.map((group) => buildListingSwatch(product, group, options)) : [];
3109
+ return {
3110
+ id: String(product.id),
3111
+ href: buildProductHref({ slug: product.slug }, void 0, options),
3112
+ title: product.title,
3113
+ primaryImage,
3114
+ priceRange,
3115
+ availableForSale,
3116
+ swatches
3117
+ };
3118
+ }
3119
+ function aggregateListingPriceRange(groups) {
3120
+ const minPrice = minOfNullable(groups.map((g) => g.listing.minPrice));
3121
+ const maxPrice = maxOfNullable(groups.map((g) => g.listing.maxPrice));
3122
+ const minCompareAtPrice = minOfNullable(
3123
+ groups.map((g) => g.listing.minCompareAtPrice)
3124
+ );
3125
+ const maxCompareAtPrice = maxOfNullable(
3126
+ groups.map((g) => g.listing.maxCompareAtPrice)
3127
+ );
3128
+ const isPriceRange = minPrice !== null && maxPrice !== null && minPrice !== maxPrice;
3129
+ return {
3130
+ minPrice,
3131
+ maxPrice,
3132
+ minCompareAtPrice,
3133
+ maxCompareAtPrice,
3134
+ isPriceRange
3135
+ };
3136
+ }
3137
+ function buildListingSwatch(product, group, options) {
3138
+ const thumbnail = firstMedia(group.optionValueThumbnail) ?? firstMedia(group.optionValueImages) ?? null;
3139
+ return {
3140
+ optionId: group.optionId,
3141
+ optionValueId: group.optionValueId,
3142
+ label: group.optionValueLabel,
3143
+ swatchColor: group.optionValueSwatchColor ?? null,
3144
+ thumbnail,
3145
+ href: buildProductHref(
3146
+ { slug: product.slug },
3147
+ {
3148
+ optionId: group.optionId,
3149
+ optionValueId: group.optionValueId,
3150
+ optionValueSlug: group.optionValueSlug,
3151
+ listing: group.listing
3152
+ },
3153
+ options
3154
+ ),
3155
+ availableForSale: group.listing.availableForSale
3156
+ };
3157
+ }
3158
+ function minOfNullable(values) {
3159
+ const numbers = values.filter((v) => v !== null);
3160
+ return numbers.length === 0 ? null : Math.min(...numbers);
3161
+ }
3162
+ function maxOfNullable(values) {
3163
+ const numbers = values.filter((v) => v !== null);
3164
+ return numbers.length === 0 ? null : Math.max(...numbers);
3165
+ }
3023
3166
  function buildProductListingGroupsByOption(args) {
3024
3167
  const primaryOptionId = args.primaryOptionId ?? void 0;
3025
3168
  if (!primaryOptionId) return [];
@@ -3370,6 +3513,7 @@ export {
3370
3513
  INTERNAL_COLLECTIONS,
3371
3514
  NetworkError,
3372
3515
  NotFoundError,
3516
+ ORDER_CHANGED_EVENT_TYPE,
3373
3517
  OrderApi,
3374
3518
  PermissionError,
3375
3519
  ProductApi,
@@ -3385,6 +3529,7 @@ export {
3385
3529
  UsageLimitError,
3386
3530
  ValidationError,
3387
3531
  buildProductHref,
3532
+ buildProductListingCard,
3388
3533
  buildProductListingGroupsByOption,
3389
3534
  buildProductListingProjection,
3390
3535
  buildProductOptionMatrix,
@@ -3423,6 +3568,7 @@ export {
3423
3568
  isGoneError,
3424
3569
  isNetworkError,
3425
3570
  isNotFoundError,
3571
+ isOrderChangedWebhookEvent,
3426
3572
  isPermissionError,
3427
3573
  isRateLimitError,
3428
3574
  isSDKError,
@@ -3431,6 +3577,8 @@ export {
3431
3577
  isUsageLimitError,
3432
3578
  isValidWebhookEvent,
3433
3579
  isValidationError,
3580
+ isWebhookCollection,
3581
+ isWebhookOperation,
3434
3582
  normalizeProductSelection,
3435
3583
  normalizeProductSelectionFromMatrix,
3436
3584
  normalizeSelectedValueIds,