@fluxyte/sdk 0.3.0 → 0.3.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.
- package/README.md +83 -0
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -26,6 +26,41 @@ Treat your API key like a password. Do not commit it to source control.
|
|
|
26
26
|
|
|
27
27
|
The SDK rejects `sk_*` keys in browser environments to prevent accidental exposure.
|
|
28
28
|
|
|
29
|
+
## Key Management
|
|
30
|
+
|
|
31
|
+
### Key Purpose
|
|
32
|
+
|
|
33
|
+
- `pk_*` (PUBLIC): for browser/frontend SDK usage.
|
|
34
|
+
- `sk_*` (SECRET): for backend/server usage only.
|
|
35
|
+
|
|
36
|
+
### How to get keys
|
|
37
|
+
|
|
38
|
+
1. Sign in to Fluxyte dashboard.
|
|
39
|
+
2. Go to `Account` -> `API Keys`.
|
|
40
|
+
3. Create a key and choose type:
|
|
41
|
+
- `PUBLIC (pk_*)` for frontend SDK traffic.
|
|
42
|
+
- `SECRET (sk_*)` for backend automation or server integrations.
|
|
43
|
+
4. Copy the key immediately (shown once).
|
|
44
|
+
|
|
45
|
+
### Allowed origins (PUBLIC keys)
|
|
46
|
+
|
|
47
|
+
For `pk_*` keys, configure allowed origins in dashboard (for example `https://app.example.com`).
|
|
48
|
+
This limits where browser-based SDK requests are accepted from.
|
|
49
|
+
|
|
50
|
+
### Rotation and revocation
|
|
51
|
+
|
|
52
|
+
- Rotate keys on a regular schedule (recommended every 60-90 days).
|
|
53
|
+
- Keep a short overlap window where old and new keys are both valid during rollout.
|
|
54
|
+
- Revoke keys immediately if exposed.
|
|
55
|
+
- Update environment variables and redeploy clients after rotation.
|
|
56
|
+
|
|
57
|
+
### Environment examples
|
|
58
|
+
|
|
59
|
+
- Frontend: `NEXT_PUBLIC_FLUXYTE_API_KEY=pk_...`
|
|
60
|
+
- Backend: `FLUXYTE_API_KEY=sk_...`
|
|
61
|
+
|
|
62
|
+
Never expose `sk_*` in browser bundles, client logs, or public repos.
|
|
63
|
+
|
|
29
64
|
## Choose An Entrypoint
|
|
30
65
|
|
|
31
66
|
The SDK ships multiple entrypoints, all with the same API surface:
|
|
@@ -136,6 +171,54 @@ Identity guidance:
|
|
|
136
171
|
|
|
137
172
|
## Onboarding Events
|
|
138
173
|
|
|
174
|
+
Events power onboarding analytics, drop-off detection, and AI insights.
|
|
175
|
+
|
|
176
|
+
Supported event types:
|
|
177
|
+
|
|
178
|
+
1. `FLOW_STARTED`
|
|
179
|
+
- User begins a tracked onboarding flow.
|
|
180
|
+
- Send once when the flow is entered.
|
|
181
|
+
|
|
182
|
+
2. `STEP_VIEWED`
|
|
183
|
+
- User lands on or opens a specific step.
|
|
184
|
+
- Send whenever the current step changes.
|
|
185
|
+
|
|
186
|
+
3. `STEP_COMPLETED`
|
|
187
|
+
- User successfully completes a step.
|
|
188
|
+
- Send only after verified completion signal.
|
|
189
|
+
|
|
190
|
+
4. `FLOW_COMPLETED`
|
|
191
|
+
- User completes all required steps in the flow.
|
|
192
|
+
- Send once at successful finish.
|
|
193
|
+
|
|
194
|
+
5. `ABANDONED`
|
|
195
|
+
- User exits/stalls before completion.
|
|
196
|
+
- Send when inactivity timeout or explicit exit indicates drop-off.
|
|
197
|
+
|
|
198
|
+
Recommended minimum context for event quality:
|
|
199
|
+
|
|
200
|
+
- `product` or `service`
|
|
201
|
+
- `userTarget`
|
|
202
|
+
- `flowSlug`
|
|
203
|
+
- `stepSlug` (for step-level events)
|
|
204
|
+
- stable identity (`context.sessionId` or `context.userId`)
|
|
205
|
+
|
|
206
|
+
Typical event sequence:
|
|
207
|
+
|
|
208
|
+
1. `FLOW_STARTED`
|
|
209
|
+
2. `STEP_VIEWED` (step 1)
|
|
210
|
+
3. `STEP_COMPLETED` (step 1)
|
|
211
|
+
4. `STEP_VIEWED` (step 2)
|
|
212
|
+
5. `STEP_COMPLETED` (step 2)
|
|
213
|
+
6. `FLOW_COMPLETED`
|
|
214
|
+
|
|
215
|
+
Drop-off sequence example:
|
|
216
|
+
|
|
217
|
+
1. `FLOW_STARTED`
|
|
218
|
+
2. `STEP_VIEWED` (step 1)
|
|
219
|
+
3. `STEP_VIEWED` (step 2)
|
|
220
|
+
4. `ABANDONED`
|
|
221
|
+
|
|
139
222
|
```ts
|
|
140
223
|
await client.sendEvent({
|
|
141
224
|
type: "STEP_COMPLETED",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluxyte/sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Official Fluxyte SDK (TypeScript) for the Fluxyte Onboarding AI API",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"type": "module",
|
|
@@ -56,4 +56,3 @@
|
|
|
56
56
|
"typescript": "^5.4.0"
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
|