@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
@@ -1,7 +1,7 @@
1
- import { D as DebugConfig, x as RetryConfig, f as ApiQueryOptions, P as PayloadFindResponse, n as PayloadMutationResponse, ax as PublicReadQueryOptions } from './types-CVf8sCZ-.js';
1
+ import { D as DebugConfig, x as RetryConfig, f as ApiQueryOptions, P as PayloadFindResponse, n as PayloadMutationResponse, ax as PublicReadQueryOptions } from './types-Umd-YTjM.js';
2
2
  import { GenerateMetadataOptions, Metadata } from './metadata.js';
3
- import { S as ServerCollection, P as PublicCollection } from './const-6XHz_jej.js';
4
- import { C as CollectionType } from './types-Cmrd1ezc.js';
3
+ import { S as ServerCollection, P as PublicCollection } from './const-ymprfiPf.js';
4
+ import { C as CollectionType } from './types-Bh2p-EMc.js';
5
5
 
6
6
  interface FetchOptions extends RequestInit {
7
7
  apiUrl?: string;
@@ -1,7 +1,7 @@
1
- import { D as DebugConfig, x as RetryConfig, f as ApiQueryOptions, P as PayloadFindResponse, n as PayloadMutationResponse, ax as PublicReadQueryOptions } from './types-BQo7UdI9.cjs';
1
+ import { D as DebugConfig, x as RetryConfig, f as ApiQueryOptions, P as PayloadFindResponse, n as PayloadMutationResponse, ax as PublicReadQueryOptions } from './types-D5uHrPLr.cjs';
2
2
  import { GenerateMetadataOptions, Metadata } from './metadata.cjs';
3
- import { S as ServerCollection, P as PublicCollection } from './const-B5KT72c7.cjs';
4
- import { C as CollectionType } from './types-D0ubzQw0.cjs';
3
+ import { S as ServerCollection, P as PublicCollection } from './const-4BUtUdGU.cjs';
4
+ import { C as CollectionType } from './types-BvpjooU-.cjs';
5
5
 
6
6
  interface FetchOptions extends RequestInit {
7
7
  apiUrl?: string;
@@ -0,0 +1,32 @@
1
+ import { d as Config } from './payload-types-DC0xzR9i.cjs';
2
+
3
+ /**
4
+ * Collection type derived from Payload Config.
5
+ * This ensures type safety and automatic synchronization with payload-types.ts
6
+ */
7
+ type Collection = keyof Config['collections'];
8
+ /**
9
+ * Internal collections that should not be exposed via SDK.
10
+ * Includes Payload system collections and admin-only collections.
11
+ */
12
+ declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-locked-documents", "payload-preferences", "payload-migrations", "payload-folders", "field-configs", "system-media", "track-assets", "audiences", "email-logs", "api-usage", "tenant-analytics-daily", "tenant-web-analytics-config", "analytics-event-schemas", "subscriptions", "billing-history", "inventory-reservations", "inventory-adjustments", "commerce-notification-intents", "product-collection-items", "order-status-logs", "tenant-commerce-config", "api-keys", "personal-access-tokens", "tenant-entitlements", "tenant-purge-jobs", "direct-upload-sessions", "webhook-events", "webhook-deliveries", "audit-logs", "plans", "webhooks", "event-registrations"];
13
+ /**
14
+ * Array of browser-public collection names for runtime use (e.g., Zod enum validation).
15
+ * This is the single source of truth for publishable-key collection discovery.
16
+ */
17
+ declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "customer-profiles", "customer-profile-stats", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags"];
18
+ /**
19
+ * Server-auth collection names for runtime use. These collections are safe for
20
+ * secret-key/PAT SDK and MCP server tools, but must not appear in browser or
21
+ * publishable-key collection discovery.
22
+ */
23
+ declare const SERVER_ONLY_COLLECTIONS: readonly ["tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "checkouts", "checkout-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "canvas-nodes", "canvas-edges", "customer-groups", "reports", "community-bans", "order-export-profiles"];
24
+ /**
25
+ * Browser-public collections available for publishable-key SDK access.
26
+ * Derived from the COLLECTIONS array (single source of truth).
27
+ */
28
+ type PublicCollection = (typeof COLLECTIONS)[number];
29
+ declare const SERVER_COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "customer-profiles", "customer-profile-stats", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags", "tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "checkouts", "checkout-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "canvas-nodes", "canvas-edges", "customer-groups", "reports", "community-bans", "order-export-profiles"];
30
+ type ServerCollection = (typeof SERVER_COLLECTIONS)[number];
31
+
32
+ export { type Collection as C, INTERNAL_COLLECTIONS as I, type PublicCollection as P, type ServerCollection as S, COLLECTIONS as a, SERVER_COLLECTIONS as b, SERVER_ONLY_COLLECTIONS as c };
@@ -0,0 +1,32 @@
1
+ import { d as Config } from './payload-types-DC0xzR9i.js';
2
+
3
+ /**
4
+ * Collection type derived from Payload Config.
5
+ * This ensures type safety and automatic synchronization with payload-types.ts
6
+ */
7
+ type Collection = keyof Config['collections'];
8
+ /**
9
+ * Internal collections that should not be exposed via SDK.
10
+ * Includes Payload system collections and admin-only collections.
11
+ */
12
+ declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-locked-documents", "payload-preferences", "payload-migrations", "payload-folders", "field-configs", "system-media", "track-assets", "audiences", "email-logs", "api-usage", "tenant-analytics-daily", "tenant-web-analytics-config", "analytics-event-schemas", "subscriptions", "billing-history", "inventory-reservations", "inventory-adjustments", "commerce-notification-intents", "product-collection-items", "order-status-logs", "tenant-commerce-config", "api-keys", "personal-access-tokens", "tenant-entitlements", "tenant-purge-jobs", "direct-upload-sessions", "webhook-events", "webhook-deliveries", "audit-logs", "plans", "webhooks", "event-registrations"];
13
+ /**
14
+ * Array of browser-public collection names for runtime use (e.g., Zod enum validation).
15
+ * This is the single source of truth for publishable-key collection discovery.
16
+ */
17
+ declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "customer-profiles", "customer-profile-stats", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags"];
18
+ /**
19
+ * Server-auth collection names for runtime use. These collections are safe for
20
+ * secret-key/PAT SDK and MCP server tools, but must not appear in browser or
21
+ * publishable-key collection discovery.
22
+ */
23
+ declare const SERVER_ONLY_COLLECTIONS: readonly ["tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "checkouts", "checkout-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "canvas-nodes", "canvas-edges", "customer-groups", "reports", "community-bans", "order-export-profiles"];
24
+ /**
25
+ * Browser-public collections available for publishable-key SDK access.
26
+ * Derived from the COLLECTIONS array (single source of truth).
27
+ */
28
+ type PublicCollection = (typeof COLLECTIONS)[number];
29
+ declare const SERVER_COLLECTIONS: readonly ["tenants", "tenant-metadata", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "customer-profiles", "customer-profile-stats", "discounts", "shipping-policies", "shipping-zones", "documents", "document-categories", "document-types", "articles", "article-authors", "article-categories", "article-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "video-categories", "video-tags", "forms", "reaction-types", "post-categories", "post-tags", "customer-profile-lists", "event-calendars", "events", "event-categories", "event-occurrences", "event-tags", "tenant-logos", "brand-logos", "images", "videos", "orders", "order-items", "returns", "return-items", "fulfillment-orders", "fulfillment-order-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "form-submissions", "carts", "cart-items", "checkouts", "checkout-items", "posts", "comments", "reactions", "bookmarks", "live-streams", "canvas-nodes", "canvas-edges", "customer-groups", "reports", "community-bans", "order-export-profiles"];
30
+ type ServerCollection = (typeof SERVER_COLLECTIONS)[number];
31
+
32
+ export { type Collection as C, INTERNAL_COLLECTIONS as I, type PublicCollection as P, type ServerCollection as S, COLLECTIONS as a, SERVER_COLLECTIONS as b, SERVER_ONLY_COLLECTIONS as c };
@@ -1,6 +1,6 @@
1
- import { C as Collection } from './const-B5KT72c7.cjs';
2
- import { C as CollectionType } from './types-D0ubzQw0.cjs';
3
- import './payload-types-m3jjhxk9.cjs';
1
+ import { C as Collection } from './const-4BUtUdGU.cjs';
2
+ import { C as CollectionType } from './types-BvpjooU-.cjs';
3
+ import './payload-types-DC0xzR9i.cjs';
4
4
 
5
5
  type WebhookOperation = string;
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { C as Collection } from './const-6XHz_jej.js';
2
- import { C as CollectionType } from './types-Cmrd1ezc.js';
3
- import './payload-types-m3jjhxk9.js';
1
+ import { C as Collection } from './const-ymprfiPf.js';
2
+ import { C as CollectionType } from './types-Bh2p-EMc.js';
3
+ import './payload-types-DC0xzR9i.js';
4
4
 
5
5
  type WebhookOperation = string;
6
6
  /**
package/dist/index.cjs CHANGED
@@ -63,8 +63,8 @@ __export(src_exports, {
63
63
  ValidationError: () => ValidationError,
64
64
  buildProductHref: () => buildProductHref,
65
65
  buildProductListingCard: () => buildProductListingCard,
66
+ buildProductListingGroupProjection: () => buildProductListingGroupProjection,
66
67
  buildProductListingGroupsByOption: () => buildProductListingGroupsByOption,
67
- buildProductListingProjection: () => buildProductListingProjection,
68
68
  buildProductOptionMatrix: () => buildProductOptionMatrix,
69
69
  buildProductOptionMatrixFromDetail: () => buildProductOptionMatrixFromDetail,
70
70
  createAnalytics: () => createAnalytics,
@@ -123,7 +123,7 @@ __export(src_exports, {
123
123
  normalizeProductSelectionFromMatrix: () => normalizeProductSelectionFromMatrix,
124
124
  normalizeSelectedValueIds: () => normalizeSelectedValueIds,
125
125
  parseProductSelection: () => parseProductSelection,
126
- resolveListingPrimaryImagePointer: () => resolveListingPrimaryImagePointer,
126
+ resolveFeaturedImagePointer: () => resolveFeaturedImagePointer,
127
127
  resolveProductDisplayMedia: () => resolveProductDisplayMedia,
128
128
  resolveProductGallery: () => resolveProductGallery,
129
129
  resolveProductMedia: () => resolveProductMedia,
@@ -1667,6 +1667,19 @@ var CustomerAuth = class {
1667
1667
  const params = new URLSearchParams();
1668
1668
  if (options?.page) params.set("page", String(options.page));
1669
1669
  if (options?.limit) params.set("limit", String(options.limit));
1670
+ if (options?.displayFinancialStatus) {
1671
+ params.set("displayFinancialStatus", options.displayFinancialStatus);
1672
+ }
1673
+ if (options?.displayFulfillmentStatus) {
1674
+ params.set("displayFulfillmentStatus", options.displayFulfillmentStatus);
1675
+ }
1676
+ if (options?.returnStatus) params.set("returnStatus", options.returnStatus);
1677
+ if (options?.primaryDisplayStatus) {
1678
+ params.set("primaryDisplayStatus", options.primaryDisplayStatus);
1679
+ }
1680
+ if (options?.returnDisplayStatus) {
1681
+ params.set("returnDisplayStatus", options.returnDisplayStatus);
1682
+ }
1670
1683
  if (options?.status) params.set("status", options.status);
1671
1684
  const qs = params.toString();
1672
1685
  return this.requestJson(`/api/customers/me/orders${qs ? `?${qs}` : ""}`, {
@@ -1939,25 +1952,14 @@ function resolveProductSelectionMedia(input) {
1939
1952
  function resolveProductDisplayMedia(input) {
1940
1953
  const pool = mediaArray(input.productMediaPool);
1941
1954
  const poolById = buildPoolById(pool);
1942
- const listingPointer = toPointerId(input.listingPrimaryImage);
1943
- if (listingPointer) {
1944
- const listingPrimary = poolById.get(listingPointer);
1945
- if (listingPrimary) {
1955
+ const featuredImagePointer = toPointerId(input.featuredImage);
1956
+ if (featuredImagePointer) {
1957
+ const featuredImage = poolById.get(featuredImagePointer);
1958
+ if (featuredImage) {
1946
1959
  return {
1947
- primaryImage: listingPrimary,
1948
- images: uniqueWithPrimaryFirst(listingPrimary, pool),
1949
- source: "listing_primary"
1950
- };
1951
- }
1952
- }
1953
- const productPrimaryPointer = getMediaId(input.productPrimaryMediaItemId);
1954
- if (productPrimaryPointer) {
1955
- const productPrimary = poolById.get(productPrimaryPointer);
1956
- if (productPrimary) {
1957
- return {
1958
- primaryImage: productPrimary,
1959
- images: uniqueWithPrimaryFirst(productPrimary, pool),
1960
- source: "product_primary"
1960
+ primaryImage: featuredImage,
1961
+ images: uniqueWithPrimaryFirst(featuredImage, pool),
1962
+ source: "featured_image"
1961
1963
  };
1962
1964
  }
1963
1965
  }
@@ -1977,22 +1979,16 @@ function resolveProductDisplayMedia(input) {
1977
1979
  source: "none"
1978
1980
  };
1979
1981
  }
1980
- function resolveListingPrimaryImagePointer(input) {
1982
+ function resolveFeaturedImagePointer(input) {
1981
1983
  const pool = mediaArray(input.productMediaPool);
1982
1984
  const resolvedPointer = getMediaId(input.resolvedPrimary);
1983
1985
  if (resolvedPointer && input.resolvedSource !== "product_pool" && input.resolvedSource !== "none") {
1984
1986
  return resolvedPointer;
1985
1987
  }
1986
1988
  const poolById = buildPoolById(pool);
1987
- const listingPointer = getMediaId(input.listingPrimaryImage);
1988
- if (listingPointer && poolById.has(listingPointer)) {
1989
- return listingPointer;
1990
- }
1991
- const primaryPointer = toPointerId(input.productPrimaryMediaItemId);
1992
- if (primaryPointer && poolById.has(primaryPointer)) return primaryPointer;
1993
- const thumbnailPointer = getMediaId(input.productThumbnail);
1994
- if (thumbnailPointer && poolById.has(thumbnailPointer)) {
1995
- return thumbnailPointer;
1989
+ const featuredImagePointer = getMediaId(input.featuredImage);
1990
+ if (featuredImagePointer && poolById.has(featuredImagePointer)) {
1991
+ return featuredImagePointer;
1996
1992
  }
1997
1993
  if (pool.length > 0) {
1998
1994
  const firstPoolId = getMediaId(pool[0]);
@@ -2071,18 +2067,22 @@ function getFirstMediaId(values) {
2071
2067
  }
2072
2068
  return null;
2073
2069
  }
2070
+ function inProductMediaPool(product, mediaId2) {
2071
+ if (mediaId2 == null) return null;
2072
+ const images = Array.isArray(product?.images) ? product.images : [];
2073
+ for (const image of images) {
2074
+ if (extractEntityId(image) === mediaId2) return mediaId2;
2075
+ }
2076
+ return null;
2077
+ }
2074
2078
  function getVariantPrimaryImage(variant) {
2075
2079
  if (!variant) return null;
2076
2080
  return extractEntityId(variant.thumbnail) ?? getFirstMediaId(variant.images);
2077
2081
  }
2078
2082
  function resolveGenericListingPrimaryImage(product, resolvedPrimary, resolvedSource) {
2079
- return resolveListingPrimaryImagePointer({
2083
+ return resolveFeaturedImagePointer({
2080
2084
  productMediaPool: product?.images ?? [],
2081
- productPrimaryMediaItemId: getRelationID(
2082
- product?.primaryMediaItemId ?? null
2083
- ),
2084
- productThumbnail: product?.thumbnail ?? null,
2085
- listingPrimaryImage: product?.listing?.primaryImage ?? null,
2085
+ featuredImage: product?.featuredImage ?? null,
2086
2086
  resolvedPrimary,
2087
2087
  resolvedSource
2088
2088
  });
@@ -2735,7 +2735,7 @@ function normalizedSelectionFromByOptionId(matrix, selectedByOptionId, variantId
2735
2735
  variantId
2736
2736
  };
2737
2737
  }
2738
- function buildFilledNormalizedSelection(matrix, normalizedSelection, listing) {
2738
+ function buildFilledNormalizedSelection(matrix, normalizedSelection, selectionHintVariant) {
2739
2739
  const selectedByOptionId = new Map(
2740
2740
  Object.entries(normalizedSelection.byOptionId)
2741
2741
  );
@@ -2776,7 +2776,7 @@ function buildFilledNormalizedSelection(matrix, normalizedSelection, listing) {
2776
2776
  const orderedMatches = [...matchingVariantEntries].sort(
2777
2777
  (left, right) => compareVariantOrder(left.source, right.source)
2778
2778
  );
2779
- const hintVariantId = listing.selectionHintVariant != null ? String(listing.selectionHintVariant) : null;
2779
+ const hintVariantId = selectionHintVariant != null ? String(selectionHintVariant) : null;
2780
2780
  const hintedEntry = hintVariantId != null ? orderedMatches.find((entry) => entry.id === hintVariantId) : void 0;
2781
2781
  const availableEntry = orderedMatches.find(
2782
2782
  (entry) => isVariantAvailableForSale(entry.source)
@@ -2835,7 +2835,6 @@ function buildSelectionMedia(detail, selectedVariant, matchingVariants, selected
2835
2835
  const productPool = mediaArray2(detail.images);
2836
2836
  const resolvedMedia = resolveProductSelectionMedia({
2837
2837
  productMediaPool: productPool,
2838
- productPrimaryMediaItemId: getRelationID(detail.primaryMediaItemId),
2839
2838
  selectedVariant: selectedVariant ? {
2840
2839
  id: selectedVariant.id,
2841
2840
  images: selectedVariant.images
@@ -2858,8 +2857,7 @@ function buildSelectionMedia(detail, selectedVariant, matchingVariants, selected
2858
2857
  }
2859
2858
  const displayMedia = resolveProductDisplayMedia({
2860
2859
  productMediaPool: productPool,
2861
- productPrimaryMediaItemId: getRelationID(detail.primaryMediaItemId),
2862
- listingPrimaryImage: detail.listing.primaryImage ?? null
2860
+ featuredImage: detail.featuredImage ?? null
2863
2861
  });
2864
2862
  if (displayMedia.source !== "none") {
2865
2863
  return {
@@ -2929,14 +2927,15 @@ function getCandidateVariantsForValue(matrix, optionId, valueId, selectedValueId
2929
2927
  }
2930
2928
  function getResolutionContext(context) {
2931
2929
  return {
2930
+ featuredImage: context?.featuredImage ?? context?.detail?.featuredImage,
2932
2931
  images: context?.images ?? context?.detail?.images ?? [],
2933
- listing: context?.listing ?? context?.detail?.listing ?? {},
2934
- primaryMediaItemId: context?.primaryMediaItemId ?? context?.detail?.primaryMediaItemId ?? null
2932
+ selectedOrFirstAvailableVariant: context?.selectedOrFirstAvailableVariant ?? context?.detail?.selectedOrFirstAvailableVariant
2935
2933
  };
2936
2934
  }
2937
2935
  function resolveProductSelectionFromMatrix(matrix, selection = {}, options, context) {
2938
- const { images, listing, primaryMediaItemId } = getResolutionContext(context);
2939
- const effectiveSelection = hasExplicitSelection(selection) || listing.selectionHintVariant == null ? selection : { ...selection, variantId: listing.selectionHintVariant };
2936
+ const { featuredImage, images, selectedOrFirstAvailableVariant } = getResolutionContext(context);
2937
+ const selectionHintVariant = getRelationID(selectedOrFirstAvailableVariant);
2938
+ const effectiveSelection = hasExplicitSelection(selection) || selectionHintVariant == null ? selection : { ...selection, variantId: selectionHintVariant };
2940
2939
  let normalizedSelection = normalizeProductSelectionFromMatrix(
2941
2940
  matrix,
2942
2941
  effectiveSelection,
@@ -2946,7 +2945,7 @@ function resolveProductSelectionFromMatrix(matrix, selection = {}, options, cont
2946
2945
  normalizedSelection = buildFilledNormalizedSelection(
2947
2946
  matrix,
2948
2947
  normalizedSelection,
2949
- listing
2948
+ selectionHintVariant
2950
2949
  );
2951
2950
  }
2952
2951
  const matchingVariantEntries = getMatchingVariantEntries(
@@ -3017,11 +3016,8 @@ function resolveProductSelectionFromMatrix(matrix, selection = {}, options, cont
3017
3016
  price: buildSelectionPrice(priceVariants),
3018
3017
  media: buildSelectionMedia(
3019
3018
  {
3020
- images,
3021
- listing: {
3022
- primaryImage: listing.primaryImage ?? null
3023
- },
3024
- primaryMediaItemId
3019
+ featuredImage,
3020
+ images
3025
3021
  },
3026
3022
  selectedVariant,
3027
3023
  matchingVariants,
@@ -3038,7 +3034,9 @@ function resolveProductSelection(detail, selection = {}, options) {
3038
3034
  }
3039
3035
  function selectNext(detail, current = {}, optionSlug, valueSlug, options) {
3040
3036
  const matrix = buildProductOptionMatrixFromDetail(detail);
3041
- const listing = detail.listing ?? {};
3037
+ const selectionHintVariant = getRelationID(
3038
+ detail.selectedOrFirstAvailableVariant
3039
+ );
3042
3040
  const normalizedCurrent = normalizeProductSelectionFromMatrix(
3043
3041
  matrix,
3044
3042
  current,
@@ -3074,7 +3072,7 @@ function selectNext(detail, current = {}, optionSlug, valueSlug, options) {
3074
3072
  return buildFilledNormalizedSelection(
3075
3073
  matrix,
3076
3074
  normalizedSelectionFromByOptionId(matrix, selectedByOptionId, null),
3077
- listing
3075
+ selectionHintVariant
3078
3076
  );
3079
3077
  };
3080
3078
  const keepPriorSelection = () => {
@@ -3085,7 +3083,7 @@ function selectNext(detail, current = {}, optionSlug, valueSlug, options) {
3085
3083
  return buildFilledNormalizedSelection(
3086
3084
  matrix,
3087
3085
  normalizedSelectionFromByOptionId(matrix, selectedByOptionId, null),
3088
- listing
3086
+ selectionHintVariant
3089
3087
  );
3090
3088
  };
3091
3089
  const clickedResult = keepClickedSelection();
@@ -3295,7 +3293,7 @@ function getMinMax(values) {
3295
3293
  max: Math.max(...numbers)
3296
3294
  };
3297
3295
  }
3298
- function buildProductListingProjection(product, variants) {
3296
+ function buildProductListingGroupProjection(product, variants) {
3299
3297
  const orderedVariants = [...variants].sort(compareVariantOrder);
3300
3298
  const activeVariants = orderedVariants.filter(
3301
3299
  (variant) => variant.isActive !== false
@@ -3316,7 +3314,6 @@ function buildProductListingProjection(product, variants) {
3316
3314
  const mediaSelectionVariants = sortVariantsForMediaSelection(variants);
3317
3315
  const resolvedProductMedia = resolveProductSelectionMedia({
3318
3316
  productMediaPool,
3319
- productPrimaryMediaItemId: getRelationID(product?.primaryMediaItemId),
3320
3317
  selectedVariant: selectionHintVariant && selectionHintHasPoolMedia ? {
3321
3318
  id: selectionHintVariant.id,
3322
3319
  images: selectionHintVariant.images
@@ -3342,47 +3339,22 @@ function buildProductListingCard(item, options = {}) {
3342
3339
  const product = item.product;
3343
3340
  const groups = item.groups;
3344
3341
  const variants = getProductListingCardVariants(item);
3345
- const projectedListing = buildProductListingProjection(product, variants);
3346
- const selectionHintVariant = getRelationID(
3347
- product.listing && "selectionHintVariant" in product.listing ? product.listing.selectionHintVariant : null
3348
- ) ?? projectedListing.selectionHintVariant;
3342
+ const projectedListing = buildProductListingGroupProjection(product, variants);
3343
+ const selectionHintVariant = getRelationID(product.selectedOrFirstAvailableVariant) ?? projectedListing.selectionHintVariant;
3349
3344
  const representativeVariant = findListingCardRepresentativeVariant(
3350
3345
  variants,
3351
3346
  selectionHintVariant
3352
3347
  );
3353
3348
  const productMediaPool = mediaArray2(product.images);
3354
- const representativeHasPoolMedia = Boolean(
3355
- representativeVariant?.images?.some(
3356
- (image) => productMediaPool.some(
3357
- (poolItem) => getRelationID(poolItem) === getRelationID(image)
3358
- )
3359
- )
3360
- );
3361
- const resolvedPrimaryMedia = resolveProductSelectionMedia(
3362
- {
3363
- productMediaPool,
3364
- productPrimaryMediaItemId: getRelationID(product.primaryMediaItemId),
3365
- selectedVariant: representativeHasPoolMedia ? representativeVariant : null,
3366
- matchingVariants: representativeHasPoolMedia ? [] : variants
3367
- }
3368
- );
3369
- const listingPrimaryPointer = resolveListingPrimaryImagePointer({
3370
- productMediaPool,
3371
- productPrimaryMediaItemId: getRelationID(product.primaryMediaItemId),
3372
- productThumbnail: product.thumbnail ?? null,
3373
- listingPrimaryImage: product.listing?.primaryImage ?? null,
3374
- resolvedPrimary: resolvedPrimaryMedia.primaryImage,
3375
- resolvedSource: resolvedPrimaryMedia.source
3376
- });
3377
- const listingPrimaryMedia = listingPrimaryPointer ? productMediaPool.find(
3378
- (item2) => getRelationID(item2) === listingPrimaryPointer
3379
- ) ?? resolvedPrimaryMedia.primaryImage ?? null : null;
3349
+ const featuredImageId = getRelationID(product.featuredImage);
3350
+ const featuredImageFromPool = featuredImageId ? productMediaPool.find((item2) => getRelationID(item2) === featuredImageId) : void 0;
3351
+ const listingPrimaryMedia = featuredImageFromPool ?? product.featuredImage ?? productMediaPool[0] ?? null;
3380
3352
  const priceRange = resolveListingCardPriceRange(
3381
3353
  product,
3382
3354
  projectedListing,
3383
3355
  groups
3384
3356
  );
3385
- const availableForSale = product.listing?.availableForSale != null ? product.listing.availableForSale : groups.length > 0 ? groups.some((group) => group.listing.availableForSale) : projectedListing.availableForSale;
3357
+ const availableForSale = product.availableForSale != null ? product.availableForSale : groups.length > 0 ? groups.some((group) => group.listing.availableForSale) : projectedListing.availableForSale;
3386
3358
  const swatches = groups.length > 1 ? groups.map((group) => buildListingSwatch(product, group, options)) : [];
3387
3359
  return {
3388
3360
  id: String(product.id),
@@ -3428,23 +3400,20 @@ function toShopifyPriceRangeV2(listing) {
3428
3400
  maxVariantPrice: { amount: listing.maxPrice ?? null }
3429
3401
  };
3430
3402
  }
3431
- function hasCompleteListingPriceProjection(listing) {
3432
- return listing?.minPrice != null && listing?.maxPrice != null;
3433
- }
3434
- function listingDefinesCompareAtProjection(listing) {
3435
- return "minCompareAtPrice" in listing || "maxCompareAtPrice" in listing;
3403
+ function hasCompleteProductPriceRange(priceRange) {
3404
+ return priceRange?.minVariantPrice?.amount != null && priceRange?.maxVariantPrice?.amount != null;
3436
3405
  }
3437
3406
  function resolveListingCardPriceRange(product, projectedListing, groups) {
3438
- const listing = product.listing;
3439
- if (hasCompleteListingPriceProjection(listing)) {
3407
+ if (hasCompleteProductPriceRange(product.priceRange)) {
3440
3408
  const groupRange = groups.length > 0 ? aggregateListingPriceRange(groups) : null;
3441
- const definesCompareAt = listingDefinesCompareAtProjection(listing);
3409
+ const minCompareAtPrice = product.compareAtPriceRange?.minVariantPrice?.amount ?? groupRange?.minCompareAtPrice ?? null;
3410
+ const maxCompareAtPrice = product.compareAtPriceRange?.maxVariantPrice?.amount ?? groupRange?.maxCompareAtPrice ?? null;
3442
3411
  return {
3443
- minPrice: listing.minPrice,
3444
- maxPrice: listing.maxPrice,
3445
- minCompareAtPrice: definesCompareAt ? listing.minCompareAtPrice ?? null : groupRange?.minCompareAtPrice ?? projectedListing.minCompareAtPrice,
3446
- maxCompareAtPrice: definesCompareAt ? listing.maxCompareAtPrice ?? null : groupRange?.maxCompareAtPrice ?? projectedListing.maxCompareAtPrice,
3447
- isPriceRange: listing.isPriceRange ?? listing.minPrice !== listing.maxPrice
3412
+ minPrice: product.priceRange.minVariantPrice.amount,
3413
+ maxPrice: product.priceRange.maxVariantPrice.amount,
3414
+ minCompareAtPrice,
3415
+ maxCompareAtPrice,
3416
+ isPriceRange: product.priceRange.isPriceRange ?? product.priceRange.minVariantPrice.amount !== product.priceRange.maxVariantPrice.amount
3448
3417
  };
3449
3418
  }
3450
3419
  if (groups.length > 0) {
@@ -3526,26 +3495,13 @@ function buildProductListingGroupsByOption(args) {
3526
3495
  if (variants.length === 0) {
3527
3496
  return [];
3528
3497
  }
3529
- const listingBase = buildProductListingProjection(void 0, variants);
3530
- const orderedVariants = sortVariantsForMediaSelection(variants);
3531
- const productMediaPool = (args.product?.images ?? []).filter(
3532
- (image) => image != null && typeof image === "object"
3533
- );
3534
- const resolvedMedia = resolveProductSelectionMedia({
3535
- productMediaPool,
3536
- productPrimaryMediaItemId: extractEntityId(
3537
- args.product?.primaryMediaItemId ?? null
3538
- ),
3539
- selectedVariant: null,
3540
- matchingVariants: orderedVariants,
3541
- selectedOptionValues: [
3542
- {
3543
- id: value.id,
3544
- swatch: normalizeMatrixSwatch(value.swatch)
3545
- }
3546
- ]
3547
- });
3548
- const groupPrimaryImage = extractEntityId(resolvedMedia.primaryImage) ?? getFirstAvailableVariantPrimaryImage(variants) ?? extractEntityId(args.product?.thumbnail) ?? getFirstMediaId(args.product?.images);
3498
+ const listingBase = buildProductListingGroupProjection(void 0, variants);
3499
+ const normalizedSwatch = normalizeMatrixSwatch(value.swatch);
3500
+ const swatchMediaId = normalizedSwatch?.mediaItemId == null ? null : String(normalizedSwatch.mediaItemId);
3501
+ const groupPrimaryImage = inProductMediaPool(args.product, swatchMediaId) ?? inProductMediaPool(
3502
+ args.product,
3503
+ getFirstAvailableVariantPrimaryImage(variants)
3504
+ ) ?? getFirstMediaId(args.product?.images);
3549
3505
  return [
3550
3506
  {
3551
3507
  optionId: primaryOption.id,
@@ -3618,15 +3574,19 @@ function buildProductListingPageWhere(params) {
3618
3574
  if (tagIds) clauses.push({ tags: { in: tagIds } });
3619
3575
  const minPrice = filters?.price?.min;
3620
3576
  if (minPrice != null) {
3621
- clauses.push({ "listing.maxPrice": { greater_than_equal: minPrice } });
3577
+ clauses.push({
3578
+ "priceRange.maxVariantPrice.amount": { greater_than_equal: minPrice }
3579
+ });
3622
3580
  }
3623
3581
  const maxPrice = filters?.price?.max;
3624
3582
  if (maxPrice != null) {
3625
- clauses.push({ "listing.minPrice": { less_than_equal: maxPrice } });
3583
+ clauses.push({
3584
+ "priceRange.minVariantPrice.amount": { less_than_equal: maxPrice }
3585
+ });
3626
3586
  }
3627
3587
  if (filters?.availableForSale != null) {
3628
3588
  clauses.push({
3629
- "listing.availableForSale": { equals: filters.availableForSale }
3589
+ availableForSale: { equals: filters.availableForSale }
3630
3590
  });
3631
3591
  }
3632
3592
  if (clauses.length === 0) return void 0;
@@ -3851,6 +3811,12 @@ var OrderApi = class extends BaseApi {
3851
3811
  idempotencyRequestOptions(params.idempotencyKey)
3852
3812
  );
3853
3813
  }
3814
+ /**
3815
+ * Returns a `PublicOrder`-compatible shape even when the server backs the
3816
+ * response with a Checkout (checkout/order separation, #1285). `orderNumber`
3817
+ * stays the stable cross-window key. A breaking `PublicCheckout` split is a
3818
+ * deferred follow-up (design D10 / Q3-b); do not change this return type here.
3819
+ */
3854
3820
  checkout(params) {
3855
3821
  const { body, idempotencyKey } = splitIdempotencyKey(params);
3856
3822
  return this.request(
@@ -4228,17 +4194,19 @@ function mergeProductDetailWithStock(catalog, snapshot) {
4228
4194
  (sum, variant) => sum + Math.max(0, (variant.stock ?? 0) - (variant.reservedStock ?? 0)),
4229
4195
  0
4230
4196
  );
4231
- const { liveStockRequired: _liveStockRequired, ...listingBase } = catalog.listing;
4232
4197
  const availableForSale = snapshot.snapshots.some(
4233
4198
  (item) => item.status === "available" && item.availableForSale
4234
4199
  );
4200
+ const selectedVariantId = typeof catalog.selectedOrFirstAvailableVariant === "object" && catalog.selectedOrFirstAvailableVariant !== null ? String(catalog.selectedOrFirstAvailableVariant.id) : catalog.selectedOrFirstAvailableVariant != null ? String(catalog.selectedOrFirstAvailableVariant) : null;
4201
+ const selectedOrFirstAvailableVariant = selectedVariantId != null ? variants.find((variant) => String(variant.id) === selectedVariantId) ?? selectedVariantId : null;
4235
4202
  return {
4236
4203
  stockMergeStatus: missingSnapshotCount === 0 ? "complete" : "partial",
4237
4204
  product: {
4238
4205
  ...catalog,
4239
4206
  product: { ...catalog.product, totalInventory },
4240
4207
  variants,
4241
- listing: { ...listingBase, availableForSale }
4208
+ availableForSale,
4209
+ selectedOrFirstAvailableVariant
4242
4210
  }
4243
4211
  };
4244
4212
  }
@@ -4518,6 +4486,7 @@ var INTERNAL_COLLECTIONS = [
4518
4486
  "commerce-notification-intents",
4519
4487
  "product-collection-items",
4520
4488
  "order-status-logs",
4489
+ "tenant-commerce-config",
4521
4490
  "api-keys",
4522
4491
  "personal-access-tokens",
4523
4492
  "tenant-entitlements",
@@ -4542,6 +4511,7 @@ var COLLECTIONS = [
4542
4511
  "product-collections",
4543
4512
  "brands",
4544
4513
  "customer-profiles",
4514
+ "customer-profile-stats",
4545
4515
  "discounts",
4546
4516
  "shipping-policies",
4547
4517
  "shipping-zones",
@@ -4570,8 +4540,6 @@ var COLLECTIONS = [
4570
4540
  "canvas-edge-types",
4571
4541
  "canvas-categories",
4572
4542
  "canvas-tags",
4573
- "canvas-nodes",
4574
- "canvas-edges",
4575
4543
  "video-categories",
4576
4544
  "video-tags",
4577
4545
  "forms",
@@ -4606,11 +4574,15 @@ var SERVER_ONLY_COLLECTIONS = [
4606
4574
  "form-submissions",
4607
4575
  "carts",
4608
4576
  "cart-items",
4577
+ "checkouts",
4578
+ "checkout-items",
4609
4579
  "posts",
4610
4580
  "comments",
4611
4581
  "reactions",
4612
4582
  "bookmarks",
4613
4583
  "live-streams",
4584
+ "canvas-nodes",
4585
+ "canvas-edges",
4614
4586
  "customer-groups",
4615
4587
  "reports",
4616
4588
  "community-bans",
@@ -4788,8 +4760,7 @@ function resolveProductMedia(input) {
4788
4760
  };
4789
4761
  }
4790
4762
  const display = resolveProductDisplayMedia({
4791
- productMediaPool: input.productMediaPool,
4792
- productPrimaryMediaItemId: input.productPrimaryMediaItemId
4763
+ productMediaPool: input.productMediaPool
4793
4764
  });
4794
4765
  return {
4795
4766
  primaryImage: display.primaryImage,
@@ -4917,8 +4888,7 @@ function resolveProductGallery(input) {
4917
4888
  if (legacyResolved && legacyResolved.source !== "none") return legacyResolved;
4918
4889
  return resolveProductDisplayMedia({
4919
4890
  productMediaPool: input.productMediaPool ?? input.pool ?? null,
4920
- productPrimaryMediaItemId: input.productPrimaryMediaItemId,
4921
- listingPrimaryImage: input.listingPrimaryImage
4891
+ featuredImage: input.featuredImage
4922
4892
  });
4923
4893
  }
4924
4894