@probie-dev/react-native 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.
Files changed (56) hide show
  1. package/README.md +221 -0
  2. package/dist/appstate.d.ts +1 -0
  3. package/dist/appstate.js +31 -0
  4. package/dist/buffer.d.ts +13 -0
  5. package/dist/buffer.js +27 -0
  6. package/dist/capture/forms.d.ts +16 -0
  7. package/dist/capture/forms.js +33 -0
  8. package/dist/capture/screen.d.ts +7 -0
  9. package/dist/capture/screen.js +30 -0
  10. package/dist/capture/tap.d.ts +11 -0
  11. package/dist/capture/tap.js +37 -0
  12. package/dist/client.d.ts +33 -0
  13. package/dist/client.js +165 -0
  14. package/dist/config.d.ts +18 -0
  15. package/dist/config.js +64 -0
  16. package/dist/deviceContext.d.ts +2 -0
  17. package/dist/deviceContext.js +43 -0
  18. package/dist/element.d.ts +3 -0
  19. package/dist/element.js +26 -0
  20. package/dist/hash.d.ts +1 -0
  21. package/dist/hash.js +6 -0
  22. package/dist/identity.d.ts +6 -0
  23. package/dist/identity.js +18 -0
  24. package/dist/ids.d.ts +1 -0
  25. package/dist/ids.js +13 -0
  26. package/dist/index.d.ts +8 -0
  27. package/dist/index.js +7 -0
  28. package/dist/interceptors/errors.d.ts +3 -0
  29. package/dist/interceptors/errors.js +59 -0
  30. package/dist/interceptors/network.d.ts +3 -0
  31. package/dist/interceptors/network.js +47 -0
  32. package/dist/nav/expoRouter.d.ts +1 -0
  33. package/dist/nav/expoRouter.js +17 -0
  34. package/dist/nav/reactNavigation.d.ts +6 -0
  35. package/dist/nav/reactNavigation.js +25 -0
  36. package/dist/react/ProbiePressable.d.ts +6 -0
  37. package/dist/react/ProbiePressable.js +21 -0
  38. package/dist/react/ProbieProvider.d.ts +7 -0
  39. package/dist/react/ProbieProvider.js +11 -0
  40. package/dist/react/hooks.d.ts +2 -0
  41. package/dist/react/hooks.js +4 -0
  42. package/dist/react/useProbieForm.d.ts +6 -0
  43. package/dist/react/useProbieForm.js +12 -0
  44. package/dist/session.d.ts +7 -0
  45. package/dist/session.js +36 -0
  46. package/dist/singleton.d.ts +10 -0
  47. package/dist/singleton.js +30 -0
  48. package/dist/transport.d.ts +9 -0
  49. package/dist/transport.js +67 -0
  50. package/dist/types.d.ts +66 -0
  51. package/dist/types.js +1 -0
  52. package/dist/url.d.ts +1 -0
  53. package/dist/url.js +21 -0
  54. package/dist/version.d.ts +2 -0
  55. package/dist/version.js +2 -0
  56. package/package.json +64 -0
