@01.software/sdk 0.40.0 → 0.41.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 +492 -0
- package/MIGRATION.md +183 -0
- package/README.md +12 -1
- package/dist/client.cjs +4 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +3 -3
- package/dist/client.d.ts +3 -3
- package/dist/client.js +4 -1
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-VYwYi6u6.d.cts → collection-client-Bymfni8u.d.cts} +1 -1
- package/dist/{collection-client-CKFa99C6.d.ts → collection-client-CN4lj6gi.d.ts} +1 -1
- package/dist/index.cjs +18 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/query.d.cts +2 -2
- package/dist/query.d.ts +2 -2
- package/dist/server.cjs +4 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +4 -1
- package/dist/server.js.map +1 -1
- package/dist/{types-D5uHrPLr.d.cts → types-Bl-m9ttd.d.cts} +31 -1
- package/dist/{types-Umd-YTjM.d.ts → types-CHrzs2GB.d.ts} +31 -1
- package/package.json +6 -4
|
@@ -1381,6 +1381,22 @@ type ProductListingCardOptions = {
|
|
|
1381
1381
|
preferCompleteVariantFromHint?: boolean;
|
|
1382
1382
|
};
|
|
1383
1383
|
declare function buildProductHref(product: ProductHrefProduct, group?: ProductHrefGroup | null, options?: ProductHrefOptions): string;
|
|
1384
|
+
/**
|
|
1385
|
+
* Server-equivalent sellability for a single variant: active, and either
|
|
1386
|
+
* unlimited or with positive sellable stock (`stock - reservedStock`). This is
|
|
1387
|
+
* the same rule the SDK applies when rolling availability up to the product, so
|
|
1388
|
+
* storefronts can compute a Shopify-style `availableForSale` without
|
|
1389
|
+
* re-implementing the check or shipping raw `stock`/`reservedStock` to the
|
|
1390
|
+
* browser.
|
|
1391
|
+
*/
|
|
1392
|
+
declare function getVariantAvailableForSale(variant: ProductVariantShape): boolean;
|
|
1393
|
+
/**
|
|
1394
|
+
* Sellable quantity for a single variant (`stock - reservedStock`, clamped at
|
|
1395
|
+
* zero), or `null` when the variant is unlimited and has no finite quantity.
|
|
1396
|
+
* Mirrors Shopify's `ProductVariant.quantityAvailable` (a single computed
|
|
1397
|
+
* number, never the raw stock/reserved breakdown).
|
|
1398
|
+
*/
|
|
1399
|
+
declare function getVariantAvailableStock(variant: ProductVariantShape): number | null;
|
|
1384
1400
|
declare function buildProductListingGroupProjection(product: ProductListingProductShape | null | undefined, variants: ProductVariantShape[]): ProductListingGroupProjection;
|
|
1385
1401
|
declare function buildProductListingCard(item: ProductListingCardSourceItem, options?: ProductListingCardOptions): ProductListingCard;
|
|
1386
1402
|
/** Shopify `priceRangeV2` naming for persisted listing projection fields. */
|
|
@@ -1414,6 +1430,20 @@ declare function toShopifyPriceRangeV2(listing: {
|
|
|
1414
1430
|
* raw reads are constrained to `depth: 0`, `joins: false`, and no `populate`.
|
|
1415
1431
|
*/
|
|
1416
1432
|
declare const PRODUCT_PLP_FIND_OPTIONS: ApiQueryOptions;
|
|
1433
|
+
/**
|
|
1434
|
+
* Adapts a raw Payload product document (from
|
|
1435
|
+
* `collections.from('products').find()`) into the listing shape the SDK
|
|
1436
|
+
* listing builders consume. A raw product already carries `priceRange`,
|
|
1437
|
+
* `compareAtPriceRange`, `availableForSale`, and `selectedOrFirstAvailableVariant`,
|
|
1438
|
+
* but it has no `featuredImage` field — only the `images` gallery. This pure,
|
|
1439
|
+
* non-lossy adapter fills `featuredImage` from the first non-null gallery image
|
|
1440
|
+
* (when not already set) so SSG/sitemap consumers on the raw `find()` escape
|
|
1441
|
+
* hatch can feed `buildProductListingGroupsByOption` / `buildProductListingCard`
|
|
1442
|
+
* without hand-rolling the projection. An explicit `featuredImage` is preserved.
|
|
1443
|
+
*/
|
|
1444
|
+
declare function projectProductToListingShape<T extends ProductListingProductShape>(product: T): T & {
|
|
1445
|
+
featuredImage: MediaValue;
|
|
1446
|
+
};
|
|
1417
1447
|
/**
|
|
1418
1448
|
* Builds product-first listing groups for one primary option.
|
|
1419
1449
|
*
|
|
@@ -2577,4 +2607,4 @@ type DeepPartial<T> = {
|
|
|
2577
2607
|
};
|
|
2578
2608
|
type ExtractArrayType<T> = T extends (infer U)[] ? U : never;
|
|
2579
2609
|
|
|
2580
|
-
export { type CollectionFieldSchema as $, type AddItemParams as A, type RootReadOnlyQueryBuilder as B, CommerceClient as C, type DebugConfig as D, EventsClient as E, type StorefrontContentListOptions as F, type StorefrontContentReference as G, type StorefrontGalleryItem as H, type StorefrontGalleryItemsListOptions as I, type StorefrontGalleryItemsSort as J, type StorefrontLink as K, type StorefrontLinksListOptions as L, type StorefrontLinksSort as M, BaseApi as N, type ServerApiOptions as O, type PayloadFindResponse as P, ServerCommerceClient as Q, type RemoveDiscountParams as R, type Sort as S, type TenantIntrospectionClient as T, type UpdateItemParams as U, type BanCustomerParams as V, type Where as W, type CommunityBan as X, type UnbanCustomerParams as Y, type ClientServerConfig as Z, type RootServerClientWithEvents as _, CommunityClient as a, type CalculateShippingResult as a$, type CollectionSchemaResponse as a0, type EventGuestCancelParams as a1, type EventGuestRegistration as a2, type EventGuestRegistrationResponse as a3, type EventRegistrationAnswerInput as a4, type EventRegistrationAttendeeInput as a5, type EventRegistrationPublic as a6, type EventRegistrationRegisterParams as a7, type EventRegistrationRegisterResponse as a8, type EventsCalendarItem as a9, type CustomerAuthResponse as aA, type CustomerLoginData as aB, type CustomerRegisterResponse as aC, type CustomerRegisterData as aD, type CustomerRefreshResponse as aE, type UpdateProfileData as aF, type ProductListingPageBaseParams as aG, type ProductListingPageParams as aH, type ProductDetailParams as aI, type ProductDetailResult as aJ, type ProductListingPageCatalogParams as aK, type ProductListingPageResult as aL, type ProductListingGroupsCatalogItem as aM, type ProductListingPageFullParams as aN, type ProductListingGroupsItem as aO, type ProductDetail as aP, type ProductDetailCatalog as aQ, type StockSnapshotResponse as aR, type ProductSelectionMediaSource as aS, type ProductDisplayMediaSource as aT, type ResolveProductSelectionMediaInput as aU, type ResolveProductSelectionMediaResult as aV, type ProductSelectionMediaPointer as aW, type RootClientWithEvents as aX, type BulkImportFulfillmentsParams as aY, type BulkImportFulfillmentsResponse as aZ, type CalculateShippingParams as a_, type EventsClientOptions as aa, type EventsDateParam as ab, type EventsExternalSource as ac, type EventsLocation as ad, type EventsOccurrenceLocation as ae, type EventsRangeEvent as af, type EventsRangeOccurrence as ag, type EventsRangeParams as ah, type EventsRangeResponse as ai, type EventsTaxonomyItem as aj, ModerationApi as ak, type RootServerClient as al, type TenantFeatureProgressEvidenceValue as am, type TenantFeatureProgressFeature as an, type TenantFeatureProgressGroup as ao, type TenantFeatureProgressInput as ap, type TenantFeatureProgressItem as aq, type TenantFeatureProgressItemState as ar, type TenantFeatureProgressResponse as as, type TenantFeatureProgressSeverity as at, type TenantFeatureProgressStatus as au, TenantIntrospectionApi as av, type TenantIntrospectionApiOptions as aw, type PublicReadQueryOptions as ax, CustomerAuth as ay, type CustomerProfile as az, ContentClient as b, type ProductListingCardOptions as b$, type CancelOrderParams as b0, type CancelOrderReconciliationStatus as b1, type CancelOrderResponse as b2, type CancelReasonCode as b3, CartApi as b4, type CartApiOptions as b5, type Comment as b6, type CommerceClientOptions as b7, type CommunityClientOptions as b8, type CommunityComment as b9, OrderApi as bA, type OrderApiOptions as bB, PRODUCT_PLP_FIND_OPTIONS as bC, PRODUCT_UPSERT_READONLY_FIELD_REASON as bD, PRODUCT_UPSERT_UNKNOWN_FIELD_REASON as bE, type PrepareFulfillmentOrderParams as bF, type PrepareFulfillmentOrderResponse as bG, ProductApi as bH, type ProductApiOptions as bI, type ProductDetailBrand as bJ, type ProductDetailCatalogResult as bK, type ProductDetailCatalogVariant as bL, type ProductDetailCategory as bM, type ProductDetailImage as bN, type ProductDetailImageMedia as bO, type ProductDetailMedia as bP, type ProductDetailOption as bQ, type ProductDetailOptionValue as bR, type ProductDetailTag as bS, type ProductDetailUnavailableReason as bT, type ProductDetailVariant as bU, type ProductDetailVariantOptionValue as bV, type ProductDetailVideo as bW, type ProductHrefGroup as bX, type ProductHrefOptions as bY, type ProductHrefProduct as bZ, type ProductListingCard as b_, type CommunityCommentListSort as ba, type CommunityPost as bb, type CommunityPostCategory as bc, type CommunityPostListSort as bd, type CommunityPostTag as be, type CommunityPublicAuthorSnapshot as bf, type CommunityPublicMediaAsset as bg, type CommunityPublicReference as bh, type CompatibilityProductSelectionParamEvent as bi, type ConfirmPaymentParams as bj, type ConfirmPaymentResponse as bk, type CreateFulfillmentParams as bl, type CreateOrderItem as bm, type CreateOrderParams as bn, type CreateReturnParams as bo, type CustomerAuthOptions as bp, type CustomerOrderListOptions as bq, type CustomerSnapshot as br, DiscountApi as bs, type DiscountApiOptions as bt, type FeaturedImagePointerInput as bu, type LegacyProductSelectionParamEvent as bv, type ListingGroupsParams as bw, type MediaValue as bx, type NormalizedOptionSwatch as by, type NormalizedProductSelection as bz, CustomerNamespace as c, type UpdateTransactionParams as c$, type ProductListingCardPriceRange as c0, type ProductListingCardRepresentativeVariant as c1, type ProductListingGroup as c2, type ProductListingGroupCatalogSummary as c3, type ProductListingGroupCatalogVariant as c4, type ProductListingGroupProjection as c5, type ProductListingGroupSummary as c6, type ProductListingGroupVariant as c7, type ProductListingGroupsCatalogProduct as c8, type ProductListingGroupsCatalogResponse as c9, type ProductSelectionUrlEmit as cA, type ProductSelectionVariant as cB, type ProductUpsertFieldValidationErrorBody as cC, type ProductUpsertFieldValidationErrorReason as cD, type ProductVariantShape as cE, type RequestOptions as cF, type ResolveCancelRefundFailedResponse as cG, type ResolveCancelRefundOutcome as cH, type ResolveCancelRefundParams as cI, type ResolveCancelRefundResponse as cJ, type ResolveCancelRefundSucceededResponse as cK, type ResolveProductDisplayMediaInput as cL, type ResolveProductDisplayMediaResult as cM, type ReturnItem as cN, type ReturnReason as cO, type ReturnWithRefundItem as cP, type ReturnWithRefundParams as cQ, ShippingApi as cR, type ShippingApiOptions as cS, type StockCheckParams as cT, type StockCheckResponse as cU, type StockCheckResult as cV, type StockSnapshotItem as cW, type StockSnapshotParams as cX, type UpdateFulfillmentParams as cY, type UpdateOrderParams as cZ, type UpdateReturnParams as c_, type ProductListingGroupsProduct as ca, type ProductListingGroupsResponse as cb, type ProductListingPageFilters as cc, type ProductListingPageSort as cd, type ProductListingProductShape as ce, type ProductListingSwatch as cf, type ProductMediaResolutionSource as cg, type ProductMoneyRange as ch, type ProductOptionMatrix as ci, type ProductOptionMatrixOption as cj, type ProductOptionMatrixValue as ck, type ProductOptionMatrixVariant as cl, type ProductOptionShape as cm, type ProductOptionValueShape as cn, type ProductOptionValueSwatch as co, type ProductOptionValueSwatchInput as cp, type ProductPriceRange as cq, type ProductSelectionAvailableSwatch as cr, type ProductSelectionAvailableValue as cs, type ProductSelectionByOptionValue as ct, ProductSelectionCodecError as cu, type ProductSelectionCodecOptions as cv, type ProductSelectionInput as cw, type ProductSelectionOptionValue as cx, type ProductSelectionResolution as cy, type ProductSelectionResolutionContext as cz, type ClientState as d, type ValidateDiscountParams as d0, type ValidateDiscountResult as d1, type WithIdempotencyKey as d2, buildProductHref as d3, buildProductListingCard as d4, buildProductListingGroupProjection as d5, buildProductListingGroupsByOption as d6, buildProductOptionMatrix as d7, buildProductOptionMatrixFromDetail as d8, createProductSelectionCodec as d9, getAvailableOptionValues as da, getProductSelectionImages as db, getSelectedValueByOptionId as dc,
|
|
2610
|
+
export { type CollectionFieldSchema as $, type AddItemParams as A, type RootReadOnlyQueryBuilder as B, CommerceClient as C, type DebugConfig as D, EventsClient as E, type StorefrontContentListOptions as F, type StorefrontContentReference as G, type StorefrontGalleryItem as H, type StorefrontGalleryItemsListOptions as I, type StorefrontGalleryItemsSort as J, type StorefrontLink as K, type StorefrontLinksListOptions as L, type StorefrontLinksSort as M, BaseApi as N, type ServerApiOptions as O, type PayloadFindResponse as P, ServerCommerceClient as Q, type RemoveDiscountParams as R, type Sort as S, type TenantIntrospectionClient as T, type UpdateItemParams as U, type BanCustomerParams as V, type Where as W, type CommunityBan as X, type UnbanCustomerParams as Y, type ClientServerConfig as Z, type RootServerClientWithEvents as _, CommunityClient as a, type CalculateShippingResult as a$, type CollectionSchemaResponse as a0, type EventGuestCancelParams as a1, type EventGuestRegistration as a2, type EventGuestRegistrationResponse as a3, type EventRegistrationAnswerInput as a4, type EventRegistrationAttendeeInput as a5, type EventRegistrationPublic as a6, type EventRegistrationRegisterParams as a7, type EventRegistrationRegisterResponse as a8, type EventsCalendarItem as a9, type CustomerAuthResponse as aA, type CustomerLoginData as aB, type CustomerRegisterResponse as aC, type CustomerRegisterData as aD, type CustomerRefreshResponse as aE, type UpdateProfileData as aF, type ProductListingPageBaseParams as aG, type ProductListingPageParams as aH, type ProductDetailParams as aI, type ProductDetailResult as aJ, type ProductListingPageCatalogParams as aK, type ProductListingPageResult as aL, type ProductListingGroupsCatalogItem as aM, type ProductListingPageFullParams as aN, type ProductListingGroupsItem as aO, type ProductDetail as aP, type ProductDetailCatalog as aQ, type StockSnapshotResponse as aR, type ProductSelectionMediaSource as aS, type ProductDisplayMediaSource as aT, type ResolveProductSelectionMediaInput as aU, type ResolveProductSelectionMediaResult as aV, type ProductSelectionMediaPointer as aW, type RootClientWithEvents as aX, type BulkImportFulfillmentsParams as aY, type BulkImportFulfillmentsResponse as aZ, type CalculateShippingParams as a_, type EventsClientOptions as aa, type EventsDateParam as ab, type EventsExternalSource as ac, type EventsLocation as ad, type EventsOccurrenceLocation as ae, type EventsRangeEvent as af, type EventsRangeOccurrence as ag, type EventsRangeParams as ah, type EventsRangeResponse as ai, type EventsTaxonomyItem as aj, ModerationApi as ak, type RootServerClient as al, type TenantFeatureProgressEvidenceValue as am, type TenantFeatureProgressFeature as an, type TenantFeatureProgressGroup as ao, type TenantFeatureProgressInput as ap, type TenantFeatureProgressItem as aq, type TenantFeatureProgressItemState as ar, type TenantFeatureProgressResponse as as, type TenantFeatureProgressSeverity as at, type TenantFeatureProgressStatus as au, TenantIntrospectionApi as av, type TenantIntrospectionApiOptions as aw, type PublicReadQueryOptions as ax, CustomerAuth as ay, type CustomerProfile as az, ContentClient as b, type ProductListingCardOptions as b$, type CancelOrderParams as b0, type CancelOrderReconciliationStatus as b1, type CancelOrderResponse as b2, type CancelReasonCode as b3, CartApi as b4, type CartApiOptions as b5, type Comment as b6, type CommerceClientOptions as b7, type CommunityClientOptions as b8, type CommunityComment as b9, OrderApi as bA, type OrderApiOptions as bB, PRODUCT_PLP_FIND_OPTIONS as bC, PRODUCT_UPSERT_READONLY_FIELD_REASON as bD, PRODUCT_UPSERT_UNKNOWN_FIELD_REASON as bE, type PrepareFulfillmentOrderParams as bF, type PrepareFulfillmentOrderResponse as bG, ProductApi as bH, type ProductApiOptions as bI, type ProductDetailBrand as bJ, type ProductDetailCatalogResult as bK, type ProductDetailCatalogVariant as bL, type ProductDetailCategory as bM, type ProductDetailImage as bN, type ProductDetailImageMedia as bO, type ProductDetailMedia as bP, type ProductDetailOption as bQ, type ProductDetailOptionValue as bR, type ProductDetailTag as bS, type ProductDetailUnavailableReason as bT, type ProductDetailVariant as bU, type ProductDetailVariantOptionValue as bV, type ProductDetailVideo as bW, type ProductHrefGroup as bX, type ProductHrefOptions as bY, type ProductHrefProduct as bZ, type ProductListingCard as b_, type CommunityCommentListSort as ba, type CommunityPost as bb, type CommunityPostCategory as bc, type CommunityPostListSort as bd, type CommunityPostTag as be, type CommunityPublicAuthorSnapshot as bf, type CommunityPublicMediaAsset as bg, type CommunityPublicReference as bh, type CompatibilityProductSelectionParamEvent as bi, type ConfirmPaymentParams as bj, type ConfirmPaymentResponse as bk, type CreateFulfillmentParams as bl, type CreateOrderItem as bm, type CreateOrderParams as bn, type CreateReturnParams as bo, type CustomerAuthOptions as bp, type CustomerOrderListOptions as bq, type CustomerSnapshot as br, DiscountApi as bs, type DiscountApiOptions as bt, type FeaturedImagePointerInput as bu, type LegacyProductSelectionParamEvent as bv, type ListingGroupsParams as bw, type MediaValue as bx, type NormalizedOptionSwatch as by, type NormalizedProductSelection as bz, CustomerNamespace as c, type UpdateTransactionParams as c$, type ProductListingCardPriceRange as c0, type ProductListingCardRepresentativeVariant as c1, type ProductListingGroup as c2, type ProductListingGroupCatalogSummary as c3, type ProductListingGroupCatalogVariant as c4, type ProductListingGroupProjection as c5, type ProductListingGroupSummary as c6, type ProductListingGroupVariant as c7, type ProductListingGroupsCatalogProduct as c8, type ProductListingGroupsCatalogResponse as c9, type ProductSelectionUrlEmit as cA, type ProductSelectionVariant as cB, type ProductUpsertFieldValidationErrorBody as cC, type ProductUpsertFieldValidationErrorReason as cD, type ProductVariantShape as cE, type RequestOptions as cF, type ResolveCancelRefundFailedResponse as cG, type ResolveCancelRefundOutcome as cH, type ResolveCancelRefundParams as cI, type ResolveCancelRefundResponse as cJ, type ResolveCancelRefundSucceededResponse as cK, type ResolveProductDisplayMediaInput as cL, type ResolveProductDisplayMediaResult as cM, type ReturnItem as cN, type ReturnReason as cO, type ReturnWithRefundItem as cP, type ReturnWithRefundParams as cQ, ShippingApi as cR, type ShippingApiOptions as cS, type StockCheckParams as cT, type StockCheckResponse as cU, type StockCheckResult as cV, type StockSnapshotItem as cW, type StockSnapshotParams as cX, type UpdateFulfillmentParams as cY, type UpdateOrderParams as cZ, type UpdateReturnParams as c_, type ProductListingGroupsProduct as ca, type ProductListingGroupsResponse as cb, type ProductListingPageFilters as cc, type ProductListingPageSort as cd, type ProductListingProductShape as ce, type ProductListingSwatch as cf, type ProductMediaResolutionSource as cg, type ProductMoneyRange as ch, type ProductOptionMatrix as ci, type ProductOptionMatrixOption as cj, type ProductOptionMatrixValue as ck, type ProductOptionMatrixVariant as cl, type ProductOptionShape as cm, type ProductOptionValueShape as cn, type ProductOptionValueSwatch as co, type ProductOptionValueSwatchInput as cp, type ProductPriceRange as cq, type ProductSelectionAvailableSwatch as cr, type ProductSelectionAvailableValue as cs, type ProductSelectionByOptionValue as ct, ProductSelectionCodecError as cu, type ProductSelectionCodecOptions as cv, type ProductSelectionInput as cw, type ProductSelectionOptionValue as cx, type ProductSelectionResolution as cy, type ProductSelectionResolutionContext as cz, type ClientState as d, type ValidateDiscountParams as d0, type ValidateDiscountResult as d1, type WithIdempotencyKey as d2, buildProductHref as d3, buildProductListingCard as d4, buildProductListingGroupProjection as d5, buildProductListingGroupsByOption as d6, buildProductOptionMatrix as d7, buildProductOptionMatrixFromDetail as d8, createProductSelectionCodec as d9, getAvailableOptionValues as da, getProductSelectionImages as db, getSelectedValueByOptionId as dc, getVariantAvailableForSale as dd, getVariantAvailableStock as de, isProductUpsertFieldValidationErrorBody as df, normalizeProductSelection as dg, normalizeProductSelectionFromMatrix as dh, normalizeSelectedValueIds as di, parseProductSelection as dj, projectProductToListingShape as dk, resolveFeaturedImagePointer as dl, resolveProductDisplayMedia as dm, resolveProductSelection as dn, resolveProductSelectionFromMatrix as dp, resolveProductSelectionMedia as dq, resolveVariantForSelection as dr, selectNext as ds, selectedSwatchMediaItemId as dt, stringifyProductSelection as du, toShopifyPriceRangeV2 as dv, type ClientConfig as e, type ApiQueryOptions as f, type ApplyDiscountParams as g, type CheckoutParams as h, type ClearCartParams as i, type ClientMetadata as j, type ContentClientOptions as k, type DeepPartial as l, type ExtractArrayType as m, type PayloadMutationResponse as n, type PublicCart as o, type PublicCartItem as p, type PublicCartReference as q, type PublicMediaAsset as r, type PublicMediaSize as s, type PublicOrder as t, type PublicOrderItem as u, type PublicOrderReference as v, type RemoveItemParams as w, type RetryConfig as x, type RootClient as y, type RootCollectionClient as z };
|
|
@@ -1381,6 +1381,22 @@ type ProductListingCardOptions = {
|
|
|
1381
1381
|
preferCompleteVariantFromHint?: boolean;
|
|
1382
1382
|
};
|
|
1383
1383
|
declare function buildProductHref(product: ProductHrefProduct, group?: ProductHrefGroup | null, options?: ProductHrefOptions): string;
|
|
1384
|
+
/**
|
|
1385
|
+
* Server-equivalent sellability for a single variant: active, and either
|
|
1386
|
+
* unlimited or with positive sellable stock (`stock - reservedStock`). This is
|
|
1387
|
+
* the same rule the SDK applies when rolling availability up to the product, so
|
|
1388
|
+
* storefronts can compute a Shopify-style `availableForSale` without
|
|
1389
|
+
* re-implementing the check or shipping raw `stock`/`reservedStock` to the
|
|
1390
|
+
* browser.
|
|
1391
|
+
*/
|
|
1392
|
+
declare function getVariantAvailableForSale(variant: ProductVariantShape): boolean;
|
|
1393
|
+
/**
|
|
1394
|
+
* Sellable quantity for a single variant (`stock - reservedStock`, clamped at
|
|
1395
|
+
* zero), or `null` when the variant is unlimited and has no finite quantity.
|
|
1396
|
+
* Mirrors Shopify's `ProductVariant.quantityAvailable` (a single computed
|
|
1397
|
+
* number, never the raw stock/reserved breakdown).
|
|
1398
|
+
*/
|
|
1399
|
+
declare function getVariantAvailableStock(variant: ProductVariantShape): number | null;
|
|
1384
1400
|
declare function buildProductListingGroupProjection(product: ProductListingProductShape | null | undefined, variants: ProductVariantShape[]): ProductListingGroupProjection;
|
|
1385
1401
|
declare function buildProductListingCard(item: ProductListingCardSourceItem, options?: ProductListingCardOptions): ProductListingCard;
|
|
1386
1402
|
/** Shopify `priceRangeV2` naming for persisted listing projection fields. */
|
|
@@ -1414,6 +1430,20 @@ declare function toShopifyPriceRangeV2(listing: {
|
|
|
1414
1430
|
* raw reads are constrained to `depth: 0`, `joins: false`, and no `populate`.
|
|
1415
1431
|
*/
|
|
1416
1432
|
declare const PRODUCT_PLP_FIND_OPTIONS: ApiQueryOptions;
|
|
1433
|
+
/**
|
|
1434
|
+
* Adapts a raw Payload product document (from
|
|
1435
|
+
* `collections.from('products').find()`) into the listing shape the SDK
|
|
1436
|
+
* listing builders consume. A raw product already carries `priceRange`,
|
|
1437
|
+
* `compareAtPriceRange`, `availableForSale`, and `selectedOrFirstAvailableVariant`,
|
|
1438
|
+
* but it has no `featuredImage` field — only the `images` gallery. This pure,
|
|
1439
|
+
* non-lossy adapter fills `featuredImage` from the first non-null gallery image
|
|
1440
|
+
* (when not already set) so SSG/sitemap consumers on the raw `find()` escape
|
|
1441
|
+
* hatch can feed `buildProductListingGroupsByOption` / `buildProductListingCard`
|
|
1442
|
+
* without hand-rolling the projection. An explicit `featuredImage` is preserved.
|
|
1443
|
+
*/
|
|
1444
|
+
declare function projectProductToListingShape<T extends ProductListingProductShape>(product: T): T & {
|
|
1445
|
+
featuredImage: MediaValue;
|
|
1446
|
+
};
|
|
1417
1447
|
/**
|
|
1418
1448
|
* Builds product-first listing groups for one primary option.
|
|
1419
1449
|
*
|
|
@@ -2577,4 +2607,4 @@ type DeepPartial<T> = {
|
|
|
2577
2607
|
};
|
|
2578
2608
|
type ExtractArrayType<T> = T extends (infer U)[] ? U : never;
|
|
2579
2609
|
|
|
2580
|
-
export { type CollectionFieldSchema as $, type AddItemParams as A, type RootReadOnlyQueryBuilder as B, CommerceClient as C, type DebugConfig as D, EventsClient as E, type StorefrontContentListOptions as F, type StorefrontContentReference as G, type StorefrontGalleryItem as H, type StorefrontGalleryItemsListOptions as I, type StorefrontGalleryItemsSort as J, type StorefrontLink as K, type StorefrontLinksListOptions as L, type StorefrontLinksSort as M, BaseApi as N, type ServerApiOptions as O, type PayloadFindResponse as P, ServerCommerceClient as Q, type RemoveDiscountParams as R, type Sort as S, type TenantIntrospectionClient as T, type UpdateItemParams as U, type BanCustomerParams as V, type Where as W, type CommunityBan as X, type UnbanCustomerParams as Y, type ClientServerConfig as Z, type RootServerClientWithEvents as _, CommunityClient as a, type CalculateShippingResult as a$, type CollectionSchemaResponse as a0, type EventGuestCancelParams as a1, type EventGuestRegistration as a2, type EventGuestRegistrationResponse as a3, type EventRegistrationAnswerInput as a4, type EventRegistrationAttendeeInput as a5, type EventRegistrationPublic as a6, type EventRegistrationRegisterParams as a7, type EventRegistrationRegisterResponse as a8, type EventsCalendarItem as a9, type CustomerAuthResponse as aA, type CustomerLoginData as aB, type CustomerRegisterResponse as aC, type CustomerRegisterData as aD, type CustomerRefreshResponse as aE, type UpdateProfileData as aF, type ProductListingPageBaseParams as aG, type ProductListingPageParams as aH, type ProductDetailParams as aI, type ProductDetailResult as aJ, type ProductListingPageCatalogParams as aK, type ProductListingPageResult as aL, type ProductListingGroupsCatalogItem as aM, type ProductListingPageFullParams as aN, type ProductListingGroupsItem as aO, type ProductDetail as aP, type ProductDetailCatalog as aQ, type StockSnapshotResponse as aR, type ProductSelectionMediaSource as aS, type ProductDisplayMediaSource as aT, type ResolveProductSelectionMediaInput as aU, type ResolveProductSelectionMediaResult as aV, type ProductSelectionMediaPointer as aW, type RootClientWithEvents as aX, type BulkImportFulfillmentsParams as aY, type BulkImportFulfillmentsResponse as aZ, type CalculateShippingParams as a_, type EventsClientOptions as aa, type EventsDateParam as ab, type EventsExternalSource as ac, type EventsLocation as ad, type EventsOccurrenceLocation as ae, type EventsRangeEvent as af, type EventsRangeOccurrence as ag, type EventsRangeParams as ah, type EventsRangeResponse as ai, type EventsTaxonomyItem as aj, ModerationApi as ak, type RootServerClient as al, type TenantFeatureProgressEvidenceValue as am, type TenantFeatureProgressFeature as an, type TenantFeatureProgressGroup as ao, type TenantFeatureProgressInput as ap, type TenantFeatureProgressItem as aq, type TenantFeatureProgressItemState as ar, type TenantFeatureProgressResponse as as, type TenantFeatureProgressSeverity as at, type TenantFeatureProgressStatus as au, TenantIntrospectionApi as av, type TenantIntrospectionApiOptions as aw, type PublicReadQueryOptions as ax, CustomerAuth as ay, type CustomerProfile as az, ContentClient as b, type ProductListingCardOptions as b$, type CancelOrderParams as b0, type CancelOrderReconciliationStatus as b1, type CancelOrderResponse as b2, type CancelReasonCode as b3, CartApi as b4, type CartApiOptions as b5, type Comment as b6, type CommerceClientOptions as b7, type CommunityClientOptions as b8, type CommunityComment as b9, OrderApi as bA, type OrderApiOptions as bB, PRODUCT_PLP_FIND_OPTIONS as bC, PRODUCT_UPSERT_READONLY_FIELD_REASON as bD, PRODUCT_UPSERT_UNKNOWN_FIELD_REASON as bE, type PrepareFulfillmentOrderParams as bF, type PrepareFulfillmentOrderResponse as bG, ProductApi as bH, type ProductApiOptions as bI, type ProductDetailBrand as bJ, type ProductDetailCatalogResult as bK, type ProductDetailCatalogVariant as bL, type ProductDetailCategory as bM, type ProductDetailImage as bN, type ProductDetailImageMedia as bO, type ProductDetailMedia as bP, type ProductDetailOption as bQ, type ProductDetailOptionValue as bR, type ProductDetailTag as bS, type ProductDetailUnavailableReason as bT, type ProductDetailVariant as bU, type ProductDetailVariantOptionValue as bV, type ProductDetailVideo as bW, type ProductHrefGroup as bX, type ProductHrefOptions as bY, type ProductHrefProduct as bZ, type ProductListingCard as b_, type CommunityCommentListSort as ba, type CommunityPost as bb, type CommunityPostCategory as bc, type CommunityPostListSort as bd, type CommunityPostTag as be, type CommunityPublicAuthorSnapshot as bf, type CommunityPublicMediaAsset as bg, type CommunityPublicReference as bh, type CompatibilityProductSelectionParamEvent as bi, type ConfirmPaymentParams as bj, type ConfirmPaymentResponse as bk, type CreateFulfillmentParams as bl, type CreateOrderItem as bm, type CreateOrderParams as bn, type CreateReturnParams as bo, type CustomerAuthOptions as bp, type CustomerOrderListOptions as bq, type CustomerSnapshot as br, DiscountApi as bs, type DiscountApiOptions as bt, type FeaturedImagePointerInput as bu, type LegacyProductSelectionParamEvent as bv, type ListingGroupsParams as bw, type MediaValue as bx, type NormalizedOptionSwatch as by, type NormalizedProductSelection as bz, CustomerNamespace as c, type UpdateTransactionParams as c$, type ProductListingCardPriceRange as c0, type ProductListingCardRepresentativeVariant as c1, type ProductListingGroup as c2, type ProductListingGroupCatalogSummary as c3, type ProductListingGroupCatalogVariant as c4, type ProductListingGroupProjection as c5, type ProductListingGroupSummary as c6, type ProductListingGroupVariant as c7, type ProductListingGroupsCatalogProduct as c8, type ProductListingGroupsCatalogResponse as c9, type ProductSelectionUrlEmit as cA, type ProductSelectionVariant as cB, type ProductUpsertFieldValidationErrorBody as cC, type ProductUpsertFieldValidationErrorReason as cD, type ProductVariantShape as cE, type RequestOptions as cF, type ResolveCancelRefundFailedResponse as cG, type ResolveCancelRefundOutcome as cH, type ResolveCancelRefundParams as cI, type ResolveCancelRefundResponse as cJ, type ResolveCancelRefundSucceededResponse as cK, type ResolveProductDisplayMediaInput as cL, type ResolveProductDisplayMediaResult as cM, type ReturnItem as cN, type ReturnReason as cO, type ReturnWithRefundItem as cP, type ReturnWithRefundParams as cQ, ShippingApi as cR, type ShippingApiOptions as cS, type StockCheckParams as cT, type StockCheckResponse as cU, type StockCheckResult as cV, type StockSnapshotItem as cW, type StockSnapshotParams as cX, type UpdateFulfillmentParams as cY, type UpdateOrderParams as cZ, type UpdateReturnParams as c_, type ProductListingGroupsProduct as ca, type ProductListingGroupsResponse as cb, type ProductListingPageFilters as cc, type ProductListingPageSort as cd, type ProductListingProductShape as ce, type ProductListingSwatch as cf, type ProductMediaResolutionSource as cg, type ProductMoneyRange as ch, type ProductOptionMatrix as ci, type ProductOptionMatrixOption as cj, type ProductOptionMatrixValue as ck, type ProductOptionMatrixVariant as cl, type ProductOptionShape as cm, type ProductOptionValueShape as cn, type ProductOptionValueSwatch as co, type ProductOptionValueSwatchInput as cp, type ProductPriceRange as cq, type ProductSelectionAvailableSwatch as cr, type ProductSelectionAvailableValue as cs, type ProductSelectionByOptionValue as ct, ProductSelectionCodecError as cu, type ProductSelectionCodecOptions as cv, type ProductSelectionInput as cw, type ProductSelectionOptionValue as cx, type ProductSelectionResolution as cy, type ProductSelectionResolutionContext as cz, type ClientState as d, type ValidateDiscountParams as d0, type ValidateDiscountResult as d1, type WithIdempotencyKey as d2, buildProductHref as d3, buildProductListingCard as d4, buildProductListingGroupProjection as d5, buildProductListingGroupsByOption as d6, buildProductOptionMatrix as d7, buildProductOptionMatrixFromDetail as d8, createProductSelectionCodec as d9, getAvailableOptionValues as da, getProductSelectionImages as db, getSelectedValueByOptionId as dc,
|
|
2610
|
+
export { type CollectionFieldSchema as $, type AddItemParams as A, type RootReadOnlyQueryBuilder as B, CommerceClient as C, type DebugConfig as D, EventsClient as E, type StorefrontContentListOptions as F, type StorefrontContentReference as G, type StorefrontGalleryItem as H, type StorefrontGalleryItemsListOptions as I, type StorefrontGalleryItemsSort as J, type StorefrontLink as K, type StorefrontLinksListOptions as L, type StorefrontLinksSort as M, BaseApi as N, type ServerApiOptions as O, type PayloadFindResponse as P, ServerCommerceClient as Q, type RemoveDiscountParams as R, type Sort as S, type TenantIntrospectionClient as T, type UpdateItemParams as U, type BanCustomerParams as V, type Where as W, type CommunityBan as X, type UnbanCustomerParams as Y, type ClientServerConfig as Z, type RootServerClientWithEvents as _, CommunityClient as a, type CalculateShippingResult as a$, type CollectionSchemaResponse as a0, type EventGuestCancelParams as a1, type EventGuestRegistration as a2, type EventGuestRegistrationResponse as a3, type EventRegistrationAnswerInput as a4, type EventRegistrationAttendeeInput as a5, type EventRegistrationPublic as a6, type EventRegistrationRegisterParams as a7, type EventRegistrationRegisterResponse as a8, type EventsCalendarItem as a9, type CustomerAuthResponse as aA, type CustomerLoginData as aB, type CustomerRegisterResponse as aC, type CustomerRegisterData as aD, type CustomerRefreshResponse as aE, type UpdateProfileData as aF, type ProductListingPageBaseParams as aG, type ProductListingPageParams as aH, type ProductDetailParams as aI, type ProductDetailResult as aJ, type ProductListingPageCatalogParams as aK, type ProductListingPageResult as aL, type ProductListingGroupsCatalogItem as aM, type ProductListingPageFullParams as aN, type ProductListingGroupsItem as aO, type ProductDetail as aP, type ProductDetailCatalog as aQ, type StockSnapshotResponse as aR, type ProductSelectionMediaSource as aS, type ProductDisplayMediaSource as aT, type ResolveProductSelectionMediaInput as aU, type ResolveProductSelectionMediaResult as aV, type ProductSelectionMediaPointer as aW, type RootClientWithEvents as aX, type BulkImportFulfillmentsParams as aY, type BulkImportFulfillmentsResponse as aZ, type CalculateShippingParams as a_, type EventsClientOptions as aa, type EventsDateParam as ab, type EventsExternalSource as ac, type EventsLocation as ad, type EventsOccurrenceLocation as ae, type EventsRangeEvent as af, type EventsRangeOccurrence as ag, type EventsRangeParams as ah, type EventsRangeResponse as ai, type EventsTaxonomyItem as aj, ModerationApi as ak, type RootServerClient as al, type TenantFeatureProgressEvidenceValue as am, type TenantFeatureProgressFeature as an, type TenantFeatureProgressGroup as ao, type TenantFeatureProgressInput as ap, type TenantFeatureProgressItem as aq, type TenantFeatureProgressItemState as ar, type TenantFeatureProgressResponse as as, type TenantFeatureProgressSeverity as at, type TenantFeatureProgressStatus as au, TenantIntrospectionApi as av, type TenantIntrospectionApiOptions as aw, type PublicReadQueryOptions as ax, CustomerAuth as ay, type CustomerProfile as az, ContentClient as b, type ProductListingCardOptions as b$, type CancelOrderParams as b0, type CancelOrderReconciliationStatus as b1, type CancelOrderResponse as b2, type CancelReasonCode as b3, CartApi as b4, type CartApiOptions as b5, type Comment as b6, type CommerceClientOptions as b7, type CommunityClientOptions as b8, type CommunityComment as b9, OrderApi as bA, type OrderApiOptions as bB, PRODUCT_PLP_FIND_OPTIONS as bC, PRODUCT_UPSERT_READONLY_FIELD_REASON as bD, PRODUCT_UPSERT_UNKNOWN_FIELD_REASON as bE, type PrepareFulfillmentOrderParams as bF, type PrepareFulfillmentOrderResponse as bG, ProductApi as bH, type ProductApiOptions as bI, type ProductDetailBrand as bJ, type ProductDetailCatalogResult as bK, type ProductDetailCatalogVariant as bL, type ProductDetailCategory as bM, type ProductDetailImage as bN, type ProductDetailImageMedia as bO, type ProductDetailMedia as bP, type ProductDetailOption as bQ, type ProductDetailOptionValue as bR, type ProductDetailTag as bS, type ProductDetailUnavailableReason as bT, type ProductDetailVariant as bU, type ProductDetailVariantOptionValue as bV, type ProductDetailVideo as bW, type ProductHrefGroup as bX, type ProductHrefOptions as bY, type ProductHrefProduct as bZ, type ProductListingCard as b_, type CommunityCommentListSort as ba, type CommunityPost as bb, type CommunityPostCategory as bc, type CommunityPostListSort as bd, type CommunityPostTag as be, type CommunityPublicAuthorSnapshot as bf, type CommunityPublicMediaAsset as bg, type CommunityPublicReference as bh, type CompatibilityProductSelectionParamEvent as bi, type ConfirmPaymentParams as bj, type ConfirmPaymentResponse as bk, type CreateFulfillmentParams as bl, type CreateOrderItem as bm, type CreateOrderParams as bn, type CreateReturnParams as bo, type CustomerAuthOptions as bp, type CustomerOrderListOptions as bq, type CustomerSnapshot as br, DiscountApi as bs, type DiscountApiOptions as bt, type FeaturedImagePointerInput as bu, type LegacyProductSelectionParamEvent as bv, type ListingGroupsParams as bw, type MediaValue as bx, type NormalizedOptionSwatch as by, type NormalizedProductSelection as bz, CustomerNamespace as c, type UpdateTransactionParams as c$, type ProductListingCardPriceRange as c0, type ProductListingCardRepresentativeVariant as c1, type ProductListingGroup as c2, type ProductListingGroupCatalogSummary as c3, type ProductListingGroupCatalogVariant as c4, type ProductListingGroupProjection as c5, type ProductListingGroupSummary as c6, type ProductListingGroupVariant as c7, type ProductListingGroupsCatalogProduct as c8, type ProductListingGroupsCatalogResponse as c9, type ProductSelectionUrlEmit as cA, type ProductSelectionVariant as cB, type ProductUpsertFieldValidationErrorBody as cC, type ProductUpsertFieldValidationErrorReason as cD, type ProductVariantShape as cE, type RequestOptions as cF, type ResolveCancelRefundFailedResponse as cG, type ResolveCancelRefundOutcome as cH, type ResolveCancelRefundParams as cI, type ResolveCancelRefundResponse as cJ, type ResolveCancelRefundSucceededResponse as cK, type ResolveProductDisplayMediaInput as cL, type ResolveProductDisplayMediaResult as cM, type ReturnItem as cN, type ReturnReason as cO, type ReturnWithRefundItem as cP, type ReturnWithRefundParams as cQ, ShippingApi as cR, type ShippingApiOptions as cS, type StockCheckParams as cT, type StockCheckResponse as cU, type StockCheckResult as cV, type StockSnapshotItem as cW, type StockSnapshotParams as cX, type UpdateFulfillmentParams as cY, type UpdateOrderParams as cZ, type UpdateReturnParams as c_, type ProductListingGroupsProduct as ca, type ProductListingGroupsResponse as cb, type ProductListingPageFilters as cc, type ProductListingPageSort as cd, type ProductListingProductShape as ce, type ProductListingSwatch as cf, type ProductMediaResolutionSource as cg, type ProductMoneyRange as ch, type ProductOptionMatrix as ci, type ProductOptionMatrixOption as cj, type ProductOptionMatrixValue as ck, type ProductOptionMatrixVariant as cl, type ProductOptionShape as cm, type ProductOptionValueShape as cn, type ProductOptionValueSwatch as co, type ProductOptionValueSwatchInput as cp, type ProductPriceRange as cq, type ProductSelectionAvailableSwatch as cr, type ProductSelectionAvailableValue as cs, type ProductSelectionByOptionValue as ct, ProductSelectionCodecError as cu, type ProductSelectionCodecOptions as cv, type ProductSelectionInput as cw, type ProductSelectionOptionValue as cx, type ProductSelectionResolution as cy, type ProductSelectionResolutionContext as cz, type ClientState as d, type ValidateDiscountParams as d0, type ValidateDiscountResult as d1, type WithIdempotencyKey as d2, buildProductHref as d3, buildProductListingCard as d4, buildProductListingGroupProjection as d5, buildProductListingGroupsByOption as d6, buildProductOptionMatrix as d7, buildProductOptionMatrixFromDetail as d8, createProductSelectionCodec as d9, getAvailableOptionValues as da, getProductSelectionImages as db, getSelectedValueByOptionId as dc, getVariantAvailableForSale as dd, getVariantAvailableStock as de, isProductUpsertFieldValidationErrorBody as df, normalizeProductSelection as dg, normalizeProductSelectionFromMatrix as dh, normalizeSelectedValueIds as di, parseProductSelection as dj, projectProductToListingShape as dk, resolveFeaturedImagePointer as dl, resolveProductDisplayMedia as dm, resolveProductSelection as dn, resolveProductSelectionFromMatrix as dp, resolveProductSelectionMedia as dq, resolveVariantForSelection as dr, selectNext as ds, selectedSwatchMediaItemId as dt, stringifyProductSelection as du, toShopifyPriceRangeV2 as dv, type ClientConfig as e, type ApiQueryOptions as f, type ApplyDiscountParams as g, type CheckoutParams as h, type ClearCartParams as i, type ClientMetadata as j, type ContentClientOptions as k, type DeepPartial as l, type ExtractArrayType as m, type PayloadMutationResponse as n, type PublicCart as o, type PublicCartItem as p, type PublicCartReference as q, type PublicMediaAsset as r, type PublicMediaSize as s, type PublicOrder as t, type PublicOrderItem as u, type PublicOrderReference as v, type RemoveItemParams as w, type RetryConfig as x, type RootClient as y, type RootCollectionClient as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@01.software/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.41.0",
|
|
4
4
|
"description": "01.software SDK",
|
|
5
5
|
"author": "<office@01.works>",
|
|
6
6
|
"repository": {
|
|
@@ -201,7 +201,9 @@
|
|
|
201
201
|
"node": ">=18.0.0"
|
|
202
202
|
},
|
|
203
203
|
"files": [
|
|
204
|
-
"dist"
|
|
204
|
+
"dist",
|
|
205
|
+
"MIGRATION.md",
|
|
206
|
+
"CHANGELOG.md"
|
|
205
207
|
],
|
|
206
208
|
"devDependencies": {
|
|
207
209
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
@@ -231,8 +233,8 @@
|
|
|
231
233
|
"tsup": "^8.5.1",
|
|
232
234
|
"typescript": "5.7.3",
|
|
233
235
|
"vitest": "^4.1.5",
|
|
234
|
-
"@repo/
|
|
235
|
-
"@repo/
|
|
236
|
+
"@repo/typescript-config": "0.0.0",
|
|
237
|
+
"@repo/eslint-config": "0.0.0"
|
|
236
238
|
},
|
|
237
239
|
"dependencies": {
|
|
238
240
|
"qs-esm": "^8.0.1"
|