@primexperts.co/pulse-agent 5.3.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 +48 -10
- package/docs/FAQ.md +1 -1
- package/docs/IMPLEMENTATION-GUIDE.md +52 -17
- package/docs/INTEGRATION-CHANNELS.md +1 -1
- package/docs/TROUBLESHOOTING.md +2 -2
- package/package.json +14 -6
package/README.md
CHANGED
|
@@ -59,19 +59,29 @@ The result is a team inbox model: one public channel for customers, multiple int
|
|
|
59
59
|
| WhatsApp | Planned/optional depending on deployment | WhatsApp contact path | Intended shared handling model when enabled; do not promise as active unless configured |
|
|
60
60
|
| Error Monitoring | Supported through this package | No visible customer UI | Browser exceptions and failed request reports tied to the website/application |
|
|
61
61
|
|
|
62
|
-
##
|
|
62
|
+
## Self-Service Setup
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
Pulse Agent is intended to be usable by any website owner who creates a Pulse workspace and enables Webchat.
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
Before adding the code snippet, do this in Pulse:
|
|
67
|
+
|
|
68
|
+
1. Create or sign in to your Pulse account.
|
|
69
|
+
2. Create your organization or workspace.
|
|
70
|
+
3. Create/select the application or website you want to connect.
|
|
71
|
+
4. Enable the Webchat integration.
|
|
72
|
+
5. Copy the generated setup values into your website environment/config.
|
|
73
|
+
6. Add your website origin, for example `https://www.example.com`, to the allowed origins/CORS settings if your Pulse deployment exposes that setting.
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
Use these values in your widget config:
|
|
76
|
+
|
|
77
|
+
| Value | Example | Required | How to get it |
|
|
78
|
+
| --- | --- | --- | --- |
|
|
79
|
+
| Organization slug | `acme-support` | Yes | Shown in Pulse for your organization/workspace. |
|
|
80
|
+
| Application key | `app_...` | Recommended when available | Copy from your Pulse application/webchat setup. |
|
|
81
|
+
| API base URL | `https://pulse.service.primexperts.co.za` | Yes | Use the API URL shown by your Pulse environment. |
|
|
82
|
+
| Website origin | `https://www.example.com` | Required for production | Add the exact site origin where the widget will run. |
|
|
74
83
|
|
|
84
|
+
You usually do not need a widget token. Pulse Agent resolves it automatically from your organization slug; when an application key is configured, the agent also sends it for app-aware deployments and reporting context.
|
|
75
85
|
## Configuration Keys
|
|
76
86
|
|
|
77
87
|
| Option | Type | Default | Description |
|
|
@@ -148,6 +158,21 @@ heroku config:set PULSE_AGENT_CAPTURE_FETCH_ERRORS=true
|
|
|
148
158
|
|
|
149
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.
|
|
150
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.
|
|
151
176
|
## Runtime Config Pattern
|
|
152
177
|
|
|
153
178
|
A common production-safe pattern is to load `/runtime-config.js` before your app bundle:
|
|
@@ -297,6 +322,19 @@ Do not confuse these values:
|
|
|
297
322
|
| `widgetToken` | Token generated by Pulse | Internal public webchat token used by endpoints | Usually leave unset. |
|
|
298
323
|
| `slug` | human-readable slug | Identifies organization | Put in config/env. |
|
|
299
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.
|
|
300
338
|
## Error Monitoring
|
|
301
339
|
|
|
302
340
|
Error monitoring is opt-in. Installing the package does not capture anything until `errorMonitoring: true` is passed to `createPulseAgent`.
|
|
@@ -363,7 +401,7 @@ Admin setup endpoints are separate and should remain authenticated.
|
|
|
363
401
|
- Framework-agnostic browser integration.
|
|
364
402
|
- Works with npm or a script tag.
|
|
365
403
|
- Supports runtime configuration, which is useful for Heroku, Docker, static hosting, and multi-environment deployments.
|
|
366
|
-
- Uses `slug
|
|
404
|
+
- Uses the organization `slug`, plus `appKey` when available, so users do not need to handle internal widget tokens.
|
|
367
405
|
- Supports visitor profile capture, history loading, transcript email requests, SSE replies, WhatsApp launcher/contact path where configured, manual open/close, and manual exception reporting.
|
|
368
406
|
- Supports operational workflows verified in the Pulse source: assignment, status/priority updates, internal notes, follow-ups, customer profiles, tags, notifications, activity logs, exports, and dashboard KPIs.
|
|
369
407
|
- Supports role-based team operation: admins manage setup and assignment, while agents work assigned conversations.
|
package/docs/FAQ.md
CHANGED
|
@@ -15,7 +15,7 @@ Do not use dashboard host URLs as API base URLs.
|
|
|
15
15
|
## What slug should I use?
|
|
16
16
|
|
|
17
17
|
Use the organization slug generated from organization name (lowercase, alphanumeric, hyphen-separated).
|
|
18
|
-
Example: `
|
|
18
|
+
Example: `Acme Support` -> `acme-support`
|
|
19
19
|
|
|
20
20
|
## Do users need to log in to use the widget?
|
|
21
21
|
|
|
@@ -32,16 +32,23 @@ The Pulse source supports more than a website chat bubble:
|
|
|
32
32
|
- Error monitoring can post browser error reports to Pulse and feed dashboard summaries.
|
|
33
33
|
|
|
34
34
|
This is why the strongest positioning is: Pulse Agent gets the customer conversation or browser issue into Pulse; Pulse gives the team a controlled workspace to manage it together.
|
|
35
|
-
## 2.
|
|
35
|
+
## 2. Self-Service Pulse Setup
|
|
36
|
+
|
|
37
|
+
Pulse Agent is intended for any website owner. Start in Pulse, then copy the values into your website config.
|
|
38
|
+
|
|
39
|
+
1. Create or sign in to your Pulse account.
|
|
40
|
+
2. Create your organization or workspace.
|
|
41
|
+
3. Create/select the application or website you want to connect.
|
|
42
|
+
4. Enable Webchat.
|
|
43
|
+
5. Copy the generated slug and application key, when available.
|
|
44
|
+
6. Add your website origin to the allowed origins/CORS settings if your Pulse environment exposes that setting.
|
|
36
45
|
|
|
37
46
|
| Value | Required | Example | Notes |
|
|
38
47
|
| --- | --- | --- | --- |
|
|
39
|
-
| `slug` | Yes | `
|
|
40
|
-
| `appKey` | Recommended | `app_abc123...` |
|
|
41
|
-
| `apiBaseUrl` | Yes | `https://pulse.service.primexperts.co.za` |
|
|
42
|
-
| Website origin |
|
|
43
|
-
|
|
44
|
-
The `appKey` is the value that starts with `app_`. It is not the same as `widgetToken`.
|
|
48
|
+
| `slug` | Yes | `acme-support` | Organization/workspace slug shown in Pulse. |
|
|
49
|
+
| `appKey` | Recommended when available | `app_abc123...` | Application key copied from Pulse setup. The agent sends it when present for app-aware deployments and reporting context. |
|
|
50
|
+
| `apiBaseUrl` | Yes | `https://pulse.service.primexperts.co.za` | Use the API URL shown by your Pulse environment. Do not add `/api`. |
|
|
51
|
+
| Website origin | Production only | `https://app.example.com` | Exact site origin where the widget runs. |
|
|
45
52
|
|
|
46
53
|
A `widgetToken` is normally resolved automatically by Pulse from the organization `slug`; when `appKey` is configured, the agent also sends it for app-aware deployments. Do not configure `widgetToken` unless Pulse explicitly provides a token for a special case.
|
|
47
54
|
|
|
@@ -63,22 +70,35 @@ For script-tag usage:
|
|
|
63
70
|
import { createPulseAgent } from '@primexperts.co/pulse-agent';
|
|
64
71
|
|
|
65
72
|
createPulseAgent({
|
|
66
|
-
slug: '
|
|
73
|
+
slug: 'acme-support',
|
|
67
74
|
appKey: 'app_your_public_application_key',
|
|
68
75
|
apiBaseUrl: 'https://pulse.service.primexperts.co.za',
|
|
69
|
-
title: '
|
|
76
|
+
title: 'Acme Support',
|
|
70
77
|
requireProfile: true,
|
|
71
78
|
autoOpen: false
|
|
72
79
|
});
|
|
73
80
|
```
|
|
74
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.
|
|
75
95
|
## 5. Error Monitoring Configuration
|
|
76
96
|
|
|
77
97
|
Error monitoring is off by default. Enable it explicitly:
|
|
78
98
|
|
|
79
99
|
```ts
|
|
80
100
|
createPulseAgent({
|
|
81
|
-
slug: '
|
|
101
|
+
slug: 'acme-support',
|
|
82
102
|
appKey: 'app_your_public_application_key',
|
|
83
103
|
apiBaseUrl: 'https://pulse.service.primexperts.co.za',
|
|
84
104
|
errorMonitoring: true,
|
|
@@ -102,7 +122,7 @@ Manual capture:
|
|
|
102
122
|
|
|
103
123
|
```ts
|
|
104
124
|
const agent = createPulseAgent({
|
|
105
|
-
slug: '
|
|
125
|
+
slug: 'acme-support',
|
|
106
126
|
appKey: 'app_your_public_application_key',
|
|
107
127
|
apiBaseUrl: 'https://pulse.service.primexperts.co.za',
|
|
108
128
|
errorMonitoring: true
|
|
@@ -126,10 +146,10 @@ try {
|
|
|
126
146
|
Use these names in Heroku, Docker, CI, or your hosting platform:
|
|
127
147
|
|
|
128
148
|
```env
|
|
129
|
-
PULSE_AGENT_SLUG=
|
|
149
|
+
PULSE_AGENT_SLUG=acme-support
|
|
130
150
|
PULSE_AGENT_APP_KEY=app_your_public_application_key
|
|
131
151
|
PULSE_AGENT_API_BASE_URL=https://pulse.service.primexperts.co.za
|
|
132
|
-
PULSE_AGENT_TITLE=
|
|
152
|
+
PULSE_AGENT_TITLE=Acme Support
|
|
133
153
|
PULSE_AGENT_ENVIRONMENT=production
|
|
134
154
|
PULSE_AGENT_RELEASE=web-1.0.0
|
|
135
155
|
|
|
@@ -153,6 +173,21 @@ PULSE_AGENT_WIDGET_TOKEN=
|
|
|
153
173
|
|
|
154
174
|
Leave `PULSE_AGENT_WIDGET_TOKEN` empty unless Pulse tells you to use it.
|
|
155
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.
|
|
156
191
|
## 7. Runtime Config Setup
|
|
157
192
|
|
|
158
193
|
Frontend bundles usually cannot read platform environment variables directly at runtime. Use a runtime config file generated from environment variables.
|
|
@@ -168,10 +203,10 @@ Example `runtime-config.js` output:
|
|
|
168
203
|
```js
|
|
169
204
|
window.__APP_RUNTIME_CONFIG__ = {
|
|
170
205
|
pulseAgent: {
|
|
171
|
-
slug: '
|
|
206
|
+
slug: 'acme-support',
|
|
172
207
|
appKey: 'app_your_public_application_key',
|
|
173
208
|
apiBaseUrl: 'https://pulse.service.primexperts.co.za',
|
|
174
|
-
title: '
|
|
209
|
+
title: 'Acme Support',
|
|
175
210
|
errorMonitoring: true,
|
|
176
211
|
captureUnhandledErrors: true,
|
|
177
212
|
captureUnhandledRejections: true,
|
|
@@ -210,10 +245,10 @@ if (pulseAgentConfig?.slug) {
|
|
|
210
245
|
Set config vars:
|
|
211
246
|
|
|
212
247
|
```bash
|
|
213
|
-
heroku config:set PULSE_AGENT_SLUG=
|
|
248
|
+
heroku config:set PULSE_AGENT_SLUG=acme-support
|
|
214
249
|
heroku config:set PULSE_AGENT_APP_KEY=app_your_public_application_key
|
|
215
250
|
heroku config:set PULSE_AGENT_API_BASE_URL=https://pulse.service.primexperts.co.za
|
|
216
|
-
heroku config:set PULSE_AGENT_TITLE=
|
|
251
|
+
heroku config:set PULSE_AGENT_TITLE=Acme Support
|
|
217
252
|
heroku config:set PULSE_AGENT_ENVIRONMENT=production
|
|
218
253
|
heroku config:set PULSE_AGENT_ERROR_MONITORING=true
|
|
219
254
|
heroku config:set PULSE_AGENT_CAPTURE_UNHANDLED_ERRORS=true
|
|
@@ -47,7 +47,7 @@ This guide documents how to integrate Pulse by channel type and which technologi
|
|
|
47
47
|
import { createPulseAgent } from '@primexperts.co/pulse-agent';
|
|
48
48
|
|
|
49
49
|
createPulseAgent({
|
|
50
|
-
slug: '
|
|
50
|
+
slug: 'acme-support',
|
|
51
51
|
apiBaseUrl: 'https://pulse.service.primexperts.co.za',
|
|
52
52
|
requireProfile: true
|
|
53
53
|
});
|
package/docs/TROUBLESHOOTING.md
CHANGED
|
@@ -71,11 +71,11 @@ regexp_replace(
|
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
Then:
|
|
74
|
-
- `
|
|
74
|
+
- `Acme Support` -> `acme-support`
|
|
75
75
|
|
|
76
76
|
Resolve URL:
|
|
77
77
|
|
|
78
|
-
`https://pulse.service.primexperts.co.za/api/pulse/public/webchat/resolve?slug=
|
|
78
|
+
`https://pulse.service.primexperts.co.za/api/pulse/public/webchat/resolve?slug=acme-support`
|
|
79
79
|
|
|
80
80
|
## 8) Quick verification checklist
|
|
81
81
|
|
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
|
}
|