@realtek/core-theme 0.0.297 → 0.0.298

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/dist-lib/index.js CHANGED
@@ -46808,38 +46808,17 @@ async function WP(e) {
46808
46808
  }).toString()}`);
46809
46809
  return t.data ?? t;
46810
46810
  }
46811
- async function GP(t) {
46812
- let n = p();
46813
- if (!n) {
46814
- let e = /* @__PURE__ */ Error("Authentication required");
46815
- throw e.status = 401, e;
46816
- }
46817
- let r = new FormData();
46818
- r.append("json", JSON.stringify(t));
46819
- let i = await fetch(`${e}/send-mail-client-doc`, {
46820
- method: "POST",
46821
- headers: { Authorization: `Bearer ${n}` },
46822
- body: r
46823
- });
46824
- i.status === 401 && m();
46825
- let a = await i.json().catch(() => ({}));
46826
- if (!i.ok || a?.status === !1) {
46827
- let e = Error(a?.message ?? a?.error ?? `API ${i.status}: ${i.statusText}`);
46828
- throw e.status = i.status, e;
46829
- }
46830
- return a.data ?? a;
46831
- }
46832
46811
  //#endregion
46833
46812
  //#region src/components/popups/definitions/manager-approve/ManagerApproveBody.jsx
46834
- function KP(...e) {
46813
+ function GP(...e) {
46835
46814
  return e.map((e) => e == null ? "" : String(e).trim()).find(Boolean) ?? "";
46836
46815
  }
46837
- var qP = (e, t) => !!e && e.toLowerCase() === KP(t).toLowerCase();
46838
- function JP(e, t, n) {
46839
- let r = KP(t.submittedBy);
46840
- return KP(qP(r, n) || qP(r, e.submitSource) || qP(r, e.supplierName) || qP(r, e.source) || qP(r, e.candidateSource) ? "" : r, e.signatureEmail);
46816
+ var KP = (e, t) => !!e && e.toLowerCase() === GP(t).toLowerCase();
46817
+ function qP(e, t, n) {
46818
+ let r = GP(t.submittedBy);
46819
+ return GP(KP(r, n) || KP(r, e.submitSource) || KP(r, e.supplierName) || KP(r, e.source) || KP(r, e.candidateSource) ? "" : r, e.signatureEmail);
46841
46820
  }
46842
- function YP(e, t = {}) {
46821
+ function JP(e, t = {}) {
46843
46822
  let n = t.employerName ?? e.supplierName ?? e.submitSource;
46844
46823
  return {
46845
46824
  client: t.clientName ?? e.clientName,
@@ -46848,15 +46827,46 @@ function YP(e, t = {}) {
46848
46827
  name: t.candidateName || [e.firstName, e.lastName].filter(Boolean).join(" ") || e.candidateFullName,
46849
46828
  location: t.jobLocation ?? e.city ?? e.currentLocation ?? e.jobLocation,
46850
46829
  vendor: n,
46851
- submittedBy: JP(e, t, n),
46830
+ submittedBy: qP(e, t, n),
46852
46831
  submittedAt: t.createdAt ?? e.createdAt,
46853
46832
  email: t.email ?? e.email,
46854
46833
  employerLocation: t.employerLocation,
46855
46834
  employerName: t.employerName
46856
46835
  };
46857
46836
  }
46858
- function XP(e) {
46859
- return xj(e).map((e) => ({ email: e }));
46837
+ function YP(e) {
46838
+ let t = e?.$oid ?? e?._id?.$oid ?? e?._id ?? e?.id?.$oid ?? e?.id ?? e;
46839
+ if (t == null || typeof t == "object") return "";
46840
+ let n = String(t).trim();
46841
+ return /^[a-f\d]{24}$/i.test(n) ? n : "";
46842
+ }
46843
+ function XP(...e) {
46844
+ for (let t of e) {
46845
+ let e = [
46846
+ t?.jobId,
46847
+ t?.JobId,
46848
+ t?.job_id,
46849
+ t?.jobDetails?._id,
46850
+ t?.jobDetails?.id,
46851
+ t?.job?._id,
46852
+ t?.job?.id,
46853
+ t?.submission?.jobId,
46854
+ t?.submission?.JobId,
46855
+ t?.submission?.job_id,
46856
+ t?.submission?.jobDetails?._id,
46857
+ t?.submission?.jobDetails?.id,
46858
+ t?.submission?.job?._id,
46859
+ t?.submission?.job?.id,
46860
+ t?.recordMeta?.jobId,
46861
+ t?.recordMeta?.JobId,
46862
+ t?.recordMeta?.job_id,
46863
+ t?.submission?.recordMeta?.jobId,
46864
+ t?.submission?.recordMeta?.JobId,
46865
+ t?.submission?.recordMeta?.job_id
46866
+ ].map(YP).find(Boolean);
46867
+ if (e) return e;
46868
+ }
46869
+ return "";
46860
46870
  }
46861
46871
  function ZP(e) {
46862
46872
  if (!e?.referralId) return {};
@@ -46972,21 +46982,26 @@ function $P({ context: e, selectedIds: t, selectedRecords: n, moduleName: r, onC
46972
46982
  candidateProposedRateUnit: _.rateUnit
46973
46983
  };
46974
46984
  try {
46975
- await GP({
46976
- submissionId: o,
46977
- to: XP(k.to),
46978
- cc: XP(k.cc),
46979
- bcc: XP(k.bcc),
46980
- subject: k.subject || null,
46981
- content: {
46982
- type: "text/html",
46983
- value: k.contents || null
46984
- }
46985
- }), await Qs(o, {
46985
+ await Qs(o, {
46986
46986
  ...e,
46987
46987
  submitVia: "VMS",
46988
46988
  ...ZP(y)
46989
- }), J.success("Approval mail sent and submission approved"), w(!1), v(null), b(null), i?.({ success: !0 });
46989
+ });
46990
+ let t = XP(s?.record, a);
46991
+ if (!t) J.warning("Submission approved, but job details were not available to send mail");
46992
+ else try {
46993
+ await Yl({
46994
+ jobId: t,
46995
+ toMail: xj(k.to),
46996
+ ccMail: xj(k.cc),
46997
+ bccMail: xj(k.bcc),
46998
+ subject: k.subject,
46999
+ contents: k.contents
47000
+ }), J.success("Approval mail sent and submission approved");
47001
+ } catch (e) {
47002
+ J.warning(e?.message ? `Submission approved, but mail was not sent: ${e.message}` : "Submission approved, but mail was not sent");
47003
+ }
47004
+ w(!1), v(null), b(null), i?.({ success: !0 });
46990
47005
  } catch (e) {
46991
47006
  J.error(e?.message ?? "Unable to send approval mail");
46992
47007
  } finally {
@@ -47025,7 +47040,7 @@ function $P({ context: e, selectedIds: t, selectedRecords: n, moduleName: r, onC
47025
47040
  type: HS,
47026
47041
  record: s.record,
47027
47042
  lookups: s.lookups,
47028
- identity: YP(a, s.display),
47043
+ identity: JP(a, s.display),
47029
47044
  referralOptions: d,
47030
47045
  currentUserId: typeof localStorage < "u" ? localStorage.getItem("userId") ?? void 0 : void 0,
47031
47046
  actions: te,