@drivemetadata-ai/sdk 0.1.1-beta.1 → 0.1.1-beta.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.
Files changed (42) hide show
  1. package/README.md +18 -15
  2. package/dist/angular/index.cjs +118 -115
  3. package/dist/angular/index.cjs.map +1 -1
  4. package/dist/angular/index.d.cts +2 -2
  5. package/dist/angular/index.d.ts +2 -2
  6. package/dist/angular/index.js +118 -115
  7. package/dist/angular/index.js.map +1 -1
  8. package/dist/browser/index.cjs +119 -116
  9. package/dist/browser/index.cjs.map +1 -1
  10. package/dist/browser/index.d.cts +5 -68
  11. package/dist/browser/index.d.ts +5 -68
  12. package/dist/browser/index.js +119 -116
  13. package/dist/browser/index.js.map +1 -1
  14. package/dist/next/index.cjs +119 -115
  15. package/dist/next/index.cjs.map +1 -1
  16. package/dist/next/index.d.cts +1 -1
  17. package/dist/next/index.d.ts +1 -1
  18. package/dist/next/index.js +119 -115
  19. package/dist/next/index.js.map +1 -1
  20. package/dist/node/index.cjs +80 -7
  21. package/dist/node/index.cjs.map +1 -1
  22. package/dist/node/index.d.cts +7 -1
  23. package/dist/node/index.d.ts +7 -1
  24. package/dist/node/index.js +80 -7
  25. package/dist/node/index.js.map +1 -1
  26. package/dist/react/index.cjs +119 -115
  27. package/dist/react/index.cjs.map +1 -1
  28. package/dist/react/index.d.cts +2 -2
  29. package/dist/react/index.d.ts +2 -2
  30. package/dist/react/index.js +119 -115
  31. package/dist/react/index.js.map +1 -1
  32. package/dist/{types-BwtS0ZDu.d.cts → types--V8TVIqT.d.cts} +7 -3
  33. package/dist/{types-BwtS0ZDu.d.ts → types--V8TVIqT.d.ts} +7 -3
  34. package/docs/angular-integration.md +6 -6
  35. package/docs/index.md +4 -6
  36. package/docs/integration.md +322 -0
  37. package/docs/node-server-integration.md +16 -7
  38. package/docs/npm-browser-sdk.md +4 -8
  39. package/docs/react-next-integration.md +9 -9
  40. package/docs/security-privacy.md +11 -11
  41. package/package.json +4 -5
  42. package/docs/migration-cdn-to-npm.md +0 -99
