@salesforce/platform-sdk 11.6.0 → 11.7.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.
@@ -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.6.0", de = (t) => {
199
+ const ce = "X-SFDC-Client-Name", ue = "X-SFDC-Client-Version", he = "@salesforce/platform-sdk", le = "11.7.0", 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";
@@ -3,7 +3,7 @@
3
3
  * All rights reserved.
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
- export { fetchI18nContext, createSalesforceDetector } from './salesforce-detector';
6
+ export { fetchI18nContext, createSalesforceDetector, reloadI18nContext, } from './salesforce-detector';
7
7
  export type { I18nContext } from './salesforce-detector';
8
8
  export { SalesforceBackend } from './salesforce-backend';
9
9
  export type { SalesforceBackendOptions } from './salesforce-backend';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACnF,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,YAAY,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACN,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,GACjB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,YAAY,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -1,9 +1,9 @@
1
- let l = null;
2
- async function u(n) {
3
- if (l) return l;
4
- if (!n.graphql)
1
+ let o = null;
2
+ async function i(r) {
3
+ if (o) return o;
4
+ if (!r.graphql)
5
5
  throw new Error("Data SDK GraphQL surface unavailable");
6
- const a = await n.graphql.query({
6
+ const a = await r.graphql.query({
7
7
  operationName: "I18nDetect",
8
8
  query: `
9
9
  query I18nDetect {
@@ -26,17 +26,20 @@ async function u(n) {
26
26
  `I18nDetect query failed: ${JSON.stringify(a.errors ?? "no data, no errors")}`
27
27
  );
28
28
  const e = a.data.uiapi.platform.i18n;
29
- return l = e, e;
29
+ return o = e, e;
30
30
  }
31
- function f(n) {
31
+ async function f(r) {
32
+ return o = null, i(r);
33
+ }
34
+ function p(r) {
32
35
  return {
33
36
  type: "languageDetector",
34
37
  detect() {
35
- return l?.lang;
38
+ return o?.lang;
36
39
  }
37
40
  };
38
41
  }
39
- const i = `
42
+ const c = `
40
43
  query Labels($ns: String!, $names: [String!]!, $locale: String) {
41
44
  uiapi {
42
45
  platform {
@@ -50,49 +53,50 @@ const i = `
50
53
  }
51
54
  }
52
55
  `;
53
- function c(n) {
56
+ function u(r) {
54
57
  const a = {};
55
- for (const e of n) {
58
+ for (const e of r) {
56
59
  const t = e.indexOf(":");
57
60
  if (t === -1) continue;
58
- const r = e.slice(0, t), o = e.slice(t + 1);
59
- (a[r] ??= []).push(o);
61
+ const n = e.slice(0, t), l = e.slice(t + 1);
62
+ (a[n] ??= []).push(l);
60
63
  }
61
64
  return a;
62
65
  }
63
- class p {
66
+ class d {
64
67
  type = "backend";
65
68
  static type = "backend";
66
69
  options = { dataSDK: {} };
67
70
  grouped = {};
68
71
  init(a, e) {
69
- this.options = e, this.grouped = c(e.labelManifest ?? []);
72
+ this.options = e, this.grouped = u(e.labelManifest ?? []);
70
73
  }
71
74
  read(a, e, t) {
72
- this.loadLabels(a, e).then((r) => t(null, r)).catch((r) => t(r, !1));
75
+ this.loadLabels(a, e).then((n) => t(null, n)).catch((n) => t(n, !1));
73
76
  }
74
77
  async loadLabels(a, e) {
75
78
  const t = this.grouped[e];
76
79
  if (!t?.length) return {};
77
80
  if (!this.options.dataSDK.graphql)
78
81
  throw new Error("Data SDK GraphQL surface unavailable");
79
- const r = await this.options.dataSDK.graphql.query({
82
+ const n = await this.options.dataSDK.graphql.query({
80
83
  operationName: "Labels",
81
- query: i,
84
+ query: c,
82
85
  variables: { ns: e, names: t, locale: a }
83
86
  });
84
- if (!r.data)
87
+ if (!n.data)
85
88
  throw new Error(
86
- `Labels query failed: ${JSON.stringify(r.errors ?? "no data, no errors")}`
89
+ `Labels query failed: ${JSON.stringify(n.errors ?? "no data, no errors")}`
87
90
  );
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;
91
+ const l = {};
92
+ for (const s of n.data.uiapi.platform.labels)
93
+ s.value != null && (l[s.name] = s.value);
94
+ return l;
92
95
  }
93
96
  }
94
97
  export {
95
- p as SalesforceBackend,
96
- f as createSalesforceDetector,
97
- u as fetchI18nContext
98
+ d as SalesforceBackend,
99
+ p as createSalesforceDetector,
100
+ i as fetchI18nContext,
101
+ f as reloadI18nContext
98
102
  };
@@ -17,6 +17,21 @@ export interface I18nContext {
17
17
  timeZone: string;
18
18
  }
19
19
  export declare function fetchI18nContext(dataSDK: DataSDK): Promise<I18nContext>;
20
+ /**
21
+ * Reload the cached i18n context: clear the memoized value and immediately
22
+ * re-query the platform, resolving to the fresh context.
23
+ *
24
+ * The context is fetched once and memoized for the lifetime of the page, so a
25
+ * locale change normally only takes effect on a full page reload. Call this
26
+ * after an in-session locale change: clearing and re-fetching are a single
27
+ * operation, so a caller cannot clear the cache and then forget to refill it.
28
+ *
29
+ * The cache is cleared before the re-query runs, so if the re-query fails the
30
+ * returned promise rejects and the cache is left empty — `detect()` reverts to
31
+ * `undefined` until a later successful fetch. Callers should handle rejection
32
+ * rather than assume a reload always repopulates.
33
+ */
34
+ export declare function reloadI18nContext(dataSDK: DataSDK): Promise<I18nContext>;
20
35
  export declare function createSalesforceDetector(_dataSDK: DataSDK): LanguageDetectorModule;
21
36
  export {};
22
37
  //# sourceMappingURL=salesforce-detector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"salesforce-detector.d.ts","sourceRoot":"","sources":["../../src/i18n/salesforce-detector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC;;;;;GAKG;AACH,UAAU,sBAAsB;IAC/B,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,IAAI,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAYD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAkC7E;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,OAAO,GAAG,sBAAsB,CAQlF"}
1
+ {"version":3,"file":"salesforce-detector.d.ts","sourceRoot":"","sources":["../../src/i18n/salesforce-detector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC;;;;;GAKG;AACH,UAAU,sBAAsB;IAC/B,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,IAAI,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAYD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAkC7E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAG9E;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,OAAO,GAAG,sBAAsB,CAQlF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/platform-sdk",
3
- "version": "11.6.0",
3
+ "version": "11.7.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -115,7 +115,7 @@
115
115
  "@conduit-client/service-pubsub": "3.19.6",
116
116
  "@conduit-client/service-retry": "3.19.6",
117
117
  "@conduit-client/utils": "3.19.6",
118
- "@salesforce/jsonrpc": "^11.6.0",
118
+ "@salesforce/jsonrpc": "^11.7.0",
119
119
  "@salesforce/sf-embedding-bridge": "2.2.4-rc.1"
120
120
  },
121
121
  "peerDependencies": {