@inslytic/sdk-react 0.1.1 → 0.1.2

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 (2) hide show
  1. package/README.md +59 -0
  2. package/package.json +5 -8
package/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # @inslytic/sdk-react
2
+
3
+ React hooks and components for [Inslytic](https://inslytic.com) — AI-powered product analytics.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @inslytic/sdk-react
9
+ ```
10
+
11
+ Requires React 18+.
12
+
13
+ ## Usage
14
+
15
+ Wrap your app with `InslyticProvider`:
16
+
17
+ ```tsx
18
+ import { InslyticProvider } from "@inslytic/sdk-react";
19
+
20
+ function App() {
21
+ return (
22
+ <InslyticProvider config={{ apiKey: "your-api-key" }}>
23
+ <YourApp />
24
+ </InslyticProvider>
25
+ );
26
+ }
27
+ ```
28
+
29
+ Then use the `useInslytic` hook in any component:
30
+
31
+ ```tsx
32
+ import { useInslytic } from "@inslytic/sdk-react";
33
+
34
+ function SignupButton() {
35
+ const { track } = useInslytic();
36
+
37
+ return (
38
+ <button onClick={() => track("signup_clicked")}>
39
+ Sign up
40
+ </button>
41
+ );
42
+ }
43
+ ```
44
+
45
+ ## API
46
+
47
+ The `useInslytic` hook returns all functions from `@inslytic/sdk-browser`:
48
+
49
+ | Function | Description |
50
+ |---|---|
51
+ | `track(event, options?)` | Track a custom event |
52
+ | `identify(userId, traits?)` | Associate events with a user |
53
+ | `page(properties?)` | Track a page view |
54
+ | `setConsent(granted)` | Set user consent status |
55
+ | `reset()` | Clear user identity and stop tracking |
56
+
57
+ ## License
58
+
59
+ MIT
package/package.json CHANGED
@@ -1,13 +1,9 @@
1
1
  {
2
2
  "name": "@inslytic/sdk-react",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "React hooks and components for Inslytic — AI-powered product analytics",
5
5
  "license": "MIT",
6
- "repository": {
7
- "type": "git",
8
- "url": "https://github.com/inslytic/inslytic",
9
- "directory": "packages/sdk-react"
10
- },
6
+ "homepage": "https://www.inslytic.com/docs/react-sdk",
11
7
  "keywords": [
12
8
  "analytics",
13
9
  "tracking",
@@ -33,13 +29,14 @@
33
29
  }
34
30
  },
35
31
  "files": [
36
- "dist"
32
+ "dist",
33
+ "README.md"
37
34
  ],
38
35
  "publishConfig": {
39
36
  "access": "public"
40
37
  },
41
38
  "dependencies": {
42
- "@inslytic/sdk-browser": "0.1.1"
39
+ "@inslytic/sdk-browser": "0.1.2"
43
40
  },
44
41
  "peerDependencies": {
45
42
  "react": ">=18"