@inploi/plugin-job-alerts 0.3.1 → 1.0.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.
@@ -1816,9 +1816,9 @@ function $d3863c46a17e8a28$var$createFocusScopesStack() {
1816
1816
  }
1817
1817
  };
1818
1818
  }
1819
- function $d3863c46a17e8a28$var$arrayRemove(array, item) {
1819
+ function $d3863c46a17e8a28$var$arrayRemove(array2, item) {
1820
1820
  const updatedArray = [
1821
- ...array
1821
+ ...array2
1822
1822
  ];
1823
1823
  const index2 = updatedArray.indexOf(item);
1824
1824
  if (index2 !== -1)
@@ -4119,21 +4119,25 @@ var applyAttributeToOthers = function(originalTarget, parentNode, markerName, co
4119
4119
  if (elementsToKeep.has(node)) {
4120
4120
  deep(node);
4121
4121
  } else {
4122
- var attr = node.getAttribute(controlAttribute);
4123
- var alreadyHidden = attr !== null && attr !== "false";
4124
- var counterValue = (counterMap.get(node) || 0) + 1;
4125
- var markerValue = (markerCounter.get(node) || 0) + 1;
4126
- counterMap.set(node, counterValue);
4127
- markerCounter.set(node, markerValue);
4128
- hiddenNodes.push(node);
4129
- if (counterValue === 1 && alreadyHidden) {
4130
- uncontrolledNodes.set(node, true);
4131
- }
4132
- if (markerValue === 1) {
4133
- node.setAttribute(markerName, "true");
4134
- }
4135
- if (!alreadyHidden) {
4136
- node.setAttribute(controlAttribute, "true");
4122
+ try {
4123
+ var attr = node.getAttribute(controlAttribute);
4124
+ var alreadyHidden = attr !== null && attr !== "false";
4125
+ var counterValue = (counterMap.get(node) || 0) + 1;
4126
+ var markerValue = (markerCounter.get(node) || 0) + 1;
4127
+ counterMap.set(node, counterValue);
4128
+ markerCounter.set(node, markerValue);
4129
+ hiddenNodes.push(node);
4130
+ if (counterValue === 1 && alreadyHidden) {
4131
+ uncontrolledNodes.set(node, true);
4132
+ }
4133
+ if (markerValue === 1) {
4134
+ node.setAttribute(markerName, "true");
4135
+ }
4136
+ if (!alreadyHidden) {
4137
+ node.setAttribute(controlAttribute, "true");
4138
+ }
4139
+ } catch (e2) {
4140
+ console.error("aria-hidden: cannot operate on ", node, e2);
4137
4141
  }
4138
4142
  }
4139
4143
  });
@@ -4177,7 +4181,7 @@ var hideOthers = function(originalTarget, parentNode, markerName) {
4177
4181
  return null;
4178
4182
  };
4179
4183
  }
4180
- targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live]")));
4184
+ targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
4181
4185
  return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
4182
4186
  };
