@joai/sdk 2.0.0 → 2.2.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
@@ -271,6 +271,21 @@ type TeamMeta = {
271
271
  branding?: TeamBrand | null;
272
272
  settings: Record<string, unknown>;
273
273
  };
274
+ type TeamPlace = {
275
+ provider: 'google';
276
+ sourceId: string;
277
+ name: string | null;
278
+ address: string | null;
279
+ location: {
280
+ lat: number | null;
281
+ lng: number | null;
282
+ };
283
+ rating?: number | null;
284
+ reviewCount?: number | null;
285
+ websiteUrl?: string | null;
286
+ mapsUrl?: string | null;
287
+ businessStatus?: string | null;
288
+ };
274
289
  type Team = {
275
290
  slug: string;
276
291
  name: string;
@@ -280,6 +295,7 @@ type Team = {
280
295
  description: TranslatableValue | null;
281
296
  locale: WarpLocale;
282
297
  timezone: string;
298
+ place?: TeamPlace | null;
283
299
  meta?: TeamMeta;
284
300
  features?: TeamFeature[];
285
301
  cover?: string | null;
@@ -315,6 +331,7 @@ type TeamPrivate = {
315
331
  balance: number;
316
332
  locale: WarpLocale;
317
333
  timezone: string;
334
+ place?: TeamPlace | null;
318
335
  logo: string | null;
319
336
  cover: string | null;
320
337
  subscription: {
@@ -409,6 +426,25 @@ type JsonValue = string | number | boolean | null | JsonValue[] | {
409
426
  }; //#endregion
410
427
  //#region src/contact/types.d.ts
411
428
  type ContactHealth = 'active' | 'lukewarm' | 'cold' | 'stale' | 'unknown';
429
+ type ContactConsentStatus = 'pending' | 'confirmed' | 'superseded' | 'unsubscribed';
430
+ type ContactConsent = {
431
+ id: string;
432
+ purpose: string;
433
+ status: ContactConsentStatus;
434
+ email: string;
435
+ consentText: {
436
+ label?: string | Record<string, string>;
437
+ description?: string | Record<string, string> | null;
438
+ };
439
+ privacyUrl: string | null;
440
+ source: {
441
+ formIdentifier?: string | null;
442
+ formTitle?: string | Record<string, string> | null;
443
+ };
444
+ requestedAt: string;
445
+ confirmedAt: string | null;
446
+ unsubscribedAt: string | null;
447
+ };
412
448
  type Contact = {
413
449
  id: string;
414
450
  name: string;
@@ -429,8 +465,11 @@ type Contact = {
429
465
  settings?: {
430
466
  marketingOptOut?: boolean;
431
467
  } | null;
468
+ consents?: ContactConsent[];
432
469
  lastActivityAt?: string | null;
433
470
  health?: ContactHealth;
471
+ nextFollowUpAt?: string | null;
472
+ followUpNote?: string | null;
434
473
  };
435
474
  type ContactActivityType = 'note' | 'call' | 'meeting' | 'task' | 'update' | 'custom' | 'form' | 'loyalty';
436
475
  type ContactActivityAuthor = {
@@ -463,6 +502,8 @@ type ContactFormData = {
463
502
  settings?: {
464
503
  marketingOptOut?: boolean;
465
504
  };
505
+ nextFollowUpAt?: string | null;
506
+ followUpNote?: string | null;
466
507
  };
467
508
  type ContactCreatePayload = ContactFormData & {
468
509
  name: string;
@@ -481,10 +522,8 @@ type MediaLibraryAttributes = {
481
522
  extension?: string;
482
523
  size?: number;
483
524
  };
484
- type MediaLibraryItems = {
485
- [uuid: string]: MediaLibraryAttributes;
486
- };
487
525
  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';
526
+ type MediaAspectRatio = 'free' | '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
488
527
  type Media = {
489
528
  id: string;
490
529
  name: string;
@@ -1029,6 +1068,12 @@ type WarpExtras = {
1029
1068
  enabled?: boolean;
1030
1069
  contact?: string | null;
1031
1070
  };
1071
+ optIn?: {
1072
+ enabled?: boolean;
1073
+ };
1074
+ results?: {
1075
+ public?: boolean;
1076
+ };
1032
1077
  };
1033
1078
  type WarpBackend = {
1034
1079
  hash: string;
@@ -1447,7 +1492,13 @@ type AppointmentAvailability = {
1447
1492
  service: AppointmentAvailabilityService | null;
1448
1493
  slots: AppointmentAvailabilitySlot[];
1449
1494
  };
1495
+ type AppointmentPolicySync = {
1496
+ enabled: boolean;
1497
+ lastSyncedAt?: string | null;
1498
+ lastSyncError?: string | null;
1499
+ };
1450
1500
  type AppointmentPolicy = {
1501
+ active: boolean;
1451
1502
  timezone: string | null;
1452
1503
  availability: Record<string, {
1453
1504
  start: string;
@@ -1463,7 +1514,9 @@ type AppointmentPolicy = {
1463
1514
  serviceSelectionEnabled?: boolean | null;
1464
1515
  paymentEnabled?: boolean | null;
1465
1516
  requireApproval?: boolean | null;
1517
+ sync?: AppointmentPolicySync | null;
1466
1518
  agent?: Agent | null;
1519
+ agentUuid?: string | null;
1467
1520
  };
1468
1521
  type AppointmentBooking = {
1469
1522
  id: string;
@@ -2021,11 +2074,8 @@ type NotificationAction = {
2021
2074
  };
2022
2075
  type NotificationSetting = {
2023
2076
  identifier: string;
2024
- name: string;
2025
- description: string;
2026
2077
  channels: {
2027
2078
  identifier: NotificationChannel;
2028
- name: string;
2029
2079
  isEnabled: boolean;
2030
2080
  }[];
2031
2081
  }; //#endregion
@@ -2471,7 +2521,7 @@ type LoyaltyMember = {
2471
2521
  updatedAt: string;
2472
2522
  }; //#endregion
2473
2523
  //#region src/segment/types.d.ts
2474
- type SegmentConditionType = 'tag' | 'has_email' | 'has_phone' | 'has_user' | 'last_purchase_after' | 'last_purchase_before' | 'total_order_amount' | 'order_count_at_least' | 'never_purchased' | 'avg_order_value_at_least' | 'last_contact_after' | 'last_contact_before' | 'created_after' | 'created_before' | 'email_contains';
2524
+ type SegmentConditionType = 'tag' | 'has_email' | 'has_phone' | 'has_user' | 'last_purchase_after' | 'last_purchase_before' | 'total_order_amount' | 'order_count_at_least' | 'never_purchased' | 'avg_order_value_at_least' | 'last_contact_after' | 'last_contact_before' | 'waiting_on' | 'created_after' | 'created_before' | 'email_contains';
2475
2525
  type SegmentCondition = {
2476
2526
  type: SegmentConditionType;
2477
2527
  value: string | boolean;
@@ -2579,7 +2629,7 @@ type UpdateCreatePayload = {
2579
2629
  type: UpdateType;
2580
2630
  body?: string;
2581
2631
  imageUrl?: string;
2582
- media?: MediaLibraryItems;
2632
+ media?: string[];
2583
2633
  linkUrl?: string;
2584
2634
  startsAt?: string;
2585
2635
  endsAt?: string;
@@ -2665,64 +2715,67 @@ type RampProviderInfo = {
2665
2715
  active: boolean;
2666
2716
  }; //#endregion
2667
2717
  //#region src/warp-webhooks/types.d.ts
2668
- type AgentWebhookTriggerCondition = {
2718
+ type HookTriggerCondition = {
2669
2719
  path: string;
2670
2720
  operator: 'exists' | 'equals' | 'contains' | 'not_contains';
2671
2721
  value?: unknown;
2672
2722
  };
2673
- type AgentWebhookTriggerInput = string | {
2723
+ type HookTriggerInput = string | {
2674
2724
  source: 'payload';
2675
2725
  path: string;
2676
2726
  } | {
2677
2727
  source: 'literal';
2678
2728
  value: unknown;
2679
2729
  };
2680
- type AgentWebhookTrigger = {
2730
+ type HookTrigger = {
2681
2731
  event?: string;
2682
2732
  contract?: string;
2683
- when?: AgentWebhookTriggerCondition[];
2684
- inputs?: Record<string, AgentWebhookTriggerInput>;
2733
+ when?: HookTriggerCondition[];
2734
+ inputs?: Record<string, HookTriggerInput>;
2685
2735
  };
2686
- type AgentWebhookWarp = {
2687
- id: number;
2736
+ type WebHookTriggerEvent = 'agent.action' | 'agent.message' | 'agent.activity' | 'user.message' | 'external.message';
2737
+ type Hook = {
2738
+ id: string;
2688
2739
  source: string;
2689
2740
  event?: string | null;
2690
2741
  contract?: string | null;
2691
- next: string;
2742
+ trigger?: HookTrigger | null;
2743
+ triggerEvent?: string | null;
2744
+ next: string | null;
2745
+ name?: string | null;
2746
+ url?: string | null;
2747
+ headers?: Record<string, string> | null;
2748
+ verifySsl?: boolean;
2749
+ timeout?: number;
2750
+ maxRetries?: number;
2751
+ lastTriggeredAt?: string | null;
2752
+ description?: string | null;
2692
2753
  active: boolean;
2693
2754
  managed: boolean;
2694
- trigger?: AgentWebhookTrigger | null;
2695
2755
  warpIdentifier: string | null;
2696
2756
  createdAt: string;
2697
2757
  };
2698
- type ActivateAgentWebhookWarpPayload = {
2758
+ type CreateInternalHookPayload = {
2759
+ source: 'internal';
2699
2760
  warpIdentifier: string;
2700
- source?: 'internal';
2701
- trigger?: AgentWebhookTrigger;
2702
- }; //#endregion
2703
- //#region src/webhook/types.d.ts
2704
- type WebhookTriggerEvent = 'agent.action' | 'agent.message' | 'user.message';
2705
- type Webhook = {
2706
- id: string;
2761
+ trigger?: HookTrigger;
2762
+ };
2763
+ type CreateWebHookPayload = {
2764
+ source: 'web';
2707
2765
  name: string;
2708
2766
  url: string;
2709
- trigger: WebhookTriggerEvent;
2710
- headers: Record<string, string>;
2711
- description: string | null;
2712
- active: boolean;
2713
- verifySsl: boolean;
2714
- timeout: number;
2715
- maxRetries: number;
2716
- lastTriggeredAt: string | null;
2717
- createdAt: string;
2718
- updatedAt: string;
2719
- webhookableType: string;
2720
- webhookable?: {
2721
- type: string;
2722
- uuid: string;
2723
- name: string;
2724
- };
2725
- }; //#endregion
2767
+ trigger: WebHookTriggerEvent;
2768
+ headers?: Record<string, string>;
2769
+ description?: string;
2770
+ active?: boolean;
2771
+ verifySsl?: boolean;
2772
+ timeout?: number;
2773
+ maxRetries?: number;
2774
+ };
2775
+ type CreateWarpLinkedHookPayload = {
2776
+ warpIdentifier: string;
2777
+ };
2778
+ type CreateHookPayload = CreateInternalHookPayload | CreateWebHookPayload | CreateWarpLinkedHookPayload; //#endregion
2726
2779
  //#region src/workspace/types.d.ts
2727
2780
  type WorkspaceInfo = {
2728
2781
  id?: string;
@@ -2762,7 +2815,7 @@ declare class AgentsResource {
2762
2815
  trainingUrl?: string | null;
2763
2816
  };
2764
2817
  }): Promise<IAppResponse<AgentPrivate>>;
2765
- update(uuid: string, name: string, description: string | null, avatar?: MediaLibraryItems): Promise<IAppResponse<AgentPrivate>>;
2818
+ update(uuid: string, name: string, description: string | null, avatar?: string[]): Promise<IAppResponse<AgentPrivate>>;
2766
2819
  delete(uuid: string): Promise<IAppResponse<void>>;
2767
2820
  updatePassword(uuid: string, password: string): Promise<IAppResponse<void>>;
2768
2821
  storePassword(uuid: string, password: string): Promise<IAppResponse<AgentPrivate>>;
@@ -2849,14 +2902,14 @@ declare class ElementsResource {
2849
2902
  type: string;
2850
2903
  description?: string | null;
2851
2904
  spec?: ElementSpec | null;
2852
- media?: any[];
2905
+ media?: string[];
2853
2906
  }): Promise<IAppResponse<Element>>;
2854
2907
  update(team: string, elementId: string, payload: {
2855
2908
  name?: string;
2856
2909
  type?: string;
2857
2910
  description?: string | null;
2858
2911
  spec?: ElementSpec | null;
2859
- media?: any[];
2912
+ media?: string[];
2860
2913
  }): Promise<IAppResponse<Element>>;
2861
2914
  delete(team: string, elementId: string): Promise<IAppResponse<void>>;
2862
2915
  generateVariation(team: string, elementId: string, payload?: {
@@ -2935,7 +2988,7 @@ declare class AppointmentsResource {
2935
2988
  private readonly http;
2936
2989
  private readonly config;
2937
2990
  constructor(http: IHttpService, config: JoAiClientConfig);
2938
- getPolicy(): Promise<IAppResponse<AppointmentPolicy>>;
2991
+ getPolicy(): Promise<IAppResponse<AppointmentPolicy | null>>;
2939
2992
  upsertPolicy(data: Partial<AppointmentPolicy>): Promise<IAppResponse<AppointmentPolicy>>;
2940
2993
  checkAvailability(agentUuid: string, params: {
2941
2994
  windowStart: string;
@@ -3061,12 +3114,12 @@ declare class BillingResource {
3061
3114
  plans(type?: 'current' | 'all'): Promise<IAppResponse<Plan[]>>;
3062
3115
  checkoutProduct(id: string): Promise<IAppResponse<Product>>;
3063
3116
  orders(team: TeamPrivate | null, page?: number, contactId?: string): Promise<IAppResponse<Order[]>>;
3064
- payOrder(id: string, provider: string): Promise<IAppResponse<{
3117
+ payOrder(id: string, provider?: PaymentProvider): Promise<IAppResponse<{
3065
3118
  url: string;
3066
3119
  }>>;
3067
3120
  deleteOrder(id: string): Promise<IAppResponse<void>>;
3068
- paymentAccount(team: string, provider: string): Promise<IAppResponse<PaymentAccount>>;
3069
- createPaymentAccountOnboarding(team: string, provider: string): Promise<IAppResponse<PaymentAccountOnboarding>>;
3121
+ paymentAccount(team: string, provider: PaymentProvider): Promise<IAppResponse<PaymentAccount>>;
3122
+ createPaymentAccountOnboarding(team: string, provider: PaymentProvider): Promise<IAppResponse<PaymentAccountOnboarding>>;
3070
3123
  updatePaymentAccount(team: string, provider: string, input: {
3071
3124
  providerAccountId: string;
3072
3125
  chargesEnabled?: boolean;
@@ -3145,7 +3198,7 @@ type CouponPayload = {
3145
3198
  restrictedItems?: CouponRestrictedItem[] | null;
3146
3199
  usesLeft?: number | null;
3147
3200
  expiresAt?: string | null;
3148
- media?: MediaLibraryAttributes[];
3201
+ media?: string[];
3149
3202
  };
3150
3203
  declare class CouponsResource {
3151
3204
  private readonly http;
@@ -3177,6 +3230,8 @@ declare class ContactsResource {
3177
3230
  search?: string;
3178
3231
  page?: number;
3179
3232
  staleDays?: number;
3233
+ waitingOn?: boolean;
3234
+ overdue?: boolean;
3180
3235
  }): Promise<IAppResponse<Contact[]>>;
3181
3236
  get(id: string): Promise<IAppResponse<Contact>>;
3182
3237
  create(payload: ContactCreatePayload): Promise<IAppResponse<Contact>>;
@@ -3253,7 +3308,7 @@ declare class DocumentsResource {
3253
3308
  }): Promise<IAppResponse<Document>>;
3254
3309
  delete(id: string): Promise<IAppResponse<void>>;
3255
3310
  trainFromUrl(agent: string, url: string): Promise<IAppResponse<Document>>;
3256
- uploadFile(agentUuid: string, name: string, document: MediaLibraryItems): Promise<IAppResponse<Document>>;
3311
+ uploadFile(agentUuid: string, name: string, document: string[]): Promise<IAppResponse<Document>>;
3257
3312
  }
3258
3313
  //#endregion
3259
3314
  //#region src/resources/flows.d.ts
@@ -3538,6 +3593,10 @@ declare class StoreResource {
3538
3593
  //#endregion
3539
3594
  //#region src/resources/media.d.ts
3540
3595
  type MediaUploadType = 'brand' | 'reference' | 'template' | 'output';
3596
+ type AttachedMedia = {
3597
+ id: string;
3598
+ custom_properties?: Record<string, unknown> | null;
3599
+ };
3541
3600
  declare class MediaResource {
3542
3601
  private readonly http;
3543
3602
  constructor(http: IHttpService);
@@ -3553,24 +3612,24 @@ declare class MediaResource {
3553
3612
  fileName?: string;
3554
3613
  mimeType?: string;
3555
3614
  type: MediaUploadType;
3615
+ aspect?: MediaAspectRatio;
3556
3616
  label?: string;
3557
3617
  tags?: string[];
3558
3618
  copyright?: string;
3559
3619
  }): Promise<IAppResponse<Media>>;
3560
- listTeam(team: string, params?: {
3620
+ list(team: string, params?: {
3561
3621
  page?: number;
3562
3622
  mime?: string;
3563
3623
  }): Promise<IAppResponse<Media[]>>;
3564
- uploadTeam(team: string, media: MediaLibraryItems, tags?: string[], options?: {
3565
- preserveOriginal?: boolean;
3566
- copyright?: string;
3567
- }): Promise<IAppResponse<Media[]>>;
3568
- deleteTeam(team: string, mediaId: string): Promise<IAppResponse<void>>;
3569
- updateTeamMedia(team: string, mediaId: string, data: {
3624
+ get(team: string, mediaId: string): Promise<IAppResponse<Media>>;
3625
+ delete(team: string, mediaId: string): Promise<IAppResponse<void>>;
3626
+ update(team: string, mediaId: string, data: {
3570
3627
  name: string;
3571
3628
  copyright?: string | null;
3572
3629
  }): Promise<IAppResponse<Media>>;
3573
- updateTeamMediaTags(team: string, mediaId: string, tags: string[]): Promise<IAppResponse<Media>>;
3630
+ updateTags(team: string, mediaId: string, tags: string[]): Promise<IAppResponse<Media>>;
3631
+ /** Download the stored bytes of a media item as a File (used to re-edit existing images). */
3632
+ download(team: string, mediaId: string, name: string, mime: string): Promise<File>;
3574
3633
  }
3575
3634
  //#endregion
3576
3635
  //#region src/resources/meetings.d.ts
@@ -3736,7 +3795,7 @@ declare class ProductsResource {
3736
3795
  active?: boolean;
3737
3796
  public?: boolean;
3738
3797
  virtual?: boolean;
3739
- media?: MediaLibraryAttributes[];
3798
+ media?: string[];
3740
3799
  }): Promise<IAppResponse<Product>>;
3741
3800
  delete(id: string): Promise<IAppResponse<void>>;
3742
3801
  createVariation(productSlug: string, data: {
@@ -3752,8 +3811,8 @@ declare class ProductsResource {
3752
3811
  hidden?: boolean;
3753
3812
  type?: string;
3754
3813
  settings?: Record<string, unknown> | null;
3755
- media?: MediaLibraryAttributes[];
3756
- preview?: MediaLibraryAttributes[];
3814
+ media?: string[];
3815
+ preview?: string[];
3757
3816
  stock?: number | null;
3758
3817
  weight?: number | null;
3759
3818
  }): Promise<IAppResponse<ProductVariation>>;
@@ -3918,13 +3977,13 @@ declare class SkillsResource {
3918
3977
  license?: string;
3919
3978
  compatibility?: string;
3920
3979
  allowedTools?: string;
3921
- media?: MediaLibraryItems;
3980
+ media?: AttachedMedia[];
3922
3981
  active?: boolean;
3923
3982
  isPublic?: boolean;
3924
3983
  price?: number;
3925
3984
  }): Promise<IAppResponse<Skill>>;
3926
3985
  update(id: string, data: Partial<Omit<Skill, 'media' | 'store'>> & {
3927
- media?: MediaLibraryItems;
3986
+ media?: AttachedMedia[];
3928
3987
  public?: boolean;
3929
3988
  price?: number;
3930
3989
  }): Promise<IAppResponse<Skill>>;
@@ -3986,7 +4045,7 @@ declare class SwarmsResource {
3986
4045
  constructor(http: IHttpService);
3987
4046
  listSwarms(team: string): Promise<IAppResponse<Swarm[]>>;
3988
4047
  listAgents(swarm: string): Promise<IAppResponse<Agent[]>>;
3989
- storeProposal(agent: string, swarm: string, title: string, description: string, actions: ProposalAction[], attachments: MediaLibraryItems, poll: ProposalPollOption[]): Promise<IAppResponse<Proposal>>;
4048
+ storeProposal(agent: string, swarm: string, title: string, description: string, actions: ProposalAction[], attachments: string[], poll: ProposalPollOption[]): Promise<IAppResponse<Proposal>>;
3990
4049
  finalizeProposal(swarm: string, txHash: string, proposal: string): Promise<IAppResponse<void>>;
3991
4050
  finalizeSignature(swarm: string, txHash: string, proposal: string): Promise<IAppResponse<void>>;
3992
4051
  finalizeExecution(chain: WarpChainName, txHash: string, actions?: ProposalAction[]): Promise<IAppResponse<void>>;
@@ -4065,9 +4124,15 @@ declare class TeamsResource {
4065
4124
  inviteMember(teamSlug: string, email: string, role: UserRole): Promise<IAppResponse<void>>;
4066
4125
  removeMember(teamSlug: string, memberId: string): Promise<IAppResponse<void>>;
4067
4126
  listMembers(teamSlug: string): Promise<IAppResponse<TeamMember[]>>;
4068
- updateLogo(teamSlug: string, logo: MediaLibraryItems): Promise<IAppResponse<TeamPrivate>>;
4069
- updateCover(teamSlug: string, cover: MediaLibraryItems): Promise<IAppResponse<TeamPrivate>>;
4127
+ updateLogo(teamSlug: string, logo: string[]): Promise<IAppResponse<TeamPrivate>>;
4128
+ updateCover(teamSlug: string, cover: string[]): Promise<IAppResponse<TeamPrivate>>;
4070
4129
  updateSetting(teamSlug: string, key: string, value: boolean | string | number | object | null): Promise<IAppResponse<TeamPrivate>>;
4130
+ searchPlaces(teamSlug: string, query: string, options?: {
4131
+ language?: string;
4132
+ region?: string;
4133
+ limit?: number;
4134
+ }): Promise<IAppResponse<TeamPlace[]>>;
4135
+ selectPlace(teamSlug: string, sourceId: string | null): Promise<IAppResponse<TeamPrivate>>;
4071
4136
  listPrivate(): Promise<IAppResponse<TeamPrivate[]>>;
4072
4137
  getInviteByToken(token: string): Promise<IAppResponse<TeamInviteInfo>>;
4073
4138
  acceptInvite(slug: string): Promise<IAppResponse<void>>;
@@ -4214,6 +4279,12 @@ type BackendWarp = {
4214
4279
  agent?: AgentPrivate | null;
4215
4280
  link?: Link | null;
4216
4281
  };
4282
+ type WarpExecutionContext<C extends Record<string, unknown> = Record<string, never>> = {
4283
+ locale?: string;
4284
+ sourceUrl?: string;
4285
+ ipAddress?: string;
4286
+ userAgent?: string;
4287
+ } & C;
4217
4288
  declare class WarpsResource {
4218
4289
  private readonly http;
4219
4290
  constructor(http: IHttpService);
@@ -4238,6 +4309,7 @@ declare class WarpsResource {
4238
4309
  form?: boolean;
4239
4310
  store?: boolean;
4240
4311
  agent?: string | null;
4312
+ optIn?: boolean | null;
4241
4313
  }): Promise<IAppResponse<BackendWarpCreateResponse>>;
4242
4314
  update(identifier: string, data: {
4243
4315
  name?: string;
@@ -4249,10 +4321,12 @@ declare class WarpsResource {
4249
4321
  store?: boolean;
4250
4322
  agent?: string | null;
4251
4323
  public?: boolean;
4324
+ optIn?: boolean | null;
4252
4325
  }): Promise<IAppResponse<BackendWarpUpdateResponse>>;
4253
4326
  destroy(identifier: string): Promise<IAppResponse<void>>;
4254
- execute(identifier: string, inputs: string[], room?: string): Promise<IAppResponse<JsonValue>>;
4327
+ execute<C extends Record<string, unknown> = Record<string, never>>(identifier: string, inputs: string[], room?: string, context?: WarpExecutionContext<C>): Promise<IAppResponse<JsonValue>>;
4255
4328
  executions(identifier: string, page?: number, perPage?: number): Promise<IAppResponse<WarpExecutionBackend[]>>;
4329
+ results(identifier: string, page?: number, perPage?: number): Promise<IAppResponse<WarpExecutionBackend[]>>;
4256
4330
  ensureLink(identifier: string): Promise<IAppResponse<Link>>;
4257
4331
  install(identifier: string): Promise<IAppResponse<{
4258
4332
  identifier: string;
@@ -4283,7 +4357,7 @@ declare class WarpsResource {
4283
4357
  name?: string;
4284
4358
  description?: string;
4285
4359
  public?: boolean;
4286
- logo?: MediaLibraryItems | null;
4360
+ logo?: string[] | null;
4287
4361
  source?: BrandSourceConfig | null;
4288
4362
  }): Promise<IAppResponse<BrandBackend>>;
4289
4363
  deleteTeamBrand(teamSlug: string, brandSlug: string): Promise<IAppResponse<void>>;
@@ -4312,35 +4386,15 @@ declare class WarpsResource {
4312
4386
  fetchSourceSchemaFromUrl(url: string): Promise<IAppResponse<any>>;
4313
4387
  }
4314
4388
  //#endregion
4315
- //#region src/resources/webhooks.d.ts
4316
- declare class WebhooksResource {
4389
+ //#region src/resources/hooks.d.ts
4390
+ declare class HooksResource {
4317
4391
  private readonly http;
4318
4392
  constructor(http: IHttpService);
4319
- list(agentId: string): Promise<IAppResponse<Webhook[]>>;
4320
- create(agentId: string, name: string, url: string, trigger: WebhookTriggerEvent, options?: {
4321
- headers?: Record<string, string>;
4322
- description?: string;
4323
- active?: boolean;
4324
- verifySsl?: boolean;
4325
- timeout?: number;
4326
- maxRetries?: number;
4327
- }): Promise<IAppResponse<Webhook>>;
4328
- update(agentId: string, webhookId: string, updates: {
4329
- name?: string;
4330
- url?: string;
4331
- trigger?: WebhookTriggerEvent;
4332
- headers?: Record<string, string>;
4333
- description?: string;
4334
- active?: boolean;
4335
- verifySsl?: boolean;
4336
- timeout?: number;
4337
- maxRetries?: number;
4338
- }): Promise<IAppResponse<Webhook>>;
4339
- delete(agentId: string, webhookId: string): Promise<IAppResponse<void>>;
4340
- listWarps(agentId: string): Promise<IAppResponse<AgentWebhookWarp[]>>;
4341
- activateWarp(agentId: string, payload: ActivateAgentWebhookWarpPayload): Promise<IAppResponse<AgentWebhookWarp>>;
4342
- deactivateWarp(agentId: string, warpIdentifier: string): Promise<IAppResponse<void>>;
4343
- deleteWarpHook(agentId: string, webhookId: number): Promise<IAppResponse<void>>;
4393
+ list(agentId: string): Promise<IAppResponse<Hook[]>>;
4394
+ create(agentId: string, payload: CreateHookPayload): Promise<IAppResponse<Hook>>;
4395
+ toggle(agentId: string, hookId: string): Promise<IAppResponse<Hook>>;
4396
+ removeByHook(agentId: string, hookId: string): Promise<IAppResponse<void>>;
4397
+ removeByWarp(agentId: string, warpIdentifier: string): Promise<IAppResponse<void>>;
4344
4398
  }
4345
4399
  //#endregion
4346
4400
  //#region src/cache/types.d.ts
@@ -4357,6 +4411,7 @@ interface JoAiClientConfig {
4357
4411
  env?: AppEnv;
4358
4412
  agentAuthKey?: string;
4359
4413
  cache?: CacheConfig;
4414
+ buildSecret?: string;
4360
4415
  }
4361
4416
  declare class JoAiClient {
4362
4417
  readonly http: IHttpService;
@@ -4427,7 +4482,7 @@ declare class JoAiClient {
4427
4482
  readonly users: UsersResource;
4428
4483
  readonly voice: VoiceResource;
4429
4484
  readonly wallets: WalletsResource;
4430
- readonly webhooks: WebhooksResource;
4485
+ readonly hooks: HooksResource;
4431
4486
  readonly workspace: WorkspaceResource;
4432
4487
  constructor(config: JoAiClientConfig);
4433
4488
  clearCache(): void;
@@ -4467,4 +4522,4 @@ declare class DistributionResource {
4467
4522
  private fetchDistribution;
4468
4523
  }
4469
4524
  //#endregion
4470
- export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, type AuthSendCodeRequest, type AuthVerifyResponse, type BackendWarp, type BackendWarpBrand, BillingAddressesResource, BillingResource, BlueprintsResource, type CacheConfig, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, type JoAiClientConfig, KvResource, LinksResource, LoyaltyResource, McpResource, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, type OpeningHoursEntry, type OpeningHoursFormatOptions, OrdersResource, PersonaResource, type Product, type ProductVariation, ProductsResource, ProjectsResource, RemindersResource, SegmentsResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, type TeamInviteInfo, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WebhooksResource, WorkspaceResource, createClient, formatOpeningHours };
4525
+ export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, type AttachedMedia, AuthResource, type AuthSendCodeRequest, type AuthVerifyResponse, type BackendWarp, type BackendWarpBrand, BillingAddressesResource, BillingResource, BlueprintsResource, type CacheConfig, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, type CreateHookPayload, type CreateInternalHookPayload, type CreateWarpLinkedHookPayload, type CreateWebHookPayload, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, type Hook, type HookTrigger, type HookTriggerCondition, type HookTriggerInput, HooksResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, type JoAiClientConfig, KvResource, LinksResource, LoyaltyResource, McpResource, type MediaUploadType, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, type OpeningHoursEntry, type OpeningHoursFormatOptions, OrdersResource, PersonaResource, type Product, type ProductVariation, ProductsResource, ProjectsResource, RemindersResource, SegmentsResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, type TeamInviteInfo, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, type WebHookTriggerEvent, WorkspaceResource, createClient, formatOpeningHours };
package/dist/index.mjs CHANGED
@@ -548,7 +548,7 @@ var BillingResource = class {
548
548
  return this.http.get(params);
549
549
  }
550
550
  payOrder(id, provider) {
551
- return this.http.post(`orders/${id}/pay`, { provider });
551
+ return this.http.post(`orders/${id}/pay`, provider ? { provider } : {});
552
552
  }
553
553
  deleteOrder(id) {
554
554
  return this.http.delete(`orders/${id}`);
@@ -741,6 +741,8 @@ var ContactsResource = class {
741
741
  if (params?.search) query.set("filter[search]", params.search);
742
742
  if (params?.page) query.set("page", String(params.page));
743
743
  if (params?.staleDays) query.set("filter[stale_days]", String(params.staleDays));
744
+ if (params?.waitingOn) query.set("filter[waiting_on]", "1");
745
+ if (params?.overdue) query.set("filter[followup_overdue]", "1");
744
746
  const qs = query.toString();
745
747
  return this.http.get(`contacts${qs ? "?" + qs : ""}`);
746
748
  }
@@ -1325,11 +1327,12 @@ var MediaResource = class {
1325
1327
  return this.http.get(`media/public${qs ? "?" + qs : ""}`);
1326
1328
  }
1327
1329
  upload(data) {
1328
- const { team, file, fileUrl, fileName, mimeType, type, label, tags, copyright } = data;
1330
+ const { team, file, fileUrl, fileName, mimeType, type, aspect, label, tags, copyright } = data;
1329
1331
  if (file) {
1330
1332
  const formData = new FormData();
1331
1333
  formData.append("file", file, file.name);
1332
1334
  formData.append("type", type);
1335
+ if (aspect) formData.append("aspect", aspect);
1333
1336
  if (label) formData.append("label", label);
1334
1337
  if (tags) tags.forEach((t) => formData.append("tags[]", t));
1335
1338
  if (copyright) formData.append("copyright", copyright);
@@ -1340,33 +1343,39 @@ var MediaResource = class {
1340
1343
  fileName,
1341
1344
  mimeType,
1342
1345
  type,
1346
+ aspect,
1343
1347
  label,
1344
1348
  tags,
1345
1349
  copyright
1346
1350
  }, { headers: { "X-Team": team } });
1347
1351
  }
1348
- listTeam(team, params) {
1352
+ list(team, params) {
1349
1353
  const query = new URLSearchParams();
1350
1354
  query.set("page", String(params?.page ?? 1));
1351
1355
  if (params?.mime) query.set("mime", params.mime);
1352
- return this.http.get(`teams/${team}/media?${query.toString()}`);
1356
+ return this.http.get(`media?${query.toString()}`, { headers: { "X-Team": team } });
1353
1357
  }
1354
- uploadTeam(team, media, tags, options) {
1355
- return this.http.post(`teams/${team}/media/upload`, {
1356
- media,
1357
- tags,
1358
- preserveOriginal: options?.preserveOriginal,
1359
- copyright: options?.copyright
1360
- });
1358
+ get(team, mediaId) {
1359
+ return this.http.get(`media/${mediaId}`, { headers: { "X-Team": team } });
1360
+ }
1361
+ delete(team, mediaId) {
1362
+ return this.http.delete(`media/${mediaId}`, { headers: { "X-Team": team } });
1361
1363
  }
1362
- deleteTeam(team, mediaId) {
1363
- return this.http.delete(`teams/${team}/media/${mediaId}`);
1364
+ update(team, mediaId, data) {
1365
+ return this.http.put(`media/${mediaId}`, data, { headers: { "X-Team": team } });
1364
1366
  }
1365
- updateTeamMedia(team, mediaId, data) {
1366
- return this.http.put(`teams/${team}/media/${mediaId}`, data);
1367
+ updateTags(team, mediaId, tags) {
1368
+ return this.http.put(`media/${mediaId}/tags`, { tags }, { headers: { "X-Team": team } });
1367
1369
  }
1368
- updateTeamMediaTags(team, mediaId, tags) {
1369
- return this.http.put(`teams/${team}/media/${mediaId}/tags`, { tags });
1370
+ /** Download the stored bytes of a media item as a File (used to re-edit existing images). */
1371
+ async download(team, mediaId, name, mime) {
1372
+ const url = `${this.http.baseUrl}/media/${mediaId}/download`;
1373
+ const headers = { "X-Team": team };
1374
+ if (this.http.authToken) headers["Authorization"] = `Bearer ${this.http.authToken}`;
1375
+ const res = await fetch(url, { headers });
1376
+ if (!res.ok) throw new Error(`Failed to download media (${res.status})`);
1377
+ const blob = await res.blob();
1378
+ return new File([blob], name, { type: mime });
1370
1379
  }
1371
1380
  };
1372
1381
  //#endregion
@@ -2049,6 +2058,16 @@ var TeamsResource = class {
2049
2058
  updateSetting(teamSlug, key, value) {
2050
2059
  return this.http.put(`teams/${teamSlug}/settings/${key}`, { value });
2051
2060
  }
2061
+ searchPlaces(teamSlug, query, options) {
2062
+ const params = new URLSearchParams({ query });
2063
+ if (options?.language) params.set("language", options.language);
2064
+ if (options?.region) params.set("region", options.region);
2065
+ if (options?.limit) params.set("limit", String(options.limit));
2066
+ return this.http.get(`teams/${teamSlug}/places?${params}`);
2067
+ }
2068
+ selectPlace(teamSlug, sourceId) {
2069
+ return this.http.put(`teams/${teamSlug}/place`, { sourceId });
2070
+ }
2052
2071
  listPrivate() {
2053
2072
  return this.http.get("teams?me=true");
2054
2073
  }
@@ -2355,15 +2374,19 @@ var WarpsResource = class {
2355
2374
  destroy(identifier) {
2356
2375
  return this.http.delete(`warps/${identifier}`);
2357
2376
  }
2358
- execute(identifier, inputs, room) {
2377
+ execute(identifier, inputs, room, context) {
2359
2378
  return this.http.post(`warps/${identifier}/execute`, {
2360
2379
  inputs,
2361
- ...room ? { room } : {}
2380
+ ...room ? { room } : {},
2381
+ ...context ? { context } : {}
2362
2382
  });
2363
2383
  }
2364
2384
  executions(identifier, page = 1, perPage = 20) {
2365
2385
  return this.http.get(`warps/${identifier}/executions?page=${page}&perPage=${perPage}`);
2366
2386
  }
2387
+ results(identifier, page = 1, perPage = 50) {
2388
+ return this.http.get(`warps/${identifier}/results?page=${page}&perPage=${perPage}`);
2389
+ }
2367
2390
  ensureLink(identifier) {
2368
2391
  return this.http.post(`warps/${identifier}/link`, {});
2369
2392
  }
@@ -2432,39 +2455,25 @@ var WarpsResource = class {
2432
2455
  }
2433
2456
  };
2434
2457
  //#endregion
2435
- //#region src/resources/webhooks.ts
2436
- var WebhooksResource = class {
2458
+ //#region src/resources/hooks.ts
2459
+ var HooksResource = class {
2437
2460
  constructor(http) {
2438
2461
  this.http = http;
2439
2462
  }
2440
2463
  list(agentId) {
2441
- return this.http.get(`agents/${agentId}/webhooks`);
2442
- }
2443
- create(agentId, name, url, trigger, options) {
2444
- return this.http.post(`agents/${agentId}/webhooks`, {
2445
- name,
2446
- url,
2447
- trigger,
2448
- ...options
2449
- });
2450
- }
2451
- update(agentId, webhookId, updates) {
2452
- return this.http.patch(`agents/${agentId}/webhooks/${webhookId}`, updates);
2453
- }
2454
- delete(agentId, webhookId) {
2455
- return this.http.delete(`agents/${agentId}/webhooks/${webhookId}`);
2464
+ return this.http.get(`hooks?agent=${agentId}`);
2456
2465
  }
2457
- listWarps(agentId) {
2458
- return this.http.get(`agents/${agentId}/webhook-warps`);
2466
+ create(agentId, payload) {
2467
+ return this.http.post(`hooks?agent=${agentId}`, payload);
2459
2468
  }
2460
- activateWarp(agentId, payload) {
2461
- return this.http.post(`agents/${agentId}/webhook-warps`, payload);
2469
+ toggle(agentId, hookId) {
2470
+ return this.http.post(`hooks/${hookId}/toggle?agent=${agentId}`);
2462
2471
  }
2463
- deactivateWarp(agentId, warpIdentifier) {
2464
- return this.http.delete(`agents/${agentId}/webhook-warps?warpIdentifier=${encodeURIComponent(warpIdentifier)}`);
2472
+ removeByHook(agentId, hookId) {
2473
+ return this.http.delete(`hooks?agent=${agentId}&hookId=${encodeURIComponent(hookId)}`);
2465
2474
  }
2466
- deleteWarpHook(agentId, webhookId) {
2467
- return this.http.delete(`agents/${agentId}/webhook-warps?webhookId=${encodeURIComponent(webhookId)}`);
2475
+ removeByWarp(agentId, warpIdentifier) {
2476
+ return this.http.delete(`hooks?agent=${agentId}&warpIdentifier=${encodeURIComponent(warpIdentifier)}`);
2468
2477
  }
2469
2478
  };
2470
2479
  //#endregion
@@ -2596,6 +2605,7 @@ var JoAiClient = class {
2596
2605
  const headers = {};
2597
2606
  if (config.team) headers["X-Team"] = config.team;
2598
2607
  if (config.agentAuthKey) headers["X-Agent-Auth-Key"] = config.agentAuthKey;
2608
+ if (config.buildSecret) headers["X-Build-Secret"] = config.buildSecret;
2599
2609
  const http = new HttpService(`${apiBaseUrl}/v1`, void 0, config.apiToken, {
2600
2610
  headers,
2601
2611
  csrfBaseUrl: apiBaseUrl
@@ -2666,7 +2676,7 @@ var JoAiClient = class {
2666
2676
  this.users = new UsersResource(this.http);
2667
2677
  this.voice = new VoiceResource(this.http);
2668
2678
  this.wallets = new WalletsResource(this.http);
2669
- this.webhooks = new WebhooksResource(this.http);
2679
+ this.hooks = new HooksResource(this.http);
2670
2680
  this.workspace = new WorkspaceResource(this.http);
2671
2681
  }
2672
2682
  clearCache() {
@@ -2712,4 +2722,4 @@ var DistributionResource = class {
2712
2722
  }
2713
2723
  };
2714
2724
  //#endregion
2715
- export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, BillingAddressesResource, BillingResource, BlueprintsResource, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, KvResource, LinksResource, LoyaltyResource, McpResource, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, OrdersResource, PersonaResource, ProductsResource, ProjectsResource, RemindersResource, SegmentsResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WebhooksResource, WorkspaceResource, createClient, formatOpeningHours };
2725
+ export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, BillingAddressesResource, BillingResource, BlueprintsResource, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, HooksResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, KvResource, LinksResource, LoyaltyResource, McpResource, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, OrdersResource, PersonaResource, ProductsResource, ProjectsResource, RemindersResource, SegmentsResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WorkspaceResource, createClient, formatOpeningHours };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",