lancer-shared 1.2.33 → 1.2.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 (74) hide show
  1. package/dist/bundle.cjs.js +103 -32
  2. package/dist/constants/organization.d.ts +2 -2
  3. package/dist/constants/routes.d.ts +4 -0
  4. package/dist/constants/routes.js +0 -6
  5. package/dist/schemas/agent/index.d.ts +49 -133
  6. package/dist/schemas/campaign/campaign-analytics.d.ts +3975 -206
  7. package/dist/schemas/campaign/campaign-integrations.d.ts +5 -0
  8. package/dist/schemas/campaign/campaign.d.ts +24 -13
  9. package/dist/schemas/dashboard/index.d.ts +0 -20
  10. package/dist/schemas/index.d.ts +0 -1
  11. package/dist/schemas/job/job.d.ts +16 -16
  12. package/dist/schemas/job/pipeline-job.d.ts +3 -9
  13. package/dist/schemas/job/pipeline-job.js +0 -1
  14. package/dist/schemas/lead/index.d.ts +856 -14
  15. package/dist/schemas/lead/lead-status.d.ts +10 -7
  16. package/dist/schemas/logger/log-event.d.ts +5 -5
  17. package/dist/schemas/organization/cover-letter.d.ts +33 -0
  18. package/dist/schemas/organization/index.d.ts +89 -40
  19. package/dist/schemas/proxy/proxy.js +1 -3
  20. package/dist/schemas/scraper/scrape-payload.d.ts +20 -10
  21. package/dist/schemas/shared.d.ts +20 -0
  22. package/dist/schemas/upwork-account/index.d.ts +1 -1
  23. package/dist/schemas/upwork-account/index.js +1 -1
  24. package/dist/schemas/upwork-account/upwork-business-manager-account.d.ts +14 -14
  25. package/dist/schemas/upwork-account/upwork-business-manager-account.js +2 -2
  26. package/dist/schemas/upwork-account/upwork-scraping-account.d.ts +23 -23
  27. package/dist/schemas/upwork-account/upwork-scraping-account.js +3 -4
  28. package/dist/types/upwork-account/upwork-scraping-account.d.ts +2 -2
  29. package/package.json +1 -1
  30. package/dist/constants/proxies.d.ts +0 -4
  31. package/dist/constants/upwork-filters.d.ts +0 -5
  32. package/dist/constants/upwork-filters.js +0 -75
  33. package/dist/schemas/account/exceptions/no-bidder-accounts-available.d.ts +0 -5
  34. package/dist/schemas/ai-config/ai-config.d.ts +0 -39
  35. package/dist/schemas/ai-config/ai-config.js +0 -12
  36. package/dist/schemas/ai-config/index.d.ts +0 -1
  37. package/dist/schemas/ai-config/index.js +0 -17
  38. package/dist/schemas/bid/bid-status.d.ts +0 -30
  39. package/dist/schemas/bid/bid-status.js +0 -15
  40. package/dist/schemas/bid/exceptions/base-exception.d.ts +0 -4
  41. package/dist/schemas/bid/exceptions/evalute-element.exception.d.ts +0 -5
  42. package/dist/schemas/bid/exceptions/wait-for-function-timeout.d.ts +0 -5
  43. package/dist/schemas/bidding/proposal-dto.d.ts +0 -26
  44. package/dist/schemas/bidding/proposal-dto.js +0 -18
  45. package/dist/schemas/job/job-pipeline.d.ts +0 -74
  46. package/dist/schemas/job/job-pipeline.js +0 -29
  47. package/dist/schemas/job/job-suitability.d.ts +0 -12
  48. package/dist/schemas/job/job-suitability.js +0 -13
  49. package/dist/schemas/knowledge-object/index.d.ts +0 -1
  50. package/dist/schemas/knowledge-object/index.js +0 -17
  51. package/dist/schemas/knowledge-object/knowledge-object.d.ts +0 -128
  52. package/dist/schemas/knowledge-object/knowledge-object.js +0 -47
  53. package/dist/schemas/scraper/scrape-response.d.ts +0 -345
  54. package/dist/schemas/scraper/scrape-response.js +0 -9
  55. package/dist/schemas/upwork-account/upwork-scraper-account.d.ts +0 -92
  56. package/dist/schemas/upwork-account/upwork-scraper-account.js +0 -31
  57. package/dist/types/ai-config/ai-config.d.ts +0 -6
  58. package/dist/types/ai-config/ai-config.js +0 -2
  59. package/dist/types/ai-config/index.d.ts +0 -1
  60. package/dist/types/ai-config/index.js +0 -17
  61. package/dist/types/bid/bid-status.d.ts +0 -5
  62. package/dist/types/bid/bid-status.js +0 -2
  63. package/dist/types/bidding/proposal-dto.d.ts +0 -3
  64. package/dist/types/bidding/proposal-dto.js +0 -2
  65. package/dist/types/job/job-pipeline.d.ts +0 -4
  66. package/dist/types/job/job-pipeline.js +0 -2
  67. package/dist/types/job/job-suitability.d.ts +0 -3
  68. package/dist/types/job/job-suitability.js +0 -2
  69. package/dist/types/knowledge-object/index.d.ts +0 -1
  70. package/dist/types/knowledge-object/index.js +0 -17
  71. package/dist/types/knowledge-object/knowledge-object.d.ts +0 -4
  72. package/dist/types/knowledge-object/knowledge-object.js +0 -2
  73. package/dist/types/scraper/scrape-response.d.ts +0 -4
  74. package/dist/types/scraper/scrape-response.js +0 -2
