@salesforce/platform-sdk 10.5.1 → 10.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.
@@ -5,7 +5,8 @@ import { Analytics, AnalyticsOptions } from './types';
5
5
  * Handles all setup internally:
6
6
  * - Creates a ChatSDK instance via getChatSDK() (unless one is provided)
7
7
  * - Calls registerInstrumentedApp() with appPayloadProvider pre-wired
8
- * to attach appId, surface, and (when set) pftId to every o11y log entry
8
+ * to attach appId, surface, axlPftId (always), and pftId (when set) to
9
+ * every o11y log entry
9
10
  * - Wraps the ChatSDK in a Proxy for auto-instrumentation
10
11
  * - Sets up global error listeners (window.onerror, unhandledrejection)
11
12
  * - Tracks session duration from init to dispose()
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/analytics/analytics.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAmB,MAAM,SAAS,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CA0GnF"}
1
+ {"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/analytics/analytics.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAmB,MAAM,SAAS,CAAC;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CA2GnF"}
@@ -5,5 +5,5 @@
5
5
  */
6
6
  export { createAnalytics } from './analytics';
7
7
  export type { Analytics, AnalyticsOptions } from './types';
8
- export { PFT_META_KEY, validatePftId } from './pft';
8
+ export { AXL_PFT_ID, PFT_META_KEY, validatePftId } from './pft';
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/analytics/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAM3D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/analytics/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAM3D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC"}
@@ -1,6 +1,7 @@
1
- import { P as e, c as s, v as c } from "../analytics-CKY6bfzK.js";
1
+ import { A as t, P as e, c as A, v as P } from "../analytics-C0LcuEnM.js";
2
2
  export {
3
+ t as AXL_PFT_ID,
3
4
  e as PFT_META_KEY,
4
- s as createAnalytics,
5
- c as validatePftId
5
+ A as createAnalytics,
6
+ P as validatePftId
6
7
  };
@@ -9,6 +9,13 @@
9
9
  * with other `_meta` consumers.
10
10
  */
11
11
  export declare const PFT_META_KEY = "sfdc.pftId";
