@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.
Files changed (153) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/blocks/AskBlocks.js +1 -338
  3. package/lib/commonjs/blocks/BlockRenderer.js +1 -250
  4. package/lib/commonjs/blocks/ChromePrototypes.js +1 -514
  5. package/lib/commonjs/blocks/DataBlocks.js +1 -545
  6. package/lib/commonjs/blocks/ExtraBlocks.js +1 -1821
  7. package/lib/commonjs/blocks/MediaBlocks.js +1 -140
  8. package/lib/commonjs/blocks/ReceiptBlocks.js +1 -596
  9. package/lib/commonjs/blocks/context.js +1 -42
  10. package/lib/commonjs/blocks/icons.js +1 -96
  11. package/lib/commonjs/blocks/index.js +1 -95
  12. package/lib/commonjs/blocks/primitives.js +1 -312
  13. package/lib/commonjs/blocks/primitivesIndex.js +1 -56
  14. package/lib/commonjs/components/ApprovalCard.js +1 -140
  15. package/lib/commonjs/components/AskBuoyHeader.js +1 -127
  16. package/lib/commonjs/components/AskBuoyIcon.js +1 -19
  17. package/lib/commonjs/components/AskBuoyModal.js +1 -322
  18. package/lib/commonjs/components/ChangesBar.js +1 -211
  19. package/lib/commonjs/components/Composer.js +1 -175
  20. package/lib/commonjs/components/EmptyState.js +1 -154
  21. package/lib/commonjs/components/Markdown.js +1 -252
  22. package/lib/commonjs/components/MessageList.js +1 -648
  23. package/lib/commonjs/components/TypingDots.js +1 -63
  24. package/lib/commonjs/index.js +1 -205
  25. package/lib/commonjs/preset.js +1 -90
  26. package/lib/commonjs/store/askBuoyStore.js +1 -279
  27. package/lib/commonjs/store/useAskBuoy.js +1 -299
  28. package/lib/commonjs/sync/askBuoySyncAdapter.js +1 -119
  29. package/lib/commonjs/sync/askBuoySyncAdapter.test.js +1 -136
  30. package/lib/commonjs/sync/wire.js +1 -58
  31. package/lib/commonjs/types.js +1 -6
  32. package/lib/module/blocks/AskBlocks.js +1 -331
  33. package/lib/module/blocks/BlockRenderer.js +1 -245
  34. package/lib/module/blocks/ChromePrototypes.js +1 -503
  35. package/lib/module/blocks/DataBlocks.js +1 -532
  36. package/lib/module/blocks/ExtraBlocks.js +1 -1794
  37. package/lib/module/blocks/MediaBlocks.js +1 -135
  38. package/lib/module/blocks/ReceiptBlocks.js +1 -584
  39. package/lib/module/blocks/context.js +1 -35
  40. package/lib/module/blocks/icons.js +1 -91
  41. package/lib/module/blocks/index.js +1 -8
  42. package/lib/module/blocks/primitives.js +1 -301
  43. package/lib/module/blocks/primitivesIndex.js +1 -5
  44. package/lib/module/components/ApprovalCard.js +1 -135
  45. package/lib/module/components/AskBuoyHeader.js +1 -124
  46. package/lib/module/components/AskBuoyIcon.js +1 -8
  47. package/lib/module/components/AskBuoyModal.js +1 -317
  48. package/lib/module/components/ChangesBar.js +1 -206
  49. package/lib/module/components/Composer.js +1 -170
  50. package/lib/module/components/EmptyState.js +1 -149
  51. package/lib/module/components/Markdown.js +1 -246
  52. package/lib/module/components/MessageList.js +1 -642
  53. package/lib/module/components/TypingDots.js +1 -58
  54. package/lib/module/index.js +1 -29
  55. package/lib/module/preset.js +1 -73
  56. package/lib/module/store/askBuoyStore.js +1 -275
  57. package/lib/module/store/useAskBuoy.js +1 -293
  58. package/lib/module/sync/askBuoySyncAdapter.js +1 -114
  59. package/lib/module/sync/askBuoySyncAdapter.test.js +1 -135
  60. package/lib/module/sync/wire.js +1 -47
  61. package/lib/module/types.js +1 -4
  62. package/lib/typescript/preset.d.ts +1 -1
  63. package/package.json +8 -8
  64. package/lib/commonjs/blocks/AskBlocks.js.map +0 -1
  65. package/lib/commonjs/blocks/BlockRenderer.js.map +0 -1
  66. package/lib/commonjs/blocks/ChromePrototypes.js.map +0 -1
  67. package/lib/commonjs/blocks/DataBlocks.js.map +0 -1
  68. package/lib/commonjs/blocks/ExtraBlocks.js.map +0 -1
  69. package/lib/commonjs/blocks/MediaBlocks.js.map +0 -1
  70. package/lib/commonjs/blocks/ReceiptBlocks.js.map +0 -1
  71. package/lib/commonjs/blocks/context.js.map +0 -1
  72. package/lib/commonjs/blocks/icons.js.map +0 -1
  73. package/lib/commonjs/blocks/index.js.map +0 -1
  74. package/lib/commonjs/blocks/primitives.js.map +0 -1
  75. package/lib/commonjs/blocks/primitivesIndex.js.map +0 -1
  76. package/lib/commonjs/components/ApprovalCard.js.map +0 -1
  77. package/lib/commonjs/components/AskBuoyHeader.js.map +0 -1
  78. package/lib/commonjs/components/AskBuoyIcon.js.map +0 -1
  79. package/lib/commonjs/components/AskBuoyModal.js.map +0 -1
  80. package/lib/commonjs/components/ChangesBar.js.map +0 -1
  81. package/lib/commonjs/components/Composer.js.map +0 -1
  82. package/lib/commonjs/components/EmptyState.js.map +0 -1
  83. package/lib/commonjs/components/Markdown.js.map +0 -1
  84. package/lib/commonjs/components/MessageList.js.map +0 -1
  85. package/lib/commonjs/components/TypingDots.js.map +0 -1
  86. package/lib/commonjs/index.js.map +0 -1
  87. package/lib/commonjs/preset.js.map +0 -1
  88. package/lib/commonjs/store/askBuoyStore.js.map +0 -1
  89. package/lib/commonjs/store/useAskBuoy.js.map +0 -1
  90. package/lib/commonjs/sync/askBuoySyncAdapter.js.map +0 -1
  91. package/lib/commonjs/sync/askBuoySyncAdapter.test.js.map +0 -1
  92. package/lib/commonjs/sync/wire.js.map +0 -1
  93. package/lib/commonjs/types.js.map +0 -1
  94. package/lib/module/blocks/AskBlocks.js.map +0 -1
  95. package/lib/module/blocks/BlockRenderer.js.map +0 -1
  96. package/lib/module/blocks/ChromePrototypes.js.map +0 -1
  97. package/lib/module/blocks/DataBlocks.js.map +0 -1
  98. package/lib/module/blocks/ExtraBlocks.js.map +0 -1
  99. package/lib/module/blocks/MediaBlocks.js.map +0 -1
  100. package/lib/module/blocks/ReceiptBlocks.js.map +0 -1
  101. package/lib/module/blocks/context.js.map +0 -1
  102. package/lib/module/blocks/icons.js.map +0 -1
  103. package/lib/module/blocks/index.js.map +0 -1
  104. package/lib/module/blocks/primitives.js.map +0 -1
  105. package/lib/module/blocks/primitivesIndex.js.map +0 -1
  106. package/lib/module/components/ApprovalCard.js.map +0 -1
  107. package/lib/module/components/AskBuoyHeader.js.map +0 -1
  108. package/lib/module/components/AskBuoyIcon.js.map +0 -1
  109. package/lib/module/components/AskBuoyModal.js.map +0 -1
  110. package/lib/module/components/ChangesBar.js.map +0 -1
  111. package/lib/module/components/Composer.js.map +0 -1
  112. package/lib/module/components/EmptyState.js.map +0 -1
  113. package/lib/module/components/Markdown.js.map +0 -1
  114. package/lib/module/components/MessageList.js.map +0 -1
  115. package/lib/module/components/TypingDots.js.map +0 -1
  116. package/lib/module/index.js.map +0 -1
  117. package/lib/module/preset.js.map +0 -1
  118. package/lib/module/store/askBuoyStore.js.map +0 -1
  119. package/lib/module/store/useAskBuoy.js.map +0 -1
  120. package/lib/module/sync/askBuoySyncAdapter.js.map +0 -1
  121. package/lib/module/sync/askBuoySyncAdapter.test.js.map +0 -1
  122. package/lib/module/sync/wire.js.map +0 -1
  123. package/lib/module/types.js.map +0 -1
  124. package/lib/typescript/blocks/AskBlocks.d.ts.map +0 -1
  125. package/lib/typescript/blocks/BlockRenderer.d.ts.map +0 -1
  126. package/lib/typescript/blocks/ChromePrototypes.d.ts.map +0 -1
  127. package/lib/typescript/blocks/DataBlocks.d.ts.map +0 -1
  128. package/lib/typescript/blocks/ExtraBlocks.d.ts.map +0 -1
  129. package/lib/typescript/blocks/MediaBlocks.d.ts.map +0 -1
  130. package/lib/typescript/blocks/ReceiptBlocks.d.ts.map +0 -1
  131. package/lib/typescript/blocks/context.d.ts.map +0 -1
  132. package/lib/typescript/blocks/icons.d.ts.map +0 -1
  133. package/lib/typescript/blocks/index.d.ts.map +0 -1
  134. package/lib/typescript/blocks/primitives.d.ts.map +0 -1
  135. package/lib/typescript/blocks/primitivesIndex.d.ts.map +0 -1
  136. package/lib/typescript/components/ApprovalCard.d.ts.map +0 -1
  137. package/lib/typescript/components/AskBuoyHeader.d.ts.map +0 -1
  138. package/lib/typescript/components/AskBuoyIcon.d.ts.map +0 -1
  139. package/lib/typescript/components/AskBuoyModal.d.ts.map +0 -1
  140. package/lib/typescript/components/ChangesBar.d.ts.map +0 -1
  141. package/lib/typescript/components/Composer.d.ts.map +0 -1
  142. package/lib/typescript/components/EmptyState.d.ts.map +0 -1
  143. package/lib/typescript/components/Markdown.d.ts.map +0 -1
  144. package/lib/typescript/components/MessageList.d.ts.map +0 -1
  145. package/lib/typescript/components/TypingDots.d.ts.map +0 -1
  146. package/lib/typescript/index.d.ts.map +0 -1
  147. package/lib/typescript/preset.d.ts.map +0 -1
  148. package/lib/typescript/store/askBuoyStore.d.ts.map +0 -1
  149. package/lib/typescript/store/useAskBuoy.d.ts.map +0 -1
  150. package/lib/typescript/sync/askBuoySyncAdapter.d.ts.map +0 -1
  151. package/lib/typescript/sync/askBuoySyncAdapter.test.d.ts.map +0 -1
  152. package/lib/typescript/sync/wire.d.ts.map +0 -1
  153. package/lib/typescript/types.d.ts.map +0 -1
@@ -1,596 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Crash = Crash;
7
- exports.LogList = LogList;
8
- exports.Peek = Peek;
9
- exports.RequestCard = RequestCard;
10
- exports.RequestList = RequestList;
11
- exports.RouteChips = RouteChips;
12
- exports.RuleCard = RuleCard;
13
- exports.ScreenElements = ScreenElements;
14
- var _react = require("react");
15
- var _reactNative = require("react-native");
16
- var _sharedUi = require("@buoy-gg/shared-ui");
17
- var _agentCore = require("@buoy-gg/agent-core");
18
- var _context = require("./context");
19
- var _primitives = require("./primitives");
20
- var _jsxRuntime = require("react/jsx-runtime");
21
- /**
22
- * Receipts — engine-made blocks for the tools people ask about most.
23
- * Each one is a card the matching Buoy tool could have drawn, with one tap
24
- * into that tool where the host supports it.
25
- */
26
-
27
- function statusColor(status) {
28
- if (status === undefined) return _sharedUi.night.color.textTertiary;
29
- if (status >= 500) return _sharedUi.night.color.danger;
30
- if (status >= 400) return _sharedUi.night.color.warning;
31
- if (status >= 300) return _sharedUi.night.color.info;
32
- return _sharedUi.night.color.accent;
33
- }
34
- function pathOf(url) {
35
- try {
36
- const u = new URL(url);
37
- return u.pathname + (u.search ? "?…" : "");
38
- } catch {
39
- return url;
40
- }
41
- }
42
- function StatusPill({
43
- status
44
- }) {
45
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
46
- style: [_primitives.blockStyles.pill, {
47
- backgroundColor: `${statusColor(status)}22`
48
- }],
49
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
50
- style: [_primitives.blockStyles.pillText, {
51
- color: statusColor(status)
52
- }],
53
- children: status ?? "…"
54
- })
55
- });
56
- }
57
- function RequestList({
58
- block
59
- }) {
60
- const h = (0, _context.useBlockHandlers)();
61
- const canOpen = h.supports?.openTool !== false;
62
- const {
63
- visible,
64
- expanded,
65
- toggle
66
- } = (0, _primitives.useExpand)(block.requests, _agentCore.CAPS.listItems);
67
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
68
- title: block.title ?? "Network requests",
69
- source: block.source,
70
- testID: `buoy-block-requests-${block.id}`,
71
- children: [visible.map((r, i) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
72
- disabled: !canOpen,
73
- onPress: () => void h.runAction({
74
- label: "Open in Network",
75
- openTool: {
76
- toolId: "network",
77
- select: r.id
78
- }
79
- }, block.id),
80
- style: [_primitives.blockStyles.row, i > 0 && _primitives.blockStyles.rowDivider],
81
- accessibilityRole: canOpen ? "button" : undefined,
82
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
83
- style: styles.method,
84
- children: r.method
85
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
86
- style: _primitives.blockStyles.rowTitle,
87
- numberOfLines: 1,
88
- children: pathOf(r.url)
89
- }), r.mocked ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
90
- style: styles.mockedChip,
91
- children: "MOCKED"
92
- }) : null, r.durationMs !== undefined ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
93
- style: _primitives.blockStyles.rowTrailing,
94
- children: [r.durationMs, " ms"]
95
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(StatusPill, {
96
- status: r.status
97
- }), canOpen ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChevronRight, {
98
- size: 12,
99
- color: _sharedUi.night.color.textTertiary
100
- }) : null]
101
- }, r.id)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.More, {
102
- shown: visible.length,
103
- total: block.total ?? block.requests.length,
104
- onExpand: block.requests.length > visible.length || expanded ? toggle : undefined,
105
- expanded: expanded
106
- })]
107
- });
108
- }
109
- function RequestCard({
110
- block
111
- }) {
112
- const [tab, setTab] = (0, _react.useState)("response");
113
- const body = tab === "response" ? block.responseBody : block.requestBody;
114
- const text = body === undefined ? "(none)" : typeof body === "string" ? body : JSON.stringify(body, null, 2);
115
- const h = (0, _context.useBlockHandlers)();
116
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
117
- source: block.source,
118
- testID: `buoy-block-request-${block.id}`,
119
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
120
- style: [_primitives.blockStyles.row, styles.reqHead],
121
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
122
- style: styles.method,
123
- children: block.request.method
124
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
125
- style: _primitives.blockStyles.rowTitle,
126
- numberOfLines: 2,
127
- children: pathOf(block.request.url)
128
- }), block.request.mocked ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
129
- style: styles.mockedChip,
130
- children: "MOCKED"
131
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(StatusPill, {
132
- status: block.request.status
133
- })]
134
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
135
- style: styles.tabs,
136
- children: ["response", "request"].map(t => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
137
- onPress: () => setTab(t),
138
- style: [styles.tab, tab === t && styles.tabOn],
139
- accessibilityRole: "tab",
140
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
141
- style: [styles.tabText, tab === t && styles.tabTextOn],
142
- children: t === "response" ? "Response" : "Request"
143
- })
144
- }, t))
145
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
146
- style: [_primitives.blockStyles.mono, styles.body],
147
- numberOfLines: 14,
148
- selectable: true,
149
- children: text.length > 1600 ? `${text.slice(0, 1600)}\n…` : text
150
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ActionRow, {
151
- blockId: block.id,
152
- actions: [{
153
- label: "Open in Network",
154
- openTool: {
155
- toolId: "network",
156
- select: block.request.id
157
- }
158
- }]
159
- }), h.supports?.openTool === false ? null : null]
160
- });
161
- }
162
- function RuleCard({
163
- block
164
- }) {
165
- const r = block.rule;
166
- const outcome = r.kind === "fail" ? "fails (no network)" : r.kind === "delay" ? `delayed ${r.delayMs ?? 0} ms` : `returns ${r.status ?? 200}`;
167
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
168
- title: r.name ?? "Network override",
169
- source: block.source,
170
- testID: `buoy-block-rule-${block.id}`,
171
- tone: r.enabled ? "warning" : undefined,
172
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
173
- style: styles.ruleBody,
174
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
175
- style: styles.ruleLine,
176
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
177
- style: styles.ruleKey,
178
- children: [r.methods?.length ? r.methods.join("/") : "ANY", " "]
179
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
180
- style: _primitives.blockStyles.mono,
181
- children: r.urlPattern
182
- })]
183
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
184
- style: styles.ruleLine,
185
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
186
- style: styles.ruleKey,
187
- children: "\u2192 "
188
- }), outcome, r.times ? ` · ${r.times === 1 ? "once" : `${r.times} times`}` : " · every time", r.hits !== undefined ? ` · ${r.hits} hit${r.hits === 1 ? "" : "s"}` : ""]
189
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
190
- style: [_primitives.blockStyles.pill, r.enabled ? styles.on : styles.off],
191
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
192
- style: [_primitives.blockStyles.pillText, {
193
- color: r.enabled ? _sharedUi.night.color.onAccent : _sharedUi.night.color.textSecondary
194
- }],
195
- children: r.enabled ? "ON" : "OFF"
196
- })
197
- })]
198
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ActionRow, {
199
- blockId: block.id,
200
- actions: [r.enabled ? {
201
- label: "Turn off",
202
- dispatch: {
203
- toolId: "network",
204
- action: "setOverrideRuleEnabled",
205
- params: {
206
- id: r.id,
207
- enabled: false
208
- }
209
- }
210
- } : {
211
- label: "Turn on",
212
- primary: true,
213
- dispatch: {
214
- toolId: "network",
215
- action: "setOverrideRuleEnabled",
216
- params: {
217
- id: r.id,
218
- enabled: true
219
- }
220
- }
221
- }, {
222
- label: "Delete",
223
- dispatch: {
224
- toolId: "network",
225
- action: "deleteOverrideRule",
226
- params: {
227
- id: r.id
228
- }
229
- }
230
- }]
231
- })]
232
- });
233
- }
234
- function ScreenElements({
235
- block
236
- }) {
237
- const h = (0, _context.useBlockHandlers)();
238
- const {
239
- visible,
240
- expanded,
241
- toggle
242
- } = (0, _primitives.useExpand)(block.elements, _agentCore.CAPS.chips);
243
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
244
- title: block.title ?? "On screen right now",
245
- source: block.source,
246
- testID: `buoy-block-screen-${block.id}`,
247
- children: [visible.map((e, i) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
248
- onPress: () => void h.runAction({
249
- label: "Highlight",
250
- dispatch: {
251
- toolId: "highlight-updates",
252
- action: "setSpotlight",
253
- params: {
254
- nativeTag: e.nativeTag
255
- }
256
- }
257
- }, block.id),
258
- disabled: h.supports?.dispatch === false,
259
- style: [_primitives.blockStyles.row, i > 0 && _primitives.blockStyles.rowDivider],
260
- accessibilityRole: "button",
261
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Eye, {
262
- size: 12,
263
- color: _sharedUi.night.color.textTertiary
264
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
265
- style: _primitives.blockStyles.rowTitle,
266
- numberOfLines: 1,
267
- children: e.label ?? e.testID ?? e.name
268
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
269
- style: _primitives.blockStyles.rowTrailing,
270
- numberOfLines: 1,
271
- children: e.name
272
- })]
273
- }, e.nativeTag)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.More, {
274
- shown: visible.length,
275
- total: block.total,
276
- onExpand: block.elements.length > visible.length || expanded ? toggle : undefined,
277
- expanded: expanded
278
- })]
279
- });
280
- }
281
- function RouteChips({
282
- block
283
- }) {
284
- const h = (0, _context.useBlockHandlers)();
285
- const [expanded, setExpanded] = (0, _react.useState)(false);
286
- const routes = expanded ? block.routes : block.routes.slice(0, _agentCore.CAPS.chips);
287
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
288
- title: block.current ? `Routes · you're on ${block.current}` : "Routes",
289
- source: block.source,
290
- testID: `buoy-block-routes-${block.id}`,
291
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
292
- style: styles.chips,
293
- children: routes.map(r => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
294
- disabled: h.supports?.dispatch === false,
295
- onPress: () => r.dynamic ? h.answer({
296
- blockId: block.id,
297
- kind: "input",
298
- value: `Open ${r.path} — which id?`
299
- }) : void h.runAction({
300
- label: `Open ${r.path}`,
301
- dispatch: {
302
- toolId: "route-events",
303
- action: "navigate",
304
- params: {
305
- path: r.path
306
- }
307
- }
308
- }, block.id),
309
- style: [styles.chip, r.path === block.current && styles.chipCurrent],
310
- accessibilityRole: "button",
311
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
312
- style: [styles.chipText, r.dynamic && styles.chipDynamic],
313
- children: r.path
314
- })
315
- }, r.path))
316
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.More, {
317
- shown: routes.length,
318
- total: block.total ?? block.routes.length,
319
- onExpand: () => setExpanded(v => !v),
320
- expanded: expanded
321
- })]
322
- });
323
- }
324
- const LEVEL_COLOR = {
325
- error: _sharedUi.night.color.danger,
326
- warn: _sharedUi.night.color.warning,
327
- warning: _sharedUi.night.color.warning,
328
- info: _sharedUi.night.color.info
329
- };
330
- function LogList({
331
- block
332
- }) {
333
- const {
334
- visible,
335
- expanded,
336
- toggle
337
- } = (0, _primitives.useExpand)(block.entries, _agentCore.CAPS.listItems);
338
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
339
- title: "Console",
340
- source: block.source,
341
- testID: `buoy-block-logs-${block.id}`,
342
- children: [visible.map((e, i) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
343
- style: [_primitives.blockStyles.row, i > 0 && _primitives.blockStyles.rowDivider, styles.logRow],
344
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
345
- style: [_primitives.blockStyles.pill, {
346
- backgroundColor: `${LEVEL_COLOR[e.level] ?? _sharedUi.night.color.textTertiary}22`
347
- }],
348
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
349
- style: [_primitives.blockStyles.pillText, {
350
- color: LEVEL_COLOR[e.level] ?? _sharedUi.night.color.textSecondary
351
- }],
352
- children: e.level.toUpperCase()
353
- })
354
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
355
- style: [_primitives.blockStyles.rowTitle, _primitives.blockStyles.mono],
356
- numberOfLines: 3,
357
- children: e.message
358
- }), e.count > 1 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
359
- style: _primitives.blockStyles.rowTrailing,
360
- children: ["\xD7", e.count]
361
- }) : null]
362
- }, `${e.level}-${e.message}-${i}`)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.More, {
363
- shown: visible.length,
364
- total: block.total,
365
- onExpand: block.entries.length > visible.length || expanded ? toggle : undefined,
366
- expanded: expanded
367
- })]
368
- });
369
- }
370
- function Crash({
371
- block
372
- }) {
373
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.Card, {
374
- tone: "danger",
375
- testID: `buoy-block-crash-${block.id}`,
376
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
377
- style: styles.crashHead,
378
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.AlertTriangle, {
379
- size: 14,
380
- color: _sharedUi.night.color.danger
381
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
382
- style: styles.crashTitle,
383
- children: ["The app crashed", block.route ? ` on ${block.route}` : ""]
384
- })]
385
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
386
- style: [_primitives.blockStyles.mono, styles.crashMsg],
387
- numberOfLines: 4,
388
- selectable: true,
389
- children: block.message
390
- }), block.suspect ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
391
- style: styles.suspect,
392
- children: ["Most likely cause: ", block.suspect.label]
393
- }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.ActionRow, {
394
- blockId: block.id,
395
- actions: [...(block.suspect?.action ? [{
396
- ...block.suspect.action,
397
- primary: true
398
- }] : []), ...(block.actions ?? [])].slice(0, 2)
399
- })]
400
- });
401
- }
402
-
403
- /** A chip, not a card: the agent moved the app; let the user look. */
404
- function Peek({
405
- block
406
- }) {
407
- const h = (0, _context.useBlockHandlers)();
408
- const can = h.supports?.minimize !== false;
409
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
410
- testID: `buoy-block-peek-${block.id}`,
411
- disabled: !can,
412
- onPress: () => void h.runAction({
413
- label: "Look",
414
- minimize: true
415
- }, block.id),
416
- style: ({
417
- pressed
418
- }) => [styles.peek, pressed && {
419
- opacity: 0.7
420
- }],
421
- accessibilityRole: "button",
422
- accessibilityLabel: `${block.label}. Look at the app`,
423
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
424
- style: styles.peekText,
425
- children: block.label
426
- }), can ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
427
- style: styles.peekLook,
428
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Eye, {
429
- size: 12,
430
- color: _sharedUi.night.color.accent
431
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
432
- style: styles.peekLookText,
433
- children: "Look"
434
- })]
435
- }) : null]
436
- });
437
- }
438
- const styles = _reactNative.StyleSheet.create({
439
- method: {
440
- color: _sharedUi.night.color.textSecondary,
441
- fontSize: _sharedUi.night.font.micro,
442
- fontWeight: "700",
443
- letterSpacing: 0.4,
444
- width: 44
445
- },
446
- // The provenance chip for a response an override rule synthesized. Loud on
447
- // purpose: mocked data rendered like live data is how testers file bugs
448
- // against reality that never existed.
449
- mockedChip: {
450
- color: _sharedUi.night.color.warning,
451
- backgroundColor: _sharedUi.night.color.warningSoft,
452
- fontSize: 9,
453
- fontWeight: "700",
454
- letterSpacing: 0.6,
455
- paddingHorizontal: 5,
456
- paddingVertical: 1,
457
- borderRadius: _sharedUi.night.radius.badge,
458
- overflow: "hidden"
459
- },
460
- reqHead: {
461
- paddingTop: 12
462
- },
463
- tabs: {
464
- flexDirection: "row",
465
- gap: 6,
466
- paddingHorizontal: 12,
467
- paddingTop: 4,
468
- paddingBottom: 8
469
- },
470
- tab: {
471
- paddingHorizontal: 10,
472
- paddingVertical: 5,
473
- borderRadius: _sharedUi.night.radius.badge,
474
- backgroundColor: _sharedUi.night.color.fill
475
- },
476
- tabOn: {
477
- backgroundColor: _sharedUi.night.color.accentSoft
478
- },
479
- tabText: {
480
- color: _sharedUi.night.color.textSecondary,
481
- fontSize: _sharedUi.night.font.micro,
482
- fontWeight: "600"
483
- },
484
- tabTextOn: {
485
- color: _sharedUi.night.color.accent
486
- },
487
- body: {
488
- paddingHorizontal: 12,
489
- paddingBottom: 4,
490
- lineHeight: 16,
491
- color: _sharedUi.night.color.textSecondary
492
- },
493
- ruleBody: {
494
- paddingHorizontal: 12,
495
- paddingTop: 4,
496
- paddingBottom: 4,
497
- gap: 4
498
- },
499
- ruleLine: {
500
- color: _sharedUi.night.color.text,
501
- fontSize: _sharedUi.night.font.caption,
502
- lineHeight: 18
503
- },
504
- ruleKey: {
505
- color: _sharedUi.night.color.textSecondary,
506
- fontWeight: "700"
507
- },
508
- on: {
509
- alignSelf: "flex-start",
510
- backgroundColor: _sharedUi.night.color.accent,
511
- marginTop: 4
512
- },
513
- off: {
514
- alignSelf: "flex-start",
515
- backgroundColor: _sharedUi.night.color.fillTertiary,
516
- marginTop: 4
517
- },
518
- chips: {
519
- flexDirection: "row",
520
- flexWrap: "wrap",
521
- gap: 6,
522
- padding: 12
523
- },
524
- chip: {
525
- paddingHorizontal: 10,
526
- paddingVertical: 6,
527
- borderRadius: _sharedUi.night.radius.chip,
528
- backgroundColor: _sharedUi.night.color.fill,
529
- borderWidth: _reactNative.StyleSheet.hairlineWidth,
530
- borderColor: _sharedUi.night.color.border
531
- },
532
- chipCurrent: {
533
- backgroundColor: _sharedUi.night.color.accentSoft,
534
- borderColor: _sharedUi.night.color.accentBorderStrong
535
- },
536
- chipText: {
537
- color: _sharedUi.night.color.text,
538
- fontSize: _sharedUi.night.font.caption,
539
- fontFamily: "Menlo"
540
- },
541
- chipDynamic: {
542
- color: _sharedUi.night.color.textSecondary
543
- },
544
- logRow: {
545
- alignItems: "flex-start"
546
- },
547
- crashHead: {
548
- flexDirection: "row",
549
- alignItems: "center",
550
- gap: 8,
551
- paddingHorizontal: 12,
552
- paddingTop: 12
553
- },
554
- crashTitle: {
555
- color: _sharedUi.night.color.danger,
556
- fontSize: _sharedUi.night.font.row,
557
- fontWeight: "600"
558
- },
559
- crashMsg: {
560
- paddingHorizontal: 12,
561
- paddingTop: 6,
562
- color: _sharedUi.night.color.text
563
- },
564
- suspect: {
565
- color: _sharedUi.night.color.textSecondary,
566
- fontSize: _sharedUi.night.font.caption,
567
- paddingHorizontal: 12,
568
- paddingTop: 6
569
- },
570
- peek: {
571
- alignSelf: "flex-start",
572
- flexDirection: "row",
573
- alignItems: "center",
574
- gap: 10,
575
- paddingLeft: 12,
576
- paddingRight: 10,
577
- paddingVertical: 7,
578
- borderRadius: _sharedUi.night.radius.chip,
579
- backgroundColor: _sharedUi.night.color.fill
580
- },
581
- peekText: {
582
- color: _sharedUi.night.color.textSecondary,
583
- fontSize: _sharedUi.night.font.caption
584
- },
585
- peekLook: {
586
- flexDirection: "row",
587
- alignItems: "center",
588
- gap: 4
589
- },
590
- peekLookText: {
591
- color: _sharedUi.night.color.accent,
592
- fontSize: _sharedUi.night.font.caption,
593
- fontWeight: "600"
594
- }
595
- });
596
- //# sourceMappingURL=ReceiptBlocks.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Crash=Crash,exports.LogList=LogList,exports.Peek=Peek,exports.RequestCard=RequestCard,exports.RequestList=RequestList,exports.RouteChips=RouteChips,exports.RuleCard=RuleCard,exports.ScreenElements=ScreenElements;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_agentCore=require("@buoy-gg/agent-core"),_context=require("./context"),_primitives=require("./primitives"),_jsxRuntime=require("react/jsx-runtime");function statusColor(e){return void 0===e?_sharedUi.night.color.textTertiary:e>=500?_sharedUi.night.color.danger:e>=400?_sharedUi.night.color.warning:e>=300?_sharedUi.night.color.info:_sharedUi.night.color.accent}function pathOf(e){try{const t=new URL(e);return t.pathname+(t.search?"?…":"")}catch{return e}}function StatusPill({status:e}){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_primitives.blockStyles.pill,{backgroundColor:`${statusColor(e)}22`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.pillText,{color:statusColor(e)}],children:e??"…"})})}function RequestList({block:e}){const t=(0,_context.useBlockHandlers)(),i=!1!==t.supports?.openTool,{visible:s,expanded:r,toggle:o}=(0,_primitives.useExpand)(e.requests,_agentCore.CAPS.listItems);return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title??"Network requests",source:e.source,testID:`buoy-block-requests-${e.id}`,children:[s.map((s,r)=>(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{disabled:!i,onPress:()=>{t.runAction({label:"Open in Network",openTool:{toolId:"network",select:s.id}},e.id)},style:[_primitives.blockStyles.row,r>0&&_primitives.blockStyles.rowDivider],accessibilityRole:i?"button":void 0,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.method,children:s.method}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,numberOfLines:1,children:pathOf(s.url)}),s.mocked?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.mockedChip,children:"MOCKED"}):null,void 0!==s.durationMs?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:_primitives.blockStyles.rowTrailing,children:[s.durationMs," ms"]}):null,(0,_jsxRuntime.jsx)(StatusPill,{status:s.status}),i?(0,_jsxRuntime.jsx)(_sharedUi.ChevronRight,{size:12,color:_sharedUi.night.color.textTertiary}):null]},s.id)),(0,_jsxRuntime.jsx)(_primitives.More,{shown:s.length,total:e.total??e.requests.length,onExpand:e.requests.length>s.length||r?o:void 0,expanded:r})]})}function RequestCard({block:e}){const[t,i]=(0,_react.useState)("response"),s="response"===t?e.responseBody:e.requestBody,r=void 0===s?"(none)":"string"==typeof s?s:JSON.stringify(s,null,2),o=(0,_context.useBlockHandlers)();return(0,_jsxRuntime.jsxs)(_primitives.Card,{source:e.source,testID:`buoy-block-request-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_primitives.blockStyles.row,styles.reqHead],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.method,children:e.request.method}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,numberOfLines:2,children:pathOf(e.request.url)}),e.request.mocked?(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.mockedChip,children:"MOCKED"}):null,(0,_jsxRuntime.jsx)(StatusPill,{status:e.request.status})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tabs,children:["response","request"].map(e=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{onPress:()=>i(e),style:[styles.tab,t===e&&styles.tabOn],accessibilityRole:"tab",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.tabText,t===e&&styles.tabTextOn],children:"response"===e?"Response":"Request"})},e))}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.mono,styles.body],numberOfLines:14,selectable:!0,children:r.length>1600?`${r.slice(0,1600)}\n…`:r}),(0,_jsxRuntime.jsx)(_primitives.ActionRow,{blockId:e.id,actions:[{label:"Open in Network",openTool:{toolId:"network",select:e.request.id}}]}),(o.supports,null)]})}function RuleCard({block:e}){const t=e.rule,i="fail"===t.kind?"fails (no network)":"delay"===t.kind?`delayed ${t.delayMs??0} ms`:`returns ${t.status??200}`;return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:t.name??"Network override",source:e.source,testID:`buoy-block-rule-${e.id}`,tone:t.enabled?"warning":void 0,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.ruleBody,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.ruleLine,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.ruleKey,children:[t.methods?.length?t.methods.join("/"):"ANY"," "]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.mono,children:t.urlPattern})]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.ruleLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.ruleKey,children:"→ "}),i,t.times?" · "+(1===t.times?"once":`${t.times} times`):" · every time",void 0!==t.hits?` · ${t.hits} hit${1===t.hits?"":"s"}`:""]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_primitives.blockStyles.pill,t.enabled?styles.on:styles.off],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.pillText,{color:t.enabled?_sharedUi.night.color.onAccent:_sharedUi.night.color.textSecondary}],children:t.enabled?"ON":"OFF"})})]}),(0,_jsxRuntime.jsx)(_primitives.ActionRow,{blockId:e.id,actions:[t.enabled?{label:"Turn off",dispatch:{toolId:"network",action:"setOverrideRuleEnabled",params:{id:t.id,enabled:!1}}}:{label:"Turn on",primary:!0,dispatch:{toolId:"network",action:"setOverrideRuleEnabled",params:{id:t.id,enabled:!0}}},{label:"Delete",dispatch:{toolId:"network",action:"deleteOverrideRule",params:{id:t.id}}}]})]})}function ScreenElements({block:e}){const t=(0,_context.useBlockHandlers)(),{visible:i,expanded:s,toggle:r}=(0,_primitives.useExpand)(e.elements,_agentCore.CAPS.chips);return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.title??"On screen right now",source:e.source,testID:`buoy-block-screen-${e.id}`,children:[i.map((i,s)=>(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{onPress:()=>{t.runAction({label:"Highlight",dispatch:{toolId:"highlight-updates",action:"setSpotlight",params:{nativeTag:i.nativeTag}}},e.id)},disabled:!1===t.supports?.dispatch,style:[_primitives.blockStyles.row,s>0&&_primitives.blockStyles.rowDivider],accessibilityRole:"button",children:[(0,_jsxRuntime.jsx)(_sharedUi.Eye,{size:12,color:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTitle,numberOfLines:1,children:i.label??i.testID??i.name}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:_primitives.blockStyles.rowTrailing,numberOfLines:1,children:i.name})]},i.nativeTag)),(0,_jsxRuntime.jsx)(_primitives.More,{shown:i.length,total:e.total,onExpand:e.elements.length>i.length||s?r:void 0,expanded:s})]})}function RouteChips({block:e}){const t=(0,_context.useBlockHandlers)(),[i,s]=(0,_react.useState)(!1),r=i?e.routes:e.routes.slice(0,_agentCore.CAPS.chips);return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:e.current?`Routes · you're on ${e.current}`:"Routes",source:e.source,testID:`buoy-block-routes-${e.id}`,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.chips,children:r.map(i=>(0,_jsxRuntime.jsx)(_reactNative.Pressable,{disabled:!1===t.supports?.dispatch,onPress:()=>i.dynamic?t.answer({blockId:e.id,kind:"input",value:`Open ${i.path} — which id?`}):void t.runAction({label:`Open ${i.path}`,dispatch:{toolId:"route-events",action:"navigate",params:{path:i.path}}},e.id),style:[styles.chip,i.path===e.current&&styles.chipCurrent],accessibilityRole:"button",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.chipText,i.dynamic&&styles.chipDynamic],children:i.path})},i.path))}),(0,_jsxRuntime.jsx)(_primitives.More,{shown:r.length,total:e.total??e.routes.length,onExpand:()=>s(e=>!e),expanded:i})]})}const LEVEL_COLOR={error:_sharedUi.night.color.danger,warn:_sharedUi.night.color.warning,warning:_sharedUi.night.color.warning,info:_sharedUi.night.color.info};function LogList({block:e}){const{visible:t,expanded:i,toggle:s}=(0,_primitives.useExpand)(e.entries,_agentCore.CAPS.listItems);return(0,_jsxRuntime.jsxs)(_primitives.Card,{title:"Console",source:e.source,testID:`buoy-block-logs-${e.id}`,children:[t.map((e,t)=>(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[_primitives.blockStyles.row,t>0&&_primitives.blockStyles.rowDivider,styles.logRow],children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[_primitives.blockStyles.pill,{backgroundColor:`${LEVEL_COLOR[e.level]??_sharedUi.night.color.textTertiary}22`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.pillText,{color:LEVEL_COLOR[e.level]??_sharedUi.night.color.textSecondary}],children:e.level.toUpperCase()})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.rowTitle,_primitives.blockStyles.mono],numberOfLines:3,children:e.message}),e.count>1?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:_primitives.blockStyles.rowTrailing,children:["×",e.count]}):null]},`${e.level}-${e.message}-${t}`)),(0,_jsxRuntime.jsx)(_primitives.More,{shown:t.length,total:e.total,onExpand:e.entries.length>t.length||i?s:void 0,expanded:i})]})}function Crash({block:e}){return(0,_jsxRuntime.jsxs)(_primitives.Card,{tone:"danger",testID:`buoy-block-crash-${e.id}`,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.crashHead,children:[(0,_jsxRuntime.jsx)(_sharedUi.AlertTriangle,{size:14,color:_sharedUi.night.color.danger}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.crashTitle,children:["The app crashed",e.route?` on ${e.route}`:""]})]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[_primitives.blockStyles.mono,styles.crashMsg],numberOfLines:4,selectable:!0,children:e.message}),e.suspect?(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.suspect,children:["Most likely cause: ",e.suspect.label]}):null,(0,_jsxRuntime.jsx)(_primitives.ActionRow,{blockId:e.id,actions:[...e.suspect?.action?[{...e.suspect.action,primary:!0}]:[],...e.actions??[]].slice(0,2)})]})}function Peek({block:e}){const t=(0,_context.useBlockHandlers)(),i=!1!==t.supports?.minimize;return(0,_jsxRuntime.jsxs)(_reactNative.Pressable,{testID:`buoy-block-peek-${e.id}`,disabled:!i,onPress:()=>{t.runAction({label:"Look",minimize:!0},e.id)},style:({pressed:e})=>[styles.peek,e&&{opacity:.7}],accessibilityRole:"button",accessibilityLabel:`${e.label}. Look at the app`,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.peekText,children:e.label}),i?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.peekLook,children:[(0,_jsxRuntime.jsx)(_sharedUi.Eye,{size:12,color:_sharedUi.night.color.accent}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.peekLookText,children:"Look"})]}):null]})}const styles=_reactNative.StyleSheet.create({method:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"700",letterSpacing:.4,width:44},mockedChip:{color:_sharedUi.night.color.warning,backgroundColor:_sharedUi.night.color.warningSoft,fontSize:9,fontWeight:"700",letterSpacing:.6,paddingHorizontal:5,paddingVertical:1,borderRadius:_sharedUi.night.radius.badge,overflow:"hidden"},reqHead:{paddingTop:12},tabs:{flexDirection:"row",gap:6,paddingHorizontal:12,paddingTop:4,paddingBottom:8},tab:{paddingHorizontal:10,paddingVertical:5,borderRadius:_sharedUi.night.radius.badge,backgroundColor:_sharedUi.night.color.fill},tabOn:{backgroundColor:_sharedUi.night.color.accentSoft},tabText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.micro,fontWeight:"600"},tabTextOn:{color:_sharedUi.night.color.accent},body:{paddingHorizontal:12,paddingBottom:4,lineHeight:16,color:_sharedUi.night.color.textSecondary},ruleBody:{paddingHorizontal:12,paddingTop:4,paddingBottom:4,gap:4},ruleLine:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,lineHeight:18},ruleKey:{color:_sharedUi.night.color.textSecondary,fontWeight:"700"},on:{alignSelf:"flex-start",backgroundColor:_sharedUi.night.color.accent,marginTop:4},off:{alignSelf:"flex-start",backgroundColor:_sharedUi.night.color.fillTertiary,marginTop:4},chips:{flexDirection:"row",flexWrap:"wrap",gap:6,padding:12},chip:{paddingHorizontal:10,paddingVertical:6,borderRadius:_sharedUi.night.radius.chip,backgroundColor:_sharedUi.night.color.fill,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.night.color.border},chipCurrent:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorderStrong},chipText:{color:_sharedUi.night.color.text,fontSize:_sharedUi.night.font.caption,fontFamily:"Menlo"},chipDynamic:{color:_sharedUi.night.color.textSecondary},logRow:{alignItems:"flex-start"},crashHead:{flexDirection:"row",alignItems:"center",gap:8,paddingHorizontal:12,paddingTop:12},crashTitle:{color:_sharedUi.night.color.danger,fontSize:_sharedUi.night.font.row,fontWeight:"600"},crashMsg:{paddingHorizontal:12,paddingTop:6,color:_sharedUi.night.color.text},suspect:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption,paddingHorizontal:12,paddingTop:6},peek:{alignSelf:"flex-start",flexDirection:"row",alignItems:"center",gap:10,paddingLeft:12,paddingRight:10,paddingVertical:7,borderRadius:_sharedUi.night.radius.chip,backgroundColor:_sharedUi.night.color.fill},peekText:{color:_sharedUi.night.color.textSecondary,fontSize:_sharedUi.night.font.caption},peekLook:{flexDirection:"row",alignItems:"center",gap:4},peekLookText:{color:_sharedUi.night.color.accent,fontSize:_sharedUi.night.font.caption,fontWeight:"600"}});
@@ -1,42 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.BlockHandlersProvider = BlockHandlersProvider;
7
- exports.actionKey = actionKey;
8
- exports.useBlockHandlers = useBlockHandlers;
9
- var _react = require("react");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- /**
12
- * How a block talks back to the sheet.
13
- *
14
- * Blocks are pure data; everything that happens when one is tapped goes
15
- * through this context so the same renderers work inside the real transcript,
16
- * on the example app's review page, and (later) on the desktop with a
17
- * different set of handlers behind them.
18
- */
19
-
20
- const noop = {
21
- answer: () => {},
22
- runAction: () => {},
23
- answered: {},
24
- supports: {}
25
- };
26
- const Ctx = /*#__PURE__*/(0, _react.createContext)(noop);
27
- function BlockHandlersProvider({
28
- value,
29
- children
30
- }) {
31
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(Ctx.Provider, {
32
- value: value,
33
- children: children
34
- });
35
- }
36
- function useBlockHandlers() {
37
- return (0, _react.useContext)(Ctx);
38
- }
39
- function actionKey(blockId, action) {
40
- return `${blockId}:${action.label}`;
41
- }
42
- //# sourceMappingURL=context.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BlockHandlersProvider=BlockHandlersProvider,exports.actionKey=actionKey,exports.useBlockHandlers=useBlockHandlers;var _react=require("react"),_jsxRuntime=require("react/jsx-runtime");const noop={answer:()=>{},runAction:()=>{},answered:{},supports:{}},Ctx=(0,_react.createContext)(noop);function BlockHandlersProvider({value:e,children:r}){return(0,_jsxRuntime.jsx)(Ctx.Provider,{value:e,children:r})}function useBlockHandlers(){return(0,_react.useContext)(Ctx)}function actionKey(e,r){return`${e}:${r.label}`}