@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 CHANGED
@@ -1,80 +1,133 @@
1
- # @allstak-io/react
1
+ # @allstak/react
2
2
 
3
- AllStak React SDK `<AllStakErrorBoundary>`, `useAllStak()` hook, and `withAllStakProfiler` HOC.
3
+ **Drop-in error tracking for React. One `<AllStakErrorBoundary>`, zero config beyond your API key.**
4
4
 
5
- ## Install
5
+ [![npm version](https://img.shields.io/npm/v/@allstak/react.svg)](https://www.npmjs.com/package/@allstak/react)
6
+ [![CI](https://github.com/allstak-io/allstak-react/actions/workflows/ci.yml/badge.svg)](https://github.com/allstak-io/allstak-react/actions)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
8
 
7
- > **Auth required:** GitHub Packages requires a token with `read:packages` scope.
9
+ Official AllStak SDK for React error boundary component, hooks, and a profiler HOC on top of the browser SDK.
8
10
 
9
- ### 1. Configure `.npmrc`
11
+ ## Dashboard
10
12
 
11
- ```ini
12
- @allstak-io:registry=https://npm.pkg.github.com
13
- //npm.pkg.github.com/:_authToken=YOUR_GITHUB_PAT
14
- ```
13
+ View captured events live at [app.allstak.sa](https://app.allstak.sa).
14
+
15
+ ![AllStak dashboard](https://app.allstak.sa/images/dashboard-preview.png)
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
- ### 2. Install
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-io/react@0.1.1 @allstak-io/browser@0.1.1
20
- # react >=16.8 is a peer dep — install separately if needed
39
+ npm install @allstak/react
21
40
  ```
22
41
 
23
- ## Usage
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-io/browser';
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: process.env.ALLSTAK_API_KEY!,
50
+ apiKey: import.meta.env.VITE_ALLSTAK_API_KEY,
32
51
  environment: 'production',
33
- release: 'v1.0.0',
34
52
  });
35
53
 
36
- // 2. Wrap your component tree
37
- function App() {
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
- <MyApp />
59
+ <Routes />
41
60
  </AllStakErrorBoundary>
42
61
  );
43
62
  }
63
+ ```
44
64
 
45
- // 3. Manual capture inside components
46
- function MyComponent() {
47
- const allstak = useAllStak();
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
- const handleClick = () => {
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
- return <button onClick={handleClick}>Do risky thing</button>;
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
- ## API
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
- | Export | Description |
64
- |--------|-------------|
65
- | `AllStak` | Re-exported from `@allstak-io/browser` — use to init |
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
- ## GitHub Packages
125
+ ## Links
72
126
 
73
- - **Package:** `@allstak-io/react`
74
- - **Registry:** `https://npm.pkg.github.com`
75
- - **Repo:** [github.com/allstak-io/allstak-react](https://github.com/allstak-io/allstak-react)
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
- ## Versioning
131
+ ## License
79
132
 
80
- Tags must match `package.json` version exactly (e.g. `v0.1.1`). The release workflow fails if there's a mismatch.
133
+ MIT © AllStak
package/dist/index.d.mts CHANGED
@@ -1 +1 @@
1
- export { AllStak, AllStakErrorBoundary, AllStakErrorBoundaryProps, useAllStak, withAllStakProfiler } from 'allstak-js/react';
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-js/react';
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-js/react");
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-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":[]}
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
@@ -4,7 +4,7 @@ import {
4
4
  useAllStak,
5
5
  withAllStakProfiler,
6
6
  AllStak
7
- } from "allstak-js/react";
7
+ } from "@allstak/js/react";
8
8
  export {
9
9
  AllStak,
10
10
  AllStakErrorBoundary,
@@ -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-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":[]}
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.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.1",
48
- "@allstak/js": "^0.1.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",