Skip to content

Commit

Permalink
copy update + links
Browse files Browse the repository at this point in the history
  • Loading branch information
neilkakkar committed Jun 15, 2021
1 parent 9baf21d commit 4460deb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
6 changes: 4 additions & 2 deletions frontend/src/scenes/plugins/Plugins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ export function Plugins({ user }: { user: UserType }): JSX.Element | null {
}
caption={
<>
Plugins enable you to extend PostHog's core data processing functionality. You can also{' '}
<a href="https://posthog.com/docs/plugins/build">build your own.</a>
Plugins enable you to extend PostHog's core data processing functionality. You can even{' '}
<a href="https://posthog.com/docs/plugins/build" target="_blank">
build your own.
</a>
</>
}
/>
Expand Down
22 changes: 13 additions & 9 deletions frontend/src/scenes/plugins/edit/PluginSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,25 @@ const defaultSource = `
// Learn more about plugins at: https://posthog.com/docs/plugins/build/overview
/* Runs on every event */
function processEvent(event, { config }) {
export function processEvent(event, { config }) {
// Some events (like $identify) don't have properties
if (event.properties) {
event.properties['hello'] = \`Hello \${config.name || 'world'}\`
event.properties['hello'] = \`Hello \${config.name}\`
}
// Return the event to ingest, return nothing to discard
return event
}
/* Runs once on plugin installation */
function setupPlugin (meta) {
export function setupPlugin (meta) {
}
/* Runs once every full hour */
// function runEveryHour(meta) {
// const weather = await (await fetch('https://weather.example.api/?city=New+York')).json()
// posthog.capture('weather', { degrees: weather.deg, fahrenheit: weather.us })
}`
// }`

const defaultConfig = [
{
Expand All @@ -45,9 +45,8 @@ const defaultConfig = [
name: 'Person to greet',
type: 'string',
hint: 'Used to personalise the property `hello`',
default: '',
default: 'world',
required: false,
order: 2,
},
]

Expand Down Expand Up @@ -103,12 +102,17 @@ export function PluginSource(): JSX.Element {
{editingSource ? (
<>
<p>
Feeling lost?{' '}
<a href="https://posthog.com/docs/plugins/build/overview" target="_blank">
Read the documentation.
</a>
Happy with your plugin? You can also
<a href="https://posthog.com/docs/plugins/build/tutorial#" target="_blank">
submit it to the official plugin repository
<br />
Happy with your plugin?{' '}
<a
href="https://posthog.com/docs/plugins/build/tutorial#submitting-your-plugin"
target="_blank"
>
Submit it to the official plugin repository.
</a>
</p>
<Form.Item label="Name" name="name" required rules={[requiredRule]}>
Expand Down

0 comments on commit 4460deb

Please sign in to comment.