@@ -0,0 +1,322 @@
1
+ # DriveMetaData SDK Integration Guide
2
+
3
+ This guide covers the npm package integration path for browser apps, React, Next.js, Angular, and Node.js.
4
+
5
+ ## Package
6
+
7
+ ```bash
8
+ npm install @drivemetadata-ai/sdk
9
+ ```
10
+
11
+ Runtime entry points:
12
+
13
+ | Runtime | Import path | Use for |
14
+ |---|---|---|
15
+ | Browser | `@drivemetadata-ai/sdk/browser` | Plain JavaScript and browser applications |
16
+ | React | `@drivemetadata-ai/sdk/react` | React provider and hooks |
17
+ | Next.js | `@drivemetadata-ai/sdk/next` | Client-safe React helpers plus route tracking hooks |
18
+ | Angular | `@drivemetadata-ai/sdk/angular` | Angular provider and injectable service |
19
+ | Node.js | `@drivemetadata-ai/sdk/node` | Backend/server events only |
20
+
21
+ Do not import the Node entry point from browser bundles. Do not initialize the browser SDK during server rendering.
22
+
23
+ ## Required Keys
24
+
25
+ Browser and framework integrations use public browser tokens:
26
+
27
+ ```ts
28
+ const browserConfig = {
29
+ clientId: 'client_xxx',
30
+ workspaceId: 'workspace_xxx',
31
+ appId: 'app_xxx',
32
+ token: 'public_token'
33
+ };
34
+ ```
35
+
36
+ Node integrations use a server token stored only in backend environment variables:
37
+
38
+ ```bash
39
+ DMD_SERVER_TOKEN=server_write_key
40
+ ```
41
+
42
+ ## Consent First Setup
43
+
44
+ Enterprise integrations should start with analytics consent as `pending` or `denied`, then grant it after the consent manager resolves.
45
+
46
+ ```ts
47
+ consent: {
48
+ analytics: 'pending',
49
+ advertising: 'denied',
50
+ personalization: 'denied',
51
+ functional: 'granted',
52
+ saleOfData: 'denied'
53
+ }
54
+ ```
55
+
56
+ If consent is omitted, analytics defaults to `pending` and events are dropped until consent is granted.
57
+
58
+ ## Browser Integration
59
+
60
+ ```ts
61
+ import {
62
+ consent,
63
+ flush,
64
+ getDmdHealth,
65
+ identify,
66
+ initDmdSDK,
67
+ page,
68
+ track
69
+ } from '@drivemetadata-ai/sdk/browser';
70
+
71
+ const dmd = initDmdSDK({
72
+ clientId: 'client_xxx',
73
+ workspaceId: 'workspace_xxx',
74
+ appId: 'app_xxx',
75
+ token: 'public_token',
76
+ consent: {
77
+ analytics: 'pending',
78
+ advertising: 'denied',
79
+ personalization: 'denied',
80
+ functional: 'granted',
81
+ saleOfData: 'denied'
82
+ }
83
+ });
84
+
85
+ consent.update({ analytics: 'granted' });
86
+
87
+ identify('user_123', { plan: 'enterprise' });
88
+ page('Product Page');
89
+ track('Product Viewed', { productId: 'sku_123' });
90
+
91
+ await flush();
92
+ console.log(getDmdHealth());
93
+ ```
94
+
95
+ ## React Integration
96
+
97
+ Wrap the app once:
98
+
99
+ ```tsx
100
+ import { DmdProvider } from '@drivemetadata-ai/sdk/react';
101
+
102
+ export function App() {
103
+ return (
104
+ <DmdProvider
105
+ config={{
106
+ clientId: 'client_xxx',
107
+ workspaceId: 'workspace_xxx',
108
+ appId: 'app_xxx',
109
+ token: 'public_token',
110
+ consent: { analytics: 'pending', advertising: 'denied' }
111
+ }}
112
+ >
113
+ <Routes />
114
+ </DmdProvider>
115
+ );
116
+ }
117
+ ```
118
+
119
+ Track from components:
120
+
121
+ ```tsx
122
+ import { useDmdConsent, useDmdFlush, useIdentify, useTrackEvent } from '@drivemetadata-ai/sdk/react';
123
+
124
+ export function CheckoutButton() {
125
+ const track = useTrackEvent();
126
+ const identify = useIdentify();
127
+ const flush = useDmdFlush();
128
+ const consent = useDmdConsent();
129
+
130
+ async function onClick() {
131
+ consent.update({ analytics: 'granted' });
132
+ identify('user_123', { plan: 'enterprise' });
133
+ track('Checkout Started', { source: 'cart' });
134
+ await flush();
135
+ }
136
+
137
+ return <button onClick={onClick}>Checkout</button>;
138
+ }
139
+ ```
140
+
141
+ ## Next.js App Router
142
+
143
+ Create a client provider:
144
+
145
+ ```tsx
146
+ 'use client';
147
+
148
+ import { DmdProvider, useDmdAppRouterPageTracking } from '@drivemetadata-ai/sdk/next';
149
+ import { usePathname, useSearchParams } from 'next/navigation';
150
+
151
+ export function AnalyticsProvider({ children }: { children: React.ReactNode }) {
152
+ const pathname = usePathname();
153
+ const searchParams = useSearchParams();
154
+
155
+ useDmdAppRouterPageTracking(pathname, searchParams.toString());
156
+
157
+ return (
158
+ <DmdProvider
159
+ config={{
160
+ clientId: process.env.NEXT_PUBLIC_DMD_CLIENT_ID!,
161
+ workspaceId: process.env.NEXT_PUBLIC_DMD_WORKSPACE_ID!,
162
+ appId: process.env.NEXT_PUBLIC_DMD_APP_ID!,
163
+ token: process.env.NEXT_PUBLIC_DMD_TOKEN!,
164
+ consent: { analytics: 'pending', advertising: 'denied' }
165
+ }}
166
+ >
167
+ {children}
168
+ </DmdProvider>
169
+ );
170
+ }
171
+ ```
172
+
173
+ Use it from `app/layout.tsx`:
174
+
175
+ ```tsx
176
+ import { AnalyticsProvider } from './AnalyticsProvider';
177
+
178
+ export default function RootLayout({ children }: { children: React.ReactNode }) {
179
+ return (
180
+ <html lang="en">
181
+ <body>
182
+ <AnalyticsProvider>{children}</AnalyticsProvider>
183
+ </body>
184
+ </html>
185
+ );
186
+ }
187
+ ```
188
+
189
+ ## Next.js Pages Router
190
+
191
+ ```tsx
192
+ import type { AppProps } from 'next/app';
193
+ import { useRouter } from 'next/router';
194
+ import { DmdProvider, useDmdPagesRouterPageTracking } from '@drivemetadata-ai/sdk/next';
195
+
196
+ function PageTracking() {
197
+ const router = useRouter();
198
+ useDmdPagesRouterPageTracking(router);
199
+ return null;
200
+ }
201
+
202
+ export default function App({ Component, pageProps }: AppProps) {
203
+ return (
204
+ <DmdProvider config={config}>
205
+ <PageTracking />
206
+ <Component {...pageProps} />
207
+ </DmdProvider>
208
+ );
209
+ }
210
+ ```
211
+
212
+ ## Angular Integration
213
+
214
+ Register the provider:
215
+
216
+ ```ts
217
+ import { ApplicationConfig } from '@angular/core';
218
+ import { provideDmdAnalytics } from '@drivemetadata-ai/sdk/angular';
219
+
220
+ export const appConfig: ApplicationConfig = {
221
+ providers: [
222
+ provideDmdAnalytics({
223
+ clientId: 'client_xxx',
224
+ workspaceId: 'workspace_xxx',
225
+ appId: 'app_xxx',
226
+ token: 'public_token',
227
+ consent: { analytics: 'pending', advertising: 'denied' }
228
+ })
229
+ ]
230
+ };
231
+ ```
232
+
233
+ Initialize and track:
234
+
235
+ ```ts
236
+ import { Component, OnInit } from '@angular/core';
237
+ import { DmdAnalyticsService } from '@drivemetadata-ai/sdk/angular';
238
+
239
+ @Component({
240
+ selector: 'app-root',
241
+ template: '<router-outlet />'
242
+ })
243
+ export class AppComponent implements OnInit {
244
+ constructor(private readonly dmd: DmdAnalyticsService) {}
245
+
246
+ ngOnInit() {
247
+ this.dmd.init();
248
+ this.dmd.track('App Loaded');
249
+ }
250
+ }
251
+ ```
252
+
253
+ For Angular Universal, call `this.dmd.init()` only when `isPlatformBrowser(platformId)` is true.
254
+
255
+ ## Node Server Integration
256
+
257
+ ```ts
258
+ import { createDmdServerClient } from '@drivemetadata-ai/sdk/node';
259
+
260
+ const dmd = createDmdServerClient({
261
+ clientId: 'client_xxx',
262
+ workspaceId: 'workspace_xxx',
263
+ appId: 'app_xxx',
264
+ token: process.env.DMD_SERVER_TOKEN!,
265
+ timeoutMs: 5000,
266
+ retry: {
267
+ attempts: 3,
268
+ minDelayMs: 250,
269
+ maxDelayMs: 2000
270
+ }
271
+ });
272
+
273
+ await dmd.track({
274
+ userId: 'user_123',
275
+ event: 'Order Completed',
276
+ messageId: 'evt_123',
277
+ idempotencyKey: 'order_123',
278
+ properties: {
279
+ amount: 500,
280
+ currency: 'USD'
281
+ }
282
+ });
283
+ ```
284
+
285
+ Use `messageId` for a unique event ID and `idempotencyKey` for business events that may retry, such as orders, invoices, subscriptions, and webhooks.
286
+
287
+ ## Diagnostics
288
+
289
+ Use health diagnostics when events do not appear:
290
+
291
+ ```ts
292
+ import { flush, getDmdHealth } from '@drivemetadata-ai/sdk/browser';
293
+
294
+ console.log(getDmdHealth());
295
+ await flush();
296
+ ```
297
+
298
+ Common drop reasons:
299
+
300
+ | Reason | Meaning | Fix |
301
+ |---|---|---|
302
+ | `consent_denied` | Analytics consent is not granted | Grant consent after the consent manager resolves |
303
+ | `payload_too_large` | Event exceeds configured payload size | Reduce event properties |
304
+ | `queue_limit_exceeded` | Offline queue is full | Flush more often or increase queue size |
305
+ | `queue_ttl_expired` | Event stayed offline past TTL | Increase TTL only if business requirements allow it |
306
+
307
+ ## Production Checklist
308
+
309
+ - Use `@drivemetadata-ai/sdk/browser`, `/react`, `/next`, or `/angular` only for public browser tokens.
310
+ - Use `@drivemetadata-ai/sdk/node` only on the server with backend-only environment variables.
311
+ - Start analytics consent as `pending` or `denied` until your consent manager grants it.
312
+ - Call `flush()` before important navigation or checkout completion boundaries when needed.
313
+ - Check `getDmdHealth()` during integration testing.
314
+ - Verify SSR builds do not initialize browser analytics on the server.
315
+
316
+ ## More Guides
317
+
318
+ - Browser SDK: [npm-browser-sdk.md](./npm-browser-sdk.md)
319
+ - React and Next.js: [react-next-integration.md](./react-next-integration.md)
320
+ - Angular: [angular-integration.md](./angular-integration.md)
321
+ - Node server: [node-server-integration.md](./node-server-integration.md)
322
+ - Security and privacy: [security-privacy.md](./security-privacy.md)
@@ -1,22 +1,25 @@
1
1
  # Node Server Integration
