@joai/sdk 1.1.0 → 1.3.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 +115 -4
- package/dist/index.mjs +68 -1
- package/package.json +1 -1
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:
|
|
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';
|
|
@@ -2520,6 +2590,13 @@ type Swarm = {
|
|
|
2520
2590
|
agents: AgentPrivate[];
|
|
2521
2591
|
};
|
|
2522
2592
|
//#endregion
|
|
2593
|
+
//#region src/tag/types.d.ts
|
|
2594
|
+
type TagType = 'contact';
|
|
2595
|
+
type Tag = {
|
|
2596
|
+
slug: string;
|
|
2597
|
+
name: string;
|
|
2598
|
+
type: TagType | null;
|
|
2599
|
+
}; //#endregion
|
|
2523
2600
|
//#region src/task/types.d.ts
|
|
2524
2601
|
type Task = {
|
|
2525
2602
|
id: string;
|
|
@@ -3017,7 +3094,7 @@ type CouponPayload = {
|
|
|
3017
3094
|
code: string;
|
|
3018
3095
|
percent?: number | null;
|
|
3019
3096
|
amount?: number | null;
|
|
3020
|
-
condition?:
|
|
3097
|
+
condition?: CouponCondition;
|
|
3021
3098
|
usesLeft?: number | null;
|
|
3022
3099
|
expiresAt?: string | null;
|
|
3023
3100
|
};
|
|
@@ -3872,6 +3949,14 @@ declare class TasksResource {
|
|
|
3872
3949
|
toggle(id: string): Promise<IAppResponse<Task>>;
|
|
3873
3950
|
}
|
|
3874
3951
|
//#endregion
|
|
3952
|
+
//#region src/resources/tags.d.ts
|
|
3953
|
+
declare class TagsResource {
|
|
3954
|
+
private readonly http;
|
|
3955
|
+
constructor(http: IHttpService);
|
|
3956
|
+
list(type?: TagType): Promise<IAppResponse<Tag[]>>;
|
|
3957
|
+
create(name: string, type?: TagType): Promise<IAppResponse<Tag[]>>;
|
|
3958
|
+
}
|
|
3959
|
+
//#endregion
|
|
3875
3960
|
//#region src/resources/teams.d.ts
|
|
3876
3961
|
type TeamInviteInfo = {
|
|
3877
3962
|
slug: string;
|
|
@@ -3935,6 +4020,29 @@ declare class TeamsResource {
|
|
|
3935
4020
|
topupFinalize(tx: string): Promise<IAppResponse<void>>;
|
|
3936
4021
|
}
|
|
3937
4022
|
//#endregion
|
|
4023
|
+
//#region src/resources/campaigns.d.ts
|
|
4024
|
+
declare class CampaignsResource {
|
|
4025
|
+
private readonly http;
|
|
4026
|
+
constructor(http: IHttpService);
|
|
4027
|
+
stats(): Promise<IAppResponse<CampaignStats>>;
|
|
4028
|
+
list(): Promise<IAppResponse<Campaign[]>>;
|
|
4029
|
+
get(id: string): Promise<IAppResponse<Campaign>>;
|
|
4030
|
+
create(payload: CampaignCreatePayload): Promise<IAppResponse<Campaign>>;
|
|
4031
|
+
send(id: string): Promise<IAppResponse<Campaign>>;
|
|
4032
|
+
delete(id: string): Promise<IAppResponse<void>>;
|
|
4033
|
+
}
|
|
4034
|
+
//#endregion
|
|
4035
|
+
//#region src/resources/segments.d.ts
|
|
4036
|
+
declare class SegmentsResource {
|
|
4037
|
+
private readonly http;
|
|
4038
|
+
constructor(http: IHttpService);
|
|
4039
|
+
list(): Promise<IAppResponse<Segment[]>>;
|
|
4040
|
+
create(payload: SegmentCreatePayload): Promise<IAppResponse<Segment>>;
|
|
4041
|
+
update(id: string, payload: SegmentCreatePayload): Promise<IAppResponse<Segment>>;
|
|
4042
|
+
delete(id: string): Promise<IAppResponse<void>>;
|
|
4043
|
+
count(payload: SegmentCountPayload): Promise<IAppResponse<SegmentCountResult>>;
|
|
4044
|
+
}
|
|
4045
|
+
//#endregion
|
|
3938
4046
|
//#region src/resources/updates.d.ts
|
|
3939
4047
|
declare class UpdatesResource {
|
|
3940
4048
|
private readonly http;
|
|
@@ -4256,7 +4364,10 @@ declare class JoAiClient {
|
|
|
4256
4364
|
readonly subscriptions: SubscriptionsResource;
|
|
4257
4365
|
readonly swarms: SwarmsResource;
|
|
4258
4366
|
readonly tasks: TasksResource;
|
|
4367
|
+
readonly tags: TagsResource;
|
|
4259
4368
|
readonly teams: TeamsResource;
|
|
4369
|
+
readonly campaigns: CampaignsResource;
|
|
4370
|
+
readonly segments: SegmentsResource;
|
|
4260
4371
|
readonly updates: UpdatesResource;
|
|
4261
4372
|
readonly upgrades: UpgradesResource;
|
|
4262
4373
|
readonly users: UsersResource;
|
|
@@ -4302,4 +4413,4 @@ declare class DistributionResource {
|
|
|
4302
4413
|
private fetchDistribution;
|
|
4303
4414
|
}
|
|
4304
4415
|
//#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 };
|
|
4416
|
+
export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, type AuthSendCodeRequest, type AuthVerifyResponse, type BackendWarp, type BackendWarpBrand, BillingAddressesResource, BillingResource, BlueprintsResource, type CacheConfig, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, type JoAiClientConfig, KvResource, LinksResource, LoyaltyResource, McpResource, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, type OpeningHoursEntry, type OpeningHoursFormatOptions, OrdersResource, PersonaResource, type Product, type ProductVariation, ProductsResource, ProjectsResource, RemindersResource, SegmentsResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, type TeamInviteInfo, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WebhooksResource, WorkspaceResource, createClient, formatOpeningHours };
|
package/dist/index.mjs
CHANGED
|
@@ -1946,6 +1946,23 @@ var TasksResource = class {
|
|
|
1946
1946
|
}
|
|
1947
1947
|
};
|
|
1948
1948
|
//#endregion
|
|
1949
|
+
//#region src/resources/tags.ts
|
|
1950
|
+
var TagsResource = class {
|
|
1951
|
+
constructor(http) {
|
|
1952
|
+
this.http = http;
|
|
1953
|
+
}
|
|
1954
|
+
list(type) {
|
|
1955
|
+
const qs = type ? `?type=${type}` : "";
|
|
1956
|
+
return this.http.get(`tags${qs}`);
|
|
1957
|
+
}
|
|
1958
|
+
create(name, type) {
|
|
1959
|
+
return this.http.post("tags", {
|
|
1960
|
+
name,
|
|
1961
|
+
type
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
};
|
|
1965
|
+
//#endregion
|
|
1949
1966
|
//#region src/resources/teams.ts
|
|
1950
1967
|
var TeamsResource = class {
|
|
1951
1968
|
constructor(http) {
|
|
@@ -2026,6 +2043,53 @@ var TeamsResource = class {
|
|
|
2026
2043
|
}
|
|
2027
2044
|
};
|
|
2028
2045
|
//#endregion
|
|
2046
|
+
//#region src/resources/campaigns.ts
|
|
2047
|
+
var CampaignsResource = class {
|
|
2048
|
+
constructor(http) {
|
|
2049
|
+
this.http = http;
|
|
2050
|
+
}
|
|
2051
|
+
stats() {
|
|
2052
|
+
return this.http.get("campaigns/stats");
|
|
2053
|
+
}
|
|
2054
|
+
list() {
|
|
2055
|
+
return this.http.get("campaigns");
|
|
2056
|
+
}
|
|
2057
|
+
get(id) {
|
|
2058
|
+
return this.http.get(`campaigns/${id}`);
|
|
2059
|
+
}
|
|
2060
|
+
create(payload) {
|
|
2061
|
+
return this.http.post("campaigns", payload);
|
|
2062
|
+
}
|
|
2063
|
+
send(id) {
|
|
2064
|
+
return this.http.post(`campaigns/${id}/send`);
|
|
2065
|
+
}
|
|
2066
|
+
delete(id) {
|
|
2067
|
+
return this.http.delete(`campaigns/${id}`);
|
|
2068
|
+
}
|
|
2069
|
+
};
|
|
2070
|
+
//#endregion
|
|
2071
|
+
//#region src/resources/segments.ts
|
|
2072
|
+
var SegmentsResource = class {
|
|
2073
|
+
constructor(http) {
|
|
2074
|
+
this.http = http;
|
|
2075
|
+
}
|
|
2076
|
+
list() {
|
|
2077
|
+
return this.http.get("segments");
|
|
2078
|
+
}
|
|
2079
|
+
create(payload) {
|
|
2080
|
+
return this.http.post("segments", payload);
|
|
2081
|
+
}
|
|
2082
|
+
update(id, payload) {
|
|
2083
|
+
return this.http.patch(`segments/${id}`, payload);
|
|
2084
|
+
}
|
|
2085
|
+
delete(id) {
|
|
2086
|
+
return this.http.delete(`segments/${id}`);
|
|
2087
|
+
}
|
|
2088
|
+
count(payload) {
|
|
2089
|
+
return this.http.post("segments/count", payload);
|
|
2090
|
+
}
|
|
2091
|
+
};
|
|
2092
|
+
//#endregion
|
|
2029
2093
|
//#region src/resources/updates.ts
|
|
2030
2094
|
var UpdatesResource = class {
|
|
2031
2095
|
constructor(http) {
|
|
@@ -2575,7 +2639,10 @@ var JoAiClient = class {
|
|
|
2575
2639
|
this.subscriptions = new SubscriptionsResource(this.http);
|
|
2576
2640
|
this.swarms = new SwarmsResource(this.http);
|
|
2577
2641
|
this.tasks = new TasksResource(this.http);
|
|
2642
|
+
this.tags = new TagsResource(this.http);
|
|
2578
2643
|
this.teams = new TeamsResource(this.http);
|
|
2644
|
+
this.campaigns = new CampaignsResource(this.http);
|
|
2645
|
+
this.segments = new SegmentsResource(this.http);
|
|
2579
2646
|
this.updates = new UpdatesResource(this.http);
|
|
2580
2647
|
this.upgrades = new UpgradesResource(this.http);
|
|
2581
2648
|
this.users = new UsersResource(this.http);
|
|
@@ -2627,4 +2694,4 @@ var DistributionResource = class {
|
|
|
2627
2694
|
}
|
|
2628
2695
|
};
|
|
2629
2696
|
//#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 };
|
|
2697
|
+
export { AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, BillingAddressesResource, BillingResource, BlueprintsResource, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, ContactsResource, ContractsResource, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, GoalsResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, ItemsResource, JoAiClient, KvResource, LinksResource, LoyaltyResource, McpResource, MeetingsResource, MemoriesResource, MessagesResource, MissionsResource, NotificationsResource, OfficeResource, OrdersResource, PersonaResource, ProductsResource, ProjectsResource, RemindersResource, SegmentsResource, ServicesResource, ShortcutsResource, SitesResource, SkillsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WebhooksResource, WorkspaceResource, createClient, formatOpeningHours };
|