@inploi/plugin-job-search 0.1.5 → 0.3.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.
@@ -25,9 +25,13 @@ declare const JobSearchResponseSchema: import("valibot").SchemaWithTransform<imp
25
25
  [x: string]: any;
26
26
  } | null>;
27
27
  href: import("valibot").StringSchema<string>;
28
+ industry: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
29
+ category: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
30
+ skills: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
31
+ town: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
32
+ city: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
33
+ country: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
28
34
  }, undefined, {
29
- title: string;
30
- href: string;
31
35
  id: number;
32
36
  company_name: string;
33
37
  employment_type: string;
@@ -40,12 +44,47 @@ declare const JobSearchResponseSchema: import("valibot").SchemaWithTransform<imp
40
44
  pay_min: string | null;
41
45
  pay_max: string | null;
42
46
  description: string;
47
+ title: string;
43
48
  contract_type: string | null;
44
49
  created_at: string | null;
45
50
  custom_data: {
46
51
  [x: string]: any;
47
52
  } | null;
53
+ href: string;
54
+ industry?: string | undefined;
55
+ category?: string | undefined;
56
+ skills?: string | undefined;
57
+ town?: string | undefined;
58
+ city?: string | undefined;
59
+ country?: string | undefined;
48
60
  }>, {
61
+ raw: {
62
+ id: number;
63
+ company_name: string;
64
+ employment_type: string;
65
+ location_type: "LOCATION" | "REMOTE" | "HYBRID";
66
+ pay_type: "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY";
67
+ pay_currency: string;
68
+ pay_mask: boolean;
69
+ pay_display: boolean;
70
+ pay: string | null;
71
+ pay_min: string | null;
72
+ pay_max: string | null;
73
+ description: string;
74
+ title: string;
75
+ contract_type: string | null;
76
+ created_at: string | null;
77
+ custom_data: {
78
+ [x: string]: any;
79
+ } | null;
80
+ href: string;
81
+ industry?: string | undefined;
82
+ category?: string | undefined;
83
+ skills?: string | undefined;
84
+ town?: string | undefined;
85
+ city?: string | undefined;
86
+ country?: string | undefined;
87
+ };
49
88
  id: number;
50
89
  isNew: boolean;
51
90
  company: {
@@ -63,6 +102,33 @@ declare const JobSearchResponseSchema: import("valibot").SchemaWithTransform<imp
63
102
  [x: string]: any;
64
103
  } | null;
65
104
  }>, {
105
+ raw: {
106
+ id: number;
107
+ company_name: string;
108
+ employment_type: string;
109
+ location_type: "LOCATION" | "REMOTE" | "HYBRID";
110
+ pay_type: "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY";
111
+ pay_currency: string;
112
+ pay_mask: boolean;
113
+ pay_display: boolean;
114
+ pay: string | null;
115
+ pay_min: string | null;
116
+ pay_max: string | null;
117
+ description: string;
118
+ title: string;
119
+ contract_type: string | null;
120
+ created_at: string | null;
121
+ custom_data: {
122
+ [x: string]: any;
123
+ } | null;
124
+ href: string;
125
+ industry?: string | undefined;
126
+ category?: string | undefined;
127
+ skills?: string | undefined;
128
+ town?: string | undefined;
129
+ city?: string | undefined;
130
+ country?: string | undefined;
131
+ };
66
132
  id: number;
67
133
  isNew: boolean;
68
134
  company: {
@@ -93,6 +159,33 @@ declare const JobSearchResponseSchema: import("valibot").SchemaWithTransform<imp
93
159
  }>;
94
160
  }, undefined, {
95
161
  data: {
162
+ raw: {
163
+ id: number;
164
+ company_name: string;
165
+ employment_type: string;
166
+ location_type: "LOCATION" | "REMOTE" | "HYBRID";
167
+ pay_type: "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY";
168
+ pay_currency: string;
169
+ pay_mask: boolean;
170
+ pay_display: boolean;
171
+ pay: string | null;
172
+ pay_min: string | null;
173
+ pay_max: string | null;
174
+ description: string;
175
+ title: string;
176
+ contract_type: string | null;
177
+ created_at: string | null;
178
+ custom_data: {
179
+ [x: string]: any;
180
+ } | null;
181
+ href: string;
182
+ industry?: string | undefined;
183
+ category?: string | undefined;
184
+ skills?: string | undefined;
185
+ town?: string | undefined;
186
+ city?: string | undefined;
187
+ country?: string | undefined;
188
+ };
96
189
  id: number;
97
190
  isNew: boolean;
98
191
  company: {
@@ -124,6 +217,33 @@ declare const JobSearchResponseSchema: import("valibot").SchemaWithTransform<imp
124
217
  last_page: number;
125
218
  };
126
219
  results: {
220
+ raw: {
221
+ id: number;
222
+ company_name: string;
223
+ employment_type: string;
224
+ location_type: "LOCATION" | "REMOTE" | "HYBRID";
225
+ pay_type: "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY";
226
+ pay_currency: string;
227
+ pay_mask: boolean;
228
+ pay_display: boolean;
229
+ pay: string | null;
230
+ pay_min: string | null;
231
+ pay_max: string | null;
232
+ description: string;
233
+ title: string;
234
+ contract_type: string | null;
235
+ created_at: string | null;
236
+ custom_data: {
237
+ [x: string]: any;
238
+ } | null;
239
+ href: string;
240
+ industry?: string | undefined;
241
+ category?: string | undefined;
242
+ skills?: string | undefined;
243
+ town?: string | undefined;
244
+ city?: string | undefined;
245
+ country?: string | undefined;
246
+ };
127
247
  id: number;
128
248
  isNew: boolean;
129
249
  company: {
@@ -169,6 +289,33 @@ export declare const getJobSearchResults: ({ apiClient, logger, signal, filters,
169
289
  last_page: number;
170
290
  };
171
291
  results: {
292
+ raw: {
293
+ id: number;
294
+ company_name: string;
295
+ employment_type: string;
296
+ location_type: "LOCATION" | "REMOTE" | "HYBRID";
297
+ pay_type: "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY";
298
+ pay_currency: string;
299
+ pay_mask: boolean;
300
+ pay_display: boolean;
301
+ pay: string | null;
302
+ pay_min: string | null;
303
+ pay_max: string | null;
304
+ description: string;
305
+ title: string;
306
+ contract_type: string | null;
307
+ created_at: string | null;
308
+ custom_data: {
309
+ [x: string]: any;
310
+ } | null;
311
+ href: string;
312
+ industry?: string | undefined;
313
+ category?: string | undefined;
314
+ skills?: string | undefined;
315
+ town?: string | undefined;
316
+ city?: string | undefined;
317
+ country?: string | undefined;
318
+ };
172
319
  id: number;
173
320
  isNew: boolean;
174
321
  company: {
@@ -1,4 +1,6 @@
1
+ import { getJobSearchResults } from './job-search.api.ts';
1
2
  import { IconName } from './components/icon.tsx';
3
+ import { HintedString } from './lib/type-utils.ts';
2
4
  type FontSettings = {
3
5
  fontFamily: string;
4
6
  weight: 'normal' | 'bold' | 'lighter' | 'bolder' | number;
@@ -11,8 +13,8 @@ declare const textStyles: {
11
13
  readonly jobHeading: "jobHeading";
12
14
  };
13
15
  type TextStyle = keyof typeof textStyles;
14
- export declare const FILTER_KEYS: readonly ["company_id", "company_name", "industry", "employment_type", "location_type", "pay_type", "pay_currency", "pay_mask", "pay", "pay_min", "pay_max", "title", "category", "skills", "address_1", "address_2", "town", "city", "postcode", "country", "contract_type", "pay_display"];
15
- export type FilterKey = (typeof FILTER_KEYS)[number] | (string & {});
16
+ export declare const FILTER_KEYS: readonly ["company_name", "employment_type", "location_type", "pay_type", "pay_currency", "pay_mask", "pay", "pay_min", "pay_max", "title", "industry", "category", "skills", "town", "city", "country", "contract_type", "pay_display"];
17
+ export type FilterKey = HintedString<(typeof FILTER_KEYS)[number]>;
16
18
  export type FilterProperty = {
17
19
  key: FilterKey;
18
20
  /** The label to display for the property.
@@ -38,6 +40,10 @@ export type FilterProperty = {
38
40
  */
39
41
  select: 'one' | 'many';
40
42
  };
43
+ export type DisplayableFilterProperty = FilterKey | {
44
+ key: string;
45
+ transform: (value: string | undefined) => string | null;
46
+ };
41
47
  export type JobSearchPluginParams = {
42
48
  theme: {
43
49
  mode: 'light' | 'dark';
@@ -62,12 +68,30 @@ export type JobSearchPluginParams = {
62
68
  };
63
69
  /** Array of properties because _order matters_ to display them. */
64
70
  properties: FilterProperty[];
71
+ jobCard: {
72
+ subheading: DisplayableFilterProperty;
73
+ infoTags: DisplayableFilterProperty[];
74
+ };
65
75
  };
76
+ export interface SSRJobSearchPluginParams extends JobSearchPluginParams {
77
+ /** If true, the data needed to display the first page of results
78
+ * will be fetched from the server. This is recommended if SEO is important
79
+ * or you want your page to be progressively enhanced. */
80
+ withData: boolean;
81
+ }
82
+ export interface CSRJobSearchPluginParams extends JobSearchPluginParams {
83
+ /** When provided with initial data, the client side bundle will hydrate
84
+ * the already present SSR content, avoiding any loading.
85
+ */
86
+ initialData?: {
87
+ jobs: Awaited<ReturnType<typeof getJobSearchResults>>;
88
+ };
89
+ }
66
90
  export declare const createJobSearchDomManager: () => {
67
91
  getRenderTargetElement: () => Element;
68
92
  };
69
93
  export type ChatbotDomManager = ReturnType<typeof createJobSearchDomManager>;
70
- export declare const jobSearchPlugin: (params: JobSearchPluginParams) => ({ apiClient, logger, analytics }: {
94
+ export declare const jobSearchPlugin: () => ({ apiClient, logger, analytics }: {
71
95
  apiClient: import("@inploi/sdk").ApiClient;
72
96
  logger: import("@inploi/sdk").Logger;
73
97
  analytics: import("@inploi/sdk").AnalyticsService;
@@ -75,8 +99,65 @@ export declare const jobSearchPlugin: (params: JobSearchPluginParams) => ({ apiC
75
99
  /** Returns a string with the initial rendering state of the UI.
76
100
  * Useful when server-side rendering to avoid CLS.
77
101
  */
78
- renderToString: () => string;
102
+ prerender: (params: SSRJobSearchPluginParams) => Promise<{
103
+ html: string;
104
+ data: {
105
+ jobs: {
106
+ pagination: {
107
+ total: number;
108
+ current_page: number;
109
+ per_page: number;
110
+ last_page: number;
111
+ };
112
+ results: {
113
+ raw: {
114
+ id: number;
115
+ company_name: string;
116
+ employment_type: string;
117
+ location_type: "LOCATION" | "REMOTE" | "HYBRID";
118
+ pay_type: "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY";
119
+ pay_currency: string;
120
+ pay_mask: boolean;
121
+ pay_display: boolean;
122
+ pay: string | null;
123
+ pay_min: string | null;
124
+ pay_max: string | null;
125
+ description: string;
126
+ title: string;
127
+ contract_type: string | null;
128
+ created_at: string | null;
129
+ custom_data: {
130
+ [x: string]: any;
131
+ } | null;
132
+ href: string;
133
+ industry?: string | undefined;
134
+ category?: string | undefined;
135
+ skills?: string | undefined;
136
+ town?: string | undefined;
137
+ city?: string | undefined;
138
+ country?: string | undefined;
139
+ };
140
+ id: number;
141
+ isNew: boolean;
142
+ company: {
143
+ name: string;
144
+ };
145
+ employmentType: string;
146
+ locationType: "LOCATION" | "REMOTE" | "HYBRID";
147
+ pay: string | undefined;
148
+ description: string;
149
+ title: string;
150
+ contractType: string | null;
151
+ href: string;
152
+ relativePostedDate: string;
153
+ customData: {
154
+ [x: string]: any;
155
+ } | null;
156
+ }[];
157
+ };
158
+ } | undefined;
159
+ }>;
79
160
  /** Renders the Job Search Plugin inside the container element. */
80
- render: () => Promise<void>;
161
+ render: (params: CSRJobSearchPluginParams) => Promise<void>;
81
162
  };
82
163
  export {};
@@ -50,9 +50,13 @@ export declare const JobSchema: import("valibot").SchemaWithTransform<import("va
50
50
  [x: string]: any;
51
51
  } | null>;
52
52
  href: import("valibot").StringSchema<string>;
53
+ industry: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
54
+ category: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
55
+ skills: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
56
+ town: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
57
+ city: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
58
+ country: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
53
59
  }, undefined, {
54
- title: string;
55
- href: string;
56
60
  id: number;
57
61
  company_name: string;
58
62
  employment_type: string;
@@ -65,12 +69,47 @@ export declare const JobSchema: import("valibot").SchemaWithTransform<import("va
65
69
  pay_min: string | null;
66
70
  pay_max: string | null;
67
71
  description: string;
72
+ title: string;
68
73
  contract_type: string | null;
69
74
  created_at: string | null;
70
75
  custom_data: {
71
76
  [x: string]: any;
72
77
  } | null;
78
+ href: string;
79
+ industry?: string | undefined;
80
+ category?: string | undefined;
81
+ skills?: string | undefined;
82
+ town?: string | undefined;
83
+ city?: string | undefined;
84
+ country?: string | undefined;
73
85
  }>, {
86
+ raw: {
87
+ id: number;
88
+ company_name: string;
89
+ employment_type: string;
90
+ location_type: "LOCATION" | "REMOTE" | "HYBRID";
91
+ pay_type: "ANNUALLY" | "HOURLY" | "MONTHLY" | "WEEKLY" | "DAILY";
92
+ pay_currency: string;
93
+ pay_mask: boolean;
94
+ pay_display: boolean;
95
+ pay: string | null;
96
+ pay_min: string | null;
97
+ pay_max: string | null;
98
+ description: string;
99
+ title: string;
100
+ contract_type: string | null;
101
+ created_at: string | null;
102
+ custom_data: {
103
+ [x: string]: any;
104
+ } | null;
105
+ href: string;
106
+ industry?: string | undefined;
107
+ category?: string | undefined;
108
+ skills?: string | undefined;
109
+ town?: string | undefined;
110
+ city?: string | undefined;
111
+ country?: string | undefined;
112
+ };
74
113
  id: number;
75
114
  isNew: boolean;
76
115
  company: {