@01.software/sdk 0.31.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 (52) hide show
  1. package/README.md +128 -47
  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 +41 -48
  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 +41 -48
  11. package/dist/client.js.map +1 -1
  12. package/dist/{collection-client-ByzY3hWK.d.ts → collection-client-B6SlhzIP.d.ts} +3 -3
  13. package/dist/{collection-client-DFXXz0vk.d.cts → collection-client-De6eKW1J.d.cts} +3 -3
  14. package/dist/{const-AytzliEu.d.cts → const-DwmSDeWq.d.ts} +2 -2
  15. package/dist/{const-BGCP-OJL.d.ts → const-sPR2IkCe.d.cts} +2 -2
  16. package/dist/index.cjs +310 -133
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +7 -7
  19. package/dist/index.d.ts +7 -7
  20. package/dist/index.js +310 -133
  21. package/dist/index.js.map +1 -1
  22. package/dist/{payload-types-Wa4-eC6x.d.cts → payload-types-dkeQyrDC.d.cts} +1572 -1440
  23. package/dist/{payload-types-Wa4-eC6x.d.ts → payload-types-dkeQyrDC.d.ts} +1572 -1440
  24. package/dist/query.cjs.map +1 -1
  25. package/dist/query.d.cts +20 -20
  26. package/dist/query.d.ts +20 -20
  27. package/dist/query.js.map +1 -1
  28. package/dist/realtime.cjs.map +1 -1
  29. package/dist/realtime.d.cts +2 -2
  30. package/dist/realtime.d.ts +2 -2
  31. package/dist/realtime.js.map +1 -1
  32. package/dist/server.cjs +70 -6
  33. package/dist/server.cjs.map +1 -1
  34. package/dist/server.d.cts +100 -8
  35. package/dist/server.d.ts +100 -8
  36. package/dist/server.js +70 -6
  37. package/dist/server.js.map +1 -1
  38. package/dist/{types-CmLG-7RL.d.cts → types-B3YT092I.d.cts} +1 -1
  39. package/dist/{types-BX2mqDf6.d.ts → types-BHh0YLmq.d.ts} +63 -13
  40. package/dist/{types-DChFjQGz.d.cts → types-BZKxss8Y.d.cts} +63 -13
  41. package/dist/{types-CVA10VC-.d.ts → types-Cel_4L9t.d.ts} +1 -1
  42. package/dist/ui/form.d.cts +1 -1
  43. package/dist/ui/form.d.ts +1 -1
  44. package/dist/ui/video.d.cts +1 -1
  45. package/dist/ui/video.d.ts +1 -1
  46. package/dist/webhook.cjs +142 -1
  47. package/dist/webhook.cjs.map +1 -1
  48. package/dist/webhook.d.cts +149 -5
  49. package/dist/webhook.d.ts +149 -5
  50. package/dist/webhook.js +142 -1
  51. package/dist/webhook.js.map +1 -1
  52. package/package.json +3 -3
