@01.software/sdk 0.43.0 → 0.44.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 (37) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +17 -18
  3. package/dist/client.cjs.map +1 -1
  4. package/dist/client.d.cts +6 -6
  5. package/dist/client.d.ts +6 -6
  6. package/dist/client.js.map +1 -1
  7. package/dist/{collection-client-gWsA7BVP.d.ts → collection-client-DWooaiTr.d.ts} +3 -3
  8. package/dist/{collection-client-U70KizLf.d.cts → collection-client-Dyl-CDcj.d.cts} +3 -3
  9. package/dist/{const-BBynifk0.d.cts → const-1vleZ6ov.d.cts} +1 -1
  10. package/dist/{const-_WWHU-gX.d.ts → const-pGDnsy0o.d.ts} +1 -1
  11. package/dist/{index-DPi5NWU8.d.ts → index-DUNySyxV.d.ts} +3 -3
  12. package/dist/{index-Dg4Y6Aq7.d.cts → index-a6g7vqAD.d.cts} +3 -3
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +7 -7
  15. package/dist/index.d.ts +7 -7
  16. package/dist/index.js.map +1 -1
  17. package/dist/{payload-types-DLxkB7Mv.d.cts → payload-types-CDsuOEfM.d.cts} +4 -9
  18. package/dist/{payload-types-DLxkB7Mv.d.ts → payload-types-CDsuOEfM.d.ts} +4 -9
  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.map +1 -1
  24. package/dist/server.d.cts +7 -7
  25. package/dist/server.d.ts +7 -7
  26. package/dist/server.js.map +1 -1
  27. package/dist/{types-Bpx5sYKo.d.cts → types-CDND3hzq.d.cts} +12 -7
  28. package/dist/{types-B9lGhZlB.d.ts → types-Dt9FJisi.d.ts} +12 -7
  29. package/dist/{types-B1ngKbWI.d.cts → types-SoXsbKhj.d.cts} +1 -1
  30. package/dist/{types-BiKNBwRA.d.ts → types-oiae_LMm.d.ts} +1 -1
  31. package/dist/ui/form.d.cts +1 -1
  32. package/dist/ui/form.d.ts +1 -1
  33. package/dist/ui/video.d.cts +1 -1
  34. package/dist/ui/video.d.ts +1 -1
  35. package/dist/webhook.d.cts +4 -4
  36. package/dist/webhook.d.ts +4 -4
  37. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @01.software/sdk
2
2
 
3
+ ## 0.44.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 14f6a6a: BREAKING (0.x minor): require `pgProvider` alongside `pgPaymentId` for paid
8
+ order creation and checkout inputs so storefronts persist the same
9
+ provider-scoped payment key used by confirmation and payment recovery. Free
10
+ orders omit both fields.
11
+
12
+ ### Patch Changes
13
+
14
+ - 2e5c223: Expose registry-backed market country and currency fields in generated Payload collection types.
15
+ - 99727ac: Expose the product `unlisted` status in generated SDK Payload types. Product
16
+ visibility now lives on `status`; Console migrations add the `unlisted` enum
17
+ value, convert legacy product visibility values into status, and remove the
18
+ legacy visibility storage.
19
+
3
20
  ## 0.43.0
4
21
 
5
22
  ### Minor Changes
package/README.md CHANGED
@@ -226,7 +226,8 @@ const order = await server.commerce.orders.create({
226
226
  { product: productId, variant: variantId, option: optionId, quantity: 1 },
227
227
  ],
228
228
  totalAmount: 10000,
229
- pgPaymentId: 'provider-payment-id', // optional (omit for free orders)
229
+ pgProvider: 'portone', // required with pgPaymentId
230
+ pgPaymentId: 'provider-payment-id', // omit both fields for free orders
230
231
  discountCode: 'WELCOME10', // optional
231
232
  })
232
233
 
@@ -346,14 +347,13 @@ mismatches, still throw
346
347
  typed `SDKError` subclasses and preserve request IDs through the existing
347
348
  `lastRequestId` / `onRequestId` path.
348
349
 