2
2
 
3
- Use `@drivemetadata/sdk/node` for backend events only.
3
+ Use `@drivemetadata-ai/sdk/node` for backend events only.
4
4
 
5
5
  Do not use the browser SDK in server code. Browser analytics depends on DOM, cookies, localStorage, sessionStorage, page lifecycle, and session behavior.
6
6
 
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- npm install @drivemetadata/sdk
10
+ npm install @drivemetadata-ai/sdk
11
11
  ```
12
12
 
13
13
  ## Create Client
14
14
 
15
15
  ```ts
16
- import { createDmdServerClient } from '@drivemetadata/sdk/node';
16
+ import { createDmdServerClient } from '@drivemetadata-ai/sdk/node';
17
17
 
18
18
  const dmd = createDmdServerClient({
19
- writeKey: process.env.DMD_SERVER_WRITE_KEY!,
19
+ clientId: 'client_xxx',
20
+ workspaceId: 'workspace_xxx',
21
+ appId: 'app_xxx',
22
+ token: process.env.DMD_SERVER_TOKEN!,
20
23
  endpoint: 'https://sdk.drivemetadata.com/v2/data-collector',
21
24
  timeoutMs: 5000,
22
25
  retry: {
@@ -115,20 +118,26 @@ The Node SDK requires Node.js 18+ because it uses global `fetch`. For older runt
115
118
 
116
119
  ```ts
117
120
  const dmd = createDmdServerClient({
118
- writeKey: process.env.DMD_SERVER_WRITE_KEY!,
121
+ clientId: 'client_xxx',
122
+ workspaceId: 'workspace_xxx',
123
+ appId: 'app_xxx',
124
+ token: process.env.DMD_SERVER_TOKEN!,
119
125
  fetch: customFetch
120
126
  });
121
127
  ```
122
128
 
123
129
  ## Server Key Safety
124
130
 
125
- Use `@drivemetadata/sdk/node` only in server runtimes. Never import this entry point from browser bundles, React client components, Angular browser bundles, or Next.js client components.
131
+ Use `@drivemetadata-ai/sdk/node` only in server runtimes. Never import this entry point from browser bundles, React client components, Angular browser bundles, or Next.js client components.
126
132
 
127
133
  Store server keys in backend-only environment variables:
128
134
 
129
135
  ```ts
130
136
  const dmd = createDmdServerClient({
131
- writeKey: process.env.DMD_SERVER_WRITE_KEY!,
137
+ clientId: 'client_xxx',
138
+ workspaceId: 'workspace_xxx',
139
+ appId: 'app_xxx',
140
+ token: process.env.DMD_SERVER_TOKEN!,
132
141
  timeoutMs: 3000
133
142
  });
134
143
  ```
@@ -3,7 +3,7 @@
3
3
  Install:
4
4
 
5
5
  ```bash
6
- npm install @drivemetadata/sdk
6
+ npm install @drivemetadata-ai/sdk
7
7
  ```
8
8
 
9
9
  Import:
@@ -20,7 +20,7 @@ import {
20
20
  page,
21
21
  reset,
22
22
  track
23
- } from '@drivemetadata/sdk/browser';
23
+ } from '@drivemetadata-ai/sdk/browser';
24
24
  ```
25
25
 
26
26
  Initialize in browser runtime:
@@ -30,7 +30,7 @@ initDmdSDK({
30
30
  clientId: 'client_xxx',
31
31
  workspaceId: 'workspace_xxx',
32
32
  appId: 'app_xxx',
33
- writeKey: 'public_write_key',
33
+ token: 'public_token',
34
34
  consent: {
35
35
  analytics: 'granted',
36
36
  advertising: 'denied',
@@ -119,7 +119,7 @@ Diagnostics:
119
119
  Use `getDmdHealth()` to inspect queue size, offline state, last error, and dropped delivery records.
120
120
 
121
121
  ```ts
122
- import { flush, getDmdHealth } from '@drivemetadata/sdk/browser';
122
+ import { flush, getDmdHealth } from '@drivemetadata-ai/sdk/browser';
123
123
 
124
124
  console.log(getDmdHealth());
125
125
  await flush();
@@ -137,7 +137,3 @@ Common drop reasons:
137
137
  Delivery behavior:
138
138
 
139
139
  The browser SDK adds message IDs and idempotency keys to delivery payloads. Queue diagnostics include expired records, and queue flushing uses a cross-tab lease to avoid duplicate ownership when multiple tabs are open.
140
-
141
- Legacy note:
142
-
143
- The current CDN script `javascript/dmdSDK_v3.js` remains supported. The npm browser entry now initializes without requiring the CDN global, while legacy script customers keep the global constructor path.
@@ -3,7 +3,7 @@
3
3
  ## Install
4
4
 
5
5
  ```bash
6
- npm install @drivemetadata/sdk
6
+ npm install @drivemetadata-ai/sdk
7
7
  ```
8
8
 
9
9
  ## React
@@ -11,7 +11,7 @@ npm install @drivemetadata/sdk
11
11
  Wrap your application once:
12
12
 
13
13
  ```tsx
14
- import { DmdProvider } from '@drivemetadata/sdk/react';
14
+ import { DmdProvider } from '@drivemetadata-ai/sdk/react';
15
15
 
16
16
  export function App() {
17
17
  return (
@@ -20,7 +20,7 @@ export function App() {
20
20
  clientId: 'client_xxx',
21
21
  workspaceId: 'workspace_xxx',
22
22
  appId: 'app_xxx',
23
- writeKey: 'public_write_key',
23
+ token: 'public_token',
24
24
  consent: { analytics: 'granted', advertising: 'denied' }
25
25
  }}
26
26
  >
@@ -33,7 +33,7 @@ export function App() {
33
33
  Track events:
34
34
 
35
35
  ```tsx
36
- import { useTrackEvent } from '@drivemetadata/sdk/react';
36
+ import { useTrackEvent } from '@drivemetadata-ai/sdk/react';
37
37
 
38
38
  export function CTAButton() {
39
39
  const track = useTrackEvent();
@@ -57,7 +57,7 @@ import {
57
57
  usePage,
58
58
  useReset,
59
59
  useTrackEvent
60
- } from '@drivemetadata/sdk/react';
60
+ } from '@drivemetadata-ai/sdk/react';
61
61
 
62
62
  export function AnalyticsActions() {
63
63
  const track = useTrackEvent();
@@ -93,7 +93,7 @@ Create a client provider:
93
93
  ```tsx
94
94
  'use client';
95
95
 
96
- import { DmdProvider, useDmdAppRouterPageTracking } from '@drivemetadata/sdk/next';
96
+ import { DmdProvider, useDmdAppRouterPageTracking } from '@drivemetadata-ai/sdk/next';
97
97
  import { usePathname, useSearchParams } from 'next/navigation';
98
98
 
99
99
  export function AnalyticsProvider({ children }: { children: React.ReactNode }) {
@@ -110,7 +110,7 @@ export function AnalyticsProvider({ children }: { children: React.ReactNode }) {
110
110
  clientId: process.env.NEXT_PUBLIC_DMD_CLIENT_ID!,
111
111
  workspaceId: process.env.NEXT_PUBLIC_DMD_WORKSPACE_ID!,
112
112
  appId: process.env.NEXT_PUBLIC_DMD_APP_ID!,
113
- writeKey: process.env.NEXT_PUBLIC_DMD_WRITE_KEY!,
113
+ token: process.env.NEXT_PUBLIC_DMD_TOKEN!,
114
114
  consent: { analytics: 'granted', advertising: 'denied' }
115
115
  }}
116
116
  >
@@ -143,7 +143,7 @@ Use a provider in `_app.tsx`:
143
143
  ```tsx
144
144
  import type { AppProps } from 'next/app';
145
145
  import { useRouter } from 'next/router';
146
- import { DmdProvider, useDmdPagesRouterPageTracking } from '@drivemetadata/sdk/next';
146
+ import { DmdProvider, useDmdPagesRouterPageTracking } from '@drivemetadata-ai/sdk/next';
147
147
 
148
148
  function AnalyticsPageTracking() {
149
149
  const router = useRouter();
@@ -163,6 +163,6 @@ export default function App({ Component, pageProps }: AppProps) {
163
163
 
164
164
  ## SSR Safety
165
165
 
166
- `@drivemetadata/sdk/react` and `@drivemetadata/sdk/next` can be imported during server rendering, but SDK initialization must run in the browser. In Next.js App Router, place `DmdProvider` inside a file that starts with `'use client'`.
166
+ `@drivemetadata-ai/sdk/react` and `@drivemetadata-ai/sdk/next` can be imported during server rendering, but SDK initialization must run in the browser. In Next.js App Router, place `DmdProvider` inside a file that starts with `'use client'`.
167
167
 
168
168
  If consent is omitted, analytics defaults to `pending`; call `consent.update()` or pass an explicit consent object after your consent manager resolves.
@@ -2,24 +2,24 @@
2
2
 
3
3
  ## Public and Server Keys
4
4
 
5
- Use public write keys only in browser, React, Next.js, and Angular integrations.
5
+ Use public browser tokens only in browser, React, Next.js, and Angular integrations.
6
6
 
7
- Use server write keys only with `@drivemetadata/sdk/node` in backend environments.
7
+ Use server tokens only with `@drivemetadata-ai/sdk/node` in backend environments.
8
8
 
9
- Never expose server write keys through `NEXT_PUBLIC_`, frontend build variables, script tags, or mobile clients.
9
+ Never expose server tokens through `NEXT_PUBLIC_`, frontend build variables, script tags, or mobile clients.
10
10
 
11
11
  ## Consent
12
12
 
13
13
  Use consent controls before tracking users in regulated environments:
14
14
 
15
15
  ```ts
16
- import { consent, initDmdSDK } from '@drivemetadata/sdk/browser';
16
+ import { consent, initDmdSDK } from '@drivemetadata-ai/sdk/browser';
17
17
 
18
18
  initDmdSDK({
19
19
  clientId: 'client_xxx',
20
20
  workspaceId: 'workspace_xxx',
21
21
  appId: 'app_xxx',
22
- writeKey: 'public_write_key',
22
+ token: 'public_token',
23
23
  consent: {
24
24
  analytics: 'pending',
25
25
  advertising: 'denied',
@@ -60,7 +60,7 @@ initDmdSDK({
60
60
  clientId: 'client_xxx',
61
61
  workspaceId: 'workspace_xxx',
62
62
  appId: 'app_xxx',
63
- writeKey: 'public_write_key',
63
+ token: 'public_token',
64
64
  maskAllText: true,
65
65
  maskAllElementAttributes: true,
66
66
  propertyDenylist: ['password', 'token', 'secret']
@@ -88,7 +88,7 @@ initDmdSDK({
88
88
  clientId: 'client_xxx',
89
89
  workspaceId: 'workspace_xxx',
90
90
  appId: 'app_xxx',
91
- writeKey: 'public_write_key',
91
+ token: 'public_token',
92
92
  apiHost: 'https://eu-sdk.drivemetadata.com/v2'
93
93
  });
94
94
  ```
@@ -98,7 +98,7 @@ initDmdSDK({
98
98
  Use `getDmdHealth()` to inspect SDK state and dropped-event diagnostics during integration:
99
99
 
100
100
  ```ts
101
- import { getDmdHealth } from '@drivemetadata/sdk/browser';
101
+ import { getDmdHealth } from '@drivemetadata-ai/sdk/browser';
102
102
 
103
103
  console.log(getDmdHealth());
104
104
  ```
@@ -109,8 +109,8 @@ Browser delivery uses message IDs, idempotency keys, queue TTL diagnostics, and
109
109
 
110
110
  - Default analytics consent is `pending`.
111
111
  - Advertising storage must remain denied until advertising consent is granted.
112
- - Browser examples must use public write keys only.
113
- - Server write keys must be used only from server runtimes.
112
+ - Browser examples must use public browser tokens only.
113
+ - Server tokens must be used only from server runtimes.
114
114
  - PII masking is recursive for common direct identifiers.
115
115
  - Customers should configure retention, region, DPA, and subprocessor review before production.
116
116
 
@@ -123,6 +123,6 @@ Customers should complete these reviews before production:
123
123
  | Legal basis | Consent states and purpose-level controls | Connect SDK consent to CMP |
124
124
  | Data retention | Event delivery includes timestamps and customer IDs | Confirm retention policy in backend/product |
125
125
  | Data residency | `apiHost` supports regional collectors | Use approved regional endpoint |
126
- | Server keys | Node entry keeps keys server-side | Store keys only in backend secrets |
126
+ | Server tokens | Node entry keeps tokens server-side | Store tokens only in backend secrets |
127
127
  | Subprocessors | Not enforced in SDK code | Review company subprocessor list |
128
128
  | PII minimization | Recursive common PII redaction | Configure denylist and avoid sensitive properties |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drivemetadata-ai/sdk",
3
- "version": "0.1.1-beta.1",
3
+ "version": "0.1.1-beta.2",
4
4
  "description": "Enterprise-grade DriveMetaData browser SDK.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -10,12 +10,12 @@
10
10
  "files": [
11
11
  "dist",
12
12
  "docs/index.md",
13
+ "docs/integration.md",
13
14
  "docs/npm-browser-sdk.md",
14
15
  "docs/react-next-integration.md",
15
16
  "docs/angular-integration.md",
16
17
  "docs/node-server-integration.md",
17
18
  "docs/security-privacy.md",
18
- "docs/migration-cdn-to-npm.md",
19
19
  "README.md",
20
20
  "CHANGELOG.md",
21
21
  "LICENSE"
@@ -56,12 +56,11 @@
56
56
  "build": "tsup",
57
57
  "typecheck": "tsc --noEmit",
58
58
  "test": "vitest run",
59
- "test:legacy": "node tests/dmdSDK_v3.browser.test.js && node tests/dmdSDK_v3.consent.test.js && node tests/dmdSDK_v3.integration.test.js && node tests/dmdSDK_v3.payload.test.js && node tests/dmdSDK_v3.privacy.test.js && node tests/dmdSDK_v3.schema.unit.test.js && node tests/dmdSDK_v3.singleton.test.js && node tests/dmdSDK_v3.storage.test.js",
60
59
  "test:package": "npm run build && vitest run tests/package/package-contents.test.ts tests/package/package-install-smoke.test.ts",
61
60
  "pack:check": "npm run build && npm pack --dry-run",
62
61
  "release:check": "npm run ci && npm_config_cache=/tmp/npm-cache npm run pack:check",
63
- "ci": "npm run typecheck && npm run test && npm run test:legacy && npm run build && npm run test:package",
64
- "ci:phase1": "npm run typecheck && npm run test && npm run test:legacy && npm run build"
62
+ "ci": "npm run typecheck && npm run test && npm run build && npm run test:package",
63
+ "ci:phase1": "npm run typecheck && npm run test && npm run build"
65
64
  },
66
65
  "peerDependencies": {
67
66
  "@angular/core": ">=16 <21",