@inploi/plugin-job-search 0.1.0 → 0.1.2

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.
@@ -3,147 +3,102 @@ import { SWRResponse } from 'swr';
3
3
  import { Input } from 'valibot';
4
4
  import { FilterValue } from './components/filter';
5
5
  declare const JobSearchResponseSchema: import("valibot").SchemaWithTransform<import("valibot").ObjectSchema<{
6
- data: import("valibot").ObjectSchema<{
7
- results: import("valibot").ArraySchema<import("valibot").SchemaWithTransform<import("valibot").ObjectSchema<{
8
- id: import("valibot").NumberSchema<number>;
9
- company_name: import("valibot").StringSchema<string>;
10
- company_logo: import("valibot").StringSchema<string>;
11
- employment_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"FULL_TIME", "FULL_TIME">, import("valibot").LiteralSchema<"PART_TIME", "PART_TIME">, import("valibot").LiteralSchema<"TEMPORARY", "TEMPORARY">, import("valibot").LiteralSchema<"CONTRACTOR", "CONTRACTOR">, import("valibot").LiteralSchema<"INTERN", "INTERN">, import("valibot").LiteralSchema<"VOLUNTEER", "VOLUNTEER">, import("valibot").LiteralSchema<"OTHER", "OTHER">], "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER">;
12
- location_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"LOCATION", "LOCATION">, import("valibot").LiteralSchema<"REMOTE", "REMOTE">, import("valibot").LiteralSchema<"HYBRID", "HYBRID">], "LOCATION" | "REMOTE" | "HYBRID">;
13
- pay_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"ANNUALLY", "ANNUALLY">, import("valibot").LiteralSchema<"HOURLY", "HOURLY">, import("valibot").LiteralSchema<"MONTHLY", "MONTHLY">, import("valibot").LiteralSchema<"WEEKLY", "WEEKLY">, import("valibot").LiteralSchema<"DAILY", "DAILY">], "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY">;
14
- pay_currency: import("valibot").StringSchema<string>;
15
- pay_mask: import("valibot").BooleanSchema<boolean>;
16
- pay_display: import("valibot").BooleanSchema<boolean>;
17
- pay: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
18
- pay_min: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
19
- pay_max: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
20
- description: import("valibot").StringSchema<string>;
21
- title: import("valibot").StringSchema<string>;
22
- coordinates: import("valibot").ObjectSchema<{
23
- lat: import("valibot").NumberSchema<number>;
24
- lng: import("valibot").NumberSchema<number>;
25
- }, undefined, {
26
- lat: number;
27
- lng: number;
28
- }>;
29
- contract_type: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
30
- created_at: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
31
- custom_data: import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").AnySchema<any>, {
32
- [x: string]: any;
33
- }>, undefined, {
34
- [x: string]: any;
35
- } | null>;
36
- href: import("valibot").StringSchema<string>;
6
+ data: import("valibot").ArraySchema<import("valibot").SchemaWithTransform<import("valibot").ObjectSchema<{
7
+ id: import("valibot").NumberSchema<number>;
8
+ company_name: import("valibot").StringSchema<string>;
9
+ employment_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"FULL_TIME", "FULL_TIME">, import("valibot").LiteralSchema<"PART_TIME", "PART_TIME">, import("valibot").LiteralSchema<"TEMPORARY", "TEMPORARY">, import("valibot").LiteralSchema<"CONTRACTOR", "CONTRACTOR">, import("valibot").LiteralSchema<"INTERN", "INTERN">, import("valibot").LiteralSchema<"VOLUNTEER", "VOLUNTEER">, import("valibot").LiteralSchema<"OTHER", "OTHER">], "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER">;
10
+ location_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"LOCATION", "LOCATION">, import("valibot").LiteralSchema<"REMOTE", "REMOTE">, import("valibot").LiteralSchema<"HYBRID", "HYBRID">], "LOCATION" | "REMOTE" | "HYBRID">;
11
+ pay_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"ANNUALLY", "ANNUALLY">, import("valibot").LiteralSchema<"HOURLY", "HOURLY">, import("valibot").LiteralSchema<"MONTHLY", "MONTHLY">, import("valibot").LiteralSchema<"WEEKLY", "WEEKLY">, import("valibot").LiteralSchema<"DAILY", "DAILY">], "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY">;
12
+ pay_currency: import("valibot").StringSchema<string>;
13
+ pay_mask: import("valibot").BooleanSchema<boolean>;
14
+ pay_display: import("valibot").BooleanSchema<boolean>;
15
+ pay: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
16
+ pay_min: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
17
+ pay_max: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
18
+ description: import("valibot").StringSchema<string>;
19
+ title: import("valibot").StringSchema<string>;
20
+ coordinates: import("valibot").ObjectSchema<{
21
+ lat: import("valibot").NumberSchema<number>;
22
+ lng: import("valibot").NumberSchema<number>;
37
23
  }, undefined, {
38
- title: string;
39
- href: string;
40
- id: number;
41
- company_name: string;
42
- company_logo: string;
43
- employment_type: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
44
- location_type: "LOCATION" | "REMOTE" | "HYBRID";
45
- pay_type: "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY";
46
- pay_currency: string;
47
- pay_mask: boolean;
48
- pay_display: boolean;
49
- pay: string | null;
50
- pay_min: string | null;
51
- pay_max: string | null;
52
- description: string;
53
- coordinates: {
54
- lat: number;
55
- lng: number;
56
- };
57
- contract_type: string | null;
58
- created_at: string | null;
59
- custom_data: {
60
- [x: string]: any;
61
- } | null;
62
- }>, {
63
- id: number;
64
- isNew: boolean;
65
- company: {
66
- name: string;
67
- logo: string;
68
- };
69
- employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
70
- locationType: "LOCATION" | "REMOTE" | "HYBRID";
71
- pay: string | undefined;
72
- description: string;
73
- title: string;
74
- coordinates: {
75
- lat: number;
76
- lng: number;
77
- };
78
- contractType: string | null;
79
- href: string;
80
- relativePostedDate: string;
81
- customData: {
82
- [x: string]: any;
83
- } | null;
84
- }>, {
85
- id: number;
86
- isNew: boolean;
87
- company: {
88
- name: string;
89
- logo: string;
90
- };
91
- employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
92
- locationType: "LOCATION" | "REMOTE" | "HYBRID";
93
- pay: string | undefined;
94
- description: string;
95
- title: string;
96
- coordinates: {
97
- lat: number;
98
- lng: number;
99
- };
100
- contractType: string | null;
101
- href: string;
102
- relativePostedDate: string;
103
- customData: {
104
- [x: string]: any;
105
- } | null;
106
- }[]>;
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
- }[];
24
+ lat: number;
25
+ lng: number;
115
26
  }>;
