@salesforcedevs/docs-components 1.27.22-banner4 → 1.27.22-banner6
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/docs-components",
|
|
3
|
-
"version": "1.27.22-
|
|
3
|
+
"version": "1.27.22-banner6",
|
|
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": "
|
|
28
|
+
"gitHead": "9e6a595bc97fb7be304852d8cf4d88d1afbb3f6b"
|
|
29
29
|
}
|
|
@@ -25,18 +25,6 @@
|
|
|
25
25
|
lwc:if={docPhaseInfo}
|
|
26
26
|
doc-phase-info={docPhaseInfo}
|
|
27
27
|
></doc-phase>
|
|
28
|
-
<doc-banner
|
|
29
|
-
slot="locale-banner"
|
|
30
|
-
lwc:if={showLocaleBanner}
|
|
31
|
-
message-text="This text was translated using Salesforce's machine translation system. More details can be found "
|
|
32
|
-
message-link-url="https://help.salesforce.com/s/articleView?id=sf.machine_translation.htm"
|
|
33
|
-
message-link-text="here"
|
|
34
|
-
button-label="Switch to English"
|
|
35
|
-
button-href={localeBannerEnUsHref}
|
|
36
|
-
secondary-label="Not Now"
|
|
37
|
-
show-close-button="true"
|
|
38
|
-
dismiss-storage-key={deliverable}
|
|
39
|
-
></doc-banner>
|
|
40
28
|
<doc-phase
|
|
41
29
|
slot="version-banner"
|
|
42
30
|
lwc:if={showVersionBanner}
|
|
@@ -51,8 +51,6 @@ export default class AmfReference extends LightningElement {
|
|
|
51
51
|
@api language!: string;
|
|
52
52
|
@api hideFooter = false;
|
|
53
53
|
|
|
54
|
-
@api deliverable = "";
|
|
55
|
-
|
|
56
54
|
/** Optional origin URL for the footer MFE (e.g. wp-json endpoint). Passed through to dx-footer-mfe. */
|
|
57
55
|
@api origin: string | null = null;
|
|
58
56
|
@track navigation = [] as NavigationItem[];
|
|
@@ -74,18 +72,6 @@ export default class AmfReference extends LightningElement {
|
|
|
74
72
|
return this.isSpecBasedReference(this._currentReferenceId);
|
|
75
73
|
}
|
|
76
74
|
|
|
77
|
-
get showLocaleBanner(): boolean {
|
|
78
|
-
if (!this.deliverable || this.language === "en-us") {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
return this.languages?.some((l) => l.id === "en-us") ?? false;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
get localeBannerEnUsHref(): string {
|
|
85
|
-
const enUs = this.languages?.find((l) => l.id === "en-us");
|
|
86
|
-
return enUs?.link?.href ?? "";
|
|
87
|
-
}
|
|
88
|
-
|
|
89
75
|
@api
|
|
90
76
|
get referenceSetConfig(): ReferenceSetConfig {
|
|
91
77
|
return this._referenceSetConfig;
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
align-items: flex-start;
|
|
24
24
|
justify-content: space-between;
|
|
25
25
|
width: 100%;
|
|
26
|
-
|
|
27
|
-
margin: 0 auto;
|
|
26
|
+
margin: 0;
|
|
28
27
|
min-height: var(--doc-banner-height);
|
|
29
28
|
padding: 0 var(--doc-banner-padding-x-right) 0
|
|
30
29
|
var(--doc-banner-padding-x-left);
|
|
@@ -2,6 +2,7 @@ import { LightningElement, api, track } from "lwc";
|
|
|
2
2
|
import { normalizeBoolean } from "dxUtils/normalizers";
|
|
3
3
|
|
|
4
4
|
const LOCALE_BANNER_STORAGE_PREFIX = "dsc-doc-locale-banner-dismissed-";
|
|
5
|
+
const BANNER_DEBUG_PREFIX = "[doc-banner]";
|
|
5
6
|
|
|
6
7
|
export default class Banner extends LightningElement {
|
|
7
8
|
@api messageText = "";
|
|
@@ -31,15 +32,33 @@ export default class Banner extends LightningElement {
|
|
|
31
32
|
@track private _dismissed = false;
|
|
32
33
|
|
|
33
34
|
connectedCallback() {
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
if (typeof window === "undefined") {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const storageKey = this.dismissStorageKey
|
|
39
|
+
? `${LOCALE_BANNER_STORAGE_PREFIX}${this.dismissStorageKey}`
|
|
40
|
+
: "";
|
|
41
|
+
if (this.dismissStorageKey && window.sessionStorage) {
|
|
42
|
+
const stored = window.sessionStorage.getItem(storageKey);
|
|
43
|
+
this._dismissed = stored === "true";
|
|
44
|
+
console.debug(BANNER_DEBUG_PREFIX, "visibility check", {
|
|
45
|
+
dismissStorageKey: this.dismissStorageKey,
|
|
46
|
+
storageKey,
|
|
47
|
+
sessionStorageValue: stored,
|
|
48
|
+
dismissed: this._dismissed,
|
|
49
|
+
bannerWillShow: !this._dismissed,
|
|
50
|
+
reason: this._dismissed
|
|
51
|
+
? "User dismissed in this session (Not Now / close)"
|
|
52
|
+
: "Not dismissed; banner will show"
|
|
53
|
+
});
|
|
54
|
+
} else {
|
|
55
|
+
console.debug(BANNER_DEBUG_PREFIX, "visibility check", {
|
|
56
|
+
dismissStorageKey: this.dismissStorageKey || "(empty)",
|
|
57
|
+
bannerWillShow: true,
|
|
58
|
+
reason: !this.dismissStorageKey
|
|
59
|
+
? "No dismiss key: banner always shown by component (if theme rendered it)"
|
|
60
|
+
: "sessionStorage not available"
|
|
61
|
+
});
|
|
43
62
|
}
|
|
44
63
|
}
|
|
45
64
|
|
|
@@ -66,9 +85,9 @@ export default class Banner extends LightningElement {
|
|
|
66
85
|
if (
|
|
67
86
|
this.dismissStorageKey &&
|
|
68
87
|
typeof window !== "undefined" &&
|
|
69
|
-
window.
|
|
88
|
+
window.sessionStorage
|
|
70
89
|
) {
|
|
71
|
-
window.
|
|
90
|
+
window.sessionStorage.setItem(
|
|
72
91
|
`${LOCALE_BANNER_STORAGE_PREFIX}${this.dismissStorageKey}`,
|
|
73
92
|
"true"
|
|
74
93
|
);
|