@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.
- package/README.md +52 -20
- package/dist/client.cjs +43 -68
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/client.js +43 -68
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-CaMgs5KE.d.ts → collection-client-CKFa99C6.d.ts} +3 -3
- package/dist/{collection-client-DVfB0Em1.d.cts → collection-client-VYwYi6u6.d.cts} +3 -3
- package/dist/const-4BUtUdGU.d.cts +32 -0
- package/dist/const-ymprfiPf.d.ts +32 -0
- package/dist/{index-BOLQxveo.d.cts → index-Dquv4xTL.d.cts} +3 -3
- package/dist/{index-CSwR2HSg.d.ts → index-w36lpSkU.d.ts} +3 -3
- package/dist/index.cjs +101 -131
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +101 -131
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-m3jjhxk9.d.cts → payload-types-DC0xzR9i.d.cts} +470 -265
- package/dist/{payload-types-m3jjhxk9.d.ts → payload-types-DC0xzR9i.d.ts} +470 -265
- package/dist/query.d.cts +5 -5
- package/dist/query.d.ts +5 -5
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/server.cjs +36 -68
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +7 -7
- package/dist/server.d.ts +7 -7
- package/dist/server.js +36 -68
- package/dist/server.js.map +1 -1
- package/dist/{types-Cmrd1ezc.d.ts → types-Bh2p-EMc.d.ts} +5 -1
- package/dist/{types-D0ubzQw0.d.cts → types-BvpjooU-.d.cts} +5 -1
- package/dist/{types-CVf8sCZ-.d.ts → types-D5uHrPLr.d.cts} +99 -77
- package/dist/{types-BQo7UdI9.d.cts → types-Umd-YTjM.d.ts} +99 -77
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/webhook.d.cts +4 -4
- package/dist/webhook.d.ts +4 -4
- package/package.json +1 -1
- package/dist/const-6XHz_jej.d.ts +0 -32
- package/dist/const-B5KT72c7.d.cts +0 -32
package/dist/query.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { QueryClient, UseQueryResult, UseSuspenseQueryResult, InfiniteData, UseInfiniteQueryResult, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query';
|
|
3
|
-
import { f as ApiQueryOptions, P as PayloadFindResponse, ax as PublicReadQueryOptions, n as PayloadMutationResponse, ay as CustomerAuth, az as CustomerProfile, aA as CustomerAuthResponse, aB as CustomerLoginData, aC as CustomerRegisterResponse, aD as CustomerRegisterData, aE as CustomerRefreshResponse, aF as UpdateProfileData, aG as ProductListingPageBaseParams, aH as ProductListingPageParams, aI as ProductDetailParams, aJ as ProductDetailResult, aK as ProductListingPageCatalogParams, aL as ProductListingPageResult, aM as ProductListingGroupsCatalogItem, aN as ProductListingPageFullParams, aO as ProductListingGroupsItem, S as Sort, W as Where, y as RootClient, al as RootServerClient } from './types-
|
|
4
|
-
import './payload-types-
|
|
5
|
-
import { C as CollectionClient } from './collection-client-
|
|
6
|
-
import { S as ServerCollection, P as PublicCollection } from './const-
|
|
7
|
-
import { C as CollectionType } from './types-
|
|
3
|
+
import { f as ApiQueryOptions, P as PayloadFindResponse, ax as PublicReadQueryOptions, n as PayloadMutationResponse, ay as CustomerAuth, az as CustomerProfile, aA as CustomerAuthResponse, aB as CustomerLoginData, aC as CustomerRegisterResponse, aD as CustomerRegisterData, aE as CustomerRefreshResponse, aF as UpdateProfileData, aG as ProductListingPageBaseParams, aH as ProductListingPageParams, aI as ProductDetailParams, aJ as ProductDetailResult, aK as ProductListingPageCatalogParams, aL as ProductListingPageResult, aM as ProductListingGroupsCatalogItem, aN as ProductListingPageFullParams, aO as ProductListingGroupsItem, S as Sort, W as Where, y as RootClient, al as RootServerClient } from './types-D5uHrPLr.cjs';
|
|
4
|
+
import './payload-types-DC0xzR9i.cjs';
|
|
5
|
+
import { C as CollectionClient } from './collection-client-VYwYi6u6.cjs';
|
|
6
|
+
import { S as ServerCollection, P as PublicCollection } from './const-4BUtUdGU.cjs';
|
|
7
|
+
import { C as CollectionType } from './types-BvpjooU-.cjs';
|
|
8
8
|
import { SDKError } from './errors.cjs';
|
|
9
9
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.cjs';
|
|
10
10
|
import './metadata.cjs';
|
package/dist/query.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import { QueryClient, UseQueryResult, UseSuspenseQueryResult, InfiniteData, UseInfiniteQueryResult, UseSuspenseInfiniteQueryResult } from '@tanstack/react-query';
|
|
3
|
-
import { f as ApiQueryOptions, P as PayloadFindResponse, ax as PublicReadQueryOptions, n as PayloadMutationResponse, ay as CustomerAuth, az as CustomerProfile, aA as CustomerAuthResponse, aB as CustomerLoginData, aC as CustomerRegisterResponse, aD as CustomerRegisterData, aE as CustomerRefreshResponse, aF as UpdateProfileData, aG as ProductListingPageBaseParams, aH as ProductListingPageParams, aI as ProductDetailParams, aJ as ProductDetailResult, aK as ProductListingPageCatalogParams, aL as ProductListingPageResult, aM as ProductListingGroupsCatalogItem, aN as ProductListingPageFullParams, aO as ProductListingGroupsItem, S as Sort, W as Where, y as RootClient, al as RootServerClient } from './types-
|
|
4
|
-
import './payload-types-
|
|
5
|
-
import { C as CollectionClient } from './collection-client-
|
|
6
|
-
import { S as ServerCollection, P as PublicCollection } from './const-
|
|
7
|
-
import { C as CollectionType } from './types-
|
|
3
|
+
import { f as ApiQueryOptions, P as PayloadFindResponse, ax as PublicReadQueryOptions, n as PayloadMutationResponse, ay as CustomerAuth, az as CustomerProfile, aA as CustomerAuthResponse, aB as CustomerLoginData, aC as CustomerRegisterResponse, aD as CustomerRegisterData, aE as CustomerRefreshResponse, aF as UpdateProfileData, aG as ProductListingPageBaseParams, aH as ProductListingPageParams, aI as ProductDetailParams, aJ as ProductDetailResult, aK as ProductListingPageCatalogParams, aL as ProductListingPageResult, aM as ProductListingGroupsCatalogItem, aN as ProductListingPageFullParams, aO as ProductListingGroupsItem, S as Sort, W as Where, y as RootClient, al as RootServerClient } from './types-Umd-YTjM.js';
|
|
4
|
+
import './payload-types-DC0xzR9i.js';
|
|
5
|
+
import { C as CollectionClient } from './collection-client-CKFa99C6.js';
|
|
6
|
+
import { S as ServerCollection, P as PublicCollection } from './const-ymprfiPf.js';
|
|
7
|
+
import { C as CollectionType } from './types-Bh2p-EMc.js';
|
|
8
8
|
import { SDKError } from './errors.js';
|
|
9
9
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.js';
|
|
10
10
|
import './metadata.js';
|
package/dist/realtime.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { R as RealtimeEvent } from './realtime-D7HtUpqt.cjs';
|
|
2
2
|
export { a as RealtimeConnection, b as RealtimeListener } from './realtime-D7HtUpqt.cjs';
|
|
3
|
-
import { P as PublicCollection } from './const-
|
|
4
|
-
import './payload-types-
|
|
3
|
+
import { P as PublicCollection } from './const-4BUtUdGU.cjs';
|
|
4
|
+
import './payload-types-DC0xzR9i.cjs';
|
|
5
5
|
|
|
6
6
|
interface UseRealtimeQueryOptions {
|
|
7
7
|
/** Filter events to specific collections. Empty/undefined = all collections. */
|
package/dist/realtime.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { R as RealtimeEvent } from './realtime-D7HtUpqt.js';
|
|
2
2
|
export { a as RealtimeConnection, b as RealtimeListener } from './realtime-D7HtUpqt.js';
|
|
3
|
-
import { P as PublicCollection } from './const-
|
|
4
|
-
import './payload-types-
|
|
3
|
+
import { P as PublicCollection } from './const-ymprfiPf.js';
|
|
4
|
+
import './payload-types-DC0xzR9i.js';
|
|
5
5
|
|
|
6
6
|
interface UseRealtimeQueryOptions {
|
|
7
7
|
/** Filter events to specific collections. Empty/undefined = all collections. */
|
package/dist/server.cjs
CHANGED
|
@@ -1671,9 +1671,6 @@ function getMediaId(value) {
|
|
|
1671
1671
|
}
|
|
1672
1672
|
return null;
|
|
1673
1673
|
}
|
|
1674
|
-
function toPointerId(value) {
|
|
1675
|
-
return getMediaId(value);
|
|
1676
|
-
}
|
|
1677
1674
|
function mediaArray(value) {
|
|
1678
1675
|
if (!Array.isArray(value)) return [];
|
|
1679
1676
|
return value.filter((entry) => entry != null);
|
|
@@ -1790,22 +1787,16 @@ function resolveProductSelectionMedia(input) {
|
|
|
1790
1787
|
source: "none"
|
|
1791
1788
|
};
|
|
1792
1789
|
}
|
|
1793
|
-
function
|
|
1790
|
+
function resolveFeaturedImagePointer(input) {
|
|
1794
1791
|
const pool = mediaArray(input.productMediaPool);
|
|
1795
1792
|
const resolvedPointer = getMediaId(input.resolvedPrimary);
|
|
1796
1793
|
if (resolvedPointer && input.resolvedSource !== "product_pool" && input.resolvedSource !== "none") {
|
|
1797
1794
|
return resolvedPointer;
|
|
1798
1795
|
}
|
|
1799
1796
|
const poolById = buildPoolById(pool);
|
|
1800
|
-
const
|
|
1801
|
-
if (
|
|
1802
|
-
return
|
|
1803
|
-
}
|
|
1804
|
-
const primaryPointer = toPointerId(input.productPrimaryMediaItemId);
|
|
1805
|
-
if (primaryPointer && poolById.has(primaryPointer)) return primaryPointer;
|
|
1806
|
-
const thumbnailPointer = getMediaId(input.productThumbnail);
|
|
1807
|
-
if (thumbnailPointer && poolById.has(thumbnailPointer)) {
|
|
1808
|
-
return thumbnailPointer;
|
|
1797
|
+
const featuredImagePointer = getMediaId(input.featuredImage);
|
|
1798
|
+
if (featuredImagePointer && poolById.has(featuredImagePointer)) {
|
|
1799
|
+
return featuredImagePointer;
|
|
1809
1800
|
}
|
|
1810
1801
|
if (pool.length > 0) {
|
|
1811
1802
|
const firstPoolId = getMediaId(pool[0]);
|
|
@@ -1860,13 +1851,9 @@ function extractEntityId(value) {
|
|
|
1860
1851
|
return null;
|
|
1861
1852
|
}
|
|
1862
1853
|
function resolveGenericListingPrimaryImage(product, resolvedPrimary, resolvedSource) {
|
|
1863
|
-
return
|
|
1854
|
+
return resolveFeaturedImagePointer({
|
|
1864
1855
|
productMediaPool: product?.images ?? [],
|
|
1865
|
-
|
|
1866
|
-
product?.primaryMediaItemId ?? null
|
|
1867
|
-
),
|
|
1868
|
-
productThumbnail: product?.thumbnail ?? null,
|
|
1869
|
-
listingPrimaryImage: product?.listing?.primaryImage ?? null,
|
|
1856
|
+
featuredImage: product?.featuredImage ?? null,
|
|
1870
1857
|
resolvedPrimary,
|
|
1871
1858
|
resolvedSource
|
|
1872
1859
|
});
|
|
@@ -2505,7 +2492,7 @@ function getMinMax(values) {
|
|
|
2505
2492
|
max: Math.max(...numbers)
|
|
2506
2493
|
};
|
|
2507
2494
|
}
|
|
2508
|
-
function
|
|
2495
|
+
function buildProductListingGroupProjection(product, variants) {
|
|
2509
2496
|
const orderedVariants = [...variants].sort(compareVariantOrder);
|
|
2510
2497
|
const activeVariants = orderedVariants.filter(
|
|
2511
2498
|
(variant) => variant.isActive !== false
|
|
@@ -2526,7 +2513,6 @@ function buildProductListingProjection(product, variants) {
|
|
|
2526
2513
|
const mediaSelectionVariants = sortVariantsForMediaSelection(variants);
|
|
2527
2514
|
const resolvedProductMedia = resolveProductSelectionMedia({
|
|
2528
2515
|
productMediaPool,
|
|
2529
|
-
productPrimaryMediaItemId: getRelationID(product?.primaryMediaItemId),
|
|
2530
2516
|
selectedVariant: selectionHintVariant && selectionHintHasPoolMedia ? {
|
|
2531
2517
|
id: selectionHintVariant.id,
|
|
2532
2518
|
images: selectionHintVariant.images
|
|
@@ -2552,47 +2538,22 @@ function buildProductListingCard(item, options = {}) {
|
|
|
2552
2538
|
const product = item.product;
|
|
2553
2539
|
const groups = item.groups;
|
|
2554
2540
|
const variants = getProductListingCardVariants(item);
|
|
2555
|
-
const projectedListing =
|
|
2556
|
-
const selectionHintVariant = getRelationID(
|
|
2557
|
-
product.listing && "selectionHintVariant" in product.listing ? product.listing.selectionHintVariant : null
|
|
2558
|
-
) ?? projectedListing.selectionHintVariant;
|
|
2541
|
+
const projectedListing = buildProductListingGroupProjection(product, variants);
|
|
2542
|
+
const selectionHintVariant = getRelationID(product.selectedOrFirstAvailableVariant) ?? projectedListing.selectionHintVariant;
|
|
2559
2543
|
const representativeVariant = findListingCardRepresentativeVariant(
|
|
2560
2544
|
variants,
|
|
2561
2545
|
selectionHintVariant
|
|
2562
2546
|
);
|
|
2563
2547
|
const productMediaPool = mediaArray2(product.images);
|
|
2564
|
-
const
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
(poolItem) => getRelationID(poolItem) === getRelationID(image)
|
|
2568
|
-
)
|
|
2569
|
-
)
|
|
2570
|
-
);
|
|
2571
|
-
const resolvedPrimaryMedia = resolveProductSelectionMedia(
|
|
2572
|
-
{
|
|
2573
|
-
productMediaPool,
|
|
2574
|
-
productPrimaryMediaItemId: getRelationID(product.primaryMediaItemId),
|
|
2575
|
-
selectedVariant: representativeHasPoolMedia ? representativeVariant : null,
|
|
2576
|
-
matchingVariants: representativeHasPoolMedia ? [] : variants
|
|
2577
|
-
}
|
|
2578
|
-
);
|
|
2579
|
-
const listingPrimaryPointer = resolveListingPrimaryImagePointer({
|
|
2580
|
-
productMediaPool,
|
|
2581
|
-
productPrimaryMediaItemId: getRelationID(product.primaryMediaItemId),
|
|
2582
|
-
productThumbnail: product.thumbnail ?? null,
|
|
2583
|
-
listingPrimaryImage: product.listing?.primaryImage ?? null,
|
|
2584
|
-
resolvedPrimary: resolvedPrimaryMedia.primaryImage,
|
|
2585
|
-
resolvedSource: resolvedPrimaryMedia.source
|
|
2586
|
-
});
|
|
2587
|
-
const listingPrimaryMedia = listingPrimaryPointer ? productMediaPool.find(
|
|
2588
|
-
(item2) => getRelationID(item2) === listingPrimaryPointer
|
|
2589
|
-
) ?? resolvedPrimaryMedia.primaryImage ?? null : null;
|
|
2548
|
+
const featuredImageId = getRelationID(product.featuredImage);
|
|
2549
|
+
const featuredImageFromPool = featuredImageId ? productMediaPool.find((item2) => getRelationID(item2) === featuredImageId) : void 0;
|
|
2550
|
+
const listingPrimaryMedia = featuredImageFromPool ?? product.featuredImage ?? productMediaPool[0] ?? null;
|
|
2590
2551
|
const priceRange = resolveListingCardPriceRange(
|
|
2591
2552
|
product,
|
|
2592
2553
|
projectedListing,
|
|
2593
2554
|
groups
|
|
2594
2555
|
);
|
|
2595
|
-
const availableForSale = product.
|
|
2556
|
+
const availableForSale = product.availableForSale != null ? product.availableForSale : groups.length > 0 ? groups.some((group) => group.listing.availableForSale) : projectedListing.availableForSale;
|
|
2596
2557
|
const swatches = groups.length > 1 ? groups.map((group) => buildListingSwatch(product, group, options)) : [];
|
|
2597
2558
|
return {
|
|
2598
2559
|
id: String(product.id),
|
|
@@ -2632,23 +2593,20 @@ function findListingCardRepresentativeVariant(variants, representativeVariantId)
|
|
|
2632
2593
|
(variant) => getRelationID(variant.id) === representativeVariantId
|
|
2633
2594
|
) ?? null;
|
|
2634
2595
|
}
|
|
2635
|
-
function
|
|
2636
|
-
return
|
|
2637
|
-
}
|
|
2638
|
-
function listingDefinesCompareAtProjection(listing) {
|
|
2639
|
-
return "minCompareAtPrice" in listing || "maxCompareAtPrice" in listing;
|
|
2596
|
+
function hasCompleteProductPriceRange(priceRange) {
|
|
2597
|
+
return priceRange?.minVariantPrice?.amount != null && priceRange?.maxVariantPrice?.amount != null;
|
|
2640
2598
|
}
|
|
2641
2599
|
function resolveListingCardPriceRange(product, projectedListing, groups) {
|
|
2642
|
-
|
|
2643
|
-
if (hasCompleteListingPriceProjection(listing)) {
|
|
2600
|
+
if (hasCompleteProductPriceRange(product.priceRange)) {
|
|
2644
2601
|
const groupRange = groups.length > 0 ? aggregateListingPriceRange(groups) : null;
|
|
2645
|
-
const
|
|
2602
|
+
const minCompareAtPrice = product.compareAtPriceRange?.minVariantPrice?.amount ?? groupRange?.minCompareAtPrice ?? null;
|
|
2603
|
+
const maxCompareAtPrice = product.compareAtPriceRange?.maxVariantPrice?.amount ?? groupRange?.maxCompareAtPrice ?? null;
|
|
2646
2604
|
return {
|
|
2647
|
-
minPrice:
|
|
2648
|
-
maxPrice:
|
|
2649
|
-
minCompareAtPrice
|
|
2650
|
-
maxCompareAtPrice
|
|
2651
|
-
isPriceRange:
|
|
2605
|
+
minPrice: product.priceRange.minVariantPrice.amount,
|
|
2606
|
+
maxPrice: product.priceRange.maxVariantPrice.amount,
|
|
2607
|
+
minCompareAtPrice,
|
|
2608
|
+
maxCompareAtPrice,
|
|
2609
|
+
isPriceRange: product.priceRange.isPriceRange ?? product.priceRange.minVariantPrice.amount !== product.priceRange.maxVariantPrice.amount
|
|
2652
2610
|
};
|
|
2653
2611
|
}
|
|
2654
2612
|
if (groups.length > 0) {
|
|
@@ -2760,15 +2718,19 @@ function buildProductListingPageWhere(params) {
|
|
|
2760
2718
|
if (tagIds) clauses.push({ tags: { in: tagIds } });
|
|
2761
2719
|
const minPrice = filters?.price?.min;
|
|
2762
2720
|
if (minPrice != null) {
|
|
2763
|
-
clauses.push({
|
|
2721
|
+
clauses.push({
|
|
2722
|
+
"priceRange.maxVariantPrice.amount": { greater_than_equal: minPrice }
|
|
2723
|
+
});
|
|
2764
2724
|
}
|
|
2765
2725
|
const maxPrice = filters?.price?.max;
|
|
2766
2726
|
if (maxPrice != null) {
|
|
2767
|
-
clauses.push({
|
|
2727
|
+
clauses.push({
|
|
2728
|
+
"priceRange.minVariantPrice.amount": { less_than_equal: maxPrice }
|
|
2729
|
+
});
|
|
2768
2730
|
}
|
|
2769
2731
|
if (filters?.availableForSale != null) {
|
|
2770
2732
|
clauses.push({
|
|
2771
|
-
|
|
2733
|
+
availableForSale: { equals: filters.availableForSale }
|
|
2772
2734
|
});
|
|
2773
2735
|
}
|
|
2774
2736
|
if (clauses.length === 0) return void 0;
|
|
@@ -3005,6 +2967,12 @@ var OrderApi = class extends BaseApi {
|
|
|
3005
2967
|
idempotencyRequestOptions(params.idempotencyKey)
|
|
3006
2968
|
);
|
|
3007
2969
|
}
|
|
2970
|
+
/**
|
|
2971
|
+
* Returns a `PublicOrder`-compatible shape even when the server backs the
|
|
2972
|
+
* response with a Checkout (checkout/order separation, #1285). `orderNumber`
|
|
2973
|
+
* stays the stable cross-window key. A breaking `PublicCheckout` split is a
|
|
2974
|
+
* deferred follow-up (design D10 / Q3-b); do not change this return type here.
|
|
2975
|
+
*/
|
|
3008
2976
|
checkout(params) {
|
|
3009
2977
|
const { body, idempotencyKey } = splitIdempotencyKey(params);
|
|
3010
2978
|
return this.request(
|