@buoy-gg/ask-buoy 7.0.40 → 7.0.42
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/README.md +13 -94
- package/lib/commonjs/blocks/AskBlocks.js +1 -338
- package/lib/commonjs/blocks/BlockRenderer.js +1 -262
- package/lib/commonjs/blocks/ChromePrototypes.js +1 -514
- package/lib/commonjs/blocks/DataBlocks.js +1 -781
- package/lib/commonjs/blocks/ExtraBlocks.js +1 -1860
- package/lib/commonjs/blocks/MediaBlocks.js +1 -156
- package/lib/commonjs/blocks/ReceiptBlocks.js +2 -586
- package/lib/commonjs/blocks/blockText.js +1 -60
- package/lib/commonjs/blocks/blockText.test.js +1 -53
- package/lib/commonjs/blocks/context.js +1 -42
- package/lib/commonjs/blocks/icons.js +1 -96
- package/lib/commonjs/blocks/index.js +1 -95
- package/lib/commonjs/blocks/listRow.test.js +1 -55
- package/lib/commonjs/blocks/pageState.js +1 -34
- package/lib/commonjs/blocks/pageState.test.js +1 -57
- package/lib/commonjs/blocks/primitives.js +1 -457
- package/lib/commonjs/blocks/primitivesIndex.js +1 -62
- package/lib/commonjs/blocks/ruleStates.js +1 -0
- package/lib/commonjs/components/ApprovalCard.js +1 -297
- package/lib/commonjs/components/AskBuoyHeader.js +1 -196
- package/lib/commonjs/components/AskBuoyIcon.js +1 -19
- package/lib/commonjs/components/AskBuoyModal.js +2 -478
- package/lib/commonjs/components/AskBuoySettings.js +1 -181
- package/lib/commonjs/components/ChangesBar.js +1 -211
- package/lib/commonjs/components/Composer.js +1 -255
- package/lib/commonjs/components/EmptyState.js +1 -161
- package/lib/commonjs/components/KeyboardPad.js +1 -80
- package/lib/commonjs/components/Markdown.js +1 -310
- package/lib/commonjs/components/MessageList.js +1 -970
- package/lib/commonjs/components/QueuedMessages.js +1 -145
- package/lib/commonjs/components/ThinkingStrip.js +1 -223
- package/lib/commonjs/components/TypingDots.js +1 -63
- package/lib/commonjs/components/markdownParse.js +1 -131
- package/lib/commonjs/components/markdownParse.test.js +1 -99
- package/lib/commonjs/components/useCopyAction.js +1 -50
- package/lib/commonjs/index.js +1 -252
- package/lib/commonjs/preset.js +1 -91
- package/lib/commonjs/store/activityGroups.js +1 -110
- package/lib/commonjs/store/activityGroups.test.js +1 -78
- package/lib/commonjs/store/askBuoySettings.js +1 -72
- package/lib/commonjs/store/askBuoyStore.js +2 -588
- package/lib/commonjs/store/blockPlacement.js +1 -64
- package/lib/commonjs/store/blockPlacement.test.js +1 -123
- package/lib/commonjs/store/queue.test.js +1 -150
- package/lib/commonjs/store/resetConversation.js +1 -77
- package/lib/commonjs/store/restorePending.test.js +1 -63
- package/lib/commonjs/store/restoredIds.test.js +1 -47
- package/lib/commonjs/store/suggestions.js +1 -54
- package/lib/commonjs/store/suggestions.test.js +1 -58
- package/lib/commonjs/store/systemLine.test.js +1 -77
- package/lib/commonjs/store/ticketPrompt.js +1 -17
- package/lib/commonjs/store/traceText.js +1 -81
- package/lib/commonjs/store/traceText.test.js +1 -112
- package/lib/commonjs/store/transcriptPersistence.js +1 -297
- package/lib/commonjs/store/transcriptPersistence.test.js +1 -333
- package/lib/commonjs/store/turnRendering.test.js +1 -151
- package/lib/commonjs/store/useAskBuoy.js +1 -651
- package/lib/commonjs/store/useAskBuoySettings.js +1 -14
- package/lib/commonjs/sync/askBuoySyncAdapter.js +1 -153
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js +1 -141
- package/lib/commonjs/sync/wire.js +1 -58
- package/lib/commonjs/types.js +1 -6
- package/lib/module/blocks/AskBlocks.js +1 -331
- package/lib/module/blocks/BlockRenderer.js +1 -257
- package/lib/module/blocks/ChromePrototypes.js +1 -503
- package/lib/module/blocks/DataBlocks.js +1 -767
- package/lib/module/blocks/ExtraBlocks.js +1 -1833
- package/lib/module/blocks/MediaBlocks.js +1 -151
- package/lib/module/blocks/ReceiptBlocks.js +2 -574
- package/lib/module/blocks/blockText.js +1 -55
- package/lib/module/blocks/blockText.test.js +1 -53
- package/lib/module/blocks/context.js +1 -35
- package/lib/module/blocks/icons.js +1 -91
- package/lib/module/blocks/index.js +1 -8
- package/lib/module/blocks/listRow.test.js +1 -56
- package/lib/module/blocks/pageState.js +1 -30
- package/lib/module/blocks/pageState.test.js +1 -56
- package/lib/module/blocks/primitives.js +1 -445
- package/lib/module/blocks/primitivesIndex.js +1 -5
- package/lib/module/blocks/ruleStates.js +1 -0
- package/lib/module/components/ApprovalCard.js +1 -292
- package/lib/module/components/AskBuoyHeader.js +1 -193
- package/lib/module/components/AskBuoyIcon.js +1 -8
- package/lib/module/components/AskBuoyModal.js +2 -473
- package/lib/module/components/AskBuoySettings.js +1 -176
- package/lib/module/components/ChangesBar.js +1 -206
- package/lib/module/components/Composer.js +1 -250
- package/lib/module/components/EmptyState.js +1 -156
- package/lib/module/components/KeyboardPad.js +1 -75
- package/lib/module/components/Markdown.js +1 -305
- package/lib/module/components/MessageList.js +1 -964
- package/lib/module/components/QueuedMessages.js +1 -140
- package/lib/module/components/ThinkingStrip.js +1 -218
- package/lib/module/components/TypingDots.js +1 -58
- package/lib/module/components/markdownParse.js +1 -125
- package/lib/module/components/markdownParse.test.js +1 -98
- package/lib/module/components/useCopyAction.js +1 -46
- package/lib/module/index.js +1 -34
- package/lib/module/preset.js +1 -74
- package/lib/module/store/activityGroups.js +1 -103
- package/lib/module/store/activityGroups.test.js +1 -77
- package/lib/module/store/askBuoySettings.js +1 -67
- package/lib/module/store/askBuoyStore.js +2 -582
- package/lib/module/store/blockPlacement.js +1 -59
- package/lib/module/store/blockPlacement.test.js +1 -122
- package/lib/module/store/queue.test.js +1 -149
- package/lib/module/store/resetConversation.js +1 -72
- package/lib/module/store/restorePending.test.js +1 -62
- package/lib/module/store/restoredIds.test.js +1 -46
- package/lib/module/store/suggestions.js +1 -49
- package/lib/module/store/suggestions.test.js +1 -57
- package/lib/module/store/systemLine.test.js +1 -76
- package/lib/module/store/ticketPrompt.js +1 -13
- package/lib/module/store/traceText.js +1 -75
- package/lib/module/store/traceText.test.js +1 -111
- package/lib/module/store/transcriptPersistence.js +1 -287
- package/lib/module/store/transcriptPersistence.test.js +1 -332
- package/lib/module/store/turnRendering.test.js +1 -150
- package/lib/module/store/useAskBuoy.js +1 -646
- package/lib/module/store/useAskBuoySettings.js +1 -9
- package/lib/module/sync/askBuoySyncAdapter.js +1 -148
- package/lib/module/sync/askBuoySyncAdapter.test.js +1 -140
- package/lib/module/sync/wire.js +1 -47
- package/lib/module/types.js +1 -4
- package/lib/typescript/blocks/context.d.ts +3 -0
- package/lib/typescript/blocks/ruleStates.d.ts +15 -0
- package/lib/typescript/components/ChangesBar.d.ts +2 -1
- package/lib/typescript/sync/askBuoySyncAdapter.d.ts +2 -2
- package/lib/web/index.mjs +15 -0
- package/package.json +44 -11
- package/lib/commonjs/blocks/AskBlocks.js.map +0 -1
- package/lib/commonjs/blocks/BlockRenderer.js.map +0 -1
- package/lib/commonjs/blocks/ChromePrototypes.js.map +0 -1
- package/lib/commonjs/blocks/DataBlocks.js.map +0 -1
- package/lib/commonjs/blocks/ExtraBlocks.js.map +0 -1
- package/lib/commonjs/blocks/MediaBlocks.js.map +0 -1
- package/lib/commonjs/blocks/ReceiptBlocks.js.map +0 -1
- package/lib/commonjs/blocks/blockText.js.map +0 -1
- package/lib/commonjs/blocks/blockText.test.js.map +0 -1
- package/lib/commonjs/blocks/context.js.map +0 -1
- package/lib/commonjs/blocks/icons.js.map +0 -1
- package/lib/commonjs/blocks/index.js.map +0 -1
- package/lib/commonjs/blocks/listRow.test.js.map +0 -1
- package/lib/commonjs/blocks/pageState.js.map +0 -1
- package/lib/commonjs/blocks/pageState.test.js.map +0 -1
- package/lib/commonjs/blocks/primitives.js.map +0 -1
- package/lib/commonjs/blocks/primitivesIndex.js.map +0 -1
- package/lib/commonjs/components/ApprovalCard.js.map +0 -1
- package/lib/commonjs/components/AskBuoyHeader.js.map +0 -1
- package/lib/commonjs/components/AskBuoyIcon.js.map +0 -1
- package/lib/commonjs/components/AskBuoyModal.js.map +0 -1
- package/lib/commonjs/components/AskBuoySettings.js.map +0 -1
- package/lib/commonjs/components/ChangesBar.js.map +0 -1
- package/lib/commonjs/components/Composer.js.map +0 -1
- package/lib/commonjs/components/EmptyState.js.map +0 -1
- package/lib/commonjs/components/KeyboardPad.js.map +0 -1
- package/lib/commonjs/components/Markdown.js.map +0 -1
- package/lib/commonjs/components/MessageList.js.map +0 -1
- package/lib/commonjs/components/QueuedMessages.js.map +0 -1
- package/lib/commonjs/components/ThinkingStrip.js.map +0 -1
- package/lib/commonjs/components/TypingDots.js.map +0 -1
- package/lib/commonjs/components/markdownParse.js.map +0 -1
- package/lib/commonjs/components/markdownParse.test.js.map +0 -1
- package/lib/commonjs/components/useCopyAction.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/preset.js.map +0 -1
- package/lib/commonjs/store/activityGroups.js.map +0 -1
- package/lib/commonjs/store/activityGroups.test.js.map +0 -1
- package/lib/commonjs/store/askBuoySettings.js.map +0 -1
- package/lib/commonjs/store/askBuoyStore.js.map +0 -1
- package/lib/commonjs/store/blockPlacement.js.map +0 -1
- package/lib/commonjs/store/blockPlacement.test.js.map +0 -1
- package/lib/commonjs/store/queue.test.js.map +0 -1
- package/lib/commonjs/store/resetConversation.js.map +0 -1
- package/lib/commonjs/store/restorePending.test.js.map +0 -1
- package/lib/commonjs/store/restoredIds.test.js.map +0 -1
- package/lib/commonjs/store/suggestions.js.map +0 -1
- package/lib/commonjs/store/suggestions.test.js.map +0 -1
- package/lib/commonjs/store/systemLine.test.js.map +0 -1
- package/lib/commonjs/store/ticketPrompt.js.map +0 -1
- package/lib/commonjs/store/traceText.js.map +0 -1
- package/lib/commonjs/store/traceText.test.js.map +0 -1
- package/lib/commonjs/store/transcriptPersistence.js.map +0 -1
- package/lib/commonjs/store/transcriptPersistence.test.js.map +0 -1
- package/lib/commonjs/store/turnRendering.test.js.map +0 -1
- package/lib/commonjs/store/useAskBuoy.js.map +0 -1
- package/lib/commonjs/store/useAskBuoySettings.js.map +0 -1
- package/lib/commonjs/sync/askBuoySyncAdapter.js.map +0 -1
- package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +0 -1
- package/lib/commonjs/sync/wire.js.map +0 -1
- package/lib/commonjs/types.js.map +0 -1
- package/lib/module/blocks/AskBlocks.js.map +0 -1
- package/lib/module/blocks/BlockRenderer.js.map +0 -1
- package/lib/module/blocks/ChromePrototypes.js.map +0 -1
- package/lib/module/blocks/DataBlocks.js.map +0 -1
- package/lib/module/blocks/ExtraBlocks.js.map +0 -1
- package/lib/module/blocks/MediaBlocks.js.map +0 -1
- package/lib/module/blocks/ReceiptBlocks.js.map +0 -1
- package/lib/module/blocks/blockText.js.map +0 -1
- package/lib/module/blocks/blockText.test.js.map +0 -1
- package/lib/module/blocks/context.js.map +0 -1
- package/lib/module/blocks/icons.js.map +0 -1
- package/lib/module/blocks/index.js.map +0 -1
- package/lib/module/blocks/listRow.test.js.map +0 -1
- package/lib/module/blocks/pageState.js.map +0 -1
- package/lib/module/blocks/pageState.test.js.map +0 -1
- package/lib/module/blocks/primitives.js.map +0 -1
- package/lib/module/blocks/primitivesIndex.js.map +0 -1
- package/lib/module/components/ApprovalCard.js.map +0 -1
- package/lib/module/components/AskBuoyHeader.js.map +0 -1
- package/lib/module/components/AskBuoyIcon.js.map +0 -1
- package/lib/module/components/AskBuoyModal.js.map +0 -1
- package/lib/module/components/AskBuoySettings.js.map +0 -1
- package/lib/module/components/ChangesBar.js.map +0 -1
- package/lib/module/components/Composer.js.map +0 -1
- package/lib/module/components/EmptyState.js.map +0 -1
- package/lib/module/components/KeyboardPad.js.map +0 -1
- package/lib/module/components/Markdown.js.map +0 -1
- package/lib/module/components/MessageList.js.map +0 -1
- package/lib/module/components/QueuedMessages.js.map +0 -1
- package/lib/module/components/ThinkingStrip.js.map +0 -1
- package/lib/module/components/TypingDots.js.map +0 -1
- package/lib/module/components/markdownParse.js.map +0 -1
- package/lib/module/components/markdownParse.test.js.map +0 -1
- package/lib/module/components/useCopyAction.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/preset.js.map +0 -1
- package/lib/module/store/activityGroups.js.map +0 -1
- package/lib/module/store/activityGroups.test.js.map +0 -1
- package/lib/module/store/askBuoySettings.js.map +0 -1
- package/lib/module/store/askBuoyStore.js.map +0 -1
- package/lib/module/store/blockPlacement.js.map +0 -1
- package/lib/module/store/blockPlacement.test.js.map +0 -1
- package/lib/module/store/queue.test.js.map +0 -1
- package/lib/module/store/resetConversation.js.map +0 -1
- package/lib/module/store/restorePending.test.js.map +0 -1
- package/lib/module/store/restoredIds.test.js.map +0 -1
- package/lib/module/store/suggestions.js.map +0 -1
- package/lib/module/store/suggestions.test.js.map +0 -1
- package/lib/module/store/systemLine.test.js.map +0 -1
- package/lib/module/store/ticketPrompt.js.map +0 -1
- package/lib/module/store/traceText.js.map +0 -1
- package/lib/module/store/traceText.test.js.map +0 -1
- package/lib/module/store/transcriptPersistence.js.map +0 -1
- package/lib/module/store/transcriptPersistence.test.js.map +0 -1
- package/lib/module/store/turnRendering.test.js.map +0 -1
- package/lib/module/store/useAskBuoy.js.map +0 -1
- package/lib/module/store/useAskBuoySettings.js.map +0 -1
- package/lib/module/sync/askBuoySyncAdapter.js.map +0 -1
- package/lib/module/sync/askBuoySyncAdapter.test.js.map +0 -1
- package/lib/module/sync/wire.js.map +0 -1
- package/lib/module/types.js.map +0 -1
- package/lib/typescript/blocks/AskBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/BlockRenderer.d.ts.map +0 -1
- package/lib/typescript/blocks/ChromePrototypes.d.ts.map +0 -1
- package/lib/typescript/blocks/DataBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/ExtraBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/MediaBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +0 -1
- package/lib/typescript/blocks/blockText.d.ts.map +0 -1
- package/lib/typescript/blocks/blockText.test.d.ts.map +0 -1
- package/lib/typescript/blocks/context.d.ts.map +0 -1
- package/lib/typescript/blocks/icons.d.ts.map +0 -1
- package/lib/typescript/blocks/index.d.ts.map +0 -1
- package/lib/typescript/blocks/listRow.test.d.ts.map +0 -1
- package/lib/typescript/blocks/pageState.d.ts.map +0 -1
- package/lib/typescript/blocks/pageState.test.d.ts.map +0 -1
- package/lib/typescript/blocks/primitives.d.ts.map +0 -1
- package/lib/typescript/blocks/primitivesIndex.d.ts.map +0 -1
- package/lib/typescript/components/ApprovalCard.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoyHeader.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoyIcon.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoyModal.d.ts.map +0 -1
- package/lib/typescript/components/AskBuoySettings.d.ts.map +0 -1
- package/lib/typescript/components/ChangesBar.d.ts.map +0 -1
- package/lib/typescript/components/Composer.d.ts.map +0 -1
- package/lib/typescript/components/EmptyState.d.ts.map +0 -1
- package/lib/typescript/components/KeyboardPad.d.ts.map +0 -1
- package/lib/typescript/components/Markdown.d.ts.map +0 -1
- package/lib/typescript/components/MessageList.d.ts.map +0 -1
- package/lib/typescript/components/QueuedMessages.d.ts.map +0 -1
- package/lib/typescript/components/ThinkingStrip.d.ts.map +0 -1
- package/lib/typescript/components/TypingDots.d.ts.map +0 -1
- package/lib/typescript/components/markdownParse.d.ts.map +0 -1
- package/lib/typescript/components/markdownParse.test.d.ts.map +0 -1
- package/lib/typescript/components/useCopyAction.d.ts.map +0 -1
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/store/activityGroups.d.ts.map +0 -1
- package/lib/typescript/store/activityGroups.test.d.ts.map +0 -1
- package/lib/typescript/store/askBuoySettings.d.ts.map +0 -1
- package/lib/typescript/store/askBuoyStore.d.ts.map +0 -1
- package/lib/typescript/store/blockPlacement.d.ts.map +0 -1
- package/lib/typescript/store/blockPlacement.test.d.ts.map +0 -1
- package/lib/typescript/store/queue.test.d.ts.map +0 -1
- package/lib/typescript/store/resetConversation.d.ts.map +0 -1
- package/lib/typescript/store/restorePending.test.d.ts.map +0 -1
- package/lib/typescript/store/restoredIds.test.d.ts.map +0 -1
- package/lib/typescript/store/suggestions.d.ts.map +0 -1
- package/lib/typescript/store/suggestions.test.d.ts.map +0 -1
- package/lib/typescript/store/systemLine.test.d.ts.map +0 -1
- package/lib/typescript/store/ticketPrompt.d.ts.map +0 -1
- package/lib/typescript/store/traceText.d.ts.map +0 -1
- package/lib/typescript/store/traceText.test.d.ts.map +0 -1
- package/lib/typescript/store/transcriptPersistence.d.ts.map +0 -1
- package/lib/typescript/store/transcriptPersistence.test.d.ts.map +0 -1
- package/lib/typescript/store/turnRendering.test.d.ts.map +0 -1
- package/lib/typescript/store/useAskBuoy.d.ts.map +0 -1
- package/lib/typescript/store/useAskBuoySettings.d.ts.map +0 -1
- package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +0 -1
- package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +0 -1
- package/lib/typescript/sync/wire.d.ts.map +0 -1
- package/lib/typescript/types.d.ts.map +0 -1
|
@@ -1,331 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Ask blocks — the user has to decide, and the turn is waiting.
|
|
5
|
-
*
|
|
6
|
-
* Choice, Confirm and Input all lock once answered: the chosen option stays
|
|
7
|
-
* highlighted, the rest dim, and nothing in history is tappable twice. The
|
|
8
|
-
* answer is handed to the sheet as a BlockAnswer and becomes the next user
|
|
9
|
-
* message, so the model reads plain words ("Business checkout"), never JSON.
|
|
10
|
-
*/
|
|
11
|
-
import { useState } from "react";
|
|
12
|
-
import { Pressable, StyleSheet, Text, TextInput, View } from "react-native";
|
|
13
|
-
import { Check, ChevronRight, night } from "@buoy-gg/shared-ui";
|
|
14
|
-
import { useBlockHandlers } from "./context";
|
|
15
|
-
import { BlockIcon } from "./icons";
|
|
16
|
-
import { Card } from "./primitives";
|
|
17
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
|
-
export function Choice({
|
|
19
|
-
block
|
|
20
|
-
}) {
|
|
21
|
-
const h = useBlockHandlers();
|
|
22
|
-
const answer = h.answered[block.id];
|
|
23
|
-
const chosen = answer?.kind === "choice" ? answer.optionId : null;
|
|
24
|
-
const locked = !!answer;
|
|
25
|
-
return /*#__PURE__*/_jsxs(Card, {
|
|
26
|
-
testID: `buoy-block-choice-${block.id}`,
|
|
27
|
-
tone: locked ? undefined : "info",
|
|
28
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
29
|
-
style: styles.question,
|
|
30
|
-
children: block.question
|
|
31
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
32
|
-
style: styles.options,
|
|
33
|
-
children: block.options.slice(0, 5).map((o, i) => {
|
|
34
|
-
const isChosen = chosen === o.id;
|
|
35
|
-
return /*#__PURE__*/_jsxs(Pressable, {
|
|
36
|
-
testID: `buoy-block-option-${o.id}`,
|
|
37
|
-
accessibilityRole: "button",
|
|
38
|
-
accessibilityState: {
|
|
39
|
-
selected: isChosen,
|
|
40
|
-
disabled: locked
|
|
41
|
-
},
|
|
42
|
-
disabled: locked,
|
|
43
|
-
onPress: () => h.answer({
|
|
44
|
-
blockId: block.id,
|
|
45
|
-
kind: "choice",
|
|
46
|
-
optionId: o.id,
|
|
47
|
-
label: o.label
|
|
48
|
-
}),
|
|
49
|
-
style: ({
|
|
50
|
-
pressed
|
|
51
|
-
}) => [styles.option, i > 0 && styles.optionDivider, isChosen && styles.optionChosen, locked && !isChosen && styles.optionDimmed, pressed && !locked && styles.pressed],
|
|
52
|
-
children: [o.icon ? /*#__PURE__*/_jsx(BlockIcon, {
|
|
53
|
-
name: o.icon
|
|
54
|
-
}) : null, /*#__PURE__*/_jsxs(View, {
|
|
55
|
-
style: styles.optionText,
|
|
56
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
57
|
-
style: [styles.optionLabel, isChosen && styles.optionLabelChosen],
|
|
58
|
-
children: o.label
|
|
59
|
-
}), o.detail ? /*#__PURE__*/_jsx(Text, {
|
|
60
|
-
style: styles.optionDetail,
|
|
61
|
-
children: o.detail
|
|
62
|
-
}) : null]
|
|
63
|
-
}), isChosen ? /*#__PURE__*/_jsx(Check, {
|
|
64
|
-
size: 14,
|
|
65
|
-
color: night.color.accent
|
|
66
|
-
}) : locked ? null : /*#__PURE__*/_jsx(ChevronRight, {
|
|
67
|
-
size: 14,
|
|
68
|
-
color: night.color.textTertiary
|
|
69
|
-
})]
|
|
70
|
-
}, o.id);
|
|
71
|
-
})
|
|
72
|
-
}), !locked && block.allowFreeText !== false ? /*#__PURE__*/_jsx(Text, {
|
|
73
|
-
style: styles.hint,
|
|
74
|
-
children: "Or just type your answer below."
|
|
75
|
-
}) : null]
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
export function Confirm({
|
|
79
|
-
block
|
|
80
|
-
}) {
|
|
81
|
-
const h = useBlockHandlers();
|
|
82
|
-
const answer = h.answered[block.id];
|
|
83
|
-
const locked = !!answer;
|
|
84
|
-
const approved = answer?.kind === "confirm" ? answer.approved : null;
|
|
85
|
-
return /*#__PURE__*/_jsxs(Card, {
|
|
86
|
-
testID: `buoy-block-confirm-${block.id}`,
|
|
87
|
-
tone: locked ? undefined : "warning",
|
|
88
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
89
|
-
style: styles.confirmTitle,
|
|
90
|
-
children: block.title
|
|
91
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
92
|
-
style: styles.confirmChange,
|
|
93
|
-
children: block.change
|
|
94
|
-
}), block.consequence ? /*#__PURE__*/_jsx(Text, {
|
|
95
|
-
style: styles.confirmConsequence,
|
|
96
|
-
children: block.consequence
|
|
97
|
-
}) : null, /*#__PURE__*/_jsx(View, {
|
|
98
|
-
style: styles.confirmActions,
|
|
99
|
-
children: locked ? /*#__PURE__*/_jsx(Text, {
|
|
100
|
-
style: styles.decided,
|
|
101
|
-
children: approved ? `✓ ${block.approveLabel ?? "Done"}` : `✕ ${block.declineLabel ?? "Not now"}`
|
|
102
|
-
}) : /*#__PURE__*/_jsxs(_Fragment, {
|
|
103
|
-
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
104
|
-
testID: "buoy-block-approve",
|
|
105
|
-
accessibilityRole: "button",
|
|
106
|
-
onPress: () => h.answer({
|
|
107
|
-
blockId: block.id,
|
|
108
|
-
kind: "confirm",
|
|
109
|
-
approved: true
|
|
110
|
-
}),
|
|
111
|
-
style: ({
|
|
112
|
-
pressed
|
|
113
|
-
}) => [styles.button, styles.buttonPrimary, pressed && styles.pressed],
|
|
114
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
115
|
-
style: styles.buttonTextPrimary,
|
|
116
|
-
children: block.approveLabel ?? "Do it"
|
|
117
|
-
})
|
|
118
|
-
}), /*#__PURE__*/_jsx(Pressable, {
|
|
119
|
-
testID: "buoy-block-decline",
|
|
120
|
-
accessibilityRole: "button",
|
|
121
|
-
onPress: () => h.answer({
|
|
122
|
-
blockId: block.id,
|
|
123
|
-
kind: "confirm",
|
|
124
|
-
approved: false
|
|
125
|
-
}),
|
|
126
|
-
style: ({
|
|
127
|
-
pressed
|
|
128
|
-
}) => [styles.button, styles.buttonPlate, pressed && styles.pressed],
|
|
129
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
130
|
-
style: styles.buttonTextPlate,
|
|
131
|
-
children: block.declineLabel ?? "Not now"
|
|
132
|
-
})
|
|
133
|
-
})]
|
|
134
|
-
})
|
|
135
|
-
})]
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
export function Input({
|
|
139
|
-
block
|
|
140
|
-
}) {
|
|
141
|
-
const h = useBlockHandlers();
|
|
142
|
-
const answer = h.answered[block.id];
|
|
143
|
-
const locked = !!answer;
|
|
144
|
-
const [value, setValue] = useState("");
|
|
145
|
-
const secret = block.type === "secret";
|
|
146
|
-
const submit = () => {
|
|
147
|
-
const v = value.trim();
|
|
148
|
-
if (!v) return;
|
|
149
|
-
h.answer({
|
|
150
|
-
blockId: block.id,
|
|
151
|
-
kind: "input",
|
|
152
|
-
value: v
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
return /*#__PURE__*/_jsxs(Card, {
|
|
156
|
-
testID: `buoy-block-input-${block.id}`,
|
|
157
|
-
tone: locked ? undefined : "info",
|
|
158
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
159
|
-
style: styles.question,
|
|
160
|
-
children: block.label
|
|
161
|
-
}), locked ? /*#__PURE__*/_jsx(Text, {
|
|
162
|
-
style: styles.decided,
|
|
163
|
-
children: answer.kind === "input" ? secret ? "••••••" : answer.value : "(skipped)"
|
|
164
|
-
}) : /*#__PURE__*/_jsxs(View, {
|
|
165
|
-
style: styles.inputRow,
|
|
166
|
-
children: [/*#__PURE__*/_jsx(TextInput, {
|
|
167
|
-
testID: "buoy-block-input-field",
|
|
168
|
-
style: styles.input,
|
|
169
|
-
value: value,
|
|
170
|
-
onChangeText: setValue,
|
|
171
|
-
placeholder: block.placeholder ?? "",
|
|
172
|
-
placeholderTextColor: night.color.placeholder,
|
|
173
|
-
keyboardType: block.type === "number" ? "numeric" : "ascii-capable",
|
|
174
|
-
secureTextEntry: secret,
|
|
175
|
-
autoCapitalize: "none",
|
|
176
|
-
autoCorrect: false,
|
|
177
|
-
returnKeyType: "send",
|
|
178
|
-
onSubmitEditing: submit
|
|
179
|
-
}), /*#__PURE__*/_jsx(Pressable, {
|
|
180
|
-
testID: "buoy-block-input-submit",
|
|
181
|
-
accessibilityRole: "button",
|
|
182
|
-
disabled: !value.trim(),
|
|
183
|
-
onPress: submit,
|
|
184
|
-
style: ({
|
|
185
|
-
pressed
|
|
186
|
-
}) => [styles.button, styles.buttonPrimary, !value.trim() && styles.buttonDisabled, pressed && styles.pressed],
|
|
187
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
188
|
-
style: styles.buttonTextPrimary,
|
|
189
|
-
children: block.submitLabel ?? "Send"
|
|
190
|
-
})
|
|
191
|
-
})]
|
|
192
|
-
})]
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
const styles = StyleSheet.create({
|
|
196
|
-
question: {
|
|
197
|
-
color: night.color.text,
|
|
198
|
-
fontSize: night.font.row,
|
|
199
|
-
fontWeight: "600",
|
|
200
|
-
lineHeight: 20,
|
|
201
|
-
paddingHorizontal: 12,
|
|
202
|
-
paddingTop: 12,
|
|
203
|
-
paddingBottom: 8
|
|
204
|
-
},
|
|
205
|
-
options: {
|
|
206
|
-
marginHorizontal: 8,
|
|
207
|
-
marginBottom: 8,
|
|
208
|
-
borderRadius: night.radius.row,
|
|
209
|
-
backgroundColor: night.color.surfaceElevated,
|
|
210
|
-
overflow: "hidden"
|
|
211
|
-
},
|
|
212
|
-
option: {
|
|
213
|
-
flexDirection: "row",
|
|
214
|
-
alignItems: "center",
|
|
215
|
-
gap: 10,
|
|
216
|
-
paddingHorizontal: 12,
|
|
217
|
-
paddingVertical: 11
|
|
218
|
-
},
|
|
219
|
-
optionDivider: {
|
|
220
|
-
borderTopWidth: StyleSheet.hairlineWidth,
|
|
221
|
-
borderTopColor: night.color.separator
|
|
222
|
-
},
|
|
223
|
-
optionChosen: {
|
|
224
|
-
backgroundColor: night.color.accentSoft
|
|
225
|
-
},
|
|
226
|
-
optionDimmed: {
|
|
227
|
-
opacity: 0.45
|
|
228
|
-
},
|
|
229
|
-
optionText: {
|
|
230
|
-
flex: 1,
|
|
231
|
-
gap: 2
|
|
232
|
-
},
|
|
233
|
-
optionLabel: {
|
|
234
|
-
color: night.color.text,
|
|
235
|
-
fontSize: night.font.body,
|
|
236
|
-
fontWeight: "500"
|
|
237
|
-
},
|
|
238
|
-
optionLabelChosen: {
|
|
239
|
-
color: night.color.accent
|
|
240
|
-
},
|
|
241
|
-
optionDetail: {
|
|
242
|
-
color: night.color.textSecondary,
|
|
243
|
-
fontSize: night.font.caption,
|
|
244
|
-
lineHeight: 17
|
|
245
|
-
},
|
|
246
|
-
hint: {
|
|
247
|
-
color: night.color.textTertiary,
|
|
248
|
-
fontSize: night.font.micro,
|
|
249
|
-
paddingHorizontal: 12,
|
|
250
|
-
paddingBottom: 10
|
|
251
|
-
},
|
|
252
|
-
confirmTitle: {
|
|
253
|
-
color: night.color.text,
|
|
254
|
-
fontSize: night.font.row,
|
|
255
|
-
fontWeight: "600",
|
|
256
|
-
paddingHorizontal: 12,
|
|
257
|
-
paddingTop: 12
|
|
258
|
-
},
|
|
259
|
-
confirmChange: {
|
|
260
|
-
color: night.color.text,
|
|
261
|
-
fontSize: night.font.body,
|
|
262
|
-
lineHeight: 19,
|
|
263
|
-
paddingHorizontal: 12,
|
|
264
|
-
paddingTop: 6
|
|
265
|
-
},
|
|
266
|
-
confirmConsequence: {
|
|
267
|
-
color: night.color.warning,
|
|
268
|
-
fontSize: night.font.caption,
|
|
269
|
-
lineHeight: 17,
|
|
270
|
-
paddingHorizontal: 12,
|
|
271
|
-
paddingTop: 6
|
|
272
|
-
},
|
|
273
|
-
confirmActions: {
|
|
274
|
-
flexDirection: "row",
|
|
275
|
-
gap: 8,
|
|
276
|
-
paddingHorizontal: 12,
|
|
277
|
-
paddingVertical: 12,
|
|
278
|
-
alignItems: "center"
|
|
279
|
-
},
|
|
280
|
-
decided: {
|
|
281
|
-
color: night.color.textSecondary,
|
|
282
|
-
fontSize: night.font.caption,
|
|
283
|
-
fontWeight: "600",
|
|
284
|
-
paddingHorizontal: 12,
|
|
285
|
-
paddingVertical: 10
|
|
286
|
-
},
|
|
287
|
-
inputRow: {
|
|
288
|
-
flexDirection: "row",
|
|
289
|
-
alignItems: "center",
|
|
290
|
-
gap: 8,
|
|
291
|
-
paddingHorizontal: 12,
|
|
292
|
-
paddingBottom: 12
|
|
293
|
-
},
|
|
294
|
-
input: {
|
|
295
|
-
flex: 1,
|
|
296
|
-
height: 38,
|
|
297
|
-
paddingHorizontal: 12,
|
|
298
|
-
borderRadius: night.radius.row,
|
|
299
|
-
backgroundColor: night.color.surfaceElevated,
|
|
300
|
-
color: night.color.text,
|
|
301
|
-
fontSize: night.font.body
|
|
302
|
-
},
|
|
303
|
-
button: {
|
|
304
|
-
paddingHorizontal: 14,
|
|
305
|
-
paddingVertical: 9,
|
|
306
|
-
borderRadius: night.radius.row
|
|
307
|
-
},
|
|
308
|
-
buttonPrimary: {
|
|
309
|
-
backgroundColor: night.color.accent
|
|
310
|
-
},
|
|
311
|
-
buttonPlate: {
|
|
312
|
-
backgroundColor: night.color.button
|
|
313
|
-
},
|
|
314
|
-
buttonDisabled: {
|
|
315
|
-
opacity: 0.5
|
|
316
|
-
},
|
|
317
|
-
buttonTextPrimary: {
|
|
318
|
-
color: night.color.onAccent,
|
|
319
|
-
fontSize: night.font.caption,
|
|
320
|
-
fontWeight: "600"
|
|
321
|
-
},
|
|
322
|
-
buttonTextPlate: {
|
|
323
|
-
color: night.color.text,
|
|
324
|
-
fontSize: night.font.caption,
|
|
325
|
-
fontWeight: "600"
|
|
326
|
-
},
|
|
327
|
-
pressed: {
|
|
328
|
-
opacity: 0.7
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
//# sourceMappingURL=AskBlocks.js.map
|
|
1
|
+
"use strict";import{useState as x}from"react";import{Pressable as h,StyleSheet as g,Text as l,TextInput as w,View as b}from"react-native";import{Check as z,ChevronRight as T,night as o}from"@buoy-gg/shared-ui";import{useBlockHandlers as y}from"./context";import{BlockIcon as C}from"./icons";import{Card as m}from"./primitives";import{jsx as n,jsxs as p,Fragment as D}from"react/jsx-runtime";export function Choice({block:t}){const a=y();const d=a.answered[t.id];const s=d?.kind==="choice"?d.optionId:null;const r=!!d;return p(m,{testID:`buoy-block-choice-${t.id}`,tone:r?void 0:"info",children:[n(l,{style:e.question,children:t.question}),n(b,{style:e.options,children:t.options.slice(0,5).map((i,f)=>{const c=s===i.id;return p(h,{testID:`buoy-block-option-${i.id}`,accessibilityRole:"button",accessibilityState:{selected:c,disabled:r},disabled:r,onPress:()=>a.answer({blockId:t.id,kind:"choice",optionId:i.id,label:i.label}),style:({pressed:u})=>[e.option,f>0&&e.optionDivider,c&&e.optionChosen,r&&!c&&e.optionDimmed,u&&!r&&e.pressed],children:[i.icon?n(C,{name:i.icon}):null,p(b,{style:e.optionText,children:[n(l,{style:[e.optionLabel,c&&e.optionLabelChosen],children:i.label}),i.detail?n(l,{style:e.optionDetail,children:i.detail}):null]}),c?n(z,{size:14,color:o.color.accent}):r?null:n(T,{size:14,color:o.color.textTertiary})]},i.id)})}),!r&&t.allowFreeText!==false?n(l,{style:e.hint,children:"Or just type your answer below."}):null]})}export function Confirm({block:t}){const a=y();const d=a.answered[t.id];const s=!!d;const r=d?.kind==="confirm"?d.approved:null;return p(m,{testID:`buoy-block-confirm-${t.id}`,tone:s?void 0:"warning",children:[n(l,{style:e.confirmTitle,children:t.title}),n(l,{style:e.confirmChange,children:t.change}),t.consequence?n(l,{style:e.confirmConsequence,children:t.consequence}):null,n(b,{style:e.confirmActions,children:s?n(l,{style:e.decided,children:r?`\u2713 ${t.approveLabel??"Done"}`:`\u2715 ${t.declineLabel??"Not now"}`}):p(D,{children:[n(h,{testID:"buoy-block-approve",accessibilityRole:"button",onPress:()=>a.answer({blockId:t.id,kind:"confirm",approved:true}),style:({pressed:i})=>[e.button,e.buttonPrimary,i&&e.pressed],children:n(l,{style:e.buttonTextPrimary,children:t.approveLabel??"Do it"})}),n(h,{testID:"buoy-block-decline",accessibilityRole:"button",onPress:()=>a.answer({blockId:t.id,kind:"confirm",approved:false}),style:({pressed:i})=>[e.button,e.buttonPlate,i&&e.pressed],children:n(l,{style:e.buttonTextPlate,children:t.declineLabel??"Not now"})})]})})]})}export function Input({block:t}){const a=y();const d=a.answered[t.id];const s=!!d;const[r,i]=x("");const f=t.type==="secret";const c=()=>{const u=r.trim();if(!u)return;a.answer({blockId:t.id,kind:"input",value:u})};return p(m,{testID:`buoy-block-input-${t.id}`,tone:s?void 0:"info",children:[n(l,{style:e.question,children:t.label}),s?n(l,{style:e.decided,children:d.kind==="input"?f?"\u2022\u2022\u2022\u2022\u2022\u2022":d.value:"(skipped)"}):p(b,{style:e.inputRow,children:[n(w,{testID:"buoy-block-input-field",style:e.input,value:r,onChangeText:i,placeholder:t.placeholder??"",placeholderTextColor:o.color.placeholder,keyboardType:t.type==="number"?"numeric":"ascii-capable",secureTextEntry:f,autoCapitalize:"none",autoCorrect:false,returnKeyType:"send",onSubmitEditing:c}),n(h,{testID:"buoy-block-input-submit",accessibilityRole:"button",disabled:!r.trim(),onPress:c,style:({pressed:u})=>[e.button,e.buttonPrimary,!r.trim()&&e.buttonDisabled,u&&e.pressed],children:n(l,{style:e.buttonTextPrimary,children:t.submitLabel??"Send"})})]})]})}const e=g.create({question:{color:o.color.text,fontSize:o.font.row,fontWeight:"600",lineHeight:20,paddingHorizontal:12,paddingTop:12,paddingBottom:8},options:{marginHorizontal:8,marginBottom:8,borderRadius:o.radius.row,backgroundColor:o.color.surfaceElevated,overflow:"hidden"},option:{flexDirection:"row",alignItems:"center",gap:10,paddingHorizontal:12,paddingVertical:11},optionDivider:{borderTopWidth:g.hairlineWidth,borderTopColor:o.color.separator},optionChosen:{backgroundColor:o.color.accentSoft},optionDimmed:{opacity:.45},optionText:{flex:1,gap:2},optionLabel:{color:o.color.text,fontSize:o.font.body,fontWeight:"500"},optionLabelChosen:{color:o.color.accent},optionDetail:{color:o.color.textSecondary,fontSize:o.font.caption,lineHeight:17},hint:{color:o.color.textTertiary,fontSize:o.font.micro,paddingHorizontal:12,paddingBottom:10},confirmTitle:{color:o.color.text,fontSize:o.font.row,fontWeight:"600",paddingHorizontal:12,paddingTop:12},confirmChange:{color:o.color.text,fontSize:o.font.body,lineHeight:19,paddingHorizontal:12,paddingTop:6},confirmConsequence:{color:o.color.warning,fontSize:o.font.caption,lineHeight:17,paddingHorizontal:12,paddingTop:6},confirmActions:{flexDirection:"row",gap:8,paddingHorizontal:12,paddingVertical:12,alignItems:"center"},decided:{color:o.color.textSecondary,fontSize:o.font.caption,fontWeight:"600",paddingHorizontal:12,paddingVertical:10},inputRow:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingBottom:12},input:{flex:1,height:38,paddingHorizontal:12,borderRadius:o.radius.row,backgroundColor:o.color.surfaceElevated,color:o.color.text,fontSize:o.font.body},button:{paddingHorizontal:14,paddingVertical:9,borderRadius:o.radius.row},buttonPrimary:{backgroundColor:o.color.accent},buttonPlate:{backgroundColor:o.color.button},buttonDisabled:{opacity:.5},buttonTextPrimary:{color:o.color.onAccent,fontSize:o.font.caption,fontWeight:"600"},buttonTextPlate:{color:o.color.text,fontSize:o.font.caption,fontWeight:"600"},pressed:{opacity:.7}});
|
|
@@ -1,257 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* One switch, one component per kind. Unknown kinds render nothing — an
|
|
5
|
-
* older sheet receiving a newer engine's block must not crash the transcript.
|
|
6
|
-
*
|
|
7
|
-
* Every block renders inside an error boundary for the same reason: block
|
|
8
|
-
* data comes from tool results and (via `buoy_ui`) from the model, and a
|
|
9
|
-
* shape the renderer chokes on must cost ONE card, not the conversation. A
|
|
10
|
-
* live eval watched model-fabricated data crash the app and take the chat —
|
|
11
|
-
* the only undo surface — down with it.
|
|
12
|
-
*/
|
|
13
|
-
import { Component } from "react";
|
|
14
|
-
import { StyleSheet, Text } from "react-native";
|
|
15
|
-
import { night } from "@buoy-gg/shared-ui";
|
|
16
|
-
import { Choice, Confirm, Input } from "./AskBlocks";
|
|
17
|
-
import { Chart, Code, Diff, Finding, KeyValue, List, Notice, Steps, Table } from "./DataBlocks";
|
|
18
|
-
import { ImageGrid } from "./MediaBlocks";
|
|
19
|
-
import { Crash, LogList, Peek, RequestCard, RequestList, RouteChips, RuleCard, ScreenElements } from "./ReceiptBlocks";
|
|
20
|
-
import { Banner, CardCarousel, CardView, Checkpoint, Claim, Compare, DateTime, Details, File, Form, MultiSelect, Plan, Proposal, Screenshot, Select, Slider, Sparkline, Suggestions, Tabs, Task, Timeline, Upload } from "./ExtraBlocks";
|
|
21
|
-
import { ActionRow } from "./primitives";
|
|
22
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
-
class BlockBoundary extends Component {
|
|
24
|
-
state = {
|
|
25
|
-
failed: false
|
|
26
|
-
};
|
|
27
|
-
static getDerivedStateFromError() {
|
|
28
|
-
return {
|
|
29
|
-
failed: true
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
render() {
|
|
33
|
-
if (this.state.failed) {
|
|
34
|
-
return /*#__PURE__*/_jsx(Text, {
|
|
35
|
-
style: boundaryStyles.fallback,
|
|
36
|
-
testID: "buoy-block-render-failed",
|
|
37
|
-
children: "This card couldn't be drawn \u2014 the data behind it is still in the conversation."
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
return this.props.children;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const boundaryStyles = StyleSheet.create({
|
|
44
|
-
fallback: {
|
|
45
|
-
color: night.color.textTertiary,
|
|
46
|
-
fontSize: night.font.micro,
|
|
47
|
-
fontStyle: "italic",
|
|
48
|
-
paddingVertical: 6
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* The recursion seam for blocks that contain blocks (Tabs).
|
|
54
|
-
*
|
|
55
|
-
* Module scope, so it is one stable function rather than a new closure per
|
|
56
|
-
* render, and defined HERE so ExtraBlocks never has to import this file back —
|
|
57
|
-
* see the note on `Tabs`.
|
|
58
|
-
*/
|
|
59
|
-
const renderNested = block => /*#__PURE__*/_jsx(BlockRenderer, {
|
|
60
|
-
block: block
|
|
61
|
-
});
|
|
62
|
-
export function BlockRenderer({
|
|
63
|
-
block
|
|
64
|
-
}) {
|
|
65
|
-
return /*#__PURE__*/_jsx(BlockBoundary, {
|
|
66
|
-
children: /*#__PURE__*/_jsx(BlockRendererInner, {
|
|
67
|
-
block: block
|
|
68
|
-
})
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
function BlockRendererInner({
|
|
72
|
-
block
|
|
73
|
-
}) {
|
|
74
|
-
switch (block.kind) {
|
|
75
|
-
case "choice":
|
|
76
|
-
return /*#__PURE__*/_jsx(Choice, {
|
|
77
|
-
block: block
|
|
78
|
-
});
|
|
79
|
-
case "confirm":
|
|
80
|
-
return /*#__PURE__*/_jsx(Confirm, {
|
|
81
|
-
block: block
|
|
82
|
-
});
|
|
83
|
-
case "input":
|
|
84
|
-
return /*#__PURE__*/_jsx(Input, {
|
|
85
|
-
block: block
|
|
86
|
-
});
|
|
87
|
-
case "table":
|
|
88
|
-
return /*#__PURE__*/_jsx(Table, {
|
|
89
|
-
block: block
|
|
90
|
-
});
|
|
91
|
-
case "keyValue":
|
|
92
|
-
return /*#__PURE__*/_jsx(KeyValue, {
|
|
93
|
-
block: block
|
|
94
|
-
});
|
|
95
|
-
case "list":
|
|
96
|
-
return /*#__PURE__*/_jsx(List, {
|
|
97
|
-
block: block
|
|
98
|
-
});
|
|
99
|
-
case "imageGrid":
|
|
100
|
-
return /*#__PURE__*/_jsx(ImageGrid, {
|
|
101
|
-
block: block
|
|
102
|
-
});
|
|
103
|
-
case "diff":
|
|
104
|
-
return /*#__PURE__*/_jsx(Diff, {
|
|
105
|
-
block: block
|
|
106
|
-
});
|
|
107
|
-
case "chart":
|
|
108
|
-
return /*#__PURE__*/_jsx(Chart, {
|
|
109
|
-
block: block
|
|
110
|
-
});
|
|
111
|
-
case "steps":
|
|
112
|
-
return /*#__PURE__*/_jsx(Steps, {
|
|
113
|
-
block: block
|
|
114
|
-
});
|
|
115
|
-
case "code":
|
|
116
|
-
return /*#__PURE__*/_jsx(Code, {
|
|
117
|
-
block: block
|
|
118
|
-
});
|
|
119
|
-
case "actions":
|
|
120
|
-
return /*#__PURE__*/_jsx(ActionRow, {
|
|
121
|
-
actions: block.actions,
|
|
122
|
-
blockId: block.id
|
|
123
|
-
});
|
|
124
|
-
case "notice":
|
|
125
|
-
return /*#__PURE__*/_jsx(Notice, {
|
|
126
|
-
block: block
|
|
127
|
-
});
|
|
128
|
-
case "finding":
|
|
129
|
-
return /*#__PURE__*/_jsx(Finding, {
|
|
130
|
-
block: block
|
|
131
|
-
});
|
|
132
|
-
case "requestList":
|
|
133
|
-
return /*#__PURE__*/_jsx(RequestList, {
|
|
134
|
-
block: block
|
|
135
|
-
});
|
|
136
|
-
case "requestCard":
|
|
137
|
-
return /*#__PURE__*/_jsx(RequestCard, {
|
|
138
|
-
block: block
|
|
139
|
-
});
|
|
140
|
-
case "ruleCard":
|
|
141
|
-
return /*#__PURE__*/_jsx(RuleCard, {
|
|
142
|
-
block: block
|
|
143
|
-
});
|
|
144
|
-
case "screenElements":
|
|
145
|
-
return /*#__PURE__*/_jsx(ScreenElements, {
|
|
146
|
-
block: block
|
|
147
|
-
});
|
|
148
|
-
case "routeChips":
|
|
149
|
-
return /*#__PURE__*/_jsx(RouteChips, {
|
|
150
|
-
block: block
|
|
151
|
-
});
|
|
152
|
-
case "logList":
|
|
153
|
-
return /*#__PURE__*/_jsx(LogList, {
|
|
154
|
-
block: block
|
|
155
|
-
});
|
|
156
|
-
case "crash":
|
|
157
|
-
return /*#__PURE__*/_jsx(Crash, {
|
|
158
|
-
block: block
|
|
159
|
-
});
|
|
160
|
-
case "peek":
|
|
161
|
-
return /*#__PURE__*/_jsx(Peek, {
|
|
162
|
-
block: block
|
|
163
|
-
});
|
|
164
|
-
case "suggestions":
|
|
165
|
-
return /*#__PURE__*/_jsx(Suggestions, {
|
|
166
|
-
block: block
|
|
167
|
-
});
|
|
168
|
-
case "multiSelect":
|
|
169
|
-
return /*#__PURE__*/_jsx(MultiSelect, {
|
|
170
|
-
block: block
|
|
171
|
-
});
|
|
172
|
-
case "select":
|
|
173
|
-
return /*#__PURE__*/_jsx(Select, {
|
|
174
|
-
block: block
|
|
175
|
-
});
|
|
176
|
-
case "slider":
|
|
177
|
-
return /*#__PURE__*/_jsx(Slider, {
|
|
178
|
-
block: block
|
|
179
|
-
});
|
|
180
|
-
case "dateTime":
|
|
181
|
-
return /*#__PURE__*/_jsx(DateTime, {
|
|
182
|
-
block: block
|
|
183
|
-
});
|
|
184
|
-
case "form":
|
|
185
|
-
return /*#__PURE__*/_jsx(Form, {
|
|
186
|
-
block: block
|
|
187
|
-
});
|
|
188
|
-
case "proposal":
|
|
189
|
-
return /*#__PURE__*/_jsx(Proposal, {
|
|
190
|
-
block: block
|
|
191
|
-
});
|
|
192
|
-
case "claim":
|
|
193
|
-
return /*#__PURE__*/_jsx(Claim, {
|
|
194
|
-
block: block
|
|
195
|
-
});
|
|
196
|
-
case "details":
|
|
197
|
-
return /*#__PURE__*/_jsx(Details, {
|
|
198
|
-
block: block
|
|
199
|
-
});
|
|
200
|
-
case "tabs":
|
|
201
|
-
return /*#__PURE__*/_jsx(Tabs, {
|
|
202
|
-
block: block,
|
|
203
|
-
renderNested: renderNested
|
|
204
|
-
});
|
|
205
|
-
case "timeline":
|
|
206
|
-
return /*#__PURE__*/_jsx(Timeline, {
|
|
207
|
-
block: block
|
|
208
|
-
});
|
|
209
|
-
case "sparkline":
|
|
210
|
-
return /*#__PURE__*/_jsx(Sparkline, {
|
|
211
|
-
block: block
|
|
212
|
-
});
|
|
213
|
-
case "compare":
|
|
214
|
-
return /*#__PURE__*/_jsx(Compare, {
|
|
215
|
-
block: block
|
|
216
|
-
});
|
|
217
|
-
case "card":
|
|
218
|
-
return /*#__PURE__*/_jsx(CardView, {
|
|
219
|
-
block: block
|
|
220
|
-
});
|
|
221
|
-
case "cardCarousel":
|
|
222
|
-
return /*#__PURE__*/_jsx(CardCarousel, {
|
|
223
|
-
block: block
|
|
224
|
-
});
|
|
225
|
-
case "screenshot":
|
|
226
|
-
return /*#__PURE__*/_jsx(Screenshot, {
|
|
227
|
-
block: block
|
|
228
|
-
});
|
|
229
|
-
case "plan":
|
|
230
|
-
return /*#__PURE__*/_jsx(Plan, {
|
|
231
|
-
block: block
|
|
232
|
-
});
|
|
233
|
-
case "checkpoint":
|
|
234
|
-
return /*#__PURE__*/_jsx(Checkpoint, {
|
|
235
|
-
block: block
|
|
236
|
-
});
|
|
237
|
-
case "task":
|
|
238
|
-
return /*#__PURE__*/_jsx(Task, {
|
|
239
|
-
block: block
|
|
240
|
-
});
|
|
241
|
-
case "banner":
|
|
242
|
-
return /*#__PURE__*/_jsx(Banner, {
|
|
243
|
-
block: block
|
|
244
|
-
});
|
|
245
|
-
case "file":
|
|
246
|
-
return /*#__PURE__*/_jsx(File, {
|
|
247
|
-
block: block
|
|
248
|
-
});
|
|
249
|
-
case "upload":
|
|
250
|
-
return /*#__PURE__*/_jsx(Upload, {
|
|
251
|
-
block: block
|
|
252
|
-
});
|
|
253
|
-
default:
|
|
254
|
-
return null;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
//# sourceMappingURL=BlockRenderer.js.map
|
|
1
|
+
"use strict";import{Component as a}from"react";import{StyleSheet as n,Text as s}from"react-native";import{night as t}from"@buoy-gg/shared-ui";import{Choice as c,Confirm as i,Input as o}from"./AskBlocks";import{Chart as u,Code as l,Diff as d,Finding as m,KeyValue as p,List as f,Notice as h,Steps as C,Table as k}from"./DataBlocks";import{ImageGrid as S}from"./MediaBlocks";import{Crash as b,LogList as g,Peek as y,RequestCard as T,RequestList as R,RouteChips as x,RuleCard as L,ScreenElements as B}from"./ReceiptBlocks";import{Banner as D,CardCarousel as I,CardView as q,Checkpoint as w,Claim as F,Compare as V,DateTime as E,Details as N,File as P,Form as j,MultiSelect as v,Plan as G,Proposal as z,Screenshot as A,Select as K,Slider as M,Sparkline as U,Suggestions as _,Tabs as H,Task as J,Timeline as O,Upload as Q}from"./ExtraBlocks";import{ActionRow as W}from"./primitives";import{jsx as r}from"react/jsx-runtime";class X extends a{state={failed:false};static getDerivedStateFromError(){return{failed:true}}render(){if(this.state.failed){return r(s,{style:Y.fallback,testID:"buoy-block-render-failed",children:"This card couldn't be drawn \u2014 the data behind it is still in the conversation."})}return this.props.children}}const Y=n.create({fallback:{color:t.color.textTertiary,fontSize:t.font.micro,fontStyle:"italic",paddingVertical:6}});const Z=e=>r(BlockRenderer,{block:e});export function BlockRenderer({block:e}){return r(X,{children:r($,{block:e})})}function $({block:e}){switch(e.kind){case"choice":return r(c,{block:e});case"confirm":return r(i,{block:e});case"input":return r(o,{block:e});case"table":return r(k,{block:e});case"keyValue":return r(p,{block:e});case"list":return r(f,{block:e});case"imageGrid":return r(S,{block:e});case"diff":return r(d,{block:e});case"chart":return r(u,{block:e});case"steps":return r(C,{block:e});case"code":return r(l,{block:e});case"actions":return r(W,{actions:e.actions,blockId:e.id});case"notice":return r(h,{block:e});case"finding":return r(m,{block:e});case"requestList":return r(R,{block:e});case"requestCard":return r(T,{block:e});case"ruleCard":return r(L,{block:e});case"screenElements":return r(B,{block:e});case"routeChips":return r(x,{block:e});case"logList":return r(g,{block:e});case"crash":return r(b,{block:e});case"peek":return r(y,{block:e});case"suggestions":return r(_,{block:e});case"multiSelect":return r(v,{block:e});case"select":return r(K,{block:e});case"slider":return r(M,{block:e});case"dateTime":return r(E,{block:e});case"form":return r(j,{block:e});case"proposal":return r(z,{block:e});case"claim":return r(F,{block:e});case"details":return r(N,{block:e});case"tabs":return r(H,{block:e,renderNested:Z});case"timeline":return r(O,{block:e});case"sparkline":return r(U,{block:e});case"compare":return r(V,{block:e});case"card":return r(q,{block:e});case"cardCarousel":return r(I,{block:e});case"screenshot":return r(A,{block:e});case"plan":return r(G,{block:e});case"checkpoint":return r(w,{block:e});case"task":return r(J,{block:e});case"banner":return r(D,{block:e});case"file":return r(P,{block:e});case"upload":return r(Q,{block:e});default:return null}}
|