27
+ contract_type: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
28
+ created_at: import("valibot").NullableSchema<import("valibot").StringSchema<string>, undefined, string | null>;
29
+ custom_data: import("valibot").NullableSchema<import("valibot").RecordSchema<import("valibot").StringSchema<string>, import("valibot").AnySchema<any>, {
30
+ [x: string]: any;
31
+ }>, undefined, {
32
+ [x: string]: any;
33
+ } | null>;
34
+ href: import("valibot").StringSchema<string>;
116
35
  }, undefined, {
117
- results: {
118
- id: number;
119
- isNew: boolean;
120
- company: {
121
- name: string;
122
- logo: string;
123
- };
124
- employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
125
- locationType: "LOCATION" | "REMOTE" | "HYBRID";
126
- pay: string | undefined;
127
- description: string;
128
- title: string;
129
- coordinates: {
130
- lat: number;
131
- lng: number;
132
- };
133
- contractType: string | null;
134
- href: string;
135
- relativePostedDate: string;
136
- customData: {
137
- [x: string]: any;
138
- } | null;
139
- }[];
140
- available_properties: {
141
- [x: string]: {
142
- value: string;
143
- label: string;
144
- }[];
36
+ title: string;
37
+ href: string;
38
+ id: number;
39
+ company_name: string;
40
+ employment_type: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
41
+ location_type: "LOCATION" | "REMOTE" | "HYBRID";
42
+ pay_type: "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY";
43
+ pay_currency: string;
44
+ pay_mask: boolean;
45
+ pay_display: boolean;
46
+ pay: string | null;
47
+ pay_min: string | null;
48
+ pay_max: string | null;
49
+ description: string;
50
+ coordinates: {
51
+ lat: number;
52
+ lng: number;
145
53
  };
146
- }>;
54
+ contract_type: string | null;
55
+ created_at: string | null;
56
+ custom_data: {
57
+ [x: string]: any;
58
+ } | null;
59
+ }>, {
60
+ id: number;
61
+ isNew: boolean;
62
+ company: {
63
+ name: string;
64
+ };
65
+ employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
66
+ locationType: "LOCATION" | "REMOTE" | "HYBRID";
67
+ pay: string | undefined;
68
+ description: string;
69
+ title: string;
70
+ coordinates: {
71
+ lat: number;
72
+ lng: number;
73
+ };
74
+ contractType: string | null;
75
+ href: string;
76
+ relativePostedDate: string;
77
+ customData: {
78
+ [x: string]: any;
79
+ } | null;
80
+ }>, {
81
+ id: number;
82
+ isNew: boolean;
83
+ company: {
84
+ name: string;
85
+ };
86
+ employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
87
+ locationType: "LOCATION" | "REMOTE" | "HYBRID";
88
+ pay: string | undefined;
89
+ description: string;
90
+ title: string;
91
+ coordinates: {
92
+ lat: number;
93
+ lng: number;
94
+ };
95
+ contractType: string | null;
96
+ href: string;
97
+ relativePostedDate: string;
98
+ customData: {
99
+ [x: string]: any;
100
+ } | null;
101
+ }[]>;
147
102
  pagination: import("valibot").ObjectSchema<{
148
103
  total: import("valibot").NumberSchema<number>;
149
104
  current_page: import("valibot").NumberSchema<number>;
@@ -157,36 +112,27 @@ declare const JobSearchResponseSchema: import("valibot").SchemaWithTransform<imp
157
112
  }>;
