@salesforce/platform-sdk 9.12.1 → 9.14.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.
package/dist/index.js CHANGED
@@ -1,19 +1,19 @@
1
- import { buildServiceDescriptor as G, setHeader as E } from "@conduit-client/service-fetch-network/v1";
2
- import { resolvedPromiseLike as b, ok as P, err as L, stableJSONStringify as ne, DataNotFoundError as ie, UserVisibleError as oe, deepFreeze as I, isUserVisibleError as ae } from "@conduit-client/utils";
3
- import { print as O, parse as ce } from "@conduit-client/onestore-graphql-parser/v1";
4
- import { RetryPolicy as le, buildServiceDescriptor as ue } from "@conduit-client/service-retry/v1";
5
- import { buildServiceDescriptor as de } from "@conduit-client/service-cache/v1";
6
- import { buildServiceDescriptor as he } from "@conduit-client/service-cache-control/v1";
7
- import { buildInMemoryCacheInclusionPolicyService as fe } from "@conduit-client/service-cache-inclusion-policy/v1";
8
- import { buildServiceDescriptor as pe } from "@conduit-client/service-pubsub/v1";
9
- import { HttpCacheControlCommand as ge } from "@conduit-client/command-http-cache-control/v1";
10
- import { encodeCoreEnvelopeContentsRaw as me } from "o11y/collectors";
11
- import { SimpleCollector as ye } from "o11y/simple_collector";
12
- import { registerInstrumentedApp as we } from "o11y/client";
13
- import { analyticsContextSchema as be, sessionSchema as ve, pageViewSchema as Ce, errorContextSchema as Se, interactionSchema as Te, customEventSchema as _e } from "o11y_schema/sf_mcpanalytics";
1
+ import { buildServiceDescriptor as J, setHeader as E } from "@conduit-client/service-fetch-network/v1";
2
+ import { resolvedPromiseLike as b, ok as D, err as P, stableJSONStringify as oe, DataNotFoundError as ae, UserVisibleError as ce, deepFreeze as I, isUserVisibleError as le } from "@conduit-client/utils";
3
+ import { print as O, parse as ue } from "@conduit-client/onestore-graphql-parser/v1";
4
+ import { RetryPolicy as de, buildServiceDescriptor as he } from "@conduit-client/service-retry/v1";
5
+ import { buildServiceDescriptor as fe } from "@conduit-client/service-cache/v1";
6
+ import { buildServiceDescriptor as pe } from "@conduit-client/service-cache-control/v1";
7
+ import { buildInMemoryCacheInclusionPolicyService as ge } from "@conduit-client/service-cache-inclusion-policy/v1";
8
+ import { buildServiceDescriptor as me } from "@conduit-client/service-pubsub/v1";
9
+ import { HttpCacheControlCommand as ye } from "@conduit-client/command-http-cache-control/v1";
10
+ import { encodeCoreEnvelopeContentsRaw as we } from "o11y/collectors";
11
+ import { SimpleCollector as be } from "o11y/simple_collector";
12
+ import { registerInstrumentedApp as ve } from "o11y/client";
13
+ import { analyticsContextSchema as Ce, sessionSchema as Se, pageViewSchema as Te, errorContextSchema as _e, interactionSchema as Ee, customEventSchema as Ie } from "o11y_schema/sf_mcpanalytics";
14
14
  var a = /* @__PURE__ */ ((s) => (s.WebApp = "WebApp", s.MicroFrontend = "Micro-Frontend", s.OpenAI = "OpenAI", s.SalesforceACC = "Salesforce-ACC", s.MCPApps = "MCP-Apps", s.Mosaic = "Mosaic", s))(a || {});
