sitepong 0.0.16 → 0.0.18
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 +274 -0
- package/dist/cdn/sitepong.min.js +5 -5
- package/dist/cdn/sitepong.min.js.map +1 -1
- package/dist/express/index.js.map +1 -1
- package/dist/express/index.mjs.map +1 -1
- package/dist/index-282F90Mc.d.ts +710 -0
- package/dist/index-CV3uStka.d.mts +710 -0
- package/dist/index.d.mts +2 -632
- package/dist/index.d.ts +2 -632
- package/dist/index.js +568 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +566 -92
- package/dist/index.mjs.map +1 -1
- package/dist/nextjs/index.d.mts +2 -2
- package/dist/nextjs/index.d.ts +2 -2
- package/dist/nextjs/index.js.map +1 -1
- package/dist/nextjs/index.mjs.map +1 -1
- package/dist/react/index.d.mts +5 -5
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.js +568 -91
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +566 -92
- package/dist/react/index.mjs.map +1 -1
- package/dist/react-native/index.d.mts +318 -0
- package/dist/react-native/index.d.ts +318 -0
- package/dist/react-native/index.js +5977 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/index.mjs +5927 -0
- package/dist/react-native/index.mjs.map +1 -0
- package/dist/server/index.d.mts +3 -3
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs.map +1 -1
- package/dist/{types-CLEYbaV8.d.mts → types-BEqbz0tw.d.mts} +2 -0
- package/dist/{types-CLEYbaV8.d.ts → types-BEqbz0tw.d.ts} +2 -0
- package/dist/{types-B-SQ044s.d.mts → types-Cms9VXx9.d.mts} +1 -1
- package/dist/{types-oS9oupfF.d.ts → types-DQSv7JAE.d.ts} +1 -1
- package/package.json +41 -1
package/README.md
CHANGED
|
@@ -447,6 +447,272 @@ function CheckoutButton() {
|
|
|
447
447
|
|
|
448
448
|
---
|
|
449
449
|
|
|
450
|
+
## React Native / Expo
|
|
451
|
+
|
|
452
|
+
First-class React Native support with automatic error capture, navigation tracking, and performance monitoring.
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
# Core
|
|
456
|
+
npm install sitepong @react-native-async-storage/async-storage
|
|
457
|
+
|
|
458
|
+
# Optional: persistent device ID (survives reinstalls)
|
|
459
|
+
npm install @sitepong/device-id
|
|
460
|
+
|
|
461
|
+
# Optional: screen recording
|
|
462
|
+
npm install @sitepong/screen-recorder
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
Add plugins to your `app.json` (only for native modules you installed):
|
|
466
|
+
|
|
467
|
+
```json
|
|
468
|
+
{
|
|
469
|
+
"plugins": [
|
|
470
|
+
"@sitepong/device-id",
|
|
471
|
+
"@sitepong/screen-recorder"
|
|
472
|
+
]
|
|
473
|
+
}
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
Then run `npx expo prebuild` to regenerate native projects.
|
|
477
|
+
|
|
478
|
+
```tsx
|
|
479
|
+
import { SitePongRNProvider } from 'sitepong/react-native';
|
|
480
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
481
|
+
import { NavigationContainer, useNavigationContainerRef } from '@react-navigation/native';
|
|
482
|
+
|
|
483
|
+
export default function App() {
|
|
484
|
+
const navigationRef = useNavigationContainerRef();
|
|
485
|
+
return (
|
|
486
|
+
<SitePongRNProvider
|
|
487
|
+
apiKey="your-api-key"
|
|
488
|
+
asyncStorage={AsyncStorage}
|
|
489
|
+
navigationRef={navigationRef}
|
|
490
|
+
>
|
|
491
|
+
<NavigationContainer ref={navigationRef}>
|
|
492
|
+
{/* Your screens */}
|
|
493
|
+
</NavigationContainer>
|
|
494
|
+
</SitePongRNProvider>
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### React Native Hooks
|
|
500
|
+
|
|
501
|
+
```tsx
|
|
502
|
+
import {
|
|
503
|
+
useScreenTrack,
|
|
504
|
+
useAppState,
|
|
505
|
+
useRemoteConfig,
|
|
506
|
+
useRNPerformance,
|
|
507
|
+
} from 'sitepong/react-native';
|
|
508
|
+
|
|
509
|
+
function MyScreen() {
|
|
510
|
+
useScreenTrack('MyScreen');
|
|
511
|
+
const appState = useAppState();
|
|
512
|
+
const config = useRemoteConfig();
|
|
513
|
+
const perf = useRNPerformance('MyScreen');
|
|
514
|
+
|
|
515
|
+
// perf.markRenderComplete() when screen is ready
|
|
516
|
+
}
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
### Screen Recording
|
|
520
|
+
|
|
521
|
+
Captures H.264 video in a rolling buffer. Requires the `@sitepong/screen-recorder` native module.
|
|
522
|
+
|
|
523
|
+
```bash
|
|
524
|
+
npm install @sitepong/screen-recorder
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
**Two modes:**
|
|
528
|
+
|
|
529
|
+
#### On Error (via Provider)
|
|
530
|
+
|
|
531
|
+
Recording starts automatically and keeps the **last 10 seconds**. When an error is captured the buffer is **automatically flushed and attached to the error**. No video is sent during normal usage.
|
|
532
|
+
|
|
533
|
+
```tsx
|
|
534
|
+
<SitePongRNProvider
|
|
535
|
+
apiKey="your-api-key"
|
|
536
|
+
asyncStorage={AsyncStorage}
|
|
537
|
+
screenRecording={{
|
|
538
|
+
enabled: true,
|
|
539
|
+
fps: 1,
|
|
540
|
+
quality: 'standard',
|
|
541
|
+
// bufferDuration defaults to 10_000 (10s) in on-error mode
|
|
542
|
+
}}
|
|
543
|
+
>
|
|
544
|
+
{/* Your app */}
|
|
545
|
+
</SitePongRNProvider>
|
|
546
|
+
```
|
|
547
|
+
|
|
548
|
+
When `captureError()` is called (or the global error handler fires), the SDK automatically flushes the last 10 seconds of video and attaches it to the error.
|
|
549
|
+
|
|
550
|
+
#### Manual
|
|
551
|
+
|
|
552
|
+
Start and stop recording yourself. Keeps the **last 60 seconds** by default. Call `flushScreenRecording()` to upload when you decide.
|
|
553
|
+
|
|
554
|
+
```tsx
|
|
555
|
+
import {
|
|
556
|
+
startScreenRecording,
|
|
557
|
+
stopScreenRecording,
|
|
558
|
+
flushScreenRecording,
|
|
559
|
+
} from 'sitepong/react-native';
|
|
560
|
+
|
|
561
|
+
// Start — keeps a 60s rolling buffer
|
|
562
|
+
startScreenRecording('your-api-key', 'https://ingest.sitepong.com', sessionId, {
|
|
563
|
+
fps: 1,
|
|
564
|
+
quality: 'standard',
|
|
565
|
+
// bufferDuration defaults to 60_000 (60s) in manual mode
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
// Upload the buffer whenever you want
|
|
569
|
+
await flushScreenRecording();
|
|
570
|
+
|
|
571
|
+
// Stop and discard the buffer
|
|
572
|
+
stopScreenRecording();
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
**Masking sensitive content:**
|
|
576
|
+
|
|
577
|
+
```tsx
|
|
578
|
+
import { SensitiveView } from '@sitepong/screen-recorder';
|
|
579
|
+
|
|
580
|
+
<SensitiveView>
|
|
581
|
+
<Text>SSN: 123-45-6789</Text>
|
|
582
|
+
<Text>Card: 4111-1111-1111-1111</Text>
|
|
583
|
+
</SensitiveView>
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
Content inside `<SensitiveView>` is replaced with a black rectangle in recorded video.
|
|
587
|
+
|
|
588
|
+
**Configuration:**
|
|
589
|
+
|
|
590
|
+
| Option | Default (on-error) | Default (manual) | Description |
|
|
591
|
+
|---|---|---|---|
|
|
592
|
+
| `enabled` | `false` | n/a | Enable via provider |
|
|
593
|
+
| `fps` | `1` | `1` | Frames per second (1-10) |
|
|
594
|
+
| `quality` | `'standard'` | `'standard'` | `'low'` / `'standard'` / `'high'` |
|
|
595
|
+
| `sampleRate` | `1.0` | `1.0` | Fraction of sessions to record (0-1) |
|
|
596
|
+
| `bufferDuration` | `10000` (10s) | `60000` (60s) | Rolling buffer size in ms |
|
|
597
|
+
| `maxDuration` | `3600000` | `3600000` | Max recording duration in ms |
|
|
598
|
+
|
|
599
|
+
### Device Intelligence (React Native)
|
|
600
|
+
|
|
601
|
+
Persistent device identification that **survives app reinstalls**. Requires the `@sitepong/device-id` native module.
|
|
602
|
+
|
|
603
|
+
```bash
|
|
604
|
+
npm install @sitepong/device-id
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
Add the config plugin to your `app.json` / `app.config.js`:
|
|
608
|
+
|
|
609
|
+
```json
|
|
610
|
+
{
|
|
611
|
+
"plugins": ["@sitepong/device-id"]
|
|
612
|
+
}
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
Once installed, the SDK automatically uses the native device ID:
|
|
616
|
+
- **iOS**: UUID stored in Keychain (persists across uninstall/reinstall, cleared on factory reset)
|
|
617
|
+
- **Android**: SHA-256 of `ANDROID_ID` + SharedPreferences UUID (stable per signing key since Android 8)
|
|
618
|
+
|
|
619
|
+
```tsx
|
|
620
|
+
import { fetchPersistentDeviceId, fetchNativeDeviceSignals } from 'sitepong/react-native';
|
|
621
|
+
|
|
622
|
+
// Get persistent device ID
|
|
623
|
+
const deviceId = await fetchPersistentDeviceId();
|
|
624
|
+
|
|
625
|
+
// Get full native signals
|
|
626
|
+
const signals = await fetchNativeDeviceSignals();
|
|
627
|
+
// { deviceId, platform, osVersion, model, manufacturer, isEmulator, screenScale,
|
|
628
|
+
// identifierForVendor (iOS), androidId (Android) }
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
Or use the native module directly:
|
|
632
|
+
|
|
633
|
+
```tsx
|
|
634
|
+
import { getDeviceId, getDeviceSignals } from '@sitepong/device-id';
|
|
635
|
+
|
|
636
|
+
const deviceId = await getDeviceId();
|
|
637
|
+
const signals = await getDeviceSignals();
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
**Identity hierarchy** (all platforms):
|
|
641
|
+
|
|
642
|
+
| Level | Scope | Persistence |
|
|
643
|
+
|-------|-------|-------------|
|
|
644
|
+
| `deviceId` | Hardware-level | Survives reinstalls (RN only) |
|
|
645
|
+
| `anonymousId` | App-level UUID | Persists in storage |
|
|
646
|
+
| `sessionId` | Session-scoped | 30-min timeout |
|
|
647
|
+
| `userId` | Developer-set | Via `identify()` |
|
|
648
|
+
|
|
649
|
+
### SQLite Query Tracking
|
|
650
|
+
|
|
651
|
+
Monitor `expo-sqlite` query performance with automatic timing and slow query detection.
|
|
652
|
+
|
|
653
|
+
```tsx
|
|
654
|
+
import { createTrackedDatabase } from 'sitepong/react-native';
|
|
655
|
+
import * as SQLite from 'expo-sqlite';
|
|
656
|
+
|
|
657
|
+
const db = SQLite.openDatabaseSync('myapp.db');
|
|
658
|
+
const trackedDb = createTrackedDatabase(db, {
|
|
659
|
+
slowQueryThreshold: 100, // ms — log queries slower than this
|
|
660
|
+
trackAll: false, // if true, track every query
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
// Use trackedDb exactly like db — same API
|
|
664
|
+
const users = trackedDb.getAllSync('SELECT * FROM users WHERE active = 1');
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
Tracked queries emit `$sqlite_query` events with `{ sql, durationMs, rowCount }` and add breadcrumbs for debugging.
|
|
668
|
+
|
|
669
|
+
### What's Included
|
|
670
|
+
|
|
671
|
+
- **Error Capture**: Automatic `ErrorUtils.setGlobalHandler()` + promise rejection tracking
|
|
672
|
+
- **Screen Recording**: H.264 rolling buffer — on-error (10s, auto-attached) or manual (60s)
|
|
673
|
+
- **Device Intelligence**: Persistent device ID via Keychain (iOS) / ANDROID_ID (Android)
|
|
674
|
+
- **SQLite Tracking**: Query timing and slow query detection for expo-sqlite
|
|
675
|
+
- **Navigation Tracking**: React Navigation integration, tracks `$screen_view` events + breadcrumbs
|
|
676
|
+
- **Network Interception**: XHR monkey-patch for request tracking + breadcrumbs
|
|
677
|
+
- **Performance**: Cold start timing, screen render tracking
|
|
678
|
+
- **App State**: Automatic foreground/background/inactive tracking
|
|
679
|
+
- **AsyncStorage**: Persistent storage for session data and remote config cache
|
|
680
|
+
|
|
681
|
+
---
|
|
682
|
+
|
|
683
|
+
## Remote Config
|
|
684
|
+
|
|
685
|
+
The SDK can fetch behavior configuration from SitePong servers on init, allowing you to change sampling rates, feature toggles, and transport settings without publishing a new SDK version.
|
|
686
|
+
|
|
687
|
+
```javascript
|
|
688
|
+
sitepong.init({
|
|
689
|
+
apiKey: 'your-api-key',
|
|
690
|
+
remoteConfig: { enabled: true },
|
|
691
|
+
});
|
|
692
|
+
|
|
693
|
+
// Check if a remote config feature is enabled
|
|
694
|
+
const enabled = sitepong.isRemoteConfigFeatureEnabled('session_replay');
|
|
695
|
+
|
|
696
|
+
// Get full remote config
|
|
697
|
+
const config = sitepong.getRemoteConfig();
|
|
698
|
+
|
|
699
|
+
// Listen for config changes
|
|
700
|
+
sitepong.onRemoteConfigChange((newConfig) => {
|
|
701
|
+
console.log('Config updated:', newConfig);
|
|
702
|
+
});
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
Remote config is managed from the **SDK Config** page in the SitePong dashboard, where you can adjust:
|
|
706
|
+
|
|
707
|
+
- **Sampling rates** for errors, analytics, replay, and performance
|
|
708
|
+
- **Feature toggles** for any SDK feature
|
|
709
|
+
- **Autocapture settings** (pageviews, clicks, forms, network requests)
|
|
710
|
+
- **Transport settings** (flush interval, batch size, retry attempts)
|
|
711
|
+
|
|
712
|
+
The SDK caches config locally (with configurable TTL) and refreshes in the background, so your app always starts instantly with the last-known config.
|
|
713
|
+
|
|
714
|
+
---
|
|
715
|
+
|
|
450
716
|
## Framework Integration
|
|
451
717
|
|
|
452
718
|
### Next.js
|
|
@@ -690,6 +956,14 @@ sitepong.init({
|
|
|
690
956
|
| `getDbQueryCount()` | Get query count |
|
|
691
957
|
| `getDbNPlusOnePatterns()` | Get N+1 patterns |
|
|
692
958
|
|
|
959
|
+
### Remote Config
|
|
960
|
+
|
|
961
|
+
| Method | Description |
|
|
962
|
+
|--------|-------------|
|
|
963
|
+
| `getRemoteConfig()` | Get full remote config |
|
|
964
|
+
| `isRemoteConfigFeatureEnabled(feature)` | Check if remote feature is enabled |
|
|
965
|
+
| `onRemoteConfigChange(callback)` | Listen for config changes (returns unsubscribe fn) |
|
|
966
|
+
|
|
693
967
|
### Profiling
|
|
694
968
|
|
|
695
969
|
| Method | Description |
|