@01.software/sdk 0.39.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +52 -20
  2. package/dist/client.cjs +43 -68
  3. package/dist/client.cjs.map +1 -1
  4. package/dist/client.d.cts +6 -6
  5. package/dist/client.d.ts +6 -6
  6. package/dist/client.js +43 -68
  7. package/dist/client.js.map +1 -1
  8. package/dist/{collection-client-CaMgs5KE.d.ts → collection-client-CKFa99C6.d.ts} +3 -3
  9. package/dist/{collection-client-DVfB0Em1.d.cts → collection-client-VYwYi6u6.d.cts} +3 -3
  10. package/dist/const-4BUtUdGU.d.cts +32 -0
  11. package/dist/const-ymprfiPf.d.ts +32 -0
  12. package/dist/{index-BOLQxveo.d.cts → index-Dquv4xTL.d.cts} +3 -3
  13. package/dist/{index-CSwR2HSg.d.ts → index-w36lpSkU.d.ts} +3 -3
  14. package/dist/index.cjs +101 -131
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +8 -8
  17. package/dist/index.d.ts +8 -8
  18. package/dist/index.js +101 -131
  19. package/dist/index.js.map +1 -1
  20. package/dist/{payload-types-m3jjhxk9.d.cts → payload-types-DC0xzR9i.d.cts} +470 -265
  21. package/dist/{payload-types-m3jjhxk9.d.ts → payload-types-DC0xzR9i.d.ts} +470 -265
  22. package/dist/query.d.cts +5 -5
  23. package/dist/query.d.ts +5 -5
  24. package/dist/realtime.d.cts +2 -2
  25. package/dist/realtime.d.ts +2 -2
  26. package/dist/server.cjs +36 -68
  27. package/dist/server.cjs.map +1 -1
  28. package/dist/server.d.cts +7 -7
  29. package/dist/server.d.ts +7 -7
  30. package/dist/server.js +36 -68
  31. package/dist/server.js.map +1 -1
  32. package/dist/{types-Cmrd1ezc.d.ts → types-Bh2p-EMc.d.ts} +5 -1
  33. package/dist/{types-D0ubzQw0.d.cts → types-BvpjooU-.d.cts} +5 -1
  34. package/dist/{types-CVf8sCZ-.d.ts → types-D5uHrPLr.d.cts} +99 -77
  35. package/dist/{types-BQo7UdI9.d.cts → types-Umd-YTjM.d.ts} +99 -77
  36. package/dist/ui/form.d.cts +1 -1
  37. package/dist/ui/form.d.ts +1 -1
  38. package/dist/ui/video.d.cts +1 -1
  39. package/dist/ui/video.d.ts +1 -1
  40. package/dist/webhook.d.cts +4 -4
  41. package/dist/webhook.d.ts +4 -4
  42. package/package.json +1 -1
  43. package/dist/const-6XHz_jej.d.ts +0 -32
  44. package/dist/const-B5KT72c7.d.cts +0 -32
