-
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.
feat: split snippet sdks into JS web and HTML snippet (#20023)
* split JS snippet into package and HTML * do for replay * do for surveys * clarify that it's a manual event * Update UI snapshots for `chromium` (1) --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
285b9d8
commit 437f9ed
Showing
20 changed files
with
96 additions
and
16 deletions.
There are no files selected for viewing
Binary file modified
BIN
+4.62 KB
(110%)
frontend/__snapshots__/scenes-other-onboarding--onboarding-billing--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-5.17 KB
(94%)
frontend/__snapshots__/scenes-other-onboarding--onboarding-billing--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.62 KB
(110%)
frontend/__snapshots__/scenes-other-onboarding--onboarding-sd-ks--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-5.17 KB
(94%)
frontend/__snapshots__/scenes-other-onboarding--onboarding-sd-ks--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
22 changes: 22 additions & 0 deletions
22
frontend/src/scenes/onboarding/sdks/product-analytics/html-snippet.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,22 @@ | ||
import { LemonDivider } from '@posthog/lemon-ui' | ||
import { CodeSnippet, Language } from 'lib/components/CodeSnippet' | ||
|
||
import { SDKHtmlSnippetInstructions } from '../sdk-install-instructions/html-snippet' | ||
|
||
function JSEventSnippet(): JSX.Element { | ||
return ( | ||
<CodeSnippet language={Language.JavaScript}>{`posthog.capture('my event', { property: 'value' })`}</CodeSnippet> | ||
) | ||
} | ||
|
||
export function HTMLSnippetInstructions(): JSX.Element { | ||
return ( | ||
<> | ||
<SDKHtmlSnippetInstructions /> | ||
<LemonDivider thick dashed className="my-4" /> | ||
<h4>Optional: Send a manual event</h4> | ||
<p>Our snippet will autocapture events for you, but you can manually define events, too!</p> | ||
<JSEventSnippet /> | ||
</> | ||
) | ||
} |
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
14 changes: 14 additions & 0 deletions
14
frontend/src/scenes/onboarding/sdks/sdk-install-instructions/html-snippet.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,14 @@ | ||
import { JSSnippet } from 'lib/components/JSSnippet' | ||
|
||
export function SDKHtmlSnippetInstructions(): JSX.Element { | ||
return ( | ||
<> | ||
<h3>Install</h3> | ||
<p> | ||
Just add this snippet to your website within the <code><head></code> tag and you'll be ready to | ||
start using PostHog. This can also be used in services like Google Tag Manager. | ||
</p> | ||
<JSSnippet /> | ||
</> | ||
) | ||
} |
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
3 changes: 2 additions & 1 deletion
3
frontend/src/scenes/onboarding/sdks/session-replay/SessionReplaySDKInstructions.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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { SDKInstructionsMap, SDKKey } from '~/types' | ||
|
||
import { JSWebInstructions, NextJSInstructions, ReactInstructions } from '.' | ||
import { HTMLSnippetInstructions, JSWebInstructions, NextJSInstructions, ReactInstructions } from '.' | ||
|
||
export const SessionReplaySDKInstructions: SDKInstructionsMap = { | ||
[SDKKey.JS_WEB]: JSWebInstructions, | ||
[SDKKey.HTML_SNIPPET]: HTMLSnippetInstructions, | ||
[SDKKey.NEXT_JS]: NextJSInstructions, | ||
[SDKKey.REACT]: ReactInstructions, | ||
} |
15 changes: 15 additions & 0 deletions
15
frontend/src/scenes/onboarding/sdks/session-replay/html-snippet.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,15 @@ | ||
import { LemonDivider } from 'lib/lemon-ui/LemonDivider' | ||
|
||
import { SDKHtmlSnippetInstructions } from '../sdk-install-instructions/html-snippet' | ||
import { SessionReplayFinalSteps } from '../shared-snippets' | ||
|
||
export function HTMLSnippetInstructions(): JSX.Element { | ||
return ( | ||
<> | ||
<SDKHtmlSnippetInstructions /> | ||
<LemonDivider thick dashed className="my-4" /> | ||
<h3>Final steps</h3> | ||
<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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './html-snippet' | ||
export * from './js-web' | ||
export * from './next-js' | ||
export * from './react' |
3 changes: 2 additions & 1 deletion
3
frontend/src/scenes/onboarding/sdks/surveys/SurveysSDKInstructions.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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { SDKInstructionsMap, SDKKey } from '~/types' | ||
|
||
import { JSWebInstructions, NextJSInstructions, ReactInstructions } from '.' | ||
import { HTMLSnippetInstructions, JSWebInstructions, NextJSInstructions, ReactInstructions } from '.' | ||
|
||
export const SurveysSDKInstructions: SDKInstructionsMap = { | ||
[SDKKey.JS_WEB]: JSWebInstructions, | ||
[SDKKey.HTML_SNIPPET]: HTMLSnippetInstructions, | ||
[SDKKey.NEXT_JS]: NextJSInstructions, | ||
[SDKKey.REACT]: ReactInstructions, | ||
} |
14 changes: 14 additions & 0 deletions
14
frontend/src/scenes/onboarding/sdks/surveys/html-snippet.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,14 @@ | ||
import { LemonDivider } from 'lib/lemon-ui/LemonDivider' | ||
|
||
import { SDKHtmlSnippetInstructions } from '../sdk-install-instructions/html-snippet' | ||
import { SurveysFinalSteps } from './SurveysFinalSteps' | ||
|
||
export function HTMLSnippetInstructions(): JSX.Element { | ||
return ( | ||
<> | ||
<SDKHtmlSnippetInstructions /> | ||
<LemonDivider thick dashed className="my-4" /> | ||
<SurveysFinalSteps /> | ||
</> | ||
) | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './html-snippet' | ||
export * from './js-web' | ||
export * from './next-js' | ||
export * from './react' |
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