@salesforcedevs/docs-components 1.27.22-banner-6 → 1.27.22-banner-8

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/lwc.config.json CHANGED
@@ -6,7 +6,7 @@
6
6
  ],
7
7
  "expose": [
8
8
  "doc/amfReference",
9
- "doc/banner",
9
+ "doc/localeBanner",
10
10
  "doc/breadcrumbs",
11
11
  "doc/componentPlayground",
12
12
  "doc/content",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.27.22-banner-6",
3
+ "version": "1.27.22-banner-8",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -25,5 +25,5 @@
25
25
  "@types/lodash.orderby": "4.6.9",
26
26
  "@types/lodash.uniqby": "4.7.9"
27
27
  },
28
- "gitHead": "7c2d0518bbabd8ad478bcbca57641b8e7982363a"
28
+ "gitHead": "7236921a17b79ea334659f323728ef656feac71e"
29
29
  }
@@ -6,7 +6,7 @@ const LOCALE_BANNER_STORAGE_PREFIX = "dsc-doc-locale-banner-dismissed-";
6
6
  const DEFAULT_MESSAGE_TEXT = "This page was machine-translated ";
7
7
  const DEFAULT_BUTTON_LABEL = "Switch to English";
8
8
 
9
- export default class Banner extends LightningElement {
9
+ export default class LocaleBanner extends LightningElement {
10
10
  @api messageText = DEFAULT_MESSAGE_TEXT;
11
11
 
12
12
  @api messageLinkUrl = "";
@@ -322,8 +322,10 @@ export default class DocXmlContent extends LightningElementWithState<{
322
322
  };
323
323
  }
324
324
 
325
- private handlePopState = (event: PopStateEvent): void =>
325
+ private handlePopState = (event: PopStateEvent): void => {
326
326
  this.updatePageReference(this.getReferenceFromUrl(), event);
327
+ this.dispatchLocaleChange();
328
+ };
327
329
 
328
330
  handleDismissVersionBanner() {
329
331
  this.showVersionBanner = false;
@@ -598,6 +600,28 @@ export default class DocXmlContent extends LightningElementWithState<{
598
600
  "docs",
599
601
  this.pageReferenceToString(this.pageReference)
600
602
  );
603
+ this.dispatchLocaleChange();
604
+ }
605
+
606
+ private dispatchLocaleChange(): void {
607
+ if (typeof window === "undefined") {
608
+ return;
609
+ }
610
+ const enUs = this.availableLanguages?.find((l) => l.id === "en-us");
611
+ window.dispatchEvent(
612
+ new CustomEvent("doc-locale-changed", {
613
+ detail: {
614
+ locale: this.language?.id,
615
+ enUsPath: enUs
616
+ ? this.pageReferenceToString({
617
+ ...this.pageReference,
618
+ docId: enUs.url
619
+ })
620
+ : "",
621
+ deliverable: this.pageReference?.deliverable || "atlas"
622
+ }
623
+ })
624
+ );
601
625
  }
602
626
 
603
627
  private updateHighlighting(searchParam: string): void {