@salesforce/platform-sdk 11.17.0 → 11.17.1

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.
@@ -6,8 +6,7 @@ import { Analytics, AnalyticsOptions } from './types';
6
6
  * - Creates a ChatSDK instance via getChatSDK() (unless one is provided)
7
7
  * - Calls registerInstrumentedApp() with appPayloadProvider pre-wired
8
8
  * to attach appId and surface (always), plus axlPftId and pftId (when set)
9
- * to every o11y log entry — PFT Ids are withheld when the internal gate is
10
- * enforced and the session is not marked internal (see `enforceInternalGate`)
9
+ * to every o11y log entry
11
10
  * - Wraps the ChatSDK in a Proxy for auto-instrumentation
12
11
  * - Sets up global error listeners (window.onerror, unhandledrejection)
13
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAK7E"}
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,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAK7E"}
@@ -5,5 +5,5 @@
5
5
  */
6
6
  export { createAnalytics } from './analytics';
7
7
  export type { Analytics, AnalyticsOptions } from './types';
8
- export { AXL_PFT_ID, INTERNAL_SESSION_META_KEY, 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,UAAU,EAAE,yBAAyB,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,8 +1,7 @@
1
- import { A as s, I as A, P as E, c as t, v as I } from "../analytics-CIbrgyL8.js";
1
+ import { A as t, P as e, c as A, v as P } from "../analytics-xqWfpWnv.js";
2
2
  export {
3
- s as AXL_PFT_ID,
4
- A as INTERNAL_SESSION_META_KEY,
5
- E as PFT_META_KEY,
6
- t as createAnalytics,
7
- I as validatePftId
3
+ t as AXL_PFT_ID,
4
+ e as PFT_META_KEY,
5
+ A as createAnalytics,
6
+ P as validatePftId
8
7
  };
@@ -9,14 +9,6 @@
9
9
  * with other `_meta` consumers.
10
10
  */
11
11
  export declare const PFT_META_KEY = "sfdc.pftId";
12
- /**
13
- * Reserved key on `CallToolResult._meta` by which an MCP server marks the
14
- * current session as Salesforce-internal, gating PFT Id tracking (W-22315204).
15
- * Must be set by the server, not forwarded from client input; only a strict
16
- * boolean `true` counts (see {@link Analytics.setInternalSession}). Namespaced
17
- * alongside {@link PFT_META_KEY} to avoid `_meta` collisions.
18
- */
19
- export declare const INTERNAL_SESSION_META_KEY = "sfdc.internalSession";
20
12
  /**
21
13
  * The AXL team's own Product Feature Taxonomy (PFT) Id, emitted on every event
22
14
  * as `axlPftId` alongside the customer `pftId` (W-22315201). A fixed constant —
@@ -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;AAEzC;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,yBAAyB,CAAC;AAEhE;;;;;GAKG;AACH,eAAO,MAAM,UAAU,uBAAuB,CAAC;AAiB/C;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
@@ -80,18 +80,6 @@ export interface AnalyticsOptions {
80
80
  * analytics dashboards only.
81
81
  */
82
82
  pftId?: string;
83
- /**
84
- * Restrict PFT Id tracking (customer `pftId` + AXL `axlPftId`) to
85
- * Salesforce-internal sessions (W-22315204). "Internal" can't be inferred
86
- * client-side, so the gate relies on a server-stamped marker
87
- * ({@link INTERNAL_SESSION_META_KEY}) surfaced via
88
- * {@link Analytics.setInternalSession} — the server is the source of truth.
89
- *
90
- * Default `false`: emission is unchanged, so this can ship before any server
91
- * stamps the marker. When `true`, `pftId`/`axlPftId` are withheld until the
92
- * session is marked internal; `appId`/`surface` always emit.
93
- */
94
- enforceInternalGate?: boolean;
95
83
  }
96
84
  /**
97
85
  * Analytics instance returned by createAnalytics().
@@ -123,14 +111,6 @@ export interface Analytics {
123
111
  * the Id set by earlier well-formed responses.
124
112
  */
125
113
  setPftId: (id: string) => void;
126
- /**
127
- * Mark whether the current session is Salesforce-internal, per the server
128
- * (W-22315204). Only relevant when `enforceInternalGate` is set: `true` opens
129
- * the gate so events carry `pftId`/`axlPftId`, `false` re-closes it (the
130
- * server can revoke). Strict `true` only — any other value is treated as
131
- * not-internal (forgery resistance). Late-bound; no-op after `dispose()`.
132
- */
133
- setInternalSession: (isInternal: boolean) => void;
134
114
  /** Cleanup — removes listeners, logs session duration, flushes events */
