@joai/core 0.16.0 → 0.17.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 +21 -4
- package/dist/react/index.d.mts +1 -0
- package/dist/react/index.mjs +29 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -294,7 +294,7 @@ type AppSubscription = {
|
|
|
294
294
|
updatedAt: string;
|
|
295
295
|
};
|
|
296
296
|
type PaymentProvider = 'xmoney' | 'lemonsqueezy' | 'stripe' | 'apple' | 'google' | 'blockchain' | 'offline';
|
|
297
|
-
type PlanFeature = 'general' | 'messages' | 'team-members' | 'teams' | 'support' | 'agent' | 'auto-mode' | 'cloud-sync' | 'wallet-cloud' | 'wallet-cloud-premium' | 'wallet-multi' | 'cards' | 'alerts' | 'advanced-commands' | 'tasks' | 'integrations' | 'message-history' | 'memory' | 'documents' | 'voice-input' | 'voice-live' | 'image-gen' | 'video-gen' | 'openclaw' | 'skills' | 'items' | 'context-length' | 'workspace-storage' | 'ingestions' | 'agent-email' | 'streak-freezes' | 'byok' | 'mcp' | 'phone-call' | 'phone-number' | 'custom-domain' | 'contacts' | 'links' | '
|
|
297
|
+
type PlanFeature = 'general' | 'messages' | 'team-members' | 'teams' | 'support' | 'agent' | 'auto-mode' | 'cloud-sync' | 'wallet-cloud' | 'wallet-cloud-premium' | 'wallet-multi' | 'cards' | 'alerts' | 'advanced-commands' | 'tasks' | 'integrations' | 'message-history' | 'memory' | 'documents' | 'voice-input' | 'voice-live' | 'image-gen' | 'video-gen' | 'openclaw' | 'skills' | 'items' | 'context-length' | 'workspace-storage' | 'ingestions' | 'agent-email' | 'streak-freezes' | 'byok' | 'mcp' | 'phone-call' | 'phone-number' | 'custom-domain' | 'contacts' | 'links' | 'store-fee-rate' | 'store-fee-rate-physical';
|
|
298
298
|
type PlanBenefit = {
|
|
299
299
|
label: Partial<Record<WarpLocale, string>>;
|
|
300
300
|
tip?: Partial<Record<WarpLocale, string>>;
|
|
@@ -517,6 +517,7 @@ type PurchaseOptions = {
|
|
|
517
517
|
};
|
|
518
518
|
//#endregion
|
|
519
519
|
//#region src/team/types.d.ts
|
|
520
|
+
type TeamFeature = 'shop' | 'appointments';
|
|
520
521
|
type TeamMember = User & {
|
|
521
522
|
role: UserRole | null;
|
|
522
523
|
roleAcceptedAt: string | null;
|
|
@@ -530,6 +531,8 @@ type Team = {
|
|
|
530
531
|
locale: WarpLocale;
|
|
531
532
|
timezone: string;
|
|
532
533
|
settings?: TeamSettings;
|
|
534
|
+
features?: TeamFeature[];
|
|
535
|
+
cover?: string | null;
|
|
533
536
|
logo: string | null;
|
|
534
537
|
tagline?: TranslatableValue | null;
|
|
535
538
|
public: boolean;
|
|
@@ -607,6 +610,7 @@ type TeamSettings = {
|
|
|
607
610
|
'board.auto.enabled'?: boolean;
|
|
608
611
|
'payments.online'?: boolean;
|
|
609
612
|
'payments.coupons'?: boolean;
|
|
613
|
+
'stock.enabled'?: boolean;
|
|
610
614
|
'branding'?: TeamBrand | null;
|
|
611
615
|
};
|
|
612
616
|
type TeamUsage = Partial<Record<PlanFeature, TeamFeatureUsage>> & {
|
|
@@ -1218,6 +1222,7 @@ type Alert = {
|
|
|
1218
1222
|
type ApiToken = {
|
|
1219
1223
|
id: number;
|
|
1220
1224
|
name: string;
|
|
1225
|
+
teams: Team[];
|
|
1221
1226
|
createdAt: string;
|
|
1222
1227
|
token?: string;
|
|
1223
1228
|
};
|
|
@@ -1230,7 +1235,6 @@ type Service = {
|
|
|
1230
1235
|
price: number;
|
|
1231
1236
|
durationMinutes: number;
|
|
1232
1237
|
tags?: string[] | null;
|
|
1233
|
-
category: string | null;
|
|
1234
1238
|
description: TranslatableValue | null;
|
|
1235
1239
|
active: boolean;
|
|
1236
1240
|
digital: boolean;
|
|
@@ -1277,7 +1281,7 @@ type AppointmentPolicy = {
|
|
|
1277
1281
|
holidays: string[] | null;
|
|
1278
1282
|
conferenceEnabled: boolean | null;
|
|
1279
1283
|
serviceSelectionEnabled?: boolean | null;
|
|
1280
|
-
|
|
1284
|
+
paymentEnabled?: boolean | null;
|
|
1281
1285
|
};
|
|
1282
1286
|
type AppointmentBookingContext = {
|
|
1283
1287
|
resolved: AppointmentPolicy | null;
|
|
@@ -2943,6 +2947,7 @@ type Update = {
|
|
|
2943
2947
|
title: string;
|
|
2944
2948
|
body: string | null;
|
|
2945
2949
|
imageUrl: string | null;
|
|
2950
|
+
media: Media[];
|
|
2946
2951
|
linkUrl: string | null;
|
|
2947
2952
|
startsAt: string | null;
|
|
2948
2953
|
endsAt: string | null;
|
|
@@ -2954,12 +2959,24 @@ type UpdateCreatePayload = {
|
|
|
2954
2959
|
type: UpdateType;
|
|
2955
2960
|
body?: string;
|
|
2956
2961
|
imageUrl?: string;
|
|
2962
|
+
media?: MediaLibraryItems;
|
|
2957
2963
|
linkUrl?: string;
|
|
2958
2964
|
startsAt?: string;
|
|
2959
2965
|
endsAt?: string;
|
|
2960
2966
|
status?: UpdateStatus;
|
|
2961
2967
|
};
|
|
2962
2968
|
type UpdateUpdatePayload = Partial<UpdateCreatePayload>;
|
|
2969
|
+
type UpdateStats = {
|
|
2970
|
+
totalUpdates: number;
|
|
2971
|
+
activeUpdates: number;
|
|
2972
|
+
dealsCount: number;
|
|
2973
|
+
eventsCount: number;
|
|
2974
|
+
newsCount: number;
|
|
2975
|
+
publishedCount: number;
|
|
2976
|
+
draftCount: number;
|
|
2977
|
+
archivedCount: number;
|
|
2978
|
+
creationHistory: number[];
|
|
2979
|
+
};
|
|
2963
2980
|
//#endregion
|
|
2964
2981
|
//#region src/swarm/types.d.ts
|
|
2965
2982
|
type Swarm = {
|
|
@@ -3137,4 +3154,4 @@ type CliSessionStatus = {
|
|
|
3137
3154
|
meta: CliSessionMeta | null;
|
|
3138
3155
|
};
|
|
3139
3156
|
//#endregion
|
|
3140
|
-
export { Achievement, Affiliate, AffiliateStatus, AffiliateTier, AffiliateTierName, Agent, AgentActionHistoryEntry, AgentCharacter, AgentDelegatable, AgentEngine, AgentExecuteHandler, AgentExecuteOptions, AgentGender, AgentMessageMeta, AgentMessageOptions, AgentPrivate, AgentSettings, AgentSimple, AgentWalletMode, AgentWebhookWarp, AggregatedRoute, AiCostEntry, AiCostsResponse, AiCostsSummary, Alert, ApiToken, AppEnv, AppFile, AppFileType, AppIngestion, AppSubscription, AppointmentAvailability, AppointmentAvailabilityService, AppointmentAvailabilitySlot, AppointmentBooking, AppointmentBookingContext, AppointmentPolicy, AppointmentRequest, AppointmentSlot, BillingAddress, Blueprint, BlueprintOnboardingStep, BlueprintRedirect, BlueprintSettings, BlueprintShortcut, BlueprintTask, BlueprintTeam, BoardSummaryViewable, BookmarkEntry, BrandBackend, BrandIntegration, BrandIntegrationAction, BrandIntegrationProvider, BrandSearchHit, BrandSiteConfig, BrandSourceConfig, Budget, ByokProviderConfig, ByokProviderName, ByokProviders, CalendarProvider, CalendarStatus, Card, Cart, CartItem, Challenge, Challenges, ChangelogEntry, Character, ChatClientAction, ChatClientThought, ChatStreamData, ChatStreamEventType, CliSessionMeta, CliSessionStatus, Contact, ContactActivity, ContactActivityAuthor, ContactFormData, ContactViewable, Contract, ContractCategoryDisplayNames, ContractCategoryName, ContractCodeMetadata, ContractEntity, ContractOnNetwork, ContractVersion, ContractsAddressConfig, CortexExecuteOptions, Coupon, DefaultCodeMetadata, DemoFlow, DemoMessage, Desk, DeskItem, DeskItemRole, Document, Earning, Element, ElementSpec, ElementType, ElementVariation, EmailProvider, EmbedStatus, EncryptionStatus, Entity, EntityDirectExecuteRequest, EntityProposable, EntitySignable, EntityTemplate, Experience, FileInfo, FileMetadata, Flow, FlowCategory, FlowInputMapping, FlowStatus, FlowStep, GamificationData, GamificationEventType, Goal, GoalCreatePayload, GoalPriority, GoalProgressViewable, GoalStatus, HintOptions, HintPosition, HttpService, IAppResponse, IHttpService, IRequestOptions, IngestionSourceType, IngestionStatus, Inquiry, InquiryStatus, InquiryType, Integration, IntegrationDetails, IntegrationType, Intent, Item, ItemCreatePayload, ItemExecutionStatus, ItemPriority, ItemStatus, ItemUpdatePayload, ItemViewable, JoaiUrls, Kyc, KycStatus, Link, LinkCreatePayload, LinkStats, LinkUpdatePayload, LocalAgentWallet, MarketplaceAgent, MarketplaceCheckoutItem, MarketplaceData, MarketplaceEntityType, MarketplaceInfo, MarketplaceItem, MarketplaceListing, MarketplacePriceTier, MarketplacePricing, MarketplacePurchasable, MarketplacePurchaseResult, McpToolCall, McpToolCallBroadcast, McpToolCallStatus, Media, MediaAttributes, MediaItems, MediaLibraryAttributes, MediaLibraryItems, MediaMime, Meeting, MeetingConferenceProvider, MeetingFeature, MeetingJoinInfo, MeetingJoinTeam, MeetingParticipant, MeetingSessionState, MeetingSpeakerAssignment, MeetingStatus, MeetingTranscriptEntry, MeetingUsage, Memory, Message, MessageId, MessageRole, Milestone, MilestoneType, Mission, MissionBudget, MissionCreatePayload, MissionPlan, MissionPriority, MissionSchedule, MissionStatus, MissionViewable, MultimodalContent, MultimodalFile, Notification, NotificationAction, NotificationAgent, NotificationChannel, NotificationSetting, OG_IMAGE_CONFIG, OG_IMAGE_HEIGHT, OG_IMAGE_WIDTH, OfficeAgent, OfficeEntity, OfficeEntityKind, OfficeLiveOverrides, OfficeMember, OfficeSnapshot, OfficeStatus, OfficeStatusFilter, OfficeTypeFilter, OgImageColors, OgImageParams, OgImageType, Order, OrderConfigurationItem, OrderItem, OrderStatus, PaymentProvider, PayoutEntry, PeriodTypeLabels, PeriodTypeOptions, PermissionConfigType, PersonaQuestionable, Plan, PlanBenefit, PlanExtra, PlanFeature, PlanInterval, PolicyMethod, PolicySetting, PricingModel, Product, ProductConfiguration, ProductDiscount, ProductMeta, ProductPieces, ProductRating, ProductRelation, ProductRelationType, ProductVariation, ProductVariationMeta, ProductVariationType, Project, ProjectAspectRatio, ProjectAssembly, ProjectCaptionStyle, ProjectClipCandidate, ProjectClips, ProjectExport, ProjectExportAsset, ProjectExportResponse, ProjectImages, ProjectInputAssistIntent, ProjectInputAssistResponse, ProjectMutation, ProjectOutputPreset, ProjectOutputType, ProjectPlan, ProjectRender, ProjectRenderMode, ProjectSelectedClip, ProjectShot, ProjectSoundtrack, ProjectSourceMedia, ProjectStatus, ProjectStudioHistoryEntry, ProjectStudioQuestion, ProjectStudioResponse, ProjectStudioStage, ProjectStudioState, ProjectStudioSummary, ProjectStyleDirection, ProjectTranscript, ProjectTranscriptSegment, Proposal, ProposalAction, ProposalActionPayment, ProposalActionPaymentSerializable, ProposalActionSerializable, ProposalPollOption, ProposalStatus, PurchaseOptions, PurchaseResult, RampProvider, RampProviderInfo, Reactions, RecentExperience, Reminder, Room, RoomId, RoomKind, ScInfo, SchedulePreset, SecretAuthorizable, SecretSettable, SendableActivityUpdate, SendableAgentAction, SendableAgentMessage, SendableAgentThought, SendableMedia, SendableUserMessage, Service, Shortcut, Site, SiteAgent, SiteBrand, SiteRoute, SiteTeam, Skill, SkillMediaBindingRole, SkillMediaBindingRoleValue, SkillScope, SkillScopeValue, SkillType, SkillTypeValue, SocialAuthProvider, SocialBot, SocialPlatform, Store, StoreCreatePayload, StoreEntry, StoreEntryPayload, StoreEntryResult, StoreToggleResult, StoreVisibility, StoreWithEntries, Streak, SubscriptionInterval, SubscriptionPlan, SubscriptionStatus, Swarm, Task, Team, TeamBrand, TeamFeatureUsage, TeamMember, TeamPrivate, TeamSettings, TeamUsage, Tier, TierFeature, TierName, TranscriptEntry, TranscriptionCorrection, TranscriptionResponse, TranslatableValue, Update, UpdateCreatePayload, UpdateStatus, UpdateType, UpdateUpdatePayload, User, UserInterest, UserMode, UserPrivate, UserRole, UserSettings, UserSocialAccount, UserStats, VolumePrice, Wallet, WalletList, WarpApprovable, WarpBackend, WarpBackendCategory, WarpBackendStatus, WarpBatchItem, WarpBatchable, WarpCloudExecutable, WarpCreateable, WarpExecutable, WarpExtras, WarpExtrasFaq, WarpInputable, WarpScreenshotVariant, WarpSearchHit, WarpSelectable, WarpSelectableDetails, WarpSuggestion, WarpTestable, WarpViewable, Webhook, WebhookTriggerEvent, WorkspaceCloudFile, WorkspaceContext, WorkspaceInfo, WorkspaceSettings, XIntegrationStatus, abbreviateNumber, getAgentsBaseUrl, getApiBaseUrl, getAppBaseUrl, getAssetAppLogoUrl, getAssetChainLogoUrl, getAssetPartnerLogoUrl, getAssetTokenLogoUrl, getAssetWalletLogoUrl, getCortexBaseUrl, getDigestBaseUrl, getFormsBaseUrl, getMcpServerAgentUrl, getSiteUrl, getSitesRootDomain, getStoreBaseUrl, getWarpScreenshotUrl, isFileFormatAudio, isFileFormatImage, isFileFormatVideo, localize, ogImageUrl, resolveWarpText, sanitizeAlphanumeric, sanitizeNumeric, toCurrencyDisplay, toHexEncodedNonce, toNameInitials, toNftId, toPreviewText, withRetry };
|
|
3157
|
+
export { Achievement, Affiliate, AffiliateStatus, AffiliateTier, AffiliateTierName, Agent, AgentActionHistoryEntry, AgentCharacter, AgentDelegatable, AgentEngine, AgentExecuteHandler, AgentExecuteOptions, AgentGender, AgentMessageMeta, AgentMessageOptions, AgentPrivate, AgentSettings, AgentSimple, AgentWalletMode, AgentWebhookWarp, AggregatedRoute, AiCostEntry, AiCostsResponse, AiCostsSummary, Alert, ApiToken, AppEnv, AppFile, AppFileType, AppIngestion, AppSubscription, AppointmentAvailability, AppointmentAvailabilityService, AppointmentAvailabilitySlot, AppointmentBooking, AppointmentBookingContext, AppointmentPolicy, AppointmentRequest, AppointmentSlot, BillingAddress, Blueprint, BlueprintOnboardingStep, BlueprintRedirect, BlueprintSettings, BlueprintShortcut, BlueprintTask, BlueprintTeam, BoardSummaryViewable, BookmarkEntry, BrandBackend, BrandIntegration, BrandIntegrationAction, BrandIntegrationProvider, BrandSearchHit, BrandSiteConfig, BrandSourceConfig, Budget, ByokProviderConfig, ByokProviderName, ByokProviders, CalendarProvider, CalendarStatus, Card, Cart, CartItem, Challenge, Challenges, ChangelogEntry, Character, ChatClientAction, ChatClientThought, ChatStreamData, ChatStreamEventType, CliSessionMeta, CliSessionStatus, Contact, ContactActivity, ContactActivityAuthor, ContactFormData, ContactViewable, Contract, ContractCategoryDisplayNames, ContractCategoryName, ContractCodeMetadata, ContractEntity, ContractOnNetwork, ContractVersion, ContractsAddressConfig, CortexExecuteOptions, Coupon, DefaultCodeMetadata, DemoFlow, DemoMessage, Desk, DeskItem, DeskItemRole, Document, Earning, Element, ElementSpec, ElementType, ElementVariation, EmailProvider, EmbedStatus, EncryptionStatus, Entity, EntityDirectExecuteRequest, EntityProposable, EntitySignable, EntityTemplate, Experience, FileInfo, FileMetadata, Flow, FlowCategory, FlowInputMapping, FlowStatus, FlowStep, GamificationData, GamificationEventType, Goal, GoalCreatePayload, GoalPriority, GoalProgressViewable, GoalStatus, HintOptions, HintPosition, HttpService, IAppResponse, IHttpService, IRequestOptions, IngestionSourceType, IngestionStatus, Inquiry, InquiryStatus, InquiryType, Integration, IntegrationDetails, IntegrationType, Intent, Item, ItemCreatePayload, ItemExecutionStatus, ItemPriority, ItemStatus, ItemUpdatePayload, ItemViewable, JoaiUrls, Kyc, KycStatus, Link, LinkCreatePayload, LinkStats, LinkUpdatePayload, LocalAgentWallet, MarketplaceAgent, MarketplaceCheckoutItem, MarketplaceData, MarketplaceEntityType, MarketplaceInfo, MarketplaceItem, MarketplaceListing, MarketplacePriceTier, MarketplacePricing, MarketplacePurchasable, MarketplacePurchaseResult, McpToolCall, McpToolCallBroadcast, McpToolCallStatus, Media, MediaAttributes, MediaItems, MediaLibraryAttributes, MediaLibraryItems, MediaMime, Meeting, MeetingConferenceProvider, MeetingFeature, MeetingJoinInfo, MeetingJoinTeam, MeetingParticipant, MeetingSessionState, MeetingSpeakerAssignment, MeetingStatus, MeetingTranscriptEntry, MeetingUsage, Memory, Message, MessageId, MessageRole, Milestone, MilestoneType, Mission, MissionBudget, MissionCreatePayload, MissionPlan, MissionPriority, MissionSchedule, MissionStatus, MissionViewable, MultimodalContent, MultimodalFile, Notification, NotificationAction, NotificationAgent, NotificationChannel, NotificationSetting, OG_IMAGE_CONFIG, OG_IMAGE_HEIGHT, OG_IMAGE_WIDTH, OfficeAgent, OfficeEntity, OfficeEntityKind, OfficeLiveOverrides, OfficeMember, OfficeSnapshot, OfficeStatus, OfficeStatusFilter, OfficeTypeFilter, OgImageColors, OgImageParams, OgImageType, Order, OrderConfigurationItem, OrderItem, OrderStatus, PaymentProvider, PayoutEntry, PeriodTypeLabels, PeriodTypeOptions, PermissionConfigType, PersonaQuestionable, Plan, PlanBenefit, PlanExtra, PlanFeature, PlanInterval, PolicyMethod, PolicySetting, PricingModel, Product, ProductConfiguration, ProductDiscount, ProductMeta, ProductPieces, ProductRating, ProductRelation, ProductRelationType, ProductVariation, ProductVariationMeta, ProductVariationType, Project, ProjectAspectRatio, ProjectAssembly, ProjectCaptionStyle, ProjectClipCandidate, ProjectClips, ProjectExport, ProjectExportAsset, ProjectExportResponse, ProjectImages, ProjectInputAssistIntent, ProjectInputAssistResponse, ProjectMutation, ProjectOutputPreset, ProjectOutputType, ProjectPlan, ProjectRender, ProjectRenderMode, ProjectSelectedClip, ProjectShot, ProjectSoundtrack, ProjectSourceMedia, ProjectStatus, ProjectStudioHistoryEntry, ProjectStudioQuestion, ProjectStudioResponse, ProjectStudioStage, ProjectStudioState, ProjectStudioSummary, ProjectStyleDirection, ProjectTranscript, ProjectTranscriptSegment, Proposal, ProposalAction, ProposalActionPayment, ProposalActionPaymentSerializable, ProposalActionSerializable, ProposalPollOption, ProposalStatus, PurchaseOptions, PurchaseResult, RampProvider, RampProviderInfo, Reactions, RecentExperience, Reminder, Room, RoomId, RoomKind, ScInfo, SchedulePreset, SecretAuthorizable, SecretSettable, SendableActivityUpdate, SendableAgentAction, SendableAgentMessage, SendableAgentThought, SendableMedia, SendableUserMessage, Service, Shortcut, Site, SiteAgent, SiteBrand, SiteRoute, SiteTeam, Skill, SkillMediaBindingRole, SkillMediaBindingRoleValue, SkillScope, SkillScopeValue, SkillType, SkillTypeValue, SocialAuthProvider, SocialBot, SocialPlatform, Store, StoreCreatePayload, StoreEntry, StoreEntryPayload, StoreEntryResult, StoreToggleResult, StoreVisibility, StoreWithEntries, Streak, SubscriptionInterval, SubscriptionPlan, SubscriptionStatus, Swarm, Task, Team, TeamBrand, TeamFeature, TeamFeatureUsage, TeamMember, TeamPrivate, TeamSettings, TeamUsage, Tier, TierFeature, TierName, TranscriptEntry, TranscriptionCorrection, TranscriptionResponse, TranslatableValue, Update, UpdateCreatePayload, UpdateStats, UpdateStatus, UpdateType, UpdateUpdatePayload, User, UserInterest, UserMode, UserPrivate, UserRole, UserSettings, UserSocialAccount, UserStats, VolumePrice, Wallet, WalletList, WarpApprovable, WarpBackend, WarpBackendCategory, WarpBackendStatus, WarpBatchItem, WarpBatchable, WarpCloudExecutable, WarpCreateable, WarpExecutable, WarpExtras, WarpExtrasFaq, WarpInputable, WarpScreenshotVariant, WarpSearchHit, WarpSelectable, WarpSelectableDetails, WarpSuggestion, WarpTestable, WarpViewable, Webhook, WebhookTriggerEvent, WorkspaceCloudFile, WorkspaceContext, WorkspaceInfo, WorkspaceSettings, XIntegrationStatus, abbreviateNumber, getAgentsBaseUrl, getApiBaseUrl, getAppBaseUrl, getAssetAppLogoUrl, getAssetChainLogoUrl, getAssetPartnerLogoUrl, getAssetTokenLogoUrl, getAssetWalletLogoUrl, getCortexBaseUrl, getDigestBaseUrl, getFormsBaseUrl, getMcpServerAgentUrl, getSiteUrl, getSitesRootDomain, getStoreBaseUrl, getWarpScreenshotUrl, isFileFormatAudio, isFileFormatImage, isFileFormatVideo, localize, ogImageUrl, resolveWarpText, sanitizeAlphanumeric, sanitizeNumeric, toCurrencyDisplay, toHexEncodedNonce, toNameInitials, toNftId, toPreviewText, withRetry };
|
package/dist/react/index.d.mts
CHANGED
|
@@ -98,6 +98,7 @@ declare function useEmbedChat({
|
|
|
98
98
|
roomId: string | null;
|
|
99
99
|
setRoomId: react.Dispatch<react.SetStateAction<string | null>>;
|
|
100
100
|
send: (message: string) => Promise<void>;
|
|
101
|
+
connectionError: boolean;
|
|
101
102
|
};
|
|
102
103
|
//#endregion
|
|
103
104
|
export { EmbedChatInput, EmbedChatItem, EmbedChatList, StreamDataHandler, clearRoom, getOrCreateGuestId, loadRoom, openEventSourceStream, saveRoom, useEmbedChat };
|
package/dist/react/index.mjs
CHANGED
|
@@ -159,18 +159,22 @@ function EmbedChatInput({ onSend, disabled, placeholder = "Type a message...", m
|
|
|
159
159
|
}
|
|
160
160
|
//#endregion
|
|
161
161
|
//#region src/react/use-embed-chat.ts
|
|
162
|
+
const RESPONSE_TIMEOUT_MS = 3e4;
|
|
162
163
|
function useEmbedChat({ agentUuid, http, cortexBaseUrl, guestId, roomStorageKey, enabled = true, extraPayload }) {
|
|
163
164
|
const [items, setItems] = useState([]);
|
|
164
165
|
const [sending, setSending] = useState(false);
|
|
165
166
|
const [awaitingResponse, setAwaitingResponse] = useState(false);
|
|
166
167
|
const [roomId, setRoomId] = useState(null);
|
|
168
|
+
const [connectionError, setConnectionError] = useState(false);
|
|
167
169
|
const roomIdRef = useRef(null);
|
|
168
170
|
roomIdRef.current = roomId;
|
|
169
171
|
const extraPayloadRef = useRef(extraPayload);
|
|
170
172
|
extraPayloadRef.current = extraPayload;
|
|
171
173
|
useEffect(() => {
|
|
172
174
|
if (!roomId) return;
|
|
175
|
+
setConnectionError(false);
|
|
173
176
|
return openEventSourceStream(`${cortexBaseUrl}/agents/stream/${roomId}`, (raw) => {
|
|
177
|
+
setConnectionError(false);
|
|
174
178
|
const data = raw;
|
|
175
179
|
if (data.type === "response:chunk") {
|
|
176
180
|
setAwaitingResponse(false);
|
|
@@ -206,12 +210,27 @@ function useEmbedChat({ agentUuid, http, cortexBaseUrl, guestId, roomStorageKey,
|
|
|
206
210
|
});
|
|
207
211
|
return updated;
|
|
208
212
|
});
|
|
209
|
-
} else if (data.type === "complete")
|
|
210
|
-
|
|
211
|
-
streaming
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
} else if (data.type === "complete") {
|
|
214
|
+
setAwaitingResponse(false);
|
|
215
|
+
setItems((prev) => prev.map((item) => item.streaming ? {
|
|
216
|
+
...item,
|
|
217
|
+
streaming: false
|
|
218
|
+
} : item));
|
|
219
|
+
}
|
|
220
|
+
}, { onConnectionError: () => setConnectionError(true) });
|
|
214
221
|
}, [roomId, cortexBaseUrl]);
|
|
222
|
+
useEffect(() => {
|
|
223
|
+
if (!awaitingResponse) return;
|
|
224
|
+
const timer = setTimeout(() => {
|
|
225
|
+
setAwaitingResponse(false);
|
|
226
|
+
setItems((prev) => [...prev, {
|
|
227
|
+
content: "Response timed out. Please try again.",
|
|
228
|
+
byUser: false,
|
|
229
|
+
error: true
|
|
230
|
+
}]);
|
|
231
|
+
}, RESPONSE_TIMEOUT_MS);
|
|
232
|
+
return () => clearTimeout(timer);
|
|
233
|
+
}, [awaitingResponse]);
|
|
215
234
|
return {
|
|
216
235
|
items,
|
|
217
236
|
setItems,
|
|
@@ -226,6 +245,7 @@ function useEmbedChat({ agentUuid, http, cortexBaseUrl, guestId, roomStorageKey,
|
|
|
226
245
|
byUser: true
|
|
227
246
|
}]);
|
|
228
247
|
setSending(true);
|
|
248
|
+
setConnectionError(false);
|
|
229
249
|
try {
|
|
230
250
|
const res = await http.post(`integrations/embed/${agentUuid}/execute`, {
|
|
231
251
|
message,
|
|
@@ -233,8 +253,9 @@ function useEmbedChat({ agentUuid, http, cortexBaseUrl, guestId, roomStorageKey,
|
|
|
233
253
|
...extraPayloadRef.current
|
|
234
254
|
});
|
|
235
255
|
if (!res.ok) {
|
|
256
|
+
const msg = res.data && typeof res.data === "object" && "message" in res.data ? res.data.message : "Something went wrong. Please try again.";
|
|
236
257
|
setItems((prev) => [...prev, {
|
|
237
|
-
content:
|
|
258
|
+
content: msg,
|
|
238
259
|
byUser: false,
|
|
239
260
|
error: true
|
|
240
261
|
}]);
|
|
@@ -262,7 +283,8 @@ function useEmbedChat({ agentUuid, http, cortexBaseUrl, guestId, roomStorageKey,
|
|
|
262
283
|
http,
|
|
263
284
|
guestId,
|
|
264
285
|
roomStorageKey
|
|
265
|
-
])
|
|
286
|
+
]),
|
|
287
|
+
connectionError
|
|
266
288
|
};
|
|
267
289
|
}
|
|
268
290
|
//#endregion
|