@joai/sdk 9.0.0 → 9.0.3
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 +52 -9
- package/dist/index.mjs +75 -5
- package/package.json +3 -3
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, AppointmentPolicyUpsert, 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, CartLine, 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, ProductDetailSection, 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, SharedSocialPost, ShippingCarrierOption, 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, TaxClass, 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";
|
|
2
|
+
import { Address, AddressCreatePayload, AddressInput, AddressType, AddressUpdatePayload, Affiliate, AffiliateTier, Agent, AgentActionHistoryEntry, AgentPrivate, AgentSettings, AgentTrustedActionRule, AiCostsResponse, Alert, ApiToken, AppEnv, AppIngestion, AppendKvEntryResult, AppointmentAvailability, AppointmentBooking, AppointmentPolicy, AppointmentPolicyUpsert, AppointmentRequest, Artifact, ArtifactCreatePayload, ArtifactDeliverPayload, ArtifactDelivery, ArtifactDeliveryPreview, 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, CartLine, 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, Install, InstallClaimPayload, InstallOptOutPayload, InstallRegisterPayload, Integration, IntegrationType, Intent, Item, ItemCreatePayload, ItemUpdatePayload, JsonValue, KvEntryPayload, KvField, KvFieldWithEntries, Link, LinkCreatePayload, LinkStats, LinkUpdatePayload, LinkVariation, LinkVariationBatchCreatePayload, LinkVariationCreatePayload, LoyaltyAccount, LoyaltyCollectPointInput, LoyaltyCollectResponse, LoyaltyJoinResponse, LoyaltyMember, LoyaltyProgram, LoyaltyPromotion, LoyaltyReward, LoyaltyTier, LoyaltyTransaction, LoyaltyWalletAccount, 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, ProductDetailSection, 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, SharedSocialPost, ShippingCarrierOption, 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, TaxClass, 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
|
|
@@ -135,10 +135,11 @@ declare class FulfillmentsResource {
|
|
|
135
135
|
declare class ReturnsResource {
|
|
136
136
|
private readonly http;
|
|
137
137
|
constructor(http: IHttpService);
|
|
138
|
+
listForTeam(team?: string): Promise<_$_joai_core0.IAppResponse<Return[]>>;
|
|
138
139
|
list(orderId: string, accessToken?: string): Promise<_$_joai_core0.IAppResponse<Return[]>>;
|
|
139
140
|
create(orderId: string, data: {
|
|
140
141
|
reason: string;
|
|
141
|
-
fulfillmentId?:
|
|
142
|
+
fulfillmentId?: string;
|
|
142
143
|
items: {
|
|
143
144
|
orderItemId: number;
|
|
144
145
|
quantity: number;
|
|
@@ -1143,12 +1144,37 @@ declare class LinksResource {
|
|
|
1143
1144
|
declare class LoyaltyResource {
|
|
1144
1145
|
private readonly http;
|
|
1145
1146
|
constructor(http: IHttpService);
|
|
1147
|
+
/**
|
|
1148
|
+
* Program of a team. Without `team` (staff, X-Team set): every collect point; daily ones include `codeToday` and
|
|
1149
|
+
* `codeValidUntil` for signed-in team members (never for agent auth keys). With `team`: public / customer view, active
|
|
1150
|
+
* points only and never today's code; a customer token adds `collected`, `collectedAt` and `nextAvailableAt`.
|
|
1151
|
+
*/
|
|
1146
1152
|
getProgram(params?: {
|
|
1147
1153
|
team?: string;
|
|
1148
1154
|
}): Promise<_$_joai_core0.IAppResponse<LoyaltyProgram>>;
|
|
1155
|
+
/** Customer: join a team's program with the signed-in user's own contact. Idempotent. */
|
|
1156
|
+
join(params: {
|
|
1157
|
+
team: string;
|
|
1158
|
+
}): Promise<_$_joai_core0.IAppResponse<LoyaltyJoinResponse>>;
|
|
1159
|
+
/** Customer: all loyalty accounts of the signed-in user across teams. */
|
|
1160
|
+
getWallet(): Promise<_$_joai_core0.IAppResponse<LoyaltyWalletAccount[]>>;
|
|
1161
|
+
/** Customer: the signed-in user's own transactions on a team's program. */
|
|
1162
|
+
getWalletHistory(params: {
|
|
1163
|
+
team: string;
|
|
1164
|
+
page?: number;
|
|
1165
|
+
}): Promise<_$_joai_core0.IAppResponse<LoyaltyTransaction[]>>;
|
|
1166
|
+
/** Customer: collect at a collect point. Joins the program if needed; replays return `already: true`. */
|
|
1167
|
+
collect(params: {
|
|
1168
|
+
team: string;
|
|
1169
|
+
key: string;
|
|
1170
|
+
code?: string;
|
|
1171
|
+
}): Promise<_$_joai_core0.IAppResponse<LoyaltyCollectResponse>>;
|
|
1172
|
+
/** Staff: update the program. `settings.collect_points` replaces the collect point list (see LoyaltyCollectPointInput). */
|
|
1149
1173
|
updateProgram(data: {
|
|
1150
1174
|
name?: string;
|
|
1151
|
-
settings?: ProgramSettings
|
|
1175
|
+
settings?: ProgramSettings & {
|
|
1176
|
+
collect_points?: LoyaltyCollectPointInput[];
|
|
1177
|
+
};
|
|
1152
1178
|
}): Promise<_$_joai_core0.IAppResponse<LoyaltyProgram>>;
|
|
1153
1179
|
getRewards(): Promise<_$_joai_core0.IAppResponse<LoyaltyReward[]>>;
|
|
1154
1180
|
createReward(data: {
|
|
@@ -1226,6 +1252,18 @@ declare class LoyaltyResource {
|
|
|
1226
1252
|
}>>;
|
|
1227
1253
|
}
|
|
1228
1254
|
//#endregion
|
|
1255
|
+
//#region src/resources/installs.d.ts
|
|
1256
|
+
declare class InstallsResource {
|
|
1257
|
+
private readonly http;
|
|
1258
|
+
constructor(http: IHttpService);
|
|
1259
|
+
/** Upsert a device install for the current team (`X-Team`). Works anonymously or signed-in. */
|
|
1260
|
+
register(data: InstallRegisterPayload): Promise<_$_joai_core0.IAppResponse<Install>>;
|
|
1261
|
+
/** Attach the signed-in user (and their contact, when present) to an existing install. */
|
|
1262
|
+
claim(data: InstallClaimPayload): Promise<_$_joai_core0.IAppResponse<Install>>;
|
|
1263
|
+
/** Mark push as opted out / unavailable for this provider device ref. */
|
|
1264
|
+
optOut(data: InstallOptOutPayload): Promise<_$_joai_core0.IAppResponse<Install>>;
|
|
1265
|
+
}
|
|
1266
|
+
//#endregion
|
|
1229
1267
|
//#region src/resources/store.d.ts
|
|
1230
1268
|
declare class StoreResource {
|
|
1231
1269
|
private readonly http;
|
|
@@ -1360,6 +1398,8 @@ declare class MessagesResource {
|
|
|
1360
1398
|
generateAudio(messageId: string): Promise<_$_joai_core0.IAppResponse<{
|
|
1361
1399
|
audioUrl: string;
|
|
1362
1400
|
}>>;
|
|
1401
|
+
attachMedia(messageId: string, file: File): Promise<_$_joai_core0.IAppResponse<Message>>;
|
|
1402
|
+
completeMediaImport(messageId: string, file?: File | null): Promise<_$_joai_core0.IAppResponse<Message>>;
|
|
1363
1403
|
storeFeedback(agent: string, message: string, positive: boolean, inquiry: Inquiry | null): Promise<_$_joai_core0.IAppResponse<void>>;
|
|
1364
1404
|
toggleReaction(messageId: string, emoji: string): Promise<_$_joai_core0.IAppResponse<{
|
|
1365
1405
|
reactions: Reactions | null;
|
|
@@ -1651,8 +1691,9 @@ declare class ServicesResource {
|
|
|
1651
1691
|
taxClassId?: string | null;
|
|
1652
1692
|
pricingModel?: string;
|
|
1653
1693
|
settings?: Record<string, unknown> | null;
|
|
1694
|
+
order?: number | null;
|
|
1654
1695
|
}): Promise<_$_joai_core0.IAppResponse<Service>>;
|
|
1655
|
-
update(id: string, data: Partial<Pick<Service, 'name' | 'price' | 'description' | 'active' | 'digital' | 'public' | 'bookable' | 'taxClassId'>> & {
|
|
1696
|
+
update(id: string, data: Partial<Pick<Service, 'name' | 'price' | 'description' | 'active' | 'digital' | 'public' | 'bookable' | 'taxClassId' | 'order'>> & {
|
|
1656
1697
|
durationMinutes?: number | null;
|
|
1657
1698
|
settings?: Record<string, unknown> | null;
|
|
1658
1699
|
}): Promise<_$_joai_core0.IAppResponse<Service>>;
|
|
@@ -1883,6 +1924,7 @@ declare class TeamsResource {
|
|
|
1883
1924
|
}): Promise<_$_joai_core0.IAppResponse<void>>;
|
|
1884
1925
|
inviteMember(teamSlug: string, email: string, role: UserRole): Promise<_$_joai_core0.IAppResponse<void>>;
|
|
1885
1926
|
removeMember(teamSlug: string, memberId: string): Promise<_$_joai_core0.IAppResponse<void>>;
|
|
1927
|
+
updateMemberRole(teamSlug: string, memberId: string, role: UserRole): Promise<_$_joai_core0.IAppResponse<void>>;
|
|
1886
1928
|
listMembers(teamSlug: string): Promise<_$_joai_core0.IAppResponse<TeamMember[]>>;
|
|
1887
1929
|
updateLogo(teamSlug: string, logo: string[]): Promise<_$_joai_core0.IAppResponse<TeamPrivate>>;
|
|
1888
1930
|
updateCover(teamSlug: string, cover: string[]): Promise<_$_joai_core0.IAppResponse<TeamPrivate>>;
|
|
@@ -1922,6 +1964,7 @@ declare class ArtifactsResource {
|
|
|
1922
1964
|
update(id: string, payload: ArtifactUpdatePayload): Promise<_$_joai_core0.IAppResponse<Artifact>>;
|
|
1923
1965
|
delete(id: string): Promise<_$_joai_core0.IAppResponse<void>>;
|
|
1924
1966
|
deliver(payload: ArtifactDeliverPayload): Promise<_$_joai_core0.IAppResponse<ArtifactDelivery[]>>;
|
|
1967
|
+
previewDelivery(payload: ArtifactDeliverPayload): Promise<_$_joai_core0.IAppResponse<ArtifactDeliveryPreview>>;
|
|
1925
1968
|
}
|
|
1926
1969
|
//#endregion
|
|
1927
1970
|
//#region src/resources/campaigns.d.ts
|
|
@@ -2311,6 +2354,7 @@ declare class JoAiClient {
|
|
|
2311
2354
|
readonly items: ItemsResource;
|
|
2312
2355
|
readonly links: LinksResource;
|
|
2313
2356
|
readonly loyalty: LoyaltyResource;
|
|
2357
|
+
readonly installs: InstallsResource;
|
|
2314
2358
|
readonly store: StoreResource;
|
|
2315
2359
|
readonly media: MediaResource;
|
|
2316
2360
|
readonly metrics: MetricsResource;
|
|
@@ -2404,16 +2448,15 @@ type OpenPortalSessionOptions = {
|
|
|
2404
2448
|
client: PortalClient;
|
|
2405
2449
|
redirect: string;
|
|
2406
2450
|
allowedOrigins: string[];
|
|
2407
|
-
env?: AppEnv;
|
|
2408
|
-
fetcher?: typeof fetch;
|
|
2409
|
-
onNavigate?: (
|
|
2451
|
+
env?: AppEnv; /** @deprecated Unused — exchange happens via same-origin blade form after navigation. */
|
|
2452
|
+
fetcher?: typeof fetch; /** Receives the API callback URL (with fragment token), not the final portal redirect. */
|
|
2453
|
+
onNavigate?: (callbackUrl: string) => void;
|
|
2410
2454
|
};
|
|
2411
2455
|
declare const openPortalSession: ({
|
|
2412
2456
|
client,
|
|
2413
2457
|
redirect,
|
|
2414
2458
|
allowedOrigins,
|
|
2415
2459
|
env,
|
|
2416
|
-
fetcher,
|
|
2417
2460
|
onNavigate
|
|
2418
2461
|
}: OpenPortalSessionOptions) => Promise<boolean>;
|
|
2419
2462
|
//#endregion
|
|
@@ -2423,4 +2466,4 @@ declare class DistributionResource {
|
|
|
2423
2466
|
private fetchDistribution;
|
|
2424
2467
|
}
|
|
2425
2468
|
//#endregion
|
|
2426
|
-
export { AddressesResource, AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, type AttachedMedia, type AuthConfirmCodeRequest, type AuthConfirmCodeResponse, type AuthNativeSessionResponse, type AuthPortalSessionResponse, AuthResource, type AuthSendCodeRequest, type AuthUser, AutomationsResource, type BackendWarp, type BackendWarpBrand, BillingResource, BlueprintsResource, type CacheConfig, CachedHttpService, CampaignsResource, CardsResource, type Cart, CartsResource, ChangelogResource, CharactersResource, CheckoutResource, type CheckoutSnapshot, CommerceResource, ContactsResource, ContentResource, ContractsResource, type CreateEmptyGuestCheckoutOptions, type CreateHookPayload, type CreateInboundHookPayload, type CreateInternalHookPayload, type CreateWarpLinkedHookPayload, type CreateWebHookPayload, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, type FulfillmentLocation, type FulfillmentLocationInput, FulfillmentsResource, GoalsResource, type GuestBuyer, type GuestCartAmounts, type GuestCheckoutCartItem, type GuestCheckoutClient, type GuestCheckoutDraft, GuestCheckoutError, type GuestCheckoutErrorCode, type GuestCheckoutSnapshotResult, type GuestCheckoutState, type GuestCommerceStorage, type GuestCommerceStorageOptions, type GuestCouponClient, GuestCouponError, type GuestCouponErrorCode, type GuestCouponPreview, type GuestOrderAccess, type Hook, type HookSample, type HookTrigger, type HookTriggerCondition, type HookTriggerInput, HooksResource, IngestionsResource, InquiriesResource, IntegrationsResource, IntentsResource, type ItemListParams, ItemsResource, JoAiClient, type JoAiClientConfig, KvResource, LinksResource, LoyaltyResource, McpResource, type MediaUploadType, MeetingsResource, MemoriesResource, MessagesResource, MetricsResource, MissionsResource, NotificationsResource, OfficeResource, type OpenPortalSessionOptions, type OpeningHoursEntry, type OpeningHoursFormatOptions, type Order, type OrderPriceMode, type OrderStatus, OrdersResource, PersonaResource, type PlaceCheckoutOrderRequest, type PlaceGuestCheckoutOrderResult, type Product, type ProductVariation, ProductsResource, ProjectsResource, type RecentlyViewedStorage, type RecentlyViewedStorageOptions, RemindersResource, ReturnsResource, type RevalidateGuestCouponResult, SegmentsResource, ServicesResource, type ShippingRate, type ShippingRateInput, ShippingResource, type ShippingZoneInput, ShortcutsResource, SitesResource, SkillsResource, SocialPostsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, type TaxClassInput, TaxClassesResource, type TeamInviteInfo, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, type WebHookTriggerEvent, WorkspaceResource, assertGuestCheckoutReady, assertGuestPickupSlotReady, buildGuestCheckoutSnapshotRequest, buildGuestOrderReturnUrl, completePortalSession, createClient, createEmptyGuestCheckoutState, createGuestCheckoutSnapshot, createGuestCommerceStorage, createRecentlyViewedStorage, formatOpeningHours, formatPickupSlotLabel, getAuthFragmentToken, getRecentlyViewedSlugs, guestCartAmounts, guestCouponMessageFromErrors, isAllowedRedirectUrl, isGuestCheckoutError, isGuestCouponError, isPortalCallbackUrl, openPortalSession, placeGuestCheckoutOrder, readGuestOrderReturnAccess, revalidateGuestCoupon, sanitizePortalCallbackUrl, stripGuestOrderReturnToken, toGuestCheckoutDraft, trackRecentlyViewed, validateGuestCoupon };
|
|
2469
|
+
export { AddressesResource, AgentsResource, AlertsResource, ApiTokensResource, AppointmentsResource, type AttachedMedia, type AuthConfirmCodeRequest, type AuthConfirmCodeResponse, type AuthNativeSessionResponse, type AuthPortalSessionResponse, AuthResource, type AuthSendCodeRequest, type AuthUser, AutomationsResource, type BackendWarp, type BackendWarpBrand, BillingResource, BlueprintsResource, type CacheConfig, CachedHttpService, CampaignsResource, CardsResource, type Cart, CartsResource, ChangelogResource, CharactersResource, CheckoutResource, type CheckoutSnapshot, CommerceResource, ContactsResource, ContentResource, ContractsResource, type CreateEmptyGuestCheckoutOptions, type CreateHookPayload, type CreateInboundHookPayload, type CreateInternalHookPayload, type CreateWarpLinkedHookPayload, type CreateWebHookPayload, DeskResource, DistributionResource, DocumentsResource, ElementsResource, EntitiesResource, FlowsResource, type FulfillmentLocation, type FulfillmentLocationInput, FulfillmentsResource, GoalsResource, type GuestBuyer, type GuestCartAmounts, type GuestCheckoutCartItem, type GuestCheckoutClient, type GuestCheckoutDraft, GuestCheckoutError, type GuestCheckoutErrorCode, type GuestCheckoutSnapshotResult, type GuestCheckoutState, type GuestCommerceStorage, type GuestCommerceStorageOptions, type GuestCouponClient, GuestCouponError, type GuestCouponErrorCode, type GuestCouponPreview, type GuestOrderAccess, type Hook, type HookSample, type HookTrigger, type HookTriggerCondition, type HookTriggerInput, HooksResource, IngestionsResource, InquiriesResource, InstallsResource, IntegrationsResource, IntentsResource, type ItemListParams, ItemsResource, JoAiClient, type JoAiClientConfig, KvResource, LinksResource, LoyaltyResource, McpResource, type MediaUploadType, MeetingsResource, MemoriesResource, MessagesResource, MetricsResource, MissionsResource, NotificationsResource, OfficeResource, type OpenPortalSessionOptions, type OpeningHoursEntry, type OpeningHoursFormatOptions, type Order, type OrderPriceMode, type OrderStatus, OrdersResource, PersonaResource, type PlaceCheckoutOrderRequest, type PlaceGuestCheckoutOrderResult, type Product, type ProductVariation, ProductsResource, ProjectsResource, type RecentlyViewedStorage, type RecentlyViewedStorageOptions, RemindersResource, ReturnsResource, type RevalidateGuestCouponResult, SegmentsResource, ServicesResource, type ShippingRate, type ShippingRateInput, ShippingResource, type ShippingZoneInput, ShortcutsResource, SitesResource, SkillsResource, SocialPostsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, type TaxClassInput, TaxClassesResource, type TeamInviteInfo, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, type WebHookTriggerEvent, WorkspaceResource, assertGuestCheckoutReady, assertGuestPickupSlotReady, buildGuestCheckoutSnapshotRequest, buildGuestOrderReturnUrl, completePortalSession, createClient, createEmptyGuestCheckoutState, createGuestCheckoutSnapshot, createGuestCommerceStorage, createRecentlyViewedStorage, formatOpeningHours, formatPickupSlotLabel, getAuthFragmentToken, getRecentlyViewedSlugs, guestCartAmounts, guestCouponMessageFromErrors, isAllowedRedirectUrl, isGuestCheckoutError, isGuestCouponError, isPortalCallbackUrl, openPortalSession, placeGuestCheckoutOrder, readGuestOrderReturnAccess, revalidateGuestCoupon, sanitizePortalCallbackUrl, stripGuestOrderReturnToken, toGuestCheckoutDraft, trackRecentlyViewed, validateGuestCoupon };
|
package/dist/index.mjs
CHANGED
|
@@ -180,6 +180,9 @@ var ReturnsResource = class {
|
|
|
180
180
|
constructor(http) {
|
|
181
181
|
this.http = http;
|
|
182
182
|
}
|
|
183
|
+
listForTeam(team) {
|
|
184
|
+
return this.http.get("returns", team ? { headers: { "X-Team": team } } : void 0);
|
|
185
|
+
}
|
|
183
186
|
list(orderId, accessToken) {
|
|
184
187
|
return this.http.get(`orders/${orderId}/returns`, orderAccessHeaders$2(accessToken));
|
|
185
188
|
}
|
|
@@ -617,6 +620,11 @@ async function placeGuestCheckoutOrder(options) {
|
|
|
617
620
|
accessToken,
|
|
618
621
|
paymentUrl: null
|
|
619
622
|
};
|
|
623
|
+
if (order.data.status !== "pending") return {
|
|
624
|
+
order: order.data,
|
|
625
|
+
accessToken,
|
|
626
|
+
paymentUrl: null
|
|
627
|
+
};
|
|
620
628
|
if (!accessToken) throw new GuestCheckoutError("payment_failed");
|
|
621
629
|
const payment = await options.client.orders.pay(order.data.id, void 0, accessToken);
|
|
622
630
|
if (!payment.ok || !payment.data?.url) return {
|
|
@@ -1736,10 +1744,33 @@ var LoyaltyResource = class {
|
|
|
1736
1744
|
constructor(http) {
|
|
1737
1745
|
this.http = http;
|
|
1738
1746
|
}
|
|
1747
|
+
/**
|
|
1748
|
+
* Program of a team. Without `team` (staff, X-Team set): every collect point; daily ones include `codeToday` and
|
|
1749
|
+
* `codeValidUntil` for signed-in team members (never for agent auth keys). With `team`: public / customer view, active
|
|
1750
|
+
* points only and never today's code; a customer token adds `collected`, `collectedAt` and `nextAvailableAt`.
|
|
1751
|
+
*/
|
|
1739
1752
|
getProgram(params) {
|
|
1740
1753
|
const query = params?.team ? `?team=${encodeURIComponent(params.team)}` : "";
|
|
1741
1754
|
return this.http.get(`loyalty/program${query}`);
|
|
1742
1755
|
}
|
|
1756
|
+
/** Customer: join a team's program with the signed-in user's own contact. Idempotent. */
|
|
1757
|
+
join(params) {
|
|
1758
|
+
return this.http.post("loyalty/join", { team: params.team });
|
|
1759
|
+
}
|
|
1760
|
+
/** Customer: all loyalty accounts of the signed-in user across teams. */
|
|
1761
|
+
getWallet() {
|
|
1762
|
+
return this.http.get("loyalty/wallet");
|
|
1763
|
+
}
|
|
1764
|
+
/** Customer: the signed-in user's own transactions on a team's program. */
|
|
1765
|
+
getWalletHistory(params) {
|
|
1766
|
+
const query = params.page ? `?page=${params.page}` : "";
|
|
1767
|
+
return this.http.get(`loyalty/wallet/${encodeURIComponent(params.team)}/history${query}`);
|
|
1768
|
+
}
|
|
1769
|
+
/** Customer: collect at a collect point. Joins the program if needed; replays return `already: true`. */
|
|
1770
|
+
collect(params) {
|
|
1771
|
+
return this.http.post("loyalty/collect", params);
|
|
1772
|
+
}
|
|
1773
|
+
/** Staff: update the program. `settings.collect_points` replaces the collect point list (see LoyaltyCollectPointInput). */
|
|
1743
1774
|
updateProgram(data) {
|
|
1744
1775
|
return this.http.patch("loyalty/program", data);
|
|
1745
1776
|
}
|
|
@@ -1821,6 +1852,25 @@ var LoyaltyResource = class {
|
|
|
1821
1852
|
}
|
|
1822
1853
|
};
|
|
1823
1854
|
//#endregion
|
|
1855
|
+
//#region src/resources/installs.ts
|
|
1856
|
+
var InstallsResource = class {
|
|
1857
|
+
constructor(http) {
|
|
1858
|
+
this.http = http;
|
|
1859
|
+
}
|
|
1860
|
+
/** Upsert a device install for the current team (`X-Team`). Works anonymously or signed-in. */
|
|
1861
|
+
register(data) {
|
|
1862
|
+
return this.http.post("installs", data);
|
|
1863
|
+
}
|
|
1864
|
+
/** Attach the signed-in user (and their contact, when present) to an existing install. */
|
|
1865
|
+
claim(data) {
|
|
1866
|
+
return this.http.post("installs/claim", data);
|
|
1867
|
+
}
|
|
1868
|
+
/** Mark push as opted out / unavailable for this provider device ref. */
|
|
1869
|
+
optOut(data) {
|
|
1870
|
+
return this.http.post("installs/opt-out", data);
|
|
1871
|
+
}
|
|
1872
|
+
};
|
|
1873
|
+
//#endregion
|
|
1824
1874
|
//#region src/resources/store.ts
|
|
1825
1875
|
var StoreResource = class {
|
|
1826
1876
|
constructor(http) {
|
|
@@ -2067,6 +2117,17 @@ var MessagesResource = class {
|
|
|
2067
2117
|
generateAudio(messageId) {
|
|
2068
2118
|
return this.http.post(`messages/${messageId}/audio`, {});
|
|
2069
2119
|
}
|
|
2120
|
+
attachMedia(messageId, file) {
|
|
2121
|
+
const form = new FormData();
|
|
2122
|
+
form.append("file", file, file.name);
|
|
2123
|
+
return this.http.post(`messages/${messageId}/media`, form, { isJson: false });
|
|
2124
|
+
}
|
|
2125
|
+
completeMediaImport(messageId, file) {
|
|
2126
|
+
if (!file) return this.http.post(`messages/${messageId}/media-import`, {});
|
|
2127
|
+
const form = new FormData();
|
|
2128
|
+
form.append("file", file, file.name);
|
|
2129
|
+
return this.http.post(`messages/${messageId}/media-import`, form, { isJson: false });
|
|
2130
|
+
}
|
|
2070
2131
|
storeFeedback(agent, message, positive, inquiry) {
|
|
2071
2132
|
return this.http.post("feedback", {
|
|
2072
2133
|
agent,
|
|
@@ -2688,6 +2749,12 @@ var TeamsResource = class {
|
|
|
2688
2749
|
removeMember(teamSlug, memberId) {
|
|
2689
2750
|
return this.http.post(`teams/${teamSlug}/members/remove`, { member: memberId });
|
|
2690
2751
|
}
|
|
2752
|
+
updateMemberRole(teamSlug, memberId, role) {
|
|
2753
|
+
return this.http.post(`teams/${teamSlug}/members/role`, {
|
|
2754
|
+
member: memberId,
|
|
2755
|
+
role
|
|
2756
|
+
});
|
|
2757
|
+
}
|
|
2691
2758
|
listMembers(teamSlug) {
|
|
2692
2759
|
return this.http.get(`teams/${teamSlug}/members`);
|
|
2693
2760
|
}
|
|
@@ -2771,6 +2838,9 @@ var ArtifactsResource = class {
|
|
|
2771
2838
|
deliver(payload) {
|
|
2772
2839
|
return this.http.post("artifacts/deliver", payload);
|
|
2773
2840
|
}
|
|
2841
|
+
previewDelivery(payload) {
|
|
2842
|
+
return this.http.post("artifacts/preview-delivery", payload);
|
|
2843
|
+
}
|
|
2774
2844
|
};
|
|
2775
2845
|
//#endregion
|
|
2776
2846
|
//#region src/resources/campaigns.ts
|
|
@@ -3514,6 +3584,7 @@ var JoAiClient = class {
|
|
|
3514
3584
|
this.items = new ItemsResource(this.http);
|
|
3515
3585
|
this.links = new LinksResource(this.http);
|
|
3516
3586
|
this.loyalty = new LoyaltyResource(this.http);
|
|
3587
|
+
this.installs = new InstallsResource(this.http);
|
|
3517
3588
|
this.store = new StoreResource(this.http);
|
|
3518
3589
|
this.media = new MediaResource(this.http);
|
|
3519
3590
|
this.metrics = new MetricsResource(this.http);
|
|
@@ -3616,19 +3687,18 @@ const completePortalSession = async (callbackUrl, fetcher = fetch) => {
|
|
|
3616
3687
|
return false;
|
|
3617
3688
|
}
|
|
3618
3689
|
};
|
|
3619
|
-
const openPortalSession = async ({ client, redirect, allowedOrigins, env = "mainnet",
|
|
3690
|
+
const openPortalSession = async ({ client, redirect, allowedOrigins, env = "mainnet", onNavigate }) => {
|
|
3620
3691
|
if (!isAllowedRedirectUrl(redirect, allowedOrigins)) return false;
|
|
3621
3692
|
const response = await client.auth.createPortalSession(redirect);
|
|
3622
3693
|
const callbackUrl = sanitizePortalCallbackUrl(response.ok ? response.data?.url : null, env);
|
|
3623
3694
|
if (!callbackUrl) return false;
|
|
3624
|
-
if (!await completePortalSession(callbackUrl, fetcher)) return false;
|
|
3625
3695
|
if (!isAllowedRedirectUrl(redirect, allowedOrigins)) return false;
|
|
3626
3696
|
if (onNavigate) {
|
|
3627
|
-
onNavigate(
|
|
3697
|
+
onNavigate(callbackUrl);
|
|
3628
3698
|
return true;
|
|
3629
3699
|
}
|
|
3630
3700
|
if (typeof window !== "undefined") {
|
|
3631
|
-
window.location.assign(
|
|
3701
|
+
window.location.assign(callbackUrl);
|
|
3632
3702
|
return true;
|
|
3633
3703
|
}
|
|
3634
3704
|
return false;
|
|
@@ -3662,4 +3732,4 @@ var DistributionResource = class {
|
|
|
3662
3732
|
}
|
|
3663
3733
|
};
|
|
3664
3734
|
//#endregion
|
|
3665
|
-
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, GuestCheckoutError, GuestCouponError, 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, SocialPostsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, TaxClassesResource, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WorkspaceResource, assertGuestCheckoutReady, assertGuestPickupSlotReady, buildGuestCheckoutSnapshotRequest, buildGuestOrderReturnUrl, completePortalSession, createClient, createEmptyGuestCheckoutState, createGuestCheckoutSnapshot, createGuestCommerceStorage, createRecentlyViewedStorage, formatOpeningHours, formatPickupSlotLabel, getAuthFragmentToken, getRecentlyViewedSlugs, guestCartAmounts, guestCouponMessageFromErrors, isAllowedRedirectUrl, isGuestCheckoutError, isGuestCouponError, isPortalCallbackUrl, openPortalSession, placeGuestCheckoutOrder, readGuestOrderReturnAccess, revalidateGuestCoupon, sanitizePortalCallbackUrl, stripGuestOrderReturnToken, toGuestCheckoutDraft, trackRecentlyViewed, validateGuestCoupon };
|
|
3735
|
+
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, GuestCheckoutError, GuestCouponError, HooksResource, IngestionsResource, InquiriesResource, InstallsResource, 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, SocialPostsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, TaxClassesResource, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WorkspaceResource, assertGuestCheckoutReady, assertGuestPickupSlotReady, buildGuestCheckoutSnapshotRequest, buildGuestOrderReturnUrl, completePortalSession, createClient, createEmptyGuestCheckoutState, createGuestCheckoutSnapshot, createGuestCommerceStorage, createRecentlyViewedStorage, formatOpeningHours, formatPickupSlotLabel, getAuthFragmentToken, getRecentlyViewedSlugs, guestCartAmounts, guestCouponMessageFromErrors, isAllowedRedirectUrl, isGuestCheckoutError, isGuestCouponError, isPortalCallbackUrl, openPortalSession, placeGuestCheckoutOrder, readGuestOrderReturnAccess, revalidateGuestCoupon, sanitizePortalCallbackUrl, stripGuestOrderReturnToken, toGuestCheckoutDraft, trackRecentlyViewed, validateGuestCoupon };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joai/sdk",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.3",
|
|
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": "^5.0.
|
|
38
|
+
"@joai/core": "^5.0.3",
|
|
39
39
|
"@joai/warps": "*"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@joai/core": "^5.0.
|
|
42
|
+
"@joai/core": "^5.0.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"tsdown": "^0.21.0",
|