@joai/sdk 0.8.1 → 0.9.1

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,6 +1,6 @@
1
1
  import { WarpBrandUrls, WarpChainName, WarpClient, WarpI18nText, WarpLocale, WarpText, WarpWalletProvider } from "@joai/warps";
2
2
 
3
- //#region ../core/dist/types-C4eYYzWF.d.mts
3
+ //#region ../core/dist/types-CWSaEVa7.d.mts
4
4
  //#region src/http/types.d.ts
5
5
  interface IHttpService {
6
6
  readonly baseUrl: string;
@@ -12,6 +12,7 @@ interface IHttpService {
12
12
  get: <T>(url: string, options?: IRequestOptions) => Promise<IAppResponse<T>>;
13
13
  post: <T>(url: string, data?: any, options?: IRequestOptions) => Promise<IAppResponse<T>>;
14
14
  put: <T>(url: string, data?: any, options?: IRequestOptions) => Promise<IAppResponse<T>>;
15
+ patch: <T>(url: string, data?: any, options?: IRequestOptions) => Promise<IAppResponse<T>>;
15
16
  delete: <T>(url: string, options?: IRequestOptions) => Promise<IAppResponse<T>>;
16
17
  }
17
18
  interface IAppResponse<T> {
@@ -134,6 +135,25 @@ type Wallet = {
134
135
  privateKey?: string;
135
136
  mnemonic?: string;
136
137
  };
138
+ //#endregion
139
+ //#region src/billing/types.d.ts
140
+ type TranslatableValue = Partial<Record<WarpLocale, string>>;
141
+ type SubscriptionStatus = 'active' | 'canceled' | 'past_due';
142
+ type SubscriptionInterval = 'weekly' | 'monthly' | 'yearly';
143
+ type AppSubscription = {
144
+ id: string;
145
+ orderId: string;
146
+ teamId: string;
147
+ contactId: string | null;
148
+ status: SubscriptionStatus;
149
+ interval: SubscriptionInterval | null;
150
+ renewsAt: string | null;
151
+ cancelledAt: string | null;
152
+ locale: string | null;
153
+ meta: Record<string, any> | null;
154
+ createdAt: string;
155
+ updatedAt: string;
156
+ };
137
157
  type Team = {
138
158
  slug: string;
139
159
  name: string;
@@ -206,6 +226,88 @@ type Skill = {
206
226
  media?: Media[];
207
227
  screenshots: string[];
208
228
  }; //#endregion
229
+ //#region src/integration/types.d.ts
230
+ type IntegrationType = 'none' | 'webhook' | 'api-token' | 'telegram' | 'slack' | 'whatsapp' | 'twilio' | 'n8n' | 'ai-nexus' | 'apple-health' | 'mcp' | 'x' | 'email' | 'calendar' | 'embed' | 'discord' | 'github' | 'sentry' | 'readwise';
231
+ type IntegrationDetails = {
232
+ type: IntegrationType;
233
+ name: string;
234
+ description?: string;
235
+ logoUrl?: string;
236
+ logoUrlDark?: string;
237
+ slug?: string;
238
+ category?: string;
239
+ [key: string]: unknown;
240
+ };
241
+ type Integration = {
242
+ id: string;
243
+ type: IntegrationType;
244
+ name: string;
245
+ active: boolean;
246
+ createdAt: string;
247
+ details?: IntegrationDetails;
248
+ };
249
+ type EmailProvider = 'resend' | 'mailgun' | 'sendgrid';
250
+ type RoomKind = 'default' | 'phone' | 'meeting';
251
+ type Room = {
252
+ id: string;
253
+ name: string;
254
+ description: string | null;
255
+ public: boolean;
256
+ default: boolean;
257
+ active: boolean;
258
+ kind?: RoomKind | null;
259
+ archivedAt?: string | null;
260
+ secKey: string | null;
261
+ createdAt: string | null;
262
+ contactId?: string | null;
263
+ agent: AgentSimple;
264
+ integration: Integration | null;
265
+ }; //#endregion
266
+ //#region src/agent/types.d.ts
267
+ type AgentPrivate = {
268
+ uuid: string;
269
+ name: string;
270
+ description: string;
271
+ avatar: string;
272
+ wallets: Wallet[];
273
+ settings: AgentSettings;
274
+ marketplace: MarketplaceInfo;
275
+ password: string | null;
276
+ authKey: string | null;
277
+ secKey: string;
278
+ emailAddress: string | null;
279
+ phoneNumber: string | null;
280
+ room: Room;
281
+ role: string | null;
282
+ blueprint: Blueprint | null;
283
+ justCreated?: boolean;
284
+ team: string;
285
+ };
286
+ type AgentSimple = {
287
+ uuid: string;
288
+ name: string;
289
+ };
290
+ type AgentEngine = 'cortex' | 'openclaw';
291
+ type AgentGender = 'male' | 'female' | 'neutral';
292
+ type AgentSettings = {
293
+ auto: boolean;
294
+ 'model.url': string;
295
+ 'voice.output': boolean;
296
+ 'voice.id': string;
297
+ 'agent.gender'?: AgentGender;
298
+ 'proactivity.enabled': boolean;
299
+ 'proactivity.quietHoursStart'?: number;
300
+ 'proactivity.quietHoursEnd'?: number;
301
+ 'proactivity.maxMessagesPerDay'?: number;
302
+ 'proactivity.timezone'?: string;
303
+ 'proactivity.blockedBehaviors'?: string[];
304
+ engine: AgentEngine;
305
+ 'training.url'?: string | null;
306
+ 'training.status'?: 'idle' | 'training' | 'completed' | 'failed' | null;
307
+ 'training.recrawlInterval'?: number | null;
308
+ 'email_provider'?: EmailProvider | null;
309
+ };
310
+ //#endregion
209
311
  //#region src/warp/types.d.ts
210
312
  type WarpExtrasFaq = {
211
313
  question: string;
@@ -238,6 +340,7 @@ type WarpBackend = {
238
340
  brand: BrandBackend | null;
239
341
  definition?: Record<string, any> | null;
240
342
  extras?: WarpExtras | null;
343
+ agent?: AgentSimple | null;
241
344
  };
242
345
  type WarpBackendStatus = 'unverified' | 'verified' | 'blacklisted';
243
346
  type WarpBackendCategory = 'none';
@@ -393,88 +496,6 @@ type BlueprintShortcut = {
393
496
  }; //#endregion
394
497
  //#region src/helpers/string.d.ts
395
498
  //#endregion
396
- //#region src/integration/types.d.ts
397
- type IntegrationType = 'none' | 'webhook' | 'api-token' | 'telegram' | 'slack' | 'whatsapp' | 'twilio' | 'n8n' | 'ai-nexus' | 'apple-health' | 'mcp' | 'x' | 'email' | 'calendar' | 'embed' | 'discord' | 'github' | 'sentry' | 'readwise';
398
- type IntegrationDetails = {
399
- type: IntegrationType;
400
- name: string;
401
- description?: string;
402
- logoUrl?: string;
403
- logoUrlDark?: string;
404
- slug?: string;
405
- category?: string;
406
- [key: string]: unknown;
407
- };
408
- type Integration = {
409
- id: string;
410
- type: IntegrationType;
411
- name: string;
412
- active: boolean;
413
- createdAt: string;
414
- details?: IntegrationDetails;
415
- };
416
- type EmailProvider = 'resend' | 'mailgun' | 'sendgrid';
417
- type RoomKind = 'default' | 'phone' | 'meeting';
418
- type Room = {
419
- id: string;
420
- name: string;
421
- description: string | null;
422
- public: boolean;
423
- default: boolean;
424
- active: boolean;
425
- kind?: RoomKind | null;
426
- archivedAt?: string | null;
427
- secKey: string | null;
428
- createdAt: string | null;
429
- contactId?: string | null;
430
- agent: AgentSimple;
431
- integration: Integration | null;
432
- }; //#endregion
433
- //#region src/agent/types.d.ts
434
- type AgentPrivate = {
435
- uuid: string;
436
- name: string;
437
- description: string;
438
- avatar: string;
439
- wallets: Wallet[];
440
- settings: AgentSettings;
441
- marketplace: MarketplaceInfo;
442
- password: string | null;
443
- authKey: string | null;
444
- secKey: string;
445
- emailAddress: string | null;
446
- phoneNumber: string | null;
447
- room: Room;
448
- role: string | null;
449
- blueprint: Blueprint | null;
450
- justCreated?: boolean;
451
- team: string;
452
- };
453
- type AgentSimple = {
454
- uuid: string;
455
- name: string;
456
- };
457
- type AgentEngine = 'cortex' | 'openclaw';
458
- type AgentGender = 'male' | 'female' | 'neutral';
459
- type AgentSettings = {
460
- auto: boolean;
461
- 'model.url': string;
462
- 'voice.output': boolean;
463
- 'voice.id': string;
464
- 'agent.gender'?: AgentGender;
465
- 'proactivity.enabled': boolean;
466
- 'proactivity.quietHoursStart'?: number;
467
- 'proactivity.quietHoursEnd'?: number;
468
- 'proactivity.maxMessagesPerDay'?: number;
469
- 'proactivity.timezone'?: string;
470
- 'proactivity.blockedBehaviors'?: string[];
471
- engine: AgentEngine;
472
- 'training.url'?: string | null;
473
- 'training.status'?: 'idle' | 'training' | 'completed' | 'failed' | null;
474
- 'training.recrawlInterval'?: number | null;
475
- 'email_provider'?: EmailProvider | null;
476
- };
477
- //#endregion
478
499
  //#region src/contact/types.d.ts
479
500
  type Contact = {
480
501
  id: string;
@@ -491,8 +512,13 @@ type Contact = {
491
512
  notes: string | null;
492
513
  tags: string[] | null;
493
514
  userId: string | null;
515
+ locale?: string | null;
494
516
  props?: Record<string, string> | null;
495
517
  };
518
+ type ContactActivityAuthor = {
519
+ name: string;
520
+ imageUrl: string | null;
521
+ };
496
522
  type ContactActivity = {
497
523
  id: string;
498
524
  type: 'note' | 'call' | 'meeting' | 'email' | 'task' | 'update' | 'custom';
@@ -500,6 +526,7 @@ type ContactActivity = {
500
526
  meta: Record<string, any> | null;
501
527
  agentName: string | null;
502
528
  createdAt: string;
529
+ author?: ContactActivityAuthor | null;
503
530
  };
504
531
  type ContactFormData = {
505
532
  name?: string;
@@ -513,6 +540,7 @@ type ContactFormData = {
513
540
  socials?: Record<string, string> | null;
514
541
  notes?: string | null;
515
542
  tags?: string[] | null;
543
+ locale?: string | null;
516
544
  props?: Record<string, string> | null;
517
545
  }; //#endregion
518
546
  //#region src/contract/types.d.ts
@@ -655,11 +683,11 @@ type Reminder = {
655
683
  type Service = {
656
684
  id: string;
657
685
  slug: string;
658
- name: string;
686
+ name: TranslatableValue;
659
687
  price: number;
660
688
  durationMinutes: number;
661
689
  category: string | null;
662
- description: string | null;
690
+ description: TranslatableValue | null;
663
691
  active: boolean;
664
692
  digital: boolean;
665
693
  public: boolean;
@@ -703,32 +731,20 @@ type BrandSiteConfig = {
703
731
  };
704
732
  //#endregion
705
733
  //#region src/link/types.d.ts
706
- declare const LINK_TYPES: readonly ["short", "qr", "nfc"];
707
- type LinkTypeName = (typeof LINK_TYPES)[number];
708
734
  type Link = {
709
735
  id: string;
710
- slug: string;
711
736
  url: string;
712
737
  shortUrl: string;
713
- type: LinkTypeName;
714
738
  status: 'active' | 'paused' | 'expired';
715
739
  title: string | null;
716
740
  scanCount: number;
717
- maxScans: number | null;
718
- startsAt: string | null;
719
- expiresAt: string | null;
741
+ lastScannedAt: string | null;
720
742
  createdAt: string;
721
743
  updatedAt: string;
722
744
  };
723
745
  type LinkCreatePayload = {
724
746
  url: string;
725
- type: LinkTypeName;
726
- title?: string;
727
- slug?: string;
728
- maxScans?: number;
729
- startsAt?: string;
730
- expiresAt?: string;
731
- status?: 'active' | 'paused' | 'expired';
747
+ title: string;
732
748
  };
733
749
  type LinkUpdatePayload = Partial<LinkCreatePayload>; //#endregion
734
750
  //#region src/store/types.d.ts
@@ -980,7 +996,41 @@ declare class MemoriesResource {
980
996
  delete(id: string): Promise<IAppResponse<unknown>>;
981
997
  }
982
998
  //#endregion
999
+ //#region src/resources/orders.d.ts
1000
+ type OrderItem = {
1001
+ id: string;
1002
+ type: 'product' | 'service';
1003
+ quantity: number;
1004
+ };
1005
+ type Order = {
1006
+ id: string;
1007
+ total: number;
1008
+ status: string;
1009
+ paymentUrl: string | null;
1010
+ invoiceUrl: string | null;
1011
+ };
1012
+ declare class OrdersResource {
1013
+ private readonly http;
1014
+ constructor(http: IHttpService);
1015
+ create(data: {
1016
+ contactId: string;
1017
+ items: OrderItem[];
1018
+ }): Promise<IAppResponse<Order>>;
1019
+ }
1020
+ //#endregion
983
1021
  //#region src/resources/products.d.ts
1022
+ type ProductVariation = {
1023
+ id: string;
1024
+ sku: string;
1025
+ name: string;
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
+ };
984
1034
  type ProductItem = {
985
1035
  id: string;
986
1036
  slug: string;
@@ -990,6 +1040,10 @@ type ProductItem = {
990
1040
  tags: string[];
991
1041
  description: string;
992
1042
  active: boolean;
1043
+ createdAt?: string;
1044
+ updatedAt?: string;
1045
+ variations?: ProductVariation[];
1046
+ settings?: Record<string, unknown> | null;
993
1047
  };
994
1048
  declare class ProductsResource {
995
1049
  private readonly http;
@@ -1090,7 +1144,7 @@ declare class UpdatesResource {
1090
1144
  data: Update[];
1091
1145
  }>>;
1092
1146
  create(payload: UpdateCreatePayload): Promise<IAppResponse<Update>>;
1093
- update(id: string, payload: UpdateUpdatePayload): any;
1147
+ update(id: string, payload: UpdateUpdatePayload): Promise<IAppResponse<Update>>;
1094
1148
  delete(id: string): Promise<IAppResponse<unknown>>;
1095
1149
  }
1096
1150
  //#endregion
@@ -1105,7 +1159,7 @@ declare class LinksResource {
1105
1159
  data: Link[];
1106
1160
  }>>;
1107
1161
  create(payload: LinkCreatePayload): Promise<IAppResponse<Link>>;
1108
- update(id: string, payload: LinkUpdatePayload): any;
1162
+ update(id: string, payload: LinkUpdatePayload): Promise<IAppResponse<Link>>;
1109
1163
  delete(id: string): Promise<IAppResponse<unknown>>;
1110
1164
  }
1111
1165
  //#endregion
@@ -1134,6 +1188,19 @@ declare class WarpsResource {
1134
1188
  id: string;
1135
1189
  }>>;
1136
1190
  destroy(identifier: string): Promise<IAppResponse<unknown>>;
1191
+ execute(identifier: string, inputs: Record<string, any>): Promise<IAppResponse<any>>;
1192
+ }
1193
+ //#endregion
1194
+ //#region src/resources/subscriptions.d.ts
1195
+ declare class SubscriptionsResource {
1196
+ private readonly http;
1197
+ constructor(http: IHttpService);
1198
+ list(team: string): Promise<IAppResponse<{
1199
+ data: AppSubscription[];
1200
+ }>>;
1201
+ get(id: string): Promise<IAppResponse<AppSubscription>>;
1202
+ cancel(id: string): Promise<IAppResponse<AppSubscription>>;
1203
+ resume(id: string): Promise<IAppResponse<AppSubscription>>;
1137
1204
  }
1138
1205
  //#endregion
1139
1206
  //#region src/cache/types.d.ts
@@ -1169,6 +1236,7 @@ declare class JoAiClient {
1169
1236
  readonly memories: MemoriesResource;
1170
1237
  readonly goals: GoalsResource;
1171
1238
  readonly reminders: RemindersResource;
1239
+ readonly orders: OrdersResource;
1172
1240
  readonly products: ProductsResource;
1173
1241
  readonly sites: SitesResource;
1174
1242
  readonly documents: DocumentsResource;
@@ -1177,6 +1245,7 @@ declare class JoAiClient {
1177
1245
  readonly updates: UpdatesResource;
1178
1246
  readonly links: LinksResource;
1179
1247
  readonly privateWarps: WarpsResource;
1248
+ readonly subscriptions: SubscriptionsResource;
1180
1249
  constructor(config: JoAiClientConfig);
1181
1250
  clearCache(): void;
1182
1251
  warps(locale?: WarpLocale): WarpClient;
@@ -1202,6 +1271,7 @@ declare class CachedHttpService implements IHttpService {
1202
1271
  get<T>(url: string, options?: IRequestOptions): Promise<IAppResponse<T>>;
1203
1272
  post<T>(url: string, data?: any, options?: IRequestOptions): Promise<IAppResponse<T>>;
1204
1273
  put<T>(url: string, data?: any, options?: IRequestOptions): Promise<IAppResponse<T>>;
1274
+ patch<T>(url: string, data?: any, options?: IRequestOptions): Promise<IAppResponse<T>>;
1205
1275
  delete<T>(url: string, options?: IRequestOptions): Promise<IAppResponse<T>>;
1206
1276
  }
1207
1277
  //#endregion
@@ -1211,4 +1281,4 @@ declare class DistributionResource {
1211
1281
  private fetchDistribution;
1212
1282
  }
1213
1283
  //#endregion
1214
- export { BlueprintsResource, type CacheConfig, CachedHttpService, DistributionResource, FlowsResource, IngestionsResource, JoAiClient, type JoAiClientConfig, MarketplaceResource, MeetingsResource, type ProductItem, ProductsResource, ServicesResource, SitesResource, SkillsResource, StoresResource, createClient };
1284
+ 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 };
package/dist/index.mjs CHANGED
@@ -12,6 +12,7 @@ var HttpService = class {
12
12
  this.get = async (url, options) => await this.request("GET", url, void 0, options);
13
13
  this.post = async (url, data, options) => await this.request("POST", url, data, options);
14
14
  this.put = async (url, data, options) => await this.request("PUT", url, data, options);
15
+ this.patch = async (url, data, options) => await this.request("PATCH", url, data, options);
15
16
  this.delete = async (url, options) => await this.request("DELETE", url, void 0, options);
16
17
  this.getCsrfToken = () => {
17
18
  if (typeof document === "undefined") return null;
@@ -393,6 +394,16 @@ var MemoriesResource = class {
393
394
  }
394
395
  };
395
396
  //#endregion
397
+ //#region src/resources/orders.ts
398
+ var OrdersResource = class {
399
+ constructor(http) {
400
+ this.http = http;
401
+ }
402
+ create(data) {
403
+ return this.http.post("orders", data);
404
+ }
405
+ };
406
+ //#endregion
396
407
  //#region src/resources/products.ts
397
408
  var ProductsResource = class {
398
409
  constructor(http) {
@@ -578,6 +589,28 @@ var WarpsResource = class {
578
589
  destroy(identifier) {
579
590
  return this.http.delete(`warps/${identifier}`);
580
591
  }
592
+ execute(identifier, inputs) {
593
+ return this.http.post(`warps/${identifier}/execute`, { inputs });
594
+ }
595
+ };
596
+ //#endregion
597
+ //#region src/resources/subscriptions.ts
598
+ var SubscriptionsResource = class {
599
+ constructor(http) {
600
+ this.http = http;
601
+ }
602
+ list(team) {
603
+ return this.http.get(`subscriptions?team=${encodeURIComponent(team)}`);
604
+ }
605
+ get(id) {
606
+ return this.http.get(`subscriptions/${id}`);
607
+ }
608
+ cancel(id) {
609
+ return this.http.post(`subscriptions/${id}/cancel`);
610
+ }
611
+ resume(id) {
612
+ return this.http.post(`subscriptions/${id}/resume`);
613
+ }
581
614
  };
582
615
  //#endregion
583
616
  //#region src/cache/memory-cache.ts
@@ -674,6 +707,11 @@ var CachedHttpService = class {
674
707
  this.cache.bust(getUrlPrefix(url));
675
708
  return response;
676
709
  }
710
+ async patch(url, data, options) {
711
+ const response = await this.inner.patch(url, data, options);
712
+ this.cache.bust(getUrlPrefix(url));
713
+ return response;
714
+ }
677
715
  async delete(url, options) {
678
716
  const response = await this.inner.delete(url, options);
679
717
  this.cache.bust(getUrlPrefix(url));
@@ -716,9 +754,11 @@ var JoAiClient = class {
716
754
  this.meetings = new MeetingsResource(this.http);
717
755
  this.stores = new StoresResource(this.http);
718
756
  this.products = new ProductsResource(this.http);
757
+ this.orders = new OrdersResource(this.http);
719
758
  this.updates = new UpdatesResource(this.http);
720
759
  this.links = new LinksResource(this.http);
721
760
  this.privateWarps = new WarpsResource(this.http);
761
+ this.subscriptions = new SubscriptionsResource(this.http);
722
762
  }
723
763
  clearCache() {
724
764
  if (this.http instanceof CachedHttpService) this.http.clearCache();
@@ -762,4 +802,4 @@ var DistributionResource = class {
762
802
  }
763
803
  };
764
804
  //#endregion
765
- export { BlueprintsResource, CachedHttpService, DistributionResource, FlowsResource, IngestionsResource, JoAiClient, MarketplaceResource, MeetingsResource, ProductsResource, ServicesResource, SitesResource, SkillsResource, StoresResource, createClient };
805
+ export { BlueprintsResource, CachedHttpService, DistributionResource, FlowsResource, IngestionsResource, JoAiClient, MarketplaceResource, MeetingsResource, OrdersResource, 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.8.1",
3
+ "version": "0.9.1",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",