@01.software/sdk 0.72.1 → 0.74.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 (47) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +70 -3
  3. package/dist/client.cjs +21 -11
  4. package/dist/client.cjs.map +1 -1
  5. package/dist/client.d.cts +6 -6
  6. package/dist/client.d.ts +6 -6
  7. package/dist/client.js +21 -11
  8. package/dist/client.js.map +1 -1
  9. package/dist/{collection-client-B3CnqMDQ.d.cts → collection-client-Bb1Wa6T6.d.cts} +4 -4
  10. package/dist/{collection-client-uOgS_1bC.d.ts → collection-client-DBrLM9RR.d.ts} +4 -4
  11. package/dist/{const-BJBK7jBl.d.ts → const-CkY2zB6J.d.ts} +1 -1
  12. package/dist/{const-_ZfJjRQG.d.cts → const-DWTSgCkn.d.cts} +1 -1
  13. package/dist/{index-CBaP4q8r.d.ts → index-Daoh-98A.d.ts} +3 -3
  14. package/dist/{index-CI_LFWiG.d.cts → index-Di5AybQN.d.cts} +3 -3
  15. package/dist/index.cjs +22 -12
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +14 -11
  18. package/dist/index.d.ts +14 -11
  19. package/dist/index.js +22 -12
  20. package/dist/index.js.map +1 -1
  21. package/dist/{payload-types-BRg8Yary.d.cts → payload-types-zukuL1s_.d.cts} +408 -1761
  22. package/dist/{payload-types-BRg8Yary.d.ts → payload-types-zukuL1s_.d.ts} +408 -1761
  23. package/dist/query.cjs +4 -0
  24. package/dist/query.cjs.map +1 -1
  25. package/dist/query.d.cts +5 -5
  26. package/dist/query.d.ts +5 -5
  27. package/dist/query.js +4 -0
  28. package/dist/query.js.map +1 -1
  29. package/dist/realtime.d.cts +2 -2
  30. package/dist/realtime.d.ts +2 -2
  31. package/dist/server.cjs +51 -19
  32. package/dist/server.cjs.map +1 -1
  33. package/dist/server.d.cts +8 -7
  34. package/dist/server.d.ts +8 -7
  35. package/dist/server.js +51 -19
  36. package/dist/server.js.map +1 -1
  37. package/dist/{types-FyklqLAk.d.cts → types-BI7aowdu.d.cts} +4 -4
  38. package/dist/{types-Cmnxxvuv.d.ts → types-BsJokT6P.d.ts} +76 -16
  39. package/dist/{types-DLjSqL0P.d.ts → types-SsS04wGw.d.ts} +4 -4
  40. package/dist/{types-CnkJQUez.d.cts → types-evAvqRBj.d.cts} +76 -16
  41. package/dist/ui/form.d.cts +1 -1
  42. package/dist/ui/form.d.ts +1 -1
  43. package/dist/ui/video.d.cts +1 -1
  44. package/dist/ui/video.d.ts +1 -1
  45. package/dist/webhook.d.cts +5 -5
  46. package/dist/webhook.d.ts +5 -5
  47. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,78 @@
1
1
  # @01.software/sdk
2
2
 