135
115
  dispose: () => void;
136
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/analytics/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,MAAM;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,WAAW,e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AAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAClF,uCAAuC;IACvC,aAAa,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C;;;;;;;;;;;;OAYG;IACH,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,yEAAyE;IACzE,OAAO,EAAE,MAAM,IAAI,CAAC;CACpB"}
@@ -0,0 +1,153 @@
1
+ import { registerInstrumentedApp as A } from "o11y/client";
2
+ import { g as E, S } from "./surface-Dd2tqrPi.js";
3
+ import { w as T } from "./sdk-promise-D0sy7OW1.js";
4
+ import { getChatSDK as x } from "./chat/index.js";
5
+ import { r as v } from "./TelemetryUploader-DKkdppe9.js";
6
+ import { analyticsContextSchema as C, sessionSchema as _, pageViewSchema as k, errorContextSchema as F, interactionSchema as D, customEventSchema as L } from "o11y_schema/sf_mcpanalytics";
7
+ function N(e) {
8
+ const n = (r, f, g, o, c) => {
9
+ e.error(c ?? r);
10
+ }, a = (r) => {
11
+ e.error(r.reason);
12
+ };
13
+ return window.addEventListener("error", n), window.addEventListener("unhandledrejection", a), () => {
14
+ window.removeEventListener("error", n), window.removeEventListener("unhandledrejection", a);
15
+ };
16
+ }
17
+ const J = "aJC", U = "sfdc.pftId", K = "aJCEE000000FgYP4A0", P = /* @__PURE__ */ new Set(), O = /^aJC[0-9A-Za-z]{12}(?:[0-9A-Za-z]{3})?$/;
18
+ function I(e) {
19
+ return typeof e != "string" || e.length === 0 ? !1 : e.length !== 15 && e.length !== 18 ? (h(e, "Expected a 15- or 18-character Salesforce ID"), !1) : O.test(e) ? !0 : (h(e, `Expected a Product Feature Id (prefix "${J}", base62).`), !1);
20
+ }
21
+ function h(e, n) {
22
+ P.has(e) || (P.add(e), console.debug(`[platform-sdk:analytics] Ignoring invalid PFT Id "${e}". ${n}`));
23
+ }
24
+ function p(e) {
25
+ return {};
26
+ }
27
+ const $ = {
28
+ callTool: {
29
+ isAsync: !0,
30
+ extractTags: (e) => ({ toolName: e[0]?.toolName ?? "unknown" })
31
+ },
32
+ setWidgetState: {
33
+ isAsync: !1,
34
+ extractTags: p
35
+ },
36
+ sendMessageToHost: {
37
+ isAsync: !0,
38
+ extractTags: p
39
+ },
40
+ openLink: {
41
+ isAsync: !0,
42
+ extractTags: p
43
+ },
44
+ readResource: {
45
+ isAsync: !0,
46
+ extractTags: (e) => {
47
+ const a = e[0]?.uri ?? "", r = a.indexOf("://");
48
+ return { scheme: r > 0 ? a.slice(0, r).toLowerCase() : "unknown" };
49
+ }
50
+ },
51
+ setDisplayMode: {
52
+ isAsync: !0,
53
+ extractTags: (e) => ({ mode: e[0] ?? "unknown" })
54
+ }
55
+ };
56
+ function M(e, n, a) {
57
+ return new Proxy(e, {
58
+ get(r, f, g) {
59
+ const o = Reflect.get(r, f, g), c = $[f];
60
+ return !c || typeof o != "function" ? o : (...u) => {
61
+ const s = { ...a(), ...c.extractTags(u) }, d = `sdk.${String(f)}`;
62
+ return c.isAsync ? n.activityAsync(d, async () => {
63
+ try {
64
+ const m = await o.apply(r, u);
65
+ return n.incrementCounter(d, 1, !1, s), m;
66
+ } catch (m) {
67
+ throw n.incrementCounter(d, 1, !0, s), m;
68
+ }
69
+ }) : (n.incrementCounter(d, 1, !1, s), o.apply(r, u));
70
+ };
71
+ }
72
+ });
73
+ }
74
+ function W(e) {
75
+ return T(R(e), "createAnalytics");
76
+ }
77
+ async function R(e) {
78
+ const { appId: n, clientSessionId: a } = e;
79
+ let r;
80
+ try {
81
+ r = await E();
82
+ } catch {
83
+ r = S.WebApp;
84
+ }
85
+ const f = Date.now(), g = e.sdk ?? await x();
86
+ let o = null;
87
+ e.pftId !== void 0 && I(e.pftId) && (o = e.pftId);
88
+ const c = () => ({
89
+ axlPftId: K,
90
+ ...o !== null ? { pftId: o } : {}
91
+ }), u = A("mcp-widget", {
92
+ appPayloadProvider: {
93
+ getPayload: () => ({
94
+ schema: C,
95
+ payload: {
96
+ appId: n,
97
+ surface: r,
98
+ ...c()
99
+ }
100
+ })
101
+ },
102
+ clientSessionId: a
103
+ }), s = u, d = M(g, s, () => ({
104
+ surface: r,
105
+ ...c()
106
+ })), m = N(s);
107
+ let y;
108
+ e.transport && (y = v(u, {
109
+ onEnvelope: (t) => {
110
+ e.transport.enqueue(t);
111
+ }
112
+ }));
113
+ let w, l = !1;
114
+ return {
115
+ instrumentedSDK: d,
116
+ app: u,
117
+ trackEvent(t, i) {
118
+ l || s.log(L, {
119
+ eventName: t,
120
+ properties: i ? JSON.stringify(i) : ""
121
+ });
122
+ },
123
+ trackInteraction(t, i) {
124
+ l || s.log(D, {
125
+ elementId: t,
126
+ properties: i ? JSON.stringify(i) : ""
127
+ });
128
+ },
129
+ trackError(t, i) {
130
+ l || s.error(t, F, {
131
+ properties: i ? JSON.stringify(i) : ""
132
+ });
133
+ },
134
+ trackPageView(t) {
135
+ l || t !== w && (w = t, s.log(k, { componentRef: t }));
136
+ },
137
+ setPftId(t) {
138
+ l || I(t) && (o = t);
139
+ },
140
+ dispose() {
141
+ if (l) return;
142
+ l = !0, m();
143
+ const t = Date.now() - f;
144
+ s.log(_, { durationMs: t }), y?.dispose();
145
+ }
146
+ };
147
+ }
148
+ export {
149
+ K as A,
150
+ U as P,
151
+ W as c,
152
+ I as v
153
+ };
@@ -239,7 +239,7 @@ class fe {
239
239
  })).structuredContent;
