@01.software/sdk 0.74.0 → 0.75.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 (55) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +79 -1
  3. package/dist/client.cjs +47 -5
  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 +47 -5
  8. package/dist/client.js.map +1 -1
  9. package/dist/{collection-client-Bb1Wa6T6.d.cts → collection-client-BNC6tUdK.d.cts} +3 -4
  10. package/dist/{collection-client-DBrLM9RR.d.ts → collection-client-CNkBMUHj.d.ts} +3 -4
  11. package/dist/collection-documents-Bl0AF0m0.d.cts +5486 -0
  12. package/dist/collection-documents-Bl0AF0m0.d.ts +5486 -0
  13. package/dist/{const-CkY2zB6J.d.ts → const-CcOT0taO.d.cts} +1 -3
  14. package/dist/{const-DWTSgCkn.d.cts → const-CcOT0taO.d.ts} +1 -3
  15. package/dist/{index-Daoh-98A.d.ts → index-CQsJvMCN.d.ts} +2 -3
  16. package/dist/{index-Di5AybQN.d.cts → index-CfxkqaY9.d.cts} +2 -3
  17. package/dist/index.cjs +48 -5
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +7 -7
  20. package/dist/index.d.ts +7 -7
  21. package/dist/index.js +48 -5
  22. package/dist/index.js.map +1 -1
  23. package/dist/query.cjs +12 -1
  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 +12 -1
  28. package/dist/query.js.map +1 -1
  29. package/dist/realtime.d.cts +1 -2
  30. package/dist/realtime.d.ts +1 -2
  31. package/dist/server.cjs +38 -2
  32. package/dist/server.cjs.map +1 -1
  33. package/dist/server.d.cts +7 -7
  34. package/dist/server.d.ts +7 -7
  35. package/dist/server.js +38 -2
  36. package/dist/server.js.map +1 -1
  37. package/dist/{types-BsJokT6P.d.ts → types-Btxz6NVi.d.ts} +106 -19
  38. package/dist/types-CQw4HXky.d.ts +151 -0
  39. package/dist/{types-evAvqRBj.d.cts → types-DMwRdJ-4.d.cts} +106 -19
  40. package/dist/types-Jr4xTiGs.d.cts +151 -0
  41. package/dist/ui/form.cjs.map +1 -1
  42. package/dist/ui/form.d.cts +1 -1
  43. package/dist/ui/form.d.ts +1 -1
  44. package/dist/ui/form.js.map +1 -1
  45. package/dist/ui/video.cjs.map +1 -1
  46. package/dist/ui/video.d.cts +1 -1
  47. package/dist/ui/video.d.ts +1 -1
  48. package/dist/ui/video.js.map +1 -1
  49. package/dist/webhook.d.cts +7 -5
  50. package/dist/webhook.d.ts +7 -5
  51. package/package.json +1 -1
  52. package/dist/payload-types-zukuL1s_.d.cts +0 -12617
  53. package/dist/payload-types-zukuL1s_.d.ts +0 -12617
  54. package/dist/types-BI7aowdu.d.cts +0 -53
  55. package/dist/types-SsS04wGw.d.ts +0 -53
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @01.software/sdk
2
2
 
3
+ ## 0.75.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3ab46a5: Allow `returnWithRefund` to complete an existing approved Return with `existingReturnId`, preserving the server-owned approval and idempotent replay. Clarify that the initial shipping refund is added separately to the line refund amount.
8
+
9
+ BREAKING (0.x minor): `returnWithRefund` now returns `ReturnWithRefundResponse`, matching the actual bounded completion receipt instead of full Return/Transaction documents. Use `refundSeq` and optional `notificationWarning`; read full documents separately when additional fields are needed. Completions without a provider transaction have both `transaction` and `refundSeq` set to null.
10
+
11
+ - 2a3cdbe: BREAKING (0.x minor): isolate SDK collection declarations from Console Config and Payload global type augmentation. Internal collection slugs no longer resolve to generated documents through `CollectionType`; existing browser/server buckets and runtime access checks are unchanged. Use documented operation DTOs where provided; code managing internal collections must use its application-owned Payload types.
12
+
13
+ Remove two unavailable internal relations from populated admission-hold types, including nested order/refund graphs. Preserve the other raw document fields and existing named compatibility types, including `WebhookWithoutSecret`. Consumer Payload applications retain ownership of their own `GeneratedTypes` augmentation. Compatibility disposition follows ADR 0138 and #8960.
14
+
15
+ - 78bd724: Add opt-in event registration email verification and its typed SDK helper on
16
+ `client.events` and `server.events`. The Events starter guides new deployments to
17
+ enable the event email-verification setting and shows an email code step for those
18
+ events; opt-out events keep immediate registration. Sandbox does not deliver
19
+ verification codes yet, so test registration there with an opt-out event.
20
+ Confirmation emails now have a tenant/recipient rolling-hour cap without changing
21
+ successful registration.
22
+ - 7aa55a1: BREAKING (0.x minor): createFulfillment and updateFulfillment now return FulfillmentMutationResponse instead of the raw Fulfillment document. Shipment mutation receipts retain shipment state, tracking and timestamps while excluding expanded relations and document extensions.
23
+
24
+ Migration: tenant, order and fulfillmentOrder are IDs rather than populated documents; fulfillmentOrder is null for legacy unlinked shipments. Branch on null before using that relationship. The receipt no longer includes items, adminNotes, metadata, method or deletedAt. Replace shipment.items?.docs and other document-only reads with an authorized server.collections.from('fulfillments').findById(receipt.id, { joins: { items: { limit: 100 } } }) read. Use the returned order or fulfillmentOrder ID with an authorized read of its owning collection when related details are needed. Remove dependencies on internal method values and populated tenant internals. Authorized collection reads retain their normal field access rules.
25
+
26
+ - 65f2725: Add `customer.auth.requestWithdrawalCode()` and `withdraw({ emailCode })` for purpose-limited withdrawal reauthentication on accounts without a local password. Existing `withdraw(password)` calls remain supported. Submit the code using the same refresh-family session (preserved across access-token refresh); successful withdrawal clears local credentials. Code-specific reauthentication reasons have a public type.
27
+
28
+ ### Patch Changes
29
+
30
+ - ed5deda: Classify workspace social provider configuration as internal and synchronize the generated document types without exposing a public collection API.
31
+ - 86ba927: Clarify that prepareFulfillmentOrder must precede createFulfillment because shipment creation requires an in-progress fulfillment order.
32
+ - f8ec410: Update the generated EventOccurrence field documentation to match the Console copy: describe parentPublic as the parent event's public status, separate from sales conditions, and drop the capacity and registrations editing hints. The type structure is unchanged.
33
+ - 79a9e72: Regenerate the `Tenant.tenantPurpose` field documentation in the raw collection document types to match the Console copy: TEST creation has ended and the purpose of retained records is immutable. The type structure is unchanged.
34
+ - c5470fd: Expose the server-only Membership billing anchor day and its source in generated collection types.
35
+ - e0c7231: Refresh the generated Tenant purpose documentation after TEST creation retirement.
36
+ The SDK type structure and wire format remain unchanged.
37
+ - 287a638: Synchronize generated tenant notification settings and notification event types for occurrence time and venue change notices.
38
+
3
39
  ## 0.74.0
4
40
 
5
41
  ### Minor Changes
package/README.md CHANGED
@@ -979,6 +979,12 @@ const client = createClient({ publishableKey: '...' })
979
979
  const query = createQueryHooks(client, getStorefrontQueryClient())
