@joai/sdk 4.3.0 → 4.5.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;
@@ -31,102 +38,7 @@ interface IRequestOptions {
31
38
  [name: string]: string;
32
39
  };
33
40
  } //#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). */
41
+ //#region src/http/service.d.ts
130
42
  //#endregion
131
43
  //#region src/ingestion/types.d.ts
132
44
  type IngestionSourceType = 'note' | 'meeting' | 'article' | 'email' | 'chat' | 'post' | 'webhook';
@@ -392,6 +304,10 @@ type WalletList = Partial<Record<WarpChainName, {
392
304
  provider: WarpWalletProvider;
393
305
  address?: string;
394
306
  }>>; //#endregion
307
+ //#region src/json/types.d.ts
308
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
309
+ [key: string]: JsonValue;
310
+ }; //#endregion
395
311
  //#region src/contact/types.d.ts
396
312
  type ContactHealth = 'active' | 'lukewarm' | 'cold' | 'stale' | 'unknown';
397
313
  type ContactConsentStatus = 'pending' | 'confirmed' | 'superseded' | 'unsubscribed';
@@ -424,6 +340,7 @@ type Contact = {
424
340
  birthday: string | null;
425
341
  website: string | null;
426
342
  location: string | null;
343
+ avatar: string | null;
427
344
  socials: Record<string, string> | null;
428
345
  notes: string | null;
429
346
  tags: string[] | null;
@@ -472,11 +389,37 @@ type ContactFormData = {
472
389
  };
473
390
  nextFollowUpAt?: string | null;
474
391
  followUpNote?: string | null;
392
+ avatar?: string[];
475
393
  };
476
394
  type ContactCreatePayload = ContactFormData & {
477
395
  name: string;
478
396
  wallets?: WalletList;
479
397
  }; //#endregion
398
+ //#region src/media/types.d.ts
399
+ type MediaLibraryAttributes = {
400
+ uuid: string;
401
+ order: number;
402
+ name: string;
403
+ custom_properties: {
404
+ [key: string]: JsonValue;
405
+ };
406
+ preview_url: null | string;
407
+ original_url: null | string;
408
+ extension?: string;
409
+ size?: number;
410
+ };
411
+ 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';
412
+ type MediaAspectRatio = 'free' | '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
413
+ type Media = {
414
+ id: string;
415
+ name: string;
416
+ mime: MediaMime;
417
+ url: string;
418
+ library: MediaLibraryAttributes;
419
+ tags?: string[];
420
+ copyright?: string | null;
421
+ aiGenerated?: boolean;
422
+ }; //#endregion
480
423
  //#region src/flow/types.d.ts
481
424
  type FlowCategory = 'none' | 'defi' | 'nft' | 'social' | 'devtools' | 'productivity' | 'trading' | 'portfolio';
482
425
  type FlowStatus = 'draft' | 'published';
@@ -642,6 +585,7 @@ declare const NativeApps: {
642
585
  readonly News: "news";
643
586
  readonly Sites: "sites";
644
587
  readonly Contracts: "contracts";
588
+ readonly Artifacts: "artifacts";
645
589
  };
646
590
  type NativeApp = (typeof NativeApps)[keyof typeof NativeApps];
647
591
  //#endregion
@@ -1024,11 +968,11 @@ type Product = {
1024
968
  media?: Media[];
1025
969
  };
1026
970
  type OrderItem = {
1027
- id: string;
971
+ id: string | null;
1028
972
  name: string;
1029
973
  quantity: number;
1030
974
  unitPrice: number;
1031
- type: 'product-variation' | 'service' | 'coupon';
975
+ type: 'product-variation' | 'service' | 'coupon' | 'custom';
1032
976
  digital?: boolean | null;
1033
977
  sellerTeamId?: string | null;
1034
978
  };
@@ -1299,6 +1243,7 @@ type AgentSimple = {
1299
1243
  team?: {
1300
1244
  slug: string;
1301
1245
  } | null;
1246
+ settings?: Pick<AgentSettings, 'auto'>;
1302
1247
  };
