@salesforce/platform-sdk 9.5.0 → 9.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.
@@ -7,16 +7,28 @@ import { NamedPubSubService } from '@conduit-client/service-pubsub/v1';
7
7
  * cache-control command. Internal to WebAppDataSDK; not part of the public API.
8
8
  */
9
9
  export type CacheServices = NamedCacheControllerService & NamedPubSubService & NamedFetchService;
10
+ export interface SharedCacheBundle {
11
+ cache: Cache;
12
+ cacheController: NamedCacheControllerService["cacheController"];
13
+ pubSub: NamedPubSubService["pubSub"];
14
+ }
10
15
  export interface CacheBundle {
16
+ shared: SharedCacheBundle;
11
17
  services: CacheServices;
12
- cache: Cache;
13
18
  }
14
19
  /**
15
- * Builds a fresh OneStore service set for one WebAppDataSDK instance. Each
16
- * SDK instance owns its own services — no module-level singleton.
17
- *
18
- * The caller passes the SDK's own bound `fetch` so cache misses inherit
19
- * CSRF retry, basePath application, and onStatus callbacks transparently.
20
+ * Module-level registry so all SDK instances targeting the same baseUrl
21
+ * share one cache + cacheController + pubSub — no redundant network
22
+ * requests for identical queries across features.
23
+ * Exported for test isolation only; not part of the public API.
24
+ */
25
+ export declare const cacheBundleRegistry: Map<string, SharedCacheBundle>;
26
+ /**
27
+ * Returns a CacheBundle for the given baseUrl. The shared cache infra
28
+ * (cache, cacheController, pubSub) is deduplicated by baseUrl — all SDK
29
+ * instances targeting the same host share cache state. The per-instance
30
+ * networkFetch ensures cache misses route through the calling SDK's fetch
31
+ * pipeline (CSRF, onStatus callbacks).
20
32
  */
21
- export declare function buildCacheServices(networkFetch: FetchService): CacheBundle;
33
+ export declare function buildCacheServices(baseUrl: string, networkFetch: FetchService): CacheBundle;
22
34
  //# sourceMappingURL=services.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../../src/data/shared/graphql/cache/services.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAE9D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAG5F,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAG5E;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,2BAA2B,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAEjG,MAAM,WAAW,WAAW;IAC3B,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;CACb;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,YAAY,GAAG,WAAW,CAS1E"}
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../../src/data/shared/graphql/cache/services.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAE9D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAG5F,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAG5E;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,2BAA2B,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAEjG,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,KAAK,CAAC;IACb,eAAe,EAAE,2BAA2B,CAAC,iBAAiB,CAAC,CAAC;IAChE,MAAM,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,WAAW;IAC3B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,aAAa,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,gCAAuC,CAAC;AAexE;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,WAAW,CAU3F"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/webapp/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAmC,MAAM,YAAY,CAAC;AAC3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAcrD;;GAEG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyD;IAClF,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;gBAErB,OAAO,CAAC,EAAE,oBAAoB;IA+BpC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAUjF;;;;;OAKG;YACW,iBAAiB;IAc/B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;CAa3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data/webapp/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAmC,MAAM,YAAY,CAAC;AAC3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAcrD;;GAEG;AACH,qBAAa,aAAc,YAAW,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyD;IAClF,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;gBAErB,OAAO,CAAC,EAAE,oBAAoB;IA2BpC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;IAUjF;;;;;OAKG;YACW,iBAAiB;IAc/B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;CAa3B"}
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
- import { buildServiceDescriptor as K, setHeader as _ } from "@conduit-client/service-fetch-network/v1";
2
- import { resolvedPromiseLike as w, ok as k, err as D, stableJSONStringify as Y, DataNotFoundError as Z, UserVisibleError as ee, deepFreeze as z } from "@conduit-client/utils";
3
- import { print as x, parse as te } from "@conduit-client/onestore-graphql-parser/v1";
4
- import { RetryPolicy as se, buildServiceDescriptor as re } from "@conduit-client/service-retry/v1";
5
- import { buildServiceDescriptor as ne } from "@conduit-client/service-cache/v1";
6
- import { buildServiceDescriptor as ie } from "@conduit-client/service-cache-control/v1";
7
- import { buildInMemoryCacheInclusionPolicyService as oe } from "@conduit-client/service-cache-inclusion-policy/v1";
8
- import { buildServiceDescriptor as ae } from "@conduit-client/service-pubsub/v1";
9
- import { HttpCacheControlCommand as ce } from "@conduit-client/command-http-cache-control/v1";
10
- import { encodeCoreEnvelopeContentsRaw as le } from "o11y/collectors";
11
- import { SimpleCollector as ue } from "o11y/simple_collector";
12
- import { registerInstrumentedApp as de } from "o11y/client";
13
- import { analyticsContextSchema as he, sessionSchema as fe, pageViewSchema as pe, errorContextSchema as ge, interactionSchema as me, customEventSchema as ye } from "o11y_schema/sf_mcpanalytics";
1
+ import { buildServiceDescriptor as B, setHeader as _ } from "@conduit-client/service-fetch-network/v1";
2
+ import { resolvedPromiseLike as w, ok as k, err as D, stableJSONStringify as Z, DataNotFoundError as ee, UserVisibleError as te, deepFreeze as z } from "@conduit-client/utils";
3
+ import { print as x, parse as se } from "@conduit-client/onestore-graphql-parser/v1";
4
+ import { RetryPolicy as re, buildServiceDescriptor as ne } from "@conduit-client/service-retry/v1";
5
+ import { buildServiceDescriptor as ie } from "@conduit-client/service-cache/v1";
6
+ import { buildServiceDescriptor as oe } from "@conduit-client/service-cache-control/v1";
7
+ import { buildInMemoryCacheInclusionPolicyService as ae } from "@conduit-client/service-cache-inclusion-policy/v1";
8
+ import { buildServiceDescriptor as ce } from "@conduit-client/service-pubsub/v1";
9
+ import { HttpCacheControlCommand as le } from "@conduit-client/command-http-cache-control/v1";
10
+ import { encodeCoreEnvelopeContentsRaw as ue } from "o11y/collectors";
11
+ import { SimpleCollector as de } from "o11y/simple_collector";
12
+ import { registerInstrumentedApp as he } from "o11y/client";
13
+ import { analyticsContextSchema as fe, sessionSchema as pe, pageViewSchema as ge, errorContextSchema as me, interactionSchema as ye, customEventSchema as we } from "o11y_schema/sf_mcpanalytics";
14
14
  var c = /* @__PURE__ */ ((s) => (s.WebApp = "WebApp", s.MicroFrontend = "Micro-Frontend", s.OpenAI = "OpenAI", s.SalesforceACC = "Salesforce-ACC", s.MCPApps = "MCP-Apps", s.Mosaic = "Mosaic", s))(c || {});
