@inploi/plugin-job-alerts 5.1.0 → 5.2.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,7 +1,9 @@
1
1
  import { JobAlertsTranslationTerms } from './job-alerts.terms';
2
+ import { JobAlertsFilters } from './lib/rpc';
2
3
 
3
4
  export { defaultTerms } from './job-alerts.terms';
4
5
  export type { JobAlertsTranslationTerms } from './job-alerts.terms';
6
+ export type { JobAlertsFilters } from './lib/rpc';
5
7
  export type JobAlertsConfig = {
6
8
  /** Button label */
7
9
  label: string;
@@ -23,7 +25,7 @@ export type JobAlertsPluginParams = {
23
25
  };
24
26
  };
25
27
  config: JobAlertsConfig;
26
- initialFilters: Record<string, string | string[]>;
28
+ initialFilters: JobAlertsFilters;
27
29
  terms?: JobAlertsTranslationTerms;
28
30
  };
29
31
  export declare const createJobAlertsDomManager: () => {
@@ -48,7 +50,16 @@ export declare const jobAlertsPlugin: () => ({ rpcClient, logger, analytics }: {
48
50
  }>;
49
51
  /** Renders the Job Alerts Plugin inside the container element. */
50
52
  render: (params: JobAlertsPluginParams) => Promise<void>;
51
- setFilters: (newFilters: Record<string, string | string[]>) => Record<string, string | string[]>;
53
+ setFilters: (newFilters: JobAlertsFilters) => {
54
+ [x: string]: string | string[] | {
55
+ type: "provided";
56
+ lat: number;
57
+ lng: number;
58
+ radius: number;
59
+ unit?: "miles" | "km" | undefined;
60
+ label?: string | undefined;
61
+ };
62
+ };
52
63
  setConfig: (newConfig: JobAlertsConfig | ((oldConfig: JobAlertsConfig) => JobAlertsConfig)) => JobAlertsConfig;
53
64
  '~brand': "@inploi/plugin-job-alerts";
54
65
  };
@@ -11009,6 +11009,51 @@ function array(item, message2) {
11009
11009
  };
11010
11010
  }
11011
11011
  // @__NO_SIDE_EFFECTS__
11012
+ function literal(literal_, message2) {
11013
+ return {
11014
+ kind: "schema",
11015
+ type: "literal",
11016
+ reference: literal,
11017
+ expects: /* @__PURE__ */ _stringify(literal_),
11018
+ async: false,
11019
+ literal: literal_,
11020
+ message: message2,
11021
+ get "~standard"() {
11022
+ return /* @__PURE__ */ _getStandardProps(this);
11023
+ },
11024
+ "~run"(dataset, config2) {
11025
+ if (dataset.value === this.literal) {
11026
+ dataset.typed = true;
11027
+ } else {
11028
+ _addIssue(this, "type", dataset, config2);
11029
+ }
11030
+ return dataset;
11031
+ }
11032
+ };
11033
+ }
11034
+ // @__NO_SIDE_EFFECTS__
11035
+ function number(message2) {
11036
+ return {
11037
+ kind: "schema",
11038
+ type: "number",
11039
+ reference: number,
11040
+ expects: "number",
11041
+ async: false,
11042
+ message: message2,
11043
+ get "~standard"() {
11044
+ return /* @__PURE__ */ _getStandardProps(this);
11045
+ },
11046
+ "~run"(dataset, config2) {
11047
+ if (typeof dataset.value === "number" && !isNaN(dataset.value)) {
11048
+ dataset.typed = true;
11049
+ } else {
11050
+ _addIssue(this, "type", dataset, config2);
11051
+ }
11052
+ return dataset;
11053
+ }
11054
+ };
11055
+ }
11056
+ // @__NO_SIDE_EFFECTS__
11012
11057
  function object(entries2, message2) {
11013
11058
  return {
11014
11059
  kind: "schema",
@@ -11353,6 +11398,21 @@ function pipe(...pipe2) {
11353
11398
  }
11354
11399
  };
11355
11400
  }
