@01.software/sdk 0.35.0 → 0.36.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 (39) hide show
  1. package/dist/client.cjs.map +1 -1
  2. package/dist/client.d.cts +6 -6
  3. package/dist/client.d.ts +6 -6
  4. package/dist/client.js.map +1 -1
  5. package/dist/{collection-client-DkREjhQ9.d.ts → collection-client-Bq5Zd7p7.d.ts} +3 -3
  6. package/dist/{collection-client-CR2B8c1v.d.cts → collection-client-Cv0D2w1Q.d.cts} +3 -3
  7. package/dist/{const-CdqCauHQ.d.ts → const-BDUKFP9w.d.ts} +1 -1
  8. package/dist/{const-BTvdrXtY.d.cts → const-DVcM7Ac_.d.cts} +1 -1
  9. package/dist/{index-CjA3U6X3.d.cts → index-BHDKJ6B3.d.cts} +3 -3
  10. package/dist/{index-DK8_NXkh.d.ts → index-DTSXUYkr.d.ts} +3 -3
  11. package/dist/index.cjs +57 -4
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +7 -7
  14. package/dist/index.d.ts +7 -7
  15. package/dist/index.js +57 -4
  16. package/dist/index.js.map +1 -1
  17. package/dist/{payload-types-C7tb7Xbs.d.cts → payload-types-BCui2Oml.d.cts} +0 -20
  18. package/dist/{payload-types-C7tb7Xbs.d.ts → payload-types-BCui2Oml.d.ts} +0 -20
  19. package/dist/query.d.cts +5 -5
  20. package/dist/query.d.ts +5 -5
  21. package/dist/realtime.d.cts +2 -2
  22. package/dist/realtime.d.ts +2 -2
  23. package/dist/server.cjs +15 -0
  24. package/dist/server.cjs.map +1 -1
  25. package/dist/server.d.cts +7 -7
  26. package/dist/server.d.ts +7 -7
  27. package/dist/server.js +15 -0
  28. package/dist/server.js.map +1 -1
  29. package/dist/{types-1ylMrCuW.d.ts → types-3qV6sY7T.d.ts} +1 -1
  30. package/dist/{types-Bx558PU6.d.cts → types-CEzLf3PX.d.cts} +1 -1
  31. package/dist/{types-Byo_Rty4.d.ts → types-DK9EnLwJ.d.ts} +83 -17
  32. package/dist/{types-DDhtZI6E.d.cts → types-Dib-zdK6.d.cts} +83 -17
  33. package/dist/ui/form.d.cts +1 -1
  34. package/dist/ui/form.d.ts +1 -1
  35. package/dist/ui/video.d.cts +1 -1
  36. package/dist/ui/video.d.ts +1 -1
  37. package/dist/webhook.d.cts +4 -4
  38. package/dist/webhook.d.ts +4 -4
  39. package/package.json +3 -3
@@ -1,7 +1,7 @@
1
- import { D as DebugConfig, R as RetryConfig, A as ApiQueryOptions, P as PayloadFindResponse, h as PayloadMutationResponse } from './types-Byo_Rty4.js';
1
+ import { D as DebugConfig, R as RetryConfig, A as ApiQueryOptions, P as PayloadFindResponse, h as PayloadMutationResponse } from './types-DK9EnLwJ.js';
2
2
  import { GenerateMetadataOptions, Metadata } from './metadata.js';
3
- import { S as ServerCollection, P as PublicCollection } from './const-CdqCauHQ.js';
4
- import { C as CollectionType } from './types-1ylMrCuW.js';
3
+ import { S as ServerCollection, P as PublicCollection } from './const-BDUKFP9w.js';
4
+ import { C as CollectionType } from './types-3qV6sY7T.js';
5
5
 
