Skip to content

Commit 04ff0ff

Browse files
➖ React: Remove extra pro specific setup (#2929)
* ➖ React: Remove extra pro specific setup * ⬆ Update package deps for vitest
1 parent 869857f commit 04ff0ff

File tree

5 files changed

+9342
-7422
lines changed

5 files changed

+9342
-7422
lines changed

packages/pro-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"test:dev": "vitest"
2626
},
2727
"devDependencies": {
28-
"@vitest/ui": "^1.6.0",
28+
"@vitest/ui": "^2.0.4",
2929
"fake-indexeddb": "^6.0.0",
3030
"jsdom": "^24.1.0",
3131
"vite": "^5.3.2",

packages/react/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,14 @@
3030
"test:dev": "vitest"
3131
},
3232
"dependencies": {
33-
"@shepherdpro/pro-js": "workspace:*",
3433
"shepherd.js": "workspace:*"
3534
},
3635
"devDependencies": {
3736
"@testing-library/jest-dom": "^6.2.0",
3837
"@testing-library/react": "^16.0.0",
3938
"@types/react": "^18.3.3",
4039
"@vitejs/plugin-react": "^4.2.1",
41-
"@vitest/ui": "^1.6.0",
40+
"@vitest/ui": "^2.0.4",
4241
"happy-dom": "^14.11.0",
4342
"typescript": "^5.4.5",
4443
"vite": "^5.3.2",

packages/react/src/index.tsx

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
import { createContext, FC, useContext, type ReactNode } from 'react';
2-
32
import Shepherd from 'shepherd.js';
4-
import ShepherdPro from '@shepherdpro/pro-js';
5-
6-
interface ShepherdProviderProps {
7-
apiKey?: string;
8-
apiPath?: string;
9-
properties?: Record<string, unknown>;
10-
children?: ReactNode;
11-
}
123

134
interface ShepherdContextType {
14-
Shepherd: typeof ShepherdPro | typeof Shepherd;
5+
Shepherd: typeof Shepherd;
156
}
167

178
const ShepherdJourneyContext = createContext<ShepherdContextType | undefined>(
@@ -32,22 +23,13 @@ export const useShepherd = () => {
3223
return ShepherdInsance;
3324
};
3425

35-
export const ShepherdJourneyProvider: FC<ShepherdProviderProps> = ({
36-
apiKey,
37-
apiPath,
38-
properties,
26+
export const ShepherdJourneyProvider = ({
3927
children
40-
}: ShepherdProviderProps) => {
41-
let JourneyLibrary = Shepherd;
42-
if (typeof window !== 'undefined') {
43-
if (apiKey) {
44-
JourneyLibrary = ShepherdPro;
45-
ShepherdPro.init(apiKey, apiPath, properties);
46-
}
47-
}
48-
28+
}: {
29+
children?: ReactNode;
30+
}) => {
4931
return (
50-
<ShepherdJourneyContext.Provider value={{ Shepherd: JourneyLibrary }}>
32+
<ShepherdJourneyContext.Provider value={{ Shepherd }}>
5133
{children}
5234
</ShepherdJourneyContext.Provider>
5335
);

packages/react/test/index.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe('<ShepherdTour />', () => {
5858
);
5959
};
6060
const TestApp = () => (
61-
<ShepherdJourneyProvider apiKey={'sh_thisIsAnAmazingKey123'}>
61+
<ShepherdJourneyProvider>
6262
<Button />
6363
</ShepherdJourneyProvider>
6464
);

0 commit comments

Comments
 (0)