@01.software/sdk 0.42.0 → 0.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +10 -4
- package/dist/client.cjs +99 -57
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +9 -6
- package/dist/client.d.ts +9 -6
- package/dist/client.js +99 -57
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-B-qVIBnJ.d.cts → collection-client-U70KizLf.d.cts} +3 -3
- package/dist/{collection-client-BhCMwIus.d.ts → collection-client-gWsA7BVP.d.ts} +3 -3
- package/dist/{const-pmHlwm3E.d.ts → const-BBynifk0.d.cts} +5 -5
- package/dist/{const-BiDujixF.d.cts → const-_WWHU-gX.d.ts} +5 -5
- package/dist/{index-B1UBDaKz.d.ts → index-DPi5NWU8.d.ts} +4 -4
- package/dist/{index-D78ki6Ij.d.cts → index-Dg4Y6Aq7.d.cts} +4 -4
- package/dist/index.cjs +111 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -8
- package/dist/index.d.ts +41 -8
- package/dist/index.js +111 -61
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-C7Ul4ElL.d.cts → payload-types-DLxkB7Mv.d.cts} +399 -27
- package/dist/{payload-types-C7Ul4ElL.d.ts → payload-types-DLxkB7Mv.d.ts} +399 -27
- package/dist/query.cjs +59 -7
- package/dist/query.cjs.map +1 -1
- package/dist/query.d.cts +5 -5
- package/dist/query.d.ts +5 -5
- package/dist/query.js +59 -7
- package/dist/query.js.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/server.cjs +130 -57
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +12 -7
- package/dist/server.d.ts +12 -7
- package/dist/server.js +130 -57
- package/dist/server.js.map +1 -1
- package/dist/{types-ChV1t4ei.d.cts → types-B1ngKbWI.d.cts} +1 -1
- package/dist/{types-BL7M-EUV.d.cts → types-B9lGhZlB.d.ts} +95 -6
- package/dist/{types-Bf2iCjy8.d.ts → types-BiKNBwRA.d.ts} +1 -1
- package/dist/{types-D5dSNIGs.d.ts → types-Bpx5sYKo.d.cts} +95 -6
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/webhook.cjs +3 -1
- package/dist/webhook.cjs.map +1 -1
- package/dist/webhook.d.cts +4 -4
- package/dist/webhook.d.ts +4 -4
- package/dist/webhook.js +3 -1
- package/dist/webhook.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,16 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AddItemParams,
|
|
3
|
-
import { P as Product } from './payload-types-
|
|
4
|
-
export { A as Article, e as ArticleAuthor, f as ArticleCategory, g as ArticleTag, h as Cart, i as CartItem, D as Document, I as Image, O as Order, j as Post, k as PostCategory, l as ProductVariant, T as Tenant, m as Transaction, V as Video } from './payload-types-
|
|
5
|
-
export { C as CollectionType, P as Product, a as ProductCollection } from './types-
|
|
6
|
-
export { C as COMMERCE_NOTIFICATION_EVENTS, a as COMMERCE_NOTIFICATION_EVENT_TYPE, b as COMMERCE_NOTIFICATION_OPERATION, c as CUSTOMER_PASSWORD_RESET_OPERATION, d as CollectionWebhookOperation, e as CommerceEmailChannel, f as CommerceEmailConfig, g as CommerceEmailEventConfig, h as CommerceEmailEventHandlers, i as CommerceEmailHandlerContext, j as CommerceNotification, k as CommerceNotificationData, l as CommerceNotificationEventHandlers, m as CommerceNotificationEventName, n as CommerceNotificationHandlerContext, o as CommerceNotificationSource, p as CommerceNotificationSourceCollection, q as CommerceNotificationWebhookEvent, r as CustomerAuthWebhookEvent, s as CustomerAuthWebhookHandlers, t as CustomerPasswordResetWebhookData, u as CustomerPasswordResetWebhookEvent, O as ORDER_CHANGED_EVENT_TYPE, v as OrderChangedWebhookEvent, W as WebhookChange, w as WebhookCommerceNotificationChange, x as WebhookEvent, y as WebhookHandler, z as WebhookKnownOperation, A as WebhookOperation, B as WebhookOptions, D as WebhookOrderChange, E as WebhookOrderMoved, F as WebhookOrderScope, G as createCommerceEmailWebhookHandler, H as createCommerceNotificationWebhookHandler, I as createCustomerAuthWebhookHandler, J as createTypedWebhookHandler, K as defineCommerceEmailConfig, L as getCommerceNotificationIdempotencyKey, M as handleWebhook, N as isCommerceNotificationWebhookEvent, P as isCustomerPasswordResetWebhookEvent, Q as isOrderChangedWebhookEvent, R as isValidWebhookEvent, S as isWebhookCollection, T as isWebhookOperation } from './index-
|
|
7
|
-
export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS, P as PublicCollection, b as SERVER_COLLECTIONS, c as SERVER_ONLY_COLLECTIONS } from './const-
|
|
1
|
+
import { O as BaseApi, Q as ServerApiOptions, X as SubscribeMembershipParams, Y as SubscribeMembershipResponse, Z as CancelMembershipParams, _ as CancelMembershipResponse, d as CustomerMembershipView, aV as ProductDetail, aW as ProductDetailCatalog, aX as StockSnapshotResponse, aY as ProductSelectionMediaSource, aZ as ProductDisplayMediaSource, a_ as ResolveProductSelectionMediaInput, a$ as ResolveProductSelectionMediaResult, b0 as ProductSelectionMediaPointer, f as ClientConfig, b1 as RootClientWithEvents } from './types-Bpx5sYKo.cjs';
|
|
2
|
+
export { A as AddItemParams, g as ApiQueryOptions, h as ApplyDiscountParams, b2 as BulkImportFulfillmentsParams, b3 as BulkImportFulfillmentsResponse, b4 as CalculateShippingParams, b5 as CalculateShippingResult, b6 as CancelOrderParams, b7 as CancelOrderReconciliationStatus, b8 as CancelOrderResponse, b9 as CancelReasonCode, ba as CartApi, bb as CartApiOptions, bc as CartMergeParams, bd as CartMergeResult, be as CartMineResult, i as CheckoutParams, j as ClearCartParams, z as Client, k as ClientMetadata, e as ClientState, z as ClientType, bf as Comment, C as CommerceClient, bg as CommerceClientOptions, a as CommunityClient, bh as CommunityClientOptions, bi as CommunityComment, bj as CommunityCommentListSort, bk as CommunityPost, bl as CommunityPostCategory, bm as CommunityPostListSort, bn as CommunityPostTag, bo as CommunityPublicAuthorSnapshot, bp as CommunityPublicMediaAsset, bq as CommunityPublicReference, br as CompatibilityProductSelectionParamEvent, bs as ConfirmPaymentParams, bt as ConfirmPaymentResponse, bu as ConfirmPaymentWithOrderResult, b as ContentClient, l as ContentClientOptions, bv as CreateFulfillmentParams, bw as CreateOrderItem, bx as CreateOrderParams, by as CreateReturnParams, aE as CustomerAuth, bz as CustomerAuthOptions, aG as CustomerAuthResponse, aH as CustomerLoginData, c as CustomerNamespace, bA as CustomerOrderListOptions, aF as CustomerProfile, aK as CustomerRefreshResponse, aJ as CustomerRegisterData, aI as CustomerRegisterResponse, bB as CustomerSnapshot, D as DebugConfig, m as DeepPartial, bC as DiscountApi, bD as DiscountApiOptions, bE as DiscountErrorReasonCode, a6 as EventGuestCancelParams, a7 as EventGuestRegistration, a8 as EventGuestRegistrationResponse, a9 as EventRegistrationAnswerInput, aa as EventRegistrationAttendeeInput, ab as EventRegistrationPublic, ac as EventRegistrationRegisterParams, ad as EventRegistrationRegisterResponse, ae as EventsCalendarItem, E as EventsClient, af as EventsClientOptions, ag as EventsDateParam, ah as EventsExternalSource, ai as EventsLocation, aj as EventsOccurrenceLocation, ak as EventsRangeEvent, al as EventsRangeOccurrence, am as EventsRangeParams, an as EventsRangeResponse, ao as EventsTaxonomyItem, n as ExtractArrayType, bF as FeaturedImagePointerInput, bG as GetOrderByPaymentIdParams, bH as LegacyProductSelectionParamEvent, bI as ListingGroupsParams, bJ as MediaValue, bK as MembershipStatus, bL as NormalizedOptionSwatch, bM as NormalizedProductSelection, bN as OrderApi, bO as OrderApiOptions, bP as OrderByPaymentResult, bQ as PRODUCT_PLP_FIND_OPTIONS, bR as PRODUCT_UPSERT_READONLY_FIELD_REASON, bS as PRODUCT_UPSERT_UNKNOWN_FIELD_REASON, P as PayloadFindResponse, o as PayloadMutationResponse, bT as PrepareFulfillmentOrderParams, bU as PrepareFulfillmentOrderResponse, bV as ProductApi, bW as ProductApiOptions, bX as ProductDetailBrand, bY as ProductDetailCatalogResult, bZ as ProductDetailCatalogVariant, b_ as ProductDetailCategory, b$ as ProductDetailImage, c0 as ProductDetailImageMedia, c1 as ProductDetailMedia, c2 as ProductDetailOption, c3 as ProductDetailOptionValue, aO as ProductDetailParams, aP as ProductDetailResult, c4 as ProductDetailTag, c5 as ProductDetailUnavailableReason, c6 as ProductDetailVariant, c7 as ProductDetailVariantOptionValue, c8 as ProductDetailVideo, c9 as ProductHrefGroup, ca as ProductHrefOptions, cb as ProductHrefProduct, cc as ProductListingCard, cd as ProductListingCardOptions, ce as ProductListingCardPriceRange, cf as ProductListingCardRepresentativeVariant, cg as ProductListingGroup, ch as ProductListingGroupCatalogSummary, ci as ProductListingGroupCatalogVariant, cj as ProductListingGroupProjection, ck as ProductListingGroupSummary, cl as ProductListingGroupVariant, aS as ProductListingGroupsCatalogItem, cm as ProductListingGroupsCatalogProduct, cn as ProductListingGroupsCatalogResponse, aU as ProductListingGroupsItem, co as ProductListingGroupsProduct, cp as ProductListingGroupsResponse, aM as ProductListingPageBaseParams, aQ as ProductListingPageCatalogParams, cq as ProductListingPageFilters, aT as ProductListingPageFullParams, aN as ProductListingPageParams, aR as ProductListingPageResult, cr as ProductListingPageSort, cs as ProductListingProductShape, ct as ProductListingSwatch, cu as ProductMediaResolutionSource, cv as ProductMoneyRange, cw as ProductOptionMatrix, cx as ProductOptionMatrixOption, cy as ProductOptionMatrixValue, cz as ProductOptionMatrixVariant, cA as ProductOptionShape, cB as ProductOptionValueShape, cC as ProductOptionValueSwatch, cD as ProductOptionValueSwatchInput, cE as ProductPriceRange, cF as ProductSelectionAvailableSwatch, cG as ProductSelectionAvailableValue, cH as ProductSelectionByOptionValue, cI as ProductSelectionCodecError, cJ as ProductSelectionCodecOptions, cK as ProductSelectionInput, cL as ProductSelectionOptionValue, cM as ProductSelectionResolution, cN as ProductSelectionResolutionContext, cO as ProductSelectionUrlEmit, cP as ProductSelectionVariant, cQ as ProductUpsertFieldValidationErrorBody, cR as ProductUpsertFieldValidationErrorReason, cS as ProductVariantShape, p as PublicCart, q as PublicCartItem, r as PublicCartReference, s as PublicMediaAsset, t as PublicMediaSize, u as PublicOrder, v as PublicOrderItem, w as PublicOrderReference, aD as PublicReadQueryOptions, R as RemoveDiscountParams, x as RemoveItemParams, cT as RequestOptions, cU as ResolveCancelRefundFailedResponse, cV as ResolveCancelRefundOutcome, cW as ResolveCancelRefundParams, cX as ResolveCancelRefundResponse, cY as ResolveCancelRefundSucceededResponse, cZ as ResolveProductDisplayMediaInput, c_ as ResolveProductDisplayMediaResult, y as RetryConfig, c$ as ReturnItem, d0 as ReturnReason, d1 as ReturnWithRefundItem, d2 as ReturnWithRefundParams, z as RootClient, B as RootCollectionClient, F as RootReadOnlyQueryBuilder, d3 as ShippingApi, d4 as ShippingApiOptions, S as Sort, d5 as StockCheckParams, d6 as StockCheckResponse, d7 as StockCheckResult, d8 as StockSnapshotItem, d9 as StockSnapshotParams, G as StorefrontContentListOptions, H as StorefrontContentReference, I as StorefrontGalleryItem, J as StorefrontGalleryItemsListOptions, K as StorefrontGalleryItemsSort, L as StorefrontLink, M as StorefrontLinksListOptions, N as StorefrontLinksSort, da as TransactionStatus, db as UpdateFulfillmentParams, U as UpdateItemParams, dc as UpdateOrderParams, aL as UpdateProfileData, dd as UpdateReturnParams, de as UpdateTransactionParams, df as ValidateDiscountParams, dg as ValidateDiscountResult, W as Where, dh as WithIdempotencyKey, di as buildProductHref, dj as buildProductListingCard, dk as buildProductListingGroupProjection, dl as buildProductListingGroupsByOption, dm as buildProductOptionMatrix, dn as buildProductOptionMatrixFromDetail, dp as createProductSelectionCodec, dq as getAvailableOptionValues, dr as getProductSelectionImages, ds as getSelectedValueByOptionId, dt as getVariantAvailableForSale, du as getVariantAvailableStock, dv as isProductUpsertFieldValidationErrorBody, dw as normalizeProductSelection, dx as normalizeProductSelectionFromMatrix, dy as normalizeSelectedValueIds, dz as parseProductSelection, dA as projectProductToListingShape, dB as resolveFeaturedImagePointer, dC as resolveProductDisplayMedia, dD as resolveProductSelection, dE as resolveProductSelectionFromMatrix, dF as resolveProductSelectionMedia, dG as resolveVariantForSelection, dH as selectNext, dI as selectedSwatchMediaItemId, dJ as stringifyProductSelection, dK as toShopifyPriceRangeV2 } from './types-Bpx5sYKo.cjs';
|
|
3
|
+
import { P as Product } from './payload-types-DLxkB7Mv.cjs';
|
|
4
|
+
export { A as Article, e as ArticleAuthor, f as ArticleCategory, g as ArticleTag, h as Cart, i as CartItem, D as Document, I as Image, O as Order, j as Post, k as PostCategory, l as ProductVariant, T as Tenant, m as Transaction, V as Video } from './payload-types-DLxkB7Mv.cjs';
|
|
5
|
+
export { C as CollectionType, P as Product, a as ProductCollection } from './types-B1ngKbWI.cjs';
|
|
6
|
+
export { C as COMMERCE_NOTIFICATION_EVENTS, a as COMMERCE_NOTIFICATION_EVENT_TYPE, b as COMMERCE_NOTIFICATION_OPERATION, c as CUSTOMER_PASSWORD_RESET_OPERATION, d as CollectionWebhookOperation, e as CommerceEmailChannel, f as CommerceEmailConfig, g as CommerceEmailEventConfig, h as CommerceEmailEventHandlers, i as CommerceEmailHandlerContext, j as CommerceNotification, k as CommerceNotificationData, l as CommerceNotificationEventHandlers, m as CommerceNotificationEventName, n as CommerceNotificationHandlerContext, o as CommerceNotificationSource, p as CommerceNotificationSourceCollection, q as CommerceNotificationWebhookEvent, r as CustomerAuthWebhookEvent, s as CustomerAuthWebhookHandlers, t as CustomerPasswordResetWebhookData, u as CustomerPasswordResetWebhookEvent, O as ORDER_CHANGED_EVENT_TYPE, v as OrderChangedWebhookEvent, W as WebhookChange, w as WebhookCommerceNotificationChange, x as WebhookEvent, y as WebhookHandler, z as WebhookKnownOperation, A as WebhookOperation, B as WebhookOptions, D as WebhookOrderChange, E as WebhookOrderMoved, F as WebhookOrderScope, G as createCommerceEmailWebhookHandler, H as createCommerceNotificationWebhookHandler, I as createCustomerAuthWebhookHandler, J as createTypedWebhookHandler, K as defineCommerceEmailConfig, L as getCommerceNotificationIdempotencyKey, M as handleWebhook, N as isCommerceNotificationWebhookEvent, P as isCustomerPasswordResetWebhookEvent, Q as isOrderChangedWebhookEvent, R as isValidWebhookEvent, S as isWebhookCollection, T as isWebhookOperation } from './index-Dg4Y6Aq7.cjs';
|
|
7
|
+
export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS, P as PublicCollection, b as SERVER_COLLECTIONS, c as SERVER_ONLY_COLLECTIONS } from './const-BBynifk0.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 ImageDataSizeEntry, c as ImageDataSizes, d as ImagePalette, e as ImagePlaceholderOptions, g as getImageLqip, f as getImagePalette, h as getImagePlaceholderStyle, i as getImageSrcSet, j as getImageUrl } from './image-BDjHp03R.cjs';
|
|
10
10
|
export { V as VideoGifOptions, a as VideoThumbnailOptions, g as getVideoGif, b as getVideoMp4Url, c as getVideoStoryboard, d as getVideoStreamUrl, e as getVideoThumbnail } from './video-WR_TFO9a.cjs';
|
|
11
11
|
export { Analytics, AnalyticsConfig, createAnalytics } from './analytics.cjs';
|
|
12
12
|
export { ApiError, AuthError, ConfigError, ConflictError, GoneError, NetworkError, NotFoundError, PermissionError, RateLimitError, SDKError, ServiceUnavailableError, TimeoutError, UsageLimitError, ValidationError, createAuthError, createConflictError, createNotFoundError, createPermissionError, createRateLimitError, isApiError, isAuthError, isConfigError, isConflictError, isGoneError, isNetworkError, isNotFoundError, isPermissionError, isRateLimitError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError } from './errors.cjs';
|
|
13
13
|
|
|
14
|
+
type MembershipApiOptions = ServerApiOptions;
|
|
15
|
+
/**
|
|
16
|
+
* Server-only (secret-key) API for membership lifecycle operations.
|
|
17
|
+
*
|
|
18
|
+
* subscribe / cancel are sk-only (admin-sk-only policy).
|
|
19
|
+
* me is also exposed on the browser client (customer-JWT policy), but the
|
|
20
|
+
* server-side method reuses the same endpoint.
|
|
21
|
+
*/
|
|
22
|
+
declare class MembershipApi extends BaseApi {
|
|
23
|
+
constructor(options: MembershipApiOptions);
|
|
24
|
+
/**
|
|
25
|
+
* Record a delegated first-charge and activate a membership.
|
|
26
|
+
* The storefront collected the payment; this endpoint deduplicates by
|
|
27
|
+
* `subscribeIntentKey` and records the already-paid charge.
|
|
28
|
+
*
|
|
29
|
+
* `subscribeIntentKey` is used as the HTTP idempotency key so the call is
|
|
30
|
+
* safely retryable.
|
|
31
|
+
*/
|
|
32
|
+
subscribe(params: SubscribeMembershipParams): Promise<SubscribeMembershipResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Cancel a membership by id.
|
|
35
|
+
* `immediate=false` (default) sets `cancelAtPeriodEnd`; the customer retains
|
|
36
|
+
* benefits until `currentPeriodEnd`. `immediate=true` cancels now and revokes
|
|
37
|
+
* membership groups immediately.
|
|
38
|
+
*/
|
|
39
|
+
cancel(params: CancelMembershipParams): Promise<CancelMembershipResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* Retrieve the authenticated customer's own membership view.
|
|
42
|
+
* Never returns payment tokens or internal keys.
|
|
43
|
+
*/
|
|
44
|
+
me(): Promise<CustomerMembershipView | null>;
|
|
45
|
+
}
|
|
46
|
+
|
|
14
47
|
type ProductDetailStockMergeStatus = 'complete' | 'partial';
|
|
15
48
|
interface MergedProductDetailResult {
|
|
16
49
|
stockMergeStatus: ProductDetailStockMergeStatus;
|
|
@@ -97,4 +130,4 @@ declare function resolveRelation<T>(ref: unknown): T | null;
|
|
|
97
130
|
|
|
98
131
|
declare function createClient(options: ClientConfig): RootClientWithEvents;
|
|
99
132
|
|
|
100
|
-
export { ClientConfig, type MediaPointerSource, type MergedProductDetailResult, ProductDetail, ProductDetailCatalog, type ProductDetailStockMergeStatus, ProductDisplayMediaSource, type ProductGallerySource, type ProductMediaSetInput, type ProductMediaSetMatchType, ProductSelectionMediaPointer, ProductSelectionMediaSource, type ResolveProductGalleryInput, type ResolveProductGalleryResult, type ResolveProductMediaInput, type ResolveProductMediaResult, ResolveProductSelectionMediaInput, ResolveProductSelectionMediaResult, RootClientWithEvents, StockSnapshotResponse, createClient, formatOrderName, generateOrderNumber, mergeProductDetailWithStock, resolveProductGallery, resolveProductMedia, resolveRelation };
|
|
133
|
+
export { BaseApi, CancelMembershipParams, CancelMembershipResponse, ClientConfig, CustomerMembershipView, type MediaPointerSource, MembershipApi, type MembershipApiOptions, type MergedProductDetailResult, ProductDetail, ProductDetailCatalog, type ProductDetailStockMergeStatus, ProductDisplayMediaSource, type ProductGallerySource, type ProductMediaSetInput, type ProductMediaSetMatchType, ProductSelectionMediaPointer, ProductSelectionMediaSource, type ResolveProductGalleryInput, type ResolveProductGalleryResult, type ResolveProductMediaInput, type ResolveProductMediaResult, ResolveProductSelectionMediaInput, ResolveProductSelectionMediaResult, RootClientWithEvents, ServerApiOptions, StockSnapshotResponse, SubscribeMembershipParams, SubscribeMembershipResponse, createClient, formatOrderName, generateOrderNumber, mergeProductDetailWithStock, resolveProductGallery, resolveProductMedia, resolveRelation };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AddItemParams,
|
|
3
|
-
import { P as Product } from './payload-types-
|
|
4
|
-
export { A as Article, e as ArticleAuthor, f as ArticleCategory, g as ArticleTag, h as Cart, i as CartItem, D as Document, I as Image, O as Order, j as Post, k as PostCategory, l as ProductVariant, T as Tenant, m as Transaction, V as Video } from './payload-types-
|
|
5
|
-
export { C as CollectionType, P as Product, a as ProductCollection } from './types-
|
|
6
|
-
export { C as COMMERCE_NOTIFICATION_EVENTS, a as COMMERCE_NOTIFICATION_EVENT_TYPE, b as COMMERCE_NOTIFICATION_OPERATION, c as CUSTOMER_PASSWORD_RESET_OPERATION, d as CollectionWebhookOperation, e as CommerceEmailChannel, f as CommerceEmailConfig, g as CommerceEmailEventConfig, h as CommerceEmailEventHandlers, i as CommerceEmailHandlerContext, j as CommerceNotification, k as CommerceNotificationData, l as CommerceNotificationEventHandlers, m as CommerceNotificationEventName, n as CommerceNotificationHandlerContext, o as CommerceNotificationSource, p as CommerceNotificationSourceCollection, q as CommerceNotificationWebhookEvent, r as CustomerAuthWebhookEvent, s as CustomerAuthWebhookHandlers, t as CustomerPasswordResetWebhookData, u as CustomerPasswordResetWebhookEvent, O as ORDER_CHANGED_EVENT_TYPE, v as OrderChangedWebhookEvent, W as WebhookChange, w as WebhookCommerceNotificationChange, x as WebhookEvent, y as WebhookHandler, z as WebhookKnownOperation, A as WebhookOperation, B as WebhookOptions, D as WebhookOrderChange, E as WebhookOrderMoved, F as WebhookOrderScope, G as createCommerceEmailWebhookHandler, H as createCommerceNotificationWebhookHandler, I as createCustomerAuthWebhookHandler, J as createTypedWebhookHandler, K as defineCommerceEmailConfig, L as getCommerceNotificationIdempotencyKey, M as handleWebhook, N as isCommerceNotificationWebhookEvent, P as isCustomerPasswordResetWebhookEvent, Q as isOrderChangedWebhookEvent, R as isValidWebhookEvent, S as isWebhookCollection, T as isWebhookOperation } from './index-
|
|
7
|
-
export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS, P as PublicCollection, b as SERVER_COLLECTIONS, c as SERVER_ONLY_COLLECTIONS } from './const-
|
|
1
|
+
import { O as BaseApi, Q as ServerApiOptions, X as SubscribeMembershipParams, Y as SubscribeMembershipResponse, Z as CancelMembershipParams, _ as CancelMembershipResponse, d as CustomerMembershipView, aV as ProductDetail, aW as ProductDetailCatalog, aX as StockSnapshotResponse, aY as ProductSelectionMediaSource, aZ as ProductDisplayMediaSource, a_ as ResolveProductSelectionMediaInput, a$ as ResolveProductSelectionMediaResult, b0 as ProductSelectionMediaPointer, f as ClientConfig, b1 as RootClientWithEvents } from './types-B9lGhZlB.js';
|
|
2
|
+
export { A as AddItemParams, g as ApiQueryOptions, h as ApplyDiscountParams, b2 as BulkImportFulfillmentsParams, b3 as BulkImportFulfillmentsResponse, b4 as CalculateShippingParams, b5 as CalculateShippingResult, b6 as CancelOrderParams, b7 as CancelOrderReconciliationStatus, b8 as CancelOrderResponse, b9 as CancelReasonCode, ba as CartApi, bb as CartApiOptions, bc as CartMergeParams, bd as CartMergeResult, be as CartMineResult, i as CheckoutParams, j as ClearCartParams, z as Client, k as ClientMetadata, e as ClientState, z as ClientType, bf as Comment, C as CommerceClient, bg as CommerceClientOptions, a as CommunityClient, bh as CommunityClientOptions, bi as CommunityComment, bj as CommunityCommentListSort, bk as CommunityPost, bl as CommunityPostCategory, bm as CommunityPostListSort, bn as CommunityPostTag, bo as CommunityPublicAuthorSnapshot, bp as CommunityPublicMediaAsset, bq as CommunityPublicReference, br as CompatibilityProductSelectionParamEvent, bs as ConfirmPaymentParams, bt as ConfirmPaymentResponse, bu as ConfirmPaymentWithOrderResult, b as ContentClient, l as ContentClientOptions, bv as CreateFulfillmentParams, bw as CreateOrderItem, bx as CreateOrderParams, by as CreateReturnParams, aE as CustomerAuth, bz as CustomerAuthOptions, aG as CustomerAuthResponse, aH as CustomerLoginData, c as CustomerNamespace, bA as CustomerOrderListOptions, aF as CustomerProfile, aK as CustomerRefreshResponse, aJ as CustomerRegisterData, aI as CustomerRegisterResponse, bB as CustomerSnapshot, D as DebugConfig, m as DeepPartial, bC as DiscountApi, bD as DiscountApiOptions, bE as DiscountErrorReasonCode, a6 as EventGuestCancelParams, a7 as EventGuestRegistration, a8 as EventGuestRegistrationResponse, a9 as EventRegistrationAnswerInput, aa as EventRegistrationAttendeeInput, ab as EventRegistrationPublic, ac as EventRegistrationRegisterParams, ad as EventRegistrationRegisterResponse, ae as EventsCalendarItem, E as EventsClient, af as EventsClientOptions, ag as EventsDateParam, ah as EventsExternalSource, ai as EventsLocation, aj as EventsOccurrenceLocation, ak as EventsRangeEvent, al as EventsRangeOccurrence, am as EventsRangeParams, an as EventsRangeResponse, ao as EventsTaxonomyItem, n as ExtractArrayType, bF as FeaturedImagePointerInput, bG as GetOrderByPaymentIdParams, bH as LegacyProductSelectionParamEvent, bI as ListingGroupsParams, bJ as MediaValue, bK as MembershipStatus, bL as NormalizedOptionSwatch, bM as NormalizedProductSelection, bN as OrderApi, bO as OrderApiOptions, bP as OrderByPaymentResult, bQ as PRODUCT_PLP_FIND_OPTIONS, bR as PRODUCT_UPSERT_READONLY_FIELD_REASON, bS as PRODUCT_UPSERT_UNKNOWN_FIELD_REASON, P as PayloadFindResponse, o as PayloadMutationResponse, bT as PrepareFulfillmentOrderParams, bU as PrepareFulfillmentOrderResponse, bV as ProductApi, bW as ProductApiOptions, bX as ProductDetailBrand, bY as ProductDetailCatalogResult, bZ as ProductDetailCatalogVariant, b_ as ProductDetailCategory, b$ as ProductDetailImage, c0 as ProductDetailImageMedia, c1 as ProductDetailMedia, c2 as ProductDetailOption, c3 as ProductDetailOptionValue, aO as ProductDetailParams, aP as ProductDetailResult, c4 as ProductDetailTag, c5 as ProductDetailUnavailableReason, c6 as ProductDetailVariant, c7 as ProductDetailVariantOptionValue, c8 as ProductDetailVideo, c9 as ProductHrefGroup, ca as ProductHrefOptions, cb as ProductHrefProduct, cc as ProductListingCard, cd as ProductListingCardOptions, ce as ProductListingCardPriceRange, cf as ProductListingCardRepresentativeVariant, cg as ProductListingGroup, ch as ProductListingGroupCatalogSummary, ci as ProductListingGroupCatalogVariant, cj as ProductListingGroupProjection, ck as ProductListingGroupSummary, cl as ProductListingGroupVariant, aS as ProductListingGroupsCatalogItem, cm as ProductListingGroupsCatalogProduct, cn as ProductListingGroupsCatalogResponse, aU as ProductListingGroupsItem, co as ProductListingGroupsProduct, cp as ProductListingGroupsResponse, aM as ProductListingPageBaseParams, aQ as ProductListingPageCatalogParams, cq as ProductListingPageFilters, aT as ProductListingPageFullParams, aN as ProductListingPageParams, aR as ProductListingPageResult, cr as ProductListingPageSort, cs as ProductListingProductShape, ct as ProductListingSwatch, cu as ProductMediaResolutionSource, cv as ProductMoneyRange, cw as ProductOptionMatrix, cx as ProductOptionMatrixOption, cy as ProductOptionMatrixValue, cz as ProductOptionMatrixVariant, cA as ProductOptionShape, cB as ProductOptionValueShape, cC as ProductOptionValueSwatch, cD as ProductOptionValueSwatchInput, cE as ProductPriceRange, cF as ProductSelectionAvailableSwatch, cG as ProductSelectionAvailableValue, cH as ProductSelectionByOptionValue, cI as ProductSelectionCodecError, cJ as ProductSelectionCodecOptions, cK as ProductSelectionInput, cL as ProductSelectionOptionValue, cM as ProductSelectionResolution, cN as ProductSelectionResolutionContext, cO as ProductSelectionUrlEmit, cP as ProductSelectionVariant, cQ as ProductUpsertFieldValidationErrorBody, cR as ProductUpsertFieldValidationErrorReason, cS as ProductVariantShape, p as PublicCart, q as PublicCartItem, r as PublicCartReference, s as PublicMediaAsset, t as PublicMediaSize, u as PublicOrder, v as PublicOrderItem, w as PublicOrderReference, aD as PublicReadQueryOptions, R as RemoveDiscountParams, x as RemoveItemParams, cT as RequestOptions, cU as ResolveCancelRefundFailedResponse, cV as ResolveCancelRefundOutcome, cW as ResolveCancelRefundParams, cX as ResolveCancelRefundResponse, cY as ResolveCancelRefundSucceededResponse, cZ as ResolveProductDisplayMediaInput, c_ as ResolveProductDisplayMediaResult, y as RetryConfig, c$ as ReturnItem, d0 as ReturnReason, d1 as ReturnWithRefundItem, d2 as ReturnWithRefundParams, z as RootClient, B as RootCollectionClient, F as RootReadOnlyQueryBuilder, d3 as ShippingApi, d4 as ShippingApiOptions, S as Sort, d5 as StockCheckParams, d6 as StockCheckResponse, d7 as StockCheckResult, d8 as StockSnapshotItem, d9 as StockSnapshotParams, G as StorefrontContentListOptions, H as StorefrontContentReference, I as StorefrontGalleryItem, J as StorefrontGalleryItemsListOptions, K as StorefrontGalleryItemsSort, L as StorefrontLink, M as StorefrontLinksListOptions, N as StorefrontLinksSort, da as TransactionStatus, db as UpdateFulfillmentParams, U as UpdateItemParams, dc as UpdateOrderParams, aL as UpdateProfileData, dd as UpdateReturnParams, de as UpdateTransactionParams, df as ValidateDiscountParams, dg as ValidateDiscountResult, W as Where, dh as WithIdempotencyKey, di as buildProductHref, dj as buildProductListingCard, dk as buildProductListingGroupProjection, dl as buildProductListingGroupsByOption, dm as buildProductOptionMatrix, dn as buildProductOptionMatrixFromDetail, dp as createProductSelectionCodec, dq as getAvailableOptionValues, dr as getProductSelectionImages, ds as getSelectedValueByOptionId, dt as getVariantAvailableForSale, du as getVariantAvailableStock, dv as isProductUpsertFieldValidationErrorBody, dw as normalizeProductSelection, dx as normalizeProductSelectionFromMatrix, dy as normalizeSelectedValueIds, dz as parseProductSelection, dA as projectProductToListingShape, dB as resolveFeaturedImagePointer, dC as resolveProductDisplayMedia, dD as resolveProductSelection, dE as resolveProductSelectionFromMatrix, dF as resolveProductSelectionMedia, dG as resolveVariantForSelection, dH as selectNext, dI as selectedSwatchMediaItemId, dJ as stringifyProductSelection, dK as toShopifyPriceRangeV2 } from './types-B9lGhZlB.js';
|
|
3
|
+
import { P as Product } from './payload-types-DLxkB7Mv.js';
|
|
4
|
+
export { A as Article, e as ArticleAuthor, f as ArticleCategory, g as ArticleTag, h as Cart, i as CartItem, D as Document, I as Image, O as Order, j as Post, k as PostCategory, l as ProductVariant, T as Tenant, m as Transaction, V as Video } from './payload-types-DLxkB7Mv.js';
|
|
5
|
+
export { C as CollectionType, P as Product, a as ProductCollection } from './types-BiKNBwRA.js';
|
|
6
|
+
export { C as COMMERCE_NOTIFICATION_EVENTS, a as COMMERCE_NOTIFICATION_EVENT_TYPE, b as COMMERCE_NOTIFICATION_OPERATION, c as CUSTOMER_PASSWORD_RESET_OPERATION, d as CollectionWebhookOperation, e as CommerceEmailChannel, f as CommerceEmailConfig, g as CommerceEmailEventConfig, h as CommerceEmailEventHandlers, i as CommerceEmailHandlerContext, j as CommerceNotification, k as CommerceNotificationData, l as CommerceNotificationEventHandlers, m as CommerceNotificationEventName, n as CommerceNotificationHandlerContext, o as CommerceNotificationSource, p as CommerceNotificationSourceCollection, q as CommerceNotificationWebhookEvent, r as CustomerAuthWebhookEvent, s as CustomerAuthWebhookHandlers, t as CustomerPasswordResetWebhookData, u as CustomerPasswordResetWebhookEvent, O as ORDER_CHANGED_EVENT_TYPE, v as OrderChangedWebhookEvent, W as WebhookChange, w as WebhookCommerceNotificationChange, x as WebhookEvent, y as WebhookHandler, z as WebhookKnownOperation, A as WebhookOperation, B as WebhookOptions, D as WebhookOrderChange, E as WebhookOrderMoved, F as WebhookOrderScope, G as createCommerceEmailWebhookHandler, H as createCommerceNotificationWebhookHandler, I as createCustomerAuthWebhookHandler, J as createTypedWebhookHandler, K as defineCommerceEmailConfig, L as getCommerceNotificationIdempotencyKey, M as handleWebhook, N as isCommerceNotificationWebhookEvent, P as isCustomerPasswordResetWebhookEvent, Q as isOrderChangedWebhookEvent, R as isValidWebhookEvent, S as isWebhookCollection, T as isWebhookOperation } from './index-DPi5NWU8.js';
|
|
7
|
+
export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS, P as PublicCollection, b as SERVER_COLLECTIONS, c as SERVER_ONLY_COLLECTIONS } from './const-_WWHU-gX.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 ImageDataSizeEntry, c as ImageDataSizes, d as ImagePalette, e as ImagePlaceholderOptions, g as getImageLqip, f as getImagePalette, h as getImagePlaceholderStyle, i as getImageSrcSet, j as getImageUrl } from './image-BDjHp03R.js';
|
|
10
10
|
export { V as VideoGifOptions, a as VideoThumbnailOptions, g as getVideoGif, b as getVideoMp4Url, c as getVideoStoryboard, d as getVideoStreamUrl, e as getVideoThumbnail } from './video-WR_TFO9a.js';
|
|
11
11
|
export { Analytics, AnalyticsConfig, createAnalytics } from './analytics.js';
|
|
12
12
|
export { ApiError, AuthError, ConfigError, ConflictError, GoneError, NetworkError, NotFoundError, PermissionError, RateLimitError, SDKError, ServiceUnavailableError, TimeoutError, UsageLimitError, ValidationError, createAuthError, createConflictError, createNotFoundError, createPermissionError, createRateLimitError, isApiError, isAuthError, isConfigError, isConflictError, isGoneError, isNetworkError, isNotFoundError, isPermissionError, isRateLimitError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError } from './errors.js';
|
|
13
13
|
|
|
14
|
+
type MembershipApiOptions = ServerApiOptions;
|
|
15
|
+
/**
|
|
16
|
+
* Server-only (secret-key) API for membership lifecycle operations.
|
|
17
|
+
*
|
|
18
|
+
* subscribe / cancel are sk-only (admin-sk-only policy).
|
|
19
|
+
* me is also exposed on the browser client (customer-JWT policy), but the
|
|
20
|
+
* server-side method reuses the same endpoint.
|
|
21
|
+
*/
|
|
22
|
+
declare class MembershipApi extends BaseApi {
|
|
23
|
+
constructor(options: MembershipApiOptions);
|
|
24
|
+
/**
|
|
25
|
+
* Record a delegated first-charge and activate a membership.
|
|
26
|
+
* The storefront collected the payment; this endpoint deduplicates by
|
|
27
|
+
* `subscribeIntentKey` and records the already-paid charge.
|
|
28
|
+
*
|
|
29
|
+
* `subscribeIntentKey` is used as the HTTP idempotency key so the call is
|
|
30
|
+
* safely retryable.
|
|
31
|
+
*/
|
|
32
|
+
subscribe(params: SubscribeMembershipParams): Promise<SubscribeMembershipResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Cancel a membership by id.
|
|
35
|
+
* `immediate=false` (default) sets `cancelAtPeriodEnd`; the customer retains
|
|
36
|
+
* benefits until `currentPeriodEnd`. `immediate=true` cancels now and revokes
|
|
37
|
+
* membership groups immediately.
|
|
38
|
+
*/
|
|
39
|
+
cancel(params: CancelMembershipParams): Promise<CancelMembershipResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* Retrieve the authenticated customer's own membership view.
|
|
42
|
+
* Never returns payment tokens or internal keys.
|
|
43
|
+
*/
|
|
44
|
+
me(): Promise<CustomerMembershipView | null>;
|
|
45
|
+
}
|
|
46
|
+
|
|
14
47
|
type ProductDetailStockMergeStatus = 'complete' | 'partial';
|
|
15
48
|
interface MergedProductDetailResult {
|
|
16
49
|
stockMergeStatus: ProductDetailStockMergeStatus;
|
|
@@ -97,4 +130,4 @@ declare function resolveRelation<T>(ref: unknown): T | null;
|
|
|
97
130
|
|
|
98
131
|
declare function createClient(options: ClientConfig): RootClientWithEvents;
|
|
99
132
|
|
|
100
|
-
export { ClientConfig, type MediaPointerSource, type MergedProductDetailResult, ProductDetail, ProductDetailCatalog, type ProductDetailStockMergeStatus, ProductDisplayMediaSource, type ProductGallerySource, type ProductMediaSetInput, type ProductMediaSetMatchType, ProductSelectionMediaPointer, ProductSelectionMediaSource, type ResolveProductGalleryInput, type ResolveProductGalleryResult, type ResolveProductMediaInput, type ResolveProductMediaResult, ResolveProductSelectionMediaInput, ResolveProductSelectionMediaResult, RootClientWithEvents, StockSnapshotResponse, createClient, formatOrderName, generateOrderNumber, mergeProductDetailWithStock, resolveProductGallery, resolveProductMedia, resolveRelation };
|
|
133
|
+
export { BaseApi, CancelMembershipParams, CancelMembershipResponse, ClientConfig, CustomerMembershipView, type MediaPointerSource, MembershipApi, type MembershipApiOptions, type MergedProductDetailResult, ProductDetail, ProductDetailCatalog, type ProductDetailStockMergeStatus, ProductDisplayMediaSource, type ProductGallerySource, type ProductMediaSetInput, type ProductMediaSetMatchType, ProductSelectionMediaPointer, ProductSelectionMediaSource, type ResolveProductGalleryInput, type ResolveProductGalleryResult, type ResolveProductMediaInput, type ResolveProductMediaResult, ResolveProductSelectionMediaInput, ResolveProductSelectionMediaResult, RootClientWithEvents, ServerApiOptions, StockSnapshotResponse, SubscribeMembershipParams, SubscribeMembershipResponse, createClient, formatOrderName, generateOrderNumber, mergeProductDetailWithStock, resolveProductGallery, resolveProductMedia, resolveRelation };
|
package/dist/index.js
CHANGED
|
@@ -685,6 +685,64 @@ async function httpFetch(url, options) {
|
|
|
685
685
|
throw lastError ?? new NetworkError("Request failed after retries");
|
|
686
686
|
}
|
|
687
687
|
|
|
688
|
+
// src/core/api/endpoints.ts
|
|
689
|
+
var COMMERCE_ENDPOINTS = {
|
|
690
|
+
orders: {
|
|
691
|
+
create: "/api/orders/create",
|
|
692
|
+
update: "/api/orders/update",
|
|
693
|
+
confirmPayment: "/api/orders/confirm-payment",
|
|
694
|
+
byPayment: "/api/orders/by-payment",
|
|
695
|
+
cancel: "/api/orders/cancel",
|
|
696
|
+
resolveCancelRefund: "/api/orders/resolve-cancel-refund",
|
|
697
|
+
checkout: "/api/orders/checkout",
|
|
698
|
+
createFulfillment: "/api/orders/create-fulfillment",
|
|
699
|
+
updateFulfillment: "/api/orders/update-fulfillment"
|
|
700
|
+
},
|
|
701
|
+
transactions: {
|
|
702
|
+
update: "/api/transactions/update"
|
|
703
|
+
},
|
|
704
|
+
returns: {
|
|
705
|
+
create: "/api/returns/create",
|
|
706
|
+
update: "/api/returns/update",
|
|
707
|
+
returnRefund: "/api/returns/return-refund"
|
|
708
|
+
},
|
|
709
|
+
fulfillmentOrders: {
|
|
710
|
+
prepare: "/api/fulfillment-orders/prepare-fulfillment-order"
|
|
711
|
+
},
|
|
712
|
+
fulfillments: {
|
|
713
|
+
bulkImport: "/api/fulfillments/bulk-import"
|
|
714
|
+
},
|
|
715
|
+
carts: {
|
|
716
|
+
mine: "/api/carts/mine",
|
|
717
|
+
merge: "/api/carts/merge",
|
|
718
|
+
addItem: "/api/carts/add-item",
|
|
719
|
+
updateItem: "/api/carts/update-item",
|
|
720
|
+
removeItem: "/api/carts/remove-item",
|
|
721
|
+
applyDiscount: "/api/carts/apply-discount",
|
|
722
|
+
removeDiscount: "/api/carts/remove-discount",
|
|
723
|
+
clear: "/api/carts/clear"
|
|
724
|
+
},
|
|
725
|
+
products: {
|
|
726
|
+
stockCheck: "/api/products/stock-check",
|
|
727
|
+
stockSnapshot: "/api/products/stock",
|
|
728
|
+
listingGroups: "/api/products/listing-groups",
|
|
729
|
+
listingGroupsCatalog: "/api/products/listing-groups/catalog",
|
|
730
|
+
listingGroupsQuery: "/api/products/listing-groups/query",
|
|
731
|
+
listingGroupsQueryCatalog: "/api/products/listing-groups/query/catalog",
|
|
732
|
+
detail: "/api/products/detail",
|
|
733
|
+
detailCatalog: "/api/products/detail/catalog",
|
|
734
|
+
upsert: "/api/products/upsert"
|
|
735
|
+
}
|
|
736
|
+
};
|
|
737
|
+
var COMMERCE_ENDPOINT_PATHS = Object.values(
|
|
738
|
+
COMMERCE_ENDPOINTS
|
|
739
|
+
).flatMap((group) => Object.values(group));
|
|
740
|
+
var MEMBERSHIP_ENDPOINTS = {
|
|
741
|
+
subscribe: "/api/memberships/subscribe",
|
|
742
|
+
cancel: (id) => `/api/memberships/${id}/cancel`,
|
|
743
|
+
me: "/api/memberships/me"
|
|
744
|
+
};
|
|
745
|
+
|
|
688
746
|
// src/core/internal/utils/query-string.ts
|
|
689
747
|
function productDetailQuery(params) {
|
|
690
748
|
const search = new URLSearchParams();
|
|
@@ -693,7 +751,7 @@ function productDetailQuery(params) {
|
|
|
693
751
|
} else {
|
|
694
752
|
search.set("id", params.id);
|
|
695
753
|
}
|
|
696
|
-
return
|
|
754
|
+
return `${COMMERCE_ENDPOINTS.products.detail}?${search}`;
|
|
697
755
|
}
|
|
698
756
|
function productDetailCatalogQuery(params) {
|
|
699
757
|
const search = new URLSearchParams();
|
|
@@ -702,20 +760,17 @@ function productDetailCatalogQuery(params) {
|
|
|
702
760
|
} else {
|
|
703
761
|
search.set("id", params.id);
|
|
704
762
|
}
|
|
705
|
-
return
|
|
763
|
+
return `${COMMERCE_ENDPOINTS.products.detailCatalog}?${search}`;
|
|
706
764
|
}
|
|
707
765
|
function listingGroupsCatalogQuery(params) {
|
|
708
|
-
return
|
|
766
|
+
return `${COMMERCE_ENDPOINTS.products.listingGroupsCatalog}?ids=${params.productIds.map(encodeURIComponent).join(",")}`;
|
|
709
767
|
}
|
|
710
768
|
function appendListingGroupsQuerySearchParams(search, options) {
|
|
711
769
|
if (options?.page != null) search.set("page", String(options.page));
|
|
712
770
|
if (options?.limit != null) search.set("limit", String(options.limit));
|
|
713
771
|
if (options?.sort != null) {
|
|
714
772
|
const sort = options.sort;
|
|
715
|
-
search.set(
|
|
716
|
-
"sort",
|
|
717
|
-
Array.isArray(sort) ? sort.join(",") : sort
|
|
718
|
-
);
|
|
773
|
+
search.set("sort", Array.isArray(sort) ? sort.join(",") : sort);
|
|
719
774
|
}
|
|
720
775
|
if (options?.where != null) {
|
|
721
776
|
search.set("whereJson", JSON.stringify(options.where));
|
|
@@ -725,16 +780,16 @@ function listingGroupsQueryUrl(options) {
|
|
|
725
780
|
const search = new URLSearchParams();
|
|
726
781
|
appendListingGroupsQuerySearchParams(search, options);
|
|
727
782
|
const query = search.toString();
|
|
728
|
-
return
|
|
783
|
+
return `${COMMERCE_ENDPOINTS.products.listingGroupsQuery}${query ? `?${query}` : ""}`;
|
|
729
784
|
}
|
|
730
785
|
function listingGroupsQueryCatalogUrl(options) {
|
|
731
786
|
const search = new URLSearchParams();
|
|
732
787
|
appendListingGroupsQuerySearchParams(search, options);
|
|
733
788
|
const query = search.toString();
|
|
734
|
-
return
|
|
789
|
+
return `${COMMERCE_ENDPOINTS.products.listingGroupsQueryCatalog}${query ? `?${query}` : ""}`;
|
|
735
790
|
}
|
|
736
791
|
function stockSnapshotQuery(params) {
|
|
737
|
-
return
|
|
792
|
+
return `${COMMERCE_ENDPOINTS.products.stockSnapshot}?variantIds=${params.variantIds.map(encodeURIComponent).join(",")}`;
|
|
738
793
|
}
|
|
739
794
|
|
|
740
795
|
// src/core/collection/http-client.ts
|
|
@@ -1630,48 +1685,6 @@ var CustomerNamespace = class {
|
|
|
1630
1685
|
}
|
|
1631
1686
|
};
|
|
1632
1687
|
|
|
1633
|
-
// src/core/api/endpoints.ts
|
|
1634
|
-
var COMMERCE_ENDPOINTS = {
|
|
1635
|
-
orders: {
|
|
1636
|
-
create: "/api/orders/create",
|
|
1637
|
-
update: "/api/orders/update",
|
|
1638
|
-
confirmPayment: "/api/orders/confirm-payment",
|
|
1639
|
-
byPayment: "/api/orders/by-payment",
|
|
1640
|
-
cancel: "/api/orders/cancel",
|
|
1641
|
-
resolveCancelRefund: "/api/orders/resolve-cancel-refund",
|
|
1642
|
-
checkout: "/api/orders/checkout",
|
|
1643
|
-
createFulfillment: "/api/orders/create-fulfillment",
|
|
1644
|
-
updateFulfillment: "/api/orders/update-fulfillment"
|
|
1645
|
-
},
|
|
1646
|
-
transactions: {
|
|
1647
|
-
update: "/api/transactions/update"
|
|
1648
|
-
},
|
|
1649
|
-
returns: {
|
|
1650
|
-
create: "/api/returns/create",
|
|
1651
|
-
update: "/api/returns/update",
|
|
1652
|
-
returnRefund: "/api/returns/return-refund"
|
|
1653
|
-
},
|
|
1654
|
-
fulfillmentOrders: {
|
|
1655
|
-
prepare: "/api/fulfillment-orders/prepare-fulfillment-order"
|
|
1656
|
-
},
|
|
1657
|
-
fulfillments: {
|
|
1658
|
-
bulkImport: "/api/fulfillments/bulk-import"
|
|
1659
|
-
},
|
|
1660
|
-
carts: {
|
|
1661
|
-
mine: "/api/carts/mine",
|
|
1662
|
-
merge: "/api/carts/merge",
|
|
1663
|
-
addItem: "/api/carts/add-item",
|
|
1664
|
-
updateItem: "/api/carts/update-item",
|
|
1665
|
-
removeItem: "/api/carts/remove-item",
|
|
1666
|
-
applyDiscount: "/api/carts/apply-discount",
|
|
1667
|
-
removeDiscount: "/api/carts/remove-discount",
|
|
1668
|
-
clear: "/api/carts/clear"
|
|
1669
|
-
}
|
|
1670
|
-
};
|
|
1671
|
-
var COMMERCE_ENDPOINT_PATHS = Object.values(
|
|
1672
|
-
COMMERCE_ENDPOINTS
|
|
1673
|
-
).flatMap((group) => Object.values(group));
|
|
1674
|
-
|
|
1675
1688
|
// src/core/api/cart-api.ts
|
|
1676
1689
|
var CartApi = class extends CustomerScopedApi {
|
|
1677
1690
|
constructor(options) {
|
|
@@ -3607,7 +3620,10 @@ var CommerceClient = class {
|
|
|
3607
3620
|
onRequestId: options.onRequestId
|
|
3608
3621
|
});
|
|
3609
3622
|
this.product = {
|
|
3610
|
-
stockCheck: (params) => api.post(
|
|
3623
|
+
stockCheck: (params) => api.post(
|
|
3624
|
+
COMMERCE_ENDPOINTS.products.stockCheck,
|
|
3625
|
+
params
|
|
3626
|
+
),
|
|
3611
3627
|
stockSnapshot: (params) => api.get(stockSnapshotQuery(params)),
|
|
3612
3628
|
listingGroups: (params) => api.get(
|
|
3613
3629
|
listingGroupsCatalogQuery(params)
|
|
@@ -3625,7 +3641,9 @@ var CommerceClient = class {
|
|
|
3625
3641
|
},
|
|
3626
3642
|
detail: async (params) => {
|
|
3627
3643
|
try {
|
|
3628
|
-
const product = await api.get(
|
|
3644
|
+
const product = await api.get(
|
|
3645
|
+
productDetailQuery(params)
|
|
3646
|
+
);
|
|
3629
3647
|
return { found: true, product };
|
|
3630
3648
|
} catch (err) {
|
|
3631
3649
|
const notFoundResult = productDetailResultFromError(err);
|
|
@@ -3673,7 +3691,10 @@ var CommerceClient = class {
|
|
|
3673
3691
|
validate: (params) => api.post("/api/discounts/validate", params)
|
|
3674
3692
|
};
|
|
3675
3693
|
this.shipping = {
|
|
3676
|
-
calculate: (params) => api.post(
|
|
3694
|
+
calculate: (params) => api.post(
|
|
3695
|
+
"/api/shipping-policies/calculate",
|
|
3696
|
+
params
|
|
3697
|
+
)
|
|
3677
3698
|
};
|
|
3678
3699
|
}
|
|
3679
3700
|
};
|
|
@@ -3762,8 +3783,12 @@ function buildGuestCancelRequestBody(token, params) {
|
|
|
3762
3783
|
}
|
|
3763
3784
|
function buildRangeEndpoint(params) {
|
|
3764
3785
|
const urlParams = new URLSearchParams();
|
|
3765
|
-
|
|
3766
|
-
|
|
3786
|
+
if (params.start !== void 0) {
|
|
3787
|
+
urlParams.set("start", formatDateParam(params.start));
|
|
3788
|
+
}
|
|
3789
|
+
if (params.end !== void 0) {
|
|
3790
|
+
urlParams.set("end", formatDateParam(params.end));
|
|
3791
|
+
}
|
|
3767
3792
|
if (params.limit !== void 0) urlParams.set("limit", String(params.limit));
|
|
3768
3793
|
if (params.page !== void 0) urlParams.set("page", String(params.page));
|
|
3769
3794
|
appendValues(urlParams, "calendar", params.calendar);
|
|
@@ -3786,6 +3811,13 @@ function appendValues(params, key, value) {
|
|
|
3786
3811
|
}
|
|
3787
3812
|
|
|
3788
3813
|
// src/core/client/client.ts
|
|
3814
|
+
var BrowserMembershipApi = class extends CustomerScopedApi {
|
|
3815
|
+
me() {
|
|
3816
|
+
return this.request(MEMBERSHIP_ENDPOINTS.me, {
|
|
3817
|
+
method: "GET"
|
|
3818
|
+
});
|
|
3819
|
+
}
|
|
3820
|
+
};
|
|
3789
3821
|
var Client = class {
|
|
3790
3822
|
constructor(options) {
|
|
3791
3823
|
this.lastRequestId = null;
|
|
@@ -3850,6 +3882,16 @@ var Client = class {
|
|
|
3850
3882
|
onRequestId,
|
|
3851
3883
|
this.config.apiUrl
|
|
3852
3884
|
);
|
|
3885
|
+
const membershipApi = new BrowserMembershipApi("MembershipApi", {
|
|
3886
|
+
publishableKey: this.config.publishableKey,
|
|
3887
|
+
apiUrl: this.config.apiUrl,
|
|
3888
|
+
customerToken: () => this.customer.auth.getToken(),
|
|
3889
|
+
onUnauthorized,
|
|
3890
|
+
onRequestId
|
|
3891
|
+
});
|
|
3892
|
+
this.memberships = {
|
|
3893
|
+
me: membershipApi.me.bind(membershipApi)
|
|
3894
|
+
};
|
|
3853
3895
|
}
|
|
3854
3896
|
getState() {
|
|
3855
3897
|
return { ...this.state };
|
|
@@ -3917,6 +3959,8 @@ var COMMERCE_NOTIFICATION_EVENTS = [
|
|
|
3917
3959
|
"fulfillmentShipped",
|
|
3918
3960
|
"orderDelivered",
|
|
3919
3961
|
"returnRequested",
|
|
3962
|
+
"returnApproved",
|
|
3963
|
+
"returnRejected",
|
|
3920
3964
|
"returnCompleted"
|
|
3921
3965
|
];
|
|
3922
3966
|
function isStringOrNumber(value) {
|
|
@@ -4005,7 +4049,7 @@ function isCommerceNotificationWebhookEvent(event) {
|
|
|
4005
4049
|
if (notification.event === "fulfillmentShipped") {
|
|
4006
4050
|
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);
|
|
4007
4051
|
}
|
|
4008
|
-
if (notification.event === "returnRequested" || notification.event === "returnCompleted") {
|
|
4052
|
+
if (notification.event === "returnRequested" || notification.event === "returnApproved" || notification.event === "returnRejected" || notification.event === "returnCompleted") {
|
|
4009
4053
|
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);
|
|
4010
4054
|
}
|
|
4011
4055
|
return false;
|
|
@@ -4188,7 +4232,9 @@ var INTERNAL_COLLECTIONS = [
|
|
|
4188
4232
|
"audit-logs",
|
|
4189
4233
|
"plans",
|
|
4190
4234
|
"webhooks",
|
|
4191
|
-
"event-registrations"
|
|
4235
|
+
"event-registrations",
|
|
4236
|
+
"customer-payment-methods",
|
|
4237
|
+
"tenant-payment-credentials"
|
|
4192
4238
|
];
|
|
4193
4239
|
var COLLECTIONS = [
|
|
4194
4240
|
"tenants",
|
|
@@ -4200,6 +4246,7 @@ var COLLECTIONS = [
|
|
|
4200
4246
|
"product-categories",
|
|
4201
4247
|
"product-tags",
|
|
4202
4248
|
"product-collections",
|
|
4249
|
+
"markets",
|
|
4203
4250
|
"brands",
|
|
4204
4251
|
"customer-profiles",
|
|
4205
4252
|
"customer-profile-stats",
|
|
@@ -4244,7 +4291,9 @@ var COLLECTIONS = [
|
|
|
4244
4291
|
"events",
|
|
4245
4292
|
"event-categories",
|
|
4246
4293
|
"event-occurrences",
|
|
4247
|
-
"event-tags"
|
|
4294
|
+
"event-tags",
|
|
4295
|
+
"membership-plans",
|
|
4296
|
+
"customer-memberships"
|
|
4248
4297
|
];
|
|
4249
4298
|
var SERVER_ONLY_COLLECTIONS = [
|
|
4250
4299
|
"tenant-logos",
|
|
@@ -4277,7 +4326,8 @@ var SERVER_ONLY_COLLECTIONS = [
|
|
|
4277
4326
|
"customer-groups",
|
|
4278
4327
|
"reports",
|
|
4279
4328
|
"community-bans",
|
|
4280
|
-
"order-export-profiles"
|
|
4329
|
+
"order-export-profiles",
|
|
4330
|
+
"membership-charges"
|
|
4281
4331
|
];
|
|
4282
4332
|
var SERVER_COLLECTIONS = [
|
|
4283
4333
|
...COLLECTIONS,
|