@grainql/analytics-web 2.2.0 → 2.2.1

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.
Files changed (83) hide show
  1. package/dist/index.global.dev.js +1 -1
  2. package/dist/index.global.js +1 -1
  3. package/dist/react/index.d.ts +44 -519
  4. package/dist/react/index.d.ts.map +1 -1
  5. package/dist/react/index.js +54 -1517
  6. package/dist/react/index.mjs +42 -1514
  7. package/package.json +1 -1
  8. package/dist/react/activity.d.ts +0 -59
  9. package/dist/react/activity.d.ts.map +0 -1
  10. package/dist/react/activity.js +0 -130
  11. package/dist/react/activity.mjs +0 -126
  12. package/dist/react/consent.d.ts +0 -72
  13. package/dist/react/consent.d.ts.map +0 -1
  14. package/dist/react/consent.js +0 -195
  15. package/dist/react/consent.mjs +0 -191
  16. package/dist/react/cookies.d.ts +0 -28
  17. package/dist/react/cookies.d.ts.map +0 -1
  18. package/dist/react/cookies.js +0 -94
  19. package/dist/react/cookies.mjs +0 -88
  20. package/dist/react/heartbeat.d.ts +0 -47
  21. package/dist/react/heartbeat.d.ts.map +0 -1
  22. package/dist/react/heartbeat.js +0 -119
  23. package/dist/react/heartbeat.mjs +0 -115
  24. package/dist/react/page-tracking.d.ts +0 -60
  25. package/dist/react/page-tracking.d.ts.map +0 -1
  26. package/dist/react/page-tracking.js +0 -179
  27. package/dist/react/page-tracking.mjs +0 -175
  28. package/dist/react/react/index.d.ts +0 -47
  29. package/dist/react/react/index.d.ts.map +0 -1
  30. package/dist/react/react/index.js +0 -58
  31. package/dist/react/react/index.mjs +0 -44
  32. /package/dist/react/{react/GrainProvider.d.ts → GrainProvider.d.ts} +0 -0
  33. /package/dist/react/{react/GrainProvider.d.ts.map → GrainProvider.d.ts.map} +0 -0
  34. /package/dist/react/{react/GrainProvider.js → GrainProvider.js} +0 -0
  35. /package/dist/react/{react/GrainProvider.mjs → GrainProvider.mjs} +0 -0
  36. /package/dist/react/{react/components → components}/ConsentBanner.d.ts +0 -0
  37. /package/dist/react/{react/components → components}/ConsentBanner.d.ts.map +0 -0
  38. /package/dist/react/{react/components → components}/ConsentBanner.js +0 -0
  39. /package/dist/react/{react/components → components}/ConsentBanner.mjs +0 -0
  40. /package/dist/react/{react/components → components}/CookieNotice.d.ts +0 -0
  41. /package/dist/react/{react/components → components}/CookieNotice.d.ts.map +0 -0
  42. /package/dist/react/{react/components → components}/CookieNotice.js +0 -0
  43. /package/dist/react/{react/components → components}/CookieNotice.mjs +0 -0
  44. /package/dist/react/{react/components → components}/PrivacyPreferenceCenter.d.ts +0 -0
  45. /package/dist/react/{react/components → components}/PrivacyPreferenceCenter.d.ts.map +0 -0
  46. /package/dist/react/{react/components → components}/PrivacyPreferenceCenter.js +0 -0
  47. /package/dist/react/{react/components → components}/PrivacyPreferenceCenter.mjs +0 -0
  48. /package/dist/react/{react/context.d.ts → context.d.ts} +0 -0
  49. /package/dist/react/{react/context.d.ts.map → context.d.ts.map} +0 -0
  50. /package/dist/react/{react/context.js → context.js} +0 -0
  51. /package/dist/react/{react/context.mjs → context.mjs} +0 -0
  52. /package/dist/react/{react/hooks → hooks}/useAllConfigs.d.ts +0 -0
  53. /package/dist/react/{react/hooks → hooks}/useAllConfigs.d.ts.map +0 -0
  54. /package/dist/react/{react/hooks → hooks}/useAllConfigs.js +0 -0
  55. /package/dist/react/{react/hooks → hooks}/useAllConfigs.mjs +0 -0
  56. /package/dist/react/{react/hooks → hooks}/useConfig.d.ts +0 -0
  57. /package/dist/react/{react/hooks → hooks}/useConfig.d.ts.map +0 -0
  58. /package/dist/react/{react/hooks → hooks}/useConfig.js +0 -0
  59. /package/dist/react/{react/hooks → hooks}/useConfig.mjs +0 -0
  60. /package/dist/react/{react/hooks → hooks}/useConsent.d.ts +0 -0
  61. /package/dist/react/{react/hooks → hooks}/useConsent.d.ts.map +0 -0
  62. /package/dist/react/{react/hooks → hooks}/useConsent.js +0 -0
  63. /package/dist/react/{react/hooks → hooks}/useConsent.mjs +0 -0
  64. /package/dist/react/{react/hooks → hooks}/useDataDeletion.d.ts +0 -0
  65. /package/dist/react/{react/hooks → hooks}/useDataDeletion.d.ts.map +0 -0
  66. /package/dist/react/{react/hooks → hooks}/useDataDeletion.js +0 -0
  67. /package/dist/react/{react/hooks → hooks}/useDataDeletion.mjs +0 -0
  68. /package/dist/react/{react/hooks → hooks}/useGrainAnalytics.d.ts +0 -0
  69. /package/dist/react/{react/hooks → hooks}/useGrainAnalytics.d.ts.map +0 -0
  70. /package/dist/react/{react/hooks → hooks}/useGrainAnalytics.js +0 -0
  71. /package/dist/react/{react/hooks → hooks}/useGrainAnalytics.mjs +0 -0
  72. /package/dist/react/{react/hooks → hooks}/usePrivacyPreferences.d.ts +0 -0
  73. /package/dist/react/{react/hooks → hooks}/usePrivacyPreferences.d.ts.map +0 -0
  74. /package/dist/react/{react/hooks → hooks}/usePrivacyPreferences.js +0 -0
  75. /package/dist/react/{react/hooks → hooks}/usePrivacyPreferences.mjs +0 -0
  76. /package/dist/react/{react/hooks → hooks}/useTrack.d.ts +0 -0
  77. /package/dist/react/{react/hooks → hooks}/useTrack.d.ts.map +0 -0
  78. /package/dist/react/{react/hooks → hooks}/useTrack.js +0 -0
  79. /package/dist/react/{react/hooks → hooks}/useTrack.mjs +0 -0
  80. /package/dist/react/{react/types.d.ts → types.d.ts} +0 -0
  81. /package/dist/react/{react/types.d.ts.map → types.d.ts.map} +0 -0
  82. /package/dist/react/{react/types.js → types.js} +0 -0
  83. /package/dist/react/{react/types.mjs → types.mjs} +0 -0
