@joai/sdk 2.3.0 → 3.0.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
@@ -37,7 +37,8 @@ interface IRequestOptions {
37
37
  type SocialAuthProvider = 'github' | 'apple' | 'google' | 'x' | 'telegram' | 'slack'; //#endregion
38
38
  //#region src/config/types.d.ts
39
39
  type AppEnv = 'mainnet' | 'testnet' | 'devnet' | 'local'; //#endregion
40
- //#region src/config/urls.d.ts
40
+ //#region src/auth/token.d.ts
41
+ /** One-time native/deep-link handoff param (exchanged for a Bearer via API). */
41
42
  //#endregion
42
43
  //#region src/ingestion/types.d.ts
43
44
  type IngestionSourceType = 'note' | 'meeting' | 'article' | 'email' | 'chat' | 'post' | 'webhook';
@@ -724,7 +725,7 @@ type OrderItem = {
724
725
  name: string;
725
726
  quantity: number;
726
727
  unitPrice: number;
727
- type: 'product-variation' | 'service';
728
+ type: 'product-variation' | 'service' | 'coupon';
728
729
  digital?: boolean | null;
729
730
  sellerTeamId?: string | null;
730
731
  };
@@ -758,6 +759,7 @@ type Order = {
758
759
  notes: string | null;
759
760
  configuration?: OrderConfigurationItem[];
760
761
  items: OrderItem[];
762
+ coupon?: Coupon | null;
761
763
  plan: Plan | null;
762
764
  user: UserPrivate | null;
763
765
  team: TeamPrivate | null;
@@ -799,6 +801,7 @@ type Coupon = {
799
801
  amount: number | null;
800
802
  percent: number | null;
801
803
  price: number | null;
804
+ discount?: number;
802
805
  condition: CouponCondition;
803
806
  restrictedItems: CouponRestrictedItem[];
804
807
  usesLeft: number | null;
@@ -837,7 +840,7 @@ type Skill = {
837
840
  screenshots: string[];
838
841
  }; //#endregion
839
842
  //#region src/integration/types.d.ts
840
- type IntegrationType = 'none' | 'webhook' | 'api-token' | 'telegram' | 'slack' | 'whatsapp' | 'twilio' | 'sms' | 'n8n' | 'apple-health' | 'mcp' | 'x' | 'email' | 'calendar' | 'embed' | 'discord' | 'github' | 'push' | 'sentry' | 'readwise';
843
+ type IntegrationType = 'none' | 'webhook' | 'api-token' | 'telegram' | 'slack' | 'whatsapp' | 'whatsapp-personal' | 'twilio' | 'sms' | 'n8n' | 'apple-health' | 'mcp' | 'x' | 'xchat' | 'instagram' | 'grok' | 'email' | 'calendar' | 'embed' | 'discord' | 'github' | 'push' | 'sentry' | 'readwise';
841
844
  type IntegrationDetails = {
842
845
  type: IntegrationType;
843
846
  name: string;
@@ -851,8 +854,16 @@ type IntegrationDetails = {
851
854
  type IntegrationMeta = {
852
855
  handle?: string;
853
856
  provider?: EmailProvider | null;
857
+ hookSource?: string;
854
858
  [key: string]: unknown;
855
859
  };
860
+ type IntegrationConnectionDetails = IntegrationDetails & {
861
+ phoneNumberId?: string;
862
+ phoneNumber?: string;
863
+ webhookUrl?: string;
864
+ webhookSecret?: string;
865
+ webhookSecretKey?: string;
866
+ };
856
867
  type Integration = {
857
868
  id: string;
858
869
  type: IntegrationType;
@@ -861,9 +872,9 @@ type Integration = {
861
872
  configured: boolean;
862
873
  createdAt: string;
863
874
  meta?: IntegrationMeta;
864
- details?: IntegrationDetails;
875
+ details?: IntegrationConnectionDetails;
865
876
  };
866
- type SocialPlatform = 'telegram' | 'slack' | 'whatsapp' | 'sms' | 'discord' | 'github';
877
+ type SocialPlatform = 'telegram' | 'slack' | 'whatsapp' | 'sms' | 'discord' | 'github' | 'xchat' | 'instagram';
867
878
  type SocialBot = {
868
879
  name: string;
869
880
  createdAt: string;
@@ -1167,51 +1178,6 @@ type BrandBackend = {
1167
1178
  integrations?: Partial<Record<BrandIntegrationProvider, BrandIntegration>>;
1168
1179
  };
1169
1180
  };
1170
- //#endregion
1171
- //#region src/store/types.d.ts
1172
- type StoreVisibility = 'private' | 'team' | 'public';
1173
- type StoreEntry = {
1174
- value: number | string | boolean;
1175
- label?: string;
1176
- at: string;
1177
- };
1178
- type Store = {
1179
- name: string;
1180
- description: string;
1181
- valueType: 'scalar' | 'series';
1182
- unit?: string;
1183
- visibility: StoreVisibility;
1184
- entryCount: number;
1185
- lastValue?: number | string | boolean;
1186
- lastAt?: string;
1187
- };
1188
- type StoreWithEntries = {
1189
- name: string;
1190
- description: string;
1191
- unit?: string;
1192
- entries: StoreEntry[];
1193
- };
1194
- type StoreCreatePayload = {
1195
- name: string;
1196
- description?: string;
1197
- valueType?: 'scalar' | 'series';
1198
- unit?: string;
1199
- visibility?: StoreVisibility;
1200
- };
1201
- type StoreEntryPayload = {
1202
- storeName?: string;
1203
- value: number | string | boolean;
1204
- label?: string;
1205
- };
1206
- type StoreEntryResult = {
1207
- name: string;
1208
- entryCount: number;
1209
- };
1210
- type StoreToggleResult = {
1211
- name: string;
1212
- value: number | string | boolean;
1213
- previous: number | string | boolean;
1214
- };
1215
1181
  type StorePricing = {
1216
1182
  model: PricingModel;
1217
1183
  amount: string;
@@ -1518,6 +1484,7 @@ type AppointmentPolicy = {
1518
1484
  serviceSelectionEnabled?: boolean | null;
1519
1485
  paymentEnabled?: boolean | null;
1520
1486
  bookingCapacity?: number | null;
1487
+ bookingCapacityUnit?: 'booking' | 'person' | null;
1521
1488
  requireApproval?: boolean | null;
1522
1489
  sync?: AppointmentPolicySync | null;
1523
1490
  agent?: Agent | null;
@@ -1793,6 +1760,7 @@ type Item = {
1793
1760
  };
1794
1761
  type ItemCreatePayload = {
1795
1762
  title: string;
1763
+ source?: 'user' | 'api';
1796
1764
  description?: string;
1797
1765
  priority?: ItemPriority;
1798
1766
  tags?: string[];
@@ -1815,6 +1783,49 @@ type ItemUpdatePayload = {
1815
1783
  contactIds?: string[];
1816
1784
  assignedToIds?: string[];
1817
1785
  }; //#endregion
1786
+ //#region src/kv/types.d.ts
1787
+ type KvValue = number | string | boolean;
1788
+ type KvEntry = {
1789
+ value: KvValue;
1790
+ label?: string | null;
1791
+ at: string;
1792
+ };
1793
+ type KvField = {
1794
+ name: string;
1795
+ description: string | null;
1796
+ valueType: 'scalar' | 'series';
1797
+ unit: string | null;
1798
+ entryCount: number;
1799
+ lastValue?: KvValue | null;
1800
+ lastAt?: string | null;
1801
+ };
1802
+ type KvFieldWithEntries = Pick<KvField, 'name' | 'description' | 'unit'> & {
1803
+ entries: KvEntry[];
1804
+ nextCursor: string | null;
1805
+ };
1806
+ type CreateKvFieldPayload = {
1807
+ name: string;
1808
+ description?: string;
1809
+ valueType?: 'scalar' | 'series';
1810
+ unit?: string;
1811
+ };
1812
+ type KvEntryPayload = {
1813
+ field?: string;
1814
+ value: KvValue;
1815
+ label?: string;
1816
+ };
1817
+ type SetKvEntryResult = KvEntry & {
1818
+ name: string;
1819
+ };
1820
+ type AppendKvEntryResult = {
1821
+ name: string;
1822
+ entryCount: number;
1823
+ };
1824
+ type ToggleKvFieldResult = {
1825
+ name: string;
1826
+ value: KvValue;
1827
+ previous: KvValue | null;
1828
+ }; //#endregion
1818
1829
  //#region src/marketing/types.d.ts
1819
1830
  //#endregion
1820
1831
  //#region src/mcp/types.d.ts
@@ -2781,7 +2792,17 @@ type CreateWebHookPayload = {
2781
2792
  type CreateWarpLinkedHookPayload = {
2782
2793
  warpIdentifier: string;
2783
2794
  };
2784
- type CreateHookPayload = CreateInternalHookPayload | CreateWebHookPayload | CreateWarpLinkedHookPayload; //#endregion
2795
+ type CreateInboundHookPayload = {
2796
+ source: string;
2797
+ warpIdentifier: string;
2798
+ trigger?: HookTrigger;
2799
+ };
2800
+ type CreateHookPayload = CreateInternalHookPayload | CreateWebHookPayload | CreateWarpLinkedHookPayload | CreateInboundHookPayload;
2801
+ type HookSample = {
2802
+ source: string;
2803
+ payload: Record<string, unknown> | null;
2804
+ recordedAt: string | null;
2805
+ }; //#endregion
2785
2806
  //#region src/workspace/types.d.ts
2786
2807
  type WorkspaceInfo = {
2787
2808
  id?: string;
@@ -3064,6 +3085,7 @@ type AuthSendCodeRequest = {
3064
3085
  table?: string;
3065
3086
  };
3066
3087
  type AuthVerifyResponse = {
3088
+ token: string;
3067
3089
  user: AuthUser;
3068
3090
  team: {
3069
3091
  slug: string;
@@ -4021,18 +4043,19 @@ declare class StatsResource {
4021
4043
  declare class KvResource {
4022
4044
  private readonly http;
4023
4045
  constructor(http: IHttpService);
4024
- list(): Promise<IAppResponse<Store[]>>;
4025
- create(payload: StoreCreatePayload): Promise<IAppResponse<Store>>;
4046
+ list(): Promise<IAppResponse<KvField[]>>;
4047
+ create(payload: CreateKvFieldPayload): Promise<IAppResponse<KvField>>;
4026
4048
  entries(params?: {
4027
- storeName?: string;
4049
+ field?: string;
4028
4050
  since?: string;
4029
4051
  until?: string;
4030
4052
  last?: number;
4031
- }): Promise<IAppResponse<StoreWithEntries>>;
4032
- setEntry(payload: StoreEntryPayload): Promise<IAppResponse<StoreEntryResult>>;
4033
- appendEntry(payload: StoreEntryPayload): Promise<IAppResponse<StoreEntryResult>>;
4034
- toggle(storeName?: string): Promise<IAppResponse<StoreToggleResult>>;
4035
- delete(storeName: string): Promise<IAppResponse<void>>;
4053
+ cursor?: string;
4054
+ }): Promise<IAppResponse<KvFieldWithEntries>>;
4055
+ setEntry(payload: KvEntryPayload): Promise<IAppResponse<SetKvEntryResult>>;
4056
+ appendEntry(payload: KvEntryPayload): Promise<IAppResponse<AppendKvEntryResult>>;
4057
+ toggle(field?: string): Promise<IAppResponse<ToggleKvFieldResult>>;
4058
+ delete(field: string): Promise<IAppResponse<void>>;
4036
4059
  }
4037
4060
  //#endregion
4038
4061
  //#region src/resources/subscriptions.d.ts
@@ -4402,6 +4425,7 @@ declare class HooksResource {
4402
4425
  constructor(http: IHttpService);
4403
4426
  list(agentId: string): Promise<IAppResponse<Hook[]>>;
4404
4427
  create(agentId: string, payload: CreateHookPayload): Promise<IAppResponse<Hook>>;
4428
+ sample(agentId: string, source: string): Promise<IAppResponse<HookSample>>;
4405
4429
  toggle(agentId: string, hookId: string): Promise<IAppResponse<Hook>>;
4406
4430
  removeByHook(agentId: string, hookId: string): Promise<IAppResponse<void>>;
4407
4431
  removeByWarp(agentId: string, warpIdentifier: string): Promise<IAppResponse<void>>;
@@ -4532,4 +4556,4 @@ declare class DistributionResource {
4532
4556
  private fetchDistribution;
4533
4557
  }
4534
4558
  //#endregion
4535
- 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 };
4559
+ 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 CreateInboundHookPayload, type CreateInternalHookPayload, type CreateWarpLinkedHookPayload, type CreateWebHookPayload, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, type Hook, type HookSample, 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
@@ -1874,10 +1874,11 @@ var KvResource = class {
1874
1874
  }
1875
1875
  entries(params) {
1876
1876
  const query = new URLSearchParams();
1877
- if (params?.storeName) query.set("storeName", params.storeName);
1877
+ if (params?.field) query.set("field", params.field);
1878
1878
  if (params?.since) query.set("since", params.since);
1879
1879
  if (params?.until) query.set("until", params.until);
1880
1880
  if (params?.last != null) query.set("last", String(params.last));
1881
+ if (params?.cursor) query.set("cursor", params.cursor);
1881
1882
  const qs = query.toString();
1882
1883
  return this.http.get(`kv/entries${qs ? "?" + qs : ""}`);
1883
1884
  }
@@ -1887,11 +1888,11 @@ var KvResource = class {
1887
1888
  appendEntry(payload) {
1888
1889
  return this.http.post("kv/entries/append", payload);
1889
1890
  }
1890
- toggle(storeName) {
1891
- return this.http.post("kv/toggle", { storeName });
1891
+ toggle(field) {
1892
+ return this.http.post("kv/toggle", { field });
1892
1893
  }
1893
- delete(storeName) {
1894
- return this.http.delete(`kv/${storeName}`);
1894
+ delete(field) {
1895
+ return this.http.delete(`kv/${encodeURIComponent(field)}`);
1895
1896
  }
1896
1897
  };
1897
1898
  //#endregion
@@ -2472,6 +2473,9 @@ var HooksResource = class {
2472
2473
  create(agentId, payload) {
2473
2474
  return this.http.post(`hooks?agent=${agentId}`, payload);
2474
2475
  }
2476
+ sample(agentId, source) {
2477
+ return this.http.get(`hooks/sample?agent=${agentId}&source=${encodeURIComponent(source)}`);
2478
+ }
2475
2479
  toggle(agentId, hookId) {
2476
2480
  return this.http.post(`hooks/${hookId}/toggle?agent=${agentId}`);
2477
2481
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "2.3.0",
3
+ "version": "3.0.0",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,7 +31,8 @@
31
31
  },
32
32
  "scripts": {
33
33
  "build": "tsdown",
34
- "dev": "tsdown --watch"
34
+ "dev": "tsdown --watch",
35
+ "test": "jest --config jest.config.js"
35
36
  },
36
37
  "dependencies": {
37
38
  "@joai/warps": "*"