@joai/sdk 7.0.7 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +38 -3
- package/dist/index.mjs +84 -15
- 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, 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, 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";
|
|
3
3
|
import { WarpChainName, WarpClient, WarpLocale, WarpText, WarpWalletProvider } from "@joai/warps";
|
|
4
4
|
|
|
5
5
|
//#region src/resources/agents.d.ts
|
|
@@ -249,6 +249,24 @@ declare function createGuestCommerceStorage(options: GuestCommerceStorageOptions
|
|
|
249
249
|
claimOrderReturn(): GuestOrderAccess | null;
|
|
250
250
|
};
|
|
251
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
|
|
252
270
|
//#region src/commerce/guestCheckout.d.ts
|
|
253
271
|
type GuestCheckoutCartItem = {
|
|
254
272
|
id: string;
|
|
@@ -1289,7 +1307,7 @@ declare class MeetingsResource {
|
|
|
1289
1307
|
get(id: string): Promise<_$_joai_core0.IAppResponse<Meeting>>;
|
|
1290
1308
|
getSummary(id: string): Promise<_$_joai_core0.IAppResponse<MeetingSummary>>;
|
|
1291
1309
|
join(code: string): Promise<_$_joai_core0.IAppResponse<MeetingJoinInfo>>;
|
|
1292
|
-
cancel(code: string,
|
|
1310
|
+
cancel(code: string, options?: {
|
|
1293
1311
|
reason?: string;
|
|
1294
1312
|
}): Promise<_$_joai_core0.IAppResponse<Meeting>>;
|
|
1295
1313
|
share(id: string, recipients: {
|
|
@@ -1447,6 +1465,17 @@ declare class OrdersResource {
|
|
|
1447
1465
|
pay(id: string, provider?: PaymentProvider, accessToken?: string): Promise<_$_joai_core0.IAppResponse<{
|
|
1448
1466
|
url: string;
|
|
1449
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
|
+
}>>;
|
|
1450
1479
|
notify(id: string, type: string | undefined, agentId: string): Promise<_$_joai_core0.IAppResponse<{
|
|
1451
1480
|
message: string;
|
|
1452
1481
|
}>>;
|
|
@@ -1478,6 +1507,9 @@ declare class ProductsResource {
|
|
|
1478
1507
|
virtual?: boolean;
|
|
1479
1508
|
public?: boolean;
|
|
1480
1509
|
taxClassId?: string | null;
|
|
1510
|
+
meta?: {
|
|
1511
|
+
details?: ProductDetailSection[];
|
|
1512
|
+
};
|
|
1481
1513
|
}, teamSlug?: string): Promise<_$_joai_core0.IAppResponse<Product>>;
|
|
1482
1514
|
update(id: string, data: {
|
|
1483
1515
|
name?: TranslatableValue;
|
|
@@ -1485,6 +1517,9 @@ declare class ProductsResource {
|
|
|
1485
1517
|
tags?: string[] | null;
|
|
1486
1518
|
description?: TranslatableValue | null;
|
|
1487
1519
|
settings?: Record<string, unknown> | null;
|
|
1520
|
+
meta?: {
|
|
1521
|
+
details?: ProductDetailSection[];
|
|
1522
|
+
};
|
|
1488
1523
|
active?: boolean;
|
|
1489
1524
|
public?: boolean;
|
|
1490
1525
|
virtual?: boolean;
|
|
@@ -2388,4 +2423,4 @@ declare class DistributionResource {
|
|
|
2388
2423
|
private fetchDistribution;
|
|
2389
2424
|
}
|
|
2390
2425
|
//#endregion
|
|
2391
|
-
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 TaxClassInput, TaxClassesResource, 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 };
|
|
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 };
|
package/dist/index.mjs
CHANGED
|
@@ -255,7 +255,7 @@ const orderAccessPrefix = "joai:order-access:";
|
|
|
255
255
|
const checkoutKey = (namespace) => `joai:guest-checkout:${namespace}`;
|
|
256
256
|
const ordersKey = (namespace) => `joai:guest-orders:${namespace}`;
|
|
257
257
|
const orderAccessKey = (namespace, orderId) => `${orderAccessPrefix}${namespace}:${orderId}`;
|
|
258
|
-
const safeGet = (key) => {
|
|
258
|
+
const safeGet$1 = (key) => {
|
|
259
259
|
if (typeof localStorage === "undefined") return null;
|
|
260
260
|
try {
|
|
261
261
|
return localStorage.getItem(key);
|
|
@@ -263,13 +263,13 @@ const safeGet = (key) => {
|
|
|
263
263
|
return null;
|
|
264
264
|
}
|
|
265
265
|
};
|
|
266
|
-
const safeSet = (key, value) => {
|
|
266
|
+
const safeSet$1 = (key, value) => {
|
|
267
267
|
if (typeof localStorage === "undefined") return;
|
|
268
268
|
try {
|
|
269
269
|
localStorage.setItem(key, value);
|
|
270
270
|
} catch {}
|
|
271
271
|
};
|
|
272
|
-
const safeRemove = (key) => {
|
|
272
|
+
const safeRemove$1 = (key) => {
|
|
273
273
|
if (typeof localStorage === "undefined") return;
|
|
274
274
|
try {
|
|
275
275
|
localStorage.removeItem(key);
|
|
@@ -287,7 +287,7 @@ const parseGuestOrderAccess = (entry) => {
|
|
|
287
287
|
};
|
|
288
288
|
const readOrderList = (namespace) => {
|
|
289
289
|
try {
|
|
290
|
-
const saved = JSON.parse(safeGet(ordersKey(namespace)) || "[]");
|
|
290
|
+
const saved = JSON.parse(safeGet$1(ordersKey(namespace)) || "[]");
|
|
291
291
|
if (!Array.isArray(saved)) return [];
|
|
292
292
|
return saved.map(parseGuestOrderAccess).filter((entry) => entry !== null);
|
|
293
293
|
} catch {
|
|
@@ -330,11 +330,11 @@ function createGuestCommerceStorage(options) {
|
|
|
330
330
|
const maxOrders = options.maxOrders ?? 10;
|
|
331
331
|
const storage = {
|
|
332
332
|
saveCheckoutDraft(draft) {
|
|
333
|
-
safeSet(checkoutKey(options.namespace), JSON.stringify(draft));
|
|
333
|
+
safeSet$1(checkoutKey(options.namespace), JSON.stringify(draft));
|
|
334
334
|
},
|
|
335
335
|
readCheckoutDraft(fallback) {
|
|
336
336
|
try {
|
|
337
|
-
const saved = JSON.parse(safeGet(checkoutKey(options.namespace)) || "");
|
|
337
|
+
const saved = JSON.parse(safeGet$1(checkoutKey(options.namespace)) || "");
|
|
338
338
|
return {
|
|
339
339
|
...fallback,
|
|
340
340
|
...saved,
|
|
@@ -346,24 +346,24 @@ function createGuestCommerceStorage(options) {
|
|
|
346
346
|
},
|
|
347
347
|
saveOrderAccess({ orderId, accessToken }) {
|
|
348
348
|
const key = orderAccessKey(options.namespace, orderId);
|
|
349
|
-
const resolvedToken = accessToken || safeGet(key);
|
|
350
|
-
if (resolvedToken) safeSet(key, resolvedToken);
|
|
349
|
+
const resolvedToken = accessToken || safeGet$1(key);
|
|
350
|
+
if (resolvedToken) safeSet$1(key, resolvedToken);
|
|
351
351
|
const orders = readOrderList(options.namespace).filter((entry) => entry.orderId !== orderId);
|
|
352
352
|
orders.unshift({
|
|
353
353
|
orderId,
|
|
354
354
|
accessToken: resolvedToken
|
|
355
355
|
});
|
|
356
356
|
const kept = orders.slice(0, maxOrders);
|
|
357
|
-
for (const dropped of orders.slice(maxOrders)) safeRemove(orderAccessKey(options.namespace, dropped.orderId));
|
|
358
|
-
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));
|
|
359
359
|
},
|
|
360
360
|
readOrderAccess(orderId) {
|
|
361
|
-
return safeGet(orderAccessKey(options.namespace, orderId));
|
|
361
|
+
return safeGet$1(orderAccessKey(options.namespace, orderId));
|
|
362
362
|
},
|
|
363
363
|
listOrderAccess() {
|
|
364
364
|
return readOrderList(options.namespace).map((entry) => ({
|
|
365
365
|
orderId: entry.orderId,
|
|
366
|
-
accessToken: entry.accessToken || safeGet(orderAccessKey(options.namespace, entry.orderId))
|
|
366
|
+
accessToken: entry.accessToken || safeGet$1(orderAccessKey(options.namespace, entry.orderId))
|
|
367
367
|
}));
|
|
368
368
|
},
|
|
369
369
|
/** Absolute shop URL from a path or full URL (e.g. orders page). */
|
|
@@ -387,6 +387,71 @@ function createGuestCommerceStorage(options) {
|
|
|
387
387
|
return storage;
|
|
388
388
|
}
|
|
389
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
|
|
390
455
|
//#region src/commerce/guestCheckout.ts
|
|
391
456
|
var GuestCheckoutError = class extends Error {
|
|
392
457
|
constructor(code) {
|
|
@@ -1938,8 +2003,9 @@ var MeetingsResource = class {
|
|
|
1938
2003
|
join(code) {
|
|
1939
2004
|
return this.http.get(`meetings/join/${code}`);
|
|
1940
2005
|
}
|
|
1941
|
-
cancel(code,
|
|
1942
|
-
|
|
2006
|
+
cancel(code, options) {
|
|
2007
|
+
const body = options?.reason ? { reason: options.reason } : {};
|
|
2008
|
+
return this.http.post(`meetings/cancel/${code}`, body);
|
|
1943
2009
|
}
|
|
1944
2010
|
share(id, recipients) {
|
|
1945
2011
|
return this.http.post(`meetings/${id}/share`, { recipients });
|
|
@@ -2110,6 +2176,9 @@ var OrdersResource = class {
|
|
|
2110
2176
|
pay(id, provider, accessToken) {
|
|
2111
2177
|
return this.http.post(`orders/${id}/pay`, { ...provider ? { provider } : {} }, orderAccessHeaders(accessToken));
|
|
2112
2178
|
}
|
|
2179
|
+
reorder(id) {
|
|
2180
|
+
return this.http.post(`orders/${id}/reorder`);
|
|
2181
|
+
}
|
|
2113
2182
|
notify(id, type = "confirmation", agentId) {
|
|
2114
2183
|
return this.http.post(`orders/${id}/notify`, {
|
|
2115
2184
|
type,
|
|
@@ -3588,4 +3657,4 @@ var DistributionResource = class {
|
|
|
3588
3657
|
}
|
|
3589
3658
|
};
|
|
3590
3659
|
//#endregion
|
|
3591
|
-
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, formatOpeningHours, formatPickupSlotLabel, getAuthFragmentToken, guestCartAmounts, guestCouponMessageFromErrors, isAllowedRedirectUrl, isGuestCheckoutError, isGuestCouponError, isPortalCallbackUrl, openPortalSession, placeGuestCheckoutOrder, readGuestOrderReturnAccess, revalidateGuestCoupon, sanitizePortalCallbackUrl, stripGuestOrderReturnToken, toGuestCheckoutDraft, validateGuestCoupon };
|
|
3660
|
+
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": "
|
|
3
|
+
"version": "8.0.0",
|
|
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.
|
|
38
|
+
"@joai/core": "^4.16.0",
|
|
39
39
|
"@joai/warps": "*"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@joai/core": "^4.
|
|
42
|
+
"@joai/core": "^4.16.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"tsdown": "^0.21.0",
|