@@ -1,60 +0,0 @@
1
- /**
2
- * Page Tracking for Grain Analytics
3
- * Automatically tracks page views with consent-aware behavior
4
- */
5
- export interface PageTrackingConfig {
6
- stripQueryParams: boolean;
7
- debug?: boolean;
8
- }
9
- export interface PageTracker {
10
- trackSystemEvent(eventName: string, properties: Record<string, unknown>): void;
11
- hasConsent(category?: string): boolean;
12
- getEffectiveUserId(): string;
13
- getEphemeralSessionId(): string;
14
- }
15
- export declare class PageTrackingManager {
16
- private config;
17
- private tracker;
18
- private isDestroyed;
19
- private currentPath;
20
- private originalPushState;
21
- private originalReplaceState;
22
- constructor(tracker: PageTracker, config: PageTrackingConfig);
23
- /**
24
- * Setup History API listeners (pushState, replaceState, popstate)
25
- */
26
- private setupHistoryListeners;
27
- /**
28
- * Setup hash change listener
29
- */
30
- private setupHashChangeListener;
31
- /**
32
- * Handle popstate event (back/forward navigation)
33
- */
34
- private handlePopState;
35
- /**
36
- * Handle hash change event
37
- */
38
- private handleHashChange;
39
- /**
40
- * Track the current page
41
- */
42
- private trackCurrentPage;
43
- /**
44
- * Extract path from URL, optionally stripping query parameters
45
- */
46
- private extractPath;
47
- /**
48
- * Get the current page path
49
- */
50
- getCurrentPage(): string | null;
51
- /**
52
- * Manually track a page view (for custom navigation)
53
- */
54
- trackPage(page: string, properties?: Record<string, unknown>): void;
55
- /**
56
- * Destroy the page tracker
57
- */
58
- destroy(): void;
59
- }
60
- //# sourceMappingURL=page-tracking.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"page-tracking.d.ts","sourceRoot":"","sources":["../../src/page-tracking.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC/E,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACvC,kBAAkB,IAAI,MAAM,CAAC;IAC7B,qBAAqB,IAAI,MAAM,CAAC;CACjC;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,OAAO,CAAc;IAC7B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,iBAAiB,CAAyC;IAClE,OAAO,CAAC,oBAAoB,CAA4C;gBAE5D,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,kBAAkB;IAY5D;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAqB7B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAK/B;;OAEG;IACH,OAAO,CAAC,cAAc,CAGpB;IAEF;;OAEG;IACH,OAAO,CAAC,gBAAgB,CAGtB;IAEF;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAmCxB;;OAEG;IACH,OAAO,CAAC,WAAW;IAmBnB;;OAEG;IACH,cAAc,IAAI,MAAM,GAAG,IAAI;IAI/B;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAgCnE;;OAEG;IACH,OAAO,IAAI,IAAI;CAyBhB"}
@@ -1,179 +0,0 @@
1
- "use strict";
2
- /**
3
- * Page Tracking for Grain Analytics
4
- * Automatically tracks page views with consent-aware behavior
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.PageTrackingManager = void 0;
8
- class PageTrackingManager {
9
- constructor(tracker, config) {
10
- this.isDestroyed = false;
11
- this.currentPath = null;
12
- this.originalPushState = null;
13
- this.originalReplaceState = null;
14
- /**
15
- * Handle popstate event (back/forward navigation)
16
- */
17
- this.handlePopState = () => {
18
- if (this.isDestroyed)
19
- return;
20
- this.trackCurrentPage();
21
- };
22
- /**
23
- * Handle hash change event
24
- */
25
- this.handleHashChange = () => {
26
- if (this.isDestroyed)
27
- return;
28
- this.trackCurrentPage();
29
- };
30
- this.tracker = tracker;
31
- this.config = config;
32
- // Track initial page load
33
- this.trackCurrentPage();
34
- // Setup listeners
35
- this.setupHistoryListeners();
36
- this.setupHashChangeListener();
37
- }
38
- /**
39
- * Setup History API listeners (pushState, replaceState, popstate)
40
- */
41
- setupHistoryListeners() {
42
- if (typeof window === 'undefined' || typeof history === 'undefined')
43
- return;
44
- // Wrap pushState
45
- this.originalPushState = history.pushState;
46
- history.pushState = (state, title, url) => {
47
- this.originalPushState?.call(history, state, title, url);
48
- this.trackCurrentPage();
49
- };
50
- // Wrap replaceState
51
- this.originalReplaceState = history.replaceState;
52
- history.replaceState = (state, title, url) => {
53
- this.originalReplaceState?.call(history, state, title, url);
54
- this.trackCurrentPage();
55
- };
56
- // Listen to popstate (back/forward buttons)
57
- window.addEventListener('popstate', this.handlePopState);
58
- }
59
- /**
60
- * Setup hash change listener
61
- */
62
- setupHashChangeListener() {
63
- if (typeof window === 'undefined')
64
- return;
65
- window.addEventListener('hashchange', this.handleHashChange);
66
- }
67
- /**
68
- * Track the current page
69
- */
70
- trackCurrentPage() {
71
- if (this.isDestroyed || typeof window === 'undefined')
72
- return;
73
- const page = this.extractPath(window.location.href);
74
- // Don't track if it's the same page
75
- if (page === this.currentPath) {
76
- return;
77
- }
78
- this.currentPath = page;
79
- const hasConsent = this.tracker.hasConsent('analytics');
80
- // Base properties (always included)
81
- const properties = {
82
- page,
83
- timestamp: Date.now(),
84
- };
85
- // Enhanced properties when consent is granted
86
- if (hasConsent) {
87
- properties.referrer = document.referrer || '';
88
- properties.title = document.title || '';
89
- properties.full_url = window.location.href;
90
- }
91
- // Track the page view event
92
- this.tracker.trackSystemEvent('page_view', properties);
93
- if (this.config.debug) {
94
- console.log('[Page Tracking] Tracked page view:', properties);
95
- }
96
- }
97
- /**
98
- * Extract path from URL, optionally stripping query parameters
99
- */
100
- extractPath(url) {
101
- try {
102
- const urlObj = new URL(url);
103
- let path = urlObj.pathname + urlObj.hash;
104
- if (!this.config.stripQueryParams && urlObj.search) {
105
- path += urlObj.search;
106
- }
107
- return path;
108
- }
109
- catch (error) {
110
- // If URL parsing fails, return the raw string
111
- if (this.config.debug) {
112
- console.warn('[Page Tracking] Failed to parse URL:', url, error);
113
- }
114
- return url;
115
- }
116
- }
117
- /**
118
- * Get the current page path
119
- */
120
- getCurrentPage() {
121
- return this.currentPath;
122
- }
123
- /**
124
- * Manually track a page view (for custom navigation)
125
- */
126
- trackPage(page, properties) {
127
- if (this.isDestroyed)
128
- return;
129
- const hasConsent = this.tracker.hasConsent('analytics');
130
- // Base properties
131
- const baseProperties = {
132
- page,
133
- timestamp: Date.now(),
134
- ...properties,
135
- };
136
- // Enhanced properties when consent is granted
137
- if (hasConsent && typeof document !== 'undefined') {
138
- if (!baseProperties.referrer) {
139
- baseProperties.referrer = document.referrer || '';
140
- }
141
- if (!baseProperties.title) {
142
- baseProperties.title = document.title || '';
143
- }
144
- if (!baseProperties.full_url && typeof window !== 'undefined') {
145
- baseProperties.full_url = window.location.href;
146
- }
147
- }
148
- this.tracker.trackSystemEvent('page_view', baseProperties);
149
- if (this.config.debug) {
150
- console.log('[Page Tracking] Manually tracked page:', baseProperties);
151
- }
152
- }
153
- /**
154
- * Destroy the page tracker
155
- */
156
- destroy() {
157
- if (this.isDestroyed)
158
- return;
159
- // Restore original history methods
160
- if (typeof history !== 'undefined') {
161
- if (this.originalPushState) {
162
- history.pushState = this.originalPushState;
163
- }
164
- if (this.originalReplaceState) {
165
- history.replaceState = this.originalReplaceState;
166
- }
167
- }
168
- // Remove event listeners
169
- if (typeof window !== 'undefined') {
170
- window.removeEventListener('popstate', this.handlePopState);
171
- window.removeEventListener('hashchange', this.handleHashChange);
172
- }
173
- this.isDestroyed = true;
174
- if (this.config.debug) {
175
- console.log('[Page Tracking] Destroyed');
176
- }
177
- }
178
- }
179
- exports.PageTrackingManager = PageTrackingManager;
@@ -1,175 +0,0 @@
1
- /**
2
- * Page Tracking for Grain Analytics
3
- * Automatically tracks page views with consent-aware behavior
4
- */
5
- export class PageTrackingManager {
6
- constructor(tracker, config) {
7
- this.isDestroyed = false;
8
- this.currentPath = null;
9
- this.originalPushState = null;
10
- this.originalReplaceState = null;
11
- /**
12
- * Handle popstate event (back/forward navigation)
13
- */
14
- this.handlePopState = () => {
15
- if (this.isDestroyed)
16
- return;
17
- this.trackCurrentPage();
18
- };
19
- /**
20
- * Handle hash change event
21
- */
22
- this.handleHashChange = () => {
23
- if (this.isDestroyed)
24
- return;
25
- this.trackCurrentPage();
26
- };
27
- this.tracker = tracker;
28
- this.config = config;
29
- // Track initial page load
30
- this.trackCurrentPage();
31
- // Setup listeners
32
- this.setupHistoryListeners();
33
- this.setupHashChangeListener();
34
- }
35
- /**
36
- * Setup History API listeners (pushState, replaceState, popstate)
37
- */
38
- setupHistoryListeners() {
39
- if (typeof window === 'undefined' || typeof history === 'undefined')
40
- return;
41
- // Wrap pushState
42
- this.originalPushState = history.pushState;
43
- history.pushState = (state, title, url) => {
44
- this.originalPushState?.call(history, state, title, url);
45
- this.trackCurrentPage();
46
- };
47
- // Wrap replaceState
48
- this.originalReplaceState = history.replaceState;
49
- history.replaceState = (state, title, url) => {
50
- this.originalReplaceState?.call(history, state, title, url);
51
- this.trackCurrentPage();
52
- };
53
- // Listen to popstate (back/forward buttons)
54
- window.addEventListener('popstate', this.handlePopState);
55
- }
56
- /**
57
- * Setup hash change listener
58
- */
59
- setupHashChangeListener() {
60
- if (typeof window === 'undefined')
61
- return;
62
- window.addEventListener('hashchange', this.handleHashChange);
63
- }
64
- /**
65
- * Track the current page
66
- */
67
- trackCurrentPage() {
68
- if (this.isDestroyed || typeof window === 'undefined')
69
- return;
70
- const page = this.extractPath(window.location.href);
71
- // Don't track if it's the same page
72
- if (page === this.currentPath) {
73
- return;
74
- }
75
- this.currentPath = page;
76
- const hasConsent = this.tracker.hasConsent('analytics');
77
- // Base properties (always included)
78
- const properties = {
79
- page,
80
- timestamp: Date.now(),
81
- };
82
- // Enhanced properties when consent is granted
83
- if (hasConsent) {
84
- properties.referrer = document.referrer || '';
85
- properties.title = document.title || '';
86
- properties.full_url = window.location.href;
87
- }
88
- // Track the page view event
89
- this.tracker.trackSystemEvent('page_view', properties);
90
- if (this.config.debug) {
91
- console.log('[Page Tracking] Tracked page view:', properties);
92
- }
93
- }
94
- /**
95
- * Extract path from URL, optionally stripping query parameters
96
- */
97
- extractPath(url) {
98
- try {
99
- const urlObj = new URL(url);
100
- let path = urlObj.pathname + urlObj.hash;
101
- if (!this.config.stripQueryParams && urlObj.search) {
102
- path += urlObj.search;
103
- }
104
- return path;
105
- }
106
- catch (error) {
107
- // If URL parsing fails, return the raw string
108
- if (this.config.debug) {
109
- console.warn('[Page Tracking] Failed to parse URL:', url, error);
110
- }
111
- return url;
112
- }
113
- }
114
- /**
115
- * Get the current page path
116
- */
117
- getCurrentPage() {
118
- return this.currentPath;
119
- }
120
- /**
121
- * Manually track a page view (for custom navigation)
122
- */
123
- trackPage(page, properties) {
124
- if (this.isDestroyed)
125
- return;
126
- const hasConsent = this.tracker.hasConsent('analytics');
127
- // Base properties
128
- const baseProperties = {
129
- page,
130
- timestamp: Date.now(),
131
- ...properties,
132
- };
133
- // Enhanced properties when consent is granted
134
- if (hasConsent && typeof document !== 'undefined') {
135
- if (!baseProperties.referrer) {
136
- baseProperties.referrer = document.referrer || '';
137
- }
138
- if (!baseProperties.title) {
139
- baseProperties.title = document.title || '';
140
- }
141
- if (!baseProperties.full_url && typeof window !== 'undefined') {
142
- baseProperties.full_url = window.location.href;
143
- }
144
- }
145
- this.tracker.trackSystemEvent('page_view', baseProperties);
146
- if (this.config.debug) {
147
- console.log('[Page Tracking] Manually tracked page:', baseProperties);
148
- }
149
- }
150
- /**
151
- * Destroy the page tracker
152
- */
153
- destroy() {
154
- if (this.isDestroyed)
155
- return;
156
- // Restore original history methods
157
- if (typeof history !== 'undefined') {
158
- if (this.originalPushState) {
159
- history.pushState = this.originalPushState;
160
- }
161
- if (this.originalReplaceState) {
162
- history.replaceState = this.originalReplaceState;
163
- }
164
- }
165
- // Remove event listeners
166
- if (typeof window !== 'undefined') {
167
- window.removeEventListener('popstate', this.handlePopState);
168
- window.removeEventListener('hashchange', this.handleHashChange);
169
- }
170
- this.isDestroyed = true;
171
- if (this.config.debug) {
172
- console.log('[Page Tracking] Destroyed');
173
- }
174
- }
175
- }
@@ -1,47 +0,0 @@
1
- /**
2
- * Grain Analytics React Hooks
3
- *
4
- * React integration for @grainql/analytics-web
5
- *
6
- * @example
7
- * ```tsx
8
- * import { GrainProvider, useConfig, useTrack } from '@grainql/analytics-web/react';
9
- *
10
- * // Pattern 1: Provider-managed client
11
- * <GrainProvider config={{ tenantId: 'xxx' }}>
12
- * <App />
13
- * </GrainProvider>
14
- *
15
- * // Pattern 2: External client
16
- * const grain = new GrainAnalytics({ tenantId: 'xxx' });
17
- * <GrainProvider client={grain}>
18
- * <App />
19
- * </GrainProvider>
20
- *
21
- * // Use hooks in components
22
- * function MyComponent() {
23
- * const { value } = useConfig('hero_variant');
24
- * const track = useTrack();
25
- *
26
- * return <button onClick={() => track('clicked')}>Click</button>;
27
- * }
28
- * ```
29
- */
30
- export { GrainProvider } from './GrainProvider';
31
- export { useGrainAnalytics } from './hooks/useGrainAnalytics';
32
- export { useConfig } from './hooks/useConfig';
33
- export { useAllConfigs } from './hooks/useAllConfigs';
34
- export { useTrack } from './hooks/useTrack';
35
- export { useConsent } from './hooks/useConsent';
36
- export { usePrivacyPreferences } from './hooks/usePrivacyPreferences';
37
- export { useDataDeletion } from './hooks/useDataDeletion';
38
- export { ConsentBanner } from './components/ConsentBanner';
39
- export { PrivacyPreferenceCenter } from './components/PrivacyPreferenceCenter';
40
- export { CookieNotice } from './components/CookieNotice';
41
- export type { GrainProviderProps, UseConfigOptions, UseConfigResult, UseAllConfigsOptions, UseAllConfigsResult, TrackFunction, } from './types';
42
- export type { ConsentBannerProps } from './components/ConsentBanner';
43
- export type { PrivacyPreferenceCenterProps } from './components/PrivacyPreferenceCenter';
44
- export type { CookieNoticeProps } from './components/CookieNotice';
45
- export type { PrivacyPreferences } from './hooks/usePrivacyPreferences';
46
- export type { DataDeletionOptions } from './hooks/useDataDeletion';
47
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,GACd,MAAM,SAAS,CAAC;AAGjB,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,YAAY,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACzF,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACnE,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,58 +0,0 @@
1
- "use strict";
2
- /**
3
- * Grain Analytics React Hooks
4
- *
5
- * React integration for @grainql/analytics-web
6
- *
7
- * @example
8
- * ```tsx
9
- * import { GrainProvider, useConfig, useTrack } from '@grainql/analytics-web/react';
10
- *
11
- * // Pattern 1: Provider-managed client
12
- * <GrainProvider config={{ tenantId: 'xxx' }}>
13
- * <App />
14
- * </GrainProvider>
15
- *
16
- * // Pattern 2: External client
17
- * const grain = new GrainAnalytics({ tenantId: 'xxx' });
18
- * <GrainProvider client={grain}>
19
- * <App />
20
- * </GrainProvider>
21
- *
22
- * // Use hooks in components
23
- * function MyComponent() {
24
- * const { value } = useConfig('hero_variant');
25
- * const track = useTrack();
26
- *
27
- * return <button onClick={() => track('clicked')}>Click</button>;
28
- * }
29
- * ```
30
- */
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.CookieNotice = exports.PrivacyPreferenceCenter = exports.ConsentBanner = exports.useDataDeletion = exports.usePrivacyPreferences = exports.useConsent = exports.useTrack = exports.useAllConfigs = exports.useConfig = exports.useGrainAnalytics = exports.GrainProvider = void 0;
33
- // Provider
34
- var GrainProvider_1 = require("./GrainProvider");
35
- Object.defineProperty(exports, "GrainProvider", { enumerable: true, get: function () { return GrainProvider_1.GrainProvider; } });
36
- // Hooks
37
- var useGrainAnalytics_1 = require("./hooks/useGrainAnalytics");
38
- Object.defineProperty(exports, "useGrainAnalytics", { enumerable: true, get: function () { return useGrainAnalytics_1.useGrainAnalytics; } });
39
- var useConfig_1 = require("./hooks/useConfig");
40
- Object.defineProperty(exports, "useConfig", { enumerable: true, get: function () { return useConfig_1.useConfig; } });
41
- var useAllConfigs_1 = require("./hooks/useAllConfigs");
42
- Object.defineProperty(exports, "useAllConfigs", { enumerable: true, get: function () { return useAllConfigs_1.useAllConfigs; } });
43
- var useTrack_1 = require("./hooks/useTrack");
44
- Object.defineProperty(exports, "useTrack", { enumerable: true, get: function () { return useTrack_1.useTrack; } });
45
- // Privacy hooks
46
- var useConsent_1 = require("./hooks/useConsent");
47
- Object.defineProperty(exports, "useConsent", { enumerable: true, get: function () { return useConsent_1.useConsent; } });
48
- var usePrivacyPreferences_1 = require("./hooks/usePrivacyPreferences");
49
- Object.defineProperty(exports, "usePrivacyPreferences", { enumerable: true, get: function () { return usePrivacyPreferences_1.usePrivacyPreferences; } });
50
- var useDataDeletion_1 = require("./hooks/useDataDeletion");
51
- Object.defineProperty(exports, "useDataDeletion", { enumerable: true, get: function () { return useDataDeletion_1.useDataDeletion; } });
52
- // Privacy components
53
- var ConsentBanner_1 = require("./components/ConsentBanner");
54
- Object.defineProperty(exports, "ConsentBanner", { enumerable: true, get: function () { return ConsentBanner_1.ConsentBanner; } });
55
- var PrivacyPreferenceCenter_1 = require("./components/PrivacyPreferenceCenter");
56
- Object.defineProperty(exports, "PrivacyPreferenceCenter", { enumerable: true, get: function () { return PrivacyPreferenceCenter_1.PrivacyPreferenceCenter; } });
57
- var CookieNotice_1 = require("./components/CookieNotice");
58
- Object.defineProperty(exports, "CookieNotice", { enumerable: true, get: function () { return CookieNotice_1.CookieNotice; } });
@@ -1,44 +0,0 @@
1
- /**
2
- * Grain Analytics React Hooks
3
- *
4
- * React integration for @grainql/analytics-web
5
- *
6
- * @example
7
- * ```tsx
8
- * import { GrainProvider, useConfig, useTrack } from '@grainql/analytics-web/react';
9
- *
10
- * // Pattern 1: Provider-managed client
11
- * <GrainProvider config={{ tenantId: 'xxx' }}>
12
- * <App />
13
- * </GrainProvider>
14
- *
15
- * // Pattern 2: External client
16
- * const grain = new GrainAnalytics({ tenantId: 'xxx' });
17
- * <GrainProvider client={grain}>
18
- * <App />
19
- * </GrainProvider>
20
- *
21
- * // Use hooks in components
22
- * function MyComponent() {
23
- * const { value } = useConfig('hero_variant');
24
- * const track = useTrack();
25
- *
26
- * return <button onClick={() => track('clicked')}>Click</button>;
27
- * }
28
- * ```
29
- */
30
- // Provider
31
- export { GrainProvider } from './GrainProvider';
32
- // Hooks
33
- export { useGrainAnalytics } from './hooks/useGrainAnalytics';
34
- export { useConfig } from './hooks/useConfig';
35
- export { useAllConfigs } from './hooks/useAllConfigs';
36
- export { useTrack } from './hooks/useTrack';
37
- // Privacy hooks
38
- export { useConsent } from './hooks/useConsent';
39
- export { usePrivacyPreferences } from './hooks/usePrivacyPreferences';
40
- export { useDataDeletion } from './hooks/useDataDeletion';
41
- // Privacy components
42
- export { ConsentBanner } from './components/ConsentBanner';
43
- export { PrivacyPreferenceCenter } from './components/PrivacyPreferenceCenter';
44
- export { CookieNotice } from './components/CookieNotice';
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes