@netlify/spark-ui 1.8.6 → 1.8.7

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.
@@ -0,0 +1,13 @@
1
+ class n {
2
+ /**
3
+ * Pushes an event payload into the dataLayer.
4
+ * @param eventName e.g. 'www:search_new_query'
5
+ * @param payload additional key/value data
6
+ */
7
+ track(t, e = {}) {
8
+ typeof gtag == "function" ? gtag("event", t, { ...e }) : console.error(`gtag is not defined. Event [${t}] failed.`);
9
+ }
10
+ }
11
+ export {
12
+ n as A
13
+ };
@@ -1,8 +1,9 @@
1
1
  import { u as t } from "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
2
  import { A as a } from "../../../chunks/hooks.module.DGkdD5n9.js";
3
3
  import { C as s, K as i } from "../../../chunks/ChatInterface.BD7rlv4H.js";
4
- import '../../../assets/AskNetlify.css';function m(o) {
5
- const e = a();
4
+ import { A as c } from "../../../chunks/analytics.Ch1vuuOl.js";
5
+ import '../../../assets/AskNetlify.css';function k(o) {
6
+ const e = a(new c());
6
7
  return /* @__PURE__ */ t(
7
8
  i,
8
9
  {
@@ -30,5 +31,5 @@ import '../../../assets/AskNetlify.css';function m(o) {
30
31
  );
31
32
  }
32
33
  export {
33
- m as default
34
+ k as default
34
35
  };
@@ -1,37 +1,28 @@
1
- import { A as y, y as h, q as k } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
- class s {
3
- /**
4
- * Pushes an event payload into the dataLayer.
5
- * @param eventName e.g. 'www:search_new_query'
6
- * @param payload additional key/value data
7
- */
8
- track(n, i = {}) {
9
- typeof gtag == "function" ? gtag("event", n, { ...i }) : console.error(`gtag is not defined. Event [${n}] failed.`);
10
- }
11
- }
12
- function p(r, n) {
13
- const l = y(new s()).current, e = (c) => c.debug_mode = !0;
1
+ import { A as y, y as h, q as d } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
+ import { A as k } from "../../../../chunks/analytics.Ch1vuuOl.js";
3
+ function b(r, l) {
4
+ const n = y(new k()).current, e = (c) => c.debug_mode = !0;
14
5
  return h(() => {
15
6
  if (!(r != null && r.searchTerm)) return;
16
7
  const c = { query: r == null ? void 0 : r.searchTerm };
17
- n && e(c), l.track("search:new_query", c);
8
+ l && e(c), n.track("search:new_query", c);
18
9
  }, [r == null ? void 0 : r.searchTerm]), h(() => {
19
10
  if (!(r != null && r.results)) return;
20
11
  const c = { query: r == null ? void 0 : r.searchTerm };
21
- n && e(c), r != null && r.searchTerm && r.results.length === 0 && l.track("search:no_results", c);
12
+ l && e(c), r != null && r.searchTerm && r.results.length === 0 && n.track("search:no_results", c);
22
13
  }, [r == null ? void 0 : r.results]), {
23
- handleClick: k((c) => {
24
- var f;
14
+ handleClick: d((c) => {
15
+ var i;
25
16
  const o = c.target.closest("a");
26
17
  if (!o) return;
27
- const g = (f = o.querySelector(".n-search-link-label")) == null ? void 0 : f.innerHTML, d = o.getAttribute("href") || void 0, u = {
28
- resultTitle: g,
29
- resultUrl: d
18
+ const f = (i = o.querySelector(".n-search-link-label")) == null ? void 0 : i.innerHTML, m = o.getAttribute("href") || void 0, u = {
19
+ resultTitle: f,
20
+ resultUrl: m
30
21
  };
31
- n && e(u), l.track("search:result_selected", u);
22
+ l && e(u), n.track("search:result_selected", u);
32
23
  }, [])
33
24
  };
34
25
  }
35
26
  export {
36
- p as useSearchLogger
27
+ b as useSearchLogger
37
28
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@netlify/spark-ui",
3
3
  "description": "Assets, design tokens, components, and utilities",
4
- "version": "1.8.6",
4
+ "version": "1.8.7",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",
@@ -1,6 +1,6 @@
1
1
  import { useRef } from 'preact/hooks';
2
2
  import { KapaProvider } from '@kapaai/react-sdk';
3
- import Analytics from '@analtyics/analytics';
3
+ import Analytics from '../../../analytics/analytics';
4
4
  import ChatInterface from './components/ChatInterface';
5
5
  import './AskNetlify.css';
6
6
 
@@ -9,7 +9,7 @@ interface AskNetlifyProps {
9
9
  }
10
10
 
11
11
  export default function AskNetlify(props: AskNetlifyProps) {
12
- const analyticsRef = useRef<Analytics>();
12
+ const analyticsRef = useRef<Analytics>(new Analytics());
13
13
  return (
14
14
  <KapaProvider
15
15
  integrationId="3c0789a6-c6a8-4fbc-b0cc-235f9e4a6351"