package/dist/index.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- import { d as ClientConfig, h as RootClient } from './types-DChFjQGz.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 ProductListingCard, ak as ProductListingCardPriceRange, al as ProductListingGroup, am as ProductListingGroupSummary, an as ProductListingGroupsItem, ao as ProductListingGroupsProduct, ap as ProductListingGroupsResponse, aq as ProductListingProductShape, ar as ProductListingProjection, as as ProductListingSwatch, at as ProductOptionMatrix, au as ProductOptionMatrixOption, av as ProductOptionMatrixValue, aw as ProductOptionMatrixVariant, ax as ProductOptionShape, ay as ProductOptionValueShape, az as ProductSelectionAvailableValue, aA as ProductSelectionByOptionValue, aB as ProductSelectionCodecError, aC as ProductSelectionCodecOptions, aD as ProductSelectionInput, aE as ProductSelectionResolution, aF as ProductSelectionResolutionContext, aG as ProductVariantShape, aH as RemoveDiscountParams, aI as RemoveItemParams, aJ as RequestOptions, R as RetryConfig, aK as ReturnItem, aL as ReturnReason, aM as ReturnWithRefundParams, i as RootCollectionClient, j as RootReadOnlyQueryBuilder, aN as ServerApiOptions, aO as ShippingApi, aP as ShippingApiOptions, S as Sort, aQ as StockCheckParams, aR as StockCheckResponse, aS as StockCheckResult, aT as UpdateFulfillmentParams, aU as UpdateItemParams, aV as UpdateOrderParams, aW as UpdateProfileData, aX as UpdateReturnParams, aY as UpdateTransactionParams, aZ as ValidateDiscountParams, a_ as ValidateDiscountResult, W as Where, a$ as buildProductHref, b0 as buildProductListingCard, b1 as buildProductListingGroupsByOption, b2 as buildProductListingProjection, b3 as buildProductOptionMatrix, b4 as buildProductOptionMatrixFromDetail, b5 as createProductSelectionCodec, b6 as getAvailableOptionValues, b7 as getProductSelectionImages, b8 as getSelectedValueByOptionId, b9 as normalizeProductSelection, ba as normalizeProductSelectionFromMatrix, bb as normalizeSelectedValueIds, bc as parseProductSelection, bd as resolveProductSelection, be as resolveProductSelectionFromMatrix, bf as resolveVariantForSelection, bg as stringifyProductSelection } from './types-DChFjQGz.cjs';
3
- import { P as Product } from './payload-types-Wa4-eC6x.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-Wa4-eC6x.cjs';
5
- export { C as CollectionType, P as Product, a as ProductCollection } from './types-CmLG-7RL.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-AytzliEu.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-BX2mqDf6.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 ProductListingCard, ak as ProductListingCardPriceRange, al as ProductListingGroup, am as ProductListingGroupSummary, an as ProductListingGroupsItem, ao as ProductListingGroupsProduct, ap as ProductListingGroupsResponse, aq as ProductListingProductShape, ar as ProductListingProjection, as as ProductListingSwatch, at as ProductOptionMatrix, au as ProductOptionMatrixOption, av as ProductOptionMatrixValue, aw as ProductOptionMatrixVariant, ax as ProductOptionShape, ay as ProductOptionValueShape, az as ProductSelectionAvailableValue, aA as ProductSelectionByOptionValue, aB as ProductSelectionCodecError, aC as ProductSelectionCodecOptions, aD as ProductSelectionInput, aE as ProductSelectionResolution, aF as ProductSelectionResolutionContext, aG as ProductVariantShape, aH as RemoveDiscountParams, aI as RemoveItemParams, aJ as RequestOptions, R as RetryConfig, aK as ReturnItem, aL as ReturnReason, aM as ReturnWithRefundParams, i as RootCollectionClient, j as RootReadOnlyQueryBuilder, aN as ServerApiOptions, aO as ShippingApi, aP as ShippingApiOptions, S as Sort, aQ as StockCheckParams, aR as StockCheckResponse, aS as StockCheckResult, aT as UpdateFulfillmentParams, aU as UpdateItemParams, aV as UpdateOrderParams, aW as UpdateProfileData, aX as UpdateReturnParams, aY as UpdateTransactionParams, aZ as ValidateDiscountParams, a_ as ValidateDiscountResult, W as Where, a$ as buildProductHref, b0 as buildProductListingCard, b1 as buildProductListingGroupsByOption, b2 as buildProductListingProjection, b3 as buildProductOptionMatrix, b4 as buildProductOptionMatrixFromDetail, b5 as createProductSelectionCodec, b6 as getAvailableOptionValues, b7 as getProductSelectionImages, b8 as getSelectedValueByOptionId, b9 as normalizeProductSelection, ba as normalizeProductSelectionFromMatrix, bb as normalizeSelectedValueIds, bc as parseProductSelection, bd as resolveProductSelection, be as resolveProductSelectionFromMatrix, bf as resolveVariantForSelection, bg as stringifyProductSelection } from './types-BX2mqDf6.js';
3
- import { P as Product } from './payload-types-Wa4-eC6x.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-Wa4-eC6x.js';
5
- export { C as CollectionType, P as Product, a as ProductCollection } from './types-CVA10VC-.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-BGCP-OJL.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
@@ -1226,7 +1226,7 @@ var CustomerAuth = class {
1226
1226
  );