6
6
  interface FetchOptions extends RequestInit {
7
7
  apiUrl?: string;
@@ -1,7 +1,7 @@
1
- import { D as DebugConfig, R as RetryConfig, A as ApiQueryOptions, P as PayloadFindResponse, h as PayloadMutationResponse } from './types-DDhtZI6E.cjs';
1
+ import { D as DebugConfig, R as RetryConfig, A as ApiQueryOptions, P as PayloadFindResponse, h as PayloadMutationResponse } from './types-Dib-zdK6.cjs';
2
2
  import { GenerateMetadataOptions, Metadata } from './metadata.cjs';
3
- import { S as ServerCollection, P as PublicCollection } from './const-BTvdrXtY.cjs';
4
- import { C as CollectionType } from './types-Bx558PU6.cjs';
3
+ import { S as ServerCollection, P as PublicCollection } from './const-DVcM7Ac_.cjs';
4
+ import { C as CollectionType } from './types-CEzLf3PX.cjs';
5
5
 
6
6
  interface FetchOptions extends RequestInit {
7
7
  apiUrl?: string;
@@ -1,4 +1,4 @@
1
- import { e as Config } from './payload-types-C7tb7Xbs.js';
1
+ import { e as Config } from './payload-types-BCui2Oml.js';
2
2
 
3
3
  /**
4
4
  * Collection type derived from Payload Config.
@@ -1,4 +1,4 @@
1
- import { e as Config } from './payload-types-C7tb7Xbs.cjs';
1
+ import { e as Config } from './payload-types-BCui2Oml.cjs';
2
2
 
3
3
  /**
4
4
  * Collection type derived from Payload Config.
@@ -1,6 +1,6 @@
1
- import { C as Collection } from './const-BTvdrXtY.cjs';
2
- import { C as CollectionType } from './types-Bx558PU6.cjs';
3
- import './payload-types-C7tb7Xbs.cjs';
1
+ import { C as Collection } from './const-DVcM7Ac_.cjs';
2
+ import { C as CollectionType } from './types-CEzLf3PX.cjs';
3
+ import './payload-types-BCui2Oml.cjs';
4
4
 
5
5
  type WebhookOperation = string;
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { C as Collection } from './const-CdqCauHQ.js';
2
- import { C as CollectionType } from './types-1ylMrCuW.js';
3
- import './payload-types-C7tb7Xbs.js';
1
+ import { C as Collection } from './const-BDUKFP9w.js';
2
+ import { C as CollectionType } from './types-3qV6sY7T.js';
3
+ import './payload-types-BCui2Oml.js';
4
4
 
5
5
  type WebhookOperation = string;
6
6
  /**
package/dist/index.cjs CHANGED
@@ -131,7 +131,8 @@ __export(src_exports, {
131
131
  resolveVariantForSelection: () => resolveVariantForSelection,
132
132
  selectNext: () => selectNext,
133
133
  selectedSwatchMediaItemId: () => selectedSwatchMediaItemId,
134
- stringifyProductSelection: () => stringifyProductSelection
134
+ stringifyProductSelection: () => stringifyProductSelection,
135
+ toShopifyPriceRangeV2: () => toShopifyPriceRangeV2
135
136
  });
136
137
  module.exports = __toCommonJS(src_exports);
137
138
 
@@ -1933,6 +1934,20 @@ var OrderApi = class extends BaseApi {
1933
1934
  idempotencyKey ? { headers: { "X-Idempotency-Key": idempotencyKey } } : void 0
1934
1935
  );
1935
1936
  }
1937
+ resolveCancelRefund(params) {
1938
+ return this.request(
1939
+ "/api/orders/resolve-cancel-refund",
1940
+ {
1941
+ orderNumber: params.orderNumber,
1942
+ idempotencyKey: params.idempotencyKey,
1943
+ outcome: params.outcome,
1944
+ refundedAmount: params.refundedAmount,
1945
+ pgProvider: params.pgProvider,
1946
+ ...params.pgRefundId ? { pgRefundId: params.pgRefundId } : {}
1947
+ },
1948
+ idempotencyRequestOptions(params.idempotencyKey)
1949
+ );
1950
+ }
1936
1951
  checkout(params) {
1937
1952
  const { body, idempotencyKey } = splitIdempotencyKey(params);
1938
1953
  return this.request(
@@ -4412,10 +4427,12 @@ function buildProductListingCard(item, options = {}) {
4412
4427
  const listingPrimaryMedia = listingPrimaryPointer ? productMediaPool.find(
4413
4428
  (item2) => getRelationID(item2) === listingPrimaryPointer
4414
4429
  ) ?? resolvedPrimaryMedia.primaryImage ?? null : null;
4415
- const priceRange = aggregateListingPriceRange(groups);
4416
- const availableForSale = groups.some(
4417
- (group) => group.listing.availableForSale
4430
+ const priceRange = resolveListingCardPriceRange(
4431
+ product,
4432
+ projectedListing,
4433
+ groups
4418
4434
  );
4435
+ const availableForSale = product.listing?.availableForSale != null ? product.listing.availableForSale : groups.length > 0 ? groups.some((group) => group.listing.availableForSale) : projectedListing.availableForSale;
4419
4436
  const swatches = groups.length > 1 ? groups.map((group) => buildListingSwatch(product, group, options)) : [];
4420
4437
  return {
4421
4438
  id: String(product.id),
@@ -4455,6 +4472,42 @@ function findListingCardRepresentativeVariant(variants, representativeVariantId)
4455
4472
  (variant) => getRelationID(variant.id) === representativeVariantId
4456
4473
  ) ?? null;
4457
4474
  }
4475
+ function toShopifyPriceRangeV2(listing) {
4476
+ return {
4477
+ minVariantPrice: { amount: listing.minPrice ?? null },
4478
+ maxVariantPrice: { amount: listing.maxPrice ?? null }
4479
+ };
4480
+ }
4481
+ function hasCompleteListingPriceProjection(listing) {
4482
+ return listing?.minPrice != null && listing?.maxPrice != null;
4483
+ }
4484
+ function listingDefinesCompareAtProjection(listing) {
4485
+ return "minCompareAtPrice" in listing || "maxCompareAtPrice" in listing;
4486
+ }
4487
+ function resolveListingCardPriceRange(product, projectedListing, groups) {
4488
+ const listing = product.listing;
4489
+ if (hasCompleteListingPriceProjection(listing)) {
4490
+ const groupRange = groups.length > 0 ? aggregateListingPriceRange(groups) : null;
4491
+ const definesCompareAt = listingDefinesCompareAtProjection(listing);
4492
+ return {
4493
+ minPrice: listing.minPrice,
4494
+ maxPrice: listing.maxPrice,
4495
+ minCompareAtPrice: definesCompareAt ? listing.minCompareAtPrice ?? null : groupRange?.minCompareAtPrice ?? projectedListing.minCompareAtPrice,
4496
+ maxCompareAtPrice: definesCompareAt ? listing.maxCompareAtPrice ?? null : groupRange?.maxCompareAtPrice ?? projectedListing.maxCompareAtPrice,
4497
+ isPriceRange: listing.isPriceRange ?? listing.minPrice !== listing.maxPrice
4498
+ };
4499
+ }
4500
+ if (groups.length > 0) {
4501
+ return aggregateListingPriceRange(groups);
4502
+ }
4503
+ return {
4504
+ minPrice: projectedListing.minPrice,
4505
+ maxPrice: projectedListing.maxPrice,
4506
+ minCompareAtPrice: projectedListing.minCompareAtPrice,
4507
+ maxCompareAtPrice: projectedListing.maxCompareAtPrice,
4508
+ isPriceRange: projectedListing.isPriceRange
4509
+ };
4510
+ }
4458
4511
  function aggregateListingPriceRange(groups) {
4459
4512
  const minPrice = minOfNullable(groups.map((g) => g.listing.minPrice));
4460
4513
  const maxPrice = maxOfNullable(groups.map((g) => g.listing.maxPrice));