@inploi/plugin-job-search 0.0.7 → 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.
@@ -1,6 +1,8 @@
1
1
  import { ApiClient, Logger } from '@inploi/sdk';
2
+ import { SWRResponse } from 'swr';
3
+ import { Input } from 'valibot';
2
4
  import { FilterValue } from './components/filter';
3
- export declare const JobSearchResponseSchema: import("valibot").ObjectSchema<{
5
+ declare const JobSearchResponseSchema: import("valibot").SchemaWithTransform<import("valibot").ObjectSchema<{
4
6
  data: import("valibot").ObjectSchema<{
5
7
  results: import("valibot").ArraySchema<import("valibot").SchemaWithTransform<import("valibot").ObjectSchema<{
6
8
  id: import("valibot").NumberSchema<number>;
@@ -25,14 +27,16 @@ export declare const JobSearchResponseSchema: import("valibot").ObjectSchema<{
25
27
  lng: number;
26
28
  }>;
27
29
  contract_type: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
28
- created_at: import("valibot").StringSchema<string>;
30
+ created_at: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
29
31
  custom_data: import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").AnySchema<any>, {
30
32
  [x: string]: any;
31
33
  }>, undefined, {
32
34
  [x: string]: any;
33
35
  } | null>;
36
+ href: import("valibot").StringSchema<string>;
34
37
  }, undefined, {
35
38
  title: string;
39
+ href: string;
36
40
  id: number;
37
41
  company_name: string;
38
42
  company_logo: string;
@@ -51,7 +55,7 @@ export declare const JobSearchResponseSchema: import("valibot").ObjectSchema<{
51
55
  lng: number;
52
56
  };
53
57
  contract_type: string | null;
54
- created_at: string;
58
+ created_at: string | null;
55
59
  custom_data: {
56
60
  [x: string]: any;
57
61
  } | null;
@@ -72,6 +76,7 @@ export declare const JobSearchResponseSchema: import("valibot").ObjectSchema<{
72
76
  lng: number;
73
77
  };
74
78
  contractType: string | null;
79
+ href: string;
75
80
  relativePostedDate: string;
76
81
  customData: {
77
82
  [x: string]: any;
@@ -93,13 +98,20 @@ export declare const JobSearchResponseSchema: import("valibot").ObjectSchema<{
93
98
  lng: number;
94
99
  };
95
100
  contractType: string | null;
101
+ href: string;
96
102
  relativePostedDate: string;
97
103
  customData: {
98
104
  [x: string]: any;
99
105
  } | null;
100
106
  }[]>;
101
- available_properties: import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").ArraySchema<import("valibot").StringSchema<string>, string[]>, {
102
- [x: string]: string[];
107
+ available_properties: import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").SchemaWithTransform<import("valibot").ArraySchema<import("valibot").StringSchema<string>, string[]>, {
108
+ value: string;
109
+ label: string;
110
+ }[]>, {
111
+ [x: string]: {
112
+ value: string;
113
+ label: string;
114
+ }[];
103
115
  }>;
104
116
  }, undefined, {
105
117
  results: {
@@ -119,13 +131,17 @@ export declare const JobSearchResponseSchema: import("valibot").ObjectSchema<{
119
131
  lng: number;
120
132
  };
121
133
  contractType: string | null;
134
+ href: string;
122
135
  relativePostedDate: string;
123
136
  customData: {
124
137
  [x: string]: any;
125
138
  } | null;
126
139
  }[];
127
140
  available_properties: {
128
- [x: string]: string[];
141
+ [x: string]: {
142
+ value: string;
143
+ label: string;
144
+ }[];
129
145
  };
130
146
  }>;
131
147
  pagination: import("valibot").ObjectSchema<{
@@ -158,13 +174,17 @@ export declare const JobSearchResponseSchema: import("valibot").ObjectSchema<{
158
174
  lng: number;
159
175
  };
160
176
  contractType: string | null;
177
+ href: string;
161
178
  relativePostedDate: string;
162
179
  customData: {
163
180
  [x: string]: any;
164
181
  } | null;
165
182
  }[];
166
183
  available_properties: {
167
- [x: string]: string[];
184
+ [x: string]: {
185
+ value: string;
186
+ label: string;
187
+ }[];
168
188
  };
169
189
  };
