@joai/sdk 7.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, 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, 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
@@ -78,6 +78,18 @@ type PlaceCheckoutOrderRequest = CheckoutSnapshotRequest & {
78
78
  declare class CheckoutResource {
79
79
  private readonly http;
80
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
+ }>>;
81
93
  snapshot(team: string, data: CheckoutSnapshotRequest): Promise<_$_joai_core0.IAppResponse<_$_joai_core0.CheckoutSnapshot>>;
82
94
  placeOrder(team: string, data: PlaceCheckoutOrderRequest): Promise<_$_joai_core0.IAppResponse<Order$1>>;
83
95
  locations(team: string): Promise<_$_joai_core0.IAppResponse<FulfillmentLocation$1[]>>;
@@ -605,7 +617,11 @@ declare class BillingResource {
605
617
  constructor(http: IHttpService);
606
618
  plans(type?: 'current' | 'all'): Promise<_$_joai_core0.IAppResponse<Plan[]>>;
607
619
  checkoutProduct(id: string): Promise<_$_joai_core0.IAppResponse<Product$1>>;
608
- 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>>;
609
625
  payOrder(id: string, provider?: PaymentProvider, accessToken?: string): Promise<_$_joai_core0.IAppResponse<{
610
626
  url: string;
611
627
  }>>;
@@ -676,7 +692,7 @@ declare class CartsResource {
676
692
  remove(type: 'product' | 'service' | 'coupon', id: string): Promise<_$_joai_core0.IAppResponse<Cart$1>>;
677
693
  updateQuantity(type: 'product' | 'service' | 'coupon', id: string, quantity: number): Promise<_$_joai_core0.IAppResponse<Cart$1>>;
678
694
  clear(): Promise<_$_joai_core0.IAppResponse<Cart$1>>;
679
- applyCoupon(code: string): Promise<_$_joai_core0.IAppResponse<void>>;
695
+ applyCoupon(code: string, team?: string): Promise<_$_joai_core0.IAppResponse<void>>;
680
696
  removeCoupon(): Promise<_$_joai_core0.IAppResponse<void>>;
681
697
  }
682
698
  //#endregion
@@ -1834,10 +1850,12 @@ declare class UpdatesResource {
1834
1850
  tags?: string;
1835
1851
  with?: UpdateRelation[];
1836
1852
  sort?: string;
1837
- limit?: number;
1853
+ page?: number;
1854
+ perPage?: number;
1838
1855
  upcoming?: boolean;
1839
1856
  past?: boolean;
1840
1857
  }): Promise<_$_joai_core0.IAppResponse<Update[]>>;
1858
+ get(id: string): Promise<_$_joai_core0.IAppResponse<Update>>;
1841
1859
  create(payload: UpdateCreatePayload): Promise<_$_joai_core0.IAppResponse<Update>>;
1842
1860
  update(id: string, payload: UpdateUpdatePayload): Promise<_$_joai_core0.IAppResponse<Update>>;
1843
1861
  delete(id: string): Promise<_$_joai_core0.IAppResponse<void>>;
@@ -1849,6 +1867,7 @@ declare class SocialPostsResource {
1849
1867
  private readonly http;
1850
1868
  constructor(http: IHttpService);
1851
1869
  connections(): Promise<_$_joai_core0.IAppResponse<SocialPostConnection[]>>;
1870
+ generateCaption(payload: SocialPostGenerateCaptionPayload): Promise<_$_joai_core0.IAppResponse<SocialPostGeneratedCaption>>;
1852
1871
  list(params?: {
1853
1872
  status?: SocialPostStatus;
1854
1873
  platform?: SocialPostPlatform;
package/dist/index.mjs CHANGED
@@ -137,6 +137,9 @@ var CheckoutResource = class {
137
137
  constructor(http) {
138
138
  this.http = http;
139
139
  }
140
+ validateCoupon(team, data) {
141
+ return this.http.post(`shops/${encodeURIComponent(team)}/checkout/coupon`, data);
142
+ }
140
143
  snapshot(team, data) {
141
144
  return this.http.post(`shops/${encodeURIComponent(team)}/checkout/snapshots`, data);
142
145
  }
@@ -906,10 +909,14 @@ var BillingResource = class {
906
909
  checkoutProduct(id) {
907
910
  return this.http.get(`products/${id}`);
908
911
  }
909
- orders(team, page = 1, contactId) {
912
+ orders(team, page = 1, filters = {}) {
910
913
  let params = `orders?page=${page}`;
911
- if (contactId) params += `&contactId=${encodeURIComponent(contactId)}`;
912
- 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 } });
913
920
  }
914
921
  payOrder(id, provider, accessToken) {
915
922
  return this.http.post(`orders/${id}/pay`, provider ? { provider } : {}, orderAccessHeaders$1(accessToken));
@@ -1054,8 +1061,11 @@ var CartsResource = class {
1054
1061
  clear() {
1055
1062
  return this.http.post("cart/clear");
1056
1063
  }
1057
- applyCoupon(code) {
1058
- return this.http.post("cart/coupon", { code });
1064
+ applyCoupon(code, team) {
1065
+ return this.http.post("cart/coupon", {
1066
+ code,
1067
+ ...team ? { team } : {}
1068
+ });
1059
1069
  }
1060
1070
  removeCoupon() {
1061
1071
  return this.http.post("cart/coupon/remove");
@@ -2718,12 +2728,16 @@ var UpdatesResource = class {
2718
2728
  if (params?.tags) query.set("tags", params.tags);
2719
2729
  if (params?.with?.length) query.set("with", params.with.join(","));
2720
2730
  if (params?.sort) query.set("sort", params.sort);
2721
- 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));
2722
2733
  if (params?.upcoming) query.set("filter[upcoming]", "1");
2723
2734
  if (params?.past) query.set("filter[past]", "1");
2724
2735
  const qs = query.toString();
2725
2736
  return this.http.get(`updates${qs ? "?" + qs : ""}`);
2726
2737
  }
2738
+ get(id) {
2739
+ return this.http.get(`updates/${id}`);
2740
+ }
2727
2741
  create(payload) {
2728
2742
  return this.http.post("updates", payload);
2729
2743
  }
@@ -2746,6 +2760,9 @@ var SocialPostsResource = class {
2746
2760
  connections() {
2747
2761
  return this.http.get("social-posts/connections");
2748
2762
  }
2763
+ generateCaption(payload) {
2764
+ return this.http.post("social-posts/generate-caption", payload);
2765
+ }
2749
2766
  list(params) {
2750
2767
  const query = new URLSearchParams();
2751
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": "7.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.15.0",
38
+ "@joai/core": "^4.15.1",
39
39
  "@joai/warps": "*"
40
40
  },
41
41
  "peerDependencies": {
42
- "@joai/core": "^4.15.0"
42
+ "@joai/core": "^4.15.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "tsdown": "^0.21.0",