Skip to content

Commit

Permalink
feat: enable customizable Sentry feedback integration (#18)
Browse files Browse the repository at this point in the history
* feat: enable customizable Sentry feedback integration

* merge feedbackIntegration into sentry option
  • Loading branch information
schettn authored Jan 6, 2025
1 parent 8f3c4ef commit 23e9027
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
3 changes: 2 additions & 1 deletion packages/gatsby-plugin-jaen/gatsby/gatsby-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export const pluginOptionsSchema: GatsbyNode['pluginOptionsSchema'] = ({
sentry: Joi.object({
org: Joi.string().required(),
project: Joi.string().required(),
dsn: Joi.string().required()
dsn: Joi.string().required(),
feedbackIntegration: Joi.object()
})
})
}
Expand Down
27 changes: 14 additions & 13 deletions packages/gatsby-plugin-jaen/src/gatsby/on-client-entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,18 @@ export const onClientEntry: GatsbyBrowser['onClientEntry'] = async (
Sentry.addIntegration(Sentry.browserProfilingIntegration())
Sentry.addIntegration(Sentry.replayIntegration())

// Temporary disable Sentry feedback integration
// A lot of websites build using Jaen are targeted at non-engish speaking
// users and the feedback form is in english. This can be confusing for users.
// Sentry.addIntegration(
// Sentry.feedbackIntegration({
// colorScheme: 'light',
// showBranding: false,
// formTitle: 'Give Feedback',
// buttonLabel: 'Feedback',
// submitButtonLabel: 'Send Feedback',
// messagePlaceholder: 'Report an issue or share your ideas.'
// })
// )
if (pluginOptions.sentry?.feedbackIntegration) {
Sentry.addIntegration(
Sentry.feedbackIntegration({
colorScheme: 'light',
showBranding: false,
formTitle: 'Give Feedback',
buttonLabel: 'Feedback',
submitButtonLabel: 'Send Feedback',
messagePlaceholder: 'Report an issue or share your ideas.',
// Allows for customizing the feedback form
...pluginOptions.sentry.feedbackIntegration
})
)
}
}
8 changes: 8 additions & 0 deletions packages/gatsby-plugin-jaen/src/gatsby/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {PluginOptions} from 'gatsby'
import type {feedbackIntegration} from '@sentry/gatsby'

export interface JaenPluginOptions extends PluginOptions {
zitadel: {
Expand All @@ -11,4 +12,11 @@ export interface JaenPluginOptions extends PluginOptions {
googleAnalytics?: {
trackingIds?: string[]
}

sentry?: {
org: string
project: string
dsn: string
feedbackIntegration?: Parameters<typeof feedbackIntegration>[0]
}
}

0 comments on commit 23e9027

Please sign in to comment.