@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/client.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { R as ReadOnlyCollectionClient } from './collection-client-
|
|
2
|
-
import { C as CommerceClient, a as CommunityClient, b as ContentClient, E as EventsClient, c as CustomerNamespace, d as ClientState, e as ClientConfig } from './types-
|
|
3
|
-
export { A as AddItemParams, f as ApiQueryOptions, g as ApplyDiscountParams, h as CheckoutParams, i as ClearCartParams, j as ClientMetadata, k as ContentClientOptions, D as DebugConfig, l as DeepPartial, m as ExtractArrayType, P as PayloadFindResponse, n as PayloadMutationResponse, 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, x as RetryConfig, y as RootClient, y as RootClientType, z as RootCollectionClient, B as RootReadOnlyQueryBuilder, S as Sort, F as StorefrontContentListOptions, G as StorefrontContentReference, H as StorefrontGalleryItem, I as StorefrontGalleryItemsListOptions, J as StorefrontGalleryItemsSort, K as StorefrontLink, L as StorefrontLinksListOptions, M as StorefrontLinksSort, U as UpdateItemParams, W as Where } from './types-
|
|
4
|
-
import './payload-types-
|
|
5
|
-
export { C as Collection, P as PublicCollection } from './const-
|
|
1
|
+
import { R as ReadOnlyCollectionClient } from './collection-client-VYwYi6u6.cjs';
|
|
2
|
+
import { C as CommerceClient, a as CommunityClient, b as ContentClient, E as EventsClient, c as CustomerNamespace, d as ClientState, e as ClientConfig } from './types-D5uHrPLr.cjs';
|
|
3
|
+
export { A as AddItemParams, f as ApiQueryOptions, g as ApplyDiscountParams, h as CheckoutParams, i as ClearCartParams, j as ClientMetadata, k as ContentClientOptions, D as DebugConfig, l as DeepPartial, m as ExtractArrayType, P as PayloadFindResponse, n as PayloadMutationResponse, 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, x as RetryConfig, y as RootClient, y as RootClientType, z as RootCollectionClient, B as RootReadOnlyQueryBuilder, S as Sort, F as StorefrontContentListOptions, G as StorefrontContentReference, H as StorefrontGalleryItem, I as StorefrontGalleryItemsListOptions, J as StorefrontGalleryItemsSort, K as StorefrontLink, L as StorefrontLinksListOptions, M as StorefrontLinksSort, U as UpdateItemParams, W as Where } from './types-D5uHrPLr.cjs';
|
|
4
|
+
import './payload-types-DC0xzR9i.cjs';
|
|
5
|
+
export { C as Collection, P as PublicCollection } from './const-4BUtUdGU.cjs';
|
|
6
6
|
import './metadata.cjs';
|
|
7
|
-
import './types-
|
|
7
|
+
import './types-BvpjooU-.cjs';
|
|
8
8
|
|
|
9
9
|
declare class Client {
|
|
10
10
|
commerce: CommerceClient;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { R as ReadOnlyCollectionClient } from './collection-client-
|
|
2
|
-
import { C as CommerceClient, a as CommunityClient, b as ContentClient, E as EventsClient, c as CustomerNamespace, d as ClientState, e as ClientConfig } from './types-
|
|
3
|
-
export { A as AddItemParams, f as ApiQueryOptions, g as ApplyDiscountParams, h as CheckoutParams, i as ClearCartParams, j as ClientMetadata, k as ContentClientOptions, D as DebugConfig, l as DeepPartial, m as ExtractArrayType, P as PayloadFindResponse, n as PayloadMutationResponse, 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, x as RetryConfig, y as RootClient, y as RootClientType, z as RootCollectionClient, B as RootReadOnlyQueryBuilder, S as Sort, F as StorefrontContentListOptions, G as StorefrontContentReference, H as StorefrontGalleryItem, I as StorefrontGalleryItemsListOptions, J as StorefrontGalleryItemsSort, K as StorefrontLink, L as StorefrontLinksListOptions, M as StorefrontLinksSort, U as UpdateItemParams, W as Where } from './types-
|
|
4
|
-
import './payload-types-
|
|
5
|
-
export { C as Collection, P as PublicCollection } from './const-
|
|
1
|
+
import { R as ReadOnlyCollectionClient } from './collection-client-CKFa99C6.js';
|
|
2
|
+
import { C as CommerceClient, a as CommunityClient, b as ContentClient, E as EventsClient, c as CustomerNamespace, d as ClientState, e as ClientConfig } from './types-Umd-YTjM.js';
|
|
3
|
+
export { A as AddItemParams, f as ApiQueryOptions, g as ApplyDiscountParams, h as CheckoutParams, i as ClearCartParams, j as ClientMetadata, k as ContentClientOptions, D as DebugConfig, l as DeepPartial, m as ExtractArrayType, P as PayloadFindResponse, n as PayloadMutationResponse, 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, x as RetryConfig, y as RootClient, y as RootClientType, z as RootCollectionClient, B as RootReadOnlyQueryBuilder, S as Sort, F as StorefrontContentListOptions, G as StorefrontContentReference, H as StorefrontGalleryItem, I as StorefrontGalleryItemsListOptions, J as StorefrontGalleryItemsSort, K as StorefrontLink, L as StorefrontLinksListOptions, M as StorefrontLinksSort, U as UpdateItemParams, W as Where } from './types-Umd-YTjM.js';
|
|
4
|
+
import './payload-types-DC0xzR9i.js';
|
|
5
|
+
export { C as Collection, P as PublicCollection } from './const-ymprfiPf.js';
|
|
6
6
|
import './metadata.js';
|
|
7
|
-
import './types-
|
|
7
|
+
import './types-Bh2p-EMc.js';
|
|
8
8
|
|
|
9
9
|
declare class Client {
|
|
10
10
|
commerce: CommerceClient;
|
package/dist/client.js
CHANGED
|
@@ -1451,6 +1451,19 @@ var CustomerAuth = class {
|
|
|
1451
1451
|
const params = new URLSearchParams();
|
|
1452
1452
|
if (options?.page) params.set("page", String(options.page));
|
|
1453
1453
|
if (options?.limit) params.set("limit", String(options.limit));
|
|
1454
|
+
if (options?.displayFinancialStatus) {
|
|
1455
|
+
params.set("displayFinancialStatus", options.displayFinancialStatus);
|
|
1456
|
+
}
|
|
1457
|
+
if (options?.displayFulfillmentStatus) {
|
|
1458
|
+
params.set("displayFulfillmentStatus", options.displayFulfillmentStatus);
|
|
1459
|
+
}
|
|
1460
|
+
if (options?.returnStatus) params.set("returnStatus", options.returnStatus);
|
|
1461
|
+
if (options?.primaryDisplayStatus) {
|
|
1462
|
+
params.set("primaryDisplayStatus", options.primaryDisplayStatus);
|
|
1463
|
+
}
|
|
1464
|
+
if (options?.returnDisplayStatus) {
|
|
1465
|
+
params.set("returnDisplayStatus", options.returnDisplayStatus);
|
|
1466
|
+
}
|
|
1454
1467
|
if (options?.status) params.set("status", options.status);
|
|
1455
1468
|
const qs = params.toString();
|
|
1456
1469
|
return this.requestJson(`/api/customers/me/orders${qs ? `?${qs}` : ""}`, {
|
|
@@ -1565,9 +1578,6 @@ function getMediaId(value) {
|
|
|
1565
1578
|
}
|
|
1566
1579
|
return null;
|
|
1567
1580
|
}
|
|
1568
|
-
function toPointerId(value) {
|
|
1569
|
-
return getMediaId(value);
|
|
1570
|
-
}
|
|
1571
1581
|
function mediaArray(value) {
|
|
1572
1582
|
if (!Array.isArray(value)) return [];
|
|
1573
1583
|
return value.filter((entry) => entry != null);
|
|
@@ -1684,22 +1694,16 @@ function resolveProductSelectionMedia(input) {
|
|
|
1684
1694
|
source: "none"
|
|
1685
1695
|
};
|
|
1686
1696
|
}
|
|
1687
|
-
function
|
|
1697
|
+
function resolveFeaturedImagePointer(input) {
|
|
1688
1698
|
const pool = mediaArray(input.productMediaPool);
|
|
1689
1699
|
const resolvedPointer = getMediaId(input.resolvedPrimary);
|
|
1690
1700
|
if (resolvedPointer && input.resolvedSource !== "product_pool" && input.resolvedSource !== "none") {
|
|
1691
1701
|
return resolvedPointer;
|
|
1692
1702
|
}
|
|
1693
1703
|
const poolById = buildPoolById(pool);
|
|
1694
|
-
const
|
|
1695
|
-
if (
|
|
1696
|
-
return
|
|
1697
|
-
}
|
|
1698
|
-
const primaryPointer = toPointerId(input.productPrimaryMediaItemId);
|
|
1699
|
-
if (primaryPointer && poolById.has(primaryPointer)) return primaryPointer;
|
|
1700
|
-
const thumbnailPointer = getMediaId(input.productThumbnail);
|
|
1701
|
-
if (thumbnailPointer && poolById.has(thumbnailPointer)) {
|
|
1702
|
-
return thumbnailPointer;
|
|
1704
|
+
const featuredImagePointer = getMediaId(input.featuredImage);
|
|
1705
|
+
if (featuredImagePointer && poolById.has(featuredImagePointer)) {
|
|
1706
|
+
return featuredImagePointer;
|
|
1703
1707
|
}
|
|
1704
1708
|
if (pool.length > 0) {
|
|
1705
1709
|
const firstPoolId = getMediaId(pool[0]);
|
|
@@ -1754,13 +1758,9 @@ function extractEntityId(value) {
|
|
|
1754
1758
|
return null;
|
|
1755
1759
|
}
|
|
1756
1760
|
function resolveGenericListingPrimaryImage(product, resolvedPrimary, resolvedSource) {
|
|
1757
|
-
return
|
|
1761
|
+
return resolveFeaturedImagePointer({
|
|
1758
1762
|
productMediaPool: product?.images ?? [],
|
|
1759
|
-
|
|
1760
|
-
product?.primaryMediaItemId ?? null
|
|
1761
|
-
),
|
|
1762
|
-
productThumbnail: product?.thumbnail ?? null,
|
|
1763
|
-
listingPrimaryImage: product?.listing?.primaryImage ?? null,
|
|
1763
|
+
featuredImage: product?.featuredImage ?? null,
|
|
1764
1764
|
resolvedPrimary,
|
|
1765
1765
|
resolvedSource
|
|
1766
1766
|
});
|
|
@@ -2399,7 +2399,7 @@ function getMinMax(values) {
|
|
|
2399
2399
|
max: Math.max(...numbers)
|
|
2400
2400
|
};
|
|
2401
2401
|
}
|
|
2402
|
-
function
|
|
2402
|
+
function buildProductListingGroupProjection(product, variants) {
|
|
2403
2403
|
const orderedVariants = [...variants].sort(compareVariantOrder);
|
|
2404
2404
|
const activeVariants = orderedVariants.filter(
|
|
2405
2405
|
(variant) => variant.isActive !== false
|
|
@@ -2420,7 +2420,6 @@ function buildProductListingProjection(product, variants) {
|
|
|
2420
2420
|
const mediaSelectionVariants = sortVariantsForMediaSelection(variants);
|
|
2421
2421
|
const resolvedProductMedia = resolveProductSelectionMedia({
|
|
2422
2422
|
productMediaPool,
|
|
2423
|
-
productPrimaryMediaItemId: getRelationID(product?.primaryMediaItemId),
|
|
2424
2423
|
selectedVariant: selectionHintVariant && selectionHintHasPoolMedia ? {
|
|
2425
2424
|
id: selectionHintVariant.id,
|
|
2426
2425
|
images: selectionHintVariant.images
|
|
@@ -2446,47 +2445,22 @@ function buildProductListingCard(item, options = {}) {
|
|
|
2446
2445
|
const product = item.product;
|
|
2447
2446
|
const groups = item.groups;
|
|
2448
2447
|
const variants = getProductListingCardVariants(item);
|
|
2449
|
-
const projectedListing =
|
|
2450
|
-
const selectionHintVariant = getRelationID(
|
|
2451
|
-
product.listing && "selectionHintVariant" in product.listing ? product.listing.selectionHintVariant : null
|
|
2452
|
-
) ?? projectedListing.selectionHintVariant;
|
|
2448
|
+
const projectedListing = buildProductListingGroupProjection(product, variants);
|
|
2449
|
+
const selectionHintVariant = getRelationID(product.selectedOrFirstAvailableVariant) ?? projectedListing.selectionHintVariant;
|
|
2453
2450
|
const representativeVariant = findListingCardRepresentativeVariant(
|
|
2454
2451
|
variants,
|
|
2455
2452
|
selectionHintVariant
|
|
2456
2453
|
);
|
|
2457
2454
|
const productMediaPool = mediaArray2(product.images);
|
|
2458
|
-
const
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
(poolItem) => getRelationID(poolItem) === getRelationID(image)
|
|
2462
|
-
)
|
|
2463
|
-
)
|
|
2464
|
-
);
|
|
2465
|
-
const resolvedPrimaryMedia = resolveProductSelectionMedia(
|
|
2466
|
-
{
|
|
2467
|
-
productMediaPool,
|
|
2468
|
-
productPrimaryMediaItemId: getRelationID(product.primaryMediaItemId),
|
|
2469
|
-
selectedVariant: representativeHasPoolMedia ? representativeVariant : null,
|
|
2470
|
-
matchingVariants: representativeHasPoolMedia ? [] : variants
|
|
2471
|
-
}
|
|
2472
|
-
);
|
|
2473
|
-
const listingPrimaryPointer = resolveListingPrimaryImagePointer({
|
|
2474
|
-
productMediaPool,
|
|
2475
|
-
productPrimaryMediaItemId: getRelationID(product.primaryMediaItemId),
|
|
2476
|
-
productThumbnail: product.thumbnail ?? null,
|
|
2477
|
-
listingPrimaryImage: product.listing?.primaryImage ?? null,
|
|
2478
|
-
resolvedPrimary: resolvedPrimaryMedia.primaryImage,
|
|
2479
|
-
resolvedSource: resolvedPrimaryMedia.source
|
|
2480
|
-
});
|
|
2481
|
-
const listingPrimaryMedia = listingPrimaryPointer ? productMediaPool.find(
|
|
2482
|
-
(item2) => getRelationID(item2) === listingPrimaryPointer
|
|
2483
|
-
) ?? resolvedPrimaryMedia.primaryImage ?? null : null;
|
|
2455
|
+
const featuredImageId = getRelationID(product.featuredImage);
|
|
2456
|
+
const featuredImageFromPool = featuredImageId ? productMediaPool.find((item2) => getRelationID(item2) === featuredImageId) : void 0;
|
|
2457
|
+
const listingPrimaryMedia = featuredImageFromPool ?? product.featuredImage ?? productMediaPool[0] ?? null;
|
|
2484
2458
|
const priceRange = resolveListingCardPriceRange(
|
|
2485
2459
|
product,
|
|
2486
2460
|
projectedListing,
|
|
2487
2461
|
groups
|
|
2488
2462
|
);
|
|
2489
|
-
const availableForSale = product.
|
|
2463
|
+
const availableForSale = product.availableForSale != null ? product.availableForSale : groups.length > 0 ? groups.some((group) => group.listing.availableForSale) : projectedListing.availableForSale;
|
|
2490
2464
|
const swatches = groups.length > 1 ? groups.map((group) => buildListingSwatch(product, group, options)) : [];
|
|
2491
2465
|
return {
|
|
2492
2466
|
id: String(product.id),
|
|
@@ -2526,23 +2500,20 @@ function findListingCardRepresentativeVariant(variants, representativeVariantId)
|
|
|
2526
2500
|
(variant) => getRelationID(variant.id) === representativeVariantId
|
|
2527
2501
|
) ?? null;
|
|
2528
2502
|
}
|
|
2529
|
-
function
|
|
2530
|
-
return
|
|
2531
|
-
}
|
|
2532
|
-
function listingDefinesCompareAtProjection(listing) {
|
|
2533
|
-
return "minCompareAtPrice" in listing || "maxCompareAtPrice" in listing;
|
|
2503
|
+
function hasCompleteProductPriceRange(priceRange) {
|
|
2504
|
+
return priceRange?.minVariantPrice?.amount != null && priceRange?.maxVariantPrice?.amount != null;
|
|
2534
2505
|
}
|
|
2535
2506
|
function resolveListingCardPriceRange(product, projectedListing, groups) {
|
|
2536
|
-
|
|
2537
|
-
if (hasCompleteListingPriceProjection(listing)) {
|
|
2507
|
+
if (hasCompleteProductPriceRange(product.priceRange)) {
|
|
2538
2508
|
const groupRange = groups.length > 0 ? aggregateListingPriceRange(groups) : null;
|
|
2539
|
-
const
|
|
2509
|
+
const minCompareAtPrice = product.compareAtPriceRange?.minVariantPrice?.amount ?? groupRange?.minCompareAtPrice ?? null;
|
|
2510
|
+
const maxCompareAtPrice = product.compareAtPriceRange?.maxVariantPrice?.amount ?? groupRange?.maxCompareAtPrice ?? null;
|
|
2540
2511
|
return {
|
|
2541
|
-
minPrice:
|
|
2542
|
-
maxPrice:
|
|
2543
|
-
minCompareAtPrice
|
|
2544
|
-
maxCompareAtPrice
|
|
2545
|
-
isPriceRange:
|
|
2512
|
+
minPrice: product.priceRange.minVariantPrice.amount,
|
|
2513
|
+
maxPrice: product.priceRange.maxVariantPrice.amount,
|
|
2514
|
+
minCompareAtPrice,
|
|
2515
|
+
maxCompareAtPrice,
|
|
2516
|
+
isPriceRange: product.priceRange.isPriceRange ?? product.priceRange.minVariantPrice.amount !== product.priceRange.maxVariantPrice.amount
|
|
2546
2517
|
};
|
|
2547
2518
|
}
|
|
2548
2519
|
if (groups.length > 0) {
|
|
@@ -2654,15 +2625,19 @@ function buildProductListingPageWhere(params) {
|
|
|
2654
2625
|
if (tagIds) clauses.push({ tags: { in: tagIds } });
|
|
2655
2626
|
const minPrice = filters?.price?.min;
|
|
2656
2627
|
if (minPrice != null) {
|
|
2657
|
-
clauses.push({
|
|
2628
|
+
clauses.push({
|
|
2629
|
+
"priceRange.maxVariantPrice.amount": { greater_than_equal: minPrice }
|
|
2630
|
+
});
|
|
2658
2631
|
}
|
|
2659
2632
|
const maxPrice = filters?.price?.max;
|
|
2660
2633
|
if (maxPrice != null) {
|
|
2661
|
-
clauses.push({
|
|
2634
|
+
clauses.push({
|
|
2635
|
+
"priceRange.minVariantPrice.amount": { less_than_equal: maxPrice }
|
|
2636
|
+
});
|
|
2662
2637
|
}
|
|
2663
2638
|
if (filters?.availableForSale != null) {
|
|
2664
2639
|
clauses.push({
|
|
2665
|
-
|
|
2640
|
+
availableForSale: { equals: filters.availableForSale }
|
|
2666
2641
|
});
|
|
2667
2642
|
}
|
|
2668
2643
|
if (clauses.length === 0) return void 0;
|