@fluid-topics/ft-search-bar 1.0.55 → 1.0.57

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,7 +1,5 @@
1
- import { FtSearchFacet, FtSearchRequest } from "@fluid-topics/public-api";
1
+ import { FtSearchFacet } from "@fluid-topics/public-api";
2
2
  import { FtFilterProperties } from "@fluid-topics/ft-filter";
3
- export declare function serializeRequest(baseUrl: string, request: FtSearchRequest): string;
4
- export declare function quote(value: string): string;
5
3
  export declare function unquote(value: string): string;
6
4
  export declare function getLabelFromValue(value: string): string | undefined;
7
5
  export declare function getBreadcrumbFromValue(value: string): string;
@@ -1,28 +1,4 @@
1
1
  import { flatDeep } from "@fluid-topics/ft-wc-utils";
2
- export function serializeRequest(baseUrl, request) {
3
- var _a;
4
- const params = new URLSearchParams({
5
- "content-lang": (_a = request.contentLocale) !== null && _a !== void 0 ? _a : "all",
6
- "query": request.query
7
- });
8
- if (request.filters.length > 0) {
9
- const filters = request.filters.map(filter => {
10
- const values = filter.values
11
- .map(value => value.replace(/_/g, "\\\\\\\\_")
12
- .replace(/~/g, "\\\\~")
13
- .replace(/\*/g, "\\*"))
14
- .map(value => encodeURIComponent(quote(value)))
15
- .join("_");
16
- return `${filter.key}~${values}`;
17
- }).join("*");
18
- params.append("filters", filters);
19
- }
20
- const url = new URL(`${baseUrl}/search/all?${params.toString()}`);
21
- return url.href;
22
- }
23
- export function quote(value) {
24
- return `"${value}"`;
25
- }
26
2
  export function unquote(value) {
27
3
  if (value.startsWith("\"") && value.endsWith("\"")) {
28
4
  return value.replace(/(^"+)|("+$)/g, "");
@@ -7,10 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { html, nothing } from "lit";
8
8
  import { property, query, state } from "lit/decorators.js";
9
9
  import { repeat } from "lit/directives/repeat.js";
10
- import { Debouncer, flatDeep, FtLitElement, jsonProperty, ParametrizedLabelResolver } from "@fluid-topics/ft-wc-utils";
10
+ import { Debouncer, flatDeep, FtLitElement, jsonProperty, ParametrizedLabelResolver, serializeRequest } from "@fluid-topics/ft-wc-utils";
11
11
  import { FtSizeCategory, FtSizeWatcher } from "@fluid-topics/ft-size-watcher";
12
12
  import { FtTypography, FtTypographyBody2 } from "@fluid-topics/ft-typography";
13
- import { facetToFilter, selectedValues, serializeRequest, unquote } from "./converters";
13
+ import { facetToFilter, selectedValues, unquote } from "./converters";
14
14
  import { FtFilter, FtFilterOption } from "@fluid-topics/ft-filter";
15
15
  import { FtIcon, } from "@fluid-topics/ft-icon";
16
16
  import { FtAccordion, FtAccordionItem } from "@fluid-topics/ft-accordion";