@salesforce/platform-sdk 11.45.2 → 11.45.4
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 +36 -0
- package/dist/data/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -83,6 +83,42 @@ analytics.dispose();
|
|
|
83
83
|
|
|
84
84
|
`createAnalytics` is async because it constructs a `ChatSDK` if you don't supply one. To skip the transport (e.g., during local development), omit the `transport` option — events still flow through `o11y` but aren't uploaded.
|
|
85
85
|
|
|
86
|
+
### Attributing events to a PFT Id
|
|
87
|
+
|
|
88
|
+
Attribute analytics events to a Product Feature Taxonomy (PFT) Id so usage rolls up to the correct feature in Salesforce dashboards.
|
|
89
|
+
|
|
90
|
+
**Server side.** The MCP server declares the customer PFT Id on the `telemetry_upload` tool's `_meta` under the reserved key `"sfdc.pftId"`:
|
|
91
|
+
|
|
92
|
+
```jsonc
|
|
93
|
+
// telemetry_upload tool definition
|
|
94
|
+
{
|
|
95
|
+
"name": "telemetry_upload",
|
|
96
|
+
"_meta": {
|
|
97
|
+
"sfdc.pftId": "aJCEE000000FgYP4A0",
|
|
98
|
+
},
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
See [`TdxAxlDemoMcpServer.java`](https://codesearch.data.sfdc.net/gitcore.soma.salesforce.com/core-2206/core-266-public@p4/266-main/-/blob/core/experience-model-services-core-impl/java/src/experiencemodel/typesystem/mcp/TdxAxlDemoMcpServer.java) for a working example.
|
|
103
|
+
|
|
104
|
+
**Widget side.** Read the Id via `chatSdk.accessToolMetadata()` and pass it to `createAnalytics`. The SDK exports the same key as `PFT_META_KEY` so the two sides stay in sync:
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import { createAnalytics, PFT_META_KEY } from "@salesforce/platform-sdk";
|
|
108
|
+
|
|
109
|
+
const meta = chatSdk.accessToolMetadata?.<Record<string, unknown>>();
|
|
110
|
+
const pftId = meta?.[PFT_META_KEY];
|
|
111
|
+
|
|
112
|
+
const analytics = await createAnalytics({
|
|
113
|
+
appId: "my-widget",
|
|
114
|
+
sdk,
|
|
115
|
+
transport,
|
|
116
|
+
pftId,
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Only PF Ids (KeyPrefix `aJC`, 15 or 18 chars) are accepted; PFE Ids (`aJD`) and malformed values are ignored, and the analytics instance simply carries no PFT attribution. Use `validatePftId` if you want to gate the value yourself before passing it in.
|
|
121
|
+
|
|
86
122
|
## Telemetry transport
|
|
87
123
|
|
|
88
124
|
`createTelemetryTransport` buffers `o11y` envelopes and uploads them via the `telemetry_upload` tool exposed by the host `ChatSDK`. Use it directly when you want batching independent of `createAnalytics`.
|
package/dist/data/index.js
CHANGED
|
@@ -245,7 +245,7 @@ const w = "Accept-Language", me = (r) => {
|
|
|
245
245
|
return u(r);
|
|
246
246
|
const [t, n] = r;
|
|
247
247
|
return (t instanceof Request && !n?.headers ? t.headers.has(w) : new Headers(n?.headers).has(w)) ? u(r) : u(b(w, e, r));
|
|
248
|
-
}, ye = "X-SFDC-Client-Name", be = "X-SFDC-Client-Version", ve = "@salesforce/platform-sdk", Se = "11.45.
|
|
248
|
+
}, ye = "X-SFDC-Client-Name", be = "X-SFDC-Client-Version", ve = "@salesforce/platform-sdk", Se = "11.45.4", ge = (r) => {
|
|
249
249
|
let e = b(ye, ve, r);
|
|
250
250
|
return e = b(be, Se, e), u(e);
|
|
251
251
|
}, we = "X-CSRF-Token";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/platform-sdk",
|
|
3
|
-
"version": "11.45.
|
|
3
|
+
"version": "11.45.4",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"@conduit-client/service-pubsub": "3.19.6",
|
|
124
124
|
"@conduit-client/service-retry": "3.19.6",
|
|
125
125
|
"@conduit-client/utils": "3.19.6",
|
|
126
|
-
"@salesforce/jsonrpc": "^11.45.
|
|
126
|
+
"@salesforce/jsonrpc": "^11.45.4",
|
|
127
127
|
"@salesforce/sf-embedding-bridge": "2.2.5-rc.2"
|
|
128
128
|
},
|
|
129
129
|
"peerDependencies": {
|