Skip to content

Commit 42db082

Browse files
Remove SDK injection (#101)
1 parent b672b56 commit 42db082

File tree

8 files changed

+7
-226
lines changed

8 files changed

+7
-226
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,9 @@ Some notes
6464

6565
## Changelog
6666

67-
*1.2.0* (2025-04-07)
67+
*1.2.1* (2025-04-16)
6868
- Support for backend SDK debugging (overrides, logs)
6969
- Feature and Experiment views now show both simulated and live evaluations when available
70-
- Ability to inject a "debugging SDK" onto pages with no front-end SDKs
7170
- UI updates
7271
- Bug fixes
7372

devtools.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,6 @@ export type SDKHealthCheckResult = {
254254
version?: string;
255255
hasWindowConfig?: boolean;
256256
sdkFound?: boolean;
257-
sdkInjected?: boolean;
258-
sdkAutoInjected?: boolean;
259257
externalSdks?: Record<string, ExternalSdkInfo>;
260258
clientKey?: string;
261259
isLoading?: boolean;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gb-devtools",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"private": true,
55
"scripts": {
66
"dev": "webpack --config webpack/webpack.dev.js --watch",

public/manifest.chrome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
"name": "GrowthBook DevTools",
55
"description": "GrowthBook DevTools helps you debug feature flags and experiments and design A/B tests visually — all from your browser.",
6-
"version": "1.2.0",
6+
"version": "1.2.1",
77

88
"content_scripts": [
99
{

public/manifest.firefox.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
"name": "GrowthBook DevTools",
55
"description": "GrowthBook DevTools helps you debug feature flags and experiments and design A/B tests visually — all from your browser.",
6-
"version": "1.2.0",
6+
"version": "1.2.1",
77

88
"browser_specific_settings": {
99
"gecko": {

src/app/components/SdkTab/SdkItemPanel.tsx

Lines changed: 1 addition & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from "react";
22
import {
33
Button,
44
Callout,
5-
Dialog,
65
Flex,
76
IconButton,
87
Link,
@@ -14,26 +13,18 @@ import {
1413
PiArrowsClockwise,
1514
PiArrowSquareOut,
1615
PiCaretRightFill,
17-
PiCode,
18-
PiCodeBold,
1916
PiInfoBold,
2017
PiWarningFill,
2118
PiWarningOctagonFill,
22-
PiX,
2319
PiXBold,
2420
} from "react-icons/pi";
2521
import * as Accordion from "@radix-ui/react-accordion";
2622
import { useResponsiveContext } from "@/app/hooks/useResponsive";
2723
import { SdkItem } from "./index";
2824
import useSdkData from "@/app/hooks/useSdkData";
29-
import {
30-
ClearInjectedSdkMessage,
31-
InjectSdkMessage,
32-
SDKHealthCheckResult,
33-
} from "devtools";
25+
import { SDKHealthCheckResult } from "devtools";
3426
import { getActiveTabId } from "@/app/hooks/useTabState";
3527
import { paddedVersionString } from "@growthbook/growthbook";
36-
import InjectSdkForm from "@/app/components/InjectSdk";
3728

3829
const panelTitles: Record<SdkItem, string> = {
3930
status: "SDK Status",
@@ -199,15 +190,12 @@ function ItemPanel({
199190

200191
function statusPanel({
201192
sdkFound,
202-
sdkInjected,
203-
sdkAutoInjected,
204193
hasPayload,
205194
canConnect,
206195
apiHost,
207196
clientKey,
208197
errorMessage,
209198
}: SDKHealthCheckResult) {
210-
const [injectModalOpen, setInjectModalOpen] = useState(false);
211199
const [activeTabId, setActiveTabId] = useState<number | undefined>(undefined);
212200
const [refreshingSdk, setRefreshingSdk] = useState<boolean>(true);
213201

@@ -229,51 +217,6 @@ function statusPanel({
229217
}
230218
};
231219

232-
const injectSdk = async ({
233-
apiHost,
234-
clientKey,
235-
autoInject,
236-
}: {
237-
apiHost: string;
238-
clientKey: string;
239-
autoInject: boolean;
240-
}) => {
241-
setRefreshingSdk(true);
242-
window.setTimeout(() => setRefreshingSdk(false), 500);
243-
const msg: InjectSdkMessage = {
244-
type: "GB_INJECT_SDK",
245-
apiHost,
246-
clientKey,
247-
autoInject,
248-
};
249-
const activeTabId = await getActiveTabId();
250-
setActiveTabId(activeTabId);
251-
if (activeTabId) {
252-
if (chrome?.tabs) {
253-
await chrome.tabs.sendMessage(activeTabId, msg);
254-
} else {
255-
await chrome.runtime.sendMessage(msg);
256-
}
257-
}
258-
};
259-
260-
const clearInjectedSdk = async () => {
261-
setRefreshingSdk(true);
262-
window.setTimeout(() => setRefreshingSdk(false), 500);
263-
const msg: ClearInjectedSdkMessage = {
264-
type: "GB_CLEAR_INJECTED_SDK",
265-
};
266-
const activeTabId = await getActiveTabId();
267-
setActiveTabId(activeTabId);
268-
if (activeTabId) {
269-
if (chrome?.tabs) {
270-
await chrome.tabs.sendMessage(activeTabId, msg);
271-
} else {
272-
await chrome.runtime.sendMessage(msg);
273-
}
274-
}
275-
};
276-
277220
useEffect(() => {
278221
refresh();
279222
}, []);
@@ -314,17 +257,6 @@ function statusPanel({
314257
<PiArrowsClockwise /> Refresh DevTools
315258
</Button>
316259
</div>
317-
318-
<div className="mt-2">
319-
<Button
320-
variant="outline"
321-
size="2"
322-
onClick={() => setInjectModalOpen(true)}
323-
disabled={refreshingSdk}
324-
>
325-
<PiCode /> Inject Debugging SDK...
326-
</Button>
327-
</div>
328260
</div>
329261
</>
330262
) : (
@@ -334,39 +266,6 @@ function statusPanel({
334266
? "The SDK is connected to the GrowthBook API."
335267
: "The SDK is not connected to the GrowthBook API."}
336268
</Text>
337-
{sdkInjected ? (
338-
<Callout.Root color="gray" size="1" className="my-2 !flex">
339-
<Callout.Icon>
340-
<PiCodeBold />
341-
</Callout.Icon>
342-
<div className="w-full">
343-
<Text as="div" size="2">
344-
This SDK was injected by DevTools.
345-
</Text>
346-
{sdkAutoInjected ? (
347-
<div className="text-xs leading-4 mt-1">
348-
Automatically injected on all page loads.
349-
</div>
350-
) : null}
351-
<div className="text-right">
352-
{!refreshingSdk ? (
353-
<Link
354-
size="1"
355-
href="#"
356-
role="button"
357-
onClick={(e) => {
358-
e.preventDefault();
359-
clearInjectedSdk();
360-
}}
361-
>
362-
<PiXBold className="inline-block mr-1" />
363-
Remove SDK
364-
</Link>
365-
) : null}
366-
</div>
367-
</div>
368-
</Callout.Root>
369-
) : null}
370269
{!canConnect && hasPayload ? (
371270
<Callout.Root color="violet" size="1" className="mt-2 mb-4">
372271
<Callout.Icon>
@@ -481,30 +380,6 @@ function statusPanel({
481380
</Accordion.Content>
482381
</Accordion.Item>
483382
</Accordion.Root>
484-
485-
<Dialog.Root
486-
open={injectModalOpen}
487-
onOpenChange={(o) => setInjectModalOpen(o)}
488-
>
489-
<Dialog.Content className="ModalBody">
490-
<Dialog.Title>Inject a Debug SDK</Dialog.Title>
491-
<InjectSdkForm
492-
injectSdk={injectSdk}
493-
close={() => setInjectModalOpen(false)}
494-
/>
495-
<Dialog.Close style={{ position: "absolute", top: 5, right: 5 }}>
496-
<IconButton
497-
color="gray"
498-
highContrast
499-
size="1"
500-
variant="outline"
501-
radius="full"
502-
>
503-
<PiX size={20} />
504-
</IconButton>
505-
</Dialog.Close>
506-
</Dialog.Content>
507-
</Dialog.Root>
508383
</>
509384
);
510385
}

src/app/components/SdkTab/index.tsx

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export default function SdkTab() {
4040

4141
const {
4242
sdkFound,
43-
sdkInjected,
4443
externalSdks,
4544
version,
4645
canConnect,
@@ -53,7 +52,6 @@ export default function SdkTab() {
5352
usingOnFeatureUsage,
5453
isRemoteEval,
5554
usingStickyBucketing,
56-
streaming,
5755
} = useSdkData();
5856

5957
const numExternalSdks = Object.keys(externalSdks || {}).length;
@@ -125,16 +123,7 @@ export default function SdkTab() {
125123
>
126124
<ItemStatus
127125
title="SDK Status"
128-
status={
129-
<div className="text-right leading-4">
130-
{canConnectStatus}
131-
{sdkInjected ? (
132-
<div className="text-xs text-gray-10">
133-
(injected by DevTools)
134-
</div>
135-
) : null}
136-
</div>
137-
}
126+
status={canConnectStatus}
138127
color={canConnectStatusColor}
139128
/>
140129
</div>
@@ -148,9 +137,7 @@ export default function SdkTab() {
148137
>
149138
<ItemStatus
150139
title="Back-end SDKs"
151-
status={
152-
<div className="text-right leading-4">{numExternalSdks}</div>
153-
}
140+
status={numExternalSdks}
154141
color="gray"
155142
/>
156143
</div>
@@ -218,16 +205,6 @@ export default function SdkTab() {
218205
/>
219206
</div>
220207

221-
{/*<div*/}
222-
{/* key={`sdkTab_sdkItems_streaming`}*/}
223-
{/* className={clsx("itemCard flex items-center justify-between", {*/}
224-
{/* selected: selectedItem === "streaming",*/}
225-
{/* })}*/}
226-
{/* onClick={() => setSelectedItem("streaming")}*/}
227-
{/*>*/}
228-
{/* <ItemStatus title="Streaming" status={streaming} color="gray" />*/}
229-
{/*</div>*/}
230-
231208
<div
232209
key={`sdkTab_sdkItems_payload`}
233210
className={clsx("itemCard flex items-center justify-between", {

0 commit comments

Comments
 (0)