980
980
  ```
981
981
 
982
+ SDK document declarations are independent of your application's Payload
983
+ `GeneratedTypes`: importing the SDK does not register the Console schema in
984
+ Payload. `CollectionType<T>` resolves browser-public and server-only raw
985
+ collection documents; internal slugs remain classification vocabulary only.
986
+ Existing named raw exports, including `Tenant`, keep their compatibility shapes.
987
+
982
988
  ## Advanced: direct Payload queries (escape hatch)
983
989
 
984
990
  Most consumers should use the helper APIs above (`commerce.product.detail`, etc.). The query builder below is the escape hatch for advanced cases the helpers do not cover: bulk operations, custom filter combinations, or fields the helper response does not expose.
@@ -1569,12 +1575,36 @@ erase personal data or free the email for a new registration.
1569
1575
  Branch on `SDKError.apiReason`: `active_membership_exists` (409) requires the
1570
1576
  membership to end first, including scheduled cancellations still in an active
1571
1577
  status; `reauthentication_unavailable` (409) means no local password is set and
1572
- the customer should contact the tenant administrator. Incorrect passwords use
1578
+ the customer must request a withdrawal-only email code. Incorrect passwords use
1573
1579
  the shared login attempt counter and temporary lock (`account_locked`, 423).
1574
1580
  Refusal leaves the SDK credentials intact. Server keys cannot withdraw on a
1575
1581
  customer's behalf. Operator restore continues to follow the existing archive
1576
1582
  rules; the withdrawal timestamp is retained.
1577
1583
 
1584
+ Customers without local password material, including social-only accounts, use
1585
+ withdrawal-only email reauthentication:
1586
+
1587
+ ```ts
1588
+ await client.customer.auth.requestWithdrawalCode()
1589
+ // Collect the code sent to the stored email, keeping the same refresh-family session.
1590
+ const { withdrawnAt } = await client.customer.auth.withdraw({ emailCode })
1591
+ ```
1592
+
1593
+ The six-digit code expires after 10 minutes, is single-use and cannot sign in.
1594
+ Ten invalid proofs block code verification for 15 minutes. Reissuing does not
1595
+ reset that budget. Refresh within the same family preserves the proof; a new
1596
+ login/family needs a new code. Issuance accepts JSON `{}` and is limited to
1597
+ 5 requests per minute and 10 per hour per tenant/customer.
1598
+ `password_reauthentication_required` (409) means this account must use its local
1599
+ password. `withdrawal_session_refresh_required` (409) means its access token
1600
+ predates the stable session claim: refresh the existing direct session with
1601
+ `customer.auth.refreshToken()`, or the hosted session with `customer.oauth.refresh()`,
1602
+ store the returned pair, and retry code issuance. These code-specific 409 values
1603
+ are typed by `CustomerWithdrawalCodeReauthenticationReason`; common HTTP/auth
1604
+ reasons still apply. No code is issued before this refresh.
1605
+ No terms acknowledgement or new login session is required. `invalid_code` (401)
1606
+ requires a valid new proof; `service_unavailable` (503) keeps withdrawal denied.
1607
+
1578
1608
  ### Market discovery
1579
1609
 
1580
1610
  Discover a tenant's active buyer markets and resolve the default market. These
@@ -2049,6 +2079,7 @@ await server.commerce.orders.createReturn({
2049
2079
  await server.commerce.orders.updateReturn({ returnId, status })
2050
2080
  await server.commerce.orders.returnWithRefund({
2051
2081
  orderNumber,
2082
+ existingReturnId?,
2052
2083
  returnItems: [{ orderItem, quantity, restockingFee? }],
2053
2084
  refundAmount,
2054
2085
  returnShippingFee?,
@@ -2058,6 +2089,26 @@ await server.commerce.orders.returnWithRefund({
2058
2089
  })
2059
2090
  ```
2060
2091
 
2092
+ **BREAKING (0.x minor):** `createFulfillment` and `updateFulfillment` return `FulfillmentMutationResponse` instead of a raw `Fulfillment` document. Shipment state, tracking and timestamps remain in the receipt.
2093
+
2094
+ - `tenant`, `order` and `fulfillmentOrder` contain IDs instead of populated documents. Legacy unlinked shipments return `fulfillmentOrder: null`; check for null before reading the related work order.
2095
+ - `items`, `adminNotes`, `metadata`, `method` and `deletedAt` are absent from the receipt. Replace `shipment.items?.docs` and other document-only reads with `server.collections.from('fulfillments').findById(receipt.id, { joins: { items: { limit: 100 } } })` under authorized server credentials. Read related details from their owning collection using the returned ID. Remove dependencies on internal `method` values and populated tenant internals; collection reads retain their normal field access rules.
2096
+
2097
+ `returnWithRefund` can complete an existing approved Return by passing
2098
+ `existingReturnId` with its `orderNumber`. The server uses the persisted approval's
2099
+ items, amounts, fees and reason; caller values cannot widen it. Keep the required
2100
+ `returnItems` and positive `refundAmount` in the request. The line refund is after
2101
+ return shipping/restocking fees; the initial shipping refund is added separately.
2102
+ Repeat the same request and `idempotencyKey` after response loss.
2103
+
2104
+ The result is a bounded completion receipt: `return` includes only `id`,
2105
+ `status`, `refundAmount`, `returnShippingFee`, `initialShippingRefundAmount` and
2106
+ `completedAt`. A provider refund includes `transaction` (`id`, `type`, `kind`,
2107
+ `status`, `amount`, `providerEventId`) and numeric `refundSeq`; a completion
2108
+ without a provider transaction has `transaction: null` and `refundSeq: null`.
2109
+ `notificationWarning` may report a post-commit display/notification problem;
2110
+ the refund has completed. Read full documents separately if needed.
2111
+
2061
2112
  ### Commerce Discounts / Shipping
2062
2113
 
