lancer-shared 1.2.139 → 1.2.141

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 (215) hide show
  1. package/dist/bundle.cjs.js +819 -652
  2. package/dist/constants/collections.js +11 -13
  3. package/dist/constants/common-questions.js +1 -4
  4. package/dist/constants/index.d.ts +1 -0
  5. package/dist/constants/index.js +10 -32
  6. package/dist/constants/job-filter-options.js +1 -4
  7. package/dist/constants/job-status.js +7 -12
  8. package/dist/constants/mappings/countryMapping.js +1 -3
  9. package/dist/constants/mappings/regionMapping.js +1 -3
  10. package/dist/constants/organization.d.ts +2 -2
  11. package/dist/constants/plan.d.ts +3 -0
  12. package/dist/constants/routes.js +39 -37
  13. package/dist/constants/upwork-accounts.js +3 -6
  14. package/dist/index.js +4 -20
  15. package/dist/schemas/account/account-status.js +2 -5
  16. package/dist/schemas/account/bidder-account.js +22 -24
  17. package/dist/schemas/account/index.js +3 -19
  18. package/dist/schemas/account/scraper-account.js +21 -24
  19. package/dist/schemas/ai/ai-config.js +8 -11
  20. package/dist/schemas/ai/index.js +3 -19
  21. package/dist/schemas/ai/proposal.js +10 -13
  22. package/dist/schemas/ai/suitability.js +8 -11
  23. package/dist/schemas/bid/bid-result.js +9 -13
  24. package/dist/schemas/bid/bid.d.ts +76 -0
  25. package/dist/schemas/bid/bid.js +29 -30
  26. package/dist/schemas/bid/index.js +2 -18
  27. package/dist/schemas/campaign/campaign-ai-metrics.js +5 -8
  28. package/dist/schemas/campaign/campaign-analytics.d.ts +360 -0
  29. package/dist/schemas/campaign/campaign-analytics.js +32 -31
  30. package/dist/schemas/campaign/campaign-expenses.js +5 -8
  31. package/dist/schemas/campaign/campaign-insights.js +30 -30
  32. package/dist/schemas/campaign/campaign-integrations.d.ts +5 -0
  33. package/dist/schemas/campaign/campaign-integrations.js +10 -13
  34. package/dist/schemas/campaign/campaign-job-count.js +3 -6
  35. package/dist/schemas/campaign/campaign.d.ts +29 -0
  36. package/dist/schemas/campaign/campaign.js +32 -35
  37. package/dist/schemas/campaign/index.js +7 -23
  38. package/dist/schemas/chat-message/chat-message.js +7 -10
  39. package/dist/schemas/chat-message/index.js +1 -17
  40. package/dist/schemas/config/agency-config.js +6 -9
  41. package/dist/schemas/config/index.js +1 -17
  42. package/dist/schemas/event/index.d.ts +58 -0
  43. package/dist/schemas/index.d.ts +1 -0
  44. package/dist/schemas/index.js +17 -32
  45. package/dist/schemas/job/haha.json +581 -0
  46. package/dist/schemas/job-filters/index.js +1 -17
  47. package/dist/schemas/job-filters/job-filters.js +62 -65
  48. package/dist/schemas/lead/index.js +173 -19
  49. package/dist/schemas/lead/lead-note.js +13 -16
  50. package/dist/schemas/lead/lead-status.js +3 -6
  51. package/dist/schemas/lead/nuxt.js +287 -0
  52. package/dist/schemas/logger/index.js +1 -17
  53. package/dist/schemas/logger/log-event.js +100 -49
  54. package/dist/schemas/meter-event/index.d.ts +12 -0
  55. package/dist/schemas/organization/index.d.ts +16 -7
  56. package/dist/schemas/organization/index.js +70 -17
  57. package/dist/schemas/organization/member.js +7 -0
  58. package/dist/schemas/organization/organization.d.ts +177 -7
  59. package/dist/schemas/organization/organization.js +14 -17
  60. package/dist/schemas/organization/subscription.js +17 -0
  61. package/dist/schemas/profile/index.d.ts +2551 -0
  62. package/dist/schemas/proxy/index.js +3 -17
  63. package/dist/schemas/proxy/proxy-available-replacements.js +3 -0
  64. package/dist/schemas/proxy/proxy-country.js +249 -0
  65. package/dist/schemas/proxy/proxy.js +25 -19
  66. package/dist/schemas/saved-search/index.js +8 -11
  67. package/dist/schemas/scraper/exceptions.d.ts +13 -1
  68. package/dist/schemas/scraper/index.js +2 -18
  69. package/dist/schemas/scraper/scrape-payload.d.ts +102 -0
  70. package/dist/schemas/scraper/scrape-payload.js +19 -14
  71. package/dist/schemas/scraper/scrape-result.js +21 -21
  72. package/dist/schemas/shared.js +12 -9
  73. package/dist/schemas/talent/index.d.ts +1314 -0
  74. package/dist/schemas/tier/index.d.ts +119 -0
  75. package/dist/schemas/time-filter/index.js +5 -8
  76. package/dist/schemas/transaction/index.js +17 -0
  77. package/dist/schemas/usage/index.js +18 -0
  78. package/dist/schemas/user/index.js +38 -41
  79. package/dist/types/account/account-status.js +1 -2
  80. package/dist/types/account/bidder-account.js +1 -2
  81. package/dist/types/account/index.js +3 -19
  82. package/dist/types/account/scraper-account.js +1 -2
  83. package/dist/types/ai/ai-config.js +1 -2
  84. package/dist/types/ai/index.js +3 -19
  85. package/dist/types/ai/proposal.js +1 -2
  86. package/dist/types/ai/suitability.js +1 -2
  87. package/dist/types/bid/bid-result.js +1 -2
  88. package/dist/types/bid/bid.js +1 -2
  89. package/dist/types/bid/index.js +2 -18
  90. package/dist/types/campaign/campaign-analytics.js +1 -2
  91. package/dist/types/campaign/campaign-expenses.js +1 -2
  92. package/dist/types/campaign/campaign-insights.js +1 -2
  93. package/dist/types/campaign/campaign-integrations.js +1 -2
  94. package/dist/types/campaign/campaign-job-count.js +1 -2
  95. package/dist/types/campaign/campaign.js +1 -2
  96. package/dist/types/campaign/index.js +6 -22
  97. package/dist/types/chat-message/chat-message.js +1 -2
  98. package/dist/types/chat-message/index.js +1 -17
  99. package/dist/types/config/agency-config.js +1 -2
  100. package/dist/types/config/index.js +1 -17
  101. package/dist/types/index.js +15 -29
  102. package/dist/types/job/index.js +3 -19
  103. package/dist/types/job/job-note.js +1 -2
  104. package/dist/types/job/job-status.js +1 -4
  105. package/dist/types/job/nuxt.js +1 -0
  106. package/dist/types/job-filters/index.js +1 -17
  107. package/dist/types/job-filters/job-filters.js +1 -2
  108. package/dist/types/logger/index.js +1 -17
  109. package/dist/types/logger/log-event.js +1 -2
  110. package/dist/types/saved-search/index.js +1 -2
  111. package/dist/types/scraper/index.js +2 -18
  112. package/dist/types/scraper/scrape-payload.js +1 -2
  113. package/dist/types/scraper/scrape-result.js +1 -2
  114. package/dist/types/shared.js +1 -0
  115. package/dist/types/time-filter/index.js +1 -2
  116. package/dist/types/transaction/index.js +1 -0
  117. package/dist/types/usage/index.js +1 -0
  118. package/dist/types/user/index.js +1 -2
  119. package/dist/utils/index.js +1 -17
  120. package/dist/utils/try-catch.js +8 -23
  121. package/package.json +1 -1
  122. package/dist/constants/account-status.d.ts +0 -3
  123. package/dist/constants/account-status.js +0 -17
  124. package/dist/constants/proxies.d.ts +0 -4
  125. package/dist/constants/upwork-filters.d.ts +0 -5
  126. package/dist/constants/upwork-filters.js +0 -75
  127. package/dist/schemas/account/exceptions/no-bidder-accounts-available.d.ts +0 -5
  128. package/dist/schemas/account/manager-account.d.ts +0 -116
  129. package/dist/schemas/account/manager-account.js +0 -38
  130. package/dist/schemas/ai-config/ai-config.d.ts +0 -39
  131. package/dist/schemas/ai-config/ai-config.js +0 -12
  132. package/dist/schemas/ai-config/index.d.ts +0 -1
  133. package/dist/schemas/ai-config/index.js +0 -17
  134. package/dist/schemas/bid/bid-status.d.ts +0 -30
  135. package/dist/schemas/bid/bid-status.js +0 -15
  136. package/dist/schemas/bid/exceptions/base-exception.d.ts +0 -4
  137. package/dist/schemas/bid/exceptions/evalute-element.exception.d.ts +0 -5
  138. package/dist/schemas/bid/exceptions/wait-for-function-timeout.d.ts +0 -5
  139. package/dist/schemas/bidding/index.d.ts +0 -1
  140. package/dist/schemas/bidding/index.js +0 -17
  141. package/dist/schemas/bidding/proposal-bidding-status.d.ts +0 -26
  142. package/dist/schemas/bidding/proposal-bidding-status.js +0 -18
  143. package/dist/schemas/bidding/proposal-dto.d.ts +0 -26
  144. package/dist/schemas/bidding/proposal-dto.js +0 -18
  145. package/dist/schemas/job/feed-job.d.ts +0 -866
  146. package/dist/schemas/job/index.js +0 -19
  147. package/dist/schemas/job/job-details.js +0 -29
  148. package/dist/schemas/job/job-note.d.ts +0 -83
  149. package/dist/schemas/job/job-note.js +0 -30
  150. package/dist/schemas/job/job-pipeline.d.ts +0 -74
  151. package/dist/schemas/job/job-pipeline.js +0 -29
  152. package/dist/schemas/job/job-status.d.ts +0 -3
  153. package/dist/schemas/job/job-status.js +0 -27
  154. package/dist/schemas/job/job-suitability.d.ts +0 -12
  155. package/dist/schemas/job/job-suitability.js +0 -13
  156. package/dist/schemas/job/job.d.ts +0 -1160
  157. package/dist/schemas/job/job.js +0 -90
  158. package/dist/schemas/job/pipeline-job.d.ts +0 -608
  159. package/dist/schemas/job/pipeline-job.js +0 -43
  160. package/dist/schemas/job/upwork-job.d.ts +0 -334
  161. package/dist/schemas/job/upwork-job.js +0 -60
  162. package/dist/schemas/knowledge-object/index.d.ts +0 -1
  163. package/dist/schemas/knowledge-object/index.js +0 -17
  164. package/dist/schemas/knowledge-object/knowledge-object.d.ts +0 -128
  165. package/dist/schemas/knowledge-object/knowledge-object.js +0 -47
  166. package/dist/schemas/lead/lead.d.ts +0 -1897
  167. package/dist/schemas/lead/lead.js +0 -143
  168. package/dist/schemas/scraper/scrape-response.d.ts +0 -345
  169. package/dist/schemas/scraper/scrape-response.js +0 -9
  170. package/dist/schemas/upwork-account/index.d.ts +0 -3
  171. package/dist/schemas/upwork-account/index.js +0 -19
  172. package/dist/schemas/upwork-account/upwork-account-status.d.ts +0 -2
  173. package/dist/schemas/upwork-account/upwork-account-status.js +0 -11
  174. package/dist/schemas/upwork-account/upwork-business-manager-account.d.ts +0 -95
  175. package/dist/schemas/upwork-account/upwork-business-manager-account.js +0 -35
  176. package/dist/schemas/upwork-account/upwork-scraper-account.d.ts +0 -92
  177. package/dist/schemas/upwork-account/upwork-scraper-account.js +0 -31
  178. package/dist/schemas/upwork-account/upwork-scraping-account.d.ts +0 -90
  179. package/dist/schemas/upwork-account/upwork-scraping-account.js +0 -30
  180. package/dist/types/account/manager-account.d.ts +0 -7
  181. package/dist/types/account/manager-account.js +0 -2
  182. package/dist/types/ai-config/ai-config.d.ts +0 -6
  183. package/dist/types/ai-config/ai-config.js +0 -2
  184. package/dist/types/ai-config/index.d.ts +0 -1
  185. package/dist/types/ai-config/index.js +0 -17
  186. package/dist/types/bid/bid-status.d.ts +0 -5
  187. package/dist/types/bid/bid-status.js +0 -2
  188. package/dist/types/bidding/index.d.ts +0 -1
  189. package/dist/types/bidding/index.js +0 -17
  190. package/dist/types/bidding/proposal-bidding-status.d.ts +0 -3
  191. package/dist/types/bidding/proposal-bidding-status.js +0 -2
  192. package/dist/types/bidding/proposal-dto.d.ts +0 -3
  193. package/dist/types/bidding/proposal-dto.js +0 -2
  194. package/dist/types/job/job-details.d.ts +0 -36
  195. package/dist/types/job/job-details.js +0 -2
  196. package/dist/types/job/job-pipeline.d.ts +0 -4
  197. package/dist/types/job/job-pipeline.js +0 -2
  198. package/dist/types/job/job-suitability.d.ts +0 -3
  199. package/dist/types/job/job-suitability.js +0 -2
  200. package/dist/types/job/job.d.ts +0 -36
  201. package/dist/types/job/job.js +0 -2
  202. package/dist/types/knowledge-object/index.d.ts +0 -1
  203. package/dist/types/knowledge-object/index.js +0 -17
  204. package/dist/types/knowledge-object/knowledge-object.d.ts +0 -4
  205. package/dist/types/knowledge-object/knowledge-object.js +0 -2
  206. package/dist/types/scraper/scrape-response.d.ts +0 -4
  207. package/dist/types/scraper/scrape-response.js +0 -2
  208. package/dist/types/upwork-account/index.d.ts +0 -3
  209. package/dist/types/upwork-account/index.js +0 -19
  210. package/dist/types/upwork-account/upwork-account-status.d.ts +0 -3
  211. package/dist/types/upwork-account/upwork-account-status.js +0 -2
  212. package/dist/types/upwork-account/upwork-business-manager-account.d.ts +0 -7
  213. package/dist/types/upwork-account/upwork-business-manager-account.js +0 -2
  214. package/dist/types/upwork-account/upwork-scraping-account.d.ts +0 -5
  215. package/dist/types/upwork-account/upwork-scraping-account.js +0 -2