4183
4187
  var __assign = function() {
@@ -4256,12 +4260,34 @@ function useCallbackRef(initialValue, callback) {
4256
4260
  ref.callback = callback;
4257
4261
  return ref.facade;
4258
4262
  }
4263
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? y$1 : p$2;
4264
+ var currentValues = /* @__PURE__ */ new WeakMap();
4259
4265
  function useMergeRefs(refs, defaultValue) {
4260
- return useCallbackRef(defaultValue || null, function(newValue) {
4266
+ var callbackRef = useCallbackRef(defaultValue || null, function(newValue) {
4261
4267
  return refs.forEach(function(ref) {
4262
4268
  return assignRef(ref, newValue);
4263
4269
  });
4264
4270
  });
4271
+ useIsomorphicLayoutEffect(function() {
4272
+ var oldValue = currentValues.get(callbackRef);
4273
+ if (oldValue) {
4274
+ var prevRefs_1 = new Set(oldValue);
4275
+ var nextRefs_1 = new Set(refs);
4276
+ var current_1 = callbackRef.current;
4277
+ prevRefs_1.forEach(function(ref) {
4278
+ if (!nextRefs_1.has(ref)) {
4279
+ assignRef(ref, null);
4280
+ }
4281
+ });
4282
+ nextRefs_1.forEach(function(ref) {
4283
+ if (!prevRefs_1.has(ref)) {
4284
+ assignRef(ref, current_1);
4285
+ }
4286
+ });
4287
+ }
4288
+ currentValues.set(callbackRef, refs);
4289
+ }, [refs]);
4290
+ return callbackRef;
4265
4291
  }
4266
4292
  function ItoI(a2) {
4267
4293
  return a2;
@@ -4502,19 +4528,38 @@ var getGapWidth = function(gapMode) {
4502
4528
  };
4503
4529
  };
4504
4530
  var Style = styleSingleton();
4531
+ var lockAttribute = "data-scroll-locked";
4505
4532
  var getStyles = function(_a, allowRelative, gapMode, important) {
4506
4533
  var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
4507
4534
  if (gapMode === void 0) {
4508
4535
  gapMode = "margin";
4509
4536
  }
4510
- return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
4537
+ return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
4511
4538
  allowRelative && "position: relative ".concat(important, ";"),
4512
4539
  gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
4513
4540
  gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
4514
- ].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
4541
+ ].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
4515
4542
  };
4516
- var RemoveScrollBar = function(props) {
4517
- var noRelative = props.noRelative, noImportant = props.noImportant, _a = props.gapMode, gapMode = _a === void 0 ? "margin" : _a;
4543
+ var getCurrentUseCounter = function() {
4544
+ var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
4545
+ return isFinite(counter) ? counter : 0;
4546
+ };
4547
+ var useLockAttribute = function() {
4548
+ p$2(function() {
4549
+ document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
4550
+ return function() {
4551
+ var newCounter = getCurrentUseCounter() - 1;
4552
+ if (newCounter <= 0) {
4553
+ document.body.removeAttribute(lockAttribute);
4554
+ } else {
4555
+ document.body.setAttribute(lockAttribute, newCounter.toString());
4556
+ }
4557
+ };
4558
+ }, []);
4559
+ };
4560
+ var RemoveScrollBar = function(_a) {
4561
+ var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
4562
+ useLockAttribute();
4518
4563
  var gap = F$1(function() {
4519
4564
  return getGapWidth(gapMode);
4520
4565
  }, [gapMode]);
@@ -5016,6 +5061,80 @@ function clsx() {
5016
5061
  (e2 = arguments[f2]) && (t2 = r$1(e2)) && (n2 && (n2 += " "), n2 += t2);
5017
5062
  return n2;
5018
5063
  }
5064
+ const JOB_ALERTS_ELEMENT_ID = "inploi-job-alerts";
5065
+ const JOB_ALERTS_SCOPE_ELEMENT_ID = "ija";
5066
+ const FREQUENCIES = ["INSTANTLY", "DAILY", "WEEKLY", "MONTHLY"];
5067
+ var FALLBACK_PLURAL_ORDER = ["other", "few", "many", "two", "one", "zero"];
5068
+ var createTranslateFunction = ({
5069
+ terms,
5070
+ overrides,
5071
+ locale
5072
+ }) => {
5073
+ const cardinalRules = new Intl.PluralRules(locale);
5074
+ function t2(key, options) {
5075
+ const term = (overrides == null ? void 0 : overrides[key]) ?? terms[key];
5076
+ switch (typeof term) {
5077
+ case "string":
5078
+ return term.replace(/{{(\w+)}}/g, (_2, param) => {
5079
+ var _a;
5080
+ return ((_a = options == null ? void 0 : options[param]) == null ? void 0 : _a.toString()) ?? "";
5081
+ });
5082
+ case "object": {
5083
+ if (typeof (options == null ? void 0 : options.count) !== "number")
5084
+ throw new Error(`Missing count for translation key “${key.toString()}”`);
5085
+ let pluralRule = cardinalRules.select(options.count);
5086
+ if (pluralRule in term === false) {
5087
+ const fallbackRule = FALLBACK_PLURAL_ORDER.find((rule) => rule in term);
5088
+ if (!fallbackRule)
5089
+ throw new Error(`Missing plural rule for translation key “${key.toString()}”`);
5090
+ pluralRule = fallbackRule;
5091
+ }
5092
+ return term[pluralRule].replace(/{{(\w+)}}/g, (_2, param) => {
5093
+ var _a;
5094
+ return ((_a = options == null ? void 0 : options[param]) == null ? void 0 : _a.toString()) ?? "";
5095
+ });
5096
+ }
5097
+ default:
5098
+ throw new Error(`Invalid translation value in dictionary for key “${key.toString()}”.`);
5099
+ }
5100
+ }
5101
+ return t2;
5102
+ };
5103
+ var TranslationContext = G$1(null);
5104
+ var createTranslation = (defaultTerms) => {
5105
+ return {
5106
+ TranslationProvider: ({ terms, children, locale }) => {
5107
+ const t2 = F$1(() => {
5108
+ return createTranslateFunction({ locale, terms: defaultTerms, overrides: terms });
5109
+ }, [terms, locale]);
5110
+ return /* @__PURE__ */ o$2(TranslationContext.Provider, { value: { t: t2, locale }, children });
5111
+ },
5112
+ useTranslation: () => {
5113
+ const context = q$1(TranslationContext);
5114
+ if (context === null)
5115
+ throw new Error("Please wrap useTranslation in a TranslationProvider");
5116
+ return { t: context.t, locale: context.locale };
5117
+ },
5118
+ createTFunction: ({
5119
+ overrides,
5120
+ locale
5121
+ }) => createTranslateFunction({ terms: defaultTerms, overrides, locale })
5122
+ };
5123
+ };
5124
+ const { TranslationProvider, useTranslation, createTFunction } = createTranslation({
5125
+ INSTANTLY: "Instantly",
5126
+ DAILY: "Daily",
5127
+ WEEKLY: "Weekly",
5128
+ MONTHLY: "Monthly",
5129
+ email: "Email",
5130
+ email_placeholder: "jane.doe@example.com",
5131
+ name: "Name",
5132
+ name_placeholder: "Jane Doe",
5133
+ save: "Save",
5134
+ save_alert: "Save Alert",
5135
+ frequency: "Frequency",
5136
+ create_alert: "Create Alert"
5137
+ });
5019
5138
  function i() {
5020
5139
  throw new Error("Cycle detected");
5021
5140
  }
@@ -5562,12 +5681,566 @@ function useSignal(n2) {
5562
5681
  return a(n2);
5563
5682
  }, []);
5564
5683
  }
5565
- const store = {
5684
+ const store$1 = {
5566
5685
  config$: a({ headerText: "", label: "" }),
5567
5686
  filters$: a({})
5568
5687
  };
5569
- const JOB_ALERTS_ELEMENT_ID = "inploi-job-alerts";
5570
- const JOB_ALERTS_SCOPE_ELEMENT_ID = "ija";
5688
+ var store;
5689
+ // @__NO_SIDE_EFFECTS__
5690
+ function getGlobalConfig(config2) {
5691
+ return {
5692
+ lang: (config2 == null ? void 0 : config2.lang) ?? (store == null ? void 0 : store.lang),
5693
+ message: config2 == null ? void 0 : config2.message,
5694
+ abortEarly: (config2 == null ? void 0 : config2.abortEarly) ?? (store == null ? void 0 : store.abortEarly),
5695
+ abortPipeEarly: (config2 == null ? void 0 : config2.abortPipeEarly) ?? (store == null ? void 0 : store.abortPipeEarly)
5696
+ };
5697
+ }
5698
+ var store2;
5699
+ // @__NO_SIDE_EFFECTS__
5700
+ function getGlobalMessage(lang) {
5701
+ return store2 == null ? void 0 : store2.get(lang);
5702
+ }
5703
+ var store3;
5704
+ // @__NO_SIDE_EFFECTS__
5705
+ function getSchemaMessage(lang) {
5706
+ return store3 == null ? void 0 : store3.get(lang);
5707
+ }
5708
+ var store4;
5709
+ // @__NO_SIDE_EFFECTS__
5710
+ function getSpecificMessage(reference, lang) {
5711
+ var _a;
5712
+ return (_a = store4 == null ? void 0 : store4.get(reference)) == null ? void 0 : _a.get(lang);
5713
+ }
5714
+ // @__NO_SIDE_EFFECTS__
5715
+ function _stringify(input) {
5716
+ var _a, _b;
5717
+ const type = typeof input;
5718
+ if (type === "string") {
5719
+ return `"${input}"`;
5720
+ }
5721
+ if (type === "number" || type === "bigint" || type === "boolean") {
5722
+ return `${input}`;
5723
+ }
5724
+ if (type === "object" || type === "function") {
5725
+ return (input && ((_b = (_a = Object.getPrototypeOf(input)) == null ? void 0 : _a.constructor) == null ? void 0 : _b.name)) ?? "null";
5726
+ }
5727
+ return type;
5728
+ }
5729
+ function _addIssue(context, label, dataset, config2, other) {
5730
+ const input = other && "input" in other ? other.input : dataset.value;
5731
+ const expected = (other == null ? void 0 : other.expected) ?? context.expects ?? null;
5732
+ const received = (other == null ? void 0 : other.received) ?? /* @__PURE__ */ _stringify(input);
5733
+ const issue = {
5734
+ kind: context.kind,
5735
+ type: context.type,
5736
+ input,
5737
+ expected,
5738
+ received,
5739
+ message: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : "R"}eceived ${received}`,
5740
+ requirement: context.requirement,
5741
+ path: other == null ? void 0 : other.path,
5742
+ issues: other == null ? void 0 : other.issues,
5743
+ lang: config2.lang,
5744
+ abortEarly: config2.abortEarly,
5745
+ abortPipeEarly: config2.abortPipeEarly
5746
+ };
5747
+ const isSchema = context.kind === "schema";
5748
+ const message2 = (other == null ? void 0 : other.message) ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config2.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);
5749
+ if (message2 !== void 0) {
5750
+ issue.message = typeof message2 === "function" ? (
5751
+ // @ts-expect-error
5752
+ message2(issue)
5753
+ ) : message2;
5754
+ }
5755
+ if (isSchema) {
5756
+ dataset.typed = false;
5757
+ }
5758
+ if (dataset.issues) {
5759
+ dataset.issues.push(issue);
5760
+ } else {
5761
+ dataset.issues = [issue];
5762
+ }
5763
+ }
5764
+ // @__NO_SIDE_EFFECTS__
5765
+ function _getStandardProps(context) {
5766
+ return {
5767
+ version: 1,
5768
+ vendor: "valibot",
5769
+ validate(value2) {
5770
+ return context["~run"]({ value: value2 }, /* @__PURE__ */ getGlobalConfig());
5771
+ }
5772
+ };
5773
+ }
5774
+ // @__NO_SIDE_EFFECTS__
5775
+ function _isValidObjectKey(object2, key) {
5776
+ return Object.hasOwn(object2, key) && key !== "__proto__" && key !== "prototype" && key !== "constructor";
5777
+ }
5778
+ // @__NO_SIDE_EFFECTS__
5779
+ function _joinExpects(values2, separator) {
5780
+ const list = [...new Set(values2)];
5781
+ if (list.length > 1) {
5782
+ return `(${list.join(` ${separator} `)})`;
5783
+ }
5784
+ return list[0] ?? "never";
5785
+ }
5786
+ var EMAIL_REGEX = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;
5787
+ // @__NO_SIDE_EFFECTS__
5788
+ function email(message2) {
5789
+ return {
5790
+ kind: "validation",
5791
+ type: "email",
5792
+ reference: email,
5793
+ expects: null,
5794
+ async: false,
5795
+ requirement: EMAIL_REGEX,
5796
+ message: message2,
5797
+ "~run"(dataset, config2) {
5798
+ if (dataset.typed && !this.requirement.test(dataset.value)) {
5799
+ _addIssue(this, "email", dataset, config2);
5800
+ }
5801
+ return dataset;
5802
+ }
5803
+ };
5804
+ }
5805
+ // @__NO_SIDE_EFFECTS__
5806
+ function getFallback(schema, dataset, config2) {
5807
+ return typeof schema.fallback === "function" ? (
5808
+ // @ts-expect-error
5809
+ schema.fallback(dataset, config2)
5810
+ ) : (
5811
+ // @ts-expect-error
5812
+ schema.fallback
5813
+ );
5814
+ }
5815
+ // @__NO_SIDE_EFFECTS__
5816
+ function getDefault(schema, dataset, config2) {
5817
+ return typeof schema.default === "function" ? (
5818
+ // @ts-expect-error
5819
+ schema.default(dataset, config2)
5820
+ ) : (
5821
+ // @ts-expect-error
5822
+ schema.default
5823
+ );
5824
+ }
5825
+ // @__NO_SIDE_EFFECTS__
5826
+ function array(item, message2) {
5827
+ return {
5828
+ kind: "schema",
5829
+ type: "array",
5830
+ reference: array,
5831
+ expects: "Array",
5832
+ async: false,
5833
+ item,
5834
+ message: message2,
5835
+ get "~standard"() {
5836
+ return /* @__PURE__ */ _getStandardProps(this);
5837
+ },
5838
+ "~run"(dataset, config2) {
5839
+ var _a;
5840
+ const input = dataset.value;
5841
+ if (Array.isArray(input)) {
5842
+ dataset.typed = true;
5843
+ dataset.value = [];
5844
+ for (let key = 0; key < input.length; key++) {
5845
+ const value2 = input[key];
5846
+ const itemDataset = this.item["~run"]({ value: value2 }, config2);
5847
+ if (itemDataset.issues) {
5848
+ const pathItem = {
5849
+ type: "array",
5850
+ origin: "value",
5851
+ input,
5852
+ key,
5853
+ value: value2
5854
+ };
5855
+ for (const issue of itemDataset.issues) {
5856
+ if (issue.path) {
5857
+ issue.path.unshift(pathItem);
5858
+ } else {
5859
+ issue.path = [pathItem];
5860
+ }
5861
+ (_a = dataset.issues) == null ? void 0 : _a.push(issue);
5862
+ }
5863
+ if (!dataset.issues) {
5864
+ dataset.issues = itemDataset.issues;
5865
+ }
5866
+ if (config2.abortEarly) {
5867
+ dataset.typed = false;
5868
+ break;
5869
+ }
5870
+ }
5871
+ if (!itemDataset.typed) {
5872
+ dataset.typed = false;
5873
+ }
5874
+ dataset.value.push(itemDataset.value);
5875
+ }
5876
+ } else {
5877
+ _addIssue(this, "type", dataset, config2);
5878
+ }
5879
+ return dataset;
5880
+ }
5881
+ };
5882
+ }
5883
+ // @__NO_SIDE_EFFECTS__
5884
+ function object(entries2, message2) {
5885
+ return {
5886
+ kind: "schema",
5887
+ type: "object",
5888
+ reference: object,
5889
+ expects: "Object",
5890
+ async: false,
5891
+ entries: entries2,
5892
+ message: message2,
5893
+ get "~standard"() {
5894
+ return /* @__PURE__ */ _getStandardProps(this);
5895
+ },
5896
+ "~run"(dataset, config2) {
5897
+ var _a;
5898
+ const input = dataset.value;
5899
+ if (input && typeof input === "object") {
5900
+ dataset.typed = true;
5901
+ dataset.value = {};
5902
+ for (const key in this.entries) {
5903
+ const valueSchema = this.entries[key];
5904
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && // @ts-expect-error
5905
+ valueSchema.default !== void 0) {
5906
+ const value2 = key in input ? (
5907
+ // @ts-expect-error
5908
+ input[key]
5909
+ ) : /* @__PURE__ */ getDefault(valueSchema);
5910
+ const valueDataset = valueSchema["~run"]({ value: value2 }, config2);
5911
+ if (valueDataset.issues) {
5912
+ const pathItem = {
5913
+ type: "object",
5914
+ origin: "value",
5915
+ input,
5916
+ key,
5917
+ value: value2
5918
+ };
5919
+ for (const issue of valueDataset.issues) {
5920
+ if (issue.path) {
5921
+ issue.path.unshift(pathItem);
5922
+ } else {
5923
+ issue.path = [pathItem];
5924
+ }
5925
+ (_a = dataset.issues) == null ? void 0 : _a.push(issue);
5926
+ }
5927
+ if (!dataset.issues) {
5928
+ dataset.issues = valueDataset.issues;
5929
+ }
5930
+ if (config2.abortEarly) {
5931
+ dataset.typed = false;
5932
+ break;
5933
+ }
5934
+ }
5935
+ if (!valueDataset.typed) {
5936
+ dataset.typed = false;
5937
+ }
5938
+ dataset.value[key] = valueDataset.value;
5939
+ } else if (valueSchema.fallback !== void 0) {
5940
+ dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);
5941
+ } else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish") {
5942
+ _addIssue(this, "key", dataset, config2, {
5943
+ input: void 0,
5944
+ expected: `"${key}"`,
5945
+ path: [
5946
+ {
5947
+ type: "object",
5948
+ origin: "key",
5949
+ input,
5950
+ key,
5951
+ // @ts-expect-error
5952
+ value: input[key]
5953
+ }
5954
+ ]
5955
+ });
5956
+ if (config2.abortEarly) {
5957
+ break;
5958
+ }
5959
+ }
5960
+ }
5961
+ } else {
5962
+ _addIssue(this, "type", dataset, config2);
5963
+ }
5964
+ return dataset;
5965
+ }
5966
+ };
5967
+ }
5968
+ // @__NO_SIDE_EFFECTS__
5969
+ function optional(wrapped, default_) {
5970
+ return {
5971
+ kind: "schema",
5972
+ type: "optional",
5973
+ reference: optional,
5974
+ expects: `(${wrapped.expects} | undefined)`,
5975
+ async: false,
5976
+ wrapped,
5977
+ default: default_,
5978
+ get "~standard"() {
5979
+ return /* @__PURE__ */ _getStandardProps(this);
5980
+ },
5981
+ "~run"(dataset, config2) {
5982
+ if (dataset.value === void 0) {
5983
+ if (this.default !== void 0) {
5984
+ dataset.value = /* @__PURE__ */ getDefault(this, dataset, config2);
5985
+ }
5986
+ if (dataset.value === void 0) {
5987
+ dataset.typed = true;
5988
+ return dataset;
5989
+ }
5990
+ }
5991
+ return this.wrapped["~run"](dataset, config2);
5992
+ }
5993
+ };
5994
+ }
5995
+ // @__NO_SIDE_EFFECTS__
5996
+ function picklist(options, message2) {
5997
+ return {
5998
+ kind: "schema",
5999
+ type: "picklist",
6000
+ reference: picklist,
6001
+ expects: /* @__PURE__ */ _joinExpects(options.map(_stringify), "|"),
6002
+ async: false,
6003
+ options,
6004
+ message: message2,
6005
+ get "~standard"() {
6006
+ return /* @__PURE__ */ _getStandardProps(this);
6007
+ },
6008
+ "~run"(dataset, config2) {
6009
+ if (this.options.includes(dataset.value)) {
6010
+ dataset.typed = true;
6011
+ } else {
6012
+ _addIssue(this, "type", dataset, config2);
6013
+ }
6014
+ return dataset;
6015
+ }
6016
+ };
6017
+ }
6018
+ // @__NO_SIDE_EFFECTS__
6019
+ function record(key, value2, message2) {
6020
+ return {
6021
+ kind: "schema",
6022
+ type: "record",
6023
+ reference: record,
6024
+ expects: "Object",
6025
+ async: false,
6026
+ key,
6027
+ value: value2,
6028
+ message: message2,
6029
+ get "~standard"() {
6030
+ return /* @__PURE__ */ _getStandardProps(this);
6031
+ },
6032
+ "~run"(dataset, config2) {
6033
+ var _a, _b;
6034
+ const input = dataset.value;
6035
+ if (input && typeof input === "object") {
6036
+ dataset.typed = true;
6037
+ dataset.value = {};
6038
+ for (const entryKey in input) {
6039
+ if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {
6040
+ const entryValue = input[entryKey];
6041
+ const keyDataset = this.key["~run"]({ value: entryKey }, config2);
6042
+ if (keyDataset.issues) {
6043
+ const pathItem = {
6044
+ type: "object",
6045
+ origin: "key",
6046
+ input,
6047
+ key: entryKey,
6048
+ value: entryValue
6049
+ };
6050
+ for (const issue of keyDataset.issues) {
6051
+ issue.path = [pathItem];
6052
+ (_a = dataset.issues) == null ? void 0 : _a.push(issue);
6053
+ }
6054
+ if (!dataset.issues) {
6055
+ dataset.issues = keyDataset.issues;
6056
+ }
6057
+ if (config2.abortEarly) {
6058
+ dataset.typed = false;
6059
+ break;
6060
+ }
6061
+ }
6062
+ const valueDataset = this.value["~run"](
6063
+ { value: entryValue },
6064
+ config2
6065
+ );
6066
+ if (valueDataset.issues) {
6067
+ const pathItem = {
6068
+ type: "object",
6069
+ origin: "value",
6070
+ input,
6071
+ key: entryKey,
6072
+ value: entryValue
6073
+ };
6074
+ for (const issue of valueDataset.issues) {
6075
+ if (issue.path) {
6076
+ issue.path.unshift(pathItem);
6077
+ } else {
6078
+ issue.path = [pathItem];
6079
+ }
6080
+ (_b = dataset.issues) == null ? void 0 : _b.push(issue);
6081
+ }
6082
+ if (!dataset.issues) {
6083
+ dataset.issues = valueDataset.issues;
6084
+ }
6085
+ if (config2.abortEarly) {
6086
+ dataset.typed = false;
6087
+ break;
6088
+ }
6089
+ }
6090
+ if (!keyDataset.typed || !valueDataset.typed) {
6091
+ dataset.typed = false;
6092
+ }
6093
+ if (keyDataset.typed) {
6094
+ dataset.value[keyDataset.value] = valueDataset.value;
6095
+ }
6096
+ }
6097
+ }
6098
+ } else {
6099
+ _addIssue(this, "type", dataset, config2);
6100
+ }
6101
+ return dataset;
6102
+ }
6103
+ };
6104
+ }
6105
+ // @__NO_SIDE_EFFECTS__
6106
+ function string(message2) {
6107
+ return {
6108
+ kind: "schema",
6109
+ type: "string",
6110
+ reference: string,
6111
+ expects: "string",
6112
+ async: false,
6113
+ message: message2,
6114
+ get "~standard"() {
6115
+ return /* @__PURE__ */ _getStandardProps(this);
6116
+ },
6117
+ "~run"(dataset, config2) {
6118
+ if (typeof dataset.value === "string") {
6119
+ dataset.typed = true;
6120
+ } else {
6121
+ _addIssue(this, "type", dataset, config2);
6122
+ }
6123
+ return dataset;
6124
+ }
6125
+ };
6126
+ }
6127
+ // @__NO_SIDE_EFFECTS__
6128
+ function _subIssues(datasets) {
6129
+ let issues;
6130
+ if (datasets) {
6131
+ for (const dataset of datasets) {
6132
+ if (issues) {
6133
+ issues.push(...dataset.issues);
6134
+ } else {
6135
+ issues = dataset.issues;
6136
+ }
6137
+ }
6138
+ }
6139
+ return issues;
6140
+ }
6141
+ // @__NO_SIDE_EFFECTS__
6142
+ function union(options, message2) {
6143
+ return {
6144
+ kind: "schema",
6145
+ type: "union",
6146
+ reference: union,
6147
+ expects: /* @__PURE__ */ _joinExpects(
6148
+ options.map((option) => option.expects),
6149
+ "|"
6150
+ ),
6151
+ async: false,
6152
+ options,
6153
+ message: message2,
6154
+ get "~standard"() {
6155
+ return /* @__PURE__ */ _getStandardProps(this);
6156
+ },
6157
+ "~run"(dataset, config2) {
6158
+ let validDataset;
6159
+ let typedDatasets;
6160
+ let untypedDatasets;
6161
+ for (const schema of this.options) {
6162
+ const optionDataset = schema["~run"]({ value: dataset.value }, config2);
6163
+ if (optionDataset.typed) {
6164
+ if (optionDataset.issues) {
6165
+ if (typedDatasets) {
6166
+ typedDatasets.push(optionDataset);
6167
+ } else {
6168
+ typedDatasets = [optionDataset];
6169
+ }
6170
+ } else {
6171
+ validDataset = optionDataset;
6172
+ break;
6173
+ }
6174
+ } else {
6175
+ if (untypedDatasets) {
6176
+ untypedDatasets.push(optionDataset);
6177
+ } else {
6178
+ untypedDatasets = [optionDataset];
6179
+ }
6180
+ }
6181
+ }
6182
+ if (validDataset) {
6183
+ return validDataset;
6184
+ }
6185
+ if (typedDatasets) {
6186
+ if (typedDatasets.length === 1) {
6187
+ return typedDatasets[0];
6188
+ }
6189
+ _addIssue(this, "type", dataset, config2, {
6190
+ issues: /* @__PURE__ */ _subIssues(typedDatasets)
6191
+ });
6192
+ dataset.typed = true;
6193
+ } else if ((untypedDatasets == null ? void 0 : untypedDatasets.length) === 1) {
6194
+ return untypedDatasets[0];
6195
+ } else {
6196
+ _addIssue(this, "type", dataset, config2, {
6197
+ issues: /* @__PURE__ */ _subIssues(untypedDatasets)
6198
+ });
6199
+ }
6200
+ return dataset;
6201
+ }
6202
+ };
6203
+ }
6204
+ // @__NO_SIDE_EFFECTS__
6205
+ function pipe(...pipe2) {
6206
+ return {
6207
+ ...pipe2[0],
6208
+ pipe: pipe2,
6209
+ get "~standard"() {
6210
+ return /* @__PURE__ */ _getStandardProps(this);
6211
+ },
6212
+ "~run"(dataset, config2) {
6213
+ for (const item of pipe2) {
6214
+ if (item.kind !== "metadata") {
6215
+ if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
6216
+ dataset.typed = false;
6217
+ break;
6218
+ }
6219
+ if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) {
6220
+ dataset = item["~run"](dataset, config2);
6221
+ }
6222
+ }
6223
+ }
6224
+ return dataset;
6225
+ }
6226
+ };
6227
+ }
6228
+ const saveSearchEndpoint = sdk.endpoint({
6229
+ pathname: "/search/save",
6230
+ method: "POST",
6231
+ schema: {
6232
+ response: sdk.typed(),
6233
+ body: /* @__PURE__ */ object({
6234
+ contact: /* @__PURE__ */ object({
6235
+ email: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ string(), /* @__PURE__ */ email()),
6236
+ first_name: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
6237
+ last_name: /* @__PURE__ */ optional(/* @__PURE__ */ string())
6238
+ }),
6239
+ alerts: /* @__PURE__ */ pipe(/* @__PURE__ */ optional(/* @__PURE__ */ string()), /* @__PURE__ */ string(), /* @__PURE__ */ picklist(FREQUENCIES)),
6240
+ filters: /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ union([/* @__PURE__ */ string(), /* @__PURE__ */ array(/* @__PURE__ */ string())]))
6241
+ })
6242
+ }
6243
+ });
5571
6244
  var COLOR_SHADES = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
5572
6245
  var OKLCH_PRESETS = {
5573
6246
  light: {
@@ -5778,17 +6451,18 @@ const JobAlertsButton = k(
5778
6451
  children: [
5779
6452
  /* @__PURE__ */ o$2(Icon, { class: "flex-none", name: "bell" }),
5780
6453
  " ",
5781
- /* @__PURE__ */ o$2("span", { class: "min-w-0 truncate text-center", children: store.config$.value.label })
6454
+ /* @__PURE__ */ o$2("span", { class: "min-w-0 truncate text-center", children: store$1.config$.value.label })
5782
6455
  ]
5783
6456
  }
5784
6457
  )
5785
6458
  );
5786
- const PopoverHeader = () => /* @__PURE__ */ o$2("p", { class: "text-neutral-11 px-2 pb-4 pt-1 text-sm", children: store.config$.value.headerText });
6459
+ const PopoverHeader = () => /* @__PURE__ */ o$2("p", { class: "text-neutral-11 px-2 pb-4 pt-1 text-sm", children: store$1.config$.value.headerText });
5787
6460
  function noop() {
5788
6461
  }
5789
- const JobAlerts = ({ theme, apiClient, logger }) => {
6462
+ const JobAlerts = ({ theme, rpcClient, logger }) => {
5790
6463
  const [formState, setFormState] = h("idle");
5791
6464
  const [error, setError] = h();
6465
+ const { t: t2 } = useTranslation();
5792
6466
  return /* @__PURE__ */ o$2("div", { id: "ija", children: /* @__PURE__ */ o$2("div", { class: getThemeVariants(theme).join(" "), children: /* @__PURE__ */ o$2($cb5cc270b50c6fcd$export$be92b6f5f03c0fe9, { children: [
5793
6467
  /* @__PURE__ */ o$2($cb5cc270b50c6fcd$export$41fb9f06171c75f4, { asChild: true, children: /* @__PURE__ */ o$2(JobAlertsButton, {}) }),
5794
6468
  /* @__PURE__ */ o$2($cb5cc270b50c6fcd$export$602eac185826482c, { children: /* @__PURE__ */ o$2("div", { id: "ija", children: /* @__PURE__ */ o$2("div", { class: clsx("absolute isolate z-50", getThemeVariants(theme).join(" ")), children: /* @__PURE__ */ o$2(
@@ -5815,17 +6489,16 @@ const JobAlerts = ({ theme, apiClient, logger }) => {
5815
6489
  await Promise.all([
5816
6490
  // waits for at least 1 second
5817
6491
  new Promise((resolve) => setTimeout(resolve, 1e3)),
5818
- apiClient.fetch("/search/save", {
5819
- method: "POST",
5820
- body: JSON.stringify({
6492
+ rpcClient.request(saveSearchEndpoint, {
6493
+ body: {
5821
6494
  contact: {
5822
6495
  email: (_b = formData.get("email")) == null ? void 0 : _b.toString(),
5823
6496
  first_name: firstName,
5824
6497
  last_name: lastName
5825
6498
  },
5826
6499
  alerts: (_c = formData.get("frequency")) == null ? void 0 : _c.toString(),
5827
- filters: store.filters$.peek()
5828
- })
6500
+ filters: store$1.filters$.peek()
6501
+ }
5829
6502
  })
5830
6503
  ]).then(async () => {
5831
6504
  setFormState("success");
@@ -5841,7 +6514,7 @@ const JobAlerts = ({ theme, apiClient, logger }) => {
5841
6514
  children: [
5842
6515
  /* @__PURE__ */ o$2("div", { children: [
5843
6516
  /* @__PURE__ */ o$2("fieldset", { class: "fieldset relative focus-within:z-10", children: [
5844
- /* @__PURE__ */ o$2("label", { class: "sr-only", htmlFor: "ija-email", children: "Email" }),
6517
+ /* @__PURE__ */ o$2("label", { class: "sr-only", htmlFor: "ija-email", children: t2("email") }),
5845
6518
  /* @__PURE__ */ o$2(
5846
6519
  "input",
5847
6520
  {
@@ -5850,14 +6523,14 @@ const JobAlerts = ({ theme, apiClient, logger }) => {
5850
6523
  class: inputClass,
5851
6524
  disabled: formState === "loading",
5852
6525
  id: "ija-email",
5853
- placeholder: "Email",
6526
+ placeholder: t2("email_placeholder"),
5854
6527
  type: "email",
5855
6528
  required: true
5856
6529
  }
5857
6530
  )
5858
6531
  ] }),
5859
6532
  /* @__PURE__ */ o$2("fieldset", { class: "fieldset relative focus-within:z-10", children: [
5860
- /* @__PURE__ */ o$2("label", { class: "sr-only", htmlFor: "ija-name", children: "Name" }),
6533
+ /* @__PURE__ */ o$2("label", { class: "sr-only", htmlFor: "ija-name", children: t2("name") }),
5861
6534
  /* @__PURE__ */ o$2(
5862
6535
  "input",
5863
6536
  {
@@ -5867,12 +6540,12 @@ const JobAlerts = ({ theme, apiClient, logger }) => {
5867
6540
  autocomplete: "name",
5868
6541
  class: inputClass,
5869
6542
  id: "ija-name",
5870
- placeholder: "Full Name"
6543
+ placeholder: t2("name_placeholder")
5871
6544
  }
5872
6545
  )
5873
6546
  ] }),
5874
6547
  /* @__PURE__ */ o$2("fieldset", { class: "fieldset relative focus-within:z-10", children: [
5875
- /* @__PURE__ */ o$2("label", { class: "sr-only", htmlFor: "ija-frequency", children: "Frequency" }),
6548
+ /* @__PURE__ */ o$2("label", { class: "sr-only", htmlFor: "ija-frequency", children: t2("frequency") }),
5876
6549
  /* @__PURE__ */ o$2(
5877
6550
  "select",
5878
6551
  {
@@ -5881,12 +6554,7 @@ const JobAlerts = ({ theme, apiClient, logger }) => {
5881
6554
  id: "ija-frequency",
5882
6555
  defaultValue: "WEEKLY",
5883
6556
  name: "frequency",
5884
- children: [
5885
- /* @__PURE__ */ o$2("option", { value: "INSTANTLY", children: "Instantly" }),
5886
- /* @__PURE__ */ o$2("option", { value: "DAILY", children: "Daily" }),
5887
- /* @__PURE__ */ o$2("option", { value: "WEEKLY", children: "Weekly" }),
5888
- /* @__PURE__ */ o$2("option", { value: "MONTHLY", children: "Monthly" })
5889
- ]
6557
+ children: FREQUENCIES.map((frequency) => /* @__PURE__ */ o$2("option", { value: frequency, children: t2(frequency) }))
5890
6558
  }
5891
6559
  ),
5892
6560
  /* @__PURE__ */ o$2("div", { class: "text-neutral-10 absolute bottom-0 right-0 top-0 flex items-center p-1", "aria-hidden": true, children: /* @__PURE__ */ o$2(Icon, { name: "chevron-up-down" }) })
@@ -5903,7 +6571,7 @@ const JobAlerts = ({ theme, apiClient, logger }) => {
5903
6571
  {
5904
6572
  "data-state": formState,
5905
6573
  class: "ease-expo-out duration-medium col-span-full row-span-full text-base opacity-0 transition-all data-[state=loading]:-translate-y-full data-[state=success]:translate-y-full data-[state=idle]:opacity-100",
5906
- children: "Create Alert"
6574
+ children: t2("create_alert")
5907
6575
  }
5908
6576
  ),
5909
6577
  /* @__PURE__ */ o$2(
@@ -5963,20 +6631,27 @@ const createJobAlertsDomManager = () => {
5963
6631
  };
5964
6632
  };
5965
6633
  const dom = createJobAlertsDomManager();
5966
- const jobAlertsPlugin = () => sdk.createPlugin(({ apiClient, logger, analytics }) => {
6634
+ const jobAlertsPlugin = () => sdk.createPlugin(({ rpcClient, logger, analytics }) => {
5967
6635
  let prerendered = false;
5968
6636
  const App = ({ params }) => {
5969
- return y$3(k$3, {}, [
6637
+ return y$3(
6638
+ TranslationProvider,
6639
+ {
6640
+ terms: params.terms,
6641
+ locale: void 0
6642
+ },
5970
6643
  [
5971
- y$3("style", { id: "inploi-job-alerts-styles" }, tailwind),
5972
- y$3("style", { id: "inploi-job-search-theme" }, generateColorThemeCss(params.theme))
5973
- ],
5974
- y$3(IconSpritesheet, { theme: params.theme }),
5975
- y$3(JobAlerts, { theme: params.theme, apiClient, logger, analytics })
5976
- ]);
6644
+ [
6645
+ y$3("style", { id: "inploi-job-alerts-styles" }, tailwind),
6646
+ y$3("style", { id: "inploi-job-search-theme" }, generateColorThemeCss(params.theme))
6647
+ ],
6648
+ y$3(IconSpritesheet, { theme: params.theme }),
6649
+ y$3(JobAlerts, { theme: params.theme, rpcClient, logger, analytics })
6650
+ ]
6651
+ );
5977
6652
  };
5978
- const setFilters = (newFilters) => store.filters$.value = newFilters;
5979
- const setConfig = (newConfig) => store.config$.value = typeof newConfig === "function" ? newConfig(store.config$.peek()) : newConfig;
6653
+ const setFilters = (newFilters) => store$1.filters$.value = newFilters;
6654
+ const setConfig = (newConfig) => store$1.config$.value = typeof newConfig === "function" ? newConfig(store$1.config$.peek()) : newConfig;
5980
6655
  return {
5981
6656
  /** Returns a string with the initial rendering state of the UI.
5982
6657
  * Useful when server-side rendering to avoid CLS.
@@ -6000,7 +6675,8 @@ const jobAlertsPlugin = () => sdk.createPlugin(({ apiClient, logger, analytics }
6000
6675
  fn2(y$3(App, { params }), dom.getRenderTargetElement());
6001
6676
  },
6002
6677
  setFilters,
6003
- setConfig
6678
+ setConfig,
6679
+ "~brand": "@inploi/plugin-job-alerts"
6004
6680
  };
6005
6681
  });
6006
6682
  exports.createJobAlertsDomManager = createJobAlertsDomManager;