@salesforcedevs/dx-components 1.31.5 → 1.31.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.31.5",
3
+ "version": "1.31.7",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -44,5 +44,5 @@
44
44
  "luxon": "3.4.4",
45
45
  "msw": "^2.12.4"
46
46
  },
47
- "gitHead": "80f936e02ef6a2ed6737f1cb37046c86354356cf"
47
+ "gitHead": "ef557a5501d2ffae9c2a6316a63bc976776263d5"
48
48
  }
@@ -64,6 +64,7 @@ export default class AgentMiawUi extends LightningElement {
64
64
  @api messagingUrl!: string;
65
65
  @api deploymentDevName = "page_builder_miaw_ui";
66
66
  @api richComponentVersion = "v1-stable";
67
+ @api isOnDigitalDomain = "true";
67
68
  @api routingAttributes?: string;
68
69
  /**
69
70
  * JSON array of suggested prompt strings for the MIAW UI (e.g.
@@ -95,6 +96,7 @@ export default class AgentMiawUi extends LightningElement {
95
96
  el.setAttribute("messaging-url", this.messagingUrl);
96
97
  el.setAttribute("deployment-dev-name", this.deploymentDevName);
97
98
  el.setAttribute("input-variant", "mini-sidebar");
99
+ el.setAttribute("is-on-digital-domain", this.isOnDigitalDomain);
98
100
  el.setAttribute(
99
101
  "rich-component-version",
100
102
  this.richComponentVersion
@@ -1,22 +1,43 @@
1
1
  import kebabCase from "lodash.kebabcase";
2
2
  import { LightningElement, api } from "lwc";
3
3
 
4
- const defaultDomain = "https://developer.salesforce.com";
4
+ const defaultDomain = ""; // empty domain means the header settings will be loaded from the same domain as the current page
5
5
  const defaultLocale = "en-us";
6
6
  const defaultHeaderSettingsBasePath = "/c/public/header-settings";
7
+ const defaultPropertyTitle = "Developers";
7
8
  const headerSettingsJsonKeys = [
8
9
  "regionSelectorOverride",
9
10
  "contactLinksOverride"
10
11
  ];
11
12
 
12
13
  export default class DevExNavigation extends LightningElement {
13
- static renderMode = "light";
14
+ static renderMode = "light"; // Light DOM currently required due to other elements reading from this element's DOM; we should fix that and use existing nav CSS variables in those other elements (TODO)
14
15
 
15
16
  @api locale: string = defaultLocale;
16
17
  @api path: string = defaultHeaderSettingsBasePath;
17
18
  @api domain: string = defaultDomain;
19
+ @api propertyTitle: string = defaultPropertyTitle; // used only as a fallback in the "barebones" nav
20
+
21
+ // Fallback basic nav config used when the header settings are not available
22
+ private get barebonesNavConfig() {
23
+ return {
24
+ headerSettings: {
25
+ origin: "",
26
+ contextNavEnabled: "true"
27
+ },
28
+ navItems: {
29
+ variation: "static",
30
+ propertyTitle: {
31
+ label: this.propertyTitle,
32
+ url: "/"
33
+ },
34
+ menuGroup: {}
35
+ }
36
+ };
37
+ }
18
38
 
19
39
  async connectedCallback(): Promise<void> {
40
+ let navConfig = null;
20
41
  try {
21
42
  const headerSettingsResponse = await fetch(
22
43
  `${this.domain}${this.path}/${this.locale}.json`,
@@ -27,13 +48,12 @@ export default class DevExNavigation extends LightningElement {
27
48
  }
28
49
  );
29
50
  if (headerSettingsResponse.ok) {
30
- this.createFullNav(await headerSettingsResponse.json());
31
- } else {
32
- this.createBarebonesNav();
51
+ navConfig = await headerSettingsResponse.json();
33
52
  }
34
53
  } catch (ex) {
35
- console.error(`Navigation error: ${ex}`);
36
- this.createBarebonesNav();
54
+ console.error(`Header settings error: ${ex}`);
55
+ } finally {
56
+ this.createFullNav(navConfig || this.barebonesNavConfig);
37
57
  }
38
58
  }
39
59
 
@@ -63,22 +83,4 @@ export default class DevExNavigation extends LightningElement {
63
83
  containerEl.appendChild(hgfNav);
64
84
  containerEl.appendChild(hgfNavContext);
65
85
  }
66
-
67
- private createBarebonesNav(): void {
68
- const hgfNav = this.createGlobalNav({
69
- origin: "",
70
- contextNavEnabled: "true"
71
- });
72
- const hgfNavContext = this.createContextNav({
73
- variation: "static",
74
- propertyTitle: {
75
- label: "Developers",
76
- url: "/"
77
- },
78
- menuGroup: {}
79
- });
80
- const containerEl = this.refs.globalNavContainer as Element;
81
- containerEl.appendChild(hgfNav);
82
- containerEl.appendChild(hgfNavContext);
83
- }
84
86
  }