@inploi/plugin-job-search 1.2.2 → 2.0.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.
@@ -58,6 +58,12 @@ declare const getJobSearchResponseSchema: (t: import('@inploi/i18n/translation')
58
58
  readonly map_jobs_error: "We’re having trouble loading jobs in the area";
59
59
  readonly map_has_more_title: "Not showing all the jobs in this area";
60
60
  readonly map_has_more_description: "Zoom in to refine your search further";
61
+ readonly map_jobs_showing: {
62
+ readonly one: "Showing {{count}} job";
63
+ readonly other: "Showing {{count}} jobs";
64
+ };
65
+ readonly page: "Page";
66
+ readonly reset: "Reset";
61
67
  }>) => import('valibot').SchemaWithTransform<import('valibot').ObjectSchema<{
62
68
  data: import('valibot').ArraySchema<import('valibot').SchemaWithTransform<import('valibot').ObjectSchema<{
63
69
  id: import('valibot').NumberSchema<number>;
@@ -516,6 +522,12 @@ declare const getJobSearchMapSchema: (t: import('@inploi/i18n/translation').TFn<
516
522
  readonly map_jobs_error: "We’re having trouble loading jobs in the area";
517
523
  readonly map_has_more_title: "Not showing all the jobs in this area";
518
524
  readonly map_has_more_description: "Zoom in to refine your search further";
525
+ readonly map_jobs_showing: {
526
+ readonly one: "Showing {{count}} job";
527
+ readonly other: "Showing {{count}} jobs";
528
+ };
529
+ readonly page: "Page";
530
+ readonly reset: "Reset";
519
531
  }>) => import('valibot').SchemaWithTransform<import('valibot').ObjectSchema<{
520
532
  data: import('valibot').ArraySchema<import('valibot').SchemaWithTransform<import('valibot').ObjectSchema<{
521
533
  id: import('valibot').NumberSchema<number>;
@@ -3,9 +3,8 @@ import { JobAlertsPluginParams, jobAlertsPlugin } from '@inploi/plugin-job-alert
3
3
  import { Logger } from '@inploi/sdk';
4
4
  import { TargetedEvent } from 'preact/compat';
5
5
  import { getJobSearchResults } from './job-search.api.ts';
6
- import { FilterValue } from './components/filter.tsx';
7
- import { GeoSearchFilter } from './components/geo-search.tsx';
8
6
  import { IconName } from './components/icon.tsx';
7
+ import { JobSearchState } from './components/job-search.tsx';
9
8
  import { JobSearchTranslationTerms } from './lib/i18n.ts';
10
9
 
11
10
  type FontSettings = {
@@ -90,7 +89,7 @@ type ColorPaletteConfig = {
90
89
  /** Float between 0 and 2. Acts as a multiplier to the original generated palette. */
91
90
  chroma: number;
92
91
  };
93
- export type JobSearchPluginParams = {
92
+ export interface JobSearchPluginParams {
94
93
  /** Used to identify the specific widget you want to render, in case there are multiple instances of the widget on the page.*/
95
94
  widgetId?: string;
96
95
  theme: {
@@ -140,8 +139,7 @@ export type JobSearchPluginParams = {
140
139
  */
141
140
  openJob?: 'redirect' | 'redirect-new-tab';
142
141
  };
143
- defaultSearchKeyword?: string;
144
- defaultGeolocation?: GeoSearchFilter;
142
+ initialState: JobSearchState | ((params: Omit<JobSearchPluginParams, 'initialState'>) => JobSearchState);
145
143
  /** Enables searching for jobs by keyword */
146
144
  enableKeywordSearch?: boolean;
147
145
  /** Translation terms */
@@ -175,7 +173,7 @@ export type JobSearchPluginParams = {
175
173
  pinColor?: string;
176
174
  defaultCenter?: [number, number];
177
175
  };
178
- };
176
+ }
179
177
  export interface PrerenderJobSearchPluginParams extends JobSearchPluginParams {
180
178
  /** If true, the data needed to display the first page of results
181
179
  * will be fetched from the server. This is recommended if SEO is important
@@ -189,9 +187,7 @@ export interface RenderJobSearchPluginParams extends JobSearchPluginParams {
189
187
  initialData?: {
190
188
  jobs: Awaited<ReturnType<typeof getJobSearchResults>>;
191
189
  };
192
- onFilterChange: (params: Record<string, FilterValue | undefined>) => void;
193
- onKeywordChange: (keyword: string | undefined) => void;
194
- onGeolocationChange: (geo: GeoSearchFilter | undefined) => void;
190
+ onStateChange: (partialState: Partial<JobSearchState>) => void;
195
191
  }
196
192
  export declare const createJobSearchDomManager: (logger: Logger) => {
197
193
  getRenderTargetElement: (widgetId: string | undefined) => Element;
@@ -163,6 +163,12 @@ export declare const getJobSchema: (t: import('@inploi/i18n/translation').TFn<{
163
163
  readonly map_jobs_error: "We’re having trouble loading jobs in the area";
164
164
  readonly map_has_more_title: "Not showing all the jobs in this area";
165
165
  readonly map_has_more_description: "Zoom in to refine your search further";
166
+ readonly map_jobs_showing: {
167
+ readonly one: "Showing {{count}} job";
168
+ readonly other: "Showing {{count}} jobs";
169
+ };
170
+ readonly page: "Page";
171
+ readonly reset: "Reset";
166
172
  }>) => import('valibot').SchemaWithTransform<import('valibot').ObjectSchema<{
167
173
  id: import('valibot').NumberSchema<number>;
168
174
  company_name: import('valibot').StringSchema<string>;
@@ -52,6 +52,12 @@ export declare const TranslationProvider: (props: {
52
52
  readonly map_jobs_error: "We’re having trouble loading jobs in the area";
53
53
  readonly map_has_more_title: "Not showing all the jobs in this area";
54
54
  readonly map_has_more_description: "Zoom in to refine your search further";
55
+ readonly map_jobs_showing: {
56
+ readonly one: "Showing {{count}} job";
57
+ readonly other: "Showing {{count}} jobs";
58
+ };
59
+ readonly page: "Page";
60
+ readonly reset: "Reset";
55
61
  }>> | undefined;
56
62
  locale: string | undefined;
57
63
  children?: import('preact').ComponentChildren;
@@ -108,6 +114,12 @@ export declare const TranslationProvider: (props: {
108
114
  readonly map_jobs_error: "We’re having trouble loading jobs in the area";
109
115
  readonly map_has_more_title: "Not showing all the jobs in this area";
110
116
  readonly map_has_more_description: "Zoom in to refine your search further";
117
+ readonly map_jobs_showing: {
118
+ readonly one: "Showing {{count}} job";
119
+ readonly other: "Showing {{count}} jobs";
120
+ };
121
+ readonly page: "Page";
122
+ readonly reset: "Reset";
111
123
  } = {
112
124
  readonly type_to_search_jobs: "Type to search jobs";
113
125
  readonly type_to_search: "Type to search";
@@ -161,6 +173,12 @@ export declare const TranslationProvider: (props: {
161
173
  readonly map_jobs_error: "We’re having trouble loading jobs in the area";
162
174
  readonly map_has_more_title: "Not showing all the jobs in this area";
163
175
  readonly map_has_more_description: "Zoom in to refine your search further";
176
+ readonly map_jobs_showing: {
177
+ readonly one: "Showing {{count}} job";
178
+ readonly other: "Showing {{count}} jobs";
179
+ };
180
+ readonly page: "Page";
181
+ readonly reset: "Reset";
164
182
  }>() => {
165
183
  t: import('@inploi/i18n/translation').TFn<T>;
166
184
  locale: string | undefined;
@@ -217,6 +235,12 @@ export declare const TranslationProvider: (props: {
217
235
  readonly map_jobs_error: "We’re having trouble loading jobs in the area";
218
236
  readonly map_has_more_title: "Not showing all the jobs in this area";
219
237
  readonly map_has_more_description: "Zoom in to refine your search further";
238
+ readonly map_jobs_showing: {
239
+ readonly one: "Showing {{count}} job";
240
+ readonly other: "Showing {{count}} jobs";
241
+ };
242
+ readonly page: "Page";
243
+ readonly reset: "Reset";
220
244
  } = {
221
245
  readonly type_to_search_jobs: "Type to search jobs";
222
246
  readonly type_to_search: "Type to search";
@@ -270,6 +294,12 @@ export declare const TranslationProvider: (props: {
270
294
  readonly map_jobs_error: "We’re having trouble loading jobs in the area";
271
295
  readonly map_has_more_title: "Not showing all the jobs in this area";
272
296
  readonly map_has_more_description: "Zoom in to refine your search further";
297
+ readonly map_jobs_showing: {
298
+ readonly one: "Showing {{count}} job";
299
+ readonly other: "Showing {{count}} jobs";
300
+ };
301
+ readonly page: "Page";
302
+ readonly reset: "Reset";
273
303
  }>(options: {
274
304
  overrides: Partial<import('@inploi/i18n/translation').TranslationDict<{
275
305
  readonly type_to_search_jobs: "Type to search jobs";
@@ -324,6 +354,12 @@ export declare const TranslationProvider: (props: {
324
354
  readonly map_jobs_error: "We’re having trouble loading jobs in the area";
325
355
  readonly map_has_more_title: "Not showing all the jobs in this area";
326
356
  readonly map_has_more_description: "Zoom in to refine your search further";
357
+ readonly map_jobs_showing: {
358
+ readonly one: "Showing {{count}} job";
359
+ readonly other: "Showing {{count}} jobs";
360
+ };
361
+ readonly page: "Page";
362
+ readonly reset: "Reset";
327
363
  }>>;
328
364
  locale: string | undefined;
329
365
  }) => import('@inploi/i18n/translation').TFn<T>;
@@ -1,7 +1,16 @@
1
1
  import { GeoSearchFilter } from '../components/geo-search';
2
- import { FilterProperty } from '..';
2
+ import { JobSearchState } from '../components/job-search';
3
+ import { FilterProperty, JobSearchPluginParams } from '..';
3
4
 
4
5
  /** Reads from search params provided and adds to list of filters. */
5
6
  export declare const getStatefulPropertiesFromSearchParams: (properties: FilterProperty[], searchParams: URLSearchParams) => FilterProperty[];
6
- export declare const getGeolocationFromSearchParams: (searchParams: URLSearchParams) => GeoSearchFilter;
7
+ export declare const getModeFromSearchParams: (searchParams: URLSearchParams) => JobSearchState['mode'];
8
+ export declare const getViewFromSearchParams: (searchParams: URLSearchParams) => JobSearchState['view'];
9
+ /** Returns a function that can be used to get the initial state of the widget from the search params. */
10
+ export declare const getWidgetStateFromSearchParams: ({ searchParams }: {
11
+ searchParams: URLSearchParams;
12
+ }) => JobSearchPluginParams['initialState'];
13
+ /** Modifies the searchParams instance in place to reflect the current state of the widget. */
14
+ export declare const setWidgetStateToSearchParams: (partialState: Partial<JobSearchState>, searchParams: URLSearchParams) => void;
15
+ export declare const getGeolocationFromSearchParams: (searchParams: URLSearchParams) => GeoSearchFilter | undefined;
7
16
  export declare const useDebouncedValue: <T>(value: T, timeout?: number) => T;
@@ -0,0 +1 @@
1
+ export {};