package/dist/server.d.cts CHANGED
@@ -1,11 +1,11 @@
1
- import { S as ServerCollectionClient } from './collection-client-DVfB0Em1.cjs';
2
- export { C as CollectionClient } from './collection-client-DVfB0Em1.cjs';
3
- import { N as BaseApi, O as ServerApiOptions, Q as ServerCommerceClient, T as TenantIntrospectionClient, a as CommunityClient, V as BanCustomerParams, X as CommunityBan, Y as UnbanCustomerParams, d as ClientState, Z as ClientServerConfig, E as EventsClient, _ as RootServerClientWithEvents } from './types-BQo7UdI9.cjs';
4
- export { A as AddItemParams, g as ApplyDiscountParams, h as CheckoutParams, i as ClearCartParams, $ as CollectionFieldSchema, a0 as CollectionSchemaResponse, a1 as EventGuestCancelParams, a2 as EventGuestRegistration, a3 as EventGuestRegistrationResponse, a4 as EventRegistrationAnswerInput, a5 as EventRegistrationAttendeeInput, a6 as EventRegistrationPublic, a7 as EventRegistrationRegisterParams, a8 as EventRegistrationRegisterResponse, a9 as EventsCalendarItem, aa as EventsClientOptions, ab as EventsDateParam, ac as EventsExternalSource, ad as EventsLocation, ae as EventsOccurrenceLocation, af as EventsRangeEvent, ag as EventsRangeOccurrence, ah as EventsRangeParams, ai as EventsRangeResponse, aj as EventsTaxonomyItem, ak as ModerationApi, o as PublicCart, p as PublicCartItem, q as PublicCartReference, r as PublicMediaAsset, s as PublicMediaSize, t as PublicOrder, u as PublicOrderItem, v as PublicOrderReference, R as RemoveDiscountParams, w as RemoveItemParams, al as RootServerClient, am as TenantFeatureProgressEvidenceValue, an as TenantFeatureProgressFeature, ao as TenantFeatureProgressGroup, ap as TenantFeatureProgressInput, aq as TenantFeatureProgressItem, ar as TenantFeatureProgressItemState, as as TenantFeatureProgressResponse, at as TenantFeatureProgressSeverity, au as TenantFeatureProgressStatus, av as TenantIntrospectionApi, aw as TenantIntrospectionApiOptions, U as UpdateItemParams } from './types-BQo7UdI9.cjs';
5
- import './payload-types-m3jjhxk9.cjs';
1
+ import { S as ServerCollectionClient } from './collection-client-VYwYi6u6.cjs';
2
+ export { C as CollectionClient } from './collection-client-VYwYi6u6.cjs';
3
+ import { N as BaseApi, O as ServerApiOptions, Q as ServerCommerceClient, T as TenantIntrospectionClient, a as CommunityClient, V as BanCustomerParams, X as CommunityBan, Y as UnbanCustomerParams, d as ClientState, Z as ClientServerConfig, E as EventsClient, _ as RootServerClientWithEvents } from './types-D5uHrPLr.cjs';
4
+ export { A as AddItemParams, g as ApplyDiscountParams, h as CheckoutParams, i as ClearCartParams, $ as CollectionFieldSchema, a0 as CollectionSchemaResponse, a1 as EventGuestCancelParams, a2 as EventGuestRegistration, a3 as EventGuestRegistrationResponse, a4 as EventRegistrationAnswerInput, a5 as EventRegistrationAttendeeInput, a6 as EventRegistrationPublic, a7 as EventRegistrationRegisterParams, a8 as EventRegistrationRegisterResponse, a9 as EventsCalendarItem, aa as EventsClientOptions, ab as EventsDateParam, ac as EventsExternalSource, ad as EventsLocation, ae as EventsOccurrenceLocation, af as EventsRangeEvent, ag as EventsRangeOccurrence, ah as EventsRangeParams, ai as EventsRangeResponse, aj as EventsTaxonomyItem, ak as ModerationApi, o as PublicCart, p as PublicCartItem, q as PublicCartReference, r as PublicMediaAsset, s as PublicMediaSize, t as PublicOrder, u as PublicOrderItem, v as PublicOrderReference, R as RemoveDiscountParams, w as RemoveItemParams, al as RootServerClient, am as TenantFeatureProgressEvidenceValue, an as TenantFeatureProgressFeature, ao as TenantFeatureProgressGroup, ap as TenantFeatureProgressInput, aq as TenantFeatureProgressItem, ar as TenantFeatureProgressItemState, as as TenantFeatureProgressResponse, at as TenantFeatureProgressSeverity, au as TenantFeatureProgressStatus, av as TenantIntrospectionApi, aw as TenantIntrospectionApiOptions, U as UpdateItemParams } from './types-D5uHrPLr.cjs';
5
+ import './payload-types-DC0xzR9i.cjs';
6
6
  import './metadata.cjs';
7
- import './const-B5KT72c7.cjs';
8
- import './types-D0ubzQw0.cjs';
7
+ import './const-4BUtUdGU.cjs';
8
+ import './types-BvpjooU-.cjs';
9
9
 
