@joai/sdk 4.3.0 → 4.6.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
@@ -1,6 +1,13 @@
1
1
  import { WarpBrandUrls, WarpChainInfo, WarpChainName, WarpClient, WarpI18nText, WarpLocale, WarpNativeValue, WarpText, WarpWalletProvider } from "@joai/warps";
2
2
 
3
- //#region ../core/dist/types-BbqlPvhU.d.mts
3
+ //#region ../core/dist/index.d.mts
4
+ //#region src/auth/types.d.ts
5
+ type SocialAuthProvider = 'github' | 'apple' | 'google' | 'x' | 'telegram' | 'slack'; //#endregion
6
+ //#region src/config/types.d.ts
7
+ type AppEnv = 'mainnet' | 'testnet' | 'devnet' | 'local'; //#endregion
8
+ //#region src/auth/token.d.ts
9
+ /** One-time native/deep-link handoff fragment key (exchanged for a Bearer via POST). */
10
+ //#endregion
4
11
  //#region src/http/types.d.ts
5
12
  interface IHttpService {
6
13
  readonly baseUrl: string;
@@ -9,6 +16,7 @@ interface IHttpService {
9
16
  onUnauthorized: (response: IAppResponse<any>) => void;
10
17
  onSuccessfulResponse: (response: IAppResponse<any>) => void;
11
18
  onMaintenanceMode: (response: IAppResponse<any>) => void;
19
+ onTooManyRequests: (response: IAppResponse<any>) => void;
12
20
  get: <T>(url: string, options?: IRequestOptions) => Promise<IAppResponse<T>>;
13
21
  post: <T>(url: string, data?: any, options?: IRequestOptions) => Promise<IAppResponse<T>>;
14
22
  put: <T>(url: string, data?: any, options?: IRequestOptions) => Promise<IAppResponse<T>>;
@@ -31,102 +39,7 @@ interface IRequestOptions {
31
39
  [name: string]: string;
32
40
  };
33
41
  } //#endregion
34
- //#region src/json/types.d.ts
35
- type JsonValue = string | number | boolean | null | JsonValue[] | {
36
- [key: string]: JsonValue;
37
- }; //#endregion
38
- //#region src/media/types.d.ts
39
- type MediaLibraryAttributes = {
40
- uuid: string;
41
- order: number;
42
- name: string;
43
- custom_properties: {
44
- [key: string]: JsonValue;
45
- };
46
- preview_url: null | string;
47
- original_url: null | string;
48
- extension?: string;
49
- size?: number;
50
- };
51
- 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';
52
- type MediaAspectRatio = 'free' | '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
53
- type Media = {
54
- id: string;
55
- name: string;
56
- mime: MediaMime;
57
- url: string;
58
- library: MediaLibraryAttributes;
59
- tags?: string[];
60
- copyright?: string | null;
61
- aiGenerated?: boolean;
62
- }; //#endregion
63
- //#region src/content/types.d.ts
64
- type ContentStatus = 'draft' | 'published' | 'archived';
65
- type ContentFieldType = 'text' | 'richText' | 'number' | 'boolean' | 'url' | 'image' | 'media' | 'list' | 'object' | 'reference';
66
- type ContentField = {
67
- key: string;
68
- type: ContentFieldType;
69
- label?: string;
70
- required?: boolean;
71
- };
72
- type ContentDefinition = {
73
- fields: ContentField[];
74
- };
75
- type ContentValue = string | number | boolean | null | ContentValue[] | {
76
- [key: string]: ContentValue;
77
- };
78
- type ContentEntry = {
79
- key: string;
80
- value: ContentValue;
81
- updatedAt: string;
82
- };
83
- type ContentVersion = {
84
- id: string;
85
- number: number;
86
- status: ContentStatus;
87
- entries: ContentEntry[];
88
- snapshotHash: string;
89
- origin: string;
90
- createdAt: string;
91
- updatedAt: string;
92
- publishedAt: string | null;
93
- };
94
- type Content = {
95
- id: string;
96
- name: string;
97
- slug: string;
98
- schema: string | null;
99
- definition: ContentDefinition;
100
- metadata: Record<string, ContentValue>;
101
- version: ContentVersion | null;
102
- createdAt: string;
103
- updatedAt: string;
104
- };
105
- type ContentPatch = {
106
- key: string;
107
- value: ContentValue;
108
- };
109
- type CreateContentInput = {
110
- team: string;
111
- name: string;
112
- slug: string;
113
- schema?: string | null;
114
- definition: ContentDefinition;
115
- metadata?: Record<string, ContentValue>;
116
- };
117
- type PatchContentInput = {
118
- expectedVersion: number;
119
- patches: ContentPatch[];
120
- origin?: 'api' | 'inlineEditor' | 'joai' | 'mcp';
121
- }; //#endregion
122
- //#endregion
123
- //#region ../core/dist/index.d.mts
124
- //#region src/auth/types.d.ts
125
- type SocialAuthProvider = 'github' | 'apple' | 'google' | 'x' | 'telegram' | 'slack'; //#endregion
126
- //#region src/config/types.d.ts
127
- type AppEnv = 'mainnet' | 'testnet' | 'devnet' | 'local'; //#endregion
128
- //#region src/auth/token.d.ts
129
- /** One-time native/deep-link handoff fragment key (exchanged for a Bearer via POST). */
42
+ //#region src/http/service.d.ts
130
43
  //#endregion
131
44
  //#region src/ingestion/types.d.ts
132
45
  type IngestionSourceType = 'note' | 'meeting' | 'article' | 'email' | 'chat' | 'post' | 'webhook';
@@ -392,6 +305,10 @@ type WalletList = Partial<Record<WarpChainName, {
392
305
  provider: WarpWalletProvider;
393
306
  address?: string;
394
307
  }>>; //#endregion
308
+ //#region src/json/types.d.ts
309
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
310
+ [key: string]: JsonValue;
311
+ }; //#endregion
395
312
  //#region src/contact/types.d.ts
396
313
  type ContactHealth = 'active' | 'lukewarm' | 'cold' | 'stale' | 'unknown';
397
314
  type ContactConsentStatus = 'pending' | 'confirmed' | 'superseded' | 'unsubscribed';
@@ -424,6 +341,7 @@ type Contact = {
424
341
  birthday: string | null;
425
342
  website: string | null;
426
343
  location: string | null;
344
+ avatar: string | null;
427
345
  socials: Record<string, string> | null;
428
346
  notes: string | null;
429
347
  tags: string[] | null;
@@ -472,10 +390,67 @@ type ContactFormData = {
472
390
  };
473
391
  nextFollowUpAt?: string | null;
474
392
  followUpNote?: string | null;
393
+ avatar?: string[];
475
394
  };
476
395
  type ContactCreatePayload = ContactFormData & {
477
396
  name: string;
478
397
  wallets?: WalletList;
398
+ };
399
+ type ContactRelationType = 'parent_of' | 'child_of' | 'spouse_of' | 'sibling_of' | 'aunt_of' | 'nibling_of' | 'manages' | 'reports_to' | 'colleague_of' | 'partner_of' | 'client_of' | 'supplier_of' | 'referred_by' | 'referred';
400
+ type ContactRelationCategory = 'family' | 'organization' | 'business' | 'referral';
401
+ type ContactRelationDirection = 'outgoing' | 'incoming';
402
+ type ContactRelationContact = {
403
+ id: string;
404
+ name: string;
405
+ avatar: string | null;
406
+ company: string | null;
407
+ title: string | null;
408
+ };
409
+ type ContactRelation = {
410
+ id: string;
411
+ type: ContactRelationType;
412
+ category: ContactRelationCategory;
413
+ direction: ContactRelationDirection;
414
+ contact: ContactRelationContact;
415
+ meta: Record<string, JsonValue> | null;
416
+ notes: string | null;
417
+ createdAt: string;
418
+ };
419
+ type ContactRelationPayload = {
420
+ relatedContactId: string;
421
+ type: ContactRelationType;
422
+ notes?: string;
423
+ meta?: Record<string, JsonValue>;
424
+ };
425
+ type ContactRelationUpdatePayload = {
426
+ type?: ContactRelationType;
427
+ notes?: string;
428
+ meta?: Record<string, JsonValue>;
429
+ }; //#endregion
430
+ //#region src/media/types.d.ts
431
+ type MediaLibraryAttributes = {
432
+ uuid: string;
433
+ order: number;
434
+ name: string;
435
+ custom_properties: {
436
+ [key: string]: JsonValue;
437
+ };
438
+ preview_url: null | string;
439
+ original_url: null | string;
440
+ extension?: string;
441
+ size?: number;
442
+ };
443
+ 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';
444
+ type MediaAspectRatio = 'free' | '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
445
+ type Media = {
446
+ id: string;
447
+ name: string;
448
+ mime: MediaMime;
449
+ url: string;
450
+ library: MediaLibraryAttributes;
451
+ tags?: string[];
452
+ copyright?: string | null;
453
+ aiGenerated?: boolean;
479
454
  }; //#endregion
480
455
  //#region src/flow/types.d.ts
481
456
  type FlowCategory = 'none' | 'defi' | 'nft' | 'social' | 'devtools' | 'productivity' | 'trading' | 'portfolio';
@@ -642,6 +617,7 @@ declare const NativeApps: {
642
617
  readonly News: "news";
643
618
  readonly Sites: "sites";
644
619
  readonly Contracts: "contracts";
620
+ readonly Artifacts: "artifacts";
645
621
  };
646
622
  type NativeApp = (typeof NativeApps)[keyof typeof NativeApps];
647
623
  //#endregion
@@ -1024,11 +1000,11 @@ type Product = {
1024
1000
  media?: Media[];
1025
1001
  };
1026
1002
  type OrderItem = {
1027
- id: string;
1003
+ id: string | null;
1028
1004
  name: string;
1029
1005
  quantity: number;
1030
1006
  unitPrice: number;
1031
- type: 'product-variation' | 'service' | 'coupon';
1007
+ type: 'product-variation' | 'service' | 'coupon' | 'custom';
1032
1008
  digital?: boolean | null;
1033
1009
  sellerTeamId?: string | null;
1034
1010
  };
