@inploi/plugin-job-search 1.2.3 → 2.0.1

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.
@@ -62,6 +62,8 @@ declare const getJobSearchResponseSchema: (t: import('@inploi/i18n/translation')
62
62
  readonly one: "Showing {{count}} job";
63
63
  readonly other: "Showing {{count}} jobs";
64
64
  };
65
+ readonly page: "Page";
66
+ readonly reset: "Reset";
65
67
  }>) => import('valibot').SchemaWithTransform<import('valibot').ObjectSchema<{
66
68
  data: import('valibot').ArraySchema<import('valibot').SchemaWithTransform<import('valibot').ObjectSchema<{
67
69
  id: import('valibot').NumberSchema<number>;
@@ -524,6 +526,8 @@ declare const getJobSearchMapSchema: (t: import('@inploi/i18n/translation').TFn<
524
526
  readonly one: "Showing {{count}} job";
525
527
  readonly other: "Showing {{count}} jobs";
526
528
  };
529
+ readonly page: "Page";
530
+ readonly reset: "Reset";
527
531
  }>) => import('valibot').SchemaWithTransform<import('valibot').ObjectSchema<{
528
532
  data: import('valibot').ArraySchema<import('valibot').SchemaWithTransform<import('valibot').ObjectSchema<{
529
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;
@@ -167,6 +167,8 @@ export declare const getJobSchema: (t: import('@inploi/i18n/translation').TFn<{
167
167
  readonly one: "Showing {{count}} job";
168
168
  readonly other: "Showing {{count}} jobs";
169
169
  };
170
+ readonly page: "Page";
171
+ readonly reset: "Reset";
170
172
  }>) => import('valibot').SchemaWithTransform<import('valibot').ObjectSchema<{
171
173
  id: import('valibot').NumberSchema<number>;
172
174
  company_name: import('valibot').StringSchema<string>;
@@ -56,6 +56,8 @@ export declare const TranslationProvider: (props: {
56
56
  readonly one: "Showing {{count}} job";
57
57
  readonly other: "Showing {{count}} jobs";
58
58
  };
59
+ readonly page: "Page";
60
+ readonly reset: "Reset";
59
61
  }>> | undefined;
60
62
  locale: string | undefined;
61
63
  children?: import('preact').ComponentChildren;
@@ -116,6 +118,8 @@ export declare const TranslationProvider: (props: {
116
118
  readonly one: "Showing {{count}} job";
117
119
  readonly other: "Showing {{count}} jobs";
118
120
  };
121
+ readonly page: "Page";
122
+ readonly reset: "Reset";
119
123
  } = {
120
124
  readonly type_to_search_jobs: "Type to search jobs";
121
125
  readonly type_to_search: "Type to search";
@@ -173,6 +177,8 @@ export declare const TranslationProvider: (props: {
173
177
  readonly one: "Showing {{count}} job";
174
178
  readonly other: "Showing {{count}} jobs";
175
179
  };
180
+ readonly page: "Page";
181
+ readonly reset: "Reset";
176
182
  }>() => {
177
183
  t: import('@inploi/i18n/translation').TFn<T>;
178
184
  locale: string | undefined;
@@ -233,6 +239,8 @@ export declare const TranslationProvider: (props: {
233
239
  readonly one: "Showing {{count}} job";
234
240
  readonly other: "Showing {{count}} jobs";
235
241
  };
242
+ readonly page: "Page";
243
+ readonly reset: "Reset";
236
244
  } = {
237
245
  readonly type_to_search_jobs: "Type to search jobs";
238
246
  readonly type_to_search: "Type to search";
@@ -290,6 +298,8 @@ export declare const TranslationProvider: (props: {
290
298
  readonly one: "Showing {{count}} job";
291
299
  readonly other: "Showing {{count}} jobs";
292
300
  };
301
+ readonly page: "Page";
302
+ readonly reset: "Reset";
293
303
  }>(options: {
294
304
  overrides: Partial<import('@inploi/i18n/translation').TranslationDict<{
295
305
  readonly type_to_search_jobs: "Type to search jobs";
@@ -348,6 +358,8 @@ export declare const TranslationProvider: (props: {
348
358
  readonly one: "Showing {{count}} job";
349
359
  readonly other: "Showing {{count}} jobs";
350
360
  };
361
+ readonly page: "Page";
362
+ readonly reset: "Reset";
351
363
  }>>;
352
364
  locale: string | undefined;
353
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 {};
@@ -1,4 +1,4 @@
1
- import { c as ib, g as rb, u as nb, _ as Ju, h as ob, a as sb, p as Km, o as Fs } from "./utils-dde9ec9c.js";
1
+ import { e as ib, f as rb, u as nb, _ as Ju, h as ob, j as sb, p as Km, o as Fs } from "./utils-1d2f30cf.js";
2
2
  var q0 = { exports: {} };
3
3
  (function(Lr, oh) {
4
4
  (function(Bs, Ns) {