@windrun-huaiin/base-ui 6.0.2 → 7.0.0

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.
@@ -172,4 +172,18 @@ declare const NotFoundIcon: () => react_jsx_runtime.JSX.Element;
172
172
  */
173
173
  declare function createSiteIcon(iconConfig: string | React.ComponentType<LucideProps>): ({ size, className, ...props }: Omit<LucideProps, "children">) => react_jsx_runtime.JSX.Element;
174
174
 
175
- export { DefaultSiteIcon, NotFoundIcon, createSiteIcon, getGlobalIcon, getIconElement, globalLucideIcons };
175
+ declare function useGoogleAnalytics(): {
176
+ trackEvent: (event: string, data?: Record<string, unknown>) => void;
177
+ };
178
+ declare global {
179
+ interface Window {
180
+ dataLayer: any[];
181
+ gtag: (...args: any[]) => void;
182
+ }
183
+ }
184
+
185
+ declare function GoogleAnalyticsScript(): react_jsx_runtime.JSX.Element | null;
186
+
187
+ declare function MicrosoftClarityScript(): react_jsx_runtime.JSX.Element | null;
188
+
189
+ export { DefaultSiteIcon, GoogleAnalyticsScript, MicrosoftClarityScript, NotFoundIcon, createSiteIcon, getGlobalIcon, getIconElement, globalLucideIcons, useGoogleAnalytics };
@@ -172,4 +172,18 @@ declare const NotFoundIcon: () => react_jsx_runtime.JSX.Element;
172
172
  */
173
173
  declare function createSiteIcon(iconConfig: string | React.ComponentType<LucideProps>): ({ size, className, ...props }: Omit<LucideProps, "children">) => react_jsx_runtime.JSX.Element;
174
174
 
175
- export { DefaultSiteIcon, NotFoundIcon, createSiteIcon, getGlobalIcon, getIconElement, globalLucideIcons };
175
+ declare function useGoogleAnalytics(): {
176
+ trackEvent: (event: string, data?: Record<string, unknown>) => void;
177
+ };
178
+ declare global {
179
+ interface Window {
180
+ dataLayer: any[];
181
+ gtag: (...args: any[]) => void;
182
+ }
183
+ }
184
+
185
+ declare function GoogleAnalyticsScript(): react_jsx_runtime.JSX.Element | null;
186
+
187
+ declare function MicrosoftClarityScript(): react_jsx_runtime.JSX.Element | null;
188
+
189
+ export { DefaultSiteIcon, GoogleAnalyticsScript, MicrosoftClarityScript, NotFoundIcon, createSiteIcon, getGlobalIcon, getIconElement, globalLucideIcons, useGoogleAnalytics };
@@ -60,11 +60,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
60
60
  var server_exports = {};
61
61
  __export(server_exports, {
62
62
  DefaultSiteIcon: () => DefaultSiteIcon,
63
+ GoogleAnalyticsScript: () => GoogleAnalyticsScript,
64
+ MicrosoftClarityScript: () => MicrosoftClarityScript,
63
65
  NotFoundIcon: () => NotFoundIcon,
64
66
  createSiteIcon: () => createSiteIcon,
65
67
  getGlobalIcon: () => getGlobalIcon,
66
68
  getIconElement: () => getIconElement,
67
- globalLucideIcons: () => globalLucideIcons
69
+ globalLucideIcons: () => globalLucideIcons,
70
+ useGoogleAnalytics: () => useGoogleAnalytics
68
71
  });
69
72
  module.exports = __toCommonJS(server_exports);
70
73
 
@@ -1466,4 +1469,86 @@ function createSiteIcon(iconConfig) {
1466
1469
  }
1467
1470
  };
1468
1471
  }
1472
+
1473
+ // src/components/script/google-analytics-client.tsx
1474
+ var import_script = __toESM(require("next/script"), 1);
1475
+ var import_jsx_runtime34 = require("react/jsx-runtime");
1476
+ function GoogleAnalyticsClient({ analyticsId }) {
1477
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
1478
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
1479
+ import_script.default,
1480
+ {
1481
+ strategy: "afterInteractive",
1482
+ src: `https://www.googletagmanager.com/gtag/js?id=${analyticsId}`
1483
+ }
1484
+ ),
1485
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
1486
+ import_script.default,
1487
+ {
1488
+ id: "google-analytics",
1489
+ strategy: "afterInteractive",
1490
+ dangerouslySetInnerHTML: {
1491
+ __html: `
1492
+ window.dataLayer = window.dataLayer || [];
1493
+ function gtag(){dataLayer.push(arguments);}
1494
+ gtag('js', new Date());
1495
+ gtag('config', '${analyticsId}');
1496
+ `
1497
+ }
1498
+ }
1499
+ )
1500
+ ] });
1501
+ }
1502
+ function useGoogleAnalytics() {
1503
+ const trackEvent = (event, data) => {
1504
+ if (typeof window === "undefined" || !window.gtag) {
1505
+ return;
1506
+ }
1507
+ window.gtag("event", event, data);
1508
+ };
1509
+ return {
1510
+ trackEvent
1511
+ };
1512
+ }
1513
+
1514
+ // src/components/script/google-analytics-script.tsx
1515
+ var import_jsx_runtime35 = require("react/jsx-runtime");
1516
+ function GoogleAnalyticsScript() {
1517
+ if (process.env.NODE_ENV !== "production") {
1518
+ return null;
1519
+ }
1520
+ const googleAnalyticsId = process.env.NEXT_PUBLIC_GOOGLE_ANALYTICS_ID;
1521
+ if (!googleAnalyticsId) {
1522
+ console.warn("NEXT_PUBLIC_GOOGLE_ANALYTICS_ID is not configured");
1523
+ return null;
1524
+ }
1525
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(GoogleAnalyticsClient, { analyticsId: googleAnalyticsId });
1526
+ }
1527
+
1528
+ // src/components/script/microsoft-clarity-client.tsx
1529
+ var import_script2 = __toESM(require("next/script"), 1);
1530
+ var import_jsx_runtime36 = require("react/jsx-runtime");
1531
+ function MicrosoftClarityClient({ clarityId }) {
1532
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_script2.default, { id: "microsoft-clarity", strategy: "afterInteractive", children: `
1533
+ (function(c,l,a,r,i,t,y){
1534
+ c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
1535
+ t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
1536
+ y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
1537
+ })(window, document, "clarity", "script", "${clarityId}");
1538
+ ` });
1539
+ }
1540
+
1541
+ // src/components/script/microsoft-clarity-script.tsx
1542
+ var import_jsx_runtime37 = require("react/jsx-runtime");
1543
+ function MicrosoftClarityScript() {
1544
+ if (process.env.NODE_ENV !== "production") {
1545
+ return null;
1546
+ }
1547
+ const microsoftClarityId = process.env.NEXT_PUBLIC_MICROSOFT_CLARITY_ID;
1548
+ if (!microsoftClarityId) {
1549
+ console.warn("NEXT_PUBLIC_MICROSOFT_CLARITY_ID is not configured");
1550
+ return null;
1551
+ }
1552
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(MicrosoftClarityClient, { clarityId: microsoftClarityId });
1553
+ }
1469
1554
  //# sourceMappingURL=server.js.map