@@ -1052,9 +1028,12 @@ type Order = {
1052
1028
  justCreated?: boolean;
1053
1029
  createdAt: string;
1054
1030
  invoiceDate: string;
1031
+ serviceDate: string;
1055
1032
  meta: Record<string, JsonValue> | null;
1056
1033
  contactId: string | null;
1057
1034
  contact?: Contact | null;
1035
+ invoiceContactId?: string | null;
1036
+ invoiceContact?: Contact | null;
1058
1037
  source: OrderSource | null;
1059
1038
  context: OrderContext | null;
1060
1039
  paymentMode: string | null;
@@ -1070,6 +1049,7 @@ type Order = {
1070
1049
  } | null;
1071
1050
  shippingFee?: number;
1072
1051
  fulfillments?: Fulfillment[];
1052
+ returns?: Return[];
1073
1053
  subscription?: Subscription | null;
1074
1054
  configuration?: OrderConfigurationItem[];
1075
1055
  items: OrderItem[];
@@ -1154,7 +1134,7 @@ type Skill = {
1154
1134
  screenshots: string[];
1155
1135
  }; //#endregion
1156
1136
  //#region src/integration/types.d.ts
1157
- 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';
1137
+ type IntegrationType = 'none' | 'webhook' | 'api-token' | 'telegram' | 'slack' | 'whatsapp' | 'whatsapp-personal' | 'twilio' | 'sms' | 'n8n' | 'apple-health' | 'mcp' | 'x' | 'xchat' | 'instagram' | 'grok' | 'cloudflare' | 'email' | 'calendar' | 'embed' | 'discord' | 'github' | 'push' | 'sentry' | 'readwise';
1158
1138
  type IntegrationDetails = {
1159
1139
  type: IntegrationType;
1160
1140
  name: string;
@@ -1299,6 +1279,7 @@ type AgentSimple = {
1299
1279
  team?: {
1300
1280
  slug: string;
1301
1281
  } | null;
1282
+ settings?: Pick<AgentSettings, 'auto'>;
1302
1283
  };
1303
1284
  type AgentEngine = 'cortex' | 'openclaw';
1304
1285
  type AgentGender = 'male' | 'female' | 'neutral';
@@ -1681,6 +1662,82 @@ type PaginatedResponse<T> = {
1681
1662
  total: number;
1682
1663
  last_page: number;
1683
1664
  }; //#endregion
1665
+ //#region src/artifact/types.d.ts
1666
+ type ArtifactType = 'agreement' | 'offer' | 'concept' | 'update' | 'demo' | 'file' | 'other';
1667
+ type ArtifactStatus = 'draft' | 'ready' | 'sent' | 'archived';
1668
+ type ArtifactDeliverIntegration = 'email' | 'sms' | 'whatsapp';
1669
+ type ArtifactLink = {
1670
+ url: string;
1671
+ label?: string | null;
1672
+ };
1673
+ type ArtifactBlockType = 'heading' | 'richText' | 'metrics' | 'table' | 'callout' | 'actions' | 'media' | 'divider';
1674
+ type ArtifactBlock = {
1675
+ id: string;
1676
+ type: ArtifactBlockType;
1677
+ data: Record<string, unknown>;
1678
+ };
1679
+ type ArtifactContactSummary = {
1680
+ id: string;
1681
+ name: string | null;
1682
+ email: string | null;
1683
+ phone: string | null;
1684
+ };
1685
+ type Artifact = {
1686
+ id: string;
1687
+ type: ArtifactType;
1688
+ status: ArtifactStatus;
1689
+ title: string;
1690
+ summary: string | null;
1691
+ blocks: ArtifactBlock[] | null;
1692
+ url: string | null;
1693
+ password: string | null;
1694
+ links: ArtifactLink[];
1695
+ media: Media[];
1696
+ meta: Record<string, unknown> | null;
1697
+ contactId: string | null;
1698
+ orderId: string | null;
1699
+ contact?: ArtifactContactSummary;
1700
+ deliveredAt: string | null;
1701
+ createdAt: string;
1702
+ updatedAt: string;
1703
+ };
1704
+ type ArtifactCreatePayload = {
1705
+ title: string;
1706
+ type: ArtifactType;
1707
+ status?: ArtifactStatus;
1708
+ summary?: string;
1709
+ blocks?: ArtifactBlock[];
1710
+ url?: string;
1711
+ password?: string;
1712
+ links?: ArtifactLink[];
1713
+ extraLinkUrl?: string;
1714
+ extraLinkLabel?: string;
1715
+ media?: string[];
1716
+ meta?: Record<string, unknown>;
1717
+ contactId?: string;
1718
+ orderId?: string;
1719
+ };
1720
+ type ArtifactUpdatePayload = Omit<Partial<ArtifactCreatePayload>, 'blocks'> & {
1721
+ blocks?: ArtifactBlock[] | null;
1722
+ };
1723
+ type ArtifactDeliverPayload = {
1724
+ artifactIds: string[];
1725
+ message: string;
1726
+ integration: ArtifactDeliverIntegration;
1727
+ subject?: string;
1728
+ contactIds?: string[];
1729
+ agentId?: string;
1730
+ };
1731
+ type ArtifactDelivery = {
1732
+ id: string;
1733
+ contactId: string;
1734
+ integration: ArtifactDeliverIntegration;
1735
+ subject: string | null;
1736
+ message: string;
1737
+ artifactIds?: string[];
1738
+ deliveredAt: string;
1739
+ createdAt: string;
1740
+ }; //#endregion
1684
1741
  //#region src/service/types.d.ts
1685
1742
  type Service = {
1686
1743
  id: string;
@@ -1841,6 +1898,65 @@ type AppointmentRequest = {
1841
1898
  configuration?: Configuration;
1842
1899
  createdAt: string;
1843
1900
  }; //#endregion
1901
+ //#region src/content/types.d.ts
1902
+ type ContentStatus = 'draft' | 'published' | 'archived';
1903
+ type ContentFieldType = 'text' | 'richText' | 'number' | 'boolean' | 'url' | 'image' | 'media' | 'list' | 'object' | 'reference';
1904
+ type ContentField = {
1905
+ key: string;
1906
+ type: ContentFieldType;
1907
+ label?: string;
1908
+ required?: boolean;
1909
+ };
1910
+ type ContentDefinition = {
1911
+ fields: ContentField[];
1912
+ };
1913
+ type ContentValue = string | number | boolean | null | ContentValue[] | {
1914
+ [key: string]: ContentValue;
1915
+ };
1916
+ type ContentEntry = {
1917
+ key: string;
1918
+ value: ContentValue;
1919
+ updatedAt: string;
1920
+ };
1921
+ type ContentVersion = {
1922
+ id: string;
1923
+ number: number;
1924
+ status: ContentStatus;
1925
+ entries: ContentEntry[];
1926
+ snapshotHash: string;
1927
+ origin: string;
1928
+ createdAt: string;
1929
+ updatedAt: string;
1930
+ publishedAt: string | null;
1931
+ };
1932
+ type Content = {
1933
+ id: string;
1934
+ name: string;
1935
+ slug: string;
1936
+ schema: string | null;
1937
+ definition: ContentDefinition;
1938
+ metadata: Record<string, ContentValue>;
1939
+ version: ContentVersion | null;
1940
+ createdAt: string;
1941
+ updatedAt: string;
1942
+ };
1943
+ type ContentPatch = {
1944
+ key: string;
1945
+ value: ContentValue;
1946
+ };
1947
+ type CreateContentInput = {
1948
+ team: string;
1949
+ name: string;
1950
+ slug: string;
1951
+ schema?: string | null;
1952
+ definition: ContentDefinition;
1953
+ metadata?: Record<string, ContentValue>;
1954
+ };
1955
+ type PatchContentInput = {
1956
+ expectedVersion: number;
1957
+ patches: ContentPatch[];
1958
+ origin?: 'api' | 'inlineEditor' | 'joai' | 'mcp';
1959
+ }; //#endregion
1844
1960
  //#region src/commerce/helpers.d.ts
1845
1961
  //#endregion
1846
1962
  //#region src/card/types.d.ts
@@ -2160,6 +2276,20 @@ type McpToolCall = {
2160
2276
  createdAt: string;
2161
2277
  };
2162
2278
  //#endregion
2279
+ //#region src/metric/types.d.ts
2280
+ type MetricSource = 'cloudflare';
2281
+ type Metric = {
2282
+ key: string;
2283
+ value: number;
2284
+ unit: string;
2285
+ };
2286
+ type MetricsResult = {
2287
+ source: MetricSource;
2288
+ resource: string;
2289
+ from: string;
2290
+ to: string;
2291
+ metrics: Metric[];
2292
+ }; //#endregion
2163
2293
  //#region src/memory/types.d.ts
2164
2294
  type Memory = {
2165
2295
  id: string;
@@ -2662,9 +2792,14 @@ type SiteAgent = {
2662
2792
  };
2663
2793
  type Site = {
2664
2794
  id: number;
2665
- brandSlug: string;
2795
+ slug: string;
2796
+ brandSlug: string | null;
2666
2797
  customDomain: string | null;
2667
2798
  enabled: boolean;
2799
+ contactId?: string | null;
2800
+ metricsSource?: string | null;
2801
+ metricsResource?: string | null;
2802
+ monthlyReport?: boolean;
2668
2803
  team: SiteTeam | null;
2669
2804
  agent: SiteAgent | null;
2670
2805
  settings: Record<string, JsonValue>;
@@ -2853,7 +2988,7 @@ type LoyaltyMember = {
2853
2988
  updatedAt: string;
2854
2989
  }; //#endregion
2855
2990
  //#region src/segment/types.d.ts
2856
- 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';
2991
+ 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' | 'prop' | 'marketing_opt_out';
2857
2992
  type SegmentCondition = {
2858
2993
  type: SegmentConditionType;
2859
2994
  value: string | boolean;
@@ -2865,7 +3000,7 @@ type SegmentGroup = {
2865
3000
  type Segment = {
2866
3001
  id: string;
2867
3002
  name: string;
2868
- conditions: SegmentGroup[];
3003
+ conditions: SegmentGroup[] | SegmentCondition[];
2869
3004
  count: number;
2870
3005
  campaignsCount: number;
2871
3006
  createdAt: string;
@@ -2885,13 +3020,36 @@ type SegmentCountResult = {
2885
3020
  }; //#endregion
2886
3021
  //#region src/campaign/types.d.ts
2887
3022
  type CampaignChannel = 'email' | 'whatsapp' | 'sms' | 'push';
2888
- type CampaignStatus = 'draft' | 'pending' | 'approved' | 'rejected' | 'sending' | 'completed' | 'failed';
3023
+ type CampaignStatus = 'draft' | 'pending' | 'approved' | 'rejected' | 'scheduled' | 'sending' | 'completed' | 'failed';
2889
3024
  type CampaignCategory = 'MARKETING' | 'UTILITY' | 'AUTHENTICATION';
3025
+ type CampaignSkipReason = 'pending_consent' | 'opted_out' | 'missing_channel' | 'approval_skipped';
3026
+ type CampaignSkipReasons = Record<CampaignSkipReason, number>;
3027
+ type CampaignRecipientStatus = 'sent' | 'failed' | 'skipped' | 'pending';
3028
+ type CampaignRecipient = {
3029
+ id: string;
3030
+ name: string | null;
3031
+ email: string | null;
3032
+ phone: string | null;
3033
+ status: CampaignRecipientStatus;
3034
+ error: string | null;
3035
+ skipReason: CampaignSkipReason | null;
3036
+ retryable: boolean;
3037
+ sentAt: string | null;
3038
+ openedAt: string | null;
3039
+ clickedAt: string | null;
3040
+ };
3041
+ type CampaignAudiencePreview = {
3042
+ total: number;
3043
+ sendable: number;
3044
+ willSkip: number;
3045
+ reasons: CampaignSkipReasons;
3046
+ };
2890
3047
  type CampaignApproval = {
2891
3048
  language: string | null;
2892
3049
  category: CampaignCategory | null;
2893
3050
  placeholders: string[];
2894
3051
  templateParams: Record<string, string>;
3052
+ aiParams: Record<string, string>;
2895
3053
  externalStatus: string | null;
2896
3054
  rejectionReason: string | null;
2897
3055
  };
@@ -2901,14 +3059,23 @@ type Campaign = {
2901
3059
  channel: CampaignChannel;
2902
3060
  subject: string | null;
2903
3061
  content: string;
3062
+ contentHtml?: boolean;
3063
+ scheduledAt?: string | null;
3064
+ openedCount?: number;
3065
+ clickedCount?: number;
2904
3066
  approval: CampaignApproval;
3067
+ agent: AgentSimple | null;
2905
3068
  tags: string[];
3069
+ segmentId?: string | null;
3070
+ contactIds?: string[];
2906
3071
  status: CampaignStatus;
2907
3072
  totalCount: number;
2908
3073
  remainingCount: number;
2909
3074
  sentCount: number;
2910
3075
  failedCount: number;
2911
3076
  skippedCount: number;
3077
+ skipReasons?: CampaignSkipReasons;
3078
+ archivedAt?: string | null;
2912
3079
  createdAt: string;
2913
3080
  updatedAt: string;
2914
3081
  };
@@ -2917,9 +3084,12 @@ type CampaignCreatePayload = {
2917
3084
  channel: CampaignChannel;
2918
3085
  subject?: string;
2919
3086
  content: string;
3087
+ contentHtml?: boolean;
2920
3088
  language?: string;
2921
3089
  category?: CampaignCategory;
2922
3090
  templateParams?: Record<string, string>;
3091
+ aiParams?: Record<string, string>;
3092
+ agentId?: string;
2923
3093
  tags?: string[];
2924
3094
  contactIds?: string[];
2925
3095
  segmentId?: string;
@@ -2928,17 +3098,33 @@ type CampaignUpdatePayload = {
2928
3098
  name: string;
2929
3099
  subject?: string;
2930
3100
  content: string;
3101
+ contentHtml?: boolean;
2931
3102
  language?: string;
2932
3103
  category?: CampaignCategory;
2933
3104
  templateParams?: Record<string, string>;
3105
+ aiParams?: Record<string, string>;
3106
+ agentId?: string;
3107
+ tags?: string[];
3108
+ contactIds?: string[];
3109
+ segmentId?: string;
3110
+ };
3111
+ type CampaignAudiencePreviewPayload = {
3112
+ campaignId: string;
3113
+ } | {
3114
+ channel: CampaignChannel;
3115
+ tags?: string[];
3116
+ contactIds?: string[];
3117
+ segmentId?: string;
2934
3118
  };
2935
3119
  type CampaignStats = {
2936
3120
  totalCampaigns: number;
2937
3121
  draftCampaigns: number;
2938
3122
  totalSent: number;
3123
+ totalOpened?: number;
3124
+ totalClicked?: number;
2939
3125
  }; //#endregion
2940
3126
  //#region src/update/types.d.ts
2941
- type UpdateType = 'deal' | 'event' | 'news';
3127
+ type UpdateType = 'deal' | 'event' | 'news' | 'article';
2942
3128
  type UpdateStatus = 'draft' | 'published' | 'archived';
2943
3129
  type UpdateRelation = 'team';
2944
3130
  type Update = {
@@ -2974,6 +3160,7 @@ type UpdateStats = {
2974
3160
  dealsCount: number;
2975
3161
  eventsCount: number;
2976
3162
  newsCount: number;
3163
+ articlesCount: number;
2977
3164
  publishedCount: number;
2978
3165
  draftCount: number;
2979
3166
  archivedCount: number;
@@ -3639,6 +3826,9 @@ declare class BillingResource {
3639
3826
  deleteOrder(id: string): Promise<IAppResponse<void>>;
3640
3827
  paymentAccount(team: string, provider: PaymentProvider): Promise<IAppResponse<PaymentAccount>>;
3641
3828
  createPaymentAccountOnboarding(team: string, provider: PaymentProvider): Promise<IAppResponse<PaymentAccountOnboarding>>;
3829
+ disconnectPaymentAccount(team: string, provider: PaymentProvider): Promise<IAppResponse<{
3830
+ disconnected: boolean;
3831
+ }>>;
3642
3832
  updatePaymentAccount(team: string, provider: PaymentProvider, input: {
3643
3833
  providerAccountId: string;
3644
3834
  chargesEnabled?: boolean;
@@ -3771,6 +3961,10 @@ declare class ContactsResource {
3771
3961
  deleteActivity(id: string, activityId: string): Promise<IAppResponse<void>>;
3772
3962
  send(id: string, message: string, subject?: string, integration?: IntegrationType | 'preferred'): Promise<IAppResponse<void>>;
3773
3963
  setProperty(id: string, key: string, value: string): Promise<IAppResponse<void>>;
3964
+ listRelations(id: string): Promise<IAppResponse<ContactRelation[]>>;
3965
+ createRelation(id: string, data: ContactRelationPayload): Promise<IAppResponse<ContactRelation>>;
3966
+ updateRelation(id: string, relationId: string, data: ContactRelationUpdatePayload): Promise<IAppResponse<ContactRelation>>;
3967
+ deleteRelation(id: string, relationId: string): Promise<IAppResponse<void>>;
3774
3968
  }
3775
3969
  //#endregion
3776
3970
  //#region src/resources/contracts.d.ts
@@ -4153,6 +4347,19 @@ declare class MediaResource {
4153
4347
  download(team: string, mediaId: string, name: string, mime: string): Promise<File>;
4154
4348
  }
4155
4349
  //#endregion
4350
+ //#region src/resources/metrics.d.ts
4351
+ type MetricsQuery = {
4352
+ source: MetricSource;
4353
+ resource: string;
4354
+ from: string;
4355
+ to: string;
4356
+ };
4357
+ declare class MetricsResource {
4358
+ private readonly http;
4359
+ constructor(http: IHttpService);
4360
+ query(params: MetricsQuery): Promise<IAppResponse<MetricsResult>>;
4361
+ }
4362
+ //#endregion
4156
4363
  //#region src/resources/meetings.d.ts
4157
4364
  declare class MeetingsResource {
4158
4365
  private readonly http;
@@ -4267,6 +4474,7 @@ declare class OrdersResource {
4267
4474
  get(id: string, accessToken?: string): Promise<IAppResponse<Order>>;
4268
4475
  create(data: {
4269
4476
  contactId?: string;
4477
+ invoiceContactId?: string;
4270
4478
  notes?: string;
4271
4479
  team: string;
4272
4480
  fresh?: boolean;
@@ -4276,10 +4484,14 @@ declare class OrdersResource {
4276
4484
  priceMode?: string;
4277
4485
  type?: OrderType;
4278
4486
  sendConfirmation?: boolean;
4487
+ invoiceDate?: string;
4488
+ serviceDate?: string;
4279
4489
  items?: {
4280
- id: string;
4281
- type: 'product' | 'service' | 'coupon';
4490
+ id?: string;
4491
+ type: 'product' | 'service' | 'coupon' | 'custom';
4282
4492
  quantity: number;
4493
+ name?: string;
4494
+ unitPrice?: number;
4283
4495
  configuration?: Configuration;
4284
4496
  }[];
4285
4497
  fulfillmentMethod?: FulfillmentMethod;
@@ -4300,7 +4512,9 @@ declare class OrdersResource {
4300
4512
  update(id: string, data: {
4301
4513
  status?: OrderStatus;
4302
4514
  date?: string;
4515
+ serviceDate?: string;
4303
4516
  type?: OrderType;
4517
+ invoiceContactId?: string | null;
4304
4518
  }): Promise<IAppResponse<Order>>;
4305
4519
  convertToOrder(id: string): Promise<IAppResponse<Order>>;
4306
4520
  delete(id: string): Promise<IAppResponse<void>>;
@@ -4505,13 +4719,25 @@ declare class SitesResource {
4505
4719
  constructor(http: IHttpService);
4506
4720
  brands(): Promise<IAppResponse<SiteBrand[]>>;
4507
4721
  listMine(teamSlug: string): Promise<IAppResponse<Site[]>>;
4722
+ create(teamSlug: string, slug: string, data?: {
4723
+ contactId?: string | null;
4724
+ metricsSource?: string | null;
4725
+ metricsResource?: string | null;
4726
+ }): Promise<IAppResponse<Site>>;
4727
+ provision(teamSlug: string, brandSlug: string, data?: {
4728
+ settings?: Record<string, unknown>;
4729
+ }): Promise<IAppResponse<Site>>;
4508
4730
  resolve(teamSlug: string, brandSlug?: string): Promise<IAppResponse<Site>>;
4509
4731
  resolveByDomain(domain: string): Promise<IAppResponse<Site>>;
4510
4732
  update(siteId: number, data: {
4511
4733
  customDomain?: string | null;
4512
4734
  enabled?: boolean;
4513
4735
  modules?: string[];
4514
- }): Promise<IAppResponse<void>>;
4736
+ contactId?: string | null;
4737
+ metricsSource?: string | null;
4738
+ metricsResource?: string | null;
4739
+ monthlyReport?: boolean;
4740
+ }): Promise<IAppResponse<Site>>;
4515
4741
  }
4516
4742
  //#endregion
4517
4743
  //#region src/resources/skills.d.ts
@@ -4706,18 +4932,61 @@ declare class TeamsResource {
4706
4932
  topupFinalize(tx: string): Promise<IAppResponse<void>>;
4707
4933
  }
4708
4934
  //#endregion
4935
+ //#region src/resources/artifacts.d.ts
4936
+ type ArtifactListParams = {
4937
+ type?: ArtifactType;
4938
+ status?: ArtifactStatus;
4939
+ contactId?: string;
4940
+ orderId?: string;
4941
+ ids?: string[] | string;
4942
+ page?: number;
4943
+ perPage?: number;
4944
+ };
4945
+ declare class ArtifactsResource {
4946
+ private readonly http;
4947
+ constructor(http: IHttpService);
4948
+ list(params?: ArtifactListParams): Promise<IAppResponse<Artifact[]>>;
4949
+ get(id: string): Promise<IAppResponse<Artifact>>;
4950
+ create(payload: ArtifactCreatePayload): Promise<IAppResponse<Artifact>>;
4951
+ update(id: string, payload: ArtifactUpdatePayload): Promise<IAppResponse<Artifact>>;
4952
+ delete(id: string): Promise<IAppResponse<void>>;
4953
+ deliver(payload: ArtifactDeliverPayload): Promise<IAppResponse<ArtifactDelivery[]>>;
4954
+ }
4955
+ //#endregion
4709
4956
  //#region src/resources/campaigns.d.ts
4710
4957
  declare class CampaignsResource {
4711
4958
  private readonly http;
4712
4959
  constructor(http: IHttpService);
4713
4960
  stats(): Promise<IAppResponse<CampaignStats>>;
4714
- list(): Promise<IAppResponse<Campaign[]>>;
4961
+ list(params?: {
4962
+ archived?: boolean;
4963
+ }): Promise<IAppResponse<Campaign[]>>;
4715
4964
  get(id: string): Promise<IAppResponse<Campaign>>;
4965
+ recipients(id: string, params?: {
4966
+ status?: CampaignRecipientStatus;
4967
+ page?: number;
4968
+ perPage?: number;
4969
+ }): Promise<IAppResponse<CampaignRecipient[]>>;
4970
+ retry(id: string, payload?: {
4971
+ contactIds?: string[];
4972
+ }): Promise<IAppResponse<{
4973
+ retried: number;
4974
+ }>>;
4975
+ previewAudience(payload: CampaignAudiencePreviewPayload): Promise<IAppResponse<CampaignAudiencePreview>>;
4716
4976
  create(payload: CampaignCreatePayload): Promise<IAppResponse<Campaign>>;
4717
4977
  update(id: string, payload: CampaignUpdatePayload): Promise<IAppResponse<Campaign>>;
4718
4978
  submitForApproval(id: string): Promise<IAppResponse<Campaign>>;
4719
4979
  refreshApproval(id: string): Promise<IAppResponse<Campaign>>;
4720
- send(id: string): Promise<IAppResponse<Campaign>>;
4980
+ send(id: string, payload?: {
4981
+ scheduledAt?: string;
4982
+ }): Promise<IAppResponse<Campaign>>;
4983
+ sendTest(id: string, payload: {
4984
+ contactId: string;
4985
+ }): Promise<IAppResponse<void>>;
4986
+ cancelSchedule(id: string): Promise<IAppResponse<Campaign>>;
4987
+ cancel(id: string): Promise<IAppResponse<Campaign>>;
4988
+ archive(id: string): Promise<IAppResponse<Campaign>>;
4989
+ unarchive(id: string): Promise<IAppResponse<Campaign>>;
4721
4990
  delete(id: string): Promise<IAppResponse<void>>;
4722
4991
  }
4723
4992
  //#endregion
@@ -4730,6 +4999,10 @@ declare class SegmentsResource {
4730
4999
  update(id: string, payload: SegmentCreatePayload): Promise<IAppResponse<Segment>>;
4731
5000
  delete(id: string): Promise<IAppResponse<void>>;
4732
5001
  count(payload: SegmentCountPayload): Promise<IAppResponse<SegmentCountResult>>;
5002
+ contacts(id: string, params?: {
5003
+ page?: number;
5004
+ perPage?: number;
5005
+ }): Promise<IAppResponse<Contact[]>>;
4733
5006
  }
4734
5007
  //#endregion
4735
5008
  //#region src/resources/updates.d.ts
@@ -4743,6 +5016,7 @@ declare class UpdatesResource {
4743
5016
  active?: boolean;
4744
5017
  tags?: string;
4745
5018
  with?: UpdateRelation[];
5019
+ sort?: string;
4746
5020
  }): Promise<IAppResponse<Update[]>>;
4747
5021
  create(payload: UpdateCreatePayload): Promise<IAppResponse<Update>>;
4748
5022
  update(id: string, payload: UpdateUpdatePayload): Promise<IAppResponse<Update>>;
@@ -5019,6 +5293,7 @@ declare class JoAiClient {
5019
5293
  readonly loyalty: LoyaltyResource;
5020
5294
  readonly store: StoreResource;
5021
5295
  readonly media: MediaResource;
5296
+ readonly metrics: MetricsResource;
5022
5297
  readonly meetings: MeetingsResource;
5023
5298
  readonly memories: MemoriesResource;
5024
5299
  readonly messages: MessagesResource;
@@ -5045,6 +5320,7 @@ declare class JoAiClient {
5045
5320
  readonly tasks: TasksResource;
5046
5321
  readonly tags: TagsResource;
5047
5322
  readonly teams: TeamsResource;
5323
+ readonly artifacts: ArtifactsResource;
5048
5324
  readonly campaigns: CampaignsResource;
5049
5325
  readonly segments: SegmentsResource;
5050
5326
  readonly updates: UpdatesResource;
@@ -5070,12 +5346,17 @@ declare class CachedHttpService implements IHttpService {
5070
5346
  private ttlMap;
5071
5347
  private defaultTtl;
5072
5348
  private cacheVersion;
5073
- onNetworkError: (error: Error) => void;
5074
- onUnauthorized: (response: IAppResponse<JsonValue>) => void;
5075
- onSuccessfulResponse: (response: IAppResponse<JsonValue>) => void;
5076
- onMaintenanceMode: (response: IAppResponse<JsonValue>) => void;
5077
- onTooManyRequests: (response: IAppResponse<JsonValue>) => void;
5078
5349
  constructor(inner: IHttpService, overrides?: TtlMap, defaultTtl?: number);
5350
+ get onNetworkError(): (error: Error) => void;
5351
+ set onNetworkError(fn: (error: Error) => void);
5352
+ get onUnauthorized(): (response: IAppResponse<JsonValue>) => void;
5353
+ set onUnauthorized(fn: (response: IAppResponse<JsonValue>) => void);
5354
+ get onSuccessfulResponse(): (response: IAppResponse<JsonValue>) => void;
5355
+ set onSuccessfulResponse(fn: (response: IAppResponse<JsonValue>) => void);
5356
+ get onMaintenanceMode(): (response: IAppResponse<JsonValue>) => void;
5357
+ set onMaintenanceMode(fn: (response: IAppResponse<JsonValue>) => void);
5358
+ get onTooManyRequests(): (response: IAppResponse<JsonValue>) => void;
5359
+ set onTooManyRequests(fn: (response: IAppResponse<JsonValue>) => void);
5079
5360
  clearCache(): void;
5080
5361
  get<T>(url: string, options?: IRequestOptions): Promise<IAppResponse<T>>;
5081
5362
  post<T>(url: string, data?: JsonValue | FormData, options?: IRequestOptions): Promise<IAppResponse<T>>;
@@ -5120,4 +5401,4 @@ declare class DistributionResource {
5120
5401
  private fetchDistribution;
5121
5402
  }
5122
5403
  //#endregion
5123
- export { AddressesResource, AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, type AttachedMedia, type AuthConfirmCodeRequest, type AuthConfirmCodeResponse, type AuthNativeSessionResponse, type AuthPortalSessionResponse, AuthResource, type AuthSendCodeRequest, type BackendWarp, type BackendWarpBrand, BillingResource, BlueprintsResource, type CacheConfig, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, CheckoutResource, CommerceResource, ContactsResource, ContentResource, ContractsResource, type CreateHookPayload, type CreateInboundHookPayload, type CreateInternalHookPayload, type CreateWarpLinkedHookPayload, type CreateWebHookPayload, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, type FulfillmentLocationInput, FulfillmentsResource, GoalsResource, type GuestBuyer, type GuestCheckoutDraft, type GuestCommerceStorageOptions, type GuestOrderAccess, 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 OpenPortalSessionOptions, type OpeningHoursEntry, type OpeningHoursFormatOptions, OrdersResource, PersonaResource, type PlaceCheckoutOrderRequest, type Product, type ProductVariation, ProductsResource, ProjectsResource, RemindersResource, ReturnsResource, SegmentsResource, ServicesResource, type ShippingRateInput, ShippingResource, type ShippingZoneInput, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, type TeamInviteInfo, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, type WebHookTriggerEvent, WorkspaceResource, completePortalSession, createClient, createGuestCommerceStorage, formatOpeningHours, getAuthFragmentToken, isAllowedRedirectUrl, isPortalCallbackUrl, openPortalSession, sanitizePortalCallbackUrl };
5404
+ export { AddressesResource, AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, type AttachedMedia, type AuthConfirmCodeRequest, type AuthConfirmCodeResponse, type AuthNativeSessionResponse, type AuthPortalSessionResponse, AuthResource, type AuthSendCodeRequest, type BackendWarp, type BackendWarpBrand, BillingResource, BlueprintsResource, type CacheConfig, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, CheckoutResource, CommerceResource, ContactsResource, ContentResource, ContractsResource, type CreateHookPayload, type CreateInboundHookPayload, type CreateInternalHookPayload, type CreateWarpLinkedHookPayload, type CreateWebHookPayload, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, type FulfillmentLocationInput, FulfillmentsResource, GoalsResource, type GuestBuyer, type GuestCheckoutDraft, type GuestCommerceStorageOptions, type GuestOrderAccess, 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, MetricsResource, MissionsResource, NotificationsResource, OfficeResource, type OpenPortalSessionOptions, type OpeningHoursEntry, type OpeningHoursFormatOptions, OrdersResource, PersonaResource, type PlaceCheckoutOrderRequest, type Product, type ProductVariation, ProductsResource, ProjectsResource, RemindersResource, ReturnsResource, SegmentsResource, ServicesResource, type ShippingRateInput, ShippingResource, type ShippingZoneInput, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, type TeamInviteInfo, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, type WebHookTriggerEvent, WorkspaceResource, completePortalSession, createClient, createGuestCommerceStorage, formatOpeningHours, getAuthFragmentToken, isAllowedRedirectUrl, isPortalCallbackUrl, openPortalSession, sanitizePortalCallbackUrl };
package/dist/index.mjs CHANGED
@@ -153,7 +153,8 @@ Object.values({
153
153
  Campaigns: "campaigns",
154
154
  News: "news",
155
155
  Sites: "sites",
156
- Contracts: "contracts"
156
+ Contracts: "contracts",
157
+ Artifacts: "artifacts"
157
158
  });
158
159
  /** Permission string values — must match joai--api `UserPermission::value`. */
159
160
  const UserPermissions = {
@@ -896,6 +897,9 @@ var BillingResource = class {
896
897
  createPaymentAccountOnboarding(team, provider) {
897
898
  return this.http.post(`payment-accounts/${provider}/onboarding`, void 0, { headers: { "X-Team": team } });
898
899
  }
900
+ disconnectPaymentAccount(team, provider) {
901
+ return this.http.delete(`payment-accounts/${provider}`, { headers: { "X-Team": team } });
902
+ }
899
903
  updatePaymentAccount(team, provider, input) {
900
904
  return this.http.put(`payment-accounts/${provider}`, input, { headers: { "X-Team": team } });
901
905
  }
@@ -1123,6 +1127,18 @@ var ContactsResource = class {
1123
1127
  value
1124
1128
  });
1125
1129
  }
1130
+ listRelations(id) {
1131
+ return this.http.get(`contacts/${id}/relations`);
1132
+ }
1133
+ createRelation(id, data) {
1134
+ return this.http.post(`contacts/${id}/relations`, data);
1135
+ }
1136
+ updateRelation(id, relationId, data) {
1137
+ return this.http.put(`contacts/${id}/relations/${relationId}`, data);
1138
+ }
1139
+ deleteRelation(id, relationId) {
1140
+ return this.http.delete(`contacts/${id}/relations/${relationId}`);
1141
+ }
1126
1142
  };
1127
1143
  //#endregion
1128
1144
  //#region src/resources/contracts.ts
@@ -1718,6 +1734,17 @@ var MediaResource = class {
1718
1734
  }
1719
1735
  };
1720
1736
  //#endregion
1737
+ //#region src/resources/metrics.ts
1738
+ var MetricsResource = class {
1739
+ constructor(http) {
1740
+ this.http = http;
1741
+ }
1742
+ query(params) {
1743
+ const query = new URLSearchParams(params);
1744
+ return this.http.get(`metrics?${query}`);
1745
+ }
1746
+ };
1747
+ //#endregion
1721
1748
  //#region src/resources/meetings.ts
1722
1749
  var MeetingsResource = class {
1723
1750
  constructor(http, config) {
@@ -2148,6 +2175,16 @@ var SitesResource = class {
2148
2175
  listMine(teamSlug) {
2149
2176
  return this.http.get(`sites/mine?team=${encodeURIComponent(teamSlug)}`);
2150
2177
  }
2178
+ create(teamSlug, slug, data) {
2179
+ return this.http.post("sites", {
2180
+ team: teamSlug,
2181
+ slug,
2182
+ ...data
2183
+ });
2184
+ }
2185
+ provision(teamSlug, brandSlug, data) {
2186
+ return this.http.post(`sites/${encodeURIComponent(brandSlug)}/provision`, data ?? {}, { headers: { "X-Team": teamSlug } });
2187
+ }
2151
2188
  resolve(teamSlug, brandSlug) {
2152
2189
  const query = brandSlug ? `team=${encodeURIComponent(teamSlug)}&brand=${encodeURIComponent(brandSlug)}` : `team=${encodeURIComponent(teamSlug)}`;
2153
2190
  return this.http.get(`sites/resolve?${query}`);
@@ -2453,6 +2490,43 @@ var TeamsResource = class {
2453
2490
  }
2454
2491
  };
2455
2492
  //#endregion
2493
+ //#region src/resources/artifacts.ts
2494
+ var ArtifactsResource = class {
2495
+ constructor(http) {
2496
+ this.http = http;
2497
+ }
2498
+ list(params) {
2499
+ const query = new URLSearchParams();
2500
+ if (params?.type) query.set("type", params.type);
2501
+ if (params?.status) query.set("status", params.status);
2502
+ if (params?.contactId) query.set("contactId", params.contactId);
2503
+ if (params?.orderId) query.set("orderId", params.orderId);
2504
+ if (params?.ids) {
2505
+ const ids = Array.isArray(params.ids) ? params.ids.join(",") : params.ids;
2506
+ if (ids) query.set("ids", ids);
2507
+ }
2508
+ if (params?.page != null) query.set("page", String(params.page));
2509
+ if (params?.perPage != null) query.set("perPage", String(params.perPage));
2510
+ const qs = query.toString();
2511
+ return this.http.get(`artifacts${qs ? `?${qs}` : ""}`);
2512
+ }
2513
+ get(id) {
2514
+ return this.http.get(`artifacts/${id}`);
2515
+ }
2516
+ create(payload) {
2517
+ return this.http.post("artifacts", payload);
2518
+ }
2519
+ update(id, payload) {
2520
+ return this.http.patch(`artifacts/${id}`, payload);
2521
+ }
2522
+ delete(id) {
2523
+ return this.http.delete(`artifacts/${id}`);
2524
+ }
2525
+ deliver(payload) {
2526
+ return this.http.post("artifacts/deliver", payload);
2527
+ }
2528
+ };
2529
+ //#endregion
2456
2530
  //#region src/resources/campaigns.ts
2457
2531
  var CampaignsResource = class {
2458
2532
  constructor(http) {
@@ -2461,12 +2535,27 @@ var CampaignsResource = class {
2461
2535
  stats() {
2462
2536
  return this.http.get("campaigns/stats");
2463
2537
  }
2464
- list() {
2465
- return this.http.get("campaigns");
2538
+ list(params) {
2539
+ const query = params?.archived ? "?archived=1" : "";
2540
+ return this.http.get(`campaigns${query}`);
2466
2541
  }
2467
2542
  get(id) {
2468
2543
  return this.http.get(`campaigns/${id}`);
2469
2544
  }
2545
+ recipients(id, params) {
2546
+ const search = new URLSearchParams();
2547
+ if (params?.status) search.set("status", params.status);
2548
+ if (params?.page) search.set("page", String(params.page));
2549
+ if (params?.perPage) search.set("perPage", String(params.perPage));
2550
+ const query = search.toString();
2551
+ return this.http.get(`campaigns/${id}/recipients${query ? `?${query}` : ""}`);
2552
+ }
2553
+ retry(id, payload) {
2554
+ return this.http.post(`campaigns/${id}/retry`, payload ?? {});
2555
+ }
2556
+ previewAudience(payload) {
2557
+ return this.http.get(`campaigns/audience-preview${audiencePreviewQuery(payload)}`);
2558
+ }
2470
2559
  create(payload) {
2471
2560
  return this.http.post("campaigns", payload);
2472
2561
  }
@@ -2479,13 +2568,40 @@ var CampaignsResource = class {
2479
2568
  refreshApproval(id) {
2480
2569
  return this.http.post(`campaigns/${id}/refresh`);
2481
2570
  }
2482
- send(id) {
2483
- return this.http.post(`campaigns/${id}/send`);
2571
+ send(id, payload) {
2572
+ return this.http.post(`campaigns/${id}/send`, payload ?? {});
2573
+ }
2574
+ sendTest(id, payload) {
2575
+ return this.http.post(`campaigns/${id}/send-test`, payload);
2576
+ }
2577
+ cancelSchedule(id) {
2578
+ return this.http.post(`campaigns/${id}/cancel-schedule`);
2579
+ }
2580
+ cancel(id) {
2581
+ return this.http.post(`campaigns/${id}/cancel`);
2582
+ }
2583
+ archive(id) {
2584
+ return this.http.post(`campaigns/${id}/archive`);
2585
+ }
2586
+ unarchive(id) {
2587
+ return this.http.post(`campaigns/${id}/unarchive`);
2484
2588
  }
2485
2589
  delete(id) {
2486
2590
  return this.http.delete(`campaigns/${id}`);
2487
2591
  }
2488
2592
  };
2593
+ const audiencePreviewQuery = (payload) => {
2594
+ const search = new URLSearchParams();
2595
+ if ("campaignId" in payload) search.set("campaignId", payload.campaignId);
2596
+ else {
2597
+ search.set("channel", payload.channel);
2598
+ if (payload.segmentId) search.set("segmentId", payload.segmentId);
2599
+ if (payload.tags?.length) search.set("tags", payload.tags.join(","));
2600
+ if (payload.contactIds?.length) search.set("contactIds", payload.contactIds.join(","));
2601
+ }
2602
+ const query = search.toString();
2603
+ return query ? `?${query}` : "";
2604
+ };
2489
2605
  //#endregion
2490
2606
  //#region src/resources/segments.ts
2491
2607
  var SegmentsResource = class {
@@ -2507,6 +2623,13 @@ var SegmentsResource = class {
2507
2623
  count(payload) {
2508
2624
  return this.http.post("segments/count", payload);
2509
2625
  }
2626
+ contacts(id, params) {
2627
+ const search = new URLSearchParams();
2628
+ if (params?.page != null) search.set("page", String(params.page));
2629
+ if (params?.perPage != null) search.set("perPage", String(params.perPage));
2630
+ const query = search.toString();
2631
+ return this.http.get(`segments/${id}/contacts${query ? `?${query}` : ""}`);
2632
+ }
2510
2633
  };
2511
2634
  //#endregion
2512
2635
  //#region src/resources/updates.ts
@@ -2522,6 +2645,7 @@ var UpdatesResource = class {
2522
2645
  if (params?.active != null) query.set("active", String(params.active));
2523
2646
  if (params?.tags) query.set("tags", params.tags);
2524
2647
  if (params?.with?.length) query.set("with", params.with.join(","));
2648
+ if (params?.sort) query.set("sort", params.sort);
2525
2649
  const qs = query.toString();
2526
2650
  return this.http.get(`updates${qs ? "?" + qs : ""}`);
2527
2651
  }
@@ -2910,11 +3034,6 @@ var CachedHttpService = class {
2910
3034
  this.inner = inner;
2911
3035
  this.cache = new MemoryCache();
2912
3036
  this.cacheVersion = 0;
2913
- this.onNetworkError = () => {};
2914
- this.onUnauthorized = () => {};
2915
- this.onSuccessfulResponse = () => {};
2916
- this.onMaintenanceMode = () => {};
2917
- this.onTooManyRequests = () => {};
2918
3037
  this.baseUrl = inner.baseUrl;
2919
3038
  this.authToken = inner.authToken;
2920
3039
  this.ttlMap = {
@@ -2923,6 +3042,36 @@ var CachedHttpService = class {
2923
3042
  };
2924
3043
  this.defaultTtl = defaultTtl ?? DEFAULT_TTL;
2925
3044
  }
3045
+ get onNetworkError() {
3046
+ return this.inner.onNetworkError;
3047
+ }
3048
+ set onNetworkError(fn) {
3049
+ this.inner.onNetworkError = fn;
3050
+ }
3051
+ get onUnauthorized() {
3052
+ return this.inner.onUnauthorized;
3053
+ }
3054
+ set onUnauthorized(fn) {
3055
+ this.inner.onUnauthorized = fn;
3056
+ }
3057
+ get onSuccessfulResponse() {
3058
+ return this.inner.onSuccessfulResponse;
3059
+ }
3060
+ set onSuccessfulResponse(fn) {
3061
+ this.inner.onSuccessfulResponse = fn;
3062
+ }
3063
+ get onMaintenanceMode() {
3064
+ return this.inner.onMaintenanceMode;
3065
+ }
3066
+ set onMaintenanceMode(fn) {
3067
+ this.inner.onMaintenanceMode = fn;
3068
+ }
3069
+ get onTooManyRequests() {
3070
+ return this.inner.onTooManyRequests;
3071
+ }
3072
+ set onTooManyRequests(fn) {
3073
+ this.inner.onTooManyRequests = fn;
3074
+ }
2926
3075
  clearCache() {
2927
3076
  this.cacheVersion++;
2928
3077
  this.cache.clear();
@@ -3017,6 +3166,7 @@ var JoAiClient = class {
3017
3166
  this.loyalty = new LoyaltyResource(this.http);
3018
3167
  this.store = new StoreResource(this.http);
3019
3168
  this.media = new MediaResource(this.http);
3169
+ this.metrics = new MetricsResource(this.http);
3020
3170
  this.meetings = new MeetingsResource(this.http, config);
3021
3171
  this.memories = new MemoriesResource(this.http);
3022
3172
  this.messages = new MessagesResource(this.http);
@@ -3043,6 +3193,7 @@ var JoAiClient = class {
3043
3193
  this.tasks = new TasksResource(this.http);
3044
3194
  this.tags = new TagsResource(this.http);
3045
3195
  this.teams = new TeamsResource(this.http);
3196
+ this.artifacts = new ArtifactsResource(this.http);
3046
3197
  this.campaigns = new CampaignsResource(this.http);
3047
3198
  this.segments = new SegmentsResource(this.http);
3048
3199
  this.updates = new UpdatesResource(this.http);
@@ -3159,4 +3310,4 @@ var DistributionResource = class {
3159
3310
  }
3160
3311
  };
3161
3312
  //#endregion
3162
- export { AddressesResource, AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, BillingResource, BlueprintsResource, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, CheckoutResource, CommerceResource, ContactsResource, ContentResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, FulfillmentsResource, GoalsResource, HooksResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, KvResource, LinksResource, LoyaltyResource, McpResource, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, OrdersResource, PersonaResource, ProductsResource, ProjectsResource, RemindersResource, ReturnsResource, SegmentsResource, ServicesResource, ShippingResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WorkspaceResource, completePortalSession, createClient, createGuestCommerceStorage, formatOpeningHours, getAuthFragmentToken, isAllowedRedirectUrl, isPortalCallbackUrl, openPortalSession, sanitizePortalCallbackUrl };
3313
+ export { AddressesResource, AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, BillingResource, BlueprintsResource, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, CheckoutResource, CommerceResource, ContactsResource, ContentResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, FulfillmentsResource, GoalsResource, HooksResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, KvResource, LinksResource, LoyaltyResource, McpResource, MeetingsResource, MemoriesResource, MessagesResource, MetricsResource, MissionsResource, NotificationsResource, OfficeResource, OrdersResource, PersonaResource, ProductsResource, ProjectsResource, RemindersResource, ReturnsResource, SegmentsResource, ServicesResource, ShippingResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WorkspaceResource, completePortalSession, createClient, createGuestCommerceStorage, formatOpeningHours, getAuthFragmentToken, isAllowedRedirectUrl, isPortalCallbackUrl, openPortalSession, sanitizePortalCallbackUrl };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "4.3.0",
3
+ "version": "4.6.0",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -38,7 +38,7 @@
38
38
  "@joai/warps": "*"
39
39
  },
40
40
  "devDependencies": {
41
- "@joai/core": "*",
41
+ "@joai/core": "^4.11.0",
42
42
  "tsdown": "^0.21.0",
43
43
  "typescript": "^5.9.3"
44
44
  }