-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { SDKKey } from '~/types' | ||
|
||
import { SDKInstallVueInstructions } from '../sdk-install-instructions/vue' | ||
import { FlagImplementationSnippet } from './flagImplementationSnippet' | ||
|
||
export function FeatureFlagsVueInstructions(): JSX.Element { | ||
return ( | ||
<> | ||
<SDKInstallVueInstructions /> | ||
<FlagImplementationSnippet sdkKey={SDKKey.JS_WEB} /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
frontend/src/scenes/onboarding/sdks/product-analytics/vue.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { SDKInstallVueInstructions } from '../sdk-install-instructions/vue' | ||
import { ProductAnalyticsAllJSFinalSteps } from './AllJSFinalSteps' | ||
|
||
export function ProductAnalyticsVueInstructions(): JSX.Element { | ||
return ( | ||
<> | ||
<SDKInstallVueInstructions /> | ||
<ProductAnalyticsAllJSFinalSteps /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
frontend/src/scenes/onboarding/sdks/sdk-install-instructions/vue.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { useValues } from 'kea' | ||
import { CodeSnippet, Language } from 'lib/components/CodeSnippet' | ||
import { Link } from 'lib/lemon-ui/Link' | ||
import { apiHostOrigin } from 'lib/utils/apiHost' | ||
import { teamLogic } from 'scenes/teamLogic' | ||
|
||
import { JSInstallSnippet } from './js-web' | ||
|
||
function VueCreatePluginsFileSnippet(): JSX.Element { | ||
return ( | ||
<CodeSnippet language={Language.Bash}> | ||
{`mkdir plugins #skip if you already have one | ||
cd plugins | ||
touch posthog.js`} | ||
</CodeSnippet> | ||
) | ||
} | ||
|
||
function VuePluginsCodeSnippet(): JSX.Element { | ||
const { currentTeam } = useValues(teamLogic) | ||
|
||
return ( | ||
<CodeSnippet language={Language.JavaScript}> | ||
{`//./plugins/posthog.js | ||
import posthog from "posthog-js"; | ||
export default { | ||
install(app) { | ||
app.config.globalProperties.$posthog = posthog.init( | ||
'${currentTeam?.api_token}', | ||
{ | ||
api_host: '${apiHostOrigin()}', | ||
} | ||
); | ||
}, | ||
};`} | ||
</CodeSnippet> | ||
) | ||
} | ||
|
||
function VueActivatePluginSnippet(): JSX.Element { | ||
return ( | ||
<CodeSnippet language={Language.JavaScript}> | ||
{`//main.js | ||
import { createApp } from 'vue' | ||
import App from './App.vue' | ||
import posthogPlugin from "./plugins/posthog"; //import the plugin. | ||
const app = createApp(App); | ||
app.use(posthogPlugin); //install the plugin | ||
app.mount('#app')`} | ||
</CodeSnippet> | ||
) | ||
} | ||
|
||
export function SDKInstallVueInstructions(): JSX.Element { | ||
return ( | ||
<> | ||
<p> | ||
The below guide is for integrating using plugins in Vue versions 3 and above. For integrating PostHog | ||
using Provide/inject, Vue.prototype, or versions 2.7 and below, see our{' '} | ||
<Link to="https://posthog.com/docs/libraries/vue-js">Vue docs</Link> | ||
</p> | ||
<h3>Install posthog-js using your package manager</h3> | ||
<JSInstallSnippet /> | ||
<h3>Create a plugin</h3> | ||
<p> | ||
Create a new file <code>posthog.js</code> in your plugins directory: | ||
</p> | ||
<VueCreatePluginsFileSnippet /> | ||
Add the following code to <code>posthog.js</code>: | ||
<VuePluginsCodeSnippet /> | ||
<h3>Activate your plugin</h3> | ||
<VueActivatePluginSnippet /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
frontend/src/scenes/onboarding/sdks/session-replay/vue.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { SDKInstallVueInstructions } from '../sdk-install-instructions' | ||
import { SessionReplayFinalSteps } from '../shared-snippets' | ||
|
||
export function VueInstructions(): JSX.Element { | ||
return ( | ||
<> | ||
<SDKInstallVueInstructions /> | ||
<SessionReplayFinalSteps /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { SDKInstallVueInstructions } from '../sdk-install-instructions/vue' | ||
|
||
export function VueInstructions(): JSX.Element { | ||
return ( | ||
<> | ||
<SDKInstallVueInstructions /> | ||
</> | ||
) | ||
} |