@salesforcedevs/dx-components 1.32.0-alpha.9 → 1.32.0-docs-content-type-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/lwc.config.json +2 -1
- package/package.json +47 -47
- package/src/modules/dx/agentMiawUi/agentMiawUi.css +4 -0
- package/src/modules/dx/agentMiawUi/agentMiawUi.html +3 -0
- package/src/modules/dx/agentMiawUi/agentMiawUi.ts +253 -0
- package/src/modules/dx/button/button.css +5 -0
- package/src/modules/dx/codeBlock/codeBlock.css +7 -0
- package/src/modules/dx/dropdownOption/dropdownOption.css +8 -13
- package/src/modules/dx/footer/footer.ts +55 -32
- package/src/modules/dx/globalHeader/globalHeader.html +2 -2
- package/src/modules/dx/globalHeader/globalHeader.ts +40 -30
- package/src/modules/dx/searchHybrid/searchHybrid.css +165 -0
- package/src/modules/dx/searchHybrid/searchHybrid.html +136 -0
- package/src/modules/dx/searchHybrid/searchHybrid.ts +306 -0
- package/src/modules/dx/searchResults/searchResults.css +6 -107
- package/src/modules/dx/searchResults/searchResults.html +91 -87
- package/src/modules/dx/searchResults/searchResults.ts +477 -174
- package/src/modules/dx/sidebar/sidebar.css +0 -1
- package/src/modules/dx/sidebar/sidebar.html +5 -1
- package/src/modules/dx/sidebar/sidebar.ts +29 -44
- package/src/modules/dx/sidebarOld/sidebarOld.html +0 -1
- package/src/modules/dx/sidebarSearch/sidebarSearch.ts +343 -159
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.css +24 -51
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.ts +4 -12
- package/src/modules/dx/tree/treeHandler.ts +2 -1
- package/src/modules/dx/treeTile/treeTile.css +4 -0
- package/src/modules/dx/treeTile/treeTile.html +10 -0
- package/src/modules/dx/treeTile/treeTile.ts +4 -0
- package/src/modules/dxUtils/async/async.ts +32 -0
- package/src/modules/dxUtils/searchLocalePrefs/searchLocalePrefs.ts +193 -0
- package/LICENSE +0 -12
- package/src/modules/dxUtils/data360Search/data360Search.ts +0 -168
package/lwc.config.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
],
|
|
7
7
|
"expose": [
|
|
8
8
|
"dx/agenda",
|
|
9
|
+
"dx/agentMiawUi",
|
|
9
10
|
"dx/alert",
|
|
10
11
|
"dx/audio",
|
|
11
12
|
"dx/banner",
|
|
@@ -85,6 +86,7 @@
|
|
|
85
86
|
"dx/redirectChecker",
|
|
86
87
|
"dx/relativeDateTime",
|
|
87
88
|
"dx/scrollManager",
|
|
89
|
+
"dx/searchHybrid",
|
|
88
90
|
"dx/searchResults",
|
|
89
91
|
"dx/section",
|
|
90
92
|
"dx/sectionBanner",
|
|
@@ -128,7 +130,6 @@
|
|
|
128
130
|
"dxUtils/analytics",
|
|
129
131
|
"dxUtils/async",
|
|
130
132
|
"dxUtils/constants",
|
|
131
|
-
"dxUtils/data360Search",
|
|
132
133
|
"dxUtils/contentTypes",
|
|
133
134
|
"dxUtils/coveo",
|
|
134
135
|
"dxUtils/dates",
|
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
2
|
+
"name": "@salesforcedevs/dx-components",
|
|
3
|
+
"version": "1.32.0-docs-content-type-1",
|
|
4
|
+
"description": "DX Lightning web components",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": "22.x"
|
|
8
|
+
},
|
|
9
|
+
"publishConfig": {
|
|
10
|
+
"access": "public"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@coveo/headless": "3.22.2",
|
|
14
|
+
"@floating-ui/dom": "1.5.1",
|
|
15
|
+
"@optimizely/optimizely-sdk": "5.3.0",
|
|
16
|
+
"@shikijs/colorized-brackets": "^3.12.2",
|
|
17
|
+
"@types/throttle-debounce": "5.0.2",
|
|
18
|
+
"@vimeo/player": "2.22.0",
|
|
19
|
+
"classnames": "2.5.1",
|
|
20
|
+
"composed-offset-position": "0.0.4",
|
|
21
|
+
"coveo-search-ui": "2.10113.0",
|
|
22
|
+
"debounce": "1.2.1",
|
|
23
|
+
"js-cookie": "3.0.5",
|
|
24
|
+
"lodash.defaults": "4.2.0",
|
|
25
|
+
"lodash.get": "4.4.2",
|
|
26
|
+
"lodash.kebabcase": "4.1.1",
|
|
27
|
+
"memoize-one": "6.0.0",
|
|
28
|
+
"microtip": "0.2.2",
|
|
29
|
+
"shiki": "^3.12.2",
|
|
30
|
+
"throttle-debounce": "5.0.0",
|
|
31
|
+
"uuid": "9.0.1"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/classnames": "2.3.1",
|
|
35
|
+
"@types/debounce": "1.2.4",
|
|
36
|
+
"@types/js-cookie": "3.0.6",
|
|
37
|
+
"@types/lodash.defaults": "4.2.9",
|
|
38
|
+
"@types/lodash.get": "4.4.9",
|
|
39
|
+
"@types/lodash.kebabcase": "4.1.9",
|
|
40
|
+
"@types/luxon": "3.4.2",
|
|
41
|
+
"@types/uuid": "8.3.4",
|
|
42
|
+
"@types/vimeo__player": "2.18.3",
|
|
43
|
+
"eventsourcemock": "2.0.0",
|
|
44
|
+
"luxon": "3.4.4",
|
|
45
|
+
"msw": "^2.12.4"
|
|
46
|
+
},
|
|
47
|
+
"stableVersion": "1.35.1"
|
|
48
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/* eslint-disable @lwc/lwc/no-document-query */
|
|
2
|
+
import { LightningElement, api } from "lwc";
|
|
3
|
+
import { waitUntilResolved } from "dxUtils/async";
|
|
4
|
+
|
|
5
|
+
const HOSTED_MIAW_UI_TAG = "page-builder-miaw-ui";
|
|
6
|
+
const SCRIPT_SRC =
|
|
7
|
+
"https://a.sfdcstatic.com/digital/@sfdc-www-emu/page-builder-miaw-ui/v1-stable/page-builder-miaw-ui.js";
|
|
8
|
+
const DEFINE_TIMEOUT_MS = 60000;
|
|
9
|
+
const WHEN_DEFINED_TIMEOUT_MESSAGE =
|
|
10
|
+
`MIAW UI embed (${HOSTED_MIAW_UI_TAG}) did not register within ${
|
|
11
|
+
DEFINE_TIMEOUT_MS / 1000
|
|
12
|
+
}s. ` +
|
|
13
|
+
"Confirm the script loads (network tab), your origin is allowed, and CSP permits this script.";
|
|
14
|
+
|
|
15
|
+
let scriptLoaded: Promise<void> | null = null;
|
|
16
|
+
|
|
17
|
+
async function ensureMiawScriptAndDefinition(): Promise<void> {
|
|
18
|
+
if (customElements.get(HOSTED_MIAW_UI_TAG)) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
let script = document.querySelector(
|
|
23
|
+
`script[src="${SCRIPT_SRC}"]`
|
|
24
|
+
) as HTMLScriptElement | null;
|
|
25
|
+
|
|
26
|
+
if (!script) {
|
|
27
|
+
script = document.createElement("script");
|
|
28
|
+
script.type = "module";
|
|
29
|
+
script.src = SCRIPT_SRC;
|
|
30
|
+
await new Promise<void>((resolve, reject) => {
|
|
31
|
+
script!.addEventListener("load", () => resolve(), { once: true });
|
|
32
|
+
script!.addEventListener(
|
|
33
|
+
"error",
|
|
34
|
+
() =>
|
|
35
|
+
reject(
|
|
36
|
+
new Error(
|
|
37
|
+
`Failed to load MIAW UI embed script (${SCRIPT_SRC}). Check status code and referrer rules.`
|
|
38
|
+
)
|
|
39
|
+
),
|
|
40
|
+
{ once: true }
|
|
41
|
+
);
|
|
42
|
+
document.head.appendChild(script!);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
await waitUntilResolved(
|
|
46
|
+
customElements.whenDefined(HOSTED_MIAW_UI_TAG),
|
|
47
|
+
DEFINE_TIMEOUT_MS,
|
|
48
|
+
WHEN_DEFINED_TIMEOUT_MESSAGE
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Loads the MIAW UI script if it is not already loaded. This occurs only once per module instance. */
|
|
53
|
+
function loadMiawUiScript(): Promise<void> {
|
|
54
|
+
if (!scriptLoaded) {
|
|
55
|
+
scriptLoaded = ensureMiawScriptAndDefinition();
|
|
56
|
+
}
|
|
57
|
+
return scriptLoaded;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function dropCookie(cookieDomain: string) {
|
|
61
|
+
const { hostname, protocol } = window.location;
|
|
62
|
+
const onCookieDomain =
|
|
63
|
+
!!cookieDomain &&
|
|
64
|
+
(hostname === cookieDomain || hostname.endsWith(`.${cookieDomain}`));
|
|
65
|
+
|
|
66
|
+
document.cookie = [
|
|
67
|
+
"show_agent=true",
|
|
68
|
+
"Path=/",
|
|
69
|
+
"Max-Age=2592000",
|
|
70
|
+
"SameSite=Lax",
|
|
71
|
+
protocol === "https:" ? "Secure" : null,
|
|
72
|
+
onCookieDomain ? `Domain=${cookieDomain}` : null
|
|
73
|
+
]
|
|
74
|
+
.filter(Boolean)
|
|
75
|
+
.join("; ");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default class AgentMiawUi extends LightningElement {
|
|
79
|
+
private static readonly SIDEBAR_OPEN_ATTR = "data-xsf-agent-sidebar-open";
|
|
80
|
+
private static readonly AGENT_ROOT_SELECTOR = '[data-testid="agent-root"]';
|
|
81
|
+
private static readonly SIDEBAR_OPEN_CLASS = "view-sidebar";
|
|
82
|
+
|
|
83
|
+
/** Salesforce org id (15- or 18-character Id). */
|
|
84
|
+
@api orgId!: string;
|
|
85
|
+
/** Messaging endpoint host URL (e.g. https://org62.my.salesforce-scrt.com). */
|
|
86
|
+
@api messagingUrl!: string;
|
|
87
|
+
@api deploymentDevName = "page_builder_miaw_ui";
|
|
88
|
+
@api richComponentVersion = "v1-stable";
|
|
89
|
+
@api isOnDigitalDomain = "true";
|
|
90
|
+
@api routingAttributes?: string;
|
|
91
|
+
/**
|
|
92
|
+
* JSON array of suggested prompt strings for the MIAW UI (e.g.
|
|
93
|
+
* `["Show me an Agentforce demo","Help me build a business case"]`); forwarded as `prompts` on the embed.
|
|
94
|
+
*/
|
|
95
|
+
@api prompts?: string;
|
|
96
|
+
/** When set, forwarded to the embed as `welcome-text` (greeting / headline copy). */
|
|
97
|
+
@api welcomeText?: string;
|
|
98
|
+
@api agentforceEnv?: string;
|
|
99
|
+
private _hideAgentConditionally = false;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* When set, mounting of the agent is gated behind the `showAgent=true` query param
|
|
103
|
+
* or `show_agent=true` cookie opt-in; otherwise (and by default), gating is off.
|
|
104
|
+
*
|
|
105
|
+
* COERCION: this component is consumed as raw, server-rendered HTML on an LWR page —
|
|
106
|
+
* not inside another LWC's template — so LWC's presence→boolean attribute convention
|
|
107
|
+
* does NOT apply automatically. Native attribute reflection runs instead, and LWC's
|
|
108
|
+
* attributeChangedCallback assigns the raw attribute STRING to this property
|
|
109
|
+
* (`this[prop] = newValue`), so a bare `hide-agent-conditionally` arrives as `""`, not
|
|
110
|
+
* boolean `true`. This setter restores HTML boolean-attribute semantics by source:
|
|
111
|
+
* - boolean (LWC property API / tests): honored as-is, so `false` turns gating off.
|
|
112
|
+
* - string (native attribute reflection): PRESENCE means true regardless of value —
|
|
113
|
+
* `""`, `"true"`, and even `"false"` all enable gating, exactly like `disabled="false"`
|
|
114
|
+
* is still disabled. Only absence (null/undefined, i.e. the attribute removed) is false.
|
|
115
|
+
*/
|
|
116
|
+
@api
|
|
117
|
+
get hideAgentConditionally(): boolean {
|
|
118
|
+
return this._hideAgentConditionally;
|
|
119
|
+
}
|
|
120
|
+
set hideAgentConditionally(value: boolean | string | null | undefined) {
|
|
121
|
+
this._hideAgentConditionally =
|
|
122
|
+
typeof value === "boolean"
|
|
123
|
+
? value
|
|
124
|
+
: value !== null && value !== undefined;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Apex domain that the opt-in cookie targets (covers subdomains); applied only when the
|
|
128
|
+
* current host matches it, so local dev / preview hosts fall back to a host-only cookie.
|
|
129
|
+
*/
|
|
130
|
+
@api cookieDomain?: string;
|
|
131
|
+
|
|
132
|
+
/** After first mount attempt is scheduled, we do not run it again for this instance. */
|
|
133
|
+
private hasRendered = false;
|
|
134
|
+
private sidebarStateObserver: MutationObserver | null = null;
|
|
135
|
+
private sidebarStateTargetSelector = "#main-content";
|
|
136
|
+
|
|
137
|
+
renderedCallback(): void {
|
|
138
|
+
if (!this.hasRendered) {
|
|
139
|
+
this.hasRendered = true;
|
|
140
|
+
if (this.shouldMount()) {
|
|
141
|
+
this.mountMiawHost();
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
disconnectedCallback(): void {
|
|
147
|
+
this.sidebarStateObserver?.disconnect();
|
|
148
|
+
this.sidebarStateObserver = null;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Decide whether the agent should mount. If conditional gating is off, always mount.
|
|
153
|
+
* If conditional gating of the agent is on, return `true` only when the user has opted in
|
|
154
|
+
* via the `showAgent=true` query param or the `show_agent=true` cookie. (When only the
|
|
155
|
+
* param is present, persists a sticky opt-in cookie (~30 days) as a side effect so the
|
|
156
|
+
* choice carries across pages and subdomains.)
|
|
157
|
+
*
|
|
158
|
+
* CROSS-SITE CONTRACT: the param key/value, cookie token, Max-Age, SameSite, Secure and
|
|
159
|
+
* Domain-scoping logic are MIRRORED in architect-sf, since both serve pages for Architect.
|
|
160
|
+
* Changing these values requires a coordinated change in all repos.
|
|
161
|
+
*/
|
|
162
|
+
private shouldMount(): boolean {
|
|
163
|
+
if (!this.hideAgentConditionally) {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// When the agent should be conditionally hidden, we check for special query param or
|
|
168
|
+
// cookie required for actually mounting/rendering it.
|
|
169
|
+
const hasParam =
|
|
170
|
+
new URLSearchParams(window.location.search).get("showAgent") ===
|
|
171
|
+
"true";
|
|
172
|
+
const hasCookie = /(?:^|;\s*)show_agent=true(?:;|$)/.test(
|
|
173
|
+
document.cookie
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
// If the user doesn't have the cookie yet but does have the param, set the cookie
|
|
177
|
+
if (hasParam && !hasCookie) {
|
|
178
|
+
dropCookie(this.cookieDomain || "");
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return hasParam || hasCookie;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
private async mountMiawHost(): Promise<void> {
|
|
185
|
+
try {
|
|
186
|
+
await loadMiawUiScript();
|
|
187
|
+
const container = this.template.querySelector(".miaw-host");
|
|
188
|
+
if (!container) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const el = document.createElement(HOSTED_MIAW_UI_TAG);
|
|
192
|
+
el.setAttribute("org-id", this.orgId);
|
|
193
|
+
el.setAttribute("messaging-url", this.messagingUrl);
|
|
194
|
+
el.setAttribute("deployment-dev-name", this.deploymentDevName);
|
|
195
|
+
el.setAttribute("input-variant", "mini-sidebar");
|
|
196
|
+
el.setAttribute("is-on-digital-domain", this.isOnDigitalDomain);
|
|
197
|
+
el.setAttribute(
|
|
198
|
+
"rich-component-version",
|
|
199
|
+
this.richComponentVersion
|
|
200
|
+
);
|
|
201
|
+
if (this.routingAttributes) {
|
|
202
|
+
el.setAttribute("routing-attributes", this.routingAttributes);
|
|
203
|
+
}
|
|
204
|
+
if (this.prompts) {
|
|
205
|
+
el.setAttribute("prompts", this.prompts);
|
|
206
|
+
}
|
|
207
|
+
if (this.welcomeText) {
|
|
208
|
+
el.setAttribute("welcome-text", this.welcomeText);
|
|
209
|
+
}
|
|
210
|
+
el.setAttribute("env", this.agentforceEnv || "dev");
|
|
211
|
+
container.appendChild(el);
|
|
212
|
+
this.bridgeSidebarState(el);
|
|
213
|
+
} catch (e) {
|
|
214
|
+
console.error(e);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
private setSidebarOpenState(isOpen: boolean): void {
|
|
219
|
+
const targets = document.querySelectorAll(
|
|
220
|
+
this.sidebarStateTargetSelector
|
|
221
|
+
);
|
|
222
|
+
targets.forEach((target) => {
|
|
223
|
+
target.setAttribute(
|
|
224
|
+
AgentMiawUi.SIDEBAR_OPEN_ATTR,
|
|
225
|
+
isOpen ? "true" : "false"
|
|
226
|
+
);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
private bridgeSidebarState(el: Element): void {
|
|
231
|
+
const host = el as HTMLElement;
|
|
232
|
+
const root = host.shadowRoot?.querySelector(
|
|
233
|
+
AgentMiawUi.AGENT_ROOT_SELECTOR
|
|
234
|
+
) as HTMLElement | null;
|
|
235
|
+
if (!root) {
|
|
236
|
+
window.requestAnimationFrame(() => this.bridgeSidebarState(el));
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const isOpen = () =>
|
|
241
|
+
root.classList.contains(AgentMiawUi.SIDEBAR_OPEN_CLASS);
|
|
242
|
+
this.setSidebarOpenState(isOpen());
|
|
243
|
+
|
|
244
|
+
this.sidebarStateObserver?.disconnect();
|
|
245
|
+
this.sidebarStateObserver = new MutationObserver(() => {
|
|
246
|
+
this.setSidebarOpenState(isOpen());
|
|
247
|
+
});
|
|
248
|
+
this.sidebarStateObserver.observe(root, {
|
|
249
|
+
attributes: true,
|
|
250
|
+
attributeFilter: ["class"]
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
--dx-c-button-opacity: 1;
|
|
18
18
|
--dx-c-button-font-size: var(--dx-g-text-sm);
|
|
19
19
|
--dx-c-button-font-weight: var(--dx-g-font-normal);
|
|
20
|
+
--dx-c-button-line-height: inherit;
|
|
21
|
+
--dx-c-button-letter-spacing: inherit;
|
|
20
22
|
--dx-c-button-display: flex;
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -35,6 +37,8 @@
|
|
|
35
37
|
var(--dx-c-button-horizontal-spacing, var(--dx-g-spacing-md));
|
|
36
38
|
border-radius: var(--dx-g-spacing-xs);
|
|
37
39
|
font-weight: var(--dx-c-button-font-weight);
|
|
40
|
+
line-height: var(--dx-c-button-line-height);
|
|
41
|
+
letter-spacing: var(--dx-c-button-letter-spacing);
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
.button:focus {
|
|
@@ -63,6 +67,7 @@
|
|
|
63
67
|
.button.variant_inline-inherit dx-icon,
|
|
64
68
|
.button.variant_icon-only dx-icon {
|
|
65
69
|
display: inline-block;
|
|
70
|
+
vertical-align: var(--dx-c-button-icon-vertical-align, 0.1em);
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
.button > span {
|
|
@@ -143,6 +143,13 @@ code[class*="shiki"] {
|
|
|
143
143
|
padding: 0 var(--dx-g-spacing-md) 0 var(--dx-g-spacing-sm);
|
|
144
144
|
text-align: right;
|
|
145
145
|
user-select: none;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.dx-theme-light .code-line-number {
|
|
149
|
+
color: var(--dx-g-gray-40);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.dx-theme-dark .code-line-number {
|
|
146
153
|
color: var(--dx-g-gray-60);
|
|
147
154
|
}
|
|
148
155
|
|
|
@@ -31,7 +31,14 @@
|
|
|
31
31
|
transition: var(--dx-g-transition-hue-1x);
|
|
32
32
|
align-items: center;
|
|
33
33
|
outline: none !important;
|
|
34
|
-
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.option:focus {
|
|
37
|
+
box-shadow: inset 0 0 0 1px var(--dx-g-blue-vibrant-50);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.option:active {
|
|
41
|
+
background: var(--dx-g-cloud-blue-vibrant-95) !important;
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
.option:not(.option-active):hover {
|
|
@@ -44,18 +51,6 @@
|
|
|
44
51
|
background: var(--dx-g-cloud-blue-vibrant-95);
|
|
45
52
|
}
|
|
46
53
|
|
|
47
|
-
.option:focus {
|
|
48
|
-
box-shadow: 0 0 0 2px var(--dx-g-blue-vibrant-50);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.option-active:focus {
|
|
52
|
-
box-shadow: 0 0 0 2px var(--dx-g-blue-vibrant-50);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.option:active {
|
|
56
|
-
background: var(--dx-g-cloud-blue-vibrant-95) !important;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
54
|
.option_details {
|
|
60
55
|
display: flex;
|
|
61
56
|
flex-direction: column;
|
|
@@ -8,7 +8,7 @@ class Footer extends LightningElement {
|
|
|
8
8
|
private _variant: FooterVariant = "small-signup";
|
|
9
9
|
private isSlotEmpty = true;
|
|
10
10
|
private signupUrl =
|
|
11
|
-
"https://www.salesforce.com/
|
|
11
|
+
"https://www.salesforce.com/company/newsletter-subscribe/?topics=Developer";
|
|
12
12
|
|
|
13
13
|
@api
|
|
14
14
|
mfeHomeHref: string = `/${window.location.host}`; // ugly hack: ideally this wouldn't be necessary, but the only way to remove the "See all ways to contact us" link from the footer MFE is to set this to a non-empty value other than "us"; and given the way that the footer works, the non-empty value needs to be something that can be appended to `/` and work correctly
|
|
@@ -151,7 +151,10 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
|
|
|
151
151
|
private buildFooterConfigLookupTables(config: any[]) {
|
|
152
152
|
config.forEach((item: any) => {
|
|
153
153
|
// attr_title is preferable to title because it is not language-specific
|
|
154
|
-
this.configItemTitleToItemLookup.set(
|
|
154
|
+
this.configItemTitleToItemLookup.set(
|
|
155
|
+
item.attr_title || item.title,
|
|
156
|
+
item
|
|
157
|
+
);
|
|
155
158
|
if (item.menu_item_parent) {
|
|
156
159
|
const parentId = parseInt(item.menu_item_parent, 10);
|
|
157
160
|
const children =
|
|
@@ -188,26 +191,26 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
|
|
|
188
191
|
return;
|
|
189
192
|
}
|
|
190
193
|
|
|
191
|
-
this.socialLinks =
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
194
|
+
this.socialLinks = socialLinksItems.map((child: any) => {
|
|
195
|
+
const childTitle: string =
|
|
196
|
+
child.attr_title || child.title || ""; // attr_title is preferable to title because it is not language-specific
|
|
197
|
+
const iconSymbol =
|
|
198
|
+
childTitle === "LinkedIn"
|
|
199
|
+
? "linked-in"
|
|
200
|
+
: childTitle.toLocaleLowerCase();
|
|
201
|
+
const iconUrlHash =
|
|
202
|
+
iconSymbol === "twitter"
|
|
203
|
+
? "#twitter-x"
|
|
204
|
+
: `#themed-${iconSymbol}`;
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
href: child.url,
|
|
208
|
+
iconSprite: "brand",
|
|
209
|
+
iconURL: `${baseSocialIconUrl}${iconUrlHash}`,
|
|
210
|
+
label: child.title,
|
|
211
|
+
iconSymbol
|
|
212
|
+
};
|
|
213
|
+
});
|
|
211
214
|
}
|
|
212
215
|
|
|
213
216
|
private setGeneralLinks() {
|
|
@@ -234,10 +237,14 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
|
|
|
234
237
|
|
|
235
238
|
const generalLinks: any[] = [];
|
|
236
239
|
generalLinksHeadingsItems.forEach((item: any) => {
|
|
237
|
-
const childrenItems = this.configItemParentToChildrenLookup.get(
|
|
240
|
+
const childrenItems = this.configItemParentToChildrenLookup.get(
|
|
241
|
+
item.ID
|
|
242
|
+
);
|
|
238
243
|
|
|
239
244
|
if (!childrenItems) {
|
|
240
|
-
console.error(
|
|
245
|
+
console.error(
|
|
246
|
+
`General links children items not found for item with title "${item.title}"`
|
|
247
|
+
);
|
|
241
248
|
return;
|
|
242
249
|
}
|
|
243
250
|
|
|
@@ -260,16 +267,24 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
|
|
|
260
267
|
}
|
|
261
268
|
|
|
262
269
|
private setLegalFooter() {
|
|
263
|
-
const copyrightNoticeItem = this.configItemTitleToItemLookup.get(
|
|
270
|
+
const copyrightNoticeItem = this.configItemTitleToItemLookup.get(
|
|
271
|
+
"All rights reserved"
|
|
272
|
+
);
|
|
264
273
|
|
|
265
274
|
if (!copyrightNoticeItem) {
|
|
266
|
-
console.error(
|
|
275
|
+
console.error(
|
|
276
|
+
"All rights reserved item not found in footer config"
|
|
277
|
+
);
|
|
267
278
|
return;
|
|
268
279
|
}
|
|
269
280
|
|
|
270
281
|
const { url, description } = copyrightNoticeItem;
|
|
271
|
-
const copyrightNoticeInnerHtml = description.replace(
|
|
272
|
-
|
|
282
|
+
const copyrightNoticeInnerHtml = description.replace(
|
|
283
|
+
"{{All rights reserved}}",
|
|
284
|
+
`<a href="${url}">All rights reserved</a>`
|
|
285
|
+
);
|
|
286
|
+
const copyrightNoticeEl =
|
|
287
|
+
this.template.querySelector(".copyright-notice")!;
|
|
273
288
|
copyrightNoticeEl.innerHTML = copyrightNoticeInnerHtml;
|
|
274
289
|
const copyrightLink = copyrightNoticeEl.querySelector("a");
|
|
275
290
|
if (copyrightLink) {
|
|
@@ -278,10 +293,14 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
|
|
|
278
293
|
);
|
|
279
294
|
}
|
|
280
295
|
|
|
281
|
-
const legalLinksItems = this.configItemParentToChildrenLookup.get(
|
|
296
|
+
const legalLinksItems = this.configItemParentToChildrenLookup.get(
|
|
297
|
+
copyrightNoticeItem.ID
|
|
298
|
+
);
|
|
282
299
|
|
|
283
300
|
if (!legalLinksItems) {
|
|
284
|
-
console.error(
|
|
301
|
+
console.error(
|
|
302
|
+
"Legal links children items not found in footer config"
|
|
303
|
+
);
|
|
285
304
|
return;
|
|
286
305
|
}
|
|
287
306
|
|
|
@@ -298,7 +317,8 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
|
|
|
298
317
|
link.href = "#";
|
|
299
318
|
link.onclick = this.handleCookiePreferencesClick;
|
|
300
319
|
} else if (itemTitle === "Your Privacy Choices") {
|
|
301
|
-
link.img =
|
|
320
|
+
link.img =
|
|
321
|
+
"https://developer.salesforce.com/ns-assets/privacyoptions.svg";
|
|
302
322
|
}
|
|
303
323
|
|
|
304
324
|
return link;
|
|
@@ -306,7 +326,10 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
|
|
|
306
326
|
}
|
|
307
327
|
|
|
308
328
|
private openOneTrustInfoDisplay() {
|
|
309
|
-
if (
|
|
329
|
+
if (
|
|
330
|
+
(window as any).OneTrust &&
|
|
331
|
+
(window as any).OneTrust.ToggleInfoDisplay
|
|
332
|
+
) {
|
|
310
333
|
(window as any).OneTrust.ToggleInfoDisplay();
|
|
311
334
|
}
|
|
312
335
|
}
|