@@ -6689,6 +6689,10 @@ const bidderAccountProviderDisplayMap = {
6689
6689
  'user-provided': 'User Provided',
6690
6690
  };
6691
6691
 
6692
+ const planSlugToNameMap = {
6693
+ "lancer-unlimited-launch-offer": "Lancer Unlimited - Launch Offer",
6694
+ };
6695
+
6692
6696
  var util;
6693
6697
  (function (util) {
6694
6698
  util.assertEqual = (val) => val;
@@ -12743,513 +12747,197 @@ const generateLeadCountsRequestSchema = z.object({
12743
12747
  campaignId: z.string().optional(),
12744
12748
  });
12745
12749
 
12746
- const bidPayloadProposalDataSchema = z.object({
12747
- coverLetter: z.string(),
12748
- questionAnswerPairs: questionAnswerPairSchema.array().nullable(),
12749
- boostingEnabled: z.boolean(),
12750
- maximumBoost: z.number().nullable(),
12750
+ const usageEventTypeEnum = z.enum([
12751
+ 'suitabilityComplete',
12752
+ 'proposalComplete',
12753
+ 'biddingComplete',
12754
+ ]);
12755
+ const usageEventMetadataSchema = objectType({
12756
+ campaignId: stringType().nullable(),
12757
+ userId: stringType().nullable(),
12758
+ stripeSubscriptionId: stringType().nullable(),
12759
+ planId: stringType().nullable(),
12751
12760
  });
12752
- const freelancerBidProposalDataSchema = bidPayloadProposalDataSchema;
12753
- const agencyBidProposalDataSchema = bidPayloadProposalDataSchema.extend({
12754
- agencyName: z.string(),
12755
- contractorName: z.string(),
12756
- specializedProfile: z.string().nullable(),
12761
+ const usageEventSchema = objectType({
12762
+ organizationId: stringType(),
12763
+ typeId: usageEventTypeEnum,
12764
+ timestamp: numberType(),
12765
+ metadata: usageEventMetadataSchema,
12757
12766
  });
12758
- const bidPayloadSchema = z.object({
12759
- organizationId: z.string(),
12760
- campaignId: z.string(),
12761
- lead: leadSchema,
12762
- jobUrl: z.string(),
12763
- username: z.string(),
12764
- password: z.string(),
12767
+
12768
+ const billingStripeMetadataSchema = objectType({
12769
+ customer: objectType({ id: stringType().nullable() }),
12765
12770
  });
12766
- const agencyBidPayloadSchema = bidPayloadSchema.extend({
12767
- proposalData: agencyBidProposalDataSchema,
12771
+ const billingSchema = objectType({
12772
+ savedCard: booleanType(),
12773
+ stripe: billingStripeMetadataSchema,
12768
12774
  });
12769
- const freelancerBidPayloadSchema = bidPayloadSchema.extend({
12770
- proposalData: freelancerBidProposalDataSchema,
12775
+
12776
+ const subscriptionStatusEnum = z.enum([
12777
+ "active",
12778
+ "trialing",
12779
+ "cancelled",
12780
+ "paused",
12781
+ "payment_processing",
12782
+ "payment_pending",
12783
+ "payment_failed",
12784
+ ]);
12785
+ const subscriptionSourceEnum = z.enum(["stripe", "manual"]);
12786
+ const subscriptionStripeMetadataItemSchema = objectType({
12787
+ id: stringType(),
12788
+ price: objectType({
12789
+ id: stringType(),
12790
+ }),
12771
12791
  });
12772
- const bidDtoSchema = z.object({
12773
- organizationId: z.string(),
12774
- campaignId: z.string(),
12775
- leadId: z.string(),
12792
+ const subscriptionStripeMetadataSchema = objectType({
12793
+ id: stringType(),
12794
+ items: arrayType(subscriptionStripeMetadataItemSchema),
12795
+ invoice: objectType({
12796
+ id: stringType(),
12797
+ hosted_invoice_url: stringType().nullable(),
12798
+ }),
12799
+ });
12800
+ const subscriptionSchema = objectType({
12801
+ planId: stringType(),
12802
+ pendingPlanId: stringType().nullable(),
12803
+ status: subscriptionStatusEnum,
12804
+ startedAt: numberType(),
12805
+ currentPeriodEnd: numberType(),
12806
+ stripe: subscriptionStripeMetadataSchema,
12807
+ source: subscriptionSourceEnum,
12808
+ usage: recordType(usageEventTypeEnum, numberType()),
12776
12809
  });
12777
12810
 
12778
- const bidSuccessSchema = z.object({
12779
- status: z.literal("success"),
12780
- biddingAmount: z.number(),
12781
- boosted: z.boolean(),
12782
- boostingAmount: z.number(),
12811
+ const coverLetterTemplateSchema = z.object({
12812
+ id: z.string(),
12813
+ name: z.string(),
12814
+ description: z.string().nullable(),
12815
+ template: z.string(),
12816
+ instructions: z.string(),
12783
12817
  });
12784
- const bidFailedSchema = z.object({
12785
- status: z.literal("failed"),
12786
- errorMessage: z.string(),
12818
+ const createCoverLetterTemplateSchema = coverLetterTemplateSchema.pick({
12819
+ name: true,
12820
+ template: true,
12821
+ instructions: true,
12787
12822
  });
12788
12823
 
12789
- class CloudflareChallengeFailedException extends Error {
12790
- code = 'CLOUDFLARE_CHALLENGE_FAILED_EXCEPTION';
12791
- constructor(url, errorMessage) {
12792
- super(`Cloudflare challenge failed for ${url}\n\n ${errorMessage}`);
12793
- }
12794
- }
12795
- const cloudflareProtectionFailure = (url, errorMessage) => new CloudflareChallengeFailedException(url, errorMessage);
12796
-
12797
- class DeleteMultiloginProfileException extends Error {
12798
- code = 'DELETE_MULTILOGIN_PROFILE_EXCEPTION';
12799
- constructor(message) {
12800
- super(message);
12801
- }
12802
- }
12803
- const deleteMultiloginProfileException = (message) => new DeleteMultiloginProfileException(message);
12824
+ const organizationMemberRoleEnum = z.enum(["admin", "member"]);
12825
+ const organizationMemberSchema = objectType({
12826
+ role: organizationMemberRoleEnum,
12827
+ joinedAt: numberType(),
12828
+ invitedBy: stringType(),
12829
+ });
12804
12830
 
12805
- class DropdownOptionNotPresentException extends Error {
12806
- code = 'DROPDOWN_OPTION_NOT_PRESENT_EXCEPTION';
12807
- constructor(selector, option) {
12808
- super(`${selector} does not contain option ${option}`);
12809
- }
12810
- }
12811
- function dropdownOptionNotPresentException(selector, option) {
12812
- return new DropdownOptionNotPresentException(selector, option);
12813
- }
12831
+ const onboardingProgressSchema = z.object({
12832
+ profileSetup: z.boolean(),
12833
+ campaignCreated: z.boolean(),
12834
+ filtersAdded: z.boolean(),
12835
+ automationEnabled: z.boolean(),
12836
+ startCampaign: z.boolean(),
12837
+ });
12814
12838
 
12815
- class ElementNotClickableException extends Error {
12816
- code = 'ELEMENT_NOT_CLICKABLE_EXCEPTION';
12817
- constructor(context, message) {
12818
- super(`${context} is not clickable: ${message}`);
12819
- }
12820
- }
12821
- function elementNotClickableException(elementInfo, message) {
12822
- return new ElementNotClickableException(JSON.stringify(elementInfo), message);
12823
- }
12839
+ const organizationTypeSchema = z.enum(["agency", "freelancer"]);
12840
+ const organizationTierEnum = z.enum(["free", "premium"]);
12841
+ const limitsSchema = objectType({
12842
+ monthlyCredits: numberType(),
12843
+ usedCredits: numberType(),
12844
+ extraCredits: numberType(),
12845
+ });
12846
+ const oneTimePaymentSchema = z.object({
12847
+ paidAt: z.number().optional(),
12848
+ amount: z.number().optional(),
12849
+ currency: z.string().optional(),
12850
+ status: z.string(),
12851
+ paymentIntentId: z.string().optional(),
12852
+ error: z.string().optional(),
12853
+ });
12854
+ const oneTimePaymentsSchema = z.object({
12855
+ usBidderAccountPayment: oneTimePaymentSchema.optional(),
12856
+ });
12857
+ const organizationSchema = objectType({
12858
+ id: stringType(),
12859
+ name: stringType(),
12860
+ type: organizationTypeSchema,
12861
+ associatedBidders: z.array(stringType()).nullable(),
12862
+ subscription: subscriptionSchema.nullable(),
12863
+ active: booleanType(),
12864
+ limits: limitsSchema,
12865
+ billing: billingSchema.nullable(),
12866
+ lastBidTime: numberType().nullable(),
12867
+ nextScheduledBidTime: numberType().nullable(),
12868
+ createdAt: numberType(),
12869
+ updatedAt: numberType(),
12870
+ openRouterApiKey: stringType().nullable(),
12871
+ appTrialEndsAt: numberType().nullable(),
12872
+ oneTimePayments: oneTimePaymentsSchema.optional(),
12873
+ });
12874
+ const organizationUpdateSchema = objectType({ planId: stringType() });
12875
+ const caseStudySchema = objectType({
12876
+ id: stringType(),
12877
+ title: stringType(),
12878
+ description: stringType(),
12879
+ });
12880
+ z.object({
12881
+ type: z.enum(["freelancer", "agency"]),
12882
+ name: z.string(),
12883
+ summary: z.string(),
12884
+ coreServices: z.string(),
12885
+ toolsSkillsTechnologies: z.string(),
12886
+ approach: z.string(),
12887
+ icp: z.string(),
12888
+ projectsTheyAvoid: z.string(),
12889
+ spokenLanguages: z.string(),
12890
+ agencyInfo: z.object({
12891
+ location: z.array(z.string()),
12892
+ website: z.string().url(),
12893
+ teamSize: z.number(),
12894
+ }),
12895
+ caseStudies: z.array(caseStudySchema),
12896
+ });
12897
+ const createOrganizationSchema = organizationSchema.pick({
12898
+ name: true,
12899
+ type: true,
12900
+ });
12901
+ const trackUsageEventTypeEnum = z.enum([
12902
+ "suitabilityComplete",
12903
+ "proposalComplete",
12904
+ "biddingComplete",
12905
+ ]);
12906
+ const trackUsagePayloadSchema = objectType({
12907
+ event: usageEventTypeEnum,
12908
+ campaignId: stringType().nullish(),
12909
+ });
12910
+ const questionRulesSchema = objectType({
12911
+ question: stringType(),
12912
+ answer: stringType(),
12913
+ category: stringType(),
12914
+ });
12915
+ const aiConfigSchema = objectType({
12916
+ questionHandling: z.string().nullable(),
12917
+ questionRules: arrayType(questionRulesSchema).nullable(),
12918
+ disqualifierRules: z.string().nullable(),
12919
+ userInstructions: z.string().nullable(),
12920
+ });
12921
+ const notificationConfigSchema = objectType({
12922
+ emailEnabled: booleanType(),
12923
+ discordWebhookUrl: stringType().nullable(),
12924
+ slackWebhookUrl: stringType().nullable(),
12925
+ });
12926
+ const organizationSettingsSchema = objectType({
12927
+ aiConfig: aiConfigSchema,
12928
+ });
12929
+ const subscribePayloadSchema = objectType({
12930
+ planId: stringType().min(1, "Plan id is required."),
12931
+ paymentMethodId: stringType().min(1, "Payment method is required."),
12932
+ toltReferral: stringType().optional(),
12933
+ couponCode: stringType().nullish(),
12934
+ });
12824
12935
 
12825
- class EvaluateElementException extends Error {
12826
- code = 'EVALUATE_ELEMENT_EXCEPTION';
12827
- constructor(element, message) {
12828
- super(`Element evaluation for ${JSON.stringify(element)} failed: ${message}`);
12829
- }
12830
- }
12831
- function evaluateElementException(element, message) {
12832
- return new EvaluateElementException(element, message);
12833
- }
12834
-
12835
- class EvaluateFunctionException extends Error {
12836
- code = 'EVALUATE_FUNCTION_EXCEPTION';
12837
- constructor(fn, args, message) {
12838
- super(`Evaluation function ${fn.toString()} failed with selectors: ${args} \n\n Error Message: ${message}`);
12839
- }
12840
- }
12841
- function evaluateFunctionException(fn, args, message) {
12842
- return new EvaluateFunctionException(fn, args, message);
12843
- }
12844
-
12845
- class GetMultiloginBrowserException extends Error {
12846
- code = 'GET_MULTILOGIN_BROWSER_EXCEPTION';
12847
- constructor(message) {
12848
- super(message);
12849
- }
12850
- }
12851
- const getMultiloginBrowserException = (message) => new GetMultiloginBrowserException(message);
12852
-
12853
- class IncorrectSecurityQuestionAnswerException extends Error {
12854
- code = 'INCORRECT_SECURITY_QUESTION_ANSWER_EXCEPTION';
12855
- constructor(message) {
12856
- super(message);
12857
- }
12858
- }
12859
- const incorrectSecurityQuestionAnswerException = (message) => new IncorrectSecurityQuestionAnswerException(message);
12860
-
12861
- class InitBrowserException extends Error {
12862
- code = 'INIT_BROWSER_EXCEPTION';
12863
- constructor(message) {
12864
- super(message);
12865
- }
12866
- }
12867
- const initBrowserException = (message) => new InitBrowserException(message);
12868
-
12869
- class InsufficientConnectsException extends Error {
12870
- code = 'INSUFFICIENT_CONNECTS_EXCEPTION';
12871
- constructor(message) {
12872
- super(message);
12873
- }
12874
- }
12875
- const insufficientConnectsException = (message) => new InsufficientConnectsException(message);
12876
-
12877
- class InvalidCredentialsException extends Error {
12878
- code = 'INVALID_CREDENTIALS_EXCEPTION';
12879
- constructor(message) {
12880
- super(message);
12881
- }
12882
- }
12883
- const invalidCredentialsException = (message) => new InvalidCredentialsException(message);
12884
-
12885
- class InvalidJobUrlException extends Error {
12886
- code = 'INVALID_JOB_URL_EXCEPTION';
12887
- constructor(message) {
12888
- super(message);
12889
- }
12890
- }
12891
- function invalidJobUrlException(message) {
12892
- return new InvalidJobUrlException(message);
12893
- }
12894
-
12895
- class LoginFailedException extends Error {
12896
- code = 'LOGIN_FAILED_EXCEPTION';
12897
- constructor(message) {
12898
- super(message);
12899
- }
12900
- }
12901
- const loginFailedException = (message) => {
12902
- return new LoginFailedException(message);
12903
- };
12904
-
12905
- class MultiloginAuthenticationException extends Error {
12906
- code = 'MULTILOGIN_AUTHENTICATION_EXCEPTION';
12907
- constructor(message) {
12908
- super(message);
12909
- }
12910
- }
12911
- const multiloginAuthenticationException = (message) => new MultiloginAuthenticationException(message);
12912
-
12913
- class NavigationTimeoutException extends Error {
12914
- code = 'NAVIGATION_TIMEOUT_EXCEPTION';
12915
- constructor(url, message) {
12916
- super(`Navigation to ${url} timed out: ${message}`);
12917
- }
12918
- }
12919
- const navigationTimeoutException = (url, message) => new NavigationTimeoutException(url, message);
12920
-
12921
- class NewBrowserPageException extends Error {
12922
- code = 'NEW_BROWSER_PAGE_EXCEPTION';
12923
- constructor(profileId, message) {
12924
- super(`Browser page for profile ${profileId} not found. \n\n Error Message: ${message}`);
12925
- }
12926
- }
12927
- const newBrowserPageException = (profileId, message) => new NewBrowserPageException(profileId, message);
12928
-
12929
- class NewPageException extends Error {
12930
- code = 'NEW_PAGE_EXCEPTION';
12931
- constructor(message) {
12932
- super(message);
12933
- }
12934
- }
12935
- const newPageException = (message) => new NewPageException(message);
12936
-
12937
- class GoToUrlException extends Error {
12938
- code = 'GO_TO_URL_EXCEPTION';
12939
- constructor(url, message) {
12940
- super(`Error opening new url: ${url}. \n\n Error Message: ${message}`);
12941
- }
12942
- }
12943
- const goToUrlException = (url, message) => new GoToUrlException(url, message);
12944
-
12945
- class ParseConnectsException extends Error {
12946
- code = 'PARSE_CONNECTS_EXCEPTION';
12947
- constructor() {
12948
- super('Failed to parse connects');
12949
- }
12950
- }
12951
- const parseConnectsException = () => new ParseConnectsException();
12952
-
12953
- class ProposalErrorAlertException extends Error {
12954
- code = 'PROPOSAL_ERROR_ALERT_EXCEPTION';
12955
- constructor(message) {
12956
- super(message);
12957
- }
12958
- }
12959
- const proposalErrorAlertException = (message) => new ProposalErrorAlertException(message);
12960
-
12961
- class ProposalFormWarningAlertException extends Error {
12962
- code = 'PROPOSAL_FORM_WARNING_ALERT_EXCEPTION';
12963
- constructor(message) {
12964
- super(message);
12965
- }
12966
- }
12967
- function proposalFormWarningAlertException(message) {
12968
- return new ProposalFormWarningAlertException(message);
12969
- }
12970
-
12971
- class ProposalGenerationFailedException extends Error {
12972
- code = 'PROPOSAL_GENERATION_FAILED_EXCEPTION';
12973
- constructor(message, organizationId, campaignId, leadId) {
12974
- super(`Proposal generation failed for lead ${leadId} in campaign ${campaignId} in organization ${organizationId}\n\n${message}`);
12975
- }
12976
- }
12977
- const proposalGenerationFailed = (message, leadId, campaignId, organizationId) => new ProposalGenerationFailedException(message, organizationId, campaignId, leadId);
12978
-
12979
- class ProposalSubmitFailedException extends Error {
12980
- code = 'PROPOSAL_SUBMIT_FAILED';
12981
- constructor(message) {
12982
- super(message);
12983
- }
12984
- }
12985
- const proposalSubmitFailedException = (message) => {
12986
- return new ProposalSubmitFailedException(message);
12987
- };
12988
-
12989
- class PuppeteerConnectionErrorException extends Error {
12990
- code = 'PUPPETEER_CONNECTION_ERROR_EXCEPTION';
12991
- constructor(message) {
12992
- super(message);
12993
- }
12994
- }
12995
- const puppeteerConnectionErrorException = (message) => new PuppeteerConnectionErrorException(message);
12996
-
12997
- class QuestionPairNotMatchingException extends Error {
12998
- code = 'QUESTION_PAIR_NOT_MATCHING';
12999
- constructor(upworkQuestion, generatedQuestion) {
13000
- super(`Question pair not matching: ${upworkQuestion} !== ${generatedQuestion}`);
13001
- }
13002
- }
13003
- const questionPairNotMatchingException = (upworkQuestion, generatedQuestion) => {
13004
- return new QuestionPairNotMatchingException(upworkQuestion, generatedQuestion);
13005
- };
13006
-
13007
- class SelectAgencyException extends Error {
13008
- code = 'SELECT_AGENCY_EXCEPTION';
13009
- constructor(agencyName, message) {
13010
- super(`Failed to select agency ${agencyName}: ${message}`);
13011
- }
13012
- }
13013
- function selectAgencyException(agencyName, message) {
13014
- return new SelectAgencyException(agencyName, message);
13015
- }
13016
-
13017
- class SelectContractorException extends Error {
13018
- code = 'SELECT_CONTRACTOR_EXCEPTION';
13019
- constructor(contractorName, message) {
13020
- super(`Failed to select contractor ${contractorName}: ${message}`);
13021
- }
13022
- }
13023
- function selectContractorException(contractorName, message) {
13024
- return new SelectContractorException(contractorName, message);
13025
- }
13026
-
13027
- class SelectorNotFoundError extends Error {
13028
- code = 'SELECTOR_NOT_FOUND_ERROR';
13029
- constructor(selector, context) {
13030
- const message = context
13031
- ? `Element matching selector "${selector}" not found within ${context}.`
13032
- : `Element matching selector "${selector}" not found.`;
13033
- super(message);
13034
- }
13035
- }
13036
- const selectorNotFoundError = (selector, context) => new SelectorNotFoundError(selector, context);
13037
-
13038
- class TypedValueInFieldNotMatchingException extends Error {
13039
- code = 'TYPED_VALUE_IN_FIELD_NOT_MATCHING_EXCEPTION';
13040
- constructor(element, inputValue, correctValue) {
13041
- super(`Input value ${inputValue} does not match correct value ${correctValue} for element ${JSON.stringify(element)}`);
13042
- }
13043
- }
13044
- const typedValueInFieldNotMatchingException = (element, inputValue, correctValue) => new TypedValueInFieldNotMatchingException(element, inputValue, correctValue);
13045
-
13046
- class TypingInputFieldException extends Error {
13047
- code = 'TYPING_INPUT_FIELD_EXCEPTION';
13048
- constructor(element, message) {
13049
- const identifier = JSON.stringify(element);
13050
- super(`${identifier} - ${message}`);
13051
- }
13052
- }
13053
- const typingInputFieldException = (element, message) => new TypingInputFieldException(element, message);
13054
-
13055
- class WaitForFunctionTimeoutError extends Error {
13056
- code = 'WAIT_FOR_FUNCTION_TIMEOUT_ERROR';
13057
- constructor(fn, timeout) {
13058
- super(`Timeout waiting for function "${fn.toString()}" after ${timeout}ms.`);
13059
- }
13060
- }
13061
- const waitForFunctionTimeoutError = (fn, timeout) => new WaitForFunctionTimeoutError(fn, timeout);
13062
-
13063
- const usageEventTypeEnum = z.enum([
13064
- 'suitabilityComplete',
13065
- 'proposalComplete',
13066
- 'biddingComplete',
13067
- ]);
13068
- const usageEventMetadataSchema = objectType({
13069
- campaignId: stringType().nullable(),
13070
- userId: stringType().nullable(),
13071
- stripeSubscriptionId: stringType().nullable(),
13072
- planId: stringType().nullable(),
13073
- });
13074
- const usageEventSchema = objectType({
13075
- organizationId: stringType(),
13076
- typeId: usageEventTypeEnum,
13077
- timestamp: numberType(),
13078
- metadata: usageEventMetadataSchema,
13079
- });
13080
-
13081
- const billingStripeMetadataSchema = objectType({
13082
- customer: objectType({ id: stringType().nullable() }),
13083
- });
13084
- const billingSchema = objectType({
13085
- savedCard: booleanType(),
13086
- stripe: billingStripeMetadataSchema,
13087
- });
13088
-
13089
- const subscriptionStatusEnum = z.enum([
13090
- "active",
13091
- "trialing",
13092
- "cancelled",
13093
- "paused",
13094
- "payment_processing",
13095
- "payment_pending",
13096
- "payment_failed",
13097
- ]);
13098
- const subscriptionSourceEnum = z.enum(["stripe", "manual"]);
13099
- const subscriptionStripeMetadataItemSchema = objectType({
13100
- id: stringType(),
13101
- price: objectType({
13102
- id: stringType(),
13103
- }),
13104
- });
13105
- const subscriptionStripeMetadataSchema = objectType({
13106
- id: stringType(),
13107
- items: arrayType(subscriptionStripeMetadataItemSchema),
13108
- invoice: objectType({
13109
- id: stringType(),
13110
- hosted_invoice_url: stringType().nullable(),
13111
- }),
13112
- });
13113
- const subscriptionSchema = objectType({
13114
- planId: stringType(),
13115
- pendingPlanId: stringType().nullable(),
13116
- status: subscriptionStatusEnum,
13117
- startedAt: numberType(),
13118
- currentPeriodEnd: numberType(),
13119
- stripe: subscriptionStripeMetadataSchema,
13120
- source: subscriptionSourceEnum,
13121
- usage: recordType(usageEventTypeEnum, numberType()),
13122
- });
13123
-
13124
- const coverLetterTemplateSchema = z.object({
13125
- id: z.string(),
13126
- name: z.string(),
13127
- description: z.string().nullable(),
13128
- template: z.string(),
13129
- instructions: z.string(),
13130
- });
13131
- const createCoverLetterTemplateSchema = coverLetterTemplateSchema.pick({
13132
- name: true,
13133
- template: true,
13134
- instructions: true,
13135
- });
13136
-
13137
- const organizationMemberRoleEnum = z.enum(["admin", "member"]);
13138
- const organizationMemberSchema = objectType({
13139
- role: organizationMemberRoleEnum,
13140
- joinedAt: numberType(),
13141
- invitedBy: stringType(),
13142
- });
13143
-
13144
- const onboardingProgressSchema = z.object({
13145
- profileSetup: z.boolean(),
13146
- campaignCreated: z.boolean(),
13147
- filtersAdded: z.boolean(),
13148
- automationEnabled: z.boolean(),
13149
- startCampaign: z.boolean(),
13150
- });
13151
-
13152
- const organizationTypeSchema = z.enum(['agency', 'freelancer']);
13153
- const organizationTierEnum = z.enum(['free', 'premium']);
13154
- const limitsSchema = objectType({
13155
- monthlyCredits: numberType(),
13156
- usedCredits: numberType(),
13157
- extraCredits: numberType(),
13158
- });
13159
- const oneTimePaymentSchema = z.object({
13160
- paidAt: z.number().optional(),
13161
- amount: z.number().optional(),
13162
- currency: z.string().optional(),
13163
- status: z.string(),
13164
- paymentIntentId: z.string().optional(),
13165
- error: z.string().optional(),
13166
- });
13167
- const oneTimePaymentsSchema = z.object({
13168
- usBidderAccountPayment: oneTimePaymentSchema.optional(),
13169
- });
13170
- const organizationSchema = objectType({
13171
- id: stringType(),
13172
- name: stringType(),
13173
- type: organizationTypeSchema,
13174
- associatedBidders: z.array(stringType()).nullable(),
13175
- subscription: subscriptionSchema.nullable(),
13176
- active: booleanType(),
13177
- limits: limitsSchema,
13178
- billing: billingSchema.nullable(),
13179
- lastBidTime: numberType().nullable(),
13180
- nextScheduledBidTime: numberType().nullable(),
13181
- createdAt: numberType(),
13182
- updatedAt: numberType(),
13183
- openRouterApiKey: stringType().nullable(),
13184
- appTrialEndsAt: numberType().nullable(),
13185
- oneTimePayments: oneTimePaymentsSchema.optional(),
13186
- });
13187
- const caseStudySchema = objectType({
13188
- id: stringType(),
13189
- title: stringType(),
13190
- description: stringType(),
13191
- });
13192
- z.object({
13193
- type: z.enum(['freelancer', 'agency']),
13194
- name: z.string(),
13195
- summary: z.string(),
13196
- coreServices: z.string(),
13197
- toolsSkillsTechnologies: z.string(),
13198
- approach: z.string(),
13199
- icp: z.string(),
13200
- projectsTheyAvoid: z.string(),
13201
- spokenLanguages: z.string(),
13202
- agencyInfo: z.object({
13203
- location: z.array(z.string()),
13204
- website: z.string().url(),
13205
- teamSize: z.number(),
13206
- }),
13207
- caseStudies: z.array(caseStudySchema),
13208
- });
13209
- const createOrganizationSchema = organizationSchema.pick({
13210
- name: true,
13211
- type: true,
13212
- });
13213
- const trackUsageEventTypeEnum = z.enum([
13214
- 'suitabilityComplete',
13215
- 'proposalComplete',
13216
- 'biddingComplete',
13217
- ]);
13218
- const trackUsagePayloadSchema = objectType({
13219
- event: usageEventTypeEnum,
13220
- campaignId: stringType().nullish(),
13221
- });
13222
- const questionRulesSchema = objectType({
13223
- question: stringType(),
13224
- answer: stringType(),
13225
- category: stringType(),
13226
- });
13227
- const aiConfigSchema = objectType({
13228
- questionHandling: z.string().nullable(),
13229
- questionRules: arrayType(questionRulesSchema).nullable(),
13230
- disqualifierRules: z.string().nullable(),
13231
- userInstructions: z.string().nullable(),
13232
- });
13233
- const notificationConfigSchema = objectType({
13234
- emailEnabled: booleanType(),
13235
- discordWebhookUrl: stringType().nullable(),
13236
- slackWebhookUrl: stringType().nullable(),
13237
- });
13238
- const organizationSettingsSchema = objectType({
13239
- aiConfig: aiConfigSchema,
13240
- });
13241
- const subscribePayloadSchema = objectType({
13242
- planId: stringType().min(1, 'Plan id is required.'),
13243
- paymentMethodId: stringType().min(1, 'Payment method is required.'),
13244
- toltReferral: stringType().optional(),
13245
- couponCode: stringType().nullish(),
13246
- });
13247
-
13248
- const campaignExpensesSchema = z.object({
13249
- biddingAmount: z.number().default(0),
13250
- boostingAmount: z.number().default(0),
13251
- boosted: z.number().default(0),
13252
- });
12936
+ const campaignExpensesSchema = z.object({
12937
+ biddingAmount: z.number().default(0),
12938
+ boostingAmount: z.number().default(0),
12939
+ boosted: z.number().default(0),
12940
+ });
13253
12941
 
13254
12942
  const bidConfigSchema = z.object({
13255
12943
  agencyName: z.string().nullable(),
@@ -13263,6 +12951,11 @@ const campaignStatusSchema = z.union([
13263
12951
  z.literal('paused'),
13264
12952
  z.literal('error'),
13265
12953
  ]);
12954
+ const biddingHourlyRateStrategy = z.enum([
12955
+ 'match_job_budget',
12956
+ 'match_profile_rate',
12957
+ 'fixed_rate',
12958
+ ]);
13266
12959
  const campaignSchema = z.object({
13267
12960
  id: z.string(),
13268
12961
  name: z.string(),
@@ -13277,6 +12970,9 @@ const campaignSchema = z.object({
13277
12970
  monthlyBudget: z.number().nullable(),
13278
12971
  // suitabilityThreshold: z.number().min(0).max(100).nullable().default(0),
13279
12972
  boostingThreshold: z.number().min(0).max(100).nullable().default(0),
12973
+ biddingDelayInMinutes: z.number().default(5),
12974
+ biddingHourlyRateStrategy: biddingHourlyRateStrategy,
12975
+ biddingFixedHourlyRate: z.number().nullable(),
13280
12976
  leadCounts: z.record(leadStatusSchema, z.number()).nullable(),
13281
12977
  expenses: campaignExpensesSchema,
13282
12978
  notificationsEnabled: z.boolean().nullable(),
@@ -13383,167 +13079,488 @@ const leadAnalysisActivityExtraSchema = z.object({
13383
13079
  suitabilityRating: z.number().min(0).max(100),
13384
13080
  creditBalance: z.number(),
13385
13081
  });
13386
- const leadAnalysisActivitySchema = baseActivitySchema.extend({
13387
- ...leadAnalysisActivityExtraSchema.shape,
13082
+ const leadAnalysisActivitySchema = baseActivitySchema.extend({
13083
+ ...leadAnalysisActivityExtraSchema.shape,
13084
+ });
13085
+ const leadStatusActivityExtraSchema = z.object({
13086
+ type: z.literal("lead_status"),
13087
+ status: leadStatusSchema,
13088
+ lead: leadSchema.pick({
13089
+ id: true,
13090
+ title: true,
13091
+ datetime: true,
13092
+ jobUrl: true,
13093
+ }),
13094
+ creditBalance: z.number(),
13095
+ });
13096
+ const leadStatusActivitySchema = baseActivitySchema.extend({
13097
+ ...leadStatusActivityExtraSchema.shape,
13098
+ });
13099
+ const proposalSentActivityExtraSchema = z.object({
13100
+ type: z.literal("proposal_sent"),
13101
+ lead: leadSchema.pick({
13102
+ id: true,
13103
+ title: true,
13104
+ datetime: true,
13105
+ jobUrl: true,
13106
+ }),
13107
+ creditBalance: z.number(),
13108
+ });
13109
+ const proposalSentActivitySchema = baseActivitySchema.extend({
13110
+ ...proposalSentActivityExtraSchema.shape,
13111
+ });
13112
+ const campaignActivitySchema = z.discriminatedUnion("type", [
13113
+ campaignStatusActivitySchema,
13114
+ leadAnalysisActivitySchema,
13115
+ leadStatusActivitySchema,
13116
+ proposalSentActivitySchema,
13117
+ ]);
13118
+ const campaignActivityCreateSchema = z.discriminatedUnion("type", [
13119
+ campaignStatusActivityExtraSchema,
13120
+ leadAnalysisActivityExtraSchema,
13121
+ leadStatusActivityExtraSchema,
13122
+ proposalSentActivityExtraSchema,
13123
+ ]);
13124
+ const updateCampaignAnalyticsSchema = z.object({
13125
+ organizationId: z.string(),
13126
+ campaignId: z.string(),
13127
+ fields: z.array(z.enum([
13128
+ "contacted",
13129
+ "viewed",
13130
+ "replied",
13131
+ "won",
13132
+ "leadsAnalyzed",
13133
+ "leadsFailed",
13134
+ "proposalsFailed",
13135
+ "suitableJobs",
13136
+ "unsuitableJobs",
13137
+ "wonAmount",
13138
+ ])),
13139
+ });
13140
+
13141
+ const campaignNotificationType = z.enum([
13142
+ 'suitableLead',
13143
+ 'proposalSent',
13144
+ 'proposalViewed',
13145
+ 'proposalReplied',
13146
+ 'noConnects',
13147
+ 'accountDisconnected',
13148
+ 'biddingWarning',
13149
+ ]);
13150
+ const chatbotChannelSchema = z.object({
13151
+ id: z.string(),
13152
+ name: z.string(),
13153
+ });
13154
+ const chatbotPlatforms = z.enum(['discord', 'slack']);
13155
+ const chatbotSchema = z.object({
13156
+ accessToken: z.string().optional(),
13157
+ refreshToken: z.string().optional(),
13158
+ workspaceId: z.string(),
13159
+ channels: z.array(chatbotChannelSchema),
13160
+ selectedChannelId: z.string().nullable(),
13161
+ notificationsEnabled: z.boolean().default(true),
13162
+ notificationSettings: z.record(campaignNotificationType, z.boolean().default(true)),
13163
+ organizationId: z.string(),
13164
+ campaignId: z.string(),
13165
+ createdAt: z.number(),
13166
+ updatedAt: z.number(),
13167
+ });
13168
+ const createChatbotSchema = chatbotSchema.pick({
13169
+ workspaceId: true,
13170
+ accessToken: true,
13171
+ refreshToken: true,
13172
+ channels: true,
13173
+ organizationId: true,
13174
+ campaignId: true,
13175
+ });
13176
+ const updateChatbotSchema = chatbotSchema.pick({
13177
+ selectedChannelId: true,
13178
+ notificationsEnabled: true,
13179
+ notificationSettings: true,
13180
+ });
13181
+ const sendNotificationRequestSchema = z.object({
13182
+ organizationId: z.string(),
13183
+ campaignId: z.string(),
13184
+ leadId: z.string(),
13185
+ notificationType: campaignNotificationType,
13186
+ message: z.string().optional(),
13187
+ });
13188
+ const updateSuitableLeadNotificationType = z.enum([
13189
+ 'proceeded',
13190
+ 'feedback-provided',
13191
+ ]);
13192
+ const updateSuitableLeadNotificationBodySchema = z.object({
13193
+ type: updateSuitableLeadNotificationType,
13194
+ });
13195
+ const CAMPAIGN_NOTIFICATION_TYPES = {
13196
+ suitableLead: 'Suitable Lead',
13197
+ proposalSent: 'Proposal Sent',
13198
+ proposalViewed: 'Proposal Viewed',
13199
+ proposalReplied: 'Proposal Replied',
13200
+ noConnects: 'No Connects',
13201
+ accountDisconnected: 'Account Disconnected',
13202
+ biddingWarning: 'Bidding Warning',
13203
+ };
13204
+ const CAMPAIGN_NOTIFICATION_SETTINGS = {
13205
+ suitableLead: 'When Lancer determines a job is suitable for your company',
13206
+ proposalSent: 'When a proposal is successfully submitted',
13207
+ proposalViewed: 'When a client views your proposal',
13208
+ proposalReplied: 'When a client replies to your proposal',
13209
+ noConnects: 'When your Agency profile has run out of Upwork connects',
13210
+ accountDisconnected: 'When there is an issue with your Upwork Bidder account',
13211
+ biddingWarning: 'When there is a bidding warning',
13212
+ };
13213
+
13214
+ const campaignCountByStatusSchema = z.object({
13215
+ // Using z.enum values to create a schema with all possible job statuses
13216
+ ...Object.fromEntries(Object.values(agentStatusSchema.enum).map((status) => [
13217
+ status,
13218
+ z.object({
13219
+ boosted: z.number(),
13220
+ organic: z.number(),
13221
+ total: z.number(),
13222
+ }),
13223
+ ])),
13224
+ });
13225
+ const campaignInsightsSchema = z.object({
13226
+ pipelineHealth: campaignCountByStatusSchema,
13227
+ biddingAmount: z.number().default(0),
13228
+ boostingAmount: z.number().default(0),
13229
+ boostedProposalsCount: z.number().default(0),
13230
+ totalProposalsCount: z.number().default(0),
13231
+ totalExpenses: z.number().default(0),
13232
+ suitabilityRange0to10: z.number(),
13233
+ suitabilityRange10to20: z.number(),
13234
+ suitabilityRange20to30: z.number(),
13235
+ suitabilityRange30to40: z.number(),
13236
+ suitabilityRange40to50: z.number(),
13237
+ suitabilityRange50to60: z.number(),
13238
+ suitabilityRange60to70: z.number(),
13239
+ suitabilityRange70to80: z.number(),
13240
+ suitabilityRange80to90: z.number(),
13241
+ suitabilityRange90to100: z.number(),
13242
+ });
13243
+
13244
+ const bidPayloadProposalDataSchema = z.object({
13245
+ coverLetter: z.string(),
13246
+ questionAnswerPairs: questionAnswerPairSchema.array().nullable(),
13247
+ boostingEnabled: z.boolean(),
13248
+ maximumBoost: z.number().nullable(),
13249
+ biddingHourlyRateStrategy: biddingHourlyRateStrategy,
13250
+ biddingFixedHourlyRate: z.number().nullable(),
13251
+ isHourlyRate: z.boolean(),
13252
+ jobMaxHourlyRate: z.number().nullable(),
13388
13253
  });
13389
- const leadStatusActivityExtraSchema = z.object({
13390
- type: z.literal("lead_status"),
13391
- status: leadStatusSchema,
13392
- lead: leadSchema.pick({
13393
- id: true,
13394
- title: true,
13395
- datetime: true,
13396
- jobUrl: true,
13397
- }),
13398
- creditBalance: z.number(),
13254
+ const freelancerBidProposalDataSchema = bidPayloadProposalDataSchema;
13255
+ const agencyBidProposalDataSchema = bidPayloadProposalDataSchema.extend({
13256
+ agencyName: z.string(),
13257
+ contractorName: z.string(),
13258
+ specializedProfile: z.string().nullable(),
13399
13259
  });
13400
- const leadStatusActivitySchema = baseActivitySchema.extend({
13401
- ...leadStatusActivityExtraSchema.shape,
13260
+ const bidPayloadSchema = z.object({
13261
+ organizationId: z.string(),
13262
+ campaignId: z.string(),
13263
+ lead: leadSchema,
13264
+ jobUrl: z.string(),
13265
+ username: z.string(),
13266
+ password: z.string(),
13402
13267
  });
13403
- const proposalSentActivityExtraSchema = z.object({
13404
- type: z.literal("proposal_sent"),
13405
- lead: leadSchema.pick({
13406
- id: true,
13407
- title: true,
13408
- datetime: true,
13409
- jobUrl: true,
13410
- }),
13411
- creditBalance: z.number(),
13268
+ const agencyBidPayloadSchema = bidPayloadSchema.extend({
13269
+ proposalData: agencyBidProposalDataSchema,
13412
13270
  });
13413
- const proposalSentActivitySchema = baseActivitySchema.extend({
13414
- ...proposalSentActivityExtraSchema.shape,
13271
+ const freelancerBidPayloadSchema = bidPayloadSchema.extend({
13272
+ proposalData: freelancerBidProposalDataSchema,
13415
13273
  });
13416
- const campaignActivitySchema = z.discriminatedUnion("type", [
13417
- campaignStatusActivitySchema,
13418
- leadAnalysisActivitySchema,
13419
- leadStatusActivitySchema,
13420
- proposalSentActivitySchema,
13421
- ]);
13422
- const campaignActivityCreateSchema = z.discriminatedUnion("type", [
13423
- campaignStatusActivityExtraSchema,
13424
- leadAnalysisActivityExtraSchema,
13425
- leadStatusActivityExtraSchema,
13426
- proposalSentActivityExtraSchema,
13427
- ]);
13428
- const updateCampaignAnalyticsSchema = z.object({
13274
+ const bidDtoSchema = z.object({
13429
13275
  organizationId: z.string(),
13430
13276
  campaignId: z.string(),
13431
- fields: z.array(z.enum([
13432
- "contacted",
13433
- "viewed",
13434
- "replied",
13435
- "won",
13436
- "leadsAnalyzed",
13437
- "leadsFailed",
13438
- "proposalsFailed",
13439
- "suitableJobs",
13440
- "unsuitableJobs",
13441
- "wonAmount",
13442
- ])),
13277
+ leadId: z.string(),
13278
+ });
13279
+
13280
+ const bidSuccessSchema = z.object({
13281
+ status: z.literal("success"),
13282
+ biddingAmount: z.number(),
13283
+ boosted: z.boolean(),
13284
+ boostingAmount: z.number(),
13285
+ });
13286
+ const bidFailedSchema = z.object({
13287
+ status: z.literal("failed"),
13288
+ errorMessage: z.string(),
13443
13289
  });
13444
13290
 
13445
- const campaignNotificationType = z.enum([
13446
- 'suitableLead',
13447
- 'proposalSent',
13448
- 'proposalViewed',
13449
- 'proposalReplied',
13450
- 'noConnects',
13451
- 'accountDisconnected',
13452
- 'biddingWarning',
13453
- ]);
13454
- const chatbotChannelSchema = z.object({
13455
- id: z.string(),
13456
- name: z.string(),
13457
- });
13458
- const chatbotPlatforms = z.enum(['discord', 'slack']);
13459
- const chatbotSchema = z.object({
13460
- accessToken: z.string().optional(),
13461
- refreshToken: z.string().optional(),
13462
- workspaceId: z.string(),
13463
- channels: z.array(chatbotChannelSchema),
13464
- selectedChannelId: z.string().nullable(),
13465
- notificationsEnabled: z.boolean().default(true),
13466
- notificationSettings: z.record(campaignNotificationType, z.boolean().default(true)),
13467
- organizationId: z.string(),
13468
- campaignId: z.string(),
13469
- createdAt: z.number(),
13470
- updatedAt: z.number(),
13471
- });
13472
- const createChatbotSchema = chatbotSchema.pick({
13473
- workspaceId: true,
13474
- accessToken: true,
13475
- refreshToken: true,
13476
- channels: true,
13477
- organizationId: true,
13478
- campaignId: true,
13479
- });
13480
- const updateChatbotSchema = chatbotSchema.pick({
13481
- selectedChannelId: true,
13482
- notificationsEnabled: true,
13483
- notificationSettings: true,
13484
- });
13485
- const sendNotificationRequestSchema = z.object({
13486
- organizationId: z.string(),
13487
- campaignId: z.string(),
13488
- leadId: z.string(),
13489
- notificationType: campaignNotificationType,
13490
- message: z.string().optional(),
13491
- });
13492
- const updateSuitableLeadNotificationType = z.enum([
13493
- 'proceeded',
13494
- 'feedback-provided',
13495
- ]);
13496
- const updateSuitableLeadNotificationBodySchema = z.object({
13497
- type: updateSuitableLeadNotificationType,
13498
- });
13499
- const CAMPAIGN_NOTIFICATION_TYPES = {
13500
- suitableLead: 'Suitable Lead',
13501
- proposalSent: 'Proposal Sent',
13502
- proposalViewed: 'Proposal Viewed',
13503
- proposalReplied: 'Proposal Replied',
13504
- noConnects: 'No Connects',
13505
- accountDisconnected: 'Account Disconnected',
13506
- biddingWarning: 'Bidding Warning',
13291
+ class CloudflareChallengeFailedException extends Error {
13292
+ code = 'CLOUDFLARE_CHALLENGE_FAILED_EXCEPTION';
13293
+ constructor(url, errorMessage) {
13294
+ super(`Cloudflare challenge failed for ${url}\n\n ${errorMessage}`);
13295
+ }
13296
+ }
13297
+ const cloudflareProtectionFailure = (url, errorMessage) => new CloudflareChallengeFailedException(url, errorMessage);
13298
+
13299
+ class DeleteMultiloginProfileException extends Error {
13300
+ code = 'DELETE_MULTILOGIN_PROFILE_EXCEPTION';
13301
+ constructor(message) {
13302
+ super(message);
13303
+ }
13304
+ }
13305
+ const deleteMultiloginProfileException = (message) => new DeleteMultiloginProfileException(message);
13306
+
13307
+ class DropdownOptionNotPresentException extends Error {
13308
+ code = 'DROPDOWN_OPTION_NOT_PRESENT_EXCEPTION';
13309
+ constructor(selector, option) {
13310
+ super(`${selector} does not contain option ${option}`);
13311
+ }
13312
+ }
13313
+ function dropdownOptionNotPresentException(selector, option) {
13314
+ return new DropdownOptionNotPresentException(selector, option);
13315
+ }
13316
+
13317
+ class ElementNotClickableException extends Error {
13318
+ code = 'ELEMENT_NOT_CLICKABLE_EXCEPTION';
13319
+ constructor(context, message) {
13320
+ super(`${context} is not clickable: ${message}`);
13321
+ }
13322
+ }
13323
+ function elementNotClickableException(elementInfo, message) {
13324
+ return new ElementNotClickableException(JSON.stringify(elementInfo), message);
13325
+ }
13326
+
13327
+ class EvaluateElementException extends Error {
13328
+ code = 'EVALUATE_ELEMENT_EXCEPTION';
13329
+ constructor(element, message) {
13330
+ super(`Element evaluation for ${JSON.stringify(element)} failed: ${message}`);
13331
+ }
13332
+ }
13333
+ function evaluateElementException(element, message) {
13334
+ return new EvaluateElementException(element, message);
13335
+ }
13336
+
13337
+ class EvaluateFunctionException extends Error {
13338
+ code = 'EVALUATE_FUNCTION_EXCEPTION';
13339
+ constructor(fn, args, message) {
13340
+ super(`Evaluation function ${fn.toString()} failed with selectors: ${args} \n\n Error Message: ${message}`);
13341
+ }
13342
+ }
13343
+ function evaluateFunctionException(fn, args, message) {
13344
+ return new EvaluateFunctionException(fn, args, message);
13345
+ }
13346
+
13347
+ class GetMultiloginBrowserException extends Error {
13348
+ code = 'GET_MULTILOGIN_BROWSER_EXCEPTION';
13349
+ constructor(message) {
13350
+ super(message);
13351
+ }
13352
+ }
13353
+ const getMultiloginBrowserException = (message) => new GetMultiloginBrowserException(message);
13354
+
13355
+ class IncorrectSecurityQuestionAnswerException extends Error {
13356
+ code = 'INCORRECT_SECURITY_QUESTION_ANSWER_EXCEPTION';
13357
+ constructor(message) {
13358
+ super(message);
13359
+ }
13360
+ }
13361
+ const incorrectSecurityQuestionAnswerException = (message) => new IncorrectSecurityQuestionAnswerException(message);
13362
+
13363
+ class InitBrowserException extends Error {
13364
+ code = 'INIT_BROWSER_EXCEPTION';
13365
+ constructor(message) {
13366
+ super(message);
13367
+ }
13368
+ }
13369
+ const initBrowserException = (message) => new InitBrowserException(message);
13370
+
13371
+ class InsufficientConnectsException extends Error {
13372
+ code = 'INSUFFICIENT_CONNECTS_EXCEPTION';
13373
+ constructor(message) {
13374
+ super(message);
13375
+ }
13376
+ }
13377
+ const insufficientConnectsException = (message) => new InsufficientConnectsException(message);
13378
+
13379
+ class InvalidCredentialsException extends Error {
13380
+ code = 'INVALID_CREDENTIALS_EXCEPTION';
13381
+ constructor(message) {
13382
+ super(message);
13383
+ }
13384
+ }
13385
+ const invalidCredentialsException = (message) => new InvalidCredentialsException(message);
13386
+
13387
+ class InvalidJobUrlException extends Error {
13388
+ code = 'INVALID_JOB_URL_EXCEPTION';
13389
+ constructor(message) {
13390
+ super(message);
13391
+ }
13392
+ }
13393
+ function invalidJobUrlException(message) {
13394
+ return new InvalidJobUrlException(message);
13395
+ }
13396
+
13397
+ class LoginFailedException extends Error {
13398
+ code = 'LOGIN_FAILED_EXCEPTION';
13399
+ constructor(message) {
13400
+ super(message);
13401
+ }
13402
+ }
13403
+ const loginFailedException = (message) => {
13404
+ return new LoginFailedException(message);
13405
+ };
13406
+
13407
+ class MultiloginAuthenticationException extends Error {
13408
+ code = 'MULTILOGIN_AUTHENTICATION_EXCEPTION';
13409
+ constructor(message) {
13410
+ super(message);
13411
+ }
13412
+ }
13413
+ const multiloginAuthenticationException = (message) => new MultiloginAuthenticationException(message);
13414
+
13415
+ class NavigationTimeoutException extends Error {
13416
+ code = 'NAVIGATION_TIMEOUT_EXCEPTION';
13417
+ constructor(url, message) {
13418
+ super(`Navigation to ${url} timed out: ${message}`);
13419
+ }
13420
+ }
13421
+ const navigationTimeoutException = (url, message) => new NavigationTimeoutException(url, message);
13422
+
13423
+ class NewBrowserPageException extends Error {
13424
+ code = 'NEW_BROWSER_PAGE_EXCEPTION';
13425
+ constructor(profileId, message) {
13426
+ super(`Browser page for profile ${profileId} not found. \n\n Error Message: ${message}`);
13427
+ }
13428
+ }
13429
+ const newBrowserPageException = (profileId, message) => new NewBrowserPageException(profileId, message);
13430
+
13431
+ class NewPageException extends Error {
13432
+ code = 'NEW_PAGE_EXCEPTION';
13433
+ constructor(message) {
13434
+ super(message);
13435
+ }
13436
+ }
13437
+ const newPageException = (message) => new NewPageException(message);
13438
+
13439
+ class GoToUrlException extends Error {
13440
+ code = 'GO_TO_URL_EXCEPTION';
13441
+ constructor(url, message) {
13442
+ super(`Error opening new url: ${url}. \n\n Error Message: ${message}`);
13443
+ }
13444
+ }
13445
+ const goToUrlException = (url, message) => new GoToUrlException(url, message);
13446
+
13447
+ class ParseConnectsException extends Error {
13448
+ code = 'PARSE_CONNECTS_EXCEPTION';
13449
+ constructor() {
13450
+ super('Failed to parse connects');
13451
+ }
13452
+ }
13453
+ const parseConnectsException = () => new ParseConnectsException();
13454
+
13455
+ class ProposalErrorAlertException extends Error {
13456
+ code = 'PROPOSAL_ERROR_ALERT_EXCEPTION';
13457
+ constructor(message) {
13458
+ super(message);
13459
+ }
13460
+ }
13461
+ const proposalErrorAlertException = (message) => new ProposalErrorAlertException(message);
13462
+
13463
+ class ProposalFormWarningAlertException extends Error {
13464
+ code = 'PROPOSAL_FORM_WARNING_ALERT_EXCEPTION';
13465
+ constructor(message) {
13466
+ super(message);
13467
+ }
13468
+ }
13469
+ function proposalFormWarningAlertException(message) {
13470
+ return new ProposalFormWarningAlertException(message);
13471
+ }
13472
+
13473
+ class ProposalGenerationFailedException extends Error {
13474
+ code = 'PROPOSAL_GENERATION_FAILED_EXCEPTION';
13475
+ constructor(message, organizationId, campaignId, leadId) {
13476
+ super(`Proposal generation failed for lead ${leadId} in campaign ${campaignId} in organization ${organizationId}\n\n${message}`);
13477
+ }
13478
+ }
13479
+ const proposalGenerationFailed = (message, leadId, campaignId, organizationId) => new ProposalGenerationFailedException(message, organizationId, campaignId, leadId);
13480
+
13481
+ class ProposalSubmitFailedException extends Error {
13482
+ code = 'PROPOSAL_SUBMIT_FAILED';
13483
+ constructor(message) {
13484
+ super(message);
13485
+ }
13486
+ }
13487
+ const proposalSubmitFailedException = (message) => {
13488
+ return new ProposalSubmitFailedException(message);
13507
13489
  };
13508
- const CAMPAIGN_NOTIFICATION_SETTINGS = {
13509
- suitableLead: 'When Lancer determines a job is suitable for your company',
13510
- proposalSent: 'When a proposal is successfully submitted',
13511
- proposalViewed: 'When a client views your proposal',
13512
- proposalReplied: 'When a client replies to your proposal',
13513
- noConnects: 'When your Agency profile has run out of Upwork connects',
13514
- accountDisconnected: 'When there is an issue with your Upwork Bidder account',
13515
- biddingWarning: 'When there is a bidding warning',
13490
+
13491
+ class PuppeteerConnectionErrorException extends Error {
13492
+ code = 'PUPPETEER_CONNECTION_ERROR_EXCEPTION';
13493
+ constructor(message) {
13494
+ super(message);
13495
+ }
13496
+ }
13497
+ const puppeteerConnectionErrorException = (message) => new PuppeteerConnectionErrorException(message);
13498
+
13499
+ class QuestionPairNotMatchingException extends Error {
13500
+ code = 'QUESTION_PAIR_NOT_MATCHING';
13501
+ constructor(upworkQuestion, generatedQuestion) {
13502
+ super(`Question pair not matching: ${upworkQuestion} !== ${generatedQuestion}`);
13503
+ }
13504
+ }
13505
+ const questionPairNotMatchingException = (upworkQuestion, generatedQuestion) => {
13506
+ return new QuestionPairNotMatchingException(upworkQuestion, generatedQuestion);
13516
13507
  };
13517
13508
 
13518
- const campaignCountByStatusSchema = z.object({
13519
- // Using z.enum values to create a schema with all possible job statuses
13520
- ...Object.fromEntries(Object.values(agentStatusSchema.enum).map((status) => [
13521
- status,
13522
- z.object({
13523
- boosted: z.number(),
13524
- organic: z.number(),
13525
- total: z.number(),
13526
- }),
13527
- ])),
13528
- });
13529
- const campaignInsightsSchema = z.object({
13530
- pipelineHealth: campaignCountByStatusSchema,
13531
- biddingAmount: z.number().default(0),
13532
- boostingAmount: z.number().default(0),
13533
- boostedProposalsCount: z.number().default(0),
13534
- totalProposalsCount: z.number().default(0),
13535
- totalExpenses: z.number().default(0),
13536
- suitabilityRange0to10: z.number(),
13537
- suitabilityRange10to20: z.number(),
13538
- suitabilityRange20to30: z.number(),
13539
- suitabilityRange30to40: z.number(),
13540
- suitabilityRange40to50: z.number(),
13541
- suitabilityRange50to60: z.number(),
13542
- suitabilityRange60to70: z.number(),
13543
- suitabilityRange70to80: z.number(),
13544
- suitabilityRange80to90: z.number(),
13545
- suitabilityRange90to100: z.number(),
13546
- });
13509
+ class SelectAgencyException extends Error {
13510
+ code = 'SELECT_AGENCY_EXCEPTION';
13511
+ constructor(agencyName, message) {
13512
+ super(`Failed to select agency ${agencyName}: ${message}`);
13513
+ }
13514
+ }
13515
+ function selectAgencyException(agencyName, message) {
13516
+ return new SelectAgencyException(agencyName, message);
13517
+ }
13518
+
13519
+ class SelectContractorException extends Error {
13520
+ code = 'SELECT_CONTRACTOR_EXCEPTION';
13521
+ constructor(contractorName, message) {
13522
+ super(`Failed to select contractor ${contractorName}: ${message}`);
13523
+ }
13524
+ }
13525
+ function selectContractorException(contractorName, message) {
13526
+ return new SelectContractorException(contractorName, message);
13527
+ }
13528
+
13529
+ class SelectorNotFoundError extends Error {
13530
+ code = 'SELECTOR_NOT_FOUND_ERROR';
13531
+ constructor(selector, context) {
13532
+ const message = context
13533
+ ? `Element matching selector "${selector}" not found within ${context}.`
13534
+ : `Element matching selector "${selector}" not found.`;
13535
+ super(message);
13536
+ }
13537
+ }
13538
+ const selectorNotFoundError = (selector, context) => new SelectorNotFoundError(selector, context);
13539
+
13540
+ class TypedValueInFieldNotMatchingException extends Error {
13541
+ code = 'TYPED_VALUE_IN_FIELD_NOT_MATCHING_EXCEPTION';
13542
+ constructor(element, inputValue, correctValue) {
13543
+ super(`Input value ${inputValue} does not match correct value ${correctValue} for element ${JSON.stringify(element)}`);
13544
+ }
13545
+ }
13546
+ const typedValueInFieldNotMatchingException = (element, inputValue, correctValue) => new TypedValueInFieldNotMatchingException(element, inputValue, correctValue);
13547
+
13548
+ class TypingInputFieldException extends Error {
13549
+ code = 'TYPING_INPUT_FIELD_EXCEPTION';
13550
+ constructor(element, message) {
13551
+ const identifier = JSON.stringify(element);
13552
+ super(`${identifier} - ${message}`);
13553
+ }
13554
+ }
13555
+ const typingInputFieldException = (element, message) => new TypingInputFieldException(element, message);
13556
+
13557
+ class WaitForFunctionTimeoutError extends Error {
13558
+ code = 'WAIT_FOR_FUNCTION_TIMEOUT_ERROR';
13559
+ constructor(fn, timeout) {
13560
+ super(`Timeout waiting for function "${fn.toString()}" after ${timeout}ms.`);
13561
+ }
13562
+ }
13563
+ const waitForFunctionTimeoutError = (fn, timeout) => new WaitForFunctionTimeoutError(fn, timeout);
13547
13564
 
13548
13565
  const invoiceStripeMetadataLineSchema = objectType({
13549
13566
  description: stringType(),
@@ -13986,8 +14003,8 @@ const upworkProfileSchema = objectType({
13986
14003
  });
13987
14004
 
13988
14005
  class NoScraperAccountAvailableException extends Error {
13989
- code = 'NO_SCRAPER_ACCOUNT_AVAILABLE';
13990
- constructor(message = 'No scraper account available.') {
14006
+ code = "NO_SCRAPER_ACCOUNT_AVAILABLE";
14007
+ constructor(message = "No scraper account available.") {
13991
14008
  super(message);
13992
14009
  }
13993
14010
  }
@@ -13995,8 +14012,8 @@ const noScraperAccountAvailableException = (message) => {
13995
14012
  return new NoScraperAccountAvailableException(message);
13996
14013
  };
13997
14014
  class OpenPageException extends Error {
13998
- code = 'OPEN_PAGE_FAILED';
13999
- constructor(message = 'Failed to open page.') {
14015
+ code = "OPEN_PAGE_FAILED";
14016
+ constructor(message = "Failed to open page.") {
14000
14017
  super(message);
14001
14018
  }
14002
14019
  }
@@ -14004,8 +14021,8 @@ const openPageException = (message) => {
14004
14021
  return new OpenPageException(message);
14005
14022
  };
14006
14023
  class FeedScrapeException extends Error {
14007
- code = 'FEED_SCRAPE_FAILED';
14008
- constructor(message = 'Feed scrape failed.') {
14024
+ code = "FEED_SCRAPE_FAILED";
14025
+ constructor(message = "Feed scrape failed.") {
14009
14026
  super(message);
14010
14027
  }
14011
14028
  }
@@ -14013,8 +14030,8 @@ const feedScrapeException = (message) => {
14013
14030
  return new FeedScrapeException(message);
14014
14031
  };
14015
14032
  class ParseJobListingsException extends Error {
14016
- code = 'PARSE_JOB_LISTINGS_FAILED';
14017
- constructor(message = 'Failed to parse job listings.') {
14033
+ code = "PARSE_JOB_LISTINGS_FAILED";
14034
+ constructor(message = "Failed to parse job listings.") {
14018
14035
  super(message);
14019
14036
  }
14020
14037
  }
@@ -14022,7 +14039,7 @@ const parseJobListingsException = (message) => {
14022
14039
  return new ParseJobListingsException(message);
14023
14040
  };
14024
14041
  class ScrapeJobDetailsException extends Error {
14025
- code = 'SCRAPE_JOB_DETAILS_FAILED';
14042
+ code = "SCRAPE_JOB_DETAILS_FAILED";
14026
14043
  constructor(jobListing) {
14027
14044
  super(`Failed to scrape job details for ${JSON.stringify(jobListing)}.`);
14028
14045
  }
@@ -14030,6 +14047,28 @@ class ScrapeJobDetailsException extends Error {
14030
14047
  const scrapeJobDetailsException = (jobListing) => {
14031
14048
  return new ScrapeJobDetailsException(jobListing);
14032
14049
  };
14050
+ class ParseUpworkProfilesException extends Error {
14051
+ code = "PARSE_JOB_PROFILES_FAILED";
14052
+ constructor(message = "Failed to parse profiles.") {
14053
+ super(message);
14054
+ }
14055
+ }
14056
+ const parseUpworkProfilesException = (message) => {
14057
+ return new ParseUpworkProfilesException(message);
14058
+ };
14059
+ class ScraperAccountProxyNotFoundException extends Error {
14060
+ scraperAccountId;
14061
+ proxyId;
14062
+ code = "SCRAPER_ACCOUNT_PROXY_NOT_FOUND";
14063
+ constructor(scraperAccountId, proxyId, message = "Scraper account proxy not found.") {
14064
+ super(message);
14065
+ this.scraperAccountId = scraperAccountId;
14066
+ this.proxyId = proxyId;
14067
+ }
14068
+ }
14069
+ const scraperAccountProxyNotFoundException = (scraperAccountId, proxyId, message) => {
14070
+ return new ScraperAccountProxyNotFoundException(scraperAccountId, proxyId, message);
14071
+ };
14033
14072
 
14034
14073
  const systemPromptSchema = objectType({
14035
14074
  suitability: stringType(),
@@ -14194,6 +14233,125 @@ const bidderInstanceSchema = objectType({
14194
14233
  updatedAt: numberType(),
14195
14234
  });
14196
14235
 
14236
+ const skillSchema = objectType({
14237
+ skill: objectType({
14238
+ prettyName: stringType(),
14239
+ uid: stringType(),
14240
+ }),
14241
+ uid: stringType(),
14242
+ });
14243
+ const portfolioItemSchema = objectType({
14244
+ description: stringType().nullable(),
14245
+ title: stringType(),
14246
+ videoUrl: stringType().nullable(),
14247
+ uid: stringType(),
14248
+ thumbnailUrl: stringType().nullable(),
14249
+ publicPortfolioItem: booleanType(),
14250
+ category: objectType({
14251
+ id: stringType().nullable(),
14252
+ level1: stringType().nullable(),
14253
+ level2: stringType().nullable(),
14254
+ }),
14255
+ });
14256
+ const profileSchema = objectType({
14257
+ title: stringType(),
14258
+ firstName: stringType(),
14259
+ lastName: stringType(),
14260
+ description: stringType(),
14261
+ location: objectType({
14262
+ country: stringType(),
14263
+ state: stringType().nullable(),
14264
+ city: stringType().nullable(),
14265
+ region: stringType(),
14266
+ subregion: stringType(),
14267
+ timezone: stringType(),
14268
+ zip: stringType().nullable(),
14269
+ }),
14270
+ chargeRate: objectType({
14271
+ rawValue: stringType(),
14272
+ currency: stringType(),
14273
+ }),
14274
+ portrait: objectType({
14275
+ portrait: stringType(),
14276
+ }),
14277
+ profileUrl: stringType(),
14278
+ offerConsultations: booleanType(),
14279
+ jobSummariesAssignmentRids: anyType().nullable(),
14280
+ shortName: stringType(),
14281
+ skills: arrayType(skillSchema),
14282
+ stats: objectType({
14283
+ hideJss: booleanType(),
14284
+ hideEarnings: booleanType(),
14285
+ topRatedStatus: stringType(),
14286
+ topRatedStatusEx: stringType(),
14287
+ rate: numberType(),
14288
+ earned: numberType(),
14289
+ jobSuccessScore: numberType(),
14290
+ rankInfo: anyType().nullable(),
14291
+ totalHours: numberType(),
14292
+ totalHourlyJobs: numberType(),
14293
+ totalFpJobs: numberType(),
14294
+ totalCompletedJobs: numberType(),
14295
+ }),
14296
+ portfolioItems: arrayType(portfolioItemSchema),
14297
+ totalPortfolioItems: numberType(),
14298
+ specializedProfiles: arrayType(anyType()),
14299
+ isDiversityCertified: booleanType(),
14300
+ isBoosted: booleanType(),
14301
+ boosted: booleanType(),
14302
+ boostedWouldHaveBeen: booleanType(),
14303
+ });
14304
+ const nuxtStateProfileSchema = objectType({
14305
+ identity: objectType({
14306
+ id: stringType(),
14307
+ ciphertext: stringType(),
14308
+ uid: stringType(),
14309
+ }),
14310
+ isPIBAvailable: booleanType(),
14311
+ profile: profileSchema,
14312
+ agency: objectType({
14313
+ orgId: stringType(),
14314
+ ciphertext: stringType(),
14315
+ name: stringType(),
14316
+ classifications: arrayType(anyType()),
14317
+ logo: stringType().nullable(),
14318
+ hideEarnings: booleanType(),
14319
+ totalEarnings: numberType(),
14320
+ isAgencyDiversityCertified: arrayType(anyType()),
14321
+ }),
14322
+ options: objectType({
14323
+ position: numberType(),
14324
+ }),
14325
+ });
14326
+ const nuxtStateProfilesSearchSchema = objectType({
14327
+ status: objectType({
14328
+ loading: booleanType(),
14329
+ loaded: booleanType(),
14330
+ failed: booleanType(),
14331
+ }),
14332
+ profiles: arrayType(nuxtStateProfileSchema),
14333
+ currentPage: numberType(),
14334
+ paging: objectType({
14335
+ total: numberType(),
14336
+ offset: numberType(),
14337
+ count: numberType(),
14338
+ originTotal: numberType(),
14339
+ pagesTotal: numberType(),
14340
+ page: numberType(),
14341
+ perPage: numberType(),
14342
+ }),
14343
+ flags: objectType({
14344
+ portfolioSearch: booleanType(),
14345
+ }),
14346
+ searchQueryCache: recordType(stringType()),
14347
+ "handle-response-data": recordType(anyType()),
14348
+ });
14349
+ const profileSearchNuxtStateSchema = objectType({
14350
+ state: objectType({
14351
+ profilesSearch: nuxtStateProfilesSearchSchema,
14352
+ }),
14353
+ });
14354
+
14197
14355
  // Main wrapper function
14198
14356
  async function tryCatch(promise) {
14199
14357
  try {
@@ -14600,6 +14758,7 @@ exports.NoScraperAccountAvailableException = NoScraperAccountAvailableException;
14600
14758
  exports.OpenPageException = OpenPageException;
14601
14759
  exports.ParseConnectsException = ParseConnectsException;
14602
14760
  exports.ParseJobListingsException = ParseJobListingsException;
14761
+ exports.ParseUpworkProfilesException = ParseUpworkProfilesException;
14603
14762
  exports.ProposalErrorAlertException = ProposalErrorAlertException;
14604
14763
  exports.ProposalFormWarningAlertException = ProposalFormWarningAlertException;
14605
14764
  exports.ProposalGenerationFailedException = ProposalGenerationFailedException;
@@ -14608,6 +14767,7 @@ exports.PuppeteerConnectionErrorException = PuppeteerConnectionErrorException;
14608
14767
  exports.QuestionPairNotMatchingException = QuestionPairNotMatchingException;
14609
14768
  exports.ROUTES = ROUTES;
14610
14769
  exports.ScrapeJobDetailsException = ScrapeJobDetailsException;
14770
+ exports.ScraperAccountProxyNotFoundException = ScraperAccountProxyNotFoundException;
14611
14771
  exports.SelectAgencyException = SelectAgencyException;
14612
14772
  exports.SelectContractorException = SelectContractorException;
14613
14773
  exports.SelectorNotFoundError = SelectorNotFoundError;
@@ -14643,6 +14803,7 @@ exports.bidderInstanceSchema = bidderInstanceSchema;
14643
14803
  exports.bidderInstanceStatusEnum = bidderInstanceStatusEnum;
14644
14804
  exports.biddingCompletedEventMetadata = biddingCompletedEventMetadata;
14645
14805
  exports.biddingFailedEventMetadata = biddingFailedEventMetadata;
14806
+ exports.biddingHourlyRateStrategy = biddingHourlyRateStrategy;
14646
14807
  exports.biddingRejectedWithFeedbackEventMetadata = biddingRejectedWithFeedbackEventMetadata;
14647
14808
  exports.booleanSchema = booleanSchema;
14648
14809
  exports.buildRoute = buildRoute;
@@ -14770,6 +14931,7 @@ exports.notificationConfigSchema = notificationConfigSchema;
14770
14931
  exports.nuxtStateJobDetailsSchema = nuxtStateJobDetailsSchema;
14771
14932
  exports.nuxtStateJobSchema = nuxtStateJobSchema;
14772
14933
  exports.nuxtStateJobsSearchSchema = nuxtStateJobsSearchSchema;
14934
+ exports.nuxtStateProfilesSearchSchema = nuxtStateProfilesSearchSchema;
14773
14935
  exports.onboardingProgressSchema = onboardingProgressSchema;
14774
14936
  exports.openPageException = openPageException;
14775
14937
  exports.organizationCampaignStatsSchema = organizationCampaignStatsSchema;
@@ -14779,18 +14941,22 @@ exports.organizationSchema = organizationSchema;
14779
14941
  exports.organizationSettingsSchema = organizationSettingsSchema;
14780
14942
  exports.organizationTierEnum = organizationTierEnum;
14781
14943
  exports.organizationTypeSchema = organizationTypeSchema;
14944
+ exports.organizationUpdateSchema = organizationUpdateSchema;
14782
14945
  exports.parseConnectsException = parseConnectsException;
14783
14946
  exports.parseJobListingsException = parseJobListingsException;
14947
+ exports.parseUpworkProfilesException = parseUpworkProfilesException;
14784
14948
  exports.passwordSchema = passwordSchema;
14785
14949
  exports.paymentTypeEnum = paymentTypeEnum;
14786
14950
  exports.periodTypeSchema = periodTypeSchema;
14787
14951
  exports.periodUsageSchema = periodUsageSchema;
14788
14952
  exports.planFeatureSchema = planFeatureSchema;
14789
14953
  exports.planSchema = planSchema;
14954
+ exports.planSlugToNameMap = planSlugToNameMap;
14790
14955
  exports.planStripeMetadataSchema = planStripeMetadataSchema;
14791
14956
  exports.pluralize = pluralize;
14792
14957
  exports.portfolioSchema = portfolioSchema;
14793
14958
  exports.processFeedPayloadSchema = processFeedPayloadSchema;
14959
+ exports.profileSearchNuxtStateSchema = profileSearchNuxtStateSchema;
14794
14960
  exports.projectDurationEnum = projectDurationEnum;
14795
14961
  exports.proposalCompleteEventMetadataSchema = proposalCompleteEventMetadataSchema;
14796
14962
  exports.proposalErrorAlertException = proposalErrorAlertException;
@@ -14835,6 +15001,7 @@ exports.scrapePayloadSchema = scrapePayloadSchema;
14835
15001
  exports.scrapeResultSchema = scrapeResultSchema;
14836
15002
  exports.scrapeUserProfileRequestSchema = scrapeUserProfileRequestSchema;
14837
15003
  exports.scraperAccountErrorEventMetadata = scraperAccountErrorEventMetadata;
15004
+ exports.scraperAccountProxyNotFoundException = scraperAccountProxyNotFoundException;
14838
15005
  exports.scraperAccountRegionEnum = scraperAccountRegionEnum;
14839
15006
  exports.scraperAccountSchema = scraperAccountSchema;
14840
15007
  exports.scraperAccountType = scraperAccountType;