10
10
  type PreviewDetailParams = {
11
11
  collection: string;
package/dist/server.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { S as ServerCollectionClient } from './collection-client-CaMgs5KE.js';
2
- export { C as CollectionClient } from './collection-client-CaMgs5KE.js';
3
- import { N as BaseApi, O as ServerApiOptions, Q as ServerCommerceClient, T as TenantIntrospectionClient, a as CommunityClient, V as BanCustomerParams, X as CommunityBan, Y as UnbanCustomerParams, d as ClientState, Z as ClientServerConfig, E as EventsClient, _ as RootServerClientWithEvents } from './types-CVf8sCZ-.js';
4
- export { A as AddItemParams, g as ApplyDiscountParams, h as CheckoutParams, i as ClearCartParams, $ as CollectionFieldSchema, a0 as CollectionSchemaResponse, a1 as EventGuestCancelParams, a2 as EventGuestRegistration, a3 as EventGuestRegistrationResponse, a4 as EventRegistrationAnswerInput, a5 as EventRegistrationAttendeeInput, a6 as EventRegistrationPublic, a7 as EventRegistrationRegisterParams, a8 as EventRegistrationRegisterResponse, a9 as EventsCalendarItem, aa as EventsClientOptions, ab as EventsDateParam, ac as EventsExternalSource, ad as EventsLocation, ae as EventsOccurrenceLocation, af as EventsRangeEvent, ag as EventsRangeOccurrence, ah as EventsRangeParams, ai as EventsRangeResponse, aj as EventsTaxonomyItem, ak as ModerationApi, o as PublicCart, p as PublicCartItem, q as PublicCartReference, r as PublicMediaAsset, s as PublicMediaSize, t as PublicOrder, u as PublicOrderItem, v as PublicOrderReference, R as RemoveDiscountParams, w as RemoveItemParams, al as RootServerClient, am as TenantFeatureProgressEvidenceValue, an as TenantFeatureProgressFeature, ao as TenantFeatureProgressGroup, ap as TenantFeatureProgressInput, aq as TenantFeatureProgressItem, ar as TenantFeatureProgressItemState, as as TenantFeatureProgressResponse, at as TenantFeatureProgressSeverity, au as TenantFeatureProgressStatus, av as TenantIntrospectionApi, aw as TenantIntrospectionApiOptions, U as UpdateItemParams } from './types-CVf8sCZ-.js';
5
- import './payload-types-m3jjhxk9.js';
1
+ import { S as ServerCollectionClient } from './collection-client-CKFa99C6.js';
2
+ export { C as CollectionClient } from './collection-client-CKFa99C6.js';
3
+ import { N as BaseApi, O as ServerApiOptions, Q as ServerCommerceClient, T as TenantIntrospectionClient, a as CommunityClient, V as BanCustomerParams, X as CommunityBan, Y as UnbanCustomerParams, d as ClientState, Z as ClientServerConfig, E as EventsClient, _ as RootServerClientWithEvents } from './types-Umd-YTjM.js';
4
+ export { A as AddItemParams, g as ApplyDiscountParams, h as CheckoutParams, i as ClearCartParams, $ as CollectionFieldSchema, a0 as CollectionSchemaResponse, a1 as EventGuestCancelParams, a2 as EventGuestRegistration, a3 as EventGuestRegistrationResponse, a4 as EventRegistrationAnswerInput, a5 as EventRegistrationAttendeeInput, a6 as EventRegistrationPublic, a7 as EventRegistrationRegisterParams, a8 as EventRegistrationRegisterResponse, a9 as EventsCalendarItem, aa as EventsClientOptions, ab as EventsDateParam, ac as EventsExternalSource, ad as EventsLocation, ae as EventsOccurrenceLocation, af as EventsRangeEvent, ag as EventsRangeOccurrence, ah as EventsRangeParams, ai as EventsRangeResponse, aj as EventsTaxonomyItem, ak as ModerationApi, o as PublicCart, p as PublicCartItem, q as PublicCartReference, r as PublicMediaAsset, s as PublicMediaSize, t as PublicOrder, u as PublicOrderItem, v as PublicOrderReference, R as RemoveDiscountParams, w as RemoveItemParams, al as RootServerClient, am as TenantFeatureProgressEvidenceValue, an as TenantFeatureProgressFeature, ao as TenantFeatureProgressGroup, ap as TenantFeatureProgressInput, aq as TenantFeatureProgressItem, ar as TenantFeatureProgressItemState, as as TenantFeatureProgressResponse, at as TenantFeatureProgressSeverity, au as TenantFeatureProgressStatus, av as TenantIntrospectionApi, aw as TenantIntrospectionApiOptions, U as UpdateItemParams } from './types-Umd-YTjM.js';
5
+ import './payload-types-DC0xzR9i.js';
6
6
  import './metadata.js';
7
- import './const-6XHz_jej.js';
8
- import './types-Cmrd1ezc.js';
7
+ import './const-ymprfiPf.js';
8
+ import './types-Bh2p-EMc.js';
9
9
 
10
10
  type PreviewDetailParams = {
11
11
  collection: string;
package/dist/server.js CHANGED
@@ -1636,9 +1636,6 @@ function getMediaId(value) {
1636
1636
  }
1637
1637
  return null;
1638
1638
  }
1639
- function toPointerId(value) {
1640
- return getMediaId(value);
1641
- }
1642
1639
  function mediaArray(value) {
1643
1640
  if (!Array.isArray(value)) return [];
1644
1641
  return value.filter((entry) => entry != null);
@@ -1755,22 +1752,16 @@ function resolveProductSelectionMedia(input) {
1755
1752
  source: "none"
1756
1753
  };
1757
1754
  }
1758
- function resolveListingPrimaryImagePointer(input) {
1755
+ function resolveFeaturedImagePointer(input) {
1759
1756
  const pool = mediaArray(input.productMediaPool);
1760
1757
  const resolvedPointer = getMediaId(input.resolvedPrimary);
1761
1758
  if (resolvedPointer && input.resolvedSource !== "product_pool" && input.resolvedSource !== "none") {
1762
1759
  return resolvedPointer;
1763
1760
  }
1764
1761
  const poolById = buildPoolById(pool);
1765
- const listingPointer = getMediaId(input.listingPrimaryImage);
1766
- if (listingPointer && poolById.has(listingPointer)) {
1767
- return listingPointer;
1768
- }
1769
- const primaryPointer = toPointerId(input.productPrimaryMediaItemId);
1770
- if (primaryPointer && poolById.has(primaryPointer)) return primaryPointer;
1771
- const thumbnailPointer = getMediaId(input.productThumbnail);
1772
- if (thumbnailPointer && poolById.has(thumbnailPointer)) {
1773
- return thumbnailPointer;
1762
+ const featuredImagePointer = getMediaId(input.featuredImage);
1763
+ if (featuredImagePointer && poolById.has(featuredImagePointer)) {
1764
+ return featuredImagePointer;
1774
1765
  }
1775
1766
  if (pool.length > 0) {
1776
1767
  const firstPoolId = getMediaId(pool[0]);
@@ -1825,13 +1816,9 @@ function extractEntityId(value) {
1825
1816
  return null;
1826
1817
  }
1827
1818
  function resolveGenericListingPrimaryImage(product, resolvedPrimary, resolvedSource) {
1828
- return resolveListingPrimaryImagePointer({
1819
+ return resolveFeaturedImagePointer({
1829
1820
  productMediaPool: product?.images ?? [],
1830
- productPrimaryMediaItemId: getRelationID(
1831
- product?.primaryMediaItemId ?? null
1832
- ),
1833
- productThumbnail: product?.thumbnail ?? null,
1834
- listingPrimaryImage: product?.listing?.primaryImage ?? null,
1821
+ featuredImage: product?.featuredImage ?? null,
1835
1822
  resolvedPrimary,
1836
1823
  resolvedSource
1837
1824
  });
@@ -2470,7 +2457,7 @@ function getMinMax(values) {
2470
2457
  max: Math.max(...numbers)
2471
2458
  };
2472
2459
  }
2473
- function buildProductListingProjection(product, variants) {
2460
+ function buildProductListingGroupProjection(product, variants) {
2474
2461
  const orderedVariants = [...variants].sort(compareVariantOrder);
2475
2462
  const activeVariants = orderedVariants.filter(
2476
2463
  (variant) => variant.isActive !== false
@@ -2491,7 +2478,6 @@ function buildProductListingProjection(product, variants) {
2491
2478
  const mediaSelectionVariants = sortVariantsForMediaSelection(variants);
2492
2479
  const resolvedProductMedia = resolveProductSelectionMedia({
2493
2480
  productMediaPool,
2494
- productPrimaryMediaItemId: getRelationID(product?.primaryMediaItemId),
2495
2481
  selectedVariant: selectionHintVariant && selectionHintHasPoolMedia ? {
2496
2482
  id: selectionHintVariant.id,
2497
2483
  images: selectionHintVariant.images
@@ -2517,47 +2503,22 @@ function buildProductListingCard(item, options = {}) {
2517
2503
  const product = item.product;
2518
2504
  const groups = item.groups;
2519
2505
  const variants = getProductListingCardVariants(item);
2520
- const projectedListing = buildProductListingProjection(product, variants);
2521
- const selectionHintVariant = getRelationID(
2522
- product.listing && "selectionHintVariant" in product.listing ? product.listing.selectionHintVariant : null
2523
- ) ?? projectedListing.selectionHintVariant;
2506
+ const projectedListing = buildProductListingGroupProjection(product, variants);
2507
+ const selectionHintVariant = getRelationID(product.selectedOrFirstAvailableVariant) ?? projectedListing.selectionHintVariant;
2524
2508
  const representativeVariant = findListingCardRepresentativeVariant(
2525
2509
  variants,
2526
2510
  selectionHintVariant
2527
2511
  );
2528
2512
  const productMediaPool = mediaArray2(product.images);
2529
- const representativeHasPoolMedia = Boolean(
2530
- representativeVariant?.images?.some(
2531
- (image) => productMediaPool.some(
2532
- (poolItem) => getRelationID(poolItem) === getRelationID(image)
2533
- )
2534
- )
2535
- );
2536
- const resolvedPrimaryMedia = resolveProductSelectionMedia(
2537
- {
2538
- productMediaPool,
2539
- productPrimaryMediaItemId: getRelationID(product.primaryMediaItemId),
2540
- selectedVariant: representativeHasPoolMedia ? representativeVariant : null,
2541
- matchingVariants: representativeHasPoolMedia ? [] : variants
2542
- }
2543
- );
2544
- const listingPrimaryPointer = resolveListingPrimaryImagePointer({
2545
- productMediaPool,
2546
- productPrimaryMediaItemId: getRelationID(product.primaryMediaItemId),
2547
- productThumbnail: product.thumbnail ?? null,
2548
- listingPrimaryImage: product.listing?.primaryImage ?? null,
2549
- resolvedPrimary: resolvedPrimaryMedia.primaryImage,
2550
- resolvedSource: resolvedPrimaryMedia.source
2551
- });
2552
- const listingPrimaryMedia = listingPrimaryPointer ? productMediaPool.find(
2553
- (item2) => getRelationID(item2) === listingPrimaryPointer
2554
- ) ?? resolvedPrimaryMedia.primaryImage ?? null : null;
2513
+ const featuredImageId = getRelationID(product.featuredImage);
2514
+ const featuredImageFromPool = featuredImageId ? productMediaPool.find((item2) => getRelationID(item2) === featuredImageId) : void 0;
2515
+ const listingPrimaryMedia = featuredImageFromPool ?? product.featuredImage ?? productMediaPool[0] ?? null;
2555
2516
  const priceRange = resolveListingCardPriceRange(
2556
2517
  product,
2557
2518
  projectedListing,
2558
2519
  groups
2559
2520
  );
2560
- const availableForSale = product.listing?.availableForSale != null ? product.listing.availableForSale : groups.length > 0 ? groups.some((group) => group.listing.availableForSale) : projectedListing.availableForSale;
2521
+ const availableForSale = product.availableForSale != null ? product.availableForSale : groups.length > 0 ? groups.some((group) => group.listing.availableForSale) : projectedListing.availableForSale;
2561
2522
  const swatches = groups.length > 1 ? groups.map((group) => buildListingSwatch(product, group, options)) : [];
2562
2523
  return {
2563
2524
  id: String(product.id),
@@ -2597,23 +2558,20 @@ function findListingCardRepresentativeVariant(variants, representativeVariantId)
2597
2558
  (variant) => getRelationID(variant.id) === representativeVariantId
2598
2559
  ) ?? null;
2599
2560
  }
2600
- function hasCompleteListingPriceProjection(listing) {
2601
- return listing?.minPrice != null && listing?.maxPrice != null;
2602
- }
2603
- function listingDefinesCompareAtProjection(listing) {
2604
- return "minCompareAtPrice" in listing || "maxCompareAtPrice" in listing;
2561
+ function hasCompleteProductPriceRange(priceRange) {
2562
+ return priceRange?.minVariantPrice?.amount != null && priceRange?.maxVariantPrice?.amount != null;
2605
2563
  }
2606
2564
  function resolveListingCardPriceRange(product, projectedListing, groups) {
2607
- const listing = product.listing;
2608
- if (hasCompleteListingPriceProjection(listing)) {
2565
+ if (hasCompleteProductPriceRange(product.priceRange)) {
2609
2566
  const groupRange = groups.length > 0 ? aggregateListingPriceRange(groups) : null;
2610
- const definesCompareAt = listingDefinesCompareAtProjection(listing);
2567
+ const minCompareAtPrice = product.compareAtPriceRange?.minVariantPrice?.amount ?? groupRange?.minCompareAtPrice ?? null;
2568
+ const maxCompareAtPrice = product.compareAtPriceRange?.maxVariantPrice?.amount ?? groupRange?.maxCompareAtPrice ?? null;
2611
2569
  return {
2612
- minPrice: listing.minPrice,
2613
- maxPrice: listing.maxPrice,
2614
- minCompareAtPrice: definesCompareAt ? listing.minCompareAtPrice ?? null : groupRange?.minCompareAtPrice ?? projectedListing.minCompareAtPrice,
2615
- maxCompareAtPrice: definesCompareAt ? listing.maxCompareAtPrice ?? null : groupRange?.maxCompareAtPrice ?? projectedListing.maxCompareAtPrice,
2616
- isPriceRange: listing.isPriceRange ?? listing.minPrice !== listing.maxPrice
2570
+ minPrice: product.priceRange.minVariantPrice.amount,
2571
+ maxPrice: product.priceRange.maxVariantPrice.amount,
2572
+ minCompareAtPrice,
2573
+ maxCompareAtPrice,
2574
+ isPriceRange: product.priceRange.isPriceRange ?? product.priceRange.minVariantPrice.amount !== product.priceRange.maxVariantPrice.amount
2617
2575
  };
2618
2576
  }
2619
2577
  if (groups.length > 0) {
@@ -2725,15 +2683,19 @@ function buildProductListingPageWhere(params) {
2725
2683
  if (tagIds) clauses.push({ tags: { in: tagIds } });
2726
2684
  const minPrice = filters?.price?.min;
2727
2685
  if (minPrice != null) {
2728
- clauses.push({ "listing.maxPrice": { greater_than_equal: minPrice } });
2686
+ clauses.push({
2687
+ "priceRange.maxVariantPrice.amount": { greater_than_equal: minPrice }
2688
+ });
2729
2689
  }
2730
2690
  const maxPrice = filters?.price?.max;
2731
2691
  if (maxPrice != null) {
2732
- clauses.push({ "listing.minPrice": { less_than_equal: maxPrice } });
2692
+ clauses.push({
2693
+ "priceRange.minVariantPrice.amount": { less_than_equal: maxPrice }
2694
+ });
2733
2695
  }
2734
2696
  if (filters?.availableForSale != null) {
2735
2697
  clauses.push({
2736
- "listing.availableForSale": { equals: filters.availableForSale }
2698
+ availableForSale: { equals: filters.availableForSale }
2737
2699
  });
2738
2700
  }
2739
2701
  if (clauses.length === 0) return void 0;
@@ -2970,6 +2932,12 @@ var OrderApi = class extends BaseApi {
2970
2932
  idempotencyRequestOptions(params.idempotencyKey)
2971
2933
  );
2972
2934
  }
2935
+ /**
2936
+ * Returns a `PublicOrder`-compatible shape even when the server backs the
2937
+ * response with a Checkout (checkout/order separation, #1285). `orderNumber`
2938
+ * stays the stable cross-window key. A breaking `PublicCheckout` split is a
2939
+ * deferred follow-up (design D10 / Q3-b); do not change this return type here.
2940
+ */
2973
2941
  checkout(params) {
2974
2942
  const { body, idempotencyKey } = splitIdempotencyKey(params);
2975
2943
  return this.request(