@01.software/sdk 0.39.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 +64 -21
- package/dist/client.cjs +47 -69
- 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 +47 -69
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-DVfB0Em1.d.cts → collection-client-Bymfni8u.d.cts} +3 -3
- package/dist/{collection-client-CaMgs5KE.d.ts → collection-client-CN4lj6gi.d.ts} +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 +119 -136
- 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 +119 -136
- 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 +40 -69
- 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 +40 -69
- package/dist/server.js.map +1 -1
- package/dist/{types-Cmrd1ezc.d.ts → types-Bh2p-EMc.d.ts} +5 -1
- package/dist/{types-CVf8sCZ-.d.ts → types-Bl-m9ttd.d.cts} +129 -77
- package/dist/{types-D0ubzQw0.d.cts → types-BvpjooU-.d.cts} +5 -1
- package/dist/{types-BQo7UdI9.d.cts → types-CHrzs2GB.d.ts} +129 -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 +6 -4
- 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-Bl-m9ttd.cjs';
|
|
4
|
+
import './payload-types-DC0xzR9i.cjs';
|
|
5
|
+
import { C as CollectionClient } from './collection-client-Bymfni8u.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-CHrzs2GB.js';
|
|
4
|
+
import './payload-types-DC0xzR9i.js';
|
|
5
|
+
import { C as CollectionClient } from './collection-client-CN4lj6gi.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
|
});
|
|
@@ -2468,11 +2455,14 @@ function compareVariantOrder(a, b) {
|
|
|
2468
2455
|
const bId = String(getRelationID(b.id) ?? "");
|
|
2469
2456
|
return aId.localeCompare(bId);
|
|
2470
2457
|
}
|
|
2471
|
-
function
|
|
2458
|
+
function getVariantAvailableForSale(variant) {
|
|
2472
2459
|
if (variant.isActive === false) return false;
|
|
2473
2460
|
if (variant.isUnlimited) return true;
|
|
2474
2461
|
return (variant.stock ?? 0) - (variant.reservedStock ?? 0) > 0;
|
|
2475
2462
|
}
|
|
2463
|
+
function isVariantAvailableForSale(variant) {
|
|
2464
|
+
return getVariantAvailableForSale(variant);
|
|
2465
|
+
}
|
|
2476
2466
|
function sortVariantsForMediaSelection(variants) {
|
|
2477
2467
|
const orderedVariants = [...variants].sort(compareVariantOrder);
|
|
2478
2468
|
const activeVariants = orderedVariants.filter(
|
|
@@ -2505,7 +2495,7 @@ function getMinMax(values) {
|
|
|
2505
2495
|
max: Math.max(...numbers)
|
|
2506
2496
|
};
|
|
2507
2497
|
}
|
|
2508
|
-
function
|
|
2498
|
+
function buildProductListingGroupProjection(product, variants) {
|
|
2509
2499
|
const orderedVariants = [...variants].sort(compareVariantOrder);
|
|
2510
2500
|
const activeVariants = orderedVariants.filter(
|
|
2511
2501
|
(variant) => variant.isActive !== false
|
|
@@ -2526,7 +2516,6 @@ function buildProductListingProjection(product, variants) {
|
|
|
2526
2516
|
const mediaSelectionVariants = sortVariantsForMediaSelection(variants);
|
|
2527
2517
|
const resolvedProductMedia = resolveProductSelectionMedia({
|
|
2528
2518
|
productMediaPool,
|
|
2529
|
-
productPrimaryMediaItemId: getRelationID(product?.primaryMediaItemId),
|
|
2530
2519
|
selectedVariant: selectionHintVariant && selectionHintHasPoolMedia ? {
|
|
2531
2520
|
id: selectionHintVariant.id,
|
|
2532
2521
|
images: selectionHintVariant.images
|
|
@@ -2552,47 +2541,22 @@ function buildProductListingCard(item, options = {}) {
|
|
|
2552
2541
|
const product = item.product;
|
|
2553
2542
|
const groups = item.groups;
|
|
2554
2543
|
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;
|
|
2544
|
+
const projectedListing = buildProductListingGroupProjection(product, variants);
|
|
2545
|
+
const selectionHintVariant = getRelationID(product.selectedOrFirstAvailableVariant) ?? projectedListing.selectionHintVariant;
|
|
2559
2546
|
const representativeVariant = findListingCardRepresentativeVariant(
|
|
2560
2547
|
variants,
|
|
2561
2548
|
selectionHintVariant
|
|
2562
2549
|
);
|
|
2563
2550
|
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;
|
|
2551
|
+
const featuredImageId = getRelationID(product.featuredImage);
|
|
2552
|
+
const featuredImageFromPool = featuredImageId ? productMediaPool.find((item2) => getRelationID(item2) === featuredImageId) : void 0;
|
|
2553
|
+
const listingPrimaryMedia = featuredImageFromPool ?? product.featuredImage ?? productMediaPool[0] ?? null;
|
|
2590
2554
|
const priceRange = resolveListingCardPriceRange(
|
|
2591
2555
|
product,
|
|
2592
2556
|
projectedListing,
|
|
2593
2557
|
groups
|
|
2594
2558
|
);
|
|
2595
|
-
const availableForSale = product.
|
|
2559
|
+
const availableForSale = product.availableForSale != null ? product.availableForSale : groups.length > 0 ? groups.some((group) => group.listing.availableForSale) : projectedListing.availableForSale;
|
|
2596
2560
|
const swatches = groups.length > 1 ? groups.map((group) => buildListingSwatch(product, group, options)) : [];
|
|
2597
2561
|
return {
|
|
2598
2562
|
id: String(product.id),
|
|
@@ -2632,23 +2596,20 @@ function findListingCardRepresentativeVariant(variants, representativeVariantId)
|
|
|
2632
2596
|
(variant) => getRelationID(variant.id) === representativeVariantId
|
|
2633
2597
|
) ?? null;
|
|
2634
2598
|
}
|
|
2635
|
-
function
|
|
2636
|
-
return
|
|
2637
|
-
}
|
|
2638
|
-
function listingDefinesCompareAtProjection(listing) {
|
|
2639
|
-
return "minCompareAtPrice" in listing || "maxCompareAtPrice" in listing;
|
|
2599
|
+
function hasCompleteProductPriceRange(priceRange) {
|
|
2600
|
+
return priceRange?.minVariantPrice?.amount != null && priceRange?.maxVariantPrice?.amount != null;
|
|
2640
2601
|
}
|
|
2641
2602
|
function resolveListingCardPriceRange(product, projectedListing, groups) {
|
|
2642
|
-
|
|
2643
|
-
if (hasCompleteListingPriceProjection(listing)) {
|
|
2603
|
+
if (hasCompleteProductPriceRange(product.priceRange)) {
|
|
2644
2604
|
const groupRange = groups.length > 0 ? aggregateListingPriceRange(groups) : null;
|
|
2645
|
-
const
|
|
2605
|
+
const minCompareAtPrice = product.compareAtPriceRange?.minVariantPrice?.amount ?? groupRange?.minCompareAtPrice ?? null;
|
|
2606
|
+
const maxCompareAtPrice = product.compareAtPriceRange?.maxVariantPrice?.amount ?? groupRange?.maxCompareAtPrice ?? null;
|
|
2646
2607
|
return {
|
|
2647
|
-
minPrice:
|
|
2648
|
-
maxPrice:
|
|
2649
|
-
minCompareAtPrice
|
|
2650
|
-
maxCompareAtPrice
|
|
2651
|
-
isPriceRange:
|
|
2608
|
+
minPrice: product.priceRange.minVariantPrice.amount,
|
|
2609
|
+
maxPrice: product.priceRange.maxVariantPrice.amount,
|
|
2610
|
+
minCompareAtPrice,
|
|
2611
|
+
maxCompareAtPrice,
|
|
2612
|
+
isPriceRange: product.priceRange.isPriceRange ?? product.priceRange.minVariantPrice.amount !== product.priceRange.maxVariantPrice.amount
|
|
2652
2613
|
};
|
|
2653
2614
|
}
|
|
2654
2615
|
if (groups.length > 0) {
|
|
@@ -2760,15 +2721,19 @@ function buildProductListingPageWhere(params) {
|
|
|
2760
2721
|
if (tagIds) clauses.push({ tags: { in: tagIds } });
|
|
2761
2722
|
const minPrice = filters?.price?.min;
|
|
2762
2723
|
if (minPrice != null) {
|
|
2763
|
-
clauses.push({
|
|
2724
|
+
clauses.push({
|
|
2725
|
+
"priceRange.maxVariantPrice.amount": { greater_than_equal: minPrice }
|
|
2726
|
+
});
|
|
2764
2727
|
}
|
|
2765
2728
|
const maxPrice = filters?.price?.max;
|
|
2766
2729
|
if (maxPrice != null) {
|
|
2767
|
-
clauses.push({
|
|
2730
|
+
clauses.push({
|
|
2731
|
+
"priceRange.minVariantPrice.amount": { less_than_equal: maxPrice }
|
|
2732
|
+
});
|
|
2768
2733
|
}
|
|
2769
2734
|
if (filters?.availableForSale != null) {
|
|
2770
2735
|
clauses.push({
|
|
2771
|
-
|
|
2736
|
+
availableForSale: { equals: filters.availableForSale }
|
|
2772
2737
|
});
|
|
2773
2738
|
}
|
|
2774
2739
|
if (clauses.length === 0) return void 0;
|
|
@@ -3005,6 +2970,12 @@ var OrderApi = class extends BaseApi {
|
|
|
3005
2970
|
idempotencyRequestOptions(params.idempotencyKey)
|
|
3006
2971
|
);
|
|
3007
2972
|
}
|
|
2973
|
+
/**
|
|
2974
|
+
* Returns a `PublicOrder`-compatible shape even when the server backs the
|
|
2975
|
+
* response with a Checkout (checkout/order separation, #1285). `orderNumber`
|
|
2976
|
+
* stays the stable cross-window key. A breaking `PublicCheckout` split is a
|
|
2977
|
+
* deferred follow-up (design D10 / Q3-b); do not change this return type here.
|
|
2978
|
+
*/
|
|
3008
2979
|
checkout(params) {
|
|
3009
2980
|
const { body, idempotencyKey } = splitIdempotencyKey(params);
|
|
3010
2981
|
return this.request(
|