sproutkit-code 1.16.0 → 1.16.1

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/index.js +78 -30
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -121,6 +121,49 @@ var require_runtime = __commonJS({
121
121
  }
122
122
  });
123
123
 
124
+ // ../desktop/dist/main/lib/outreach-template.js
125
+ var require_outreach_template = __commonJS({
126
+ "../desktop/dist/main/lib/outreach-template.js"(exports2) {
127
+ "use strict";
128
+ Object.defineProperty(exports2, "__esModule", { value: true });
129
+ exports2.PREVIOUS_DEFAULT_TEMPLATE = exports2.OUTREACH_TEMPLATE = void 0;
130
+ exports2.OUTREACH_TEMPLATE = `Hello,
131
+
132
+ I came across {name} on Google and noticed you don't have a website yet, so I put together a free demo to show what one could look like:
133
+
134
+ {site_url}
135
+
136
+ It's built from your real reviews and photos.
137
+
138
+ I also recorded a short video walking you through it: {video}
139
+
140
+ And I've set up a virtual front desk for {name}. It answers your calls when you can't get to the phone, knows your services, prices and opening hours, and texts you a summary of every call. Try it the way a customer would \u2014 ask if you're open on Saturday, or what something costs:
141
+
142
+ {front_desk}
143
+
144
+ If you like the website, I can put it live on your own domain for a one-off fee of \xA3199, with no monthly charges. The front desk can be switched on for your number whenever you're ready.
145
+
146
+ Would you be open to a quick chat this week?
147
+
148
+ Best regards
149
+
150
+ If you'd rather not hear from me again, just reply and let me know.`;
151
+ exports2.PREVIOUS_DEFAULT_TEMPLATE = `Hello,
152
+
153
+ I came across {name} on Google and noticed you don't have a website yet, so I put together a free demo to show what one could look like:
154
+
155
+ {site_url}
156
+
157
+ It's built from your real reviews and photos. If you like it, I can put it live on your own domain with your details for a one-off fee of \xA3199 \u2014 no monthly charges.
158
+
159
+ Would you be open to a quick chat this week?
160
+
161
+ Best regards
162
+
163
+ If you'd rather not hear from me again, just reply and let me know.`;
164
+ }
165
+ });
166
+
124
167
  // ../desktop/dist/main/db.js
