@getlupa/client 0.4.3-1 → 0.5.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.
Files changed (47) hide show
  1. package/README.md +11 -3
  2. package/dist/cjs/components/search-results/filters/facets/TermFacet.vue.d.ts +3 -2
  3. package/dist/cjs/constants/development/searchBoxDev.example.const.d.ts +1 -0
  4. package/dist/cjs/constants/development/searchResultsDev.example.const.d.ts +1 -0
  5. package/dist/cjs/constants/queryParams.const.d.ts +1 -0
  6. package/dist/cjs/index.d.ts +1 -0
  7. package/dist/cjs/index.min.js +442 -233
  8. package/dist/cjs/store/modules/searchBox.d.ts +4 -3
  9. package/dist/cjs/types/General.d.ts +4 -0
  10. package/dist/cjs/types/search-box/SearchBoxOptions.d.ts +1 -0
  11. package/dist/cjs/types/search-results/SearchResultsOptions.d.ts +1 -0
  12. package/dist/cjs/utils/filter.toggle.utils.d.ts +1 -1
  13. package/dist/cjs/utils/filter.utils.d.ts +1 -0
  14. package/dist/cjs/utils/price.utils.d.ts +2 -2
  15. package/dist/cjs/utils/tracking.utils.d.ts +4 -0
  16. package/dist/es/components/search-results/filters/facets/TermFacet.vue.d.ts +3 -2
  17. package/dist/es/constants/development/searchBoxDev.example.const.d.ts +1 -0
  18. package/dist/es/constants/development/searchResultsDev.example.const.d.ts +1 -0
  19. package/dist/es/constants/queryParams.const.d.ts +1 -0
  20. package/dist/es/index.d.ts +1 -0
  21. package/dist/es/index.min.js +442 -233
  22. package/dist/es/store/modules/searchBox.d.ts +4 -3
  23. package/dist/es/types/General.d.ts +4 -0
  24. package/dist/es/types/search-box/SearchBoxOptions.d.ts +1 -0
  25. package/dist/es/types/search-results/SearchResultsOptions.d.ts +1 -0
  26. package/dist/es/utils/filter.toggle.utils.d.ts +1 -1
  27. package/dist/es/utils/filter.utils.d.ts +1 -0
  28. package/dist/es/utils/price.utils.d.ts +2 -2
  29. package/dist/es/utils/tracking.utils.d.ts +4 -0
  30. package/dist/iife/components/search-results/filters/facets/TermFacet.vue.d.ts +3 -2
  31. package/dist/iife/constants/development/searchBoxDev.example.const.d.ts +1 -0
  32. package/dist/iife/constants/development/searchResultsDev.example.const.d.ts +1 -0
  33. package/dist/iife/constants/queryParams.const.d.ts +1 -0
  34. package/dist/iife/index.d.ts +1 -0
  35. package/dist/iife/index.min.js +1 -1
  36. package/dist/iife/store/modules/searchBox.d.ts +4 -3
  37. package/dist/iife/types/General.d.ts +4 -0
  38. package/dist/iife/types/search-box/SearchBoxOptions.d.ts +1 -0
  39. package/dist/iife/types/search-results/SearchResultsOptions.d.ts +1 -0
  40. package/dist/iife/utils/filter.toggle.utils.d.ts +1 -1
  41. package/dist/iife/utils/filter.utils.d.ts +1 -0
  42. package/dist/iife/utils/price.utils.d.ts +2 -2
  43. package/dist/iife/utils/tracking.utils.d.ts +4 -0
  44. package/package.json +2 -2
  45. package/.github/workflows/build-test.yml +0 -23
  46. package/.github/workflows/npm-publish.yml +0 -24
  47. package/cypress.json +0 -1
@@ -1,8 +1,9 @@
1
1
  import { SearchBoxOptions } from "@/types/search-box/SearchBoxOptions";
2
- import { Options, PublicQuery, SearchQueryResult, Suggestion } from "@getlupa/client-sdk/Types";
2
+ import { PublicQuery, SearchQueryResult, Suggestion } from "@getlupa/client-sdk/Types";
3
3
  import { VuexModule } from "vuex-module-decorators";
