@primexperts.co/pulse-agent 5.4.0 → 5.6.0
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 +28 -0
- package/docs/IMPLEMENTATION-GUIDE.md +28 -0
- package/package.json +14 -6
package/README.md
CHANGED
|
@@ -158,6 +158,21 @@ heroku config:set PULSE_AGENT_CAPTURE_FETCH_ERRORS=true
|
|
|
158
158
|
|
|
159
159
|
If your app uses a `runtime-config.js` file, make sure Heroku serves that file from environment values at request time or regenerates it during build/startup.
|
|
160
160
|
|
|
161
|
+
## Required Code Structure
|
|
162
|
+
|
|
163
|
+
Pulse Agent does not require a special framework architecture, but it does need one clear bootstrap point.
|
|
164
|
+
|
|
165
|
+
Structure your app so `createPulseAgent(...)` runs:
|
|
166
|
+
|
|
167
|
+
- once per page/app session;
|
|
168
|
+
- only in the browser, never during server-side rendering;
|
|
169
|
+
- as early as practical after runtime config is available;
|
|
170
|
+
- before the user flows you want error monitoring to observe;
|
|
171
|
+
- from a stable root entry point such as `main.ts`, `App.tsx`, a root layout client component, `onMounted`, or a script loaded after `/runtime-config.js`.
|
|
172
|
+
|
|
173
|
+
Do not initialize Pulse Agent inside frequently re-rendered child components, route components that mount repeatedly, button click handlers, or server-only files. If the root component can unmount, keep the returned handle and call `agent.destroy()` during cleanup.
|
|
174
|
+
|
|
175
|
+
For error monitoring, timing matters: errors that happen before `createPulseAgent(...)` runs cannot be captured by Pulse Agent. If you want broad coverage, load runtime config first and initialize Pulse Agent before bootstrapping the rest of the application where your framework allows it.
|
|
161
176
|
## Runtime Config Pattern
|
|
162
177
|
|
|
163
178
|
A common production-safe pattern is to load `/runtime-config.js` before your app bundle:
|
|
@@ -307,6 +322,19 @@ Do not confuse these values:
|
|
|
307
322
|
| `widgetToken` | Token generated by Pulse | Internal public webchat token used by endpoints | Usually leave unset. |
|
|
308
323
|
| `slug` | human-readable slug | Identifies organization | Put in config/env. |
|
|
309
324
|
|
|
325
|
+
## Network Access and Security Scanners
|
|
326
|
+
|
|
327
|
+
Security scanners such as Socket may flag this package for network access. That is expected and intentional.
|
|
328
|
+
|
|
329
|
+
Pulse Agent is a browser widget, so it uses standard browser networking APIs to provide its features:
|
|
330
|
+
|
|
331
|
+
- `fetch` resolves the active widget configuration.
|
|
332
|
+
- `fetch` sends visitor messages to Pulse.
|
|
333
|
+
- `fetch` loads conversation history and sends transcript/error-report requests.
|
|
334
|
+
- `EventSource` keeps the chat connected for realtime replies.
|
|
335
|
+
- Optional `fetch` wrapping reports failed website requests only when `errorMonitoring` and `captureFetchErrors` are enabled.
|
|
336
|
+
|
|
337
|
+
The package does not run install scripts, does not start background processes, does not open arbitrary sockets, and does not use Node filesystem or shell APIs at runtime. Network calls are made from the visitor's browser after the website initializes `createPulseAgent(...)`, and they target the configured `apiBaseUrl` plus optional WhatsApp links when configured.
|
|
310
338
|
## Error Monitoring
|
|
311
339
|
|
|
312
340
|
Error monitoring is opt-in. Installing the package does not capture anything until `errorMonitoring: true` is passed to `createPulseAgent`.
|
|
@@ -79,6 +79,19 @@ createPulseAgent({
|
|
|
79
79
|
});
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
+
## Network Access and Security Scanners
|
|
83
|
+
|
|
84
|
+
Security scanners such as Socket may flag this package for network access. That is expected and intentional.
|
|
85
|
+
|
|
86
|
+
Pulse Agent is a browser widget, so it uses standard browser networking APIs to provide its features:
|
|
87
|
+
|
|
88
|
+
- `fetch` resolves the active widget configuration.
|
|
89
|
+
- `fetch` sends visitor messages to Pulse.
|
|
90
|
+
- `fetch` loads conversation history and sends transcript/error-report requests.
|
|
91
|
+
- `EventSource` keeps the chat connected for realtime replies.
|
|
92
|
+
- Optional `fetch` wrapping reports failed website requests only when `errorMonitoring` and `captureFetchErrors` are enabled.
|
|
93
|
+
|
|
94
|
+
The package does not run install scripts, does not start background processes, does not open arbitrary sockets, and does not use Node filesystem or shell APIs at runtime. Network calls are made from the visitor's browser after the website initializes `createPulseAgent(...)`, and they target the configured `apiBaseUrl` plus optional WhatsApp links when configured.
|
|
82
95
|
## 5. Error Monitoring Configuration
|
|
83
96
|
|
|
84
97
|
Error monitoring is off by default. Enable it explicitly:
|
|
@@ -160,6 +173,21 @@ PULSE_AGENT_WIDGET_TOKEN=
|
|
|
160
173
|
|
|
161
174
|
Leave `PULSE_AGENT_WIDGET_TOKEN` empty unless Pulse tells you to use it.
|
|
162
175
|
|
|
176
|
+
## Required Code Structure
|
|
177
|
+
|
|
178
|
+
Pulse Agent does not require a special framework architecture, but it does need one clear bootstrap point.
|
|
179
|
+
|
|
180
|
+
Structure your app so `createPulseAgent(...)` runs:
|
|
181
|
+
|
|
182
|
+
- once per page/app session;
|
|
183
|
+
- only in the browser, never during server-side rendering;
|
|
184
|
+
- as early as practical after runtime config is available;
|
|
185
|
+
- before the user flows you want error monitoring to observe;
|
|
186
|
+
- from a stable root entry point such as `main.ts`, `App.tsx`, a root layout client component, `onMounted`, or a script loaded after `/runtime-config.js`.
|
|
187
|
+
|
|
188
|
+
Do not initialize Pulse Agent inside frequently re-rendered child components, route components that mount repeatedly, button click handlers, or server-only files. If the root component can unmount, keep the returned handle and call `agent.destroy()` during cleanup.
|
|
189
|
+
|
|
190
|
+
For error monitoring, timing matters: errors that happen before `createPulseAgent(...)` runs cannot be captured by Pulse Agent. If you want broad coverage, load runtime config first and initialize Pulse Agent before bootstrapping the rest of the application where your framework allows it.
|
|
163
191
|
## 7. Runtime Config Setup
|
|
164
192
|
|
|
165
193
|
Frontend bundles usually cannot read platform environment variables directly at runtime. Use a runtime config file generated from environment variables.
|
package/package.json
CHANGED
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primexperts.co/pulse-agent",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "Embeddable Pulse floating chat agent widget.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
8
12
|
"exports": {
|
|
9
13
|
".": {
|
|
10
14
|
"types": "./dist/index.d.ts",
|
|
11
15
|
"default": "./dist/index.js"
|
|
12
|
-
}
|
|
16
|
+
},
|
|
17
|
+
"./browser": "./dist/browser/pulse-agent.global.js"
|
|
13
18
|
},
|
|
14
19
|
"files": [
|
|
15
|
-
"dist",
|
|
20
|
+
"dist/index.js",
|
|
21
|
+
"dist/index.js.map",
|
|
22
|
+
"dist/index.d.ts",
|
|
23
|
+
"dist/index.d.ts.map",
|
|
24
|
+
"dist/widget",
|
|
25
|
+
"dist/browser/pulse-agent.global.js",
|
|
16
26
|
"docs",
|
|
17
27
|
"README.md",
|
|
18
28
|
"LICENSE"
|
|
@@ -31,9 +41,7 @@
|
|
|
31
41
|
"private": false,
|
|
32
42
|
"license": "MIT",
|
|
33
43
|
"author": "PrimExperts",
|
|
34
|
-
"dependencies": {
|
|
35
|
-
"tslib": "^2.8.1"
|
|
36
|
-
},
|
|
44
|
+
"dependencies": {},
|
|
37
45
|
"devDependencies": {
|
|
38
46
|
"typescript": "~5.8.2"
|
|
39
47
|
}
|