@01.software/sdk 0.31.0 → 0.33.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.
- package/README.md +128 -47
- package/dist/analytics/react.cjs.map +1 -1
- package/dist/analytics/react.js.map +1 -1
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js.map +1 -1
- package/dist/client.cjs +41 -48
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +6 -6
- package/dist/client.d.ts +6 -6
- package/dist/client.js +41 -48
- package/dist/client.js.map +1 -1
- package/dist/{collection-client-ByzY3hWK.d.ts → collection-client-B6SlhzIP.d.ts} +3 -3
- package/dist/{collection-client-DFXXz0vk.d.cts → collection-client-De6eKW1J.d.cts} +3 -3
- package/dist/{const-AytzliEu.d.cts → const-DwmSDeWq.d.ts} +2 -2
- package/dist/{const-BGCP-OJL.d.ts → const-sPR2IkCe.d.cts} +2 -2
- package/dist/index.cjs +310 -133
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +310 -133
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-Wa4-eC6x.d.cts → payload-types-dkeQyrDC.d.cts} +1572 -1440
- package/dist/{payload-types-Wa4-eC6x.d.ts → payload-types-dkeQyrDC.d.ts} +1572 -1440
- package/dist/query.cjs.map +1 -1
- package/dist/query.d.cts +20 -20
- package/dist/query.d.ts +20 -20
- package/dist/query.js.map +1 -1
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/realtime.js.map +1 -1
- package/dist/server.cjs +70 -6
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +100 -8
- package/dist/server.d.ts +100 -8
- package/dist/server.js +70 -6
- package/dist/server.js.map +1 -1
- package/dist/{types-CmLG-7RL.d.cts → types-B3YT092I.d.cts} +1 -1
- package/dist/{types-BX2mqDf6.d.ts → types-BHh0YLmq.d.ts} +63 -13
- package/dist/{types-DChFjQGz.d.cts → types-BZKxss8Y.d.cts} +63 -13
- package/dist/{types-CVA10VC-.d.ts → types-Cel_4L9t.d.ts} +1 -1
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/webhook.cjs +142 -1
- package/dist/webhook.cjs.map +1 -1
- package/dist/webhook.d.cts +149 -5
- package/dist/webhook.d.ts +149 -5
- package/dist/webhook.js +142 -1
- package/dist/webhook.js.map +1 -1
- package/package.json +3 -3
package/dist/server.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { S as ServerCollectionClient } from './collection-client-
|
|
2
|
-
export { C as CollectionClient } from './collection-client-
|
|
3
|
-
import { B as BaseApi,
|
|
4
|
-
import { i as Cart, j as CartItem, O as Order,
|
|
1
|
+
import { S as ServerCollectionClient } from './collection-client-De6eKW1J.cjs';
|
|
2
|
+
export { C as CollectionClient } from './collection-client-De6eKW1J.cjs';
|
|
3
|
+
import { B as BaseApi, aU as ServerApiOptions, aX as StockCheckParams, aY as StockCheckResponse, _ as ListingGroupsParams, av as ProductListingGroupsResponse, ad as ProductDetailParams, ae as ProductDetailResult, bo as ProductDetailPreviewParams, bp as ProductDetailPreviewOptions, a4 as ProductDetail, bq as ProductUpsertParams, br as ProductUpsertResponse, k as AddItemParams, a$ as UpdateItemParams, aO as RemoveItemParams, l as ApplyDiscountParams, aN as RemoveDiscountParams, t as ClearCartParams, s as CheckoutParams, H as CreateOrderParams, b0 as UpdateOrderParams, b3 as UpdateTransactionParams, y as ConfirmPaymentParams, z as ConfirmPaymentResponse, F as CreateFulfillmentParams, a_ as UpdateFulfillmentParams, m as BulkImportFulfillmentsParams, n as BulkImportFulfillmentsResponse, I as CreateReturnParams, b2 as UpdateReturnParams, aT as ReturnWithRefundParams, b4 as ValidateDiscountParams, b5 as ValidateDiscountResult, o as CalculateShippingParams, p as CalculateShippingResult, a as CommunityClient, c as ClientState, bs as ClientServerConfig } from './types-BZKxss8Y.cjs';
|
|
4
|
+
import { i as Cart, j as CartItem, O as Order, m as Transaction, n as Fulfillment, o as Return } from './payload-types-dkeQyrDC.cjs';
|
|
5
5
|
import './metadata.cjs';
|
|
6
|
-
import './const-
|
|
7
|
-
import './types-
|
|
6
|
+
import './const-sPR2IkCe.cjs';
|
|
7
|
+
import './types-B3YT092I.cjs';
|
|
8
8
|
|
|
9
9
|
type ModerationApiOptions = ServerApiOptions;
|
|
10
10
|
interface CommunityBan {
|
|
@@ -44,7 +44,7 @@ declare class ServerCommerceClient {
|
|
|
44
44
|
readonly product: {
|
|
45
45
|
stockCheck: (params: StockCheckParams) => Promise<StockCheckResponse>;
|
|
46
46
|
listingGroups: (params: ListingGroupsParams) => Promise<ProductListingGroupsResponse>;
|
|
47
|
-
detail: (params: ProductDetailParams) => Promise<
|
|
47
|
+
detail: (params: ProductDetailParams) => Promise<ProductDetailResult>;
|
|
48
48
|
previewDetail: (params: ProductDetailPreviewParams, options: ProductDetailPreviewOptions) => Promise<ProductDetail | null>;
|
|
49
49
|
upsert: (params: ProductUpsertParams) => Promise<ProductUpsertResponse>;
|
|
50
50
|
};
|
|
@@ -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-
|
|
2
|
-
export { C as CollectionClient } from './collection-client-
|
|
3
|
-
import { B as BaseApi,
|
|
4
|
-
import { i as Cart, j as CartItem, O as Order,
|
|
1
|
+
import { S as ServerCollectionClient } from './collection-client-B6SlhzIP.js';
|
|
2
|
+
export { C as CollectionClient } from './collection-client-B6SlhzIP.js';
|
|
3
|
+
import { B as BaseApi, aU as ServerApiOptions, aX as StockCheckParams, aY as StockCheckResponse, _ as ListingGroupsParams, av as ProductListingGroupsResponse, ad as ProductDetailParams, ae as ProductDetailResult, bo as ProductDetailPreviewParams, bp as ProductDetailPreviewOptions, a4 as ProductDetail, bq as ProductUpsertParams, br as ProductUpsertResponse, k as AddItemParams, a$ as UpdateItemParams, aO as RemoveItemParams, l as ApplyDiscountParams, aN as RemoveDiscountParams, t as ClearCartParams, s as CheckoutParams, H as CreateOrderParams, b0 as UpdateOrderParams, b3 as UpdateTransactionParams, y as ConfirmPaymentParams, z as ConfirmPaymentResponse, F as CreateFulfillmentParams, a_ as UpdateFulfillmentParams, m as BulkImportFulfillmentsParams, n as BulkImportFulfillmentsResponse, I as CreateReturnParams, b2 as UpdateReturnParams, aT as ReturnWithRefundParams, b4 as ValidateDiscountParams, b5 as ValidateDiscountResult, o as CalculateShippingParams, p as CalculateShippingResult, a as CommunityClient, c as ClientState, bs as ClientServerConfig } from './types-BHh0YLmq.js';
|
|
4
|
+
import { i as Cart, j as CartItem, O as Order, m as Transaction, n as Fulfillment, o as Return } from './payload-types-dkeQyrDC.js';
|
|
5
5
|
import './metadata.js';
|
|
6
|
-
import './const-
|
|
7
|
-
import './types-
|
|
6
|
+
import './const-DwmSDeWq.js';
|
|
7
|
+
import './types-Cel_4L9t.js';
|
|
8
8
|
|
|
9
9
|
type ModerationApiOptions = ServerApiOptions;
|
|
10
10
|
interface CommunityBan {
|
|
@@ -44,7 +44,7 @@ declare class ServerCommerceClient {
|
|
|
44
44
|
readonly product: {
|
|
45
45
|
stockCheck: (params: StockCheckParams) => Promise<StockCheckResponse>;
|
|
46
46
|
listingGroups: (params: ListingGroupsParams) => Promise<ProductListingGroupsResponse>;
|
|
47
|
-
detail: (params: ProductDetailParams) => Promise<
|
|
47
|
+
detail: (params: ProductDetailParams) => Promise<ProductDetailResult>;
|
|
48
48
|
previewDetail: (params: ProductDetailPreviewParams, options: ProductDetailPreviewOptions) => Promise<ProductDetail | null>;
|
|
49
49
|
upsert: (params: ProductUpsertParams) => Promise<ProductUpsertResponse>;
|
|
50
50
|
};
|
|
@@ -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
|
@@ -1401,6 +1401,28 @@ var CartApi = class {
|
|
|
1401
1401
|
};
|
|
1402
1402
|
|
|
1403
1403
|
// src/core/api/product-api.ts
|
|
1404
|
+
var PRODUCT_DETAIL_UNAVAILABLE_REASONS = /* @__PURE__ */ new Set([
|
|
1405
|
+
"not_found",
|
|
1406
|
+
"not_published",
|
|
1407
|
+
"feature_disabled"
|
|
1408
|
+
]);
|
|
1409
|
+
function isRecord(value) {
|
|
1410
|
+
return typeof value === "object" && value !== null;
|
|
1411
|
+
}
|
|
1412
|
+
function readProductDetailUnavailableReason(value) {
|
|
1413
|
+
if (!isRecord(value)) return void 0;
|
|
1414
|
+
const directReason = value.reason ?? value.code;
|
|
1415
|
+
if (typeof directReason === "string" && PRODUCT_DETAIL_UNAVAILABLE_REASONS.has(directReason)) {
|
|
1416
|
+
return directReason;
|
|
1417
|
+
}
|
|
1418
|
+
return readProductDetailUnavailableReason(value.body);
|
|
1419
|
+
}
|
|
1420
|
+
function productDetailResultFromError(error) {
|
|
1421
|
+
if (!(error instanceof SDKError) || error.status !== 404) return void 0;
|
|
1422
|
+
const reason = readProductDetailUnavailableReason(error.details);
|
|
1423
|
+
if (!reason) return void 0;
|
|
1424
|
+
return { found: false, reason };
|
|
1425
|
+
}
|
|
1404
1426
|
var ProductApi = class extends BaseApi {
|
|
1405
1427
|
constructor(options) {
|
|
1406
1428
|
super("ProductApi", options);
|
|
@@ -1421,15 +1443,24 @@ var ProductApi = class extends BaseApi {
|
|
|
1421
1443
|
}
|
|
1422
1444
|
/**
|
|
1423
1445
|
* Fetch full product detail by slug or id.
|
|
1424
|
-
* Returns
|
|
1425
|
-
*
|
|
1426
|
-
*
|
|
1446
|
+
* Returns a discriminated result so storefronts can distinguish missing,
|
|
1447
|
+
* unpublished, and feature-disabled products.
|
|
1448
|
+
*
|
|
1449
|
+
* Only product-detail 404 responses carrying one of those allowlisted reasons
|
|
1450
|
+
* are mapped to `{ found: false, reason }`. Unknown or uncoded 404s, plus
|
|
1451
|
+
* permission/auth errors such as tenant mismatch, continue to throw typed SDK
|
|
1452
|
+
* errors instead of being collapsed into a storefront absence result.
|
|
1427
1453
|
*/
|
|
1428
1454
|
async detail(params) {
|
|
1429
1455
|
try {
|
|
1430
|
-
|
|
1456
|
+
const product = await this.request(
|
|
1457
|
+
"/api/products/detail",
|
|
1458
|
+
params
|
|
1459
|
+
);
|
|
1460
|
+
return { found: true, product };
|
|
1431
1461
|
} catch (err) {
|
|
1432
|
-
|
|
1462
|
+
const notFoundResult = productDetailResultFromError(err);
|
|
1463
|
+
if (notFoundResult) return notFoundResult;
|
|
1433
1464
|
throw err;
|
|
1434
1465
|
}
|
|
1435
1466
|
}
|
|
@@ -1496,7 +1527,7 @@ var OrderApi = class extends BaseApi {
|
|
|
1496
1527
|
}
|
|
1497
1528
|
bulkImportFulfillments(params) {
|
|
1498
1529
|
return this.request(
|
|
1499
|
-
"/api/
|
|
1530
|
+
"/api/fulfillments/bulk-import",
|
|
1500
1531
|
params
|
|
1501
1532
|
);
|
|
1502
1533
|
}
|
|
@@ -1625,6 +1656,29 @@ var ServerCommerceClient = class {
|
|
|
1625
1656
|
}
|
|
1626
1657
|
};
|
|
1627
1658
|
|
|
1659
|
+
// src/core/api/tenant-introspection-api.ts
|
|
1660
|
+
var TenantIntrospectionApi = class extends BaseApi {
|
|
1661
|
+
constructor(options) {
|
|
1662
|
+
super("TenantIntrospectionApi", options);
|
|
1663
|
+
}
|
|
1664
|
+
collectionSchema(collection) {
|
|
1665
|
+
return this.request(
|
|
1666
|
+
`/api/tenants/schema/${encodeURIComponent(collection)}`,
|
|
1667
|
+
void 0,
|
|
1668
|
+
{ method: "GET" }
|
|
1669
|
+
);
|
|
1670
|
+
}
|
|
1671
|
+
featureProgress(params) {
|
|
1672
|
+
const search = new URLSearchParams({ feature: params.feature });
|
|
1673
|
+
if (params.includeEvidence) search.set("includeEvidence", "true");
|
|
1674
|
+
return this.request(
|
|
1675
|
+
`/api/tenants/feature-progress?${search.toString()}`,
|
|
1676
|
+
void 0,
|
|
1677
|
+
{ method: "GET" }
|
|
1678
|
+
);
|
|
1679
|
+
}
|
|
1680
|
+
};
|
|
1681
|
+
|
|
1628
1682
|
// src/core/client/client.server.ts
|
|
1629
1683
|
var ServerClient = class {
|
|
1630
1684
|
constructor(options) {
|
|
@@ -1658,6 +1712,15 @@ var ServerClient = class {
|
|
|
1658
1712
|
onRequestId
|
|
1659
1713
|
};
|
|
1660
1714
|
this.commerce = new ServerCommerceClient(serverOptions);
|
|
1715
|
+
const tenantIntrospectionApi = new TenantIntrospectionApi(serverOptions);
|
|
1716
|
+
this.tenant = {
|
|
1717
|
+
collectionSchema: tenantIntrospectionApi.collectionSchema.bind(
|
|
1718
|
+
tenantIntrospectionApi
|
|
1719
|
+
),
|
|
1720
|
+
featureProgress: tenantIntrospectionApi.featureProgress.bind(
|
|
1721
|
+
tenantIntrospectionApi
|
|
1722
|
+
)
|
|
1723
|
+
};
|
|
1661
1724
|
const previewApi = new ServerPreviewClient(serverOptions);
|
|
1662
1725
|
this.preview = {
|
|
1663
1726
|
detail: previewApi.detail.bind(previewApi)
|
|
@@ -1698,6 +1761,7 @@ export {
|
|
|
1698
1761
|
ServerCollectionClient,
|
|
1699
1762
|
ServerCommerceClient,
|
|
1700
1763
|
ServerPreviewClient,
|
|
1764
|
+
TenantIntrospectionApi,
|
|
1701
1765
|
createServerClient
|
|
1702
1766
|
};
|
|
1703
1767
|
//# sourceMappingURL=server.js.map
|