@salesforce/platform-sdk 11.3.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.
- package/dist/data/index.js +1 -1
- package/dist/i18n/index.d.ts +10 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +98 -0
- package/dist/i18n/salesforce-backend.d.ts +17 -0
- package/dist/i18n/salesforce-backend.d.ts.map +1 -0
- package/dist/i18n/salesforce-detector.d.ts +22 -0
- package/dist/i18n/salesforce-detector.d.ts.map +1 -0
- package/package.json +10 -2
package/dist/data/index.js
CHANGED
|
@@ -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.
|
|
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,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026, Salesforce, Inc.,
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* For full license text, see the LICENSE.txt file
|
|
5
|
+
*/
|
|
6
|
+
export { fetchI18nContext, createSalesforceDetector } from './salesforce-detector';
|
|
7
|
+
export type { I18nContext } from './salesforce-detector';
|
|
8
|
+
export { SalesforceBackend } from './salesforce-backend';
|
|
9
|
+
export type { SalesforceBackendOptions } from './salesforce-backend';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DataSDK } from '../core';
|
|
2
|
+
export interface SalesforceBackendOptions {
|
|
3
|
+
dataSDK: DataSDK;
|
|
4
|
+
labelManifest?: string[];
|
|
5
|
+
}
|
|
6
|
+
type ReadCallback = (err: unknown, data: Record<string, string> | false) => void;
|
|
7
|
+
export declare class SalesforceBackend {
|
|
8
|
+
type: "backend";
|
|
9
|
+
static type: "backend";
|
|
10
|
+
private options;
|
|
11
|
+
private grouped;
|
|
12
|
+
init(_services: unknown, options: SalesforceBackendOptions): void;
|
|
13
|
+
read(language: string, namespace: string, callback: ReadCallback): void;
|
|
14
|
+
private loadLabels;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=salesforce-backend.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"salesforce-backend.d.ts","sourceRoot":"","sources":["../../src/i18n/salesforce-backend.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,MAAM,WAAW,wBAAwB;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAeD,KAAK,YAAY,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,KAAK,KAAK,IAAI,CAAC;AA6BjF,qBAAa,iBAAiB;IAC7B,IAAI,EAAG,SAAS,CAAU;IAC1B,MAAM,CAAC,IAAI,EAAG,SAAS,CAAU;IAEjC,OAAO,CAAC,OAAO,CAA6C;IAC5D,OAAO,CAAC,OAAO,CAAgC;IAE/C,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,wBAAwB,GAAG,IAAI;IAKjE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI;YAMzD,UAAU;CA8BxB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DataSDK } from '../core';
|
|
2
|
+
/**
|
|
3
|
+
* The subset of i18next's native LanguageDetectorModule contract that this
|
|
4
|
+
* detector implements. Declared locally so platform-sdk does not take a
|
|
5
|
+
* dependency on i18next; the returned object is structurally compatible with
|
|
6
|
+
* i18next's `.use()` plugin slot.
|
|
7
|
+
*/
|
|
8
|
+
interface LanguageDetectorModule {
|
|
9
|
+
type: "languageDetector";
|
|
10
|
+
detect(): string | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface I18nContext {
|
|
13
|
+
lang: string;
|
|
14
|
+
locale: string;
|
|
15
|
+
dir: string;
|
|
16
|
+
currency: string;
|
|
17
|
+
timeZone: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function fetchI18nContext(dataSDK: DataSDK): Promise<I18nContext>;
|
|
20
|
+
export declare function createSalesforceDetector(_dataSDK: DataSDK): LanguageDetectorModule;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=salesforce-detector.d.ts.map
|
|
@@ -0,0 +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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/platform-sdk",
|
|
3
|
-
"version": "11.
|
|
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.
|
|
118
|
+
"@salesforce/jsonrpc": "^11.4.1",
|
|
111
119
|
"@salesforce/sf-embedding-bridge": "2.2.4-rc.1"
|
|
112
120
|
},
|
|
113
121
|
"peerDependencies": {
|