@01.software/sdk 0.31.0 → 0.32.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 (52) hide show
  1. package/README.md +87 -29
  2. package/dist/analytics/react.cjs.map +1 -1
  3. package/dist/analytics/react.js.map +1 -1
  4. package/dist/analytics.cjs.map +1 -1
  5. package/dist/analytics.js.map +1 -1
  6. package/dist/client.cjs +10 -46
  7. package/dist/client.cjs.map +1 -1
  8. package/dist/client.d.cts +6 -6
  9. package/dist/client.d.ts +6 -6
  10. package/dist/client.js +10 -46
  11. package/dist/client.js.map +1 -1
  12. package/dist/{collection-client-DFXXz0vk.d.cts → collection-client-CORhppPb.d.cts} +3 -3
  13. package/dist/{collection-client-ByzY3hWK.d.ts → collection-client-DPGXnhoF.d.ts} +3 -3
  14. package/dist/{const-AytzliEu.d.cts → const-Brk2Ff0q.d.cts} +1 -1
  15. package/dist/{const-BGCP-OJL.d.ts → const-DcY2_z9O.d.ts} +1 -1
  16. package/dist/index.cjs +58 -47
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +7 -7
  19. package/dist/index.d.ts +7 -7
  20. package/dist/index.js +58 -47
  21. package/dist/index.js.map +1 -1
  22. package/dist/{payload-types-Wa4-eC6x.d.cts → payload-types-DVK1QCeU.d.cts} +8 -2
  23. package/dist/{payload-types-Wa4-eC6x.d.ts → payload-types-DVK1QCeU.d.ts} +8 -2
  24. package/dist/query.cjs.map +1 -1
  25. package/dist/query.d.cts +16 -16
  26. package/dist/query.d.ts +16 -16
  27. package/dist/query.js.map +1 -1
  28. package/dist/realtime.cjs.map +1 -1
  29. package/dist/realtime.d.cts +2 -2
  30. package/dist/realtime.d.ts +2 -2
  31. package/dist/realtime.js.map +1 -1
  32. package/dist/server.cjs +34 -1
  33. package/dist/server.cjs.map +1 -1
  34. package/dist/server.d.cts +99 -7
  35. package/dist/server.d.ts +99 -7
  36. package/dist/server.js +34 -1
  37. package/dist/server.js.map +1 -1
  38. package/dist/{types-CmLG-7RL.d.cts → types-ByMrR_Z_.d.cts} +1 -1
  39. package/dist/{types-DChFjQGz.d.cts → types-CAkWqIr6.d.cts} +41 -8
  40. package/dist/{types-BX2mqDf6.d.ts → types-CYMSBkJC.d.ts} +41 -8
  41. package/dist/{types-CVA10VC-.d.ts → types-DUPC7Xn6.d.ts} +1 -1
  42. package/dist/ui/form.d.cts +1 -1
  43. package/dist/ui/form.d.ts +1 -1
  44. package/dist/ui/video.d.cts +1 -1
  45. package/dist/ui/video.d.ts +1 -1
  46. package/dist/webhook.cjs +48 -1
  47. package/dist/webhook.cjs.map +1 -1
  48. package/dist/webhook.d.cts +73 -4
  49. package/dist/webhook.d.ts +73 -4
  50. package/dist/webhook.js +48 -1
  51. package/dist/webhook.js.map +1 -1
  52. package/package.json +3 -3