1227
1227
  return data.customer ?? null;
1228
1228
  } catch (error) {
1229
- if (error instanceof ApiError && error.status === 401) {
1229
+ if (error instanceof SDKError && error.status === 401) {
1230
1230
  this.setToken(null);
1231
1231
  return null;
1232
1232
  }
@@ -1321,51 +1321,15 @@ var CustomerAuth = class {
1321
1321
  if (!headers.has("Content-Type") && init.body) {
1322
1322
  headers.set("Content-Type", "application/json");
1323
1323
  }
1324
- const controller = new AbortController();
1325
- const timeoutId = setTimeout(() => controller.abort(), DEFAULT_TIMEOUT2);
1326
- let res;
1327
- try {
1328
- res = await fetch(`${this.baseUrl}${path}`, {
1329
- ...init,
1330
- headers,
1331
- signal: controller.signal
1332
- });
1333
- } catch (error) {
1334
- clearTimeout(timeoutId);
1335
- if (error instanceof Error && error.name === "AbortError") {
1336
- throw new TimeoutError(`Request timed out after ${DEFAULT_TIMEOUT2}ms`, {
1337
- url: path,
1338
- timeout: DEFAULT_TIMEOUT2
1339
- });
1340
- }
1341
- throw new NetworkError(
1342
- error instanceof Error ? error.message : "Network request failed",
1343
- void 0,
1344
- { url: path },
1345
- "Network connection failed.",
1346
- "Please check your internet connection and try again."
1347
- );
1348
- }
1349
- clearTimeout(timeoutId);
1350
- if (!res.ok) {
1351
- const body = await res.json().catch(() => ({}));
1352
- throw new ApiError(
1353
- body.error || `HTTP ${res.status}`,
1354
- res.status,
1355
- body.details,
1356
- body.error
1357
- );
1358
- }
1359
- try {
1360
- return await res.json();
1361
- } catch {
1362
- throw new ApiError(
1363
- "Invalid JSON response from server",
1364
- res.status,
1365
- void 0,
1366
- "INVALID_RESPONSE"
1367
- );
1368
- }
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);
1369
1333
  }
1370
1334
  };
1371
1335
 
@@ -1446,6 +1410,117 @@ var CartApi = class {
1446
1410
  }
1447
1411
  };
1448
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
+
1449
1524
  // src/core/commerce/commerce-client.ts
