@builder.io/sdk-svelte 0.0.2 → 0.0.3
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare type QueryObject = Record<string, string>;
|
|
2
2
|
export declare const convertSearchParamsToQueryObject: (searchParams: URLSearchParams) => QueryObject;
|
|
3
|
-
export declare const getBuilderSearchParams: (
|
|
3
|
+
export declare const getBuilderSearchParams: (_options: QueryObject | URLSearchParams | undefined) => QueryObject;
|
|
4
4
|
export declare const getBuilderSearchParamsFromWindow: () => QueryObject;
|
|
5
5
|
export declare const normalizeSearchParams: (searchParams: QueryObject | URLSearchParams) => QueryObject;
|
|
6
6
|
export {};
|
|
@@ -7,7 +7,11 @@ export const convertSearchParamsToQueryObject = (searchParams) => {
|
|
|
7
7
|
});
|
|
8
8
|
return options;
|
|
9
9
|
};
|
|
10
|
-
export const getBuilderSearchParams = (
|
|
10
|
+
export const getBuilderSearchParams = (_options) => {
|
|
11
|
+
if (!_options) {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
const options = normalizeSearchParams(_options);
|
|
11
15
|
const newOptions = {};
|
|
12
16
|
Object.keys(options).forEach((key) => {
|
|
13
17
|
if (key.startsWith(BUILDER_SEARCHPARAMS_PREFIX)) {
|
|
@@ -22,7 +26,7 @@ export const getBuilderSearchParamsFromWindow = () => {
|
|
|
22
26
|
return {};
|
|
23
27
|
}
|
|
24
28
|
const searchParams = new URLSearchParams(window.location.search);
|
|
25
|
-
return getBuilderSearchParams(
|
|
29
|
+
return getBuilderSearchParams(searchParams);
|
|
26
30
|
};
|
|
27
31
|
export const normalizeSearchParams = (searchParams) => searchParams instanceof URLSearchParams
|
|
28
32
|
? convertSearchParamsToQueryObject(searchParams)
|