1303
1248
  type AgentEngine = 'cortex' | 'openclaw';
1304
1249
  type AgentGender = 'male' | 'female' | 'neutral';
@@ -1681,6 +1626,69 @@ type PaginatedResponse<T> = {
1681
1626
  total: number;
1682
1627
  last_page: number;
1683
1628
  }; //#endregion
1629
+ //#region src/artifact/types.d.ts
1630
+ type ArtifactType = 'agreement' | 'offer' | 'concept' | 'update' | 'demo' | 'file' | 'other';
1631
+ type ArtifactStatus = 'draft' | 'ready' | 'sent' | 'archived';
1632
+ type ArtifactDeliverIntegration = 'email' | 'sms' | 'whatsapp';
1633
+ type ArtifactLink = {
1634
+ url: string;
1635
+ label?: string | null;
1636
+ };
1637
+ type ArtifactContactSummary = {
1638
+ id: string;
1639
+ name: string | null;
1640
+ email: string | null;
1641
+ phone: string | null;
1642
+ };
1643
+ type Artifact = {
1644
+ id: string;
1645
+ type: ArtifactType;
1646
+ status: ArtifactStatus;
1647
+ title: string;
1648
+ summary: string | null;
1649
+ url: string | null;
1650
+ password: string | null;
1651
+ links: ArtifactLink[];
1652
+ meta: Record<string, unknown> | null;
1653
+ contactId: string | null;
1654
+ orderId: string | null;
1655
+ contact?: ArtifactContactSummary;
1656
+ deliveredAt: string | null;
1657
+ createdAt: string;
1658
+ updatedAt: string;
1659
+ };
1660
+ type ArtifactCreatePayload = {
1661
+ title: string;
1662
+ type: ArtifactType;
1663
+ status?: ArtifactStatus;
1664
+ summary?: string;
1665
+ url?: string;
1666
+ password?: string;
1667
+ links?: ArtifactLink[];
1668
+ extraLinkUrl?: string;
1669
+ extraLinkLabel?: string;
1670
+ meta?: Record<string, unknown>;
1671
+ contactId?: string;
1672
+ orderId?: string;
1673
+ };
1674
+ type ArtifactUpdatePayload = Partial<ArtifactCreatePayload>;
1675
+ type ArtifactDeliverPayload = {
1676
+ artifactIds: string[];
1677
+ message: string;
1678
+ integration: ArtifactDeliverIntegration;
1679
+ subject?: string;
1680
+ contactIds?: string[];
1681
+ };
1682
+ type ArtifactDelivery = {
1683
+ id: string;
1684
+ contactId: string;
1685
+ integration: ArtifactDeliverIntegration;
1686
+ subject: string | null;
1687
+ message: string;
1688
+ artifactIds?: string[];
1689
+ deliveredAt: string;
1690
+ createdAt: string;
1691
+ }; //#endregion
1684
1692
  //#region src/service/types.d.ts
