@coras-io/embed 0.9.0 → 0.10.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 (45) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/components/locations-results/locations-results.component.d.ts +2 -0
  3. package/dist/components/locations-results/locations-results.component.js +11 -0
  4. package/dist/core/events.d.ts +1 -0
  5. package/dist/core/types/api-schema.d.ts +2 -0
  6. package/dist/locales/ar-SA.d.ts +1 -0
  7. package/dist/locales/ar-SA.js +1 -0
  8. package/dist/locales/da-DK.d.ts +1 -0
  9. package/dist/locales/da-DK.js +1 -0
  10. package/dist/locales/de-DE.d.ts +1 -0
  11. package/dist/locales/de-DE.js +1 -0
  12. package/dist/locales/en-IE.d.ts +1 -0
  13. package/dist/locales/en-IE.js +1 -0
  14. package/dist/locales/en-US.d.ts +1 -0
  15. package/dist/locales/en-US.js +1 -0
  16. package/dist/locales/es-ES.d.ts +1 -0
  17. package/dist/locales/es-ES.js +1 -0
  18. package/dist/locales/fr-FR.d.ts +1 -0
  19. package/dist/locales/fr-FR.js +1 -0
  20. package/dist/locales/fr-MA.d.ts +1 -0
  21. package/dist/locales/fr-MA.js +1 -0
  22. package/dist/locales/is-IS.d.ts +1 -0
  23. package/dist/locales/is-IS.js +1 -0
  24. package/dist/locales/it-IT.d.ts +1 -0
  25. package/dist/locales/it-IT.js +1 -0
  26. package/dist/locales/ms-MY.d.ts +1 -0
  27. package/dist/locales/ms-MY.js +1 -0
  28. package/dist/locales/nb-NO.d.ts +1 -0
  29. package/dist/locales/nb-NO.js +1 -0
  30. package/dist/locales/pl-PL.d.ts +1 -0
  31. package/dist/locales/pl-PL.js +1 -0
  32. package/dist/locales/pt-PT.d.ts +1 -0
  33. package/dist/locales/pt-PT.js +1 -0
  34. package/dist/locales/sv-SE.d.ts +1 -0
  35. package/dist/locales/sv-SE.js +1 -0
  36. package/dist/locales/th-TH.d.ts +1 -0
  37. package/dist/locales/th-TH.js +1 -0
  38. package/dist/locales/tr-TR.d.ts +1 -0
  39. package/dist/locales/tr-TR.js +1 -0
  40. package/dist/locales/zh-CN.d.ts +1 -0
  41. package/dist/locales/zh-CN.js +1 -0
  42. package/dist/locales/zh-HK.d.ts +1 -0
  43. package/dist/locales/zh-HK.js +1 -0
  44. package/dist/mixins/location-search/location-search.js +74 -3
  45. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @coras-io/embed
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 2f0d761: Open the location search on a country or city page with that country and its top cities, and add an "All locations" option next to "Near me"
8
+
3
9
  ## 0.9.0
4
10
 
5
11
  ### Minor Changes
@@ -9,6 +9,7 @@ export interface GeolocationFailedEventDetail {
9
9
  code: number;
10
10
  }
11
11
  /**
12
+ * @fires all-locations-selected - When "All locations" is chosen
12
13
  * @fires geolocation-selected - The device position when "Near me" succeeds
13
14
  * @fires geolocation-failed - Detail `{ code }` when the position is denied or unavailable
14
15
  */
@@ -18,6 +19,7 @@ export declare class CorasLocationsResults extends LitElement {
18
19
  items: components["schemas"]["LocationSchema"][];
19
20
  private near;
20
21
  private reportGeolocationFailure;
22
+ private selectAllLocations;
21
23
  private renderPopular;
22
24
  render(): TemplateResult<1>;
23
25
  }
@@ -15,6 +15,7 @@ import "../select-list/select-option/select-option.js";
15
15
  /** Browsers without the Geolocation API get a code outside the spec's 1-3. */
