salesprompter-cli 0.1.34 → 0.1.35

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.
Files changed (2) hide show
  1. package/dist/cli.js +82 -1
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2836,6 +2836,87 @@ async function promptText(rl, prompt, options = {}) {
2836
2836
  writeWizardLine("This field is required.");
2837
2837
  }
2838
2838
  }
2839
+ async function promptLongPastedText(rl, prompt, options = {}) {
2840
+ if (!process.stdin.isTTY || !process.stdout.isTTY || typeof process.stdin.setRawMode !== "function") {
2841
+ return await promptText(rl, prompt, options);
2842
+ }
2843
+ const suffix = options.defaultValue !== undefined ? ` [${options.defaultValue}]` : "";
2844
+ while (true) {
2845
+ const answer = await new Promise((resolve, reject) => {
2846
+ const stdin = process.stdin;
2847
+ let value = "";
2848
+ let finished = false;
2849
+ const cleanup = () => {
2850
+ if (finished) {
2851
+ return;
2852
+ }
2853
+ finished = true;
2854
+ stdin.off("data", onData);
2855
+ process.off("SIGINT", onSigint);
2856
+ if (stdin.isTTY) {
2857
+ stdin.setRawMode(false);
2858
+ }
2859
+ stdin.pause();
2860
+ rl.resume?.();
2861
+ };
2862
+ const finish = () => {
2863
+ cleanup();
2864
+ process.stdout.write("\n");
2865
+ resolve(value.trim());
2866
+ };
2867
+ const cancel = () => {
2868
+ cleanup();
2869
+ process.stdout.write("\n");
2870
+ reject(new Error("prompt cancelled"));
2871
+ };
2872
+ const onSigint = () => {
2873
+ cancel();
2874
+ };
2875
+ const onData = (chunk) => {
2876
+ for (const byte of chunk) {
2877
+ if (byte === 3) {
2878
+ cancel();
2879
+ return;
2880
+ }
2881
+ if (byte === 13 || byte === 10) {
2882
+ finish();
2883
+ return;
2884
+ }
2885
+ if (byte === 127 || byte === 8) {
2886
+ if (value.length > 0) {
2887
+ value = value.slice(0, -1);
2888
+ process.stdout.write("\b \b");
2889
+ }
2890
+ continue;
2891
+ }
2892
+ // Ignore escape sequences for arrows and other terminal controls.
2893
+ if (byte === 27) {
2894
+ continue;
2895
+ }
2896
+ const character = Buffer.from([byte]).toString("utf8");
2897
+ value += character;
2898
+ process.stdout.write(character);
2899
+ }
2900
+ };
2901
+ rl.pause?.();
2902
+ process.stdout.write(`${prompt}${suffix}: `);
2903
+ stdin.setRawMode(true);
2904
+ stdin.resume();
2905
+ stdin.on("data", onData);
2906
+ process.on("SIGINT", onSigint);
2907
+ });
2908
+ if (answer.length > 0) {
2909
+ return answer;
2910
+ }
2911
+ if (options.defaultValue !== undefined) {
2912
+ return options.defaultValue;
2913
+ }
2914
+ if (!options.required) {
2915
+ return "";
2916
+ }
2917
+ writeWizardLine("This field is required.");
2918
+ }
2919
+ }
2839
2920
  async function promptYesNo(rl, prompt, defaultValue) {
2840
2921
  while (true) {
2841
2922
  const answer = (await rl.question(`${prompt} [${defaultValue ? "Y/n" : "y/N"}]: `)).trim().toLowerCase();
@@ -5432,7 +5513,7 @@ async function runDirectSalesNavigatorSearchWizard(input) {
5432
5513
  }
5433
5514
  async function runProductMarketWizard(rl) {
5434
5515
  writeWizardSection("Find leads from a product market", "Start from a company website, LinkedIn company page, product page, or category page. I will turn that into intended job titles and durable Sales Navigator crawls.");
5435
- const input = await promptText(rl, "What company website or LinkedIn page should I start from?", {
5516
+ const input = await promptLongPastedText(rl, "What company website or LinkedIn page should I start from?", {
5436
5517
  required: true
5437
5518
  });
5438
5519
  if (isSalesNavigatorPeopleSearchUrl(input)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "salesprompter-cli",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
4
4
  "description": "Sales workflow CLI for guided lead generation, enrichment, scoring, and sync.",
5
5
  "author": "Daniel Sinewe <hello@danielsinewe.com>",
6
6
  "type": "module",