170
190
  pagination: {
@@ -173,44 +193,109 @@ export declare const JobSearchResponseSchema: import("valibot").ObjectSchema<{
173
193
  per_page: number;
174
194
  last_page: number;
175
195
  };
196
+ }>, {
197
+ pagination: {
198
+ total: number;
199
+ current_page: number;
200
+ per_page: number;
201
+ last_page: number;
202
+ };
203
+ results: {
204
+ id: number;
205
+ isNew: boolean;
206
+ company: {
207
+ name: string;
208
+ logo: string;
209
+ };
210
+ employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
211
+ locationType: "LOCATION" | "REMOTE" | "HYBRID";
212
+ pay: string | undefined;
213
+ description: string;
214
+ title: string;
215
+ coordinates: {
216
+ lat: number;
217
+ lng: number;
218
+ };
219
+ contractType: string | null;
220
+ href: string;
221
+ relativePostedDate: string;
222
+ customData: {
223
+ [x: string]: any;
224
+ } | null;
225
+ }[];
226
+ availableProperties: {
227
+ [x: string]: {
228
+ value: string;
229
+ label: string;
230
+ }[];
231
+ };
176
232
  }>;
177
- export declare const getJobSearchResults: ({ apiClient, logger, signal, filters, }: {
233
+ export type JobSearchResponsePayload = Input<typeof JobSearchResponseSchema>;
234
+ export declare const getJobSearchResults: ({ apiClient, logger, signal, filters, page, }: {
178
235
  apiClient: ApiClient;
179
236
  logger: Logger;
180
237
  signal?: AbortSignal | undefined;
181
238
  filters: Record<string, FilterValue | undefined>;
239
+ page?: number | undefined;
182
240
  }) => Promise<{
183
- data: {
184
- results: {
185
- id: number;
186
- isNew: boolean;
187
- company: {
188
- name: string;
189
- logo: string;
190
- };
191
- employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
192
- locationType: "LOCATION" | "REMOTE" | "HYBRID";
193
- pay: string | undefined;
194
- description: string;
195
- title: string;
196
- coordinates: {
197
- lat: number;
198
- lng: number;
199
- };
200
- contractType: string | null;
201
- relativePostedDate: string;
202
- customData: {
203
- [x: string]: any;
204
- } | null;
205
- }[];
206
- available_properties: {
207
- [x: string]: string[];
208
- };
209
- };
210
241
  pagination: {
211
242
  total: number;
212
243
  current_page: number;
213
244
  per_page: number;
214
245
  last_page: number;
215
246
  };
247
+ results: {
248
+ id: number;
249
+ isNew: boolean;
250
+ company: {
251
+ name: string;
252
+ logo: string;
253
+ };
254
+ employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
255
+ locationType: "LOCATION" | "REMOTE" | "HYBRID";
256
+ pay: string | undefined;
257
+ description: string;
258
+ title: string;
259
+ coordinates: {
260
+ lat: number;
261
+ lng: number;
262
+ };
263
+ contractType: string | null;
264
+ href: string;
265
+ relativePostedDate: string;
266
+ customData: {
267
+ [x: string]: any;
268
+ } | null;
269
+ }[];
270
+ availableProperties: {
271
+ [x: string]: {
272
+ value: string;
273
+ label: string;
274
+ }[];
275
+ };
216
276
  }>;
277
+ export declare const getDataState: <T>(swr: SWRResponse<T, any, any>) => {
278
+ state: "error";
279
+ error: unknown;
280
+ data: T | undefined;
281
+ } | {
282
+ state: "loading";
283
+ data: T | undefined;
284
+ error?: undefined;
285
+ } | {
286
+ state: "revalidating";
287
+ data: NonNullable<T>;
288
+ error?: undefined;
289
+ } | {
290
+ state: "loaded";
291
+ data: NonNullable<T>;
292
+ error?: undefined;
293
+ };
294
+ export declare const SWR_SETTINGS: {
295
+ readonly keepPreviousData: true;
296
+ readonly revalidateOnFocus: false;
297
+ readonly revalidateOnReconnect: false;
298
+ readonly revalidateIfStale: false;
299
+ readonly revalidateFirstPage: false;
300
+ };
301
+ export {};
@@ -43,7 +43,6 @@ export type JobSearchPluginParams = {
43
43
  mode: 'light' | 'dark';
44
44
  corners: 'rounded' | 'soft' | 'sharp';
45
45
  highlights: 'stroke' | 'fill';
46
- highcontrast: boolean;
47
46
  typography: Partial<FontSettings> & Partial<Record<TextStyle, Partial<FontSettings>>>;
48
47
  accent: {
49
48
  /** Number between 0 and 360. Number above or below range will loop. */
@@ -51,6 +50,15 @@ export type JobSearchPluginParams = {
51
50
  /** Float between 0 and 2. Acts as a multiplier to the original generated palette. */
52
51
  chroma: number;
53
52
  };
53
+ /** Applies to the filter section on desktop. Override to ensure the filters are stuck to the top of the viewport,
54
+ * but not obscured by the header. This is useful when the header is sticky on your website.
55
+ * @default 112px
56
+ */
57
+ filtersOffsetTopPx?: number;
58
+ accessibility: {
59
+ highcontrast: boolean;
60
+ reducedMotion: boolean;
61
+ };
54
62
  };
55
63
  /** Array of properties because _order matters_ to display them. */
56
64
  properties: FilterProperty[];
@@ -1,8 +1,15 @@
1
1
  import { Output } from 'valibot';
2
- export declare const AvailablePropertiesSchema: import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").ArraySchema<import("valibot").StringSchema<string>, string[]>, {
3
- [x: string]: string[];
2
+ export declare const AvailablePropertiesSchema: import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").SchemaWithTransform<import("valibot").ArraySchema<import("valibot").StringSchema<string>, string[]>, {
3
+ value: string;
4
+ label: string;
5
+ }[]>, {
6
+ [x: string]: {
7
+ value: string;
8
+ label: string;
9
+ }[];
4
10
  }>;
5
11
  export type AvailablePropertiesSchema = Output<typeof AvailablePropertiesSchema>;
12
+ export type FilterSuggestion = AvailablePropertiesSchema[keyof AvailablePropertiesSchema][number];
6
13
  export declare const PaginationSchema: import("valibot").ObjectSchema<{
7
14
  total: import("valibot").NumberSchema<number>;
8
15
  current_page: import("valibot").NumberSchema<number>;
@@ -38,14 +45,16 @@ export declare const JobSchema: import("valibot").SchemaWithTransform<import("va
38
45
  lng: number;
39
46
  }>;
40
47
  contract_type: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
41
- created_at: import("valibot").StringSchema<string>;
48
+ created_at: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
42
49
  custom_data: import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").AnySchema<any>, {
43
50
  [x: string]: any;
44
51
  }>, undefined, {
45
52
  [x: string]: any;
46
53
  } | null>;
54
+ href: import("valibot").StringSchema<string>;
47
55
  }, undefined, {
48
56
  title: string;
57
+ href: string;
49
58
  id: number;
50
59
  company_name: string;
51
60
  company_logo: string;
@@ -64,7 +73,7 @@ export declare const JobSchema: import("valibot").SchemaWithTransform<import("va
64
73
  lng: number;
65
74
  };
66
75
  contract_type: string | null;
67
- created_at: string;
76
+ created_at: string | null;
68
77
  custom_data: {
69
78
  [x: string]: any;
70
79
  } | null;
@@ -85,6 +94,7 @@ export declare const JobSchema: import("valibot").SchemaWithTransform<import("va
85
94
  lng: number;
86
95
  };
87
96
  contractType: string | null;
97
+ href: string;
88
98
  relativePostedDate: string;
89
99
  customData: {
90
100
  [x: string]: any;