@joai/sdk 0.11.1 → 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
@@ -180,8 +180,15 @@ type ProductRelation = {
180
180
  position: number;
181
181
  variations: ProductVariation[];
182
182
  };
183
+ type VolumePrice = {
184
+ id: number;
185
+ minQty: number;
186
+ maxQty: number | null;
187
+ unitPrice: number;
188
+ };
183
189
  type ProductVariation = {
184
190
  resource?: 'product-variation';
191
+ id?: string;
185
192
  sku: string;
186
193
  name: TranslatableValue;
187
194
  type?: ProductVariationType | null;
@@ -194,6 +201,7 @@ type ProductVariation = {
194
201
  active?: boolean;
195
202
  hidden?: boolean;
196
203
  availableAt?: string | null;
204
+ order?: number | null;
197
205
  pieces?: ProductPieces | null;
198
206
  discount?: ProductDiscount | null;
199
207
  product?: Product;
@@ -217,6 +225,42 @@ type Product = {
217
225
  variations: ProductVariation[];
218
226
  relatedProducts?: ProductRelation[];
219
227
  rating?: ProductRating;
228
+ settings?: Record<string, unknown> | null;
229
+ volumePrices?: VolumePrice[];
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;
220
264
  };
221
265
  type Team = {
222
266
  slug: string;
@@ -560,6 +604,62 @@ type BlueprintShortcut = {
560
604
  }; //#endregion
561
605
  //#region src/helpers/string.d.ts
562
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
563
663
  //#region src/contact/types.d.ts
564
664
  type Contact = {
565
665
  id: string;
@@ -802,6 +902,8 @@ type Link = {
802
902
  status: 'active' | 'paused' | 'expired';
803
903
  title: string | null;
804
904
  scanCount: number;
905
+ scanHistory: number[];
906
+ scanGeography: Record<string, number>;
805
907
  lastScannedAt: string | null;
806
908
  createdAt: string;
807
909
  updatedAt: string;
@@ -884,6 +986,65 @@ type UpdateCreatePayload = {
884
986
  type UpdateUpdatePayload = Partial<UpdateCreatePayload>; //#endregion
885
987
  //#region src/swarm/types.d.ts
886
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
887
1048
  //#region src/resources/agents.d.ts
888
1049
  declare class AgentsResource {
889
1050
  private readonly http;
@@ -896,6 +1057,46 @@ declare class AgentsResource {
896
1057
  }): Promise<IAppResponse<unknown>>;
897
1058
  }
898
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
899
1100
  //#region src/resources/blueprints.d.ts
900
1101
  declare class BlueprintsResource {
901
1102
  private readonly http;
@@ -907,6 +1108,17 @@ declare class BlueprintsResource {
907
1108
  get(slug: string, locale?: string): Promise<IAppResponse<Blueprint>>;
908
1109
  }
909
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
910
1122
  //#region src/resources/flows.d.ts
911
1123
  declare class FlowsResource {
912
1124
  private readonly http;
@@ -1061,25 +1273,31 @@ declare class MemoriesResource {
1061
1273
  }
1062
1274
  //#endregion
1063
1275
  //#region src/resources/orders.d.ts
1064
- type OrderItem = {
1065
- id: string;
1066
- type: 'product' | 'service';
1067
- quantity: number;
1068
- };
1069
1276
  type Order = {
1070
1277
  id: string;
1071
1278
  total: number;
1072
1279
  status: string;
1073
1280
  paymentUrl: string | null;
1074
1281
  invoiceUrl: string | null;
1282
+ createdAt: string;
1283
+ items: OrderItem[];
1284
+ contactId: string | null;
1075
1285
  };
1076
1286
  declare class OrdersResource {
1077
1287
  private readonly http;
1078
1288
  constructor(http: IHttpService);
1289
+ list(team: string): Promise<IAppResponse<Order[]>>;
1290
+ get(id: string): Promise<IAppResponse<Order>>;
1079
1291
  create(data: {
1080
- contactId: string;
1292
+ contactId?: string;
1081
1293
  notes?: string;
1082
- items: OrderItem[];
1294
+ team: string;
1295
+ fresh?: boolean;
1296
+ items: {
1297
+ id: string;
1298
+ type: 'product' | 'service';
1299
+ quantity: number;
1300
+ }[];
1083
1301
  }): Promise<IAppResponse<Order>>;
1084
1302
  }
1085
1303
  //#endregion
@@ -1087,7 +1305,7 @@ declare class OrdersResource {
1087
1305
  declare class ProductsResource {
1088
1306
  private readonly http;
1089
1307
  constructor(http: IHttpService);
1090
- list(): Promise<IAppResponse<Product[]>>;
1308
+ list(team?: string): Promise<IAppResponse<Product[]>>;
1091
1309
  get(id: string): Promise<IAppResponse<Product>>;
1092
1310
  create(data: {
1093
1311
  name: TranslatableValue;
@@ -1203,23 +1421,24 @@ declare class LinksResource {
1203
1421
  }
1204
1422
  //#endregion
1205
1423
  //#region src/resources/warps.d.ts
1206
- type WarpResponseData = {
1424
+ type BackendWarpBrand = {
1425
+ name: string;
1426
+ description?: WarpText | null;
1427
+ logo?: string | null;
1428
+ };
1429
+ type BackendWarp = {
1207
1430
  id: string;
1208
1431
  title: string;
1209
1432
  url: string;
1210
1433
  definition: Record<string, any>;
1211
- brand: {
1212
- name: string;
1213
- description?: string;
1214
- logo?: string | null;
1215
- } | null;
1434
+ brand: BackendWarpBrand | null;
1216
1435
  agent?: AgentPrivate | null;
1217
1436
  };
1218
1437
  declare class WarpsResource {
1219
1438
  private readonly http;
1220
1439
  constructor(http: IHttpService);
1221
- list(brand?: string): Promise<IAppResponse<WarpResponseData[]>>;
1222
- show(identifier: string): Promise<IAppResponse<WarpResponseData>>;
1440
+ list(brand?: string): Promise<IAppResponse<BackendWarp[]>>;
1441
+ show(identifier: string): Promise<IAppResponse<BackendWarp>>;
1223
1442
  create(data: {
1224
1443
  brand: string;
1225
1444
  definition: Record<string, any>;
@@ -1271,6 +1490,7 @@ interface JoAiClientConfig {
1271
1490
  declare class JoAiClient {
1272
1491
  readonly http: IHttpService;
1273
1492
  private readonly env;
1493
+ readonly appointments: AppointmentsResource;
1274
1494
  readonly hub: HubResource;
1275
1495
  readonly teams: TeamsResource;
1276
1496
  readonly agents: AgentsResource;
@@ -1296,6 +1516,8 @@ declare class JoAiClient {
1296
1516
  readonly links: LinksResource;
1297
1517
  readonly privateWarps: WarpsResource;
1298
1518
  readonly subscriptions: SubscriptionsResource;
1519
+ readonly cart: CartsResource;
1520
+ readonly auth: AuthResource;
1299
1521
  constructor(config: JoAiClientConfig);
1300
1522
  clearCache(): void;
1301
1523
  warps(locale?: WarpLocale): WarpClient;
@@ -1331,4 +1553,4 @@ declare class DistributionResource {
1331
1553
  private fetchDistribution;
1332
1554
  }
1333
1555
  //#endregion
1334
- 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 };
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.11.1",
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",