package/dist/server.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- import { S as ServerCollectionClient } from './collection-client-DFXXz0vk.cjs';
2
- export { C as CollectionClient } from './collection-client-DFXXz0vk.cjs';
3
- import { B as BaseApi, aN as ServerApiOptions, aQ as StockCheckParams, aR as StockCheckResponse, Y as ListingGroupsParams, ap as ProductListingGroupsResponse, ab as ProductDetailParams, a2 as ProductDetail, bh as ProductDetailPreviewParams, bi as ProductDetailPreviewOptions, bj as ProductUpsertParams, bk as ProductUpsertResponse, k as AddItemParams, aU as UpdateItemParams, aI as RemoveItemParams, l as ApplyDiscountParams, aH as RemoveDiscountParams, t as ClearCartParams, s as CheckoutParams, G as CreateOrderParams, aV as UpdateOrderParams, aY as UpdateTransactionParams, y as ConfirmPaymentParams, z as ConfirmPaymentResponse, F as CreateFulfillmentParams, aT as UpdateFulfillmentParams, m as BulkImportFulfillmentsParams, n as BulkImportFulfillmentsResponse, H as CreateReturnParams, aX as UpdateReturnParams, aM as ReturnWithRefundParams, aZ as ValidateDiscountParams, a_ as ValidateDiscountResult, o as CalculateShippingParams, p as CalculateShippingResult, a as CommunityClient, c as ClientState, bl as ClientServerConfig } from './types-DChFjQGz.cjs';
4
- import { i as Cart, j as CartItem, O as Order, n as Transaction, o as Fulfillment, p as Return } from './payload-types-Wa4-eC6x.cjs';
1
+ import { S as ServerCollectionClient } from './collection-client-CORhppPb.cjs';
2
+ export { C as CollectionClient } from './collection-client-CORhppPb.cjs';
3
+ import { B as BaseApi, aQ as ServerApiOptions, aT as StockCheckParams, aU as StockCheckResponse, _ as ListingGroupsParams, as as ProductListingGroupsResponse, ad as ProductDetailParams, a4 as ProductDetail, bk as ProductDetailPreviewParams, bl as ProductDetailPreviewOptions, bm as ProductUpsertParams, bn as ProductUpsertResponse, k as AddItemParams, aX as UpdateItemParams, aL as RemoveItemParams, l as ApplyDiscountParams, aK as RemoveDiscountParams, t as ClearCartParams, s as CheckoutParams, H as CreateOrderParams, aY as UpdateOrderParams, a$ as UpdateTransactionParams, y as ConfirmPaymentParams, z as ConfirmPaymentResponse, F as CreateFulfillmentParams, aW as UpdateFulfillmentParams, m as BulkImportFulfillmentsParams, n as BulkImportFulfillmentsResponse, I as CreateReturnParams, a_ as UpdateReturnParams, aP as ReturnWithRefundParams, b0 as ValidateDiscountParams, b1 as ValidateDiscountResult, o as CalculateShippingParams, p as CalculateShippingResult, a as CommunityClient, c as ClientState, bo as ClientServerConfig } from './types-CAkWqIr6.cjs';
4
+ import { i as Cart, j as CartItem, O as Order, m as Transaction, n as Fulfillment, o as Return } from './payload-types-DVK1QCeU.cjs';
5
5
  import './metadata.cjs';
6
- import './const-AytzliEu.cjs';
7
- import './types-CmLG-7RL.cjs';
6
+ import './const-Brk2Ff0q.cjs';
7
+ import './types-ByMrR_Z_.cjs';
8
8
 
9
9
  type ModerationApiOptions = ServerApiOptions;
