@salesmind-ai/design-system 0.3.0 → 0.3.2
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.
- package/README.md +32 -2
- package/dist/admin/index.cjs +68 -2928
- package/dist/admin/index.cjs.map +1 -1
- package/dist/admin/index.js +5 -2915
- package/dist/admin/index.js.map +1 -1
- package/dist/blog/index.cjs +53 -1064
- package/dist/blog/index.cjs.map +1 -1
- package/dist/blog/index.js +8 -1054
- package/dist/blog/index.js.map +1 -1
- package/dist/charts/index.cjs +46 -2694
- package/dist/charts/index.cjs.map +1 -1
- package/dist/charts/index.js +3 -2680
- package/dist/charts/index.js.map +1 -1
- package/dist/chunk-2GARWEJK.js +17 -0
- package/dist/chunk-2GARWEJK.js.map +1 -0
- package/dist/chunk-3NKRFUAR.js +37 -0
- package/dist/chunk-3NKRFUAR.js.map +1 -0
- package/dist/chunk-3TGSIILM.cjs +201 -0
- package/dist/chunk-3TGSIILM.cjs.map +1 -0
- package/dist/chunk-4GM5BGBN.cjs +801 -0
- package/dist/chunk-4GM5BGBN.cjs.map +1 -0
- package/dist/chunk-5LGDEZWY.cjs +2434 -0
- package/dist/chunk-5LGDEZWY.cjs.map +1 -0
- package/dist/chunk-6H4DSTXR.js +786 -0
- package/dist/chunk-6H4DSTXR.js.map +1 -0
- package/dist/chunk-6UNG76Y2.js +153 -0
- package/dist/chunk-6UNG76Y2.js.map +1 -0
- package/dist/chunk-7PX2AZ6Y.js +39 -0
- package/dist/chunk-7PX2AZ6Y.js.map +1 -0
- package/dist/chunk-B6AVAX4F.js +1415 -0
- package/dist/chunk-B6AVAX4F.js.map +1 -0
- package/dist/chunk-BILT5KD3.js +264 -0
- package/dist/chunk-BILT5KD3.js.map +1 -0
- package/dist/chunk-C2BCDNAV.js +24 -0
- package/dist/chunk-C2BCDNAV.js.map +1 -0
- package/dist/chunk-CH42VPWE.cjs +421 -0
- package/dist/chunk-CH42VPWE.cjs.map +1 -0
- package/dist/chunk-CJ2MKVAF.cjs +46 -0
- package/dist/chunk-CJ2MKVAF.cjs.map +1 -0
- package/dist/chunk-DP74LUXG.cjs +98 -0
- package/dist/chunk-DP74LUXG.cjs.map +1 -0
- package/dist/chunk-E7D6EKJ4.cjs +44 -0
- package/dist/chunk-E7D6EKJ4.cjs.map +1 -0
- package/dist/chunk-ECXBTUH6.cjs +584 -0
- package/dist/chunk-ECXBTUH6.cjs.map +1 -0
- package/dist/chunk-EFRAP5ES.js +157 -0
- package/dist/chunk-EFRAP5ES.js.map +1 -0
- package/dist/chunk-F6YYWMME.js +485 -0
- package/dist/chunk-F6YYWMME.js.map +1 -0
- package/dist/chunk-FAFAP4L5.js +183 -0
- package/dist/chunk-FAFAP4L5.js.map +1 -0
- package/dist/chunk-GUZIMHWS.js +1608 -0
- package/dist/chunk-GUZIMHWS.js.map +1 -0
- package/dist/chunk-H2Y6BSTL.cjs +69 -0
- package/dist/chunk-H2Y6BSTL.cjs.map +1 -0
- package/dist/chunk-HN4PHABT.js +126 -0
- package/dist/chunk-HN4PHABT.js.map +1 -0
- package/dist/chunk-HRENHNDJ.js +211 -0
- package/dist/chunk-HRENHNDJ.js.map +1 -0
- package/dist/chunk-I75BFEYT.cjs +2561 -0
- package/dist/chunk-I75BFEYT.cjs.map +1 -0
- package/dist/chunk-IFRATNLU.js +562 -0
- package/dist/chunk-IFRATNLU.js.map +1 -0
- package/dist/chunk-IYPXJ6YC.cjs +69 -0
- package/dist/chunk-IYPXJ6YC.cjs.map +1 -0
- package/dist/chunk-JPJN4YBC.js +409 -0
- package/dist/chunk-JPJN4YBC.js.map +1 -0
- package/dist/chunk-KBA2LFBG.js +62 -0
- package/dist/chunk-KBA2LFBG.js.map +1 -0
- package/dist/chunk-KCKUSU2M.cjs +166 -0
- package/dist/chunk-KCKUSU2M.cjs.map +1 -0
- package/dist/chunk-KJ2OXQF4.js +287 -0
- package/dist/chunk-KJ2OXQF4.js.map +1 -0
- package/dist/chunk-KNQEIU7O.cjs +1202 -0
- package/dist/chunk-KNQEIU7O.cjs.map +1 -0
- package/dist/chunk-KVGSVGRK.cjs +569 -0
- package/dist/chunk-KVGSVGRK.cjs.map +1 -0
- package/dist/chunk-L352JRV6.cjs +105 -0
- package/dist/chunk-L352JRV6.cjs.map +1 -0
- package/dist/chunk-LJADZITX.cjs +298 -0
- package/dist/chunk-LJADZITX.cjs.map +1 -0
- package/dist/chunk-LMJPWXTZ.cjs +194 -0
- package/dist/chunk-LMJPWXTZ.cjs.map +1 -0
- package/dist/chunk-LOWEAQST.js +701 -0
- package/dist/chunk-LOWEAQST.js.map +1 -0
- package/dist/chunk-MDB2WCRQ.cjs +137 -0
- package/dist/chunk-MDB2WCRQ.cjs.map +1 -0
- package/dist/chunk-MQDEE7HC.cjs +283 -0
- package/dist/chunk-MQDEE7HC.cjs.map +1 -0
- package/dist/chunk-MQRB634A.cjs +34 -0
- package/dist/chunk-MQRB634A.cjs.map +1 -0
- package/dist/chunk-MTI27RDV.js +185 -0
- package/dist/chunk-MTI27RDV.js.map +1 -0
- package/dist/chunk-MU6GW5ZV.js +2317 -0
- package/dist/chunk-MU6GW5ZV.js.map +1 -0
- package/dist/chunk-NN3TUHIH.js +28 -0
- package/dist/chunk-NN3TUHIH.js.map +1 -0
- package/dist/chunk-NT4LBP7D.cjs +111 -0
- package/dist/chunk-NT4LBP7D.cjs.map +1 -0
- package/dist/chunk-OLV7OD3X.cjs +502 -0
- package/dist/chunk-OLV7OD3X.cjs.map +1 -0
- package/dist/chunk-OXNXEQY7.js +2538 -0
- package/dist/chunk-OXNXEQY7.js.map +1 -0
- package/dist/chunk-P5BOFE5A.js +546 -0
- package/dist/chunk-P5BOFE5A.js.map +1 -0
- package/dist/chunk-Q2MFGYTE.cjs +1449 -0
- package/dist/chunk-Q2MFGYTE.cjs.map +1 -0
- package/dist/chunk-Q75DBVDY.cjs +68 -0
- package/dist/chunk-Q75DBVDY.cjs.map +1 -0
- package/dist/chunk-REQ5Q6ZI.js +1022 -0
- package/dist/chunk-REQ5Q6ZI.js.map +1 -0
- package/dist/chunk-SICKWUWB.js +62 -0
- package/dist/chunk-SICKWUWB.js.map +1 -0
- package/dist/chunk-T343CCH5.js +1190 -0
- package/dist/chunk-T343CCH5.js.map +1 -0
- package/dist/chunk-TEC62D4A.cjs +1624 -0
- package/dist/chunk-TEC62D4A.cjs.map +1 -0
- package/dist/chunk-TW5JB35D.js +2122 -0
- package/dist/chunk-TW5JB35D.js.map +1 -0
- package/dist/chunk-VC5LMUVQ.cjs +20 -0
- package/dist/chunk-VC5LMUVQ.cjs.map +1 -0
- package/dist/chunk-VM7WFMKI.cjs +76 -0
- package/dist/chunk-VM7WFMKI.cjs.map +1 -0
- package/dist/chunk-W2WTP6HS.cjs +233 -0
- package/dist/chunk-W2WTP6HS.cjs.map +1 -0
- package/dist/chunk-WH7PYHZY.cjs +35 -0
- package/dist/chunk-WH7PYHZY.cjs.map +1 -0
- package/dist/chunk-XQZVY7JJ.cjs +717 -0
- package/dist/chunk-XQZVY7JJ.cjs.map +1 -0
- package/dist/chunk-XU3OMQ7V.js +98 -0
- package/dist/chunk-XU3OMQ7V.js.map +1 -0
- package/dist/chunk-XWPDRMZG.js +62 -0
- package/dist/chunk-XWPDRMZG.js.map +1 -0
- package/dist/chunk-Y3CPKNB7.js +67 -0
- package/dist/chunk-Y3CPKNB7.js.map +1 -0
- package/dist/chunk-YNVRDD2P.js +98 -0
- package/dist/chunk-YNVRDD2P.js.map +1 -0
- package/dist/chunk-YSYR54XR.js +92 -0
- package/dist/chunk-YSYR54XR.js.map +1 -0
- package/dist/chunk-YTYDQBVY.cjs +162 -0
- package/dist/chunk-YTYDQBVY.cjs.map +1 -0
- package/dist/chunk-ZDLOA2UT.cjs +1042 -0
- package/dist/chunk-ZDLOA2UT.cjs.map +1 -0
- package/dist/chunk-ZWUKRCOJ.cjs +2162 -0
- package/dist/chunk-ZWUKRCOJ.cjs.map +1 -0
- package/dist/core/index.cjs +807 -4333
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +14 -4130
- package/dist/core/index.js.map +1 -1
- package/dist/i18n/index.cjs +86 -558
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.js +1 -544
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.cjs +1432 -17139
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +11 -7
- package/dist/index.css.map +1 -1
- package/dist/index.js +31 -16784
- package/dist/index.js.map +1 -1
- package/dist/marketing/index.cjs +142 -3072
- package/dist/marketing/index.cjs.map +1 -1
- package/dist/marketing/index.js +11 -3042
- package/dist/marketing/index.js.map +1 -1
- package/dist/motion/index.cjs +26 -1222
- package/dist/motion/index.cjs.map +1 -1
- package/dist/motion/index.js +2 -1215
- package/dist/motion/index.js.map +1 -1
- package/dist/nav/index.cjs +101 -1518
- package/dist/nav/index.cjs.map +1 -1
- package/dist/nav/index.js +4 -1498
- package/dist/nav/index.js.map +1 -1
- package/dist/report/index.cjs +171 -2403
- package/dist/report/index.cjs.map +1 -1
- package/dist/report/index.js +3 -2363
- package/dist/report/index.js.map +1 -1
- package/dist/sections/index.cjs +28 -378
- package/dist/sections/index.cjs.map +1 -1
- package/dist/sections/index.css +1 -4
- package/dist/sections/index.css.map +1 -1
- package/dist/sections/index.js +4 -372
- package/dist/sections/index.js.map +1 -1
- package/dist/social-proof/index.cjs +53 -1249
- package/dist/social-proof/index.cjs.map +1 -1
- package/dist/social-proof/index.css +10 -3
- package/dist/social-proof/index.css.map +1 -1
- package/dist/social-proof/index.js +6 -1234
- package/dist/social-proof/index.js.map +1 -1
- package/dist/theme/index.cjs +38 -565
- package/dist/theme/index.cjs.map +1 -1
- package/dist/theme/index.js +2 -555
- package/dist/theme/index.js.map +1 -1
- package/dist/web/client/index.cjs +48 -0
- package/dist/web/client/index.cjs.map +1 -0
- package/dist/web/client/index.css +456 -0
- package/dist/web/client/index.css.map +1 -0
- package/dist/web/client/index.d.cts +172 -0
- package/dist/web/client/index.d.ts +172 -0
- package/dist/web/client/index.js +7 -0
- package/dist/web/client/index.js.map +1 -0
- package/dist/web/index.cjs +158 -1346
- package/dist/web/index.cjs.map +1 -1
- package/dist/web/index.d.cts +5 -893
- package/dist/web/index.d.ts +5 -893
- package/dist/web/index.js +9 -1305
- package/dist/web/index.js.map +1 -1
- package/dist/web/server/index.cjs +32 -0
- package/dist/web/server/index.cjs.map +1 -0
- package/dist/web/server/index.d.cts +725 -0
- package/dist/web/server/index.d.ts +725 -0
- package/dist/web/server/index.js +3 -0
- package/dist/web/server/index.js.map +1 -0
- package/package.json +14 -1
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generic analytics script loader.
|
|
6
|
+
*
|
|
7
|
+
* Framework-agnostic: injects a `<script>` tag into `<head>` once,
|
|
8
|
+
* guards against double-loading, and respects cookie consent.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { createAnalyticsLoader } from '@salesmind-ai/design-system/web';
|
|
13
|
+
*
|
|
14
|
+
* const loadGA = createAnalyticsLoader({
|
|
15
|
+
* id: 'ga-script',
|
|
16
|
+
* src: (gaId) => `https://www.googletagmanager.com/gtag/js?id=${gaId}`,
|
|
17
|
+
* onLoad: (gaId) => {
|
|
18
|
+
* window.dataLayer = window.dataLayer || [];
|
|
19
|
+
* function gtag(...args: unknown[]) { window.dataLayer.push(args); }
|
|
20
|
+
* gtag('js', new Date());
|
|
21
|
+
* gtag('config', gaId);
|
|
22
|
+
* },
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Later, after consent:
|
|
26
|
+
* loadGA('G-XXXXXX');
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
interface AnalyticsLoaderConfig<TId extends string = string> {
|
|
30
|
+
/** Unique DOM id for the script element (prevents double-loading) */
|
|
31
|
+
id: string;
|
|
32
|
+
/** Build the script src URL from the tracking ID */
|
|
33
|
+
src: (trackingId: TId) => string;
|
|
34
|
+
/** Async attribute on the script tag (default: true) */
|
|
35
|
+
async?: boolean;
|
|
36
|
+
/** Called after the script is appended to the DOM */
|
|
37
|
+
onLoad?: (trackingId: TId) => void;
|
|
38
|
+
/** Custom inline script content instead of an external src */
|
|
39
|
+
inlineScript?: (trackingId: TId) => string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create a reusable analytics loader function.
|
|
43
|
+
* The returned function injects the script once and is safe to call multiple times.
|
|
44
|
+
*/
|
|
45
|
+
declare function createAnalyticsLoader<TId extends string = string>(config: AnalyticsLoaderConfig<TId>): (trackingId: TId) => void;
|
|
46
|
+
declare global {
|
|
47
|
+
interface Window {
|
|
48
|
+
dataLayer: unknown[];
|
|
49
|
+
clarity?: (...args: unknown[]) => void;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Load Google Analytics (gtag.js).
|
|
54
|
+
* Call with your GA measurement ID after cookie consent.
|
|
55
|
+
*/
|
|
56
|
+
declare const loadGoogleAnalytics: (trackingId: string) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Load Microsoft Clarity.
|
|
59
|
+
* Call with your Clarity project ID after cookie consent.
|
|
60
|
+
*/
|
|
61
|
+
declare const loadClarity: (trackingId: string) => void;
|
|
62
|
+
|
|
63
|
+
/** Cookie consent state */
|
|
64
|
+
type ConsentStatus = 'granted' | 'denied' | null;
|
|
65
|
+
/** Event name dispatched on window when consent changes */
|
|
66
|
+
declare const COOKIE_CONSENT_EVENT = "cookie_consent_granted";
|
|
67
|
+
/** localStorage key for cookie consent */
|
|
68
|
+
declare const COOKIE_CONSENT_KEY = "cookie_consent";
|
|
69
|
+
/** Labels for i18n support */
|
|
70
|
+
interface CookieConsentLabels {
|
|
71
|
+
title?: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
privacyLinkText?: string;
|
|
74
|
+
acceptLabel?: string;
|
|
75
|
+
declineLabel?: string;
|
|
76
|
+
}
|
|
77
|
+
interface CookieConsentProps {
|
|
78
|
+
/** Delay in ms before showing the banner (default: 1000) */
|
|
79
|
+
delay?: number;
|
|
80
|
+
/** URL to the privacy policy page (default: "/legal/privacy") */
|
|
81
|
+
privacyUrl?: string;
|
|
82
|
+
/** Called when the user accepts cookies */
|
|
83
|
+
onAccept?: () => void;
|
|
84
|
+
/** Called when the user declines cookies */
|
|
85
|
+
onDecline?: () => void;
|
|
86
|
+
/** Override default labels for i18n */
|
|
87
|
+
labels?: CookieConsentLabels;
|
|
88
|
+
/** Custom className for the container */
|
|
89
|
+
className?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* CookieConsent — GDPR-compliant cookie consent banner.
|
|
93
|
+
*
|
|
94
|
+
* - Animated entrance/exit via CSS transitions (no framer-motion)
|
|
95
|
+
* - Respects prior consent stored in localStorage
|
|
96
|
+
* - Dispatches a `cookie_consent_granted` event on the window for analytics loaders
|
|
97
|
+
* - Uses DS Button component
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```tsx
|
|
101
|
+
* import { CookieConsent } from '@salesmind-ai/design-system/web';
|
|
102
|
+
*
|
|
103
|
+
* <CookieConsent
|
|
104
|
+
* privacyUrl="/legal/privacy"
|
|
105
|
+
* onAccept={() => loadGoogleAnalytics('G-XXXX')}
|
|
106
|
+
* />
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
declare function CookieConsent({ delay, privacyUrl, onAccept, onDecline, labels, className, }: CookieConsentProps): react_jsx_runtime.JSX.Element | null;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* React hook that tracks cookie consent status.
|
|
113
|
+
*
|
|
114
|
+
* Returns `true` once the user has granted cookie consent,
|
|
115
|
+
* `false` if denied, `null` if not yet decided.
|
|
116
|
+
*
|
|
117
|
+
* Listens for the `cookie_consent_granted` window event dispatched
|
|
118
|
+
* by the CookieConsent component.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```tsx
|
|
122
|
+
* const hasConsent = useCookieConsent();
|
|
123
|
+
*
|
|
124
|
+
* useEffect(() => {
|
|
125
|
+
* if (hasConsent) loadGoogleAnalytics('G-XXXX');
|
|
126
|
+
* }, [hasConsent]);
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
declare function useCookieConsent(): ConsentStatus;
|
|
130
|
+
|
|
131
|
+
/** Arbitrary properties bag attached to every analytics event. */
|
|
132
|
+
type AnalyticsEventProps = Record<string, string | number | boolean | undefined>;
|
|
133
|
+
/** Signature for the track function provided by AnalyticsProvider. */
|
|
134
|
+
type TrackFn = (event: string, props?: AnalyticsEventProps) => void;
|
|
135
|
+
/** Value exposed by the AnalyticsContext. */
|
|
136
|
+
interface AnalyticsContextValue {
|
|
137
|
+
track: TrackFn;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Props for the AnalyticsProvider component */
|
|
141
|
+
interface AnalyticsProviderProps {
|
|
142
|
+
/** Callback invoked on every track() call. Wire this to your analytics backend. */
|
|
143
|
+
onTrack: TrackFn;
|
|
144
|
+
/** Enable console logging in development (default: false) */
|
|
145
|
+
debug?: boolean;
|
|
146
|
+
children: ReactNode;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Provides analytics event tracking to all descendant DS components.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```tsx
|
|
153
|
+
* <AnalyticsProvider
|
|
154
|
+
* onTrack={(event, props) => {
|
|
155
|
+
* window.gtag?.('event', event, props);
|
|
156
|
+
* }}
|
|
157
|
+
* >
|
|
158
|
+
* <App />
|
|
159
|
+
* </AnalyticsProvider>
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
declare function AnalyticsProvider({ onTrack, debug, children }: AnalyticsProviderProps): react_jsx_runtime.JSX.Element;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Hook that returns the analytics `track` function.
|
|
166
|
+
*
|
|
167
|
+
* Safe to call without a wrapping `<AnalyticsProvider>` — all calls
|
|
168
|
+
* become no-ops in that case (Storybook, tests, SSR).
|
|
169
|
+
*/
|
|
170
|
+
declare function useAnalytics(): AnalyticsContextValue;
|
|
171
|
+
|
|
172
|
+
export { type AnalyticsContextValue, type AnalyticsEventProps, type AnalyticsLoaderConfig, AnalyticsProvider, type AnalyticsProviderProps, COOKIE_CONSENT_EVENT, COOKIE_CONSENT_KEY, type ConsentStatus, CookieConsent, type CookieConsentLabels, type CookieConsentProps, type TrackFn, createAnalyticsLoader, loadClarity, loadGoogleAnalytics, useAnalytics, useCookieConsent };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generic analytics script loader.
|
|
6
|
+
*
|
|
7
|
+
* Framework-agnostic: injects a `<script>` tag into `<head>` once,
|
|
8
|
+
* guards against double-loading, and respects cookie consent.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { createAnalyticsLoader } from '@salesmind-ai/design-system/web';
|
|
13
|
+
*
|
|
14
|
+
* const loadGA = createAnalyticsLoader({
|
|
15
|
+
* id: 'ga-script',
|
|
16
|
+
* src: (gaId) => `https://www.googletagmanager.com/gtag/js?id=${gaId}`,
|
|
17
|
+
* onLoad: (gaId) => {
|
|
18
|
+
* window.dataLayer = window.dataLayer || [];
|
|
19
|
+
* function gtag(...args: unknown[]) { window.dataLayer.push(args); }
|
|
20
|
+
* gtag('js', new Date());
|
|
21
|
+
* gtag('config', gaId);
|
|
22
|
+
* },
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* // Later, after consent:
|
|
26
|
+
* loadGA('G-XXXXXX');
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
interface AnalyticsLoaderConfig<TId extends string = string> {
|
|
30
|
+
/** Unique DOM id for the script element (prevents double-loading) */
|
|
31
|
+
id: string;
|
|
32
|
+
/** Build the script src URL from the tracking ID */
|
|
33
|
+
src: (trackingId: TId) => string;
|
|
34
|
+
/** Async attribute on the script tag (default: true) */
|
|
35
|
+
async?: boolean;
|
|
36
|
+
/** Called after the script is appended to the DOM */
|
|
37
|
+
onLoad?: (trackingId: TId) => void;
|
|
38
|
+
/** Custom inline script content instead of an external src */
|
|
39
|
+
inlineScript?: (trackingId: TId) => string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Create a reusable analytics loader function.
|
|
43
|
+
* The returned function injects the script once and is safe to call multiple times.
|
|
44
|
+
*/
|
|
45
|
+
declare function createAnalyticsLoader<TId extends string = string>(config: AnalyticsLoaderConfig<TId>): (trackingId: TId) => void;
|
|
46
|
+
declare global {
|
|
47
|
+
interface Window {
|
|
48
|
+
dataLayer: unknown[];
|
|
49
|
+
clarity?: (...args: unknown[]) => void;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Load Google Analytics (gtag.js).
|
|
54
|
+
* Call with your GA measurement ID after cookie consent.
|
|
55
|
+
*/
|
|
56
|
+
declare const loadGoogleAnalytics: (trackingId: string) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Load Microsoft Clarity.
|
|
59
|
+
* Call with your Clarity project ID after cookie consent.
|
|
60
|
+
*/
|
|
61
|
+
declare const loadClarity: (trackingId: string) => void;
|
|
62
|
+
|
|
63
|
+
/** Cookie consent state */
|
|
64
|
+
type ConsentStatus = 'granted' | 'denied' | null;
|
|
65
|
+
/** Event name dispatched on window when consent changes */
|
|
66
|
+
declare const COOKIE_CONSENT_EVENT = "cookie_consent_granted";
|
|
67
|
+
/** localStorage key for cookie consent */
|
|
68
|
+
declare const COOKIE_CONSENT_KEY = "cookie_consent";
|
|
69
|
+
/** Labels for i18n support */
|
|
70
|
+
interface CookieConsentLabels {
|
|
71
|
+
title?: string;
|
|
72
|
+
description?: string;
|
|
73
|
+
privacyLinkText?: string;
|
|
74
|
+
acceptLabel?: string;
|
|
75
|
+
declineLabel?: string;
|
|
76
|
+
}
|
|
77
|
+
interface CookieConsentProps {
|
|
78
|
+
/** Delay in ms before showing the banner (default: 1000) */
|
|
79
|
+
delay?: number;
|
|
80
|
+
/** URL to the privacy policy page (default: "/legal/privacy") */
|
|
81
|
+
privacyUrl?: string;
|
|
82
|
+
/** Called when the user accepts cookies */
|
|
83
|
+
onAccept?: () => void;
|
|
84
|
+
/** Called when the user declines cookies */
|
|
85
|
+
onDecline?: () => void;
|
|
86
|
+
/** Override default labels for i18n */
|
|
87
|
+
labels?: CookieConsentLabels;
|
|
88
|
+
/** Custom className for the container */
|
|
89
|
+
className?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* CookieConsent — GDPR-compliant cookie consent banner.
|
|
93
|
+
*
|
|
94
|
+
* - Animated entrance/exit via CSS transitions (no framer-motion)
|
|
95
|
+
* - Respects prior consent stored in localStorage
|
|
96
|
+
* - Dispatches a `cookie_consent_granted` event on the window for analytics loaders
|
|
97
|
+
* - Uses DS Button component
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```tsx
|
|
101
|
+
* import { CookieConsent } from '@salesmind-ai/design-system/web';
|
|
102
|
+
*
|
|
103
|
+
* <CookieConsent
|
|
104
|
+
* privacyUrl="/legal/privacy"
|
|
105
|
+
* onAccept={() => loadGoogleAnalytics('G-XXXX')}
|
|
106
|
+
* />
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
declare function CookieConsent({ delay, privacyUrl, onAccept, onDecline, labels, className, }: CookieConsentProps): react_jsx_runtime.JSX.Element | null;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* React hook that tracks cookie consent status.
|
|
113
|
+
*
|
|
114
|
+
* Returns `true` once the user has granted cookie consent,
|
|
115
|
+
* `false` if denied, `null` if not yet decided.
|
|
116
|
+
*
|
|
117
|
+
* Listens for the `cookie_consent_granted` window event dispatched
|
|
118
|
+
* by the CookieConsent component.
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```tsx
|
|
122
|
+
* const hasConsent = useCookieConsent();
|
|
123
|
+
*
|
|
124
|
+
* useEffect(() => {
|
|
125
|
+
* if (hasConsent) loadGoogleAnalytics('G-XXXX');
|
|
126
|
+
* }, [hasConsent]);
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
declare function useCookieConsent(): ConsentStatus;
|
|
130
|
+
|
|
131
|
+
/** Arbitrary properties bag attached to every analytics event. */
|
|
132
|
+
type AnalyticsEventProps = Record<string, string | number | boolean | undefined>;
|
|
133
|
+
/** Signature for the track function provided by AnalyticsProvider. */
|
|
134
|
+
type TrackFn = (event: string, props?: AnalyticsEventProps) => void;
|
|
135
|
+
/** Value exposed by the AnalyticsContext. */
|
|
136
|
+
interface AnalyticsContextValue {
|
|
137
|
+
track: TrackFn;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Props for the AnalyticsProvider component */
|
|
141
|
+
interface AnalyticsProviderProps {
|
|
142
|
+
/** Callback invoked on every track() call. Wire this to your analytics backend. */
|
|
143
|
+
onTrack: TrackFn;
|
|
144
|
+
/** Enable console logging in development (default: false) */
|
|
145
|
+
debug?: boolean;
|
|
146
|
+
children: ReactNode;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Provides analytics event tracking to all descendant DS components.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```tsx
|
|
153
|
+
* <AnalyticsProvider
|
|
154
|
+
* onTrack={(event, props) => {
|
|
155
|
+
* window.gtag?.('event', event, props);
|
|
156
|
+
* }}
|
|
157
|
+
* >
|
|
158
|
+
* <App />
|
|
159
|
+
* </AnalyticsProvider>
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
declare function AnalyticsProvider({ onTrack, debug, children }: AnalyticsProviderProps): react_jsx_runtime.JSX.Element;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Hook that returns the analytics `track` function.
|
|
166
|
+
*
|
|
167
|
+
* Safe to call without a wrapping `<AnalyticsProvider>` — all calls
|
|
168
|
+
* become no-ops in that case (Storybook, tests, SSR).
|
|
169
|
+
*/
|
|
170
|
+
declare function useAnalytics(): AnalyticsContextValue;
|
|
171
|
+
|
|
172
|
+
export { type AnalyticsContextValue, type AnalyticsEventProps, type AnalyticsLoaderConfig, AnalyticsProvider, type AnalyticsProviderProps, COOKIE_CONSENT_EVENT, COOKIE_CONSENT_KEY, type ConsentStatus, CookieConsent, type CookieConsentLabels, type CookieConsentProps, type TrackFn, createAnalyticsLoader, loadClarity, loadGoogleAnalytics, useAnalytics, useCookieConsent };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export { AnalyticsProvider, COOKIE_CONSENT_EVENT, COOKIE_CONSENT_KEY, CookieConsent, createAnalyticsLoader, loadClarity, loadGoogleAnalytics, useCookieConsent } from '../../chunk-6UNG76Y2.js';
|
|
3
|
+
import '../../chunk-SICKWUWB.js';
|
|
4
|
+
export { useAnalytics } from '../../chunk-2GARWEJK.js';
|
|
5
|
+
import '../../chunk-KJ2OXQF4.js';
|
|
6
|
+
//# sourceMappingURL=out.js.map
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|