@joai/sdk 0.10.1 → 0.11.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 (2) hide show
  1. package/dist/index.d.mts +72 -34
  2. package/package.json +1 -1
package/dist/index.d.mts CHANGED
@@ -154,6 +154,70 @@ type AppSubscription = {
154
154
  createdAt: string;
155
155
  updatedAt: string;
156
156
  };
157
+ type ProductRating = {
158
+ average: number;
159
+ count: number;
160
+ };
161
+ type ProductPieces = {
162
+ amount: number;
163
+ name: string;
164
+ };
165
+ type ProductDiscount = {
166
+ original: number;
167
+ percent: number;
168
+ };
169
+ type ProductVariationType = {
170
+ name: string;
171
+ };
172
+ type ProductRelationType = 'cross_sell' | 'upsell' | 'add_on';
173
+ type ProductRelation = {
174
+ id: string;
175
+ name: TranslatableValue;
176
+ slug: string;
177
+ price: number;
178
+ unit: string | null;
179
+ type: ProductRelationType;
180
+ position: number;
181
+ variations: ProductVariation[];
182
+ };
183
+ type ProductVariation = {
184
+ resource?: 'product-variation';
185
+ sku: string;
186
+ name: TranslatableValue;
187
+ type?: ProductVariationType | null;
188
+ description?: Partial<Record<WarpLocale, string>>;
189
+ price: number;
190
+ badge?: string;
191
+ quantity?: number;
192
+ media?: Media[];
193
+ preorder?: boolean;
194
+ active?: boolean;
195
+ hidden?: boolean;
196
+ availableAt?: string | null;
197
+ pieces?: ProductPieces | null;
198
+ discount?: ProductDiscount | null;
199
+ product?: Product;
200
+ meta?: {
201
+ appleProductId: string | null;
202
+ googleProductId: string | null;
203
+ };
204
+ nativePriceStr?: string | null;
205
+ };
206
+ type Product = {
207
+ slug: string;
208
+ name: TranslatableValue;
209
+ description?: Partial<Record<WarpLocale, string>>;
210
+ price?: number;
211
+ unit?: string | null;
212
+ active?: boolean;
213
+ virtual?: boolean;
214
+ tags?: string[] | null;
215
+ createdAt?: string;
216
+ updatedAt?: string;
217
+ variations: ProductVariation[];
218
+ relatedProducts?: ProductRelation[];
219
+ rating?: ProductRating;
220
+ };
157
221
  type Team = {
158
222
  slug: string;
159
223
  name: string;
@@ -1019,45 +1083,19 @@ declare class OrdersResource {
1019
1083
  }
1020
1084
  //#endregion
1021
1085
  //#region src/resources/products.d.ts
1022
- type ProductVariation = {
1023
- id: string;
1024
- sku: string;
1025
- name: TranslatableValue;
1026
- description: string | null;
1027
- price: number;
1028
- badge: string;
1029
- meta: Record<string, unknown> | null;
1030
- active: boolean;
1031
- order: number | null;
1032
- type: string | null;
1033
- };
1034
- type ProductItem = {
1035
- id: string;
1036
- slug: string;
1037
- name: TranslatableValue;
1038
- price: number;
1039
- unit: string;
1040
- tags: string[];
1041
- description: string;
1042
- active: boolean;
1043
- createdAt?: string;
1044
- updatedAt?: string;
1045
- variations?: ProductVariation[];
1046
- settings?: Record<string, unknown> | null;
1047
- };
1048
1086
  declare class ProductsResource {
1049
1087
  private readonly http;
1050
1088
  constructor(http: IHttpService);
1051
- list(): Promise<IAppResponse<ProductItem[]>>;
1052
- get(id: string): Promise<IAppResponse<ProductItem>>;
1089
+ list(): Promise<IAppResponse<Product[]>>;
1090
+ get(id: string): Promise<IAppResponse<Product>>;
1053
1091
  create(data: {
1054
1092
  name: TranslatableValue;
1055
- price: number;
1056
1093
  unit?: string;
1057
- description?: string;
1058
- tags?: string[];
1059
- }): Promise<IAppResponse<ProductItem>>;
1060
- update(id: string, data: Partial<Pick<ProductItem, 'name' | 'price' | 'unit' | 'description' | 'tags' | 'active'>>): Promise<IAppResponse<ProductItem>>;
1094
+ }): Promise<IAppResponse<Product>>;
1095
+ update(id: string, data: {
1096
+ name?: TranslatableValue;
1097
+ active?: boolean;
1098
+ }): Promise<IAppResponse<Product>>;
1061
1099
  delete(id: string): Promise<IAppResponse<unknown>>;
1062
1100
  }
1063
1101
  //#endregion
@@ -1292,4 +1330,4 @@ declare class DistributionResource {
1292
1330
  private fetchDistribution;
1293
1331
  }
1294
1332
  //#endregion
1295
- export { BlueprintsResource, type CacheConfig, CachedHttpService, DistributionResource, FlowsResource, IngestionsResource, JoAiClient, type JoAiClientConfig, MarketplaceResource, MeetingsResource, type Order, type OrderItem, OrdersResource, type ProductItem, type ProductVariation, ProductsResource, ServicesResource, SitesResource, SkillsResource, StoresResource, SubscriptionsResource, createClient };
1333
+ export { BlueprintsResource, type CacheConfig, CachedHttpService, DistributionResource, FlowsResource, IngestionsResource, JoAiClient, type JoAiClientConfig, MarketplaceResource, MeetingsResource, type Order, type OrderItem, OrdersResource, type Product, type ProductVariation, ProductsResource, ServicesResource, SitesResource, SkillsResource, StoresResource, SubscriptionsResource, createClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",