1450
1525
  var CommerceClient = class {
1451
1526
  constructor(options) {
@@ -1480,9 +1555,14 @@ var CommerceClient = class {
1480
1555
  listingGroups: (params) => execute("/api/products/listing-groups", params),
1481
1556
  detail: async (params) => {
1482
1557
  try {
1483
- return await execute("/api/products/detail", params);
1558
+ const product = await execute(
1559
+ "/api/products/detail",
1560
+ params
1561
+ );
1562
+ return { found: true, product };
1484
1563
  } catch (err) {
1485
- if (err instanceof NotFoundError) return null;
1564
+ const notFoundResult = productDetailResultFromError(err);
1565
+ if (notFoundResult) return notFoundResult;
1486
1566
  throw err;
1487
1567
  }
1488
1568
  }
@@ -1574,42 +1654,6 @@ function createClient(options) {
1574
1654
  return new Client(options);
1575
1655
  }
1576
1656
 
1577
- // src/core/api/base-api.ts
1578
- var BaseApi = class {
1579
- constructor(apiName, options) {
1580
- if (!options.secretKey) {
1581
- throw createConfigError(`secretKey is required for ${apiName}.`);
1582
- }
1583
- this.publishableKey = requirePublishableKeyForSecret(
1584
- apiName,
1585
- options.publishableKey,
1586
- options.secretKey
1587
- );
1588
- this.secretKey = options.secretKey;
1589
- this.apiUrl = options.apiUrl;
1590
- this.onRequestId = options.onRequestId;
1591
- }
1592
- async request(endpoint, body, options) {
1593
- const method = options?.method ?? "POST";
1594
- try {
1595
- const response = await httpFetch(endpoint, {
1596
- method,
1597
- apiUrl: this.apiUrl,
1598
- publishableKey: this.publishableKey,
1599
- secretKey: this.secretKey,
1600
- ...body !== void 0 && { body: JSON.stringify(body) },
1601
- ...options?.headers && { headers: options.headers }
1602
- });
1603
- this.onRequestId?.(response.headers.get("x-request-id") ?? null);
1604
- return parseApiResponse(response, endpoint);
1605
- } catch (err) {
1606
- const id = err instanceof SDKError ? err.requestId ?? null : null;
1607
- this.onRequestId?.(id);
1608
- throw err;
1609
- }
1610
- }
1611
- };
1612
-
1613
1657
  // src/core/api/order-api.ts
1614
1658
  var OrderApi = class extends BaseApi {
1615
1659
  constructor(options) {
@@ -1642,7 +1686,7 @@ var OrderApi = class extends BaseApi {
1642
1686
  }
1643
1687
  bulkImportFulfillments(params) {
1644
1688
  return this.request(
1645
- "/api/orders/bulk-import-fulfillments",
1689
+ "/api/fulfillments/bulk-import",
1646
1690
  params
1647
1691
  );
1648
1692
  }
@@ -1680,58 +1724,144 @@ var ShippingApi = class extends BaseApi {
1680
1724
  }
1681
1725
  };
1682
1726
 
1683
- // src/core/api/product-api.ts
1684
- var ProductApi = class extends BaseApi {
1685
- constructor(options) {
1686
- super("ProductApi", options);
1687
- }
1688
- /**
1689
- * Check point-in-time stock availability for one or more product variants.
1690
- * Results reflect available stock at the moment of the call and are not guaranteed
1691
- * to remain available by the time an order is placed.
1692
- */
1693
- stockCheck(params) {
1694
- return this.request("/api/products/stock-check", params);
1695
- }
1696
- listingGroups(params) {
1697
- return this.request(
1698
- "/api/products/listing-groups",
1699
- params
1700
- );
1701
- }
1702
- /**
1703
- * Fetch full product detail by slug or id.
1704
- * Returns `null` on 404 regardless of reason (`not_found` / `not_published` /
1705
- * `tenant_mismatch` / `feature_disabled`). For the reason behind a null,
1706
- * inspect `client.lastRequestId` against backend logs.
1707
- */
1708
- async detail(params) {
1709
- try {
1710
- return await this.request("/api/products/detail", params);
1711
- } catch (err) {
1712
- if (err instanceof NotFoundError) return null;
1713
- throw err;
1714
- }
1715
- }
1716
- /**
1717
- * Atomically create or update a product together with its options,
1718
- * option-values, and variants in a single transaction. Mirrors Shopify's
1719
- * `productSet` shape and is the canonical write path for the MCP
1720
- * `product-upsert` tool.
1721
- */
1722
- upsert(params) {
1723
- return this.request("/api/products/upsert", params);
1724
- }
1725
- };
1726
-
1727
1727
  // src/core/webhook/index.ts
1728
+ var ORDER_CHANGED_EVENT_TYPE = "collection.orderChanged";
1729
+ var COMMERCE_NOTIFICATION_EVENT_TYPE = "commerce.notification";
1728
1730
  function isValidWebhookEvent(data) {
1729
1731
  if (typeof data !== "object" || data === null) return false;
1730
1732
  const obj = data;
1731
1733
  return typeof obj.collection === "string" && typeof obj.operation === "string" && obj.operation.length > 0 && typeof obj.data === "object" && obj.data !== null;
1732
1734
  }
1735
+ var COMMERCE_NOTIFICATION_OPERATION = "notification";
1736
+ var COMMERCE_NOTIFICATION_EVENTS = [
1737
+ "orderPaid",
1738
+ "fulfillmentShipped",
1739
+ "orderDelivered",
1740
+ "returnRequested",
1741
+ "returnCompleted"
1742
+ ];
1743
+ function isStringOrNumber(value) {
1744
+ return typeof value === "string" || typeof value === "number";
1745
+ }
1746
+ function isWebhookOrderScope(value) {
1747
+ if (!isRecord2(value)) return false;
1748
+ if (value.kind === "collection") {
1749
+ return typeof value.collection === "string";
1750
+ }
1751
+ if (value.kind === "join") {
1752
+ return typeof value.collection === "string" && typeof value.field === "string" && isStringOrNumber(value.id);
1753
+ }
1754
+ return false;
1755
+ }
1756
+ function isWebhookOrderMoved(value) {
1757
+ if (!isRecord2(value)) return false;
1758
+ return typeof value.collection === "string" && isStringOrNumber(value.id) && (value.relatedCollection === void 0 || typeof value.relatedCollection === "string") && (value.relatedId === void 0 || isStringOrNumber(value.relatedId));
1759
+ }
1760
+ function hasOptionalOrderValue(value, key) {
1761
+ return value[key] === void 0 || value[key] === null || typeof value[key] === "string";
1762
+ }
1763
+ function isWebhookOrderChange(value) {
1764
+ if (!isRecord2(value)) return false;
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);
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
+ }
1791
+ function isOrderChangedWebhookEvent(event) {
1792
+ if (!isValidWebhookEvent(event) || event.operation !== "update" || event.eventType !== ORDER_CHANGED_EVENT_TYPE || !isWebhookOrderChange(event.change)) {
1793
+ return false;
1794
+ }
1795
+ if (event.collection !== event.change.scope.collection) {
1796
+ return false;
1797
+ }
1798
+ if (event.change.scope.kind === "collection" && event.change.moved.collection !== event.change.scope.collection) {
1799
+ return false;
1800
+ }
1801
+ return true;
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
+ }
1857
+ function isWebhookCollection(event, collection) {
1858
+ return isValidWebhookEvent(event) && event.collection === collection;
1859
+ }
1860
+ function isWebhookOperation(event, operation) {
1861
+ return isValidWebhookEvent(event) && event.operation === operation;
1862
+ }
1733
1863
  var CUSTOMER_PASSWORD_RESET_OPERATION = "password-reset";
1734
- function isRecord(value) {
1864
+ function isRecord2(value) {
1735
1865
  return typeof value === "object" && value !== null;
1736
1866
  }
1737
1867
  function hasString(value, key) {
@@ -1741,7 +1871,7 @@ function hasStringOrNumber(value, key) {
1741
1871
  return typeof value[key] === "string" || typeof value[key] === "number";
1742
1872
  }
1743
1873
  function isCustomerPasswordResetWebhookEvent(event) {
1744
- 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)) {
1745
1875
  return false;
1746
1876
  }
1747
1877
  return hasStringOrNumber(event.data, "customerId") && hasString(event.data, "email") && hasString(event.data, "name") && hasString(event.data, "resetPasswordToken") && hasString(event.data, "resetPasswordExpiresAt");
@@ -1861,6 +1991,7 @@ var INTERNAL_COLLECTIONS = [
1861
1991
  "subscriptions",
1862
1992
  "billing-history",
1863
1993
  "inventory-reservations",
1994
+ "commerce-notification-intents",
1864
1995
  "product-collection-items",
1865
1996
  "order-status-logs",
1866
1997
  "api-keys",
@@ -3093,7 +3224,14 @@ function buildProductListingProjection(product, variants) {
3093
3224
  function buildProductListingCard(item, options = {}) {
3094
3225
  const product = item.product;
3095
3226
  const groups = item.groups;
3096
- 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;
3097
3235
  const priceRange = aggregateListingPriceRange(groups);
3098
3236
  const availableForSale = groups.some(
3099
3237
  (group) => group.listing.availableForSale
@@ -3101,14 +3239,42 @@ function buildProductListingCard(item, options = {}) {
3101
3239
  const swatches = groups.length > 1 ? groups.map((group) => buildListingSwatch(product, group, options)) : [];
3102
3240
  return {
3103
3241
  id: String(product.id),
3104
- href: buildProductHref({ slug: product.slug }, void 0, options),
3242
+ href: buildProductHref(
3243
+ { slug: product.slug },
3244
+ { listing: { selectionHintVariant } },
3245
+ options
3246
+ ),
3105
3247
  title: product.title,
3248
+ representativeVariant,
3106
3249
  primaryImage,
3107
3250
  priceRange,
3108
3251
  availableForSale,
3109
3252
  swatches
3110
3253
  };
3111
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
+ }
3112
3278
  function aggregateListingPriceRange(groups) {
3113
3279
  const minPrice = minOfNullable(groups.map((g) => g.listing.minPrice));
3114
3280
  const maxPrice = maxOfNullable(groups.map((g) => g.listing.maxPrice));
@@ -3492,6 +3658,9 @@ export {
3492
3658
  AuthError,
3493
3659
  BaseApi,
3494
3660
  COLLECTIONS,
3661
+ COMMERCE_NOTIFICATION_EVENTS,
3662
+ COMMERCE_NOTIFICATION_EVENT_TYPE,
3663
+ COMMERCE_NOTIFICATION_OPERATION,
3495
3664
  CUSTOMER_PASSWORD_RESET_OPERATION,
3496
3665
  CartApi,
3497
3666
  CommerceClient,
@@ -3506,6 +3675,7 @@ export {
3506
3675
  INTERNAL_COLLECTIONS,
3507
3676
  NetworkError,
3508
3677
  NotFoundError,
3678
+ ORDER_CHANGED_EVENT_TYPE,
3509
3679
  OrderApi,
3510
3680
  PermissionError,
3511
3681
  ProductApi,
@@ -3529,6 +3699,7 @@ export {
3529
3699
  createAnalytics,
3530
3700
  createAuthError,
3531
3701
  createClient2 as createClient,
3702
+ createCommerceEmailWebhookHandler,
3532
3703
  createConflictError,
3533
3704
  createCustomerAuthWebhookHandler,
3534
3705
  createNotFoundError,
@@ -3536,9 +3707,11 @@ export {
3536
3707
  createProductSelectionCodec,
3537
3708
  createRateLimitError,
3538
3709
  createTypedWebhookHandler,
3710
+ defineCommerceEmailConfig,
3539
3711
  formatOrderName,
3540
3712
  generateOrderNumber,
3541
3713
  getAvailableOptionValues,
3714
+ getCommerceNotificationIdempotencyKey,
3542
3715
  getImageLqip,
3543
3716
  getImagePalette,
3544
3717
  getImagePlaceholderStyle,
@@ -3554,12 +3727,14 @@ export {
3554
3727
  handleWebhook,
3555
3728
  isApiError,
3556
3729
  isAuthError,
3730
+ isCommerceNotificationWebhookEvent,
3557
3731
  isConfigError,
3558
3732
  isConflictError,
3559
3733
  isCustomerPasswordResetWebhookEvent,
3560
3734
  isGoneError,
3561
3735
  isNetworkError,
3562
3736
  isNotFoundError,
3737
+ isOrderChangedWebhookEvent,
3563
3738
  isPermissionError,
3564
3739
  isRateLimitError,
3565
3740
  isSDKError,
@@ -3568,6 +3743,8 @@ export {
3568
3743
  isUsageLimitError,
3569
3744
  isValidWebhookEvent,
3570
3745
  isValidationError,
3746
+ isWebhookCollection,
3747
+ isWebhookOperation,
3571
3748
  normalizeProductSelection,
3572
3749
  normalizeProductSelectionFromMatrix,
3573
3750
  normalizeSelectedValueIds,