From 40d11e315fe9eade637aff47c4be60b999d41986 Mon Sep 17 00:00:00 2001 From: Luis David Barrera Date: Thu, 2 Nov 2023 11:54:06 +0100 Subject: [PATCH] refactor: rename function generateAdditionalInfo --- src/runtime/plugin.ts | 4 ++-- src/runtime/utm.ts | 4 ++-- test/fixtures/basic/nuxt.config.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/runtime/plugin.ts b/src/runtime/plugin.ts index 026a8bb..2557abd 100644 --- a/src/runtime/plugin.ts +++ b/src/runtime/plugin.ts @@ -4,7 +4,7 @@ import { getSessionID, urlHasUtmParams, getUtmParams, - generateAdditionalInfo, + getAdditionalInfo, isRepeatedEntry, } from "./utm"; import { ref } from "vue"; @@ -29,7 +29,7 @@ export default defineNuxtPlugin((nuxtApp) => { const utmParams = getUtmParams(query); - const additionalInfo = generateAdditionalInfo(); + const additionalInfo = getAdditionalInfo(); const timestamp = new Date().toISOString(); diff --git a/src/runtime/utm.ts b/src/runtime/utm.ts index 86f733d..9565d98 100644 --- a/src/runtime/utm.ts +++ b/src/runtime/utm.ts @@ -2,7 +2,7 @@ import { Ref } from "vue"; import { LocationQuery } from "vue-router"; import { UTMParams, AdditionalInfo, DataObject } from "nuxt-utm"; -const generateSessionId = () => { +export const generateSessionId = () => { return Math.random().toString(36).substring(2, 15); }; @@ -50,7 +50,7 @@ export const getUtmParams = (query: LocationQuery) => { return utmParams; }; -export const generateAdditionalInfo = () => { +export const getAdditionalInfo = () => { const additionalInfo: AdditionalInfo = { referrer: document.referrer, userAgent: navigator.userAgent, diff --git a/test/fixtures/basic/nuxt.config.ts b/test/fixtures/basic/nuxt.config.ts index 6ab7cb1..c705ef0 100644 --- a/test/fixtures/basic/nuxt.config.ts +++ b/test/fixtures/basic/nuxt.config.ts @@ -1,5 +1,5 @@ -import MyModule from "../../../src/module"; +import UtmModule from "../../../src/module"; export default defineNuxtConfig({ - modules: [MyModule], + modules: [UtmModule], });