@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/CHANGELOG.md +492 -0
- package/MIGRATION.md +183 -0
- package/README.md +12 -1
- package/dist/client.cjs +4 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +3 -3
- package/dist/client.d.ts +3 -3
- package/dist/client.js +4 -1
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-VYwYi6u6.d.cts → collection-client-Bymfni8u.d.cts} +1 -1
- package/dist/{collection-client-CKFa99C6.d.ts → collection-client-CN4lj6gi.d.ts} +1 -1
- package/dist/index.cjs +18 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/query.d.cts +2 -2
- package/dist/query.d.ts +2 -2
- package/dist/server.cjs +4 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +4 -1
- package/dist/server.js.map +1 -1
- package/dist/{types-D5uHrPLr.d.cts → types-Bl-m9ttd.d.cts} +31 -1
- package/dist/{types-Umd-YTjM.d.ts → types-CHrzs2GB.d.ts} +31 -1
- package/package.json +6 -4
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 {
|
|
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
|
|
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(
|