@adminide-stack/yantra-mobile 12.0.172-alpha.0 → 12.0.172-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 +10 -4
- package/lib/components/GatewayConnector/GatewayConnector.js.map +1 -1
- package/lib/components/GatewayConnector/GatewayStatusSheet.js +174 -0
- package/lib/components/GatewayConnector/GatewayStatusSheet.js.map +1 -0
- package/lib/components/GatewayToolbarButtonMobile.js +6 -2
- package/lib/components/GatewayToolbarButtonMobile.js.map +1 -1
- package/lib/config/env-config.js +12 -3
- package/lib/config/env-config.js.map +1 -1
- package/lib/features/apps/nativeAppHandoff.js +31 -13
- package/lib/features/apps/nativeAppHandoff.js.map +1 -1
- package/lib/features/chat/PromptFillBar.js +153 -0
- package/lib/features/chat/PromptFillBar.js.map +1 -0
- package/lib/features/chat/promptBlanks.js +120 -0
- package/lib/features/chat/promptBlanks.js.map +1 -0
- package/lib/features/chat/savedReply.js +11 -0
- package/lib/features/chat/savedReply.js.map +1 -0
- package/lib/features/games/GameInviteCard.js +93 -0
- package/lib/features/games/GameInviteCard.js.map +1 -0
- package/lib/features/games/cubeforge3D.js +75 -4
- package/lib/features/games/cubeforge3D.js.map +1 -1
- package/lib/features/games/cubeforgeFriends.js +112 -0
- package/lib/features/games/cubeforgeFriends.js.map +1 -0
- package/lib/features/games/gameInvite.js +13 -0
- package/lib/features/games/gameInvite.js.map +1 -0
- package/lib/features/games/useCubeforgeFriends.js +63 -0
- package/lib/features/games/useCubeforgeFriends.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/nativeWorlds.js +68 -0
- package/lib/features/games/vendored/core/cubeforge/nativeWorlds.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/sharedWorlds.js +10 -0
- package/lib/features/games/vendored/core/cubeforge/sharedWorlds.js.map +1 -0
- package/lib/features/games/vendored/ui/GamesRoot.js +69 -5
- package/lib/features/games/vendored/ui/GamesRoot.js.map +1 -1
- package/lib/features/games/vendored/ui/screens/Cubeforge3DHomeScreen.js +296 -0
- package/lib/features/games/vendored/ui/screens/Cubeforge3DHomeScreen.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/CubeforgeScreen.js +1 -1
- package/lib/features/games/vendored/ui/screens/CubeforgeScreen.js.map +1 -1
- package/lib/features/messaging/ChatComponents.js +12 -4
- package/lib/features/messaging/ChatComponents.js.map +1 -1
- package/lib/features/messaging/messageCards.js +22 -0
- package/lib/features/messaging/messageCards.js.map +1 -0
- package/lib/features/travel/TravelAgentChatPane.js +9 -1
- package/lib/features/travel/TravelAgentChatPane.js.map +1 -1
- package/lib/hooks/useCdecliAutoConnect.js +8 -1
- package/lib/hooks/useCdecliAutoConnect.js.map +1 -1
- package/lib/hooks/useCdecliChannel.js +142 -49
- package/lib/hooks/useCdecliChannel.js.map +1 -1
- package/lib/hooks/useChatApi.js +21 -10
- package/lib/hooks/useChatApi.js.map +1 -1
- package/lib/hooks/useChatStream.js +18 -5
- package/lib/hooks/useChatStream.js.map +1 -1
- package/lib/module.js +2 -1
- package/lib/module.js.map +1 -1
- package/lib/screens/Chat/index.js +23 -15
- package/lib/screens/Chat/index.js.map +1 -1
- package/lib/screens/GamesNative/index.js +48 -3
- package/lib/screens/GamesNative/index.js.map +1 -1
- package/lib/screens/Home/HomeScreen.js +147 -33
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/Home/components/HomeSuggestions.js +1 -1
- package/lib/screens/Home/components/HomeSuggestions.js.map +1 -1
- package/lib/screens/Home/components/homeCatalog.js +68 -16
- package/lib/screens/Home/components/homeCatalog.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {jsxs,jsx,Fragment}from'react/jsx-runtime';import React__default,{useRef,useState,useCallback,useMemo,useEffect}from'react';import {View,StyleSheet,useWindowDimensions,InteractionManager,Animated,Keyboard,Pressable,Platform}from'react-native';import {Text,InputToolBar}from'@admin-layout/gluestack-ui-mobile';import {useSafeAreaInsets,SafeAreaView}from'react-native-safe-area-context';import {useNavigation,useRoute,useFocusEffect,CommonActions,useIsFocused}from'@react-navigation/native';import {useDispatch,useSelector}from'react-redux';import {userSelector}from'@adminide-stack/user-auth0-client';import {v4}from'uuid';import {pickGivenName}from'../../utils/authUserDisplay.js';import {KeyboardAwareScreen,KeyboardComposerDock}from'../../components/KeyboardComposerDock.js';import {useKeyboardBottomOffset}from'../../hooks/useKeyboardBottomOffset.js';import {dismissKeyboard}from'../../utils/keyboardController.js';import {usePrerequisiteIds}from'../../hooks/usePrerequisiteIds.js';import {syncMobileOrgRouteContext}from'../../utils/syncMobileOrgRouteContext.js';import {useChatMutations,usePrefetchChatHistory}from'../../hooks/useChatApi.js';import {hydrateChatHistorySnapshot,persistChatHistorySnapshot}from'../../features/chat/chatHistorySnapshot.js';import {AudioRecorderPanel}from'../../features/audio-input/AudioRecorderPanel.js';import {MicErrorBoundary}from'../../features/audio-input/MicErrorBoundary.js';import {requestMicPermission}from'../../features/audio-input/useAudioPermission.js';import {mobileTokens}from'../../theme/mobileTokens.js';import {useAppTheme}from'../../theme/AppThemeProvider.js';import {groupByKind,BUILD_KINDS,kindForGroup,buildKind,CODE_ASSISTANT_GROUP}from'../../features/templates/buildKinds.js';import {ComposerModeSwitch,composerMode}from'../../features/chat/ComposerModeSwitch.js';import {useMarketplaceTemplateGroups}from'../../hooks/useMarketplaceTemplateGroups.js';import {useImageAttachments}from'../../features/attachments/useImageAttachments.js';import {ComposerAttachmentBar}from'../../features/attachments/ComposerAttachmentBar.js';import {useComposerAttachMenu}from'../../features/attachments/ComposerAttachMenu.js';import {stashComposerAttachments}from'../../features/attachments/composerAttachmentHandoff.js';import {nativeHandoffParams}from'../../features/apps/nativeAppNavigation.js';import {ConnectAppsSheet}from'../../features/channels/ConnectAppsSheet.js';import {HomeImessage}from'../../features/channels/HomeImessage.js';import {IMESSAGE_CHANNEL}from'../../features/channels/channelLinks.js';import {useChannelBindings}from'../../features/channels/useChannelsApi.js';import {ChatModelSheet}from'../../features/chat/ChatModelSheet.js';import {HomeSky}from'../../features/home/sky/HomeSky.js';import {setHomeSkyBar}from'../../features/home/sky/homeSkyBar.js';import {useSkyScene}from'../../features/home/sky/useSkyScene.js';import {useHomeWeather}from'../../features/home/useHomeWeather.js';import {BuildKindPicker,BuildGroupTabs}from'./components/BuildKindPicker.js';import {buildPalette}from'./components/buildTheme.js';import {BuildTemplatesSection}from'./components/BuildTemplatesSection.js';import {ChooseTemplateModal}from'./components/ChooseTemplateModal.js';import {TemplateSuggestionBanner}from'./components/TemplateSuggestionBanner.js';import {SUGGEST_MIN_QUERY,suggestTemplateGroup,SUGGEST_DEBOUNCE_MS}from'../../features/templates/templateSuggestion.js';import {HomeHero}from'./components/HomeHero.js';import {FreeCreditsCard}from'../../features/credits/FreeCreditsCard.js';import {shouldOfferFreeCredits}from'../../features/credits/freeCredits.js';import {useFreeCredits}from'../../features/credits/useFreeCredits.js';import {HomeSuggestions}from'./components/HomeSuggestions.js';import {HomeWash}from'./components/HomeWash.js';import {WebBuilderPrewarm}from'./components/WebBuilderPrewarm.js';import {CanvasPrewarm}from'./components/CanvasPrewarm.js';import {WebBuilderCodePrewarm}from'./components/WebBuilderCodePrewarm.js';import {resetDrawerClosed,dispatchDrawerAction,afterNativeModalClose}from'../../utils/drawerNavigation.js';var __defProp = Object.defineProperty;
|
|
1
|
+
import {jsxs,jsx,Fragment}from'react/jsx-runtime';import React__default,{useRef,useState,useCallback,useMemo,useEffect}from'react';import {View,StyleSheet,useWindowDimensions,InteractionManager,Animated,Keyboard,Pressable,Platform}from'react-native';import {Text,InputToolBar}from'@admin-layout/gluestack-ui-mobile';import {useSafeAreaInsets,SafeAreaView}from'react-native-safe-area-context';import {useNavigation,useRoute,useFocusEffect,CommonActions,useIsFocused}from'@react-navigation/native';import {useDispatch,useSelector}from'react-redux';import {userSelector}from'@adminide-stack/user-auth0-client';import {v4}from'uuid';import {pickGivenName}from'../../utils/authUserDisplay.js';import {KeyboardAwareScreen,KeyboardComposerDock}from'../../components/KeyboardComposerDock.js';import {useKeyboardBottomOffset}from'../../hooks/useKeyboardBottomOffset.js';import {dismissKeyboard}from'../../utils/keyboardController.js';import {usePrerequisiteIds}from'../../hooks/usePrerequisiteIds.js';import {syncMobileOrgRouteContext}from'../../utils/syncMobileOrgRouteContext.js';import {useChatMutations,usePrefetchChatHistory}from'../../hooks/useChatApi.js';import {hydrateChatHistorySnapshot,persistChatHistorySnapshot}from'../../features/chat/chatHistorySnapshot.js';import {AudioRecorderPanel}from'../../features/audio-input/AudioRecorderPanel.js';import {MicErrorBoundary}from'../../features/audio-input/MicErrorBoundary.js';import {requestMicPermission}from'../../features/audio-input/useAudioPermission.js';import {mobileTokens}from'../../theme/mobileTokens.js';import {useAppTheme}from'../../theme/AppThemeProvider.js';import {groupByKind,BUILD_KINDS,kindForGroup,buildKind,CODE_ASSISTANT_GROUP}from'../../features/templates/buildKinds.js';import {ComposerModeSwitch,composerMode}from'../../features/chat/ComposerModeSwitch.js';import {useMarketplaceTemplateGroups}from'../../hooks/useMarketplaceTemplateGroups.js';import {useImageAttachments}from'../../features/attachments/useImageAttachments.js';import {ComposerAttachmentBar}from'../../features/attachments/ComposerAttachmentBar.js';import {useComposerAttachMenu}from'../../features/attachments/ComposerAttachMenu.js';import {stashComposerAttachments}from'../../features/attachments/composerAttachmentHandoff.js';import {nativeHandoffParams}from'../../features/apps/nativeAppNavigation.js';import {ConnectAppsSheet}from'../../features/channels/ConnectAppsSheet.js';import {HomeImessage}from'../../features/channels/HomeImessage.js';import {IMESSAGE_CHANNEL}from'../../features/channels/channelLinks.js';import {useChannelBindings}from'../../features/channels/useChannelsApi.js';import {ChatModelSheet}from'../../features/chat/ChatModelSheet.js';import {isFillComplete,firstUnfilledBlank,startFill,filledPrompt,answerBlank,nextEmptyBlank,blankLabel}from'../../features/chat/promptBlanks.js';import {PromptFillBar}from'../../features/chat/PromptFillBar.js';import {HomeSky}from'../../features/home/sky/HomeSky.js';import {setHomeSkyBar}from'../../features/home/sky/homeSkyBar.js';import {useSkyScene}from'../../features/home/sky/useSkyScene.js';import {useHomeWeather}from'../../features/home/useHomeWeather.js';import {BuildKindPicker,BuildGroupTabs}from'./components/BuildKindPicker.js';import {buildPalette}from'./components/buildTheme.js';import {BuildTemplatesSection}from'./components/BuildTemplatesSection.js';import {ChooseTemplateModal}from'./components/ChooseTemplateModal.js';import {TemplateSuggestionBanner}from'./components/TemplateSuggestionBanner.js';import {SUGGEST_MIN_QUERY,suggestTemplateGroup,SUGGEST_DEBOUNCE_MS}from'../../features/templates/templateSuggestion.js';import {HomeHero}from'./components/HomeHero.js';import {FreeCreditsCard}from'../../features/credits/FreeCreditsCard.js';import {shouldOfferFreeCredits}from'../../features/credits/freeCredits.js';import {useFreeCredits}from'../../features/credits/useFreeCredits.js';import {HomeSuggestions}from'./components/HomeSuggestions.js';import {HomeWash}from'./components/HomeWash.js';import {WebBuilderPrewarm}from'./components/WebBuilderPrewarm.js';import {CanvasPrewarm}from'./components/CanvasPrewarm.js';import {WebBuilderCodePrewarm}from'./components/WebBuilderCodePrewarm.js';import {resetDrawerClosed,dispatchDrawerAction,afterNativeModalClose}from'../../utils/drawerNavigation.js';var __defProp = Object.defineProperty;
|
|
2
2
|
var __defProps = Object.defineProperties;
|
|
3
3
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -94,11 +94,27 @@ function HomeScreenContent({
|
|
|
94
94
|
const inputRef = useRef(null);
|
|
95
95
|
const [composerEpoch, setComposerEpoch] = useState(0);
|
|
96
96
|
const clearComposerOnFocusRef = useRef(false);
|
|
97
|
+
const shortcutTemplateRef = useRef(null);
|
|
98
|
+
const shortcutAppRef = useRef(null);
|
|
99
|
+
const [blankHint, setBlankHint] = useState(null);
|
|
100
|
+
const [fill, setFill] = useState(null);
|
|
101
|
+
const selectComposerRange = useCallback((start, end) => {
|
|
102
|
+
setTimeout(() => {
|
|
103
|
+
const input = inputRef.current;
|
|
104
|
+
if (!input) return;
|
|
105
|
+
input.setSelection(start, end);
|
|
106
|
+
input.focus();
|
|
107
|
+
}, 60);
|
|
108
|
+
}, []);
|
|
97
109
|
const resetComposer = useCallback(() => {
|
|
98
110
|
var _a2;
|
|
99
111
|
setValue("");
|
|
100
112
|
setComposerEpoch((n) => n + 1);
|
|
101
113
|
(_a2 = inputRef.current) == null ? void 0 : _a2.clear();
|
|
114
|
+
shortcutTemplateRef.current = null;
|
|
115
|
+
shortcutAppRef.current = null;
|
|
116
|
+
setBlankHint(null);
|
|
117
|
+
setFill(null);
|
|
102
118
|
}, []);
|
|
103
119
|
useFocusEffect(useCallback(() => {
|
|
104
120
|
var _a2, _b2;
|
|
@@ -291,18 +307,16 @@ function HomeScreenContent({
|
|
|
291
307
|
setSelectedBuildTemplate(null);
|
|
292
308
|
}
|
|
293
309
|
}, []);
|
|
294
|
-
const navigateToChat = useCallback((channelId, query, mode, attachments) => {
|
|
310
|
+
const navigateToChat = useCallback((channelId, query, mode, attachments, app) => {
|
|
295
311
|
var _a2;
|
|
296
|
-
const params = {
|
|
312
|
+
const params = __spreadValues({
|
|
297
313
|
channelId,
|
|
298
314
|
orgName: (_a2 = effectiveOrgName != null ? effectiveOrgName : routeOrgName) != null ? _a2 : void 0,
|
|
299
315
|
initialQuery: query,
|
|
300
316
|
initialMode: mode
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
// two seconds after Send.
|
|
305
|
-
};
|
|
317
|
+
}, app ? {
|
|
318
|
+
initialApp: app
|
|
319
|
+
} : {});
|
|
306
320
|
if (attachments && attachments.length > 0) {
|
|
307
321
|
params.initialAttachments = attachments;
|
|
308
322
|
}
|
|
@@ -363,8 +377,20 @@ function HomeScreenContent({
|
|
|
363
377
|
return (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
364
378
|
}, []);
|
|
365
379
|
const handleSubmit = useCallback(async () => {
|
|
366
|
-
var _a2;
|
|
380
|
+
var _a2, _b2;
|
|
367
381
|
if (!canSubmit || isLoading || disabled) return;
|
|
382
|
+
if (fill && !isFillComplete(fill)) {
|
|
383
|
+
setSendWhenReady(false);
|
|
384
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
const blank = fill ? null : firstUnfilledBlank(value, shortcutTemplateRef.current);
|
|
388
|
+
if (blank) {
|
|
389
|
+
setSendWhenReady(false);
|
|
390
|
+
setBlankHint(blank.text);
|
|
391
|
+
selectComposerRange(blank.start, blank.end);
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
368
394
|
if (!workspaceReady) {
|
|
369
395
|
setSendWhenReady(true);
|
|
370
396
|
return;
|
|
@@ -387,7 +413,8 @@ function HomeScreenContent({
|
|
|
387
413
|
console.warn("[HomeScreen] projectId not ready \u2014 using testing project fallback for submit.");
|
|
388
414
|
}
|
|
389
415
|
const queryToForward = trimmedQuery;
|
|
390
|
-
const
|
|
416
|
+
const shortcutApp = shortcutAppRef.current;
|
|
417
|
+
const isRemix = activeMode === "build" && Boolean((_b2 = selectedBuildTemplate == null ? void 0 : selectedBuildTemplate.snapshotId) == null ? void 0 : _b2.trim());
|
|
391
418
|
const kindBuildsSite = !pickedKind || pickedKind === "website" || pickedKind === "app";
|
|
392
419
|
const routedGroup = selectedTemplateGroup != null ? selectedTemplateGroup : suggestedGroupId;
|
|
393
420
|
const buildAsChat = activeMode === "build" && !isRemix && (routedGroup ? routedGroup !== CODE_ASSISTANT_GROUP : !kindBuildsSite);
|
|
@@ -435,8 +462,8 @@ function HomeScreenContent({
|
|
|
435
462
|
});
|
|
436
463
|
}
|
|
437
464
|
setSelectedBuildTemplate(null);
|
|
438
|
-
navigateToChat(requestedChannelId, queryToForward, sendMode);
|
|
439
|
-
}, [canSubmit, workspaceReady, isLoading, disabled, activeMode, trimmedQuery, onSubmitProp, effectiveOrgName, effectiveProjectId, createChannel, navigateToChat, selectedBuildTemplate, selectedTemplateGroup, suggestedGroupId, pickedKind, composerAttachments, resetComposer, navigation]);
|
|
465
|
+
navigateToChat(requestedChannelId, queryToForward, sendMode, void 0, shortcutApp);
|
|
466
|
+
}, [value, selectComposerRange, canSubmit, workspaceReady, isLoading, disabled, activeMode, trimmedQuery, onSubmitProp, effectiveOrgName, effectiveProjectId, createChannel, navigateToChat, selectedBuildTemplate, selectedTemplateGroup, suggestedGroupId, pickedKind, composerAttachments, resetComposer, navigation]);
|
|
440
467
|
const surfaceColor = isDark ? "#0f172a" : mobileTokens.color.surface;
|
|
441
468
|
const authUser = useSelector(userSelector);
|
|
442
469
|
const firstName = useMemo(() => pickGivenName(authUser), [authUser]);
|
|
@@ -544,14 +571,71 @@ function HomeScreenContent({
|
|
|
544
571
|
}));
|
|
545
572
|
}, [dispatch, navigation, route == null ? void 0 : route.name, route == null ? void 0 : route.params, (_j = route == null ? void 0 : route.params) == null ? void 0 : _j.orgName, resolvedOrgName, accountUserId, mobileRoutePath, orgLoading]);
|
|
546
573
|
const handleValueChange = useCallback((e) => {
|
|
547
|
-
|
|
574
|
+
const {
|
|
575
|
+
text
|
|
576
|
+
} = e.nativeEvent;
|
|
577
|
+
setValue(text);
|
|
578
|
+
if (!text.trim()) {
|
|
579
|
+
shortcutTemplateRef.current = null;
|
|
580
|
+
shortcutAppRef.current = null;
|
|
581
|
+
}
|
|
582
|
+
setBlankHint((hint) => hint && firstUnfilledBlank(text, shortcutTemplateRef.current) ? hint : null);
|
|
548
583
|
}, []);
|
|
549
|
-
const handleInjectPrompt = useCallback((prompt, mode) => {
|
|
584
|
+
const handleInjectPrompt = useCallback((prompt, mode, app, guides) => {
|
|
550
585
|
setValue(prompt);
|
|
551
|
-
|
|
586
|
+
handleModeSwitch(mode != null ? mode : "chat");
|
|
587
|
+
shortcutTemplateRef.current = prompt;
|
|
588
|
+
shortcutAppRef.current = app != null ? app : null;
|
|
589
|
+
setBlankHint(null);
|
|
590
|
+
const started = startFill(prompt, guides);
|
|
591
|
+
setFill(started);
|
|
592
|
+
if (started) setTimeout(() => {
|
|
593
|
+
var _a2;
|
|
594
|
+
return (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
595
|
+
}, 60);
|
|
596
|
+
}, [handleModeSwitch]);
|
|
597
|
+
const applyFill = useCallback((next) => {
|
|
598
|
+
setFill(next);
|
|
599
|
+
setValue(filledPrompt(next));
|
|
552
600
|
}, []);
|
|
601
|
+
const handleFillChange = useCallback((e) => {
|
|
602
|
+
if (fill) applyFill(answerBlank(fill, e.nativeEvent.text));
|
|
603
|
+
}, [fill, applyFill]);
|
|
604
|
+
const handlePickAnswer = useCallback((answer) => {
|
|
605
|
+
var _a2;
|
|
606
|
+
if (!fill) return;
|
|
607
|
+
const answered = answerBlank(fill, answer);
|
|
608
|
+
const next = nextEmptyBlank(answered);
|
|
609
|
+
applyFill(next >= 0 ? __spreadProps(__spreadValues({}, answered), {
|
|
610
|
+
active: next
|
|
611
|
+
}) : answered);
|
|
612
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
613
|
+
}, [fill, applyFill]);
|
|
614
|
+
const handleSelectBlank = useCallback((index) => {
|
|
615
|
+
var _a2;
|
|
616
|
+
setFill((current) => current ? __spreadProps(__spreadValues({}, current), {
|
|
617
|
+
active: index
|
|
618
|
+
}) : current);
|
|
619
|
+
(_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
620
|
+
}, []);
|
|
621
|
+
const handleEditAllFill = useCallback(() => {
|
|
622
|
+
if (!fill) return;
|
|
623
|
+
const draft = filledPrompt(fill);
|
|
624
|
+
setValue(draft);
|
|
625
|
+
setFill(null);
|
|
626
|
+
const blank = firstUnfilledBlank(draft, fill.template);
|
|
627
|
+
if (blank) selectComposerRange(blank.start, blank.end);
|
|
628
|
+
else setTimeout(() => {
|
|
629
|
+
var _a2;
|
|
630
|
+
return (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
631
|
+
}, 60);
|
|
632
|
+
}, [fill, selectComposerRange]);
|
|
633
|
+
const handleCancelFill = useCallback(() => {
|
|
634
|
+
Keyboard.dismiss();
|
|
635
|
+
resetComposer();
|
|
636
|
+
}, [resetComposer]);
|
|
553
637
|
const handleMicPress = useCallback(() => {
|
|
554
|
-
if (hasQuery) return;
|
|
638
|
+
if (hasQuery && !fill) return;
|
|
555
639
|
setVoiceError(null);
|
|
556
640
|
Keyboard.dismiss();
|
|
557
641
|
void (async () => {
|
|
@@ -565,13 +649,18 @@ function HomeScreenContent({
|
|
|
565
649
|
}
|
|
566
650
|
setShowAudioRecorder(true);
|
|
567
651
|
})();
|
|
568
|
-
}, [hasQuery]);
|
|
652
|
+
}, [hasQuery, fill]);
|
|
569
653
|
const handleTranscriptionComplete = useCallback((text) => {
|
|
570
654
|
const cleaned = (text != null ? text : "").trim();
|
|
571
655
|
setShowAudioRecorder(false);
|
|
572
656
|
if (!cleaned) return;
|
|
657
|
+
if (fill) {
|
|
658
|
+
const typed = fill.answers[fill.active].trim();
|
|
659
|
+
applyFill(answerBlank(fill, typed ? `${typed} ${cleaned}` : cleaned));
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
573
662
|
setValue((prev) => prev.trim().length > 0 ? `${prev.trim()} ${cleaned}` : cleaned);
|
|
574
|
-
}, []);
|
|
663
|
+
}, [fill, applyFill]);
|
|
575
664
|
const handleRecorderCancel = useCallback(() => {
|
|
576
665
|
setShowAudioRecorder(false);
|
|
577
666
|
}, []);
|
|
@@ -617,20 +706,38 @@ function HomeScreenContent({
|
|
|
617
706
|
}, SEND_WAIT_MS);
|
|
618
707
|
return () => clearTimeout(timer);
|
|
619
708
|
}, [sendWhenReady, canSubmit, workspaceReady, handleSubmit]);
|
|
620
|
-
const inputConfig = useMemo(() =>
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
709
|
+
const inputConfig = useMemo(() => {
|
|
710
|
+
var _a2, _b2;
|
|
711
|
+
return {
|
|
712
|
+
value: fill ? fill.answers[fill.active] : value,
|
|
713
|
+
onChange: fill ? handleFillChange : handleValueChange,
|
|
714
|
+
placeholder: fill ? (_b2 = (_a2 = fill.guides[fill.active]) == null ? void 0 : _a2.ask) != null ? _b2 : blankLabel(fill.blanks[fill.active]) : inputPlaceholder,
|
|
715
|
+
disabled: isLoading || disabled,
|
|
716
|
+
inputRef,
|
|
717
|
+
returnKeyType: fill && nextEmptyBlank(fill) >= 0 ? "next" : "send",
|
|
718
|
+
blurOnSubmit: true,
|
|
719
|
+
onSubmitEditing: () => {
|
|
720
|
+
const next = fill ? nextEmptyBlank(fill) : -1;
|
|
721
|
+
if (fill && next >= 0) {
|
|
722
|
+
setFill(__spreadProps(__spreadValues({}, fill), {
|
|
723
|
+
active: next
|
|
724
|
+
}));
|
|
725
|
+
setTimeout(() => {
|
|
726
|
+
var _a3;
|
|
727
|
+
return (_a3 = inputRef.current) == null ? void 0 : _a3.focus();
|
|
728
|
+
}, 60);
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
if (canSubmit) void handleSubmit();
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
}, [fill, value, handleFillChange, handleValueChange, inputPlaceholder, isLoading, disabled, canSubmit, handleSubmit]);
|
|
735
|
+
const blankHintLine = blankHint ? /* @__PURE__ */ jsx(Text, { accessibilityLiveRegion: "polite", style: [styles.blankHint, {
|
|
736
|
+
color: isDark ? "#fcd34d" : "#92400e"
|
|
737
|
+
}], children: `Replace ${blankHint} with yours to send.` }) : null;
|
|
632
738
|
const micSendButton = useMemo(() => ({
|
|
633
|
-
|
|
739
|
+
// Send waits for the blank: until it is answered this stays the mic, as on an empty composer.
|
|
740
|
+
hasContent: fill ? isFillComplete(fill) : hasQuery || hasAttachments,
|
|
634
741
|
onSend: () => {
|
|
635
742
|
Keyboard.dismiss();
|
|
636
743
|
void handleSubmit();
|
|
@@ -638,7 +745,7 @@ function HomeScreenContent({
|
|
|
638
745
|
onMic: handleMicPress,
|
|
639
746
|
disabled: isLoading || disabled,
|
|
640
747
|
isLoading: isLoading || sendWhenReady
|
|
641
|
-
}), [hasQuery, hasAttachments, handleSubmit, handleMicPress, isLoading, disabled, sendWhenReady]);
|
|
748
|
+
}), [fill, hasQuery, hasAttachments, handleSubmit, handleMicPress, isLoading, disabled, sendWhenReady]);
|
|
642
749
|
return /* @__PURE__ */ jsxs(SafeAreaView, { ref: screenRef, collapsable: false, edges: ["left", "right"], style: {
|
|
643
750
|
flex: 1,
|
|
644
751
|
backgroundColor: surfaceColor
|
|
@@ -676,7 +783,7 @@ function HomeScreenContent({
|
|
|
676
783
|
}], children: voiceError || composerAttachments.error }) }) : null,
|
|
677
784
|
showAudioRecorder ? /* @__PURE__ */ jsx(MicErrorBoundary, { onCancel: handleRecorderCancel, onError: handleRecorderError, children: /* @__PURE__ */ jsx(AudioRecorderPanel, { isDark, onTranscriptionComplete: handleTranscriptionComplete, onCancel: handleRecorderCancel, onError: handleRecorderError }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
678
785
|
/* @__PURE__ */ jsx(ComposerAttachmentBar, { attachments: composerAttachments.pending, onRemove: composerAttachments.remove, isDark }),
|
|
679
|
-
/* @__PURE__ */ jsx(InputToolBar, { inputConfig, leftCustomRender: modeSwitch, rightItems, templateButton, topContent: draftReadable ? /* @__PURE__ */ jsx(TemplateSuggestionBanner, { selectedLabel: selectedTemplateGroup ? (_l = bannerGroup == null ? void 0 : bannerGroup.label) != null ? _l : null : null, suggestedLabel: selectedTemplateGroup ? null : (_m = bannerGroup == null ? void 0 : bannerGroup.label) != null ? _m : null, description: bannerGroup == null ? void 0 : bannerGroup.description, isAnalyzing: analyzingQuery, onChange: () => {
|
|
786
|
+
/* @__PURE__ */ jsx(InputToolBar, { inputConfig, leftCustomRender: modeSwitch, rightItems, templateButton, topContent: fill ? /* @__PURE__ */ jsx(PromptFillBar, { fill, isDark, onSelectBlank: handleSelectBlank, onPickAnswer: handlePickAnswer, onEditAll: handleEditAllFill, onCancel: handleCancelFill }) : blankHintLine != null ? blankHintLine : draftReadable ? /* @__PURE__ */ jsx(TemplateSuggestionBanner, { selectedLabel: selectedTemplateGroup ? (_l = bannerGroup == null ? void 0 : bannerGroup.label) != null ? _l : null : null, suggestedLabel: selectedTemplateGroup ? null : (_m = bannerGroup == null ? void 0 : bannerGroup.label) != null ? _m : null, description: bannerGroup == null ? void 0 : bannerGroup.description, isAnalyzing: analyzingQuery, onChange: () => {
|
|
680
787
|
dismissKeyboard();
|
|
681
788
|
setGroupPickerOpen(true);
|
|
682
789
|
}, palette: buildColors }) : null, micSendButton }, composerEpoch)
|
|
@@ -693,6 +800,13 @@ function HomeScreenContent({
|
|
|
693
800
|
] });
|
|
694
801
|
}
|
|
695
802
|
const styles = StyleSheet.create({
|
|
803
|
+
blankHint: {
|
|
804
|
+
fontSize: 13,
|
|
805
|
+
lineHeight: 18,
|
|
806
|
+
fontWeight: "500",
|
|
807
|
+
paddingHorizontal: 4,
|
|
808
|
+
paddingBottom: 6
|
|
809
|
+
},
|
|
696
810
|
flex: {
|
|
697
811
|
flex: 1
|
|
698
812
|
},
|