@joai/sdk 4.6.0 → 4.7.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 +108 -1
- package/dist/index.mjs +46 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1898,6 +1898,88 @@ type AppointmentRequest = {
|
|
|
1898
1898
|
configuration?: Configuration;
|
|
1899
1899
|
createdAt: string;
|
|
1900
1900
|
}; //#endregion
|
|
1901
|
+
//#region src/automation/types.d.ts
|
|
1902
|
+
type AutomationTriggerType = 'prop' | 'segment' | 'manual';
|
|
1903
|
+
type AutomationActionType = 'wait' | 'send_email' | 'halt';
|
|
1904
|
+
type AutomationSendMode = 'direct' | 'campaign';
|
|
1905
|
+
type AutomationEnrollmentStatus = 'active' | 'completed' | 'skipped';
|
|
1906
|
+
type AutomationSkipReason = 'pending_consent' | 'opted_out' | 'missing_channel' | 'automation_disabled' | 'already_completed';
|
|
1907
|
+
type AutomationTriggerConfig = {
|
|
1908
|
+
propKey?: string;
|
|
1909
|
+
propValue?: string | number | boolean;
|
|
1910
|
+
segmentId?: string;
|
|
1911
|
+
};
|
|
1912
|
+
type AutomationActionConfig = {
|
|
1913
|
+
delayMinutes?: number;
|
|
1914
|
+
sendMode?: AutomationSendMode;
|
|
1915
|
+
campaignId?: string;
|
|
1916
|
+
subject?: string;
|
|
1917
|
+
body?: string;
|
|
1918
|
+
contentHtml?: boolean;
|
|
1919
|
+
sentPropKey?: string;
|
|
1920
|
+
[key: string]: unknown;
|
|
1921
|
+
};
|
|
1922
|
+
type AutomationAction = {
|
|
1923
|
+
id: string;
|
|
1924
|
+
position: number;
|
|
1925
|
+
type: AutomationActionType;
|
|
1926
|
+
config: AutomationActionConfig;
|
|
1927
|
+
};
|
|
1928
|
+
type Automation = {
|
|
1929
|
+
id: string;
|
|
1930
|
+
name: string;
|
|
1931
|
+
triggerType: AutomationTriggerType;
|
|
1932
|
+
triggerConfig: AutomationTriggerConfig;
|
|
1933
|
+
enabled: boolean;
|
|
1934
|
+
agent: AgentSimple | null;
|
|
1935
|
+
actions?: AutomationAction[];
|
|
1936
|
+
createdAt: string;
|
|
1937
|
+
updatedAt: string;
|
|
1938
|
+
};
|
|
1939
|
+
type AutomationEnrollment = {
|
|
1940
|
+
id: string;
|
|
1941
|
+
automationId: string;
|
|
1942
|
+
contactId: string | null;
|
|
1943
|
+
contact?: {
|
|
1944
|
+
id: string;
|
|
1945
|
+
name: string | null;
|
|
1946
|
+
email: string | null;
|
|
1947
|
+
};
|
|
1948
|
+
status: AutomationEnrollmentStatus;
|
|
1949
|
+
currentPosition: number;
|
|
1950
|
+
enteredAt: string | null;
|
|
1951
|
+
eligibleAt: string | null;
|
|
1952
|
+
sentAt: string | null;
|
|
1953
|
+
completedAt: string | null;
|
|
1954
|
+
skippedAt: string | null;
|
|
1955
|
+
skipReason: AutomationSkipReason | null;
|
|
1956
|
+
error: string | null;
|
|
1957
|
+
createdAt: string;
|
|
1958
|
+
updatedAt: string;
|
|
1959
|
+
};
|
|
1960
|
+
type AutomationActionInput = {
|
|
1961
|
+
type: AutomationActionType;
|
|
1962
|
+
config?: AutomationActionConfig;
|
|
1963
|
+
};
|
|
1964
|
+
type AutomationCreatePayload = {
|
|
1965
|
+
name: string;
|
|
1966
|
+
triggerType: AutomationTriggerType;
|
|
1967
|
+
triggerConfig?: AutomationTriggerConfig;
|
|
1968
|
+
actions?: AutomationActionInput[];
|
|
1969
|
+
enabled?: boolean;
|
|
1970
|
+
agentId?: string;
|
|
1971
|
+
};
|
|
1972
|
+
type AutomationUpdatePayload = {
|
|
1973
|
+
name?: string;
|
|
1974
|
+
triggerType?: AutomationTriggerType;
|
|
1975
|
+
triggerConfig?: AutomationTriggerConfig;
|
|
1976
|
+
enabled?: boolean;
|
|
1977
|
+
agentId?: string | null;
|
|
1978
|
+
};
|
|
1979
|
+
type AutomationAudiencePreview = {
|
|
1980
|
+
count: number;
|
|
1981
|
+
sampleContactIds: string[];
|
|
1982
|
+
}; //#endregion
|
|
1901
1983
|
//#region src/content/types.d.ts
|
|
1902
1984
|
type ContentStatus = 'draft' | 'published' | 'archived';
|
|
1903
1985
|
type ContentFieldType = 'text' | 'richText' | 'number' | 'boolean' | 'url' | 'image' | 'media' | 'list' | 'object' | 'reference';
|
|
@@ -4990,6 +5072,27 @@ declare class CampaignsResource {
|
|
|
4990
5072
|
delete(id: string): Promise<IAppResponse<void>>;
|
|
4991
5073
|
}
|
|
4992
5074
|
//#endregion
|
|
5075
|
+
//#region src/resources/automations.d.ts
|
|
5076
|
+
declare class AutomationsResource {
|
|
5077
|
+
private readonly http;
|
|
5078
|
+
constructor(http: IHttpService);
|
|
5079
|
+
list(): Promise<IAppResponse<Automation[]>>;
|
|
5080
|
+
get(id: string): Promise<IAppResponse<Automation>>;
|
|
5081
|
+
create(payload: AutomationCreatePayload): Promise<IAppResponse<Automation>>;
|
|
5082
|
+
update(id: string, payload: AutomationUpdatePayload): Promise<IAppResponse<Automation>>;
|
|
5083
|
+
setActions(id: string, actions: AutomationActionInput[]): Promise<IAppResponse<Automation>>;
|
|
5084
|
+
delete(id: string): Promise<IAppResponse<void>>;
|
|
5085
|
+
enrollments(id: string, params?: {
|
|
5086
|
+
page?: number;
|
|
5087
|
+
perPage?: number;
|
|
5088
|
+
}): Promise<IAppResponse<AutomationEnrollment[]>>;
|
|
5089
|
+
run(id: string, payload: {
|
|
5090
|
+
contactId: string;
|
|
5091
|
+
}): Promise<IAppResponse<AutomationEnrollment>>;
|
|
5092
|
+
retryEnrollment(id: string, enrollmentId: string): Promise<IAppResponse<AutomationEnrollment>>;
|
|
5093
|
+
previewAudience(id: string): Promise<IAppResponse<AutomationAudiencePreview>>;
|
|
5094
|
+
}
|
|
5095
|
+
//#endregion
|
|
4993
5096
|
//#region src/resources/segments.d.ts
|
|
4994
5097
|
declare class SegmentsResource {
|
|
4995
5098
|
private readonly http;
|
|
@@ -5017,6 +5120,9 @@ declare class UpdatesResource {
|
|
|
5017
5120
|
tags?: string;
|
|
5018
5121
|
with?: UpdateRelation[];
|
|
5019
5122
|
sort?: string;
|
|
5123
|
+
limit?: number;
|
|
5124
|
+
upcoming?: boolean;
|
|
5125
|
+
past?: boolean;
|
|
5020
5126
|
}): Promise<IAppResponse<Update[]>>;
|
|
5021
5127
|
create(payload: UpdateCreatePayload): Promise<IAppResponse<Update>>;
|
|
5022
5128
|
update(id: string, payload: UpdateUpdatePayload): Promise<IAppResponse<Update>>;
|
|
@@ -5322,6 +5428,7 @@ declare class JoAiClient {
|
|
|
5322
5428
|
readonly teams: TeamsResource;
|
|
5323
5429
|
readonly artifacts: ArtifactsResource;
|
|
5324
5430
|
readonly campaigns: CampaignsResource;
|
|
5431
|
+
readonly automations: AutomationsResource;
|
|
5325
5432
|
readonly segments: SegmentsResource;
|
|
5326
5433
|
readonly updates: UpdatesResource;
|
|
5327
5434
|
readonly upgrades: UpgradesResource;
|
|
@@ -5401,4 +5508,4 @@ declare class DistributionResource {
|
|
|
5401
5508
|
private fetchDistribution;
|
|
5402
5509
|
}
|
|
5403
5510
|
//#endregion
|
|
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 };
|
|
5511
|
+
export { AddressesResource, AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, type AttachedMedia, type AuthConfirmCodeRequest, type AuthConfirmCodeResponse, type AuthNativeSessionResponse, type AuthPortalSessionResponse, AuthResource, type AuthSendCodeRequest, AutomationsResource, 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
|
@@ -2603,6 +2603,47 @@ const audiencePreviewQuery = (payload) => {
|
|
|
2603
2603
|
return query ? `?${query}` : "";
|
|
2604
2604
|
};
|
|
2605
2605
|
//#endregion
|
|
2606
|
+
//#region src/resources/automations.ts
|
|
2607
|
+
var AutomationsResource = class {
|
|
2608
|
+
constructor(http) {
|
|
2609
|
+
this.http = http;
|
|
2610
|
+
}
|
|
2611
|
+
list() {
|
|
2612
|
+
return this.http.get("automations");
|
|
2613
|
+
}
|
|
2614
|
+
get(id) {
|
|
2615
|
+
return this.http.get(`automations/${id}`);
|
|
2616
|
+
}
|
|
2617
|
+
create(payload) {
|
|
2618
|
+
return this.http.post("automations", payload);
|
|
2619
|
+
}
|
|
2620
|
+
update(id, payload) {
|
|
2621
|
+
return this.http.put(`automations/${id}`, payload);
|
|
2622
|
+
}
|
|
2623
|
+
setActions(id, actions) {
|
|
2624
|
+
return this.http.put(`automations/${id}/actions`, { actions });
|
|
2625
|
+
}
|
|
2626
|
+
delete(id) {
|
|
2627
|
+
return this.http.delete(`automations/${id}`);
|
|
2628
|
+
}
|
|
2629
|
+
enrollments(id, params) {
|
|
2630
|
+
const search = new URLSearchParams();
|
|
2631
|
+
if (params?.page) search.set("page", String(params.page));
|
|
2632
|
+
if (params?.perPage) search.set("perPage", String(params.perPage));
|
|
2633
|
+
const query = search.toString();
|
|
2634
|
+
return this.http.get(`automations/${id}/enrollments${query ? `?${query}` : ""}`);
|
|
2635
|
+
}
|
|
2636
|
+
run(id, payload) {
|
|
2637
|
+
return this.http.post(`automations/${id}/run`, payload);
|
|
2638
|
+
}
|
|
2639
|
+
retryEnrollment(id, enrollmentId) {
|
|
2640
|
+
return this.http.post(`automations/${id}/enrollments/${enrollmentId}/retry`);
|
|
2641
|
+
}
|
|
2642
|
+
previewAudience(id) {
|
|
2643
|
+
return this.http.get(`automations/${id}/audience-preview`);
|
|
2644
|
+
}
|
|
2645
|
+
};
|
|
2646
|
+
//#endregion
|
|
2606
2647
|
//#region src/resources/segments.ts
|
|
2607
2648
|
var SegmentsResource = class {
|
|
2608
2649
|
constructor(http) {
|
|
@@ -2646,6 +2687,9 @@ var UpdatesResource = class {
|
|
|
2646
2687
|
if (params?.tags) query.set("tags", params.tags);
|
|
2647
2688
|
if (params?.with?.length) query.set("with", params.with.join(","));
|
|
2648
2689
|
if (params?.sort) query.set("sort", params.sort);
|
|
2690
|
+
if (params?.limit != null) query.set("limit", String(params.limit));
|
|
2691
|
+
if (params?.upcoming) query.set("filter[upcoming]", "1");
|
|
2692
|
+
if (params?.past) query.set("filter[past]", "1");
|
|
2649
2693
|
const qs = query.toString();
|
|
2650
2694
|
return this.http.get(`updates${qs ? "?" + qs : ""}`);
|
|
2651
2695
|
}
|
|
@@ -3195,6 +3239,7 @@ var JoAiClient = class {
|
|
|
3195
3239
|
this.teams = new TeamsResource(this.http);
|
|
3196
3240
|
this.artifacts = new ArtifactsResource(this.http);
|
|
3197
3241
|
this.campaigns = new CampaignsResource(this.http);
|
|
3242
|
+
this.automations = new AutomationsResource(this.http);
|
|
3198
3243
|
this.segments = new SegmentsResource(this.http);
|
|
3199
3244
|
this.updates = new UpdatesResource(this.http);
|
|
3200
3245
|
this.upgrades = new UpgradesResource(this.http);
|
|
@@ -3310,4 +3355,4 @@ var DistributionResource = class {
|
|
|
3310
3355
|
}
|
|
3311
3356
|
};
|
|
3312
3357
|
//#endregion
|
|
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 };
|
|
3358
|
+
export { AddressesResource, AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, AutomationsResource, 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
|
+
"version": "4.7.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": "^4.
|
|
41
|
+
"@joai/core": "^4.12.0",
|
|
42
42
|
"tsdown": "^0.21.0",
|
|
43
43
|
"typescript": "^5.9.3"
|
|
44
44
|
}
|