@tracelog/lib 2.5.0 → 2.5.1-rc.89.5

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 CHANGED
@@ -131,6 +131,7 @@ tracelog.destroy();
131
131
  | `setCustomHeaders(provider)` | Add custom HTTP headers to requests (see [Custom Headers](#custom-headers)) |
132
132
  | `removeCustomHeaders()` | Remove custom headers provider |
133
133
  | `isInitialized()` | Check initialization status |
134
+ | `getSessionId()` | Get current session ID (or null) |
134
135
  | `setQaMode(enabled)` | Enable/disable QA mode (console logging) |
135
136
  | `destroy()` | Stop tracking and cleanup |
136
137
 
@@ -879,6 +880,24 @@ await tracelog.init({ /* same config */ });
879
880
 
880
881
  **→ [Full Error Handling Reference](./API_REFERENCE.md#error-handling)**
881
882
 
883
+ ### Session Continuity (External Redirects)
884
+
885
+ TraceLog automatically preserves sessions across external redirects (payment processors, OAuth flows, etc.) with zero developer action. Session data is mirrored to `sessionStorage` alongside `localStorage`, so when a user returns from an external site and `localStorage` is empty, the session is recovered from `sessionStorage` transparently.
886
+
887
+ ```typescript
888
+ // No special handling needed before redirect
889
+ window.location.href = paymentUrl;
890
+
891
+ // On the confirmation page, init() automatically recovers the session
892
+ const { sessionId } = await tracelog.init({ /* same config */ });
893
+ tracelog.event('purchase', { orderId: '12345', amount: 99.99 });
894
+ // Same session as before the redirect
895
+ ```
896
+
897
+ - Automatic: no API calls or developer action required
898
+ - `sessionStorage` mirror survives same-tab navigation (cleared on tab close)
899
+ - Session timeout still applies (expired sessions are not recovered)
900
+
882
901
  ---
883
902
 
884
903
  ## Privacy & Security