@@ -336,15 +336,14 @@ const jobStatusOrder = [
336
336
  "contacted",
337
337
  "viewed",
338
338
  "replied",
339
- "interview",
340
339
  "won",
341
340
  "lost",
342
341
  ];
343
342
  const getPreviousStatus = (status) => {
344
343
  if (status === "won")
345
- return "interview";
344
+ return "replied";
346
345
  if (status === "lost")
347
- return "interview";
346
+ return "replied";
348
347
  const index = jobStatusOrder.indexOf(status);
349
348
  return index > 0 ? jobStatusOrder[index - 1] : null;
350
349
  };
@@ -6507,6 +6506,10 @@ const ROUTES = {
6507
6506
  BY_ID: (id) => `organizations/${id}`,
6508
6507
  ONBOARDING: (id) => `organizations/${id}/onboarding/progress`,
6509
6508
  AI_CONFIG: (id) => `organizations/${id}/settings/ai-config`,
6509
+ COVER_LETTER: {
6510
+ BASE: (id) => `organizations/${id}/cover-letter`,
6511
+ BY_ID: (id, coverLetterId) => `organizations/${id}/cover-letter/${coverLetterId}`,
6512
+ },
6510
6513
  PROFILE: (id) => `organizations/${id}/profile/data`,
6511
6514
  MEMBERS: {
6512
6515
  BASE: (id) => `organizations/${id}/members`,
@@ -11444,9 +11447,6 @@ const noGoogleOAuthTokensFoundException = (message) => new NoGoogleOAuthTokensFo
11444
11447
  const booleanSchema = z
11445
11448
  .union([z.boolean(), z.literal("true"), z.literal("false")])
11446
11449
  .transform((value) => value === true || value === "true");
11447
- const dateSchema = (params = {}) => coerce.date({
11448
- ...params,
11449
- });
11450
11450
  const passwordSchema = stringType()
11451
11451
  .min(8, "Password must be at least 8 characters long.")
11452
11452
  .max(255, "Password must be at most 255 characters long.")
@@ -11459,6 +11459,14 @@ const regionSchema = z.union([
11459
11459
  z.literal("UKOnly"),
11460
11460
  z.literal("Worldwide"),
11461
11461
  ]);
11462
+ z.object({
11463
+ id: z.string(),
11464
+ name: z.string(),
11465
+ });
11466
+ z.object({
11467
+ id: z.string(),
11468
+ name: z.string(),
11469
+ });
11462
11470
 
11463
11471
  const segmentationDataSchema = objectType({
11464
11472
  customValue: stringType().nullable(),
@@ -12022,7 +12030,6 @@ const leadStatusSchema = z.enum([
12022
12030
  "contacted",
12023
12031
  "viewed",
12024
12032
  "replied",
12025
- "interview",
12026
12033
  "won",
12027
12034
  "lost",
12028
12035
  ]);
@@ -12032,7 +12039,8 @@ const updateLeadStatusSchema = z.object({
12032
12039
  campaignId: z.string(),
12033
12040
  status: leadStatusSchema,
12034
12041
  proposalId: z.string().optional(),
12035
- userId: z.string(),
12042
+ userId: z.string().optional(),
12043
+ wonAmount: z.number().optional(),
12036
12044
  });
12037
12045
 
12038
12046
  const questionAnswerPairSchema = z.object({
@@ -12055,6 +12063,7 @@ const leadSchema = upworkJobSchema
12055
12063
  boostingAmount: numberType().nullable(),
12056
12064
  biddingTaskScheduled: booleanType().nullable(),
12057
12065
  scheduledBiddingTime: numberType().nullable(),
12066
+ wonAmount: numberType().optional(),
12058
12067
  })
12059
12068
  .omit({
12060
12069
  processed: true,
@@ -12076,7 +12085,7 @@ const findLeadsRequestSchema = z.object({
12076
12085
  // Lead Search Response Schema
12077
12086
  const findLeadsResponseSchema = z.object({
12078
12087
  total: z.number(),
12079
- jobs: z.array(upworkJobSchema),
12088
+ data: z.array(upworkJobSchema.or(leadSchema)),
12080
12089
  lastMonthTotal: z.number().optional(),
12081
12090
  error: z.string().optional(),
12082
12091
  });
@@ -12283,6 +12292,18 @@ const onboardingProgressSchema = z.object({
12283
12292
  automationEnabled: z.boolean(),
12284
12293
  });
12285
12294
 
12295
+ const coverLetterSchema = z.object({
12296
+ id: z.string(),
12297
+ name: z.string(),
12298
+ coverLetterExample: z.string(),
12299
+ coverLetterRules: z.string(),
12300
+ });
12301
+ const createCoverLetterSchema = coverLetterSchema.pick({
12302
+ name: true,
12303
+ coverLetterExample: true,
12304
+ coverLetterRules: true,
12305
+ });
12306
+
12286
12307
  const organizationTypeSchema = z.enum(["agency", "freelancer"]);
12287
12308
  const organizationTierEnum = z.enum(["free", "premium"]);
12288
12309
  const limitsSchema = objectType({
@@ -12303,6 +12324,27 @@ const organizationSchema = objectType({
12303
12324
  createdAt: numberType(),
12304
12325
  updatedAt: numberType(),
12305
12326
  });
12327
+ const caseStudySchema = objectType({
12328
+ title: stringType(),
12329
+ description: stringType(),
12330
+ });
12331
+ z.object({
12332
+ type: z.enum(["freelancer", "agency"]),
12333
+ name: z.string(),
12334
+ summary: z.string(),
12335
+ coreServices: z.string(),
12336
+ toolsSkillsTechnologies: z.string(),
12337
+ approach: z.string(),
12338
+ icp: z.string(),
12339
+ projectsTheyAvoid: z.string(),
12340
+ spokenLanguages: z.string(),
12341
+ agencyInfo: z.object({
12342
+ location: z.array(z.string()),
12343
+ website: z.string().url(),
12344
+ teamSize: z.number(),
12345
+ }),
12346
+ caseStudies: z.array(caseStudySchema),
12347
+ });
12306
12348
  const createOrganizationSchema = organizationSchema.pick({
12307
12349
  name: true,
12308
12350
  type: true,
@@ -12323,12 +12365,12 @@ const questionRulesSchema = objectType({
12323
12365
  category: stringType(),
12324
12366
  });
12325
12367
  const aiConfigSchema = objectType({
12326
- suitabilityRules: stringType().nullable(),
12327
- coverLetterRules: stringType().nullable(),
12328
- coverLetterTemplate: stringType().nullable(),
12368
+ // suitabilityRules: string().nullable(),
12369
+ // coverLetterRules: string().nullable(),
12370
+ // coverLetterTemplate: string().nullable(),
12329
12371
  questionRules: arrayType(questionRulesSchema).nullable(),
12330
- approvedSuitabilityJobs: numberType().nullable(),
12331
- approvedProposalJobs: numberType().nullable(),
12372
+ // approvedSuitabilityJobs: number().nullable(),
12373
+ // approvedProposalJobs: number().nullable(),
12332
12374
  });
12333
12375
  const notificationConfigSchema = objectType({
12334
12376
  emailEnabled: booleanType(),
@@ -12355,11 +12397,9 @@ const systemSchema = objectType({
12355
12397
  });
12356
12398
 
12357
12399
  const agentTaskRequestSchema = z.object({
12400
+ userId: z.string(),
12358
12401
  organizationId: z.string(),
12359
- userId: z.string().optional(),
12360
- campaignId: z.string().optional(),
12361
- leadId: z.string(),
12362
- aiConfig: aiConfigSchema,
12402
+ campaignId: z.string(),
12363
12403
  lead: leadSchema,
12364
12404
  });
12365
12405
  const testSystemPromptsRequestSchema = z.object({
@@ -12735,10 +12775,10 @@ const bidConfigSchema = z.object({
12735
12775
  specialisedProfile: z.string().nullable(),
12736
12776
  });
12737
12777
  const campaignStatusSchema = z.union([
12738
- z.literal('active'),
12739
- z.literal('draft'),
12740
- z.literal('paused'),
12741
- z.literal('error'),
12778
+ z.literal("active"),
12779
+ z.literal("draft"),
12780
+ z.literal("paused"),
12781
+ z.literal("error"),
12742
12782
  ]);
12743
12783
  const campaignSchema = z.object({
12744
12784
  id: z.string(),
@@ -12761,6 +12801,7 @@ const campaignSchema = z.object({
12761
12801
  notificationWebhooks: campaignNotificationWebhooks,
12762
12802
  status: campaignStatusSchema.optional(),
12763
12803
  bidConfig: bidConfigSchema.nullable(),
12804
+ coverLetterTemplateId: z.string().nullable(),
12764
12805
  });
12765
12806
  const createCampaignSchema = campaignSchema.omit({
12766
12807
  id: true,
@@ -12784,11 +12825,13 @@ const campaignAnalyticsSchema = z.object({
12784
12825
  contacted: z.number().optional(),
12785
12826
  viewed: z.number().optional(),
12786
12827
  replied: z.number().optional(),
12787
- interview: z.number().optional(),
12788
12828
  won: z.number().optional(),
12789
12829
  proposalsGenerated: z.number().optional(),
12790
12830
  leadsAnalyzed: z.number().optional(),
12791
12831
  leadsFailed: z.number().optional(),
12832
+ suitableJobs: z.number().optional(),
12833
+ unsuitableJobs: z.number().optional(),
12834
+ wonAmount: z.number().optional(),
12792
12835
  });
12793
12836
  const campaignAnalyticsStatsSchema = z.object({
12794
12837
  totalStats: campaignAnalyticsSchema,
@@ -12797,7 +12840,6 @@ const campaignAnalyticsStatsSchema = z.object({
12797
12840
  contacted: z.number(),
12798
12841
  viewed: z.number(),
12799
12842
  replied: z.number(),
12800
- interview: z.number(),
12801
12843
  won: z.number(),
12802
12844
  leadsAnalyzed: z.number(),
12803
12845
  })),
@@ -12807,7 +12849,6 @@ const campaignAnalyticsResponseSchema = z.object({
12807
12849
  contacted: z.number(),
12808
12850
  viewed: z.number(),
12809
12851
  replied: z.number(),
12810
- interview: z.number(),
12811
12852
  won: z.number(),
12812
12853
  });
12813
12854
  const campaignActivityTypeSchema = z.enum([
@@ -12819,7 +12860,15 @@ const campaignActivityTypeSchema = z.enum([
12819
12860
  const campaignStatusActivitySchema = z.object({
12820
12861
  type: z.literal("campaign_status"),
12821
12862
  createdAt: z.number(),
12822
- status: z.enum(["started", "paused"]),
12863
+ status: z.enum(["started", "paused", "created", "error"]),
12864
+ organization: organizationSchema.pick({
12865
+ id: true,
12866
+ name: true,
12867
+ }),
12868
+ campaign: campaignSchema.pick({
12869
+ id: true,
12870
+ name: true,
12871
+ }),
12823
12872
  });
12824
12873
  const leadAnalysisActivitySchema = z.object({
12825
12874
  type: z.literal("lead_analysis"),
@@ -12831,6 +12880,14 @@ const leadAnalysisActivitySchema = z.object({
12831
12880
  jobUrl: true,
12832
12881
  }),
12833
12882
  suitabilityRating: z.number().min(0).max(100),
12883
+ organization: organizationSchema.pick({
12884
+ id: true,
12885
+ name: true,
12886
+ }),
12887
+ campaign: campaignSchema.pick({
12888
+ id: true,
12889
+ name: true,
12890
+ }),
12834
12891
  });
12835
12892
  const leadStatusActivitySchema = z.object({
12836
12893
  type: z.literal("lead_status"),
@@ -12842,6 +12899,14 @@ const leadStatusActivitySchema = z.object({
12842
12899
  datetime: true,
12843
12900
  jobUrl: true,
12844
12901
  }),
12902
+ organization: organizationSchema.pick({
12903
+ id: true,
12904
+ name: true,
12905
+ }),
12906
+ campaign: campaignSchema.pick({
12907
+ id: true,
12908
+ name: true,
12909
+ }),
12845
12910
  });
12846
12911
  const proposalSentActivitySchema = z.object({
12847
12912
  type: z.literal("proposal_sent"),
@@ -12852,6 +12917,14 @@ const proposalSentActivitySchema = z.object({
12852
12917
  datetime: true,
12853
12918
  jobUrl: true,
12854
12919
  }),
12920
+ organization: organizationSchema.pick({
12921
+ id: true,
12922
+ name: true,
12923
+ }),
12924
+ campaign: campaignSchema.pick({
12925
+ id: true,
12926
+ name: true,
12927
+ }),
12855
12928
  });
12856
12929
  const campaignActivitySchema = z.discriminatedUnion("type", [
12857
12930
  campaignStatusActivitySchema,
@@ -12862,7 +12935,7 @@ const campaignActivitySchema = z.discriminatedUnion("type", [
12862
12935
  const campaignActivityCreateSchema = z.discriminatedUnion("type", [
12863
12936
  z.object({
12864
12937
  type: z.literal("campaign_status"),
12865
- status: z.enum(["started", "paused"]),
12938
+ status: z.enum(["started", "paused", "created", "error"]),
12866
12939
  }),
12867
12940
  z.object({
12868
12941
  type: z.literal("lead_analysis"),
@@ -13143,7 +13216,6 @@ const campaignStatsSchema = z.object({
13143
13216
  contacted: z.number(),
13144
13217
  viewed: z.number(),
13145
13218
  replied: z.number(),
13146
- interview: z.number(),
13147
13219
  won: z.number(),
13148
13220
  proposalsGenerated: z.number(),
13149
13221
  leadsAnalyzed: z.number(),
@@ -13592,7 +13664,6 @@ exports.bidderAccountProviderDisplayMap = bidderAccountProviderDisplayMap;
13592
13664
  exports.bidderAccountSchema = bidderAccountSchema;
13593
13665
  exports.biddingCompletedEventMetadata = biddingCompletedEventMetadata;
13594
13666
  exports.biddingFailedEventMetadata = biddingFailedEventMetadata;
13595
- exports.booleanSchema = booleanSchema;
13596
13667
  exports.buildRoute = buildRoute;
13597
13668
  exports.campaignAIMetricsSchema = campaignAIMetricsSchema;
13598
13669
  exports.campaignActivityCreateSchema = campaignActivityCreateSchema;
@@ -13610,6 +13681,7 @@ exports.campaignSchema = campaignSchema;
13610
13681
  exports.campaignStatusActivitySchema = campaignStatusActivitySchema;
13611
13682
  exports.campaignStatusSchema = campaignStatusSchema;
13612
13683
  exports.capitalize = capitalize;
13684
+ exports.caseStudySchema = caseStudySchema;
13613
13685
  exports.categoryEnum = categoryEnum;
13614
13686
  exports.checkLeadStatusPayloadSchema = checkLeadStatusPayloadSchema;
13615
13687
  exports.clientIndustryEnum = clientIndustryEnum;
@@ -13619,12 +13691,13 @@ exports.clientSizeEnum = clientSizeEnum;
13619
13691
  exports.cloudflareProtectionFailure = cloudflareProtectionFailure;
13620
13692
  exports.commonQuestions = commonQuestions;
13621
13693
  exports.countryMapping = countryMapping;
13694
+ exports.coverLetterSchema = coverLetterSchema;
13622
13695
  exports.createBidderAccountSchema = createBidderAccountSchema;
13623
13696
  exports.createCampaignSchema = createCampaignSchema;
13697
+ exports.createCoverLetterSchema = createCoverLetterSchema;
13624
13698
  exports.createOrganizationSchema = createOrganizationSchema;
13625
13699
  exports.createScraperAccountSchema = createScraperAccountSchema;
13626
13700
  exports.dailyUsageSchema = dailyUsageSchema;
13627
- exports.dateSchema = dateSchema;
13628
13701
  exports.deleteMultiloginProfileException = deleteMultiloginProfileException;
13629
13702
  exports.dropdownOptionNotPresentException = dropdownOptionNotPresentException;
13630
13703
  exports.elementNotClickableException = elementNotClickableException;
@@ -13706,7 +13779,6 @@ exports.organizationSettingsSchema = organizationSettingsSchema;
13706
13779
  exports.organizationTierEnum = organizationTierEnum;
13707
13780
  exports.organizationTypeSchema = organizationTypeSchema;
13708
13781
  exports.parseConnectsException = parseConnectsException;
13709
- exports.passwordSchema = passwordSchema;
13710
13782
  exports.paymentTypeEnum = paymentTypeEnum;
13711
13783
  exports.periodUsageSchema = periodUsageSchema;
13712
13784
  exports.planFeatureSchema = planFeatureSchema;
@@ -13730,7 +13802,6 @@ exports.questionPairNotMatchingException = questionPairNotMatchingException;
13730
13802
  exports.questionRulesSchema = questionRulesSchema;
13731
13803
  exports.regionEnum = regionEnum;
13732
13804
  exports.regionMapping = regionMapping;
13733
- exports.regionSchema = regionSchema;
13734
13805
  exports.registerSchema = registerSchema;
13735
13806
  exports.requiredEarningsEnum = requiredEarningsEnum;
13736
13807
  exports.requiredJSSEnum = requiredJSSEnum;
@@ -1,2 +1,2 @@
1
- import { CreditDeductionEventType } from "../schemas";
2
- export declare const creditDeductionAmountMap: Record<CreditDeductionEventType, number>;
1
+ import { TrackUsageEventType } from "../schemas";
2
+ export declare const creditDeductionAmountMap: Record<TrackUsageEventType, number>;
@@ -90,6 +90,10 @@ export declare const ROUTES: {
90
90
  readonly BY_ID: (id: string) => string;
91
91
  readonly ONBOARDING: (id: string) => string;
92
92
  readonly AI_CONFIG: (id: string) => string;
93
+ readonly COVER_LETTER: {
94
+ readonly BASE: (id: string) => string;
95
+ readonly BY_ID: (id: string, coverLetterId: string) => string;
96
+ };
93
97
  readonly PROFILE: (id: string) => string;
94
98
  readonly MEMBERS: {
95
99
  readonly BASE: (id: string) => string;
@@ -91,12 +91,6 @@ exports.ROUTES = {
91
91
  BY_PROVIDER: (provider) => `admin/scraper-accounts/${provider}`,
92
92
  BY_PROVIDER_AND_ID: (provider, id) => `admin/scraper-accounts/${provider}/${id}`,
93
93
  },
94
- PROXIES: {
95
- BASE: 'admin/proxies',
96
- BY_ID: (id) => `admin/proxies/${id}`,
97
- REPLACE_PROXY: (id) => `admin/proxies/${id}/replace`,
98
- SYNC: 'admin/proxies/sync',
99
- },
100
94
  },
101
95
  BID: {
102
96
  BASE: 'bid',