2063
2114
  Available on both Client (customer JWT) and ServerClient (secretKey).
@@ -2381,6 +2432,12 @@ replacement API. Pass an empty list to clear codes. Singular `admission`,
2381
2432
  Browser `mine()`/`merge({ guestCartToken })` derive customer identity from the
2382
2433
  JWT; server calls require an explicit `customerToken`.
2383
2434
 
2435
+ ### Event discovery and unlisted links
2436
+
2437
+ `client.events.getRange()` lists published events with `visibility=public`. Its pages and totals exclude `unlisted` events, as do Publishable Key raw event and occurrence lists and counts. For an unlisted link, retain the event and occurrence IDs and read each with `client.collections.from('events').findById(eventId)` and `client.collections.from('event-occurrences').findById(occurrenceId)`. Registration remains available when the event and occurrence meet the registration rules.
2438
+
2439
+ An id or slug filter on a raw list still follows listing visibility. To make an event discoverable, select `visibility=public`. Refresh cached lists and totals when the server's listing behavior changes.
2440
+
2384
2441
  ### Event admission availability
2385
2442
 
2386
2443
  For paid admission choices, call
@@ -2989,3 +3046,24 @@ zero provider amount and restores credit only. A full-credit Order rejects any
2989
3046
  `pgPaymentId` or `paymentKey`; never invent an identifier. Explicit blank values
2990
3047
  remain invalid. Orders without credit funding retain `400/validation_failed`
2991
3048
  when `pgPaymentId` is omitted. Refund amount, credential, tenant and ecommerce authority remain unchanged.
3049
+
3050
+ ### Event registration email verification
3051
+
3052
+ For an event with **Verify registration email** enabled, call
3053
+ `client.events.requestRegistrationEmailVerification(input)` before registering.
3054
+ When `verificationRequired` is true, collect the emailed eight-digit code, then
3055
+ pass the same input plus `emailVerification: { requestId, code }` to
3056
+ `client.events.register`. The code expires after 15 minutes and five attempts.
3057
+ No registration or seats exist until successful verification and a fresh capacity
3058
+ check. Opt-out events retain the existing register result and immediate behavior.
3059
+ Confirmation mail has a ten-per-hour tenant/recipient cap; suppression does not
3060
+ cancel registration. Event-cancellation notices are exempt. Verification mail has
3061
+ its own three-per-hour cap and a 60-second resend interval, plus ordinary email quota.
3062
+
3063
+ The request returns a processing receipt before delivery in Live and Sandbox.
3064
+ Recipient limits suppress background delivery behind that same receipt; the
3065
+ recipient-independent tenant admission limit still returns synchronous 429.
3066
+ Only an active member of the exact Sandbox with a verified current email receives
3067
+ the code, using platform From, a `[Sandbox]` subject and no Reply-To. Other
3068
+ recipients and ordinary event mail are captured. Sandbox keeps its shared
3069
+ 100/month non-billable email ceiling. A receipt confirms neither delivery nor seats.
package/dist/client.cjs CHANGED
@@ -1379,7 +1379,8 @@ var CUSTOMER_AUTH_ENDPOINT_OPERATIONS = {
1379
1379
  resetPassword: operation("customers", "post", "/reset-password"),
1380
1380
  changePassword: operation("customers", "post", "/change-password"),
1381
1381
  revokeRefresh: operation("customers", "post", "/revoke-refresh"),
1382
- withdraw: operation("customers", "post", "/withdraw")
1382
+ withdraw: operation("customers", "post", "/withdraw"),
1383
+ requestWithdrawalCode: operation("customers", "post", "/withdraw/email-code")
1383
1384
  };