3
+ ## 0.74.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a5ac520: **Additive response arm (0.x minor).** `cancelOrder()` already returned this body for an order paid entirely with customer credit; `CancelOrderResponse` now types it as `CancelOrderCreditOnlyCommittedResponse` (exported from `@01.software/sdk`): `cancelCommitted: true`, the restored purchase total as `refundedAmount`, `providerRefunded: false`, and no `transactionId` or `refundPending`. There is no PG refund to run. Runtime behavior is unchanged. Code that assumed a committed response without `transactionId` has `refundedAmount: 0`, or an exhaustive check over `CancelOrderResponse`, needs the new arm.
8
+ - b01549e: Feature progress now supports `customers` and `community` in addition to `ecommerce`. `createServerClient().tenant.featureProgress({ feature })` returns the response for the requested feature (`TenantFeatureProgressResponseFor<F>`): the `ecommerce` response keeps `config.fulfillmentMode`, while `customers` and `community` responses have no `config`. `TenantFeatureProgressResponse` still names the ecommerce response and `TenantFeatureProgressInput` still defaults to `feature: 'ecommerce'`, so existing wrappers keep their types; use `TenantFeatureProgressInput<TenantFeatureProgressFeature>` and `TenantFeatureProgressResponseUnion` to handle every supported feature. `01 feature check customers|community` reports hosted customer sign-in and first public comment setup. Manual items still require an end-to-end check in the app.
9
+
10
+ BREAKING (0.x minor): `TenantFeatureProgressFeature` now also includes `'customers'` and `'community'`, so exhaustive handling of that type needs the new cases, and a hand-written `TenantIntrospectionClient` implementation must type `featureProgress` as generic over the requested feature.
11
+
12
+ - 6b8a188: Feature progress now supports `events`. `createServerClient().tenant.featureProgress({ feature: 'events' })` and `01 feature check events` report whether the workspace event calendar is public and whether a scheduled, not-yet-ended occurrence accepts a free RSVP, plus a manual register, lookup, and cancel check. The check is read-only and does not evaluate remaining capacity or paid admission. The response has no `config`.
13
+
14
+ BREAKING (0.x minor): `TenantFeatureProgressFeature` now also includes `'events'`, so exhaustive handling of that type needs the new case.
15
+
16
+ - f433dee: Feature progress now supports `membership`. `createServerClient().tenant.featureProgress({ feature: 'membership' })` and `01 feature check membership` report whether an active plan has an active price for new sign-ups, plus a manual sign-up, charge, renewal, and cancellation check. Apps that only read or cancel existing memberships can treat the sellable-plan item as optional. The response has no `config`, like `customers` and `community`.
17
+
18
+ BREAKING (0.x minor): `TenantFeatureProgressFeature` now also includes `'membership'`, so exhaustive handling of that type needs the new case.
19
+
20
+ ### Patch Changes
21
+
22
+ - 6814052: Clarify generated Event location JSDoc about the public read visibility of stored online URLs and notes and the privacy of internal notes. Persisted location paths and public read behavior remain unchanged.
23
+ - 65ed375: `Tenant` 생성 타입의 `defaultContentLocale` 설명 주석에 고객 메일도 이 언어로 발송한다는 내용이 추가됩니다. 타입 구조는 변경하지 않습니다.
24
+ - eb457be: Regenerate Payload type documentation after clarifying guest-link expiry guidance in the Console Admin Panel. Only JSDoc changes; field types and API response shapes are unchanged.
25
+ - e1c8158: Order variants by their fractional-indexing `_order` key (code-unit order, keyed before unkeyed; equal to the Admin Panel order for current-format `[0-9a-z]` keys) instead of a `Number()` conversion that turned every key into `NaN`, so listing-group representative variants and `fillDefaults` selections follow the Admin Panel variant order.
26
+ - e0fcb45: Type `createServerClient().video` as non-optional so the documented `createServerClient(...).video.playback(id)` compiles under strict TypeScript without `?.` or `!`. The server client always sets `video` at runtime; `RootServerClient.video` stays optional for structural mocks. A hand-written mock typed as `RootServerClientWithEvents` (or a `withMarket()` stub returning it) now needs a `video` member.
27
+ - 58f915b: `Customer`·`Product` 생성 타입에서 `customData` 속성의 선언 순서만 바뀝니다. 타입 구조는 변경하지 않습니다.
28
+ - 0e826e1: Remove collection-level descriptions from the generated payload types; Console list screens no longer show collection descriptions.
29
+ - 6dea486: Shorten or remove commerce field descriptions in the generated payload types to match the trimmed Console copy.
30
+ - 8530c76: Align event and registration descriptions in the generated payload types with the Console public read terminology and clarify guest-token PII visibility under retention policies. Types and response shapes are unchanged.
31
+ - 9c0c1d5: Point the generated `users.tenants` description at the renamed Settings > Workspace > Project destination.
32
+ - 16b3229: Shorten or remove shared field descriptions (SEO, subtitle, summary, taxonomy, videos) in the generated payload types to match the trimmed Console copy.
33
+ - a26270c: Keep internal profile record creation evidence out of public profile and profile-statistics types while synchronizing the generated storage schema. Ordinary API and GraphQL surfaces do not expose `recordCreatedAt`.
34
+ - 1d52b00: Shorten or remove customer and membership field descriptions in the generated payload types to match the trimmed Console copy.
35
+ - a16f609: Shorten or remove content, community and event field descriptions in the generated payload types to match the trimmed Console copy.
36
+ - 4165ada: Add `voided` to the generated `MembershipUnappliedPaidEvidence.reason` values for late paid evidence on expired setup charges.
37
+ - 27f0891: Shorten or remove workspace, settings and system field descriptions in the generated payload types to match the trimmed Console copy.
38
+ - 5376b13: Fix product listing-page search requests to query title and slug only, avoiding HTTP 400 errors caused by querying the nonexistent Products handle field.
39
+ - fb854bc: 생성 타입에서 입장 유형 `priceReference` 필드 설명 주석을 갱신한다. 런타임과 타입 시그니처 변경은 없다.
40
+ - 809b7db: Clarify the generated Video viewCount documentation to reflect that views are not currently collected automatically. The type structure is unchanged.
41
+
42
+ ## 0.73.1
43
+
44
+ ### Patch Changes
45
+
46
+ - 57e6e15: Sort product options and option values by their orderable `_order` keys in Payload's fractional-indexing (code-unit) order instead of the runtime-locale-dependent `localeCompare` order. For current-format keys this is the order the Admin Panel shows.
47
+ - 623b7e8: Update the generated field descriptions for the tenant base currency and the market exchange rate.
48
+ - 265ad09: Synchronize generated storage types for internal Project invitations and private
49
+ current-email verification evidence. No invitation SDK API or collection access
50
+ is added.
51
+
52
+ ## 0.73.0
53
+
54
+ ### Minor Changes
55
+
56
+ - b271588: Add optional market selection to events.getAdmissionAvailability so callers can display the same market price used by Cart and Checkout. Omitted market uses the catalog default; the public price response keeps its existing fields. Resolved-market reads, including default-market calls, omit admission types whose same-tenant products are not assigned to that market.
57
+ - 41c7d41: Add server-only `memberships.billingCustodyContext` to obtain the Console-owned
58
+ restore generation through the existing delegated HMAC custody boundary. Keep
59
+ legacy ciphertext requests and responses compatible. Deploy Console support
60
+ before publishing the SDK or using the updated Membership and CLUB templates.
61
+ The bundled starters obtain the generation from Console without a storefront
62
+ environment variable and retain the generation across custody read/CAS updates.
63
+
64
+ ### Patch Changes
65
+
66
+ - 163b450: Clarify that form submission email settings are retained for compatibility and do not send notifications, without changing field keys or types.
67
+ - ae622d1: Refresh generated workspace sender, credential, and webhook field descriptions. Public types and API behavior are unchanged.
68
+ - f8a25e1: Clarify that tenant administrators obtain the billing custody restore generation from the authenticated Console delegated billing connection panel.
69
+ - 9cfcc4e: Update generated User membership guidance to point Project workspace member management to Settings > Workspace > Project environments. No SDK type shape or runtime behavior changes.
70
+ - b8a447c: Clarify generated transaction kind and shipping policy descriptions without changing field keys or types.
71
+ - 4781438: Clarify the generated customer address description. Field types and API response shapes are unchanged.
72
+ - 3d0665d: Clarify the generated preview destination description without changing its schema or behavior.
73
+ - 668102b: Webhook.url 필드 설명의 민감정보 경고를 복원합니다. 타입 구조는 변경하지 않습니다.
74
+ - 5ef9bc6: Format the numbers in the `Monthly API usage limit exceeded (current/limit)` error message with a fixed `en-US` locale so the message no longer depends on the runtime's default locale.
75
+
3
76
  ## 0.72.1