4
4
  import { DisplaySuggestion, HighlightedDocInfo } from "@/types/search-box/Common";
5
5
  import { SearchBoxPanel } from "@/types/search-box/SearchBoxPanel";
6
+ import { SdkOptions } from "@/types/General";
6
7
  export default class SearchBoxModule extends VuexModule {
7
8
  options: SearchBoxOptions;
8
9
  docResults: Record<string, SearchQueryResult>;
@@ -43,7 +44,7 @@ export default class SearchBoxModule extends VuexModule {
43
44
  querySuggestions({ queryKey, publicQuery, options, }: {
44
45
  queryKey: string;
45
46
  publicQuery: PublicQuery;
46
- options?: Options | undefined;
47
+ options?: SdkOptions;
47
48
  }): Promise<{
48
49
  queryKey: string;
49
50
  suggestions?: Suggestion[];
@@ -52,7 +53,7 @@ export default class SearchBoxModule extends VuexModule {
52
53
  queryDocuments({ queryKey, publicQuery, options, }: {
53
54
  queryKey: string;
54
55
  publicQuery: PublicQuery;
55
- options?: Options | undefined;
56
+ options?: SdkOptions;
56
57
  }): Promise<{
57
58
  queryKey: string;
58
59
  result?: SearchQueryResult;
@@ -2,6 +2,10 @@ import { Environment } from "@getlupa/client-sdk/Types";
2
2
  import { AnalyticsOptions } from "./AnalyticsOptions";
3
3
  export declare type SdkOptions = {
4
4
  environment: Environment;
5
+ customUrl?: string;
6
+ customPayload?: Record<string, unknown>;
7
+ customHeaders?: Record<string, string>;
8
+ onError?: (err: unknown) => unknown;
5
9
  };
6
10
  export declare type TrackingOptions = {
7
11
  trackBase?: boolean;
@@ -10,6 +10,7 @@ export declare type SearchBoxOptionLabels = {
10
10
  noResults: string;
11
11
  moreResults: string;
12
12
  currency: string;
13
+ priceSeparator?: string;
13
14
  defaultFacetLabel?: string;
14
15
  };
15
16
  export declare type SearchBoxOptionLinks = {
@@ -18,6 +18,7 @@ export declare type SearchResultsSimilarQueriesLabels = {
18
18
  export declare type SearchResultsOptionLabels = SearchResultsPaginationLabels & SearchResultsDidYouMeanLabels & SearchResultsSimilarQueriesLabels & {
19
19
  sortBy: string;
20
20
  currency: string;
21
+ priceSeparator?: string;
21
22
  itemCount: string;
22
23
  emptyResults: string;
23
24
  mobileFilterButton: string;
@@ -16,7 +16,7 @@ export declare const getFacetParam: (key: string, value: string[] | string, type
16
16
  };
17
17
  export declare const toggleTermFilter: (appendParams: AppendParams, facetAction: TermFacetAction, currentFilters?: FilterGroup | undefined) => void;
18
18
  export declare const toggleHierarchyFilter: (appendParams: AppendParams, facetAction: HierarchyFacetAction, currentFilters?: FilterGroup | undefined, removeAllLevels?: boolean) => void;
19
- export declare const toggleRangeFilter: (appendParams: AppendParams, facetAction: RangeFacetAction) => void;
19
+ export declare const toggleRangeFilter: (appendParams: AppendParams, facetAction: RangeFacetAction, currentFilters?: FilterGroup | undefined) => void;
20
20
  export declare const toggleTermParam: (params?: string[], param?: string) => string[];
21
21
  export declare const toggleLastPram: (params?: string[], param?: string) => string[];
22
22
  export declare const toggleHierarchyParam: (params?: string[], param?: string, removeAllLevels?: boolean) => string[];
@@ -8,3 +8,4 @@ export declare const isArrayKey: (key: string) => boolean;
8
8
  export declare const getMostSpecificHierarchyTerms: (terms: string[]) => string[];
9
9
  export declare const recursiveFilter: (items: HierarchyTree[], query?: string) => HierarchyTree[];
10
10
  export declare const recursiveFilterItem: (item: HierarchyTree, query?: string) => HierarchyTree | undefined;
11
+ export declare const rangeFilterToString: (rangeFilter: FilterGroupItemTypeRange, separator?: string | undefined) => string;
@@ -1,2 +1,2 @@
1
- export declare const formatPrice: (price?: string | number | undefined, currency?: string) => string;
2
- export declare const formatPriceSummary: ([min, max]: [min?: string | number | undefined, max?: string | number | undefined], currency?: string | undefined) => string;
1
+ export declare const formatPrice: (price?: string | number | undefined, currency?: string, separator?: string) => string;
2
+ export declare const formatPriceSummary: ([min, max]: [min?: string | number | undefined, max?: string | number | undefined], currency?: string | undefined, separator?: string) => string;
@@ -2,4 +2,8 @@ import { TrackingOptions } from "@/types/General";
2
2
  import { TrackableEventData } from "@/types/search-box/Common";
3
3
  import { Options } from "@getlupa/client-sdk/Types";
4
4
  export declare const initTracking: (options: TrackingOptions) => void;
5
+ export declare const getLupaTrackingContext: () => {
6
+ userId?: string;
7
+ sessionId?: string;
8
+ };
5
9
  export declare const track: (queryKey?: string | undefined, data?: TrackableEventData, options?: Options | undefined) => void;
@@ -1,10 +1,10 @@
1
1
  import Vue from "vue";
2
- import { FacetGroup, FacetGroupItem, FilterGroupItemTypeTerms } from "@getlupa/client-sdk/Types";
2
+ import { FacetGroup, FacetGroupItem, FilterGroupItemTypeRange, FilterGroupItemTypeTerms } from "@getlupa/client-sdk/Types";
3
3
  import { ResultFacetOptions } from "@/types/search-results/SearchResultsOptions";
4
4
  export default class TermFacet extends Vue {
5
5
  options: ResultFacetOptions;
6
6
  facet: FacetGroup;
7
- currentFilters: FilterGroupItemTypeTerms;
7
+ currentFilters: FilterGroupItemTypeTerms | FilterGroupItemTypeRange[];
8
8
  showAll: boolean;
9
9
  termFilter: string;
10
10
  get itemLimit(): number;
@@ -12,6 +12,7 @@ export default class TermFacet extends Vue {
12
12
  get displayValues(): FacetGroupItem[];
13
13
  get filteredValues(): FacetGroupItem[];
14
14
  get isFilterable(): boolean;
15
+ get isRange(): boolean;
15
16
  handleFacetClick(item: FacetGroupItem): void;
16
17
  handleShowAll(): void;
17
18
  isChecked(item: FacetGroupItem): boolean;
@@ -13,6 +13,7 @@ export declare const SEARCH_BOX_CONFIGURATION: {
13
13
  noResults: string;
14
14
  moreResults: string;
15
15
  currency: string;
16
+ priceSeparator: string;
16
17
  defaultFacetLabel: string;
17
18
  };
18
19
  links: {
@@ -10,6 +10,7 @@ export declare const SEARCH_RESULTS_CONFIGURATION: {
10
10
  sortBy: string;
11
11
  itemCount: string;
12
12
  currency: string;
13
+ priceSeparator: string;
13
14
  showMore: string;
14
15
  emptyResults: string;
15
16
  mobileFilterButton: string;
@@ -23,3 +23,4 @@ export declare const FACET_FILTER_MAP: {
23
23
  export declare const FACET_KEY_SEPARATOR = ".";
24
24
  export declare const FACET_RANGE_SEPARATOR = ":";
25
25
  export declare const HIERARCHY_SEPARATOR = ">";
26
+ export declare const FACET_TERM_RANGE_SEPARATOR = "-";
@@ -8,4 +8,5 @@ declare const lupaSearch: {
8
8
  clearSearchBox: () => void;
9
9
  clearSearchResults: () => void;
10
10
  };
11
+ export { TrackingOptions, SearchBoxOptions, SearchResultsOptions };
11
12
  export default lupaSearch;