@@ -0,0 +1,66 @@
1
+ export type EventType = 'pageview' | 'click' | 'rage_click' | 'form_submit' | 'form_abandon' | 'form_retry' | 'fetch_error' | 'js_error';
2
+ export interface ElementInfo {
3
+ path: string;
4
+ role: string | null;
5
+ name: string | null;
6
+ type: string | null;
7
+ testid: string | null;
8
+ text_hash: string | null;
9
+ }
10
+ export interface DeviceContext {
11
+ platform: string | null;
12
+ os_version: string | null;
13
+ app_version: string | null;
14
+ build: string | null;
15
+ device_model: string | null;
16
+ sdk_name: string;
17
+ sdk_version: string;
18
+ anon_id: string | null;
19
+ }
20
+ export interface ProbieEvent {
21
+ type: EventType;
22
+ ts: number;
23
+ session_id: string;
24
+ user_id: string | null;
25
+ url: string;
26
+ route: string;
27
+ referrer: string;
28
+ element: ElementInfo | null;
29
+ payload: Record<string, unknown>;
30
+ context: DeviceContext;
31
+ }
32
+ export interface ElementSource {
33
+ path?: string;
34
+ testID?: string | null;
35
+ accessibilityRole?: string | null;
36
+ accessibilityLabel?: string | null;
37
+ name?: string | null;
38
+ type?: string | null;
39
+ text?: string | null;
40
+ }
41
+ export interface AsyncStorageLike {
42
+ getItem(key: string): Promise<string | null>;
43
+ setItem(key: string, value: string): Promise<void>;
44
+ removeItem?(key: string): Promise<void>;
45
+ }
46
+ export interface ProbieConfig {
47
+ token: string;
48
+ apiBase: string;
49
+ sampleRate?: number;
50
+ captureQuery?: boolean;
51
+ captureErrors?: boolean;
52
+ captureNetwork?: boolean;
53
+ captureUnhandledRejections?: boolean;
54
+ idleTimeoutMs?: number | null;
55
+ flushIntervalMs?: number;
56
+ appVersion?: string;
57
+ storage?: AsyncStorageLike;
58
+ fetchImpl?: (url: string, init: unknown) => Promise<unknown>;
59
+ }
60
+ export interface ProbieClient {
61
+ identify(userId: string | null): void;
62
+ reset(): void;
63
+ trackScreen(name: string, params?: Record<string, unknown>): void;
64
+ track(type: EventType, payload?: Record<string, unknown>, element?: ElementSource | ElementInfo | null): void;
65
+ flush(): Promise<void>;
66
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/url.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare function sanitizeUrl(raw: string, captureQuery: boolean): string;
package/dist/url.js ADDED
@@ -0,0 +1,21 @@
1
+ function stripCredentials(url) {
2
+ const schemeIdx = url.indexOf('://');
3
+ if (schemeIdx === -1)
4
+ return url;
5
+ const authStart = schemeIdx + 3;
6
+ const rest = url.slice(authStart);
7
+ const endMatch = rest.search(/[/?#]/);
8
+ const authority = endMatch === -1 ? rest : rest.slice(0, endMatch);
9
+ const at = authority.lastIndexOf('@');
10
+ if (at === -1)
11
+ return url;
12
+ const cleaned = authority.slice(at + 1);
13
+ return url.slice(0, authStart) + cleaned + (endMatch === -1 ? '' : rest.slice(endMatch));
14
+ }
15
+ export function sanitizeUrl(raw, captureQuery) {
16
+ if (!raw)
17
+ return '';
18
+ const noHash = raw.split('#')[0];
19
+ const noQuery = captureQuery ? noHash : noHash.split('?')[0];
20
+ return stripCredentials(noQuery);
21
+ }
@@ -0,0 +1,2 @@
1
+ export declare const SDK_NAME = "@probie-dev/react-native";
2
+ export declare const SDK_VERSION = "0.1.0";
@@ -0,0 +1,2 @@
1
+ export const SDK_NAME = '@probie-dev/react-native';
2
+ export const SDK_VERSION = '0.1.0';
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@probie-dev/react-native",
3
+ "version": "0.1.0",
4
+ "description": "Probie passive behavioral telemetry SDK for Expo / React Native apps.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "sideEffects": false,
11
+ "files": [
12
+ "dist",
13
+ "README.md"
14
+ ],
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "keywords": [
19
+ "probie",
20
+ "expo",
21
+ "react-native",
22
+ "telemetry",
23
+ "analytics",
24
+ "observability"
25
+ ],
26
+ "scripts": {
27
+ "build": "tsc -p tsconfig.build.json",
28
+ "typecheck": "tsc --noEmit -p tsconfig.json",
29
+ "test": "jest",
30
+ "clean": "rm -rf dist",
31
+ "prepublishOnly": "npm run clean && npm run build"
32
+ },
33
+ "peerDependencies": {
34
+ "expo": ">=50.0.0",
35
+ "react": ">=18.0.0",
36
+ "react-native": ">=0.73.0"
37
+ },
38
+ "peerDependenciesMeta": {
39
+ "expo-router": {
40
+ "optional": true
41
+ },
42
+ "@react-navigation/native": {
43
+ "optional": true
44
+ }
45
+ },
46
+ "dependencies": {
47
+ "@react-native-async-storage/async-storage": "^1.23.0 || ^2.0.0",
48
+ "expo-application": "^5.9.0 || ^6.0.0",
49
+ "expo-constants": "^16.0.0 || ^17.0.0",
50
+ "expo-crypto": "^13.0.0 || ^14.0.0",
51
+ "expo-device": "^6.0.0 || ^7.0.0"
52
+ },
53
+ "devDependencies": {
54
+ "@types/jest": "^29.5.12",
55
+ "@types/react": "~18.2.79",
56
+ "babel-preset-expo": "^11.0.0",
57
+ "expo": "^51.0.0",
58
+ "jest": "^29.7.0",
59
+ "jest-expo": "^51.0.0",
60
+ "react": "18.2.0",
61
+ "react-native": "0.74.7",
62
+ "typescript": "^5.7.2"
63
+ }
64
+ }