4
77
 
5
78
  ### Patch Changes
package/README.md CHANGED
@@ -472,6 +472,8 @@ addendum in `docs/decisions/0012-sdk-public-commerce-contract.md`.
472
472
 
473
473
  ### Product Listing Pages (PLP) — join-safe queries
474
474
 
475
+ `search` trims surrounding whitespace and matches product `title` or `slug`.
476
+
475
477
  **Recommended path:** Use `commerce.product.listingPage()` (or
476
478
  `createQueryHooks(client).useProductListingPage()`) for greenfield storefront
477
479
  PLPs. It wraps the cacheable listing-groups query endpoint, keeps the raw
@@ -933,6 +935,32 @@ request UUID and the current version; exact retries retain the original values.
933
935
  A privacy-erased snapshot has state `erased`, null `externalCustomerId`, and
934
936
  null `previousState`. Keep these calls and snapshots in trusted server code.
935
937
 
938
+ ### Delegated billing ciphertext
939
+
940
+ The server client obtains the Console-owned restore generation through the
941
+ existing custody endpoint, using its server key and delegated connection HMAC:
942
+
943
+ ```ts
944
+ const { generation } = await server.memberships.billingCustodyContext({
945
+ membershipId,
946
+ webhookSecret,
947
+ })
948
+ const stored = await server.memberships.billingCustody({
949
+ action: 'read',
950
+ membershipId,
951
+ webhookSecret,
952
+ generation,
953
+ })
954
+ ```
955
+
956
+ Keep that generation and `stored.version` for mutations based on this read.
957
+ Obtain a context immediately before a fresh initial upload (`expectedVersion: 0`).
958
+ Generation mismatch stops execution; never fetch a new context to retry an old
959
+ mutation or charge. After recovery, provider re-authorization and a fresh encrypted
960
+ upload/readback are required. Existing explicit-generation requests remain
961
+ supported. Deploy Console support before SDK publication and upgraded template
962
+ use; unsupported servers and malformed contexts fail without fallback.
963
+
936
964
  ## Storefront performance defaults
