algolia-experiences 1.0.1 → 1.0.2

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/src/types.ts DELETED
@@ -1,104 +0,0 @@
1
- import type { widgets } from './widgets';
2
-
3
- type StaticString = { type: 'string'; value: string };
4
- type Attribute = { type: 'attribute'; path: string[] };
5
- type Highlight = { type: 'highlight' | 'snippet'; path: string[] };
6
- export type TemplateText = Array<Attribute | StaticString | Highlight>;
7
- export type TemplateAttribute = Array<Attribute | StaticString>;
8
- type RegularParameters = {
9
- class?: TemplateAttribute;
10
- };
11
- export type TemplateChild =
12
- | {
13
- type: 'paragraph' | 'span' | 'h2';
14
- parameters: {
15
- text: TemplateText;
16
- } & RegularParameters;
17
- }
18
- | {
19
- type: 'div';
20
- parameters: RegularParameters;
21
- children: TemplateChild[];
22
- }
23
- | {
24
- type: 'image';
25
- parameters: {
26
- src: TemplateAttribute;
27
- alt: TemplateAttribute;
28
- } & RegularParameters;
29
- }
30
- | {
31
- type: 'link';
32
- parameters: {
33
- href: TemplateAttribute;
34
- } & RegularParameters;
35
- children: TemplateChild[];
36
- };
37
-
38
- export type TemplateWidgetTypes =
39
- | 'ais.hits'
40
- | 'ais.infiniteHits'
41
- | 'ais.frequentlyBoughtTogether'
42
- | 'ais.lookingSimilar'
43
- | 'ais.relatedProducts'
44
- | 'ais.trendingItems';
45
-
46
- export type TemplateWidget<
47
- TKeys extends TemplateWidgetTypes = TemplateWidgetTypes
48
- > = {
49
- [key in TKeys]: {
50
- type: key;
51
- parameters: Omit<
52
- Parameters<typeof widgets[key]>[0],
53
- 'container' | 'templates'
54
- >;
55
- children: TemplateChild[];
56
- };
57
- }[TKeys];
58
-
59
- export type PanelWidgetTypes =
60
- | 'ais.refinementList'
61
- | 'ais.menu'
62
- | 'ais.hierarchicalMenu'
63
- | 'ais.breadcrumb'
64
- | 'ais.numericMenu'
65
- | 'ais.rangeInput'
66
- | 'ais.rangeSlider'
67
- | 'ais.ratingMenu'
68
- | 'ais.toggleRefinement';
69
- export type PanelWidget<TKeys extends PanelWidgetTypes = PanelWidgetTypes> = {
70
- [key in TKeys]: {
71
- type: key;
72
- parameters: Omit<Parameters<typeof widgets[key]>[0], 'container'> & {
73
- header?: string;
74
- collapsed?: boolean;
75
- };
76
- };
77
- }[TKeys];
78
-
79
- type RegularWidget<TKeys extends keyof typeof widgets = keyof typeof widgets> =
80
- {
81
- [key in TKeys]: {
82
- type: key;
83
- parameters: Omit<Parameters<typeof widgets[key]>[0], 'container'>;
84
- };
85
- }[TKeys];
86
-
87
- export type Child =
88
- | {
89
- [key in keyof typeof widgets]: key extends TemplateWidgetTypes
90
- ? TemplateWidget<key>
91
- : key extends PanelWidgetTypes
92
- ? PanelWidget<key>
93
- : RegularWidget<key>;
94
- }[keyof typeof widgets]
95
- | {
96
- type: 'columns';
97
- children: Child[][];
98
- };
99
-
100
- export type Configuration = {
101
- id: string;
102
- indexName: string;
103
- children: Child[];
104
- };
package/src/util.ts DELETED
@@ -1,9 +0,0 @@
1
- // @TODO: hook up to some way it can be set runtime, maybe query params
2
- const VERBOSE = true;
3
-
4
- export function error(message: string) {
5
- if (VERBOSE) {
6
- // eslint-disable-next-line no-console
7
- console.error(`[InstantSearch] ${message}`);
8
- }
9
- }
package/src/widgets.ts DELETED
@@ -1,51 +0,0 @@
1
- import {
2
- breadcrumb,
3
- clearRefinements,
4
- configure,
5
- currentRefinements,
6
- frequentlyBoughtTogether,
7
- hierarchicalMenu,
8
- hits,
9
- hitsPerPage,
10
- infiniteHits,
11
- lookingSimilar,
12
- menu,
13
- numericMenu,
14
- pagination,
15
- rangeInput,
16
- rangeSlider,
17
- ratingMenu,
18
- refinementList,
19
- relatedProducts,
20
- searchBox,
21
- sortBy,
22
- stats,
23
- toggleRefinement,
24
- trendingItems,
25
- } from 'instantsearch.js/es/widgets';
26
-
27
- export const widgets = {
28
- 'ais.breadcrumb': breadcrumb,
29
- 'ais.clearRefinements': clearRefinements,
30
- 'ais.configure': configure,
31
- 'ais.currentRefinements': currentRefinements,
32
- 'ais.frequentlyBoughtTogether': frequentlyBoughtTogether,
33
- 'ais.hierarchicalMenu': hierarchicalMenu,
34
- 'ais.hits': hits,
35
- 'ais.hitsPerPage': hitsPerPage,
36
- 'ais.infiniteHits': infiniteHits,
37
- 'ais.lookingSimilar': lookingSimilar,
38
- 'ais.menu': menu,
39
- 'ais.numericMenu': numericMenu,
40
- 'ais.pagination': pagination,
41
- 'ais.rangeInput': rangeInput,
42
- 'ais.rangeSlider': rangeSlider,
43
- 'ais.ratingMenu': ratingMenu,
44
- 'ais.refinementList': refinementList,
45
- 'ais.relatedProducts': relatedProducts,
46
- 'ais.searchBox': searchBox,
47
- 'ais.sortBy': sortBy,
48
- 'ais.stats': stats,
49
- 'ais.toggleRefinement': toggleRefinement,
50
- 'ais.trendingItems': trendingItems,
51
- };