PageSourceSearch

https://www.tele-blast.com/assets/ColdCallScriptPage-DPaefwcQ.js

js tele-blast.com collected 2026-10-07 17:44:41 UTC 28,287 bytes, 599 lines download raw bytes

1import { r as reactExports, j as jsxRuntimeExports } from "./vendor-react-em1ljm69.js";
2import { G as useBackend, d as useSubscription, u as useLeads, S as Skeleton, L as Label, T as Textarea, B as Button } from "./index-Bp0STQHC.js";
3import { S as Select, a as SelectTrigger, b as SelectValue, c as SelectContent, d as SelectItem } from "./select-BSpWQ5Z6.js";
4import { a as useQuery, u as useQueryClient, b as useMutation, f as useSearch } from "./vendor-router-YtkA8fm7.js";
5import { aD as ScrollText, K as LoaderCircle, B as Check, am as Save, aV as Copy, a6 as RefreshCw, J as ue, H as CircleCheck } from "./vendor-DoRlLPMq.js";
6import { T as TokenBalance } from "./TokenBalance-BA9B0sBO.js";
7import { b as useAiGenerateColdCallScriptForLead } from "./useAi-D5RRtgXF.js";
8import "./vendor-ic-CYrLubFP.js";
9function useColdCallConfig() {
10  const { actor, isFetching } = useBackend();
11  return useQuery({
12    queryKey: ["coldCallConfig"],
13    queryFn: async () => {
14      if (!actor) return null;
15      try {
16        const actorAny = actor;
17        const result = await actorAny.getColdCallConfig();
18        if (Array.isArray(result) && result.length > 0) {
19          return result[0];
20        }
21        return null;
22      } catch {
23        return null;
24      }
25    },
26    enabled: !!actor && !isFetching
27  });
28}
29function useSaveColdCallConfig() {
30  const { actor } = useBackend();
31  const queryClient = useQueryClient();
32  return useMutation({
33    mutationFn: async (input) => {
34      if (!actor) throw new Error("Not connected");
35      const actorAny = actor;
36      await actorAny.saveColdCallConfig(input);
37    },
38    onSuccess: () => {
39      queryClient.invalidateQueries({ queryKey: ["coldCallConfig"] });
40    }
41  });
42}
43function parseScriptSections(text) {
44  const regex = /===\s*([^=]+?)\s*===/g;
45  const sections = [];
46  const parts = text.split(regex);
47  for (let i = 1; i < parts.length; i += 2) {
48    const title = parts[i].trim();
49    const content = (parts[i + 1] ?? "").trim();
50    if (title) sections.push({ title, content });
51  }
52  if (sections.length === 0 && text.trim()) {
53    sections.push({ title: "Script", content: text.trim() });
54  }
55  return sections;
56}
57const SECTION_COLORS = {
58  GREETING: "border-primary/40 bg-primary/5",
59  "PRE-QUALIFYING": "border-amber-500/40 bg-amber-500/5",
60  "THE PITCH": "border-sky-500/40 bg-sky-500/5",
61  "A/B CHOICE CLOSE": "border-emerald-500/40 bg-emerald-500/5"
62};
63const SECTION_HEADER_COLORS = {
64  GREETING: "text-primary",
65  "PRE-QUALIFYING": "text-amber-600",
66  "THE PITCH": "text-sky-600",
67  "A/B CHOICE CLOSE": "text-emerald-600"
68};
69function getSectionColor(title, prop) {
70  const key = title.toUpperCase().trim();
71  if (prop === "border") {
72    return SECTION_COLORS[key] ?? "border-border bg-muted/20";
73  }
74  return SECTION_HEADER_COLORS[key] ?? "text-foreground";
75}
76function LeadSelector({
77  leads,
78  selectedId,
79  onSelect
80}) {
81  const [search, setSearch] = reactExports.useState("");
82  const inputRef = reactExports.useRef(null);
83  const filtered = search.trim() ? leads.filter((l) => {
84    const q = search.toLowerCase();
85    return l.name?.toLowerCase().includes(q) || `${l.firstName ?? ""} ${l.lastName ?? ""}`.toLowerCase().includes(q);
86  }) : leads;
87  const selectedLead = leads.find((l) => l.id === selectedId) ?? null;
88  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", "data-ocid": "cold-call-script.lead_selector", children: [
89    /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { className: "text-sm font-semibold text-foreground", children: "Select a Lead" }),
90    /* @__PURE__ */ jsxRuntimeExports.jsx(
91      "input",
92      {
93        ref: inputRef,
94        type: "text",
95        value: search,
96        onChange: (e) => setSearch(e.target.value),
97        placeholder: "Search leads by name…",
98        className: "w-full px-3 py-2.5 text-sm rounded-lg border border-input bg-background focus:outline-none focus:ring-2 focus:ring-primary/30 min-h-[44px] transition-all",
99        "data-ocid": "cold-call-script.lead_search_input",
100        "aria-label": "Search leads"
101      }
102    ),
103    selectedLead && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 px-3 py-2 rounded-lg border border-primary/40 bg-primary/5 text-sm", children: [
104      /* @__PURE__ */ jsxRuntimeExports.jsx(CircleCheck, { className: "w-4 h-4 text-primary shrink-0" }),
105      /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-primary font-medium truncate min-w-0", children: selectedLead.name || `${selectedLead.firstName ?? ""} ${selectedLead.lastName ?? ""}`.trim() || "Unnamed Lead" }),
106      /* @__PURE__ */ jsxRuntimeExports.jsx(
107        "button",
108        {
109          type: "button",
110          onClick: () => onSelect(null),
111          className: "ml-auto text-muted-foreground hover:text-foreground transition-colors shrink-0 text-xs",
112          "data-ocid": "cold-call-script.clear_lead_button",
113          children: "Change"
114        }
115      )
116    ] }),
117    !selectedLead && /* @__PURE__ */ jsxRuntimeExports.jsx(
118      "div",
119      {
120        className: "max-h-52 overflow-y-auto rounded-lg border border-border bg-card divide-y divide-border",
121        "data-ocid": "cold-call-script.lead_list",
122        children: filtered.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
123          "div",
124          {
125            className: "py-8 text-center text-sm text-muted-foreground",
126            "data-ocid": "cold-call-script.lead_list_empty_state",
127            children: search ? "No leads match your search" : "No leads available"
128          }
129        ) : filtered.slice(0, 50).map((lead, i) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
130          "button",
131          {
132            type: "button",
133            onClick: () => {
134              onSelect(lead.id);
135              setSearch("");
136            },
137            className: "w-full flex flex-col px-3 py-2.5 text-left hover:bg-muted/50 active:bg-muted transition-colors min-h-[48px] justify-center",
138            "data-ocid": `cold-call-script.lead_item.${i + 1}`,
139            children: [
140              /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-sm font-medium text-foreground truncate", children: lead.name || `${lead.firstName ?? ""} ${lead.lastName ?? ""}`.trim() || "Unnamed Lead" }),
141              (lead.firstName || lead.lastName) && lead.name && lead.name !== `${lead.firstName ?? ""} ${lead.lastName ?? ""}`.trim() && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-muted-foreground truncate", children: `${lead.firstName ?? ""} ${lead.lastName ?? ""}`.trim() })
142            ]
143          },
144          String(lead.id)
145        ))
146      }
147    )
148  ] });
149}
150function ScriptSectionCard({
151  section,
152  index
153}) {
154  const [copied, setCopied] = reactExports.useState(false);
155  const handleCopy = async () => {
156    try {
157      await navigator.clipboard.writeText(section.content);
158      setCopied(true);
159      setTimeout(() => setCopied(false), 2e3);
160    } catch {
161      ue.error("Could not copy to clipboard.");
162    }
163  };
164  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
165    "div",
166    {
167      className: `rounded-xl border p-4 space-y-2 ${getSectionColor(section.title, "border")}`,
168      "data-ocid": `cold-call-script.section_card.${index + 1}`,
169      children: [
170        /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
171          /* @__PURE__ */ jsxRuntimeExports.jsx(
172            "h3",
173            {
174              className: `text-sm font-bold uppercase tracking-wider ${getSectionColor(section.title, "header")}`,
175              children: section.title
176            }
177          ),
178          /* @__PURE__ */ jsxRuntimeExports.jsx(
179            "button",
180            {
181              type: "button",
182              onClick: handleCopy,
183              className: "flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-xs font-medium border border-border bg-background hover:bg-muted transition-colors min-h-[32px] shrink-0 text-muted-foreground hover:text-foreground",
184              "data-ocid": `cold-call-script.copy_section_button.${index + 1}`,
185              "aria-label": `Copy ${section.title} section`,
186              children: copied ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
187                /* @__P
187URE__ */ jsxRuntimeExports.jsx(Check, { className: "w-3 h-3" }),
188                "Copied"
189              ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
190                /* @__PURE__ */ jsxRuntimeExports.jsx(Copy, { className: "w-3 h-3" }),
191                "Copy"
192              ] })
193            }
194          )
195        ] }),
196        /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-foreground leading-relaxed whitespace-pre-wrap", children: section.content })
197      ]
198    }
199  );
200}
201function ColdCallScriptPage() {
202  const searchParams = useSearch({ strict: false });
203  useSubscription();
204  const { data: leads = [], isLoading: leadsLoading } = useLeads();
205  const { data: savedConfig, isLoading: configLoading } = useColdCallConfig();
206  const saveColdCallConfig = useSaveColdCallConfig();
207  const generateScript = useAiGenerateColdCallScriptForLead();
208  const [whatYouAreSelling, setWhatYouAreSelling] = reactExports.useState("");
209  const [preQualifyingNeeds, setPreQualifyingNeeds] = reactExports.useState("");
210  const [packagesOrServices, setPackagesOrServices] = reactExports.useState("");
211  const [goalType, setGoalType] = reactExports.useState("Get an Appointment");
212  const [configSaved, setConfigSaved] = reactExports.useState(false);
213  const [selectedLeadId, setSelectedLeadId] = reactExports.useState(null);
214  const [scriptSections, setScriptSections] = reactExports.useState([]);
215  const [rawScript, setRawScript] = reactExports.useState(null);
216  const [copiedFull, setCopiedFull] = reactExports.useState(false);
217  reactExports.useEffect(() => {
218    if (savedConfig) {
219      setWhatYouAreSelling(savedConfig.whatYouAreSelling ?? "");
220      setPreQualifyingNeeds(savedConfig.preQualifyingNeeds ?? "");
221      setPackagesOrServices(savedConfig.packagesOrServices ?? "");
222      setGoalType(savedConfig.goalType ?? "Get an Appointment");
223    }
224  }, [savedConfig]);
225  reactExports.useEffect(() => {
226    if (searchParams.leadId && leads.length > 0) {
227      try {
228        const parsed = BigInt(searchParams.leadId);
229        const exists = leads.find((l) => l.id === parsed);
230        if (exists) setSelectedLeadId(parsed);
231      } catch {
232      }
233    }
234  }, [searchParams.leadId, leads]);
235  const handleSaveConfig = async () => {
236    const config = {
237      whatYouAreSelling,
238      preQualifyingNeeds,
239      packagesOrServices,
240      goalType
241    };
242    try {
243      await saveColdCallConfig.mutateAsync(config);
244      setConfigSaved(true);
245      setTimeout(() => setConfigSaved(false), 3e3);
246      ue.success("Script settings saved!");
247    } catch {
248      ue.error("Failed to save settings. Please try again.");
249    }
250  };
251  const handleGenerate = async () => {
252    setScriptSections([]);
253    setRawScript(null);
254    try {
255      const leadId = selectedLeadId ?? BigInt(0);
256      const result = await generateScript.mutateAsync(leadId);
257      setRawScript(result);
258      setScriptSections(parseScriptSections(result));
259    } catch (err) {
260      const msg = err instanceof Error ? err.message : "Failed to generate script.";
261      if (msg.includes("API key") || msg.includes("not configured") || msg.includes("administrator")) {
262        ue.error(
263          "AI not configured — please add your Anthropic API key in the Admin Panel > AI Settings."
264        );
265      } else if (msg.includes("tokens")) {
266        ue.error(msg, {
267          action: {
268            label: "Buy Credits",
269            onClick: () => window.open("/pricing", "_blank")
270          }
271        });
272      } else {
273        ue.error(msg);
274      }
275    }
276  };
277  const handleCopyFull = async () => {
278    if (!rawScript) return;
279    try {
280      await navigator.clipboard.writeText(rawScript);
281      setCopiedFull(true);
282      setTimeout(() => setCopiedFull(false), 2500);
283    } catch {
284      ue.error("Could not copy to clipboard.");
285    }
286  };
287  if (configLoading || leadsLoading) {
288    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-3xl mx-auto px-3 sm:px-6 py-5 sm:py-8 space-y-4", children: [
289      /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-8 w-56" }),
290      /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-64 rounded-2xl" }),
291      /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-48 rounded-2xl" })
292    ] });
293  }
294  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-3xl mx-auto px-3 sm:px-6 py-5 sm:py-8 space-y-5 relative overflow-hidden", children: [
295    /* @__PURE__ */ jsxRuntimeExports.jsxs(
296      "div",
297      {
298        className: "flex items-center gap-3",
299        "data-ocid": "cold-call-script.page",
300        children: [
301          /* @__PURE__ */ jsxRuntimeExports.jsx(
302            "div",
303            {
304              className: "w-9 h-9 rounded-xl flex items-center justify-center shrink-0",
305              style: { background: "oklch(0.22 0.12 264)" },
306              children: /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollText, { className: "w-5 h-5 text-white" })
307            }
308          ),
309          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
310            /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-xl sm:text-2xl font-bold text-foreground leading-tight", children: "Cold Call Script Builder" }),
311            /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: "Configure your script settings and generate personalized scripts for each lead" })
312          ] })
313        ]
314      }
315    ),
316    /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TokenBalance, { showLtai: false }) }),
317    false,
318    /* @__PURE__ */ jsxRuntimeExports.jsxs(
319      "section",
320      {
321        className: "bg-card border border-border rounded-2xl shadow-sm overflow-hidden",
322        "data-ocid": "cold-call-script.ai_setup_card",
323        children: [
324          /* @__PURE__ */ jsxRuntimeExports.jsxs(
325            "div",
326            {
327              className: "flex items-center gap-2.5 px-5 py-4 border-b border-border",
328              style: { background: "oklch(0.22 0.12 264 / 0.06)" },
329              children: [
330                /* @__PURE__ */ jsxRuntimeExports.jsx(
331                  "div",
332                  {
333                    className: "w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-bold shrink-0",
334                    style: { background: "oklch(0.56 0.16 44)" },
335                    children: "1"
336                  }
337                ),
338                /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-sm font-bold text-foreground", children: "Script Settings" }),
339                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-auto text-xs text-muted-foreground", children: "Saved settings will be used when generating scripts" })
340              ]
341            }
342          ),
343          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-5 space-y-4", children: [
344            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1.5", children: [
345              /* @__PURE__ */ jsxRuntimeExports.jsx(
346                Label,
347                {
348                  htmlFor: "whatYouAreSelling",
349                  className: "text-sm font-semibold text-foreground",
350                  children: "What are you selling?"
351                }
352              ),
353              /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: "Describe your product or service in plain terms" }),
354              /* @__PURE__ */ jsxRuntimeExports.jsx(
355                Textarea,
356                {
357                  id: "whatYouAreSelling",
358                  value: whatYouAreSelling,
359                  onChange: (e) => setWhatYouAreSelling(e.target.value),
360                  placeholder: "e.g. Business loans for small businesses, fast approvals up to $500k…",
361                  rows: 3,
362                  className: "resize-none text-sm min-h-[80px]",
363                  "data-ocid": "cold-call-script.what_selling_input"
364                }
365              )
366            ] }),
367            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1.5", children: [
368              /* @__PURE__ */ jsxRuntimeExports.jsx(
369                Label,
370                {
371                  htmlFor: "preQualifyingNeeds",
372                  className: "text-sm font-semibold text-foreground",
373                  children: "What type of pre-qualifying does your calls need?"
374                }
375              ),
376              /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: "e.g. monthly revenue minimum, time in business, credit score threshold" }),
377              /* @__PURE__ */ jsxRuntimeExports.jsx(
378                Textarea,
379                {
380                  id: "preQualifyingNeeds",
381                  value: preQualifyingNeeds,
382                  onChange: (e) => setPreQualifyingNeeds(e.target.value),
383                  placeholder: "e.g. Must be in business 2+ years, $20k/month revenue, owner must be available…",
384                  rows: 3,
385                  className: "resize-none text-sm min-h-[80px]",
386                  "data-ocid": "cold-call-script.pre_qualifying_input"
387                }
388              )
389            ] }),
390            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1.5", children: [
391              /* @__PURE__ */ jsxRuntimeExports.jsx(
392                Label,
393                {
394                  htmlFor: "packagesOrServices",
395                  className: "text-sm font-semibold text-foreground",
396                  children: "What packages or services do you sell?"
397                }
398              ),
399              /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground", children: "List your main offerings so they can be referenced in the script" }),
400              /* @__PURE__ */ jsxRuntimeExports.jsx(
401                Textarea,
402                {
403                  id: "packagesOrServices",
404                  value: packagesOrServices,
405                  onChange: (e) => setPackagesOrServices(e.target.value),
406                  placeholder: "e.g. Term loans ($10k–$500k), merchant cash advances, SBA loans, equipment financing…",
407                  rows: 3,
408                  className: "resize-none text-sm min-h-[80px]",
409                  "data-ocid": "cold-call-script.packages_input"
410                }
411              )
412            ] }),
413            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1.5", children: [
414              /* @__PURE__ */ jsxRuntimeExports.jsx(
415                Label,
416                {
417                  htmlFor: "goalType",
418                  className: "text-sm font-semibold text-foreground",
419                  children: "Is your goal to get an appointment or close them on the call?"
420                }
421              ),
422              /* @__PURE__ */ jsxRuntimeExports.jsxs(Select, { value: goalType, onValueChange: setGoalType, children: [
423                /* @__PURE__ */ jsxRuntimeExports.jsx(
424                  SelectTrigger,
425                  {
426                    id: "goalType",
427                    className: "w-full min-h-[44px]",
428                    "data-ocid": "cold-call-script.goal_type_select",
429                    children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { placeholder: "Select your goal…" })
430                  }
431                ),
432                /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectContent, { children: [
433                  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "Get an Appointment", children: "Get an Appointment" }),
434                  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: "Close on the Call", children: "Close on the Call" })
435                ] })
436              ] })
437            ] }),
438            /* @__PURE__ */ jsxRuntimeExports.jsx(
439              Button,
440              {
441                onClick: handleSaveConfig,
442                disabled: saveColdCallConfig.isPending,
443                className: "w-full sm:w-auto gap-2 font-semibold min-h-[44px]",
444                style: !saveColdCallConfig.isPending ? { background: "oklch(0.22 0.12 264)" } : {},
445                "data-ocid": "cold-call-script.save_config_button",
446                children: saveColdCallConfig.isPending ? /* @__P
446URE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
447                  /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "w-4 h-4 animate-spin" }),
448                  "Saving…"
449                ] }) : configSaved ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
450                  /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: "w-4 h-4" }),
451                  "Settings Saved!"
452                ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
453                  /* @__PURE__ */ jsxRuntimeExports.jsx(Save, { className: "w-4 h-4" }),
454                  "Save Settings"
455                ] })
456              }
457            )
458          ] })
459        ]
460      }
461    ),
462    /* @__PURE__ */ jsxRuntimeExports.jsxs(
463      "section",
464      {
465        className: "bg-card border border-border rounded-2xl shadow-sm overflow-hidden",
466        "data-ocid": "cold-call-script.lead_selector_card",
467        children: [
468          /* @__PURE__ */ jsxRuntimeExports.jsxs(
469            "div",
470            {
471              className: "flex items-center gap-2.5 px-5 py-4 border-b border-border",
472              style: { background: "oklch(0.22 0.12 264 / 0.06)" },
473              children: [
474                /* @__PURE__ */ jsxRuntimeExports.jsx(
475                  "div",
476                  {
477                    className: "w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-bold shrink-0",
478                    style: { background: "oklch(0.56 0.16 44)" },
479                    children: "2"
480                  }
481                ),
482                /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-sm font-bold text-foreground", children: "Choose a Lead" }),
483                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-1 text-xs text-muted-foreground font-normal", children: "(optional)" })
484              ]
485            }
486          ),
487          /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-5", children: [
488            /* @__PURE__ */ jsxRuntimeExports.jsx(
489              LeadSelector,
490              {
491                leads,
492                selectedId: selectedLeadId,
493                onSelect: setSelectedLeadId
494              }
495            ),
496            /* @__P
496URE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground mt-2", children: "Skip lead selection to generate a generic script based on your settings above." })
497          ] })
498        ]
499      }
500    ),
501    /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { "data-ocid": "cold-call-script.generate_section", children: [
502      /* @__PURE__ */ jsxRuntimeExports.jsx(
503        Button,
504        {
505          onClick: handleGenerate,
506          disabled: generateScript.isPending,
507          className: "w-full font-bold text-base min-h-[52px] gap-2 text-white",
508          style: { background: "oklch(0.56 0.16 44)" },
509          "data-ocid": "cold-call-script.generate_button",
510          children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
511            /* @__PURE__ */ jsxRuntimeExports.jsx(ScrollText, { className: "w-5 h-5" }),
512            selectedLeadId ? "Generate Cold Call Script" : "Generate Generic Script"
513          ] })
514        }
515      ),
516      !selectedLeadId && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-center text-xs text-muted-foreground mt-2", children: "No lead selected — a generic script will be generated based on your settings." })
517    ] }),
518    scriptSections.length > 0 && rawScript && /* @__PURE__ */ jsxRuntimeExports.jsxs(
519      "section",
520      {
521        className: "bg-card border border-border rounded-2xl shadow-sm overflow-hidden",
522        "data-ocid": "cold-call-script.output_card",
523        children: [
524          /* @__PURE__ */ jsxRuntimeExports.jsxs(
525            "div",
526            {
527              className: "flex items-center justify-between gap-3 px-5 py-4 border-b border-border",
528              style: { background: "oklch(0.22 0.12 264 / 0.06)" },
529              children: [
530                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2.5", children: [
531                  /* @__PURE__ */ jsxRuntimeExports.jsx(
532                    "div",
533                    {
534                      className: "w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-bold shrink-0",
535                      style: { background: "oklch(0.56 0.16 44)" },
536                      children: "3"
537                    }
538                  ),
539                  /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-sm font-bold text-foreground", children: "Your Cold Call Script" })
540                ] }),
541                /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
542                  /* @__PURE__ */ jsxRuntimeExports.jsx(
543                    "button",
544                    {
545                      type: "button",
546                      onClick: handleCopyFull,
547                      className: "flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold border border-border bg-background hover:bg-muted transition-colors min-h-[36px] text-foreground",
548                      "data-ocid": "cold-call-script.copy_full_button",
549                      children: copiedFull ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
550                        /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: "w-3.5 h-3.5 text-emerald-500" }),
551                        "Copied!"
552                      ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
553                        /* @__PURE__ */ jsxRuntimeExports.jsx(Copy, { className: "w-3.5 h-3.5" }),
554                        "Copy All"
555                      ] })
556                    }
557                  ),
558                  /* @__PURE__ */ jsxRuntimeExports.jsxs(
559                    "button",
560                    {
561                      type: "button",
562                      onClick: handleGenerate,
563                      disabled: generateScript.isPending,
564                      className: "flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-semibold border border-border bg-background hover:bg-muted transition-colors min-h-[36px] text-muted-foreground hover:text-foreground disabled:opacity-50",
565                      "data-ocid": "cold-call-script.regenerate_button",
566                      children: [
567                        /* @__PURE__ */ jsxRuntimeExports.jsx(RefreshCw, { className: "w-3.5 h-3.5" }),
568                        /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "hidden sm:inline", children: "Regenerate" })
569                      ]
570                    }
571                  )
572                ] })
573              ]
574            }
575          ),
576          /* @__PURE__ */ jsxRuntimeExports.jsx(
577            "div",
578            {
579              className: "p-4 sm:p-5 space-y-3",
580              "data-ocid": "cold-call-script.sections_list",
581              children: scriptSections.map((section, i) => /* @__PURE__ */ jsxRuntimeExports.jsx(
582                ScriptSectionCard,
583                {
584                  section,
585                  index: i
586                },
587                `${section.title}-${i}`
588              ))
589            }
590          )
591        ]
592      }
593    ),
594    generateScript.isPending
595  ] });
596}
597export {
598  ColdCallScriptPage as default
599};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.