240
240
  }
241
241
  }
242
- const pe = "X-SFDC-Client-Name", me = "X-SFDC-Client-Version", ye = "@salesforce/platform-sdk", be = "11.17.0", ve = (r) => {
242
+ const pe = "X-SFDC-Client-Name", me = "X-SFDC-Client-Version", ye = "@salesforce/platform-sdk", be = "11.17.1", ve = (r) => {
243
243
  let e = b(pe, ye, r);
244
244
  return e = b(me, be, e), u(e);
245
245
  }, Se = "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 { AXL_PFT_ID, createAnalytics, INTERNAL_SESSION_META_KEY, 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,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EACl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ACb,KAAK,SAAS,EACd,KAAK,gBAAgB,GACrB,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,42 +1,41 @@
1
1
  import { M as a, a as t, S as s, g as o, i, b as p, r as S } from "./surface-Dd2tqrPi.js";
2
2
  import { g as c } from "./capabilities-5BWkCbcP.js";
3
3
  import { w as D } from "./sdk-promise-D0sy7OW1.js";
4
- import { MCPAppsChatSDK as g, createChatSDK as l, getChatSDK as A, getChatSDKSync as x, resetChatSDK as T } from "./chat/index.js";
5
- import { MCPAppsViewSDK as C, createViewSDK as E, getViewSDK as d, getViewSDKSync as w, resetViewSDK as M } from "./view/index.js";
6
- import { createDataSDK as _, gql as h } from "./data/index.js";
7
- import { createLightningSDK as I } from "./lightning/index.js";
8
- import { c as b } from "./transport-D9QstWle.js";
9
- import { T as N, r as v } from "./TelemetryUploader-DKkdppe9.js";
10
- import { A as F, I as U, P as Y, c as q, v as z } from "./analytics-CIbrgyL8.js";
4
+ import { MCPAppsChatSDK as g, createChatSDK as l, getChatSDK as x, getChatSDKSync as n, resetChatSDK as A } from "./chat/index.js";
5
+ import { MCPAppsViewSDK as T, createViewSDK as d, getViewSDK as w, getViewSDKSync as P, resetViewSDK as h } from "./view/index.js";
6
+ import { createDataSDK as M, gql as V } from "./data/index.js";
7
+ import { createLightningSDK as u } from "./lightning/index.js";
8
+ import { c as _ } from "./transport-D9QstWle.js";
9
+ import { T as I, r as F } from "./TelemetryUploader-DKkdppe9.js";
10
+ import { A as U, P as q, c as z, v as N } from "./analytics-xqWfpWnv.js";
11
11
  export {
12
- F as AXL_PFT_ID,
13
- U as INTERNAL_SESSION_META_KEY,
12
+ U as AXL_PFT_ID,
14
13
  g as MCPAppsChatSDK,
15
- C as MCPAppsViewSDK,
14
+ T as MCPAppsViewSDK,
16
15
  a as McpAppsNotAvailableError,
17
16
  t as McpAppsSession,
18
- Y as PFT_META_KEY,
17
+ q as PFT_META_KEY,
19
18
  s as Surface,
20
- N as TelemetryUploader,
21
- q as createAnalytics,
19
+ I as TelemetryUploader,
20
+ z as createAnalytics,
22
21
  l as createChatSDK,
23
- _ as createDataSDK,
24
- I as createLightningSDK,
25
- b as createTelemetryTransport,
26
- E as createViewSDK,
27
- A as getChatSDK,
28
- x as getChatSDKSync,
22
+ M as createDataSDK,
23
+ u as createLightningSDK,
24
+ _ as createTelemetryTransport,
25
+ d as createViewSDK,
26
+ x as getChatSDK,
27
+ n as getChatSDKSync,
29
28
  c as getSurfaceCapabilities,
30
29
  o as getVerifiedSurface,
31
- d as getViewSDK,
32
- w as getViewSDKSync,
33
- h as gql,
30
+ w as getViewSDK,
31
+ P as getViewSDKSync,
32
+ V as gql,
34
33
  i as initialize,
35
34
  p as isSfEmbeddingIframe,
36
- v as registerTelemetryUploader,
37
- T as resetChatSDK,
35
+ F as registerTelemetryUploader,
36
+ A as resetChatSDK,
38
37
  S as resetSurface,
39
- M as resetViewSDK,
40
- z as validatePftId,
38
+ h as resetViewSDK,
39
+ N as validatePftId,
41
40
  D as wrapSDKPromise
42
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/platform-sdk",
3
- "version": "11.17.0",
3
+ "version": "11.17.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -115,7 +115,7 @@
115
115
  "@conduit-client/service-pubsub": "3.19.6",
116
116
  "@conduit-client/service-retry": "3.19.6",
117
117
  "@conduit-client/utils": "3.19.6",
118
- "@salesforce/jsonrpc": "^11.17.0",
118
+ "@salesforce/jsonrpc": "^11.17.1",
119
119
  "@salesforce/sf-embedding-bridge": "2.2.4-rc.1"
120
120
  },
121
121
  "peerDependencies": {
@@ -1,159 +0,0 @@
1
- import { registerInstrumentedApp as h } from "o11y/client";
2
- import { g as T, S as x } from "./surface-Dd2tqrPi.js";
3
- import { w as v } from "./sdk-promise-D0sy7OW1.js";
4
- import { getChatSDK as _ } from "./chat/index.js";
5
- import { r as C } from "./TelemetryUploader-DKkdppe9.js";
6
- import { analyticsContextSchema as k, sessionSchema as F, pageViewSchema as L, errorContextSchema as N, interactionSchema as D, customEventSchema as J } from "o11y_schema/sf_mcpanalytics";
7
- function K(e) {
8
- const n = (r, f, p, o, u) => {
9
- e.error(u ?? r);
10
- }, a = (r) => {
11
- e.error(r.reason);
12
- };
13
- return window.addEventListener("error", n), window.addEventListener("unhandledrejection", a), () => {
14
- window.removeEventListener("error", n), window.removeEventListener("unhandledrejection", a);
15
- };
16
- }
17
- const O = "aJC", W = "sfdc.pftId", X = "sfdc.internalSession", M = "aJCEE000000FgYP4A0", I = /* @__PURE__ */ new Set(), R = /^aJC[0-9A-Za-z]{12}(?:[0-9A-Za-z]{3})?$/;
18
- function S(e) {
19
- 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) : R.test(e) ? !0 : (A(e, `Expected a Product Feature Id (prefix "${O}", base62).`), !1);
20
- }
21
- function A(e, n) {
22
- I.has(e) || (I.add(e), console.debug(`[platform-sdk:analytics] Ignoring invalid PFT Id "${e}". ${n}`));
23
- }
24
- function g(e) {
25
- return {};
26
- }
27
- const $ = {
28
- callTool: {
29
- isAsync: !0,
30
- extractTags: (e) => ({ toolName: e[0]?.toolName ?? "unknown" })
31
- },
32
- setWidgetState: {
33
- isAsync: !1,
34
- extractTags: g
35
- },
36
- sendMessageToHost: {
37
- isAsync: !0,
38
- extractTags: g
39
- },
40
- openLink: {
41
- isAsync: !0,
42
- extractTags: g
43
- },
44
- readResource: {
45
- isAsync: !0,
46
- extractTags: (e) => {
47
- const a = e[0]?.uri ?? "", r = a.indexOf("://");
48
- return { scheme: r > 0 ? a.slice(0, r).toLowerCase() : "unknown" };
49
- }
50
- },
51
- setDisplayMode: {
52
- isAsync: !0,
53
- extractTags: (e) => ({ mode: e[0] ?? "unknown" })
54
- }
55
- };
56
- function V(e, n, a) {
57
- return new Proxy(e, {
58
- get(r, f, p) {
59
- const o = Reflect.get(r, f, p), u = $[f];
60
- return !u || typeof o != "function" ? o : (...d) => {
61
- const m = { ...a(), ...u.extractTags(d) }, c = `sdk.${String(f)}`;
62
- return u.isAsync ? n.activityAsync(c, async () => {
63
- try {
64
- const s = await o.apply(r, d);
65
- return n.incrementCounter(c, 1, !1, m), s;
66
- } catch (s) {
67
- throw n.incrementCounter(c, 1, !0, m), s;
68
- }
69
- }) : (n.incrementCounter(c, 1, !1, m), o.apply(r, d));
70
- };
71
- }
72
- });
73
- }
74
- function Z(e) {
75
- return v(Y(e), "createAnalytics");
76
- }
77
- async function Y(e) {
78
- const { appId: n, clientSessionId: a } = e;
79
- let r;
80
- try {
81
- r = await T();
82
- } catch {
83
- r = x.WebApp;
84
- }
85
- const f = Date.now(), p = e.sdk ?? await _();
86
- let o = null;
87
- e.pftId !== void 0 && S(e.pftId) && (o = e.pftId);
88
- const u = e.enforceInternalGate === !0;
89
- let d = !1;
90
- const m = () => !u || d ? {
91
- axlPftId: M,
92
- ...o !== null ? { pftId: o } : {}
93
- } : {}, c = h("mcp-widget", {
94
- appPayloadProvider: {
95
- getPayload: () => ({
96
- schema: k,
97
- payload: {
98
- appId: n,
99
- surface: r,
100
- ...m()
101
- }
102
- })
103
- },
104
- clientSessionId: a
105
- }), s = c, E = V(p, s, () => ({
106
- surface: r,
107
- ...m()
108
- })), P = K(s);
109
- let y;
110
- e.transport && (y = C(c, {
111
- onEnvelope: (t) => {
112
- e.transport.enqueue(t);
113
- }
114
- }));
115
- let w, i = !1;
116
- return {
117
- instrumentedSDK: E,
118
- app: c,
119
- trackEvent(t, l) {
120
- i || s.log(J, {
121
- eventName: t,
122
- properties: l ? JSON.stringify(l) : ""
123
- });
124
- },
125
- trackInteraction(t, l) {
126
- i || s.log(D, {
127
- elementId: t,
128
- properties: l ? JSON.stringify(l) : ""
129
- });
130
- },
131
- trackError(t, l) {
132
- i || s.error(t, N, {
133
- properties: l ? JSON.stringify(l) : ""
134
- });
135
- },
136
- trackPageView(t) {
137
- i || t !== w && (w = t, s.log(L, { componentRef: t }));
138
- },
139
- setPftId(t) {
140
- i || S(t) && (o = t);
141
- },
142
- setInternalSession(t) {
143
- i || (d = t === !0);
144
- },
145
- dispose() {
146
- if (i) return;
147
- i = !0, P();
148
- const t = Date.now() - f;
149
- s.log(F, { durationMs: t }), y?.dispose();
150
- }
151
- };
152
- }
153
- export {
154
- M as A,
155
- X as I,
156
- W as P,
157
- Z as c,
158
- S as v
159
- };