1384
1385
  var EMBEDDED_ADMIN_ENDPOINT_OPERATIONS = {
1385
1386
  show: operation("tenants", "get", "/embedded-admin-app"),
@@ -1393,6 +1394,13 @@ var FIELD_CONFIG_ENDPOINT_OPERATIONS = {
1393
1394
  var EVENTS_ENDPOINT_OPERATIONS = {
1394
1395
  registrations: {
1395
1396
  register: operation("event-registrations", "post", "/register"),
1397
+ requestEmailVerification: operation(
1398
+ "event-registrations",
1399
+ "post",
1400
+ "/request-email-verification"
1401
+ ),
1402
+ emailCancelPage: operation("event-registrations", "get", "/email-cancel"),
1403
+ emailCancel: operation("event-registrations", "post", "/email-cancel"),
1396
1404
  guestLookup: operation("event-registrations", "post", "/guest/lookup"),
1397
1405
  guestLookupByUrl: operation("event-registrations", "get", "/guest/:token"),
1398
1406
  guestCancel: operation("event-registrations", "post", "/guest/cancel"),
@@ -1431,6 +1439,9 @@ var VIDEO_ENDPOINT_OPERATIONS = {
1431
1439
  function resolveOperationTemplate(descriptor) {
1432
1440
  return descriptor.collection ? `/api/${descriptor.collection}${descriptor.path}` : `/api${descriptor.path}`;
1433
1441
  }
1442
+ var PAYMENT_DIAGNOSTIC_ENDPOINT_OPERATIONS = {
1443
+ diagnose: operation("tenants", "get", "/payment-diagnostics")
1444
+ };
1434
1445
  function resolveOperationPath(descriptor, options) {
1435
1446
  const path = resolveOperationTemplate(descriptor).replace(
1436
1447
  /:([A-Za-z][A-Za-z0-9_]*)/g,
@@ -4805,8 +4816,25 @@ var CustomerAuth = class {
4805
4816
  body: JSON.stringify({ refreshToken })
4806
4817
  });
4807
4818
  }
4808
- /** Archive the current password account and clear this client's credentials on success. */
4809
- async withdraw(currentPassword) {
4819
+ /** Send a withdrawal-only code to the current passwordless customer's stored email. */
4820
+ async requestWithdrawalCode() {
4821
+ const token = this.getToken();
4822
+ if (!token) throw new ApiError("Not authenticated", 401);
4823
+ const operation2 = CUSTOMER_AUTH_ENDPOINT_OPERATIONS.requestWithdrawalCode;
4824
+ const result = await this.requestJson(
4825
+ resolveOperationPath(operation2),
4826
+ {
4827
+ method: resolveOperationMethod(operation2),
4828
+ headers: { Authorization: `Bearer ${token}` },
4829
+ body: JSON.stringify({})
4830
+ }
4831
+ );
4832
+ if (!result || typeof result.message !== "string")
4833
+ throw new ApiError("Invalid withdrawal code response", 502);
4834
+ return result;
4835
+ }
4836
+ /** Archive the current account and clear this client's credentials on success. */
4837
+ async withdraw(proof) {
4810
4838
  const token = this.getToken();
4811
4839
  if (!token) throw new ApiError("Not authenticated", 401);
4812
4840
  const operation2 = CUSTOMER_AUTH_ENDPOINT_OPERATIONS.withdraw;
@@ -4815,7 +4843,9 @@ var CustomerAuth = class {
4815
4843
  {
4816
4844
  method: resolveOperationMethod(operation2),
4817
4845
  headers: { Authorization: `Bearer ${token}` },
4818
- body: JSON.stringify({ currentPassword })
4846
+ body: JSON.stringify(
4847
+ typeof proof === "string" ? { currentPassword: proof } : proof
4848
+ )
4819
4849
  }
4820
4850
  );
4821
4851
  if (!result || typeof result.withdrawnAt !== "string" || !Number.isFinite(Date.parse(result.withdrawnAt)))
@@ -6754,6 +6784,15 @@ var EventsClient = class {
6754
6784
  { useCustomerAuth: true }
6755
6785
  );
6756
6786
  }
6787
+ requestRegistrationEmailVerification(params) {
6788
+ const operation2 = EVENTS_ENDPOINT_OPERATIONS.registrations.requestEmailVerification;
6789
+ return this.execute(
6790
+ resolveOperationPath(operation2),
6791
+ resolveOperationMethod(operation2),
6792
+ buildRegistrationRequestBody(params),
6793
+ { useCustomerAuth: true, noStore: true }
6794
+ );
6795
+ }
6757
6796
  getGuestRegistration(token) {
6758
6797
  return this.execute(
6759
6798
  resolveOperationPath(
@@ -6806,7 +6845,10 @@ function buildRegistrationRequestBody(params) {
6806
6845
  occurrence: params.occurrence,
6807
6846
  ...params.quantity !== void 0 && { quantity: params.quantity },
6808
6847
  ...params.attendee !== void 0 && { attendee: params.attendee },
6809
- ...params.answers !== void 0 && { answers: params.answers }
6848
+ ...params.answers !== void 0 && { answers: params.answers },
6849
+ ...params.emailVerification !== void 0 && {
6850
+ emailVerification: params.emailVerification
6851
+ }
6810
6852
  };
6811
6853
  }
6812
6854
  function buildGuestCancelRequestBody(token, params) {