937
965
 
938
966
  - **PLP:** prefer `commerce.product.listingPage()` or `useProductListingPage()` (GET `/api/products/listing-groups/query/catalog`, CDN-cacheable, card-ready). Use `listingGroupsCatalog({ productIds })` only when IDs are already known. Treat the full listing-groups response shape as a server-auth escape hatch because it can include operational stock fields. Avoid fetching a product list and then calling `detail()` per card.
@@ -1634,9 +1662,24 @@ customer already owns returns `resolution: 'unchanged'` and writes nothing, so
1634
1662
  the revision you last observed stays valid for the next mutation. Because it
1635
1663
  writes nothing, such a merge does not count as Cart activity for stale-Cart
1636
1664
  cleanup.
1665
+ `carts.merge` rejects an unknown or wrong `guestCartToken`, or a Cart belonging to another
1666
+ customer or tenant, with the same `404/not_found` envelope without writes.
1667
+ The response does not reveal which case occurred. Branch on
1668
+ `reason`, and use `requestId` for support correlation rather than comparing error text.
1637
1669
  Treat a replayed Cart result as an operation receipt: never replace a newer
1638
1670
  cached Cart with a lower `revision`; retrieve when response ordering is unclear.
1639
1671
 
1672
+ A customer can have more than one active Cart, because `carts.create` always
1673
+ creates a new Cart. `carts.mine` returns the active Cart with the latest
1674
+ `createdAt`, and `carts.merge` merges a guest Cart into that same Cart. When
1675
+ `createdAt` is equal, the Cart with the higher `id` is chosen. Merging an active
1676
+ Cart the customer already owns returns that Cart `unchanged`, even when it is an
1677
+ older Cart.
1678
+
1679
+ If the guest Cart's market differs from that chosen Cart, `carts.merge` returns
1680
+ `409 cart_market_mismatch`. It does not merge into an older Cart in the guest
1681
+ Cart's market instead.
1682
+
1640
1683
  Shipping Checkout creation requires a request `shippingAddress` or a valid