158
113
  }, undefined, {
159
114
  data: {
160
- results: {
161
- id: number;
162
- isNew: boolean;
163
- company: {
164
- name: string;
165
- logo: string;
166
- };
167
- employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
168
- locationType: "LOCATION" | "REMOTE" | "HYBRID";
169
- pay: string | undefined;
170
- description: string;
171
- title: string;
172
- coordinates: {
173
- lat: number;
174
- lng: number;
175
- };
176
- contractType: string | null;
177
- href: string;
178
- relativePostedDate: string;
179
- customData: {
180
- [x: string]: any;
181
- } | null;
182
- }[];
183
- available_properties: {
184
- [x: string]: {
185
- value: string;
186
- label: string;
187
- }[];
115
+ id: number;
116
+ isNew: boolean;
117
+ company: {
118
+ name: string;
188
119
  };
189
- };
120
+ employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
121
+ locationType: "LOCATION" | "REMOTE" | "HYBRID";
122
+ pay: string | undefined;
123
+ description: string;
124
+ title: string;
125
+ coordinates: {
126
+ lat: number;
127
+ lng: number;
128
+ };
129
+ contractType: string | null;
130
+ href: string;
131
+ relativePostedDate: string;
132
+ customData: {
133
+ [x: string]: any;
134
+ } | null;
135
+ }[];
190
136
  pagination: {
191
137
  total: number;
192
138
  current_page: number;
@@ -205,7 +151,6 @@ declare const JobSearchResponseSchema: import("valibot").SchemaWithTransform<imp
205
151
  isNew: boolean;
206
152
  company: {
207
153
  name: string;
208
- logo: string;
209
154
  };
210
155
  employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
211
156
  locationType: "LOCATION" | "REMOTE" | "HYBRID";
@@ -223,14 +168,20 @@ declare const JobSearchResponseSchema: import("valibot").SchemaWithTransform<imp
223
168
  [x: string]: any;
224
169
  } | null;
225
170
  }[];
226
- availableProperties: {
227
- [x: string]: {
228
- value: string;
229
- label: string;
230
- }[];
231
- };
232
171
  }>;
233
172
  export type JobSearchResponsePayload = Input<typeof JobSearchResponseSchema>;
