diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/FeatureFlagsSDKInstructions.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/FeatureFlagsSDKInstructions.tsx index 1455900dd48ee..681d094fae017 100644 --- a/frontend/src/scenes/onboarding/sdks/feature-flags/FeatureFlagsSDKInstructions.tsx +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/FeatureFlagsSDKInstructions.tsx @@ -22,6 +22,7 @@ import { FeatureFlagsRNInstructions, FeatureFlagsRubyInstructions, FeatureFlagsSvelteInstructions, + FeatureFlagsVueInstructions, FeatureFlagsWebflowInstructions, } from '.' @@ -47,5 +48,6 @@ export const FeatureFlagsSDKInstructions: SDKInstructionsMap = { [SDKKey.REMIX]: FeatureFlagsRemixJSInstructions, [SDKKey.RUBY]: FeatureFlagsRubyInstructions, [SDKKey.SVELTE]: FeatureFlagsSvelteInstructions, + [SDKKey.VUE_JS]: FeatureFlagsVueInstructions, [SDKKey.WEBFLOW]: FeatureFlagsWebflowInstructions, } diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/index.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/index.tsx index 22286b9cd9884..900f2f45ba2e9 100644 --- a/frontend/src/scenes/onboarding/sdks/feature-flags/index.tsx +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/index.tsx @@ -19,4 +19,5 @@ export * from './react-native' export * from './remix' export * from './ruby' export * from './svelte' +export * from './vue' export * from './webflow' diff --git a/frontend/src/scenes/onboarding/sdks/feature-flags/vue.tsx b/frontend/src/scenes/onboarding/sdks/feature-flags/vue.tsx new file mode 100644 index 0000000000000..eec3c3d13f093 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/feature-flags/vue.tsx @@ -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 ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/ProductAnalyticsSDKInstructions.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/ProductAnalyticsSDKInstructions.tsx index ee707796f03d8..9d5106158a62e 100644 --- a/frontend/src/scenes/onboarding/sdks/product-analytics/ProductAnalyticsSDKInstructions.tsx +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/ProductAnalyticsSDKInstructions.tsx @@ -23,6 +23,7 @@ import { ProductAnalyticsRNInstructions, ProductAnalyticsRubyInstructions, ProductAnalyticsSvelteJSInstructions, + ProductAnalyticsVueInstructions, ProductAnalyticsWebflowInstructions, } from '.' @@ -49,5 +50,6 @@ export const ProductAnalyticsSDKInstructions: SDKInstructionsMap = { [SDKKey.REMIX]: ProductAnalyticsRemixJSInstructions, [SDKKey.RUBY]: ProductAnalyticsRubyInstructions, [SDKKey.SVELTE]: ProductAnalyticsSvelteJSInstructions, + [SDKKey.VUE_JS]: ProductAnalyticsVueInstructions, [SDKKey.WEBFLOW]: ProductAnalyticsWebflowInstructions, } diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/index.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/index.tsx index 64c8d36e2d505..4585fda4a7079 100644 --- a/frontend/src/scenes/onboarding/sdks/product-analytics/index.tsx +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/index.tsx @@ -20,4 +20,5 @@ export * from './react-native' export * from './remix' export * from './ruby' export * from './svelte' +export * from './vue' export * from './webflow' diff --git a/frontend/src/scenes/onboarding/sdks/product-analytics/vue.tsx b/frontend/src/scenes/onboarding/sdks/product-analytics/vue.tsx new file mode 100644 index 0000000000000..f4646bb7867c2 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/product-analytics/vue.tsx @@ -0,0 +1,11 @@ +import { SDKInstallVueInstructions } from '../sdk-install-instructions/vue' +import { ProductAnalyticsAllJSFinalSteps } from './AllJSFinalSteps' + +export function ProductAnalyticsVueInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/index.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/index.tsx index f581ea9955b22..4c8ef1e268d09 100644 --- a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/index.tsx +++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/index.tsx @@ -17,4 +17,5 @@ export * from './react-native' export * from './remix' export * from './ruby' export * from './svelte' +export * from './vue' export * from './webflow' diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/vue.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/vue.tsx new file mode 100644 index 0000000000000..9bd3eb224ec10 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/vue.tsx @@ -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 ( + + {`mkdir plugins #skip if you already have one +cd plugins +touch posthog.js`} + + ) +} + +function VuePluginsCodeSnippet(): JSX.Element { + const { currentTeam } = useValues(teamLogic) + + return ( + + {`//./plugins/posthog.js +import posthog from "posthog-js"; + +export default { + install(app) { + app.config.globalProperties.$posthog = posthog.init( + '${currentTeam?.api_token}', + { + api_host: '${apiHostOrigin()}', + } + ); + }, +};`} + + ) +} + +function VueActivatePluginSnippet(): JSX.Element { + return ( + + {`//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')`} + + ) +} + +export function SDKInstallVueInstructions(): JSX.Element { + return ( + <> +

+ 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{' '} + Vue docs +

+

Install posthog-js using your package manager

+ +

Create a plugin

+

+ Create a new file posthog.js in your plugins directory: +

+ + Add the following code to posthog.js: + +

Activate your plugin

+ + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/session-replay/SessionReplaySDKInstructions.tsx b/frontend/src/scenes/onboarding/sdks/session-replay/SessionReplaySDKInstructions.tsx index ad37dbe9e1d51..b8fc50a5bd38a 100644 --- a/frontend/src/scenes/onboarding/sdks/session-replay/SessionReplaySDKInstructions.tsx +++ b/frontend/src/scenes/onboarding/sdks/session-replay/SessionReplaySDKInstructions.tsx @@ -12,6 +12,7 @@ import { ReactInstructions, RemixInstructions, SvelteInstructions, + VueInstructions, WebflowInstructions, } from '.' @@ -27,5 +28,6 @@ export const SessionReplaySDKInstructions: SDKInstructionsMap = { [SDKKey.REACT]: ReactInstructions, [SDKKey.REMIX]: RemixInstructions, [SDKKey.SVELTE]: SvelteInstructions, + [SDKKey.VUE_JS]: VueInstructions, [SDKKey.WEBFLOW]: WebflowInstructions, } diff --git a/frontend/src/scenes/onboarding/sdks/session-replay/index.tsx b/frontend/src/scenes/onboarding/sdks/session-replay/index.tsx index cb7a7f25e5604..a1fbaef355a9c 100644 --- a/frontend/src/scenes/onboarding/sdks/session-replay/index.tsx +++ b/frontend/src/scenes/onboarding/sdks/session-replay/index.tsx @@ -9,4 +9,5 @@ export * from './nuxt' export * from './react' export * from './remix' export * from './svelte' +export * from './vue' export * from './webflow' diff --git a/frontend/src/scenes/onboarding/sdks/session-replay/vue.tsx b/frontend/src/scenes/onboarding/sdks/session-replay/vue.tsx new file mode 100644 index 0000000000000..3e783a11ba9fb --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/session-replay/vue.tsx @@ -0,0 +1,11 @@ +import { SDKInstallVueInstructions } from '../sdk-install-instructions' +import { SessionReplayFinalSteps } from '../shared-snippets' + +export function VueInstructions(): JSX.Element { + return ( + <> + + + + ) +} diff --git a/frontend/src/scenes/onboarding/sdks/surveys/SurveysSDKInstructions.tsx b/frontend/src/scenes/onboarding/sdks/surveys/SurveysSDKInstructions.tsx index 3b9db97ceb079..c0ee501fc6fe7 100644 --- a/frontend/src/scenes/onboarding/sdks/surveys/SurveysSDKInstructions.tsx +++ b/frontend/src/scenes/onboarding/sdks/surveys/SurveysSDKInstructions.tsx @@ -12,6 +12,7 @@ import { ReactInstructions, RemixInstructions, SvelteInstructions, + VueInstructions, WebflowInstructions, } from '.' @@ -27,5 +28,6 @@ export const SurveysSDKInstructions: SDKInstructionsMap = { [SDKKey.REACT]: ReactInstructions, [SDKKey.REMIX]: RemixInstructions, [SDKKey.SVELTE]: SvelteInstructions, + [SDKKey.VUE_JS]: VueInstructions, [SDKKey.WEBFLOW]: WebflowInstructions, } diff --git a/frontend/src/scenes/onboarding/sdks/surveys/index.tsx b/frontend/src/scenes/onboarding/sdks/surveys/index.tsx index cb7a7f25e5604..a1fbaef355a9c 100644 --- a/frontend/src/scenes/onboarding/sdks/surveys/index.tsx +++ b/frontend/src/scenes/onboarding/sdks/surveys/index.tsx @@ -9,4 +9,5 @@ export * from './nuxt' export * from './react' export * from './remix' export * from './svelte' +export * from './vue' export * from './webflow' diff --git a/frontend/src/scenes/onboarding/sdks/surveys/vue.tsx b/frontend/src/scenes/onboarding/sdks/surveys/vue.tsx new file mode 100644 index 0000000000000..1714535074989 --- /dev/null +++ b/frontend/src/scenes/onboarding/sdks/surveys/vue.tsx @@ -0,0 +1,9 @@ +import { SDKInstallVueInstructions } from '../sdk-install-instructions/vue' + +export function VueInstructions(): JSX.Element { + return ( + <> + + + ) +}