@salesforcedevs/dx-components 1.28.7-alpha.12 → 1.28.7-alpha.13
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "1.28.7-alpha.
|
|
3
|
+
"version": "1.28.7-alpha.13",
|
|
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": "
|
|
47
|
+
"gitHead": "30013174e0eb18a3bc89e854eaf505dc33d1089b"
|
|
48
48
|
}
|
|
@@ -2,10 +2,10 @@ import { LightningElement, api, track } from "lwc";
|
|
|
2
2
|
import debounce from "debounce";
|
|
3
3
|
import { track as trackGTM } from "dxUtils/analytics";
|
|
4
4
|
import {
|
|
5
|
-
type
|
|
5
|
+
type Data360SearchResultItem,
|
|
6
6
|
fetchSearch,
|
|
7
7
|
getQueryFromUrl
|
|
8
|
-
} from "dxUtils/
|
|
8
|
+
} from "dxUtils/data360Search";
|
|
9
9
|
|
|
10
10
|
const SEARCH_DEBOUNCE_DELAY = 400;
|
|
11
11
|
|
|
@@ -99,12 +99,12 @@ export default class SearchResults extends LightningElement {
|
|
|
99
99
|
try {
|
|
100
100
|
const raw = await fetchSearch(query);
|
|
101
101
|
this.results = raw.map(
|
|
102
|
-
(item:
|
|
102
|
+
(item: Data360SearchResultItem, index: number) =>
|
|
103
103
|
this.normalizeResult(item, index)
|
|
104
104
|
);
|
|
105
105
|
this.trackSearchResultsOnce(query, this.results.length);
|
|
106
106
|
} catch (err) {
|
|
107
|
-
console.error("Data
|
|
107
|
+
console.error("Data 360 Search request failed", err);
|
|
108
108
|
this.results = [];
|
|
109
109
|
} finally {
|
|
110
110
|
this.isLoading = false;
|
|
@@ -116,7 +116,7 @@ export default class SearchResults extends LightningElement {
|
|
|
116
116
|
}, SEARCH_DEBOUNCE_DELAY);
|
|
117
117
|
|
|
118
118
|
private normalizeResult(
|
|
119
|
-
item:
|
|
119
|
+
item: Data360SearchResultItem,
|
|
120
120
|
index: number
|
|
121
121
|
): SearchResultDisplay {
|
|
122
122
|
const href = item.url ?? "";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import debounce from "debounce";
|
|
3
3
|
import {
|
|
4
|
-
type
|
|
4
|
+
type Data360SearchResultItem,
|
|
5
5
|
fetchSearch
|
|
6
|
-
} from "dxUtils/
|
|
6
|
+
} from "dxUtils/data360Search";
|
|
7
7
|
import { createSearchRegExp } from "dxUtils/regexps";
|
|
8
8
|
import { RecentSearches } from "dxUtils/recentSearches";
|
|
9
9
|
import {
|
|
@@ -44,7 +44,7 @@ const getSearchQueryParam = (): string =>
|
|
|
44
44
|
export default class SidebarSearch extends LightningElement {
|
|
45
45
|
@api
|
|
46
46
|
public fetchMoreResults() {
|
|
47
|
-
// Data
|
|
47
|
+
// Data 360 Search API does not expose pagination in the same way; no-op
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
@api
|
|
@@ -64,7 +64,7 @@ export default class SidebarSearch extends LightningElement {
|
|
|
64
64
|
private recentSearches: Option[] = [];
|
|
65
65
|
private value: string = "";
|
|
66
66
|
private didRender = false;
|
|
67
|
-
private
|
|
67
|
+
private data360SearchInitialized: boolean = false;
|
|
68
68
|
|
|
69
69
|
private get isDropdownOpen() {
|
|
70
70
|
return (
|
|
@@ -81,8 +81,8 @@ export default class SidebarSearch extends LightningElement {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
renderedCallback() {
|
|
84
|
-
if (!this.
|
|
85
|
-
this.
|
|
84
|
+
if (!this.data360SearchInitialized) {
|
|
85
|
+
this.data360SearchInitialized = true;
|
|
86
86
|
if (this.value) {
|
|
87
87
|
// Page load with ?q= in URL: run search so results and loading state resolve
|
|
88
88
|
if (!this.didRender) {
|
|
@@ -101,7 +101,7 @@ export default class SidebarSearch extends LightningElement {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
private normalizeDataCloudResult = (
|
|
104
|
-
item:
|
|
104
|
+
item: Data360SearchResultItem,
|
|
105
105
|
index: number
|
|
106
106
|
): SidebarSearchResult => {
|
|
107
107
|
const href = item.url ?? "";
|
|
@@ -133,7 +133,7 @@ export default class SidebarSearch extends LightningElement {
|
|
|
133
133
|
);
|
|
134
134
|
this.dispatchChange(results);
|
|
135
135
|
} catch (err) {
|
|
136
|
-
console.error("Data
|
|
136
|
+
console.error("Data 360 Search request failed", err);
|
|
137
137
|
this.dispatchChange([]);
|
|
138
138
|
} finally {
|
|
139
139
|
this.dispatchOnLoading(false);
|
package/src/modules/dxUtils/{dataCloudSearch/dataCloudSearch.ts → data360Search/data360Search.ts}
RENAMED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Data
|
|
2
|
+
* Data 360 search API – shared endpoints and helpers for sidebar search,
|
|
3
3
|
* search results page, and has-results check.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
6
|
+
export const DATA_360_SEARCH_PATH = "/data-360-search/search";
|
|
7
|
+
export const DATA_360_HAS_RESULTS_PATH = "/data-360-search/has-results";
|
|
8
|
+
export const DATA_360_SEARCH_ORIGIN = "https://developer.salesforce.com";
|
|
9
9
|
|
|
10
|
-
/** Data
|
|
11
|
-
export interface
|
|
10
|
+
/** Data 360 Search API result item (title, url, matchedText) */
|
|
11
|
+
export interface Data360SearchResultItem {
|
|
12
12
|
title?: string;
|
|
13
13
|
url?: string;
|
|
14
14
|
matchedText?: string;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export function getBaseUrlPath(): string {
|
|
18
|
-
const url =
|
|
18
|
+
const url = DATA_360_SEARCH_ORIGIN + window.location.pathname;
|
|
19
19
|
const lastSlash = url.lastIndexOf("/");
|
|
20
20
|
return lastSlash > 0 ? url.substring(0, lastSlash) : url;
|
|
21
21
|
}
|
|
@@ -53,11 +53,11 @@ export function getQueryFromUrl(): string {
|
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Quick check if the current page has searchable results.
|
|
56
|
-
* Only when this returns true should the Data
|
|
56
|
+
* Only when this returns true should the Data 360 sidebar be shown.
|
|
57
57
|
*/
|
|
58
58
|
export async function fetchHasResults(): Promise<boolean> {
|
|
59
59
|
try {
|
|
60
|
-
const res = await fetch(
|
|
60
|
+
const res = await fetch(DATA_360_HAS_RESULTS_PATH, {
|
|
61
61
|
method: "POST",
|
|
62
62
|
headers: { "Content-Type": "application/json" },
|
|
63
63
|
body: JSON.stringify({ baseUrlPath: getBaseUrlPath() })
|
|
@@ -73,16 +73,16 @@ export async function fetchHasResults(): Promise<boolean> {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
|
-
* Run a Data
|
|
76
|
+
* Run a Data 360 search. Returns the raw result items; callers normalize for UI.
|
|
77
77
|
*/
|
|
78
78
|
export async function fetchSearch(
|
|
79
79
|
searchQuery: string
|
|
80
|
-
): Promise<
|
|
80
|
+
): Promise<Data360SearchResultItem[]> {
|
|
81
81
|
const query = searchQuery.trim();
|
|
82
82
|
if (!query) {
|
|
83
83
|
return [];
|
|
84
84
|
}
|
|
85
|
-
const res = await fetch(
|
|
85
|
+
const res = await fetch(DATA_360_SEARCH_PATH, {
|
|
86
86
|
method: "POST",
|
|
87
87
|
headers: { "Content-Type": "application/json" },
|
|
88
88
|
body: JSON.stringify({
|