@joai/sdk 6.0.0 → 7.0.1

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
@@ -1,5 +1,5 @@
1
1
  import * as _$_joai_core0 from "@joai/core";
2
- import { Address, AddressCreatePayload, AddressInput, AddressType, AddressUpdatePayload, Affiliate, AffiliateTier, Agent, AgentActionHistoryEntry, AgentPrivate, AgentSettings, AiCostsResponse, Alert, ApiToken, AppEnv, AppIngestion, AppendKvEntryResult, AppointmentAvailability, AppointmentBooking, AppointmentPolicy, AppointmentRequest, Artifact, ArtifactCreatePayload, ArtifactDeliverPayload, ArtifactDelivery, ArtifactStatus, ArtifactType, ArtifactUpdatePayload, AuthUser, AuthUser as AuthUser$1, Automation, AutomationActionInput, AutomationAudiencePreview, AutomationCreatePayload, AutomationEnrollment, AutomationStats, AutomationUpdatePayload, Blueprint, BlueprintSettings, BrandBackend, BrandSiteConfig, BrandSourceConfig, CalendarStatus, Campaign, CampaignAudiencePreview, CampaignAudiencePreviewPayload, CampaignCreatePayload, CampaignRecipient, CampaignRecipientStatus, CampaignStats, CampaignUpdatePayload, Card, Cart, Cart as Cart$1, ChangelogEntry, Character, CheckoutSnapshot, CheckoutSnapshot as CheckoutSnapshot$1, CheckoutSnapshotRequest, CommissionAgreement, Configuration, Contact, ContactActivity, ContactCreatePayload, ContactFormData, ContactRelation, ContactRelationPayload, ContactRelationUpdatePayload, Content, ContentVersion, Contract, ContractCategoryName, ContractVersion, Coupon, CouponCondition, CouponRestrictedItem, CreateContentInput, CreateHookPayload, CreateHookPayload as CreateHookPayload$1, CreateInboundHookPayload, CreateInternalHookPayload, CreateKvFieldPayload, CreateWarpLinkedHookPayload, CreateWebHookPayload, Document, EarnResponse, Element, ElementSpec, ElementVariation, EmbedStatus, Entity, Flow, Fulfillment, FulfillmentLocation, FulfillmentLocation as FulfillmentLocation$1, FulfillmentMethod, GamificationData, Goal, GoalCreatePayload, GuestBuyer, GuestBuyer as GuestBuyer$1, Hook, Hook as Hook$1, HookSample, HookSample as HookSample$1, HookTrigger, HookTriggerCondition, HookTriggerInput, IAppResponse, IHttpService, IRequestOptions, Inquiry, InquiryType, Integration, IntegrationType, Intent, Item, ItemCreatePayload, ItemUpdatePayload, JsonValue, KvEntryPayload, KvField, KvFieldWithEntries, Link, LinkCreatePayload, LinkStats, LinkUpdatePayload, LinkVariation, LinkVariationBatchCreatePayload, LinkVariationCreatePayload, LoyaltyAccount, LoyaltyMember, LoyaltyProgram, LoyaltyPromotion, LoyaltyReward, LoyaltyTier, LoyaltyTransaction, McpToolCall, Media, MediaAspectRatio, Meeting, MeetingJoinInfo, MeetingSpeakerAssignment, MeetingSummary, Memory, Message, MetricSource, MetricsResult, Mission, MissionCreatePayload, Notification, NotificationChannel, NotificationSetting, OfficeSnapshot, Order, Order as Order$1, OrderContext, OrderPriceMode, OrderPriceMode as OrderPriceMode$1, OrderStatus, OrderStatus as OrderStatus$1, OrderType, PaginatedResponse, Pass, PatchContentInput, PaymentAccount, PaymentAccountOnboarding, PaymentProvider, Plan, PlanFeature, Product, Product as Product$1, ProductRelation, ProductVariation, ProgramSettings, Project, ProjectExportResponse, ProjectInputAssistIntent, ProjectInputAssistResponse, ProjectMutation, ProjectOutputPreset, ProjectOutputType, ProjectStudioHistoryEntry, Proposal, ProposalAction, ProposalPollOption, PublicFormResults, PurchaseResult, RampProviderInfo, Reactions, RedeemResponse, Reminder, Return, ReturnStatus, Room, RoomKind, Segment, SegmentCountPayload, SegmentCountResult, SegmentCreatePayload, Service, SetKvEntryResult, ShippingRate, ShippingRate as ShippingRate$1, ShippingZone, Shortcut, Site, SiteBrand, SiteType, Skill, SkillScopeValue, SocialAuthProvider, SocialBot, SocialPlatform, SocialPost, SocialPostConnection, SocialPostCreatePayload, SocialPostPlatform, SocialPostStatus, SocialPostUpdatePayload, StampResponse, StoreAgent, StoreData, StorePriceTier, StorePurchaseResult, Subscription, Swarm, Tag, TagType, Task, Team, TeamAccessConfig, TeamCategory, TeamEarning, TeamEarningsBalance, TeamFeature, TeamFeatureUsage, TeamMember, TeamMeta, TeamPayout, TeamPayoutAddress, TeamPrivate, TeamUsage, TerminalConnectionToken, TerminalPaymentIntent, ToggleKvFieldResult, TranslatableValue, Update, UpdateCreatePayload, UpdateRelation, UpdateStats, UpdateType, UpdateUpdatePayload, Upgrade, UpgradeStatus, UserPrivate, UserRole, UserSettings, VolumePrice, WarpBackend, WarpBackendStatus, WarpExecutionBackend, WebHookTriggerEvent, WorkspaceCloudFile, WorkspaceInfo, XIntegrationStatus } from "@joai/core";
2
+ import { Address, AddressCreatePayload, AddressInput, AddressType, AddressUpdatePayload, Affiliate, AffiliateTier, Agent, AgentActionHistoryEntry, AgentPrivate, AgentSettings, AgentTrustedActionRule, AiCostsResponse, Alert, ApiToken, AppEnv, AppIngestion, AppendKvEntryResult, AppointmentAvailability, AppointmentBooking, AppointmentPolicy, AppointmentRequest, Artifact, ArtifactCreatePayload, ArtifactDeliverPayload, ArtifactDelivery, ArtifactStatus, ArtifactType, ArtifactUpdatePayload, AuthUser, AuthUser as AuthUser$1, Automation, AutomationActionInput, AutomationAudiencePreview, AutomationCreatePayload, AutomationEnrollment, AutomationStats, AutomationUpdatePayload, Blueprint, BlueprintSettings, BrandBackend, BrandSiteConfig, BrandSourceConfig, CalendarStatus, Campaign, CampaignAudiencePreview, CampaignAudiencePreviewPayload, CampaignCreatePayload, CampaignRecipient, CampaignRecipientStatus, CampaignStats, CampaignUpdatePayload, Card, Cart, Cart as Cart$1, ChangelogEntry, Character, CheckoutSnapshot, CheckoutSnapshot as CheckoutSnapshot$1, CheckoutSnapshotRequest, CommissionAgreement, Configuration, Contact, ContactActivity, ContactCreatePayload, ContactFormData, ContactRelation, ContactRelationPayload, ContactRelationUpdatePayload, Content, ContentVersion, Contract, ContractCategoryName, ContractVersion, Coupon, CouponCondition, CouponRestrictedItem, CreateContentInput, CreateHookPayload, CreateHookPayload as CreateHookPayload$1, CreateInboundHookPayload, CreateInternalHookPayload, CreateKvFieldPayload, CreateWarpLinkedHookPayload, CreateWebHookPayload, Document, EarnResponse, Element, ElementSpec, ElementVariation, EmbedStatus, Entity, Flow, Fulfillment, FulfillmentLocation, FulfillmentLocation as FulfillmentLocation$1, FulfillmentMethod, GamificationData, Goal, GoalCreatePayload, GuestBuyer, GuestBuyer as GuestBuyer$1, Hook, Hook as Hook$1, HookSample, HookSample as HookSample$1, HookTrigger, HookTriggerCondition, HookTriggerInput, IAppResponse, IHttpService, IRequestOptions, Inquiry, InquiryType, Integration, IntegrationType, Intent, Item, ItemCreatePayload, ItemUpdatePayload, JsonValue, KvEntryPayload, KvField, KvFieldWithEntries, Link, LinkCreatePayload, LinkStats, LinkUpdatePayload, LinkVariation, LinkVariationBatchCreatePayload, LinkVariationCreatePayload, LoyaltyAccount, LoyaltyMember, LoyaltyProgram, LoyaltyPromotion, LoyaltyReward, LoyaltyTier, LoyaltyTransaction, McpToolCall, Media, MediaAspectRatio, Meeting, MeetingJoinInfo, MeetingSpeakerAssignment, MeetingSummary, Memory, Message, MetricSource, MetricsResult, Mission, MissionCreatePayload, Notification, NotificationChannel, NotificationSetting, OfficeSnapshot, Order, Order as Order$1, OrderContext, OrderPriceMode, OrderPriceMode as OrderPriceMode$1, OrderStatus, OrderStatus as OrderStatus$1, OrderType, PaginatedResponse, Pass, PatchContentInput, PaymentAccount, PaymentAccountOnboarding, PaymentProvider, Plan, PlanFeature, Product, Product as Product$1, ProductRelation, ProductVariation, ProgramSettings, Project, ProjectExportResponse, ProjectInputAssistIntent, ProjectInputAssistResponse, ProjectMutation, ProjectOutputPreset, ProjectOutputType, ProjectStudioHistoryEntry, Proposal, ProposalAction, ProposalPollOption, PublicFormResults, PurchaseResult, RampProviderInfo, Reactions, RedeemResponse, Reminder, Return, ReturnStatus, Room, RoomKind, Segment, SegmentCountPayload, SegmentCountResult, SegmentCreatePayload, Service, SetKvEntryResult, ShippingRate, ShippingRate as ShippingRate$1, ShippingZone, Shortcut, Site, SiteBrand, SiteType, Skill, SkillScopeValue, SocialAuthProvider, SocialBot, SocialPlatform, SocialPost, SocialPostConnection, SocialPostCreatePayload, SocialPostGenerateCaptionPayload, SocialPostGeneratedCaption, SocialPostPlatform, SocialPostStatus, SocialPostUpdatePayload, StampResponse, StoreAgent, StoreData, StorePriceTier, StorePurchaseResult, Subscription, Swarm, Tag, TagType, Task, Team, TeamAccessConfig, TeamCategory, TeamEarning, TeamEarningsBalance, TeamFeature, TeamFeatureUsage, TeamMember, TeamMeta, TeamOrderStats, TeamPayout, TeamPayoutAddress, TeamPrivate, TeamUsage, TerminalConnectionToken, TerminalPaymentIntent, ToggleKvFieldResult, TranslatableValue, Update, UpdateCreatePayload, UpdateRelation, UpdateStats, UpdateType, UpdateUpdatePayload, Upgrade, UpgradeStatus, UserPrivate, UserRole, UserSettings, VolumePrice, WarpBackend, WarpBackendStatus, WarpExecutionBackend, WebHookTriggerEvent, WorkspaceCloudFile, WorkspaceInfo, XIntegrationStatus } from "@joai/core";
3
3
  import { WarpChainName, WarpClient, WarpLocale, WarpText, WarpWalletProvider } from "@joai/warps";
