@joai/sdk 0.12.0 → 0.13.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
@@ -228,6 +228,40 @@ type Product = {
228
228
  settings?: Record<string, unknown> | null;
229
229
  volumePrices?: VolumePrice[];
230
230
  };
231
+ type OrderItem = {
232
+ id: string;
233
+ name: string;
234
+ quantity: number;
235
+ unitPrice: number;
236
+ type: 'product-variation' | 'service';
237
+ };
238
+ type CartItem = {
239
+ id: string;
240
+ name: TranslatableValue;
241
+ price: number;
242
+ quantity: number;
243
+ type: 'service' | 'product';
244
+ sku: string | null;
245
+ badge: string | null;
246
+ media: Media[];
247
+ };
248
+ type Cart = {
249
+ subtotal: number;
250
+ taxes: {
251
+ amount: number;
252
+ percent: number;
253
+ };
254
+ total: number;
255
+ items: CartItem[];
256
+ coupon: Coupon | null;
257
+ couponDiscount: number;
258
+ };
259
+ type Coupon = {
260
+ code: string;
261
+ amount: number;
262
+ percent: number;
263
+ expiresAt: string | null;
264
+ };
231
265
  type Team = {
232
266
  slug: string;
233
267
  name: string;
@@ -570,6 +604,62 @@ type BlueprintShortcut = {
570
604
  }; //#endregion
571
605
  //#region src/helpers/string.d.ts
572
606
  //#endregion
607
+ //#region src/appointment/types.d.ts
608
+ type AppointmentSlot = {
609
+ start: string;
610
+ end: string;
611
+ label?: string;
612
+ };
613
+ type AppointmentAvailability = {
614
+ connected: boolean;
615
+ timezone: string;
616
+ service: string | null;
617
+ slots: AppointmentSlot[];
618
+ };
619
+ type AppointmentPolicy = {
620
+ timezone: string | null;
621
+ availability: Record<string, {
622
+ start: string;
623
+ end: string;
624
+ }[]> | null;
625
+ minNoticeMinutes: number | null;
626
+ bufferMinutes: number | null;
627
+ maxDaysAhead: number | null;
628
+ slotIntervalMinutes: number | null;
629
+ blockedDates: string[] | null;
630
+ holidays: string[] | null;
631
+ conferenceEnabled: boolean | null;
632
+ };
633
+ type AppointmentBooking = {
634
+ id: string;
635
+ name: string;
636
+ scheduledAt: string;
637
+ scheduledEndAt: string;
638
+ timezone: string | null;
639
+ conferenceUrl: string | null;
640
+ conferenceProvider: string | null;
641
+ status: string;
642
+ attendeeEmail: string | null;
643
+ attendeeName: string | null;
644
+ };
645
+ type AppointmentRequest = {
646
+ id: string;
647
+ title: string;
648
+ requesterName: string | null;
649
+ requesterEmail: string | null;
650
+ timezone: string | null;
651
+ durationMinutes: number | null;
652
+ notes: string | null;
653
+ status: string;
654
+ failureReason: string | null;
655
+ preferredWindows: {
656
+ start: string;
657
+ end: string;
658
+ }[] | null;
659
+ createdAt: string;
660
+ }; //#endregion
661
+ //#region src/budget/types.d.ts
662
+ //#endregion
573
663
  //#region src/contact/types.d.ts
574
664
  type Contact = {
575
665
  id: string;
@@ -812,6 +902,8 @@ type Link = {
812
902
  status: 'active' | 'paused' | 'expired';
813
903
  title: string | null;
814
904
  scanCount: number;
905
+ scanHistory: number[];
906
+ scanGeography: Record<string, number>;
815
907
  lastScannedAt: string | null;
816
908
  createdAt: string;
817
909
  updatedAt: string;
@@ -894,6 +986,65 @@ type UpdateCreatePayload = {
894
986
  type UpdateUpdatePayload = Partial<UpdateCreatePayload>; //#endregion
895
987
  //#region src/swarm/types.d.ts
896
988
  //#endregion
989
+ //#region src/resources/appointments.d.ts
990
+ declare class AppointmentsResource {
991
+ private readonly http;
992
+ constructor(http: IHttpService);
993
+ getPolicy(agentUuid: string): Promise<IAppResponse<AppointmentPolicy>>;
994
+ upsertPolicy(agentUuid: string, data: Partial<AppointmentPolicy>): Promise<IAppResponse<AppointmentPolicy>>;
995
+ checkAvailability(agentUuid: string, params: {
996
+ windowStart: string;
997
+ windowEnd: string;
998
+ durationMinutes: number;
999
+ timezone?: string;
1000
+ limit?: number;
1001
+ serviceSlug?: string;
1002
+ }): Promise<IAppResponse<AppointmentAvailability>>;
1003
+ book(agentUuid: string, data: {
1004
+ title: string;
1005
+ scheduledAt: string;
1006
+ description?: string;
1007
+ conferenceProvider?: string;
1008
+ timezone?: string;
1009
+ attendeeEmail?: string;
1010
+ attendeeName?: string;
1011
+ attendees?: {
1012
+ email: string;
1013
+ name?: string;
1014
+ }[];
1015
+ serviceSlug?: string;
1016
+ appointmentRequestId?: string;
1017
+ }): Promise<IAppResponse<AppointmentBooking>>;
1018
+ reschedule(agentUuid: string, meetingId: string, data: {
1019
+ scheduledAt: string;
1020
+ timezone?: string;
1021
+ }): Promise<IAppResponse<AppointmentBooking>>;
1022
+ cancel(agentUuid: string, meetingId: string, data?: {
1023
+ reason?: string;
1024
+ }): Promise<IAppResponse<AppointmentBooking>>;
1025
+ listRequests(agentUuid: string): Promise<IAppResponse<AppointmentRequest[]>>;
1026
+ createRequest(agentUuid: string, data: {
1027
+ title: string;
1028
+ requesterName?: string;
1029
+ requesterEmail?: string;
1030
+ timezone?: string;
1031
+ durationMinutes?: number;
1032
+ notes?: string;
1033
+ windowStart?: string;
1034
+ windowEnd?: string;
1035
+ preferredWindows?: {
1036
+ start: string;
1037
+ end: string;
1038
+ }[];
1039
+ serviceSlug?: string;
1040
+ }): Promise<IAppResponse<AppointmentRequest>>;
1041
+ updateRequest(agentUuid: string, requestId: string, data: {
1042
+ status?: string;
1043
+ notes?: string;
1044
+ failureReason?: string;
1045
+ }): Promise<IAppResponse<AppointmentRequest>>;
1046
+ }
1047
+ //#endregion
897
1048
  //#region src/resources/agents.d.ts
898
1049
  declare class AgentsResource {
899
1050
  private readonly http;
@@ -906,6 +1057,46 @@ declare class AgentsResource {
906
1057
  }): Promise<IAppResponse<unknown>>;
907
1058
  }
908
1059
  //#endregion
1060
+ //#region src/resources/auth.d.ts
1061
+ type AuthSendCodeRequest = {
1062
+ name: string;
1063
+ phone?: string;
1064
+ email?: string;
1065
+ team?: string;
1066
+ table?: string;
1067
+ };
1068
+ type AuthVerifyResponse = {
1069
+ user: {
1070
+ id: string;
1071
+ name: string;
1072
+ phone: string | null;
1073
+ email: string | null;
1074
+ };
1075
+ team: {
1076
+ slug: string;
1077
+ name: string;
1078
+ } | null;
1079
+ contact: {
1080
+ id: string;
1081
+ name: string;
1082
+ phone: string | null;
1083
+ email: string | null;
1084
+ } | null;
1085
+ table: string | null;
1086
+ };
1087
+ declare class AuthResource {
1088
+ private http;
1089
+ constructor(http: IHttpService);
1090
+ sendCode(data: AuthSendCodeRequest): Promise<IAppResponse<void>>;
1091
+ verify(token: string): Promise<IAppResponse<AuthVerifyResponse>>;
1092
+ me(): Promise<IAppResponse<{
1093
+ id: string;
1094
+ name: string;
1095
+ phone: string | null;
1096
+ email: string | null;
1097
+ }>>;
1098
+ }
1099
+ //#endregion
909
1100
  //#region src/resources/blueprints.d.ts
910
1101
  declare class BlueprintsResource {
911
1102
  private readonly http;
@@ -917,6 +1108,17 @@ declare class BlueprintsResource {
917
1108
  get(slug: string, locale?: string): Promise<IAppResponse<Blueprint>>;
918
1109
  }
919
1110
  //#endregion
1111
+ //#region src/resources/carts.d.ts
1112
+ declare class CartsResource {
1113
+ private readonly http;
1114
+ constructor(http: IHttpService);
1115
+ 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>>;
1119
+ clear(): Promise<IAppResponse<Cart>>;
1120
+ }
1121
+ //#endregion
920
1122
  //#region src/resources/flows.d.ts
921
1123
  declare class FlowsResource {
922
1124
  private readonly http;
@@ -1077,13 +1279,20 @@ type Order = {
1077
1279
  status: string;
1078
1280
  paymentUrl: string | null;
1079
1281
  invoiceUrl: string | null;
1282
+ createdAt: string;
1283
+ items: OrderItem[];
1284
+ contactId: string | null;
1080
1285
  };
1081
1286
  declare class OrdersResource {
1082
1287
  private readonly http;
1083
1288
  constructor(http: IHttpService);
1289
+ list(team: string): Promise<IAppResponse<Order[]>>;
1290
+ get(id: string): Promise<IAppResponse<Order>>;
1084
1291
  create(data: {
1085
- contactId: string;
1292
+ contactId?: string;
1086
1293
  notes?: string;
1294
+ team: string;
1295
+ fresh?: boolean;
1087
1296
  items: {
1088
1297
  id: string;
1089
1298
  type: 'product' | 'service';
@@ -1096,7 +1305,7 @@ declare class OrdersResource {
1096
1305
  declare class ProductsResource {
1097
1306
  private readonly http;
1098
1307
  constructor(http: IHttpService);
1099
- list(): Promise<IAppResponse<Product[]>>;
1308
+ list(team?: string): Promise<IAppResponse<Product[]>>;
1100
1309
  get(id: string): Promise<IAppResponse<Product>>;
1101
1310
  create(data: {
1102
1311
  name: TranslatableValue;
@@ -1212,23 +1421,24 @@ declare class LinksResource {
1212
1421
  }
1213
1422
  //#endregion
1214
1423
  //#region src/resources/warps.d.ts
1215
- type WarpResponseData = {
1424
+ type BackendWarpBrand = {
1425
+ name: string;
1426
+ description?: WarpText | null;
1427
+ logo?: string | null;
1428
+ };
1429
+ type BackendWarp = {
1216
1430
  id: string;
1217
1431
  title: string;
1218
1432
  url: string;
1219
1433
  definition: Record<string, any>;
1220
- brand: {
1221
- name: string;
1222
- description?: string;
1223
- logo?: string | null;
1224
- } | null;
1434
+ brand: BackendWarpBrand | null;
1225
1435
  agent?: AgentPrivate | null;
1226
1436
  };
1227
1437
  declare class WarpsResource {
1228
1438
  private readonly http;
1229
1439
  constructor(http: IHttpService);
1230
- list(brand?: string): Promise<IAppResponse<WarpResponseData[]>>;
1231
- show(identifier: string): Promise<IAppResponse<WarpResponseData>>;
1440
+ list(brand?: string): Promise<IAppResponse<BackendWarp[]>>;
1441
+ show(identifier: string): Promise<IAppResponse<BackendWarp>>;
1232
1442
  create(data: {
1233
1443
  brand: string;
1234
1444
  definition: Record<string, any>;
@@ -1280,6 +1490,7 @@ interface JoAiClientConfig {
1280
1490
  declare class JoAiClient {
1281
1491
  readonly http: IHttpService;
1282
1492
  private readonly env;
1493
+ readonly appointments: AppointmentsResource;
1283
1494
  readonly hub: HubResource;
1284
1495
  readonly teams: TeamsResource;
1285
1496
  readonly agents: AgentsResource;
@@ -1305,6 +1516,8 @@ declare class JoAiClient {
1305
1516
  readonly links: LinksResource;
1306
1517
  readonly privateWarps: WarpsResource;
1307
1518
  readonly subscriptions: SubscriptionsResource;
1519
+ readonly cart: CartsResource;
1520
+ readonly auth: AuthResource;
1308
1521
  constructor(config: JoAiClientConfig);
1309
1522
  clearCache(): void;
1310
1523
  warps(locale?: WarpLocale): WarpClient;
@@ -1340,4 +1553,4 @@ declare class DistributionResource {
1340
1553
  private fetchDistribution;
1341
1554
  }
1342
1555
  //#endregion
1343
- export { BlueprintsResource, type CacheConfig, CachedHttpService, DistributionResource, FlowsResource, IngestionsResource, JoAiClient, type JoAiClientConfig, MarketplaceResource, MeetingsResource, type Order, OrdersResource, type Product, type ProductVariation, ProductsResource, ServicesResource, SitesResource, SkillsResource, StoresResource, SubscriptionsResource, createClient };
1556
+ export { AppointmentsResource, AuthResource, type AuthSendCodeRequest, type AuthVerifyResponse, type BackendWarp, type BackendWarpBrand, BlueprintsResource, type CacheConfig, CachedHttpService, CartsResource, DistributionResource, FlowsResource, IngestionsResource, JoAiClient, type JoAiClientConfig, MarketplaceResource, MeetingsResource, type Order, OrdersResource, type Product, type ProductVariation, ProductsResource, ServicesResource, SitesResource, SkillsResource, StoresResource, SubscriptionsResource, WarpsResource, createClient };
package/dist/index.mjs CHANGED
@@ -110,6 +110,40 @@ var HttpService = class {
110
110
  }
111
111
  };
112
112
  //#endregion
113
+ //#region src/resources/appointments.ts
114
+ var AppointmentsResource = class {
115
+ constructor(http) {
116
+ this.http = http;
117
+ }
118
+ getPolicy(agentUuid) {
119
+ return this.http.get(`agents/${agentUuid}/appointments/policy`);
120
+ }
121
+ upsertPolicy(agentUuid, data) {
122
+ return this.http.put(`agents/${agentUuid}/appointments/policy`, data);
123
+ }
124
+ checkAvailability(agentUuid, params) {
125
+ return this.http.post(`agents/${agentUuid}/appointments/availability`, params);
126
+ }
127
+ book(agentUuid, data) {
128
+ return this.http.post(`agents/${agentUuid}/appointments/book`, data);
129
+ }
130
+ reschedule(agentUuid, meetingId, data) {
131
+ return this.http.post(`agents/${agentUuid}/appointments/${meetingId}/reschedule`, data);
132
+ }
133
+ cancel(agentUuid, meetingId, data) {
134
+ return this.http.post(`agents/${agentUuid}/appointments/${meetingId}/cancel`, data ?? {});
135
+ }
136
+ listRequests(agentUuid) {
137
+ return this.http.get(`agents/${agentUuid}/appointment-requests`);
138
+ }
139
+ createRequest(agentUuid, data) {
140
+ return this.http.post(`agents/${agentUuid}/appointment-requests`, data);
141
+ }
142
+ updateRequest(agentUuid, requestId, data) {
143
+ return this.http.put(`agents/${agentUuid}/appointment-requests/${requestId}`, data);
144
+ }
145
+ };
146
+ //#endregion
113
147
  //#region src/resources/agents.ts
114
148
  var AgentsResource = class {
115
149
  constructor(http) {
@@ -127,6 +161,22 @@ var AgentsResource = class {
127
161
  }
128
162
  };
129
163
  //#endregion
164
+ //#region src/resources/auth.ts
165
+ var AuthResource = class {
166
+ constructor(http) {
167
+ this.http = http;
168
+ }
169
+ sendCode(data) {
170
+ return this.http.post("auth/send-code", data);
171
+ }
172
+ verify(token) {
173
+ return this.http.get("auth/verify?token=" + token);
174
+ }
175
+ me() {
176
+ return this.http.get("auth/me");
177
+ }
178
+ };
179
+ //#endregion
130
180
  //#region src/resources/blueprints.ts
131
181
  var BlueprintsResource = class {
132
182
  constructor(http) {
@@ -144,6 +194,34 @@ var BlueprintsResource = class {
144
194
  }
145
195
  };
146
196
  //#endregion
197
+ //#region src/resources/carts.ts
198
+ var CartsResource = class {
199
+ constructor(http) {
200
+ this.http = http;
201
+ }
202
+ get() {
203
+ return this.http.get("cart");
204
+ }
205
+ add(id, quantity = 1) {
206
+ return this.http.post("cart/add", {
207
+ id,
208
+ quantity
209
+ });
210
+ }
211
+ remove(id) {
212
+ return this.http.post("cart/remove", { id });
213
+ }
214
+ updateQuantity(id, quantity) {
215
+ return this.http.post("cart/quantity", {
216
+ id,
217
+ quantity
218
+ });
219
+ }
220
+ clear() {
221
+ return this.http.post("cart/clear");
222
+ }
223
+ };
224
+ //#endregion
147
225
  //#region src/resources/flows.ts
148
226
  var FlowsResource = class {
149
227
  constructor(http) {
@@ -399,8 +477,14 @@ var OrdersResource = class {
399
477
  constructor(http) {
400
478
  this.http = http;
401
479
  }
480
+ list(team) {
481
+ return this.http.get("orders", { headers: { "X-Team": team } });
482
+ }
483
+ get(id) {
484
+ return this.http.get(`orders/${id}`);
485
+ }
402
486
  create(data) {
403
- return this.http.post("orders", data);
487
+ return this.http.post("orders", data, { headers: { "X-Team": data.team } });
404
488
  }
405
489
  };
406
490
  //#endregion
@@ -409,8 +493,9 @@ var ProductsResource = class {
409
493
  constructor(http) {
410
494
  this.http = http;
411
495
  }
412
- list() {
413
- return this.http.get("products");
496
+ list(team) {
497
+ const url = team ? `products?team=${encodeURIComponent(team)}` : "products";
498
+ return this.http.get(url);
414
499
  }
415
500
  get(id) {
416
501
  return this.http.get(`products/${id}`);
@@ -740,6 +825,7 @@ var JoAiClient = class {
740
825
  const http = new HttpService(`${getApiBaseUrl(config.env ?? "mainnet")}/v1`, void 0, config.apiToken, { headers });
741
826
  const cache = config.cache;
742
827
  this.http = cache?.enabled !== false ? new CachedHttpService(http, cache?.overrides, cache?.defaultTtl) : http;
828
+ this.appointments = new AppointmentsResource(this.http);
743
829
  this.hub = new HubResource(this.http);
744
830
  this.teams = new TeamsResource(this.http);
745
831
  this.agents = new AgentsResource(this.http);
@@ -765,6 +851,8 @@ var JoAiClient = class {
765
851
  this.links = new LinksResource(this.http);
766
852
  this.privateWarps = new WarpsResource(this.http);
767
853
  this.subscriptions = new SubscriptionsResource(this.http);
854
+ this.cart = new CartsResource(this.http);
855
+ this.auth = new AuthResource(this.http);
768
856
  }
769
857
  clearCache() {
770
858
  if (this.http instanceof CachedHttpService) this.http.clearCache();
@@ -808,4 +896,4 @@ var DistributionResource = class {
808
896
  }
809
897
  };
810
898
  //#endregion
811
- export { BlueprintsResource, CachedHttpService, DistributionResource, FlowsResource, IngestionsResource, JoAiClient, MarketplaceResource, MeetingsResource, OrdersResource, ProductsResource, ServicesResource, SitesResource, SkillsResource, StoresResource, SubscriptionsResource, createClient };
899
+ export { AppointmentsResource, AuthResource, BlueprintsResource, CachedHttpService, CartsResource, DistributionResource, FlowsResource, IngestionsResource, JoAiClient, MarketplaceResource, MeetingsResource, OrdersResource, ProductsResource, ServicesResource, SitesResource, SkillsResource, StoresResource, SubscriptionsResource, WarpsResource, createClient };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",