1641
1684
  stored Cart address whenever any line has `requiresShipping !== false`.
1642
1685
  `recipientName`, `phone`, `postalCode`, `address`, and `detailAddress` must be nonblank after trimming. Otherwise,
@@ -1931,9 +1974,12 @@ Customer order reads remain available through
1931
1974
  The SDK root no longer exports raw generated `Order`, `Transaction`, `Cart`, or
1932
1975
  `CartItem` Payload documents. Use the canonical `PublicOrder` / `PublicCart`
1933
1976
  DTOs for storefront code and explicit server collection types only inside
1934
- trusted operational code. Order cancellation no longer returns the deprecated
1935
- inline provider-refund branch. `refundPending` is a local financial marker, not
1936
- authority for caller provider I/O:
1977
+ trusted operational code. SDK types no longer include the retired inline
1978
+ provider-refund flow. An order whose cancellation started through that flow can
1979
+ still return `providerRefunded: true` with `refundSeq`, or an uncommitted body
1980
+ with `reconciliationRequired: true`. These bounded legacy bodies remain outside
1981
+ `CancelOrderResponse`. `refundPending` is a local financial marker, not authority
1982
+ for caller provider I/O:
1937
1983
 
1938
1984
  | Captured payment lane | Provider refund owner | `resolveCancelRefund` |
1939
1985
  | ------------------------------------------------------- | ---------------------------- | ----------------------------------------------------------------------------------- |
@@ -1956,6 +2002,13 @@ as a committed cancellation and never start a provider refund from your
1956
2002
  storefront or BFF. A retry reads or resumes the same Console refund. Registered
1957
2003
  PortOne and credit-funded managed orders still return the pending marker.
1958
2004
 
2005
+ For an order paid entirely with customer credit, `cancelOrder()` restores credit
2006
+ inside the cancel commit and returns `CancelOrderCreditOnlyCommittedResponse`:
2007
+ `cancelCommitted: true`, the positive restored purchase total as
2008
+ `refundedAmount`, and `providerRefunded: false`, with neither `transactionId`
2009
+ nor `refundPending`. There is no PG refund to run. A later domain retry uses the
2010
+ ordinary `alreadyCanceled` arm with the same `refundedAmount`.
2011
+
1959
2012
  Managed ownership follows the captured Transaction's exact tenant-bound
1960
2013
  PaymentSession and historical registered account. Order/provider/environment
1961
2014
  drift remains Console-owned corruption. Unresolved or cross-tenant identity
@@ -2328,6 +2381,20 @@ replacement API. Pass an empty list to clear codes. Singular `admission`,
2328
2381
  Browser `mine()`/`merge({ guestCartToken })` derive customer identity from the
2329
2382
  JWT; server calls require an explicit `customerToken`.
2330
2383
 
2384
+ ### Event admission availability
2385
+
2386
+ For paid admission choices, call
2387
+ `client.events.getAdmissionAvailability({ occurrence, market: 'kr' })` with an
2388
+ active market handle or id. Omit `market` for the catalog default. The public
2389
+ price includes `amount`, `compareAtPrice`, `currency`, and `marketId` resolved
2390
+ from fixed market prices or the market calculation; an unknown market returns
2391
+ `404 not_found`. Use the same market for the Cart. Checkout re-reads current
2392
+ pricing and eligibility. When a market resolves, admission types are returned
2393
+ only when their same-tenant product is assigned to that market. This filter also
2394
+ applies to existing calls that omit `market` and use the default market; missing
2395
+ products and empty assignments are omitted. With no active market, base pricing
2396
+ and the existing unfiltered behavior remain.
2397
+
2331
2398
  ### Customer event registration history
2332
2399
 
2333
2400
  After customer sign-in, `client.events.listMyRegistrations({ page: 1, limit: 10 })`
package/dist/client.cjs CHANGED
@@ -896,7 +896,7 @@ async function httpFetch(url, options) {
896
896
  );