15
- const Ee = Ie();
16
- function Ie() {
15
+ const Ae = Me();
16
+ function Me() {
17
17
  if (typeof window > "u")
18
18
  return "Mosaic";
19
19
  if (window.openai)
@@ -28,48 +28,38 @@ function Ie() {
28
28
  return s.$A || s.Aura ? "Salesforce-ACC" : "WebApp";
29
29
  }
30
30
  function S(s) {
31
- return s ?? Ee;
32
- }
33
- function A(s) {
34
- return typeof s == "object" && s !== null && "jsonrpc" in s && s.jsonrpc === "2.0";
35
- }
36
- function Me(s) {
37
- return A(s) && "id" in s && typeof s.id == "number" && "result" in s;
31
+ return s ?? Ae;
38
32
  }
39
33
  function X(s) {
40
- return A(s) && "id" in s && typeof s.id == "number" && "error" in s;
34
+ return typeof s == "object" && s !== null && !Array.isArray(s);
41
35
  }
42
- function Ae(s) {
43
- return Me(s) || X(s);
36
+ function Y(s) {
37
+ return typeof s.id == "number" && Number.isInteger(s.id) && s.id >= 0;
38
+ }
39
+ function H(s) {
40
+ return X(s) && s.jsonrpc === "2.0";
44
41
  }
45
42
  function ke(s) {
46
- return A(s) && "method" in s && typeof s.method == "string" && !("id" in s);
43
+ if (!H(s)) return !1;
44
+ const e = s;
45
+ return !("id" in e) && typeof e.method == "string";
47
46
  }
48
- function us(s) {
49
- return A(s) && "id" in s && typeof s.id == "number" && "method" in s && typeof s.method == "string";
47
+ function De(s) {
48
+ if (!H(s)) return !1;
49
+ const e = s;
50
+ return Y(e) && "result" in e && !("error" in e) && !("method" in e);
50
51
  }
51
- class De {
52
- targetOrigin;
53
- /**
54
- * @param targetOrigin - origin passed as the second argument to
55
- * `window.parent.postMessage`. Defaults to `"*"` for backwards
56
- * compatibility. Pin to the known parent origin when possible to
57
- * prevent leaking messages to a cross-origin navigated parent.
58
- */
59
- constructor(e = "*") {
60
- this.targetOrigin = e;
61
- }
62
- post(e) {
63
- window.parent?.postMessage(e, this.targetOrigin);
64
- }
65
- onMessage(e) {
66
- const t = (r) => {
67
- e(r.data);
68
- };
69
- return window.addEventListener("message", t), () => window.removeEventListener("message", t);
70
- }
52
+ function Z(s) {
53
+ if (!H(s)) return !1;
54
+ const e = s;
55
+ if (!Y(e) || "result" in e || "method" in e) return !1;
56
+ const t = e.error;
57
+ return X(t) && typeof t.code == "number";
71
58
  }
72
- class Pe {
59
+ function Pe(s) {
60
+ return De(s) || Z(s);
61
+ }
62
+ class Le {
73
63
  nextRequestId = 1;
74
64
  pending = /* @__PURE__ */ new Map();
75
65
  notificationHandlers = /* @__PURE__ */ new Map();
@@ -77,21 +67,20 @@ class Pe {
77
67
  /**
78
68
  * Construct a JSON-RPC client bound to the given transport.
79
69
  *
80
- * @param transport - the transport to use; defaults to a
81
- * `WindowPostMessageTransport`, which preserves the original
82
- * `window.parent.postMessage` behaviour.
70
+ * @param transport - the transport to use.
83
71
  */
84
- constructor(e = new De()) {
72
+ constructor(e) {
85
73
  this.transport = e, this.transport.onMessage(this.onMessage);
86
74
  }
87
75
  /**
88
- * Register a handler for a specific JSON-RPC notification method
76
+ * Register a handler for a specific JSON-RPC notification method.
89
77
  *
90
- * Subclasses can register handlers to process specific notification types.
91
- * When a notification with the registered method is received, the handler
92
- * will be invoked with the notification params.
78
+ * Subclasses can register handlers to process specific notification
79
+ * types. When a notification with the registered method is received,
80
+ * the handler will be invoked with the notification params.
93
81
  *
94
- * @param method - The notification method to handle (e.g. "ui/notifications/host-context-changed")
82
+ * @param method - The notification method to handle (e.g.
83
+ * "ui/notifications/host-context-changed")
95
84
  * @param handler - Callback function to process the notification params
96
85
  *
97
86
  * @example
@@ -105,16 +94,16 @@ class Pe {
105
94
  /**
106
95
  * Handle inbound JSON-RPC messages from the transport.
107
96
  *
108
- * Processes both responses (for requests) and notifications. Non-JSON-RPC
109
- * payloads are silently ignored so that a shared transport can be used for
110
- * multiple protocols without cross-talk.
97
+ * Processes both responses (for requests) and notifications.
98
+ * Non-JSON-RPC payloads are silently ignored so that a shared transport
99
+ * can be used for multiple protocols without cross-talk.
111
100
  */
112
101
  onMessage = (e) => {
113
- if (Ae(e)) {
102
+ if (Pe(e)) {
114
103
  const t = this.pending.get(e.id);
115
104
  if (!t)
116
105
  return;
117
- this.pending.delete(e.id), X(e) ? t.reject(new Error(e.error.message || "Request failed")) : t.resolve(e.result);
106
+ this.pending.delete(e.id), Z(e) ? t.reject(new Error(e.error.message || "Request failed")) : t.resolve(e.result);
118
107
  return;
119
108
  }
120
109
  if (ke(e)) {
@@ -181,106 +170,27 @@ class Pe {
181
170
  this.transport.post(r);
182
171
  }
183
172
  }
184
- function Le() {
185
- }
186
- class ds {
187
- #e;
188
- #s = /* @__PURE__ */ new Set();
189
- #n = !1;
190
- #r = !1;
191
- /** Messages queued before `port.start()` has been called. Flushed on first subscribe. */
192
- #t = [];
193
- constructor(e) {
194
- this.#e = e;
195
- }
173
+ class xe {
174
+ targetOrigin;
196
175
  /**
197
- * Post a message to the peer.
198
- *
199
- * Never throws on transient failure — a closed / neutered / disposed
200
- * port silently drops the message. If the transport has not yet
201
- * started (no `onMessage` subscriber), the message is buffered and
202
- * flushed on first subscription.
176
+ * @param targetOrigin - origin passed as the second argument to
177
+ * `window.parent.postMessage`.
203
178
  */
179
+ constructor(e) {
180
+ this.targetOrigin = e;
181
+ }
204
182
  post(e) {
205
- if (!this.#r) {
206
- if (!this.#n) {
207
- this.#t.push(e);
208
- return;
209
- }
210
- try {
211
- this.#e.postMessage(e);
212
- } catch {
213
- }
214
- }
183
+ window.parent?.postMessage(e, this.targetOrigin);
215
184
  }
216
- /**
217
- * Subscribe to inbound messages from the peer. The callback receives
218
- * the **unwrapped** payload (`MessageEvent.data`) — callers never see
219
- * the `MessageEvent` wrapper.
220
- *
221
- * Starts the underlying port on first subscription and flushes any
222
- * messages queued via `post` before the port was started.
223
- *
224
- * Returns an unsubscribe function. Calling it is idempotent.
225
- */
226
185
  onMessage(e) {
227
- if (this.#r)
228
- return Le;
229
- this.#s.add(e), this.#n || this.#o();
230
- let t = !1;
231
- return () => {
232
- t || (t = !0, this.#s.delete(e));
186
+ const t = (r) => {
187
+ e(r.data);
233
188
  };
189
+ return window.addEventListener("message", t), () => window.removeEventListener("message", t);
234
190
  }
235
- /**
236
- * Tear down the transport:
237
- * - remove the internal `message` listener
238
- * - call `port.close()`
239
- * - clear subscriber set and outbound buffer
240
- * - subsequent `post` calls silently no-op
241
- * - subsequent `onMessage` calls return a no-op unsubscribe
242
- */
243
- dispose() {
244
- if (!this.#r) {
245
- this.#r = !0;
246
- try {
247
- this.#e.removeEventListener("message", this.#i);
248
- } catch {
249
- }
250
- this.#s.clear(), this.#t.length = 0;
251
- try {
252
- this.#e.close();
253
- } catch {
254
- }
255
- }
256
- }
257
- #o() {
258
- this.#n = !0, this.#e.addEventListener("message", this.#i);
259
- try {
260
- this.#e.start();
261
- } catch {
262
- }
263
- if (this.#t.length > 0) {
264
- const e = this.#t;
265
- this.#t = [];
266
- for (const t of e)
267
- try {
268
- this.#e.postMessage(t);
269
- } catch {
270
- }
271
- }
272
- }
273
- #i = (e) => {
274
- const t = [...this.#s];
275
- for (const r of t)
276
- try {
277
- r(e.data);
278
- } catch {
279
- }
280
- };
281
191
  }
282
- const xe = 500, Re = "2026-01-26";
283
- class w extends Pe {
192
+ const Oe = 500, He = "2026-01-26";
193
+ class w extends Le {
284
194
  static initPromise = null;
285
195
  hostCtx = {};
286
196
  _handshakeSucceeded = !1;
@@ -289,12 +199,19 @@ class w extends Pe {
289
199
  *
290
200
  * The first call performs the SEP-1865 handshake. Concurrent and subsequent
291
201
  * calls reuse the same session and handshake result.
202
+ *
203
+ * @param options - Optional configuration. `targetOrigin` defaults to `"*"`
204
+ * when omitted; pin to the concrete MCP host origin whenever known.
292
205
  */
293
206
  static async getInstance(e) {
294
- return w.initPromise || (w.initPromise = (async () => {
295
- const t = new w();
296
- return await t.handshake(e), t;
297
- })()), w.initPromise;
207
+ if (!w.initPromise) {
208
+ const t = e?.targetOrigin ?? "*";
209
+ w.initPromise = (async () => {
210
+ const r = new w(new xe(t));
211
+ return await r.handshake(e), r;
212
+ })();
213
+ }
214
+ return w.initPromise;
298
215
  }
299
216
  /**
300
217
  * Reset the singleton (for testing only).
@@ -311,11 +228,11 @@ class w extends Pe {
311
228
  * still render (graceful degradation for non-SEP-1865 hosts).
312
229
  */
313
230
  async handshake(e) {
314
- const t = e?.handshakeTimeoutMs ?? xe, r = e?.appInfo ?? { name: "mcp-app", version: "1.0.0" };
231
+ const t = e?.handshakeTimeoutMs ?? Oe, r = e?.appInfo ?? { name: "mcp-app", version: "1.0.0" };
315
232
  try {
316
233
  const n = /* @__PURE__ */ Symbol("timeout"), i = await Promise.race([
317
234
  this.request("ui/initialize", {
318
- protocolVersion: Re,
235
+ protocolVersion: He,
319
236
  appInfo: r,
320
237
  appCapabilities: {}
321
238
  }),
@@ -351,7 +268,7 @@ class w extends Pe {
351
268
  super.registerNotificationHandler(e, t);
352
269
  }
353
270
  }
354
- const Oe = {
271
+ const Re = {
355
272
  callTool: !0,
356
273
  sendMessageToHost: !0,
357
274
  readResource: !0,
@@ -372,7 +289,7 @@ const Oe = {
372
289
  // TODO
373
290
  getTheme: !0,
374
291
  resize: !0
375
- }, He = {
292
+ }, qe = {
376
293
  callTool: !0,
377
294
  sendMessageToHost: !0,
378
295
  readResource: !1,
@@ -392,7 +309,7 @@ const Oe = {
392
309
  displayModal: !0,
393
310
  getTheme: !0,
394
311
  resize: !1
395
- }, qe = {
312
+ }, Ne = {
396
313
  callTool: !1,
397
314
  sendMessageToHost: !0,
398
315
  readResource: !1,
@@ -412,7 +329,7 @@ const Oe = {
412
329
  displayModal: !1,
413
330
  getTheme: !0,
414
331
  resize: !1
415
- }, Ne = {
332
+ }, Fe = {
416
333
  callTool: !1,
417
334
  sendMessageToHost: !1,
418
335
  readResource: !1,
@@ -433,26 +350,26 @@ const Oe = {
433
350
  getTheme: !1,
434
351
  resize: !1
435
352
  };
436
- function hs(s) {
353
+ function ds(s) {
437
354
  switch (s) {
438
355
  case a.MCPApps:
439
- return { ...Oe };
356
+ return { ...Re };
440
357
  case a.OpenAI:
441
- return { ...He };
442
- case a.SalesforceACC:
443
358
  return { ...qe };
359
+ case a.SalesforceACC:
360
+ return { ...Ne };
444
361
  case a.Mosaic:
445
362
  case a.WebApp:
446
363
  case a.MicroFrontend:
447
364
  default:
448
- return { ...Ne };
365
+ return { ...Fe };
449
366
  }
450
367
  }
451
- const Fe = /* @__PURE__ */ new Set(["then", "catch", "finally"]);
452
- function k(s, e) {
368
+ const Ue = /* @__PURE__ */ new Set(["then", "catch", "finally"]);
369
+ function M(s, e) {
453
370
  return new Proxy(s, {
454
371
  get(t, r, n) {
455
- if (typeof r == "symbol" || Fe.has(r)) {
372
+ if (typeof r == "symbol" || Ue.has(r)) {
456
373
  const i = Reflect.get(t, r, n);
457
374
  return typeof i == "function" ? i.bind(t) : i;
458
375
  }
@@ -463,7 +380,7 @@ Use \`const sdk = await ${e}();\` before accessing SDK methods.`
463
380
  }
464
381
  });
465
382
  }
466
- class Ue {
383
+ class Ve {
467
384
  constructor(e) {
468
385
  this.session = e;
469
386
  const t = e.getHostContext();
@@ -600,7 +517,7 @@ class Ue {
600
517
  }
601
518
  }
602
519
  const U = "openai:set_globals";
603
- class Ve {
520
+ class $e {
604
521
  sendMessageToHost(e) {
605
522
  return window.openai.sendFollowUpMessage({ prompt: e.content });
606
523
  }
@@ -640,7 +557,7 @@ class Ve {
640
557
  };
641
558
  }
642
559
  }
643
- class $e {
560
+ class We {
644
561
  async sendMessageToHost(e) {
645
562
  throw console.warn("SalesforceACCChatSDK.sendMessageToHost: stub implementation", e), new Error("SalesforceACCChatSDK.sendMessageToHost not yet implemented");
646
563
  }
@@ -648,31 +565,31 @@ class $e {
648
565
  return console.warn("SalesforceACCChatSDK.followUpActions: stub implementation"), [];
649
566
  }
650
567
  }
651
- let T = null, H = null;
652
- function We(s) {
653
- return T || (T = Ke(s).then((e) => (H = e, e))), T;
568
+ let T = null, R = null;
569
+ function Ke(s) {
570
+ return T || (T = ze(s).then((e) => (R = e, e))), T;
654
571
  }
655
- function fs() {
656
- return H;
572
+ function hs() {
573
+ return R;
657
574
  }
658
- function ps() {
659
- T = null, H = null;
575
+ function fs() {
576
+ T = null, R = null;
660
577
  }
661
- function Ke(s) {
662
- return k(
578
+ function ze(s) {
579
+ return M(
663
580
  (async () => {
664
581
  switch (S(s?.surface)) {
665
582
  case a.OpenAI:
666
- return new Ve();
583
+ return new $e();
667
584
  case a.WebApp:
668
585
  case a.Mosaic:
669
586
  return {};
670
587
  case a.SalesforceACC:
671
- return new $e();
588
+ return new We();
672
589
  case a.MicroFrontend:
673
590
  case a.MCPApps: {
674
591
  const t = await w.getInstance(s?.mcpApps);
675
- return t.handshakeSucceeded ? new Ue(t) : {};
592
+ return t.handshakeSucceeded ? new Ve(t) : {};
676
593
  }
677
594
  default:
678
595
  return {};
@@ -681,7 +598,7 @@ function Ke(s) {
681
598
  "createChatSDK"
682
599
  );
683
600
  }
684
- function ze(s) {
601
+ function Be(s) {
685
602
  switch (s) {
686
603
  case "info":
687
604
  return "ℹ️";
@@ -695,8 +612,8 @@ function ze(s) {
695
612
  return "ℹ️";
696
613
  }
697
614
  }
698
- function x(s, e) {
699
- return `${ze(e)} ${s}`;
615
+ function L(s, e) {
616
+ return `${Be(e)} ${s}`;
700
617
  }
701
618
  function V(s, e) {
702
619
  const t = s.trim();
@@ -714,7 +631,7 @@ function V(s, e) {
714
631
  error: `Invalid ${e}: "${s}". Value must be a positive number.`
715
632
  } : { success: !0, value: n };
716
633
  }
717
- class Be {
634
+ class je {
718
635
  constructor(e) {
719
636
  this.session = e;
720
637
  }
@@ -724,7 +641,7 @@ class Be {
724
641
  * @param level - The message severity level (defaults to "info")
725
642
  */
726
643
  async sendMessage(e, t = "info") {
727
- const r = x(e, t);
644
+ const r = L(e, t);
728
645
  await this.session.request("ui/message", {
729
646
  role: "user",
730
647
  content: [
@@ -759,13 +676,13 @@ class Be {
759
676
  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
677
  }
761
678
  }
762
- class je {
679
+ class Qe {
763
680
  async displayAlert(e) {
764
- const t = e.level || "info", r = x(e.message, t);
681
+ const t = e.level || "info", r = L(e.message, t);
765
682
  await window.openai.sendFollowUpMessage({ prompt: r });
766
683
  }
767
684
  async displayToast(e) {
768
- const t = e.level || "info", r = x(e.message, t);
685
+ const t = e.level || "info", r = L(e.message, t);
769
686
  await window.openai.sendFollowUpMessage({ prompt: r });
770
687
  }
771
688
  async displayModal(e) {
@@ -780,21 +697,21 @@ class je {
780
697
  }
781
698
  }
782
699
  let _ = null, q = null;
783
- function gs(s) {
784
- return _ || (_ = Je(s).then((e) => (q = e, e))), _;
700
+ function ps(s) {
701
+ return _ || (_ = Ge(s).then((e) => (q = e, e))), _;
785
702
  }
786
- function ms() {
703
+ function gs() {
787
704
  return q;
788
705
  }
789
- function ys() {
706
+ function ms() {
790
707
  _ = null, q = null;
791
708
  }
792
- function Je(s) {
793
- return k(
709
+ function Ge(s) {
710
+ return M(
794
711
  (async () => {
795
712
  switch (S(s?.surface)) {
796
713
  case a.OpenAI:
797
- return new je();
714
+ return new Qe();
798
715
  case a.WebApp:
799
716
  case a.Mosaic:
800
717
  return {};
@@ -803,7 +720,7 @@ function Je(s) {
803
720
  case a.MicroFrontend:
804
721
  case a.MCPApps: {
805
722
  const t = await w.getInstance(s?.mcpApps);
806
- return t.handshakeSucceeded ? new Be(t) : {};
723
+ return t.handshakeSucceeded ? new je(t) : {};
807
724
  }
808
725
  default:
809
726
  return {};
@@ -812,7 +729,7 @@ function Je(s) {
812
729
  "createViewSDK"
813
730
  );
814
731
  }
815
- function Qe(s) {
732
+ function Je(s) {
816
733
  return (e) => {
817
734
  const [t, r] = e;
818
735
  if (typeof t == "string" && !t.startsWith("http")) {
@@ -822,23 +739,23 @@ function Qe(s) {
822
739
  return b(e);
823
740
  };
824
741
  }
825
- function Ge(s) {
742
+ function Xe(s) {
826
743
  return (e) => b(E("Authorization", `Bearer ${s}`, e));
827
744
  }
828
- function Xe(s, e) {
745
+ function Ye(s, e) {
829
746
  const t = [];
830
- return s && t.push(Qe(s)), e && t.push(Ge(e)), G({
747
+ return s && t.push(Je(s)), e && t.push(Xe(e)), J({
831
748
  request: t
832
749
  }).service;
833
750
  }
834
- const M = () => {
835
- }, R = async () => {
751
+ const A = () => {
752
+ }, x = async () => {
836
753
  };
837
754
  function N(s) {
838
755
  try {
839
- return P(ce(s));
756
+ return D(ue(s));
840
757
  } catch (e) {
841
- return L(v(e));
758
+ return P(v(e));
842
759
  }
843
760
  }
844
761
  function F(s, e) {
@@ -855,7 +772,7 @@ function v(s) {
855
772
  }
856
773
  return s instanceof Error ? [{ message: s.message }] : typeof s == "string" ? [{ message: s }] : [{ message: "Unknown error" }];
857
774
  }
858
- async function Y(s, { mutation: e, variables: t, operationName: r }) {
775
+ async function ee(s, { mutation: e, variables: t, operationName: r }) {
859
776
  const n = N(e);
860
777
  if (n.isErr()) return { data: void 0, errors: n.error };
861
778
  const i = n.value, o = F(i, r);
@@ -882,7 +799,7 @@ async function Y(s, { mutation: e, variables: t, operationName: r }) {
882
799
  return { data: void 0, errors: v(c) };
883
800
  }
884
801
  }
885
- function Z(s) {
802
+ function te(s) {
886
803
  function e(r, n, i) {
887
804
  return s({
888
805
  query: O(r),
@@ -906,8 +823,8 @@ function Z(s) {
906
823
  return {
907
824
  data: void 0,
908
825
  errors: o.error,
909
- subscribe: () => M,
910
- refresh: R
826
+ subscribe: () => A,
827
+ refresh: x
911
828
  };
912
829
  const c = o.value, l = F(c, i);
913
830
  if (l !== "query")
@@ -918,8 +835,8 @@ function Z(s) {
918
835
  message: `DataSDK.graphql.query() requires a GraphQL query, received ${l}.`
919
836
  }
920
837
  ],
921
- subscribe: () => M,
922
- refresh: R
838
+ subscribe: () => A,
839
+ refresh: x
923
840
  };
924
841
  const d = /* @__PURE__ */ new Set(), g = n, f = await e(c, g, i);
925
842
  return {
@@ -938,20 +855,20 @@ function Z(s) {
938
855
  }
939
856
  return {
940
857
  query: t,
941
- mutate: (r) => Y(s, r)
858
+ mutate: (r) => ee(s, r)
942
859
  };
943
860
  }
944
- const Ye = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0";
945
- function ee(s = Ye) {
861
+ const Ze = typeof __SF_API_VERSION__ < "u" ? __SF_API_VERSION__ : "65.0";
862
+ function se(s = Ze) {
946
863
  return `/services/data/v${s}`;
947
864
  }
948
- class Ze {
865
+ class et {
949
866
  clientFetch;
950
867
  pathData;
951
868
  graphql;
952
869
  constructor(e) {
953
- const t = et(), r = tt(e?.instanceUrl ?? t.instanceUrl), n = e?.accessToken ?? t.accessToken;
954
- this.pathData = ee(e?.apiVersion ?? t.apiVersion), this.clientFetch = Xe(r || void 0, n), this.graphql = Z(this.executeRawGraphQL.bind(this));
870
+ const t = tt(), r = st(e?.instanceUrl ?? t.instanceUrl), n = e?.accessToken ?? t.accessToken;
871
+ this.pathData = se(e?.apiVersion ?? t.apiVersion), this.clientFetch = Ye(r || void 0, n), this.graphql = te(this.executeRawGraphQL.bind(this));
955
872
  }
956
873
  async executeRawGraphQL({
957
874
  query: e,
@@ -968,7 +885,7 @@ class Ze {
968
885
  })).json();
969
886
  }
970
887
  }
971
- function et() {
888
+ function tt() {
972
889
  const s = globalThis.MOSAIC_ENV;
973
890
  return {
974
891
  instanceUrl: s?.instanceUrl,
@@ -976,45 +893,45 @@ function et() {
976
893
  apiVersion: s?.apiVersion
977
894
  };
978
895
  }
979
- function tt(s) {
896
+ function st(s) {
980
897
  if (!s || s === "/") return "";
981
898
  let e = s;
982
899
  return !e.startsWith("/") && !e.startsWith("http") && (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
983
900
  }
984
- const st = "graphqlQuery";
985
- class rt {
901
+ const rt = "graphqlQuery";
902
+ class nt {
986
903
  graphql;
987
904
  constructor() {
988
- this.graphql = Z(this.executeRawGraphQL.bind(this));
905
+ this.graphql = te(this.executeRawGraphQL.bind(this));
989
906
  }
990
907
  async executeRawGraphQL({
991
908
  query: e,
992
909
  variables: t,
993
910
  operationName: r
994
911
  }) {
995
- return (await window.openai.callTool(st, {
912
+ return (await window.openai.callTool(rt, {
996
913
  query: e,
997
914
  ...t != null ? { variables: t } : {},
998
915
  ...r != null ? { operationName: r } : {}
999
916
  })).structuredContent;
1000
917
  }
1001
918
  }
1002
- const nt = "X-SFDC-Client-Name", it = "X-SFDC-Client-Version", ot = "@salesforce/platform-sdk", at = "9.12.1", ct = (s) => {
1003
- let e = E(nt, ot, s);
1004
- return e = E(it, at, e), b(e);
1005
- }, lt = "X-CSRF-Token";
1006
- function ut(s, e = {}) {
919
+ const it = "X-SFDC-Client-Name", ot = "X-SFDC-Client-Version", at = "@salesforce/platform-sdk", ct = "9.14.0", lt = (s) => {
920
+ let e = E(it, at, s);
921
+ return e = E(ot, ct, e), b(e);
922
+ }, ut = "X-CSRF-Token";
923
+ function dt(s, e = {}) {
1007
924
  const { protectedUrls: t = [], alwaysProtectedUrls: r = [] } = e;
1008
925
  return async (n) => {
1009
926
  const [i, o] = n, c = new Request(i, o);
1010
- if ($(r, c.url) || dt(c.method) && $(t, c.url)) {
927
+ if ($(r, c.url) || ht(c.method) && $(t, c.url)) {
1011
928
  const d = await s.getToken();
1012
- n = E(lt, d, n);
929
+ n = E(ut, d, n);
1013
930
  }
1014
931
  return b(n);
1015
932
  };
1016
933
  }
1017
- function dt(s) {
934
+ function ht(s) {
1018
935
  const e = s.toLowerCase();
1019
936
  return e === "post" || e === "put" || e === "patch" || e === "delete";
1020
937
  }
@@ -1022,16 +939,16 @@ function $(s, e) {
1022
939
  const t = new URL(e);
1023
940
  return s.some((r) => t.pathname.includes(r));
1024
941
  }
1025
- function ht(s, e = {}) {
1026
- const t = ut(s, e);
942
+ function ft(s, e = {}) {
943
+ const t = dt(s, e);
1027
944
  async function r(n) {
1028
945
  const i = await t(n);
1029
946
  return fetch(i[0], i[1]);
1030
947
  }
1031
948
  return (n, i) => i ? i.applyRetry(async () => r(n)) : r(n);
1032
949
  }
1033
- const ft = [400, 401, 403];
1034
- class pt extends le {
950
+ const pt = [400, 401, 403];
951
+ class gt extends de {
1035
952
  constructor(e) {
1036
953
  super(e), this.csrfTokenManager = e;
1037
954
  }
@@ -1039,7 +956,7 @@ class pt extends le {
1039
956
  * Determines if a failed request should be retried due to CSRF token issues.
1040
957
  */
1041
958
  async shouldRetry(e, t) {
1042
- return t.attempt >= 1 ? !1 : ft.includes(e.status);
959
+ return t.attempt >= 1 ? !1 : pt.includes(e.status);
1043
960
  }
1044
961
  /**
1045
962
  * CSRF token refresh should happen immediately with no delay.
@@ -1057,7 +974,7 @@ class pt extends le {
1057
974
  await this.csrfTokenManager.refreshToken();
1058
975
  }
1059
976
  }
1060
- class gt {
977
+ class mt {
1061
978
  constructor(e, t) {
1062
979
  this.endpoint = e, this.cacheName = t, this.tokenPromise = this.obtainToken();
1063
980
  }
@@ -1106,28 +1023,28 @@ class gt {
1106
1023
  }
1107
1024
  }
1108
1025
  const W = /* @__PURE__ */ new Map();
1109
- function mt(s) {
1026
+ function yt(s) {
1110
1027
  const { endpoint: e, cacheName: t, ...r } = s.csrf;
1111
1028
  let n = W.get(e);
1112
- return n || (n = new gt(e, t), W.set(e, n)), G(
1029
+ return n || (n = new mt(e, t), W.set(e, n)), J(
1113
1030
  {
1114
- retry: ht(n, r),
1115
- request: [ct]
1031
+ retry: ft(n, r),
1032
+ request: [lt]
1116
1033
  },
1117
- ue(new pt(n)).service
1034
+ he(new gt(n)).service
1118
1035
  ).service;
1119
1036
  }
1120
1037
  const K = /* @__PURE__ */ new Map();
1121
- function yt(s) {
1038
+ function wt(s) {
1122
1039
  let e = K.get(s);
1123
1040
  if (!e) {
1124
- const t = de().service, r = fe(t).service, n = he(t, r).service, i = pe().service;
1041
+ const t = fe().service, r = ge(t).service, n = pe(t, r).service, i = me().service;
1125
1042
  e = { cache: t, cacheController: n, pubSub: i }, K.set(s, e);
1126
1043
  }
1127
1044
  return e;
1128
1045
  }
1129
- function wt(s, e) {
1130
- const t = yt(s);
1046
+ function bt(s, e) {
1047
+ const t = wt(s);
1131
1048
  return {
1132
1049
  shared: t,
1133
1050
  services: {
@@ -1137,7 +1054,7 @@ function wt(s, e) {
1137
1054
  }
1138
1055
  };
1139
1056
  }
1140
- function te() {
1057
+ function re() {
1141
1058
  return {
1142
1059
  "Content-Type": "application/json",
1143
1060
  Accept: "application/json",
@@ -1145,7 +1062,7 @@ function te() {
1145
1062
  };
1146
1063
  }
1147
1064
  const z = 300;
1148
- function bt(s, e) {
1065
+ function vt(s, e) {
1149
1066
  try {
1150
1067
  return JSON.parse(JSON.stringify(s));
1151
1068
  } catch (t) {
@@ -1155,19 +1072,19 @@ function bt(s, e) {
1155
1072
  throw n.cause = t, n;
1156
1073
  }
1157
1074
  }
1158
- function vt(s) {
1075
+ function Ct(s) {
1159
1076
  if (typeof s == "object" && s.type === "max-age") {
1160
1077
  const e = s.maxAge;
1161
1078
  return Number.isFinite(e) && e >= 0 ? e : z;
1162
1079
  }
1163
1080
  return z;
1164
1081
  }
1165
- class Ct extends ge {
1082
+ class St extends ye {
1166
1083
  constructor(e, t, r) {
1167
- super(t), this.url = r, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = bt(
1084
+ super(t), this.url = r, this.query = e.query, this.normalizedOperationName = e.operationName ?? "", this.normalizedVariables = vt(
1168
1085
  e.variables ?? {},
1169
1086
  this.normalizedOperationName
1170
- ), this.cacheControl = e.cacheControl, this.resolvedMaxAge = vt(e.cacheControl);
1087
+ ), this.cacheControl = e.cacheControl, this.resolvedMaxAge = Ct(e.cacheControl);
1171
1088
  }
1172
1089
  query;
1173
1090
  normalizedVariables;
@@ -1179,7 +1096,7 @@ class Ct extends ge {
1179
1096
  this.url,
1180
1097
  {
1181
1098
  method: "POST",
1182
- headers: te(),
1099
+ headers: re(),
1183
1100
  body: JSON.stringify({
1184
1101
  query: this.query,
1185
1102
  variables: this.normalizedVariables,
@@ -1189,7 +1106,7 @@ class Ct extends ge {
1189
1106
  ];
1190
1107
  }
1191
1108
  buildKey() {
1192
- return ne({
1109
+ return oe({
1193
1110
  query: this.query,
1194
1111
  variables: this.normalizedVariables,
1195
1112
  operationName: this.normalizedOperationName
@@ -1210,7 +1127,7 @@ class Ct extends ge {
1210
1127
  */
1211
1128
  readFromCache(e) {
1212
1129
  const t = this.buildKey(), r = e.get(t)?.value;
1213
- return r === void 0 ? b(L(new ie())) : b(P(r));
1130
+ return r === void 0 ? b(P(new ae())) : b(D(r));
1214
1131
  }
1215
1132
  writeToCache(e, t) {
1216
1133
  if (t.isOk() && t.value.data != null && Object.keys(t.value.data).length > 0) {
@@ -1240,32 +1157,32 @@ class Ct extends ge {
1240
1157
  return e.errors && e.errors.length > 0;
1241
1158
  }
1242
1159
  processFetchReturnValue(e) {
1243
- return this.responseHasErrors(e) ? L(new oe(e)) : P(e);
1160
+ return this.responseHasErrors(e) ? P(new ce(e)) : D(e);
1244
1161
  }
1245
1162
  }
1246
- function se(s) {
1247
- if (ae(s) && s.data && typeof s.data == "object") {
1163
+ function ne(s) {
1164
+ if (le(s) && s.data && typeof s.data == "object") {
1248
1165
  const e = s.data;
1249
1166
  if (e.data != null)
1250
1167
  return e.data;
1251
1168
  }
1252
1169
  }
1253
- function St(s) {
1170
+ function Tt(s) {
1254
1171
  return (e) => {
1255
1172
  if (e.isOk()) {
1256
1173
  const t = e.value;
1257
1174
  I(t), s({ data: t, errors: void 0 });
1258
1175
  } else {
1259
- const t = se(e.error);
1176
+ const t = ne(e.error);
1260
1177
  t && I(t), s({ data: t, errors: v(e.error) });
1261
1178
  }
1262
1179
  };
1263
1180
  }
1264
- async function Tt(s) {
1181
+ async function _t(s) {
1265
1182
  let e, t, r;
1266
1183
  try {
1267
1184
  const n = await s.execute();
1268
- n.isOk() ? (e = n.value.data, I(e), r = (i) => n.value.subscribe(i)) : (e = se(n.error.failure), e && I(e), t = v(n.error.failure), r = (i) => n.error.subscribe(i));
1185
+ n.isOk() ? (e = n.value.data, I(e), r = (i) => n.value.subscribe(i)) : (e = ne(n.error.failure), e && I(e), t = v(n.error.failure), r = (i) => n.error.subscribe(i));
1269
1186
  } catch (n) {
1270
1187
  t = v(n);
1271
1188
  }
@@ -1273,22 +1190,22 @@ async function Tt(s) {
1273
1190
  data: e,
1274
1191
  errors: t,
1275
1192
  subscribe(n) {
1276
- return r ? r(St(n)) : M;
1193
+ return r ? r(Tt(n)) : A;
1277
1194
  },
1278
1195
  async refresh() {
1279
1196
  await s.refresh();
1280
1197
  }
1281
1198
  };
1282
1199
  }
1283
- function D(s) {
1200
+ function k(s) {
1284
1201
  return {
1285
1202
  data: void 0,
1286
1203
  errors: s,
1287
- subscribe: () => M,
1288
- refresh: R
1204
+ subscribe: () => A,
1205
+ refresh: x
1289
1206
  };
1290
1207
  }
1291
- function _t({
1208
+ function Et({
1292
1209
  bundle: s,
1293
1210
  url: e,
1294
1211
  executeRaw: t
@@ -1301,17 +1218,17 @@ function _t({
1301
1218
  cacheControl: l
1302
1219
  }) {
1303
1220
  const d = N(i);
1304
- if (d.isErr()) return D(d.error);
1221
+ if (d.isErr()) return k(d.error);
1305
1222
  const g = d.value, f = F(g, c);
1306
1223
  if (f !== "query")
1307
- return D([
1224
+ return k([
1308
1225
  {
1309
1226
  message: `DataSDK.graphql.query() requires a GraphQL query, received ${f}.`
1310
1227
  }
1311
1228
  ]);
1312
1229
  let h;
1313
1230
  try {
1314
- h = new Ct(
1231
+ h = new St(
1315
1232
  {
1316
1233
  query: O(g),
1317
1234
  variables: o,
@@ -1322,33 +1239,33 @@ function _t({
1322
1239
  e
1323
1240
  );
1324
1241
  } catch (p) {
1325
- return D(v(p));
1242
+ return k(v(p));
1326
1243
  }
1327
- return Tt(h);
1244
+ return _t(h);
1328
1245
  }
1329
1246
  return {
1330
1247
  query: n,
1331
- mutate: (i) => Y(t, i)
1248
+ mutate: (i) => ee(t, i)
1332
1249
  };
1333
1250
  }
1334
- const Et = 1, It = `@salesforce/platform-sdk-data_v${Et}`, re = ee(), Mt = `${re}/ui-api`, B = `${re}/graphql`;
1335
- class At {
1251
+ const It = 1, At = `@salesforce/platform-sdk-data_v${It}`, ie = se(), Mt = `${ie}/ui-api`, B = `${ie}/graphql`;
1252
+ class kt {
1336
1253
  baseUrl;
1337
1254
  clientFetch;
1338
1255
  onStatus;
1339
1256
  graphql;
1340
1257
  constructor(e) {
1341
- const t = kt();
1342
- this.baseUrl = Dt(e?.basePath ?? t.apiPath), this.onStatus = e?.onStatus ?? {}, this.clientFetch = mt({
1258
+ const t = Dt();
1259
+ this.baseUrl = Pt(e?.basePath ?? t.apiPath), this.onStatus = e?.onStatus ?? {}, this.clientFetch = yt({
1343
1260
  csrf: {
1344
1261
  endpoint: `${this.baseUrl}${Mt}/session/csrf`,
1345
- cacheName: It,
1262
+ cacheName: At,
1346
1263
  protectedUrls: ["services/data/v", "services/apexrest"],
1347
1264
  alwaysProtectedUrls: ["services/apexrest"]
1348
1265
  }
1349
1266
  });
1350
- const r = (i, o) => this.fetch(i, o), n = wt(this.baseUrl, r);
1351
- this.graphql = _t({
1267
+ const r = (i, o) => this.fetch(i, o), n = bt(this.baseUrl, r);
1268
+ this.graphql = Et({
1352
1269
  bundle: n,
1353
1270
  url: B,
1354
1271
  executeRaw: this.executeRawGraphQL.bind(this)
@@ -1372,7 +1289,7 @@ class At {
1372
1289
  return (await this.fetch(B, {
1373
1290
  method: "POST",
1374
1291
  body: JSON.stringify({ query: e, variables: t, operationName: r }),
1375
- headers: te()
1292
+ headers: re()
1376
1293
  })).json();
1377
1294
  }
1378
1295
  /**
@@ -1389,33 +1306,33 @@ class At {
1389
1306
  return e;
1390
1307
  }
1391
1308
  }
1392
- function kt() {
1309
+ function Dt() {
1393
1310
  return {
1394
1311
  apiPath: globalThis.SFDC_ENV?.apiPath
1395
1312
  };
1396
1313
  }
1397
- function Dt(s) {
1314
+ function Pt(s) {
1398
1315
  if (!s || s === "/") return "";
1399
1316
  let e = s;
1400
1317
  return e.startsWith("/") || (e = `/${e}`), e.endsWith("/") && (e = e.slice(0, -1)), e;
1401
1318
  }
1402
- function ws(s, ...e) {
1319
+ function ys(s, ...e) {
1403
1320
  let t = s[0] ?? "";
1404
1321
  for (let r = 0; r < e.length; r += 1)
1405
1322
  t += String(e[r]) + (s[r + 1] ?? "");
1406
1323
  return t;
1407
1324
  }
1408
- function bs(s) {
1409
- return k(
1325
+ function ws(s) {
1326
+ return M(
1410
1327
  (async () => {
1411
1328
  switch (S(s?.surface)) {
1412
1329
  case a.OpenAI:
1413
- return new rt();
1330
+ return new nt();
1414
1331
  case a.WebApp:
1415
1332
  case a.MicroFrontend:
1416
- return new At(s?.webapp);
1333
+ return new kt(s?.webapp);
1417
1334
  case a.Mosaic:
1418
- return new Ze(s?.mosaic);
1335
+ return new et(s?.mosaic);
1419
1336
  case a.SalesforceACC:
1420
1337
  case a.MCPApps:
1421
1338
  return {};
@@ -1426,8 +1343,8 @@ function bs(s) {
1426
1343
  "createDataSDK"
1427
1344
  );
1428
1345
  }
1429
- function vs(s) {
1430
- return k(
1346
+ function bs(s) {
1347
+ return M(
1431
1348
  (async () => {
1432
1349
  switch (S(s?.surface)) {
1433
1350
  case a.OpenAI:
@@ -1449,13 +1366,13 @@ function vs(s) {
1449
1366
  "createLightningSDK"
1450
1367
  );
1451
1368
  }
1452
- function Pt(s) {
1369
+ function Lt(s) {
1453
1370
  let e = "";
1454
1371
  for (let r = 0; r < s.length; r += 8192)
1455
1372
  e += String.fromCharCode.apply(null, Array.from(s.subarray(r, r + 8192)));
1456
1373
  return btoa(e);
1457
1374
  }
1458
- class Lt {
1375
+ class xt {
1459
1376
  entries = [];
1460
1377
  totalBytes = 0;
1461
1378
  maxBufferSize;
@@ -1470,7 +1387,7 @@ class Lt {
1470
1387
  return this.entries.length === 0;
1471
1388
  }
1472
1389
  enqueue(e, t) {
1473
- const r = Pt(e), n = {
1390
+ const r = Lt(e), n = {
1474
1391
  data: r,
1475
1392
  traceId: t?.traceId,
1476
1393
  instanceId: t?.instanceId,
@@ -1492,8 +1409,8 @@ class Lt {
1492
1409
  e > 0 && this.onError?.({ reason: "buffer_overflow", droppedCount: e });
1493
1410
  }
1494
1411
  }
1495
- const xt = "telemetry/upload";
1496
- class Rt {
1412
+ const Ot = "telemetry/upload";
1413
+ class Ht {
1497
1414
  buffer;
1498
1415
  sdk;
1499
1416
  onError;
@@ -1511,8 +1428,8 @@ class Rt {
1511
1428
  flush() {
1512
1429
  if (this.buffer.isEmpty || !this.sdk.callTool)
1513
1430
  return;
1514
- const t = this.buffer.drain().map(Ot);
1515
- this.sdk.callTool({ toolName: xt, params: { inputs: [{ envelopes: t }] } }).catch((r) => {
1431
+ const t = this.buffer.drain().map(Rt);
1432
+ this.sdk.callTool({ toolName: Ot, params: { inputs: [{ envelopes: t }] } }).catch((r) => {
1516
1433
  this.onError?.({ reason: "tool_call_failed", error: r });
1517
1434
  });
1518
1435
  }
@@ -1520,18 +1437,18 @@ class Rt {
1520
1437
  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());
1521
1438
  }
1522
1439
  }
1523
- function Ot(s) {
1440
+ function Rt(s) {
1524
1441
  const e = { base64Env: s.data };
1525
1442
  return s.traceId !== void 0 && (e.traceId = s.traceId), e;
1526
1443
  }
1527
- const Ht = 65536, qt = 3e4;
1528
- function Cs(s) {
1444
+ const qt = 65536, Nt = 3e4;
1445
+ function vs(s) {
1529
1446
  const {
1530
1447
  sdk: e,
1531
- maxBufferSize: t = Ht,
1532
- flushInterval: r = qt,
1448
+ maxBufferSize: t = qt,
1449
+ flushInterval: r = Nt,
1533
1450
  onError: n
1534
- } = s, i = new Lt({ maxBufferSize: t, onError: n }), o = new Rt(i, e, { flushInterval: r, onError: n });
1451
+ } = s, i = new xt({ maxBufferSize: t, onError: n }), o = new Ht(i, e, { flushInterval: r, onError: n });
1535
1452
  return {
1536
1453
  enqueue(c, l) {
1537
1454
  i.enqueue(c, l);
@@ -1541,16 +1458,16 @@ function Cs(s) {
1541
1458
  }
1542
1459
  };
1543
1460
  }
1544
- const Nt = 1e4, Ft = 10, Ut = 10, Vt = 250, $t = 1e3;
1461
+ const Ft = 1e4, Ut = 10, Vt = 10, $t = 250, Wt = 1e3;
1545
1462
  function C(s, e) {
1546
1463
  if (s !== void 0 && (typeof s != "number" || !Number.isFinite(s) || s <= 0))
1547
1464
  throw new Error(`${e}, if defined, must be a finite number greater than 0`);
1548
1465
  }
1549
- function Wt(s, e) {
1466
+ function Kt(s, e) {
1550
1467
  if (typeof s != "function")
1551
1468
  throw new Error(`${e} must be a function`);
1552
1469
  }
1553
- class Kt {
1470
+ class zt {
1554
1471
  _collector;
1555
1472
  _onEnvelope;
1556
1473
  _onError;
@@ -1571,7 +1488,7 @@ class Kt {
1571
1488
  _lastClickTriggeredAt = 0;
1572
1489
  _isDisposed = !1;
1573
1490
  constructor(e) {
1574
- Wt(e?.onEnvelope, "options.onEnvelope"), C(e.uploadInterval, "options.uploadInterval"), C(e.messagesLimit, "options.messagesLimit"), C(e.metricsLimit, "options.metricsLimit"), C(e.maxUniqueSchemas, "options.maxUniqueSchemas"), C(e.clickUploadDelay, "options.clickUploadDelay"), C(e.clickTriggerCooldown, "options.clickTriggerCooldown"), this._onEnvelope = e.onEnvelope, this._onError = e.onError, this._messagesLimit = e.messagesLimit ?? Ft, this._metricsLimit = e.metricsLimit ?? Ut, this._uploadInterval = e.uploadInterval ?? Nt, this._clickUploadDelay = e.clickUploadDelay ?? Vt, this._clickTriggerCooldown = e.clickTriggerCooldown ?? $t, this._enableClickTrigger = e.enableClickTrigger !== !1, this._enableVisibilityTrigger = e.enableVisibilityTrigger !== !1, this._collector = new ye({
1491
+ Kt(e?.onEnvelope, "options.onEnvelope"), C(e.uploadInterval, "options.uploadInterval"), C(e.messagesLimit, "options.messagesLimit"), C(e.metricsLimit, "options.metricsLimit"), C(e.maxUniqueSchemas, "options.maxUniqueSchemas"), C(e.clickUploadDelay, "options.clickUploadDelay"), C(e.clickTriggerCooldown, "options.clickTriggerCooldown"), this._onEnvelope = e.onEnvelope, this._onError = e.onError, this._messagesLimit = e.messagesLimit ?? Ut, this._metricsLimit = e.metricsLimit ?? Vt, this._uploadInterval = e.uploadInterval ?? Ft, this._clickUploadDelay = e.clickUploadDelay ?? $t, this._clickTriggerCooldown = e.clickTriggerCooldown ?? Wt, this._enableClickTrigger = e.enableClickTrigger !== !1, this._enableVisibilityTrigger = e.enableVisibilityTrigger !== !1, this._collector = new be({
1575
1492
  environment: e.environment,
1576
1493
  maxUniqueSchemas: e.maxUniqueSchemas
1577
1494
  }), this._restartInterval(), this._attachWindowListeners();
@@ -1651,7 +1568,7 @@ class Kt {
1651
1568
  metricsCount: this.metricsCount,
1652
1569
  estimatedByteSize: this.estimatedByteSize,
1653
1570
  triggeredAt: Date.now()
1654
- }, r = this._collector.getRawContentsOfCoreEnvelope(), n = me(r);
1571
+ }, r = this._collector.getRawContentsOfCoreEnvelope(), n = we(r);
1655
1572
  this._restartInterval();
1656
1573
  try {
1657
1574
  await this._onEnvelope(n, t);
@@ -1664,13 +1581,13 @@ class Kt {
1664
1581
  }
1665
1582
  }
1666
1583
  }
1667
- function zt(s, e) {
1584
+ function Bt(s, e) {
1668
1585
  if (!s)
1669
1586
  throw new Error("instrumentedApp is required");
1670
- const t = new Kt(e);
1587
+ const t = new zt(e);
1671
1588
  return s.registerLogCollector(t), s.registerMetricsCollector(t), e.enableClickTrigger !== !1 && s.activateClickTracker?.(), t;
1672
1589
  }
1673
- function Bt(s) {
1590
+ function jt(s) {
1674
1591
  const e = (r, n, i, o, c) => {
1675
1592
  s.error(c ?? r);
1676
1593
  }, t = (r) => {
@@ -1680,17 +1597,17 @@ function Bt(s) {
1680
1597
  window.removeEventListener("error", e), window.removeEventListener("unhandledrejection", t);
1681
1598
  };
1682
1599
  }
1683
- const jt = "aJC", Ss = "sfdc.pftId", j = /* @__PURE__ */ new Set(), Jt = /^aJC[0-9A-Za-z]{12}(?:[0-9A-Za-z]{3})?$/;
1684
- function J(s) {
1685
- return typeof s != "string" || s.length === 0 ? !1 : s.length !== 15 && s.length !== 18 ? (Q(s, "Expected a 15- or 18-character Salesforce ID"), !1) : Jt.test(s) ? !0 : (Q(s, `Expected a Product Feature Id (prefix "${jt}", base62).`), !1);
1600
+ const Qt = "aJC", Cs = "sfdc.pftId", j = /* @__PURE__ */ new Set(), Gt = /^aJC[0-9A-Za-z]{12}(?:[0-9A-Za-z]{3})?$/;
1601
+ function Q(s) {
1602
+ return typeof s != "string" || s.length === 0 ? !1 : s.length !== 15 && s.length !== 18 ? (G(s, "Expected a 15- or 18-character Salesforce ID"), !1) : Gt.test(s) ? !0 : (G(s, `Expected a Product Feature Id (prefix "${Qt}", base62).`), !1);
1686
1603
  }
1687
- function Q(s, e) {
1604
+ function G(s, e) {
1688
1605
  j.has(s) || (j.add(s), console.debug(`[platform-sdk:analytics] Ignoring invalid PFT Id "${s}". ${e}`));
1689
1606
  }
1690
1607
  function y(s, e) {
1691
1608
  return { surface: e };
1692
1609
  }
1693
- const Qt = {
1610
+ const Jt = {
1694
1611
  callTool: {
1695
1612
  isAsync: !0,
1696
1613
  extractTags: (s, e) => ({ toolName: s[0]?.toolName ?? "unknown", surface: e })
@@ -1744,10 +1661,10 @@ const Qt = {
1744
1661
  extractTags: y
1745
1662
  }
1746
1663
  };
1747
- function Gt(s, e, t) {
1664
+ function Xt(s, e, t) {
1748
1665
  return new Proxy(s, {
1749
1666
  get(r, n, i) {
1750
- const o = Reflect.get(r, n, i), c = Qt[n];
1667
+ const o = Reflect.get(r, n, i), c = Jt[n];
1751
1668
  return !c || typeof o != "function" ? o : (...l) => {
1752
1669
  const d = c.extractTags(l, t), g = c.wrapArgs ? c.wrapArgs(l, e) : l, f = `sdk.${String(n)}`;
1753
1670
  return c.isAsync ? e.activityAsync(f, async () => {
@@ -1765,14 +1682,14 @@ function Gt(s, e, t) {
1765
1682
  }
1766
1683
  });
1767
1684
  }
1768
- async function Ts(s) {
1769
- const { appId: e, clientSessionId: t } = s, r = S(), n = Date.now(), i = s.sdk ?? await We();
1685
+ async function Ss(s) {
1686
+ const { appId: e, clientSessionId: t } = s, r = S(), n = Date.now(), i = s.sdk ?? await Ke();
1770
1687
  let o = null;
1771
- s.pftId !== void 0 && J(s.pftId) && (o = s.pftId);
1772
- const c = we("mcp-widget", {
1688
+ s.pftId !== void 0 && Q(s.pftId) && (o = s.pftId);
1689
+ const c = ve("mcp-widget", {
1773
1690
  appPayloadProvider: {
1774
1691
  getPayload: () => ({
1775
- schema: be,
1692
+ schema: Ce,
1776
1693
  payload: {
1777
1694
  appId: e,
1778
1695
  surface: r,
@@ -1781,9 +1698,9 @@ async function Ts(s) {
1781
1698
  })
1782
1699
  },
1783
1700
  clientSessionId: t
1784
- }), l = c, d = Gt(i, l, r), g = Bt(l);
1701
+ }), l = c, d = Xt(i, l, r), g = jt(l);
1785
1702
  let f;
1786
- s.transport && (f = zt(c, {
1703
+ s.transport && (f = Bt(c, {
1787
1704
  onEnvelope: (u) => {
1788
1705
  s.transport.enqueue(u);
1789
1706
  }
@@ -1793,68 +1710,59 @@ async function Ts(s) {
1793
1710
  instrumentedSDK: d,
1794
1711
  app: c,
1795
1712
  trackEvent(u, m) {
1796
- p || l.log(_e, {
1713
+ p || l.log(Ie, {
1797
1714
  eventName: u,
1798
1715
  properties: m ? JSON.stringify(m) : ""
1799
1716
  });
1800
1717
  },
1801
1718
  trackInteraction(u, m) {
1802
- p || l.log(Te, {
1719
+ p || l.log(Ee, {
1803
1720
  elementId: u,
1804
1721
  properties: m ? JSON.stringify(m) : ""
1805
1722
  });
1806
1723
  },
1807
1724
  trackError(u, m) {
1808
- p || l.error(u, Se, {
1725
+ p || l.error(u, _e, {
1809
1726
  properties: m ? JSON.stringify(m) : ""
1810
1727
  });
1811
1728
  },
1812
1729
  trackPageView(u) {
1813
- p || u !== h && (h = u, l.log(Ce, { componentRef: u }));
1730
+ p || u !== h && (h = u, l.log(Te, { componentRef: u }));
1814
1731
  },
1815
1732
  setPftId(u) {
1816
- p || J(u) && (o = u);
1733
+ p || Q(u) && (o = u);
1817
1734
  },
1818
1735
  dispose() {
1819
1736
  if (p) return;
1820
1737
  p = !0, g();
1821
1738
  const u = Date.now() - n;
1822
- l.log(ve, { durationMs: u }), f?.dispose();
1739
+ l.log(Se, { durationMs: u }), f?.dispose();
1823
1740
  }
1824
1741
  };
1825
1742
  }
1826
1743
  export {
1827
- Pe as JsonRpcClient,
1828
- Ue as MCPAppsChatSDK,
1829
- Be as MCPAppsViewSDK,
1744
+ Ve as MCPAppsChatSDK,
1745
+ je as MCPAppsViewSDK,
1830
1746
  w as McpAppsSession,
1831
- ds as MessageChannelTransport,
1832
- Ss as PFT_META_KEY,
1747
+ Cs as PFT_META_KEY,
1833
1748
  a as Surface,
1834
- Kt as TelemetryUploader,
1835
- De as WindowPostMessageTransport,
1836
- Ts as createAnalytics,
1837
- Ke as createChatSDK,
1838
- bs as createDataSDK,
1839
- vs as createLightningSDK,
1840
- Cs as createTelemetryTransport,
1841
- Je as createViewSDK,
1842
- We as getChatSDK,
1843
- fs as getChatSDKSync,
1749
+ zt as TelemetryUploader,
1750
+ Ss as createAnalytics,
1751
+ ze as createChatSDK,
1752
+ ws as createDataSDK,
1753
+ bs as createLightningSDK,
1754
+ vs as createTelemetryTransport,
1755
+ Ge as createViewSDK,
1756
+ Ke as getChatSDK,
1757
+ hs as getChatSDKSync,
1844
1758
  S as getSurface,
1845
- hs as getSurfaceCapabilities,
1846
- gs as getViewSDK,
1847
- ms as getViewSDKSync,
1848
- ws as gql,
1849
- A as isJsonRpcBase,
1850
- X as isJsonRpcErrorResponse,
1851
- ke as isJsonRpcNotification,
1852
- us as isJsonRpcRequest,
1853
- Ae as isJsonRpcResponse,
1854
- Me as isJsonRpcSuccessResponse,
1855
- zt as registerTelemetryUploader,
1856
- ps as resetChatSDK,
1857
- ys as resetViewSDK,
1858
- J as validatePftId,
1859
- k as wrapSDKPromise
1759
+ ds as getSurfaceCapabilities,
1760
+ ps as getViewSDK,
1761
+ gs as getViewSDKSync,
1762
+ ys as gql,
1763
+ Bt as registerTelemetryUploader,
1764
+ fs as resetChatSDK,
1765
+ ms as resetViewSDK,
1766
+ Q as validatePftId,
1767
+ M as wrapSDKPromise
1860
1768
  };