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