@joai/sdk 7.0.6 → 7.0.8
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 +68 -10
- package/dist/index.mjs +128 -33
- 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, 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, 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, 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";
|
|
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, 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
|
|
@@ -109,10 +109,16 @@ declare class CheckoutResource {
|
|
|
109
109
|
}
|
|
110
110
|
//#endregion
|
|
111
111
|
//#region src/commerce/fulfillments.d.ts
|
|
112
|
+
type FulfillmentUpdateInput = {
|
|
113
|
+
status?: Fulfillment['status'];
|
|
114
|
+
carrierCode?: string | null;
|
|
115
|
+
trackingNumber?: string | null;
|
|
116
|
+
};
|
|
112
117
|
declare class FulfillmentsResource {
|
|
113
118
|
private readonly http;
|
|
114
119
|
constructor(http: IHttpService);
|
|
115
120
|
list(orderId: string): Promise<_$_joai_core0.IAppResponse<Fulfillment[]>>;
|
|
121
|
+
carriers(): Promise<_$_joai_core0.IAppResponse<ShippingCarrierOption[]>>;
|
|
116
122
|
create(orderId: string, data: {
|
|
117
123
|
items: {
|
|
118
124
|
orderItemId: number;
|
|
@@ -120,10 +126,9 @@ declare class FulfillmentsResource {
|
|
|
120
126
|
}[];
|
|
121
127
|
carrierCode?: string;
|
|
122
128
|
trackingNumber?: string;
|
|
123
|
-
trackingUrl?: string;
|
|
124
129
|
status?: Fulfillment['status'];
|
|
125
130
|
}): Promise<_$_joai_core0.IAppResponse<Fulfillment>>;
|
|
126
|
-
update(orderId: string, fulfillmentId: string,
|
|
131
|
+
update(orderId: string, fulfillmentId: string, data: FulfillmentUpdateInput | Fulfillment['status']): Promise<_$_joai_core0.IAppResponse<Fulfillment>>;
|
|
127
132
|
}
|
|
128
133
|
//#endregion
|
|
129
134
|
//#region src/commerce/returns.d.ts
|
|
@@ -192,6 +197,22 @@ declare class ShippingResource {
|
|
|
192
197
|
deleteLocation(team: string, locationId: string): Promise<_$_joai_core0.IAppResponse<void>>;
|
|
193
198
|
}
|
|
194
199
|
//#endregion
|
|
200
|
+
//#region src/commerce/taxClasses.d.ts
|
|
201
|
+
type TaxClassInput = {
|
|
202
|
+
name: string;
|
|
203
|
+
rate: number;
|
|
204
|
+
isDefault?: boolean;
|
|
205
|
+
position?: number;
|
|
206
|
+
};
|
|
207
|
+
declare class TaxClassesResource {
|
|
208
|
+
private readonly http;
|
|
209
|
+
constructor(http: IHttpService);
|
|
210
|
+
list(team: string): Promise<_$_joai_core0.IAppResponse<TaxClass[]>>;
|
|
211
|
+
create(team: string, data: TaxClassInput): Promise<_$_joai_core0.IAppResponse<TaxClass>>;
|
|
212
|
+
update(team: string, taxClassId: string, data: TaxClassInput): Promise<_$_joai_core0.IAppResponse<TaxClass>>;
|
|
213
|
+
delete(team: string, taxClassId: string): Promise<_$_joai_core0.IAppResponse<void>>;
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
195
216
|
//#region src/commerce/guest.d.ts
|
|
196
217
|
type GuestOrderAccess = {
|
|
197
218
|
orderId: string;
|
|
@@ -228,6 +249,24 @@ declare function createGuestCommerceStorage(options: GuestCommerceStorageOptions
|
|
|
228
249
|
claimOrderReturn(): GuestOrderAccess | null;
|
|
229
250
|
};
|
|
230
251
|
//#endregion
|
|
252
|
+
//#region src/commerce/recentlyViewed.d.ts
|
|
253
|
+
type RecentlyViewedStorageOptions = {
|
|
254
|
+
/** Team slug or shop id — scopes storage per storefront. */namespace: string;
|
|
255
|
+
maxItems?: number;
|
|
256
|
+
};
|
|
257
|
+
type RecentlyViewedStorage = {
|
|
258
|
+
track: (slug: string) => void;
|
|
259
|
+
getSlugs: () => string[];
|
|
260
|
+
clear: () => void;
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Persist recently viewed product slugs in localStorage (no PII).
|
|
264
|
+
* Newest first; duplicates move to the front; capped by maxItems.
|
|
265
|
+
*/
|
|
266
|
+
declare function createRecentlyViewedStorage(options: RecentlyViewedStorageOptions): RecentlyViewedStorage;
|
|
267
|
+
declare function trackRecentlyViewed(namespace: string, slug: string, maxItems?: number): void;
|
|
268
|
+
declare function getRecentlyViewedSlugs(namespace: string): string[];
|
|
269
|
+
//#endregion
|
|
231
270
|
//#region src/commerce/guestCheckout.d.ts
|
|
232
271
|
type GuestCheckoutCartItem = {
|
|
233
272
|
id: string;
|
|
@@ -401,12 +440,14 @@ declare function revalidateGuestCoupon(options: {
|
|
|
401
440
|
}): Promise<RevalidateGuestCouponResult>;
|
|
402
441
|
//#endregion
|
|
403
442
|
//#region src/commerce/pickupSlotLabel.d.ts
|
|
404
|
-
|
|
443
|
+
/** Formats a pickup slot in a locale-aware 24h label. Pass timeZone when the meeting/policy provides one. */
|
|
444
|
+
declare const formatPickupSlotLabel: (iso: string, locale: string, timeZone?: string | null) => string;
|
|
405
445
|
//#endregion
|
|
406
446
|
//#region src/commerce/index.d.ts
|
|
407
447
|
declare class CommerceResource {
|
|
408
448
|
readonly checkout: CheckoutResource;
|
|
409
449
|
readonly shipping: ShippingResource;
|
|
450
|
+
readonly taxClasses: TaxClassesResource;
|
|
410
451
|
readonly fulfillments: FulfillmentsResource;
|
|
411
452
|
readonly returns: ReturnsResource;
|
|
412
453
|
constructor(http: IHttpService);
|
|
@@ -558,7 +599,7 @@ declare class AppointmentsResource {
|
|
|
558
599
|
private readonly config;
|
|
559
600
|
constructor(http: IHttpService, config: JoAiClientConfig);
|
|
560
601
|
getPolicy(): Promise<_$_joai_core0.IAppResponse<AppointmentPolicy | null>>;
|
|
561
|
-
upsertPolicy(data:
|
|
602
|
+
upsertPolicy(data: AppointmentPolicyUpsert): Promise<_$_joai_core0.IAppResponse<AppointmentPolicy>>;
|
|
562
603
|
checkAvailability(agentUuid: string, params: {
|
|
563
604
|
windowStart: string;
|
|
564
605
|
windowEnd: string;
|
|
@@ -701,7 +742,7 @@ declare class BillingResource {
|
|
|
701
742
|
orders(team: TeamPrivate | null, page?: number, filters?: {
|
|
702
743
|
contactId?: string;
|
|
703
744
|
couponId?: string;
|
|
704
|
-
}): Promise<_$_joai_core0.IAppResponse<Order$1[]>>;
|
|
745
|
+
}, perPage?: number): Promise<_$_joai_core0.IAppResponse<Order$1[]>>;
|
|
705
746
|
orderStats(team: string): Promise<_$_joai_core0.IAppResponse<TeamOrderStats>>;
|
|
706
747
|
payOrder(id: string, provider?: PaymentProvider, accessToken?: string): Promise<_$_joai_core0.IAppResponse<{
|
|
707
748
|
url: string;
|
|
@@ -901,12 +942,14 @@ declare class DocumentsResource {
|
|
|
901
942
|
blueprint?: string;
|
|
902
943
|
}): Promise<_$_joai_core0.IAppResponse<Document>>;
|
|
903
944
|
get(id: string): Promise<_$_joai_core0.IAppResponse<Document>>;
|
|
904
|
-
getShared(slug: string): Promise<_$_joai_core0.IAppResponse<Document>>;
|
|
945
|
+
getShared(slug: string, password?: string): Promise<_$_joai_core0.IAppResponse<Document>>;
|
|
905
946
|
update(id: string, data: {
|
|
906
947
|
title?: string;
|
|
907
948
|
content?: string;
|
|
908
949
|
public?: boolean;
|
|
909
950
|
archived?: boolean;
|
|
951
|
+
password?: string | null;
|
|
952
|
+
clearPassword?: boolean;
|
|
910
953
|
meta?: Record<string, unknown>;
|
|
911
954
|
}): Promise<_$_joai_core0.IAppResponse<Document>>;
|
|
912
955
|
delete(id: string): Promise<_$_joai_core0.IAppResponse<void>>;
|
|
@@ -1365,7 +1408,7 @@ declare class OfficeResource {
|
|
|
1365
1408
|
declare class OrdersResource {
|
|
1366
1409
|
private readonly http;
|
|
1367
1410
|
constructor(http: IHttpService);
|
|
1368
|
-
list(team: string): Promise<_$_joai_core0.IAppResponse<Order$1[]>>;
|
|
1411
|
+
list(team: string, page?: number, perPage?: number): Promise<_$_joai_core0.IAppResponse<Order$1[]>>;
|
|
1369
1412
|
get(id: string, accessToken?: string): Promise<_$_joai_core0.IAppResponse<Order$1>>;
|
|
1370
1413
|
create(data: {
|
|
1371
1414
|
contactId?: string;
|
|
@@ -1387,6 +1430,7 @@ declare class OrdersResource {
|
|
|
1387
1430
|
quantity: number;
|
|
1388
1431
|
name?: string;
|
|
1389
1432
|
unitPrice?: number;
|
|
1433
|
+
taxClassId?: string | null;
|
|
1390
1434
|
configuration?: Configuration;
|
|
1391
1435
|
}[];
|
|
1392
1436
|
fulfillmentMethod?: FulfillmentMethod;
|
|
@@ -1421,6 +1465,17 @@ declare class OrdersResource {
|
|
|
1421
1465
|
pay(id: string, provider?: PaymentProvider, accessToken?: string): Promise<_$_joai_core0.IAppResponse<{
|
|
1422
1466
|
url: string;
|
|
1423
1467
|
}>>;
|
|
1468
|
+
reorder(id: string): Promise<_$_joai_core0.IAppResponse<{
|
|
1469
|
+
added: Array<{
|
|
1470
|
+
id: string;
|
|
1471
|
+
name: string;
|
|
1472
|
+
quantity: number;
|
|
1473
|
+
}>;
|
|
1474
|
+
skipped: Array<{
|
|
1475
|
+
name: string;
|
|
1476
|
+
reason: string;
|
|
1477
|
+
}>;
|
|
1478
|
+
}>>;
|
|
1424
1479
|
notify(id: string, type: string | undefined, agentId: string): Promise<_$_joai_core0.IAppResponse<{
|
|
1425
1480
|
message: string;
|
|
1426
1481
|
}>>;
|
|
@@ -1451,6 +1506,7 @@ declare class ProductsResource {
|
|
|
1451
1506
|
description?: TranslatableValue | null;
|
|
1452
1507
|
virtual?: boolean;
|
|
1453
1508
|
public?: boolean;
|
|
1509
|
+
taxClassId?: string | null;
|
|
1454
1510
|
}, teamSlug?: string): Promise<_$_joai_core0.IAppResponse<Product>>;
|
|
1455
1511
|
update(id: string, data: {
|
|
1456
1512
|
name?: TranslatableValue;
|
|
@@ -1461,6 +1517,7 @@ declare class ProductsResource {
|
|
|
1461
1517
|
active?: boolean;
|
|
1462
1518
|
public?: boolean;
|
|
1463
1519
|
virtual?: boolean;
|
|
1520
|
+
taxClassId?: string | null;
|
|
1464
1521
|
media?: string[];
|
|
1465
1522
|
}): Promise<_$_joai_core0.IAppResponse<Product>>;
|
|
1466
1523
|
delete(id: string): Promise<_$_joai_core0.IAppResponse<void>>;
|
|
@@ -1585,10 +1642,11 @@ declare class ServicesResource {
|
|
|
1585
1642
|
digital?: boolean;
|
|
1586
1643
|
public?: boolean;
|
|
1587
1644
|
bookable?: boolean;
|
|
1645
|
+
taxClassId?: string | null;
|
|
1588
1646
|
pricingModel?: string;
|
|
1589
1647
|
settings?: Record<string, unknown> | null;
|
|
1590
1648
|
}): Promise<_$_joai_core0.IAppResponse<Service>>;
|
|
1591
|
-
update(id: string, data: Partial<Pick<Service, 'name' | 'price' | 'description' | 'active' | 'digital' | 'public' | 'bookable'>> & {
|
|
1649
|
+
update(id: string, data: Partial<Pick<Service, 'name' | 'price' | 'description' | 'active' | 'digital' | 'public' | 'bookable' | 'taxClassId'>> & {
|
|
1592
1650
|
durationMinutes?: number | null;
|
|
1593
1651
|
settings?: Record<string, unknown> | null;
|
|
1594
1652
|
}): Promise<_$_joai_core0.IAppResponse<Service>>;
|
|
@@ -2359,4 +2417,4 @@ declare class DistributionResource {
|
|
|
2359
2417
|
private fetchDistribution;
|
|
2360
2418
|
}
|
|
2361
2419
|
//#endregion
|
|
2362
|
-
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, RemindersResource, ReturnsResource, type RevalidateGuestCouponResult, SegmentsResource, ServicesResource, type ShippingRate, type ShippingRateInput, ShippingResource, type ShippingZoneInput, ShortcutsResource, SitesResource, SkillsResource, SocialPostsResource, StatsResource, StoreResource, SubscriptionsResource, SwarmsResource, TagsResource, TasksResource, type TeamInviteInfo, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, type WebHookTriggerEvent, WorkspaceResource, assertGuestCheckoutReady, assertGuestPickupSlotReady, buildGuestCheckoutSnapshotRequest, buildGuestOrderReturnUrl, completePortalSession, createClient, createEmptyGuestCheckoutState, createGuestCheckoutSnapshot, createGuestCommerceStorage, formatOpeningHours, formatPickupSlotLabel, getAuthFragmentToken, guestCartAmounts, guestCouponMessageFromErrors, isAllowedRedirectUrl, isGuestCheckoutError, isGuestCouponError, isPortalCallbackUrl, openPortalSession, placeGuestCheckoutOrder, readGuestOrderReturnAccess, revalidateGuestCoupon, sanitizePortalCallbackUrl, stripGuestOrderReturnToken, toGuestCheckoutDraft, validateGuestCoupon };
|
|
2420
|
+
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 };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HttpService, cartLineTotal, cartPayableTotal, getApiBaseUrl, isCompleteAddressInput } from "@joai/core";
|
|
1
|
+
import { HttpService, cartLineTotal, cartPayableTotal, firstValidationMessage, getApiBaseUrl, isCompleteAddressInput, validationMessageFor } from "@joai/core";
|
|
2
2
|
import { WarpClient } from "@joai/warps";
|
|
3
3
|
//#region src/resources/agents.ts
|
|
4
4
|
var AgentsResource = class {
|
|
@@ -162,11 +162,15 @@ var FulfillmentsResource = class {
|
|
|
162
162
|
list(orderId) {
|
|
163
163
|
return this.http.get(`orders/${orderId}/fulfillments`);
|
|
164
164
|
}
|
|
165
|
+
carriers() {
|
|
166
|
+
return this.http.get("shipping-carriers");
|
|
167
|
+
}
|
|
165
168
|
create(orderId, data) {
|
|
166
169
|
return this.http.post(`orders/${orderId}/fulfillments`, data);
|
|
167
170
|
}
|
|
168
|
-
update(orderId, fulfillmentId,
|
|
169
|
-
|
|
171
|
+
update(orderId, fulfillmentId, data) {
|
|
172
|
+
const body = typeof data === "string" ? { status: data } : data;
|
|
173
|
+
return this.http.patch(`orders/${orderId}/fulfillments/${fulfillmentId}`, body);
|
|
170
174
|
}
|
|
171
175
|
};
|
|
172
176
|
//#endregion
|
|
@@ -227,12 +231,31 @@ var ShippingResource = class {
|
|
|
227
231
|
}
|
|
228
232
|
};
|
|
229
233
|
//#endregion
|
|
234
|
+
//#region src/commerce/taxClasses.ts
|
|
235
|
+
var TaxClassesResource = class {
|
|
236
|
+
constructor(http) {
|
|
237
|
+
this.http = http;
|
|
238
|
+
}
|
|
239
|
+
list(team) {
|
|
240
|
+
return this.http.get(`teams/${team}/tax-classes`);
|
|
241
|
+
}
|
|
242
|
+
create(team, data) {
|
|
243
|
+
return this.http.post(`teams/${team}/tax-classes`, data);
|
|
244
|
+
}
|
|
245
|
+
update(team, taxClassId, data) {
|
|
246
|
+
return this.http.patch(`teams/${team}/tax-classes/${taxClassId}`, data);
|
|
247
|
+
}
|
|
248
|
+
delete(team, taxClassId) {
|
|
249
|
+
return this.http.delete(`teams/${team}/tax-classes/${taxClassId}`);
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
//#endregion
|
|
230
253
|
//#region src/commerce/guest.ts
|
|
231
254
|
const orderAccessPrefix = "joai:order-access:";
|
|
232
255
|
const checkoutKey = (namespace) => `joai:guest-checkout:${namespace}`;
|
|
233
256
|
const ordersKey = (namespace) => `joai:guest-orders:${namespace}`;
|
|
234
257
|
const orderAccessKey = (namespace, orderId) => `${orderAccessPrefix}${namespace}:${orderId}`;
|
|
235
|
-
const safeGet = (key) => {
|
|
258
|
+
const safeGet$1 = (key) => {
|
|
236
259
|
if (typeof localStorage === "undefined") return null;
|
|
237
260
|
try {
|
|
238
261
|
return localStorage.getItem(key);
|
|
@@ -240,13 +263,13 @@ const safeGet = (key) => {
|
|
|
240
263
|
return null;
|
|
241
264
|
}
|
|
242
265
|
};
|
|
243
|
-
const safeSet = (key, value) => {
|
|
266
|
+
const safeSet$1 = (key, value) => {
|
|
244
267
|
if (typeof localStorage === "undefined") return;
|
|
245
268
|
try {
|
|
246
269
|
localStorage.setItem(key, value);
|
|
247
270
|
} catch {}
|
|
248
271
|
};
|
|
249
|
-
const safeRemove = (key) => {
|
|
272
|
+
const safeRemove$1 = (key) => {
|
|
250
273
|
if (typeof localStorage === "undefined") return;
|
|
251
274
|
try {
|
|
252
275
|
localStorage.removeItem(key);
|
|
@@ -264,7 +287,7 @@ const parseGuestOrderAccess = (entry) => {
|
|
|
264
287
|
};
|
|
265
288
|
const readOrderList = (namespace) => {
|
|
266
289
|
try {
|
|
267
|
-
const saved = JSON.parse(safeGet(ordersKey(namespace)) || "[]");
|
|
290
|
+
const saved = JSON.parse(safeGet$1(ordersKey(namespace)) || "[]");
|
|
268
291
|
if (!Array.isArray(saved)) return [];
|
|
269
292
|
return saved.map(parseGuestOrderAccess).filter((entry) => entry !== null);
|
|
270
293
|
} catch {
|
|
@@ -307,11 +330,11 @@ function createGuestCommerceStorage(options) {
|
|
|
307
330
|
const maxOrders = options.maxOrders ?? 10;
|
|
308
331
|
const storage = {
|
|
309
332
|
saveCheckoutDraft(draft) {
|
|
310
|
-
safeSet(checkoutKey(options.namespace), JSON.stringify(draft));
|
|
333
|
+
safeSet$1(checkoutKey(options.namespace), JSON.stringify(draft));
|
|
311
334
|
},
|
|
312
335
|
readCheckoutDraft(fallback) {
|
|
313
336
|
try {
|
|
314
|
-
const saved = JSON.parse(safeGet(checkoutKey(options.namespace)) || "");
|
|
337
|
+
const saved = JSON.parse(safeGet$1(checkoutKey(options.namespace)) || "");
|
|
315
338
|
return {
|
|
316
339
|
...fallback,
|
|
317
340
|
...saved,
|
|
@@ -323,24 +346,24 @@ function createGuestCommerceStorage(options) {
|
|
|
323
346
|
},
|
|
324
347
|
saveOrderAccess({ orderId, accessToken }) {
|
|
325
348
|
const key = orderAccessKey(options.namespace, orderId);
|
|
326
|
-
const resolvedToken = accessToken || safeGet(key);
|
|
327
|
-
if (resolvedToken) safeSet(key, resolvedToken);
|
|
349
|
+
const resolvedToken = accessToken || safeGet$1(key);
|
|
350
|
+
if (resolvedToken) safeSet$1(key, resolvedToken);
|
|
328
351
|
const orders = readOrderList(options.namespace).filter((entry) => entry.orderId !== orderId);
|
|
329
352
|
orders.unshift({
|
|
330
353
|
orderId,
|
|
331
354
|
accessToken: resolvedToken
|
|
332
355
|
});
|
|
333
356
|
const kept = orders.slice(0, maxOrders);
|
|
334
|
-
for (const dropped of orders.slice(maxOrders)) safeRemove(orderAccessKey(options.namespace, dropped.orderId));
|
|
335
|
-
safeSet(ordersKey(options.namespace), JSON.stringify(kept));
|
|
357
|
+
for (const dropped of orders.slice(maxOrders)) safeRemove$1(orderAccessKey(options.namespace, dropped.orderId));
|
|
358
|
+
safeSet$1(ordersKey(options.namespace), JSON.stringify(kept));
|
|
336
359
|
},
|
|
337
360
|
readOrderAccess(orderId) {
|
|
338
|
-
return safeGet(orderAccessKey(options.namespace, orderId));
|
|
361
|
+
return safeGet$1(orderAccessKey(options.namespace, orderId));
|
|
339
362
|
},
|
|
340
363
|
listOrderAccess() {
|
|
341
364
|
return readOrderList(options.namespace).map((entry) => ({
|
|
342
365
|
orderId: entry.orderId,
|
|
343
|
-
accessToken: entry.accessToken || safeGet(orderAccessKey(options.namespace, entry.orderId))
|
|
366
|
+
accessToken: entry.accessToken || safeGet$1(orderAccessKey(options.namespace, entry.orderId))
|
|
344
367
|
}));
|
|
345
368
|
},
|
|
346
369
|
/** Absolute shop URL from a path or full URL (e.g. orders page). */
|
|
@@ -364,6 +387,71 @@ function createGuestCommerceStorage(options) {
|
|
|
364
387
|
return storage;
|
|
365
388
|
}
|
|
366
389
|
//#endregion
|
|
390
|
+
//#region src/commerce/recentlyViewed.ts
|
|
391
|
+
const DEFAULT_MAX_ITEMS = 12;
|
|
392
|
+
const storageKey = (namespace) => `joai:recently-viewed:${namespace}`;
|
|
393
|
+
const safeGet = (key) => {
|
|
394
|
+
if (typeof localStorage === "undefined") return null;
|
|
395
|
+
try {
|
|
396
|
+
return localStorage.getItem(key);
|
|
397
|
+
} catch {
|
|
398
|
+
return null;
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
const safeSet = (key, value) => {
|
|
402
|
+
if (typeof localStorage === "undefined") return;
|
|
403
|
+
try {
|
|
404
|
+
localStorage.setItem(key, value);
|
|
405
|
+
} catch {}
|
|
406
|
+
};
|
|
407
|
+
const safeRemove = (key) => {
|
|
408
|
+
if (typeof localStorage === "undefined") return;
|
|
409
|
+
try {
|
|
410
|
+
localStorage.removeItem(key);
|
|
411
|
+
} catch {}
|
|
412
|
+
};
|
|
413
|
+
const parseSlugs = (raw) => {
|
|
414
|
+
if (!raw) return [];
|
|
415
|
+
try {
|
|
416
|
+
const parsed = JSON.parse(raw);
|
|
417
|
+
if (!Array.isArray(parsed)) return [];
|
|
418
|
+
return parsed.filter((item) => typeof item === "string" && item.length > 0);
|
|
419
|
+
} catch {
|
|
420
|
+
return [];
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
/**
|
|
424
|
+
* Persist recently viewed product slugs in localStorage (no PII).
|
|
425
|
+
* Newest first; duplicates move to the front; capped by maxItems.
|
|
426
|
+
*/
|
|
427
|
+
function createRecentlyViewedStorage(options) {
|
|
428
|
+
const key = storageKey(options.namespace);
|
|
429
|
+
const maxItems = options.maxItems ?? DEFAULT_MAX_ITEMS;
|
|
430
|
+
return {
|
|
431
|
+
track(slug) {
|
|
432
|
+
const normalized = slug.trim();
|
|
433
|
+
if (!normalized) return;
|
|
434
|
+
const updated = [normalized, ...parseSlugs(safeGet(key)).filter((item) => item !== normalized)].slice(0, maxItems);
|
|
435
|
+
safeSet(key, JSON.stringify(updated));
|
|
436
|
+
},
|
|
437
|
+
getSlugs() {
|
|
438
|
+
return parseSlugs(safeGet(key));
|
|
439
|
+
},
|
|
440
|
+
clear() {
|
|
441
|
+
safeRemove(key);
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
function trackRecentlyViewed(namespace, slug, maxItems) {
|
|
446
|
+
createRecentlyViewedStorage({
|
|
447
|
+
namespace,
|
|
448
|
+
maxItems
|
|
449
|
+
}).track(slug);
|
|
450
|
+
}
|
|
451
|
+
function getRecentlyViewedSlugs(namespace) {
|
|
452
|
+
return createRecentlyViewedStorage({ namespace }).getSlugs();
|
|
453
|
+
}
|
|
454
|
+
//#endregion
|
|
367
455
|
//#region src/commerce/guestCheckout.ts
|
|
368
456
|
var GuestCheckoutError = class extends Error {
|
|
369
457
|
constructor(code) {
|
|
@@ -518,7 +606,11 @@ async function placeGuestCheckoutOrder(options) {
|
|
|
518
606
|
serviceSlug: options.serviceSlug,
|
|
519
607
|
sendConfirmation: true
|
|
520
608
|
});
|
|
521
|
-
if (!order.ok || !order.data?.id)
|
|
609
|
+
if (!order.ok || !order.data?.id) {
|
|
610
|
+
const validationMessage = firstValidationMessage(order.errors);
|
|
611
|
+
if (validationMessage) throw new Error(validationMessage);
|
|
612
|
+
throw new GuestCheckoutError("order_failed");
|
|
613
|
+
}
|
|
522
614
|
const accessToken = typeof order.meta?.orderAccessToken === "string" ? order.meta.orderAccessToken : null;
|
|
523
615
|
if (options.pay === false) return {
|
|
524
616
|
order: order.data,
|
|
@@ -553,12 +645,7 @@ var GuestCouponError = class extends Error {
|
|
|
553
645
|
}
|
|
554
646
|
};
|
|
555
647
|
/** First `couponCode` validation message from an API error payload. */
|
|
556
|
-
const guestCouponMessageFromErrors = (errors) =>
|
|
557
|
-
if (!errors || typeof errors !== "object" || Array.isArray(errors)) return void 0;
|
|
558
|
-
const couponError = errors.couponCode;
|
|
559
|
-
if (Array.isArray(couponError) && typeof couponError[0] === "string") return couponError[0];
|
|
560
|
-
if (typeof couponError === "string") return couponError;
|
|
561
|
-
};
|
|
648
|
+
const guestCouponMessageFromErrors = (errors) => validationMessageFor(errors, "couponCode");
|
|
562
649
|
const isGuestCouponError = (error) => {
|
|
563
650
|
if (error instanceof GuestCouponError) return true;
|
|
564
651
|
return typeof error === "object" && error !== null && error.name === "GuestCouponError" && typeof error.code === "string";
|
|
@@ -628,13 +715,16 @@ async function revalidateGuestCoupon(options) {
|
|
|
628
715
|
}
|
|
629
716
|
//#endregion
|
|
630
717
|
//#region src/commerce/pickupSlotLabel.ts
|
|
718
|
+
/** Formats a pickup slot in a locale-aware 24h label. Pass timeZone when the meeting/policy provides one. */
|
|
631
719
|
const formatPickupSlotLabel = (iso, locale, timeZone) => new Intl.DateTimeFormat(locale, {
|
|
632
|
-
timeZone,
|
|
720
|
+
...timeZone ? { timeZone } : {},
|
|
633
721
|
weekday: "short",
|
|
634
|
-
day: "
|
|
635
|
-
month: "
|
|
722
|
+
day: "2-digit",
|
|
723
|
+
month: "2-digit",
|
|
724
|
+
year: "numeric",
|
|
636
725
|
hour: "2-digit",
|
|
637
|
-
minute: "2-digit"
|
|
726
|
+
minute: "2-digit",
|
|
727
|
+
hourCycle: "h23"
|
|
638
728
|
}).format(new Date(iso));
|
|
639
729
|
//#endregion
|
|
640
730
|
//#region src/commerce/index.ts
|
|
@@ -642,6 +732,7 @@ var CommerceResource = class {
|
|
|
642
732
|
constructor(http) {
|
|
643
733
|
this.checkout = new CheckoutResource(http);
|
|
644
734
|
this.shipping = new ShippingResource(http);
|
|
735
|
+
this.taxClasses = new TaxClassesResource(http);
|
|
645
736
|
this.fulfillments = new FulfillmentsResource(http);
|
|
646
737
|
this.returns = new ReturnsResource(http);
|
|
647
738
|
}
|
|
@@ -1012,8 +1103,8 @@ var BillingResource = class {
|
|
|
1012
1103
|
checkoutProduct(id) {
|
|
1013
1104
|
return this.http.get(`products/${id}`);
|
|
1014
1105
|
}
|
|
1015
|
-
orders(team, page = 1, filters = {}) {
|
|
1016
|
-
let params = `orders?page=${page}`;
|
|
1106
|
+
orders(team, page = 1, filters = {}, perPage = 10) {
|
|
1107
|
+
let params = `orders?page=${page}&perPage=${perPage}`;
|
|
1017
1108
|
if (filters.contactId) params += `&contactId=${encodeURIComponent(filters.contactId)}`;
|
|
1018
1109
|
if (filters.couponId) params += `&couponId=${encodeURIComponent(filters.couponId)}`;
|
|
1019
1110
|
return this.http.get(params, team ? { headers: { "X-Team": team.slug } } : void 0);
|
|
@@ -1365,8 +1456,9 @@ var DocumentsResource = class {
|
|
|
1365
1456
|
get(id) {
|
|
1366
1457
|
return this.http.get(`documents/${id}`);
|
|
1367
1458
|
}
|
|
1368
|
-
getShared(slug) {
|
|
1369
|
-
|
|
1459
|
+
getShared(slug, password) {
|
|
1460
|
+
const query = password ? `?password=${encodeURIComponent(password)}` : "";
|
|
1461
|
+
return this.http.get(`documents/shared/${encodeURIComponent(slug)}${query}`);
|
|
1370
1462
|
}
|
|
1371
1463
|
update(id, data) {
|
|
1372
1464
|
return this.http.put(`documents/${id}`, data);
|
|
@@ -2062,8 +2154,8 @@ var OrdersResource = class {
|
|
|
2062
2154
|
constructor(http) {
|
|
2063
2155
|
this.http = http;
|
|
2064
2156
|
}
|
|
2065
|
-
list(team) {
|
|
2066
|
-
return this.http.get(
|
|
2157
|
+
list(team, page = 1, perPage = 10) {
|
|
2158
|
+
return this.http.get(`orders?page=${page}&perPage=${perPage}`, { headers: { "X-Team": team } });
|
|
2067
2159
|
}
|
|
2068
2160
|
get(id, accessToken) {
|
|
2069
2161
|
return this.http.get(`orders/${id}`, orderAccessHeaders(accessToken));
|
|
@@ -2083,6 +2175,9 @@ var OrdersResource = class {
|
|
|
2083
2175
|
pay(id, provider, accessToken) {
|
|
2084
2176
|
return this.http.post(`orders/${id}/pay`, { ...provider ? { provider } : {} }, orderAccessHeaders(accessToken));
|
|
2085
2177
|
}
|
|
2178
|
+
reorder(id) {
|
|
2179
|
+
return this.http.post(`orders/${id}/reorder`);
|
|
2180
|
+
}
|
|
2086
2181
|
notify(id, type = "confirmation", agentId) {
|
|
2087
2182
|
return this.http.post(`orders/${id}/notify`, {
|
|
2088
2183
|
type,
|
|
@@ -3561,4 +3656,4 @@ var DistributionResource = class {
|
|
|
3561
3656
|
}
|
|
3562
3657
|
};
|
|
3563
3658
|
//#endregion
|
|
3564
|
-
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, TeamsResource, UpdatesResource, UpgradesResource, UsersResource, VoiceResource, WalletsResource, WarpsResource, WorkspaceResource, assertGuestCheckoutReady, assertGuestPickupSlotReady, buildGuestCheckoutSnapshotRequest, buildGuestOrderReturnUrl, completePortalSession, createClient, createEmptyGuestCheckoutState, createGuestCheckoutSnapshot, createGuestCommerceStorage, formatOpeningHours, formatPickupSlotLabel, getAuthFragmentToken, guestCartAmounts, guestCouponMessageFromErrors, isAllowedRedirectUrl, isGuestCheckoutError, isGuestCouponError, isPortalCallbackUrl, openPortalSession, placeGuestCheckoutOrder, readGuestOrderReturnAccess, revalidateGuestCoupon, sanitizePortalCallbackUrl, stripGuestOrderReturnToken, toGuestCheckoutDraft, validateGuestCoupon };
|
|
3659
|
+
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joai/sdk",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.8",
|
|
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.
|
|
38
|
+
"@joai/core": "^4.15.7",
|
|
39
39
|
"@joai/warps": "*"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@joai/core": "^4.15.
|
|
42
|
+
"@joai/core": "^4.15.7"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"tsdown": "^0.21.0",
|