@codebards/ik-embeddable-form 0.0.2788575612-qa → 0.0.2791646055-qa
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/embed.js +49 -21
- package/dist/embed.js.map +1 -1
- package/package.json +1 -1
package/dist/embed.js
CHANGED
|
@@ -22766,7 +22766,9 @@ ${leadMagnetStyles}`;
|
|
|
22766
22766
|
}
|
|
22767
22767
|
}
|
|
22768
22768
|
function renderPendingTab(tab, tool, options = {}) {
|
|
22769
|
-
const
|
|
22769
|
+
const heading = options.gated ? "Finishing up" : "Analysing your resume";
|
|
22770
|
+
const waitingCopy = options.gated ? `We're wrapping up your registration in the tab you came from — your results will
|
|
22771
|
+
appear here automatically the moment it's done.` : `This usually takes under a minute. Please keep this tab open — your results will
|
|
22770
22772
|
appear here automatically.`;
|
|
22771
22773
|
try {
|
|
22772
22774
|
tab.document.write(`<!doctype html>
|
|
@@ -22774,7 +22776,7 @@ ${leadMagnetStyles}`;
|
|
|
22774
22776
|
<head>
|
|
22775
22777
|
<meta charset="utf-8">
|
|
22776
22778
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
22777
|
-
<title
|
|
22779
|
+
<title>${escapeHtml(heading)} — ${escapeHtml(tool.copy.title)}</title>
|
|
22778
22780
|
<style>
|
|
22779
22781
|
:root { color-scheme: light dark; }
|
|
22780
22782
|
* { box-sizing: border-box; }
|
|
@@ -22799,7 +22801,7 @@ ${leadMagnetStyles}`;
|
|
|
22799
22801
|
<body>
|
|
22800
22802
|
<div class="wrap" role="status" aria-live="polite">
|
|
22801
22803
|
<div class="spinner"></div>
|
|
22802
|
-
<h1
|
|
22804
|
+
<h1>${escapeHtml(heading)}</h1>
|
|
22803
22805
|
<p>${waitingCopy}</p>
|
|
22804
22806
|
</div>
|
|
22805
22807
|
</body>
|
|
@@ -22822,24 +22824,31 @@ ${leadMagnetStyles}`;
|
|
|
22822
22824
|
(c2) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c2]
|
|
22823
22825
|
);
|
|
22824
22826
|
}
|
|
22827
|
+
const GATE_TERMINAL_STEP_ID = "goals-details";
|
|
22825
22828
|
function openGqlGate(options) {
|
|
22826
22829
|
const { tool, identity, dataClickId, onRegistered, onDismissed } = options;
|
|
22827
22830
|
const IKForm = typeof window !== "undefined" ? window.IKForm : void 0;
|
|
22828
22831
|
if (!IKForm) {
|
|
22829
|
-
onRegistered();
|
|
22832
|
+
onRegistered(null);
|
|
22830
22833
|
return;
|
|
22831
22834
|
}
|
|
22835
|
+
const releaseClaim = claimResultTab(tool);
|
|
22832
22836
|
let settled = false;
|
|
22833
22837
|
const handOffOnce = () => {
|
|
22834
22838
|
if (settled) return;
|
|
22835
22839
|
settled = true;
|
|
22836
22840
|
IKForm.close();
|
|
22837
|
-
onRegistered();
|
|
22841
|
+
onRegistered(releaseClaim());
|
|
22838
22842
|
};
|
|
22839
22843
|
const dismissOnce = () => {
|
|
22840
22844
|
if (settled) return;
|
|
22841
|
-
|
|
22842
|
-
|
|
22845
|
+
setTimeout(() => {
|
|
22846
|
+
var _a;
|
|
22847
|
+
if (settled) return;
|
|
22848
|
+
settled = true;
|
|
22849
|
+
(_a = releaseClaim()) == null ? void 0 : _a.close();
|
|
22850
|
+
onDismissed == null ? void 0 : onDismissed();
|
|
22851
|
+
}, 3e3);
|
|
22843
22852
|
};
|
|
22844
22853
|
IKForm.open({
|
|
22845
22854
|
...tool.gqlGateConfig,
|
|
@@ -22856,6 +22865,27 @@ ${leadMagnetStyles}`;
|
|
|
22856
22865
|
onClose: dismissOnce
|
|
22857
22866
|
});
|
|
22858
22867
|
}
|
|
22868
|
+
function claimResultTab(tool) {
|
|
22869
|
+
let resultTab = null;
|
|
22870
|
+
let claimed = false;
|
|
22871
|
+
const onClick = (event) => {
|
|
22872
|
+
if (claimed) return;
|
|
22873
|
+
const onTerminalStep = event.composedPath().some((el) => el instanceof HTMLElement && el.dataset.testid === GATE_TERMINAL_STEP_ID);
|
|
22874
|
+
if (!onTerminalStep) return;
|
|
22875
|
+
claimed = true;
|
|
22876
|
+
resultTab = window.open("", "_blank");
|
|
22877
|
+
if (resultTab) {
|
|
22878
|
+
renderPendingTab(resultTab, tool, { gated: true });
|
|
22879
|
+
window.focus();
|
|
22880
|
+
}
|
|
22881
|
+
document.removeEventListener("click", onClick, true);
|
|
22882
|
+
};
|
|
22883
|
+
document.addEventListener("click", onClick, true);
|
|
22884
|
+
return () => {
|
|
22885
|
+
document.removeEventListener("click", onClick, true);
|
|
22886
|
+
return resultTab;
|
|
22887
|
+
};
|
|
22888
|
+
}
|
|
22859
22889
|
function goToResult(url) {
|
|
22860
22890
|
const tab = window.open(url, "_blank");
|
|
22861
22891
|
if (!tab) window.location.href = url;
|
|
@@ -22933,11 +22963,8 @@ ${leadMagnetStyles}`;
|
|
|
22933
22963
|
);
|
|
22934
22964
|
const submit = q$1(async () => {
|
|
22935
22965
|
if (!localFile) return;
|
|
22936
|
-
const resultTab = window.open("", "_blank");
|
|
22937
|
-
if (resultTab)
|
|
22938
|
-
renderPendingTab(resultTab, tool, { gated: tool.gateBehindGqlForm });
|
|
22939
|
-
if (tool.gateBehindGqlForm) window.focus();
|
|
22940
|
-
}
|
|
22966
|
+
const resultTab = tool.gateBehindGqlForm ? null : window.open("", "_blank");
|
|
22967
|
+
if (resultTab) renderPendingTab(resultTab, tool);
|
|
22941
22968
|
setToolState(tool.id, { status: "uploading" });
|
|
22942
22969
|
try {
|
|
22943
22970
|
const base64 = await fileToBase64(localFile);
|
|
@@ -22948,22 +22975,23 @@ ${leadMagnetStyles}`;
|
|
|
22948
22975
|
const resultUrl = buildResultUrl(tool, uuid);
|
|
22949
22976
|
setToolState(tool.id, { status: "done" });
|
|
22950
22977
|
reportLeadMagnetClick(buildLifecycleClickId(surface, tool.id, "upload-success"));
|
|
22951
|
-
const handOff = () => {
|
|
22952
|
-
if (resultTab && !resultTab.closed) resultTab.location.href = resultUrl;
|
|
22953
|
-
else goToResult(resultUrl);
|
|
22954
|
-
};
|
|
22955
22978
|
if (tool.gateBehindGqlForm) {
|
|
22956
22979
|
openGqlGate({
|
|
22957
22980
|
tool,
|
|
22958
22981
|
identity: data,
|
|
22959
22982
|
dataClickId: resolveClickId(surface, tool.id),
|
|
22960
|
-
|
|
22961
|
-
//
|
|
22962
|
-
//
|
|
22963
|
-
|
|
22983
|
+
// `gateTab` is whatever openGqlGate managed to claim on the submit click — null
|
|
22984
|
+
// if the browser refused it, in which case goToResult tries once more and,
|
|
22985
|
+
// failing that, falls back to navigating this tab.
|
|
22986
|
+
onRegistered: (gateTab) => {
|
|
22987
|
+
if (gateTab && !gateTab.closed) gateTab.location.href = resultUrl;
|
|
22988
|
+
else goToResult(resultUrl);
|
|
22989
|
+
}
|
|
22964
22990
|
});
|
|
22991
|
+
} else if (resultTab) {
|
|
22992
|
+
resultTab.location.href = resultUrl;
|
|
22965
22993
|
} else {
|
|
22966
|
-
|
|
22994
|
+
goToResult(resultUrl);
|
|
22967
22995
|
}
|
|
22968
22996
|
} catch (err) {
|
|
22969
22997
|
const message = err instanceof Error ? err.message : "Upload failed. Please try again.";
|