4
4
 
5
5
  //#region src/resources/agents.d.ts
@@ -43,6 +43,12 @@ declare class AgentsResource {
43
43
  error?: string;
44
44
  meta?: Record<string, any>;
45
45
  }): Promise<_$_joai_core0.IAppResponse<unknown>>;
46
+ listTrustedActions(uuid: string): Promise<_$_joai_core0.IAppResponse<{
47
+ rules: AgentTrustedActionRule[];
48
+ }>>;
49
+ removeTrustedAction(uuid: string, ruleId: string): Promise<_$_joai_core0.IAppResponse<{
50
+ rules: AgentTrustedActionRule[];
51
+ }>>;
46
52
  }
47
53
  //#endregion
48
54
  //#region src/address/addresses.d.ts
@@ -72,6 +78,18 @@ type PlaceCheckoutOrderRequest = CheckoutSnapshotRequest & {
72
78
  declare class CheckoutResource {
73
79
  private readonly http;
74
80
  constructor(http: IHttpService);
81
+ validateCoupon(team: string, data: {
82
+ couponCode: string;
83
+ items: {
84
+ id: string;
85
+ type: 'product' | 'service' | 'coupon';
86
+ quantity: number;
87
+ }[];
88
+ }): Promise<_$_joai_core0.IAppResponse<{
89
+ code: string;
90
+ discount: number;
91
+ eligibleSubtotal: number;
92
+ }>>;
75
93
  snapshot(team: string, data: CheckoutSnapshotRequest): Promise<_$_joai_core0.IAppResponse<_$_joai_core0.CheckoutSnapshot>>;
76
94
  placeOrder(team: string, data: PlaceCheckoutOrderRequest): Promise<_$_joai_core0.IAppResponse<Order$1>>;
77
95
  locations(team: string): Promise<_$_joai_core0.IAppResponse<FulfillmentLocation$1[]>>;
@@ -182,6 +200,7 @@ type GuestCheckoutDraft<TCart = unknown> = {
182
200
  fulfillmentMethod: FulfillmentMethod;
183
201
  shippingRateId: number | null;
184
202
  fulfillmentLocationId: number | null;
203
+ couponCode?: string | null;
185
204
  };
186
205
  type GuestCommerceStorageOptions = {
187
206
  namespace: string;
@@ -476,6 +495,7 @@ declare class AppointmentsResource {
476
495
  timezone?: string;
477
496
  attendeeEmail?: string;
478
497
  attendeeName?: string;
498
+ contactIds?: string[];
479
499
  attendees?: {
480
500
  email: string;
481
501
  name?: string;
@@ -597,7 +617,11 @@ declare class BillingResource {
597
617
  constructor(http: IHttpService);
598
618
  plans(type?: 'current' | 'all'): Promise<_$_joai_core0.IAppResponse<Plan[]>>;
599
619
  checkoutProduct(id: string): Promise<_$_joai_core0.IAppResponse<Product$1>>;
600
- orders(team: TeamPrivate | null, page?: number, contactId?: string): Promise<_$_joai_core0.IAppResponse<Order$1[]>>;
620
+ orders(team: TeamPrivate | null, page?: number, filters?: {
621
+ contactId?: string;
622
+ couponId?: string;
623
+ }): Promise<_$_joai_core0.IAppResponse<Order$1[]>>;
624
+ orderStats(team: string): Promise<_$_joai_core0.IAppResponse<TeamOrderStats>>;
601
625
  payOrder(id: string, provider?: PaymentProvider, accessToken?: string): Promise<_$_joai_core0.IAppResponse<{
602
626
  url: string;
603
627
  }>>;
@@ -668,7 +692,7 @@ declare class CartsResource {
668
692
  remove(type: 'product' | 'service' | 'coupon', id: string): Promise<_$_joai_core0.IAppResponse<Cart$1>>;
669
693
  updateQuantity(type: 'product' | 'service' | 'coupon', id: string, quantity: number): Promise<_$_joai_core0.IAppResponse<Cart$1>>;
670
694
  clear(): Promise<_$_joai_core0.IAppResponse<Cart$1>>;
671
- applyCoupon(code: string): Promise<_$_joai_core0.IAppResponse<void>>;
695
+ applyCoupon(code: string, team?: string): Promise<_$_joai_core0.IAppResponse<void>>;
672
696
  removeCoupon(): Promise<_$_joai_core0.IAppResponse<void>>;
673
697
  }
674
698
  //#endregion
@@ -1301,7 +1325,7 @@ declare class OrdersResource {
1301
1325
  pay(id: string, provider?: PaymentProvider, accessToken?: string): Promise<_$_joai_core0.IAppResponse<{
1302
1326
  url: string;
1303
1327
  }>>;
1304
- notify(id: string, type?: string, agentId?: string): Promise<_$_joai_core0.IAppResponse<{
1328
+ notify(id: string, type: string | undefined, agentId: string): Promise<_$_joai_core0.IAppResponse<{
1305
1329
  message: string;
1306
1330
  }>>;
1307
1331
  }
@@ -1826,10 +1850,12 @@ declare class UpdatesResource {
1826
1850
  tags?: string;
1827
1851
  with?: UpdateRelation[];
1828
1852
  sort?: string;
1829
- limit?: number;
1853
+ page?: number;
1854
+ perPage?: number;
1830
1855
  upcoming?: boolean;
1831
1856
  past?: boolean;
1832
1857
  }): Promise<_$_joai_core0.IAppResponse<Update[]>>;
1858
+ get(id: string): Promise<_$_joai_core0.IAppResponse<Update>>;
1833
1859
  create(payload: UpdateCreatePayload): Promise<_$_joai_core0.IAppResponse<Update>>;
1834
1860
  update(id: string, payload: UpdateUpdatePayload): Promise<_$_joai_core0.IAppResponse<Update>>;
1835
1861
  delete(id: string): Promise<_$_joai_core0.IAppResponse<void>>;
@@ -1841,6 +1867,7 @@ declare class SocialPostsResource {
1841
1867
  private readonly http;
1842
1868
  constructor(http: IHttpService);
1843
1869
  connections(): Promise<_$_joai_core0.IAppResponse<SocialPostConnection[]>>;
1870
+ generateCaption(payload: SocialPostGenerateCaptionPayload): Promise<_$_joai_core0.IAppResponse<SocialPostGeneratedCaption>>;
1844
1871
  list(params?: {
1845
1872
  status?: SocialPostStatus;
1846
1873
  platform?: SocialPostPlatform;
package/dist/index.mjs CHANGED
@@ -88,6 +88,12 @@ var AgentsResource = class {
88
88
  result
89
89
  });
90
90
  }
91
+ listTrustedActions(uuid) {
92
+ return this.http.get(`agents/${uuid}/trusted-actions`);
93
+ }
94
+ removeTrustedAction(uuid, ruleId) {
95
+ return this.http.delete(`agents/${uuid}/trusted-actions/${encodeURIComponent(ruleId)}`);
96
+ }
91
97
  };
92
98
  //#endregion
93
99
  //#region src/address/addresses.ts
@@ -131,6 +137,9 @@ var CheckoutResource = class {
131
137
  constructor(http) {
132
138
  this.http = http;
133
139
  }
140
+ validateCoupon(team, data) {
141
+ return this.http.post(`shops/${encodeURIComponent(team)}/checkout/coupon`, data);
142
+ }
134
143
  snapshot(team, data) {
135
144
  return this.http.post(`shops/${encodeURIComponent(team)}/checkout/snapshots`, data);
136
145
  }
@@ -380,13 +389,15 @@ const createEmptyGuestCheckoutState = (options = {}) => ({
380
389
  phone: ""
381
390
  },
382
391
  shippingRateId: null,
383
- fulfillmentLocationId: null
392
+ fulfillmentLocationId: null,
393
+ couponCode: null
384
394
  });
385
395
  const toGuestCheckoutDraft = (state) => ({
386
396
  cart: state.cart,
387
397
  fulfillmentMethod: state.fulfillmentMethod,
388
398
  shippingRateId: state.shippingRateId,
389
- fulfillmentLocationId: state.fulfillmentLocationId
399
+ fulfillmentLocationId: state.fulfillmentLocationId,
400
+ couponCode: state.couponCode ?? null
390
401
  });
391
402
  const assertGuestCheckoutReady = (state, pickupLocationIds = []) => {
392
403
  if (!state.cart.length) throw new GuestCheckoutError("empty_cart");
@@ -425,13 +436,15 @@ const buildGuestCheckoutSnapshotRequest = (state, options = {}) => {
425
436
  ...address,
426
437
  type: "shipping"
427
438
  },
428
- shippingRateId: rate.id
439
+ shippingRateId: rate.id,
440
+ couponCode: state.couponCode?.trim() || void 0
429
441
  };
430
442
  }
431
443
  return {
432
444
  fulfillmentMethod: "pickup",
433
445
  items,
434
- fulfillmentLocationId: state.fulfillmentLocationId || options.pickupLocationIds?.[0] || null
446
+ fulfillmentLocationId: state.fulfillmentLocationId || options.pickupLocationIds?.[0] || null,
447
+ couponCode: state.couponCode?.trim() || void 0
435
448
  };
436
449
  };
437
450
  async function createGuestCheckoutSnapshot(options) {
@@ -896,10 +909,14 @@ var BillingResource = class {
896
909
  checkoutProduct(id) {
897
910
  return this.http.get(`products/${id}`);
898
911
  }
899
- orders(team, page = 1, contactId) {
912
+ orders(team, page = 1, filters = {}) {
900
913
  let params = `orders?page=${page}`;
901
- if (contactId) params += `&contactId=${encodeURIComponent(contactId)}`;
902
- return this.http.get(params);
914
+ if (filters.contactId) params += `&contactId=${encodeURIComponent(filters.contactId)}`;
915
+ if (filters.couponId) params += `&couponId=${encodeURIComponent(filters.couponId)}`;
916
+ return this.http.get(params, team ? { headers: { "X-Team": team.slug } } : void 0);
917
+ }
918
+ orderStats(team) {
919
+ return this.http.get(`orders/stats?team=${encodeURIComponent(team)}`, { headers: { "X-Team": team } });
903
920
  }
904
921
  payOrder(id, provider, accessToken) {
905
922
  return this.http.post(`orders/${id}/pay`, provider ? { provider } : {}, orderAccessHeaders$1(accessToken));
@@ -1044,8 +1061,11 @@ var CartsResource = class {
1044
1061
  clear() {
1045
1062
  return this.http.post("cart/clear");
1046
1063
  }
1047
- applyCoupon(code) {
1048
- return this.http.post("cart/coupon", { code });
1064
+ applyCoupon(code, team) {
1065
+ return this.http.post("cart/coupon", {
1066
+ code,
1067
+ ...team ? { team } : {}
1068
+ });
1049
1069
  }
1050
1070
  removeCoupon() {
1051
1071
  return this.http.post("cart/coupon/remove");
@@ -1954,7 +1974,7 @@ var OrdersResource = class {
1954
1974
  notify(id, type = "confirmation", agentId) {
1955
1975
  return this.http.post(`orders/${id}/notify`, {
1956
1976
  type,
1957
- ...agentId ? { agentId } : {}
1977
+ agentId
1958
1978
  });
1959
1979
  }
1960
1980
  };
@@ -2708,12 +2728,16 @@ var UpdatesResource = class {
2708
2728
  if (params?.tags) query.set("tags", params.tags);
2709
2729
  if (params?.with?.length) query.set("with", params.with.join(","));
2710
2730
  if (params?.sort) query.set("sort", params.sort);
2711
- if (params?.limit != null) query.set("limit", String(params.limit));
2731
+ if (params?.page != null) query.set("page", String(params.page));
2732
+ if (params?.perPage != null) query.set("perPage", String(params.perPage));
2712
2733
  if (params?.upcoming) query.set("filter[upcoming]", "1");
2713
2734
  if (params?.past) query.set("filter[past]", "1");
2714
2735
  const qs = query.toString();
2715
2736
  return this.http.get(`updates${qs ? "?" + qs : ""}`);
2716
2737
  }
2738
+ get(id) {
2739
+ return this.http.get(`updates/${id}`);
2740
+ }
2717
2741
  create(payload) {
2718
2742
  return this.http.post("updates", payload);
2719
2743
  }
@@ -2736,6 +2760,9 @@ var SocialPostsResource = class {
2736
2760
  connections() {
2737
2761
  return this.http.get("social-posts/connections");
2738
2762
  }
2763
+ generateCaption(payload) {
2764
+ return this.http.post("social-posts/generate-caption", payload);
2765
+ }
2739
2766
  list(params) {
2740
2767
  const query = new URLSearchParams();
2741
2768
  if (params?.status) query.set("status", params.status);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "6.0.0",
3
+ "version": "7.0.1",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,11 +35,11 @@
35
35
  "test": "jest --config jest.config.js"
36
36
  },
37
37
  "dependencies": {
38
- "@joai/core": "^4.14.0",
38
+ "@joai/core": "^4.15.1",
39
39
  "@joai/warps": "*"
40
40
  },
41
41
  "peerDependencies": {
42
- "@joai/core": "^4.14.0"
42
+ "@joai/core": "^4.15.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "tsdown": "^0.21.0",