@adobe/acc-js-sdk 1.1.11 → 1.1.12

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.
@@ -38,6 +38,7 @@ title: The Application Object
38
38
  <tr><td><b>login</b></td><td>the login name of the operator</td></tr>
39
39
  <tr><td><b>computeString</b></td><td>A human readable name for the operator</td></tr>
40
40
  <tr><td><b>timezone</b></td><td>The timezone of the operator</td></tr>
41
+ <tr><td><b>instanceLocale</b></td><td>The locale of the instance</td></tr>
41
42
  <tr><td><b>rights</b></td><td>An array of strings describing the rights of the operators</td></tr>
42
43
  </tbody>
43
44
  </table>
@@ -2,6 +2,13 @@
2
2
  layout: page
3
3
  title: Change Log
4
4
  ---
5
+ <section class="changelog"><h1>Version 1.1.12</h1>
6
+ <h2>2022/11/16</h2>
7
+
8
+ <li>Fix an issue with localization ids: do not generate localization ids for empty labels or descriptions</li>
9
+ <li>Add the instanceLocale attribute in the CurrentLogin object. This attribute returns the instance locale</li>
10
+ </section>
11
+
5
12
  <section class="changelog"><h1>Version 1.1.11</h1>
6
13
  <h2>2022/11/09</h2>
7
14
 
package/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/acc-js-sdk",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/acc-js-sdk",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "ACC Javascript SDK",
5
5
  "main": "src/index.js",
6
6
  "homepage": "https://github.com/adobe/acc-js-sdk#readme",
@@ -669,10 +669,14 @@ class XtkSchemaNode {
669
669
  this._localizationId = this._localizationId + "__e____" + this.name;
670
670
  }
671
671
  }
672
- this.labelLocalizationId = this._localizationId + "__@label";
673
- this.descriptionLocalizationId = this._localizationId + "__@desc";
674
- if (!this.parent) {
675
- this.labelSingularLocalizationId = this._localizationId + "__@labelSingular";
672
+ if (this.label) {
673
+ this.labelLocalizationId = this._localizationId + "__@label";
674
+ }
675
+ if (this.description) {
676
+ this.descriptionLocalizationId = this._localizationId + "__@desc";
677
+ }
678
+ if (!this.parent && this.labelSingular) {
679
+ this.labelSingularLocalizationId = this._localizationId + "__@labelSingular";
676
680
  }
677
681
  }
678
682
 
