@salesforcedevs/dx-components 1.32.0-alpha.8 → 1.32.1-alpha.0

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,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",
@@ -128,7 +129,6 @@
128
129
  "dxUtils/analytics",
129
130
  "dxUtils/async",
130
131
  "dxUtils/constants",
131
- "dxUtils/data360Search",
132
132
  "dxUtils/contentTypes",
133
133
  "dxUtils/coveo",
134
134
  "dxUtils/dates",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.32.0-alpha.8",
3
+ "version": "1.32.1-alpha.0",
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": "b97e92aa3483e9eefdba3d60962f20cd68291df2"
47
+ "gitHead": "6ce1be58809077071ba1466ed17deb4a9315bf1e"
48
48
  }
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <div lwc:dom="manual" class="miaw-host"></div>
3
+ </template>
@@ -0,0 +1,139 @@
1
+ /* eslint-disable @lwc/lwc/no-document-query */
2
+ import { LightningElement, api } from "lwc";
3
+
4
+ const PAGE_BUILDER_TAG = "page-builder-miaw-ui";
5
+ const SCRIPT_SRC =
6
+ "https://a.sfdcstatic.com/digital/@sfdc-www-emu/page-builder-miaw-ui/v1-stable/page-builder-miaw-ui.js";
7
+ const DEFINE_TIMEOUT_MS = 60_000;
8
+
9
+ let loadPromise: Promise<void> | null = null;
10
+
11
+ function withTimeout<T>(
12
+ promise: Promise<T>,
13
+ ms: number,
14
+ message: string
15
+ ): Promise<T> {
16
+ return Promise.race([
17
+ promise,
18
+ new Promise<T>((_, reject) => {
19
+ window.setTimeout(() => reject(new Error(message)), ms);
20
+ })
21
+ ]);
22
+ }
23
+
24
+ function loadMiawUi(): Promise<void> {
25
+ if (loadPromise) {
26
+ return loadPromise;
27
+ }
28
+
29
+ loadPromise = (async () => {
30
+ let script = document.querySelector(
31
+ `script[src="${SCRIPT_SRC}"]`
32
+ ) as HTMLScriptElement | null;
33
+
34
+ const awaitDefinition = () =>
35
+ withTimeout(
36
+ customElements.whenDefined(PAGE_BUILDER_TAG),
37
+ DEFINE_TIMEOUT_MS,
38
+ `${PAGE_BUILDER_TAG} did not register within ${
39
+ DEFINE_TIMEOUT_MS / 1000
40
+ }s. ` +
41
+ "Confirm the script loads (network tab), your origin is allowed, and CSP permits this script."
42
+ ).then(() => undefined);
43
+
44
+ if (customElements.get(PAGE_BUILDER_TAG)) {
45
+ return;
46
+ }
47
+
48
+ if (script) {
49
+ await awaitDefinition();
50
+ return;
51
+ }
52
+
53
+ script = document.createElement("script");
54
+ script.type = "module";
55
+ script.src = SCRIPT_SRC;
56
+
57
+ await new Promise<void>((resolve, reject) => {
58
+ script!.addEventListener("load", () => resolve(), { once: true });
59
+ script!.addEventListener(
60
+ "error",
61
+ () =>
62
+ reject(
63
+ new Error(
64
+ `Failed to load page-builder-miaw-ui script (${SCRIPT_SRC}). Check status code and referrer rules.`
65
+ )
66
+ ),
67
+ { once: true }
68
+ );
69
+ document.head.appendChild(script!);
70
+ });
71
+
72
+ await awaitDefinition();
73
+ })();
74
+
75
+ loadPromise = loadPromise.catch((e) => {
76
+ loadPromise = null;
77
+ throw e;
78
+ });
79
+
80
+ return loadPromise;
81
+ }
82
+
83
+ export default class AgentMiawUi extends LightningElement {
84
+ /** Salesforce org id (15- or 18-character Id). */
85
+ @api orgId!: string;
86
+ /** Messaging endpoint host URL (e.g. https://org62.my.salesforce-scrt.com). */
87
+ @api messagingUrl!: string;
88
+ @api deploymentDevName = "page_builder_miaw_ui";
89
+ @api richComponentVersion = "v1-stable";
90
+
91
+ private ensureMountedPromise: Promise<void> | null = null;
92
+
93
+ renderedCallback(): void {
94
+ if (!this.orgId || !this.messagingUrl) {
95
+ return;
96
+ }
97
+ if (
98
+ this.template
99
+ .querySelector(".miaw-host")
100
+ ?.querySelector(PAGE_BUILDER_TAG)
101
+ ) {
102
+ return;
103
+ }
104
+
105
+ this.ensureMiawUiMounted();
106
+ }
107
+
108
+ private ensureMiawUiMounted(): Promise<void> {
109
+ if (this.ensureMountedPromise) {
110
+ return this.ensureMountedPromise;
111
+ }
112
+
113
+ this.ensureMountedPromise = (async () => {
114
+ try {
115
+ await loadMiawUi();
116
+ const container = this.template.querySelector(".miaw-host");
117
+ if (!container || container.querySelector(PAGE_BUILDER_TAG)) {
118
+ return;
119
+ }
120
+
121
+ const el = document.createElement(PAGE_BUILDER_TAG);
122
+ el.setAttribute("org-id", this.orgId);
123
+ el.setAttribute("messaging-url", this.messagingUrl);
124
+ el.setAttribute("deployment-dev-name", this.deploymentDevName);
125
+ el.setAttribute(
126
+ "rich-component-version",
127
+ this.richComponentVersion
128
+ );
129
+ container.appendChild(el);
130
+ } catch (e) {
131
+ console.error(e);
132
+ } finally {
133
+ this.ensureMountedPromise = null;
134
+ }
135
+ })();
136
+
137
+ return this.ensureMountedPromise;
138
+ }
139
+ }
@@ -31,7 +31,14 @@
31
31
  transition: var(--dx-g-transition-hue-1x);
32
32
  align-items: center;
33
33
  outline: none !important;
34
- background: white;
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;
@@ -248,7 +248,7 @@ li.coveo-dynamic-facet-breadcrumb-value-list-item {
248
248
 
249
249
  .coveo-pager-list-item {
250
250
  border: none;
251
- border-radius: var(--dx-g-spacing-xs);
251
+ border-radius: 16px;
252
252
  display: inline-flex;
253
253
  align-items: center;
254
254
  justify-content: center;
@@ -282,62 +282,13 @@ li.coveo-dynamic-facet-breadcrumb-value-list-item {
282
282
  border-right: none;
283
283
  }
284
284
 
285
- /* List item states: same padding in all states so text never moves. Ring 8px from text on sides, more on top/bottom. */
286
285
  .dx-result {
287
- --dx-result-inner-gap-x: var(
288
- --dx-g-spacing-sm
289
- ); /* 8px between text and ring on sides */
290
-
291
- --dx-result-inner-gap-y: var(
292
- --dx-g-spacing-xs
293
- ); /* ring closer to card edge so more padding inside box top/bottom */
294
-
295
- position: relative;
296
286
  background: white;
297
- border-radius: var(--dx-g-spacing-md);
287
+ border-radius: 16px;
298
288
  border: 1px solid rgb(24 24 24 / 4%);
299
289
  box-shadow: 0 0 2px 0 rgb(24 24 24 / 8%), 0 2px 4px 1px rgb(24 24 24 / 16%);
300
- padding: var(--dx-g-spacing-md);
301
- margin-bottom: var(--dx-g-spacing-md);
302
- transition: background-color 0.1s ease;
303
- }
304
-
305
- /* Hover: same shape as focus box, more padding top/bottom inside box; space between results unchanged */
306
- .dx-result:hover::after {
307
- content: "";
308
- position: absolute;
309
- top: var(--dx-result-inner-gap-y);
310
- bottom: var(--dx-result-inner-gap-y);
311
- left: var(--dx-result-inner-gap-x);
312
- right: var(--dx-result-inner-gap-x);
313
- background: var(--dx-g-gray-95);
314
- border-radius: var(--dx-g-spacing-xs);
315
- pointer-events: none;
316
- z-index: 0;
317
- }
318
-
319
- .dx-result > * {
320
- position: relative;
321
- z-index: 1;
322
- }
323
-
324
- /* Focus: ring 8px from text via pseudo-element; no padding/layout change */
325
- .dx-result:focus-within {
326
- outline: none;
327
- }
328
-
329
- /* Pseudo: 8px from text on sides, more padding top/bottom inside ring (smaller inset y) */
330
- .dx-result:focus-within::before {
331
- content: "";
332
- position: absolute;
333
- top: var(--dx-result-inner-gap-y);
334
- bottom: var(--dx-result-inner-gap-y);
335
- left: var(--dx-result-inner-gap-x);
336
- right: var(--dx-result-inner-gap-x);
337
- border: 2px solid var(--dx-g-blue-vibrant-50);
338
- border-radius: var(--dx-g-spacing-xs);
339
- pointer-events: none;
340
- z-index: 2;
290
+ padding: 20px;
291
+ margin-bottom: var(--dx-g-spacing-lg);
341
292
  }
342
293
 
343
294
  .dx-result-title {
@@ -371,59 +322,10 @@ li.coveo-dynamic-facet-breadcrumb-value-list-item {
371
322
  color: white;
372
323
  }
373
324
 
374
- .dx-search-header + .dx-search-main {
325
+ .dx-search-header + .coveo-main-section {
375
326
  margin-top: var(--dx-g-spacing-2xl);
376
327
  }
377
328
 
378
- .dx-search-results {
379
- font-family: var(--dx-g-font-sans);
380
- background-color: #fafaf9;
381
- }
382
-
383
- .dx-search-main {
384
- max-width: 1200px;
385
- margin: 0 auto;
386
- padding: 0 var(--dx-g-spacing-xl);
387
- }
388
-
389
- .dx-search-box-row {
390
- margin-bottom: var(--dx-g-spacing-lg);
391
- }
392
-
393
- .dx-search-box-row .dx-search-box {
394
- max-width: 400px;
395
- }
396
-
397
- .dx-search-loading {
398
- padding: var(--dx-g-spacing-2xl);
399
- text-align: center;
400
- }
401
-
402
- .dx-search-loading-image {
403
- max-width: 200px;
404
- }
405
-
406
- .dx-search-no-results {
407
- display: flex;
408
- justify-content: center;
409
- gap: 90px;
410
- margin: 50px 34px 90px;
411
- }
412
-
413
- .dx-search-no-results-info {
414
- text-align: left;
415
- }
416
-
417
- .dx-search-no-results-info > ul {
418
- list-style-type: disc;
419
- list-style-position: inside;
420
- font-size: var(--dx-g-text-xs);
421
- }
422
-
423
- .dx-search-result-list {
424
- padding-bottom: var(--dx-g-spacing-2xl);
425
- }
426
-
427
329
  .dx-search-header-container {
428
330
  margin: 0 auto;
429
331
  max-width: 1200px;
@@ -596,8 +498,7 @@ li.coveo-dynamic-facet-breadcrumb-value-list-item {
596
498
  }
597
499
 
598
500
  @media screen and (max-width: 768px) {
599
- .no-results > img,
600
- .dx-search-no-results > img {
501
+ .no-results > img {
601
502
  display: none;
602
503
  }
603
504
  }
@@ -1,102 +1,106 @@
1
1
  <template>
2
- <div id="search" class="dx-search-results">
3
- <div lwc:if={hasQuery} class="dx-search-header">
2
+ <div
3
+ id="search"
4
+ class="CoveoSearchInterface"
5
+ data-enable-history="true"
6
+ data-pipeline={coveoSearchPipeline}
7
+ >
8
+ <div
9
+ class="CoveoAnalytics"
10
+ data-search-hub="salesforcedevdoc"
11
+ data-endpoint={coveoAnalyticsEndpoint}
12
+ ></div>
13
+ <div if:true={hasQuery} class="dx-search-header">
4
14
  <div class="dx-search-header-container">
5
15
  <p class="dx-search-header-title">
6
- <span class="dx-search-header-title-results">
7
- {resultCountLabel}
8
- </span>
16
+ <span class="dx-search-header-title-results">{header}</span>
9
17
  &nbsp;results for
10
18
  </p>
11
19
  <p class="dx-search-header-query">&ldquo;{query}&rdquo;</p>
12
20
  </div>
13
21
  </div>
14
- <div class="dx-search-main">
15
- <div class="dx-search-results-column">
16
- <div class="dx-search-box-row">
17
- <dx-input
18
- class="dx-search-box"
19
- type="search"
20
- placeholder="Search"
21
- role="search"
22
- aria-label="Search"
23
- icon-symbol="search"
24
- size="small"
25
- value={query}
26
- onchange={onSearchInputChange}
27
- clearable
28
- ></dx-input>
22
+ <div class="coveo-main-section">
23
+ <div class="coveo-facet-column">
24
+ <div class="dx-facet-column-header">
25
+ <span class="dx-facet-column-header-title">Filters</span>
26
+ <template if:true={hasFilters}>
27
+ <dx-button onclick={clearFilters} variant="inline">
28
+ Clear
29
+ </dx-button>
30
+ </template>
29
31
  </div>
30
- <div lwc:if={isLoading} class="dx-search-loading">
31
- <img
32
- class="dx-search-loading-image"
33
- src="https://a.sfdcstatic.com/developer-website/prod/images/sidebar-loading.svg"
34
- alt="Loading"
35
- />
32
+ <div
33
+ class="CoveoDynamicFacetManager"
34
+ data-enable-reorder="false"
35
+ >
36
+ <div
37
+ class="CoveoDynamicFacet"
38
+ data-title="Content Type"
39
+ data-field="@commonsource"
40
+ data-tab="All"
41
+ data-enable-facet-search="false"
42
+ ></div>
43
+ <div
44
+ class="CoveoDynamicFacet"
45
+ data-title="Language"
46
+ data-field="@language"
47
+ data-tab="All"
48
+ data-enable-facet-search="false"
49
+ ></div>
36
50
  </div>
37
- <template lwc:if={showNoResults}>
38
- <div class="dx-search-no-results">
39
- <img
40
- src="https://a.sfdcstatic.com/developer-website/prod/images/binary-cloud-circle-small.svg"
41
- alt=""
42
- />
43
- <div class="dx-search-no-results-info">
44
- <p class="dx-text-display-8">
45
- Sorry, no results were found for your search
46
- &ldquo;{query}&rdquo;
47
- </p>
48
- <p class="dx-text-display-8 tip">Search Tips:</p>
49
- <ul class="tip-list">
50
- <li>Please consider misspellings</li>
51
- <li>Try different search keywords</li>
52
- </ul>
53
- <p class="dx-text-display-8 tip tbc-container">
54
- Still not finding what you're looking for?
55
- Consider asking in the&nbsp;
56
- <a
57
- class="link"
58
- href="https://trailhead.salesforce.com/trailblazer-community/feed"
59
- >
60
- Trailblazer Community
61
- </a>
62
- !
63
- </p>
64
- </div>
51
+ <div class="dx-facet-column-footer">
52
+ <dx-button onclick={dismissFiltersOverlay}>
53
+ View {header} results
54
+ </dx-button>
55
+ </div>
56
+ </div>
57
+ <div class="coveo-results-column">
58
+ <div class="CoveoShareQuery"></div>
59
+ <div class="CoveoExportToExcel"></div>
60
+ <div class="CoveoPreferencesPanel">
61
+ <div class="CoveoResultsPreferences"></div>
62
+ <div class="CoveoResultsFiltersPreferences"></div>
63
+ </div>
64
+ <div class="CoveoDidYouMean"></div>
65
+ <div class="coveo-results-header">
66
+ <div class="coveo-summary-section"></div>
67
+ <div class="coveo-sort-section" role="radiogroup">
68
+ <span
69
+ class="CoveoSort"
70
+ data-sort-criteria="relevancy"
71
+ data-caption="Sorted by Relevance"
72
+ ></span>
65
73
  </div>
66
- </template>
67
- <template lwc:if={hasResults}>
68
- <div class="dx-search-result-list">
69
- <template
70
- for:each={results}
71
- for:item="result"
72
- for:index="index"
73
- >
74
- <div
75
- key={result.uniqueId}
76
- class="dx-result"
77
- data-result-id={result.uniqueId}
78
- >
79
- <a
80
- href={result.href}
81
- class="dx-result-title"
82
- target={result.openInNewTab}
83
- rel={result.rel}
84
- data-index={result.resultIndex}
85
- data-title={result.title}
86
- onclick={onSearchResultClick}
87
- >
88
- {result.title}
89
- </a>
90
- <p
91
- lwc:if={result.matchedText}
92
- class="dx-result-excerpt"
93
- >
94
- {result.matchedText}
95
- </p>
96
- </div>
97
- </template>
74
+ <div>
75
+ <div
76
+ class="CoveoSearchbox"
77
+ data-enable-omnibox="false"
78
+ data-add-search-button="false"
79
+ aria-hidden="true"
80
+ ></div>
98
81
  </div>
99
- </template>
82
+ </div>
83
+ <div class="CoveoBreadcrumb"></div>
84
+ <div class="CoveoHiddenQuery"></div>
85
+ <div class="CoveoErrorReport"></div>
86
+ <div
87
+ class="CoveoResultList"
88
+ data-layout="list"
89
+ data-wait-animation="fade"
90
+ data-auto-select-fields-to-include="true"
91
+ lwc:dom="manual"
92
+ ></div>
93
+ <div class="coveo-results-footer" aria-hidden="true">
94
+ <div class="CoveoPager"></div>
95
+ </div>
96
+ <div class="pagination-container">
97
+ <dx-pagination
98
+ current-page={currentPage}
99
+ total-pages={totalPages}
100
+ onpagechange={goToPage}
101
+ pages-to-show="5"
102
+ ></dx-pagination>
103
+ </div>
100
104
  </div>
101
105
  </div>
102
106
  </div>