@nekm/svelte-core 1.10.1 → 1.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import {onMount} from "svelte";
3
3
  import {browserImportScript} from "@nekm/core";
4
- import {page} from "$app/state";
4
+ import { dev } from "$app/environment";
5
5
 
6
6
  export interface GoogleAnalyticsProps {
7
7
  /**
@@ -10,29 +10,20 @@
10
10
  readonly id: string;
11
11
 
12
12
  /**
13
- * Base domain to the production site. If the current domain does not match
14
- * this, then Google Analytics will send debug data only.
13
+ * Activate debug mode. Defaults to true during dev
15
14
  */
16
- readonly productionDomain?: string | URL;
15
+ readonly debugMode?: boolean;
17
16
  }
18
17
 
19
- interface GoogleAnalyticsConfig {
20
- readonly debug_mode?: boolean;
21
- }
22
-
23
- const { id, productionDomain }: GoogleAnalyticsProps = $props();
18
+ const { id, debugMode = dev }: GoogleAnalyticsProps = $props();
24
19
 
25
20
  const url = "https://www.googletagmanager.com";
26
21
 
27
- const productionDomainStr = $derived(productionDomain instanceof URL ? productionDomain.hostname : productionDomain);
28
-
29
22
  onMount(() => {
30
- let config: GoogleAnalyticsConfig = { debug_mode: true };
23
+ let config: { readonly debug_mode?: boolean } = { };
31
24
 
32
- if (productionDomain) {
33
- if (page.url.hostname === productionDomainStr) {
34
- config = {};
35
- }
25
+ if (debugMode) {
26
+ config = { debug_mode: true };
36
27
  }
37
28
 
38
29
  window.dataLayer = window.dataLayer || [];
@@ -4,10 +4,9 @@ export interface GoogleAnalyticsProps {
4
4
  */
5
5
  readonly id: string;
6
6
  /**
7
- * Base domain to the production site. If the current domain does not match
8
- * this, then Google Analytics will send debug data only.
7
+ * Activate debug mode. Defaults to true during dev
9
8
  */
10
- readonly productionDomain?: string | URL;
9
+ readonly debugMode?: boolean;
11
10
  }
12
11
  declare const GoogleAnalytics: import("svelte").Component<GoogleAnalyticsProps, {}, "">;
13
12
  type GoogleAnalytics = ReturnType<typeof GoogleAnalytics>;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@nekm/svelte-core",
3
3
  "description": "Code I find myself re-writing over-and-over, Svelte edition.",
4
4
  "license": "MIT",
5
- "version": "1.10.1",
5
+ "version": "1.10.3",
6
6
  "scripts": {
7
7
  "dev": "vite dev",
8
8
  "build": "vite build && npm run prepack",