@adminide-stack/yantra-mobile 12.0.160 → 12.0.161-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/GatewayConnector/GatewayConnector.js +1 -1
- package/lib/components/GatewayConnector/GatewayConnector.js.map +1 -1
- package/lib/components/NavigationHeader/HeaderSkillsButton.js +1 -1
- package/lib/components/NavigationHeader/HeaderSkillsButton.js.map +1 -1
- package/lib/components/NavigationHeader/HeaderTasksButton.js +1 -1
- package/lib/components/NavigationHeader/HeaderTasksButton.js.map +1 -1
- package/lib/contexts/CdecliConnectionContext.js +2 -11
- package/lib/contexts/CdecliConnectionContext.js.map +1 -1
- package/lib/contexts/ChatLiveStreamContext.js +1 -1
- package/lib/contexts/ChatLiveStreamContext.js.map +1 -1
- package/lib/contexts/cdecliConnection.js +9 -0
- package/lib/contexts/cdecliConnection.js.map +1 -0
- package/lib/features/attachments/displayUserMessageText.js +3 -3
- package/lib/features/attachments/displayUserMessageText.js.map +1 -1
- package/lib/features/audio-input/AudioRecorderPanel.js +1 -1
- package/lib/features/audio-input/AudioRecorderPanel.js.map +1 -1
- package/lib/features/chat/ChatWidgetCard.js +3 -10
- package/lib/features/chat/ChatWidgetCard.js.map +1 -1
- package/lib/features/chat/TemplatesChatCards.js +1 -1
- package/lib/features/chat/TemplatesChatCards.js.map +1 -1
- package/lib/features/chat/chatWidgets.js +13 -52
- package/lib/features/chat/chatWidgets.js.map +1 -1
- package/lib/features/chat/hostTranscriptProtocol.js +82 -0
- package/lib/features/chat/hostTranscriptProtocol.js.map +1 -0
- package/lib/features/chat/transcriptProtocol.js +11 -0
- package/lib/features/chat/transcriptProtocol.js.map +1 -0
- package/lib/features/chat/useComputerAction.js +1 -1
- package/lib/features/chat/useComputerAction.js.map +1 -1
- package/lib/features/credits/FreeCreditsCard.js +94 -0
- package/lib/features/credits/FreeCreditsCard.js.map +1 -0
- package/lib/features/credits/freeCredits.js +92 -0
- package/lib/features/credits/freeCredits.js.map +1 -0
- package/lib/features/credits/useFreeCredits.js +47 -0
- package/lib/features/credits/useFreeCredits.js.map +1 -0
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/module.js +2 -1
- package/lib/module.js.map +1 -1
- package/lib/screens/Chat/index.js +30 -17
- package/lib/screens/Chat/index.js.map +1 -1
- package/lib/screens/ExpensesNative/useExpensesHostChat.js +1 -1
- package/lib/screens/Home/HomeScreen.js +18 -4
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/InboxNative/useInboxHostChat.js +1 -1
- package/lib/screens/JobSearchNative/useJobSearchHostChat.js +1 -1
- package/lib/screens/LocalServicesNative/useLocalServicesHostChat.js +1 -1
- package/lib/screens/MoviesNative/useMoviesHostChat.js +1 -1
- package/lib/screens/ResumeNative/useResumeHostChat.js +1 -1
- package/lib/screens/ShoppingNative/useShoppingHostChat.js +1 -1
- package/lib/screens/StudyNative/useStudyHostChat.js +1 -1
- package/lib/screens/TravelNative/useTravelHostChat.js +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {useApolloClient}from'@apollo/client/index.js';import {useState,useEffect,useCallback}from'react';import {fetchFreeCreditsStatus,claimFreeCredits,FREE_CREDITS_CLAIM_FAILED}from'./freeCredits.js';const claimListeners = /* @__PURE__ */ new Set();
|
|
2
|
+
function useFreeCredits(orgName) {
|
|
3
|
+
const client = useApolloClient();
|
|
4
|
+
const [status, setStatus] = useState(null);
|
|
5
|
+
const [claiming, setClaiming] = useState(false);
|
|
6
|
+
const [error, setError] = useState(null);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (!orgName) return void 0;
|
|
9
|
+
let live = true;
|
|
10
|
+
void fetchFreeCreditsStatus(client, orgName).then((next) => {
|
|
11
|
+
if (live) setStatus((current) => (current == null ? void 0 : current.unlocked) ? current : next);
|
|
12
|
+
});
|
|
13
|
+
return () => {
|
|
14
|
+
live = false;
|
|
15
|
+
};
|
|
16
|
+
}, [client, orgName]);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const onClaimed = (claimedOrg, next) => {
|
|
19
|
+
if (claimedOrg === orgName) setStatus(next);
|
|
20
|
+
};
|
|
21
|
+
claimListeners.add(onClaimed);
|
|
22
|
+
return () => {
|
|
23
|
+
claimListeners.delete(onClaimed);
|
|
24
|
+
};
|
|
25
|
+
}, [orgName]);
|
|
26
|
+
const claim = useCallback(async () => {
|
|
27
|
+
if (!orgName) return null;
|
|
28
|
+
setClaiming(true);
|
|
29
|
+
setError(null);
|
|
30
|
+
try {
|
|
31
|
+
const next = await claimFreeCredits(client, orgName);
|
|
32
|
+
claimListeners.forEach((listener) => listener(orgName, next));
|
|
33
|
+
return next;
|
|
34
|
+
} catch (err) {
|
|
35
|
+
setError(err instanceof Error ? err.message : FREE_CREDITS_CLAIM_FAILED);
|
|
36
|
+
return null;
|
|
37
|
+
} finally {
|
|
38
|
+
setClaiming(false);
|
|
39
|
+
}
|
|
40
|
+
}, [client, orgName]);
|
|
41
|
+
return {
|
|
42
|
+
status,
|
|
43
|
+
claiming,
|
|
44
|
+
error,
|
|
45
|
+
claim
|
|
46
|
+
};
|
|
47
|
+
}export{useFreeCredits};//# sourceMappingURL=useFreeCredits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFreeCredits.js","sources":["../../../src/features/credits/useFreeCredits.ts"],"sourcesContent":["import { useApolloClient } from '@apollo/client';\nimport { useCallback, useEffect, useState } from 'react';\nimport {\n claimFreeCredits,\n fetchFreeCreditsStatus,\n FREE_CREDITS_CLAIM_FAILED,\n type FreeCreditsStatus,\n} from './freeCredits';\n\nexport interface FreeCredits {\n /** Null until read, and when it cannot be read. */\n status: FreeCreditsStatus | null;\n claiming: boolean;\n /** The last claim's failure, in the server's words. */\n error: string | null;\n /** Claim the offer; resolves to the new status, or null when it failed (see `error`). */\n claim: () => Promise<FreeCreditsStatus | null>;\n}\n\ntype ClaimListener = (orgName: string, status: FreeCreditsStatus) => void;\n\n/** A claim in one surface updates the others (the web uses a `window` event for this). */\nconst claimListeners = new Set<ClaimListener>();\n\n/** The org's free-tier offer for one surface. Idle while `orgName` is empty. */\nexport function useFreeCredits(orgName?: string | null): FreeCredits {\n const client = useApolloClient();\n const [status, setStatus] = useState<FreeCreditsStatus | null>(null);\n const [claiming, setClaiming] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n if (!orgName) return undefined;\n let live = true;\n void fetchFreeCreditsStatus(client, orgName).then((next) => {\n // A read that started before a claim must not take the claim back.\n if (live) setStatus((current) => (current?.unlocked ? current : next));\n });\n return () => {\n live = false;\n };\n }, [client, orgName]);\n\n useEffect(() => {\n const onClaimed: ClaimListener = (claimedOrg, next) => {\n if (claimedOrg === orgName) setStatus(next);\n };\n claimListeners.add(onClaimed);\n return () => {\n claimListeners.delete(onClaimed);\n };\n }, [orgName]);\n\n const claim = useCallback(async () => {\n if (!orgName) return null;\n setClaiming(true);\n setError(null);\n try {\n const next = await claimFreeCredits(client, orgName);\n claimListeners.forEach((listener) => listener(orgName, next));\n return next;\n } catch (err) {\n setError(err instanceof Error ? err.message : FREE_CREDITS_CLAIM_FAILED);\n return null;\n } finally {\n setClaiming(false);\n }\n }, [client, orgName]);\n\n return { status, claiming, error, claim };\n}\n"],"names":[],"mappings":"0MAeA,MAAM,cAAA,uBAAqB,GAAmB,EAAA;AAGvC,SAAS,eAAe,OAAsC,EAAA;AACnE,EAAA,MAAM,SAAS,eAAgB,EAAA;AAC/B,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAmC,IAAI,CAAA;AACnE,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAS,KAAK,CAAA;AAC9C,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAwB,IAAI,CAAA;AACtD,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,CAAC,SAAgB,OAAA,MAAA;AACrB,IAAA,IAAI,IAAO,GAAA,IAAA;AACX,IAAA,KAAK,sBAAuB,CAAA,MAAA,EAAQ,OAAO,CAAA,CAAE,KAAK,CAAQ,IAAA,KAAA;AAExD,MAAA,IAAI,MAAgB,SAAA,CAAA,CAAA,OAAA,KAAA,CAAW,OAAS,IAAA,IAAA,GAAA,MAAA,GAAA,OAAA,CAAA,QAAA,IAAW,UAAU,IAAI,CAAA;AAAA,KAClE,CAAA;AACD,IAAA,OAAO,MAAM;AACX,MAAO,IAAA,GAAA,KAAA;AAAA,KACT;AAAA,GACC,EAAA,CAAC,MAAQ,EAAA,OAAO,CAAC,CAAA;AACpB,EAAA,SAAA,CAAU,MAAM;AACd,IAAM,MAAA,SAAA,GAA2B,CAAC,UAAA,EAAY,IAAS,KAAA;AACrD,MAAI,IAAA,UAAA,KAAe,OAAS,EAAA,SAAA,CAAU,IAAI,CAAA;AAAA,KAC5C;AACA,IAAA,cAAA,CAAe,IAAI,SAAS,CAAA;AAC5B,IAAA,OAAO,MAAM;AACX,MAAA,cAAA,CAAe,OAAO,SAAS,CAAA;AAAA,KACjC;AAAA,GACF,EAAG,CAAC,OAAO,CAAC,CAAA;AACZ,EAAM,MAAA,KAAA,GAAQ,YAAY,YAAY;AACpC,IAAI,IAAA,CAAC,SAAgB,OAAA,IAAA;AACrB,IAAA,WAAA,CAAY,IAAI,CAAA;AAChB,IAAA,QAAA,CAAS,IAAI,CAAA;AACb,IAAI,IAAA;AACF,MAAA,MAAM,IAAO,GAAA,MAAM,gBAAiB,CAAA,MAAA,EAAQ,OAAO,CAAA;AACnD,MAAA,cAAA,CAAe,OAAQ,CAAA,CAAA,QAAA,KAAY,QAAS,CAAA,OAAA,EAAS,IAAI,CAAC,CAAA;AAC1D,MAAO,OAAA,IAAA;AAAA,aACA,GAAK,EAAA;AACZ,MAAA,QAAA,CAAS,GAAe,YAAA,KAAA,GAAQ,GAAI,CAAA,OAAA,GAAU,yBAAyB,CAAA;AACvE,MAAO,OAAA,IAAA;AAAA,KACP,SAAA;AACA,MAAA,WAAA,CAAY,KAAK,CAAA;AAAA;AACnB,GACC,EAAA,CAAC,MAAQ,EAAA,OAAO,CAAC,CAAA;AACpB,EAAO,OAAA;AAAA,IACL,MAAA;AAAA,IACA,QAAA;AAAA,IACA,KAAA;AAAA,IACA;AAAA,GACF;AACF"}
|
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {Feature}from'@common-stack/client-react';import YantraMobileModule from'./module.js';export{default as Home}from'./screens/Home/HomeScreen.js';export{default as NewChat}from'./screens/NewChat/index.js';export{default as Account}from'./screens/Account/index.js';export{default as ChatHistory}from'./screens/ChatHistory/index.js';export{default as Apps}from'./screens/Apps/index.js';export{default as WebBuilder}from'./screens/WebBuilder/index.js';export{GatewayContextProvider,useGatewayContext}from'./contexts/GatewayContext.js';export{CdecliConnectionProvider
|
|
1
|
+
import {Feature}from'@common-stack/client-react';import YantraMobileModule from'./module.js';export{default as Home}from'./screens/Home/HomeScreen.js';export{default as NewChat}from'./screens/NewChat/index.js';export{default as Account}from'./screens/Account/index.js';export{default as ChatHistory}from'./screens/ChatHistory/index.js';export{default as Apps}from'./screens/Apps/index.js';export{default as WebBuilder}from'./screens/WebBuilder/index.js';export{GatewayContextProvider,useGatewayContext}from'./contexts/GatewayContext.js';export{CdecliConnectionProvider}from'./contexts/CdecliConnectionContext.js';export{ChatLiveStreamEngine}from'./contexts/ChatLiveStreamContext.js';export{MemoryPressureResponder}from'./features/memory/MemoryPressureResponder.js';export{BUILTIN_MOBILE_GATEWAYS,MAX_CONCURRENT_TASKS,STORAGE_KEYS}from'./config/constants.js';export{config}from'./config/env-config.js';export{useCdecliAutoConnect}from'./hooks/useCdecliAutoConnect.js';export{useObtainSystemToken}from'./hooks/useObtainSystemToken.js';export{mintSurfaceSystemToken,resolveSurfaceCatalogBackend}from'./hooks/mintSurfaceSystemToken.js';export{buildCdecliTokenInjection,buildSurfaceGateRecoveryScript}from'./hooks/surfaceHandoffScript.js';export{isInstanceNotFoundError,useGatewayConnection}from'./hooks/useGatewayConnection.js';export{usePrerequisiteIds}from'./hooks/usePrerequisiteIds.js';export{useWorkspaceProvisioner}from'./hooks/useWorkspaceProvisioner.js';export{useGatewayRegistry}from'./hooks/useGatewayRegistry.js';export{agentSessionManager}from'./services/agentSessionManager.js';export{ensureGatewayApiKeys,resetGatewayApiKeyBridge}from'./services/gatewayApiKeyBridge.js';export{GatewayClient}from'./services/gatewayClient.js';export{BRIDGE_PROTOCOL_VERSION,BRIDGE_READY_ACTION,DEFAULT_BRIDGE_TIMEOUT_MS,DEFAULT_CHUNK_SIZE,MessageType}from'./bridge/types.js';export{WebViewManager}from'./bridge/WebViewManager.js';export{NativeWebViewBridge}from'./bridge/NativeWebViewBridge.js';export{TypedBridge}from'./bridge/TypedBridge.js';export{CancellableRequest}from'./bridge/CancellableRequest.js';export{ChunkedMessageHandler}from'./bridge/ChunkedMessageHandler.js';export{BridgeDebugger}from'./bridge/BridgeDebugger.js';export{WEB_BRIDGE_BOOTSTRAP}from'./bridge/webBridgeBootstrap.js';export{AuthenticatedFetch}from'./bridge/AuthenticatedFetch.js';export{AuthBridgeHandler}from'./bridge/handlers/AuthBridgeHandler.js';export{NavigationBridgeHandler}from'./bridge/handlers/NavigationBridgeHandler.js';export{AnalyticsBridgeHandler}from'./bridge/handlers/AnalyticsBridgeHandler.js';export{SURFACE_HOST_ACTIONS,SurfaceHostBridgeHandler}from'./bridge/handlers/SurfaceHostBridgeHandler.js';export{classifySurfaceNavigation}from'./bridge/surfaceLinkRouting.js';export{getPackagerHost,resolveMobileWebUrl}from'./bridge/resolveMobileWebUrl.js';export{YANTRA_LOADER_SIZE_COMPACT,YANTRA_LOADER_SIZE_DEFAULT,YantraBrandLoader}from'./components/YantraBrandLoader.js';export{default as CustomDrawer}from'./components/CustomDrawer.js';export{AppThemeProvider,useAppTheme}from'./theme/AppThemeProvider.js';export{InviteDeepLink}from'./features/invite/InviteDeepLink.js';export{ChatInviteDeepLink}from'./features/messaging/ChatInviteDeepLink.js';export{HealthSyncRunner}from'./features/health/HealthSyncRunner.js';export{startHealthBackgroundSync}from'./features/health/backgroundSync.js';export{FitnessWidgetRunner}from'./features/fitness-widgets/FitnessWidgetRunner.js';export{FitnessDeepLink}from'./features/fitness-widgets/FitnessDeepLink.js';export{inviteTokenFromUrl,isInviteUrl}from'./features/invite/inviteLink.js';export{isKeyboardControllerAvailable}from'./utils/keyboardController.js';export{getNativeCanvasExperience,getNativeCanvasViewer,preloadNativeCanvasExperience,registerCanvasExperiencePreload,registerNativeCanvasExperience,registerNativeCanvasViewer}from'./features/canvas/nativeViewerRegistry.js';export{getNativeCharactersExperience,registerNativeCharactersExperience}from'./features/characters/nativeCharactersRegistry.js';export{getNativeChatExperience,registerNativeChatExperience}from'./features/messaging/nativeChatRegistry.js';export{forgetChatPushToken,rememberChatPushToken}from'./features/messaging/chatPushToken.js';export{CHAT_NOTIFICATION_CONFIG_KEY,CHAT_NOTIFICATION_KEYS,chatPrefsFromSettings}from'./features/messaging/chatNotificationPrefs.js';export{settingsUriForAccount}from'./utils/cdecodeUri.js';export{getNativeShoppingExperience,preloadNativeShoppingExperience,registerNativeShoppingExperience,registerShoppingExperiencePreload}from'./features/shopping/nativeShoppingRegistry.js';export{getNativeTravelExperience,preloadNativeTravelExperience,registerNativeTravelExperience,registerTravelExperiencePreload}from'./features/travel/nativeTravelRegistry.js';export{getNativeJobSearchExperience,preloadNativeJobSearchExperience,registerJobSearchExperiencePreload,registerNativeJobSearchExperience}from'./features/job-search/nativeJobSearchRegistry.js';export{getNativeResumeExperience,preloadNativeResumeExperience,registerNativeResumeExperience,registerResumeExperiencePreload}from'./features/resume/nativeResumeRegistry.js';export{getNativeInboxExperience,preloadNativeInboxExperience,registerInboxExperiencePreload,registerNativeInboxExperience}from'./features/inbox/nativeInboxRegistry.js';export{getNativeStudyExperience,preloadNativeStudyExperience,registerNativeStudyExperience,registerStudyExperiencePreload}from'./features/study/nativeStudyRegistry.js';export{getNativeLocalServicesExperience,preloadNativeLocalServicesExperience,registerLocalServicesExperiencePreload,registerNativeLocalServicesExperience}from'./features/local-services/nativeLocalServicesRegistry.js';export{getNativeMoviesExperience,preloadNativeMoviesExperience,registerMoviesExperiencePreload,registerNativeMoviesExperience}from'./features/movies/nativeMoviesRegistry.js';export{getNativeExpensesExperience,preloadNativeExpensesExperience,registerExpensesExperiencePreload,registerNativeExpensesExperience}from'./features/expenses/nativeExpensesRegistry.js';export{getNativeWebBuilderExperience,preloadNativeWebBuilderExperience,registerNativeWebBuilderExperience,registerWebBuilderExperiencePreload}from'./features/webbuilder/nativeWebBuilderRegistry.js';export{NativeAgentChat}from'./features/agent-chat/NativeAgentChat.js';export{ChatLinkOpenerProvider}from'./features/links/ChatLinkOpenerProvider.js';export{useCdecliConnection}from'./contexts/cdecliConnection.js';export{resolveSurfaceAuthGraphqlUrl}from'./hooks/resolveSurfaceAuthGraphqlUrl.js';var index = new Feature(YantraMobileModule);export{index as default};//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { Feature } from '@common-stack/client-react';\nimport YantraMobileModule from './module';\n\nexport default new Feature(YantraMobileModule);\nexport * from './screens';\nexport { GatewayContextProvider, useGatewayContext } from './contexts/GatewayContext';\nexport { CdecliConnectionProvider, useCdecliConnection } from './contexts/CdecliConnectionContext';\nexport { ChatLiveStreamEngine } from './contexts/ChatLiveStreamContext';\nexport { MemoryPressureResponder } from './features/memory/MemoryPressureResponder';\nexport * from './config/constants';\nexport { config } from './config/env-config';\nexport { useCdecliAutoConnect } from './hooks/useCdecliAutoConnect';\nexport { useObtainSystemToken } from './hooks/useObtainSystemToken';\nexport {\n mintSurfaceSystemToken,\n resolveSurfaceCatalogBackend,\n resolveSurfaceAuthGraphqlUrl,\n} from './hooks/mintSurfaceSystemToken';\nexport { buildCdecliTokenInjection, buildSurfaceGateRecoveryScript } from './hooks/surfaceHandoffScript';\nexport { useGatewayConnection, isInstanceNotFoundError } from './hooks/useGatewayConnection';\nexport { usePrerequisiteIds } from './hooks/usePrerequisiteIds';\nexport { useWorkspaceProvisioner } from './hooks/useWorkspaceProvisioner';\nexport { useGatewayRegistry } from './hooks/useGatewayRegistry';\nexport * from './services';\nexport * from './bridge';\nexport {\n YantraBrandLoader,\n YANTRA_LOADER_SIZE_DEFAULT,\n YANTRA_LOADER_SIZE_COMPACT,\n} from './components/YantraBrandLoader';\nexport { default as CustomDrawer } from './components/CustomDrawer';\nexport { AppThemeProvider, useAppTheme } from './theme/AppThemeProvider';\n// Invite deep links. Mounted by the app at the root (see portable-devices/mobile\n// App.tsx) rather than routed to: the invitee has neither an org nor a session,\n// and every mobile route requires both.\nexport { InviteDeepLink } from './features/invite/InviteDeepLink';\nexport { ChatInviteDeepLink } from './features/messaging/ChatInviteDeepLink';\n// Apple Health / Health Connect sync. Mounted at the app root like the invite\n// handlers: it syncs on every return to the foreground, whatever screen is open.\nexport { HealthSyncRunner } from './features/health/HealthSyncRunner';\n// Apple Health while the app is closed: started once at launch, before anything renders.\nexport { startHealthBackgroundSync } from './features/health/backgroundSync';\n// Fitness widgets (iOS): keeps the home / lock screen snapshot fresh, and opens the\n// Fitness surface when a widget or the workout Live Activity is tapped. Both at the root.\nexport { FitnessWidgetRunner } from './features/fitness-widgets/FitnessWidgetRunner';\nexport { FitnessDeepLink } from './features/fitness-widgets/FitnessDeepLink';\nexport { inviteTokenFromUrl, isInviteUrl } from './features/invite/inviteLink';\nexport { isKeyboardControllerAvailable } from './utils/keyboardController';\n// The canvas viewer seam. Exported from the index on purpose: the app (the MF\n// host) registers the federated viewer here and the CanvasBoard screen reads\n// it. Reachability from this entry is what makes rollup emit the registry as a\n// real shared module - as an internal-only file, `registerNativeCanvasViewer`\n// is never called inside the package, so rollup tree-shakes it and constant-\n// folds the screen down to its fallback branch.\nexport {\n registerNativeCanvasViewer,\n getNativeCanvasViewer,\n registerNativeCanvasExperience,\n getNativeCanvasExperience,\n registerCanvasExperiencePreload,\n preloadNativeCanvasExperience,\n} from './features/canvas/nativeViewerRegistry';\n// Characters seam - same reachability contract as the canvas registry above.\nexport {\n registerNativeCharactersExperience,\n getNativeCharactersExperience,\n} from './features/characters/nativeCharactersRegistry';\n// Chat seam - same reachability contract as the two registries above.\nexport { registerNativeChatExperience, getNativeChatExperience } from './features/messaging/nativeChatRegistry';\n// Chat push + notification preferences: the app (which owns expo-notifications and the\n// settings session) registers the token and serves the preferences through these.\nexport { rememberChatPushToken, forgetChatPushToken } from './features/messaging/chatPushToken';\nexport {\n CHAT_NOTIFICATION_CONFIG_KEY,\n CHAT_NOTIFICATION_KEYS,\n chatPrefsFromSettings,\n} from './features/messaging/chatNotificationPrefs';\nexport { settingsUriForAccount } from './utils/cdecodeUri';\nexport {\n registerNativeShoppingExperience,\n getNativeShoppingExperience,\n registerShoppingExperiencePreload,\n preloadNativeShoppingExperience,\n} from './features/shopping/nativeShoppingRegistry';\nexport type { ShoppingExperienceProps } from './features/shopping/ShoppingExperience';\nexport type { ShoppingHostChat } from './features/shopping/hostChat';\nexport {\n registerNativeTravelExperience,\n getNativeTravelExperience,\n registerTravelExperiencePreload,\n preloadNativeTravelExperience,\n} from './features/travel/nativeTravelRegistry';\nexport type { TravelExperienceProps } from './features/travel/TravelExperience';\nexport type { TravelHostChat } from './features/travel/hostChat';\nexport {\n registerNativeJobSearchExperience,\n getNativeJobSearchExperience,\n registerJobSearchExperiencePreload,\n preloadNativeJobSearchExperience,\n} from './features/job-search/nativeJobSearchRegistry';\nexport type { JobSearchExperienceProps } from './features/job-search/JobSearchExperience';\nexport type { JobSearchHostChat } from './features/job-search/hostChat';\nexport {\n registerNativeResumeExperience,\n getNativeResumeExperience,\n registerResumeExperiencePreload,\n preloadNativeResumeExperience,\n} from './features/resume/nativeResumeRegistry';\nexport type { ResumeExperienceProps } from './features/resume/ResumeExperience';\nexport type { ResumeHostChat } from './features/resume/hostChat';\nexport {\n registerNativeInboxExperience,\n getNativeInboxExperience,\n registerInboxExperiencePreload,\n preloadNativeInboxExperience,\n} from './features/inbox/nativeInboxRegistry';\nexport type { InboxExperienceProps } from './features/inbox/InboxExperience';\nexport type { InboxHostChat } from './features/inbox/hostChat';\nexport {\n registerNativeStudyExperience,\n getNativeStudyExperience,\n registerStudyExperiencePreload,\n preloadNativeStudyExperience,\n} from './features/study/nativeStudyRegistry';\nexport type { StudyExperienceProps } from './features/study/StudyExperience';\nexport type { StudyHostChat } from './features/study/hostChat';\nexport {\n registerNativeLocalServicesExperience,\n getNativeLocalServicesExperience,\n registerLocalServicesExperiencePreload,\n preloadNativeLocalServicesExperience,\n} from './features/local-services/nativeLocalServicesRegistry';\nexport type { LocalServicesExperienceProps } from './features/local-services/LocalServicesExperience';\nexport type { LocalServicesHostChat } from './features/local-services/hostChat';\nexport {\n registerNativeMoviesExperience,\n getNativeMoviesExperience,\n registerMoviesExperiencePreload,\n preloadNativeMoviesExperience,\n} from './features/movies/nativeMoviesRegistry';\nexport type { MoviesExperienceProps } from './features/movies/MoviesExperience';\nexport type { MoviesHostChat } from './features/movies/hostChat';\nexport {\n registerNativeExpensesExperience,\n getNativeExpensesExperience,\n registerExpensesExperiencePreload,\n preloadNativeExpensesExperience,\n} from './features/expenses/nativeExpensesRegistry';\nexport type { ExpensesExperienceProps } from './features/expenses/ExpensesExperience';\nexport type { ExpensesHostChat } from './features/expenses/hostChat';\nexport {\n registerNativeWebBuilderExperience,\n getNativeWebBuilderExperience,\n registerWebBuilderExperiencePreload,\n preloadNativeWebBuilderExperience,\n} from './features/webbuilder/nativeWebBuilderRegistry';\nexport type { WebBuilderExperienceProps } from './features/webbuilder/WebBuilderExperience';\nexport type { WebBuilderHostChat } from './features/webbuilder/hostChat';\nexport { NativeAgentChat } from './features/agent-chat';\nexport { ChatLinkOpenerProvider } from './features/links/ChatLinkOpenerProvider';\nexport type { AgentChatMessage, AgentChatSuggestion, NativeAgentChatProps } from './features/agent-chat';\nexport type {\n ChatHostServices,\n ChatViewer,\n FederatedChatProps,\n NativeChatExperienceProps,\n} from './features/messaging/chatHost';\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { Feature } from '@common-stack/client-react';\nimport YantraMobileModule from './module';\n\nexport default new Feature(YantraMobileModule);\nexport * from './screens';\nexport { GatewayContextProvider, useGatewayContext } from './contexts/GatewayContext';\nexport { CdecliConnectionProvider, useCdecliConnection } from './contexts/CdecliConnectionContext';\nexport { ChatLiveStreamEngine } from './contexts/ChatLiveStreamContext';\nexport { MemoryPressureResponder } from './features/memory/MemoryPressureResponder';\nexport * from './config/constants';\nexport { config } from './config/env-config';\nexport { useCdecliAutoConnect } from './hooks/useCdecliAutoConnect';\nexport { useObtainSystemToken } from './hooks/useObtainSystemToken';\nexport {\n mintSurfaceSystemToken,\n resolveSurfaceCatalogBackend,\n resolveSurfaceAuthGraphqlUrl,\n} from './hooks/mintSurfaceSystemToken';\nexport { buildCdecliTokenInjection, buildSurfaceGateRecoveryScript } from './hooks/surfaceHandoffScript';\nexport { useGatewayConnection, isInstanceNotFoundError } from './hooks/useGatewayConnection';\nexport { usePrerequisiteIds } from './hooks/usePrerequisiteIds';\nexport { useWorkspaceProvisioner } from './hooks/useWorkspaceProvisioner';\nexport { useGatewayRegistry } from './hooks/useGatewayRegistry';\nexport * from './services';\nexport * from './bridge';\nexport {\n YantraBrandLoader,\n YANTRA_LOADER_SIZE_DEFAULT,\n YANTRA_LOADER_SIZE_COMPACT,\n} from './components/YantraBrandLoader';\nexport { default as CustomDrawer } from './components/CustomDrawer';\nexport { AppThemeProvider, useAppTheme } from './theme/AppThemeProvider';\n// Invite deep links. Mounted by the app at the root (see portable-devices/mobile\n// App.tsx) rather than routed to: the invitee has neither an org nor a session,\n// and every mobile route requires both.\nexport { InviteDeepLink } from './features/invite/InviteDeepLink';\nexport { ChatInviteDeepLink } from './features/messaging/ChatInviteDeepLink';\n// Apple Health / Health Connect sync. Mounted at the app root like the invite\n// handlers: it syncs on every return to the foreground, whatever screen is open.\nexport { HealthSyncRunner } from './features/health/HealthSyncRunner';\n// Apple Health while the app is closed: started once at launch, before anything renders.\nexport { startHealthBackgroundSync } from './features/health/backgroundSync';\n// Fitness widgets (iOS): keeps the home / lock screen snapshot fresh, and opens the\n// Fitness surface when a widget or the workout Live Activity is tapped. Both at the root.\nexport { FitnessWidgetRunner } from './features/fitness-widgets/FitnessWidgetRunner';\nexport { FitnessDeepLink } from './features/fitness-widgets/FitnessDeepLink';\nexport { inviteTokenFromUrl, isInviteUrl } from './features/invite/inviteLink';\nexport { isKeyboardControllerAvailable } from './utils/keyboardController';\n// The canvas viewer seam. Exported from the index on purpose: the app (the MF\n// host) registers the federated viewer here and the CanvasBoard screen reads\n// it. Reachability from this entry is what makes rollup emit the registry as a\n// real shared module - as an internal-only file, `registerNativeCanvasViewer`\n// is never called inside the package, so rollup tree-shakes it and constant-\n// folds the screen down to its fallback branch.\nexport {\n registerNativeCanvasViewer,\n getNativeCanvasViewer,\n registerNativeCanvasExperience,\n getNativeCanvasExperience,\n registerCanvasExperiencePreload,\n preloadNativeCanvasExperience,\n} from './features/canvas/nativeViewerRegistry';\n// Characters seam - same reachability contract as the canvas registry above.\nexport {\n registerNativeCharactersExperience,\n getNativeCharactersExperience,\n} from './features/characters/nativeCharactersRegistry';\n// Chat seam - same reachability contract as the two registries above.\nexport { registerNativeChatExperience, getNativeChatExperience } from './features/messaging/nativeChatRegistry';\n// Chat push + notification preferences: the app (which owns expo-notifications and the\n// settings session) registers the token and serves the preferences through these.\nexport { rememberChatPushToken, forgetChatPushToken } from './features/messaging/chatPushToken';\nexport {\n CHAT_NOTIFICATION_CONFIG_KEY,\n CHAT_NOTIFICATION_KEYS,\n chatPrefsFromSettings,\n} from './features/messaging/chatNotificationPrefs';\nexport { settingsUriForAccount } from './utils/cdecodeUri';\nexport {\n registerNativeShoppingExperience,\n getNativeShoppingExperience,\n registerShoppingExperiencePreload,\n preloadNativeShoppingExperience,\n} from './features/shopping/nativeShoppingRegistry';\nexport type { ShoppingExperienceProps } from './features/shopping/ShoppingExperience';\nexport type { ShoppingHostChat } from './features/shopping/hostChat';\nexport {\n registerNativeTravelExperience,\n getNativeTravelExperience,\n registerTravelExperiencePreload,\n preloadNativeTravelExperience,\n} from './features/travel/nativeTravelRegistry';\nexport type { TravelExperienceProps } from './features/travel/TravelExperience';\nexport type { TravelHostChat } from './features/travel/hostChat';\nexport {\n registerNativeJobSearchExperience,\n getNativeJobSearchExperience,\n registerJobSearchExperiencePreload,\n preloadNativeJobSearchExperience,\n} from './features/job-search/nativeJobSearchRegistry';\nexport type { JobSearchExperienceProps } from './features/job-search/JobSearchExperience';\nexport type { JobSearchHostChat } from './features/job-search/hostChat';\nexport {\n registerNativeResumeExperience,\n getNativeResumeExperience,\n registerResumeExperiencePreload,\n preloadNativeResumeExperience,\n} from './features/resume/nativeResumeRegistry';\nexport type { ResumeExperienceProps } from './features/resume/ResumeExperience';\nexport type { ResumeHostChat } from './features/resume/hostChat';\nexport {\n registerNativeInboxExperience,\n getNativeInboxExperience,\n registerInboxExperiencePreload,\n preloadNativeInboxExperience,\n} from './features/inbox/nativeInboxRegistry';\nexport type { InboxExperienceProps } from './features/inbox/InboxExperience';\nexport type { InboxHostChat } from './features/inbox/hostChat';\nexport {\n registerNativeStudyExperience,\n getNativeStudyExperience,\n registerStudyExperiencePreload,\n preloadNativeStudyExperience,\n} from './features/study/nativeStudyRegistry';\nexport type { StudyExperienceProps } from './features/study/StudyExperience';\nexport type { StudyHostChat } from './features/study/hostChat';\nexport {\n registerNativeLocalServicesExperience,\n getNativeLocalServicesExperience,\n registerLocalServicesExperiencePreload,\n preloadNativeLocalServicesExperience,\n} from './features/local-services/nativeLocalServicesRegistry';\nexport type { LocalServicesExperienceProps } from './features/local-services/LocalServicesExperience';\nexport type { LocalServicesHostChat } from './features/local-services/hostChat';\nexport {\n registerNativeMoviesExperience,\n getNativeMoviesExperience,\n registerMoviesExperiencePreload,\n preloadNativeMoviesExperience,\n} from './features/movies/nativeMoviesRegistry';\nexport type { MoviesExperienceProps } from './features/movies/MoviesExperience';\nexport type { MoviesHostChat } from './features/movies/hostChat';\nexport {\n registerNativeExpensesExperience,\n getNativeExpensesExperience,\n registerExpensesExperiencePreload,\n preloadNativeExpensesExperience,\n} from './features/expenses/nativeExpensesRegistry';\nexport type { ExpensesExperienceProps } from './features/expenses/ExpensesExperience';\nexport type { ExpensesHostChat } from './features/expenses/hostChat';\nexport {\n registerNativeWebBuilderExperience,\n getNativeWebBuilderExperience,\n registerWebBuilderExperiencePreload,\n preloadNativeWebBuilderExperience,\n} from './features/webbuilder/nativeWebBuilderRegistry';\nexport type { WebBuilderExperienceProps } from './features/webbuilder/WebBuilderExperience';\nexport type { WebBuilderHostChat } from './features/webbuilder/hostChat';\nexport { NativeAgentChat } from './features/agent-chat';\nexport { ChatLinkOpenerProvider } from './features/links/ChatLinkOpenerProvider';\nexport type { AgentChatMessage, AgentChatSuggestion, NativeAgentChatProps } from './features/agent-chat';\nexport type {\n ChatHostServices,\n ChatViewer,\n FederatedChatProps,\n NativeChatExperienceProps,\n} from './features/messaging/chatHost';\n"],"names":[],"mappings":"+5MAEA,YAAe,IAAI,QAAQ,kBAAkB,CAAA"}
|
package/lib/module.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {Feature}from'@common-stack/client-react';import {filteredRoutes}from'./compute.js';import {typePolicies}from'./graphql/typePolicies.js';
|
|
1
|
+
import {Feature}from'@common-stack/client-react';import {filteredRoutes}from'./compute.js';import {registerHostTranscriptProtocol}from'./features/chat/hostTranscriptProtocol.js';import {typePolicies}from'./graphql/typePolicies.js';registerHostTranscriptProtocol();
|
|
2
|
+
var YantraMobileModule = new Feature({
|
|
2
3
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
4
|
routeConfig: filteredRoutes,
|
|
4
5
|
clientStateParams: {
|
package/lib/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../src/module.ts"],"sourcesContent":["/* eslint-disable import/no-extraneous-dependencies */\nimport { Feature } from '@common-stack/client-react';\nimport { filteredRoutes } from './compute';\nimport { typePolicies } from './graphql/typePolicies';\n\nexport default new Feature({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n routeConfig: filteredRoutes as any,\n clientStateParams: {\n typePolicies,\n },\n // Mirror billing/browser: namespace plan vs subscription cache ids so a\n // CurrentSubscription{id:'basic'} cannot clobber AdminPlan{id:'basic'}.\n dataIdFromObject: {\n AdminPlan: (result: { id: string }) => `AdminPlan:${result.id}`,\n CurrentSubscription: (result: { id: string }) => `CurrentSubscription:${result.id}`,\n },\n});\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../src/module.ts"],"sourcesContent":["/* eslint-disable import/no-extraneous-dependencies */\nimport { Feature } from '@common-stack/client-react';\nimport { filteredRoutes } from './compute';\nimport { registerHostTranscriptProtocol } from './features/chat/hostTranscriptProtocol';\nimport { typePolicies } from './graphql/typePolicies';\n\n// Before any chat renders, in this host or in a federated remote it loads.\nregisterHostTranscriptProtocol();\n\nexport default new Feature({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n routeConfig: filteredRoutes as any,\n clientStateParams: {\n typePolicies,\n },\n // Mirror billing/browser: namespace plan vs subscription cache ids so a\n // CurrentSubscription{id:'basic'} cannot clobber AdminPlan{id:'basic'}.\n dataIdFromObject: {\n AdminPlan: (result: { id: string }) => `AdminPlan:${result.id}`,\n CurrentSubscription: (result: { id: string }) => `CurrentSubscription:${result.id}`,\n },\n});\n"],"names":[],"mappings":"uOAOA,8BAA+B,EAAA;AAC/B,yBAAe,IAAI,OAAQ,CAAA;AAAA;AAAA,EAEzB,WAAa,EAAA,cAAA;AAAA,EACb,iBAAmB,EAAA;AAAA,IACjB;AAAA,GACF;AAAA;AAAA;AAAA,EAGA,gBAAkB,EAAA;AAAA,IAChB,SAAW,EAAA,CAAC,MAEN,KAAA,CAAA,UAAA,EAAa,OAAO,EAAE,CAAA,CAAA;AAAA,IAC5B,mBAAqB,EAAA,CAAC,MAEhB,KAAA,CAAA,oBAAA,EAAuB,OAAO,EAAE,CAAA;AAAA;AAE1C,CAAC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useMemo,useLayoutEffect,useState,useCallback,useRef,useEffect}from'react';import {useWindowDimensions,Keyboard,StyleSheet,View,Pressable}from'react-native';import {getDefaultLeftItems,Box,Text,InputToolBar}from'@admin-layout/gluestack-ui-mobile';import {useSafeAreaInsets,SafeAreaView}from'react-native-safe-area-context';import {useNavigation,useRoute,CommonActions}from'@react-navigation/native';import {MessageActionBar}from'../../features/chat/MessageActionBar.js';import {ChatTranscript}from'../../features/chat/ChatTranscript.js';import {ChatLinkOpenerProvider}from'../../features/links/ChatLinkOpenerProvider.js';import {AskUserCard}from'../../features/chat/AskUserCard.js';import {pendingAskUser}from'../../features/chat/askUser.js';import {PendingConnectorConnectCard}from'../../features/chat/ConnectorConnectPrompt.js';import {QueuedFollowUps}from'../../features/chat/QueuedFollowUps.js';import {queuedFollowUpRows}from'../../features/chat/queuedFollowUpRows.js';import {displayConnectorConnectMessages,displayConnectorConnectText}from'common';import {splitPreResponse}from'../../features/chat/preResponse.js';import {useCdecliConnection}from'../../contexts/
|
|
1
|
+
import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {useMemo,useLayoutEffect,useState,useCallback,useRef,useEffect}from'react';import {useWindowDimensions,Keyboard,StyleSheet,View,Pressable}from'react-native';import {getDefaultLeftItems,Box,Text,InputToolBar}from'@admin-layout/gluestack-ui-mobile';import {useSafeAreaInsets,SafeAreaView}from'react-native-safe-area-context';import {useNavigation,useRoute,CommonActions}from'@react-navigation/native';import {MessageActionBar}from'../../features/chat/MessageActionBar.js';import {ChatTranscript}from'../../features/chat/ChatTranscript.js';import {ChatLinkOpenerProvider}from'../../features/links/ChatLinkOpenerProvider.js';import {AskUserCard}from'../../features/chat/AskUserCard.js';import {pendingAskUser}from'../../features/chat/askUser.js';import {PendingConnectorConnectCard}from'../../features/chat/ConnectorConnectPrompt.js';import {QueuedFollowUps}from'../../features/chat/QueuedFollowUps.js';import {queuedFollowUpRows}from'../../features/chat/queuedFollowUpRows.js';import {displayConnectorConnectMessages,displayConnectorConnectText}from'common';import {splitPreResponse}from'../../features/chat/preResponse.js';import {FreeCreditsCard}from'../../features/credits/FreeCreditsCard.js';import {lockedTurnToResend}from'../../features/credits/freeCredits.js';import {useFreeCredits}from'../../features/credits/useFreeCredits.js';import'common/graphql';import'../../config/env-config.js';import'../../hooks/usePrerequisiteIds.js';import'@react-native-async-storage/async-storage';import'expo-secure-store';import'../../features/messaging/yantraChatOrg.js';import {useCdecliConnection}from'../../contexts/cdecliConnection.js';import'../../contexts/GatewayContext.js';import {useChatLiveStream}from'../../contexts/ChatLiveStreamContext.js';import {KeyboardAwareScreen,KeyboardComposerDock}from'../../components/KeyboardComposerDock.js';import {YantraBrandLoader,YANTRA_LOADER_SIZE_COMPACT}from'../../components/YantraBrandLoader.js';import ThinkingIndicator from'../../components/ThinkingIndicator.js';import {mobileTokens}from'../../theme/mobileTokens.js';import {useAppTheme}from'../../theme/AppThemeProvider.js';import DeepSearchModal from'../Home/components/DeepSearchModal.js';import {normalizeSummaryText,extractDeepSearchSources}from'../Home/deepSearchUtils.js';import {AudioRecorderPanel}from'../../features/audio-input/AudioRecorderPanel.js';import {NativeDictationBar}from'../../features/audio-input/NativeDictationBar.js';import {isNativeDictationAvailable}from'../../features/audio-input/nativeDictation.js';import {useImageAttachments}from'../../features/attachments/useImageAttachments.js';import {ComposerAttachmentBar}from'../../features/attachments/ComposerAttachmentBar.js';import {useComposerAttachMenu}from'../../features/attachments/ComposerAttachMenu.js';import {peekComposerAttachments,hasComposerAttachments,takeComposerAttachments}from'../../features/attachments/composerAttachmentHandoff.js';import {MicErrorBoundary}from'../../features/audio-input/MicErrorBoundary.js';import {requestMicPermission}from'../../features/audio-input/useAudioPermission.js';import {shouldRedirectToShop}from'../../features/shopping/chat/homeShoppingIntent.js';import {replaceWithShopNative,shopHandoffParams,pushShopNative}from'../../features/shopping/chat/openShopNative.js';import {resolveNativeHandoff,nativeRouteForConnectors}from'../../features/apps/nativeAppHandoff.js';import {parseToolActivity}from'../../features/chat/toolActivity.js';import {replaceWithNativeApp,nativeHandoffParams,pushNativeApp}from'../../features/apps/nativeAppNavigation.js';var __defProp = Object.defineProperty;
|
|
2
2
|
var __defProps = Object.defineProperties;
|
|
3
3
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -51,7 +51,7 @@ const PLACEHOLDER = {
|
|
|
51
51
|
chat: "Ask anything..."
|
|
52
52
|
};
|
|
53
53
|
function ChatScreen() {
|
|
54
|
-
var _a;
|
|
54
|
+
var _a, _b;
|
|
55
55
|
const navigation = useNavigation();
|
|
56
56
|
const route = useRoute();
|
|
57
57
|
const params = (_a = route == null ? void 0 : route.params) != null ? _a : {};
|
|
@@ -87,11 +87,11 @@ function ChatScreen() {
|
|
|
87
87
|
}, [channelId, setActiveChannelId]);
|
|
88
88
|
const chat = useChatLiveStream();
|
|
89
89
|
const [routingTurns, setRoutingTurns] = useState(() => {
|
|
90
|
-
var _a2,
|
|
90
|
+
var _a2, _b2;
|
|
91
91
|
return initialQuery || (initialAttachments == null ? void 0 : initialAttachments.length) || ((_a2 = peekComposerAttachments(channelId)) == null ? void 0 : _a2.length) ? [{
|
|
92
92
|
id: FIRST_TURN,
|
|
93
93
|
text: initialQuery != null ? initialQuery : "",
|
|
94
|
-
attachments: (
|
|
94
|
+
attachments: (_b2 = peekComposerAttachments(channelId)) != null ? _b2 : normalizeRouteAttachments(initialAttachments),
|
|
95
95
|
placement: "thread"
|
|
96
96
|
}] : [];
|
|
97
97
|
});
|
|
@@ -148,18 +148,30 @@ function ChatScreen() {
|
|
|
148
148
|
cancel
|
|
149
149
|
} = chat;
|
|
150
150
|
const regenerateFrom = useCallback((messageId) => {
|
|
151
|
-
var _a2,
|
|
151
|
+
var _a2, _b2;
|
|
152
152
|
const match = /^msg-(\d+)-assistant$/.exec(messageId);
|
|
153
153
|
if (!match || !channelId) return;
|
|
154
154
|
for (let i = Number(match[1]) - 1; i >= 0; i -= 1) {
|
|
155
155
|
const prior = chat.messages[i];
|
|
156
|
-
if ((prior == null ? void 0 : prior.role) === "user" && (((_a2 = prior.content) == null ? void 0 : _a2.trim()) || ((
|
|
156
|
+
if ((prior == null ? void 0 : prior.role) === "user" && (((_a2 = prior.content) == null ? void 0 : _a2.trim()) || ((_b2 = prior.attachments) == null ? void 0 : _b2.length))) {
|
|
157
157
|
void chat.sendMessage(prior.content, prior.attachments, channelId);
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
}, [chat, channelId]);
|
|
162
|
+
const lockedTurn = useMemo(() => lockedTurnToResend(messages), [messages]);
|
|
163
|
+
const freeCredits = useFreeCredits(lockedTurn ? params.orgName : null);
|
|
164
|
+
const {
|
|
165
|
+
claim: claimFreeCredits
|
|
166
|
+
} = freeCredits;
|
|
167
|
+
const claimAndResend = useCallback(async () => {
|
|
168
|
+
const claimed = await claimFreeCredits();
|
|
169
|
+
if ((claimed == null ? void 0 : claimed.unlocked) && lockedTurn && channelId) {
|
|
170
|
+
void sendMessage(lockedTurn.content, lockedTurn.attachments, channelId);
|
|
171
|
+
}
|
|
172
|
+
}, [claimFreeCredits, lockedTurn, sendMessage, channelId]);
|
|
162
173
|
const chatBusy = isLoading || isStreaming;
|
|
174
|
+
const showClaim = Boolean(lockedTurn) && !chatBusy && !((_b = freeCredits.status) == null ? void 0 : _b.unlocked);
|
|
163
175
|
const renderMessageActions = useCallback((message) => message.role === "assistant" ? /* @__PURE__ */ jsx(MessageActionBar, { text: message.content, onRegenerate: chatBusy ? void 0 : () => regenerateFrom(message.id) }) : null, [chatBusy, regenerateFrom]);
|
|
164
176
|
const imageAttachments = useImageAttachments();
|
|
165
177
|
const {
|
|
@@ -349,8 +361,8 @@ function ChatScreen() {
|
|
|
349
361
|
imageAttachments.clear();
|
|
350
362
|
}, [channelId, sendMessage, isDeepSearchMode, isBuildMode, navigation, params.orgName, imageAttachments, messages.length, hasAssistantReply, chatBusy, releaseRoutingTurn]);
|
|
351
363
|
const handleValueChange = useCallback((e) => {
|
|
352
|
-
var _a2,
|
|
353
|
-
setValue((
|
|
364
|
+
var _a2, _b2;
|
|
365
|
+
setValue((_b2 = (_a2 = e == null ? void 0 : e.nativeEvent) == null ? void 0 : _a2.text) != null ? _b2 : "");
|
|
354
366
|
}, []);
|
|
355
367
|
const openWhisperRecorder = useCallback(() => {
|
|
356
368
|
setVoiceError(null);
|
|
@@ -382,8 +394,8 @@ function ChatScreen() {
|
|
|
382
394
|
setValue((prev) => {
|
|
383
395
|
const next = prev.trim().length > 0 ? `${prev.trim()} ${cleaned}` : cleaned;
|
|
384
396
|
requestAnimationFrame(() => {
|
|
385
|
-
var _a2,
|
|
386
|
-
(
|
|
397
|
+
var _a2, _b2, _c, _d;
|
|
398
|
+
(_b2 = (_a2 = inputRef.current) == null ? void 0 : _a2.setNativeProps) == null ? void 0 : _b2.call(_a2, {
|
|
387
399
|
text: next
|
|
388
400
|
});
|
|
389
401
|
(_d = (_c = inputRef.current) == null ? void 0 : _c.focus) == null ? void 0 : _d.call(_c);
|
|
@@ -428,14 +440,14 @@ function ChatScreen() {
|
|
|
428
440
|
}, [messages]);
|
|
429
441
|
const handedOffTurnRef = useRef(-1);
|
|
430
442
|
useEffect(() => {
|
|
431
|
-
var _a2,
|
|
443
|
+
var _a2, _b2, _c;
|
|
432
444
|
if (!isStreaming || !response || isDeepSearchMode || lastUserIndex < 0) return;
|
|
433
445
|
if (handedOffTurnRef.current === lastUserIndex) return;
|
|
434
446
|
const route2 = nativeRouteForConnectors(parseToolActivity(response, true).steps.map((step) => step.connector));
|
|
435
447
|
if (!route2) return;
|
|
436
448
|
handedOffTurnRef.current = lastUserIndex;
|
|
437
449
|
cancel();
|
|
438
|
-
const ask = (_c = (
|
|
450
|
+
const ask = (_c = (_b2 = (_a2 = messages[lastUserIndex]) == null ? void 0 : _a2.content) == null ? void 0 : _b2.trim()) != null ? _c : "";
|
|
439
451
|
const firstAsk = !messages.slice(0, lastUserIndex).some((m) => m.role === "assistant");
|
|
440
452
|
const handoff = nativeHandoffParams({
|
|
441
453
|
orgName: params.orgName,
|
|
@@ -446,20 +458,20 @@ function ChatScreen() {
|
|
|
446
458
|
else pushNativeApp(navigation, route2, handoff);
|
|
447
459
|
}, [cancel, channelId, isDeepSearchMode, isStreaming, lastUserIndex, messages, navigation, params.orgName, response]);
|
|
448
460
|
const deepSearchQuery = useMemo(() => {
|
|
449
|
-
var _a2,
|
|
461
|
+
var _a2, _b2;
|
|
450
462
|
if (lastUserIndex >= 0) {
|
|
451
|
-
const txt = (
|
|
463
|
+
const txt = (_b2 = (_a2 = messages[lastUserIndex]) == null ? void 0 : _a2.content) == null ? void 0 : _b2.trim();
|
|
452
464
|
if (txt) return txt;
|
|
453
465
|
}
|
|
454
466
|
return initialQuery != null ? initialQuery : null;
|
|
455
467
|
}, [messages, lastUserIndex, initialQuery]);
|
|
456
468
|
const latestAssistantContent = useMemo(() => {
|
|
457
|
-
var _a2,
|
|
469
|
+
var _a2, _b2;
|
|
458
470
|
if (response && response.trim()) return response;
|
|
459
471
|
if (lastUserIndex < 0) return "";
|
|
460
472
|
for (let i = lastUserIndex + 1; i < messages.length; i += 1) {
|
|
461
473
|
if (((_a2 = messages[i]) == null ? void 0 : _a2.role) === "assistant") {
|
|
462
|
-
return splitPreResponse((
|
|
474
|
+
return splitPreResponse((_b2 = messages[i]) == null ? void 0 : _b2.content).text;
|
|
463
475
|
}
|
|
464
476
|
}
|
|
465
477
|
return "";
|
|
@@ -542,8 +554,9 @@ function ChatScreen() {
|
|
|
542
554
|
} else if (isHydrating) {
|
|
543
555
|
transcriptArea = /* @__PURE__ */ jsx(Box, { flex: 1, px: "$4", pt: "$8", children: /* @__PURE__ */ jsx(ThinkingIndicator, { variant: "awaiting", color: secondaryTextColor, isDark, label: "Opening conversation\u2026" }) });
|
|
544
556
|
} else {
|
|
557
|
+
const threadLoader = showSendingLoader && pinSendingLoaderNearComposer ? /* @__PURE__ */ jsx(View, { style: styles.thinkingInThread, children: /* @__PURE__ */ jsx(ThinkingIndicator, { variant: "awaiting", color: secondaryTextColor, isDark }) }) : null;
|
|
545
558
|
transcriptArea = // Links in the transcript open in the app on their surface, or in a browser sheet.
|
|
546
|
-
/* @__PURE__ */ jsx(ChatLinkOpenerProvider, { children: /* @__PURE__ */ jsx(View, { style: styles.transcriptPane, children: /* @__PURE__ */ jsx(ChatTranscript, { messages: transcriptDisplayRows, streamingContent: transcriptStreaming, quickReply, listFooter:
|
|
559
|
+
/* @__PURE__ */ jsx(ChatLinkOpenerProvider, { children: /* @__PURE__ */ jsx(View, { style: styles.transcriptPane, children: /* @__PURE__ */ jsx(ChatTranscript, { messages: transcriptDisplayRows, streamingContent: transcriptStreaming, quickReply, listFooter: showClaim ? /* @__PURE__ */ jsx(FreeCreditsCard, { status: freeCredits.status, claiming: freeCredits.claiming, error: freeCredits.error, onClaim: claimAndResend, isDark }) : threadLoader, renderMessageActions, isDark, listContentStyle: {
|
|
547
560
|
paddingTop: 12,
|
|
548
561
|
paddingBottom: 8,
|
|
549
562
|
margin: 0,
|