897
897
  const usageError = attachRequestId(
898
898
  createUsageLimitError(
899
- `Monthly API usage limit exceeded (${current.toLocaleString()}/${limit.toLocaleString()})`,
899
+ `Monthly API usage limit exceeded (${current.toLocaleString("en-US")}/${limit.toLocaleString("en-US")})`,
900
900
  { limit, current, remaining },
901
901
  {
902
902
  url,
@@ -1386,6 +1386,10 @@ var EMBEDDED_ADMIN_ENDPOINT_OPERATIONS = {
1386
1386
  configure: operation("tenants", "patch", "/embedded-admin-app"),
1387
1387
  disable: operation("tenants", "delete", "/embedded-admin-app")
1388
1388
  };
1389
+ var FIELD_CONFIG_ENDPOINT_OPERATIONS = {
1390
+ list: operation("field-configs", "get", "/list"),
1391
+ save: operation("field-configs", "post", "/save")
1392
+ };
1389
1393
  var EVENTS_ENDPOINT_OPERATIONS = {
1390
1394
  registrations: {
1391
1395
  register: operation("event-registrations", "post", "/register"),
@@ -5613,6 +5617,11 @@ function getRelationID(value) {
5613
5617
  }
5614
5618
  return void 0;
5615
5619
  }
5620
+ function compareOrdinal(left, right) {
5621
+ if (left < right) return -1;
5622
+ if (left > right) return 1;
5623
+ return 0;
5624
+ }
5616
5625
  function extractEntityId(value) {
5617
5626
  if (typeof value === "string") return value;
5618
5627
  if (typeof value === "number") return String(value);
@@ -6218,14 +6227,17 @@ function buildProductHref(product, group, options = {}) {
6218
6227
  return params.size > 0 ? `${path}?${params.toString()}` : path;
6219
6228
  }
6220
6229
  function compareVariantOrder(a, b) {
6221
- const aOrder = Number(a._order ?? Number.MAX_SAFE_INTEGER);
6222
- const bOrder = Number(b._order ?? Number.MAX_SAFE_INTEGER);
6223
- if (Number.isFinite(aOrder) && Number.isFinite(bOrder) && aOrder !== bOrder) {
6224
- return aOrder - bOrder;
6230
+ const aOrder = a._order || null;
6231
+ const bOrder = b._order || null;
6232
+ if (aOrder !== bOrder) {
6233
+ if (aOrder === null) return 1;
6234
+ if (bOrder === null) return -1;
6235
+ const byOrder = compareOrdinal(aOrder, bOrder);
6236
+ if (byOrder !== 0) return byOrder;
6225
6237
  }
6226
6238
  const aId = String(getRelationID(a.id) ?? "");
6227
6239
  const bId = String(getRelationID(b.id) ?? "");
6228
- return aId.localeCompare(bId);
6240
+ return compareOrdinal(aId, bId);
6229
6241
  }
6230
6242
  function getVariantAvailableForSale(variant) {
6231
6243
  if (variant.isActive === false) return false;
@@ -6472,11 +6484,7 @@ function buildProductListingPageWhere(params) {
6472
6484
  const search = params.search?.trim();
6473
6485
  if (search) {
6474
6486
  clauses.push({
6475
- or: [
6476
- { title: { like: search } },
6477
- { slug: { like: search } },
6478
- { handle: { like: search } }
6479
- ]
6487
+ or: [{ title: { like: search } }, { slug: { like: search } }]
6480
6488
  });
6481
6489
  }
6482
6490
  const filters = params.filters;
@@ -6830,6 +6838,8 @@ function buildRangeEndpoint(params) {
6830
6838
  function buildAdmissionAvailabilityEndpoint(params) {
6831
6839
  const urlParams = new URLSearchParams();
6832
6840
  urlParams.set("occurrence", params.occurrence);
6841
+ const normalizedMarket2 = params.market?.trim();
6842
+ if (normalizedMarket2) urlParams.set("market", normalizedMarket2);
6833
6843
  return resolveOperationPath(
6834
6844
  EVENTS_ENDPOINT_OPERATIONS.occurrences.admissionAvailability,
6835
6845
  { query: urlParams }