@ecomid/modules 0.0.0-stage → 0.1.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.
@@ -0,0 +1,113 @@
1
+ import { ReactNode } from "react";
2
+ type SearchEnvironment = 'production' | 'staging' | 'sandbox';
3
+ type SearchProduct = {
4
+ id: string;
5
+ name: string;
6
+ url?: string;
7
+ imageUrl?: string;
8
+ imageTags?: string[];
9
+ hoverImageUrl?: string;
10
+ hoverImageTags?: string[];
11
+ price?: number;
12
+ baselinePrice?: number;
13
+ currency?: string;
14
+ variantCount?: number;
15
+ reason?: string;
16
+ };
17
+ type RenderProductContext = {
18
+ position: number;
19
+ menuButton: ReactNode;
20
+ };
21
+ type SearchSuggestion = {
22
+ text: string;
23
+ ask?: boolean;
24
+ };
25
+ type InstantResults = {
26
+ suggestions: SearchSuggestion[];
27
+ products: SearchProduct[];
28
+ };
29
+ type SearchStarter = {
30
+ text: string;
31
+ };
32
+ type EmptyState = {
33
+ starters: SearchStarter[];
34
+ recommendedProducts: SearchProduct[];
35
+ };
36
+ type SearchPageLocation = 'landing' | 'pdp' | 'plp';
37
+ type SearchResultsSection = {
38
+ title?: string;
39
+ products: SearchProduct[];
40
+ };
41
+ type SearchSort = 'relevance' | 'best_selling' | 'newest' | 'cheapest' | 'most_expensive' | 'biggest_discount';
42
+ type SearchMode = 'search' | 'discovery' | 'conversational';
43
+ type SearchQuestion = {
44
+ text: string;
45
+ answers: string[];
46
+ };
47
+ type SearchFilterKey = 'category' | 'gender' | 'size' | 'color' | 'material';
48
+ type SearchFilters = {
49
+ category?: string[];
50
+ gender?: string[];
51
+ size?: string[];
52
+ color?: string[];
53
+ material?: string[];
54
+ priceMin?: number;
55
+ priceMax?: number;
56
+ onSale?: boolean;
57
+ };
58
+ type SearchFacetValue = {
59
+ value: string;
60
+ label: string;
61
+ available: boolean;
62
+ };
63
+ type SearchFacet = {
64
+ key: string;
65
+ values: SearchFacetValue[];
66
+ };
67
+ type SearchAppliedFilter = {
68
+ key: string;
69
+ values: string[];
70
+ labels: string[];
71
+ exclude?: boolean;
72
+ };
73
+ type SearchStateFilter = {
74
+ key: string;
75
+ values: string[];
76
+ labels?: string[];
77
+ exclude?: boolean;
78
+ };
79
+ type SearchTurnState = {
80
+ terms: string[];
81
+ excludedTerms: string[];
82
+ filters: SearchStateFilter[];
83
+ sort: SearchSort;
84
+ };
85
+ type SearchResultsData = {
86
+ query: string;
87
+ lang: string;
88
+ market: string;
89
+ limit?: number;
90
+ page?: string;
91
+ products: SearchProduct[];
92
+ total?: number;
93
+ nextPageToken?: string;
94
+ appliedFilters?: SearchAppliedFilter[];
95
+ facets?: SearchFacet[];
96
+ title?: string;
97
+ description?: string;
98
+ sections?: SearchResultsSection[];
99
+ state?: SearchTurnState;
100
+ };
101
+ type SearchPage = {
102
+ kind: 'search';
103
+ state: SearchTurnState;
104
+ } | {
105
+ kind: 'compose';
106
+ text: string;
107
+ };
108
+ type SearchPageParams = URLSearchParams | string;
109
+ declare const SEARCH_PAGE_KEYS: string[];
110
+ declare function searchPageParams(page: SearchPage): URLSearchParams;
111
+ declare function readSearchPage(params: SearchPageParams): SearchPage | null;
112
+ declare function withSearchPageParams(search: string, page: SearchPage | null): string;
113
+ export { SearchTurnState as C, SearchSuggestion as S, SearchProduct as _, searchPageParams as a, SearchSort as b, InstantResults as c, SearchFacet as d, SearchFacetValue as f, SearchPageLocation as g, SearchMode as h, readSearchPage as i, RenderProductContext as l, SearchFilters as m, SearchPage as n, withSearchPageParams as o, SearchFilterKey as p, SearchPageParams as r, EmptyState as s, SEARCH_PAGE_KEYS as t, SearchAppliedFilter as u, SearchQuestion as v, SearchEnvironment as w, SearchStarter as x, SearchResultsData as y };
@@ -0,0 +1,97 @@
1
+ // src/translations/search/widget/sk.json
2
+ var e = "Čo hľadáte?", t = "Hľadať", n = "Prispôsobiť", r = "Návrhy", i = "Opýtajte sa na “{query}”", a = "Produkty", o = "Nenašli sa žiadne výsledky", s = "Niečo sa pokazilo. Skúste to prosím znova.", c = {
3
+ sale: "Akciová cena {price}",
4
+ original: "Pôvodná cena {price}"
5
+ }, l = {
6
+ title_singular: "{count} výsledok pre \"{query}\"",
7
+ title_plural: "Výsledky pre \"{query}\": {count}"
8
+ }, u = {
9
+ singular: "{count} produkt",
10
+ plural: "Produkty: {count}"
11
+ }, d = {
12
+ singular: "+ {count} farba",
13
+ plural: "Ďalšie farby: +{count}"
14
+ }, f = {
15
+ more_like_this: "Podobné",
16
+ similar_to: "Podobné ako {name}",
17
+ open: "Podobné: {name}"
18
+ }, p = {
19
+ title: "Filtre",
20
+ all: "Všetky filtre",
21
+ more_count: "Ďalšie filtre: {count}",
22
+ clear_all: "Vymazať všetko",
23
+ show_products: {
24
+ singular: "Zobraziť {count} produkt",
25
+ plural: "Zobraziť produkty: {count}"
26
+ },
27
+ min: "Min",
28
+ max: "Max",
29
+ price_under: "Do {price}",
30
+ any_price: "Akákoľvek cena",
31
+ on_sale: "V zľave",
32
+ remove: "Odstrániť: {filter}",
33
+ remove_exclusion: "Odstrániť vylúčenie: {filter}",
34
+ groups: {
35
+ category: "Kategória",
36
+ gender: "Pohlavie",
37
+ size: "Veľkosť",
38
+ color: "Farba",
39
+ price: "Cena",
40
+ material: "Materiál"
41
+ }
42
+ }, m = {
43
+ label: "Zoradiť",
44
+ selected: "Zoradiť: {option}",
45
+ options: {
46
+ relevance: "Odporúčané",
47
+ newest: "Najnovšie",
48
+ cheapest: "Cena od najnižšej",
49
+ most_expensive: "Cena od najvyššej"
50
+ }
51
+ }, h = {
52
+ placeholder: "Opýtajte sa na niečo iné",
53
+ send: "Odoslať"
54
+ }, g = {
55
+ search: "Hľadať",
56
+ for_you: "Pre vás",
57
+ new_search: "Nové vyhľadávanie",
58
+ back_to_top: "Späť hore"
59
+ }, _ = "Už čoskoro", v = {
60
+ title: "Žiadny produkt pre “{query}”",
61
+ hint: "Skúste iné slová alebo opíšte, čo potrebujete",
62
+ filtered_title: "Nenašli sa žiadne produkty",
63
+ filtered_hint: "Skúste odstrániť filter",
64
+ popular: "Obľúbené produkty"
65
+ }, y = { describe_placeholder: "Opíšte alebo sa opýtajte" }, b = {
66
+ title: "Predchádzajúce kroky",
67
+ now: "Teraz"
68
+ }, x = {
69
+ close: "Zavrieť",
70
+ submit: "Zobraziť výsledky",
71
+ previous: "Predošlý snímok",
72
+ next: "Nasledujúci snímok"
73
+ }, S = {
74
+ placeholder: e,
75
+ dialog_label: t,
76
+ personalize: n,
77
+ suggestions: r,
78
+ ask_suggestion: i,
79
+ products: a,
80
+ no_results: o,
81
+ results_error: s,
82
+ price: c,
83
+ results_status: l,
84
+ results_count: u,
85
+ more_colors: d,
86
+ card_menu: f,
87
+ filters: p,
88
+ sort: m,
89
+ compose: h,
90
+ shell: g,
91
+ coming_soon: _,
92
+ empty: v,
93
+ bar: y,
94
+ history: b,
95
+ actions: x
96
+ };
97
+ export { x as actions, i as ask_suggestion, y as bar, f as card_menu, _ as coming_soon, h as compose, S as default, t as dialog_label, v as empty, p as filters, b as history, d as more_colors, o as no_results, n as personalize, e as placeholder, c as price, a as products, u as results_count, s as results_error, l as results_status, g as shell, m as sort, r as suggestions };
@@ -0,0 +1,97 @@
1
+ // src/translations/search/widget/sv.json
2
+ var e = "Vad letar du efter?", t = "Sök", n = "Personalisera", r = "Förslag", i = "Fråga “{query}”", a = "Produkter", o = "Inga resultat hittades", s = "Något gick fel. Försök igen.", c = {
3
+ sale: "Rabatterat pris {price}",
4
+ original: "Ordinarie pris {price}"
5
+ }, l = {
6
+ title_singular: "{count} resultat för \"{query}\"",
7
+ title_plural: "{count} resultat för \"{query}\""
8
+ }, u = {
9
+ singular: "{count} produkt",
10
+ plural: "{count} produkter"
11
+ }, d = {
12
+ singular: "+ {count} färg",
13
+ plural: "+ {count} färger"
14
+ }, f = {
15
+ more_like_this: "Mer som detta",
16
+ similar_to: "Liknande {name}",
17
+ open: "Mer som detta: {name}"
18
+ }, p = {
19
+ title: "Filter",
20
+ all: "Alla filter",
21
+ more_count: "Fler filter: {count}",
22
+ clear_all: "Rensa alla",
23
+ show_products: {
24
+ singular: "Visa {count} produkt",
25
+ plural: "Visa {count} produkter"
26
+ },
27
+ min: "Min",
28
+ max: "Max",
29
+ price_under: "Under {price}",
30
+ any_price: "Alla priser",
31
+ on_sale: "Rea",
32
+ remove: "Ta bort {filter}",
33
+ remove_exclusion: "Ta bort uteslutning av {filter}",
34
+ groups: {
35
+ category: "Kategori",
36
+ gender: "Kön",
37
+ size: "Storlek",
38
+ color: "Färg",
39
+ price: "Pris",
40
+ material: "Material"
41
+ }
42
+ }, m = {
43
+ label: "Sortera",
44
+ selected: "Sortera: {option}",
45
+ options: {
46
+ relevance: "Rekommenderat",
47
+ newest: "Nyast",
48
+ cheapest: "Lägsta pris först",
49
+ most_expensive: "Högsta pris först"
50
+ }
51
+ }, h = {
52
+ placeholder: "Fråga något annat",
53
+ send: "Skicka"
54
+ }, g = {
55
+ search: "Sök",
56
+ for_you: "För dig",
57
+ new_search: "Ny sökning",
58
+ back_to_top: "Till toppen"
59
+ }, _ = "Kommer snart", v = {
60
+ title: "Ingen produkt för “{query}”",
61
+ hint: "Prova andra ord eller beskriv vad du behöver",
62
+ filtered_title: "Inga produkter hittades",
63
+ filtered_hint: "Prova att ta bort ett filter",
64
+ popular: "Populära produkter"
65
+ }, y = { describe_placeholder: "Beskriv eller fråga" }, b = {
66
+ title: "Tidigare steg",
67
+ now: "Nu"
68
+ }, x = {
69
+ close: "Stäng",
70
+ submit: "Visa resultat",
71
+ previous: "Föregående bild",
72
+ next: "Nästa bild"
73
+ }, S = {
74
+ placeholder: e,
75
+ dialog_label: t,
76
+ personalize: n,
77
+ suggestions: r,
78
+ ask_suggestion: i,
79
+ products: a,
80
+ no_results: o,
81
+ results_error: s,
82
+ price: c,
83
+ results_status: l,
84
+ results_count: u,
85
+ more_colors: d,
86
+ card_menu: f,
87
+ filters: p,
88
+ sort: m,
89
+ compose: h,
90
+ shell: g,
91
+ coming_soon: _,
92
+ empty: v,
93
+ bar: y,
94
+ history: b,
95
+ actions: x
96
+ };
97
+ export { x as actions, i as ask_suggestion, y as bar, f as card_menu, _ as coming_soon, h as compose, S as default, t as dialog_label, v as empty, p as filters, b as history, d as more_colors, o as no_results, n as personalize, e as placeholder, c as price, a as products, u as results_count, s as results_error, l as results_status, g as shell, m as sort, r as suggestions };
@@ -0,0 +1,51 @@
1
+ import { _ as SearchProduct, b as SearchSort, l as RenderProductContext, m as SearchFilters, r as SearchPageParams, w as SearchEnvironment, y as SearchResultsData } from "./chunks/searchPage-BDL83WXl.js";
2
+ import { MouseEvent, ReactNode } from "react";
3
+ type RenderProduct = (product: SearchProduct, context: RenderProductContext) => ReactNode;
4
+ type SearchRootProps = {
5
+ clientId: string;
6
+ lang: string;
7
+ market: string;
8
+ open: boolean;
9
+ onClose: () => void;
10
+ onSubmit?: (query: string) => void;
11
+ resultsUrl?: string;
12
+ onProductClick?: (product: SearchProduct, event: MouseEvent<HTMLElement>) => void;
13
+ renderProduct?: RenderProduct;
14
+ onOpen?: () => void;
15
+ baseUrl?: string;
16
+ };
17
+ type SearchModalProps = Omit<SearchRootProps, 'baseUrl' | 'clientId' | 'lang' | 'market'> & {
18
+ clientId?: string;
19
+ locale?: string;
20
+ environment?: SearchEnvironment;
21
+ };
22
+ export declare function SearchModal({ clientId, locale, environment, ...props }: SearchModalProps): import("react").JSX.Element;
23
+ type HeadingLevel = 1 | 2 | 3 | 4 | 5;
24
+ type SearchResultsProps$1 = {
25
+ clientId: string;
26
+ lang: string;
27
+ market: string;
28
+ query?: string;
29
+ page?: SearchPageParams | null;
30
+ onPageChange?: (params: URLSearchParams) => void;
31
+ initialResults?: SearchResultsData | null;
32
+ limit?: number;
33
+ headingLevel?: HeadingLevel;
34
+ onProductClick?: (product: SearchProduct, event: MouseEvent<HTMLElement>) => void;
35
+ renderProduct?: RenderProduct;
36
+ baseUrl?: string;
37
+ };
38
+ type SearchResultsProps = Omit<SearchResultsProps$1, 'baseUrl' | 'clientId' | 'lang' | 'market'> & {
39
+ clientId?: string;
40
+ locale?: string;
41
+ environment?: SearchEnvironment;
42
+ };
43
+ export declare function SearchResults({ clientId, locale, environment, ...props }: SearchResultsProps): import("react").JSX.Element;
44
+ type EcomidProviderProps = {
45
+ clientId: string;
46
+ locale: string;
47
+ environment?: SearchEnvironment;
48
+ children?: ReactNode;
49
+ };
50
+ export declare function EcomidProvider({ clientId, locale, environment, children }: EcomidProviderProps): import("react").JSX.Element;
51
+ export type { SearchEnvironment as EcomidEnvironment, SearchEnvironment, EcomidProviderProps, RenderProductContext, SearchFilters, SearchModalProps, SearchProduct, SearchResultsData, SearchResultsProps, SearchSort };