@dbrij/glass-native 0.0.0-stage → 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dbrij
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,73 @@
1
- # Temporary Holding Version
1
+ # @dbrij/glass-native
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Dbrij Glass analytics for native apps. Sessions, screen views, taps and custom events
4
+ from a React Native app (or any fetch-capable JS runtime) land in the same Glass
5
+ dashboard as your web traffic, with device shown as iOS or Android.
6
+
7
+ **What it does NOT do:** session replay. Recording native screens safely (with input
8
+ masking) is a separate project; native sessions appear in Replays as sessions without
9
+ a recording. No cookies, no fingerprinting, no data collected beyond what you call.
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ npm install @dbrij/glass-native
15
+ ```
16
+
17
+ Get a site key (`gk_...`) from Glass → Sites in your Dbrij dashboard.
18
+
19
+ ## React Native wiring
20
+
21
+ ```tsx
22
+ import AsyncStorage from '@react-native-async-storage/async-storage';
23
+ import { AppState, Dimensions, Platform } from 'react-native';
24
+ import { createGlass } from '@dbrij/glass-native';
25
+
26
+ export const glass = createGlass({
27
+ siteKey: 'gk_your_site_key',
28
+ platform: {
29
+ os: Platform.OS === 'ios' ? 'ios' : 'android',
30
+ device: 'mobile',
31
+ appVersion: '1.4.2',
32
+ },
33
+ storage: AsyncStorage, // getItem/setItem/removeItem match directly
34
+ screen: Dimensions.get('screen'),
35
+ });
36
+
37
+ // Sessions survive backgrounding correctly when you wire AppState:
38
+ AppState.addEventListener('change', (state) => {
39
+ if (state === 'active') glass.onForeground();
40
+ else if (state === 'background') glass.onBackground();
41
+ });
42
+ ```
43
+
44
+ Screen views from React Navigation:
45
+
46
+ ```tsx
47
+ <NavigationContainer
48
+ onStateChange={() => {
49
+ const route = navigationRef.getCurrentRoute();
50
+ if (route) glass.screen(route.name);
51
+ }}
52
+ >
53
+ ```
54
+
55
+ Business moments and identity:
56
+
57
+ ```ts
58
+ glass.track('signup', { plan: 'pro' });
59
+ glass.identify('user_1234', { plan: 'pro' }); // after login
60
+ glass.tap(48, 88, 'buy-button'); // percentages of the screen, for heatmaps
61
+ glass.setDisabled(true); // user opted out: stops and clears everything
62
+ ```
63
+
64
+ ## Behavior worth knowing
65
+
66
+ - Events batch (20 per envelope, 5s timer) and flush hard on `onBackground()`.
67
+ - Offline: the queue persists to your storage (bounded at 500 events) and drains on
68
+ the next launch. Events older than 5 minutes get the server's arrival time instead
69
+ of their true time; ordering within a session is preserved.
70
+ - A session ends after 30 minutes of inactivity (server-configurable) or 4 hours flat.
71
+ - The monthly event quota kill switch is honored: over quota, the SDK stops sending
72
+ until the next check finds the site open again.
73
+ - Every entry point is wrapped; the SDK never throws into your app.
@@ -0,0 +1,5 @@
1
+ import type { GlassClient, GlassOptions } from './types';
2
+ /** A screen name becomes a stable page path: 'Checkout / Payment' → /checkout-payment */
3
+ export declare function screenPath(name: string): string;
4
+ export declare function createGlass(options: GlassOptions): GlassClient;
5
+ //# sourceMappingURL=glass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glass.d.ts","sourceRoot":"","sources":["../src/glass.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAgB,MAAM,SAAS,CAAC;AA8DvE,yFAAyF;AACzF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ/C;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,WAAW,CAuQ9D"}
package/dist/glass.js ADDED
@@ -0,0 +1,323 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.screenPath = screenPath;
4
+ exports.createGlass = createGlass;
5
+ const storage_1 = require("./storage");
6
+ /**
7
+ * The Glass native client: the web tracker's state machine
8
+ * (apps/web/src/tracker/index.ts in the Dbrij monorepo) minus everything
9
+ * browser-shaped. Same rules of the road:
10
+ *
11
+ * 1. Never break the host app: every entry point is wrapped, every failure is
12
+ * silent, every network call is fire-and-forget with one retry at most.
13
+ * 2. Privacy is not a setting: identity is a random first-party id, identify()
14
+ * is dropped entirely while disabled, and nothing is collected the host app
15
+ * did not explicitly call.
16
+ * 3. Speak the collector's wire contract exactly: text/plain envelopes, ids
17
+ * matching /^[A-Za-z0-9_-]{10,64}$/ (visitor) and {10,40} (session), at most
18
+ * 50 events per envelope. Contract source of truth:
19
+ * apps/api/src/modules/glass/ingest-parse.ts.
20
+ *
21
+ * No replay: recording native screens is a different, deliberate project.
22
+ */
23
+ const VERSION = '0.1.0';
24
+ const DEFAULT_ENDPOINT = 'https://api.dbrij.com/api/v1';
25
+ /** Matches GLASS_SESSION_TIMEOUT_MS in @dbrij/shared; the config endpoint overrides it. */
26
+ const DEFAULT_SESSION_TIMEOUT_MS = 30 * 60 * 1000;
27
+ const MAX_SESSION_MS = 4 * 60 * 60 * 1000;
28
+ const FLUSH_AT = 20;
29
+ const FLUSH_MS = 5000;
30
+ /** Server cap is 50/envelope; stay under it. */
31
+ const ENVELOPE_SLICE = 20;
32
+ const CONFIG_TTL_MS = 5 * 60 * 1000;
33
+ /** Offline queue ceiling: beyond this the oldest events are dropped, because an
34
+ * unbounded queue on a device that never reconnects is a storage leak. */
35
+ const MAX_PERSISTED_EVENTS = 500;
36
+ function rand() {
37
+ try {
38
+ const cryptoObj = globalThis.crypto;
39
+ if (cryptoObj?.getRandomValues) {
40
+ const bytes = new Uint8Array(12);
41
+ cryptoObj.getRandomValues(bytes);
42
+ return Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
43
+ }
44
+ }
45
+ catch {
46
+ /* fall through */
47
+ }
48
+ return `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 12)}${Math.random().toString(36).slice(2, 6)}`;
49
+ }
50
+ /** A screen name becomes a stable page path: 'Checkout / Payment' → /checkout-payment */
51
+ function screenPath(name) {
52
+ const slug = String(name || '')
53
+ .trim()
54
+ .toLowerCase()
55
+ .replace(/[^a-z0-9]+/g, '-')
56
+ .replace(/^-+|-+$/g, '')
57
+ .slice(0, 120);
58
+ return `/${slug || 'screen'}`;
59
+ }
60
+ function createGlass(options) {
61
+ const storage = options.storage ?? (0, storage_1.createMemoryStorage)();
62
+ const endpoint = (options.endpoint ?? DEFAULT_ENDPOINT).replace(/\/+$/, '');
63
+ const siteKey = options.siteKey ?? '';
64
+ const keyPrefix = `glass:${siteKey.slice(0, 12)}`;
65
+ const valid = typeof siteKey === 'string' && siteKey.startsWith('gk_');
66
+ let disabled = !!options.disabled || !valid;
67
+ let killed = false;
68
+ let sessionTimeoutMs = DEFAULT_SESSION_TIMEOUT_MS;
69
+ let visitorId = '';
70
+ let session = null;
71
+ let queue = [];
72
+ let currentPath = '/';
73
+ let flushTimer;
74
+ let lastConfigAt = 0;
75
+ // ── persistence ──────────────────────────────────────────────────────────────
76
+ async function load() {
77
+ try {
78
+ const vid = await storage.getItem('glass:vid');
79
+ visitorId = vid && /^[A-Za-z0-9_-]{10,64}$/.test(vid) ? vid : `gv_${rand()}`;
80
+ await storage.setItem('glass:vid', visitorId);
81
+ const rawSession = await storage.getItem(`${keyPrefix}:s`);
82
+ if (rawSession) {
83
+ const parsed = JSON.parse(rawSession);
84
+ if (parsed?.id && typeof parsed.last === 'number')
85
+ session = parsed;
86
+ }
87
+ // drain anything a previous run persisted on background/offline
88
+ const rawQueue = await storage.getItem(`${keyPrefix}:q`);
89
+ if (rawQueue) {
90
+ const parsed = JSON.parse(rawQueue);
91
+ if (Array.isArray(parsed) && parsed.length)
92
+ queue.push(...parsed.slice(-MAX_PERSISTED_EVENTS));
93
+ await storage.removeItem(`${keyPrefix}:q`);
94
+ }
95
+ }
96
+ catch {
97
+ if (!visitorId)
98
+ visitorId = `gv_${rand()}`;
99
+ }
100
+ }
101
+ function saveSession() {
102
+ if (!session)
103
+ return;
104
+ void Promise.resolve(storage.setItem(`${keyPrefix}:s`, JSON.stringify(session))).catch(() => undefined);
105
+ }
106
+ async function persistQueue() {
107
+ try {
108
+ if (queue.length)
109
+ await storage.setItem(`${keyPrefix}:q`, JSON.stringify(queue.slice(-MAX_PERSISTED_EVENTS)));
110
+ else
111
+ await storage.removeItem(`${keyPrefix}:q`);
112
+ }
113
+ catch {
114
+ /* storage full or gone; the queue stays in memory */
115
+ }
116
+ }
117
+ // ── session ──────────────────────────────────────────────────────────────────
118
+ function ensureSession() {
119
+ const now = Date.now();
120
+ if (!session || now - session.last > sessionTimeoutMs || now - session.started > MAX_SESSION_MS) {
121
+ session = { id: `gs_${rand()}`.slice(0, 40), started: now, last: now };
122
+ }
123
+ else {
124
+ session.last = now;
125
+ }
126
+ saveSession();
127
+ return session;
128
+ }
129
+ // ── transport ────────────────────────────────────────────────────────────────
130
+ function envelope(events) {
131
+ const s = ensureSession();
132
+ return JSON.stringify({
133
+ k: siteKey,
134
+ v: visitorId,
135
+ s: s.id,
136
+ url: currentPath,
137
+ sw: options.screen?.width,
138
+ sh: options.screen?.height,
139
+ pf: options.platform.os,
140
+ dv: options.platform.device ?? 'mobile',
141
+ av: options.platform.appVersion?.slice(0, 20),
142
+ gv: VERSION,
143
+ events,
144
+ });
145
+ }
146
+ async function send(body) {
147
+ try {
148
+ const res = await fetch(`${endpoint}/public/glass/ingest`, {
149
+ method: 'POST',
150
+ body,
151
+ headers: { 'Content-Type': 'text/plain' },
152
+ });
153
+ return res.ok;
154
+ }
155
+ catch {
156
+ return false;
157
+ }
158
+ }
159
+ async function flush() {
160
+ if (disabled || killed || !queue.length)
161
+ return;
162
+ await ready;
163
+ while (queue.length) {
164
+ const slice = queue.slice(0, ENVELOPE_SLICE);
165
+ const ok = await send(envelope(slice));
166
+ if (!ok) {
167
+ // offline or refused: keep the queue (bounded) for the next attempt
168
+ queue = queue.slice(-MAX_PERSISTED_EVENTS);
169
+ await persistQueue();
170
+ return;
171
+ }
172
+ queue = queue.slice(slice.length);
173
+ }
174
+ await persistQueue();
175
+ }
176
+ function enqueue(event) {
177
+ if (disabled || killed)
178
+ return;
179
+ queue.push(event);
180
+ ensureSession();
181
+ if (queue.length >= FLUSH_AT) {
182
+ void flush();
183
+ return;
184
+ }
185
+ if (flushTimer === undefined) {
186
+ flushTimer = setTimeout(() => {
187
+ flushTimer = undefined;
188
+ void flush();
189
+ }, FLUSH_MS);
190
+ }
191
+ }
192
+ // ── config (kill switch + session timeout) ───────────────────────────────────
193
+ async function refreshConfig() {
194
+ if (disabled || Date.now() - lastConfigAt < CONFIG_TTL_MS)
195
+ return;
196
+ lastConfigAt = Date.now();
197
+ try {
198
+ const res = await fetch(`${endpoint}/public/glass/config?k=${encodeURIComponent(siteKey)}`);
199
+ if (!res.ok)
200
+ return;
201
+ const parsed = (await res.json());
202
+ const cfg = parsed.data ?? parsed;
203
+ if (typeof cfg?.ok !== 'boolean')
204
+ return;
205
+ killed = !cfg.ok;
206
+ if (typeof cfg.sessionTimeoutMs === 'number' && cfg.sessionTimeoutMs > 60_000)
207
+ sessionTimeoutMs = cfg.sessionTimeoutMs;
208
+ }
209
+ catch {
210
+ /* offline: keep going with what we have */
211
+ }
212
+ }
213
+ const ready = load().then(() => refreshConfig());
214
+ // ── public API ───────────────────────────────────────────────────────────────
215
+ return {
216
+ version: VERSION,
217
+ visitorId: () => visitorId,
218
+ screen(name) {
219
+ try {
220
+ const path = screenPath(name);
221
+ if (path === currentPath && queue.some((e) => e.t === 'pageview' && e.p === path))
222
+ return;
223
+ currentPath = path;
224
+ enqueue({ t: 'pageview', p: path, ts: Date.now() });
225
+ }
226
+ catch {
227
+ /* never the app's problem */
228
+ }
229
+ },
230
+ track(name, props) {
231
+ try {
232
+ if (typeof name !== 'string' || !name)
233
+ return;
234
+ enqueue({
235
+ t: 'custom',
236
+ n: name.slice(0, 120),
237
+ p: currentPath,
238
+ props: props && typeof props === 'object' ? props : undefined,
239
+ ts: Date.now(),
240
+ });
241
+ }
242
+ catch {
243
+ /* never the app's problem */
244
+ }
245
+ },
246
+ identify(distinctId, traits) {
247
+ try {
248
+ if (disabled || typeof distinctId !== 'string' || !distinctId)
249
+ return;
250
+ enqueue({
251
+ t: 'identify',
252
+ n: distinctId.slice(0, 200),
253
+ p: currentPath,
254
+ props: traits && typeof traits === 'object' ? traits : undefined,
255
+ ts: Date.now(),
256
+ });
257
+ }
258
+ catch {
259
+ /* never the app's problem */
260
+ }
261
+ },
262
+ tap(xPct, yPct, label) {
263
+ try {
264
+ if (!isFinite(xPct) || !isFinite(yPct))
265
+ return;
266
+ // The collector buckets x/vw: send percentages with a 100-unit viewport so
267
+ // native taps land on the same heatmap grid as web clicks.
268
+ enqueue({
269
+ t: 'click',
270
+ p: currentPath,
271
+ props: {
272
+ selector: (label ?? 'tap').slice(0, 250),
273
+ x: Math.round(Math.min(100, Math.max(0, xPct))),
274
+ y: Math.round(Math.min(100, Math.max(0, yPct))),
275
+ vw: 100,
276
+ vh: 100,
277
+ },
278
+ ts: Date.now(),
279
+ });
280
+ }
281
+ catch {
282
+ /* never the app's problem */
283
+ }
284
+ },
285
+ onForeground() {
286
+ try {
287
+ ensureSession();
288
+ void refreshConfig();
289
+ }
290
+ catch {
291
+ /* never the app's problem */
292
+ }
293
+ },
294
+ onBackground() {
295
+ try {
296
+ if (flushTimer !== undefined) {
297
+ clearTimeout(flushTimer);
298
+ flushTimer = undefined;
299
+ }
300
+ // fire the flush AND persist what we have: if the OS freezes the app before
301
+ // the request lands, the next launch drains the same events.
302
+ void persistQueue();
303
+ void flush();
304
+ }
305
+ catch {
306
+ /* never the app's problem */
307
+ }
308
+ },
309
+ flush,
310
+ setDisabled(next) {
311
+ disabled = !!next || !valid;
312
+ if (disabled) {
313
+ queue = [];
314
+ if (flushTimer !== undefined) {
315
+ clearTimeout(flushTimer);
316
+ flushTimer = undefined;
317
+ }
318
+ void Promise.resolve(storage.removeItem(`${keyPrefix}:q`)).catch(() => undefined);
319
+ }
320
+ },
321
+ };
322
+ }
323
+ //# sourceMappingURL=glass.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glass.js","sourceRoot":"","sources":["../src/glass.ts"],"names":[],"mappings":";;AAgEA,gCAQC;AAED,kCAuQC;AAjVD,uCAAgD;AAGhD;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,OAAO,GAAG,OAAO,CAAC;AACxB,MAAM,gBAAgB,GAAG,8BAA8B,CAAC;AACxD,2FAA2F;AAC3F,MAAM,0BAA0B,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAClD,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC1C,MAAM,QAAQ,GAAG,EAAE,CAAC;AACpB,MAAM,QAAQ,GAAG,IAAI,CAAC;AACtB,gDAAgD;AAChD,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM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AC;YACvB,CAAC;YAAC,MAAM,CAAC;gBACP,6BAA6B;YAC/B,CAAC;QACH,CAAC;QAED,YAAY;YACV,IAAI,CAAC;gBACH,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;oBAC7B,YAAY,CAAC,UAAU,CAAC,CAAC;oBACzB,UAAU,GAAG,SAAS,CAAC;gBACzB,CAAC;gBACD,4EAA4E;gBAC5E,6DAA6D;gBAC7D,KAAK,YAAY,EAAE,CAAC;gBACpB,KAAK,KAAK,EAAE,CAAC;YACf,CAAC;YAAC,MAAM,CAAC;gBACP,6BAA6B;YAC/B,CAAC;QACH,CAAC;QAED,KAAK;QAEL,WAAW,CAAC,IAAa;YACvB,QAAQ,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC;YAC5B,IAAI,QAAQ,EAAE,CAAC;gBACb,KAAK,GAAG,EAAE,CAAC;gBACX,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;oBAC7B,YAAY,CAAC,UAAU,CAAC,CAAC;oBACzB,UAAU,GAAG,SAAS,CAAC;gBACzB,CAAC;gBACD,KAAK,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,SAAS,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACpF,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { createGlass, screenPath } from './glass';
2
+ export { createMemoryStorage } from './storage';
3
+ export type { GlassClient, GlassOptions, GlassPlatform, GlassStorage } from './types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createMemoryStorage = exports.screenPath = exports.createGlass = void 0;
4
+ var glass_1 = require("./glass");
5
+ Object.defineProperty(exports, "createGlass", { enumerable: true, get: function () { return glass_1.createGlass; } });
6
+ Object.defineProperty(exports, "screenPath", { enumerable: true, get: function () { return glass_1.screenPath; } });
7
+ var storage_1 = require("./storage");
8
+ Object.defineProperty(exports, "createMemoryStorage", { enumerable: true, get: function () { return storage_1.createMemoryStorage; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iCAAkD;AAAzC,oGAAA,WAAW,OAAA;AAAE,mGAAA,UAAU,OAAA;AAChC,qCAAgD;AAAvC,8GAAA,mBAAmB,OAAA"}
@@ -0,0 +1,5 @@
1
+ import type { GlassStorage } from './types';
2
+ /** Default storage: process-lifetime only. Fine for tests; on a device inject
3
+ * AsyncStorage so visitors and sessions survive relaunches. */
4
+ export declare function createMemoryStorage(): GlassStorage;
5
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;gEACgE;AAChE,wBAAgB,mBAAmB,IAAI,YAAY,CAWlD"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createMemoryStorage = createMemoryStorage;
4
+ /** Default storage: process-lifetime only. Fine for tests; on a device inject
5
+ * AsyncStorage so visitors and sessions survive relaunches. */
6
+ function createMemoryStorage() {
7
+ const map = new Map();
8
+ return {
9
+ getItem: (key) => map.get(key) ?? null,
10
+ setItem: (key, value) => {
11
+ map.set(key, value);
12
+ },
13
+ removeItem: (key) => {
14
+ map.delete(key);
15
+ },
16
+ };
17
+ }
18
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":";;AAIA,kDAWC;AAbD;gEACgE;AAChE,SAAgB,mBAAmB;IACjC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;IACtC,OAAO;QACL,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI;QACtC,OAAO,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YACtB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACtB,CAAC;QACD,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE;YAClB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Public types for @dbrij/glass-native.
3
+ *
4
+ * This package deliberately depends on NOTHING — not react, not react-native, not
5
+ * even @dbrij/shared (which is private and would break a standalone npm install).
6
+ * The wire contract it speaks is defined by the Glass collector
7
+ * (apps/api/src/modules/glass/ingest-parse.ts in the Dbrij monorepo); the few
8
+ * constants duplicated here name that file as their source of truth.
9
+ */
10
+ /**
11
+ * Where visitor id, session state and the offline queue persist. Methods may be
12
+ * sync (a Map) or async (AsyncStorage, MMKV, Keychain) — the SDK always awaits.
13
+ * Mirrors the TokenStore shape used across Dbrij packages.
14
+ */
15
+ export interface GlassStorage {
16
+ getItem(key: string): string | null | Promise<string | null>;
17
+ setItem(key: string, value: string): void | Promise<void>;
18
+ removeItem(key: string): void | Promise<void>;
19
+ }
20
+ export interface GlassPlatform {
21
+ os: 'ios' | 'android';
22
+ /** Defaults to 'mobile'; pass 'tablet' when the host app knows better. */
23
+ device?: 'mobile' | 'tablet';
24
+ /** Shown in the dashboard as "App <version>". */
25
+ appVersion?: string;
26
+ }
27
+ export interface GlassOptions {
28
+ /** The site's public tracking key (gk_...), from Glass → Sites. */
29
+ siteKey: string;
30
+ /** API base, default https://api.dbrij.com/api/v1 */
31
+ endpoint?: string;
32
+ /** Persistence. Strongly recommended on device (AsyncStorage adapter); memory default. */
33
+ storage?: GlassStorage;
34
+ platform: GlassPlatform;
35
+ /**
36
+ * Start disabled (user opted out of analytics, ATT denied, etc.). Nothing is
37
+ * stored or sent while disabled; identify() calls are dropped, not queued.
38
+ */
39
+ disabled?: boolean;
40
+ /** Screen dimensions for context, e.g. from Dimensions.get('screen'). */
41
+ screen?: {
42
+ width: number;
43
+ height: number;
44
+ };
45
+ }
46
+ export interface GlassClient {
47
+ /** A screen became visible. The name becomes a page path (/checkout-payment). */
48
+ screen(name: string): void;
49
+ /** A business moment your code names; props become dashboard breakdowns. */
50
+ track(name: string, props?: Record<string, unknown>): void;
51
+ /** Tie this device's sessions to your own user id. Dropped while disabled. */
52
+ identify(distinctId: string, traits?: Record<string, unknown>): void;
53
+ /**
54
+ * A tap, as percentages of the CURRENT SCREEN (0-100), for heatmaps.
55
+ * Label is a short element name, like a data-glass-id on the web.
56
+ */
57
+ tap(xPct: number, yPct: number, label?: string): void;
58
+ /** Call from AppState 'active': touches the session and refreshes config. */
59
+ onForeground(): void;
60
+ /** Call from AppState 'background': hard-flushes and persists the queue. */
61
+ onBackground(): void;
62
+ /** Send everything queued now. */
63
+ flush(): Promise<void>;
64
+ /** Runtime privacy switch. Disabling flushes nothing and stops all sending. */
65
+ setDisabled(disabled: boolean): void;
66
+ /** The persistent visitor id ('' until storage loads). */
67
+ visitorId(): string;
68
+ version: string;
69
+ }
70
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings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AAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACrE;;;OAGG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtD,6EAA6E;IAC7E,YAAY,IAAI,IAAI,CAAC;IACrB,4EAA4E;IAC5E,YAAY,IAAI,IAAI,CAAC;IACrB,kCAAkC;IAClC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,+EAA+E;IAC/E,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;IACrC,0DAA0D;IAC1D,SAAS,IAAI,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB"}
package/dist/types.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ /**
3
+ * Public types for @dbrij/glass-native.
4
+ *
5
+ * This package deliberately depends on NOTHING — not react, not react-native, not
6
+ * even @dbrij/shared (which is private and would break a standalone npm install).
7
+ * The wire contract it speaks is defined by the Glass collector
8
+ * (apps/api/src/modules/glass/ingest-parse.ts in the Dbrij monorepo); the few
9
+ * constants duplicated here name that file as their source of truth.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG"}
package/package.json CHANGED
@@ -1,6 +1,47 @@
1
1
  {
2
2
  "name": "@dbrij/glass-native",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0",
4
+ "description": "Dbrij Glass analytics for native apps: sessions, screens, taps and events from React Native (or any fetch-capable JS runtime) into your Glass dashboard.",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "dbrij",
8
+ "glass",
9
+ "analytics",
10
+ "react-native",
11
+ "session-tracking"
12
+ ],
13
+ "main": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md",
24
+ "LICENSE"
25
+ ],
26
+ "devDependencies": {
27
+ "@eslint/js": "^9.18.0",
28
+ "eslint": "^9.18.0",
29
+ "typescript": "^5.7.3",
30
+ "typescript-eslint": "^8.20.0"
31
+ },
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "git+https://github.com/SAW-TECHNOLOGIES-LIMITED/Dbrij.git",
35
+ "directory": "packages/glass-native"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "scripts": {
41
+ "build": "tsc -p tsconfig.json",
42
+ "dev": "tsc -p tsconfig.json --watch --preserveWatchOutput",
43
+ "lint": "eslint src --max-warnings 0",
44
+ "typecheck": "tsc -p tsconfig.json --noEmit",
45
+ "clean": "rm -rf dist .turbo"
46
+ }
6
47
  }