lancer-shared 1.2.42 → 1.2.44

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.
@@ -1,5 +1,14 @@
1
1
  'use strict';
2
2
 
3
+ const CAMPAIGN_WEBHOOK_TYPES = {
4
+ suitableLead: 'suitableLead',
5
+ proposalSent: 'proposalSent',
6
+ proposalViewed: 'proposalViewed',
7
+ proposalReplied: 'proposalReplied',
8
+ lowConnects: 'lowConnects',
9
+ accountHealth: 'accountHealth',
10
+ };
11
+
3
12
  const commonQuestions = [
4
13
  {
5
14
  id: 'similar_experience',
@@ -6543,6 +6552,7 @@ const ROUTES = {
6543
6552
  GENERATE_COUNTS: (organizationId, campaignId) => `organizations/${organizationId}/campaigns/${campaignId}/leads/generate-counts`,
6544
6553
  },
6545
6554
  ANALYTICS: (organizationId, campaignId) => `organizations/${organizationId}/campaigns/${campaignId}/analytics`,
6555
+ TOTAL_STATS: (organizationId, campaignId) => `organizations/${organizationId}/campaigns/${campaignId}/analytics/totals`,
6546
6556
  ACTIVITIES: {
6547
6557
  BASE: (organizationId, campaignId) => `organizations/${organizationId}/campaigns/${campaignId}/activities`,
6548
6558
  BY_ID: (organizationId, campaignId, activityId) => `organizations/${organizationId}/campaigns/${campaignId}/activities/${activityId}`,
@@ -12757,15 +12767,21 @@ const campaignExpensesSchema = z.object({
12757
12767
  const campaignNotificationType = z.enum([
12758
12768
  'suitableLead',
12759
12769
  'proposalSent',
12760
- 'proposalFailed',
12761
12770
  'proposalViewed',
12762
12771
  'proposalReplied',
12763
12772
  'lowConnects',
12764
- 'leadAnalyzed',
12765
12773
  'accountHealth',
12766
12774
  ]);
12767
- const campaignNotificationWebhooks = z.record(campaignNotificationType, z.string().url().nullable());
12768
- const updateCampaignNotificationWebhooksSchema = z.record(campaignNotificationType, z.string().url());
12775
+ const campaignWebhookSettingsSchema = z.object(Object.fromEntries(Object.values(campaignNotificationType.enum).map((type) => [
12776
+ type,
12777
+ z.boolean().default(false),
12778
+ ])));
12779
+ const campaignWebhookSchema = z.object({
12780
+ id: z.string(),
12781
+ title: z.string(),
12782
+ url: z.string().url(),
12783
+ notificationSettings: campaignWebhookSettingsSchema,
12784
+ });
12769
12785
 
12770
12786
  const bidConfigSchema = z.object({
12771
12787
  agencyName: z.string().nullable(),
@@ -12774,10 +12790,10 @@ const bidConfigSchema = z.object({
12774
12790
  specialisedProfile: z.string().nullable(),
12775
12791
  });
12776
12792
  const campaignStatusSchema = z.union([
12777
- z.literal("active"),
12778
- z.literal("draft"),
12779
- z.literal("paused"),
12780
- z.literal("error"),
12793
+ z.literal('active'),
12794
+ z.literal('draft'),
12795
+ z.literal('paused'),
12796
+ z.literal('error'),
12781
12797
  ]);
12782
12798
  const campaignSchema = z.object({
12783
12799
  id: z.string(),
@@ -12789,14 +12805,14 @@ const campaignSchema = z.object({
12789
12805
  // automatedSuitability: z.boolean().nullable(),
12790
12806
  boostingEnabled: z.boolean().nullable().default(false),
12791
12807
  maximumBoost: z.number().nullable().default(30),
12792
- minimumBoost: z.number().nullable().default(0),
12793
- webhookUrl: z.string().nullable(),
12808
+ // minimumBoost: z.number().nullable().default(0),
12794
12809
  monthlyBudget: z.number().nullable(),
12795
12810
  // suitabilityThreshold: z.number().min(0).max(100).nullable().default(0),
12796
12811
  boostingThreshold: z.number().min(0).max(100).nullable().default(0),
12797
12812
  leadCounts: z.record(leadStatusSchema, z.number()).nullable(),
12798
12813
  expenses: campaignExpensesSchema,
12799
- notificationWebhooks: campaignNotificationWebhooks,
12814
+ notificationsEnabled: z.boolean().nullable(),
12815
+ webhooks: z.array(campaignWebhookSchema),
12800
12816
  status: campaignStatusSchema.optional(),
12801
12817
  bidConfig: bidConfigSchema.nullable(),
12802
12818
  coverLetterTemplateId: z.string().nullable(),
@@ -12856,10 +12872,8 @@ const campaignActivityTypeSchema = z.enum([
12856
12872
  "lead_status",
12857
12873
  "proposal_sent",
12858
12874
  ]);
12859
- const campaignStatusActivitySchema = z.object({
12860
- type: z.literal("campaign_status"),
12875
+ const baseActivitySchema = z.object({
12861
12876
  createdAt: z.number(),
12862
- status: z.enum(["started", "paused", "created", "error"]),
12863
12877
  organization: organizationSchema.pick({
12864
12878
  id: true,
12865
12879
  name: true,
@@ -12869,9 +12883,15 @@ const campaignStatusActivitySchema = z.object({
12869
12883
  name: true,
12870
12884
  }),
12871
12885
  });
12872
- const leadAnalysisActivitySchema = z.object({
12886
+ const campaignStatusActivityExtraSchema = z.object({
12887
+ type: z.literal("campaign_status"),
12888
+ status: z.enum(["started", "paused", "created", "error"]),
12889
+ });
12890
+ const campaignStatusActivitySchema = baseActivitySchema.extend({
12891
+ ...campaignStatusActivityExtraSchema.shape,
12892
+ });
12893
+ const leadAnalysisActivityExtraSchema = z.object({
12873
12894
  type: z.literal("lead_analysis"),
12874
- createdAt: z.number(),
12875
12895
  lead: leadSchema.pick({
12876
12896
  id: true,
12877
12897
  title: true,
@@ -12879,18 +12899,12 @@ const leadAnalysisActivitySchema = z.object({
12879
12899
  jobUrl: true,
12880
12900
  }),
12881
12901
  suitabilityRating: z.number().min(0).max(100),
12882
- organization: organizationSchema.pick({
12883
- id: true,
12884
- name: true,
12885
- }),
12886
- campaign: campaignSchema.pick({
12887
- id: true,
12888
- name: true,
12889
- }),
12890
12902
  });
12891
- const leadStatusActivitySchema = z.object({
12903
+ const leadAnalysisActivitySchema = baseActivitySchema.extend({
12904
+ ...leadAnalysisActivityExtraSchema.shape,
12905
+ });
12906
+ const leadStatusActivityExtraSchema = z.object({
12892
12907
  type: z.literal("lead_status"),
12893
- createdAt: z.number(),
12894
12908
  status: leadStatusSchema,
12895
12909
  lead: leadSchema.pick({
12896
12910
  id: true,
@@ -12898,32 +12912,21 @@ const leadStatusActivitySchema = z.object({
12898
12912
  datetime: true,
12899
12913
  jobUrl: true,
12900
12914
  }),
12901
- organization: organizationSchema.pick({
12902
- id: true,
12903
- name: true,
12904
- }),
12905
- campaign: campaignSchema.pick({
12906
- id: true,
12907
- name: true,
12908
- }),
12909
12915
  });
12910
- const proposalSentActivitySchema = z.object({
12916
+ const leadStatusActivitySchema = baseActivitySchema.extend({
12917
+ ...leadStatusActivityExtraSchema.shape,
12918
+ });
12919
+ const proposalSentActivityExtraSchema = z.object({
12911
12920
  type: z.literal("proposal_sent"),
12912
- createdAt: z.number(),
12913
12921
  lead: leadSchema.pick({
12914
12922
  id: true,
12915
12923
  title: true,
12916
12924
  datetime: true,
12917
12925
  jobUrl: true,
12918
12926
  }),
12919
- organization: organizationSchema.pick({
12920
- id: true,
12921
- name: true,
12922
- }),
12923
- campaign: campaignSchema.pick({
12924
- id: true,
12925
- name: true,
12926
- }),
12927
+ });
12928
+ const proposalSentActivitySchema = baseActivitySchema.extend({
12929
+ ...proposalSentActivityExtraSchema.shape,
12927
12930
  });
12928
12931
  const campaignActivitySchema = z.discriminatedUnion("type", [
12929
12932
  campaignStatusActivitySchema,
@@ -12932,39 +12935,10 @@ const campaignActivitySchema = z.discriminatedUnion("type", [
12932
12935
  proposalSentActivitySchema,
12933
12936
  ]);
12934
12937
  const campaignActivityCreateSchema = z.discriminatedUnion("type", [
12935
- z.object({
12936
- type: z.literal("campaign_status"),
12937
- status: z.enum(["started", "paused", "created", "error"]),
12938
- }),
12939
- z.object({
12940
- type: z.literal("lead_analysis"),
12941
- lead: leadSchema.pick({
12942
- id: true,
12943
- title: true,
12944
- datetime: true,
12945
- jobUrl: true,
12946
- }),
12947
- suitabilityRating: z.number().min(0).max(100),
12948
- }),
12949
- z.object({
12950
- type: z.literal("lead_status"),
12951
- status: leadStatusSchema,
12952
- lead: leadSchema.pick({
12953
- id: true,
12954
- title: true,
12955
- datetime: true,
12956
- jobUrl: true,
12957
- }),
12958
- }),
12959
- z.object({
12960
- type: z.literal("proposal_sent"),
12961
- lead: leadSchema.pick({
12962
- id: true,
12963
- title: true,
12964
- datetime: true,
12965
- jobUrl: true,
12966
- }),
12967
- }),
12938
+ campaignStatusActivityExtraSchema,
12939
+ leadAnalysisActivityExtraSchema,
12940
+ leadStatusActivityExtraSchema,
12941
+ proposalSentActivityExtraSchema,
12968
12942
  ]);
12969
12943
  const updateCampaignAnalyticsSchema = z.object({
12970
12944
  organizationId: z.string(),
@@ -13604,6 +13578,7 @@ const capitalize = (str) => {
13604
13578
  const generateSlug = (name) => slugify(name, { lower: true, trim: true, replacement: "-" });
13605
13579
 
13606
13580
  exports.BidderAccountAlreadyConnectedException = BidderAccountAlreadyConnectedException;
13581
+ exports.CAMPAIGN_WEBHOOK_TYPES = CAMPAIGN_WEBHOOK_TYPES;
13607
13582
  exports.CloudflareChallengeFailedException = CloudflareChallengeFailedException;
13608
13583
  exports.DeleteMultiloginProfileException = DeleteMultiloginProfileException;
13609
13584
  exports.DropdownOptionNotPresentException = DropdownOptionNotPresentException;
@@ -13678,10 +13653,11 @@ exports.campaignCountByStatusSchema = campaignCountByStatusSchema;
13678
13653
  exports.campaignExpensesSchema = campaignExpensesSchema;
13679
13654
  exports.campaignInsightsSchema = campaignInsightsSchema;
13680
13655
  exports.campaignNotificationType = campaignNotificationType;
13681
- exports.campaignNotificationWebhooks = campaignNotificationWebhooks;
13682
13656
  exports.campaignSchema = campaignSchema;
13683
13657
  exports.campaignStatusActivitySchema = campaignStatusActivitySchema;
13684
13658
  exports.campaignStatusSchema = campaignStatusSchema;
13659
+ exports.campaignWebhookSchema = campaignWebhookSchema;
13660
+ exports.campaignWebhookSettingsSchema = campaignWebhookSettingsSchema;
13685
13661
  exports.capitalize = capitalize;
13686
13662
  exports.caseStudySchema = caseStudySchema;
13687
13663
  exports.categoryEnum = categoryEnum;
@@ -13850,7 +13826,6 @@ exports.typedValueInFieldNotMatchingException = typedValueInFieldNotMatchingExce
13850
13826
  exports.typingInputFieldException = typingInputFieldException;
13851
13827
  exports.updateBidderAccountSchema = updateBidderAccountSchema;
13852
13828
  exports.updateCampaignAnalyticsSchema = updateCampaignAnalyticsSchema;
13853
- exports.updateCampaignNotificationWebhooksSchema = updateCampaignNotificationWebhooksSchema;
13854
13829
  exports.updateCampaignSchema = updateCampaignSchema;
13855
13830
  exports.updateLeadStatusSchema = updateLeadStatusSchema;
13856
13831
  exports.updateScraperAccountSchema = updateScraperAccountSchema;
@@ -0,0 +1,2 @@
1
+ import { CampaignNotificationType } from '../schemas/campaign/campaign-webhooks';
2
+ export declare const CAMPAIGN_WEBHOOK_TYPES: Record<CampaignNotificationType, string>;
@@ -1,8 +1,9 @@
1
- export * from "./common-questions";
2
- export * from "./invoice";
3
- export * from "./job-filter-options";
4
- export * from "./job-status";
5
- export { default as countryMapping } from "./mappings/countryMapping";
6
- export { default as regionMapping } from "./mappings/regionMapping";
7
- export * from "./routes";
8
- export * from "./upwork-accounts";
1
+ export * from './campaign-webhook-types';
2
+ export * from './common-questions';
3
+ export * from './invoice';
4
+ export * from './job-filter-options';
5
+ export * from './job-status';
6
+ export { default as countryMapping } from './mappings/countryMapping';
7
+ export { default as regionMapping } from './mappings/regionMapping';
8
+ export * from './routes';
9
+ export * from './upwork-accounts';
@@ -127,6 +127,7 @@ export declare const ROUTES: {
127
127
  readonly GENERATE_COUNTS: (organizationId: string, campaignId: string) => string;
128
128
  };
129
129
  readonly ANALYTICS: (organizationId: string, campaignId: string) => string;
130
+ readonly TOTAL_STATS: (organizationId: string, campaignId: string) => string;
130
131
  readonly ACTIVITIES: {
131
132
  readonly BASE: (organizationId: string, campaignId: string) => string;
132
133
  readonly BY_ID: (organizationId: string, campaignId: string, activityId: string) => string;