173
+ export declare const getAvailableFilters: ({ apiClient, filters, logger, signal, }: {
174
+ apiClient: ApiClient;
175
+ logger: Logger;
176
+ signal?: AbortSignal | undefined;
177
+ filters: Record<string, FilterValue | undefined>;
178
+ }) => Promise<{
179
+ [x: string]: {
180
+ value: string;
181
+ label: string;
182
+ }[];
183
+ }>;
184
+ export type GetAvailableFiltersResponse = Awaited<ReturnType<typeof getAvailableFilters>>;
234
185
  export declare const getJobSearchResults: ({ apiClient, logger, signal, filters, page, }: {
235
186
  apiClient: ApiClient;
236
187
  logger: Logger;
@@ -249,7 +200,6 @@ export declare const getJobSearchResults: ({ apiClient, logger, signal, filters,
249
200
  isNew: boolean;
250
201
  company: {
251
202
  name: string;
252
- logo: string;
253
203
  };
254
204
  employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
255
205
  locationType: "LOCATION" | "REMOTE" | "HYBRID";
@@ -267,30 +217,27 @@ export declare const getJobSearchResults: ({ apiClient, logger, signal, filters,
267
217
  [x: string]: any;
268
218
  } | null;
269
219
  }[];
270
- availableProperties: {
271
- [x: string]: {
272
- value: string;
273
- label: string;
274
- }[];
275
- };
276
220
  }>;
277
- export declare const getDataState: <T>(swr: SWRResponse<T, any, any>) => {
278
- state: "error";
221
+ export type GetJobSearchResponse = Awaited<ReturnType<typeof getJobSearchResults>>;
222
+ export type QueryState<T> = {
223
+ state: 'error';
224
+ data?: never;
279
225
  error: unknown;
280
- data: T | undefined;
281
226
  } | {
282
- state: "loading";
283
- data: T | undefined;
284
- error?: undefined;
227
+ state: 'loading';
228
+ data?: never;
229
+ error?: never;
285
230
  } | {
286
- state: "revalidating";
287
- data: NonNullable<T>;
288
- error?: undefined;
231
+ state: 'revalidating';
232
+ data: T;
233
+ error?: never;
289
234
  } | {
290
- state: "loaded";
291
- data: NonNullable<T>;
292
- error?: undefined;
235
+ state: 'loaded';
236
+ data: T;
237
+ error?: never;
293
238
  };
239
+ /** Binds together state to data, fixing useSWR’s type-safety */
240
+ export declare const getQueryState: <T>(swr: SWRResponse<T, any, any>) => QueryState<T>;
294
241
  export declare const SWR_SETTINGS: {
295
242
  readonly keepPreviousData: true;
296
243
  readonly revalidateOnFocus: false;
@@ -1,2 +1,3 @@
1
1
  export declare const JOB_SEARCH_ELEMENT_ID = "inploi-job-search";
2
2
  export declare const JOB_SEARCH_SCOPE_ELEMENT_ID = "ijs";
3
+ export declare const PAGE_SIZE = 10;
@@ -55,7 +55,7 @@ export type JobSearchPluginParams = {
55
55
  * @default 112px
56
56
  */
57
57
  filtersOffsetTopPx?: number;
58
- accessibility: {
58
+ accessibility?: {
59
59
  highcontrast: boolean;
60
60
  reducedMotion: boolean;
61
61
  };
@@ -25,7 +25,6 @@ export type PaginationSchema = Output<typeof PaginationSchema>;
25
25
  export declare const JobSchema: import("valibot").SchemaWithTransform<import("valibot").ObjectSchema<{
26
26
  id: import("valibot").NumberSchema<number>;
27
27
  company_name: import("valibot").StringSchema<string>;
28
- company_logo: import("valibot").StringSchema<string>;
29
28
  employment_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"FULL_TIME", "FULL_TIME">, import("valibot").LiteralSchema<"PART_TIME", "PART_TIME">, import("valibot").LiteralSchema<"TEMPORARY", "TEMPORARY">, import("valibot").LiteralSchema<"CONTRACTOR", "CONTRACTOR">, import("valibot").LiteralSchema<"INTERN", "INTERN">, import("valibot").LiteralSchema<"VOLUNTEER", "VOLUNTEER">, import("valibot").LiteralSchema<"OTHER", "OTHER">], "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER">;
30
29
  location_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"LOCATION", "LOCATION">, import("valibot").LiteralSchema<"REMOTE", "REMOTE">, import("valibot").LiteralSchema<"HYBRID", "HYBRID">], "LOCATION" | "REMOTE" | "HYBRID">;
31
30
  pay_type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"ANNUALLY", "ANNUALLY">, import("valibot").LiteralSchema<"HOURLY", "HOURLY">, import("valibot").LiteralSchema<"MONTHLY", "MONTHLY">, import("valibot").LiteralSchema<"WEEKLY", "WEEKLY">, import("valibot").LiteralSchema<"DAILY", "DAILY">], "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY">;
@@ -57,7 +56,6 @@ export declare const JobSchema: import("valibot").SchemaWithTransform<import("va
57
56
  href: string;
58
57
  id: number;
59
58
  company_name: string;
60
- company_logo: string;
61
59
  employment_type: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
62
60
  location_type: "LOCATION" | "REMOTE" | "HYBRID";
63
61
  pay_type: "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY";
@@ -82,7 +80,6 @@ export declare const JobSchema: import("valibot").SchemaWithTransform<import("va
82
80
  isNew: boolean;
83
81
  company: {
84
82
  name: string;
85
- logo: string;
86
83
  };
87
84
  employmentType: "FULL_TIME" | "PART_TIME" | "TEMPORARY" | "CONTRACTOR" | "INTERN" | "VOLUNTEER" | "OTHER";
88
85
  locationType: "LOCATION" | "REMOTE" | "HYBRID";