15
- const we = ve();
15
+ const be = ve();
16
16
  function ve() {
17
17
  if (typeof window > "u")
18
18
  return "Mosaic";
@@ -28,27 +28,27 @@ function ve() {
28
28
  return s.$A || s.Aura ? "Salesforce-ACC" : "WebApp";
29
29
  }
30
30
  function C(s) {
31
- return s ?? we;
31
+ return s ?? be;
32
32
  }
33
33
  function M(s) {
34
34
  return typeof s == "object" && s !== null && "jsonrpc" in s && s.jsonrpc === "2.0";
35
35
  }
36
- function be(s) {
36
+ function Ce(s) {
37
37
  return M(s) && "id" in s && typeof s.id == "number" && "result" in s;
38
38
  }
39
- function B(s) {
39
+ function j(s) {
40
40
  return M(s) && "id" in s && typeof s.id == "number" && "error" in s;
41
41
  }
42
- function Ce(s) {
43
- return be(s) || B(s);
44
- }
45
42
  function Se(s) {
43
+ return Ce(s) || j(s);
44
+ }
45
+ function Te(s) {
46
46
  return M(s) && "method" in s && typeof s.method == "string" && !("id" in s);
47
47
  }
48
- function es(s) {
48
+ function ss(s) {
49
49
  return M(s) && "id" in s && typeof s.id == "number" && "method" in s && typeof s.method == "string";
50
50
  }
51
- class Te {
51
+ class _e {
52
52
  targetOrigin;
53
53
  /**
54
54
  * @param targetOrigin - origin passed as the second argument to
@@ -69,7 +69,7 @@ class Te {
69
69
  return window.addEventListener("message", t), () => window.removeEventListener("message", t);
70
70
  }
71
71
  }
72
- class _e {
72
+ class Ee {
73
73
  nextRequestId = 1;
74
74
  pending = /* @__PURE__ */ new Map();
75
75
  notificationHandlers = /* @__PURE__ */ new Map();
@@ -81,7 +81,7 @@ class _e {
81
81
  * `WindowPostMessageTransport`, which preserves the original
82
82
  * `window.parent.postMessage` behaviour.
83
83
  */
84
- constructor(e = new Te()) {
84
+ constructor(e = new _e()) {
85
85
  this.transport = e, this.transport.onMessage(this.onMessage);
86
86
  }
87
87
  /**
@@ -110,14 +110,14 @@ class _e {
110
110
  * multiple protocols without cross-talk.
111
111
  */
112
112
  onMessage = (e) => {
113
- if (Ce(e)) {
113
+ if (Se(e)) {
114
114
  const t = this.pending.get(e.id);
115
115
  if (!t)
116
116
  return;
117
- this.pending.delete(e.id), B(e) ? t.reject(new Error(e.error.message || "Request failed")) : t.resolve(e.result);
117
+ this.pending.delete(e.id), j(e) ? t.reject(new Error(e.error.message || "Request failed")) : t.resolve(e.result);
118
118
  return;
119
119
  }
120
- if (Se(e)) {
120
+ if (Te(e)) {
121
121
  const t = this.notificationHandlers.get(e.method);
122
122
  t && t.forEach((r) => r(e.params));
123
123
  }
@@ -181,9 +181,9 @@ class _e {
181
181
  this.transport.post(r);
182
182
  }
183
183
  }
184
- function Ee() {
184
+ function Me() {
185
185
  }
186
- class ts {
186
+ class rs {
187
187
  #e;
188
188
  #s = /* @__PURE__ */ new Set();
189
189
  #n = !1;
@@ -225,7 +225,7 @@ class ts {
225
225
  */
226
226
  onMessage(e) {
227
227
  if (this.#r)
228
- return Ee;
228
+ return Me;
229
229
  this.#s.add(e), this.#n || this.#o();
230
230
  let t = !1;
231
231
  return () => {
@@ -279,8 +279,8 @@ class ts {
279
279
  }
280
280
  };
281
281
  }
282
- const Me = 500, Ae = "2026-01-26";
283
- class y extends _e {
282
+ const Ae = 500, Ie = "2026-01-26";
283
+ class y extends Ee {
284
284
  static initPromise = null;
285
285
  hostCtx = {};
286
286
  _handshakeSucceeded = !1;
@@ -311,11 +311,11 @@ class y extends _e {
311
311
  * still render (graceful degradation for non-SEP-1865 hosts).
312
312
  */
313
313
  async handshake(e) {
314
- const t = e?.handshakeTimeoutMs ?? Me, r = e?.appInfo ?? { name: "mcp-app", version: "1.0.0" };
314
+ const t = e?.handshakeTimeoutMs ?? Ae, r = e?.appInfo ?? { name: "mcp-app", version: "1.0.0" };
315
315
  try {
316
316
  const n = /* @__PURE__ */ Symbol("timeout"), i = await Promise.race([
317
317
  this.request("ui/initialize", {
318
- protocolVersion: Ae,
318
+ protocolVersion: Ie,
319
319
  appInfo: r,
320
320
  appCapabilities: {}
321
321
  }),
@@ -351,7 +351,7 @@ class y extends _e {
351
351
  super.registerNotificationHandler(e, t);
352
352
  }
353
353
  }
354
- const Ie = {
354
+ const ke = {
355
355
  callTool: !0,
356
356
  sendMessageToHost: !0,
357
357
  readResource: !0,
@@ -372,7 +372,7 @@ const Ie = {
372
372
  // TODO
373
373
  getTheme: !0,
374
374
  resize: !0
375
- }, ke = {
375
+ }, De = {
376
376
  callTool: !0,
377
377
  sendMessageToHost: !0,
378
378
  readResource: !1,
@@ -392,7 +392,7 @@ const Ie = {
392
392
  displayModal: !0,
393
393
  getTheme: !0,
394
394
  resize: !1
395
- }, De = {
395
+ }, Pe = {
396
396
  callTool: !1,
397
397
  sendMessageToHost: !0,
398
398
  readResource: !1,
@@ -412,7 +412,7 @@ const Ie = {
412
412
  displayModal: !1,
413
413
  getTheme: !0,
414
414
  resize: !1
415
- }, Pe = {
415
+ }, Le = {
416
416
  callTool: !1,
417
417
  sendMessageToHost: !1,
418
418
  readResource: !1,
@@ -433,26 +433,26 @@ const Ie = {
433
433
  getTheme: !1,
434
434
  resize: !1
435
435
  };
436
- function ss(s) {
436
+ function ns(s) {
437
437
  switch (s) {
438
438
  case c.MCPApps:
439
- return { ...Ie };
440
- case c.OpenAI:
441
439
  return { ...ke };
442
- case c.SalesforceACC:
440
+ case c.OpenAI:
443
441
  return { ...De };
442
+ case c.SalesforceACC:
443
+ return { ...Pe };
444
444
  case c.Mosaic:
445
445
  case c.WebApp:
446
446
  case c.MicroFrontend:
447
447
  default:
448
- return { ...Pe };
448
+ return { ...Le };
449
449
  }
450
450
  }
451
- const Le = /* @__PURE__ */ new Set(["then", "catch", "finally"]);
451
+ const xe = /* @__PURE__ */ new Set(["then", "catch", "finally"]);
452
452
  function A(s, e) {
453
453
  return new Proxy(s, {
454
454
  get(t, r, n) {
455
- if (typeof r == "symbol" || Le.has(r)) {
455
+ if (typeof r == "symbol" || xe.has(r)) {
456
456
  const i = Reflect.get(t, r, n);
457
457
  return typeof i == "function" ? i.bind(t) : i;
458
458
  }
@@ -463,7 +463,7 @@ Use \`const sdk = await ${e}();\` before accessing SDK methods.`
463
463
  }
464
464
  });
465
465
  }
466
- class xe {
466
+ class Re {
467
467
  constructor(e) {
468
468
  this.session = e;
469
469
  const t = e.getHostContext();
@@ -600,7 +600,7 @@ class xe {
600
600
  }
601
601
  }
602
602
  const N = "openai:set_globals";
603
- class Re {
603
+ class Oe {
604
604
  sendMessageToHost(e) {
605
605
  return window.openai.sendFollowUpMessage({ prompt: e.content });
606
606
  }
@@ -640,7 +640,7 @@ class Re {
640
640
  };
641
641
  }
642
642
  }
643
- class Oe {
643
+ class He {
644
644
  async sendMessageToHost(e) {
645
645
  throw console.warn("SalesforceACCChatSDK.sendMessageToHost: stub implementation", e), new Error("SalesforceACCChatSDK.sendMessageToHost not yet implemented");
646
646
  }
@@ -649,30 +649,30 @@ class Oe {
649
649
  }
650
650
  }
651
651
  let S = null, R = null;
652
- function He(s) {
653
- return S || (S = qe(s).then((e) => (R = e, e))), S;
652
+ function qe(s) {
653
+ return S || (S = Ne(s).then((e) => (R = e, e))), S;
654
654
  }
655
- function rs() {
655
+ function is() {
656
656
  return R;
657
657
  }
658
- function ns() {
658
+ function os() {
659
659
  S = null, R = null;
660
660
  }
661
- function qe(s) {
661
+ function Ne(s) {
662
662
  return A(
663
663
  (async () => {
664
664
  switch (C(s?.surface)) {
665
665
  case c.OpenAI:
666
- return new Re();
666
+ return new Oe();
667
667
  case c.WebApp:
668
668
  case c.Mosaic:
669
669
  return {};
670
670
  case c.SalesforceACC:
671
- return new Oe();
671
+ return new He();
672
672
  case c.MicroFrontend:
673
673
  case c.MCPApps: {
674
674
  const t = await y.getInstance(s?.mcpApps);
675
- return t.handshakeSucceeded ? new xe(t) : {};
675
+ return t.handshakeSucceeded ? new Re(t) : {};
676
676
  }
677
677
  default:
678
678
  return {};
@@ -681,7 +681,7 @@ function qe(s) {
681
681
  "createChatSDK"
682
682
  );
683
683
  }
684
- function Ne(s) {
684
+ function Fe(s) {
685
685
  switch (s) {
686
686
  case "info":
687
687
  return "ℹ️";
@@ -696,7 +696,7 @@ function Ne(s) {
696
696
  }
697
697
  }
698
698
  function P(s, e) {
699
- return `${Ne(e)} ${s}`;
699
+ return `${Fe(e)} ${s}`;
700
700
  }
701
701
  function F(s, e) {
702
702
  const t = s.trim();
@@ -714,7 +714,7 @@ function F(s, e) {
714
714
  error: `Invalid ${e}: "${s}". Value must be a positive number.`
715
715
  } : { success: !0, value: n };
716
716
  }
717
- class Fe {
717
+ class Ue {
718
718
  constructor(e) {
719
719
  this.session = e;
720
720
  }
@@ -759,7 +759,7 @@ class Fe {
759
759
  return r.value !== void 0 && (i.width = r.value), n.value !== void 0 && (i.height = n.value), this.session.sendNotification("ui/notifications/size-changed", i), Promise.resolve();
760
760
  }
761
761
  }
762
- class Ue {
762
+ class Ve {
763
763
  async displayAlert(e) {
764
764
  const t = e.level || "info", r = P(e.message, t);
765
765
  await window.openai.sendFollowUpMessage({ prompt: r });
@@ -780,21 +780,21 @@ class Ue {
780
780
  }
781
781
  }
782
782
  let T = null, O = null;
783
- function is(s) {
784
- return T || (T = Ve(s).then((e) => (O = e, e))), T;
783
+ function as(s) {
784
+ return T || (T = We(s).then((e) => (O = e, e))), T;
785
785
  }
786
- function os() {
786
+ function cs() {
787
787
  return O;
788
788
  }
789
- function as() {
789
+ function ls() {
790
790
  T = null, O = null;
791
791
  }
792
- function Ve(s) {
792
+ function We(s) {
793
793
  return A(
794
794
  (async () => {
795
795
  switch (C(s?.surface)) {
796
796
  case c.OpenAI:
797
- return new Ue();
797
+ return new Ve();
798
798
  case c.WebApp:
799
799
  case c.Mosaic:
800
800
  return {};
@@ -803,7 +803,7 @@ function Ve(s) {
803
803
  case c.MicroFrontend:
804
804
  case c.MCPApps: {
805
805
  const t = await y.getInstance(s?.mcpApps);
806
- return t.handshakeSucceeded ? new Fe(t) : {};
806
+ return t.handshakeSucceeded ? new Ue(t) : {};
807
807
  }
808
808
  default:
809
809
  return {};
@@ -812,7 +812,7 @@ function Ve(s) {
812
812
  "createViewSDK"
813
813
  );
814
814
  }
815
- function We(s) {
815
+ function $e(s) {
816
816
  return (e) => {
817
817
  const [t, r] = e;
818
818
  if (typeof t == "string" && !t.startsWith("http")) {
@@ -822,12 +822,12 @@ function We(s) {
822
822
  return w(e);
823
823
  };
824
824
  }
825
- function $e(s) {
825
+ function Ke(s) {
826
826
  return (e) => w(_("Authorization", `Bearer ${s}`, e));
827
827
  }
828
- function Ke(s, e) {
828
+ function Be(s, e) {
829
829
  const t = [];
830
- return s && t.push(We(s)), e && t.push($e(e)), K({
830
+ return s && t.push($e(s)), e && t.push(Ke(e)), B({
831
831
  request: t
832
832
  }).service;
833
833
  }
@@ -836,9 +836,9 @@ const E = () => {
836
836
  };
837
837
  function H(s) {
838
838
  try {
839
- return k(te(s));
839
+ return k(se(s));
840
840
  } catch (e) {
841
- return D(v(e));
841
+ return D(b(e));
842
842
  }
843
843
  }
844
844
  function q(s, e) {
@@ -847,7 +847,7 @@ function q(s, e) {
847
847
  );
848
848
  return t.length === 0 ? "unknown" : t.length === 1 ? e === void 0 || t[0].name?.value === e ? t[0].operation : "unknown" : e === void 0 ? "unknown" : t.find((r) => r.name?.value === e)?.operation ?? "unknown";
849
849
  }
850
- function v(s) {
850
+ function b(s) {
851
851
  if (s && typeof s == "object" && "data" in s) {
852
852
  const e = s.data;
853
853
  if (e && typeof e == "object" && "errors" in e && Array.isArray(e.errors))
@@ -855,7 +855,7 @@ function v(s) {
855
855
  }
856
856
  return s instanceof Error ? [{ message: s.message }] : typeof s == "string" ? [{ message: s }] : [{ message: "Unknown error" }];
857
857
  }
858
- async function j(s, { mutation: e, variables: t, operationName: r }) {
858
+ async function Q(s, { mutation: e, variables: t, operationName: r }) {
859
859
  const n = H(e);
860
860
  if (n.isErr()) return { data: void 0, errors: n.error };
861
861
  const i = n.value, o = q(i, r);
@@ -879,10 +879,10 @@ async function j(s, { mutation: e, variables: t, operationName: r }) {
879
879
  errors: a.errors
880
880
  };
881
881
  } catch (a) {
882
- return { data: void 0, errors: v(a) };
882
+ return { data: void 0, errors: b(a) };
883
883
  }
884
884
  }
885
- function Q(s) {
885
+ function G(s) {
886
886
  function e(r, n, i) {
887
887
  return s({
888
888
  query: x(r),
@@ -893,7 +893,7 @@ function Q(s) {
893
893
  data: o.data ?? void 0,
894
894
  errors: o.errors
895
895
  }),
896
- (o) => ({ data: void 0, errors: v(o) })
896
+ (o) => ({ data: void 0, errors: b(o) })
897
897
  );
898
898
  }
899
899
  async function t({
@@ -938,20 +938,20 @@ function Q(s) {
938
938
  }
939
939
  return {
940
940
  query: t,
941
- mutate: (r) => j(s, r)
941
+ mutate: (r) => Q(s, r)
942
942
  };
943
943
  }
944
944
  const ze = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0";
945
- function G(s = ze) {
945
+ function J(s = ze) {
946
946
  return `/services/data/v${s}`;
947
947
  }
948
- class Be {
948
+ class je {
949
949
  clientFetch;
950
950
  pathData;
951
951
  graphql;
952
952
  constructor(e) {
953
- const t = je(), r = Qe(e?.instanceUrl ?? t.instanceUrl), n = e?.accessToken ?? t.accessToken;
954
- this.pathData = G(e?.apiVersion ?? t.apiVersion), this.clientFetch = Ke(r || void 0, n), this.graphql = Q(this.executeRawGraphQL.bind(this));
953
+ const t = Qe(), r = Ge(e?.instanceUrl ?? t.instanceUrl), n = e?.accessToken ?? t.accessToken;
954
+ this.pathData = J(e?.apiVersion ?? t.apiVersion), this.clientFetch = Be(r || void 0, n), this.graphql = G(this.executeRawGraphQL.bind(this));
955
955
  }
956
956
  async executeRawGraphQL({
957
957
  query: e,
@@ -968,7 +968,7 @@ class Be {
968
968
  })).json();
969
969
  }
970
970
  }
971
- function je() {
971
+ function Qe() {
972
972
  const s = globalThis.MOSAIC_ENV;
973
973
  return {
974
974
  instanceUrl: s?.instanceUrl,
@@ -976,45 +976,45 @@ function je() {
976
976
  apiVersion: s?.apiVersion
977
977
  };
978
978
  }
979
- function Qe(s) {
979
+ function Ge(s) {
980
980
  if (!s || s === "/") return "";
981
981
  let e = s;
982
982
  return !e.startsWith("/") && !e.startsWith("http") && (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
983
983
  }
984
- const Ge = "graphqlQuery";
985
- class Je {
984
+ const Je = "graphqlQuery";
985
+ class Xe {
986
986
  graphql;
987
987
  constructor() {
988
- this.graphql = Q(this.executeRawGraphQL.bind(this));
988
+ this.graphql = G(this.executeRawGraphQL.bind(this));
989
989
  }
990
990
  async executeRawGraphQL({
991
991
  query: e,
992
992
  variables: t,
993
993
  operationName: r
994
994
  }) {
995
- return (await window.openai.callTool(Ge, {
995
+ return (await window.openai.callTool(Je, {
996
996
  query: e,
997
997
  ...t != null ? { variables: t } : {},
998
998
  ...r != null ? { operationName: r } : {}
999
999
  })).structuredContent;
1000
1000
  }
1001
1001
  }
1002
- const Xe = "X-SFDC-Client-Name", Ye = "X-SFDC-Client-Version", Ze = "@salesforce/platform-sdk", et = "9.5.0", tt = (s) => {
1003
- let e = _(Xe, Ze, s);
1004
- return e = _(Ye, et, e), w(e);
1005
- }, st = "X-CSRF-Token";
1006
- function rt(s, e = {}) {
1002
+ const Ye = "X-SFDC-Client-Name", Ze = "X-SFDC-Client-Version", et = "@salesforce/platform-sdk", tt = "9.6.0", st = (s) => {
1003
+ let e = _(Ye, et, s);
1004
+ return e = _(Ze, tt, e), w(e);
1005
+ }, rt = "X-CSRF-Token";
1006
+ function nt(s, e = {}) {
1007
1007
  const { protectedUrls: t = [], alwaysProtectedUrls: r = [] } = e;
1008
1008
  return async (n) => {
1009
1009
  const [i, o] = n, a = new Request(i, o);
1010
- if (U(r, a.url) || nt(a.method) && U(t, a.url)) {
1010
+ if (U(r, a.url) || it(a.method) && U(t, a.url)) {
1011
1011
  const d = await s.getToken();
1012
- n = _(st, d, n);
1012
+ n = _(rt, d, n);
1013
1013
  }
1014
1014
  return w(n);
1015
1015
  };
1016
1016
  }
1017
- function nt(s) {
1017
+ function it(s) {
1018
1018
  const e = s.toLowerCase();
1019
1019
  return e === "post" || e === "put" || e === "patch" || e === "delete";
1020
1020
  }
@@ -1022,16 +1022,16 @@ function U(s, e) {
1022
1022
  const t = new URL(e);
1023
1023
  return s.some((r) => t.pathname.includes(r));
1024
1024
  }
1025
- function it(s, e = {}) {
1026
- const t = rt(s, e);
1025
+ function ot(s, e = {}) {
1026
+ const t = nt(s, e);
1027
1027
  async function r(n) {
1028
1028
  const i = await t(n);
1029
1029
  return fetch(i[0], i[1]);
1030
1030
  }
1031
1031
  return (n, i) => i ? i.applyRetry(async () => r(n)) : r(n);
1032
1032
  }
1033
- const ot = [400, 401, 403];
1034
- class at extends se {
1033
+ const at = [400, 401, 403];
1034
+ class ct extends re {
1035
1035
  constructor(e) {
1036
1036
  super(e), this.csrfTokenManager = e;
1037
1037
  }
@@ -1039,7 +1039,7 @@ class at extends se {
1039
1039
  * Determines if a failed request should be retried due to CSRF token issues.
1040
1040
  */
1041
1041
  async shouldRetry(e, t) {
1042
- return t.attempt >= 1 ? !1 : ot.includes(e.status);
1042
+ return t.attempt >= 1 ? !1 : at.includes(e.status);
1043
1043
  }
1044
1044
  /**
1045
1045
  * CSRF token refresh should happen immediately with no delay.
@@ -1057,7 +1057,7 @@ class at extends se {
1057
1057
  await this.csrfTokenManager.refreshToken();
1058
1058
  }
1059
1059
  }
1060
- class ct {
1060
+ class lt {
1061
1061
  constructor(e, t) {
1062
1062
  this.endpoint = e, this.cacheName = t, this.tokenPromise = this.obtainToken();
1063
1063
  }
@@ -1106,33 +1106,46 @@ class ct {
1106
1106
  }
1107
1107
  }
1108
1108
  const V = /* @__PURE__ */ new Map();
1109
- function lt(s) {
1109
+ function ut(s) {
1110
1110
  const { endpoint: e, cacheName: t, ...r } = s.csrf;
1111
1111
  let n = V.get(e);
1112
- return n || (n = new ct(e, t), V.set(e, n)), K(
1112
+ return n || (n = new lt(e, t), V.set(e, n)), B(
1113
1113
  {
1114
- retry: it(n, r),
1115
- request: [tt]
1114
+ retry: ot(n, r),
1115
+ request: [st]
1116
1116
  },
1117
- re(new at(n)).service
1117
+ ne(new ct(n)).service
1118
1118
  ).service;
1119
1119
  }
1120
- function ut(s) {
1121
- const e = ne().service, t = oe(e).service, r = ie(e, t).service, n = ae().service;
1120
+ const W = /* @__PURE__ */ new Map();
1121
+ function dt(s) {
1122
+ let e = W.get(s);
1123
+ if (!e) {
1124
+ const t = ie().service, r = ae(t).service, n = oe(t, r).service, i = ce().service;
1125
+ e = { cache: t, cacheController: n, pubSub: i }, W.set(s, e);
1126
+ }
1127
+ return e;
1128
+ }
1129
+ function ht(s, e) {
1130
+ const t = dt(s);
1122
1131
  return {
1123
- cache: e,
1124
- services: { cacheController: r, pubSub: n, fetch: s }
1132
+ shared: t,
1133
+ services: {
1134
+ cacheController: t.cacheController,
1135
+ pubSub: t.pubSub,
1136
+ fetch: e
1137
+ }
1125
1138
  };
1126
1139
  }
1127
- function J() {
1140
+ function X() {
1128
1141
  return {
1129
1142
  "Content-Type": "application/json",
1130
1143
  Accept: "application/json",
1131
1144
  "X-Chatter-Entity-Encoding": "false"
1132
1145
  };
1133
1146
  }
1134
- const W = 300;
1135
- function dt(s, e) {
1147
+ const $ = 300;
1148
+ function ft(s, e) {
1136
1149
  try {
1137
1150
  return JSON.parse(JSON.stringify(s));
1138
1151
  } catch (t) {
@@ -1142,19 +1155,19 @@ function dt(s, e) {
1142
1155
  throw n.cause = t, n;
1143
1156
  }
1144
1157
  }
1145
- function ht(s) {
1158
+ function pt(s) {
1146
1159
  if (typeof s == "object" && s.type === "max-age") {
1147
1160
  const e = s.maxAge;
1148
- return Number.isFinite(e) && e >= 0 ? e : W;
1161
+ return Number.isFinite(e) && e >= 0 ? e : $;
1149
1162
  }
1150
- return W;
1163
+ return $;
1151
1164
  }
1152
- class ft extends ce {
1165
+ class gt extends le {
1153
1166
  constructor(e, t, r) {
1154
- super(t), this.url = r, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = dt(
1167
+ super(t), this.url = r, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = ft(
1155
1168
  e.variables ?? {},
1156
1169
  this.normalizedOperationName
1157
- ), this.cacheControl = e.cacheControl, this.resolvedMaxAge = ht(e.cacheControl);
1170
+ ), this.cacheControl = e.cacheControl, this.resolvedMaxAge = pt(e.cacheControl);
1158
1171
  }
1159
1172
  query;
1160
1173
  normalizedVariables;
@@ -1166,7 +1179,7 @@ class ft extends ce {
1166
1179
  this.url,
1167
1180
  {
1168
1181
  method: "POST",
1169
- headers: J(),
1182
+ headers: X(),
1170
1183
  body: JSON.stringify({
1171
1184
  query: this.query,
1172
1185
  variables: this.normalizedVariables,
@@ -1176,7 +1189,7 @@ class ft extends ce {
1176
1189
  ];
1177
1190
  }
1178
1191
  buildKey() {
1179
- return Y({
1192
+ return Z({
1180
1193
  query: this.query,
1181
1194
  variables: this.normalizedVariables,
1182
1195
  operationName: this.normalizedOperationName
@@ -1197,7 +1210,7 @@ class ft extends ce {
1197
1210
  */
1198
1211
  readFromCache(e) {
1199
1212
  const t = this.buildKey(), r = e.get(t)?.value;
1200
- return r === void 0 ? w(D(new Z())) : w(k(r));
1213
+ return r === void 0 ? w(D(new ee())) : w(k(r));
1201
1214
  }
1202
1215
  writeToCache(e, t) {
1203
1216
  if (t.isOk() && t.value.data != null && Object.keys(t.value.data).length > 0) {
@@ -1227,31 +1240,31 @@ class ft extends ce {
1227
1240
  return e.errors && e.errors.length > 0;
1228
1241
  }
1229
1242
  processFetchReturnValue(e) {
1230
- return this.responseHasErrors(e) ? D(new ee(e)) : k(e);
1243
+ return this.responseHasErrors(e) ? D(new te(e)) : k(e);
1231
1244
  }
1232
1245
  }
1233
- function pt(s) {
1246
+ function mt(s) {
1234
1247
  return (e) => {
1235
1248
  if (e.isOk()) {
1236
1249
  const t = e.value;
1237
1250
  z(t), s({ data: t, errors: void 0 });
1238
1251
  } else
1239
- s({ data: void 0, errors: v(e.error) });
1252
+ s({ data: void 0, errors: b(e.error) });
1240
1253
  };
1241
1254
  }
1242
- async function gt(s) {
1255
+ async function yt(s) {
1243
1256
  let e, t, r;
1244
1257
  try {
1245
1258
  const n = await s.execute();
1246
- n.isOk() ? (e = n.value.data, z(e), r = (i) => n.value.subscribe(i)) : (t = v(n.error.failure), r = (i) => n.error.subscribe(i));
1259
+ n.isOk() ? (e = n.value.data, z(e), r = (i) => n.value.subscribe(i)) : (t = b(n.error.failure), r = (i) => n.error.subscribe(i));
1247
1260
  } catch (n) {
1248
- t = v(n);
1261
+ t = b(n);
1249
1262
  }
1250
1263
  return {
1251
1264
  data: e,
1252
1265
  errors: t,
1253
1266
  subscribe(n) {
1254
- return r ? r(pt(n)) : E;
1267
+ return r ? r(mt(n)) : E;
1255
1268
  },
1256
1269
  async refresh() {
1257
1270
  await s.refresh();
@@ -1266,7 +1279,7 @@ function I(s) {
1266
1279
  refresh: L
1267
1280
  };
1268
1281
  }
1269
- function mt({
1282
+ function wt({
1270
1283
  bundle: s,
1271
1284
  url: e,
1272
1285
  executeRaw: t
@@ -1289,7 +1302,7 @@ function mt({
1289
1302
  ]);
1290
1303
  let l;
1291
1304
  try {
1292
- l = new ft(
1305
+ l = new gt(
1293
1306
  {
1294
1307
  query: x(p),
1295
1308
  variables: o,
@@ -1300,35 +1313,35 @@ function mt({
1300
1313
  e
1301
1314
  );
1302
1315
  } catch (u) {
1303
- return I(v(u));
1316
+ return I(b(u));
1304
1317
  }
1305
- return gt(l);
1318
+ return yt(l);
1306
1319
  }
1307
1320
  return {
1308
1321
  query: n,
1309
- mutate: (i) => j(t, i)
1322
+ mutate: (i) => Q(t, i)
1310
1323
  };
1311
1324
  }
1312
- const yt = 1, wt = `@salesforce/platform-sdk-data_v${yt}`, X = G(), vt = `${X}/ui-api`, $ = `${X}/graphql`;
1313
- class bt {
1325
+ const bt = 1, vt = `@salesforce/platform-sdk-data_v${bt}`, Y = J(), Ct = `${Y}/ui-api`, K = `${Y}/graphql`;
1326
+ class St {
1314
1327
  baseUrl;
1315
1328
  clientFetch;
1316
1329
  onStatus;
1317
1330
  graphql;
1318
1331
  constructor(e) {
1319
- const t = Ct();
1320
- this.baseUrl = St(e?.basePath ?? t.apiPath), this.onStatus = e?.onStatus ?? {}, this.clientFetch = lt({
1332
+ const t = Tt();
1333
+ this.baseUrl = _t(e?.basePath ?? t.apiPath), this.onStatus = e?.onStatus ?? {}, this.clientFetch = ut({
1321
1334
  csrf: {
1322
- endpoint: `${this.baseUrl}${vt}/session/csrf`,
1323
- cacheName: wt,
1335
+ endpoint: `${this.baseUrl}${Ct}/session/csrf`,
1336
+ cacheName: vt,
1324
1337
  protectedUrls: ["services/data/v", "services/apexrest"],
1325
1338
  alwaysProtectedUrls: ["services/apexrest"]
1326
1339
  }
1327
1340
  });
1328
- const n = ut((i, o) => this.fetch(i, o));
1329
- this.graphql = mt({
1341
+ const r = (i, o) => this.fetch(i, o), n = ht(this.baseUrl, r);
1342
+ this.graphql = wt({
1330
1343
  bundle: n,
1331
- url: $,
1344
+ url: K,
1332
1345
  executeRaw: this.executeRawGraphQL.bind(this)
1333
1346
  });
1334
1347
  }
@@ -1347,10 +1360,10 @@ class bt {
1347
1360
  variables: t,
1348
1361
  operationName: r
1349
1362
  }) {
1350
- return (await this.fetch($, {
1363
+ return (await this.fetch(K, {
1351
1364
  method: "POST",
1352
1365
  body: JSON.stringify({ query: e, variables: t, operationName: r }),
1353
- headers: J()
1366
+ headers: X()
1354
1367
  })).json();
1355
1368
  }
1356
1369
  /**
@@ -1367,33 +1380,33 @@ class bt {
1367
1380
  return e;
1368
1381
  }
1369
1382
  }
1370
- function Ct() {
1383
+ function Tt() {
1371
1384
  return {
1372
1385
  apiPath: globalThis.SFDC_ENV?.apiPath
1373
1386
  };
1374
1387
  }
1375
- function St(s) {
1388
+ function _t(s) {
1376
1389
  if (!s || s === "/") return "";
1377
1390
  let e = s;
1378
1391
  return e.startsWith("/") || (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
1379
1392
  }
1380
- function cs(s, ...e) {
1393
+ function us(s, ...e) {
1381
1394
  let t = s[0] ?? "";
1382
1395
  for (let r = 0; r < e.length; r += 1)
1383
1396
  t += String(e[r]) + (s[r + 1] ?? "");
1384
1397
  return t;
1385
1398
  }
1386
- function ls(s) {
1399
+ function ds(s) {
1387
1400
  return A(
1388
1401
  (async () => {
1389
1402
  switch (C(s?.surface)) {
1390
1403
  case c.OpenAI:
1391
- return new Je();
1404
+ return new Xe();
1392
1405
  case c.WebApp:
1393
1406
  case c.MicroFrontend:
1394
- return new bt(s?.webapp);
1407
+ return new St(s?.webapp);
1395
1408
  case c.Mosaic:
1396
- return new Be(s?.mosaic);
1409
+ return new je(s?.mosaic);
1397
1410
  case c.SalesforceACC:
1398
1411
  case c.MCPApps:
1399
1412
  return {};
@@ -1404,7 +1417,7 @@ function ls(s) {
1404
1417
  "createDataSDK"
1405
1418
  );
1406
1419
  }
1407
- function us(s) {
1420
+ function hs(s) {
1408
1421
  return A(
1409
1422
  (async () => {
1410
1423
  switch (C(s?.surface)) {
@@ -1427,13 +1440,13 @@ function us(s) {
1427
1440
  "createLightningSDK"
1428
1441
  );
1429
1442
  }
1430
- function Tt(s) {
1443
+ function Et(s) {
1431
1444
  let e = "";
1432
1445
  for (let r = 0; r < s.length; r += 8192)
1433
1446
  e += String.fromCharCode.apply(null, Array.from(s.subarray(r, r + 8192)));
1434
1447
  return btoa(e);
1435
1448
  }
1436
- class _t {
1449
+ class Mt {
1437
1450
  entries = [];
1438
1451
  totalBytes = 0;
1439
1452
  maxBufferSize;
@@ -1448,7 +1461,7 @@ class _t {
1448
1461
  return this.entries.length === 0;
1449
1462
  }
1450
1463
  enqueue(e, t) {
1451
- const r = Tt(e), n = {
1464
+ const r = Et(e), n = {
1452
1465
  data: r,
1453
1466
  traceId: t?.traceId,
1454
1467
  instanceId: t?.instanceId,
@@ -1470,8 +1483,8 @@ class _t {
1470
1483
  e > 0 && this.onError?.({ reason: "buffer_overflow", droppedCount: e });
1471
1484
  }
1472
1485
  }
1473
- const Et = "telemetry/upload";
1474
- class Mt {
1486
+ const At = "telemetry/upload";
1487
+ class It {
1475
1488
  buffer;
1476
1489
  sdk;
1477
1490
  onError;
@@ -1489,8 +1502,8 @@ class Mt {
1489
1502
  flush() {
1490
1503
  if (this.buffer.isEmpty || !this.sdk.callTool)
1491
1504
  return;
1492
- const t = this.buffer.drain().map(At);
1493
- this.sdk.callTool({ toolName: Et, params: { inputs: [{ envelopes: t }] } }).catch((r) => {
1505
+ const t = this.buffer.drain().map(kt);
1506
+ this.sdk.callTool({ toolName: At, params: { inputs: [{ envelopes: t }] } }).catch((r) => {
1494
1507
  this.onError?.({ reason: "tool_call_failed", error: r });
1495
1508
  });
1496
1509
  }
@@ -1498,18 +1511,18 @@ class Mt {
1498
1511
  this.disposed || (this.disposed = !0, this.timerId !== null && (clearInterval(this.timerId), this.timerId = null), document.removeEventListener("visibilitychange", this.handleVisibilityChange), window.removeEventListener("pagehide", this.handlePageHide), this.flush());
1499
1512
  }
1500
1513
  }
1501
- function At(s) {
1514
+ function kt(s) {
1502
1515
  const e = { base64Env: s.data };
1503
1516
  return s.traceId !== void 0 && (e.traceId = s.traceId), e;
1504
1517
  }
1505
- const It = 65536, kt = 3e4;
1506
- function ds(s) {
1518
+ const Dt = 65536, Pt = 3e4;
1519
+ function fs(s) {
1507
1520
  const {
1508
1521
  sdk: e,
1509
- maxBufferSize: t = It,
1510
- flushInterval: r = kt,
1522
+ maxBufferSize: t = Dt,
1523
+ flushInterval: r = Pt,
1511
1524
  onError: n
1512
- } = s, i = new _t({ maxBufferSize: t, onError: n }), o = new Mt(i, e, { flushInterval: r, onError: n });
1525
+ } = s, i = new Mt({ maxBufferSize: t, onError: n }), o = new It(i, e, { flushInterval: r, onError: n });
1513
1526
  return {
1514
1527
  enqueue(a, h) {
1515
1528
  i.enqueue(a, h);
@@ -1519,16 +1532,16 @@ function ds(s) {
1519
1532
  }
1520
1533
  };
1521
1534
  }
1522
- const Dt = 1e4, Pt = 10, Lt = 10, xt = 250, Rt = 1e3;
1523
- function b(s, e) {
1535
+ const Lt = 1e4, xt = 10, Rt = 10, Ot = 250, Ht = 1e3;
1536
+ function v(s, e) {
1524
1537
  if (s !== void 0 && (typeof s != "number" || !Number.isFinite(s) || s <= 0))
1525
1538
  throw new Error(`${e}, if defined, must be a finite number greater than 0`);
1526
1539
  }
1527
- function Ot(s, e) {
1540
+ function qt(s, e) {
1528
1541
  if (typeof s != "function")
1529
1542
  throw new Error(`${e} must be a function`);
1530
1543
  }
1531
- class Ht {
1544
+ class Nt {
1532
1545
  _collector;
1533
1546
  _onEnvelope;
1534
1547
  _onError;
@@ -1549,7 +1562,7 @@ class Ht {
1549
1562
  _lastClickTriggeredAt = 0;
1550
1563
  _isDisposed = !1;
1551
1564
  constructor(e) {
1552
- Ot(e?.onEnvelope, "options.onEnvelope"), b(e.uploadInterval, "options.uploadInterval"), b(e.messagesLimit, "options.messagesLimit"), b(e.metricsLimit, "options.metricsLimit"), b(e.maxUniqueSchemas, "options.maxUniqueSchemas"), b(e.clickUploadDelay, "options.clickUploadDelay"), b(e.clickTriggerCooldown, "options.clickTriggerCooldown"), this._onEnvelope = e.onEnvelope, this._onError = e.onError, this._messagesLimit = e.messagesLimit ?? Pt, this._metricsLimit = e.metricsLimit ?? Lt, this._uploadInterval = e.uploadInterval ?? Dt, this._clickUploadDelay = e.clickUploadDelay ?? xt, this._clickTriggerCooldown = e.clickTriggerCooldown ?? Rt, this._enableClickTrigger = e.enableClickTrigger !== !1, this._enableVisibilityTrigger = e.enableVisibilityTrigger !== !1, this._collector = new ue({
1565
+ qt(e?.onEnvelope, "options.onEnvelope"), v(e.uploadInterval, "options.uploadInterval"), v(e.messagesLimit, "options.messagesLimit"), v(e.metricsLimit, "options.metricsLimit"), v(e.maxUniqueSchemas, "options.maxUniqueSchemas"), v(e.clickUploadDelay, "options.clickUploadDelay"), v(e.clickTriggerCooldown, "options.clickTriggerCooldown"), this._onEnvelope = e.onEnvelope, this._onError = e.onError, this._messagesLimit = e.messagesLimit ?? xt, this._metricsLimit = e.metricsLimit ?? Rt, this._uploadInterval = e.uploadInterval ?? Lt, this._clickUploadDelay = e.clickUploadDelay ?? Ot, this._clickTriggerCooldown = e.clickTriggerCooldown ?? Ht, this._enableClickTrigger = e.enableClickTrigger !== !1, this._enableVisibilityTrigger = e.enableVisibilityTrigger !== !1, this._collector = new de({
1553
1566
  environment: e.environment,
1554
1567
  maxUniqueSchemas: e.maxUniqueSchemas
1555
1568
  }), this._restartInterval(), this._attachWindowListeners();
@@ -1629,7 +1642,7 @@ class Ht {
1629
1642
  metricsCount: this.metricsCount,
1630
1643
  estimatedByteSize: this.estimatedByteSize,
1631
1644
  triggeredAt: Date.now()
1632
- }, r = this._collector.getRawContentsOfCoreEnvelope(), n = le(r);
1645
+ }, r = this._collector.getRawContentsOfCoreEnvelope(), n = ue(r);
1633
1646
  this._restartInterval();
1634
1647
  try {
1635
1648
  await this._onEnvelope(n, t);
@@ -1642,13 +1655,13 @@ class Ht {
1642
1655
  }
1643
1656
  }
1644
1657
  }
1645
- function qt(s, e) {
1658
+ function Ft(s, e) {
1646
1659
  if (!s)
1647
1660
  throw new Error("instrumentedApp is required");
1648
- const t = new Ht(e);
1661
+ const t = new Nt(e);
1649
1662
  return s.registerLogCollector(t), s.registerMetricsCollector(t), e.enableClickTrigger !== !1 && s.activateClickTracker?.(), t;
1650
1663
  }
1651
- function Nt(s) {
1664
+ function Ut(s) {
1652
1665
  const e = (r, n, i, o, a) => {
1653
1666
  s.error(a ?? r);
1654
1667
  }, t = (r) => {
@@ -1661,7 +1674,7 @@ function Nt(s) {
1661
1674
  function m(s, e) {
1662
1675
  return { surface: e };
1663
1676
  }
1664
- const Ft = {
1677
+ const Vt = {
1665
1678
  callTool: {
1666
1679
  isAsync: !0,
1667
1680
  extractTags: (s, e) => ({ toolName: s[0]?.toolName ?? "unknown", surface: e })
@@ -1715,10 +1728,10 @@ const Ft = {
1715
1728
  extractTags: m
1716
1729
  }
1717
1730
  };
1718
- function Ut(s, e, t) {
1731
+ function Wt(s, e, t) {
1719
1732
  return new Proxy(s, {
1720
1733
  get(r, n, i) {
1721
- const o = Reflect.get(r, n, i), a = Ft[n];
1734
+ const o = Reflect.get(r, n, i), a = Vt[n];
1722
1735
  return !a || typeof o != "function" ? o : (...h) => {
1723
1736
  const d = a.extractTags(h, t), p = a.wrapArgs ? a.wrapArgs(h, e) : h, f = `sdk.${String(n)}`;
1724
1737
  return a.isAsync ? e.activityAsync(f, async () => {
@@ -1736,18 +1749,18 @@ function Ut(s, e, t) {
1736
1749
  }
1737
1750
  });
1738
1751
  }
1739
- async function hs(s) {
1740
- const { appId: e, clientSessionId: t } = s, r = C(), n = Date.now(), i = s.sdk ?? await He(), o = de("mcp-widget", {
1752
+ async function ps(s) {
1753
+ const { appId: e, clientSessionId: t } = s, r = C(), n = Date.now(), i = s.sdk ?? await qe(), o = he("mcp-widget", {
1741
1754
  appPayloadProvider: {
1742
1755
  getPayload: () => ({
1743
- schema: he,
1756
+ schema: fe,
1744
1757
  payload: { appId: e, surface: r }
1745
1758
  })
1746
1759
  },
1747
1760
  clientSessionId: t
1748
- }), a = o, h = Ut(i, a, r), d = Nt(a);
1761
+ }), a = o, h = Wt(i, a, r), d = Ut(a);
1749
1762
  let p;
1750
- s.transport && (p = qt(o, {
1763
+ s.transport && (p = Ft(o, {
1751
1764
  onEnvelope: (u) => {
1752
1765
  s.transport.enqueue(u);
1753
1766
  }
@@ -1757,63 +1770,63 @@ async function hs(s) {
1757
1770
  instrumentedSDK: h,
1758
1771
  app: o,
1759
1772
  trackEvent(u, g) {
1760
- l || a.log(ye, {
1773
+ l || a.log(we, {
1761
1774
  eventName: u,
1762
1775
  properties: g ? JSON.stringify(g) : ""
1763
1776
  });
1764
1777
  },
1765
1778
  trackInteraction(u, g) {
1766
- l || a.log(me, {
1779
+ l || a.log(ye, {
1767
1780
  elementId: u,
1768
1781
  properties: g ? JSON.stringify(g) : ""
1769
1782
  });
1770
1783
  },
1771
1784
  trackError(u, g) {
1772
- l || a.error(u, ge, {
1785
+ l || a.error(u, me, {
1773
1786
  properties: g ? JSON.stringify(g) : ""
1774
1787
  });
1775
1788
  },
1776
1789
  trackPageView(u) {
1777
- l || u !== f && (f = u, a.log(pe, { componentRef: u }));
1790
+ l || u !== f && (f = u, a.log(ge, { componentRef: u }));
1778
1791
  },
1779
1792
  dispose() {
1780
1793
  if (l) return;
1781
1794
  l = !0, d();
1782
1795
  const u = Date.now() - n;
1783
- a.log(fe, { durationMs: u }), p?.dispose();
1796
+ a.log(pe, { durationMs: u }), p?.dispose();
1784
1797
  }
1785
1798
  };
1786
1799
  }
1787
1800
  export {
1788
- _e as JsonRpcClient,
1789
- xe as MCPAppsChatSDK,
1790
- Fe as MCPAppsViewSDK,
1801
+ Ee as JsonRpcClient,
1802
+ Re as MCPAppsChatSDK,
1803
+ Ue as MCPAppsViewSDK,
1791
1804
  y as McpAppsSession,
1792
- ts as MessageChannelTransport,
1805
+ rs as MessageChannelTransport,
1793
1806
  c as Surface,
1794
- Ht as TelemetryUploader,
1795
- Te as WindowPostMessageTransport,
1796
- hs as createAnalytics,
1797
- qe as createChatSDK,
1798
- ls as createDataSDK,
1799
- us as createLightningSDK,
1800
- ds as createTelemetryTransport,
1801
- Ve as createViewSDK,
1802
- He as getChatSDK,
1803
- rs as getChatSDKSync,
1807
+ Nt as TelemetryUploader,
1808
+ _e as WindowPostMessageTransport,
1809
+ ps as createAnalytics,
1810
+ Ne as createChatSDK,
1811
+ ds as createDataSDK,
1812
+ hs as createLightningSDK,
1813
+ fs as createTelemetryTransport,
1814
+ We as createViewSDK,
1815
+ qe as getChatSDK,
1816
+ is as getChatSDKSync,
1804
1817
  C as getSurface,
1805
- ss as getSurfaceCapabilities,
1806
- is as getViewSDK,
1807
- os as getViewSDKSync,
1808
- cs as gql,
1818
+ ns as getSurfaceCapabilities,
1819
+ as as getViewSDK,
1820
+ cs as getViewSDKSync,
1821
+ us as gql,
1809
1822
  M as isJsonRpcBase,
1810
- B as isJsonRpcErrorResponse,
1811
- Se as isJsonRpcNotification,
1812
- es as isJsonRpcRequest,
1813
- Ce as isJsonRpcResponse,
1814
- be as isJsonRpcSuccessResponse,
1815
- qt as registerTelemetryUploader,
1816
- ns as resetChatSDK,
1817
- as as resetViewSDK,
1823
+ j as isJsonRpcErrorResponse,
1824
+ Te as isJsonRpcNotification,
1825
+ ss as isJsonRpcRequest,
1826
+ Se as isJsonRpcResponse,
1827
+ Ce as isJsonRpcSuccessResponse,
1828
+ Ft as registerTelemetryUploader,
1829
+ os as resetChatSDK,
1830
+ ls as resetViewSDK,
1818
1831
  A as wrapSDKPromise
1819
1832
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/platform-sdk",
3
- "version": "9.5.0",
3
+ "version": "9.6.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",