11401
+ const alertFiltersSchema = /* @__PURE__ */ record(
11402
+ /* @__PURE__ */ string(),
11403
+ /* @__PURE__ */ union([
11404
+ /* @__PURE__ */ string(),
11405
+ /* @__PURE__ */ array(/* @__PURE__ */ string()),
11406
+ /* @__PURE__ */ object({
11407
+ type: /* @__PURE__ */ literal("provided"),
11408
+ lat: /* @__PURE__ */ number(),
11409
+ lng: /* @__PURE__ */ number(),
11410
+ radius: /* @__PURE__ */ number(),
11411
+ unit: /* @__PURE__ */ optional(/* @__PURE__ */ picklist(["miles", "km"])),
11412
+ label: /* @__PURE__ */ optional(/* @__PURE__ */ string())
11413
+ })
11414
+ ])
11415
+ );
11356
11416
  const saveSearchEndpoint = sdk.endpoint({
11357
11417
  pathname: "/search/save",
11358
11418
  method: "POST",
@@ -11365,7 +11425,7 @@ const saveSearchEndpoint = sdk.endpoint({
11365
11425
  last_name: /* @__PURE__ */ optional(/* @__PURE__ */ string())
11366
11426
  }),
11367
11427
  alerts: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ string(), /* @__PURE__ */ picklist(FREQUENCIES)),
11368
- filters: /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ array(/* @__PURE__ */ string())]))
11428
+ filters: alertFiltersSchema
11369
11429
  })
11370
11430
  }
11371
11431
  });
@@ -11007,6 +11007,51 @@ function array(item, message2) {
11007
11007
  };
11008
11008
  }
11009
11009
  // @__NO_SIDE_EFFECTS__
11010
+ function literal(literal_, message2) {
11011
+ return {
11012
+ kind: "schema",
11013
+ type: "literal",
11014
+ reference: literal,
11015
+ expects: /* @__PURE__ */ _stringify(literal_),
11016
+ async: false,
11017
+ literal: literal_,
11018
+ message: message2,
11019
+ get "~standard"() {
11020
+ return /* @__PURE__ */ _getStandardProps(this);
11021
+ },
11022
+ "~run"(dataset, config2) {
11023
+ if (dataset.value === this.literal) {
11024
+ dataset.typed = true;
11025
+ } else {
11026
+ _addIssue(this, "type", dataset, config2);
11027
+ }
11028
+ return dataset;
11029
+ }
11030
+ };
11031
+ }
11032
+ // @__NO_SIDE_EFFECTS__
11033
+ function number(message2) {
11034
+ return {
11035
+ kind: "schema",
11036
+ type: "number",
11037
+ reference: number,
11038
+ expects: "number",
11039
+ async: false,
11040
+ message: message2,
11041
+ get "~standard"() {
11042
+ return /* @__PURE__ */ _getStandardProps(this);
11043
+ },
11044
+ "~run"(dataset, config2) {
11045
+ if (typeof dataset.value === "number" && !isNaN(dataset.value)) {
11046
+ dataset.typed = true;
11047
+ } else {
11048
+ _addIssue(this, "type", dataset, config2);
11049
+ }
11050
+ return dataset;
11051
+ }
11052
+ };
11053
+ }
11054
+ // @__NO_SIDE_EFFECTS__
11010
11055
  function object(entries2, message2) {
11011
11056
  return {
11012
11057
  kind: "schema",
@@ -11351,6 +11396,21 @@ function pipe(...pipe2) {
11351
11396
  }
11352
11397
  };
11353
11398
  }
11399
+ const alertFiltersSchema = /* @__PURE__ */ record(
11400
+ /* @__PURE__ */ string(),
11401
+ /* @__PURE__ */ union([
11402
+ /* @__PURE__ */ string(),
11403
+ /* @__PURE__ */ array(/* @__PURE__ */ string()),
11404
+ /* @__PURE__ */ object({
11405
+ type: /* @__PURE__ */ literal("provided"),
11406
+ lat: /* @__PURE__ */ number(),
11407
+ lng: /* @__PURE__ */ number(),
11408
+ radius: /* @__PURE__ */ number(),
11409
+ unit: /* @__PURE__ */ optional(/* @__PURE__ */ picklist(["miles", "km"])),
11410
+ label: /* @__PURE__ */ optional(/* @__PURE__ */ string())
11411
+ })
11412
+ ])
11413
+ );
11354
11414
  const saveSearchEndpoint = endpoint({
11355
11415
  pathname: "/search/save",
11356
11416
  method: "POST",
@@ -11363,7 +11423,7 @@ const saveSearchEndpoint = endpoint({
11363
11423
  last_name: /* @__PURE__ */ optional(/* @__PURE__ */ string())
11364
11424
  }),
11365
11425
  alerts: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ string(), /* @__PURE__ */ picklist(FREQUENCIES)),
11366
- filters: /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ array(/* @__PURE__ */ string())]))
11426
+ filters: alertFiltersSchema
11367
11427
  })
11368
11428
  }
11369
11429
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-job-alerts",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "type": "module",
5
5
  "main": "dist/plugin-job-alerts.js",
6
6
  "types": "dist/index.d.ts",