@inploi/plugin-job-search 0.13.0 → 0.14.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.
- package/cdn/index.js +5 -5
- package/dist/job-search.d.ts +6 -6
- package/dist/plugin-job-search.cjs +28 -6
- package/dist/plugin-job-search.js +28 -6
- package/package.json +2 -2
package/dist/job-search.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export type FilterProperty = {
|
|
|
32
32
|
*/
|
|
33
33
|
hidden?: boolean;
|
|
34
34
|
/** The initial value for the filter. */
|
|
35
|
-
value?: string;
|
|
35
|
+
value?: string | string[];
|
|
36
36
|
/** Whether users can search from the available results.
|
|
37
37
|
* @default false
|
|
38
38
|
*/
|
|
@@ -69,6 +69,8 @@ export type DisplayableFilterProperty = {
|
|
|
69
69
|
export type JobSearchPluginCardOverrides = {
|
|
70
70
|
/** Use only if you want to override the default salary property. */
|
|
71
71
|
salary?: DisplayableFilterProperty;
|
|
72
|
+
/** Overrides the link to the job. */
|
|
73
|
+
baseUrl?: (jobId: string) => string;
|
|
72
74
|
};
|
|
73
75
|
export type JobSearchPluginParams = {
|
|
74
76
|
theme: {
|
|
@@ -147,7 +149,7 @@ export interface RenderJobSearchPluginParams extends JobSearchPluginParams {
|
|
|
147
149
|
export declare const createJobSearchDomManager: () => {
|
|
148
150
|
getRenderTargetElement: () => Element;
|
|
149
151
|
};
|
|
150
|
-
export type
|
|
152
|
+
export type JobSearchDomManager = ReturnType<typeof createJobSearchDomManager>;
|
|
151
153
|
export declare const jobSearchPlugin: () => ({ apiClient, logger, analytics }: {
|
|
152
154
|
apiClient: import('@inploi/sdk').ApiClient;
|
|
153
155
|
logger: import('@inploi/sdk').Logger;
|
|
@@ -194,9 +196,7 @@ export declare const jobSearchPlugin: () => ({ apiClient, logger, analytics }: {
|
|
|
194
196
|
company_logo?: string | undefined;
|
|
195
197
|
skills?: string | undefined;
|
|
196
198
|
town?: string | undefined;
|
|
197
|
-
};
|
|
198
|
-
* @default `'one'`
|
|
199
|
-
*/
|
|
199
|
+
};
|
|
200
200
|
id: number;
|
|
201
201
|
isNew: boolean;
|
|
202
202
|
company: {
|
|
@@ -221,4 +221,4 @@ export declare const jobSearchPlugin: () => ({ apiClient, logger, analytics }: {
|
|
|
221
221
|
/** Renders the Job Search Plugin inside the container element. */
|
|
222
222
|
render: (params: RenderJobSearchPluginParams) => Promise<void>;
|
|
223
223
|
};
|
|
224
|
-
export {};
|
|
224
|
+
export { getStatefulPropertiesFromSearchParams } from './lib/utils';
|
|
@@ -4399,14 +4399,15 @@ const JobCardLogo = ({
|
|
|
4399
4399
|
};
|
|
4400
4400
|
const asArray = (value) => Array.isArray(value) ? value : [value];
|
|
4401
4401
|
const JobCard = ({ job, config }) => {
|
|
4402
|
-
var _a;
|
|
4402
|
+
var _a, _b;
|
|
4403
4403
|
const subheading = config.subheading ? getDisplayableProperty({ job, property: config.subheading }) : null;
|
|
4404
4404
|
const tags = config.infoTags.flatMap((infoTag) => asArray(getDisplayableProperty({ job, property: infoTag }))).filter(Boolean);
|
|
4405
4405
|
const salary = asArray(
|
|
4406
4406
|
((_a = config.overrides) == null ? void 0 : _a.salary) ? getDisplayableProperty({ job, property: config.overrides.salary }) : job.pay
|
|
4407
4407
|
).filter(Boolean);
|
|
4408
4408
|
const postedDateConfig = config.postedDate ?? "show";
|
|
4409
|
-
|
|
4409
|
+
const href = ((_b = config.overrides) == null ? void 0 : _b.baseUrl) ? config.overrides.baseUrl(job.id.toString()) : job.href;
|
|
4410
|
+
return /* @__PURE__ */ u$1("a", { href, target: config.openJob === "redirect-new-tab" ? "_blank" : void 0, class: wrapperClass(), children: [
|
|
4410
4411
|
/* @__PURE__ */ u$1("div", { class: "flex min-w-0 flex-1 flex-col gap-4", children: [
|
|
4411
4412
|
/* @__PURE__ */ u$1("div", { class: "gap-logo flex items-center", children: [
|
|
4412
4413
|
/* @__PURE__ */ u$1(JobCardLogo, { job, config: config.logo }),
|
|
@@ -4595,13 +4596,21 @@ const ResultsPage = ({
|
|
|
4595
4596
|
};
|
|
4596
4597
|
const getFilterDefaults = (properties) => properties.reduce(
|
|
4597
4598
|
(acc, property) => {
|
|
4599
|
+
var _a;
|
|
4598
4600
|
switch (property.select) {
|
|
4599
|
-
case "one":
|
|
4600
|
-
|
|
4601
|
+
case "one": {
|
|
4602
|
+
const value = typeof property.value === "string" ? property.value : (_a = property.value) == null ? void 0 : _a[0];
|
|
4603
|
+
acc[property.key] = { select: property.select, value };
|
|
4601
4604
|
break;
|
|
4602
|
-
|
|
4603
|
-
|
|
4605
|
+
}
|
|
4606
|
+
case "many": {
|
|
4607
|
+
const value = typeof property.value === "string" ? [property.value] : Array.isArray(property.value) ? property.value : [];
|
|
4608
|
+
acc[property.key] = {
|
|
4609
|
+
select: property.select,
|
|
4610
|
+
value
|
|
4611
|
+
};
|
|
4604
4612
|
break;
|
|
4613
|
+
}
|
|
4605
4614
|
default:
|
|
4606
4615
|
exhaustive(property.select);
|
|
4607
4616
|
}
|
|
@@ -4918,6 +4927,18 @@ const generateColorThemeCss = (theme) => {
|
|
|
4918
4927
|
${tokenCss.concat(tokenCss).join("\n")}
|
|
4919
4928
|
}`;
|
|
4920
4929
|
};
|
|
4930
|
+
const getStatefulPropertiesFromSearchParams = (properties, searchParams) => {
|
|
4931
|
+
const newProperties = structuredClone(properties);
|
|
4932
|
+
newProperties.forEach((property) => {
|
|
4933
|
+
if (searchParams.has(property.key)) {
|
|
4934
|
+
const newValue = searchParams.get(property.key);
|
|
4935
|
+
if (!newValue)
|
|
4936
|
+
return;
|
|
4937
|
+
property.value = newValue.includes(",") ? newValue.split(",") : newValue;
|
|
4938
|
+
}
|
|
4939
|
+
});
|
|
4940
|
+
return newProperties;
|
|
4941
|
+
};
|
|
4921
4942
|
const FILTER_KEYS = [
|
|
4922
4943
|
"company_name",
|
|
4923
4944
|
"employment_type",
|
|
@@ -5012,4 +5033,5 @@ const jobSearchPlugin = () => {
|
|
|
5012
5033
|
};
|
|
5013
5034
|
exports.FILTER_KEYS = FILTER_KEYS;
|
|
5014
5035
|
exports.createJobSearchDomManager = createJobSearchDomManager;
|
|
5036
|
+
exports.getStatefulPropertiesFromSearchParams = getStatefulPropertiesFromSearchParams;
|
|
5015
5037
|
exports.jobSearchPlugin = jobSearchPlugin;
|
|
@@ -4397,14 +4397,15 @@ const JobCardLogo = ({
|
|
|
4397
4397
|
};
|
|
4398
4398
|
const asArray = (value) => Array.isArray(value) ? value : [value];
|
|
4399
4399
|
const JobCard = ({ job, config }) => {
|
|
4400
|
-
var _a;
|
|
4400
|
+
var _a, _b;
|
|
4401
4401
|
const subheading = config.subheading ? getDisplayableProperty({ job, property: config.subheading }) : null;
|
|
4402
4402
|
const tags = config.infoTags.flatMap((infoTag) => asArray(getDisplayableProperty({ job, property: infoTag }))).filter(Boolean);
|
|
4403
4403
|
const salary = asArray(
|
|
4404
4404
|
((_a = config.overrides) == null ? void 0 : _a.salary) ? getDisplayableProperty({ job, property: config.overrides.salary }) : job.pay
|
|
4405
4405
|
).filter(Boolean);
|
|
4406
4406
|
const postedDateConfig = config.postedDate ?? "show";
|
|
4407
|
-
|
|
4407
|
+
const href = ((_b = config.overrides) == null ? void 0 : _b.baseUrl) ? config.overrides.baseUrl(job.id.toString()) : job.href;
|
|
4408
|
+
return /* @__PURE__ */ u$1("a", { href, target: config.openJob === "redirect-new-tab" ? "_blank" : void 0, class: wrapperClass(), children: [
|
|
4408
4409
|
/* @__PURE__ */ u$1("div", { class: "flex min-w-0 flex-1 flex-col gap-4", children: [
|
|
4409
4410
|
/* @__PURE__ */ u$1("div", { class: "gap-logo flex items-center", children: [
|
|
4410
4411
|
/* @__PURE__ */ u$1(JobCardLogo, { job, config: config.logo }),
|
|
@@ -4593,13 +4594,21 @@ const ResultsPage = ({
|
|
|
4593
4594
|
};
|
|
4594
4595
|
const getFilterDefaults = (properties) => properties.reduce(
|
|
4595
4596
|
(acc, property) => {
|
|
4597
|
+
var _a;
|
|
4596
4598
|
switch (property.select) {
|
|
4597
|
-
case "one":
|
|
4598
|
-
|
|
4599
|
+
case "one": {
|
|
4600
|
+
const value = typeof property.value === "string" ? property.value : (_a = property.value) == null ? void 0 : _a[0];
|
|
4601
|
+
acc[property.key] = { select: property.select, value };
|
|
4599
4602
|
break;
|
|
4600
|
-
|
|
4601
|
-
|
|
4603
|
+
}
|
|
4604
|
+
case "many": {
|
|
4605
|
+
const value = typeof property.value === "string" ? [property.value] : Array.isArray(property.value) ? property.value : [];
|
|
4606
|
+
acc[property.key] = {
|
|
4607
|
+
select: property.select,
|
|
4608
|
+
value
|
|
4609
|
+
};
|
|
4602
4610
|
break;
|
|
4611
|
+
}
|
|
4603
4612
|
default:
|
|
4604
4613
|
exhaustive(property.select);
|
|
4605
4614
|
}
|
|
@@ -4916,6 +4925,18 @@ const generateColorThemeCss = (theme) => {
|
|
|
4916
4925
|
${tokenCss.concat(tokenCss).join("\n")}
|
|
4917
4926
|
}`;
|
|
4918
4927
|
};
|
|
4928
|
+
const getStatefulPropertiesFromSearchParams = (properties, searchParams) => {
|
|
4929
|
+
const newProperties = structuredClone(properties);
|
|
4930
|
+
newProperties.forEach((property) => {
|
|
4931
|
+
if (searchParams.has(property.key)) {
|
|
4932
|
+
const newValue = searchParams.get(property.key);
|
|
4933
|
+
if (!newValue)
|
|
4934
|
+
return;
|
|
4935
|
+
property.value = newValue.includes(",") ? newValue.split(",") : newValue;
|
|
4936
|
+
}
|
|
4937
|
+
});
|
|
4938
|
+
return newProperties;
|
|
4939
|
+
};
|
|
4919
4940
|
const FILTER_KEYS = [
|
|
4920
4941
|
"company_name",
|
|
4921
4942
|
"employment_type",
|
|
@@ -5011,5 +5032,6 @@ const jobSearchPlugin = () => {
|
|
|
5011
5032
|
export {
|
|
5012
5033
|
FILTER_KEYS,
|
|
5013
5034
|
createJobSearchDomManager,
|
|
5035
|
+
getStatefulPropertiesFromSearchParams,
|
|
5014
5036
|
jobSearchPlugin
|
|
5015
5037
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inploi/plugin-job-search",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/plugin-job-search.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"vite": "^4.5.3",
|
|
46
46
|
"vite-plugin-dts": "^3.9.1",
|
|
47
47
|
"vite-tsconfig-paths": "^4.3.2",
|
|
48
|
-
"@inploi/core": "1.14.
|
|
48
|
+
"@inploi/core": "1.14.1",
|
|
49
49
|
"@inploi/design-tokens": "0.2.1",
|
|
50
50
|
"@inploi/plugin-job-alerts": "0.2.0",
|
|
51
51
|
"@inploi/sdk": "1.13.2",
|