Merge branch 'feat/utm-generator' into chore/all-my-stuffs

# Conflicts:
#	src/tools/index.ts
This commit is contained in:
ShareVB committed 2024-11-03 23:10:17 +01:00
commit cc3365e16c
4 files changed
+171 -8

No files matched your search

+10 -8
View File
@@ -1058,9 +1058,9 @@ packages:
resolution: {integrity: sha512-+lcUbnTRhd0jOewtFSedLyiPsD5tswKkbgcezOqqWFUVNEwoUTlpPOBmvhG7OXWLR4jMdv0czPGH5XbflnD1EA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.22.5
'@babel/types': 7.23.0
'@jridgewell/gen-mapping': 0.3.3
'@jridgewell/trace-mapping': 0.3.18
'@jridgewell/trace-mapping': 0.3.20
jsesc: 2.5.2
dev: true
@@ -1195,8 +1195,8 @@ packages:
resolution: {integrity: sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/template': 7.22.5
'@babel/types': 7.22.5
'@babel/template': 7.22.15
'@babel/types': 7.23.0
dev: true
/@babel/helper-function-name@7.23.0:
@@ -1210,7 +1210,7 @@ packages:
resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.22.5
'@babel/types': 7.23.0
/@babel/helper-member-expression-to-functions@7.22.5:
resolution: {integrity: sha512-aBiH1NKMG0H2cGZqspNvsaBe6wNGjbJjuLy29aU+eDZjSbbN53BaxlpB02xm9v34pLTZ1nIQPFYn2qMZoa5BQQ==}
@@ -1330,7 +1330,7 @@ packages:
resolution: {integrity: sha512-thqK5QFghPKWLhAV321lxF95yCg2K3Ob5yw+M3VHWfdia0IkPXUtoLH8x/6Fh486QUvzhb8YOWHChTVen2/PoQ==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.22.5
'@babel/types': 7.23.0
dev: true
/@babel/helper-split-export-declaration@7.22.6:
@@ -5697,7 +5697,7 @@ packages:
/@types/lodash-es@4.17.10:
resolution: {integrity: sha512-YJP+w/2khSBwbUSFdGsSqmDvmnN3cCKoPOL7Zjle6s30ZtemkkqhjVfFqGwPN7ASil5VyjE2GtyU/yqYY6mC0A==}
dependencies:
'@types/lodash': 4.14.192
'@types/lodash': 4.14.200
dev: false
/@types/lodash.defaultsdeep@4.6.9:
@@ -5720,6 +5720,7 @@ packages:
/@types/lodash@4.14.192:
resolution: {integrity: sha512-km+Vyn3BYm5ytMO13k9KTp27O75rbQ0NFw+U//g+PX7VZyjCioXaRFisqSIJRECljcTv73G3i6BpglNGHgUQ5A==}
dev: true
/@types/lodash@4.14.200:
resolution: {integrity: sha512-YI/M/4HRImtNf3pJgbF+W6FrXovqj+T+/HpENLTooK9PnkacBsDpeP3IpHab40CClUfhNmdM2WTNP2sa2dni5Q==}
@@ -10206,6 +10207,7 @@ packages:
/glob@7.2.3:
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
deprecated: Glob versions prior to v9 are no longer supported
dependencies:
fs.realpath: 1.0.0
inflight: 1.0.6
@@ -15514,7 +15516,7 @@ packages:
/unimport@3.0.8(rollup@2.79.1):
resolution: {integrity: sha512-AOt6xj3QMwqcTZRPB+NhFkyVEjCKnpTVoPm5x6424zz2NYYtCfym2bpJofzPHIJKPNIh5ko2/t2q46ZIMgdmbw==}
dependencies:
'@rollup/pluginutils': 5.0.2(rollup@2.79.1)
'@rollup/pluginutils': 5.0.5(rollup@2.79.1)
escape-string-regexp: 5.0.0
fast-glob: 3.3.1
local-pkg: 0.4.3
+2
View File
@@ -135,6 +135,7 @@ import { tool as rsaEncryption } from './rsa-encryption';
import { tool as urlCleaner } from './url-cleaner';
import { tool as urlFanger } from './url-fanger';
import { tool as urlTextFragmentMaker } from './url-text-fragment-maker';
import { tool as utmUrlGenerator } from './utm-url-generator';
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
import { tool as numeronymGenerator } from './numeronym-generator';
import { tool as macAddressGenerator } from './mac-address-generator';
@@ -342,6 +343,7 @@ export const toolsByCategory: ToolCategory[] = [
urlCleaner,
urlFanger,
urlTextFragmentMaker,
utmUrlGenerator,
deviceInformation,
basicAuthGenerator,
htpasswdGenerator,
+12
View File
@@ -0,0 +1,12 @@
import { Ad } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'UTM Url Generator',
path: '/utm-url-generator',
description: 'Generate an URL with utm_ parameters',
keywords: ['utm', 'url', 'generator'],
component: () => import('./utm-url-generator.vue'),
icon: Ad,
createdAt: new Date('2024-03-15'),
});
@@ -0,0 +1,147 @@
<script setup lang="ts">
import { useCopy } from '@/composable/copy';
import { useValidation } from '@/composable/validation';
const url = useStorage('utm-generator:url', '');
const utmSource = useStorage('utm-generator:source', '');
const utmMedium = useStorage('utm-generator:medium', '');
const utmCampaign = useStorage('utm-generator:campaign', '');
const utmContent = useStorage('utm-generator:content', '');
const utmTerm = useStorage('utm-generator:term', '');
const utmifiedUrl = computed(() => {
try {
const utmUrl = new URL(url.value);
utmUrl.searchParams.set('utm_source', utmSource.value);
utmUrl.searchParams.set('utm_medium', utmMedium.value);
utmUrl.searchParams.set('utm_campaign', utmCampaign.value);
if (utmContent.value) {
utmUrl.searchParams.set('utm_content', utmContent.value);
}
if (utmContent.value) {
utmUrl.searchParams.set('utm_term', utmTerm.value);
}
return utmUrl.href;
}
catch {
return '# invalid inputs';
}
});
const urlValidation = useValidation({
source: url,
rules: [
{
message: 'Invalid url string',
validator: (value) => {
try {
const _ = (new URL(value));
return true;
}
catch {
return false;
}
},
},
],
});
const utmMediumValidation = useValidation({
source: utmMedium,
rules: [
{
message: 'UTM Medium is required',
validator: value => value !== '',
},
],
});
const utmSourceValidation = useValidation({
source: utmSource,
rules: [
{
message: 'UTM Source is required',
validator: value => value !== '',
},
],
});
const utmCampaignValidation = useValidation({
source: utmCampaign,
rules: [
{
message: 'UTM Campaign is required',
validator: value => value !== '',
},
],
});
const { copy } = useCopy({ source: utmifiedUrl, text: 'UTMified url copied.' });
</script>
<template>
<div>
<n-p>
For more info about UTM, see <n-a href="https://en.wikipedia.org/wiki/UTM_parameters" target="_blank" rel="noopener noreferrer">
UTM Parameters
</n-a>
</n-p>
<c-input-text
v-model:value="url"
label="Website url"
placeholder="Put your website url here..."
clearable
mb-2
:validation="urlValidation"
/>
<c-input-text
v-model:value="utmSource"
label="UTM Source (Identifies which site sent the traffic)"
placeholder="Put your UTM Source here..."
clearable
mb-2
:validation="utmSourceValidation"
/>
<c-input-text
v-model:value="utmMedium"
label="UTM Medium (Identifies what type of link was used)"
placeholder="Put your UTM Medium here..."
clearable
mb-2
:validation="utmMediumValidation"
/>
<c-input-text
v-model:value="utmCampaign"
label="UTM Campaign (Identifies a specific product promotion or strategic campaign)"
placeholder="Put your UTM Campaign here..."
clearable
mb-2
:validation="utmCampaignValidation"
/>
<c-input-text
v-model:value="utmContent"
label="UTM Content (Identifies search terms)"
placeholder="Put your UTM Content here..."
clearable
mb-2
/>
<c-input-text
v-model:value="utmTerm"
label="UTM Term (Identifies what specifically was clicked to bring the user to the site)"
placeholder="Put your UTM Term here..."
clearable
mb-2
/>
<div v-if="utmifiedUrl">
<div mb-2>
Your url with UTM parameters added
</div>
<c-card>
{{ utmifiedUrl }}
</c-card>
<div mt-3 flex justify-center>
<c-button autofocus @click="copy()">
Copy url
</c-button>
</div>
</div>
</div>
</template>