@joai/sdk 0.13.0 → 0.14.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/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { WarpBrandUrls, WarpChainName, WarpClient, WarpI18nText, WarpLocale, WarpText, WarpWalletProvider } from "@joai/warps";
1
+ import { WarpBrandUrls, WarpChainName, WarpClient, WarpI18nText, WarpLocale, WarpNativeValue, WarpText, WarpWalletProvider } from "@joai/warps";
2
2
 
3
3
  //#region ../core/dist/types-CWSaEVa7.d.mts
4
4
  //#region src/http/types.d.ts
@@ -183,9 +183,26 @@ type ProductRelation = {
183
183
  type VolumePrice = {
184
184
  id: number;
185
185
  minQty: number;
186
- maxQty: number | null;
187
186
  unitPrice: number;
188
187
  };
188
+ type ProductConfiguration = Record<string, WarpNativeValue>;
189
+ type OrderConfigurationItem = {
190
+ itemId: string | null;
191
+ type: string;
192
+ configuration: ProductConfiguration;
193
+ };
194
+ type ProductVariationMeta = {
195
+ itemGroupId?: string | null;
196
+ appleProductId: string | null;
197
+ googleProductId: string | null;
198
+ gtin?: string | null;
199
+ mpn?: string | null;
200
+ condition?: 'new' | 'used' | 'refurbished';
201
+ };
202
+ type ProductMeta = {
203
+ googleProductCategory?: number | null;
204
+ brand?: string | null;
205
+ };
189
206
  type ProductVariation = {
190
207
  resource?: 'product-variation';
191
208
  id?: string;
@@ -197,6 +214,9 @@ type ProductVariation = {
197
214
  badge?: string;
198
215
  quantity?: number;
199
216
  media?: Media[];
217
+ preview?: Media[];
218
+ stock?: number | null;
219
+ weight?: number | null;
200
220
  preorder?: boolean;
201
221
  active?: boolean;
202
222
  hidden?: boolean;
@@ -204,11 +224,9 @@ type ProductVariation = {
204
224
  order?: number | null;
205
225
  pieces?: ProductPieces | null;
206
226
  discount?: ProductDiscount | null;
227
+ settings?: Record<string, unknown> | null;
207
228
  product?: Product;
208
- meta?: {
209
- appleProductId: string | null;
210
- googleProductId: string | null;
211
- };
229
+ meta?: ProductVariationMeta;
212
230
  nativePriceStr?: string | null;
213
231
  };
214
232
  type Product = {
@@ -216,8 +234,10 @@ type Product = {
216
234
  name: TranslatableValue;
217
235
  description?: Partial<Record<WarpLocale, string>>;
218
236
  price?: number;
219
- unit?: string | null;
237
+ unit?: TranslatableValue | null;
220
238
  active?: boolean;
239
+ public?: boolean;
240
+ meta?: ProductMeta;
221
241
  virtual?: boolean;
222
242
  tags?: string[] | null;
223
243
  createdAt?: string;
@@ -227,6 +247,7 @@ type Product = {
227
247
  rating?: ProductRating;
228
248
  settings?: Record<string, unknown> | null;
229
249
  volumePrices?: VolumePrice[];
250
+ media?: Media[];
230
251
  };
231
252
  type OrderItem = {
232
253
  id: string;
@@ -243,7 +264,9 @@ type CartItem = {
243
264
  type: 'service' | 'product';
244
265
  sku: string | null;
245
266
  badge: string | null;
267
+ configuration?: ProductConfiguration;
246
268
  media: Media[];
269
+ product?: Product | null;
247
270
  };
248
271
  type Cart = {
249
272
  subtotal: number;
@@ -266,15 +289,58 @@ type Team = {
266
289
  slug: string;
267
290
  name: string;
268
291
  personal: boolean;
269
- description: string | null;
292
+ description: TranslatableValue | null;
270
293
  locale: WarpLocale;
271
294
  timezone: string;
295
+ settings?: TeamSettings;
272
296
  logo: string | null;
297
+ tagline?: TranslatableValue | null;
273
298
  public: boolean;
274
299
  createdAt: string;
275
300
  blueprints?: Blueprint[];
276
301
  flows?: Flow[];
277
302
  };
303
+ type TeamBrand = {
304
+ bg?: string;
305
+ fg?: string;
306
+ label?: string;
307
+ logo?: string;
308
+ bankName?: string;
309
+ bankIban?: string;
310
+ bankBic?: string;
311
+ invoiceAddress?: string;
312
+ invoiceVat?: string;
313
+ invoiceCity?: string;
314
+ invoiceZip?: string;
315
+ invoiceCountry?: string;
316
+ };
317
+ type ByokProviderConfig = {
318
+ apiKey?: string;
319
+ accessKey?: string;
320
+ secretKey?: string;
321
+ };
322
+ type ByokProviders = {
323
+ openai?: ByokProviderConfig;
324
+ anthropic?: ByokProviderConfig;
325
+ google?: ByokProviderConfig;
326
+ xai?: ByokProviderConfig;
327
+ klingai?: ByokProviderConfig;
328
+ };
329
+ type TeamSettings = {
330
+ 'extra.messages': number;
331
+ 'limit.spending': number | null;
332
+ 'currency': string;
333
+ 'extra.usage.enabled'?: boolean;
334
+ 'auto.reload.enabled'?: boolean;
335
+ 'auto.reload.threshold_cents'?: number | null;
336
+ 'auto.reload.amount_cents'?: number | null;
337
+ 'llm.provider'?: 'openai' | 'anthropic' | 'google' | 'xai' | null;
338
+ 'byok.providers'?: ByokProviders | null;
339
+ 'board.auto.enabled'?: boolean;
340
+ 'payments.online'?: boolean;
341
+ 'payments.coupons'?: boolean;
342
+ 'branding'?: TeamBrand | null;
343
+ };
278
344
  //#endregion
279
345
  //#region src/flow/types.d.ts
280
346
  type FlowCategory = 'none' | 'defi' | 'nft' | 'social' | 'devtools' | 'productivity' | 'trading' | 'portfolio';
@@ -488,6 +554,7 @@ type BrandBackend = {
488
554
  locales: WarpLocale[];
489
555
  warps: WarpBackend[];
490
556
  isTeamOwned?: boolean;
557
+ isPublic?: boolean;
491
558
  inviteCode?: string;
492
559
  source?: BrandSourceConfig | null;
493
560
  contract?: string;
@@ -604,17 +671,40 @@ type BlueprintShortcut = {
604
671
  }; //#endregion
605
672
  //#region src/helpers/string.d.ts
606
673
  //#endregion
674
+ //#region src/service/types.d.ts
675
+ type Service = {
676
+ id: string;
677
+ slug: string;
678
+ name: TranslatableValue;
679
+ price: number;
680
+ durationMinutes: number;
681
+ tags?: string[] | null;
682
+ category: string | null;
683
+ description: TranslatableValue | null;
684
+ active: boolean;
685
+ digital: boolean;
686
+ public: boolean;
687
+ createdAt: string;
688
+ updatedAt: string;
689
+ }; //#endregion
607
690
  //#region src/appointment/types.d.ts
608
- type AppointmentSlot = {
609
- start: string;
610
- end: string;
611
- label?: string;
691
+ type AppointmentAvailabilityService = {
692
+ slug: string;
693
+ name: string | null;
694
+ durationMinutes: number | null;
695
+ };
696
+ type AppointmentAvailabilitySlot = {
697
+ startAt: string;
698
+ endAt: string;
699
+ agentUuid: string;
700
+ agentName: string;
701
+ serviceSlug: string | null;
612
702
  };
613
703
  type AppointmentAvailability = {
614
704
  connected: boolean;
615
705
  timezone: string;
616
- service: string | null;
617
- slots: AppointmentSlot[];
706
+ service: AppointmentAvailabilityService | null;
707
+ slots: AppointmentAvailabilitySlot[];
618
708
  };
619
709
  type AppointmentPolicy = {
620
710
  timezone: string | null;
@@ -629,6 +719,18 @@ type AppointmentPolicy = {
629
719
  blockedDates: string[] | null;
630
720
  holidays: string[] | null;
631
721
  conferenceEnabled: boolean | null;
722
+ serviceSelectionEnabled?: boolean | null;
723
+ marketplacePaymentEnabled?: boolean | null;
724
+ };
725
+ type AppointmentBookingContext = {
726
+ resolved: AppointmentPolicy | null;
727
+ policy: AppointmentPolicy | null;
728
+ services: Service[];
729
+ availableStaff: {
730
+ uuid: string;
731
+ name: string;
732
+ }[];
733
+ requestStatuses: string[];
632
734
  };
633
735
  type AppointmentBooking = {
634
736
  id: string;
@@ -638,6 +740,7 @@ type AppointmentBooking = {
638
740
  timezone: string | null;
639
741
  conferenceUrl: string | null;
640
742
  conferenceProvider: string | null;
743
+ inviteUrl?: string | null;
641
744
  status: string;
642
745
  attendeeEmail: string | null;
643
746
  attendeeName: string | null;
@@ -843,21 +946,6 @@ type Reminder = {
843
946
  dispatchedAt?: string | null;
844
947
  createdAt: string;
845
948
  }; //#endregion
846
- //#region src/service/types.d.ts
847
- type Service = {
848
- id: string;
849
- slug: string;
850
- name: TranslatableValue;
851
- price: number;
852
- durationMinutes: number;
853
- category: string | null;
854
- description: TranslatableValue | null;
855
- active: boolean;
856
- digital: boolean;
857
- public: boolean;
858
- createdAt: string;
859
- updatedAt: string;
860
- }; //#endregion
861
949
  //#region src/shortcut/types.d.ts
862
950
  //#endregion
863
951
  //#region src/site/types.d.ts
@@ -912,7 +1000,8 @@ type LinkCreatePayload = {
912
1000
  url: string;
913
1001
  title: string;
914
1002
  };
915
- type LinkUpdatePayload = Partial<LinkCreatePayload>; //#endregion
1003
+ type LinkUpdatePayload = Partial<LinkCreatePayload>;
1004
+ //#endregion
916
1005
  //#region src/store/types.d.ts
917
1006
  type StoreVisibility = 'private' | 'team' | 'public';
918
1007
  type StoreEntry = {
@@ -990,7 +1079,7 @@ type UpdateUpdatePayload = Partial<UpdateCreatePayload>; //#endregion
990
1079
  declare class AppointmentsResource {
991
1080
  private readonly http;
992
1081
  constructor(http: IHttpService);
993
- getPolicy(agentUuid: string): Promise<IAppResponse<AppointmentPolicy>>;
1082
+ getBookingPolicy(agentUuid: string): Promise<IAppResponse<AppointmentBookingContext>>;
994
1083
  upsertPolicy(agentUuid: string, data: Partial<AppointmentPolicy>): Promise<IAppResponse<AppointmentPolicy>>;
995
1084
  checkAvailability(agentUuid: string, params: {
996
1085
  windowStart: string;
@@ -1095,6 +1184,7 @@ declare class AuthResource {
1095
1184
  phone: string | null;
1096
1185
  email: string | null;
1097
1186
  }>>;
1187
+ logout(): Promise<IAppResponse<void>>;
1098
1188
  }
1099
1189
  //#endregion
1100
1190
  //#region src/resources/blueprints.d.ts
@@ -1113,9 +1203,9 @@ declare class CartsResource {
1113
1203
  private readonly http;
1114
1204
  constructor(http: IHttpService);
1115
1205
  get(): Promise<IAppResponse<Cart>>;
1116
- add(id: string, quantity?: number): Promise<IAppResponse<Cart>>;
1117
- remove(id: string): Promise<IAppResponse<Cart>>;
1118
- updateQuantity(id: string, quantity: number): Promise<IAppResponse<Cart>>;
1206
+ add(type: 'product' | 'service', id: string, quantity?: number, configuration?: ProductConfiguration): Promise<IAppResponse<Cart>>;
1207
+ remove(type: 'product' | 'service', id: string): Promise<IAppResponse<Cart>>;
1208
+ updateQuantity(type: 'product' | 'service', id: string, quantity: number): Promise<IAppResponse<Cart>>;
1119
1209
  clear(): Promise<IAppResponse<Cart>>;
1120
1210
  }
1121
1211
  //#endregion
@@ -1141,8 +1231,8 @@ declare class MarketplaceResource {
1141
1231
  declare class ServicesResource {
1142
1232
  private readonly http;
1143
1233
  constructor(http: IHttpService);
1144
- get(id: string): Promise<IAppResponse<Service>>;
1145
- list(team: string): Promise<IAppResponse<Service[]>>;
1234
+ list(team?: string): Promise<IAppResponse<Service[]>>;
1235
+ get(slug: string): Promise<IAppResponse<Service>>;
1146
1236
  store(team: string, data: {
1147
1237
  name: string;
1148
1238
  price: number;
@@ -1230,6 +1320,19 @@ declare class MeetingsResource {
1230
1320
  join(code: string): Promise<IAppResponse<MeetingJoinInfo>>;
1231
1321
  }
1232
1322
  //#endregion
1323
+ //#region src/resources/media.d.ts
1324
+ type MediaUploadType = 'brand' | 'reference' | 'template' | 'output';
1325
+ declare class MediaResource {
1326
+ private readonly http;
1327
+ constructor(http: IHttpService);
1328
+ upload(data: {
1329
+ team: string;
1330
+ file: File;
1331
+ type: MediaUploadType;
1332
+ label?: string;
1333
+ }): Promise<IAppResponse<Media>>;
1334
+ }
1335
+ //#endregion
1233
1336
  //#region src/resources/ingestions.d.ts
1234
1337
  declare class IngestionsResource {
1235
1338
  private readonly http;
@@ -1281,6 +1384,7 @@ type Order = {
1281
1384
  invoiceUrl: string | null;
1282
1385
  createdAt: string;
1283
1386
  items: OrderItem[];
1387
+ configuration: OrderConfigurationItem[];
1284
1388
  contactId: string | null;
1285
1389
  };
1286
1390
  declare class OrdersResource {
@@ -1297,6 +1401,7 @@ declare class OrdersResource {
1297
1401
  id: string;
1298
1402
  type: 'product' | 'service';
1299
1403
  quantity: number;
1404
+ configuration?: ProductConfiguration;
1300
1405
  }[];
1301
1406
  }): Promise<IAppResponse<Order>>;
1302
1407
  }
@@ -1364,6 +1469,10 @@ declare class TeamsResource {
1364
1469
  private readonly http;
1365
1470
  constructor(http: IHttpService);
1366
1471
  list(): Promise<IAppResponse<Team[]>>;
1472
+ listPublic(params?: {
1473
+ tags?: string;
1474
+ }): Promise<IAppResponse<Team[]>>;
1475
+ get(slug: string): Promise<IAppResponse<Team>>;
1367
1476
  invite(teamSlug: string, payload: {
1368
1477
  email: string;
1369
1478
  role: 'owner' | 'admin' | 'member';
@@ -1425,6 +1534,7 @@ type BackendWarpBrand = {
1425
1534
  name: string;
1426
1535
  description?: WarpText | null;
1427
1536
  logo?: string | null;
1537
+ isPublic?: boolean;
1428
1538
  };
1429
1539
  type BackendWarp = {
1430
1540
  id: string;
@@ -1453,6 +1563,7 @@ declare class WarpsResource {
1453
1563
  update(identifier: string, data: {
1454
1564
  definition?: Record<string, any>;
1455
1565
  agent?: string | null;
1566
+ public?: boolean;
1456
1567
  }): Promise<IAppResponse<{
1457
1568
  id: string;
1458
1569
  }>>;
@@ -1511,6 +1622,7 @@ declare class JoAiClient {
1511
1622
  readonly sites: SitesResource;
1512
1623
  readonly documents: DocumentsResource;
1513
1624
  readonly meetings: MeetingsResource;
1625
+ readonly media: MediaResource;
1514
1626
  readonly stores: StoresResource;
1515
1627
  readonly updates: UpdatesResource;
1516
1628
  readonly links: LinksResource;
@@ -1520,7 +1632,7 @@ declare class JoAiClient {
1520
1632
  readonly auth: AuthResource;
1521
1633
  constructor(config: JoAiClientConfig);
1522
1634
  clearCache(): void;
1523
- warps(locale?: WarpLocale): WarpClient;
1635
+ warps(locale?: WarpLocale, currentUrl?: string): WarpClient;
1524
1636
  }
1525
1637
  declare function createClient(config: JoAiClientConfig): JoAiClient;
1526
1638
  //#endregion
package/dist/index.mjs CHANGED
@@ -115,7 +115,7 @@ var AppointmentsResource = class {
115
115
  constructor(http) {
116
116
  this.http = http;
117
117
  }
118
- getPolicy(agentUuid) {
118
+ getBookingPolicy(agentUuid) {
119
119
  return this.http.get(`agents/${agentUuid}/appointments/policy`);
120
120
  }
121
121
  upsertPolicy(agentUuid, data) {
@@ -175,6 +175,9 @@ var AuthResource = class {
175
175
  me() {
176
176
  return this.http.get("auth/me");
177
177
  }
178
+ logout() {
179
+ return this.http.post("auth/logout");
180
+ }
178
181
  };
179
182
  //#endregion
180
183
  //#region src/resources/blueprints.ts
@@ -202,18 +205,24 @@ var CartsResource = class {
202
205
  get() {
203
206
  return this.http.get("cart");
204
207
  }
205
- add(id, quantity = 1) {
208
+ add(type, id, quantity = 1, configuration) {
206
209
  return this.http.post("cart/add", {
207
210
  id,
208
- quantity
211
+ type,
212
+ quantity,
213
+ configuration
209
214
  });
210
215
  }
211
- remove(id) {
212
- return this.http.post("cart/remove", { id });
216
+ remove(type, id) {
217
+ return this.http.post("cart/remove", {
218
+ id,
219
+ type
220
+ });
213
221
  }
214
- updateQuantity(id, quantity) {
222
+ updateQuantity(type, id, quantity) {
215
223
  return this.http.post("cart/quantity", {
216
224
  id,
225
+ type,
217
226
  quantity
218
227
  });
219
228
  }
@@ -288,11 +297,12 @@ var ServicesResource = class {
288
297
  constructor(http) {
289
298
  this.http = http;
290
299
  }
291
- get(id) {
292
- return this.http.get(`services/${id}`);
293
- }
294
300
  list(team) {
295
- return this.http.get(`services?team=${encodeURIComponent(team)}`);
301
+ const url = team ? `services?team=${encodeURIComponent(team)}` : "services";
302
+ return this.http.get(url);
303
+ }
304
+ get(slug) {
305
+ return this.http.get(`services/${slug}`);
296
306
  }
297
307
  store(team, data) {
298
308
  return this.http.post("services", {
@@ -412,6 +422,20 @@ var MeetingsResource = class {
412
422
  }
413
423
  };
414
424
  //#endregion
425
+ //#region src/resources/media.ts
426
+ var MediaResource = class {
427
+ constructor(http) {
428
+ this.http = http;
429
+ }
430
+ upload(data) {
431
+ const formData = new FormData();
432
+ formData.append("file", data.file, data.file.name);
433
+ formData.append("type", data.type);
434
+ if (data.label) formData.append("label", data.label);
435
+ return this.http.post("media", formData, { headers: { "X-Team": data.team } });
436
+ }
437
+ };
438
+ //#endregion
415
439
  //#region src/resources/ingestions.ts
416
440
  var IngestionsResource = class {
417
441
  constructor(http) {
@@ -571,6 +595,13 @@ var TeamsResource = class {
571
595
  list() {
572
596
  return this.http.get("teams");
573
597
  }
598
+ listPublic(params) {
599
+ const qs = params?.tags ? `?tags=${encodeURIComponent(params.tags)}` : "";
600
+ return this.http.get(`teams/public${qs}`);
601
+ }
602
+ get(slug) {
603
+ return this.http.get(`teams/${encodeURIComponent(slug)}`);
604
+ }
574
605
  invite(teamSlug, payload) {
575
606
  return this.http.post(`teams/${teamSlug}/invitations`, payload);
576
607
  }
@@ -844,6 +875,7 @@ var JoAiClient = class {
844
875
  this.sites = new SitesResource(this.http);
845
876
  this.documents = new DocumentsResource(this.http);
846
877
  this.meetings = new MeetingsResource(this.http);
878
+ this.media = new MediaResource(this.http);
847
879
  this.stores = new StoresResource(this.http);
848
880
  this.products = new ProductsResource(this.http);
849
881
  this.orders = new OrdersResource(this.http);
@@ -857,9 +889,10 @@ var JoAiClient = class {
857
889
  clearCache() {
858
890
  if (this.http instanceof CachedHttpService) this.http.clearCache();
859
891
  }
860
- warps(locale = "en") {
892
+ warps(locale = "en", currentUrl) {
861
893
  return new WarpClient({
862
894
  env: toWarpEnv(this.env),
895
+ currentUrl,
863
896
  preferences: { locale }
864
897
  }, { chains: [] });
865
898
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",