@salesforce/sdk-view 1.130.1 → 1.130.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAIvF;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,UAAU;IACjD,iEAAiE;IACjE,OAAO,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAsB,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAwB9E;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvE,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,KAAK,EACL,SAAS,EACT,YAAY,EACZ,OAAO,GACP,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAIvF;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,UAAU;IACjD,iEAAiE;IACjE,OAAO,CAAC,EAAE,qBAAqB,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CA6BxE;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEvE,YAAY,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,KAAK,EACL,SAAS,EACT,YAAY,EACZ,OAAO,GACP,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { getSurface as d, Surface as a, McpAppsSession as p } from "@salesforce/sdk-core";
2
- function m(s) {
1
+ import { wrapSDKPromise as d, getSurface as p, Surface as a, McpAppsSession as m } from "@salesforce/sdk-core";
2
+ function f(s) {
3
3
  switch (s) {
4
4
  case "info":
5
5
  return "ℹ️";
@@ -14,25 +14,25 @@ function m(s) {
14
14
  }
15
15
  }
16
16
  function c(s, e) {
17
- return `${m(e)} ${s}`;
17
+ return `${f(e)} ${s}`;
18
18
  }
19
19
  function l(s, e) {
20
20
  const t = s.trim();
21
21
  if (t === "")
22
22
  return { success: !0, value: void 0 };
23
- const n = t.match(/^(\d+(?:\.\d+)?)(px)?$/);
24
- if (!n || !n[1])
23
+ const r = t.match(/^(\d+(?:\.\d+)?)(px)?$/);
24
+ if (!r || !r[1])
25
25
  return {
26
26
  success: !1,
27
27
  error: `Invalid ${e}: "${s}". Only pixel values are supported (e.g., "800px" or "800").`
28
28
  };
29
- const r = parseFloat(n[1]);
30
- return r < 0 || !isFinite(r) ? {
29
+ const n = parseFloat(r[1]);
30
+ return n < 0 || !isFinite(n) ? {
31
31
  success: !1,
32
32
  error: `Invalid ${e}: "${s}". Value must be a positive number.`
33
- } : { success: !0, value: r };
33
+ } : { success: !0, value: n };
34
34
  }
35
- class f {
35
+ class w {
36
36
  constructor(e) {
37
37
  this.session = e;
38
38
  }
@@ -42,13 +42,13 @@ class f {
42
42
  * @param level - The message severity level (defaults to "info")
43
43
  */
44
44
  async sendMessage(e, t = "info") {
45
- const n = c(e, t);
45
+ const r = c(e, t);
46
46
  await this.session.request("ui/message", {
47
47
  role: "user",
48
48
  content: [
49
49
  {
50
50
  type: "text",
51
- text: n
51
+ text: r
52
52
  }
53
53
  ]
54
54
  });
@@ -67,24 +67,24 @@ class f {
67
67
  return e ? { mode: e } : null;
68
68
  }
69
69
  async resize(e, t) {
70
- const n = l(e, "width");
71
- if (!n.success)
72
- return Promise.reject(new Error(n.error));
73
- const r = l(t, "height");
70
+ const r = l(e, "width");
74
71
  if (!r.success)
75
72
  return Promise.reject(new Error(r.error));
73
+ const n = l(t, "height");
74
+ if (!n.success)
75
+ return Promise.reject(new Error(n.error));
76
76
  const o = {};
77
- return n.value !== void 0 && (o.width = n.value), r.value !== void 0 && (o.height = r.value), this.session.sendNotification("ui/notifications/size-changed", o), Promise.resolve();
77
+ return r.value !== void 0 && (o.width = r.value), n.value !== void 0 && (o.height = n.value), this.session.sendNotification("ui/notifications/size-changed", o), Promise.resolve();
78
78
  }
79
79
  }
80
- class w {
80
+ class h {
81
81
  async displayAlert(e) {
82
- const t = e.level || "info", n = c(e.message, t);
83
- await window.openai.sendFollowUpMessage({ prompt: n });
82
+ const t = e.level || "info", r = c(e.message, t);
83
+ await window.openai.sendFollowUpMessage({ prompt: r });
84
84
  }
85
85
  async displayToast(e) {
86
- const t = e.level || "info", n = c(e.message, t);
87
- await window.openai.sendFollowUpMessage({ prompt: n });
86
+ const t = e.level || "info", r = c(e.message, t);
87
+ await window.openai.sendFollowUpMessage({ prompt: r });
88
88
  }
89
89
  async displayModal(e) {
90
90
  await window.openai.requestModal({
@@ -98,37 +98,42 @@ class w {
98
98
  }
99
99
  }
100
100
  let i = null, u = null;
101
- function v(s) {
102
- return i || (i = h(s).then((e) => (u = e, e))), i;
101
+ function y(s) {
102
+ return i || (i = g(s).then((e) => (u = e, e))), i;
103
103
  }
104
- function y() {
104
+ function M() {
105
105
  return u;
106
106
  }
107
- function M() {
107
+ function S() {
108
108
  i = null, u = null;
109
109
  }
110
- async function h(s) {
111
- switch (d(s?.surface)) {
112
- case a.OpenAI:
113
- return new w();
114
- case a.WebApp:
115
- case a.Mosaic:
116
- return {};
117
- case a.SalesforceACC:
118
- return {};
119
- case a.MicroFrontend:
120
- case a.MCPApps: {
121
- const t = await p.getInstance(s?.mcpApps);
122
- return t.handshakeSucceeded ? new f(t) : {};
123
- }
124
- default:
125
- return {};
126
- }
110
+ function g(s) {
111
+ return d(
112
+ (async () => {
113
+ switch (p(s?.surface)) {
114
+ case a.OpenAI:
115
+ return new h();
116
+ case a.WebApp:
117
+ case a.Mosaic:
118
+ return {};
119
+ case a.SalesforceACC:
120
+ return {};
121
+ case a.MicroFrontend:
122
+ case a.MCPApps: {
123
+ const t = await m.getInstance(s?.mcpApps);
124
+ return t.handshakeSucceeded ? new w(t) : {};
125
+ }
126
+ default:
127
+ return {};
128
+ }
129
+ })(),
130
+ "createViewSDK"
131
+ );
127
132
  }
128
133
  export {
129
- f as MCPAppsViewSDK,
130
- h as createViewSDK,
131
- v as getViewSDK,
132
- y as getViewSDKSync,
133
- M as resetViewSDK
134
+ w as MCPAppsViewSDK,
135
+ g as createViewSDK,
136
+ y as getViewSDK,
137
+ M as getViewSDKSync,
138
+ S as resetViewSDK
134
139
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/sdk-view",
3
- "version": "1.130.1",
3
+ "version": "1.130.2",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "test:coverage": "vitest run --coverage"
27
27
  },
28
28
  "dependencies": {
29
- "@salesforce/sdk-core": "^1.130.1"
29
+ "@salesforce/sdk-core": "^1.130.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "vite": "^7.3.1",