@salesforce/platform-sdk 11.4.0 → 11.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -196,7 +196,7 @@ class ie {
196
196
  })).structuredContent;
197
197
  }
198
198
  }
199
- const ce = "X-SFDC-Client-Name", ue = "X-SFDC-Client-Version", he = "@salesforce/platform-sdk", le = "11.4.0", de = (t) => {
199
+ const ce = "X-SFDC-Client-Name", ue = "X-SFDC-Client-Version", he = "@salesforce/platform-sdk", le = "11.4.1", de = (t) => {
200
200
  let e = y(ce, he, t);
201
201
  return e = y(ue, le, e), u(e);
202
202
  }, pe = "X-CSRF-Token";
@@ -0,0 +1,98 @@
1
+ let l = null;
2
+ async function u(n) {
3
+ if (l) return l;
4
+ if (!n.graphql)
5
+ throw new Error("Data SDK GraphQL surface unavailable");
6
+ const a = await n.graphql.query({
7
+ operationName: "I18nDetect",
8
+ query: `
9
+ query I18nDetect {
10
+ uiapi {
11
+ platform {
12
+ i18n {
13
+ lang
14
+ locale
15
+ dir
16
+ currency
17
+ timeZone
18
+ }
19
+ }
20
+ }
21
+ }
22
+ `
23
+ });
24
+ if (!a.data)
25
+ throw new Error(
26
+ `I18nDetect query failed: ${JSON.stringify(a.errors ?? "no data, no errors")}`
27
+ );
28
+ const e = a.data.uiapi.platform.i18n;
29
+ return l = e, e;
30
+ }
31
+ function f(n) {
32
+ return {
33
+ type: "languageDetector",
34
+ detect() {
35
+ return l?.lang;
36
+ }
37
+ };
38
+ }
39
+ const i = `
40
+ query Labels($ns: String!, $names: [String!]!, $locale: String) {
41
+ uiapi {
42
+ platform {
43
+ labels(namespace: $ns, names: $names, locale: $locale) {
44
+ name
45
+ value
46
+ resolvedLocale
47
+ wasFallback
48
+ }
49
+ }
50
+ }
51
+ }
52
+ `;
53
+ function c(n) {
54
+ const a = {};
55
+ for (const e of n) {
56
+ const t = e.indexOf(":");
57
+ if (t === -1) continue;
58
+ const r = e.slice(0, t), o = e.slice(t + 1);
59
+ (a[r] ??= []).push(o);
60
+ }
61
+ return a;
62
+ }
63
+ class p {
64
+ type = "backend";
65
+ static type = "backend";
66
+ options = { dataSDK: {} };
67
+ grouped = {};
68
+ init(a, e) {
69
+ this.options = e, this.grouped = c(e.labelManifest ?? []);
70
+ }
71
+ read(a, e, t) {
72
+ this.loadLabels(a, e).then((r) => t(null, r)).catch((r) => t(r, !1));
73
+ }
74
+ async loadLabels(a, e) {
75
+ const t = this.grouped[e];
76
+ if (!t?.length) return {};
77
+ if (!this.options.dataSDK.graphql)
78
+ throw new Error("Data SDK GraphQL surface unavailable");
79
+ const r = await this.options.dataSDK.graphql.query({
80
+ operationName: "Labels",
81
+ query: i,
82
+ variables: { ns: e, names: t, locale: a }
83
+ });
84
+ if (!r.data)
85
+ throw new Error(
86
+ `Labels query failed: ${JSON.stringify(r.errors ?? "no data, no errors")}`
87
+ );
88
+ const o = {};
89
+ for (const s of r.data.uiapi.platform.labels)
90
+ s.value != null && (o[s.name] = s.value);
91
+ return o;
92
+ }
93
+ }
94
+ export {
95
+ p as SalesforceBackend,
96
+ f as createSalesforceDetector,
97
+ u as fetchI18nContext
98
+ };
package/dist/index.d.ts CHANGED
@@ -10,5 +10,4 @@ export { createDataSDK, type DataSDKOptions, type WebAppDataSDKOptions, type Mos
10
10
  export { createLightningSDK, type LightningSDKOptions } from './lightning';
11
11
  export { createTelemetryTransport, registerTelemetryUploader, TelemetryUploader, type TelemetryTransport, type TelemetryTransportOptions, type EnvelopeEntry, type EnvelopeMetadata, type TelemetryUploaderOptions, type OnEnvelopeCallback, type FlushReason, type TelemetryUploadContext, type TelemetryUploaderErrorContext, type InstrumentedAppLike, type DisposeOptions, } from './telemetry';
12
12
  export { AXL_PFT_ID, createAnalytics, INTERNAL_SESSION_META_KEY, PFT_META_KEY, validatePftId, type Analytics, type AnalyticsOptions, } from './analytics';
13
- export { fetchI18nContext, createSalesforceDetector, SalesforceBackend, type I18nContext, type SalesforceBackendOptions, } from './i18n';
14
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,QAAQ,CAAC;AAGvB,OAAO,EACN,aAAa,EACb,KAAK,cAAc,EACnB,cAAc,EACd,UAAU,EACV,cAAc,EACd,YAAY,GACZ,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACN,aAAa,EACb,KAAK,cAAc,EACnB,cAAc,EACd,UAAU,EACV,cAAc,EACd,YAAY,GACZ,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACN,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,GAAG,GACH,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAG3E,OAAO,EACN,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,cAAc,GACnB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACN,UAAU,EACV,eAAe,EACf,yBAAyB,EACzB,YAAY,EACZ,aAAa,EACb,KAAK,SAAS,EACd,KAAK,gBAAgB,GACrB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACN,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,wBAAwB,GAC7B,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,QAAQ,CAAC;AAGvB,OAAO,EACN,aAAa,EACb,KAAK,cAAc,EACnB,cAAc,EACd,UAAU,EACV,cAAc,EACd,YAAY,GACZ,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACN,aAAa,EACb,KAAK,cAAc,EACnB,cAAc,EACd,UAAU,EACV,cAAc,EACd,YAAY,GACZ,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACN,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,GAAG,GACH,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAG3E,OAAO,EACN,wBAAwB,EACxB,yBAAyB,EACzB,iBAAiB,EACjB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,cAAc,GACnB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACN,UAAU,EACV,eAAe,EACf,yBAAyB,EACzB,YAAY,EACZ,aAAa,EACb,KAAK,SAAS,EACd,KAAK,gBAAgB,GACrB,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,138 +1,42 @@
1
- import { M as g, a as m, S as h, g as D, i as y, b as K, r as b } from "./surface-Dd2tqrPi.js";
2
- import { g as x } from "./capabilities-5BWkCbcP.js";
3
- import { w as q } from "./sdk-promise-D0sy7OW1.js";
4
- import { MCPAppsChatSDK as A, createChatSDK as I, getChatSDK as v, getChatSDKSync as C, resetChatSDK as T } from "./chat/index.js";
5
- import { MCPAppsViewSDK as N, createViewSDK as M, getViewSDK as $, getViewSDKSync as P, resetViewSDK as V } from "./view/index.js";
6
- import { createDataSDK as O, gql as B } from "./data/index.js";
7
- import { createLightningSDK as Q } from "./lightning/index.js";
8
- import { c as Y } from "./transport-CdXFRgRc.js";
9
- import { T as J, r as R } from "./TelemetryUploader-DKkdppe9.js";
10
- import { A as X, I as Z, P as j, c as H, v as W } from "./analytics-CY_NdbkB.js";
11
- let s = null;
12
- async function p(o) {
13
- if (s) return s;
14
- if (!o.graphql)
15
- throw new Error("Data SDK GraphQL surface unavailable");
16
- const a = await o.graphql.query({
17
- operationName: "I18nDetect",
18
- query: `
19
- query I18nDetect {
20
- uiapi {
21
- platform {
22
- i18n {
23
- lang
24
- locale
25
- dir
26
- currency
27
- timeZone
28
- }
29
- }
30
- }
31
- }
32
- `
33
- });
34
- if (!a.data)
35
- throw new Error(
36
- `I18nDetect query failed: ${JSON.stringify(a.errors ?? "no data, no errors")}`
37
- );
38
- const e = a.data.uiapi.platform.i18n;
39
- return s = e, e;
40
- }
41
- function f(o) {
42
- return {
43
- type: "languageDetector",
44
- detect() {
45
- return s?.lang;
46
- }
47
- };
48
- }
49
- const l = `
50
- query Labels($ns: String!, $names: [String!]!, $locale: String) {
51
- uiapi {
52
- platform {
53
- labels(namespace: $ns, names: $names, locale: $locale) {
54
- name
55
- value
56
- resolvedLocale
57
- wasFallback
58
- }
59
- }
60
- }
61
- }
62
- `;
63
- function c(o) {
64
- const a = {};
65
- for (const e of o) {
66
- const r = e.indexOf(":");
67
- if (r === -1) continue;
68
- const t = e.slice(0, r), n = e.slice(r + 1);
69
- (a[t] ??= []).push(n);
70
- }
71
- return a;
72
- }
73
- class u {
74
- type = "backend";
75
- static type = "backend";
76
- options = { dataSDK: {} };
77
- grouped = {};
78
- init(a, e) {
79
- this.options = e, this.grouped = c(e.labelManifest ?? []);
80
- }
81
- read(a, e, r) {
82
- this.loadLabels(a, e).then((t) => r(null, t)).catch((t) => r(t, !1));
83
- }
84
- async loadLabels(a, e) {
85
- const r = this.grouped[e];
86
- if (!r?.length) return {};
87
- if (!this.options.dataSDK.graphql)
88
- throw new Error("Data SDK GraphQL surface unavailable");
89
- const t = await this.options.dataSDK.graphql.query({
90
- operationName: "Labels",
91
- query: l,
92
- variables: { ns: e, names: r, locale: a }
93
- });
94
- if (!t.data)
95
- throw new Error(
96
- `Labels query failed: ${JSON.stringify(t.errors ?? "no data, no errors")}`
97
- );
98
- const n = {};
99
- for (const i of t.data.uiapi.platform.labels)
100
- i.value != null && (n[i.name] = i.value);
101
- return n;
102
- }
103
- }
1
+ import { M as a, a as t, S as s, g as o, i, b as p, r as S } from "./surface-Dd2tqrPi.js";
2
+ import { g as c } from "./capabilities-5BWkCbcP.js";
3
+ import { w as D } from "./sdk-promise-D0sy7OW1.js";
4
+ import { MCPAppsChatSDK as g, createChatSDK as l, getChatSDK as A, getChatSDKSync as x, resetChatSDK as T } from "./chat/index.js";
5
+ import { MCPAppsViewSDK as C, createViewSDK as E, getViewSDK as d, getViewSDKSync as w, resetViewSDK as M } from "./view/index.js";
6
+ import { createDataSDK as _, gql as h } from "./data/index.js";
7
+ import { createLightningSDK as I } from "./lightning/index.js";
8
+ import { c as b } from "./transport-CdXFRgRc.js";
9
+ import { T as N, r as v } from "./TelemetryUploader-DKkdppe9.js";
10
+ import { A as F, I as U, P as Y, c as q, v as z } from "./analytics-CY_NdbkB.js";
104
11
  export {
105
- X as AXL_PFT_ID,
106
- Z as INTERNAL_SESSION_META_KEY,
107
- A as MCPAppsChatSDK,
108
- N as MCPAppsViewSDK,
109
- g as McpAppsNotAvailableError,
110
- m as McpAppsSession,
111
- j as PFT_META_KEY,
112
- u as SalesforceBackend,
113
- h as Surface,
114
- J as TelemetryUploader,
115
- H as createAnalytics,
116
- I as createChatSDK,
117
- O as createDataSDK,
118
- Q as createLightningSDK,
119
- f as createSalesforceDetector,
120
- Y as createTelemetryTransport,
121
- M as createViewSDK,
122
- p as fetchI18nContext,
123
- v as getChatSDK,
124
- C as getChatSDKSync,
125
- x as getSurfaceCapabilities,
126
- D as getVerifiedSurface,
127
- $ as getViewSDK,
128
- P as getViewSDKSync,
129
- B as gql,
130
- y as initialize,
131
- K as isSfEmbeddingIframe,
132
- R as registerTelemetryUploader,
12
+ F as AXL_PFT_ID,
13
+ U as INTERNAL_SESSION_META_KEY,
14
+ g as MCPAppsChatSDK,
15
+ C as MCPAppsViewSDK,
16
+ a as McpAppsNotAvailableError,
17
+ t as McpAppsSession,
18
+ Y as PFT_META_KEY,
19
+ s as Surface,
20
+ N as TelemetryUploader,
21
+ q as createAnalytics,
22
+ l as createChatSDK,
23
+ _ as createDataSDK,
24
+ I as createLightningSDK,
25
+ b as createTelemetryTransport,
26
+ E as createViewSDK,
27
+ A as getChatSDK,
28
+ x as getChatSDKSync,
29
+ c as getSurfaceCapabilities,
30
+ o as getVerifiedSurface,
31
+ d as getViewSDK,
32
+ w as getViewSDKSync,
33
+ h as gql,
34
+ i as initialize,
35
+ p as isSfEmbeddingIframe,
36
+ v as registerTelemetryUploader,
133
37
  T as resetChatSDK,
134
- b as resetSurface,
135
- V as resetViewSDK,
136
- W as validatePftId,
137
- q as wrapSDKPromise
38
+ S as resetSurface,
39
+ M as resetViewSDK,
40
+ z as validatePftId,
41
+ D as wrapSDKPromise
138
42
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/platform-sdk",
3
- "version": "11.4.0",
3
+ "version": "11.4.1",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -35,6 +35,9 @@
35
35
  ],
36
36
  "sf-embedding": [
37
37
  "./dist/sf-embedding/index.d.ts"
38
+ ],
39
+ "i18n": [
40
+ "./dist/i18n/index.d.ts"
38
41
  ]
39
42
  }
40
43
  },
@@ -84,6 +87,11 @@
84
87
  "import": "./dist/sf-embedding/index.js",
85
88
  "default": "./dist/sf-embedding/index.js"
86
89
  },
90
+ "./i18n": {
91
+ "types": "./dist/i18n/index.d.ts",
92
+ "import": "./dist/i18n/index.js",
93
+ "default": "./dist/i18n/index.js"
94
+ },
87
95
  "./package.json": "./package.json"
88
96
  },
89
97
  "files": [
@@ -107,7 +115,7 @@
107
115
  "@conduit-client/service-pubsub": "3.19.6",
108
116
  "@conduit-client/service-retry": "3.19.6",
109
117
  "@conduit-client/utils": "3.19.6",
110
- "@salesforce/jsonrpc": "^11.4.0",
118
+ "@salesforce/jsonrpc": "^11.4.1",
111
119
  "@salesforce/sf-embedding-bridge": "2.2.4-rc.1"
112
120
  },
113
121
  "peerDependencies": {