@joai/sdk 4.5.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 +171 -15
- package/dist/index.mjs +91 -10
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -16,6 +16,7 @@ interface IHttpService {
|
|
|
16
16
|
onUnauthorized: (response: IAppResponse<any>) => void;
|
|
17
17
|
onSuccessfulResponse: (response: IAppResponse<any>) => void;
|
|
18
18
|
onMaintenanceMode: (response: IAppResponse<any>) => void;
|
|
19
|
+
onTooManyRequests: (response: IAppResponse<any>) => void;
|
|
19
20
|
get: <T>(url: string, options?: IRequestOptions) => Promise<IAppResponse<T>>;
|
|
20
21
|
post: <T>(url: string, data?: any, options?: IRequestOptions) => Promise<IAppResponse<T>>;
|
|
21
22
|
put: <T>(url: string, data?: any, options?: IRequestOptions) => Promise<IAppResponse<T>>;
|
|
@@ -394,6 +395,37 @@ type ContactFormData = {
|
|
|
394
395
|
type ContactCreatePayload = ContactFormData & {
|
|
395
396
|
name: string;
|
|
396
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>;
|
|
397
429
|
}; //#endregion
|
|
398
430
|
//#region src/media/types.d.ts
|
|
399
431
|
type MediaLibraryAttributes = {
|
|
@@ -996,9 +1028,12 @@ type Order = {
|
|
|
996
1028
|
justCreated?: boolean;
|
|
997
1029
|
createdAt: string;
|
|
998
1030
|
invoiceDate: string;
|
|
1031
|
+
serviceDate: string;
|
|
999
1032
|
meta: Record<string, JsonValue> | null;
|
|
1000
1033
|
contactId: string | null;
|
|
1001
1034
|
contact?: Contact | null;
|
|
1035
|
+
invoiceContactId?: string | null;
|
|
1036
|
+
invoiceContact?: Contact | null;
|
|
1002
1037
|
source: OrderSource | null;
|
|
1003
1038
|
context: OrderContext | null;
|
|
1004
1039
|
paymentMode: string | null;
|
|
@@ -1014,6 +1049,7 @@ type Order = {
|
|
|
1014
1049
|
} | null;
|
|
1015
1050
|
shippingFee?: number;
|
|
1016
1051
|
fulfillments?: Fulfillment[];
|
|
1052
|
+
returns?: Return[];
|
|
1017
1053
|
subscription?: Subscription | null;
|
|
1018
1054
|
configuration?: OrderConfigurationItem[];
|
|
1019
1055
|
items: OrderItem[];
|
|
@@ -1098,7 +1134,7 @@ type Skill = {
|
|
|
1098
1134
|
screenshots: string[];
|
|
1099
1135
|
}; //#endregion
|
|
1100
1136
|
//#region src/integration/types.d.ts
|
|
1101
|
-
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';
|
|
1102
1138
|
type IntegrationDetails = {
|
|
1103
1139
|
type: IntegrationType;
|
|
1104
1140
|
name: string;
|
|
@@ -1634,6 +1670,12 @@ type ArtifactLink = {
|
|
|
1634
1670
|
url: string;
|
|
1635
1671
|
label?: string | null;
|
|
1636
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
|
+
};
|
|
1637
1679
|
type ArtifactContactSummary = {
|
|
1638
1680
|
id: string;
|
|
1639
1681
|
name: string | null;
|
|
@@ -1646,9 +1688,11 @@ type Artifact = {
|
|
|
1646
1688
|
status: ArtifactStatus;
|
|
1647
1689
|
title: string;
|
|
1648
1690
|
summary: string | null;
|
|
1691
|
+
blocks: ArtifactBlock[] | null;
|
|
1649
1692
|
url: string | null;
|
|
1650
1693
|
password: string | null;
|
|
1651
1694
|
links: ArtifactLink[];
|
|
1695
|
+
media: Media[];
|
|
1652
1696
|
meta: Record<string, unknown> | null;
|
|
1653
1697
|
contactId: string | null;
|
|
1654
1698
|
orderId: string | null;
|
|
@@ -1662,22 +1706,27 @@ type ArtifactCreatePayload = {
|
|
|
1662
1706
|
type: ArtifactType;
|
|
1663
1707
|
status?: ArtifactStatus;
|
|
1664
1708
|
summary?: string;
|
|
1709
|
+
blocks?: ArtifactBlock[];
|
|
1665
1710
|
url?: string;
|
|
1666
1711
|
password?: string;
|
|
1667
1712
|
links?: ArtifactLink[];
|
|
1668
1713
|
extraLinkUrl?: string;
|
|
1669
1714
|
extraLinkLabel?: string;
|
|
1715
|
+
media?: string[];
|
|
1670
1716
|
meta?: Record<string, unknown>;
|
|
1671
1717
|
contactId?: string;
|
|
1672
1718
|
orderId?: string;
|
|
1673
1719
|
};
|
|
1674
|
-
type ArtifactUpdatePayload = Partial<ArtifactCreatePayload
|
|
1720
|
+
type ArtifactUpdatePayload = Omit<Partial<ArtifactCreatePayload>, 'blocks'> & {
|
|
1721
|
+
blocks?: ArtifactBlock[] | null;
|
|
1722
|
+
};
|
|
1675
1723
|
type ArtifactDeliverPayload = {
|
|
1676
1724
|
artifactIds: string[];
|
|
1677
1725
|
message: string;
|
|
1678
1726
|
integration: ArtifactDeliverIntegration;
|
|
1679
1727
|
subject?: string;
|
|
1680
1728
|
contactIds?: string[];
|
|
1729
|
+
agentId?: string;
|
|
1681
1730
|
};
|
|
1682
1731
|
type ArtifactDelivery = {
|
|
1683
1732
|
id: string;
|
|
@@ -2227,6 +2276,20 @@ type McpToolCall = {
|
|
|
2227
2276
|
createdAt: string;
|
|
2228
2277
|
};
|
|
2229
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
|
|
2230
2293
|
//#region src/memory/types.d.ts
|
|
2231
2294
|
type Memory = {
|
|
2232
2295
|
id: string;
|
|
@@ -2729,9 +2792,14 @@ type SiteAgent = {
|
|
|
2729
2792
|
};
|
|
2730
2793
|
type Site = {
|
|
2731
2794
|
id: number;
|
|
2732
|
-
|
|
2795
|
+
slug: string;
|
|
2796
|
+
brandSlug: string | null;
|
|
2733
2797
|
customDomain: string | null;
|
|
2734
2798
|
enabled: boolean;
|
|
2799
|
+
contactId?: string | null;
|
|
2800
|
+
metricsSource?: string | null;
|
|
2801
|
+
metricsResource?: string | null;
|
|
2802
|
+
monthlyReport?: boolean;
|
|
2735
2803
|
team: SiteTeam | null;
|
|
2736
2804
|
agent: SiteAgent | null;
|
|
2737
2805
|
settings: Record<string, JsonValue>;
|
|
@@ -2920,7 +2988,7 @@ type LoyaltyMember = {
|
|
|
2920
2988
|
updatedAt: string;
|
|
2921
2989
|
}; //#endregion
|
|
2922
2990
|
//#region src/segment/types.d.ts
|
|
2923
|
-
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';
|
|
2924
2992
|
type SegmentCondition = {
|
|
2925
2993
|
type: SegmentConditionType;
|
|
2926
2994
|
value: string | boolean;
|
|
@@ -2952,10 +3020,24 @@ type SegmentCountResult = {
|
|
|
2952
3020
|
}; //#endregion
|
|
2953
3021
|
//#region src/campaign/types.d.ts
|
|
2954
3022
|
type CampaignChannel = 'email' | 'whatsapp' | 'sms' | 'push';
|
|
2955
|
-
type CampaignStatus = 'draft' | 'pending' | 'approved' | 'rejected' | 'sending' | 'completed' | 'failed';
|
|
3023
|
+
type CampaignStatus = 'draft' | 'pending' | 'approved' | 'rejected' | 'scheduled' | 'sending' | 'completed' | 'failed';
|
|
2956
3024
|
type CampaignCategory = 'MARKETING' | 'UTILITY' | 'AUTHENTICATION';
|
|
2957
3025
|
type CampaignSkipReason = 'pending_consent' | 'opted_out' | 'missing_channel' | 'approval_skipped';
|
|
2958
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
|
+
};
|
|
2959
3041
|
type CampaignAudiencePreview = {
|
|
2960
3042
|
total: number;
|
|
2961
3043
|
sendable: number;
|
|
@@ -2977,9 +3059,15 @@ type Campaign = {
|
|
|
2977
3059
|
channel: CampaignChannel;
|
|
2978
3060
|
subject: string | null;
|
|
2979
3061
|
content: string;
|
|
3062
|
+
contentHtml?: boolean;
|
|
3063
|
+
scheduledAt?: string | null;
|
|
3064
|
+
openedCount?: number;
|
|
3065
|
+
clickedCount?: number;
|
|
2980
3066
|
approval: CampaignApproval;
|
|
2981
3067
|
agent: AgentSimple | null;
|
|
2982
3068
|
tags: string[];
|
|
3069
|
+
segmentId?: string | null;
|
|
3070
|
+
contactIds?: string[];
|
|
2983
3071
|
status: CampaignStatus;
|
|
2984
3072
|
totalCount: number;
|
|
2985
3073
|
remainingCount: number;
|
|
@@ -2996,6 +3084,7 @@ type CampaignCreatePayload = {
|
|
|
2996
3084
|
channel: CampaignChannel;
|
|
2997
3085
|
subject?: string;
|
|
2998
3086
|
content: string;
|
|
3087
|
+
contentHtml?: boolean;
|
|
2999
3088
|
language?: string;
|
|
3000
3089
|
category?: CampaignCategory;
|
|
3001
3090
|
templateParams?: Record<string, string>;
|
|
@@ -3009,11 +3098,15 @@ type CampaignUpdatePayload = {
|
|
|
3009
3098
|
name: string;
|
|
3010
3099
|
subject?: string;
|
|
3011
3100
|
content: string;
|
|
3101
|
+
contentHtml?: boolean;
|
|
3012
3102
|
language?: string;
|
|
3013
3103
|
category?: CampaignCategory;
|
|
3014
3104
|
templateParams?: Record<string, string>;
|
|
3015
3105
|
aiParams?: Record<string, string>;
|
|
3016
3106
|
agentId?: string;
|
|
3107
|
+
tags?: string[];
|
|
3108
|
+
contactIds?: string[];
|
|
3109
|
+
segmentId?: string;
|
|
3017
3110
|
};
|
|
3018
3111
|
type CampaignAudiencePreviewPayload = {
|
|
3019
3112
|
campaignId: string;
|
|
@@ -3027,9 +3120,11 @@ type CampaignStats = {
|
|
|
3027
3120
|
totalCampaigns: number;
|
|
3028
3121
|
draftCampaigns: number;
|
|
3029
3122
|
totalSent: number;
|
|
3123
|
+
totalOpened?: number;
|
|
3124
|
+
totalClicked?: number;
|
|
3030
3125
|
}; //#endregion
|
|
3031
3126
|
//#region src/update/types.d.ts
|
|
3032
|
-
type UpdateType = 'deal' | 'event' | 'news';
|
|
3127
|
+
type UpdateType = 'deal' | 'event' | 'news' | 'article';
|
|
3033
3128
|
type UpdateStatus = 'draft' | 'published' | 'archived';
|
|
3034
3129
|
type UpdateRelation = 'team';
|
|
3035
3130
|
type Update = {
|
|
@@ -3065,6 +3160,7 @@ type UpdateStats = {
|
|
|
3065
3160
|
dealsCount: number;
|
|
3066
3161
|
eventsCount: number;
|
|
3067
3162
|
newsCount: number;
|
|
3163
|
+
articlesCount: number;
|
|
3068
3164
|
publishedCount: number;
|
|
3069
3165
|
draftCount: number;
|
|
3070
3166
|
archivedCount: number;
|
|
@@ -3865,6 +3961,10 @@ declare class ContactsResource {
|
|
|
3865
3961
|
deleteActivity(id: string, activityId: string): Promise<IAppResponse<void>>;
|
|
3866
3962
|
send(id: string, message: string, subject?: string, integration?: IntegrationType | 'preferred'): Promise<IAppResponse<void>>;
|
|
3867
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>>;
|
|
3868
3968
|
}
|
|
3869
3969
|
//#endregion
|
|
3870
3970
|
//#region src/resources/contracts.d.ts
|
|
@@ -4247,6 +4347,19 @@ declare class MediaResource {
|
|
|
4247
4347
|
download(team: string, mediaId: string, name: string, mime: string): Promise<File>;
|
|
4248
4348
|
}
|
|
4249
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
|
|
4250
4363
|
//#region src/resources/meetings.d.ts
|
|
4251
4364
|
declare class MeetingsResource {
|
|
4252
4365
|
private readonly http;
|
|
@@ -4361,6 +4474,7 @@ declare class OrdersResource {
|
|
|
4361
4474
|
get(id: string, accessToken?: string): Promise<IAppResponse<Order>>;
|
|
4362
4475
|
create(data: {
|
|
4363
4476
|
contactId?: string;
|
|
4477
|
+
invoiceContactId?: string;
|
|
4364
4478
|
notes?: string;
|
|
4365
4479
|
team: string;
|
|
4366
4480
|
fresh?: boolean;
|
|
@@ -4370,6 +4484,8 @@ declare class OrdersResource {
|
|
|
4370
4484
|
priceMode?: string;
|
|
4371
4485
|
type?: OrderType;
|
|
4372
4486
|
sendConfirmation?: boolean;
|
|
4487
|
+
invoiceDate?: string;
|
|
4488
|
+
serviceDate?: string;
|
|
4373
4489
|
items?: {
|
|
4374
4490
|
id?: string;
|
|
4375
4491
|
type: 'product' | 'service' | 'coupon' | 'custom';
|
|
@@ -4396,7 +4512,9 @@ declare class OrdersResource {
|
|
|
4396
4512
|
update(id: string, data: {
|
|
4397
4513
|
status?: OrderStatus;
|
|
4398
4514
|
date?: string;
|
|
4515
|
+
serviceDate?: string;
|
|
4399
4516
|
type?: OrderType;
|
|
4517
|
+
invoiceContactId?: string | null;
|
|
4400
4518
|
}): Promise<IAppResponse<Order>>;
|
|
4401
4519
|
convertToOrder(id: string): Promise<IAppResponse<Order>>;
|
|
4402
4520
|
delete(id: string): Promise<IAppResponse<void>>;
|
|
@@ -4601,13 +4719,25 @@ declare class SitesResource {
|
|
|
4601
4719
|
constructor(http: IHttpService);
|
|
4602
4720
|
brands(): Promise<IAppResponse<SiteBrand[]>>;
|
|
4603
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>>;
|
|
4604
4730
|
resolve(teamSlug: string, brandSlug?: string): Promise<IAppResponse<Site>>;
|
|
4605
4731
|
resolveByDomain(domain: string): Promise<IAppResponse<Site>>;
|
|
4606
4732
|
update(siteId: number, data: {
|
|
4607
4733
|
customDomain?: string | null;
|
|
4608
4734
|
enabled?: boolean;
|
|
4609
4735
|
modules?: string[];
|
|
4610
|
-
|
|
4736
|
+
contactId?: string | null;
|
|
4737
|
+
metricsSource?: string | null;
|
|
4738
|
+
metricsResource?: string | null;
|
|
4739
|
+
monthlyReport?: boolean;
|
|
4740
|
+
}): Promise<IAppResponse<Site>>;
|
|
4611
4741
|
}
|
|
4612
4742
|
//#endregion
|
|
4613
4743
|
//#region src/resources/skills.d.ts
|
|
@@ -4832,12 +4962,28 @@ declare class CampaignsResource {
|
|
|
4832
4962
|
archived?: boolean;
|
|
4833
4963
|
}): Promise<IAppResponse<Campaign[]>>;
|
|
4834
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
|
+
}>>;
|
|
4835
4975
|
previewAudience(payload: CampaignAudiencePreviewPayload): Promise<IAppResponse<CampaignAudiencePreview>>;
|
|
4836
4976
|
create(payload: CampaignCreatePayload): Promise<IAppResponse<Campaign>>;
|
|
4837
4977
|
update(id: string, payload: CampaignUpdatePayload): Promise<IAppResponse<Campaign>>;
|
|
4838
4978
|
submitForApproval(id: string): Promise<IAppResponse<Campaign>>;
|
|
4839
4979
|
refreshApproval(id: string): Promise<IAppResponse<Campaign>>;
|
|
4840
|
-
send(id: string
|
|
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>>;
|
|
4841
4987
|
cancel(id: string): Promise<IAppResponse<Campaign>>;
|
|
4842
4988
|
archive(id: string): Promise<IAppResponse<Campaign>>;
|
|
4843
4989
|
unarchive(id: string): Promise<IAppResponse<Campaign>>;
|
|
@@ -4853,7 +4999,10 @@ declare class SegmentsResource {
|
|
|
4853
4999
|
update(id: string, payload: SegmentCreatePayload): Promise<IAppResponse<Segment>>;
|
|
4854
5000
|
delete(id: string): Promise<IAppResponse<void>>;
|
|
4855
5001
|
count(payload: SegmentCountPayload): Promise<IAppResponse<SegmentCountResult>>;
|
|
4856
|
-
contacts(id: string
|
|
5002
|
+
contacts(id: string, params?: {
|
|
5003
|
+
page?: number;
|
|
5004
|
+
perPage?: number;
|
|
5005
|
+
}): Promise<IAppResponse<Contact[]>>;
|
|
4857
5006
|
}
|
|
4858
5007
|
//#endregion
|
|
4859
5008
|
//#region src/resources/updates.d.ts
|
|
@@ -4867,6 +5016,7 @@ declare class UpdatesResource {
|
|
|
4867
5016
|
active?: boolean;
|
|
4868
5017
|
tags?: string;
|
|
4869
5018
|
with?: UpdateRelation[];
|
|
5019
|
+
sort?: string;
|
|
4870
5020
|
}): Promise<IAppResponse<Update[]>>;
|
|
4871
5021
|
create(payload: UpdateCreatePayload): Promise<IAppResponse<Update>>;
|
|
4872
5022
|
update(id: string, payload: UpdateUpdatePayload): Promise<IAppResponse<Update>>;
|
|
@@ -5143,6 +5293,7 @@ declare class JoAiClient {
|
|
|
5143
5293
|
readonly loyalty: LoyaltyResource;
|
|
5144
5294
|
readonly store: StoreResource;
|
|
5145
5295
|
readonly media: MediaResource;
|
|
5296
|
+
readonly metrics: MetricsResource;
|
|
5146
5297
|
readonly meetings: MeetingsResource;
|
|
5147
5298
|
readonly memories: MemoriesResource;
|
|
5148
5299
|
readonly messages: MessagesResource;
|
|
@@ -5195,12 +5346,17 @@ declare class CachedHttpService implements IHttpService {
|
|
|
5195
5346
|
private ttlMap;
|
|
5196
5347
|
private defaultTtl;
|
|
5197
5348
|
private cacheVersion;
|
|
5198
|
-
onNetworkError: (error: Error) => void;
|
|
5199
|
-
onUnauthorized: (response: IAppResponse<JsonValue>) => void;
|
|
5200
|
-
onSuccessfulResponse: (response: IAppResponse<JsonValue>) => void;
|
|
5201
|
-
onMaintenanceMode: (response: IAppResponse<JsonValue>) => void;
|
|
5202
|
-
onTooManyRequests: (response: IAppResponse<JsonValue>) => void;
|
|
5203
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);
|
|
5204
5360
|
clearCache(): void;
|
|
5205
5361
|
get<T>(url: string, options?: IRequestOptions): Promise<IAppResponse<T>>;
|
|
5206
5362
|
post<T>(url: string, data?: JsonValue | FormData, options?: IRequestOptions): Promise<IAppResponse<T>>;
|
|
@@ -5245,4 +5401,4 @@ declare class DistributionResource {
|
|
|
5245
5401
|
private fetchDistribution;
|
|
5246
5402
|
}
|
|
5247
5403
|
//#endregion
|
|
5248
|
-
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
|
@@ -1127,6 +1127,18 @@ var ContactsResource = class {
|
|
|
1127
1127
|
value
|
|
1128
1128
|
});
|
|
1129
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
|
+
}
|
|
1130
1142
|
};
|
|
1131
1143
|
//#endregion
|
|
1132
1144
|
//#region src/resources/contracts.ts
|
|
@@ -1722,6 +1734,17 @@ var MediaResource = class {
|
|
|
1722
1734
|
}
|
|
1723
1735
|
};
|
|
1724
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
|
|
1725
1748
|
//#region src/resources/meetings.ts
|
|
1726
1749
|
var MeetingsResource = class {
|
|
1727
1750
|
constructor(http, config) {
|
|
@@ -2152,6 +2175,16 @@ var SitesResource = class {
|
|
|
2152
2175
|
listMine(teamSlug) {
|
|
2153
2176
|
return this.http.get(`sites/mine?team=${encodeURIComponent(teamSlug)}`);
|
|
2154
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
|
+
}
|
|
2155
2188
|
resolve(teamSlug, brandSlug) {
|
|
2156
2189
|
const query = brandSlug ? `team=${encodeURIComponent(teamSlug)}&brand=${encodeURIComponent(brandSlug)}` : `team=${encodeURIComponent(teamSlug)}`;
|
|
2157
2190
|
return this.http.get(`sites/resolve?${query}`);
|
|
@@ -2509,6 +2542,17 @@ var CampaignsResource = class {
|
|
|
2509
2542
|
get(id) {
|
|
2510
2543
|
return this.http.get(`campaigns/${id}`);
|
|
2511
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
|
+
}
|
|
2512
2556
|
previewAudience(payload) {
|
|
2513
2557
|
return this.http.get(`campaigns/audience-preview${audiencePreviewQuery(payload)}`);
|
|
2514
2558
|
}
|
|
@@ -2524,8 +2568,14 @@ var CampaignsResource = class {
|
|
|
2524
2568
|
refreshApproval(id) {
|
|
2525
2569
|
return this.http.post(`campaigns/${id}/refresh`);
|
|
2526
2570
|
}
|
|
2527
|
-
send(id) {
|
|
2528
|
-
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`);
|
|
2529
2579
|
}
|
|
2530
2580
|
cancel(id) {
|
|
2531
2581
|
return this.http.post(`campaigns/${id}/cancel`);
|
|
@@ -2573,8 +2623,12 @@ var SegmentsResource = class {
|
|
|
2573
2623
|
count(payload) {
|
|
2574
2624
|
return this.http.post("segments/count", payload);
|
|
2575
2625
|
}
|
|
2576
|
-
contacts(id) {
|
|
2577
|
-
|
|
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}` : ""}`);
|
|
2578
2632
|
}
|
|
2579
2633
|
};
|
|
2580
2634
|
//#endregion
|
|
@@ -2591,6 +2645,7 @@ var UpdatesResource = class {
|
|
|
2591
2645
|
if (params?.active != null) query.set("active", String(params.active));
|
|
2592
2646
|
if (params?.tags) query.set("tags", params.tags);
|
|
2593
2647
|
if (params?.with?.length) query.set("with", params.with.join(","));
|
|
2648
|
+
if (params?.sort) query.set("sort", params.sort);
|
|
2594
2649
|
const qs = query.toString();
|
|
2595
2650
|
return this.http.get(`updates${qs ? "?" + qs : ""}`);
|
|
2596
2651
|
}
|
|
@@ -2979,11 +3034,6 @@ var CachedHttpService = class {
|
|
|
2979
3034
|
this.inner = inner;
|
|
2980
3035
|
this.cache = new MemoryCache();
|
|
2981
3036
|
this.cacheVersion = 0;
|
|
2982
|
-
this.onNetworkError = () => {};
|
|
2983
|
-
this.onUnauthorized = () => {};
|
|
2984
|
-
this.onSuccessfulResponse = () => {};
|
|
2985
|
-
this.onMaintenanceMode = () => {};
|
|
2986
|
-
this.onTooManyRequests = () => {};
|
|
2987
3037
|
this.baseUrl = inner.baseUrl;
|
|
2988
3038
|
this.authToken = inner.authToken;
|
|
2989
3039
|
this.ttlMap = {
|
|
@@ -2992,6 +3042,36 @@ var CachedHttpService = class {
|
|
|
2992
3042
|
};
|
|
2993
3043
|
this.defaultTtl = defaultTtl ?? DEFAULT_TTL;
|
|
2994
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
|
+
}
|
|
2995
3075
|
clearCache() {
|
|
2996
3076
|
this.cacheVersion++;
|
|
2997
3077
|
this.cache.clear();
|
|
@@ -3086,6 +3166,7 @@ var JoAiClient = class {
|
|
|
3086
3166
|
this.loyalty = new LoyaltyResource(this.http);
|
|
3087
3167
|
this.store = new StoreResource(this.http);
|
|
3088
3168
|
this.media = new MediaResource(this.http);
|
|
3169
|
+
this.metrics = new MetricsResource(this.http);
|
|
3089
3170
|
this.meetings = new MeetingsResource(this.http, config);
|
|
3090
3171
|
this.memories = new MemoriesResource(this.http);
|
|
3091
3172
|
this.messages = new MessagesResource(this.http);
|
|
@@ -3229,4 +3310,4 @@ var DistributionResource = class {
|
|
|
3229
3310
|
}
|
|
3230
3311
|
};
|
|
3231
3312
|
//#endregion
|
|
3232
|
-
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
|
+
"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": "^4.
|
|
41
|
+
"@joai/core": "^4.11.0",
|
|
42
42
|
"tsdown": "^0.21.0",
|
|
43
43
|
"typescript": "^5.9.3"
|
|
44
44
|
}
|