@joai/sdk 4.2.3 → 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 +688 -468
- package/dist/index.mjs +131 -11
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -153,13 +153,16 @@ 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 = {
|
|
160
161
|
BillingManage: "billing-manage",
|
|
161
162
|
TeamManage: "team-manage",
|
|
162
163
|
TeamView: "team-view",
|
|
164
|
+
ContentEdit: "content-edit",
|
|
165
|
+
ContentPublish: "content-publish",
|
|
163
166
|
TeamMemberInvite: "team-member-invite",
|
|
164
167
|
TeamMemberRemove: "team-member-remove",
|
|
165
168
|
TeamSecretView: "team-secret-view",
|
|
@@ -359,16 +362,16 @@ var FulfillmentsResource = class {
|
|
|
359
362
|
};
|
|
360
363
|
//#endregion
|
|
361
364
|
//#region src/commerce/returns.ts
|
|
362
|
-
const orderAccessHeaders$
|
|
365
|
+
const orderAccessHeaders$2 = (accessToken) => accessToken ? { headers: { "X-Order-Access-Token": accessToken } } : void 0;
|
|
363
366
|
var ReturnsResource = class {
|
|
364
367
|
constructor(http) {
|
|
365
368
|
this.http = http;
|
|
366
369
|
}
|
|
367
370
|
list(orderId, accessToken) {
|
|
368
|
-
return this.http.get(`orders/${orderId}/returns`, orderAccessHeaders$
|
|
371
|
+
return this.http.get(`orders/${orderId}/returns`, orderAccessHeaders$2(accessToken));
|
|
369
372
|
}
|
|
370
373
|
create(orderId, data, accessToken) {
|
|
371
|
-
return this.http.post(`orders/${orderId}/returns`, data, orderAccessHeaders$
|
|
374
|
+
return this.http.post(`orders/${orderId}/returns`, data, orderAccessHeaders$2(accessToken));
|
|
372
375
|
}
|
|
373
376
|
update(id, data) {
|
|
374
377
|
return this.http.patch(`returns/${id}`, data);
|
|
@@ -395,12 +398,24 @@ var ShippingResource = class {
|
|
|
395
398
|
createRate(team, zoneId, data) {
|
|
396
399
|
return this.http.post(`teams/${team}/shipping-zones/${zoneId}/rates`, data);
|
|
397
400
|
}
|
|
401
|
+
updateRate(team, zoneId, rateId, data) {
|
|
402
|
+
return this.http.patch(`teams/${team}/shipping-zones/${zoneId}/rates/${rateId}`, data);
|
|
403
|
+
}
|
|
404
|
+
deleteRate(team, zoneId, rateId) {
|
|
405
|
+
return this.http.delete(`teams/${team}/shipping-zones/${zoneId}/rates/${rateId}`);
|
|
406
|
+
}
|
|
398
407
|
locations(team) {
|
|
399
408
|
return this.http.get(`teams/${team}/fulfillment-locations`);
|
|
400
409
|
}
|
|
401
410
|
createLocation(team, data) {
|
|
402
411
|
return this.http.post(`teams/${team}/fulfillment-locations`, data);
|
|
403
412
|
}
|
|
413
|
+
updateLocation(team, locationId, data) {
|
|
414
|
+
return this.http.patch(`teams/${team}/fulfillment-locations/${locationId}`, data);
|
|
415
|
+
}
|
|
416
|
+
deleteLocation(team, locationId) {
|
|
417
|
+
return this.http.delete(`teams/${team}/fulfillment-locations/${locationId}`);
|
|
418
|
+
}
|
|
404
419
|
};
|
|
405
420
|
//#endregion
|
|
406
421
|
//#region src/commerce/guest.ts
|
|
@@ -776,6 +791,40 @@ var AppointmentsResource = class {
|
|
|
776
791
|
}
|
|
777
792
|
};
|
|
778
793
|
//#endregion
|
|
794
|
+
//#region src/resources/content.ts
|
|
795
|
+
var ContentResource = class {
|
|
796
|
+
constructor(http) {
|
|
797
|
+
this.http = http;
|
|
798
|
+
}
|
|
799
|
+
list(team) {
|
|
800
|
+
return this.http.get(`contents?team=${encodeURIComponent(team)}`);
|
|
801
|
+
}
|
|
802
|
+
create(input) {
|
|
803
|
+
return this.http.post("contents", input);
|
|
804
|
+
}
|
|
805
|
+
get(contentId) {
|
|
806
|
+
return this.http.get(`contents/${contentId}`);
|
|
807
|
+
}
|
|
808
|
+
patch(contentId, input) {
|
|
809
|
+
return this.http.patch(`contents/${contentId}`, input);
|
|
810
|
+
}
|
|
811
|
+
preview(contentId) {
|
|
812
|
+
return this.http.get(`contents/${contentId}/preview`);
|
|
813
|
+
}
|
|
814
|
+
publish(contentId, expectedVersion) {
|
|
815
|
+
return this.http.post(`contents/${contentId}/publish`, { expectedVersion });
|
|
816
|
+
}
|
|
817
|
+
rollback(contentId, versionId, expectedVersion) {
|
|
818
|
+
return this.http.post(`contents/${contentId}/rollback/${versionId}`, { expectedVersion });
|
|
819
|
+
}
|
|
820
|
+
versions(contentId) {
|
|
821
|
+
return this.http.get(`contents/${contentId}/versions`);
|
|
822
|
+
}
|
|
823
|
+
getPublic(slug) {
|
|
824
|
+
return this.http.get(`content/${encodeURIComponent(slug)}`);
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
//#endregion
|
|
779
828
|
//#region src/resources/auth.ts
|
|
780
829
|
var AuthResource = class {
|
|
781
830
|
constructor(http) {
|
|
@@ -820,6 +869,7 @@ var AuthResource = class {
|
|
|
820
869
|
};
|
|
821
870
|
//#endregion
|
|
822
871
|
//#region src/resources/billing.ts
|
|
872
|
+
const orderAccessHeaders$1 = (accessToken) => accessToken ? { headers: { "X-Order-Access-Token": accessToken } } : void 0;
|
|
823
873
|
var BillingResource = class {
|
|
824
874
|
constructor(http) {
|
|
825
875
|
this.http = http;
|
|
@@ -835,8 +885,8 @@ var BillingResource = class {
|
|
|
835
885
|
if (contactId) params += `&contactId=${encodeURIComponent(contactId)}`;
|
|
836
886
|
return this.http.get(params);
|
|
837
887
|
}
|
|
838
|
-
payOrder(id, provider) {
|
|
839
|
-
return this.http.post(`orders/${id}/pay`, provider ? { provider } : {});
|
|
888
|
+
payOrder(id, provider, accessToken) {
|
|
889
|
+
return this.http.post(`orders/${id}/pay`, provider ? { provider } : {}, orderAccessHeaders$1(accessToken));
|
|
840
890
|
}
|
|
841
891
|
deleteOrder(id) {
|
|
842
892
|
return this.http.delete(`orders/${id}`);
|
|
@@ -847,6 +897,9 @@ var BillingResource = class {
|
|
|
847
897
|
createPaymentAccountOnboarding(team, provider) {
|
|
848
898
|
return this.http.post(`payment-accounts/${provider}/onboarding`, void 0, { headers: { "X-Team": team } });
|
|
849
899
|
}
|
|
900
|
+
disconnectPaymentAccount(team, provider) {
|
|
901
|
+
return this.http.delete(`payment-accounts/${provider}`, { headers: { "X-Team": team } });
|
|
902
|
+
}
|
|
850
903
|
updatePaymentAccount(team, provider, input) {
|
|
851
904
|
return this.http.put(`payment-accounts/${provider}`, input, { headers: { "X-Team": team } });
|
|
852
905
|
}
|
|
@@ -1687,8 +1740,8 @@ var MeetingsResource = class {
|
|
|
1687
1740
|
join(code) {
|
|
1688
1741
|
return this.http.get(`meetings/join/${code}`);
|
|
1689
1742
|
}
|
|
1690
|
-
cancel(code) {
|
|
1691
|
-
return this.http.post(`meetings/cancel/${code}`, {});
|
|
1743
|
+
cancel(code, data) {
|
|
1744
|
+
return this.http.post(`meetings/cancel/${code}`, data ?? {});
|
|
1692
1745
|
}
|
|
1693
1746
|
share(id, recipients) {
|
|
1694
1747
|
return this.http.post(`meetings/${id}/share`, { recipients });
|
|
@@ -2404,6 +2457,43 @@ var TeamsResource = class {
|
|
|
2404
2457
|
}
|
|
2405
2458
|
};
|
|
2406
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
|
|
2407
2497
|
//#region src/resources/campaigns.ts
|
|
2408
2498
|
var CampaignsResource = class {
|
|
2409
2499
|
constructor(http) {
|
|
@@ -2412,12 +2502,16 @@ var CampaignsResource = class {
|
|
|
2412
2502
|
stats() {
|
|
2413
2503
|
return this.http.get("campaigns/stats");
|
|
2414
2504
|
}
|
|
2415
|
-
list() {
|
|
2416
|
-
|
|
2505
|
+
list(params) {
|
|
2506
|
+
const query = params?.archived ? "?archived=1" : "";
|
|
2507
|
+
return this.http.get(`campaigns${query}`);
|
|
2417
2508
|
}
|
|
2418
2509
|
get(id) {
|
|
2419
2510
|
return this.http.get(`campaigns/${id}`);
|
|
2420
2511
|
}
|
|
2512
|
+
previewAudience(payload) {
|
|
2513
|
+
return this.http.get(`campaigns/audience-preview${audiencePreviewQuery(payload)}`);
|
|
2514
|
+
}
|
|
2421
2515
|
create(payload) {
|
|
2422
2516
|
return this.http.post("campaigns", payload);
|
|
2423
2517
|
}
|
|
@@ -2433,10 +2527,31 @@ var CampaignsResource = class {
|
|
|
2433
2527
|
send(id) {
|
|
2434
2528
|
return this.http.post(`campaigns/${id}/send`);
|
|
2435
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
|
+
}
|
|
2436
2539
|
delete(id) {
|
|
2437
2540
|
return this.http.delete(`campaigns/${id}`);
|
|
2438
2541
|
}
|
|
2439
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
|
+
};
|
|
2440
2555
|
//#endregion
|
|
2441
2556
|
//#region src/resources/segments.ts
|
|
2442
2557
|
var SegmentsResource = class {
|
|
@@ -2458,6 +2573,9 @@ var SegmentsResource = class {
|
|
|
2458
2573
|
count(payload) {
|
|
2459
2574
|
return this.http.post("segments/count", payload);
|
|
2460
2575
|
}
|
|
2576
|
+
contacts(id) {
|
|
2577
|
+
return this.http.get(`segments/${id}/contacts`);
|
|
2578
|
+
}
|
|
2461
2579
|
};
|
|
2462
2580
|
//#endregion
|
|
2463
2581
|
//#region src/resources/updates.ts
|
|
@@ -2946,6 +3064,7 @@ var JoAiClient = class {
|
|
|
2946
3064
|
this.entities = new EntitiesResource(this.http);
|
|
2947
3065
|
this.mcp = new McpResource(this.http);
|
|
2948
3066
|
this.appointments = new AppointmentsResource(this.http, config);
|
|
3067
|
+
this.content = new ContentResource(this.http);
|
|
2949
3068
|
this.auth = new AuthResource(this.http);
|
|
2950
3069
|
this.billing = new BillingResource(this.http);
|
|
2951
3070
|
this.blueprints = new BlueprintsResource(this.http);
|
|
@@ -2993,6 +3112,7 @@ var JoAiClient = class {
|
|
|
2993
3112
|
this.tasks = new TasksResource(this.http);
|
|
2994
3113
|
this.tags = new TagsResource(this.http);
|
|
2995
3114
|
this.teams = new TeamsResource(this.http);
|
|
3115
|
+
this.artifacts = new ArtifactsResource(this.http);
|
|
2996
3116
|
this.campaigns = new CampaignsResource(this.http);
|
|
2997
3117
|
this.segments = new SegmentsResource(this.http);
|
|
2998
3118
|
this.updates = new UpdatesResource(this.http);
|
|
@@ -3109,4 +3229,4 @@ var DistributionResource = class {
|
|
|
3109
3229
|
}
|
|
3110
3230
|
};
|
|
3111
3231
|
//#endregion
|
|
3112
|
-
export { AddressesResource, AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, AuthResource, BillingResource, BlueprintsResource, CachedHttpService, CampaignsResource, CardsResource, CartsResource, ChangelogResource, CharactersResource, CheckoutResource, CommerceResource, ContactsResource, 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 };
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joai/sdk",
|
|
3
|
-
"version": "4.
|
|
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
|
}
|