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