Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"@telegraph/segmented-control": "^0.2.2",
"@telegraph/select": "^0.0.86",
"@telegraph/tag": "^0.1.4",
"@telegraph/toggle": "0.1.1",
"@telegraph/tokens": "^0.1.4",
"@telegraph/tooltip": "0.1.3",
"@telegraph/typography": "^0.2.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,94 +1,159 @@
import { useGuideContext } from "@knocklabs/react-core";
import { useGuideContext, useStore } from "@knocklabs/react-core";
import { Box, Stack } from "@telegraph/layout";
import { Toggle } from "@telegraph/toggle";
import { Tooltip } from "@telegraph/tooltip";
import { Text } from "@telegraph/typography";

export const GuideContextDetails = () => {
const { client } = useGuideContext();
const { debugSettings } = useStore(client.store, (state) => ({
debugSettings: state.debug || {},
}));

return (
<Box py="3" px="3">
<Tooltip
label={
<Text as="span" size="1">
The tenant and data payload passed to the guide client that are used
for targeting
<br />
(via the `targetParams` prop to `KnockGuideProvider`)
</Text>
}
delayDuration={500}
>
<Text
as="label"
size="1"
weight="medium"
borderBottom="px"
borderStyle="dashed"
style={{
whiteSpace: "nowrap",
}}
>
Target params
<Stack direction="column" gap="1" width="full">
<Text as="label" size="1" weight="medium" display="block">
Toolbar settings
</Text>
</Tooltip>
<Stack direction="column" gap="2" mt="2">
<Stack direction="row" gap="2" align="center">
<Text
as="span"
size="1"
weight="medium"
color="gray"
width="36"
mt="1"
>
Tenant
</Text>
<Box
rounded="2"
overflow="auto"
backgroundColor="surface-2"
border="px"
p="1"
style={{ flex: 1, minWidth: 0 }}
>
<pre style={{ fontSize: "11px", margin: 0 }}>
<code>{client.targetParams.tenant || "-"}</code>
</pre>
</Box>
<Stack direction="column" gap="1">
<Stack direction="row" gap="2" align="center" h="7">
<Tooltip label="Contain engagement actions to client side only">
<Text
as="span"
size="1"
weight="medium"
color="gray"
width="36"
mt="1"
>
Sandbox engagement
</Text>
</Tooltip>
<Toggle.Default
size="1"
pt="1_5"
value={!!debugSettings.skipEngagementTracking}
onValueChange={(value: boolean) => {
client.setDebug({
...debugSettings,
skipEngagementTracking: value,
});
}}
/>
</Stack>
<Stack direction="row" gap="2" align="center" h="7">
<Tooltip label="Ignore throttle and show next guide immediately">
<Text
as="span"
size="1"
weight="medium"
color="gray"
width="36"
mt="1"
>
Ignore throttle
</Text>
</Tooltip>
<Toggle.Default
size="1"
pt="1_5"
value={!!debugSettings.ignoreDisplayInterval}
onValueChange={(value: boolean) => {
client.setDebug({
...debugSettings,
ignoreDisplayInterval: value,
});
}}
/>
</Stack>
</Stack>
<Stack direction="row" gap="2" align="flex-start">
</Stack>
<Stack direction="column" gap="1" width="full">
<Tooltip
label={
<Text as="span" size="1">
The tenant and data payload passed to the guide client that are
used for targeting
<br />
(via the `targetParams` prop to `KnockGuideProvider`)
</Text>
}
delayDuration={500}
>
<Text
as="span"
as="label"
size="1"
weight="medium"
color="gray"
width="36"
mt="1"
>
Data
</Text>
<Box
rounded="2"
overflow="auto"
backgroundColor="surface-2"
border="px"
p="1"
borderBottom="px"
borderStyle="dashed"
mt="4"
style={{
flex: 1,
minWidth: 0,
minHeight: "50px",
maxHeight: "200px",
whiteSpace: "nowrap",
width: "fit-content",
}}
>
<pre style={{ fontSize: "11px", margin: 0 }}>
<code>
{client.targetParams.data
? JSON.stringify(client.targetParams.data, null, 2)
: "-"}
</code>
</pre>
</Box>
Target params
</Text>
</Tooltip>
<Stack direction="column" gap="2">
<Stack direction="row" gap="2" align="center">
<Text
as="span"
size="1"
weight="medium"
color="gray"
width="36"
mt="1"
>
Tenant
</Text>
<Box
rounded="2"
overflow="auto"
backgroundColor="surface-2"
border="px"
p="1"
style={{ flex: 1, minWidth: 0 }}
>
<pre style={{ fontSize: "11px", margin: 0 }}>
<code>{client.targetParams.tenant || "-"}</code>
</pre>
</Box>
</Stack>
<Stack direction="row" gap="2" align="flex-start">
<Text
as="span"
size="1"
weight="medium"
color="gray"
width="36"
mt="1"
>
Data
</Text>
<Box
rounded="2"
overflow="auto"
backgroundColor="surface-2"
border="px"
p="1"
style={{
flex: 1,
minWidth: 0,
minHeight: "50px",
maxHeight: "200px",
}}
>
<pre style={{ fontSize: "11px", margin: 0 }}>
<code>
{client.targetParams.data
? JSON.stringify(client.targetParams.data, null, 2)
: "-"}
</code>
</pre>
</Box>
</Stack>
</Stack>
</Stack>
</Box>
Expand Down
50 changes: 2 additions & 48 deletions packages/react/src/modules/guide/components/Toolbar/V2/V2.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { useGuideContext, useStore } from "@knocklabs/react-core";
import { useGuideContext } from "@knocklabs/react-core";
import { Button } from "@telegraph/button";
import { Icon } from "@telegraph/icon";
import { Box, Stack } from "@telegraph/layout";
import { SegmentedControl } from "@telegraph/segmented-control";
import { Tooltip } from "@telegraph/tooltip";
import { Text } from "@telegraph/typography";
import {
Box as BoxIcon,
ChevronDown,
ChevronRight,
Gauge,
GripVertical,
LogOut,
Minimize2,
Expand Down Expand Up @@ -100,10 +98,6 @@ export const V2 = () => {
const [isCollapsed, setIsCollapsed] = React.useState(false);
const [isContextPanelOpen, setIsContextPanelOpen] = React.useState(false);

const { debugSettings } = useStore(client.store, (state) => ({
debugSettings: state.debug || {},
}));

React.useEffect(() => {
const { isVisible = false, focusedGuideKeys = {} } = runConfig || {};
const isDebugging = client.store.state.debug?.debugging;
Expand Down Expand Up @@ -287,47 +281,7 @@ export const V2 = () => {
</SegmentedControl.Option>
</SegmentedControl.Root>

<Tooltip label="Sandbox: Contain engagement actions to client side only">
<Button
size="1"
variant={
debugSettings.skipEngagementTracking ? "outline" : "ghost"
}
color={
debugSettings.skipEngagementTracking ? "blue" : "gray"
}
icon={{ icon: BoxIcon, alt: "Sandbox mode" }}
onClick={() => {
client.setDebug({
...debugSettings,
skipEngagementTracking:
!debugSettings.skipEngagementTracking,
});
}}
/>
</Tooltip>

<Tooltip label="Ignore throttle: Show next guide immediately">
<Button
size="1"
variant={
debugSettings.ignoreDisplayInterval ? "outline" : "ghost"
}
color={
debugSettings.ignoreDisplayInterval ? "blue" : "gray"
}
icon={{ icon: Gauge, alt: "Ignore throttle" }}
onClick={() => {
client.setDebug({
...debugSettings,
ignoreDisplayInterval:
!debugSettings.ignoreDisplayInterval,
});
}}
/>
</Tooltip>

<Tooltip label="Inspect target params">
<Tooltip label="Settings & target params">
<Button
size="1"
variant={isContextPanelOpen ? "outline" : "ghost"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import "@telegraph/toggle/default.css";
@telegraph tokens;
@telegraph components;

Expand Down
41 changes: 40 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4556,6 +4556,7 @@ __metadata:
"@telegraph/segmented-control": "npm:^0.2.2"
"@telegraph/select": "npm:^0.0.86"
"@telegraph/tag": "npm:^0.1.4"
"@telegraph/toggle": "npm:0.1.0"
"@telegraph/tokens": "npm:^0.1.4"
"@telegraph/tooltip": "npm:0.1.3"
"@telegraph/typography": "npm:^0.2.1"
Expand Down Expand Up @@ -7267,6 +7268,24 @@ __metadata:
languageName: node
linkType: hard

"@telegraph/button@npm:^0.4.0":
version: 0.4.1
resolution: "@telegraph/button@npm:0.4.1"
dependencies:
"@telegraph/helpers": "npm:^0.0.15"
"@telegraph/icon": "npm:^0.4.0"
"@telegraph/layout": "npm:^0.4.0"
"@telegraph/style-engine": "npm:^0.2.2"
"@telegraph/typography": "npm:^0.2.0"
clsx: "npm:^2.1.1"
lucide-react: "npm:^0.544.0"
peerDependencies:
react: ^18.0.0 || ^19.0.0
react-dom: ^18.0.0 || ^19.0.0
checksum: 10c0/f83da4f73d25658635e3faf5230b6dbd14b392bf84572fe092e04abfedc2854694729211ed215d268876d337ecc65ecee29df9727a44624584eed3a47097120c
languageName: node
linkType: hard

"@telegraph/button@npm:^0.5.0":
version: 0.5.0
resolution: "@telegraph/button@npm:0.5.0"
Expand Down Expand Up @@ -7472,7 +7491,7 @@ __metadata:
languageName: node
linkType: hard

"@telegraph/tag@npm:^0.1.4":
"@telegraph/tag@npm:^0.1.0, @telegraph/tag@npm:^0.1.4":
version: 0.1.4
resolution: "@telegraph/tag@npm:0.1.4"
dependencies:
Expand Down Expand Up @@ -7506,6 +7525,26 @@ __metadata:
languageName: node
linkType: hard

"@telegraph/toggle@npm:0.1.0":
version: 0.1.0
resolution: "@telegraph/toggle@npm:0.1.0"
dependencies:
"@radix-ui/react-use-controllable-state": "npm:^1.2.2"
"@radix-ui/react-visually-hidden": "npm:^1.2.4"
"@telegraph/button": "npm:^0.4.0"
"@telegraph/helpers": "npm:^0.0.15"
"@telegraph/icon": "npm:^0.4.0"
"@telegraph/layout": "npm:^0.4.0"
"@telegraph/tag": "npm:^0.1.0"
"@telegraph/typography": "npm:^0.2.0"
lucide-react: "npm:^0.544.0"
peerDependencies:
react: ^18.0.0 || ^19.0.0
react-dom: ^18.0.0 || ^19.0.0
checksum: 10c0/7d2cb03d6575511dbb982862b76cc8f0880ad6f524e74705664808fbff72b9450d3e532d0cc7e82b87ac214d6fff3429c312e9911c7668dd215f4d4b0f899985
languageName: node
linkType: hard

"@telegraph/tokens@npm:^0.1.3":
version: 0.1.3
resolution: "@telegraph/tokens@npm:0.1.3"
Expand Down
Loading