12
+ /**
13
+ * The AXL team's own Product Feature Taxonomy (PFT) Id, emitted on every event
14
+ * as `axlPftId` alongside the customer `pftId` (W-22315201). A fixed constant —
15
+ * intentionally not in {@link AnalyticsOptions} or any setter, so consumers
16
+ * cannot override or suppress it. A unit test asserts it passes validatePftId.
17
+ */
18
+ export declare const AXL_PFT_ID = "aJCEE000000FgYP4A0";
12
19
  /**
13
20
  * Validates a PFT Id at the SDK boundary.
14
21
  *
@@ -1 +1 @@
1
- {"version":3,"file":"pft.d.ts","sourceRoot":"","sources":["../../src/analytics/pft.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwBH;;;;GAIG;AACH,eAAO,MAAM,YAAY,eAAe,CAAC;AAiBzC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,MAAM,CAqBvD"}
1
+ {"version":3,"file":"pft.d.ts","sourceRoot":"","sources":["../../src/analytics/pft.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwBH;;;;GAIG;AACH,eAAO,MAAM,YAAY,eAAe,CAAC;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,uBAAuB,CAAC;AAiB/C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,IAAI,MAAM,CAqBvD"}
@@ -1,9 +1,9 @@
1
- import { registerInstrumentedApp as x } from "o11y/client";
2
- import { g as I } from "./sdk-promise-BMDSCpcq.js";
3
- import { getChatSDK as h } from "./chat/index.js";
1
+ import { registerInstrumentedApp as I } from "o11y/client";
2
+ import { g as x } from "./sdk-promise-BMDSCpcq.js";
3
+ import { getChatSDK as P } from "./chat/index.js";
4
4
  import { r as E } from "./TelemetryUploader-DKkdppe9.js";
5
- import { analyticsContextSchema as P, sessionSchema as S, pageViewSchema as v, errorContextSchema as k, interactionSchema as C, customEventSchema as _ } from "o11y_schema/sf_mcpanalytics";
6
- function b(e) {
5
+ import { analyticsContextSchema as h, sessionSchema as S, pageViewSchema as v, errorContextSchema as k, interactionSchema as _, customEventSchema as C } from "o11y_schema/sf_mcpanalytics";
6
+ function F(e) {
7
7
  const t = (o, d, y, c, s) => {
8
8
  e.error(s ?? o);
9
9
  }, n = (o) => {
@@ -13,40 +13,40 @@ function b(e) {
13
13
  window.removeEventListener("error", t), window.removeEventListener("unhandledrejection", n);
14
14
  };
15
15
  }
16
- const D = "aJC", R = "sfdc.pftId", w = /* @__PURE__ */ new Set(), F = /^aJC[0-9A-Za-z]{12}(?:[0-9A-Za-z]{3})?$/;
17
- function T(e) {
18
- return typeof e != "string" || e.length === 0 ? !1 : e.length !== 15 && e.length !== 18 ? (A(e, "Expected a 15- or 18-character Salesforce ID"), !1) : F.test(e) ? !0 : (A(e, `Expected a Product Feature Id (prefix "${D}", base62).`), !1);
16
+ const b = "aJC", j = "sfdc.pftId", D = "aJCEE000000FgYP4A0", w = /* @__PURE__ */ new Set(), L = /^aJC[0-9A-Za-z]{12}(?:[0-9A-Za-z]{3})?$/;
17
+ function A(e) {
18
+ return typeof e != "string" || e.length === 0 ? !1 : e.length !== 15 && e.length !== 18 ? (T(e, "Expected a 15- or 18-character Salesforce ID"), !1) : L.test(e) ? !0 : (T(e, `Expected a Product Feature Id (prefix "${b}", base62).`), !1);
19
19
  }
20
- function A(e, t) {
20
+ function T(e, t) {
21
21
  w.has(e) || (w.add(e), console.debug(`[platform-sdk:analytics] Ignoring invalid PFT Id "${e}". ${t}`));
22
22
  }
23
- function u(e, t) {
23
+ function l(e, t) {
24
24
  return { surface: t };
25
25
  }
26
- const L = {
26
+ const N = {
27
27
  callTool: {
28
28
  isAsync: !0,
29
29
  extractTags: (e, t) => ({ toolName: e[0]?.toolName ?? "unknown", surface: t })
30
30
  },
31
31
  setWidgetState: {
32
32
  isAsync: !1,
33
- extractTags: u
33
+ extractTags: l
34
34
  },
35
35
  getWidgetState: {
36
36
  isAsync: !1,
37
- extractTags: u
37
+ extractTags: l
38
38
  },
39
39
  sendMessageToHost: {
40
40
  isAsync: !0,
41
- extractTags: u
41
+ extractTags: l
42
42
  },
43
43
  openLink: {
44
44
  isAsync: !0,
45
- extractTags: u
45
+ extractTags: l
46
46
  },
47
47
  subscribe: {
48
48
  isAsync: !1,
49
- extractTags: u,
49
+ extractTags: l,
50
50
  wrapArgs: (e, t) => {
51
51
  const n = e[0];
52
52
  return [
@@ -66,57 +66,58 @@ const L = {
66
66
  },
67
67
  accessToolOutput: {
68
68
  isAsync: !1,
69
- extractTags: u
69
+ extractTags: l
70
70
  },
71
71
  accessToolInput: {
72
72
  isAsync: !1,
73
- extractTags: u
73
+ extractTags: l
74
74
  },
75
75
  accessToolMetadata: {
76
76
  isAsync: !1,
77
- extractTags: u
77
+ extractTags: l
78
78
  }
79
79
  };
80
- function N(e, t, n) {
80
+ function J(e, t, n) {
81
81
  return new Proxy(e, {
82
82
  get(o, d, y) {
83
- const c = Reflect.get(o, d, y), s = L[d];
83
+ const c = Reflect.get(o, d, y), s = N[d];
84
84
  return !s || typeof c != "function" ? c : (...a) => {
85
- const p = s.extractTags(a, n), m = s.wrapArgs ? s.wrapArgs(a, t) : a, l = `sdk.${String(d)}`;
86
- return s.isAsync ? t.activityAsync(l, async () => {
85
+ const p = s.extractTags(a, n), m = s.wrapArgs ? s.wrapArgs(a, t) : a, u = `sdk.${String(d)}`;
86
+ return s.isAsync ? t.activityAsync(u, async () => {
87
87
  try {
88
88
  const g = await c.apply(
89
89
  o,
90
90
  m
91
91
  );
92
- return t.incrementCounter(l, 1, !1, p), g;
92
+ return t.incrementCounter(u, 1, !1, p), g;
93
93
  } catch (g) {
94
- throw t.incrementCounter(l, 1, !0, p), g;
94
+ throw t.incrementCounter(u, 1, !0, p), g;
95
95
  }
96
- }) : (t.incrementCounter(l, 1, !1, p), c.apply(o, m));
96
+ }) : (t.incrementCounter(u, 1, !1, p), c.apply(o, m));
97
97
  };
98
98
  }
99
99
  });
100
100
  }
101
- async function j(e) {
102
- const { appId: t, clientSessionId: n } = e, o = I(), d = Date.now(), y = e.sdk ?? await h();
101
+ async function q(e) {
102
+ const { appId: t, clientSessionId: n } = e, o = x(), d = Date.now(), y = e.sdk ?? await P();
103
103
  let c = null;
104
- e.pftId !== void 0 && T(e.pftId) && (c = e.pftId);
105
- const s = x("mcp-widget", {
104
+ e.pftId !== void 0 && A(e.pftId) && (c = e.pftId);
105
+ const s = I("mcp-widget", {
106
106
  appPayloadProvider: {
107
107
  getPayload: () => ({
108
- schema: P,
108
+ schema: h,
109
109
  payload: {
110
110
  appId: t,
111
111
  surface: o,
112
+ axlPftId: D,
112
113
  ...c !== null ? { pftId: c } : {}
113
114
  }
114
115
  })
115
116
  },
116
117
  clientSessionId: n
117
- }), a = s, p = N(y, a, o), m = b(a);
118
- let l;
119
- e.transport && (l = E(s, {
118
+ }), a = s, p = J(y, a, o), m = F(a);
119
+ let u;
120
+ e.transport && (u = E(s, {
120
121
  onEnvelope: (r) => {
121
122
  e.transport.enqueue(r);
122
123
  }
@@ -126,13 +127,13 @@ async function j(e) {
126
127
  instrumentedSDK: p,
127
128
  app: s,
128
129
  trackEvent(r, i) {
129
- f || a.log(_, {
130
+ f || a.log(C, {
130
131
  eventName: r,
131
132
  properties: i ? JSON.stringify(i) : ""
132
133
  });
133
134
  },
134
135
  trackInteraction(r, i) {
135
- f || a.log(C, {
136
+ f || a.log(_, {
136
137
  elementId: r,
137
138
  properties: i ? JSON.stringify(i) : ""
138
139
  });
@@ -146,18 +147,19 @@ async function j(e) {
146
147
  f || r !== g && (g = r, a.log(v, { componentRef: r }));
147
148
  },
148
149
  setPftId(r) {
149
- f || T(r) && (c = r);
150
+ f || A(r) && (c = r);
150
151
  },
151
152
  dispose() {
152
153
  if (f) return;
153
154
  f = !0, m();
154
155
  const r = Date.now() - d;
155
- a.log(S, { durationMs: r }), l?.dispose();
156
+ a.log(S, { durationMs: r }), u?.dispose();
156
157
  }
157
158
  };
158
159
  }
159
160
  export {
160
- R as P,
161
- j as c,
162
- T as v
161
+ D as A,
162
+ j as P,
163
+ q as c,
164
+ A as v
163
165
  };
@@ -195,7 +195,7 @@ class ie {
195
195
  })).structuredContent;
196
196
  }
197
197
  }
198
- const ce = "X-SFDC-Client-Name", ue = "X-SFDC-Client-Version", he = "@salesforce/platform-sdk", le = "10.5.1", de = (t) => {
198
+ const ce = "X-SFDC-Client-Name", ue = "X-SFDC-Client-Version", he = "@salesforce/platform-sdk", le = "10.6.0", de = (t) => {
199
199
  let e = y(ce, he, t);
200
200
  return e = y(ue, le, e), u(e);
201
201
  }, pe = "X-CSRF-Token";
package/dist/index.d.ts CHANGED
@@ -9,5 +9,5 @@ export { createViewSDK, type ViewSDKOptions, MCPAppsViewSDK, getViewSDK, getView
9
9
  export { createDataSDK, type DataSDKOptions, type WebAppDataSDKOptions, type MosaicDataSDKOptions, type StatusCallback, type NodeOfConnection, gql, } from './data';
10
10
  export { createLightningSDK, type LightningSDKOptions } from './lightning';
11
11
  export { createTelemetryTransport, registerTelemetryUploader, TelemetryUploader, type TelemetryTransport, type TelemetryTransportOptions, type EnvelopeEntry, type EnvelopeMetadata, type TelemetryUploaderOptions, type OnEnvelopeCallback, type FlushReason, type TelemetryUploadContext, type TelemetryUploaderErrorContext, type InstrumentedAppLike, type DisposeOptions, } from './telemetry';
12
- export { createAnalytics, PFT_META_KEY, validatePftId, type Analytics, type AnalyticsOptions, } from './analytics';
12
+ export { AXL_PFT_ID, createAnalytics, PFT_META_KEY, validatePftId, type Analytics, type AnalyticsOptions, } from './analytics';
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,QAAQ,CAAC;AAGvB,OAAO,EACN,aAAa,EACb,KAAK,cAAc,EACnB,cAAc,EACd,UAAU,EACV,cAAc,EACd,YAAY,GACZ,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACN,aAAa,EACb,KAAK,cAAc,EACnB,cAAc,EACd,UAAU,EACV,cAAc,EACd,YAAY,GACZ,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACN,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,GAAG,GACH,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAG3E,OAAO,EACN,wBAA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aAAa,CAAC;AAGrB,OAAO,EACN,UAAU,EACV,eAAe,EACf,YAAY,EACZ,aAAa,EACb,KAAK,SAAS,EACd,KAAK,gBAAgB,GACrB,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,36 +1,37 @@
1
1
  import { S as t, g as a, w as o } from "./sdk-promise-BMDSCpcq.js";
2
- import { M as s } from "./mcpapps-session-BOT5CvWa.js";
2
+ import { M as p } from "./mcpapps-session-BOT5CvWa.js";
3
3
  import { getSurfaceCapabilities as c } from "./core/index.js";
4
- import { MCPAppsChatSDK as f, createChatSDK as m, getChatSDK as D, getChatSDKSync as K, resetChatSDK as g } from "./chat/index.js";
5
- import { MCPAppsViewSDK as l, createViewSDK as C, getViewSDK as n, getViewSDKSync as w, resetViewSDK as T } from "./view/index.js";
6
- import { createDataSDK as y, gql as P } from "./data/index.js";
4
+ import { MCPAppsChatSDK as D, createChatSDK as f, getChatSDK as m, getChatSDKSync as K, resetChatSDK as g } from "./chat/index.js";
5
+ import { MCPAppsViewSDK as l, createViewSDK as C, getViewSDK as T, getViewSDKSync as n, resetViewSDK as w } from "./view/index.js";
6
+ import { createDataSDK as P, gql as h } from "./data/index.js";
7
7
  import { createLightningSDK as M } from "./lightning/index.js";
8
8
  import { c as d } from "./transport-D8xgRy7y.js";
9
- import { T as v, r as E } from "./TelemetryUploader-DKkdppe9.js";
10
- import { P as _, c as b, v as q } from "./analytics-CKY6bfzK.js";
9
+ import { T as u, r as v } from "./TelemetryUploader-DKkdppe9.js";
10
+ import { A as F, P as I, c as L, v as U } from "./analytics-C0LcuEnM.js";
11
11
  export {
12
- f as MCPAppsChatSDK,
12
+ F as AXL_PFT_ID,
13
+ D as MCPAppsChatSDK,
13
14
  l as MCPAppsViewSDK,
14
- s as McpAppsSession,
15
- _ as PFT_META_KEY,
15
+ p as McpAppsSession,
16
+ I as PFT_META_KEY,
16
17
  t as Surface,
17
- v as TelemetryUploader,
18
- b as createAnalytics,
19
- m as createChatSDK,
20
- y as createDataSDK,
18
+ u as TelemetryUploader,
19
+ L as createAnalytics,
20
+ f as createChatSDK,
21
+ P as createDataSDK,
21
22
  M as createLightningSDK,
22
23
  d as createTelemetryTransport,
23
24
  C as createViewSDK,
24
- D as getChatSDK,
25
+ m as getChatSDK,
25
26
  K as getChatSDKSync,
26
27
  a as getSurface,
27
28
  c as getSurfaceCapabilities,
28
- n as getViewSDK,
29
- w as getViewSDKSync,
30
- P as gql,
31
- E as registerTelemetryUploader,
29
+ T as getViewSDK,
30
+ n as getViewSDKSync,
31
+ h as gql,
32
+ v as registerTelemetryUploader,
32
33
  g as resetChatSDK,
33
- T as resetViewSDK,
34
- q as validatePftId,
34
+ w as resetViewSDK,
35
+ U as validatePftId,
35
36
  o as wrapSDKPromise
36
37
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/platform-sdk",
3
- "version": "10.5.1",
3
+ "version": "10.6.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -96,7 +96,7 @@
96
96
  "@conduit-client/service-pubsub": "3.19.6",
97
97
  "@conduit-client/service-retry": "3.19.6",
98
98
  "@conduit-client/utils": "3.19.6",
99
- "@salesforce/jsonrpc": "^10.5.1"
99
+ "@salesforce/jsonrpc": "^10.6.0"
100
100
  },
101
101
  "peerDependencies": {
102
102
  "o11y": ">=260.0.0",