@primexperts.co/pulse-agent 5.2.0 → 5.4.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 CHANGED
@@ -36,19 +36,52 @@ const agent = createPulseAgent({
36
36
  agent.open();
37
37
  ```
38
38
 
39
- ## What You Need From Pulse
39
+ ## Why Teams Use Pulse Agent
40
40
 
41
- You need these values before going live:
41
+ Pulse Agent is useful when a business has customer messages arriving through public-facing channels, but the team needs a controlled place to handle them.
42
42
 
43
- | Value | Example | Required | Where it comes from |
43
+ Typical use cases:
44
+
45
+ - A website visitor starts a chat and any available team member can respond from Pulse.
46
+ - A support mailbox can be connected so the team manages customer email from a shared workspace instead of one person's inbox.
47
+ - Conversation history stays attached to the customer interaction, so the next team member can continue with context.
48
+ - Teams can separate customer communication by organization/application using the `slug` and `appKey`.
49
+ - Website errors can be reported into Pulse so support and operations can see when customers are affected.
50
+
51
+ The result is a team inbox model: one public channel for customers, multiple internal users for response and follow-up.
52
+
53
+ ## Channel Model
54
+
55
+ | Channel | Current role | What the customer sees | What the team gets in Pulse |
44
56
  | --- | --- | --- | --- |
45
- | Organization slug | `vayakids` | Yes | Pulse organization/webchat setup |
46
- | Application key | `app_...` | Recommended | Pulse Dashboard application/webchat setup |
47
- | API base URL | `https://pulse.service.primexperts.co.za` | Yes | Pulse production API host |
48
- | Allowed website origin | `https://www.example.com` | Yes | Must be allowed by Pulse CORS/backend configuration |
57
+ | Webchat | Supported through this package | Website chat launcher | Shared conversation thread, visitor profile, realtime replies, history, transcript action |
58
+ | Email | Supported by Pulse integrations | Normal support email address | Shared email conversations in Pulse, independent of one person's mailbox |
59
+ | WhatsApp | Planned/optional depending on deployment | WhatsApp contact path | Intended shared handling model when enabled; do not promise as active unless configured |
60
+ | Error Monitoring | Supported through this package | No visible customer UI | Browser exceptions and failed request reports tied to the website/application |
61
+
62
+ ## Self-Service Setup
63
+
64
+ Pulse Agent is intended to be usable by any website owner who creates a Pulse workspace and enables Webchat.
49
65
 
50
- You usually do not need a widget token. The widget resolves it automatically by calling Pulse with your `slug` and `appKey`.
66
+ Before adding the code snippet, do this in Pulse:
51
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.
74
+
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. |
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.
52
85
  ## Configuration Keys
53
86
 
54
87
  | Option | Type | Default | Description |
@@ -261,7 +294,7 @@ onBeforeUnmount(() => agent?.destroy());
261
294
  At startup or first send, Pulse Agent calls:
262
295
 
263
296
  ```text
264
- GET /api/pulse/public/webchat/resolve?slug=<slug>&appKey=<app_...>
297
+ GET /api/pulse/public/webchat/resolve?slug=<slug>[&appKey=<app_...>]
265
298
  ```
266
299
 
267
300
  Pulse returns the active widget configuration, including an internal `widgetToken`. The widget then uses that token for chat, history, streaming, transcript email, and error reporting.
@@ -324,7 +357,7 @@ Pulse Agent does not:
324
357
  The widget expects these Pulse endpoints:
325
358
 
326
359
  ```text
327
- GET /api/pulse/public/webchat/resolve?slug=<slug>&appKey=<appKey>
360
+ GET /api/pulse/public/webchat/resolve?slug=<slug>[&appKey=<appKey>]
328
361
  POST /api/pulse/public/webchat/{widgetToken}/message
329
362
  GET /api/pulse/public/webchat/{widgetToken}/messages?conversationId=<id>
330
363
  POST /api/pulse/public/webchat/{widgetToken}/transcript-email?conversationId=<id>
@@ -340,8 +373,10 @@ Admin setup endpoints are separate and should remain authenticated.
340
373
  - Framework-agnostic browser integration.
341
374
  - Works with npm or a script tag.
342
375
  - Supports runtime configuration, which is useful for Heroku, Docker, static hosting, and multi-environment deployments.
343
- - Uses `slug` + `appKey` so users do not need to handle internal widget tokens.
344
- - Supports visitor profile capture, history loading, transcript email requests, SSE replies, WhatsApp launcher, manual open/close, and manual exception reporting.
376
+ - Uses the organization `slug`, plus `appKey` when available, so users do not need to handle internal widget tokens.
377
+ - Supports visitor profile capture, history loading, transcript email requests, SSE replies, WhatsApp launcher/contact path where configured, manual open/close, and manual exception reporting.
378
+ - 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.
379
+ - Supports role-based team operation: admins manage setup and assignment, while agents work assigned conversations.
345
380
 
346
381
  ## Limitations
347
382
 
@@ -395,7 +430,7 @@ The public resolve endpoint is protected or the key is not accepted. Confirm the
395
430
 
396
431
  ### `Failed to resolve widget keys (404)`
397
432
 
398
- The slug is wrong, webchat is not enabled, or the selected application has no active widget.
433
+ The slug is wrong, Webchat is not enabled, or the selected organization/application has no active widget.
399
434
 
400
435
  ### CORS error in the browser console
401
436
 
@@ -412,34 +447,4 @@ Confirm all of the following:
412
447
  - `errorMonitoring: true` is present in runtime config.
413
448
  - The widget successfully resolves a widget token.
414
449
  - The error happens after `createPulseAgent(...)` runs.
415
- - The browser can post to `/api/pulse/public/webchat/{widgetToken}/errors`.
416
-
417
- ## Additional Documentation
418
-
419
- - `docs/IMPLEMENTATION-GUIDE.md` for end-to-end setup examples.
420
- - `docs/TROUBLESHOOTING.md` for diagnostics.
421
- - `docs/FAQ.md` for common questions.
422
- - `docs/INTEGRATION-CHANNELS.md` for channel-level implementation notes.
423
-
424
- ## Build and Publish
425
-
426
- ```bash
427
- npm run build
428
- npm publish --access public
429
- ```
430
-
431
- Build output includes:
432
-
433
- - ESM and type declarations in `dist/`.
434
- - Browser global bundle in `dist/browser/pulse-agent.global.js`.
435
-
436
- ## Versioning
437
-
438
- Use the built-in version script instead of editing package files manually:
439
-
440
- ```bash
441
- npm run version:patch
442
- npm run version:minor
443
- npm run version:major
444
- npm run version:bump -- 1.2.3
445
- ```
450
+ - The browser can post to `/api/pulse/public/webchat/{widgetToken}/errors`.
@@ -0,0 +1,42 @@
1
+ # Pulse Agent Developer Notes
2
+
3
+ This document is for maintainers of `@primexperts.co/pulse-agent`. It is not required for customers installing the widget.
4
+
5
+ ## Repository Documentation
6
+
7
+ - `docs/IMPLEMENTATION-GUIDE.md` - end-to-end setup examples and deployment guidance.
8
+ - `docs/TROUBLESHOOTING.md` - diagnostics for CORS, resolve failures, streaming, and monitoring.
9
+ - `docs/FAQ.md` - common integration questions.
10
+ - `docs/INTEGRATION-CHANNELS.md` - channel-level implementation notes.
11
+
12
+ ## Build
13
+
14
+ ```bash
15
+ npm run build
16
+ ```
17
+
18
+ Build output includes:
19
+
20
+ - ESM and type declarations in `dist/`.
21
+ - Browser global bundle in `dist/browser/pulse-agent.global.js`.
22
+
23
+ ## Publish
24
+
25
+ ```bash
26
+ npm publish --access public
27
+ ```
28
+
29
+ `prepublishOnly` runs the build before publishing.
30
+
31
+ ## Versioning
32
+
33
+ Use the built-in version script instead of editing package files manually:
34
+
35
+ ```bash
36
+ npm run version:patch
37
+ npm run version:minor
38
+ npm run version:major
39
+ npm run version:bump -- 1.2.3
40
+ ```
41
+
42
+ This updates both `package.json` and `package-lock.json` when the script is used.
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: `PrimeXperts` -> `primexperts`
18
+ Example: `Acme Support` -> `acme-support`
19
19
 
20
20
  ## Do users need to log in to use the widget?
21
21
 
@@ -1,6 +1,6 @@
1
1
  # Pulse Agent Implementation Guide
2
2
 
3
- This guide explains how to add Pulse Agent to a website, configure it from environment variables, enable browser error monitoring, and verify the integration before production release.
3
+ This guide explains how to add Pulse Agent to a website, configure it from environment variables, enable browser error monitoring, and verify the integration before production release. It also explains the bigger product model: Pulse Agent is the website entry point into a shared Pulse workspace where multiple users can manage customer conversations from connected channels.
4
4
 
5
5
  ## 1. What Pulse Agent Does
6
6
 
@@ -12,23 +12,45 @@ Pulse Agent is a browser widget for public websites. It provides:
12
12
  - Conversation history loading.
13
13
  - Realtime replies through Server-Sent Events.
14
14
  - Optional transcript/follow-up email action.
15
- - Optional WhatsApp launcher.
15
+ - Optional WhatsApp launcher/contact path where configured; full WhatsApp shared-inbox handling should be described only when enabled for that deployment.
16
16
  - Optional website error monitoring for browser exceptions and failed fetch calls.
17
17
 
18
18
  Installing the package only makes the code available. The widget and error monitoring start only after your app calls `createPulseAgent(...)` with valid configuration.
19
19
 
20
- ## 2. Required Pulse Values
20
+ ## 1.1. Source-Verified Product Capabilities
21
+
22
+ The Pulse source supports more than a website chat bubble:
23
+
24
+ - Authenticated Pulse users can work from an Inbox.
25
+ - Admins can assign or reassign conversations.
26
+ - Agents are assignment-scoped in the current role model.
27
+ - Team members can reply to conversations and add internal notes.
28
+ - Conversations support status, priority, activity, tags, follow-ups, quotes, and customer profiles.
29
+ - Dashboard views show open/pending conversations, team load, and error summaries.
30
+ - Email integrations can connect an inbox through IMAPS polling and convert unread mail into Pulse conversations.
31
+ - Webchat uses public visitor endpoints, rate limiting, history, and SSE streaming.
32
+ - Error monitoring can post browser error reports to Pulse and feed dashboard summaries.
33
+
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. 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.
21
45
 
22
46
  | Value | Required | Example | Notes |
23
47
  | --- | --- | --- | --- |
24
- | `slug` | Yes | `vayakids` | Public organization slug. |
25
- | `appKey` | Recommended | `app_abc123...` | Public application key from Pulse Dashboard. |
26
- | `apiBaseUrl` | Yes | `https://pulse.service.primexperts.co.za` | Host only; do not add `/api`. |
27
- | Website origin | Yes | `https://app.example.com` | Must be allowed by Pulse CORS/backend configuration. |
28
-
29
- 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. |
30
52
 
31
- A `widgetToken` is normally resolved automatically by Pulse. Do not configure it unless Pulse explicitly provides a token for a special case.
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.
32
54
 
33
55
  ## 3. Install
34
56
 
@@ -48,10 +70,10 @@ For script-tag usage:
48
70
  import { createPulseAgent } from '@primexperts.co/pulse-agent';
49
71
 
50
72
  createPulseAgent({
51
- slug: 'vayakids',
73
+ slug: 'acme-support',
52
74
  appKey: 'app_your_public_application_key',
53
75
  apiBaseUrl: 'https://pulse.service.primexperts.co.za',
54
- title: 'VayaKids',
76
+ title: 'Acme Support',
55
77
  requireProfile: true,
56
78
  autoOpen: false
57
79
  });
@@ -63,7 +85,7 @@ Error monitoring is off by default. Enable it explicitly:
63
85
 
64
86
  ```ts
65
87
  createPulseAgent({
66
- slug: 'vayakids',
88
+ slug: 'acme-support',
67
89
  appKey: 'app_your_public_application_key',
68
90
  apiBaseUrl: 'https://pulse.service.primexperts.co.za',
69
91
  errorMonitoring: true,
@@ -87,7 +109,7 @@ Manual capture:
87
109
 
88
110
  ```ts
89
111
  const agent = createPulseAgent({
90
- slug: 'vayakids',
112
+ slug: 'acme-support',
91
113
  appKey: 'app_your_public_application_key',
92
114
  apiBaseUrl: 'https://pulse.service.primexperts.co.za',
93
115
  errorMonitoring: true
@@ -111,10 +133,10 @@ try {
111
133
  Use these names in Heroku, Docker, CI, or your hosting platform:
112
134
 
113
135
  ```env
114
- PULSE_AGENT_SLUG=vayakids
136
+ PULSE_AGENT_SLUG=acme-support
115
137
  PULSE_AGENT_APP_KEY=app_your_public_application_key
116
138
  PULSE_AGENT_API_BASE_URL=https://pulse.service.primexperts.co.za
117
- PULSE_AGENT_TITLE=VayaKids
139
+ PULSE_AGENT_TITLE=Acme Support
118
140
  PULSE_AGENT_ENVIRONMENT=production
119
141
  PULSE_AGENT_RELEASE=web-1.0.0
120
142
 
@@ -153,10 +175,10 @@ Example `runtime-config.js` output:
153
175
  ```js
154
176
  window.__APP_RUNTIME_CONFIG__ = {
155
177
  pulseAgent: {
156
- slug: 'vayakids',
178
+ slug: 'acme-support',
157
179
  appKey: 'app_your_public_application_key',
158
180
  apiBaseUrl: 'https://pulse.service.primexperts.co.za',
159
- title: 'VayaKids',
181
+ title: 'Acme Support',
160
182
  errorMonitoring: true,
161
183
  captureUnhandledErrors: true,
162
184
  captureUnhandledRejections: true,
@@ -195,10 +217,10 @@ if (pulseAgentConfig?.slug) {
195
217
  Set config vars:
196
218
 
197
219
  ```bash
198
- heroku config:set PULSE_AGENT_SLUG=vayakids
220
+ heroku config:set PULSE_AGENT_SLUG=acme-support
199
221
  heroku config:set PULSE_AGENT_APP_KEY=app_your_public_application_key
200
222
  heroku config:set PULSE_AGENT_API_BASE_URL=https://pulse.service.primexperts.co.za
201
- heroku config:set PULSE_AGENT_TITLE=VayaKids
223
+ heroku config:set PULSE_AGENT_TITLE=Acme Support
202
224
  heroku config:set PULSE_AGENT_ENVIRONMENT=production
203
225
  heroku config:set PULSE_AGENT_ERROR_MONITORING=true
204
226
  heroku config:set PULSE_AGENT_CAPTURE_UNHANDLED_ERRORS=true
@@ -235,7 +257,7 @@ Use the browser global bundle and call `window.PulseAgent.createPulseAgent(...)`
235
257
  Pulse Agent calls these public endpoints:
236
258
 
237
259
  ```text
238
- GET /api/pulse/public/webchat/resolve?slug=<slug>&appKey=<appKey>
260
+ GET /api/pulse/public/webchat/resolve?slug=<slug>[&appKey=<appKey>]
239
261
  POST /api/pulse/public/webchat/{widgetToken}/message
240
262
  GET /api/pulse/public/webchat/{widgetToken}/messages?conversationId=<id>
241
263
  POST /api/pulse/public/webchat/{widgetToken}/transcript-email?conversationId=<id>
@@ -270,7 +292,7 @@ These endpoints are public by design for website visitors. Admin setup endpoints
270
292
  ## 13. Verification Checklist
271
293
 
272
294
  1. Open the site and confirm the Pulse launcher appears.
273
- 2. In browser dev tools, confirm `resolve?slug=...&appKey=...` succeeds.
295
+ 2. In browser dev tools, confirm `resolve?slug=...` succeeds; if your deployment uses app keys, confirm `appKey=...` is included.
274
296
  3. Send a test message and confirm `message` succeeds.
275
297
  4. Confirm `stream` is open and receives replies.
276
298
  5. If history is enabled, confirm `messages?conversationId=...` succeeds.
@@ -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: 'primexperts',
50
+ slug: 'acme-support',
51
51
  apiBaseUrl: 'https://pulse.service.primexperts.co.za',
52
52
  requireProfile: true
53
53
  });
@@ -71,11 +71,11 @@ regexp_replace(
71
71
  ```
72
72
 
73
73
  Then:
74
- - `PrimeXperts` -> `primexperts`
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=primexperts`
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,40 +1,40 @@
1
- {
2
- "name": "@primexperts.co/pulse-agent",
3
- "version": "5.2.0",
4
- "description": "Embeddable Pulse floating chat agent widget.",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "default": "./dist/index.js"
12
- }
13
- },
14
- "files": [
15
- "dist",
16
- "docs",
17
- "README.md",
18
- "LICENSE"
19
- ],
20
- "scripts": {
21
- "clean": "node -e \"if(require('fs').existsSync('dist')) require('fs').rmSync('dist',{recursive:true,force:true})\"",
22
- "build:types": "tsc -p tsconfig.build.json",
23
- "build:browser": "node scripts/build-browser-global.mjs",
24
- "build": "npm run clean && npm run build:types && npm run build:browser",
25
- "version:bump": "node scripts/bump-version.mjs",
26
- "version:patch": "node scripts/bump-version.mjs patch",
27
- "version:minor": "node scripts/bump-version.mjs minor",
28
- "version:major": "node scripts/bump-version.mjs major",
29
- "prepublishOnly": "npm run build"
30
- },
31
- "private": false,
32
- "license": "MIT",
33
- "author": "PrimExperts",
34
- "dependencies": {
35
- "tslib": "^2.8.1"
36
- },
37
- "devDependencies": {
38
- "typescript": "~5.8.2"
39
- }
40
- }
1
+ {
2
+ "name": "@primexperts.co/pulse-agent",
3
+ "version": "5.4.0",
4
+ "description": "Embeddable Pulse floating chat agent widget.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "docs",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "scripts": {
21
+ "clean": "node -e \"if(require('fs').existsSync('dist')) require('fs').rmSync('dist',{recursive:true,force:true})\"",
22
+ "build:types": "tsc -p tsconfig.build.json",
23
+ "build:browser": "node scripts/build-browser-global.mjs",
24
+ "build": "npm run clean && npm run build:types && npm run build:browser",
25
+ "version:bump": "node scripts/bump-version.mjs",
26
+ "version:patch": "node scripts/bump-version.mjs patch",
27
+ "version:minor": "node scripts/bump-version.mjs minor",
28
+ "version:major": "node scripts/bump-version.mjs major",
29
+ "prepublishOnly": "npm run build"
30
+ },
31
+ "private": false,
32
+ "license": "MIT",
33
+ "author": "PrimExperts",
34
+ "dependencies": {
35
+ "tslib": "^2.8.1"
36
+ },
37
+ "devDependencies": {
38
+ "typescript": "~5.8.2"
39
+ }
40
+ }