-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
npm run format (after useTabs: false in .prettierrc)
- Loading branch information
Showing
14 changed files
with
146 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,53 @@ | ||
{ | ||
"name": "svelte-static", | ||
"version": "0.0.1", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite dev", | ||
"build": "vite build", | ||
"preview": "vite preview", | ||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", | ||
"format": "prettier --write .", | ||
"lint": "prettier --check . && eslint .", | ||
"obfuscate": "javascript-obfuscator ./build --output ./build", | ||
"test:unit": "vitest", | ||
"test": "npm run test:unit -- --run && npm run test:e2e", | ||
"test:e2e": "playwright test" | ||
}, | ||
"devDependencies": { | ||
"@iconify/json": "^2.2.273", | ||
"@playwright/test": "^1.45.3", | ||
"@sentry/browser": "^8.40.0", | ||
"@sveltejs/adapter-static": "^3.0.6", | ||
"@sveltejs/kit": "^2.0.0", | ||
"@sveltejs/vite-plugin-svelte": "^4.0.0", | ||
"@types/eslint": "^9.6.0", | ||
"autoprefixer": "^10.4.20", | ||
"eslint": "^9.7.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-svelte": "^2.36.0", | ||
"globals": "^15.0.0", | ||
"javascript-obfuscator": "^4.1.1", | ||
"luxon": "^3.5.0", | ||
"postcss": "^8.4.49", | ||
"postcss-import": "^16.1.0", | ||
"prettier": "^3.3.2", | ||
"prettier-plugin-svelte": "^3.2.6", | ||
"prettier-plugin-tailwindcss": "^0.6.5", | ||
"svelte": "^5.0.0", | ||
"svelte-check": "^4.0.0", | ||
"tailwindcss": "^3.4.9", | ||
"typescript": "^5.0.0", | ||
"typescript-eslint": "^8.0.0", | ||
"unplugin-icons": "^0.20.1", | ||
"vite": "^5.0.3", | ||
"vitest": "^2.0.4" | ||
}, | ||
"dependencies": { | ||
"@tailwindcss/aspect-ratio": "^0.4.2", | ||
"@tailwindcss/container-queries": "^0.1.1", | ||
"@tailwindcss/forms": "^0.5.9", | ||
"@tailwindcss/typography": "^0.5.15" | ||
} | ||
"name": "svelte-static", | ||
"version": "0.0.1", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite dev", | ||
"build": "vite build", | ||
"preview": "vite preview", | ||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", | ||
"format": "prettier --write .", | ||
"lint": "prettier --check . && eslint .", | ||
"obfuscate": "javascript-obfuscator ./build --output ./build", | ||
"test:unit": "vitest", | ||
"test": "npm run test:unit -- --run && npm run test:e2e", | ||
"test:e2e": "playwright test" | ||
}, | ||
"devDependencies": { | ||
"@iconify/json": "^2.2.273", | ||
"@playwright/test": "^1.45.3", | ||
"@sentry/browser": "^8.40.0", | ||
"@sveltejs/adapter-static": "^3.0.6", | ||
"@sveltejs/kit": "^2.0.0", | ||
"@sveltejs/vite-plugin-svelte": "^4.0.0", | ||
"@types/eslint": "^9.6.0", | ||
"autoprefixer": "^10.4.20", | ||
"eslint": "^9.7.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-svelte": "^2.36.0", | ||
"globals": "^15.0.0", | ||
"javascript-obfuscator": "^4.1.1", | ||
"luxon": "^3.5.0", | ||
"postcss": "^8.4.49", | ||
"postcss-import": "^16.1.0", | ||
"prettier": "^3.3.2", | ||
"prettier-plugin-svelte": "^3.2.6", | ||
"prettier-plugin-tailwindcss": "^0.6.5", | ||
"svelte": "^5.0.0", | ||
"svelte-check": "^4.0.0", | ||
"tailwindcss": "^3.4.9", | ||
"typescript": "^5.0.0", | ||
"typescript-eslint": "^8.0.0", | ||
"unplugin-icons": "^0.20.1", | ||
"vite": "^5.0.3", | ||
"vitest": "^2.0.4" | ||
}, | ||
"dependencies": { | ||
"@tailwindcss/aspect-ratio": "^0.4.2", | ||
"@tailwindcss/container-queries": "^0.1.1", | ||
"@tailwindcss/forms": "^0.5.9", | ||
"@tailwindcss/typography": "^0.5.15" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** The driven port of the application for reporting events related to ad campaigns. */ | ||
export abstract class AdCampaignService { | ||
abstract trackClick(targetId: string): void; | ||
abstract trackConversion(label: string, value?: number): void; | ||
abstract trackClick(targetId: string): void; | ||
abstract trackConversion(label: string, value?: number): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,34 @@ | ||
import { AdCampaignService } from './service'; | ||
|
||
declare global { | ||
interface Window { | ||
dataLayer: any[]; | ||
} | ||
interface Window { | ||
dataLayer: any[]; | ||
} | ||
} | ||
|
||
/** | ||
* Google Ads (AdWords) adapter for the ad campaign service. | ||
*/ | ||
export class AdCampaignServiceGoogleAds extends AdCampaignService { | ||
constructor(gtagId: string) { | ||
super(); | ||
const script = document.createElement('script'); | ||
script.async = true; | ||
script.src = `https://www.googletagmanager.com/gtag/js?id=${gtagId}`; | ||
document.head.appendChild(script); | ||
window.dataLayer = window.dataLayer || []; | ||
this.gtag('js', new Date()); | ||
this.gtag('config', gtagId); | ||
} | ||
constructor(gtagId: string) { | ||
super(); | ||
const script = document.createElement('script'); | ||
script.async = true; | ||
script.src = `https://www.googletagmanager.com/gtag/js?id=${gtagId}`; | ||
document.head.appendChild(script); | ||
window.dataLayer = window.dataLayer || []; | ||
this.gtag('js', new Date()); | ||
this.gtag('config', gtagId); | ||
} | ||
|
||
private gtag(..._: any[]): void { | ||
window.dataLayer.push(arguments); | ||
} | ||
private gtag(..._: any[]): void { | ||
window.dataLayer.push(arguments); | ||
} | ||
|
||
trackClick(targetId: string): void { | ||
this.gtag('event', 'click', { targetId }); | ||
} | ||
trackConversion(label: string, value?: number): void { | ||
this.gtag('event', 'conversion', { label, value }); | ||
} | ||
trackClick(targetId: string): void { | ||
this.gtag('event', 'click', { targetId }); | ||
} | ||
trackConversion(label: string, value?: number): void { | ||
this.gtag('event', 'conversion', { label, value }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** The driven port of the application for loading and showing ads. */ | ||
export abstract class AdDisplayService { | ||
abstract loadAd(element: HTMLElement, adSlot: string, format: string): Promise<void>; | ||
abstract loadAd(element: HTMLElement, adSlot: string, format: string): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
import { AdDisplayService } from './service'; | ||
|
||
declare global { | ||
interface Window { | ||
adsbygoogle: any[]; | ||
} | ||
interface Window { | ||
adsbygoogle: any[]; | ||
} | ||
} | ||
|
||
/** | ||
* Google AdSense adapter for the ad display service. | ||
*/ | ||
export class AdDisplayServiceGoogleAdsense extends AdDisplayService { | ||
private clientId: string; | ||
private clientId: string; | ||
|
||
constructor(clientId: string) { | ||
super(); | ||
this.clientId = clientId; | ||
window.adsbygoogle = window.adsbygoogle || []; | ||
const script = document.createElement('script'); | ||
script.async = true; | ||
script.src = `https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`; | ||
script.crossOrigin = 'anonymous'; | ||
document.head.appendChild(script); | ||
} | ||
constructor(clientId: string) { | ||
super(); | ||
this.clientId = clientId; | ||
window.adsbygoogle = window.adsbygoogle || []; | ||
const script = document.createElement('script'); | ||
script.async = true; | ||
script.src = `https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`; | ||
script.crossOrigin = 'anonymous'; | ||
document.head.appendChild(script); | ||
} | ||
|
||
async loadAd(element: HTMLElement, adSlot: string, format: string = 'auto'): Promise<void> { | ||
window.adsbygoogle.push({ | ||
element, | ||
adUnitPath: adSlot, | ||
format: format | ||
}); | ||
return new Promise((resolve) => { | ||
element.addEventListener('load', () => resolve()); | ||
}); | ||
} | ||
async loadAd(element: HTMLElement, adSlot: string, format: string = 'auto'): Promise<void> { | ||
window.adsbygoogle.push({ | ||
element, | ||
adUnitPath: adSlot, | ||
format: format | ||
}); | ||
return new Promise((resolve) => { | ||
element.addEventListener('load', () => resolve()); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/** The driven port of the application for reporting errors to an external service. */ | ||
export abstract class ReportingService { | ||
abstract reportError(error: any, message?: string): Promise<void>; | ||
abstract reportError(error: any, message?: string): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters