@01.software/sdk 0.32.0 → 0.33.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 (46) hide show
  1. package/README.md +43 -20
  2. package/dist/client.cjs +31 -2
  3. package/dist/client.cjs.map +1 -1
  4. package/dist/client.d.cts +6 -6
  5. package/dist/client.d.ts +6 -6
  6. package/dist/client.js +31 -2
  7. package/dist/client.js.map +1 -1
  8. package/dist/{collection-client-DPGXnhoF.d.ts → collection-client-B6SlhzIP.d.ts} +3 -3
  9. package/dist/{collection-client-CORhppPb.d.cts → collection-client-De6eKW1J.d.cts} +3 -3
  10. package/dist/{const-Brk2Ff0q.d.cts → const-DwmSDeWq.d.ts} +2 -2
  11. package/dist/{const-DcY2_z9O.d.ts → const-sPR2IkCe.d.cts} +2 -2
  12. package/dist/index.cjs +256 -90
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +7 -7
  15. package/dist/index.d.ts +7 -7
  16. package/dist/index.js +256 -90
  17. package/dist/index.js.map +1 -1
  18. package/dist/{payload-types-DVK1QCeU.d.cts → payload-types-dkeQyrDC.d.cts} +1562 -1436
  19. package/dist/{payload-types-DVK1QCeU.d.ts → payload-types-dkeQyrDC.d.ts} +1562 -1436
  20. package/dist/query.cjs.map +1 -1
  21. package/dist/query.d.cts +9 -9
  22. package/dist/query.d.ts +9 -9
  23. package/dist/query.js.map +1 -1
  24. package/dist/realtime.d.cts +2 -2
  25. package/dist/realtime.d.ts +2 -2
  26. package/dist/server.cjs +37 -6
  27. package/dist/server.cjs.map +1 -1
  28. package/dist/server.d.cts +7 -7
  29. package/dist/server.d.ts +7 -7
  30. package/dist/server.js +37 -6
  31. package/dist/server.js.map +1 -1
  32. package/dist/{types-ByMrR_Z_.d.cts → types-B3YT092I.d.cts} +1 -1
  33. package/dist/{types-CYMSBkJC.d.ts → types-BHh0YLmq.d.ts} +27 -10
  34. package/dist/{types-CAkWqIr6.d.cts → types-BZKxss8Y.d.cts} +27 -10
  35. package/dist/{types-DUPC7Xn6.d.ts → types-Cel_4L9t.d.ts} +1 -1
  36. package/dist/ui/form.d.cts +1 -1
  37. package/dist/ui/form.d.ts +1 -1
  38. package/dist/ui/video.d.cts +1 -1
  39. package/dist/ui/video.d.ts +1 -1
  40. package/dist/webhook.cjs +94 -0
  41. package/dist/webhook.cjs.map +1 -1
  42. package/dist/webhook.d.cts +82 -7
  43. package/dist/webhook.d.ts +82 -7
  44. package/dist/webhook.js +94 -0
  45. package/dist/webhook.js.map +1 -1
  46. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -1,10 +1,10 @@
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';
1
+ import { d as ClientConfig, h as RootClient } from './types-BZKxss8Y.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 ProductDetailResult, af as ProductDetailTag, ag as ProductDetailUnavailableReason, ah as ProductDetailVariant, ai as ProductDetailVariantOptionValue, aj as ProductDetailVideo, ak as ProductHrefGroup, al as ProductHrefOptions, am as ProductHrefProduct, an as ProductListingCard, ao as ProductListingCardPriceRange, ap as ProductListingCardRepresentativeVariant, aq as ProductListingGroup, ar as ProductListingGroupSummary, as as ProductListingGroupVariant, at as ProductListingGroupsItem, au as ProductListingGroupsProduct, av as ProductListingGroupsResponse, aw as ProductListingProductShape, ax as ProductListingProjection, ay as ProductListingSwatch, az as ProductOptionMatrix, aA as ProductOptionMatrixOption, aB as ProductOptionMatrixValue, aC as ProductOptionMatrixVariant, aD as ProductOptionShape, aE as ProductOptionValueShape, aF as ProductSelectionAvailableValue, aG as ProductSelectionByOptionValue, aH as ProductSelectionCodecError, aI as ProductSelectionCodecOptions, aJ as ProductSelectionInput, aK as ProductSelectionResolution, aL as ProductSelectionResolutionContext, aM as ProductVariantShape, aN as RemoveDiscountParams, aO as RemoveItemParams, aP as RequestOptions, R as RetryConfig, aQ as ReturnItem, aR as ReturnReason, aS as ReturnWithRefundItem, aT as ReturnWithRefundParams, i as RootCollectionClient, j as RootReadOnlyQueryBuilder, aU as ServerApiOptions, aV as ShippingApi, aW as ShippingApiOptions, S as Sort, aX as StockCheckParams, aY as StockCheckResponse, aZ as StockCheckResult, a_ as UpdateFulfillmentParams, a$ as UpdateItemParams, b0 as UpdateOrderParams, b1 as UpdateProfileData, b2 as UpdateReturnParams, b3 as UpdateTransactionParams, b4 as ValidateDiscountParams, b5 as ValidateDiscountResult, W as Where, b6 as buildProductHref, b7 as buildProductListingCard, b8 as buildProductListingGroupsByOption, b9 as buildProductListingProjection, ba as buildProductOptionMatrix, bb as buildProductOptionMatrixFromDetail, bc as createProductSelectionCodec, bd as getAvailableOptionValues, be as getProductSelectionImages, bf as getSelectedValueByOptionId, bg as normalizeProductSelection, bh as normalizeProductSelectionFromMatrix, bi as normalizeSelectedValueIds, bj as parseProductSelection, bk as resolveProductSelection, bl as resolveProductSelectionFromMatrix, bm as resolveVariantForSelection, bn as stringifyProductSelection } from './types-BZKxss8Y.cjs';
3
+ import { P as Product } from './payload-types-dkeQyrDC.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-dkeQyrDC.cjs';
5
+ export { C as CollectionType, P as Product, a as ProductCollection } from './types-B3YT092I.cjs';
6
+ export { COMMERCE_NOTIFICATION_EVENTS, COMMERCE_NOTIFICATION_EVENT_TYPE, COMMERCE_NOTIFICATION_OPERATION, CUSTOMER_PASSWORD_RESET_OPERATION, CollectionWebhookOperation, CommerceEmailChannel, CommerceEmailConfig, CommerceEmailEventConfig, CommerceEmailEventHandlers, CommerceEmailHandlerContext, CommerceNotification, CommerceNotificationData, CommerceNotificationEventName, CommerceNotificationSource, CommerceNotificationSourceCollection, CommerceNotificationWebhookEvent, CustomerAuthWebhookEvent, CustomerAuthWebhookHandlers, CustomerPasswordResetWebhookData, CustomerPasswordResetWebhookEvent, ORDER_CHANGED_EVENT_TYPE, OrderChangedWebhookEvent, WebhookChange, WebhookCommerceNotificationChange, WebhookEvent, WebhookHandler, WebhookKnownOperation, WebhookOperation, WebhookOptions, WebhookOrderChange, WebhookOrderMoved, WebhookOrderScope, createCommerceEmailWebhookHandler, createCustomerAuthWebhookHandler, createTypedWebhookHandler, defineCommerceEmailConfig, getCommerceNotificationIdempotencyKey, handleWebhook, isCommerceNotificationWebhookEvent, 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-sPR2IkCe.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';
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
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';
1
+ import { d as ClientConfig, h as RootClient } from './types-BHh0YLmq.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 ProductDetailResult, af as ProductDetailTag, ag as ProductDetailUnavailableReason, ah as ProductDetailVariant, ai as ProductDetailVariantOptionValue, aj as ProductDetailVideo, ak as ProductHrefGroup, al as ProductHrefOptions, am as ProductHrefProduct, an as ProductListingCard, ao as ProductListingCardPriceRange, ap as ProductListingCardRepresentativeVariant, aq as ProductListingGroup, ar as ProductListingGroupSummary, as as ProductListingGroupVariant, at as ProductListingGroupsItem, au as ProductListingGroupsProduct, av as ProductListingGroupsResponse, aw as ProductListingProductShape, ax as ProductListingProjection, ay as ProductListingSwatch, az as ProductOptionMatrix, aA as ProductOptionMatrixOption, aB as ProductOptionMatrixValue, aC as ProductOptionMatrixVariant, aD as ProductOptionShape, aE as ProductOptionValueShape, aF as ProductSelectionAvailableValue, aG as ProductSelectionByOptionValue, aH as ProductSelectionCodecError, aI as ProductSelectionCodecOptions, aJ as ProductSelectionInput, aK as ProductSelectionResolution, aL as ProductSelectionResolutionContext, aM as ProductVariantShape, aN as RemoveDiscountParams, aO as RemoveItemParams, aP as RequestOptions, R as RetryConfig, aQ as ReturnItem, aR as ReturnReason, aS as ReturnWithRefundItem, aT as ReturnWithRefundParams, i as RootCollectionClient, j as RootReadOnlyQueryBuilder, aU as ServerApiOptions, aV as ShippingApi, aW as ShippingApiOptions, S as Sort, aX as StockCheckParams, aY as StockCheckResponse, aZ as StockCheckResult, a_ as UpdateFulfillmentParams, a$ as UpdateItemParams, b0 as UpdateOrderParams, b1 as UpdateProfileData, b2 as UpdateReturnParams, b3 as UpdateTransactionParams, b4 as ValidateDiscountParams, b5 as ValidateDiscountResult, W as Where, b6 as buildProductHref, b7 as buildProductListingCard, b8 as buildProductListingGroupsByOption, b9 as buildProductListingProjection, ba as buildProductOptionMatrix, bb as buildProductOptionMatrixFromDetail, bc as createProductSelectionCodec, bd as getAvailableOptionValues, be as getProductSelectionImages, bf as getSelectedValueByOptionId, bg as normalizeProductSelection, bh as normalizeProductSelectionFromMatrix, bi as normalizeSelectedValueIds, bj as parseProductSelection, bk as resolveProductSelection, bl as resolveProductSelectionFromMatrix, bm as resolveVariantForSelection, bn as stringifyProductSelection } from './types-BHh0YLmq.js';
3
+ import { P as Product } from './payload-types-dkeQyrDC.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-dkeQyrDC.js';
5
+ export { C as CollectionType, P as Product, a as ProductCollection } from './types-Cel_4L9t.js';
6
+ export { COMMERCE_NOTIFICATION_EVENTS, COMMERCE_NOTIFICATION_EVENT_TYPE, COMMERCE_NOTIFICATION_OPERATION, CUSTOMER_PASSWORD_RESET_OPERATION, CollectionWebhookOperation, CommerceEmailChannel, CommerceEmailConfig, CommerceEmailEventConfig, CommerceEmailEventHandlers, CommerceEmailHandlerContext, CommerceNotification, CommerceNotificationData, CommerceNotificationEventName, CommerceNotificationSource, CommerceNotificationSourceCollection, CommerceNotificationWebhookEvent, CustomerAuthWebhookEvent, CustomerAuthWebhookHandlers, CustomerPasswordResetWebhookData, CustomerPasswordResetWebhookEvent, ORDER_CHANGED_EVENT_TYPE, OrderChangedWebhookEvent, WebhookChange, WebhookCommerceNotificationChange, WebhookEvent, WebhookHandler, WebhookKnownOperation, WebhookOperation, WebhookOptions, WebhookOrderChange, WebhookOrderMoved, WebhookOrderScope, createCommerceEmailWebhookHandler, createCustomerAuthWebhookHandler, createTypedWebhookHandler, defineCommerceEmailConfig, getCommerceNotificationIdempotencyKey, handleWebhook, isCommerceNotificationWebhookEvent, 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-DwmSDeWq.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';
package/dist/index.js CHANGED
@@ -1410,6 +1410,117 @@ var CartApi = class {
1410
1410
  }
1411
1411
  };
1412
1412
 
1413
+ // src/core/api/base-api.ts
1414
+ var BaseApi = class {
1415
+ constructor(apiName, options) {
1416
+ if (!options.secretKey) {
1417
+ throw createConfigError(`secretKey is required for ${apiName}.`);
1418
+ }
1419
+ this.publishableKey = requirePublishableKeyForSecret(
1420
+ apiName,
1421
+ options.publishableKey,
1422
+ options.secretKey
1423
+ );
1424
+ this.secretKey = options.secretKey;
1425
+ this.apiUrl = options.apiUrl;
1426
+ this.onRequestId = options.onRequestId;
1427
+ }
1428
+ async request(endpoint, body, options) {
1429
+ const method = options?.method ?? "POST";
1430
+ try {
1431
+ const response = await httpFetch(endpoint, {
1432
+ method,
1433
+ apiUrl: this.apiUrl,
1434
+ publishableKey: this.publishableKey,
1435
+ secretKey: this.secretKey,
1436
+ ...body !== void 0 && { body: JSON.stringify(body) },
1437
+ ...options?.headers && { headers: options.headers }
1438
+ });
1439
+ this.onRequestId?.(response.headers.get("x-request-id") ?? null);
1440
+ return parseApiResponse(response, endpoint);
1441
+ } catch (err) {
1442
+ const id = err instanceof SDKError ? err.requestId ?? null : null;
1443
+ this.onRequestId?.(id);
1444
+ throw err;
1445
+ }
1446
+ }
1447
+ };
1448
+
1449
+ // src/core/api/product-api.ts
1450
+ var PRODUCT_DETAIL_UNAVAILABLE_REASONS = /* @__PURE__ */ new Set([
1451
+ "not_found",
1452
+ "not_published",
1453
+ "feature_disabled"
1454
+ ]);
1455
+ function isRecord(value) {
1456
+ return typeof value === "object" && value !== null;
1457
+ }
1458
+ function readProductDetailUnavailableReason(value) {
1459
+ if (!isRecord(value)) return void 0;
1460
+ const directReason = value.reason ?? value.code;
1461
+ if (typeof directReason === "string" && PRODUCT_DETAIL_UNAVAILABLE_REASONS.has(directReason)) {
1462
+ return directReason;
1463
+ }
1464
+ return readProductDetailUnavailableReason(value.body);
1465
+ }
1466
+ function productDetailResultFromError(error) {
1467
+ if (!(error instanceof SDKError) || error.status !== 404) return void 0;
1468
+ const reason = readProductDetailUnavailableReason(error.details);
1469
+ if (!reason) return void 0;
1470
+ return { found: false, reason };
1471
+ }
1472
+ var ProductApi = class extends BaseApi {
1473
+ constructor(options) {
1474
+ super("ProductApi", options);
1475
+ }
1476
+ /**
1477
+ * Check point-in-time stock availability for one or more product variants.
1478
+ * Results reflect available stock at the moment of the call and are not guaranteed
1479
+ * to remain available by the time an order is placed.
1480
+ */
1481
+ stockCheck(params) {
1482
+ return this.request("/api/products/stock-check", params);
1483
+ }
1484
+ listingGroups(params) {
1485
+ return this.request(
1486
+ "/api/products/listing-groups",
1487
+ params
1488
+ );
1489
+ }
1490
+ /**
1491
+ * Fetch full product detail by slug or id.
1492
+ * Returns a discriminated result so storefronts can distinguish missing,
1493
+ * unpublished, and feature-disabled products.
1494
+ *
1495
+ * Only product-detail 404 responses carrying one of those allowlisted reasons
1496
+ * are mapped to `{ found: false, reason }`. Unknown or uncoded 404s, plus
1497
+ * permission/auth errors such as tenant mismatch, continue to throw typed SDK
1498
+ * errors instead of being collapsed into a storefront absence result.
1499
+ */
1500
+ async detail(params) {
1501
+ try {
1502
+ const product = await this.request(
1503
+ "/api/products/detail",
1504
+ params
1505
+ );
1506
+ return { found: true, product };
1507
+ } catch (err) {
1508
+ const notFoundResult = productDetailResultFromError(err);
1509
+ if (notFoundResult) return notFoundResult;
1510
+ throw err;
1511
+ }
1512
+ }
1513
+ /**
1514
+ * Atomically create or update a product together with its options,
1515
+ * option-values, and variants in a single transaction. Mirrors Shopify's
1516
+ * `productSet` shape and is the canonical write path for the MCP
1517
+ * `product-upsert` tool.
1518
+ */
1519
+ upsert(params) {
1520
+ return this.request("/api/products/upsert", params);
1521
+ }
1522
+ };
1523
+
1413
1524
  // src/core/commerce/commerce-client.ts
1414
1525
  var CommerceClient = class {
1415
1526
  constructor(options) {
@@ -1444,9 +1555,14 @@ var CommerceClient = class {
1444
1555
  listingGroups: (params) => execute("/api/products/listing-groups", params),
1445
1556
  detail: async (params) => {
1446
1557
  try {
1447
- return await execute("/api/products/detail", params);
1558
+ const product = await execute(
1559
+ "/api/products/detail",
1560
+ params
1561
+ );
1562
+ return { found: true, product };
1448
1563
  } catch (err) {
1449
- if (err instanceof NotFoundError) return null;
1564
+ const notFoundResult = productDetailResultFromError(err);
1565
+ if (notFoundResult) return notFoundResult;
1450
1566
  throw err;
1451
1567
  }
1452
1568
  }
@@ -1538,42 +1654,6 @@ function createClient(options) {
1538
1654
  return new Client(options);
1539
1655
  }
1540
1656
 
1541
- // src/core/api/base-api.ts
1542
- var BaseApi = class {
1543
- constructor(apiName, options) {
1544
- if (!options.secretKey) {
1545
- throw createConfigError(`secretKey is required for ${apiName}.`);
1546
- }
1547
- this.publishableKey = requirePublishableKeyForSecret(
1548
- apiName,
1549
- options.publishableKey,
1550
- options.secretKey
1551
- );
1552
- this.secretKey = options.secretKey;
1553
- this.apiUrl = options.apiUrl;
1554
- this.onRequestId = options.onRequestId;
1555
- }
1556
- async request(endpoint, body, options) {
1557
- const method = options?.method ?? "POST";
1558
- try {
1559
- const response = await httpFetch(endpoint, {
1560
- method,
1561
- apiUrl: this.apiUrl,
1562
- publishableKey: this.publishableKey,
1563
- secretKey: this.secretKey,
1564
- ...body !== void 0 && { body: JSON.stringify(body) },
1565
- ...options?.headers && { headers: options.headers }
1566
- });
1567
- this.onRequestId?.(response.headers.get("x-request-id") ?? null);
1568
- return parseApiResponse(response, endpoint);
1569
- } catch (err) {
1570
- const id = err instanceof SDKError ? err.requestId ?? null : null;
1571
- this.onRequestId?.(id);
1572
- throw err;
1573
- }
1574
- }
1575
- };
1576
-
1577
1657
  // src/core/api/order-api.ts
1578
1658
  var OrderApi = class extends BaseApi {
1579
1659
  constructor(options) {
@@ -1606,7 +1686,7 @@ var OrderApi = class extends BaseApi {
1606
1686
  }
1607
1687
  bulkImportFulfillments(params) {
1608
1688
  return this.request(
1609
- "/api/orders/bulk-import-fulfillments",
1689
+ "/api/fulfillments/bulk-import",
1610
1690
  params
1611
1691
  );
1612
1692
  }
@@ -1644,62 +1724,27 @@ var ShippingApi = class extends BaseApi {
1644
1724
  }
1645
1725
  };
1646
1726
 
1647
- // src/core/api/product-api.ts
1648
- var ProductApi = class extends BaseApi {
1649
- constructor(options) {
1650
- super("ProductApi", options);
1651
- }
1652
- /**
1653
- * Check point-in-time stock availability for one or more product variants.
1654
- * Results reflect available stock at the moment of the call and are not guaranteed
1655
- * to remain available by the time an order is placed.
1656
- */
1657
- stockCheck(params) {
1658
- return this.request("/api/products/stock-check", params);
1659
- }
1660
- listingGroups(params) {
1661
- return this.request(
1662
- "/api/products/listing-groups",
1663
- params
1664
- );
1665
- }
1666
- /**
1667
- * Fetch full product detail by slug or id.
1668
- * Returns `null` on 404 regardless of reason (`not_found` / `not_published` /
1669
- * `feature_disabled`). For the reason behind a null,
1670
- * inspect `client.lastRequestId` against backend logs.
1671
- */
1672
- async detail(params) {
1673
- try {
1674
- return await this.request("/api/products/detail", params);
1675
- } catch (err) {
1676
- if (err instanceof NotFoundError) return null;
1677
- throw err;
1678
- }
1679
- }
1680
- /**
1681
- * Atomically create or update a product together with its options,
1682
- * option-values, and variants in a single transaction. Mirrors Shopify's
1683
- * `productSet` shape and is the canonical write path for the MCP
1684
- * `product-upsert` tool.
1685
- */
1686
- upsert(params) {
1687
- return this.request("/api/products/upsert", params);
1688
- }
1689
- };
1690
-
1691
1727
  // src/core/webhook/index.ts
1692
1728
  var ORDER_CHANGED_EVENT_TYPE = "collection.orderChanged";
1729
+ var COMMERCE_NOTIFICATION_EVENT_TYPE = "commerce.notification";
1693
1730
  function isValidWebhookEvent(data) {
1694
1731
  if (typeof data !== "object" || data === null) return false;
1695
1732
  const obj = data;
1696
1733
  return typeof obj.collection === "string" && typeof obj.operation === "string" && obj.operation.length > 0 && typeof obj.data === "object" && obj.data !== null;
1697
1734
  }
1735
+ var COMMERCE_NOTIFICATION_OPERATION = "notification";
1736
+ var COMMERCE_NOTIFICATION_EVENTS = [
1737
+ "orderPaid",
1738
+ "fulfillmentShipped",
1739
+ "orderDelivered",
1740
+ "returnRequested",
1741
+ "returnCompleted"
1742
+ ];
1698
1743
  function isStringOrNumber(value) {
1699
1744
  return typeof value === "string" || typeof value === "number";
1700
1745
  }
1701
1746
  function isWebhookOrderScope(value) {
1702
- if (!isRecord(value)) return false;
1747
+ if (!isRecord2(value)) return false;
1703
1748
  if (value.kind === "collection") {
1704
1749
  return typeof value.collection === "string";
1705
1750
  }
@@ -1709,16 +1754,40 @@ function isWebhookOrderScope(value) {
1709
1754
  return false;
1710
1755
  }
1711
1756
  function isWebhookOrderMoved(value) {
1712
- if (!isRecord(value)) return false;
1757
+ if (!isRecord2(value)) return false;
1713
1758
  return typeof value.collection === "string" && isStringOrNumber(value.id) && (value.relatedCollection === void 0 || typeof value.relatedCollection === "string") && (value.relatedId === void 0 || isStringOrNumber(value.relatedId));
1714
1759
  }
1715
1760
  function hasOptionalOrderValue(value, key) {
1716
1761
  return value[key] === void 0 || value[key] === null || typeof value[key] === "string";
1717
1762
  }
1718
1763
  function isWebhookOrderChange(value) {
1719
- if (!isRecord(value)) return false;
1764
+ if (!isRecord2(value)) return false;
1720
1765
  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
1766
  }
1767
+ function isCommerceNotificationEventName(value) {
1768
+ return typeof value === "string" && COMMERCE_NOTIFICATION_EVENTS.includes(value);
1769
+ }
1770
+ function isCommerceNotificationSourceCollection(value) {
1771
+ return value === "orders" || value === "fulfillments" || value === "returns";
1772
+ }
1773
+ function isCommerceNotificationData(value) {
1774
+ if (!isRecord2(value)) return false;
1775
+ if (value.source !== void 0 && (!isRecord2(value.source) || !isCommerceNotificationSourceCollection(value.source.collection) || !isStringOrNumber(value.source.id))) {
1776
+ return false;
1777
+ }
1778
+ return (value.orderId === void 0 || isStringOrNumber(value.orderId)) && (value.orderNumber === void 0 || typeof value.orderNumber === "string") && (value.status === void 0 || typeof value.status === "string") && (value.totalAmount === void 0 || typeof value.totalAmount === "number") && (value.currency === void 0 || typeof value.currency === "string") && (value.fulfillmentId === void 0 || isStringOrNumber(value.fulfillmentId)) && (value.fulfillmentStatus === void 0 || typeof value.fulfillmentStatus === "string") && (value.shippedAt === void 0 || typeof value.shippedAt === "string") && (value.returnId === void 0 || isStringOrNumber(value.returnId)) && (value.returnStatus === void 0 || typeof value.returnStatus === "string") && (value.refundAmount === void 0 || typeof value.refundAmount === "number") && (value.completedAt === void 0 || typeof value.completedAt === "string");
1779
+ }
1780
+ function isCommerceNotification(value) {
1781
+ if (!isRecord2(value)) return false;
1782
+ return isCommerceNotificationEventName(value.event) && typeof value.intentId === "string" && value.intentId.length > 0 && typeof value.dedupeKey === "string" && value.dedupeKey.length > 0 && (value.orderId === void 0 || typeof value.orderId === "string") && (value.fulfillmentId === void 0 || typeof value.fulfillmentId === "string") && (value.returnId === void 0 || typeof value.returnId === "string");
1783
+ }
1784
+ function isWebhookCommerceNotificationChange(value) {
1785
+ if (!isRecord2(value)) return false;
1786
+ return value.type === "notification" && value.source === "commerce-notifications" && isCommerceNotificationEventName(value.event) && isCommerceNotificationSourceCollection(value.sourceCollection) && isStringOrNumber(value.sourceId);
1787
+ }
1788
+ function matchesOptionalId(actual, expected) {
1789
+ return actual === void 0 || expected === void 0 || actual === expected;
1790
+ }
1722
1791
  function isOrderChangedWebhookEvent(event) {
1723
1792
  if (!isValidWebhookEvent(event) || event.operation !== "update" || event.eventType !== ORDER_CHANGED_EVENT_TYPE || !isWebhookOrderChange(event.change)) {
1724
1793
  return false;
@@ -1731,6 +1800,60 @@ function isOrderChangedWebhookEvent(event) {
1731
1800
  }
1732
1801
  return true;
1733
1802
  }
1803
+ function isCommerceNotificationWebhookEvent(event) {
1804
+ if (!isValidWebhookEvent(event) || event.operation !== COMMERCE_NOTIFICATION_OPERATION || event.eventType !== COMMERCE_NOTIFICATION_EVENT_TYPE || !isCommerceNotificationData(event.data) || !isCommerceNotification(event.notification)) {
1805
+ return false;
1806
+ }
1807
+ const notification = event.notification;
1808
+ const data = event.data;
1809
+ const change = event.change;
1810
+ const sourceCollection = data.source?.collection ?? event.collection;
1811
+ const sourceId = data.source?.id;
1812
+ if (!isCommerceNotificationSourceCollection(sourceCollection)) return false;
1813
+ if (data.source !== void 0 && event.collection !== data.source.collection) {
1814
+ return false;
1815
+ }
1816
+ if (change !== void 0) {
1817
+ if (!isWebhookCommerceNotificationChange(change)) return false;
1818
+ if (change.sourceCollection !== sourceCollection) return false;
1819
+ if (change.event !== notification.event) return false;
1820
+ if (!matchesOptionalId(change.sourceId, sourceId)) return false;
1821
+ }
1822
+ const changeSourceId = isWebhookCommerceNotificationChange(change) ? change.sourceId : void 0;
1823
+ if (notification.event === "orderPaid" || notification.event === "orderDelivered") {
1824
+ return sourceCollection === "orders" && typeof notification.orderId === "string" && notification.orderId.length > 0 && matchesOptionalId(data.orderId, sourceId) && matchesOptionalId(notification.orderId, sourceId) && matchesOptionalId(data.orderId, notification.orderId) && matchesOptionalId(changeSourceId, data.orderId ?? notification.orderId);
1825
+ }
1826
+ if (notification.event === "fulfillmentShipped") {
1827
+ return sourceCollection === "fulfillments" && matchesOptionalId(data.fulfillmentId, sourceId) && typeof notification.fulfillmentId === "string" && notification.fulfillmentId.length > 0 && matchesOptionalId(notification.fulfillmentId, sourceId) && matchesOptionalId(data.fulfillmentId, notification.fulfillmentId) && matchesOptionalId(changeSourceId, notification.fulfillmentId);
1828
+ }
1829
+ if (notification.event === "returnRequested" || notification.event === "returnCompleted") {
1830
+ return sourceCollection === "returns" && matchesOptionalId(data.returnId, sourceId) && typeof notification.returnId === "string" && notification.returnId.length > 0 && matchesOptionalId(notification.returnId, sourceId) && matchesOptionalId(data.returnId, notification.returnId) && matchesOptionalId(changeSourceId, notification.returnId);
1831
+ }
1832
+ return false;
1833
+ }
1834
+ function getCommerceNotificationIdempotencyKey(event) {
1835
+ return `${event.notification.intentId}:${event.notification.dedupeKey}`;
1836
+ }
1837
+ function defineCommerceEmailConfig(config) {
1838
+ return config;
1839
+ }
1840
+ function createCommerceEmailWebhookHandler(handlers) {
1841
+ return async (event) => {
1842
+ if (!isCommerceNotificationWebhookEvent(event)) {
1843
+ await handlers.unhandled?.(event);
1844
+ return;
1845
+ }
1846
+ const handler = handlers[event.notification.event];
1847
+ if (!handler) {
1848
+ await handlers.unhandled?.(event);
1849
+ return;
1850
+ }
1851
+ await handler({
1852
+ event,
1853
+ idempotencyKey: getCommerceNotificationIdempotencyKey(event)
1854
+ });
1855
+ };
1856
+ }
1734
1857
  function isWebhookCollection(event, collection) {
1735
1858
  return isValidWebhookEvent(event) && event.collection === collection;
1736
1859
  }
@@ -1738,7 +1861,7 @@ function isWebhookOperation(event, operation) {
1738
1861
  return isValidWebhookEvent(event) && event.operation === operation;
1739
1862
  }
1740
1863
  var CUSTOMER_PASSWORD_RESET_OPERATION = "password-reset";
1741
- function isRecord(value) {
1864
+ function isRecord2(value) {
1742
1865
  return typeof value === "object" && value !== null;
1743
1866
  }
1744
1867
  function hasString(value, key) {
@@ -1748,7 +1871,7 @@ function hasStringOrNumber(value, key) {
1748
1871
  return typeof value[key] === "string" || typeof value[key] === "number";
1749
1872
  }
1750
1873
  function isCustomerPasswordResetWebhookEvent(event) {
1751
- if (event.collection !== "customers" || event.operation !== CUSTOMER_PASSWORD_RESET_OPERATION || !isRecord(event.data)) {
1874
+ if (event.collection !== "customers" || event.operation !== CUSTOMER_PASSWORD_RESET_OPERATION || !isRecord2(event.data)) {
1752
1875
  return false;
1753
1876
  }
1754
1877
  return hasStringOrNumber(event.data, "customerId") && hasString(event.data, "email") && hasString(event.data, "name") && hasString(event.data, "resetPasswordToken") && hasString(event.data, "resetPasswordExpiresAt");
@@ -1868,6 +1991,7 @@ var INTERNAL_COLLECTIONS = [
1868
1991
  "subscriptions",
1869
1992
  "billing-history",
1870
1993
  "inventory-reservations",
1994
+ "commerce-notification-intents",
1871
1995
  "product-collection-items",
1872
1996
  "order-status-logs",
1873
1997
  "api-keys",
@@ -3100,7 +3224,14 @@ function buildProductListingProjection(product, variants) {
3100
3224
  function buildProductListingCard(item, options = {}) {
3101
3225
  const product = item.product;
3102
3226
  const groups = item.groups;
3103
- const primaryImage = firstMedia(product.thumbnail) ?? firstMedia(product.images ?? null) ?? null;
3227
+ const variants = getProductListingCardVariants(item);
3228
+ const projectedListing = buildProductListingProjection(product, variants);
3229
+ const selectionHintVariant = getRelationID(product.listing?.selectionHintVariant) ?? projectedListing.selectionHintVariant;
3230
+ const representativeVariant = findListingCardRepresentativeVariant(
3231
+ variants,
3232
+ selectionHintVariant
3233
+ );
3234
+ const primaryImage = firstMedia(product.thumbnail) ?? firstMedia(product.images ?? null) ?? firstMedia(representativeVariant?.thumbnail) ?? firstMedia(representativeVariant?.images) ?? firstMedia(product.listing?.primaryImage) ?? firstMedia(projectedListing.primaryImage) ?? null;
3104
3235
  const priceRange = aggregateListingPriceRange(groups);
3105
3236
  const availableForSale = groups.some(
3106
3237
  (group) => group.listing.availableForSale
@@ -3108,14 +3239,42 @@ function buildProductListingCard(item, options = {}) {
3108
3239
  const swatches = groups.length > 1 ? groups.map((group) => buildListingSwatch(product, group, options)) : [];
3109
3240
  return {
3110
3241
  id: String(product.id),
3111
- href: buildProductHref({ slug: product.slug }, void 0, options),
3242
+ href: buildProductHref(
3243
+ { slug: product.slug },
3244
+ { listing: { selectionHintVariant } },
3245
+ options
3246
+ ),
3112
3247
  title: product.title,
3248
+ representativeVariant,
3113
3249
  primaryImage,
3114
3250
  priceRange,
3115
3251
  availableForSale,
3116
3252
  swatches
3117
3253
  };
3118
3254
  }
3255
+ function getProductListingCardVariants(item) {
3256
+ const productVariants = item.product.variants?.docs;
3257
+ if (Array.isArray(productVariants) && productVariants.length > 0) {
3258
+ return productVariants;
3259
+ }
3260
+ const variants = [];
3261
+ const seen = /* @__PURE__ */ new Set();
3262
+ for (const group of item.groups) {
3263
+ for (const variant of group.variants) {
3264
+ const id = getRelationID(variant.id);
3265
+ if (id && seen.has(id)) continue;
3266
+ if (id) seen.add(id);
3267
+ variants.push(variant);
3268
+ }
3269
+ }
3270
+ return variants;
3271
+ }
3272
+ function findListingCardRepresentativeVariant(variants, representativeVariantId) {
3273
+ if (representativeVariantId == null) return null;
3274
+ return variants.find(
3275
+ (variant) => getRelationID(variant.id) === representativeVariantId
3276
+ ) ?? null;
3277
+ }
3119
3278
  function aggregateListingPriceRange(groups) {
3120
3279
  const minPrice = minOfNullable(groups.map((g) => g.listing.minPrice));
3121
3280
  const maxPrice = maxOfNullable(groups.map((g) => g.listing.maxPrice));
@@ -3499,6 +3658,9 @@ export {
3499
3658
  AuthError,
3500
3659
  BaseApi,
3501
3660
  COLLECTIONS,
3661
+ COMMERCE_NOTIFICATION_EVENTS,
3662
+ COMMERCE_NOTIFICATION_EVENT_TYPE,
3663
+ COMMERCE_NOTIFICATION_OPERATION,
3502
3664
  CUSTOMER_PASSWORD_RESET_OPERATION,
3503
3665
  CartApi,
3504
3666
  CommerceClient,
@@ -3537,6 +3699,7 @@ export {
3537
3699
  createAnalytics,
3538
3700
  createAuthError,
3539
3701
  createClient2 as createClient,
3702
+ createCommerceEmailWebhookHandler,
3540
3703
  createConflictError,
3541
3704
  createCustomerAuthWebhookHandler,
3542
3705
  createNotFoundError,
@@ -3544,9 +3707,11 @@ export {
3544
3707
  createProductSelectionCodec,
3545
3708
  createRateLimitError,
3546
3709
  createTypedWebhookHandler,
3710
+ defineCommerceEmailConfig,
3547
3711
  formatOrderName,
3548
3712
  generateOrderNumber,
3549
3713
  getAvailableOptionValues,
3714
+ getCommerceNotificationIdempotencyKey,
3550
3715
  getImageLqip,
3551
3716
  getImagePalette,
3552
3717
  getImagePlaceholderStyle,
@@ -3562,6 +3727,7 @@ export {
3562
3727
  handleWebhook,
3563
3728
  isApiError,
3564
3729
  isAuthError,
3730
+ isCommerceNotificationWebhookEvent,
3565
3731
  isConfigError,
3566
3732
  isConflictError,
3567
3733
  isCustomerPasswordResetWebhookEvent,