@tekibo/feedpulse-sdk 2.0.0 → 2.0.1

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 +191 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,191 @@
1
+ # @tekibo/feedpulse-sdk
2
+
3
+ Developer-first embeddable behavior analytics and feedback SDK for Nuxt and React.
4
+
5
+ - Tracks user interactions from elements tagged with `data-fp-id`
6
+ - Sends event batches to your FeedPulse ingest endpoint
7
+ - Includes ready-to-use feedback widgets for Nuxt and React
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pnpm add @tekibo/feedpulse-sdk
13
+ ```
14
+
15
+ ## What this SDK tracks
16
+
17
+ The SDK automatically tracks:
18
+
19
+ - `click`: when users click an element that has `data-fp-id`
20
+ - `hover`: when users hover an element for more than 500ms
21
+ - `scroll_into_view`: when tagged elements enter viewport
22
+ - `feedback`: explicit rating/message submissions from widget or manual API
23
+
24
+ Each event includes context such as session id, visitor id, page path, device, browser, OS, metadata, and timestamp.
25
+
26
+ ## Backend requirements
27
+
28
+ Your backend must expose an ingest endpoint compatible with this payload:
29
+
30
+ ```json
31
+ {
32
+ "events": [
33
+ {
34
+ "projectApiKey": "fp_live_xxx",
35
+ "elementId": "hero-cta",
36
+ "eventType": "click",
37
+ "sessionId": "session-1",
38
+ "visitorId": "visitor-1",
39
+ "page": "/",
40
+ "device": "desktop",
41
+ "metadata": {},
42
+ "timestamp": "2026-03-12T00:00:00.000Z"
43
+ }
44
+ ]
45
+ }
46
+ ```
47
+
48
+ In the FeedPulse codebase, the default server endpoint is:
49
+
50
+ - `POST /api/ingest`
51
+
52
+ ## Quick start (Nuxt)
53
+
54
+ Import from `@tekibo/feedpulse-sdk/nuxt` and wrap your app:
55
+
56
+ ```vue
57
+ <script setup lang="ts">
58
+ import { FeedPulseProvider, FeedPulseWidget } from "@tekibo/feedpulse-sdk/nuxt";
59
+ </script>
60
+
61
+ <template>
62
+ <FeedPulseProvider api-key="fp_live_your_project_key">
63
+ <NuxtPage />
64
+ <FeedPulseWidget id="global-feedback" position="bottom-right" />
65
+ </FeedPulseProvider>
66
+ </template>
67
+ ```
68
+
69
+ Tag any interactive element with `data-fp-id`:
70
+
71
+ ```vue
72
+ <template>
73
+ <UButton data-fp-id="hero-cta">
74
+ Start free trial
75
+ </UButton>
76
+ </template>
77
+ ```
78
+
79
+ Use the composable for manual feedback/event calls:
80
+
81
+ ```vue
82
+ <script setup lang="ts">
83
+ import { useFeedPulse } from "@tekibo/feedpulse-sdk/nuxt";
84
+
85
+ const tracker = useFeedPulse();
86
+
87
+ function sendNps() {
88
+ tracker?.trackFeedback("nps-card", 5, "Great onboarding flow");
89
+ }
90
+ </script>
91
+ ```
92
+
93
+ ## Quick start (React)
94
+
95
+ Import from `@tekibo/feedpulse-sdk/react`:
96
+
97
+ ```tsx
98
+ import { FeedPulseProvider, FeedPulseWidget, useFeedPulse } from "@tekibo/feedpulse-sdk/react";
99
+
100
+ function SaveButton() {
101
+ const { tracker } = useFeedPulse();
102
+
103
+ return (
104
+ <button
105
+ data-fp-id="settings-save"
106
+ onClick={() => tracker?.trackFeedback("settings-save", 5, "Saved successfully")}
107
+ >
108
+ Save
109
+ </button>
110
+ );
111
+ }
112
+
113
+ export default function App() {
114
+ return (
115
+ <FeedPulseProvider apiKey="fp_live_your_project_key">
116
+ <button data-fp-id="hero-cta">Get Started</button>
117
+ <SaveButton />
118
+ <FeedPulseWidget id="global-feedback" position="bottom-right" />
119
+ </FeedPulseProvider>
120
+ );
121
+ }
122
+ ```
123
+
124
+ ## Core API
125
+
126
+ Import from `@tekibo/feedpulse-sdk`:
127
+
128
+ ```ts
129
+ import { FeedPulseTracker } from "@tekibo/feedpulse-sdk";
130
+ ```
131
+
132
+ `FeedPulseTracker` configuration:
133
+
134
+ - `apiKey: string` required
135
+ - `endpoint?: string` optional, defaults to `https://feedpulse.dev/api/ingest`
136
+ - `batchInterval?: number` optional, defaults to `5000` ms
137
+
138
+ Key methods:
139
+
140
+ - `init()` start listeners and batching
141
+ - `track(eventType, elementId, metadata?)` enqueue an event
142
+ - `trackFeedback(elementId, rating, message)` send feedback immediately
143
+ - `destroy()` stop listeners and flush queue
144
+
145
+ ## Widget props
146
+
147
+ Nuxt and React widgets support:
148
+
149
+ - `id?: string` element id used in feedback event
150
+ - `placeholder?: string` prompt text
151
+ - `position?: "bottom-right" | "bottom-left" | "inline"` default is `"bottom-right"`
152
+
153
+ ## Endpoint override
154
+
155
+ Use this when sending to staging/self-hosted backend:
156
+
157
+ ### Nuxt
158
+
159
+ ```vue
160
+ <FeedPulseProvider
161
+ api-key="fp_live_your_project_key"
162
+ endpoint="https://staging.your-domain.com/api/ingest"
163
+ >
164
+ <NuxtPage />
165
+ </FeedPulseProvider>
166
+ ```
167
+
168
+ ### React
169
+
170
+ ```tsx
171
+ <FeedPulseProvider
172
+ apiKey="fp_live_your_project_key"
173
+ endpoint="https://staging.your-domain.com/api/ingest"
174
+ >
175
+ {children}
176
+ </FeedPulseProvider>
177
+ ```
178
+
179
+ ## Integration checklist for your app
180
+
181
+ 1. Create a project in FeedPulse dashboard and copy the project API key
182
+ 2. Install package and add provider at root layout/app level
183
+ 3. Add `data-fp-id` to primary buttons, links, forms, and sections
184
+ 4. Optionally mount `FeedPulseWidget` for direct user feedback
185
+ 5. Verify data appears in FeedPulse dashboard analytics and feedback pages
186
+
187
+ ## Package exports
188
+
189
+ - `@tekibo/feedpulse-sdk` → core types + tracker
190
+ - `@tekibo/feedpulse-sdk/nuxt` → `FeedPulseProvider`, `FeedPulseWidget`, `useFeedPulse`
191
+ - `@tekibo/feedpulse-sdk/react` → `FeedPulseProvider`, `FeedPulseWidget`, `useFeedPulse`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekibo/feedpulse-sdk",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Embeddable analytics and feedback SDK for FeedPulse",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",