@allstak/react 0.1.1 → 0.1.3
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 +100 -47
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,80 +1,133 @@
|
|
|
1
|
-
# @allstak
|
|
1
|
+
# @allstak/react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Drop-in error tracking for React. One `<AllStakErrorBoundary>`, zero config beyond your API key.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@allstak/react)
|
|
6
|
+
[](https://github.com/allstak-io/allstak-react/actions)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
Official AllStak SDK for React — error boundary component, hooks, and a profiler HOC on top of the browser SDK.
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
## Dashboard
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
View captured events live at [app.allstak.sa](https://app.allstak.sa).
|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
|
+
- `<AllStakErrorBoundary>` component for render-tree error capture
|
|
20
|
+
- `useAllStak()` hook for in-component capture and context
|
|
21
|
+
- `withAllStakProfiler` HOC for mount/update timing
|
|
22
|
+
- Inherits automatic fetch, console, and window error capture from the core SDK
|
|
23
|
+
- Works with React 17, 18, and 19
|
|
24
|
+
- Full TypeScript types
|
|
15
25
|
|
|
16
|
-
|
|
26
|
+
## What You Get
|
|
27
|
+
|
|
28
|
+
Once integrated, every event flows to your AllStak dashboard:
|
|
29
|
+
|
|
30
|
+
- **Errors** — render-tree crashes, caught hook errors, stack traces with component names
|
|
31
|
+
- **Logs** — console warnings and errors as structured breadcrumbs
|
|
32
|
+
- **HTTP** — outbound `fetch` timing, status codes, failed calls
|
|
33
|
+
- **Performance** — mount and update timing from the profiler HOC
|
|
34
|
+
- **Alerts** — email and webhook notifications on regressions
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
17
37
|
|
|
18
38
|
```bash
|
|
19
|
-
npm install @allstak
|
|
20
|
-
# react >=16.8 is a peer dep — install separately if needed
|
|
39
|
+
npm install @allstak/react
|
|
21
40
|
```
|
|
22
41
|
|
|
23
|
-
##
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
> Create a project at [app.allstak.sa](https://app.allstak.sa) to get your API key.
|
|
24
45
|
|
|
25
46
|
```tsx
|
|
26
|
-
import { AllStak } from '@allstak
|
|
27
|
-
import { AllStakErrorBoundary, useAllStak } from '@allstak-io/react';
|
|
47
|
+
import { AllStak, AllStakErrorBoundary } from '@allstak/react';
|
|
28
48
|
|
|
29
|
-
// 1. Initialize once at app root
|
|
30
49
|
AllStak.init({
|
|
31
|
-
apiKey:
|
|
50
|
+
apiKey: import.meta.env.VITE_ALLSTAK_API_KEY,
|
|
32
51
|
environment: 'production',
|
|
33
|
-
release: 'v1.0.0',
|
|
34
52
|
});
|
|
35
53
|
|
|
36
|
-
|
|
37
|
-
|
|
54
|
+
AllStak.captureException(new Error('test: hello from allstak-react'));
|
|
55
|
+
|
|
56
|
+
export function App() {
|
|
38
57
|
return (
|
|
39
58
|
<AllStakErrorBoundary fallback={<p>Something went wrong.</p>}>
|
|
40
|
-
<
|
|
59
|
+
<Routes />
|
|
41
60
|
</AllStakErrorBoundary>
|
|
42
61
|
);
|
|
43
62
|
}
|
|
63
|
+
```
|
|
44
64
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
65
|
+
Load the app — the test error appears in your dashboard within seconds.
|
|
66
|
+
|
|
67
|
+
## Get Your API Key
|
|
68
|
+
|
|
69
|
+
1. Sign up at [app.allstak.sa](https://app.allstak.sa)
|
|
70
|
+
2. Create a project
|
|
71
|
+
3. Copy your API key from **Project Settings → API Keys**
|
|
72
|
+
4. Export it as `ALLSTAK_API_KEY` or pass it to `AllStak.init(...)`
|
|
73
|
+
|
|
74
|
+
## Configuration
|
|
75
|
+
|
|
76
|
+
| Option | Type | Required | Default | Description |
|
|
77
|
+
|---|---|---|---|---|
|
|
78
|
+
| `apiKey` | `string` | yes | — | Project API key (`ask_live_…`) |
|
|
79
|
+
| `environment` | `string` | no | — | Deployment env |
|
|
80
|
+
| `release` | `string` | no | — | Version or git SHA |
|
|
81
|
+
| `host` | `string` | no | `https://api.allstak.sa` | Ingest host override |
|
|
82
|
+
| `user` | `{ id?, email? }` | no | — | Default user context |
|
|
83
|
+
| `tags` | `Record<string,string>` | no | — | Default tags |
|
|
84
|
+
|
|
85
|
+
## Example Usage
|
|
48
86
|
|
|
49
|
-
|
|
50
|
-
try {
|
|
51
|
-
riskyOperation();
|
|
52
|
-
} catch (err) {
|
|
53
|
-
allstak.captureException(err as Error);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
87
|
+
Capture an error inside a component:
|
|
56
88
|
|
|
57
|
-
|
|
89
|
+
```tsx
|
|
90
|
+
import { useAllStak } from '@allstak/react';
|
|
91
|
+
|
|
92
|
+
function CheckoutButton() {
|
|
93
|
+
const allstak = useAllStak();
|
|
94
|
+
return (
|
|
95
|
+
<button onClick={() => {
|
|
96
|
+
try { checkout(); }
|
|
97
|
+
catch (e) { allstak.captureException(e as Error); }
|
|
98
|
+
}}>Pay</button>
|
|
99
|
+
);
|
|
58
100
|
}
|
|
59
101
|
```
|
|
60
102
|
|
|
61
|
-
|
|
103
|
+
Wrap a component with the profiler:
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
import { withAllStakProfiler } from '@allstak/react';
|
|
107
|
+
export default withAllStakProfiler(Dashboard, { name: 'Dashboard' });
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Set user context on login:
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import { AllStak } from '@allstak/react';
|
|
114
|
+
AllStak.setUser({ id: user.id, email: user.email });
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Production Endpoint
|
|
118
|
+
|
|
119
|
+
Production endpoint: `https://api.allstak.sa`. Override via `host` for self-hosted installs:
|
|
62
120
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
| `AllStakErrorBoundary` | React error boundary; catches component-tree errors |
|
|
67
|
-
| `AllStakErrorBoundaryProps` | Props type for the boundary |
|
|
68
|
-
| `useAllStak()` | Hook returning `{ captureException, captureMessage, setUser, setTag }` |
|
|
69
|
-
| `withAllStakProfiler(Component)` | HOC that wraps a component in the profiler |
|
|
121
|
+
```tsx
|
|
122
|
+
AllStak.init({ apiKey: '...', host: 'https://allstak.mycorp.com' });
|
|
123
|
+
```
|
|
70
124
|
|
|
71
|
-
##
|
|
125
|
+
## Links
|
|
72
126
|
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
- **Releases:** [github.com/allstak-io/allstak-react/releases](https://github.com/allstak-io/allstak-react/releases)
|
|
127
|
+
- Documentation: https://docs.allstak.sa
|
|
128
|
+
- Dashboard: https://app.allstak.sa
|
|
129
|
+
- Source: https://github.com/allstak-io/allstak-react
|
|
77
130
|
|
|
78
|
-
##
|
|
131
|
+
## License
|
|
79
132
|
|
|
80
|
-
|
|
133
|
+
MIT © AllStak
|
package/dist/index.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AllStak, AllStakErrorBoundary, AllStakErrorBoundaryProps, useAllStak, withAllStakProfiler } from 'allstak
|
|
1
|
+
export { AllStak, AllStakErrorBoundary, AllStakErrorBoundaryProps, useAllStak, withAllStakProfiler } from '@allstak/js/react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AllStak, AllStakErrorBoundary, AllStakErrorBoundaryProps, useAllStak, withAllStakProfiler } from 'allstak
|
|
1
|
+
export { AllStak, AllStakErrorBoundary, AllStakErrorBoundaryProps, useAllStak, withAllStakProfiler } from '@allstak/js/react';
|
package/dist/index.js
CHANGED
|
@@ -26,5 +26,5 @@ __export(index_exports, {
|
|
|
26
26
|
withAllStakProfiler: () => import_react.withAllStakProfiler
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(index_exports);
|
|
29
|
-
var import_react = require("allstak
|
|
29
|
+
var import_react = require("@allstak/js/react");
|
|
30
30
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @allstak/react — React-specific public API.\n *\n * Re-exports the React integration from allstak
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @allstak/react — React-specific public API.\n *\n * Re-exports the React integration from @allstak/js/react.\n * Components and hooks all rely on @allstak/browser being initialized first.\n */\nexport {\n AllStakErrorBoundary,\n type AllStakErrorBoundaryProps,\n useAllStak,\n withAllStakProfiler,\n AllStak,\n} from '@allstak/js/react';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,mBAMO;","names":[]}
|
package/dist/index.mjs
CHANGED
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @allstak/react — React-specific public API.\n *\n * Re-exports the React integration from allstak
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @allstak/react — React-specific public API.\n *\n * Re-exports the React integration from @allstak/js/react.\n * Components and hooks all rely on @allstak/browser being initialized first.\n */\nexport {\n AllStakErrorBoundary,\n type AllStakErrorBoundaryProps,\n useAllStak,\n withAllStakProfiler,\n AllStak,\n} from '@allstak/js/react';\n"],"mappings":";AAMA;AAAA,EACE;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allstak/react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "AllStak React SDK — <AllStakErrorBoundary>, useAllStak() hook, withAllStakProfiler HOC. Depends on @allstak-io/browser.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"react": ">=16.8.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@allstak/browser": "^0.1.
|
|
48
|
-
"@allstak/js": "^0.1.
|
|
47
|
+
"@allstak/browser": "^0.1.3",
|
|
48
|
+
"@allstak/js": "^0.1.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/react": "^18.3.0",
|