@joai/sdk 0.14.0 → 0.15.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
@@ -118,6 +118,9 @@ type MediaLibraryAttributes = {
118
118
  extension?: string;
119
119
  size?: number;
120
120
  };
121
+ type MediaLibraryItems = {
122
+ [uuid: string]: MediaLibraryAttributes;
123
+ };
121
124
  type MediaMime = 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp' | 'video/mp4' | 'video/webm' | 'video/quicktime' | 'video/x-msvideo' | 'audio/mpeg' | 'audio/mp3' | 'audio/ogg' | 'audio/wav' | 'audio/webm' | 'audio/aac' | 'audio/m4a' | 'audio/m4b' | 'audio/m4p' | 'audio/m4v' | 'application/pdf' | 'application/json';
122
125
  type Media = {
123
126
  id: string;
@@ -285,6 +288,9 @@ type Coupon = {
285
288
  percent: number;
286
289
  expiresAt: string | null;
287
290
  };
291
+ //#endregion
292
+ //#region src/team/types.d.ts
293
+ type TeamFeature = 'shop' | 'appointments';
288
294
  type Team = {
289
295
  slug: string;
290
296
  name: string;
@@ -293,6 +299,8 @@ type Team = {
293
299
  locale: WarpLocale;
294
300
  timezone: string;
295
301
  settings?: TeamSettings;
302
+ features?: TeamFeature[];
303
+ cover?: string | null;
296
304
  logo: string | null;
297
305
  tagline?: TranslatableValue | null;
298
306
  public: boolean;
@@ -339,6 +347,7 @@ type TeamSettings = {
339
347
  'board.auto.enabled'?: boolean;
340
348
  'payments.online'?: boolean;
341
349
  'payments.coupons'?: boolean;
350
+ 'stock.enabled'?: boolean;
342
351
  'branding'?: TeamBrand | null;
343
352
  };
344
353
  //#endregion
@@ -679,7 +688,6 @@ type Service = {
679
688
  price: number;
680
689
  durationMinutes: number;
681
690
  tags?: string[] | null;
682
- category: string | null;
683
691
  description: TranslatableValue | null;
684
692
  active: boolean;
685
693
  digital: boolean;
@@ -720,17 +728,7 @@ type AppointmentPolicy = {
720
728
  holidays: string[] | null;
721
729
  conferenceEnabled: boolean | null;
722
730
  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[];
731
+ paymentEnabled?: boolean | null;
734
732
  };
735
733
  type AppointmentBooking = {
736
734
  id: string;
@@ -1056,6 +1054,7 @@ type Update = {
1056
1054
  title: string;
1057
1055
  body: string | null;
1058
1056
  imageUrl: string | null;
1057
+ media: Media[];
1059
1058
  linkUrl: string | null;
1060
1059
  startsAt: string | null;
1061
1060
  endsAt: string | null;
@@ -1067,20 +1066,33 @@ type UpdateCreatePayload = {
1067
1066
  type: UpdateType;
1068
1067
  body?: string;
1069
1068
  imageUrl?: string;
1069
+ media?: MediaLibraryItems;
1070
1070
  linkUrl?: string;
1071
1071
  startsAt?: string;
1072
1072
  endsAt?: string;
1073
1073
  status?: UpdateStatus;
1074
1074
  };
1075
- type UpdateUpdatePayload = Partial<UpdateCreatePayload>; //#endregion
1075
+ type UpdateUpdatePayload = Partial<UpdateCreatePayload>;
1076
+ type UpdateStats = {
1077
+ totalUpdates: number;
1078
+ activeUpdates: number;
1079
+ dealsCount: number;
1080
+ eventsCount: number;
1081
+ newsCount: number;
1082
+ publishedCount: number;
1083
+ draftCount: number;
1084
+ archivedCount: number;
1085
+ creationHistory: number[];
1086
+ }; //#endregion
1076
1087
  //#region src/swarm/types.d.ts
1077
1088
  //#endregion
1078
1089
  //#region src/resources/appointments.d.ts
1079
1090
  declare class AppointmentsResource {
1080
1091
  private readonly http;
1081
- constructor(http: IHttpService);
1082
- getBookingPolicy(agentUuid: string): Promise<IAppResponse<AppointmentBookingContext>>;
1083
- upsertPolicy(agentUuid: string, data: Partial<AppointmentPolicy>): Promise<IAppResponse<AppointmentPolicy>>;
1092
+ private readonly config;
1093
+ constructor(http: IHttpService, config: JoAiClientConfig);
1094
+ getPolicy(): Promise<IAppResponse<AppointmentPolicy>>;
1095
+ upsertPolicy(data: Partial<AppointmentPolicy>): Promise<IAppResponse<AppointmentPolicy>>;
1084
1096
  checkAvailability(agentUuid: string, params: {
1085
1097
  windowStart: string;
1086
1098
  windowEnd: string;
@@ -1207,6 +1219,9 @@ declare class CartsResource {
1207
1219
  remove(type: 'product' | 'service', id: string): Promise<IAppResponse<Cart>>;
1208
1220
  updateQuantity(type: 'product' | 'service', id: string, quantity: number): Promise<IAppResponse<Cart>>;
1209
1221
  clear(): Promise<IAppResponse<Cart>>;
1222
+ applyCoupon(code: string): Promise<IAppResponse<{
1223
+ ok: boolean;
1224
+ }>>;
1210
1225
  }
1211
1226
  //#endregion
1212
1227
  //#region src/resources/flows.d.ts
@@ -1512,6 +1527,7 @@ declare class UpdatesResource {
1512
1527
  create(payload: UpdateCreatePayload): Promise<IAppResponse<Update>>;
1513
1528
  update(id: string, payload: UpdateUpdatePayload): Promise<IAppResponse<Update>>;
1514
1529
  delete(id: string): Promise<IAppResponse<unknown>>;
1530
+ stats(): Promise<IAppResponse<UpdateStats>>;
1515
1531
  }
1516
1532
  //#endregion
1517
1533
  //#region src/resources/links.d.ts
@@ -1531,6 +1547,7 @@ declare class LinksResource {
1531
1547
  //#endregion
1532
1548
  //#region src/resources/warps.d.ts
1533
1549
  type BackendWarpBrand = {
1550
+ slug: string;
1534
1551
  name: string;
1535
1552
  description?: WarpText | null;
1536
1553
  logo?: string | null;
package/dist/index.mjs CHANGED
@@ -112,14 +112,15 @@ var HttpService = class {
112
112
  //#endregion
113
113
  //#region src/resources/appointments.ts
114
114
  var AppointmentsResource = class {
115
- constructor(http) {
115
+ constructor(http, config) {
116
116
  this.http = http;
117
+ this.config = config;
117
118
  }
118
- getBookingPolicy(agentUuid) {
119
- return this.http.get(`agents/${agentUuid}/appointments/policy`);
119
+ getPolicy() {
120
+ return this.http.get(`teams/${this.config.team}/appointments/policy`);
120
121
  }
121
- upsertPolicy(agentUuid, data) {
122
- return this.http.put(`agents/${agentUuid}/appointments/policy`, data);
122
+ upsertPolicy(data) {
123
+ return this.http.put(`teams/${this.config.team}/appointments/policy`, data);
123
124
  }
124
125
  checkAvailability(agentUuid, params) {
125
126
  return this.http.post(`agents/${agentUuid}/appointments/availability`, params);
@@ -203,10 +204,10 @@ var CartsResource = class {
203
204
  this.http = http;
204
205
  }
205
206
  get() {
206
- return this.http.get("cart");
207
+ return this.http.get("v1/cart");
207
208
  }
208
209
  add(type, id, quantity = 1, configuration) {
209
- return this.http.post("cart/add", {
210
+ return this.http.post("v1/cart/add", {
210
211
  id,
211
212
  type,
212
213
  quantity,
@@ -214,20 +215,23 @@ var CartsResource = class {
214
215
  });
215
216
  }
216
217
  remove(type, id) {
217
- return this.http.post("cart/remove", {
218
+ return this.http.post("v1/cart/remove", {
218
219
  id,
219
220
  type
220
221
  });
221
222
  }
222
223
  updateQuantity(type, id, quantity) {
223
- return this.http.post("cart/quantity", {
224
+ return this.http.post("v1/cart/quantity", {
224
225
  id,
225
226
  type,
226
227
  quantity
227
228
  });
228
229
  }
229
230
  clear() {
230
- return this.http.post("cart/clear");
231
+ return this.http.post("v1/cart/clear");
232
+ }
233
+ applyCoupon(code) {
234
+ return this.http.post("v1/cart/coupon", { code });
231
235
  }
232
236
  };
233
237
  //#endregion
@@ -662,6 +666,9 @@ var UpdatesResource = class {
662
666
  delete(id) {
663
667
  return this.http.delete(`updates/${id}`);
664
668
  }
669
+ stats() {
670
+ return this.http.get("updates/stats");
671
+ }
665
672
  };
666
673
  //#endregion
667
674
  //#region src/resources/links.ts
@@ -856,7 +863,7 @@ var JoAiClient = class {
856
863
  const http = new HttpService(`${getApiBaseUrl(config.env ?? "mainnet")}/v1`, void 0, config.apiToken, { headers });
857
864
  const cache = config.cache;
858
865
  this.http = cache?.enabled !== false ? new CachedHttpService(http, cache?.overrides, cache?.defaultTtl) : http;
859
- this.appointments = new AppointmentsResource(this.http);
866
+ this.appointments = new AppointmentsResource(this.http, config);
860
867
  this.hub = new HubResource(this.http);
861
868
  this.teams = new TeamsResource(this.http);
862
869
  this.agents = new AgentsResource(this.http);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",