@joai/sdk 0.15.0 → 0.16.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
@@ -290,15 +290,34 @@ type Coupon = {
290
290
  };
291
291
  //#endregion
292
292
  //#region src/team/types.d.ts
293
+ type TeamCategory = 'general' | 'appointment' | 'restaurant' | 'service' | 'fitness' | 'beauty' | 'consultation';
293
294
  type TeamFeature = 'shop' | 'appointments';
295
+ type TeamMeta = {
296
+ 'extra.messages'?: number;
297
+ 'limit.spending'?: number | null;
298
+ 'currency'?: string;
299
+ 'extra.usage.enabled'?: boolean;
300
+ 'auto.reload.enabled'?: boolean;
301
+ 'auto.reload.threshold_cents'?: number | null;
302
+ 'auto.reload.amount_cents'?: number | null;
303
+ 'llm.provider'?: 'openai' | 'anthropic' | 'google' | 'xai' | null;
304
+ 'byok.providers'?: ByokProviders | null;
305
+ 'board.auto.enabled'?: boolean;
306
+ 'payments.online'?: boolean;
307
+ 'payments.coupons'?: boolean;
308
+ 'stock.enabled'?: boolean;
309
+ 'branding'?: TeamBrand | null;
310
+ settings: Record<string, unknown>;
311
+ };
294
312
  type Team = {
295
313
  slug: string;
296
314
  name: string;
297
315
  personal: boolean;
316
+ category?: TeamCategory;
298
317
  description: TranslatableValue | null;
299
318
  locale: WarpLocale;
300
319
  timezone: string;
301
- settings?: TeamSettings;
320
+ meta?: TeamMeta;
302
321
  features?: TeamFeature[];
303
322
  cover?: string | null;
304
323
  logo: string | null;
@@ -334,22 +353,6 @@ type ByokProviders = {
334
353
  xai?: ByokProviderConfig;
335
354
  klingai?: ByokProviderConfig;
336
355
  };
337
- type TeamSettings = {
338
- 'extra.messages': number;
339
- 'limit.spending': number | null;
340
- 'currency': string;
341
- 'extra.usage.enabled'?: boolean;
342
- 'auto.reload.enabled'?: boolean;
343
- 'auto.reload.threshold_cents'?: number | null;
344
- 'auto.reload.amount_cents'?: number | null;
345
- 'llm.provider'?: 'openai' | 'anthropic' | 'google' | 'xai' | null;
346
- 'byok.providers'?: ByokProviders | null;
347
- 'board.auto.enabled'?: boolean;
348
- 'payments.online'?: boolean;
349
- 'payments.coupons'?: boolean;
350
- 'stock.enabled'?: boolean;
351
- 'branding'?: TeamBrand | null;
352
- };
353
356
  //#endregion
354
357
  //#region src/flow/types.d.ts
355
358
  type FlowCategory = 'none' | 'defi' | 'nft' | 'social' | 'devtools' | 'productivity' | 'trading' | 'portfolio';
@@ -410,7 +413,7 @@ type Skill = {
410
413
  screenshots: string[];
411
414
  }; //#endregion
412
415
  //#region src/integration/types.d.ts
413
- type IntegrationType = 'none' | 'webhook' | 'api-token' | 'telegram' | 'slack' | 'whatsapp' | 'twilio' | 'n8n' | 'ai-nexus' | 'apple-health' | 'mcp' | 'x' | 'email' | 'calendar' | 'embed' | 'discord' | 'github' | 'sentry' | 'readwise';
416
+ type IntegrationType = 'none' | 'webhook' | 'api-token' | 'telegram' | 'slack' | 'whatsapp' | 'twilio' | 'n8n' | 'apple-health' | 'mcp' | 'x' | 'email' | 'calendar' | 'embed' | 'discord' | 'github' | 'sentry' | 'readwise';
414
417
  type IntegrationDetails = {
415
418
  type: IntegrationType;
416
419
  name: string;
@@ -447,6 +450,25 @@ type Room = {
447
450
  integration: Integration | null;
448
451
  }; //#endregion
449
452
  //#region src/agent/types.d.ts
453
+ type AgentCharacter = {
454
+ name: string | null;
455
+ system: string | null;
456
+ bio: string | null;
457
+ };
458
+ type Agent = {
459
+ uuid: string;
460
+ name: string;
461
+ description: string;
462
+ avatar: string;
463
+ wallets: Wallet[];
464
+ settings: AgentSettings;
465
+ marketplace: MarketplaceInfo;
466
+ character?: AgentCharacter | null;
467
+ room: Room;
468
+ role: string | null;
469
+ blueprint: Blueprint | null;
470
+ team: string;
471
+ };
450
472
  type AgentPrivate = {
451
473
  uuid: string;
452
474
  name: string;
@@ -679,7 +701,13 @@ type BlueprintShortcut = {
679
701
  chat: boolean;
680
702
  }; //#endregion
681
703
  //#region src/helpers/string.d.ts
682
- //#endregion
704
+ type PaginatedResponse<T> = {
705
+ data: T[];
706
+ current_page: number;
707
+ per_page: number;
708
+ total: number;
709
+ last_page: number;
710
+ }; //#endregion
683
711
  //#region src/service/types.d.ts
684
712
  type Service = {
685
713
  id: string;
@@ -692,10 +720,67 @@ type Service = {
692
720
  active: boolean;
693
721
  digital: boolean;
694
722
  public: boolean;
723
+ settings?: Record<string, unknown> | null;
695
724
  createdAt: string;
696
725
  updatedAt: string;
697
726
  }; //#endregion
698
- //#region src/appointment/types.d.ts
727
+ //#region src/meeting/types.d.ts
728
+ type MeetingParticipant = {
729
+ name: string | null;
730
+ profileImageUrl: string | null;
731
+ };
732
+ type MeetingSpeakerAssignment = {
733
+ speakerId: number;
734
+ name: string;
735
+ contactId: string | null;
736
+ };
737
+ type Meeting = {
738
+ id: string;
739
+ code: string;
740
+ name: string | null;
741
+ room: Room | null;
742
+ inviteUrl: string;
743
+ status: MeetingStatus;
744
+ conferenceProvider: MeetingConferenceProvider | null;
745
+ conferenceUrl: string | null;
746
+ conferenceExternalId: string | null;
747
+ captureMode: 'desktop_local' | null;
748
+ transcriptUrl: string | null;
749
+ summaryUrl: string | null;
750
+ participants?: MeetingParticipant[];
751
+ speakerAssignments?: MeetingSpeakerAssignment[] | null;
752
+ configuration?: Record<string, WarpNativeValue>;
753
+ scheduledAt: string | null;
754
+ calendarEventId: number | null;
755
+ startedAt: string | null;
756
+ endedAt: string | null;
757
+ createdAt: string;
758
+ };
759
+ type MeetingStatus = 'active' | 'completed' | 'analyzed' | 'scheduled' | 'cancelled';
760
+ type MeetingConferenceProvider = 'google_meet' | 'teams' | 'zoom';
761
+ type MeetingFeature = 'transcription' | 'summary' | 'insights' | 'actions';
762
+ type MeetingJoinTeam = {
763
+ name: string;
764
+ logo: string | null;
765
+ };
766
+ type MeetingJoinInfo = {
767
+ id: string;
768
+ code: string;
769
+ name: string | null;
770
+ inviteUrl: string;
771
+ agentName: string;
772
+ team: MeetingJoinTeam;
773
+ status: MeetingStatus;
774
+ isPhysical: boolean;
775
+ scheduledAt: string | null;
776
+ scheduledEndAt: string | null;
777
+ timezone: string;
778
+ conferenceUrl: string | null;
779
+ conferenceProvider: MeetingConferenceProvider | null;
780
+ endedAt: string | null;
781
+ canCancel: boolean;
782
+ features: Record<MeetingFeature, boolean>;
783
+ };
699
784
  type AppointmentAvailabilityService = {
700
785
  slug: string;
701
786
  name: string | null;
@@ -709,7 +794,6 @@ type AppointmentAvailabilitySlot = {
709
794
  serviceSlug: string | null;
710
795
  };
711
796
  type AppointmentAvailability = {
712
- connected: boolean;
713
797
  timezone: string;
714
798
  service: AppointmentAvailabilityService | null;
715
799
  slots: AppointmentAvailabilitySlot[];
@@ -729,6 +813,8 @@ type AppointmentPolicy = {
729
813
  conferenceEnabled: boolean | null;
730
814
  serviceSelectionEnabled?: boolean | null;
731
815
  paymentEnabled?: boolean | null;
816
+ requireApproval?: boolean | null;
817
+ agent?: Agent | null;
732
818
  };
733
819
  type AppointmentBooking = {
734
820
  id: string;
@@ -742,6 +828,7 @@ type AppointmentBooking = {
742
828
  status: string;
743
829
  attendeeEmail: string | null;
744
830
  attendeeName: string | null;
831
+ configuration?: Record<string, WarpNativeValue>;
745
832
  };
746
833
  type AppointmentRequest = {
747
834
  id: string;
@@ -757,6 +844,10 @@ type AppointmentRequest = {
757
844
  start: string;
758
845
  end: string;
759
846
  }[] | null;
847
+ configuration?: Record<string, WarpNativeValue>;
848
+ service?: Service | null;
849
+ meeting?: Meeting | null;
850
+ agent?: Agent | null;
760
851
  createdAt: string;
761
852
  }; //#endregion
762
853
  //#region src/budget/types.d.ts
@@ -874,31 +965,6 @@ type ItemCreatePayload = {
874
965
  contactIds?: string[];
875
966
  assignedToIds?: string[];
876
967
  };
877
- type MeetingStatus = 'active' | 'completed' | 'analyzed' | 'scheduled' | 'cancelled';
878
- type MeetingConferenceProvider = 'google_meet' | 'teams' | 'zoom';
879
- type MeetingFeature = 'transcription' | 'summary' | 'insights' | 'actions';
880
- type MeetingJoinTeam = {
881
- name: string;
882
- logo: string | null;
883
- };
884
- type MeetingJoinInfo = {
885
- id: string;
886
- code: string;
887
- name: string | null;
888
- inviteUrl: string;
889
- agentName: string;
890
- team: MeetingJoinTeam;
891
- status: MeetingStatus;
892
- isPhysical: boolean;
893
- scheduledAt: string | null;
894
- scheduledEndAt: string | null;
895
- timezone: string;
896
- conferenceUrl: string | null;
897
- conferenceProvider: MeetingConferenceProvider | null;
898
- endedAt: string | null;
899
- canCancel: boolean;
900
- features: Record<MeetingFeature, boolean>;
901
- };
902
968
  //#endregion
903
969
  //#region src/memory/types.d.ts
904
970
  type Memory = {
@@ -981,6 +1047,13 @@ type BrandSiteConfig = {
981
1047
  };
982
1048
  //#endregion
983
1049
  //#region src/link/types.d.ts
1050
+ type LinkScanHistory = {
1051
+ daily: number[];
1052
+ geography: Record<string, number>;
1053
+ devices?: Record<string, number>;
1054
+ operatingSystems?: Record<string, number>;
1055
+ browsers?: Record<string, number>;
1056
+ };
984
1057
  type Link = {
985
1058
  id: string;
986
1059
  url: string;
@@ -988,18 +1061,49 @@ type Link = {
988
1061
  status: 'active' | 'paused' | 'expired';
989
1062
  title: string | null;
990
1063
  scanCount: number;
991
- scanHistory: number[];
992
- scanGeography: Record<string, number>;
1064
+ scanHistory: LinkScanHistory;
1065
+ lastScannedAt: string | null;
1066
+ createdAt: string;
1067
+ updatedAt: string;
1068
+ };
1069
+ type LinkVariation = {
1070
+ id: string;
1071
+ linkId: string;
1072
+ title: string | null;
1073
+ values: Record<string, string>;
1074
+ url: string;
1075
+ shortUrl: string;
1076
+ status: 'active' | 'paused' | 'expired';
1077
+ scanCount: number;
993
1078
  lastScannedAt: string | null;
994
1079
  createdAt: string;
995
1080
  updatedAt: string;
996
1081
  };
1082
+ type LinkVariationCreatePayload = {
1083
+ title?: string | null;
1084
+ values: Record<string, string>;
1085
+ };
1086
+ type LinkVariationBatchCreatePayload = {
1087
+ placeholder: string;
1088
+ labelTemplate?: string | null;
1089
+ from?: number | null;
1090
+ to?: number | null;
1091
+ values?: Array<{
1092
+ value: string;
1093
+ label?: string | null;
1094
+ }>;
1095
+ };
997
1096
  type LinkCreatePayload = {
998
1097
  url: string;
999
1098
  title: string;
1000
1099
  };
1001
1100
  type LinkUpdatePayload = Partial<LinkCreatePayload>;
1002
- //#endregion
1101
+ type LinkStats = {
1102
+ totalLinks: number;
1103
+ activeLinks: number;
1104
+ totalScans: number;
1105
+ scanHistory: LinkScanHistory;
1106
+ }; //#endregion
1003
1107
  //#region src/store/types.d.ts
1004
1108
  type StoreVisibility = 'private' | 'team' | 'public';
1005
1109
  type StoreEntry = {
@@ -1058,6 +1162,7 @@ type Update = {
1058
1162
  linkUrl: string | null;
1059
1163
  startsAt: string | null;
1060
1164
  endsAt: string | null;
1165
+ team?: Team;
1061
1166
  createdAt: string;
1062
1167
  updatedAt: string;
1063
1168
  };
@@ -1087,6 +1192,27 @@ type UpdateStats = {
1087
1192
  //#region src/swarm/types.d.ts
1088
1193
  //#endregion
1089
1194
  //#region src/resources/appointments.d.ts
1195
+ declare const WEEKDAYS: readonly ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
1196
+ type Weekday = typeof WEEKDAYS[number];
1197
+ type OpeningHoursRange = string | {
1198
+ start: string;
1199
+ end: string;
1200
+ };
1201
+ type OpeningHoursAvailability = Partial<Record<Weekday | string, OpeningHoursRange[] | null | undefined>> | null | undefined;
1202
+ type OpeningHoursEntry = {
1203
+ days: string;
1204
+ time: string;
1205
+ };
1206
+ type OpeningHoursFormatOptions = {
1207
+ locale?: string;
1208
+ dayFormat?: 'narrow' | 'short' | 'long';
1209
+ dayLabels?: Partial<Record<Weekday, string>>;
1210
+ dayRangeSeparator?: string;
1211
+ dayListSeparator?: string;
1212
+ lastDayListSeparator?: string;
1213
+ timeRangeSeparator?: string;
1214
+ };
1215
+ declare const formatOpeningHours: (availability: OpeningHoursAvailability, options?: OpeningHoursFormatOptions) => OpeningHoursEntry[];
1090
1216
  declare class AppointmentsResource {
1091
1217
  private readonly http;
1092
1218
  private readonly config;
@@ -1115,6 +1241,7 @@ declare class AppointmentsResource {
1115
1241
  }[];
1116
1242
  serviceSlug?: string;
1117
1243
  appointmentRequestId?: string;
1244
+ configuration?: Record<string, WarpNativeValue>;
1118
1245
  }): Promise<IAppResponse<AppointmentBooking>>;
1119
1246
  reschedule(agentUuid: string, meetingId: string, data: {
1120
1247
  scheduledAt: string;
@@ -1123,7 +1250,7 @@ declare class AppointmentsResource {
1123
1250
  cancel(agentUuid: string, meetingId: string, data?: {
1124
1251
  reason?: string;
1125
1252
  }): Promise<IAppResponse<AppointmentBooking>>;
1126
- listRequests(agentUuid: string): Promise<IAppResponse<AppointmentRequest[]>>;
1253
+ listRequests(agentUuid?: string): Promise<IAppResponse<AppointmentRequest[]>>;
1127
1254
  createRequest(agentUuid: string, data: {
1128
1255
  title: string;
1129
1256
  requesterName?: string;
@@ -1138,6 +1265,7 @@ declare class AppointmentsResource {
1138
1265
  end: string;
1139
1266
  }[];
1140
1267
  serviceSlug?: string;
1268
+ configuration?: Record<string, WarpNativeValue>;
1141
1269
  }): Promise<IAppResponse<AppointmentRequest>>;
1142
1270
  updateRequest(agentUuid: string, requestId: string, data: {
1143
1271
  status?: string;
@@ -1291,10 +1419,18 @@ declare class ContactsResource {
1291
1419
  update(id: string, data: ContactFormData): Promise<IAppResponse<Contact>>;
1292
1420
  delete(id: string): Promise<IAppResponse<unknown>>;
1293
1421
  listActivities(id: string): Promise<IAppResponse<ContactActivity[]>>;
1422
+ getTimeline<T = Record<string, unknown>>(id: string, page?: number): Promise<IAppResponse<PaginatedResponse<T>>>;
1294
1423
  addActivity(id: string, data: {
1295
1424
  type: ContactActivity['type'];
1296
1425
  description?: string;
1426
+ meta?: Record<string, unknown>;
1427
+ }): Promise<IAppResponse<ContactActivity>>;
1428
+ updateActivity(id: string, activityId: string, data: {
1429
+ type?: ContactActivity['type'];
1430
+ description?: string | null;
1431
+ meta?: Record<string, unknown> | null;
1297
1432
  }): Promise<IAppResponse<ContactActivity>>;
1433
+ deleteActivity(id: string, activityId: string): Promise<IAppResponse<unknown>>;
1298
1434
  }
1299
1435
  //#endregion
1300
1436
  //#region src/resources/documents.d.ts
@@ -1331,8 +1467,21 @@ declare class GoalsResource {
1331
1467
  //#region src/resources/meetings.d.ts
1332
1468
  declare class MeetingsResource {
1333
1469
  private readonly http;
1334
- constructor(http: IHttpService);
1470
+ private readonly config;
1471
+ constructor(http: IHttpService, config: JoAiClientConfig);
1472
+ listUpcoming(): Promise<IAppResponse<Meeting[]>>;
1473
+ get(id: string): Promise<IAppResponse<Meeting>>;
1474
+ getSummary(id: string): Promise<IAppResponse<{
1475
+ content: string;
1476
+ }>>;
1335
1477
  join(code: string): Promise<IAppResponse<MeetingJoinInfo>>;
1478
+ cancel(code: string): Promise<IAppResponse<Meeting>>;
1479
+ share(id: string, recipients: {
1480
+ name: string;
1481
+ email: string;
1482
+ }[]): Promise<IAppResponse<unknown>>;
1483
+ update(id: string, name: string | null, notify?: boolean, speakers?: MeetingSpeakerAssignment[]): Promise<IAppResponse<Meeting>>;
1484
+ finalize(id: string, notify: boolean): Promise<IAppResponse<unknown>>;
1336
1485
  }
1337
1486
  //#endregion
1338
1487
  //#region src/resources/media.d.ts
@@ -1340,11 +1489,17 @@ type MediaUploadType = 'brand' | 'reference' | 'template' | 'output';
1340
1489
  declare class MediaResource {
1341
1490
  private readonly http;
1342
1491
  constructor(http: IHttpService);
1492
+ listPublic(params?: {
1493
+ tags?: string;
1494
+ team?: string;
1495
+ mime?: string;
1496
+ }): Promise<IAppResponse<Media[]>>;
1343
1497
  upload(data: {
1344
1498
  team: string;
1345
1499
  file: File;
1346
1500
  type: MediaUploadType;
1347
1501
  label?: string;
1502
+ tags?: string[];
1348
1503
  }): Promise<IAppResponse<Media>>;
1349
1504
  }
1350
1505
  //#endregion
@@ -1518,6 +1673,12 @@ declare class StoresResource {
1518
1673
  declare class UpdatesResource {
1519
1674
  private readonly http;
1520
1675
  constructor(http: IHttpService);
1676
+ listPublic(params?: {
1677
+ type?: string;
1678
+ tags?: string;
1679
+ }): Promise<IAppResponse<{
1680
+ data: Update[];
1681
+ }>>;
1521
1682
  list(params?: {
1522
1683
  type?: UpdateType;
1523
1684
  active?: boolean;
@@ -1543,6 +1704,15 @@ declare class LinksResource {
1543
1704
  create(payload: LinkCreatePayload): Promise<IAppResponse<Link>>;
1544
1705
  update(id: string, payload: LinkUpdatePayload): Promise<IAppResponse<Link>>;
1545
1706
  delete(id: string): Promise<IAppResponse<unknown>>;
1707
+ stats(): Promise<IAppResponse<LinkStats>>;
1708
+ variations(linkId: string): Promise<IAppResponse<{
1709
+ data: LinkVariation[];
1710
+ }>>;
1711
+ createVariation(linkId: string, payload: LinkVariationCreatePayload): Promise<IAppResponse<LinkVariation>>;
1712
+ createVariationBatch(linkId: string, payload: LinkVariationBatchCreatePayload): Promise<IAppResponse<{
1713
+ data: LinkVariation[];
1714
+ }>>;
1715
+ deleteVariation(linkId: string, variationId: string): Promise<IAppResponse<unknown>>;
1546
1716
  }
1547
1717
  //#endregion
1548
1718
  //#region src/resources/warps.d.ts
@@ -1682,4 +1852,4 @@ declare class DistributionResource {
1682
1852
  private fetchDistribution;
1683
1853
  }
1684
1854
  //#endregion
1685
- 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 };
1855
+ export { AppointmentsResource, AuthResource, type AuthSendCodeRequest, type AuthVerifyResponse, type BackendWarp, type BackendWarpBrand, BlueprintsResource, type CacheConfig, CachedHttpService, CartsResource, ContactsResource, DistributionResource, FlowsResource, IngestionsResource, JoAiClient, type JoAiClientConfig, LinksResource, MarketplaceResource, MeetingsResource, type OpeningHoursEntry, type OpeningHoursFormatOptions, type Order, OrdersResource, type Product, type ProductVariation, ProductsResource, ServicesResource, SitesResource, SkillsResource, StoresResource, SubscriptionsResource, WarpsResource, createClient, formatOpeningHours };
package/dist/index.mjs CHANGED
@@ -111,6 +111,83 @@ var HttpService = class {
111
111
  };
112
112
  //#endregion
113
113
  //#region src/resources/appointments.ts
114
+ const WEEKDAYS = [
115
+ "monday",
116
+ "tuesday",
117
+ "wednesday",
118
+ "thursday",
119
+ "friday",
120
+ "saturday",
121
+ "sunday"
122
+ ];
123
+ const WEEKDAY_DATES = [
124
+ "2024-01-01",
125
+ "2024-01-02",
126
+ "2024-01-03",
127
+ "2024-01-04",
128
+ "2024-01-05",
129
+ "2024-01-06",
130
+ "2024-01-07"
131
+ ];
132
+ const formatTimeRange = (range, separator) => {
133
+ if (typeof range === "string") return range.replace(/\s*-\s*/, ` ${separator} `);
134
+ return `${range.start} ${separator} ${range.end}`;
135
+ };
136
+ const labelForDay = (day, options) => {
137
+ if (options.dayLabels?.[day]) return options.dayLabels[day];
138
+ const date = /* @__PURE__ */ new Date(`${WEEKDAY_DATES[WEEKDAYS.indexOf(day)]}T12:00:00Z`);
139
+ return new Intl.DateTimeFormat(options.locale, {
140
+ weekday: options.dayFormat,
141
+ timeZone: "UTC"
142
+ }).format(date).replace(/\.$/, "");
143
+ };
144
+ const formatDayIndexes = (indexes, options) => {
145
+ const ranges = [];
146
+ let start = indexes[0];
147
+ let previous = indexes[0];
148
+ for (const index of indexes.slice(1)) {
149
+ if (index === previous + 1) {
150
+ previous = index;
151
+ continue;
152
+ }
153
+ ranges.push(start === previous ? labelForDay(WEEKDAYS[start], options) : `${labelForDay(WEEKDAYS[start], options)} ${options.dayRangeSeparator} ${labelForDay(WEEKDAYS[previous], options)}`);
154
+ start = index;
155
+ previous = index;
156
+ }
157
+ ranges.push(start === previous ? labelForDay(WEEKDAYS[start], options) : `${labelForDay(WEEKDAYS[start], options)} ${options.dayRangeSeparator} ${labelForDay(WEEKDAYS[previous], options)}`);
158
+ if (ranges.length <= 1) return ranges[0] ?? "";
159
+ return `${ranges.slice(0, -1).join(options.dayListSeparator)}${options.lastDayListSeparator}${ranges.at(-1)}`;
160
+ };
161
+ const formatOpeningHours = (availability, options = {}) => {
162
+ if (!availability) return [];
163
+ const resolvedOptions = {
164
+ locale: options.locale ?? "en",
165
+ dayFormat: options.dayFormat ?? "short",
166
+ dayLabels: options.dayLabels ?? {},
167
+ dayRangeSeparator: options.dayRangeSeparator ?? "–",
168
+ dayListSeparator: options.dayListSeparator ?? ", ",
169
+ lastDayListSeparator: options.lastDayListSeparator ?? " & ",
170
+ timeRangeSeparator: options.timeRangeSeparator ?? "–"
171
+ };
172
+ const lines = [];
173
+ for (const [dayIndex, day] of WEEKDAYS.entries()) {
174
+ const ranges = availability[day];
175
+ if (!ranges?.length) continue;
176
+ for (const range of ranges) {
177
+ const time = formatTimeRange(range, resolvedOptions.timeRangeSeparator);
178
+ const existing = lines.find((line) => line.time === time);
179
+ if (existing) existing.dayIndexes.push(dayIndex);
180
+ else lines.push({
181
+ dayIndexes: [dayIndex],
182
+ time
183
+ });
184
+ }
185
+ }
186
+ return lines.map((line) => ({
187
+ days: formatDayIndexes(line.dayIndexes, resolvedOptions),
188
+ time: line.time
189
+ }));
190
+ };
114
191
  var AppointmentsResource = class {
115
192
  constructor(http, config) {
116
193
  this.http = http;
@@ -135,7 +212,8 @@ var AppointmentsResource = class {
135
212
  return this.http.post(`agents/${agentUuid}/appointments/${meetingId}/cancel`, data ?? {});
136
213
  }
137
214
  listRequests(agentUuid) {
138
- return this.http.get(`agents/${agentUuid}/appointment-requests`);
215
+ const params = agentUuid ? `?agent=${encodeURIComponent(agentUuid)}` : "";
216
+ return this.http.get(`teams/${this.config.team}/appointment-requests${params}`);
139
217
  }
140
218
  createRequest(agentUuid, data) {
141
219
  return this.http.post(`agents/${agentUuid}/appointment-requests`, data);
@@ -204,10 +282,10 @@ var CartsResource = class {
204
282
  this.http = http;
205
283
  }
206
284
  get() {
207
- return this.http.get("v1/cart");
285
+ return this.http.get("cart");
208
286
  }
209
287
  add(type, id, quantity = 1, configuration) {
210
- return this.http.post("v1/cart/add", {
288
+ return this.http.post("cart/add", {
211
289
  id,
212
290
  type,
213
291
  quantity,
@@ -215,23 +293,23 @@ var CartsResource = class {
215
293
  });
216
294
  }
217
295
  remove(type, id) {
218
- return this.http.post("v1/cart/remove", {
296
+ return this.http.post("cart/remove", {
219
297
  id,
220
298
  type
221
299
  });
222
300
  }
223
301
  updateQuantity(type, id, quantity) {
224
- return this.http.post("v1/cart/quantity", {
302
+ return this.http.post("cart/quantity", {
225
303
  id,
226
304
  type,
227
305
  quantity
228
306
  });
229
307
  }
230
308
  clear() {
231
- return this.http.post("v1/cart/clear");
309
+ return this.http.post("cart/clear");
232
310
  }
233
311
  applyCoupon(code) {
234
- return this.http.post("v1/cart/coupon", { code });
312
+ return this.http.post("cart/coupon", { code });
235
313
  }
236
314
  };
237
315
  //#endregion
@@ -371,9 +449,18 @@ var ContactsResource = class {
371
449
  listActivities(id) {
372
450
  return this.http.get(`contacts/${id}/activities`);
373
451
  }
452
+ getTimeline(id, page = 1) {
453
+ return this.http.get(`contacts/${id}/timeline?page=${page}`);
454
+ }
374
455
  addActivity(id, data) {
375
456
  return this.http.post(`contacts/${id}/activities`, data);
376
457
  }
458
+ updateActivity(id, activityId, data) {
459
+ return this.http.put(`contacts/${id}/activities/${activityId}`, data);
460
+ }
461
+ deleteActivity(id, activityId) {
462
+ return this.http.delete(`contacts/${id}/activities/${activityId}`);
463
+ }
377
464
  };
378
465
  //#endregion
379
466
  //#region src/resources/documents.ts
@@ -418,12 +505,38 @@ var GoalsResource = class {
418
505
  //#endregion
419
506
  //#region src/resources/meetings.ts
420
507
  var MeetingsResource = class {
421
- constructor(http) {
508
+ constructor(http, config) {
422
509
  this.http = http;
510
+ this.config = config;
511
+ }
512
+ listUpcoming() {
513
+ return this.http.get(`teams/${this.config.team}/meetings/upcoming`);
514
+ }
515
+ get(id) {
516
+ return this.http.get(`meetings/${id}`);
517
+ }
518
+ getSummary(id) {
519
+ return this.http.get(`meetings/${id}/summary`);
423
520
  }
424
521
  join(code) {
425
522
  return this.http.get(`meetings/join/${code}`);
426
523
  }
524
+ cancel(code) {
525
+ return this.http.post(`meetings/cancel/${code}`, {});
526
+ }
527
+ share(id, recipients) {
528
+ return this.http.post(`meetings/${id}/share`, { recipients });
529
+ }
530
+ update(id, name, notify, speakers) {
531
+ return this.http.put(`meetings/${id}`, {
532
+ name,
533
+ ...notify !== void 0 && { notify },
534
+ ...speakers !== void 0 && { speakers }
535
+ });
536
+ }
537
+ finalize(id, notify) {
538
+ return this.http.post(`meetings/${id}/finalize`, { notify });
539
+ }
427
540
  };
428
541
  //#endregion
429
542
  //#region src/resources/media.ts
@@ -431,11 +544,20 @@ var MediaResource = class {
431
544
  constructor(http) {
432
545
  this.http = http;
433
546
  }
547
+ listPublic(params) {
548
+ const query = new URLSearchParams();
549
+ if (params?.tags) query.set("tags", params.tags);
550
+ if (params?.team) query.set("team", params.team);
551
+ if (params?.mime) query.set("mime", params.mime);
552
+ const qs = query.toString();
553
+ return this.http.get(`media/public${qs ? "?" + qs : ""}`);
554
+ }
434
555
  upload(data) {
435
556
  const formData = new FormData();
436
557
  formData.append("file", data.file, data.file.name);
437
558
  formData.append("type", data.type);
438
559
  if (data.label) formData.append("label", data.label);
560
+ if (data.tags) data.tags.forEach((t) => formData.append("tags[]", t));
439
561
  return this.http.post("media", formData, { headers: { "X-Team": data.team } });
440
562
  }
441
563
  };
@@ -650,6 +772,13 @@ var UpdatesResource = class {
650
772
  constructor(http) {
651
773
  this.http = http;
652
774
  }
775
+ listPublic(params) {
776
+ const query = new URLSearchParams();
777
+ if (params?.type) query.set("type", params.type);
778
+ if (params?.tags) query.set("tags", params.tags);
779
+ const qs = query.toString();
780
+ return this.http.get(`updates/public${qs ? "?" + qs : ""}`);
781
+ }
653
782
  list(params) {
654
783
  const query = new URLSearchParams();
655
784
  if (params?.type) query.set("type", params.type);
@@ -692,6 +821,21 @@ var LinksResource = class {
692
821
  delete(id) {
693
822
  return this.http.delete(`links/${id}`);
694
823
  }
824
+ stats() {
825
+ return this.http.get("links/stats");
826
+ }
827
+ variations(linkId) {
828
+ return this.http.get(`links/${linkId}/variations`);
829
+ }
830
+ createVariation(linkId, payload) {
831
+ return this.http.post(`links/${linkId}/variations`, payload);
832
+ }
833
+ createVariationBatch(linkId, payload) {
834
+ return this.http.post(`links/${linkId}/variations/batch`, payload);
835
+ }
836
+ deleteVariation(linkId, variationId) {
837
+ return this.http.delete(`links/${linkId}/variations/${variationId}`);
838
+ }
695
839
  };
696
840
  //#endregion
697
841
  //#region src/resources/warps.ts
@@ -881,7 +1025,7 @@ var JoAiClient = class {
881
1025
  this.reminders = new RemindersResource(this.http);
882
1026
  this.sites = new SitesResource(this.http);
883
1027
  this.documents = new DocumentsResource(this.http);
884
- this.meetings = new MeetingsResource(this.http);
1028
+ this.meetings = new MeetingsResource(this.http, config);
885
1029
  this.media = new MediaResource(this.http);
886
1030
  this.stores = new StoresResource(this.http);
887
1031
  this.products = new ProductsResource(this.http);
@@ -936,4 +1080,4 @@ var DistributionResource = class {
936
1080
  }
937
1081
  };
938
1082
  //#endregion
939
- export { AppointmentsResource, AuthResource, BlueprintsResource, CachedHttpService, CartsResource, DistributionResource, FlowsResource, IngestionsResource, JoAiClient, MarketplaceResource, MeetingsResource, OrdersResource, ProductsResource, ServicesResource, SitesResource, SkillsResource, StoresResource, SubscriptionsResource, WarpsResource, createClient };
1083
+ export { AppointmentsResource, AuthResource, BlueprintsResource, CachedHttpService, CartsResource, ContactsResource, DistributionResource, FlowsResource, IngestionsResource, JoAiClient, LinksResource, MarketplaceResource, MeetingsResource, OrdersResource, ProductsResource, ServicesResource, SitesResource, SkillsResource, StoresResource, SubscriptionsResource, WarpsResource, createClient, formatOpeningHours };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",