@01.software/sdk 0.40.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/README.md CHANGED
@@ -363,7 +363,10 @@ does not expose), use `createServerClient()` and spread
363
363
  `PRODUCT_PLP_FIND_OPTIONS` to raise the default Payload join limit of 10:
364
364
 
365
365
  ```typescript
366
- import { PRODUCT_PLP_FIND_OPTIONS } from '@01.software/sdk'
366
+ import {
367
+ PRODUCT_PLP_FIND_OPTIONS,
368
+ projectProductToListingShape,
369
+ } from '@01.software/sdk'
367
370
  import { createServerClient } from '@01.software/sdk/server'
368
371
 
369
372
  const server = createServerClient({
@@ -396,6 +399,8 @@ const { docs } = await server.collections.from('products').find({
396
399
  },
397
400
  limit: 24,
398
401
  })
402
+
403
+ const listingProducts = docs.map(projectProductToListingShape)
399
404
  ```
400
405
 
401
406
  `PRODUCT_PLP_FIND_OPTIONS` sets `joins.variants` and `joins.options` to safe
@@ -1487,6 +1492,12 @@ API keys created without explicit scopes use the default `['read', 'write']`. Co
1487
1492
 
1488
1493
  ## Changelog
1489
1494
 
1495
+ > The complete, up-to-date release history (including 0.35.0+) lives in
1496
+ > [`CHANGELOG.md`](./CHANGELOG.md), and breaking-change migration steps live in
1497
+ > [`MIGRATION.md`](./MIGRATION.md). Both ship with the published package. The
1498
+ > selected entries below are kept inline for historically significant breaking
1499
+ > changes.
1500
+
1490
1501
  ### v0.23.0 (Product option-value visuals)
1491
1502
 
1492
1503
  - Added reusable option-value visuals (nested `swatch`, `thumbnail`, `images`) to Payload types and ecommerce utility shapes.
package/dist/client.cjs CHANGED
@@ -2390,11 +2390,14 @@ function compareVariantOrder(a, b) {
2390
2390
  const bId = String(getRelationID(b.id) ?? "");
2391
2391
  return aId.localeCompare(bId);
2392
2392
  }
2393
- function isVariantAvailableForSale(variant) {
2393
+ function getVariantAvailableForSale(variant) {
2394
2394
  if (variant.isActive === false) return false;
2395
2395
  if (variant.isUnlimited) return true;
2396
2396
  return (variant.stock ?? 0) - (variant.reservedStock ?? 0) > 0;
2397
2397
  }
2398
+ function isVariantAvailableForSale(variant) {
2399
+ return getVariantAvailableForSale(variant);
2400
+ }
2398
2401
  function sortVariantsForMediaSelection(variants) {
2399
2402
  const orderedVariants = [...variants].sort(compareVariantOrder);
2400
2403
  const activeVariants = orderedVariants.filter(