125
168
  var require_db = __commonJS({
126
169
  "../desktop/dist/main/db.js"(exports2) {
@@ -131,6 +174,7 @@ var require_db = __commonJS({
131
174
  Object.defineProperty(exports2, "__esModule", { value: true });
132
175
  exports2.databasePath = databasePath;
133
176
  exports2.initDatabase = initDatabase2;
177
+ exports2.upgradeDefaultTemplate = upgradeDefaultTemplate;
134
178
  exports2.getDb = getDb2;
135
179
  var node_sqlite3_wasm_1 = require("node-sqlite3-wasm");
136
180
  var path_1 = __importDefault(require("path"));
@@ -426,6 +470,16 @@ var require_db = __commonJS({
426
470
  }
427
471
  }
428
472
  }
473
+ function upgradeDefaultTemplate() {
474
+ try {
475
+ const t = require_outreach_template();
476
+ db2.run("UPDATE settings SET value = ? WHERE key = 'outreach_template' AND value = ?", [
477
+ t.OUTREACH_TEMPLATE,
478
+ t.PREVIOUS_DEFAULT_TEMPLATE
479
+ ]);
480
+ } catch {
481
+ }
482
+ }
429
483
  function getDb2() {
430
484
  return db2;
431
485
  }
@@ -84500,7 +84554,7 @@ var require_pitch_text = __commonJS({
84500
84554
  exports2.prettyNumber = prettyNumber;
84501
84555
  function withVideo(message, videoUrl) {
84502
84556
  if (!videoUrl)
84503
- return message.replace(/\n?[^\n]*\{video\}[^\n]*/g, "");
84557
+ return omit(message, /\{video\}/, /\bvideo\b/i);
84504
84558
  if (message.includes("{video}"))
84505
84559
  return message.replace(/\{video\}/g, videoUrl);
84506
84560
  const line = `I also recorded a short video walking you through it: ${videoUrl}`;
@@ -84517,7 +84571,7 @@ ${line}`;
84517
84571
  void demoNumber;
84518
84572
  message = message.replace(/\{front_desk\}/g, "{receptionist}");
84519
84573
  if (!url)
84520
- return message.replace(/\n?[^\n]*\{receptionist\}[^\n]*/g, "");
84574
+ return omit(message, /\{receptionist\}/, /front desk|receptionist/i);
84521
84575
  if (message.includes("{receptionist}"))
84522
84576
  return message.replace(/\{receptionist\}/g, url);
84523
84577
  const line = `I've also set up a virtual front desk for ${businessName ?? "you"}: it answers your calls when you can't${chatOn ? ", and questions on your website" : ""}, 24/7. You can try it here: ${url}`;
@@ -84544,6 +84598,23 @@ ${line}`;
84544
84598
  return `(${d.slice(2, 5)}) ${d.slice(5, 8)}-${d.slice(8)}`;
84545
84599
  return e164;
84546
84600
  }
84601
+ function omit(message, placeholder, mention) {
84602
+ const blocks = message.split(/\n[ \t]*\n/);
84603
+ const drop = /* @__PURE__ */ new Set();
84604
+ blocks.forEach((b, i) => {
84605
+ if (!placeholder.test(b))
84606
+ return;
84607
+ const rest = b.replace(placeholder, "").trim();
84608
+ if (!rest || /:$/.test(rest)) {
84609
+ drop.add(i);
84610
+ if (!rest && i > 0 && /:\s*$/.test(blocks[i - 1]))
84611
+ drop.add(i - 1);
84612
+ } else {
84613
+ blocks[i] = b.split("\n").filter((line) => !placeholder.test(line)).join("\n");
84614
+ }
84615
+ });
84616
+ return blocks.filter((_, i) => !drop.has(i)).map((b) => b.split(/(?<=[.!?])\s+/).filter((sent) => !mention.test(sent)).join(" ") || "").filter((b) => b.trim()).join("\n\n");
84617
+ }
84547
84618
  }
84548
84619
  });
84549
84620
 
@@ -97737,6 +97808,7 @@ var require_chat_tools = __commonJS({
97737
97808
  var lead_search_1 = require_lead_search();
97738
97809
  var ai_search_1 = require_ai_search();
97739
97810
  var pitch_text_1 = require_pitch_text();
97811
+ var outreach_template_1 = require_outreach_template();
97740
97812
  var receptionist_1 = require_receptionist();
97741
97813
  var places_1 = require_places();
97742
97814
  var booking_detect_1 = require_booking_detect();
@@ -98242,19 +98314,7 @@ Want it live on your own domain?`;
98242
98314
  }
98243
98315
  function outreachTemplate(db2) {
98244
98316
  const row = db2.get("SELECT value FROM settings WHERE key = ?", ["outreach_template"]);
98245
- return row?.value ?? `Hello,
98246
-
98247
- I came across {name} on Google and noticed you don't have a website yet, so I put together a free demo to show what one could look like:
98248
-
98249
- {site_url}
98250
-
98251
- It's built from your real reviews and photos. If you like it, I can put it live on your own domain with your details for a one-off fee of \xA3199 \u2014 no monthly charges.
98252
-
98253
- Would you be open to a quick chat this week?
98254
-
98255
- Best regards
98256
-
98257
- If you'd rather not hear from me again, just reply and let me know.`;
98317
+ return row?.value ?? outreach_template_1.OUTREACH_TEMPLATE;
98258
98318
  }
98259
98319
  function normaliseChannel(value) {
98260
98320
  switch (String(value ?? "").toLowerCase()) {
@@ -98416,19 +98476,7 @@ If you'd rather not hear from me again, just reply and let me know.`;
98416
98476
  const phone = (lead.phone ?? "").replace(/[^\d+]/g, "");
98417
98477
  const e164 = phone.startsWith("+") ? phone : phone.startsWith("0") ? `+44${phone.slice(1)}` : phone;
98418
98478
  const tplRow = db2.get("SELECT value FROM settings WHERE key = ?", ["outreach_template"]);
98419
- const template = tplRow?.value ?? `Hello,
98420
-
98421
- I came across {name} on Google and noticed you don't have a website yet, so I put together a free demo to show what one could look like:
98422
-
98423
- {site_url}
98424
-
98425
- It's built from your real reviews and photos. If you like it, I can put it live on your own domain with your details for a one-off fee of \xA3199 \u2014 no monthly charges.
98426
-
98427
- Would you be open to a quick chat this week?
98428
-
98429
- Best regards
98430
-
98431
- If you'd rather not hear from me again, just reply and let me know.`;
98479
+ const template = tplRow?.value ?? outreach_template_1.OUTREACH_TEMPLATE;
98432
98480
  const body = input.message ?? template.replace(/\{name\}/g, lead.name).replace(/\{site_url\}/g, lead.site_url ?? "");
98433
98481
  const url = `https://wa.me/${e164.replace(/^\+/, "")}?text=${encodeURIComponent(body)}`;
98434
98482
  return { url, message: body, phone: e164 };
@@ -98473,7 +98521,7 @@ If you'd rather not hear from me again, just reply and let me know.`;
98473
98521
  }
98474
98522
  let receptionistUrl = r.receptionist_url ?? null;
98475
98523
  let receptionistLine = r.receptionist_line ?? null;
98476
- if (!isBookingLead && !receptionistUrl && r.site_url && getDecryptedSetting("receptionist_auto") === "1") {
98524
+ if (!isBookingLead && !receptionistUrl && r.site_url && getDecryptedSetting("receptionist_auto") !== "0") {
98477
98525
  ctx.emitProgress?.({ channel: "outreach:progress", payload: { msg: `Setting up Front Desk for ${r.name}\u2026` } });
98478
98526
  try {
98479
98527
  const t = await (0, receptionist_1.createTrial)(r.id);
@@ -100494,7 +100542,7 @@ var require_package2 = __commonJS({
100494
100542
  "package.json"(exports2, module2) {
100495
100543
  module2.exports = {
100496
100544
  name: "sproutkit-code",
100497
- version: "1.16.0",
100545
+ version: "1.16.1",
100498
100546
  description: "Sproutkit in your terminal \u2014 find leads, build sites, run outreach, all via chat.",
100499
100547
  bin: {
100500
100548
  sproutkit: "./dist/index.js"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sproutkit-code",
3
- "version": "1.16.0",
3
+ "version": "1.16.1",
4
4
  "description": "Sproutkit in your terminal — find leads, build sites, run outreach, all via chat.",
5
5
  "bin": {
6
6
  "sproutkit": "./dist/index.js"