@dench.com/cli 3.12.13 → 3.12.14-staging.1275

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/app-sdk.d.ts CHANGED
@@ -390,13 +390,15 @@ export interface ApiRequests {
390
390
  pageToken?: string;
391
391
  checkDuplicatesAcrossWorkspace?: boolean;
392
392
  };
393
- /** Add up to 50 selected recipients without another search. Deduplicates, applies suppression, and preserves the campaign's launch state. — `dench campaign add --people-file` — POST /api/v1/campaigns/{sequenceId}/people/batch */
393
+ /** Add up to 300 selected recipients without another search. Chunks writes server-side, deduplicates, applies suppression, and preserves the campaign's launch state. — `dench campaign add --people-file` — POST /api/v1/campaigns/{sequenceId}/people/batch */
394
394
  "campaigns.people.addBatch": {
395
395
  sequenceId: string;
396
396
  recipients: {
397
397
  email?: string;
398
398
  linkedinProfileUrl?: string;
399
399
  displayName?: string;
400
+ /** Profile photo URL (https://...) shown on the person inside the campaign. */
401
+ avatarUrl?: string;
400
402
  /** Merge values keyed by name, e.g. {"Company":"Acme"} for {{Company}}. */
401
403
  personalization?: Record<string, unknown>;
402
404
  }[];
@@ -3118,6 +3120,7 @@ export interface ApiRequests {
3118
3120
  "campaigns.people.add": {
3119
3121
  sequenceId: string;
3120
3122
  displayName?: string;
3123
+ avatarUrl?: string;
3121
3124
  email?: string;
3122
3125
  linkedinProfileUrl?: string;
3123
3126
  /** Existing CRM people entry to link. */
@@ -3813,6 +3816,8 @@ export interface ApiResponses {
3813
3816
  email?: string;
3814
3817
  linkedinProfileUrl?: string;
3815
3818
  displayName?: string;
3819
+ /** Profile photo URL (https://...) shown on the person inside the campaign. */
3820
+ avatarUrl?: string;
3816
3821
  /** Merge values keyed by name, e.g. {"Company":"Acme"} for {{Company}}. */
3817
3822
  personalization?: Record<string, unknown>;
3818
3823
  }[];
@@ -3829,6 +3834,8 @@ export interface ApiResponses {
3829
3834
  email?: string;
3830
3835
  linkedinProfileUrl?: string;
3831
3836
  displayName?: string;
3837
+ /** Profile photo URL (https://...) shown on the person inside the campaign. */
3838
+ avatarUrl?: string;
3832
3839
  /** Merge values keyed by name, e.g. {"Company":"Acme"} for {{Company}}. */
3833
3840
  personalization?: Record<string, unknown>;
3834
3841
  }[];
@@ -9083,7 +9090,7 @@ export type DenchApiTree = {
9083
9090
  people: {
9084
9091
  /** Add one person by email and/or LinkedIn profile URL. (`dench campaign add --name`) */
9085
9092
  add(args: Req<"campaigns.people.add">): Promise<Res<"campaigns.people.add">>;
9086
- /** Add up to 50 selected recipients without another search. Deduplicates, applies suppression, and preserves the campaign's launch state. (`dench campaign add --people-file`) */
9093
+ /** Add up to 300 selected recipients without another search. Chunks writes server-side, deduplicates, applies suppression, and preserves the campaign's launch state. (`dench campaign add --people-file`) */
9087
9094
  addBatch(args: Req<"campaigns.people.addBatch">): Promise<Res<"campaigns.people.addBatch">>;
9088
9095
  /** Add CRM records (up to 100 ids per call) to a campaign; returns how many were added and why others were skipped. (`dench campaign add`) */
9089
9096
  addFromCrm(args: Req<"campaigns.people.addFromCrm">): Promise<Res<"campaigns.people.addFromCrm">>;
@@ -2810,6 +2810,12 @@ const campaignRecipient = z
2810
2810
  email: z.string().optional(),
2811
2811
  linkedinProfileUrl: z.string().optional(),
2812
2812
  displayName: z.string().optional(),
2813
+ avatarUrl: z
2814
+ .string()
2815
+ .optional()
2816
+ .describe(
2817
+ "Profile photo URL (https://...) shown on the person inside the campaign.",
2818
+ ),
2813
2819
  personalization: z
2814
2820
  .record(z.string(), z.unknown())
2815
2821
  .optional()
@@ -3408,7 +3414,7 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
3408
3414
  "campaigns.people.addBatch": z
3409
3415
  .object({
3410
3416
  sequenceId: z.string(),
3411
- recipients: z.array(campaignRecipient).min(1).max(50),
3417
+ recipients: z.array(campaignRecipient).min(1).max(300),
3412
3418
  newRecordsObject: z.enum(["lead", "people"]).optional(),
3413
3419
  checkDuplicatesAcrossWorkspace: z.boolean().optional(),
3414
3420
  })
@@ -3829,6 +3835,7 @@ export const requestSchemas: Record<string, ZodTypeAny> = {
3829
3835
  "campaigns.people.add": z.object({
3830
3836
  sequenceId: z.string(),
3831
3837
  displayName: z.string().optional(),
3838
+ avatarUrl: z.string().optional(),
3832
3839
  email: z.string().optional(),
3833
3840
  linkedinProfileUrl: z.string().optional(),
3834
3841
  entryId: z
@@ -99,7 +99,7 @@ export const APP_SDK_OPERATIONS: readonly AppSdkOperationInfo[] = [
99
99
  {"id":"campaigns.drafts.create","group":"campaigns","summary":"Create an idempotent empty campaign draft with the caller's available sender pools. Does not launch or send.","cli":"dench campaign draft","method":"POST","path":"/campaigns/drafts","permission":"campaigns:write","pathParams":[]},
100
100
  {"id":"campaigns.audience.search","group":"campaigns","summary":"Search people by filters without adding CRM records or campaign recipients. Search credits apply; this is not a free provider preview.","cli":"dench campaign search","method":"POST","path":"/campaigns/audience/search","permission":"campaigns:write","pathParams":[]},
101
101
  {"id":"campaigns.people.addFromSearch","group":"campaigns","summary":"Search and add up to 50 people to an existing campaign. New identities become Leads. Search credits apply; use nextPageToken for another page.","cli":"dench campaign add --search","method":"POST","path":"/campaigns/{sequenceId}/people/search","permission":"campaigns:write","pathParams":["sequenceId"]},
102
- {"id":"campaigns.people.addBatch","group":"campaigns","summary":"Add up to 50 selected recipients without another search. Deduplicates, applies suppression, and preserves the campaign's launch state.","cli":"dench campaign add --people-file","method":"POST","path":"/campaigns/{sequenceId}/people/batch","permission":"campaigns:write","pathParams":["sequenceId"]},
102
+ {"id":"campaigns.people.addBatch","group":"campaigns","summary":"Add up to 300 selected recipients without another search. Chunks writes server-side, deduplicates, applies suppression, and preserves the campaign's launch state.","cli":"dench campaign add --people-file","method":"POST","path":"/campaigns/{sequenceId}/people/batch","permission":"campaigns:write","pathParams":["sequenceId"]},
103
103
  {"id":"campaigns.sources.get","group":"campaigns","summary":"Read a campaign's saved signal source, targeting and schedule.","cli":"dench campaign sources get","method":"GET","path":"/campaigns/{sequenceId}/sources","permission":"campaigns:read","pathParams":["sequenceId"]},
104
104
  {"id":"campaigns.sources.signals","group":"campaigns","summary":"Read signal choices, suggested terms and current source configuration.","cli":"dench campaign sources signals","method":"GET","path":"/campaigns/{sequenceId}/sources/signals","permission":"campaigns:read","pathParams":["sequenceId"]},
105
105
  {"id":"campaigns.sources.update","group":"campaigns","summary":"Update source cadence, pause/resume, targeting, signals or terms. Active sources may perform billable future work.","cli":"dench campaign sources set","method":"PATCH","path":"/campaigns/{sequenceId}/sources","permission":"campaigns:write","pathParams":["sequenceId"]},
@@ -19,10 +19,12 @@ import { splitListValue } from "../leads";
19
19
  import { campaignAudienceFiltersSchema } from "./api-schemas";
20
20
  import {
21
21
  COLUMN_MAP_USAGE,
22
+ CSV_AVATAR_KEYS,
22
23
  type CsvColumn,
23
24
  detectDelimiter,
24
25
  MAX_CSV_CHARS,
25
26
  MAX_CSV_RECIPIENTS,
27
+ normalizeHttpAvatarUrl,
26
28
  parseColumnMap,
27
29
  parseRecipientTable,
28
30
  type RecipientTable,
@@ -197,6 +199,7 @@ type Recipient = {
197
199
  email?: string;
198
200
  linkedinProfileUrl?: string;
199
201
  displayName?: string;
202
+ avatarUrl?: string;
200
203
  personalization?: Record<string, unknown>;
201
204
  };
202
205
 
@@ -215,6 +218,12 @@ const RECIPIENT_ALIASES: Record<string, RecipientField> = {
215
218
  fullname: "displayName",
216
219
  };
217
220
 
221
+ /** Ordered photo-key aliases; resolved by priority rather than strict conflict
222
+ * because provider/LinkedIn/CRM JSON exports often carry multiple photo keys. */
223
+ const AVATAR_ALIAS_RANK = new Map<string, number>(
224
+ CSV_AVATAR_KEYS.map((alias, index) => [alias, index]),
225
+ );
226
+
218
227
  const MAX_PEOPLE_FILE_RECIPIENTS = 300;
219
228
  /**
220
229
  * People per `addEnrollments` call, as the app's Add people sends them
@@ -253,6 +262,7 @@ export function recipientFromRow(row: unknown, label: string): Recipient {
253
262
  );
254
263
  const recipient: Recipient = {};
255
264
  const seen: Partial<Record<RecipientField, string>> = {};
265
+ let bestAvatarRank: number | undefined;
256
266
  const extra: Record<string, unknown> = {};
257
267
  let personalization: Record<string, unknown> | undefined;
258
268
  let first = "";
@@ -277,7 +287,21 @@ export function recipientFromRow(row: unknown, label: string): Recipient {
277
287
  }
278
288
  continue;
279
289
  }
280
- const field = RECIPIENT_ALIASES[aliasKey(key)];
290
+ const normalizedKey = aliasKey(key);
291
+ const avatarRank = AVATAR_ALIAS_RANK.get(normalizedKey);
292
+ if (avatarRank !== undefined) {
293
+ if (isBlank(value)) continue;
294
+ const clean = normalizeHttpAvatarUrl(value);
295
+ if (
296
+ clean &&
297
+ (bestAvatarRank === undefined || avatarRank < bestAvatarRank)
298
+ ) {
299
+ recipient.avatarUrl = clean;
300
+ bestAvatarRank = avatarRank;
301
+ }
302
+ continue;
303
+ }
304
+ const field = RECIPIENT_ALIASES[normalizedKey];
281
305
  if (field) {
282
306
  if (isBlank(value)) continue;
283
307
  if (typeof value !== "string")
@@ -1013,7 +1037,7 @@ function listRowRecipient(row: unknown, index: number): Recipient {
1013
1037
  "Job Title": record.title,
1014
1038
  Website: record.website,
1015
1039
  Location: record.location,
1016
- Photo: record.avatarUrl,
1040
+ avatarUrl: record.avatarUrl,
1017
1041
  personalization: record.personalization,
1018
1042
  },
1019
1043
  `List row ${index + 1}`,
@@ -2,6 +2,7 @@ export type CsvRecipient = {
2
2
  email?: string;
3
3
  linkedinProfileUrl?: string;
4
4
  displayName?: string;
5
+ avatarUrl?: string;
5
6
  personalization?: Record<string, string>;
6
7
  };
7
8
 
@@ -751,6 +752,68 @@ function resolveNameColumns(
751
752
  return { first: pick("firstName"), last: pick("lastName") };
752
753
  }
753
754
 
755
+ export const CSV_AVATAR_KEYS = [
756
+ "avatarurl",
757
+ "avatar",
758
+ "photo",
759
+ "photourl",
760
+ "profilephoto",
761
+ "profilephotourl",
762
+ "profilepictureurl",
763
+ "profilepicture",
764
+ "profilepicurl",
765
+ "profilepic",
766
+ "profileimageurl",
767
+ "profileimage",
768
+ "profilepicturepermalink",
769
+ "pictureurl",
770
+ "picture",
771
+ "imageurl",
772
+ "headshoturl",
773
+ "headshot",
774
+ ] as const;
775
+
776
+ const AVATAR_URL_MAX = 1000;
777
+
778
+ /** Validates an http(s) avatar URL with no embedded credentials and bounded length. */
779
+ export function normalizeHttpAvatarUrl(value: unknown): string | undefined {
780
+ if (typeof value !== "string") return undefined;
781
+ const trimmed = value.trim();
782
+ if (!trimmed || trimmed.length > AVATAR_URL_MAX) return undefined;
783
+ try {
784
+ const parsed = new URL(trimmed);
785
+ if (parsed.protocol !== "https:" && parsed.protocol !== "http:") {
786
+ return undefined;
787
+ }
788
+ if (parsed.username || parsed.password) return undefined;
789
+ if (parsed.toString().length > AVATAR_URL_MAX) return undefined;
790
+ return trimmed;
791
+ } catch {
792
+ return undefined;
793
+ }
794
+ }
795
+
796
+ function extractCsvAvatarUrl(
797
+ personalization: Record<string, string> | undefined,
798
+ ): string | undefined {
799
+ if (!personalization) return undefined;
800
+ const byKey = new Map<string, string>();
801
+ for (const [key, raw] of Object.entries(personalization)) {
802
+ const clean = normalizeHttpAvatarUrl(raw);
803
+ if (!clean) continue;
804
+ const normalized = key
805
+ .replace(/^(crm|person):/i, "")
806
+ .toLowerCase()
807
+ .replace(/[^a-z0-9]/g, "");
808
+ if (normalized && !byKey.has(normalized)) byKey.set(normalized, clean);
809
+ }
810
+ for (const key of CSV_AVATAR_KEYS) {
811
+ const hit = byKey.get(key);
812
+ if (hit) return hit;
813
+ }
814
+ return undefined;
815
+ }
816
+
754
817
  export function recipientsFromTable(
755
818
  table: RecipientTable,
756
819
  mapping: RecipientColumnMapping = {},
@@ -820,6 +883,7 @@ export function recipientsFromTable(
820
883
  const personalization = table.hasHeader
821
884
  ? rowPersonalization(row, columnNames, consumed)
822
885
  : undefined;
886
+ const avatarUrl = extractCsvAvatarUrl(personalization);
823
887
  const name =
824
888
  rowDisplayName(row, nameColumns)?.trim() ||
825
889
  extractNameFromNamedEmail(emailRaw) ||
@@ -845,6 +909,7 @@ export function recipientsFromTable(
845
909
  seen.set(profileKey, existing);
846
910
  }
847
911
  if (name && !existing.displayName) existing.displayName = name;
912
+ if (avatarUrl && !existing.avatarUrl) existing.avatarUrl = avatarUrl;
848
913
  if (personalization && Object.keys(personalization).length > 0) {
849
914
  existing.personalization = {
850
915
  ...personalization,
@@ -857,6 +922,7 @@ export function recipientsFromTable(
857
922
  ...(address ? { email: address } : {}),
858
923
  ...(linkedinUrl ? { linkedinProfileUrl: linkedinUrl } : {}),
859
924
  ...(name ? { displayName: name } : {}),
925
+ ...(avatarUrl ? { avatarUrl } : {}),
860
926
  ...(personalization && Object.keys(personalization).length > 0
861
927
  ? { personalization }
862
928
  : {}),
@@ -386,13 +386,13 @@ const rawApiOperations = [
386
386
  id: "campaigns.people.addBatch",
387
387
  group: "campaigns",
388
388
  summary:
389
- "Add up to 50 selected recipients without another search. Deduplicates, applies suppression, and preserves the campaign's launch state.",
389
+ "Add up to 300 selected recipients without another search. Chunks writes server-side, deduplicates, applies suppression, and preserves the campaign's launch state.",
390
390
  cli: "dench campaign add --people-file",
391
391
  method: "POST",
392
392
  path: "/campaigns/{sequenceId}/people/batch",
393
393
  requestSchema: anyObject,
394
394
  responseSchema: anyResponse,
395
- backend: convex("mutation", "functions/outreachSequences:addEnrollments"),
395
+ backend: convex("action", "functions/outreachAudienceNode:addBatch"),
396
396
  }),
397
397
  op({
398
398
  id: "campaigns.sources.get",