1685
1693
  type Service = {
1686
1694
  id: string;
@@ -1841,6 +1849,65 @@ type AppointmentRequest = {
1841
1849
  configuration?: Configuration;
1842
1850
  createdAt: string;
1843
1851
  }; //#endregion
1852
+ //#region src/content/types.d.ts
1853
+ type ContentStatus = 'draft' | 'published' | 'archived';
1854
+ type ContentFieldType = 'text' | 'richText' | 'number' | 'boolean' | 'url' | 'image' | 'media' | 'list' | 'object' | 'reference';
1855
+ type ContentField = {
1856
+ key: string;
1857
+ type: ContentFieldType;
1858
+ label?: string;
1859
+ required?: boolean;
1860
+ };
1861
+ type ContentDefinition = {
1862
+ fields: ContentField[];
1863
+ };
1864
+ type ContentValue = string | number | boolean | null | ContentValue[] | {
1865
+ [key: string]: ContentValue;
1866
+ };
1867
+ type ContentEntry = {
1868
+ key: string;
1869
+ value: ContentValue;
1870
+ updatedAt: string;
1871
+ };
1872
+ type ContentVersion = {
1873
+ id: string;
1874
+ number: number;
1875
+ status: ContentStatus;
1876
+ entries: ContentEntry[];
1877
+ snapshotHash: string;
1878
+ origin: string;
1879
+ createdAt: string;
1880
+ updatedAt: string;
1881
+ publishedAt: string | null;
1882
+ };
1883
+ type Content = {
1884
+ id: string;
1885
+ name: string;
1886
+ slug: string;
1887
+ schema: string | null;
1888
+ definition: ContentDefinition;
1889
+ metadata: Record<string, ContentValue>;
1890
+ version: ContentVersion | null;
1891
+ createdAt: string;
1892
+ updatedAt: string;
1893
+ };
1894
+ type ContentPatch = {
1895
+ key: string;
1896
+ value: ContentValue;
1897
+ };
1898
+ type CreateContentInput = {
1899
+ team: string;
1900
+ name: string;
1901
+ slug: string;
1902
+ schema?: string | null;
1903
+ definition: ContentDefinition;
1904
+ metadata?: Record<string, ContentValue>;
1905
+ };
1906
+ type PatchContentInput = {
1907
+ expectedVersion: number;
1908
+ patches: ContentPatch[];
1909
+ origin?: 'api' | 'inlineEditor' | 'joai' | 'mcp';
1910
+ }; //#endregion
1844
1911
  //#region src/commerce/helpers.d.ts
1845
1912
  //#endregion
1846
1913
  //#region src/card/types.d.ts
@@ -2865,7 +2932,7 @@ type SegmentGroup = {
2865
2932
  type Segment = {
2866
2933
  id: string;
2867
2934
  name: string;
2868
- conditions: SegmentGroup[];
2935
+ conditions: SegmentGroup[] | SegmentCondition[];
2869
2936
  count: number;
2870
2937
  campaignsCount: number;
2871
2938
  createdAt: string;
@@ -2887,11 +2954,20 @@ type SegmentCountResult = {
2887
2954
  type CampaignChannel = 'email' | 'whatsapp' | 'sms' | 'push';
2888
2955
  type CampaignStatus = 'draft' | 'pending' | 'approved' | 'rejected' | 'sending' | 'completed' | 'failed';
2889
2956
  type CampaignCategory = 'MARKETING' | 'UTILITY' | 'AUTHENTICATION';
2957
+ type CampaignSkipReason = 'pending_consent' | 'opted_out' | 'missing_channel' | 'approval_skipped';
2958
+ type CampaignSkipReasons = Record<CampaignSkipReason, number>;
2959
+ type CampaignAudiencePreview = {
2960
+ total: number;
2961
+ sendable: number;
2962
+ willSkip: number;
2963
+ reasons: CampaignSkipReasons;
2964
+ };
2890
2965
  type CampaignApproval = {
2891
2966
  language: string | null;
2892
2967
  category: CampaignCategory | null;
2893
2968
  placeholders: string[];
2894
2969
  templateParams: Record<string, string>;
2970
+ aiParams: Record<string, string>;
2895
2971
  externalStatus: string | null;
2896
2972
  rejectionReason: string | null;
2897
2973
  };
@@ -2902,6 +2978,7 @@ type Campaign = {
2902
2978
  subject: string | null;
2903
2979
  content: string;
2904
2980
  approval: CampaignApproval;
2981
+ agent: AgentSimple | null;
2905
2982
  tags: string[];
2906
2983
  status: CampaignStatus;
2907
2984
  totalCount: number;
@@ -2909,6 +2986,8 @@ type Campaign = {
2909
2986
  sentCount: number;
2910
2987
  failedCount: number;
2911
2988
  skippedCount: number;
2989
+ skipReasons?: CampaignSkipReasons;
2990
+ archivedAt?: string | null;
2912
2991
  createdAt: string;
2913
2992
  updatedAt: string;
2914
2993
  };
@@ -2920,6 +2999,8 @@ type CampaignCreatePayload = {
2920
2999
  language?: string;
2921
3000
  category?: CampaignCategory;
2922
3001
  templateParams?: Record<string, string>;
3002
+ aiParams?: Record<string, string>;
3003
+ agentId?: string;
2923
3004
  tags?: string[];
2924
3005
  contactIds?: string[];
2925
3006
  segmentId?: string;
@@ -2931,6 +3012,16 @@ type CampaignUpdatePayload = {
2931
3012
  language?: string;
2932
3013
  category?: CampaignCategory;
2933
3014
  templateParams?: Record<string, string>;
3015
+ aiParams?: Record<string, string>;
3016
+ agentId?: string;
3017
+ };
3018
+ type CampaignAudiencePreviewPayload = {
3019
+ campaignId: string;
3020
+ } | {
3021
+ channel: CampaignChannel;
3022
+ tags?: string[];
3023
+ contactIds?: string[];
3024
+ segmentId?: string;
2934
3025
  };
2935
3026
  type CampaignStats = {
2936
3027
  totalCampaigns: number;
@@ -3639,6 +3730,9 @@ declare class BillingResource {
3639
3730
  deleteOrder(id: string): Promise<IAppResponse<void>>;
3640
3731
  paymentAccount(team: string, provider: PaymentProvider): Promise<IAppResponse<PaymentAccount>>;
3641
3732
  createPaymentAccountOnboarding(team: string, provider: PaymentProvider): Promise<IAppResponse<PaymentAccountOnboarding>>;
3733
+ disconnectPaymentAccount(team: string, provider: PaymentProvider): Promise<IAppResponse<{
3734
+ disconnected: boolean;
3735
+ }>>;
3642
3736
  updatePaymentAccount(team: string, provider: PaymentProvider, input: {
3643
3737
  providerAccountId: string;
3644
3738
  chargesEnabled?: boolean;
@@ -4277,9 +4371,11 @@ declare class OrdersResource {
4277
4371
  type?: OrderType;
4278
4372
  sendConfirmation?: boolean;
4279
4373
  items?: {
4280
- id: string;
4281
- type: 'product' | 'service' | 'coupon';
4374
+ id?: string;
4375
+ type: 'product' | 'service' | 'coupon' | 'custom';
4282
4376
  quantity: number;
4377
+ name?: string;
4378
+ unitPrice?: number;
4283
4379
  configuration?: Configuration;
4284
4380
  }[];
4285
4381
  fulfillmentMethod?: FulfillmentMethod;
@@ -4706,18 +4802,45 @@ declare class TeamsResource {
4706
4802
  topupFinalize(tx: string): Promise<IAppResponse<void>>;
4707
4803
  }
4708
4804
  //#endregion
4805
+ //#region src/resources/artifacts.d.ts
4806
+ type ArtifactListParams = {
4807
+ type?: ArtifactType;
4808
+ status?: ArtifactStatus;
4809
+ contactId?: string;
4810
+ orderId?: string;
4811
+ ids?: string[] | string;
4812
+ page?: number;
4813
+ perPage?: number;
4814
+ };
4815
+ declare class ArtifactsResource {
4816
+ private readonly http;
4817
+ constructor(http: IHttpService);
4818
+ list(params?: ArtifactListParams): Promise<IAppResponse<Artifact[]>>;
4819
+ get(id: string): Promise<IAppResponse<Artifact>>;
4820
+ create(payload: ArtifactCreatePayload): Promise<IAppResponse<Artifact>>;
4821
+ update(id: string, payload: ArtifactUpdatePayload): Promise<IAppResponse<Artifact>>;
4822
+ delete(id: string): Promise<IAppResponse<void>>;
4823
+ deliver(payload: ArtifactDeliverPayload): Promise<IAppResponse<ArtifactDelivery[]>>;
4824
+ }
4825
+ //#endregion
4709
4826
  //#region src/resources/campaigns.d.ts
4710
4827
  declare class CampaignsResource {
4711
4828
  private readonly http;
4712
4829
  constructor(http: IHttpService);
4713
4830
  stats(): Promise<IAppResponse<CampaignStats>>;
4714
- list(): Promise<IAppResponse<Campaign[]>>;
4831
+ list(params?: {
4832
+ archived?: boolean;
4833
+ }): Promise<IAppResponse<Campaign[]>>;
4715
4834
  get(id: string): Promise<IAppResponse<Campaign>>;
4835
+ previewAudience(payload: CampaignAudiencePreviewPayload): Promise<IAppResponse<CampaignAudiencePreview>>;
4716
4836
  create(payload: CampaignCreatePayload): Promise<IAppResponse<Campaign>>;
4717
4837
  update(id: string, payload: CampaignUpdatePayload): Promise<IAppResponse<Campaign>>;
4718
4838
  submitForApproval(id: string): Promise<IAppResponse<Campaign>>;
4719
4839
  refreshApproval(id: string): Promise<IAppResponse<Campaign>>;
4720
4840
  send(id: string): Promise<IAppResponse<Campaign>>;
4841
+ cancel(id: string): Promise<IAppResponse<Campaign>>;
4842
+ archive(id: string): Promise<IAppResponse<Campaign>>;
4843
+ unarchive(id: string): Promise<IAppResponse<Campaign>>;
4721
4844
  delete(id: string): Promise<IAppResponse<void>>;
4722
4845
  }
4723
4846
  //#endregion
@@ -4730,6 +4853,7 @@ declare class SegmentsResource {
4730
4853
  update(id: string, payload: SegmentCreatePayload): Promise<IAppResponse<Segment>>;
4731
4854
  delete(id: string): Promise<IAppResponse<void>>;
4732
4855
  count(payload: SegmentCountPayload): Promise<IAppResponse<SegmentCountResult>>;
4856
+ contacts(id: string): Promise<IAppResponse<Contact[]>>;
4733
4857
  }
4734
4858
  //#endregion
4735
4859
  //#region src/resources/updates.d.ts
@@ -5045,6 +5169,7 @@ declare class JoAiClient {
5045
5169
  readonly tasks: TasksResource;
5046
5170
  readonly tags: TagsResource;
5047
5171
  readonly teams: TeamsResource;
5172
+ readonly artifacts: ArtifactsResource;
5048
5173
  readonly campaigns: CampaignsResource;
5049
5174
  readonly segments: SegmentsResource;
5050
5175
  readonly updates: UpdatesResource;
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
  }
@@ -2453,6 +2457,43 @@ var TeamsResource = class {
2453
2457
  }
2454
2458
  };
2455
2459
  //#endregion
2460
+ //#region src/resources/artifacts.ts
2461
+ var ArtifactsResource = class {
2462
+ constructor(http) {
2463
+ this.http = http;
2464
+ }
2465
+ list(params) {
2466
+ const query = new URLSearchParams();
2467
+ if (params?.type) query.set("type", params.type);
2468
+ if (params?.status) query.set("status", params.status);
2469
+ if (params?.contactId) query.set("contactId", params.contactId);
2470
+ if (params?.orderId) query.set("orderId", params.orderId);
2471
+ if (params?.ids) {
2472
+ const ids = Array.isArray(params.ids) ? params.ids.join(",") : params.ids;
2473
+ if (ids) query.set("ids", ids);
2474
+ }
2475
+ if (params?.page != null) query.set("page", String(params.page));
2476
+ if (params?.perPage != null) query.set("perPage", String(params.perPage));
2477
+ const qs = query.toString();
2478
+ return this.http.get(`artifacts${qs ? `?${qs}` : ""}`);
2479
+ }
2480
+ get(id) {
2481
+ return this.http.get(`artifacts/${id}`);
2482
+ }
2483
+ create(payload) {
2484
+ return this.http.post("artifacts", payload);
2485
+ }
2486
+ update(id, payload) {
2487
+ return this.http.patch(`artifacts/${id}`, payload);
2488
+ }
2489
+ delete(id) {
2490
+ return this.http.delete(`artifacts/${id}`);
2491
+ }
2492
+ deliver(payload) {
2493
+ return this.http.post("artifacts/deliver", payload);
2494
+ }
2495
+ };
2496
+ //#endregion
2456
2497
  //#region src/resources/campaigns.ts
2457
2498
  var CampaignsResource = class {
2458
2499
  constructor(http) {
@@ -2461,12 +2502,16 @@ var CampaignsResource = class {
2461
2502
  stats() {
2462
2503
  return this.http.get("campaigns/stats");
2463
2504
  }
2464
- list() {
2465
- return this.http.get("campaigns");
2505
+ list(params) {
2506
+ const query = params?.archived ? "?archived=1" : "";
2507
+ return this.http.get(`campaigns${query}`);
2466
2508
  }
2467
2509
  get(id) {
2468
2510
  return this.http.get(`campaigns/${id}`);
2469
2511
  }
2512
+ previewAudience(payload) {
2513
+ return this.http.get(`campaigns/audience-preview${audiencePreviewQuery(payload)}`);
2514
+ }
2470
2515
  create(payload) {
2471
2516
  return this.http.post("campaigns", payload);
2472
2517
  }
@@ -2482,10 +2527,31 @@ var CampaignsResource = class {
2482
2527
  send(id) {
2483
2528
  return this.http.post(`campaigns/${id}/send`);
2484
2529
  }
2530
+ cancel(id) {
2531
+ return this.http.post(`campaigns/${id}/cancel`);
2532
+ }
2533
+ archive(id) {
2534
+ return this.http.post(`campaigns/${id}/archive`);
2535
+ }
2536
+ unarchive(id) {
2537
+ return this.http.post(`campaigns/${id}/unarchive`);
2538
+ }
2485
2539
  delete(id) {
2486
2540
  return this.http.delete(`campaigns/${id}`);
2487
2541
  }
2488
2542
  };
2543
+ const audiencePreviewQuery = (payload) => {
2544
+ const search = new URLSearchParams();
2545
+ if ("campaignId" in payload) search.set("campaignId", payload.campaignId);
2546
+ else {
2547
+ search.set("channel", payload.channel);
2548
+ if (payload.segmentId) search.set("segmentId", payload.segmentId);
2549
+ if (payload.tags?.length) search.set("tags", payload.tags.join(","));
2550
+ if (payload.contactIds?.length) search.set("contactIds", payload.contactIds.join(","));
2551
+ }
2552
+ const query = search.toString();
2553
+ return query ? `?${query}` : "";
2554
+ };
2489
2555
  //#endregion
2490
2556
  //#region src/resources/segments.ts
2491
2557
  var SegmentsResource = class {
@@ -2507,6 +2573,9 @@ var SegmentsResource = class {
2507
2573
  count(payload) {
2508
2574
  return this.http.post("segments/count", payload);
2509
2575
  }
2576
+ contacts(id) {
2577
+ return this.http.get(`segments/${id}/contacts`);
2578
+ }
2510
2579
  };
2511
2580
  //#endregion
2512
2581
  //#region src/resources/updates.ts
@@ -3043,6 +3112,7 @@ var JoAiClient = class {
3043
3112
  this.tasks = new TasksResource(this.http);
3044
3113
  this.tags = new TagsResource(this.http);
3045
3114
  this.teams = new TeamsResource(this.http);
3115
+ this.artifacts = new ArtifactsResource(this.http);
3046
3116
  this.campaigns = new CampaignsResource(this.http);
3047
3117
  this.segments = new SegmentsResource(this.http);
3048
3118
  this.updates = new UpdatesResource(this.http);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "4.3.0",
3
+ "version": "4.5.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.10.0",
42
42
  "tsdown": "^0.21.0",
43
43
  "typescript": "^5.9.3"
44
44
  }