@joai/sdk 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -440,6 +440,9 @@ type Contact = {
440
440
  userId: string | null;
441
441
  locale?: string | null;
442
442
  props?: Record<string, string> | null;
443
+ settings?: {
444
+ marketingOptOut?: boolean;
445
+ } | null;
443
446
  lastActivityAt?: string | null;
444
447
  health?: ContactHealth;
445
448
  };
@@ -471,6 +474,9 @@ type ContactFormData = {
471
474
  tags?: string[] | null;
472
475
  locale?: string | null;
473
476
  props?: Record<string, string> | null;
477
+ settings?: {
478
+ marketingOptOut?: boolean;
479
+ };
474
480
  };
475
481
  type ContactCreatePayload = ContactFormData & {
476
482
  name: string;
@@ -507,7 +513,7 @@ type TranslatableValue = Partial<Record<WarpLocale, string>>;
507
513
  type OrderStatus = 'pending' | 'completed' | 'delivered' | 'canceled';
508
514
  type OrderSource = 'auto' | 'manual' | 'kiosk';
509
515
  type OrderType = 'order' | 'quote';
510
- type SubscriptionStatus = 'active' | 'canceled' | 'past_due';
516
+ type SubscriptionStatus = 'active' | 'canceled' | 'past_due' | 'pending';
511
517
  type SubscriptionInterval = 'weekly' | 'biweekly' | 'monthly' | 'quarterly' | 'yearly';
512
518
  type PricingModel = 'free' | 'one-time' | 'weekly' | 'biweekly' | 'monthly' | 'quarterly' | 'yearly' | 'per-run';
513
519
  type AppSubscription = {
@@ -750,12 +756,13 @@ type Cart = {
750
756
  coupon: Coupon | null;
751
757
  couponDiscount: number;
752
758
  };
759
+ type CouponCondition = 'none' | 'onetime-use' | 'previous-purchase';
753
760
  type Coupon = {
754
761
  id: string;
755
762
  code: string;
756
763
  amount: number | null;
757
764
  percent: number | null;
758
- condition: number;
765
+ condition: CouponCondition;
759
766
  usesLeft: number | null;
760
767
  expiresAt: string | null;
761
768
  };
@@ -2446,6 +2453,69 @@ type LoyaltyMember = {
2446
2453
  tier: string | null;
2447
2454
  updatedAt: string;
2448
2455
  }; //#endregion
2456
+ //#region src/segment/types.d.ts
2457
+ type SegmentConditionType = 'tag' | 'has_email' | 'has_phone' | 'created_after' | 'created_before' | 'email_contains';
2458
+ type SegmentCondition = {
2459
+ type: SegmentConditionType;
2460
+ value: string | boolean;
2461
+ };
2462
+ type SegmentGroup = {
2463
+ match: 'all' | 'any';
2464
+ conditions: SegmentCondition[];
2465
+ };
2466
+ type Segment = {
2467
+ id: string;
2468
+ name: string;
2469
+ conditions: SegmentGroup[];
2470
+ count: number;
2471
+ campaignsCount: number;
2472
+ createdAt: string;
2473
+ updatedAt: string;
2474
+ };
2475
+ type SegmentCreatePayload = {
2476
+ name: string;
2477
+ conditions: SegmentGroup[];
2478
+ };
2479
+ type SegmentCountPayload = {
2480
+ conditions: SegmentGroup[];
2481
+ channel?: string;
2482
+ };
2483
+ type SegmentCountResult = {
2484
+ count: number;
2485
+ reachable: number | null;
2486
+ }; //#endregion
2487
+ //#region src/campaign/types.d.ts
2488
+ type CampaignChannel = 'email' | 'whatsapp' | 'sms';
2489
+ type CampaignStatus = 'draft' | 'sending' | 'completed' | 'failed';
2490
+ type Campaign = {
2491
+ id: string;
2492
+ name: string;
2493
+ channel: CampaignChannel;
2494
+ subject: string | null;
2495
+ content: string;
2496
+ tags: string[];
2497
+ status: CampaignStatus;
2498
+ totalCount: number;
2499
+ remainingCount: number;
2500
+ sentCount: number;
2501
+ failedCount: number;
2502
+ skippedCount: number;
2503
+ createdAt: string;
2504
+ updatedAt: string;
2505
+ };
2506
+ type CampaignCreatePayload = {
2507
+ name: string;
2508
+ channel: CampaignChannel;
2509
+ subject?: string;
2510
+ content: string;
2511
+ tags?: string[];
2512
+ contactIds?: string[];
2513
+ };
2514
+ type CampaignStats = {
2515
+ totalCampaigns: number;
2516
+ draftCampaigns: number;
2517
+ totalSent: number;
2518
+ }; //#endregion
2449
2519
  //#region src/update/types.d.ts
2450
2520
  type UpdateType = 'deal' | 'event' | 'news';
2451
2521
  type UpdateStatus = 'draft' | 'published' | 'archived';
@@ -3017,7 +3087,7 @@ type CouponPayload = {
3017
3087
  code: string;
3018
3088
  percent?: number | null;
3019
3089
  amount?: number | null;
3020
- condition?: number;
3090
+ condition?: CouponCondition;
3021
3091
  usesLeft?: number | null;
3022
3092
  expiresAt?: string | null;
3023
3093
  };
@@ -3935,6 +4005,32 @@ declare class TeamsResource {
3935
4005
  topupFinalize(tx: string): Promise<IAppResponse<void>>;
3936
4006
  }
3937
4007
  //#endregion
4008
+ //#region src/resources/campaigns.d.ts
4009
+ declare class CampaignsResource {
4010
+ private readonly http;
4011
+ constructor(http: IHttpService);
4012
+ stats(): Promise<IAppResponse<CampaignStats>>;
4013
+ list(): Promise<IAppResponse<Campaign[]>>;
4014
+ get(id: string): Promise<IAppResponse<Campaign>>;
4015
+ create(payload: CampaignCreatePayload): Promise<IAppResponse<Campaign>>;
4016
+ send(id: string): Promise<IAppResponse<Campaign>>;
4017
+ delete(id: string): Promise<IAppResponse<void>>;
4018
+ }
4019
+ //#endregion
4020
+ //#region src/resources/segments.d.ts
4021
+ declare class SegmentsResource {
4022
+ private readonly http;
4023
+ constructor(http: IHttpService);
4024
+ list(): Promise<IAppResponse<Segment[]>>;
4025
+ create(payload: SegmentCreatePayload): Promise<IAppResponse<Segment>>;
4026
+ update(id: string, payload: SegmentCreatePayload): Promise<IAppResponse<Segment>>;
4027
+ delete(id: string): Promise<IAppResponse<void>>;
4028
+ count(payload: SegmentCountPayload): Promise<IAppResponse<SegmentCountResult>>;
4029
+ tags(): Promise<IAppResponse<{
4030
+ tags: string[];
4031
+ }>>;
4032
+ }
4033
+ //#endregion
3938
4034
  //#region src/resources/updates.d.ts
3939
4035
  declare class UpdatesResource {
3940
4036
  private readonly http;
@@ -4257,6 +4353,8 @@ declare class JoAiClient {
4257
4353
  readonly swarms: SwarmsResource;
4258
4354
  readonly tasks: TasksResource;
4259
4355
  readonly teams: TeamsResource;
4356
+ readonly campaigns: CampaignsResource;
4357
+ readonly segments: SegmentsResource;
4260
4358
  readonly updates: UpdatesResource;
4261
4359
  readonly upgrades: UpgradesResource;
4262
4360
  readonly users: UsersResource;
@@ -4302,4 +4400,4 @@ declare class DistributionResource {
4302
4400
  private fetchDistribution;
4303
4401
  }
4304
4402
  //#endregion
4305
- export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, type AuthSendCodeRequest, type AuthVerifyResponse, type BackendWarp, type BackendWarpBrand, BillingAddressesResource, BillingResource, BlueprintsResource, type CacheConfig, CachedHttpService, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, type JoAiClientConfig, KvResource, LinksResource, LoyaltyResource, McpResource, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, type OpeningHoursEntry, type OpeningHoursFormatOptions, OrdersResource, PersonaResource, type Product, type ProductVariation, ProductsResource, ProjectsResource, RemindersResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TasksResource, type TeamInviteInfo, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WebhooksResource, WorkspaceResource, createClient, formatOpeningHours };
4403
+ export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, type AuthSendCodeRequest, type AuthVerifyResponse, type BackendWarp, type BackendWarpBrand, BillingAddressesResource, BillingResource, BlueprintsResource, type CacheConfig, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, type JoAiClientConfig, KvResource, LinksResource, LoyaltyResource, McpResource, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, type OpeningHoursEntry, type OpeningHoursFormatOptions, OrdersResource, PersonaResource, type Product, type ProductVariation, ProductsResource, ProjectsResource, RemindersResource, SegmentsResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TasksResource, type TeamInviteInfo, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WebhooksResource, WorkspaceResource, createClient, formatOpeningHours };
package/dist/index.mjs CHANGED
@@ -2026,6 +2026,56 @@ var TeamsResource = class {
2026
2026
  }
2027
2027
  };
2028
2028
  //#endregion
2029
+ //#region src/resources/campaigns.ts
2030
+ var CampaignsResource = class {
2031
+ constructor(http) {
2032
+ this.http = http;
2033
+ }
2034
+ stats() {
2035
+ return this.http.get("campaigns/stats");
2036
+ }
2037
+ list() {
2038
+ return this.http.get("campaigns");
2039
+ }
2040
+ get(id) {
2041
+ return this.http.get(`campaigns/${id}`);
2042
+ }
2043
+ create(payload) {
2044
+ return this.http.post("campaigns", payload);
2045
+ }
2046
+ send(id) {
2047
+ return this.http.post(`campaigns/${id}/send`);
2048
+ }
2049
+ delete(id) {
2050
+ return this.http.delete(`campaigns/${id}`);
2051
+ }
2052
+ };
2053
+ //#endregion
2054
+ //#region src/resources/segments.ts
2055
+ var SegmentsResource = class {
2056
+ constructor(http) {
2057
+ this.http = http;
2058
+ }
2059
+ list() {
2060
+ return this.http.get("segments");
2061
+ }
2062
+ create(payload) {
2063
+ return this.http.post("segments", payload);
2064
+ }
2065
+ update(id, payload) {
2066
+ return this.http.patch(`segments/${id}`, payload);
2067
+ }
2068
+ delete(id) {
2069
+ return this.http.delete(`segments/${id}`);
2070
+ }
2071
+ count(payload) {
2072
+ return this.http.post("segments/count", payload);
2073
+ }
2074
+ tags() {
2075
+ return this.http.get("segments/tags");
2076
+ }
2077
+ };
2078
+ //#endregion
2029
2079
  //#region src/resources/updates.ts
2030
2080
  var UpdatesResource = class {
2031
2081
  constructor(http) {
@@ -2576,6 +2626,8 @@ var JoAiClient = class {
2576
2626
  this.swarms = new SwarmsResource(this.http);
2577
2627
  this.tasks = new TasksResource(this.http);
2578
2628
  this.teams = new TeamsResource(this.http);
2629
+ this.campaigns = new CampaignsResource(this.http);
2630
+ this.segments = new SegmentsResource(this.http);
2579
2631
  this.updates = new UpdatesResource(this.http);
2580
2632
  this.upgrades = new UpgradesResource(this.http);
2581
2633
  this.users = new UsersResource(this.http);
@@ -2627,4 +2679,4 @@ var DistributionResource = class {
2627
2679
  }
2628
2680
  };
2629
2681
  //#endregion
2630
- export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, BillingAddressesResource, BillingResource, BlueprintsResource, CachedHttpService, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, KvResource, LinksResource, LoyaltyResource, McpResource, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, OrdersResource, PersonaResource, ProductsResource, ProjectsResource, RemindersResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TasksResource, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WebhooksResource, WorkspaceResource, createClient, formatOpeningHours };
2682
+ export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, BillingAddressesResource, BillingResource, BlueprintsResource, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, KvResource, LinksResource, LoyaltyResource, McpResource, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, OrdersResource, PersonaResource, ProductsResource, ProjectsResource, RemindersResource, SegmentsResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TasksResource, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WebhooksResource, WorkspaceResource, createClient, formatOpeningHours };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",