349
- Public product visibility has two axes. Lifecycle `status` must still be
350
- `published` and `publishedAt` must be current or empty. Then
351
- `storefrontVisibility` decides storefront exposure: `listed` products appear in
352
- listing helpers and direct detail, `unlisted` products are omitted from listing
353
- helpers but can be fetched by direct detail slug/id, and `hidden` products return
354
- `{ found: false, reason: 'not_published' }` from detail and are omitted from
355
- listings. Legacy products without `storefrontVisibility` are treated as
356
- `listed`.
350
+ Public product visibility is driven by product `status` and `publishedAt`.
351
+ Listing helpers return products with `status: 'published'` when `publishedAt`
352
+ is current or empty. Direct detail and checkout admission also allow
353
+ `status: 'unlisted'`, so an unlisted product can be opened by slug/id without
354
+ appearing in PLP/search/curated listing helpers. Draft, archived, scheduled, or
355
+ malformed lifecycle states return `{ found: false, reason: 'not_published' }`
356
+ from detail and are omitted from listings.
357
357
 
358
358
  The successful product payload exposes inventory rollups without sentinel
359
359
  values: `product.totalInventory` is the tracked stock sum across non-unlimited
@@ -457,13 +457,6 @@ const { docs } = await server.collections.from('products').find({
457
457
  { publishedAt: { equals: null } },
458
458
  ],
459
459
  },
460
- {
461
- or: [
462
- { storefrontVisibility: { equals: 'listed' } },
463
- { storefrontVisibility: { exists: false } },
464
- { storefrontVisibility: { equals: null } },
465
- ],
466
- },
467
460
  ],
468
461
  },
469
462
  limit: 24,
@@ -775,7 +768,7 @@ Dotted-path filters (`where: { 'product.slug': { equals } }`) are Payload-native
775
768
 
776
769
  Checklist when `find()` returns `docs: []` unexpectedly, in order of likelihood:
777
770
 
778
- 1. **Access control filtered the document.** Many collections enforce public read filters. Products require `status: 'published'`, a current or unset `publishedAt`, and listable storefront visibility (`listed`, legacy missing, or `null`) for publishable-key raw listing reads. Draft, future, `unlisted`, `hidden`, or malformed products silently disappear from raw listing results even when their slug or ID matches. Use the shaped product detail helper for direct-link `unlisted` products. Correlate with backend logs via `client.lastRequestId` (or catch `SDKError.requestId`).
771
+ 1. **Access control filtered the document.** Many collections enforce public read filters. Product listing reads require `status: 'published'` plus a current or unset `publishedAt`. Draft, future, `unlisted`, archived, or malformed products silently disappear from raw listing results even when their slug or ID matches. Use `commerce.product.detail({ slug | id })` for `unlisted` products. Correlate with backend logs via `client.lastRequestId` (or catch `SDKError.requestId`).
779
772
  2. **Build-time publishable key / API URL differs from runtime.** SSG `generateStaticParams` / `generateMetadata` / the page render must all see the same tenant context. A wrong or missing key at build time produces a baked-in empty response.
780
773
  3. **Next.js SSG fetch cache served a stale empty response.** Use `cache: 'no-store'` or `export const revalidate = 0` on server components that should reflect live data.
781
774
  4. **`where: { slug: 'x' }` string shorthand.** Always use `{ slug: { equals: 'x' } }` — bare strings silently match nothing.
@@ -1103,7 +1096,7 @@ Available on ServerClient via `server.commerce.orders.*`. `checkout` and `listMi
1103
1096
  // Orders
1104
1097
  await server.commerce.orders.create(params)
1105
1098
  await server.commerce.orders.update({ orderNumber, status: 'confirmed' })
1106
- await server.commerce.orders.checkout({ cartId, pgPaymentId?, orderNumber, customerSnapshot, discountCode? })
1099
+ await server.commerce.orders.checkout({ cartId, orderNumber, customerSnapshot, pgProvider, pgPaymentId, discountCode? })
1107
1100
 
1108
1101
  // Single-order lookup (getOrder endpoint removed — use collection find)
1109
1102
  const { docs: [order] } = await server.collections.from('orders').find({
@@ -1129,6 +1122,12 @@ await server.commerce.orders.confirmPayment({
1129
1122
  providerEventId,
1130
1123
  })
1131
1124
 
1125
+ // For paid create/checkout flows, pass pgProvider with the same provider slug
1126
+ // you will later use for confirmPayment and getByPaymentId. pgProvider and
1127
+ // pgPaymentId are a pair: omit both for free orders, or provide both for paid
1128
+ // payment windows. getByPaymentId({ pgProvider, pgPaymentId }) is strict and
1129
+ // only resolves payment transactions stored with the same provider.
1130
+
1132
1131
  // Low-level transaction annotation / compatibility path. Prefer confirmPayment()
1133
1132
  // for normal provider-verified paid transitions.
1134
1133
  // status: 'failed' records a retryable PG failure on the Transaction only; the