@01.software/sdk 0.29.0 → 0.31.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 (78) hide show
  1. package/README.md +331 -77
  2. package/dist/analytics/react.cjs +4 -1
  3. package/dist/analytics/react.cjs.map +1 -1
  4. package/dist/analytics/react.js +4 -1
  5. package/dist/analytics/react.js.map +1 -1
  6. package/dist/analytics.cjs +4 -1
  7. package/dist/analytics.cjs.map +1 -1
  8. package/dist/analytics.js +4 -1
  9. package/dist/analytics.js.map +1 -1
  10. package/dist/client.cjs +1541 -0
  11. package/dist/client.cjs.map +1 -0
  12. package/dist/client.d.cts +28 -0
  13. package/dist/client.d.ts +28 -0
  14. package/dist/client.js +1518 -0
  15. package/dist/client.js.map +1 -0
  16. package/dist/collection-client-ByzY3hWK.d.ts +218 -0
  17. package/dist/collection-client-DFXXz0vk.d.cts +218 -0
  18. package/dist/{const-DAjQYNuM.d.ts → const-AytzliEu.d.cts} +5 -7
  19. package/dist/{const-Dsixdi6z.d.cts → const-BGCP-OJL.d.ts} +5 -7
  20. package/dist/index-BGEhoDUs.d.cts +106 -0
  21. package/dist/index-BGEhoDUs.d.ts +106 -0
  22. package/dist/index.cjs +1006 -1615
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +11 -115
  25. package/dist/index.d.ts +11 -115
  26. package/dist/index.js +932 -1559
  27. package/dist/index.js.map +1 -1
  28. package/dist/metadata.cjs +91 -0
  29. package/dist/metadata.cjs.map +1 -0
  30. package/dist/metadata.d.cts +58 -0
  31. package/dist/metadata.d.ts +58 -0
  32. package/dist/metadata.js +68 -0
  33. package/dist/metadata.js.map +1 -0
  34. package/dist/{payload-types-Ci-ZA7aM.d.cts → payload-types-Wa4-eC6x.d.cts} +794 -532
  35. package/dist/{payload-types-Ci-ZA7aM.d.ts → payload-types-Wa4-eC6x.d.ts} +794 -532
  36. package/dist/query.cjs +1841 -0
  37. package/dist/query.cjs.map +1 -0
  38. package/dist/query.d.cts +244 -0
  39. package/dist/query.d.ts +244 -0
  40. package/dist/query.js +1836 -0
  41. package/dist/query.js.map +1 -0
  42. package/dist/realtime.cjs +4 -1
  43. package/dist/realtime.cjs.map +1 -1
  44. package/dist/realtime.d.cts +2 -2
  45. package/dist/realtime.d.ts +2 -2
  46. package/dist/realtime.js +4 -1
  47. package/dist/realtime.js.map +1 -1
  48. package/dist/{server-BINWywT8.d.cts → server-CrsPyqEc.d.cts} +14 -31
  49. package/dist/{server-BINWywT8.d.ts → server-CrsPyqEc.d.ts} +14 -31
  50. package/dist/server.cjs +430 -846
  51. package/dist/server.cjs.map +1 -1
  52. package/dist/server.d.cts +137 -7
  53. package/dist/server.d.ts +137 -7
  54. package/dist/server.js +430 -864
  55. package/dist/server.js.map +1 -1
  56. package/dist/{server-Cv0Q4dPQ.d.ts → types-BX2mqDf6.d.ts} +270 -743
  57. package/dist/{types-BWq_WlbB.d.ts → types-CVA10VC-.d.ts} +6 -2
  58. package/dist/{types-zKjATmDK.d.cts → types-CmLG-7RL.d.cts} +6 -2
  59. package/dist/{server-C0C8dtms.d.cts → types-DChFjQGz.d.cts} +270 -743
  60. package/dist/ui/canvas/server.cjs +7 -6
  61. package/dist/ui/canvas/server.cjs.map +1 -1
  62. package/dist/ui/canvas/server.d.cts +1 -3
  63. package/dist/ui/canvas/server.d.ts +1 -3
  64. package/dist/ui/canvas/server.js +7 -6
  65. package/dist/ui/canvas/server.js.map +1 -1
  66. package/dist/ui/canvas.cjs +11 -10
  67. package/dist/ui/canvas.cjs.map +1 -1
  68. package/dist/ui/canvas.d.cts +29 -6
  69. package/dist/ui/canvas.d.ts +29 -6
  70. package/dist/ui/canvas.js +11 -10
  71. package/dist/ui/canvas.js.map +1 -1
  72. package/dist/ui/form.d.cts +1 -1
  73. package/dist/ui/form.d.ts +1 -1
  74. package/dist/ui/video.d.cts +1 -1
  75. package/dist/ui/video.d.ts +1 -1
  76. package/dist/webhook.d.cts +3 -3
  77. package/dist/webhook.d.ts +3 -3
  78. package/package.json +84 -15
package/dist/server.d.cts CHANGED
@@ -1,7 +1,137 @@
1
- export { E as ClientServerConfig, F as CollectionClient, o as CommunityClient, ag as ModerationApi, b4 as ServerClient, b5 as ServerCollectionClient, b7 as ServerCommerceClient, by as createServerClient } from './server-C0C8dtms.cjs';
2
- import './payload-types-Ci-ZA7aM.cjs';
3
- import '@tanstack/react-query';
4
- import 'payload';
5
- import 'next';
6
- import './types-zKjATmDK.cjs';
7
- import './const-Dsixdi6z.cjs';
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';
5
+ import './metadata.cjs';
6
+ import './const-AytzliEu.cjs';
7
+ import './types-CmLG-7RL.cjs';
8
+
9
+ type ModerationApiOptions = ServerApiOptions;
10
+ interface CommunityBan {
11
+ id: string;
12
+ customer: string;
13
+ isPermanent?: boolean;
14
+ bannedUntil?: string;
15
+ reason?: string;
16
+ createdAt?: string;
17
+ updatedAt?: string;
18
+ [key: string]: unknown;
19
+ }
20
+ type BanCustomerParams = {
21
+ customerId: string;
22
+ isPermanent?: boolean;
23
+ bannedUntil?: string;
24
+ reason?: string;
25
+ };
26
+ type UnbanCustomerParams = {
27
+ customerId: string;
28
+ };
29
+ declare class ModerationApi extends BaseApi {
30
+ constructor(options: ModerationApiOptions);
31
+ banCustomer(params: BanCustomerParams): Promise<CommunityBan>;
32
+ unbanCustomer(params: UnbanCustomerParams): Promise<{
33
+ success: true;
34
+ }>;
35
+ }
36
+
37
+ interface ServerCommerceClientOptions {
38
+ publishableKey?: string;
39
+ secretKey: string;
40
+ apiUrl?: string;
41
+ onRequestId?: (id: string | null) => void;
42
+ }
43
+ declare class ServerCommerceClient {
44
+ readonly product: {
45
+ stockCheck: (params: StockCheckParams) => Promise<StockCheckResponse>;
46
+ listingGroups: (params: ListingGroupsParams) => Promise<ProductListingGroupsResponse>;
47
+ detail: (params: ProductDetailParams) => Promise<ProductDetail | null>;
48
+ previewDetail: (params: ProductDetailPreviewParams, options: ProductDetailPreviewOptions) => Promise<ProductDetail | null>;
49
+ upsert: (params: ProductUpsertParams) => Promise<ProductUpsertResponse>;
50
+ };
51
+ readonly cart: {
52
+ get: (cartId: string) => Promise<Cart>;
53
+ addItem: (params: AddItemParams) => Promise<CartItem>;
54
+ updateItem: (params: UpdateItemParams) => Promise<CartItem>;
55
+ removeItem: (params: RemoveItemParams) => Promise<{
56
+ success: boolean;
57
+ }>;
58
+ applyDiscount: (params: ApplyDiscountParams) => Promise<Cart>;
59
+ removeDiscount: (params: RemoveDiscountParams) => Promise<Cart>;
60
+ clear: (params: ClearCartParams) => Promise<{
61
+ success: boolean;
62
+ }>;
63
+ };
64
+ readonly orders: {
65
+ checkout: (params: CheckoutParams) => Promise<Order>;
66
+ create: (params: CreateOrderParams) => Promise<Order>;
67
+ update: (params: UpdateOrderParams) => Promise<Order>;
68
+ updateTransaction: (params: UpdateTransactionParams) => Promise<Transaction>;
69
+ confirmPayment: (params: ConfirmPaymentParams) => Promise<ConfirmPaymentResponse>;
70
+ createFulfillment: (params: CreateFulfillmentParams) => Promise<Fulfillment>;
71
+ updateFulfillment: (params: UpdateFulfillmentParams) => Promise<Fulfillment>;
72
+ bulkImportFulfillments: (params: BulkImportFulfillmentsParams) => Promise<BulkImportFulfillmentsResponse>;
73
+ createReturn: (params: CreateReturnParams) => Promise<Return>;
74
+ updateReturn: (params: UpdateReturnParams) => Promise<Return>;
75
+ returnWithRefund: (params: ReturnWithRefundParams) => Promise<{
76
+ return: Return;
77
+ transaction: Transaction | null;
78
+ }>;
79
+ };
80
+ readonly discounts: {
81
+ validate: (params: ValidateDiscountParams) => Promise<ValidateDiscountResult>;
82
+ };
83
+ readonly shipping: {
84
+ calculate: (params: CalculateShippingParams) => Promise<CalculateShippingResult>;
85
+ };
86
+ constructor(options: ServerCommerceClientOptions);
87
+ }
88
+
89
+ type PreviewDetailParams = {
90
+ collection: string;
91
+ id: string;
92
+ };
93
+ type PreviewDetailOptions = {
94
+ previewToken: string;
95
+ };
96
+ /**
97
+ * Server-side client for the generic preview detail endpoint
98
+ * (`POST /api/preview/detail`). Returns `null` on 404 so callers can
99
+ * branch on missing previews without try/catch noise.
100
+ *
101
+ * Auth uses the standard server credentials (`secretKey` +
102
+ * `publishableKey`) plus the short-lived `X-Preview-Token` header issued
103
+ * by the Console preview start endpoint.
104
+ */
105
+ declare class ServerPreviewClient extends BaseApi {
106
+ constructor(options: ServerApiOptions);
107
+ detail<T = unknown>(params: PreviewDetailParams, options: PreviewDetailOptions): Promise<T | null>;
108
+ }
109
+
110
+ declare class ServerClient {
111
+ commerce: ServerCommerceClient;
112
+ community: CommunityClient & {
113
+ moderation: {
114
+ banCustomer: (p: BanCustomerParams) => Promise<CommunityBan>;
115
+ unbanCustomer: (p: UnbanCustomerParams) => Promise<{
116
+ success: true;
117
+ }>;
118
+ };
119
+ };
120
+ preview: {
121
+ detail: <T = unknown>(params: PreviewDetailParams, options: PreviewDetailOptions) => Promise<T | null>;
122
+ };
123
+ collections: ServerCollectionClient;
124
+ lastRequestId: string | null;
125
+ protected state: ClientState;
126
+ protected config: ClientServerConfig;
127
+ constructor(options: ClientServerConfig);
128
+ getState(): ClientState;
129
+ getConfig(): Omit<ClientServerConfig, 'secretKey'>;
130
+ }
131
+ /**
132
+ * Create a server-only client with full read/write access. Requires secretKey.
133
+ * For read-only usage, prefer `createClient()` (no secretKey needed).
134
+ */
135
+ declare function createServerClient(options: ClientServerConfig): ServerClient;
136
+
137
+ export { ClientServerConfig, CommunityClient, ModerationApi, type PreviewDetailOptions, type PreviewDetailParams, ServerClient, ServerCollectionClient, ServerCommerceClient, ServerPreviewClient, createServerClient };
package/dist/server.d.ts CHANGED
@@ -1,7 +1,137 @@
1
- export { E as ClientServerConfig, F as CollectionClient, o as CommunityClient, ag as ModerationApi, b4 as ServerClient, b5 as ServerCollectionClient, b7 as ServerCommerceClient, by as createServerClient } from './server-Cv0Q4dPQ.js';
2
- import './payload-types-Ci-ZA7aM.js';
3
- import '@tanstack/react-query';
4
- import 'payload';
5
- import 'next';
6
- import './types-BWq_WlbB.js';
7
- import './const-DAjQYNuM.js';
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';
5
+ import './metadata.js';
6
+ import './const-BGCP-OJL.js';
7
+ import './types-CVA10VC-.js';
8
+
9
+ type ModerationApiOptions = ServerApiOptions;
10
+ interface CommunityBan {
11
+ id: string;
12
+ customer: string;
13
+ isPermanent?: boolean;
14
+ bannedUntil?: string;
15
+ reason?: string;
16
+ createdAt?: string;
17
+ updatedAt?: string;
18
+ [key: string]: unknown;
19
+ }
20
+ type BanCustomerParams = {
21
+ customerId: string;
22
+ isPermanent?: boolean;
23
+ bannedUntil?: string;
24
+ reason?: string;
25
+ };
26
+ type UnbanCustomerParams = {
27
+ customerId: string;
28
+ };
29
+ declare class ModerationApi extends BaseApi {
30
+ constructor(options: ModerationApiOptions);
31
+ banCustomer(params: BanCustomerParams): Promise<CommunityBan>;
32
+ unbanCustomer(params: UnbanCustomerParams): Promise<{
33
+ success: true;
34
+ }>;
35
+ }
36
+
37
+ interface ServerCommerceClientOptions {
38
+ publishableKey?: string;
39
+ secretKey: string;
40
+ apiUrl?: string;
41
+ onRequestId?: (id: string | null) => void;
42
+ }
43
+ declare class ServerCommerceClient {
44
+ readonly product: {
45
+ stockCheck: (params: StockCheckParams) => Promise<StockCheckResponse>;
46
+ listingGroups: (params: ListingGroupsParams) => Promise<ProductListingGroupsResponse>;
47
+ detail: (params: ProductDetailParams) => Promise<ProductDetail | null>;
48
+ previewDetail: (params: ProductDetailPreviewParams, options: ProductDetailPreviewOptions) => Promise<ProductDetail | null>;
49
+ upsert: (params: ProductUpsertParams) => Promise<ProductUpsertResponse>;
50
+ };
51
+ readonly cart: {
52
+ get: (cartId: string) => Promise<Cart>;
53
+ addItem: (params: AddItemParams) => Promise<CartItem>;
54
+ updateItem: (params: UpdateItemParams) => Promise<CartItem>;
55
+ removeItem: (params: RemoveItemParams) => Promise<{
56
+ success: boolean;
57
+ }>;
58
+ applyDiscount: (params: ApplyDiscountParams) => Promise<Cart>;
59
+ removeDiscount: (params: RemoveDiscountParams) => Promise<Cart>;
60
+ clear: (params: ClearCartParams) => Promise<{
61
+ success: boolean;
62
+ }>;
63
+ };
64
+ readonly orders: {
65
+ checkout: (params: CheckoutParams) => Promise<Order>;
66
+ create: (params: CreateOrderParams) => Promise<Order>;
67
+ update: (params: UpdateOrderParams) => Promise<Order>;
68
+ updateTransaction: (params: UpdateTransactionParams) => Promise<Transaction>;
69
+ confirmPayment: (params: ConfirmPaymentParams) => Promise<ConfirmPaymentResponse>;
70
+ createFulfillment: (params: CreateFulfillmentParams) => Promise<Fulfillment>;
71
+ updateFulfillment: (params: UpdateFulfillmentParams) => Promise<Fulfillment>;
72
+ bulkImportFulfillments: (params: BulkImportFulfillmentsParams) => Promise<BulkImportFulfillmentsResponse>;
73
+ createReturn: (params: CreateReturnParams) => Promise<Return>;
74
+ updateReturn: (params: UpdateReturnParams) => Promise<Return>;
75
+ returnWithRefund: (params: ReturnWithRefundParams) => Promise<{
76
+ return: Return;
77
+ transaction: Transaction | null;
78
+ }>;
79
+ };
80
+ readonly discounts: {
81
+ validate: (params: ValidateDiscountParams) => Promise<ValidateDiscountResult>;
82
+ };
83
+ readonly shipping: {
84
+ calculate: (params: CalculateShippingParams) => Promise<CalculateShippingResult>;
85
+ };
86
+ constructor(options: ServerCommerceClientOptions);
87
+ }
88
+
89
+ type PreviewDetailParams = {
90
+ collection: string;
91
+ id: string;
92
+ };
93
+ type PreviewDetailOptions = {
94
+ previewToken: string;
95
+ };
96
+ /**
97
+ * Server-side client for the generic preview detail endpoint
98
+ * (`POST /api/preview/detail`). Returns `null` on 404 so callers can
99
+ * branch on missing previews without try/catch noise.
100
+ *
101
+ * Auth uses the standard server credentials (`secretKey` +
102
+ * `publishableKey`) plus the short-lived `X-Preview-Token` header issued
103
+ * by the Console preview start endpoint.
104
+ */
105
+ declare class ServerPreviewClient extends BaseApi {
106
+ constructor(options: ServerApiOptions);
107
+ detail<T = unknown>(params: PreviewDetailParams, options: PreviewDetailOptions): Promise<T | null>;
108
+ }
109
+
110
+ declare class ServerClient {
111
+ commerce: ServerCommerceClient;
112
+ community: CommunityClient & {
113
+ moderation: {
114
+ banCustomer: (p: BanCustomerParams) => Promise<CommunityBan>;
115
+ unbanCustomer: (p: UnbanCustomerParams) => Promise<{
116
+ success: true;
117
+ }>;
118
+ };
119
+ };
120
+ preview: {
121
+ detail: <T = unknown>(params: PreviewDetailParams, options: PreviewDetailOptions) => Promise<T | null>;
122
+ };
123
+ collections: ServerCollectionClient;
124
+ lastRequestId: string | null;
125
+ protected state: ClientState;
126
+ protected config: ClientServerConfig;
127
+ constructor(options: ClientServerConfig);
128
+ getState(): ClientState;
129
+ getConfig(): Omit<ClientServerConfig, 'secretKey'>;
130
+ }
131
+ /**
132
+ * Create a server-only client with full read/write access. Requires secretKey.
133
+ * For read-only usage, prefer `createClient()` (no secretKey needed).
134
+ */
135
+ declare function createServerClient(options: ClientServerConfig): ServerClient;
136
+
137
+ export { ClientServerConfig, CommunityClient, ModerationApi, type PreviewDetailOptions, type PreviewDetailParams, ServerClient, ServerCollectionClient, ServerCommerceClient, ServerPreviewClient, createServerClient };