Skip to content

Commit

Permalink
fix: fix for module options
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamiewarb committed Jul 14, 2023
1 parent a208a59 commit c5ffd10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/module.ts
Expand Up @@ -7,33 +7,33 @@ export interface ModuleOptions {
/**
* Whether to show debug logs for the module
*/
debugEnabled: boolean
debugEnabled?: boolean

/**
* Whether events shall be tracked when running the site in development mode
*
* @default false
*/
trackDevMode: boolean
trackDevMode?: boolean

/**
* Whether trackPageView should be automatically integrated with the router
*
* @default true
*/
enableRouterSync: boolean
enableRouterSync?: boolean

/**
* Enable Nuxt Devtools integration
*
* @default true
*/
devtools: boolean
devtools?: boolean

/**
* Ignore some router views from being tracked - used when enableRouterSync is true
*/
ignoredViews: string[] | ((to: any, from: any) => boolean)
ignoredViews?: string[] | ((to: any, from: any) => boolean)

/**
* Derive additional event data after navigation
Expand Down Expand Up @@ -69,7 +69,7 @@ export interface ModuleOptions {
*
* @default {}
*/
options: {
options?: {
/**
* The API host where the events will be sent to
*
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/plugin.client.ts
Expand Up @@ -12,7 +12,7 @@ let deriveAdditionalEventData: ModuleOptions['vueRouterAdditionalEventData'] = (
export default defineNuxtPlugin((nuxt) => {
const config = nuxt.$config.public.segment;

debugEnabled = config.debugEnabled;
debugEnabled = config.debugEnabled ?? false;
trackOnNextTick = config.trackOnNextTick;
deriveAdditionalEventData = config.vueRouterAdditionalEventData || deriveAdditionalEventData;

Expand All @@ -29,7 +29,7 @@ export default defineNuxtPlugin((nuxt) => {
const options = config.options;

let integrations = {};
if (options.apiHost || options.protocol) {
if (options?.apiHost || options?.protocol) {
integrations = {
integrations: {
'Segment.io': {
Expand Down

0 comments on commit c5ffd10

Please sign in to comment.