@xapp/stentor-handler-contact-capture 1.85.7 → 1.85.9
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 +19 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
## @xapp/stentor-handler-contact-capture
|
|
2
|
+
|
|
3
|
+
Provides `ContactCaptureHandler`, a plain class (not an `AbstractHandler`) whose `sendLead()` takes the key/value pairs from a chat widget `FORM_SUBMIT` payload, splits them into lead fields and "extras" — tracking data such as UTM parameters, click IDs, and TrustedForm certificate URLs — and calls the configured CRM service's `send()` method with both.
|
|
4
|
+
|
|
5
|
+
### Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { ContactCaptureHandler } from "@xapp/stentor-handler-contact-capture";
|
|
9
|
+
|
|
10
|
+
const handler = new ContactCaptureHandler({
|
|
11
|
+
leadDataList: [{ name: "FIRST_NAME" }, { name: "PHONE" }, { name: "EMAIL" }],
|
|
12
|
+
crmService: myCrmService // any object implementing send(lead, extras)
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const result = await handler.sendLead(formSlots, requestAttributes, transcript);
|
|
16
|
+
// { status: string, message?: string }
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Slots matching a known tracking key (`utm_source`, `utm_campaign`, `utm_medium`, `utm_content`, `utm_term`, `gclid`, `fbclid`, `rwg_token`, `xxTrustedFormCertUrl`, `xxTrustedFormPingUrl`) always go to `extras`, with `requestAttributes` filling any keys missing from the form. Remaining slots named in `leadDataList` become `lead.fields`; if `leadDataList` is empty, every non-extra slot is sent, and empty values are skipped. Downstream integrations (e.g. `@xapp/stentor-service-boberdoo`) can then pass `extras` along to lead buyers. `sendLead()` returns `{ status: "Failure" }` instead of throwing when no `crmService` is configured or `send()` throws; otherwise it returns the CRM service's result.
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.85.
|
|
7
|
+
"version": "1.85.9",
|
|
8
8
|
"description": "Contact capture handler that routes form submissions to CRM services",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"main": "lib/index",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"chai": "4.5.0",
|
|
22
22
|
"mocha": "11.8.0",
|
|
23
23
|
"sinon": "21.0.0",
|
|
24
|
-
"stentor-logger": "1.74.
|
|
24
|
+
"stentor-logger": "1.74.11",
|
|
25
25
|
"ts-node": "10.9.2",
|
|
26
26
|
"typescript": "5.9.3"
|
|
27
27
|
},
|