10
10
  interface CommunityBan {
@@ -86,6 +86,97 @@ declare class ServerCommerceClient {
86
86
  constructor(options: ServerCommerceClientOptions);
87
87
  }
88
88
 
89
+ type TenantIntrospectionApiOptions = ServerApiOptions;
90
+ type TenantFeatureProgressFeature = 'ecommerce';
91
+ interface TenantFeatureProgressInput {
92
+ feature: TenantFeatureProgressFeature;
93
+ includeEvidence?: boolean;
94
+ }
95
+ type TenantFeatureProgressStatus = 'ready' | 'attention' | 'blocked';
96
+ type TenantFeatureProgressItemState = 'complete' | 'incomplete' | 'blocked' | 'attention' | 'optional' | 'unknown' | 'manual' | 'not-applicable';
97
+ type TenantFeatureProgressSeverity = 'required' | 'recommended' | 'optional';
98
+ type TenantFeatureProgressEvidenceValue = string | number | boolean | null;
99
+ interface TenantFeatureProgressItem {
100
+ id: string;
101
+ title: string;
102
+ state: TenantFeatureProgressItemState;
103
+ severity: TenantFeatureProgressSeverity;
104
+ summary: string;
105
+ evidence?: Record<string, TenantFeatureProgressEvidenceValue>;
106
+ }
107
+ interface TenantFeatureProgressGroup {
108
+ id: string;
109
+ title: string;
110
+ summary?: string;
111
+ items: TenantFeatureProgressItem[];
112
+ }
113
+ interface TenantFeatureProgressResponse {
114
+ schemaVersion: 1;
115
+ feature: TenantFeatureProgressFeature;
116
+ status: TenantFeatureProgressStatus;
117
+ generatedAt: string;
118
+ tenant: {
119
+ id: string;
120
+ name: string;
121
+ plan: string;
122
+ };
123
+ capability: {
124
+ effectiveFeatures: string[];
125
+ planBlocked: string[];
126
+ closureAdded: string[];
127
+ };
128
+ summary: {
129
+ complete: number;
130
+ total: number;
131
+ blocking: number;
132
+ manual: number;
133
+ unknown: number;
134
+ };
135
+ groups: TenantFeatureProgressGroup[];
136
+ }
137
+ interface CollectionFieldSchema {
138
+ name: string;
139
+ path: string;
140
+ type: string;
141
+ required?: true;
142
+ unique?: true;
143
+ hasMany?: true;
144
+ relationTo?: string | string[];
145
+ options?: Array<{
146
+ label: string;
147
+ value: string;
148
+ }>;
149
+ hidden?: true;
150
+ systemManaged?: true;
151
+ writable?: boolean;
152
+ fields?: CollectionFieldSchema[];
153
+ }
154
+ interface CollectionSchemaResponse {
155
+ contractVersion: 1;
156
+ mode: 'effective';
157
+ collection: {
158
+ slug: string;
159
+ timestamps: boolean;
160
+ alwaysActive: boolean;
161
+ feature: string | null;
162
+ systemFields: string[];
163
+ visibility: {
164
+ collectionHidden: boolean;
165
+ hiddenFields: string[];
166
+ };
167
+ fields: CollectionFieldSchema[];
168
+ };
169
+ }
170
+ interface TenantIntrospectionClient {
171
+ collectionSchema: (collection: string) => Promise<CollectionSchemaResponse>;
172
+ featureProgress: (params: TenantFeatureProgressInput) => Promise<TenantFeatureProgressResponse>;
173
+ }
174
+ declare class TenantIntrospectionApi extends BaseApi implements TenantIntrospectionClient {
175
+ constructor(options: TenantIntrospectionApiOptions);
176
+ collectionSchema(collection: string): Promise<CollectionSchemaResponse>;
177
+ featureProgress(params: TenantFeatureProgressInput): Promise<TenantFeatureProgressResponse>;
178
+ }
179
+
89
180
  type PreviewDetailParams = {
90
181
  collection: string;
91
182
  id: string;
@@ -109,6 +200,7 @@ declare class ServerPreviewClient extends BaseApi {
109
200
 
110
201
  declare class ServerClient {
111
202
  commerce: ServerCommerceClient;
203
+ tenant: TenantIntrospectionClient;
112
204
  community: CommunityClient & {
113
205
  moderation: {
114
206
  banCustomer: (p: BanCustomerParams) => Promise<CommunityBan>;
@@ -134,4 +226,4 @@ declare class ServerClient {
134
226
  */
135
227
  declare function createServerClient(options: ClientServerConfig): ServerClient;
136
228
 
137
- export { ClientServerConfig, CommunityClient, ModerationApi, type PreviewDetailOptions, type PreviewDetailParams, ServerClient, ServerCollectionClient, ServerCommerceClient, ServerPreviewClient, createServerClient };
229
+ export { ClientServerConfig, type CollectionFieldSchema, type CollectionSchemaResponse, CommunityClient, ModerationApi, type PreviewDetailOptions, type PreviewDetailParams, ServerClient, ServerCollectionClient, ServerCommerceClient, ServerPreviewClient, type TenantFeatureProgressEvidenceValue, type TenantFeatureProgressFeature, type TenantFeatureProgressGroup, type TenantFeatureProgressInput, type TenantFeatureProgressItem, type TenantFeatureProgressItemState, type TenantFeatureProgressResponse, type TenantFeatureProgressSeverity, type TenantFeatureProgressStatus, TenantIntrospectionApi, type TenantIntrospectionApiOptions, type TenantIntrospectionClient, createServerClient };
package/dist/server.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { S as ServerCollectionClient } from './collection-client-ByzY3hWK.js';
2
- export { C as CollectionClient } from './collection-client-ByzY3hWK.js';
3
- import { B as BaseApi, aN as ServerApiOptions, aQ as StockCheckParams, aR as StockCheckResponse, Y as ListingGroupsParams, ap as ProductListingGroupsResponse, ab as ProductDetailParams, a2 as ProductDetail, bh as ProductDetailPreviewParams, bi as ProductDetailPreviewOptions, bj as ProductUpsertParams, bk as ProductUpsertResponse, k as AddItemParams, aU as UpdateItemParams, aI as RemoveItemParams, l as ApplyDiscountParams, aH as RemoveDiscountParams, t as ClearCartParams, s as CheckoutParams, G as CreateOrderParams, aV as UpdateOrderParams, aY as UpdateTransactionParams, y as ConfirmPaymentParams, z as ConfirmPaymentResponse, F as CreateFulfillmentParams, aT as UpdateFulfillmentParams, m as BulkImportFulfillmentsParams, n as BulkImportFulfillmentsResponse, H as CreateReturnParams, aX as UpdateReturnParams, aM as ReturnWithRefundParams, aZ as ValidateDiscountParams, a_ as ValidateDiscountResult, o as CalculateShippingParams, p as CalculateShippingResult, a as CommunityClient, c as ClientState, bl as ClientServerConfig } from './types-BX2mqDf6.js';
4
- import { i as Cart, j as CartItem, O as Order, n as Transaction, o as Fulfillment, p as Return } from './payload-types-Wa4-eC6x.js';
1
+ import { S as ServerCollectionClient } from './collection-client-DPGXnhoF.js';
2
+ export { C as CollectionClient } from './collection-client-DPGXnhoF.js';
3
+ import { B as BaseApi, aQ as ServerApiOptions, aT as StockCheckParams, aU as StockCheckResponse, _ as ListingGroupsParams, as as ProductListingGroupsResponse, ad as ProductDetailParams, a4 as ProductDetail, bk as ProductDetailPreviewParams, bl as ProductDetailPreviewOptions, bm as ProductUpsertParams, bn as ProductUpsertResponse, k as AddItemParams, aX as UpdateItemParams, aL as RemoveItemParams, l as ApplyDiscountParams, aK as RemoveDiscountParams, t as ClearCartParams, s as CheckoutParams, H as CreateOrderParams, aY as UpdateOrderParams, a$ as UpdateTransactionParams, y as ConfirmPaymentParams, z as ConfirmPaymentResponse, F as CreateFulfillmentParams, aW as UpdateFulfillmentParams, m as BulkImportFulfillmentsParams, n as BulkImportFulfillmentsResponse, I as CreateReturnParams, a_ as UpdateReturnParams, aP as ReturnWithRefundParams, b0 as ValidateDiscountParams, b1 as ValidateDiscountResult, o as CalculateShippingParams, p as CalculateShippingResult, a as CommunityClient, c as ClientState, bo as ClientServerConfig } from './types-CYMSBkJC.js';
4
+ import { i as Cart, j as CartItem, O as Order, m as Transaction, n as Fulfillment, o as Return } from './payload-types-DVK1QCeU.js';
5
5
  import './metadata.js';
6
- import './const-BGCP-OJL.js';
7
- import './types-CVA10VC-.js';
6
+ import './const-DcY2_z9O.js';
7
+ import './types-DUPC7Xn6.js';
8
8
 
9
9
  type ModerationApiOptions = ServerApiOptions;
10
10
  interface CommunityBan {
@@ -86,6 +86,97 @@ declare class ServerCommerceClient {
86
86
  constructor(options: ServerCommerceClientOptions);
87
87
  }
88
88
 
89
+ type TenantIntrospectionApiOptions = ServerApiOptions;
90
+ type TenantFeatureProgressFeature = 'ecommerce';
91
+ interface TenantFeatureProgressInput {
92
+ feature: TenantFeatureProgressFeature;
93
+ includeEvidence?: boolean;
94
+ }
95
+ type TenantFeatureProgressStatus = 'ready' | 'attention' | 'blocked';
96
+ type TenantFeatureProgressItemState = 'complete' | 'incomplete' | 'blocked' | 'attention' | 'optional' | 'unknown' | 'manual' | 'not-applicable';
97
+ type TenantFeatureProgressSeverity = 'required' | 'recommended' | 'optional';
98
+ type TenantFeatureProgressEvidenceValue = string | number | boolean | null;
99
+ interface TenantFeatureProgressItem {
100
+ id: string;
101
+ title: string;
102
+ state: TenantFeatureProgressItemState;
103
+ severity: TenantFeatureProgressSeverity;
104
+ summary: string;
105
+ evidence?: Record<string, TenantFeatureProgressEvidenceValue>;
106
+ }
107
+ interface TenantFeatureProgressGroup {
108
+ id: string;
109
+ title: string;
110
+ summary?: string;
111
+ items: TenantFeatureProgressItem[];
112
+ }
113
+ interface TenantFeatureProgressResponse {
114
+ schemaVersion: 1;
115
+ feature: TenantFeatureProgressFeature;
116
+ status: TenantFeatureProgressStatus;
117
+ generatedAt: string;
118
+ tenant: {
119
+ id: string;
120
+ name: string;
121
+ plan: string;
122
+ };
123
+ capability: {
124
+ effectiveFeatures: string[];
125
+ planBlocked: string[];
126
+ closureAdded: string[];
127
+ };
128
+ summary: {
129
+ complete: number;
130
+ total: number;
131
+ blocking: number;
132
+ manual: number;
133
+ unknown: number;
134
+ };
135
+ groups: TenantFeatureProgressGroup[];
136
+ }
137
+ interface CollectionFieldSchema {
138
+ name: string;
139
+ path: string;
140
+ type: string;
141
+ required?: true;
142
+ unique?: true;
143
+ hasMany?: true;
144
+ relationTo?: string | string[];
145
+ options?: Array<{
146
+ label: string;
147
+ value: string;
148
+ }>;
149
+ hidden?: true;
150
+ systemManaged?: true;
151
+ writable?: boolean;
152
+ fields?: CollectionFieldSchema[];
153
+ }
154
+ interface CollectionSchemaResponse {
155
+ contractVersion: 1;
156
+ mode: 'effective';
157
+ collection: {
158
+ slug: string;
159
+ timestamps: boolean;
160
+ alwaysActive: boolean;
161
+ feature: string | null;
162
+ systemFields: string[];
163
+ visibility: {
164
+ collectionHidden: boolean;
165
+ hiddenFields: string[];
166
+ };
167
+ fields: CollectionFieldSchema[];
168
+ };
169
+ }
170
+ interface TenantIntrospectionClient {
171
+ collectionSchema: (collection: string) => Promise<CollectionSchemaResponse>;
172
+ featureProgress: (params: TenantFeatureProgressInput) => Promise<TenantFeatureProgressResponse>;
173
+ }
174
+ declare class TenantIntrospectionApi extends BaseApi implements TenantIntrospectionClient {
175
+ constructor(options: TenantIntrospectionApiOptions);
176
+ collectionSchema(collection: string): Promise<CollectionSchemaResponse>;
177
+ featureProgress(params: TenantFeatureProgressInput): Promise<TenantFeatureProgressResponse>;
178
+ }
179
+
89
180
  type PreviewDetailParams = {
90
181
  collection: string;
91
182
  id: string;
@@ -109,6 +200,7 @@ declare class ServerPreviewClient extends BaseApi {
109
200
 
110
201
  declare class ServerClient {
111
202
  commerce: ServerCommerceClient;
203
+ tenant: TenantIntrospectionClient;
112
204
  community: CommunityClient & {
113
205
  moderation: {
114
206
  banCustomer: (p: BanCustomerParams) => Promise<CommunityBan>;
@@ -134,4 +226,4 @@ declare class ServerClient {
134
226
  */
135
227
  declare function createServerClient(options: ClientServerConfig): ServerClient;
136
228
 
137
- export { ClientServerConfig, CommunityClient, ModerationApi, type PreviewDetailOptions, type PreviewDetailParams, ServerClient, ServerCollectionClient, ServerCommerceClient, ServerPreviewClient, createServerClient };
229
+ export { ClientServerConfig, type CollectionFieldSchema, type CollectionSchemaResponse, CommunityClient, ModerationApi, type PreviewDetailOptions, type PreviewDetailParams, ServerClient, ServerCollectionClient, ServerCommerceClient, ServerPreviewClient, type TenantFeatureProgressEvidenceValue, type TenantFeatureProgressFeature, type TenantFeatureProgressGroup, type TenantFeatureProgressInput, type TenantFeatureProgressItem, type TenantFeatureProgressItemState, type TenantFeatureProgressResponse, type TenantFeatureProgressSeverity, type TenantFeatureProgressStatus, TenantIntrospectionApi, type TenantIntrospectionApiOptions, type TenantIntrospectionClient, createServerClient };
package/dist/server.js CHANGED
@@ -1422,7 +1422,7 @@ var ProductApi = class extends BaseApi {
1422
1422
  /**
1423
1423
  * Fetch full product detail by slug or id.
1424
1424
  * Returns `null` on 404 regardless of reason (`not_found` / `not_published` /
1425
- * `tenant_mismatch` / `feature_disabled`). For the reason behind a null,
1425
+ * `feature_disabled`). For the reason behind a null,
1426
1426
  * inspect `client.lastRequestId` against backend logs.
1427
1427
  */
1428
1428
  async detail(params) {
@@ -1625,6 +1625,29 @@ var ServerCommerceClient = class {
1625
1625
  }
1626
1626
  };
1627
1627
 
1628
+ // src/core/api/tenant-introspection-api.ts
1629
+ var TenantIntrospectionApi = class extends BaseApi {
1630
+ constructor(options) {
1631
+ super("TenantIntrospectionApi", options);
1632
+ }
1633
+ collectionSchema(collection) {
1634
+ return this.request(
1635
+ `/api/tenants/schema/${encodeURIComponent(collection)}`,
1636
+ void 0,
1637
+ { method: "GET" }
1638
+ );
1639
+ }
1640
+ featureProgress(params) {
1641
+ const search = new URLSearchParams({ feature: params.feature });
1642
+ if (params.includeEvidence) search.set("includeEvidence", "true");
1643
+ return this.request(
1644
+ `/api/tenants/feature-progress?${search.toString()}`,
1645
+ void 0,
1646
+ { method: "GET" }
1647
+ );
1648
+ }
1649
+ };
1650
+
1628
1651
  // src/core/client/client.server.ts
1629
1652
  var ServerClient = class {
1630
1653
  constructor(options) {
@@ -1658,6 +1681,15 @@ var ServerClient = class {
1658
1681
  onRequestId
1659
1682
  };
1660
1683
  this.commerce = new ServerCommerceClient(serverOptions);
1684
+ const tenantIntrospectionApi = new TenantIntrospectionApi(serverOptions);
1685
+ this.tenant = {
1686
+ collectionSchema: tenantIntrospectionApi.collectionSchema.bind(
1687
+ tenantIntrospectionApi
1688
+ ),
1689
+ featureProgress: tenantIntrospectionApi.featureProgress.bind(
1690
+ tenantIntrospectionApi
1691
+ )
1692
+ };
1661
1693
  const previewApi = new ServerPreviewClient(serverOptions);
1662
1694
  this.preview = {
1663
1695
  detail: previewApi.detail.bind(previewApi)
@@ -1698,6 +1730,7 @@ export {
1698
1730
  ServerCollectionClient,
1699
1731
  ServerCommerceClient,
1700
1732
  ServerPreviewClient,
1733
+ TenantIntrospectionApi,
1701
1734
  createServerClient
1702
1735
  };
1703
1736
  //# sourceMappingURL=server.js.map