16
16
  export const GEOLOCATION_UNSUPPORTED_CODE = 0;
17
17
  /**
18
+ * @fires all-locations-selected - When "All locations" is chosen
18
19
  * @fires geolocation-selected - The device position when "Near me" succeeds
19
20
  * @fires geolocation-failed - Detail `{ code }` when the position is denied or unavailable
20
21
  */
@@ -41,6 +42,9 @@ let CorasLocationsResults = class CorasLocationsResults extends LitElement {
41
42
  reportGeolocationFailure(code) {
42
43
  fireInternalEvent(this, "geolocation-failed", { code });
43
44
  }
45
+ selectAllLocations() {
46
+ fireInternalEvent(this, "all-locations-selected", {});
47
+ }
44
48
  renderPopular() {
45
49
  return html `
46
50
  <div class="popular">
@@ -49,6 +53,13 @@ let CorasLocationsResults = class CorasLocationsResults extends LitElement {
49
53
  <button type="button" class="near-me" @click=${this.near}>
50
54
  ${msg("Near me")}
51
55
  </button>
56
+ <button
57
+ type="button"
58
+ class="near-me"
59
+ @click=${this.selectAllLocations}
60
+ >
61
+ ${msg("All locations")}
62
+ </button>
52
63
  </div>
53
64
  </div>
54
65
  `;
@@ -119,6 +119,7 @@ export interface InternalEventMap {
119
119
  "seats-confirmed": SeatsConfirmedEventDetail;
120
120
  "geolocation-selected": GeolocationSelectedEventDetail;
121
121
  "geolocation-failed": GeolocationFailedEventDetail;
122
+ "all-locations-selected": Record<string, never>;
122
123
  "tab-changed": TabChangeEventDetail;
123
124
  "chip-removed": Record<string, never>;
124
125
  "coras-image-load": Record<string, never>;
@@ -7386,6 +7386,8 @@ export interface operations {
7386
7386
  latitude?: number | null;
7387
7387
  /** @description Longitude for location search (optional) */
7388
7388
  longitude?: number | null;
7389
+ /** @description Country slug. Returns that country followed by its cities with the most attractions. Cannot be combined with query or coordinates. */
7390
+ country?: string | null;
7389
7391
  };
7390
7392
  header: {
7391
7393
  /** @description Content type of the request body */
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `البحث عن الفعاليات`,
259
259
  'sffdadf0a576fd802': `ارتفاع`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Søg efter begivenheder`,
259
259
  'sffdadf0a576fd802': `Højde`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Ereignisse suchen`,
259
259
  'sffdadf0a576fd802': `Höhe`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Search events`,
259
259
  'sffdadf0a576fd802': `Height`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Search events`,
259
259
  'sffdadf0a576fd802': `Height`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Buscar eventos`,
259
259
  'sffdadf0a576fd802': `Altura`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Rechercher des événements`,
259
259
  'sffdadf0a576fd802': `Hauteur`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Rechercher des événements`,
259
259
  'sffdadf0a576fd802': `Hauteur`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Leita að viðburðum`,
259
259
  'sffdadf0a576fd802': `Hæð`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Cerca eventi`,
259
259
  'sffdadf0a576fd802': `Altezza`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Cari acara`,
259
259
  'sffdadf0a576fd802': `Ketinggian`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Søk etter hendelser`,
259
259
  'sffdadf0a576fd802': `Høyde`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Wyszukaj wydarzenia`,
259
259
  'sffdadf0a576fd802': `Wysokość`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Pesquisar eventos`,
259
259
  'sffdadf0a576fd802': `Altura`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Sök händelser`,
259
259
  'sffdadf0a576fd802': `Höjd`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `ค้นหาเหตุการณ์`,
259
259
  'sffdadf0a576fd802': `ความสูง`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `Olayları ara`,
259
259
  'sffdadf0a576fd802': `Yükseklik`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `搜索事件`,
259
259
  'sffdadf0a576fd802': `高度`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -252,6 +252,7 @@ export declare const templates: {
252
252
  sfd25dcb1e3a468be: string;
253
253
  sffdadf0a576fd802: string;
254
254
  s8ffdc67bd6500a2f: string;
255
+ sfe5857d2790cdd68: string;
255
256
  s43d13a9f9be37bd6: import("@lit/localize").StrResult;
256
257
  sb4f1dffbb6be6302: string;
257
258
  scd0ddab5a7a0f930: string;
@@ -258,6 +258,7 @@ export const templates = {
258
258
  'sfd25dcb1e3a468be': `搜尋事件`,
259
259
  'sffdadf0a576fd802': `高度`,
260
260
  's8ffdc67bd6500a2f': `Near me`,
261
+ 'sfe5857d2790cdd68': `All locations`,
261
262
  's43d13a9f9be37bd6': str `All ${0} locations`,
262
263
  'sb4f1dffbb6be6302': `Clear`,
263
264
  'scd0ddab5a7a0f930': `Drawer`,
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { html, } from "lit";
7
+ import { html, nothing, } from "lit";
8
8
  import { property, state } from "lit/decorators.js";
9
9
  import { classMap } from "lit/directives/class-map.js";
10
10
  import { ifDefined } from "lit/directives/if-defined.js";
@@ -21,6 +21,7 @@ import { APIError } from "../../core/api/api-error.js";
21
21
  import { getApiLanguageCode } from "../../core/utils/locale.js";
22
22
  import { getRecentlySelectedSearches } from "../../containers/navbar/navbar.utils.js";
23
23
  const RECENT_LOCATIONS_LIMIT = 5;
24
+ const SEARCH_RESULTS_LIMIT = 11;
24
25
  function findSingleLocationMatch(results) {
25
26
  const [first, ...rest] = results ?? [];
26
27
  if (rest.length === 0) {
@@ -47,6 +48,7 @@ export const LocationSearchMixin = (superClass) => {
47
48
  this.cachedPopularLocations = null;
48
49
  this.selectedLocation = null;
49
50
  this.locationsData = null;
51
+ this.countryLocationsCache = new Map();
50
52
  this.handleFieldFocus = () => {
51
53
  this.isFieldFocused = true;
52
54
  };
@@ -73,6 +75,7 @@ export const LocationSearchMixin = (superClass) => {
73
75
  };
74
76
  if (query) {
75
77
  searchParams.query = query;
78
+ searchParams.size = SEARCH_RESULTS_LIMIT;
76
79
  }
77
80
  else if (latitude != null && longitude != null) {
78
81
  searchParams.latitude = Number(latitude);
@@ -98,6 +101,44 @@ export const LocationSearchMixin = (superClass) => {
98
101
  this.isLocationsDropdownOpen,
99
102
  ],
100
103
  });
104
+ this.countryLocationsTask = new Task(this, {
105
+ task: async ([locale, countrySlug, isDropdownOpen]) => {
106
+ if (!isDropdownOpen || !countrySlug) {
107
+ return [];
108
+ }
109
+ const cacheKey = `${locale}:${countrySlug}`;
110
+ const cached = this.countryLocationsCache.get(cacheKey);
111
+ if (cached) {
112
+ return cached;
113
+ }
114
+ try {
115
+ const { data } = await apiGet({
116
+ client: this.client,
117
+ distributorID: this.distributorID,
118
+ locale,
119
+ endpoint: "/{api_version}/locations/search",
120
+ query: {
121
+ language_code: getApiLanguageCode(locale),
122
+ country: countrySlug,
123
+ },
124
+ });
125
+ const countryLocations = data?.results ?? [];
126
+ this.countryLocationsCache.set(cacheKey, countryLocations);
127
+ return countryLocations;
128
+ }
129
+ catch (error) {
130
+ if (error instanceof APIError) {
131
+ return [];
132
+ }
133
+ throw error;
134
+ }
135
+ },
136
+ args: () => [
137
+ this.locale,
138
+ this.pageCountrySlug,
139
+ this.isLocationsDropdownOpen,
140
+ ],
141
+ });
101
142
  this.throttledLocationSearch = debounce({ delay: 200 }, (event) => this.handleLocationSearch(event));
102
143
  this.handleLocationSearch = (event) => {
103
144
  this.locationSearchTerm = event.detail.value;
@@ -129,6 +170,13 @@ export const LocationSearchMixin = (superClass) => {
129
170
  });
130
171
  this.isLocationsDropdownOpen = false;
131
172
  };
173
+ this.handleAllLocationsSelected = () => {
174
+ this.selectedLocation = null;
175
+ this.locationSearchTerm = "";
176
+ this.locationNamePlaceholder = "";
177
+ this.dispatchPageUpdate({ city: "", country: "" });
178
+ this.isLocationsDropdownOpen = false;
179
+ };
132
180
  this.handleRecentLocationSelected = (item) => {
133
181
  this.selectedLocation = null;
134
182
  this.locationSearchTerm = "";
@@ -155,6 +203,18 @@ export const LocationSearchMixin = (superClass) => {
155
203
  };
156
204
  }
157
205
  static { this.styles = styles; }
206
+ get pageCountrySlug() {
207
+ if (this.country) {
208
+ return this.country;
209
+ }
210
+ if (!this.city) {
211
+ return "";
212
+ }
213
+ const cityCountry = (this.locationsData ?? [])
214
+ .flatMap((continent) => continent.countries ?? [])
215
+ .find((country) => country?.cities?.some((city) => city?.slug === this.city));
216
+ return cityCountry?.slug ?? "";
217
+ }
158
218
  toggleLocationsDropdown() {
159
219
  if (!this.isLocationsDropdownOpen) {
160
220
  this.isLocationsDropdownOpen = true;
@@ -206,11 +266,21 @@ export const LocationSearchMixin = (superClass) => {
206
266
  if ((response.results?.length ?? 0) > 0) {
207
267
  return this.renderLocationOptions(response.results);
208
268
  }
269
+ const countryLocations = this.countryLocationsTask.value ?? [];
270
+ const isListedAbove = (item) => (item.type === "city" && item.value === this.city) ||
271
+ countryLocations.some((location) => location.location_type === item.type &&
272
+ location.slug === item.value);
209
273
  const recentLocations = getRecentlySelectedSearches()
210
274
  .filter((item) => item.type === "city" || item.type === "country")
275
+ .filter((item) => !isListedAbove(item))
211
276
  .slice(0, RECENT_LOCATIONS_LIMIT);
212
- if (recentLocations.length > 0) {
213
- return this.renderRecentLocations(recentLocations);
277
+ if (countryLocations.length > 0 || recentLocations.length > 0) {
278
+ return html `
279
+ ${this.renderLocationOptions(countryLocations)}
280
+ ${recentLocations.length > 0
281
+ ? this.renderRecentLocations(recentLocations)
282
+ : nothing}
283
+ `;
214
284
  }
215
285
  const popular = response.popular ?? [];
216
286
  if (popular.length === 0) {
@@ -332,6 +402,7 @@ export const LocationSearchMixin = (superClass) => {
332
402
  ></coras-icon>
333
403
  </coras-field>
334
404
  <coras-locations-results
405
+ @all-locations-selected=${this.handleAllLocationsSelected}
335
406
  @geolocation-selected=${this.handleGeolocationSelected}
336
407
  @geolocation-failed=${this.handleGeolocationFailed}
337
408
  >
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "engines": {
21
21
  "node": ">=22"
22
22
  },
23
- "version": "0.9.0",
23
+ "version": "0.10.0",
24
24
  "private": false,
25
25
  "homepage": "https://docs.coras.io",
26
26
  "bugs": {