@@ -1219,7 +1223,13 @@ class CurrentLogin {
1219
1223
  * @type {string}
1220
1224
  */
1221
1225
  this.timezone = EntityAccessor.getAttributeAsString(userInfo, "timezone");
1222
-
1226
+
1227
+ /**
1228
+ * The instance locale
1229
+ * @type { string }
1230
+ */
1231
+ this.instanceLocale = EntityAccessor.getAttributeAsString(userInfo, "instanceLocale");
1232
+
1223
1233
  /**
1224
1234
  * The llist of operator rights
1225
1235
  * @type {string[]}
@@ -2061,29 +2061,42 @@ describe('Application', () => {
2061
2061
  });
2062
2062
 
2063
2063
  describe("Translation ids", () => {
2064
- it("schema should have a correct label localization id", () => {
2064
+ it("schema should not have label localization id when label does not exist", () => {
2065
2065
  const xml = DomUtil.parse("<schema namespace='nms' name='recipient'><element name='recipient' label='Recipients'/></schema>");
2066
2066
  const schema = newSchema(xml);
2067
+ expect(schema.labelLocalizationId).toBeUndefined();
2068
+ expect(schema.descriptionLocalizationId).toBeUndefined();
2069
+ });
2070
+
2071
+ it("schema should have a correct label localization id", () => {
2072
+ const xml = DomUtil.parse("<schema namespace='nms' name='recipient' label='Recipients' desc='Recipient table(profiles)'><element name='recipient' label='Recipients'/></schema>");
2073
+ const schema = newSchema(xml);
2067
2074
  expect(schema.labelLocalizationId).toBe('nms__recipient__@label');
2068
2075
  expect(schema.descriptionLocalizationId).toBe('nms__recipient__@desc');
2069
2076
  });
2070
2077
 
2071
2078
  it("schema should have a correct singular label localization id", () => {
2072
- const xml = DomUtil.parse("<schema namespace='nms' name='recipient'><element name='recipient' label='Recipients'/></schema>");
2079
+ const xml = DomUtil.parse("<schema namespace='nms' name='recipient' labelSingular='Recipient'><element name='recipient' label='Recipients'/></schema>");
2073
2080
  const schema = newSchema(xml);
2074
2081
  expect(schema.labelSingularLocalizationId).toBe('nms__recipient__@labelSingular');
2075
2082
  });
2076
2083
 
2077
- it("root node should have a correct label localization id", () => {
2084
+ it("schema should not have singular label localization id when singular label does not exist", () => {
2078
2085
  const xml = DomUtil.parse("<schema namespace='nms' name='recipient'><element name='recipient' label='Recipients'/></schema>");
2079
2086
  const schema = newSchema(xml);
2087
+ expect(schema.labelSingularLocalizationId).toBeUndefined();
2088
+ });
2089
+
2090
+ it("root node should have a correct label localization id", () => {
2091
+ const xml = DomUtil.parse("<schema namespace='nms' name='recipient'><element name='recipient' label='Recipients' desc='Recipients'/></schema>");
2092
+ const schema = newSchema(xml);
2080
2093
  const root = schema.root;
2081
2094
  expect(root.labelLocalizationId).toBe('nms__recipient__e____recipient__@label');
2082
2095
  expect(root.descriptionLocalizationId).toBe('nms__recipient__e____recipient__@desc');
2083
2096
  });
2084
2097
 
2085
2098
  it("child node should have a correct label localization id", () => {
2086
- const xml = DomUtil.parse("<schema namespace='nms' name='recipient'><element name='lib' label='library'/><element name='recipient' label='Recipients'/></schema>");
2099
+ const xml = DomUtil.parse("<schema namespace='nms' name='recipient'><element name='lib' label='library' desc='library'/><element name='recipient' label='Recipients'/></schema>");
2087
2100
  const schema = newSchema(xml);
2088
2101
  const lib = schema.children["lib"];
2089
2102
  expect(lib.labelLocalizationId).toBe('nms__recipient__e____lib__@label');
@@ -2093,7 +2106,7 @@ describe('Application', () => {
2093
2106
  it("attribute should have a correct label localization id", () => {
2094
2107
  const xml = DomUtil.parse(`<schema namespace='nms' name='recipient'>
2095
2108
  <element name='recipient' label='Recipients'>
2096
- <attribute name='email' type='string' label='email' length='3'/>
2109
+ <attribute name='email' type='string' label='email' desc='email' length='3'/>
2097
2110
  </element>
2098
2111
  </schema>`);
2099
2112
  const schema = newSchema(xml);
@@ -2141,13 +2154,15 @@ describe('Application', () => {
2141
2154
  loginCS: "Alex",
2142
2155
  timezone: "Europe/Paris",
2143
2156
  "login-right": [
2144
- ]
2157
+ ],
2158
+ instanceLocale: "en"
2145
2159
  })
2146
2160
  expect(op.login).toBe("alex");
2147
2161
  expect(op.id).toBe(12);
2148
2162
  expect(op.computeString).toBe("Alex");
2149
2163
  expect(op.timezone).toBe("Europe/Paris");
2150
2164
  expect(op.rights).toEqual([]);
2165
+ expect(op.instanceLocale).toBe("en");
2151
2166
  })
2152
2167
 
2153
2168
  it("Should support missing 'login-right' node", () => {