lancer-shared 1.2.138 → 1.2.140

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.
@@ -6581,9 +6581,11 @@ const ROUTES = {
6581
6581
  BASE: (organizationId, campaignId) => `organizations/${organizationId}/campaigns/${campaignId}/chat-bots`,
6582
6582
  BY_PLATFORM: (organizationId, campaignId, platform) => `organizations/${organizationId}/campaigns/${campaignId}/chat-bots/${platform}`,
6583
6583
  OAUTH_URL: (organizationId, campaignId, platform) => `organizations/${organizationId}/campaigns/${campaignId}/chat-bots/${platform}/oauth-url`,
6584
+ UPDATE_SUITABLE_LEAD_NOTIFICATION: (organizationId, campaignId, leadId) => `organizations/${organizationId}/campaigns/${campaignId}/chat-bots/update-lead-message-state/${leadId}`,
6584
6585
  CALLBACK: (platform) => `chat-bots/${platform}/callback`,
6585
6586
  SEND_NOTIFICATION: () => 'chat-bots/send-notification',
6586
6587
  REMOVE_SUITABLE_LEAD_MESSAGE_BUTTONS: () => 'chat-bots/remove-suitable-lead-message-buttons',
6588
+ SLACK_INTERACTIONS: () => 'chat-bots/slack/interactions',
6587
6589
  },
6588
6590
  ACTIVITIES: {
6589
6591
  BASE: (organizationId, campaignId) => `organizations/${organizationId}/campaigns/${campaignId}/activities`,
@@ -12741,513 +12743,196 @@ const generateLeadCountsRequestSchema = z.object({
12741
12743
  campaignId: z.string().optional(),
12742
12744
  });
12743
12745
 
12744
- const bidPayloadProposalDataSchema = z.object({
12745
- coverLetter: z.string(),
12746
- questionAnswerPairs: questionAnswerPairSchema.array().nullable(),
12747
- boostingEnabled: z.boolean(),
12748
- maximumBoost: z.number().nullable(),
12746
+ const usageEventTypeEnum = z.enum([
12747
+ 'suitabilityComplete',
12748
+ 'proposalComplete',
12749
+ 'biddingComplete',
12750
+ ]);
12751
+ const usageEventMetadataSchema = objectType({
12752
+ campaignId: stringType().nullable(),
12753
+ userId: stringType().nullable(),
12754
+ stripeSubscriptionId: stringType().nullable(),
12755
+ planId: stringType().nullable(),
12749
12756
  });
12750
- const freelancerBidProposalDataSchema = bidPayloadProposalDataSchema;
12751
- const agencyBidProposalDataSchema = bidPayloadProposalDataSchema.extend({
12752
- agencyName: z.string(),
12753
- contractorName: z.string(),
12754
- specializedProfile: z.string().nullable(),
12757
+ const usageEventSchema = objectType({
12758
+ organizationId: stringType(),
12759
+ typeId: usageEventTypeEnum,
12760
+ timestamp: numberType(),
12761
+ metadata: usageEventMetadataSchema,
12755
12762
  });
12756
- const bidPayloadSchema = z.object({
12757
- organizationId: z.string(),
12758
- campaignId: z.string(),
12759
- lead: leadSchema,
12760
- jobUrl: z.string(),
12761
- username: z.string(),
12762
- password: z.string(),
12763
+
12764
+ const billingStripeMetadataSchema = objectType({
12765
+ customer: objectType({ id: stringType().nullable() }),
12763
12766
  });
12764
- const agencyBidPayloadSchema = bidPayloadSchema.extend({
12765
- proposalData: agencyBidProposalDataSchema,
12767
+ const billingSchema = objectType({
12768
+ savedCard: booleanType(),
12769
+ stripe: billingStripeMetadataSchema,
12766
12770
  });
12767
- const freelancerBidPayloadSchema = bidPayloadSchema.extend({
12768
- proposalData: freelancerBidProposalDataSchema,
12771
+
12772
+ const subscriptionStatusEnum = z.enum([
12773
+ "active",
12774
+ "trialing",
12775
+ "cancelled",
12776
+ "paused",
12777
+ "payment_processing",
12778
+ "payment_pending",
12779
+ "payment_failed",
12780
+ ]);
12781
+ const subscriptionSourceEnum = z.enum(["stripe", "manual"]);
12782
+ const subscriptionStripeMetadataItemSchema = objectType({
12783
+ id: stringType(),
12784
+ price: objectType({
12785
+ id: stringType(),
12786
+ }),
12769
12787
  });
12770
- const bidDtoSchema = z.object({
12771
- organizationId: z.string(),
12772
- campaignId: z.string(),
12773
- leadId: z.string(),
12788
+ const subscriptionStripeMetadataSchema = objectType({
12789
+ id: stringType(),
12790
+ items: arrayType(subscriptionStripeMetadataItemSchema),
12791
+ invoice: objectType({
12792
+ id: stringType(),
12793
+ hosted_invoice_url: stringType().nullable(),
12794
+ }),
12795
+ });
12796
+ const subscriptionSchema = objectType({
12797
+ planId: stringType(),
12798
+ pendingPlanId: stringType().nullable(),
12799
+ status: subscriptionStatusEnum,
12800
+ startedAt: numberType(),
12801
+ currentPeriodEnd: numberType(),
12802
+ stripe: subscriptionStripeMetadataSchema,
12803
+ source: subscriptionSourceEnum,
12804
+ usage: recordType(usageEventTypeEnum, numberType()),
12774
12805
  });
12775
12806
 
12776
- const bidSuccessSchema = z.object({
12777
- status: z.literal("success"),
12778
- biddingAmount: z.number(),
12779
- boosted: z.boolean(),
12780
- boostingAmount: z.number(),
12807
+ const coverLetterTemplateSchema = z.object({
12808
+ id: z.string(),
12809
+ name: z.string(),
12810
+ description: z.string().nullable(),
12811
+ template: z.string(),
12812
+ instructions: z.string(),
12781
12813
  });
12782
- const bidFailedSchema = z.object({
12783
- status: z.literal("failed"),
12784
- errorMessage: z.string(),
12814
+ const createCoverLetterTemplateSchema = coverLetterTemplateSchema.pick({
12815
+ name: true,
12816
+ template: true,
12817
+ instructions: true,
12785
12818
  });
12786
12819
 
12787
- class CloudflareChallengeFailedException extends Error {
12788
- code = 'CLOUDFLARE_CHALLENGE_FAILED_EXCEPTION';
12789
- constructor(url, errorMessage) {
12790
- super(`Cloudflare challenge failed for ${url}\n\n ${errorMessage}`);
12791
- }
12792
- }
12793
- const cloudflareProtectionFailure = (url, errorMessage) => new CloudflareChallengeFailedException(url, errorMessage);
12794
-
12795
- class DeleteMultiloginProfileException extends Error {
12796
- code = 'DELETE_MULTILOGIN_PROFILE_EXCEPTION';
12797
- constructor(message) {
12798
- super(message);
12799
- }
12800
- }
12801
- const deleteMultiloginProfileException = (message) => new DeleteMultiloginProfileException(message);
12820
+ const organizationMemberRoleEnum = z.enum(["admin", "member"]);
12821
+ const organizationMemberSchema = objectType({
12822
+ role: organizationMemberRoleEnum,
12823
+ joinedAt: numberType(),
12824
+ invitedBy: stringType(),
12825
+ });
12802
12826
 
12803
- class DropdownOptionNotPresentException extends Error {
12804
- code = 'DROPDOWN_OPTION_NOT_PRESENT_EXCEPTION';
12805
- constructor(selector, option) {
12806
- super(`${selector} does not contain option ${option}`);
12807
- }
12808
- }
12809
- function dropdownOptionNotPresentException(selector, option) {
12810
- return new DropdownOptionNotPresentException(selector, option);
12811
- }
12827
+ const onboardingProgressSchema = z.object({
12828
+ profileSetup: z.boolean(),
12829
+ campaignCreated: z.boolean(),
12830
+ filtersAdded: z.boolean(),
12831
+ automationEnabled: z.boolean(),
12832
+ startCampaign: z.boolean(),
12833
+ });
12812
12834
 
12813
- class ElementNotClickableException extends Error {
12814
- code = 'ELEMENT_NOT_CLICKABLE_EXCEPTION';
12815
- constructor(context, message) {
12816
- super(`${context} is not clickable: ${message}`);
12817
- }
12818
- }
12819
- function elementNotClickableException(elementInfo, message) {
12820
- return new ElementNotClickableException(JSON.stringify(elementInfo), message);
12821
- }
12835
+ const organizationTypeSchema = z.enum(['agency', 'freelancer']);
12836
+ const organizationTierEnum = z.enum(['free', 'premium']);
12837
+ const limitsSchema = objectType({
12838
+ monthlyCredits: numberType(),
12839
+ usedCredits: numberType(),
12840
+ extraCredits: numberType(),
12841
+ });
12842
+ const oneTimePaymentSchema = z.object({
12843
+ paidAt: z.number().optional(),
12844
+ amount: z.number().optional(),
12845
+ currency: z.string().optional(),
12846
+ status: z.string(),
12847
+ paymentIntentId: z.string().optional(),
12848
+ error: z.string().optional(),
12849
+ });
12850
+ const oneTimePaymentsSchema = z.object({
12851
+ usBidderAccountPayment: oneTimePaymentSchema.optional(),
12852
+ });
12853
+ const organizationSchema = objectType({
12854
+ id: stringType(),
12855
+ name: stringType(),
12856
+ type: organizationTypeSchema,
12857
+ associatedBidders: z.array(stringType()).nullable(),
12858
+ subscription: subscriptionSchema.nullable(),
12859
+ active: booleanType(),
12860
+ limits: limitsSchema,
12861
+ billing: billingSchema.nullable(),
12862
+ lastBidTime: numberType().nullable(),
12863
+ nextScheduledBidTime: numberType().nullable(),
12864
+ createdAt: numberType(),
12865
+ updatedAt: numberType(),
12866
+ openRouterApiKey: stringType().nullable(),
12867
+ appTrialEndsAt: numberType().nullable(),
12868
+ oneTimePayments: oneTimePaymentsSchema.optional(),
12869
+ });
12870
+ const caseStudySchema = objectType({
12871
+ id: stringType(),
12872
+ title: stringType(),
12873
+ description: stringType(),
12874
+ });
12875
+ z.object({
12876
+ type: z.enum(['freelancer', 'agency']),
12877
+ name: z.string(),
12878
+ summary: z.string(),
12879
+ coreServices: z.string(),
12880
+ toolsSkillsTechnologies: z.string(),
12881
+ approach: z.string(),
12882
+ icp: z.string(),
12883
+ projectsTheyAvoid: z.string(),
12884
+ spokenLanguages: z.string(),
12885
+ agencyInfo: z.object({
12886
+ location: z.array(z.string()),
12887
+ website: z.string().url(),
12888
+ teamSize: z.number(),
12889
+ }),
12890
+ caseStudies: z.array(caseStudySchema),
12891
+ });
12892
+ const createOrganizationSchema = organizationSchema.pick({
12893
+ name: true,
12894
+ type: true,
12895
+ });
12896
+ const trackUsageEventTypeEnum = z.enum([
12897
+ 'suitabilityComplete',
12898
+ 'proposalComplete',
12899
+ 'biddingComplete',
12900
+ ]);
12901
+ const trackUsagePayloadSchema = objectType({
12902
+ event: usageEventTypeEnum,
12903
+ campaignId: stringType().nullish(),
12904
+ });
12905
+ const questionRulesSchema = objectType({
12906
+ question: stringType(),
12907
+ answer: stringType(),
12908
+ category: stringType(),
12909
+ });
12910
+ const aiConfigSchema = objectType({
12911
+ questionHandling: z.string().nullable(),
12912
+ questionRules: arrayType(questionRulesSchema).nullable(),
12913
+ disqualifierRules: z.string().nullable(),
12914
+ userInstructions: z.string().nullable(),
12915
+ });
12916
+ const notificationConfigSchema = objectType({
12917
+ emailEnabled: booleanType(),
12918
+ discordWebhookUrl: stringType().nullable(),
12919
+ slackWebhookUrl: stringType().nullable(),
12920
+ });
12921
+ const organizationSettingsSchema = objectType({
12922
+ aiConfig: aiConfigSchema,
12923
+ });
12924
+ const subscribePayloadSchema = objectType({
12925
+ planId: stringType().min(1, 'Plan id is required.'),
12926
+ paymentMethodId: stringType().min(1, 'Payment method is required.'),
12927
+ toltReferral: stringType().optional(),
12928
+ couponCode: stringType().nullish(),
12929
+ });
12822
12930
 
12823
- class EvaluateElementException extends Error {
12824
- code = 'EVALUATE_ELEMENT_EXCEPTION';
12825
- constructor(element, message) {
12826
- super(`Element evaluation for ${JSON.stringify(element)} failed: ${message}`);
12827
- }
12828
- }
12829
- function evaluateElementException(element, message) {
12830
- return new EvaluateElementException(element, message);
12831
- }
12832
-
12833
- class EvaluateFunctionException extends Error {
12834
- code = 'EVALUATE_FUNCTION_EXCEPTION';
12835
- constructor(fn, args, message) {
12836
- super(`Evaluation function ${fn.toString()} failed with selectors: ${args} \n\n Error Message: ${message}`);
12837
- }
12838
- }
12839
- function evaluateFunctionException(fn, args, message) {
12840
- return new EvaluateFunctionException(fn, args, message);
12841
- }
12842
-
12843
- class GetMultiloginBrowserException extends Error {
12844
- code = 'GET_MULTILOGIN_BROWSER_EXCEPTION';
12845
- constructor(message) {
12846
- super(message);
12847
- }
12848
- }
12849
- const getMultiloginBrowserException = (message) => new GetMultiloginBrowserException(message);
12850
-
12851
- class IncorrectSecurityQuestionAnswerException extends Error {
12852
- code = 'INCORRECT_SECURITY_QUESTION_ANSWER_EXCEPTION';
12853
- constructor(message) {
12854
- super(message);
12855
- }
12856
- }
12857
- const incorrectSecurityQuestionAnswerException = (message) => new IncorrectSecurityQuestionAnswerException(message);
12858
-
12859
- class InitBrowserException extends Error {
12860
- code = 'INIT_BROWSER_EXCEPTION';
12861
- constructor(message) {
12862
- super(message);
12863
- }
12864
- }
12865
- const initBrowserException = (message) => new InitBrowserException(message);
12866
-
12867
- class InsufficientConnectsException extends Error {
12868
- code = 'INSUFFICIENT_CONNECTS_EXCEPTION';
12869
- constructor(message) {
12870
- super(message);
12871
- }
12872
- }
12873
- const insufficientConnectsException = (message) => new InsufficientConnectsException(message);
12874
-
12875
- class InvalidCredentialsException extends Error {
12876
- code = 'INVALID_CREDENTIALS_EXCEPTION';
12877
- constructor(message) {
12878
- super(message);
12879
- }
12880
- }
12881
- const invalidCredentialsException = (message) => new InvalidCredentialsException(message);
12882
-
12883
- class InvalidJobUrlException extends Error {
12884
- code = 'INVALID_JOB_URL_EXCEPTION';
12885
- constructor(message) {
12886
- super(message);
12887
- }
12888
- }
12889
- function invalidJobUrlException(message) {
12890
- return new InvalidJobUrlException(message);
12891
- }
12892
-
12893
- class LoginFailedException extends Error {
12894
- code = 'LOGIN_FAILED_EXCEPTION';
12895
- constructor(message) {
12896
- super(message);
12897
- }
12898
- }
12899
- const loginFailedException = (message) => {
12900
- return new LoginFailedException(message);
12901
- };
12902
-
12903
- class MultiloginAuthenticationException extends Error {
12904
- code = 'MULTILOGIN_AUTHENTICATION_EXCEPTION';
12905
- constructor(message) {
12906
- super(message);
12907
- }
12908
- }
12909
- const multiloginAuthenticationException = (message) => new MultiloginAuthenticationException(message);
12910
-
12911
- class NavigationTimeoutException extends Error {
12912
- code = 'NAVIGATION_TIMEOUT_EXCEPTION';
12913
- constructor(url, message) {
12914
- super(`Navigation to ${url} timed out: ${message}`);
12915
- }
12916
- }
12917
- const navigationTimeoutException = (url, message) => new NavigationTimeoutException(url, message);
12918
-
12919
- class NewBrowserPageException extends Error {
12920
- code = 'NEW_BROWSER_PAGE_EXCEPTION';
12921
- constructor(profileId, message) {
12922
- super(`Browser page for profile ${profileId} not found. \n\n Error Message: ${message}`);
12923
- }
12924
- }
12925
- const newBrowserPageException = (profileId, message) => new NewBrowserPageException(profileId, message);
12926
-
12927
- class NewPageException extends Error {
12928
- code = 'NEW_PAGE_EXCEPTION';
12929
- constructor(message) {
12930
- super(message);
12931
- }
12932
- }
12933
- const newPageException = (message) => new NewPageException(message);
12934
-
12935
- class GoToUrlException extends Error {
12936
- code = 'GO_TO_URL_EXCEPTION';
12937
- constructor(url, message) {
12938
- super(`Error opening new url: ${url}. \n\n Error Message: ${message}`);
12939
- }
12940
- }
12941
- const goToUrlException = (url, message) => new GoToUrlException(url, message);
12942
-
12943
- class ParseConnectsException extends Error {
12944
- code = 'PARSE_CONNECTS_EXCEPTION';
12945
- constructor() {
12946
- super('Failed to parse connects');
12947
- }
12948
- }
12949
- const parseConnectsException = () => new ParseConnectsException();
12950
-
12951
- class ProposalErrorAlertException extends Error {
12952
- code = 'PROPOSAL_ERROR_ALERT_EXCEPTION';
12953
- constructor(message) {
12954
- super(message);
12955
- }
12956
- }
12957
- const proposalErrorAlertException = (message) => new ProposalErrorAlertException(message);
12958
-
12959
- class ProposalFormWarningAlertException extends Error {
12960
- code = 'PROPOSAL_FORM_WARNING_ALERT_EXCEPTION';
12961
- constructor(message) {
12962
- super(message);
12963
- }
12964
- }
12965
- function proposalFormWarningAlertException(message) {
12966
- return new ProposalFormWarningAlertException(message);
12967
- }
12968
-
12969
- class ProposalGenerationFailedException extends Error {
12970
- code = 'PROPOSAL_GENERATION_FAILED_EXCEPTION';
12971
- constructor(message, organizationId, campaignId, leadId) {
12972
- super(`Proposal generation failed for lead ${leadId} in campaign ${campaignId} in organization ${organizationId}\n\n${message}`);
12973
- }
12974
- }
12975
- const proposalGenerationFailed = (message, leadId, campaignId, organizationId) => new ProposalGenerationFailedException(message, organizationId, campaignId, leadId);
12976
-
12977
- class ProposalSubmitFailedException extends Error {
12978
- code = 'PROPOSAL_SUBMIT_FAILED';
12979
- constructor(message) {
12980
- super(message);
12981
- }
12982
- }
12983
- const proposalSubmitFailedException = (message) => {
12984
- return new ProposalSubmitFailedException(message);
12985
- };
12986
-
12987
- class PuppeteerConnectionErrorException extends Error {
12988
- code = 'PUPPETEER_CONNECTION_ERROR_EXCEPTION';
12989
- constructor(message) {
12990
- super(message);
12991
- }
12992
- }
12993
- const puppeteerConnectionErrorException = (message) => new PuppeteerConnectionErrorException(message);
12994
-
12995
- class QuestionPairNotMatchingException extends Error {
12996
- code = 'QUESTION_PAIR_NOT_MATCHING';
12997
- constructor(upworkQuestion, generatedQuestion) {
12998
- super(`Question pair not matching: ${upworkQuestion} !== ${generatedQuestion}`);
12999
- }
13000
- }
13001
- const questionPairNotMatchingException = (upworkQuestion, generatedQuestion) => {
13002
- return new QuestionPairNotMatchingException(upworkQuestion, generatedQuestion);
13003
- };
13004
-
13005
- class SelectAgencyException extends Error {
13006
- code = 'SELECT_AGENCY_EXCEPTION';
13007
- constructor(agencyName, message) {
13008
- super(`Failed to select agency ${agencyName}: ${message}`);
13009
- }
13010
- }
13011
- function selectAgencyException(agencyName, message) {
13012
- return new SelectAgencyException(agencyName, message);
13013
- }
13014
-
13015
- class SelectContractorException extends Error {
13016
- code = 'SELECT_CONTRACTOR_EXCEPTION';
13017
- constructor(contractorName, message) {
13018
- super(`Failed to select contractor ${contractorName}: ${message}`);
13019
- }
13020
- }
13021
- function selectContractorException(contractorName, message) {
13022
- return new SelectContractorException(contractorName, message);
13023
- }
13024
-
13025
- class SelectorNotFoundError extends Error {
13026
- code = 'SELECTOR_NOT_FOUND_ERROR';
13027
- constructor(selector, context) {
13028
- const message = context
13029
- ? `Element matching selector "${selector}" not found within ${context}.`
13030
- : `Element matching selector "${selector}" not found.`;
13031
- super(message);
13032
- }
13033
- }
13034
- const selectorNotFoundError = (selector, context) => new SelectorNotFoundError(selector, context);
13035
-
13036
- class TypedValueInFieldNotMatchingException extends Error {
13037
- code = 'TYPED_VALUE_IN_FIELD_NOT_MATCHING_EXCEPTION';
13038
- constructor(element, inputValue, correctValue) {
13039
- super(`Input value ${inputValue} does not match correct value ${correctValue} for element ${JSON.stringify(element)}`);
13040
- }
13041
- }
13042
- const typedValueInFieldNotMatchingException = (element, inputValue, correctValue) => new TypedValueInFieldNotMatchingException(element, inputValue, correctValue);
13043
-
13044
- class TypingInputFieldException extends Error {
13045
- code = 'TYPING_INPUT_FIELD_EXCEPTION';
13046
- constructor(element, message) {
13047
- const identifier = JSON.stringify(element);
13048
- super(`${identifier} - ${message}`);
13049
- }
13050
- }
13051
- const typingInputFieldException = (element, message) => new TypingInputFieldException(element, message);
13052
-
13053
- class WaitForFunctionTimeoutError extends Error {
13054
- code = 'WAIT_FOR_FUNCTION_TIMEOUT_ERROR';
13055
- constructor(fn, timeout) {
13056
- super(`Timeout waiting for function "${fn.toString()}" after ${timeout}ms.`);
13057
- }
13058
- }
13059
- const waitForFunctionTimeoutError = (fn, timeout) => new WaitForFunctionTimeoutError(fn, timeout);
13060
-
13061
- const usageEventTypeEnum = z.enum([
13062
- 'suitabilityComplete',
13063
- 'proposalComplete',
13064
- 'biddingComplete',
13065
- ]);
13066
- const usageEventMetadataSchema = objectType({
13067
- campaignId: stringType().nullable(),
13068
- userId: stringType().nullable(),
13069
- stripeSubscriptionId: stringType().nullable(),
13070
- planId: stringType().nullable(),
13071
- });
13072
- const usageEventSchema = objectType({
13073
- organizationId: stringType(),
13074
- typeId: usageEventTypeEnum,
13075
- timestamp: numberType(),
13076
- metadata: usageEventMetadataSchema,
13077
- });
13078
-
13079
- const billingStripeMetadataSchema = objectType({
13080
- customer: objectType({ id: stringType().nullable() }),
13081
- });
13082
- const billingSchema = objectType({
13083
- savedCard: booleanType(),
13084
- stripe: billingStripeMetadataSchema,
13085
- });
13086
-
13087
- const subscriptionStatusEnum = z.enum([
13088
- "active",
13089
- "trialing",
13090
- "cancelled",
13091
- "paused",
13092
- "payment_processing",
13093
- "payment_pending",
13094
- "payment_failed",
13095
- ]);
13096
- const subscriptionSourceEnum = z.enum(["stripe", "manual"]);
13097
- const subscriptionStripeMetadataItemSchema = objectType({
13098
- id: stringType(),
13099
- price: objectType({
13100
- id: stringType(),
13101
- }),
13102
- });
13103
- const subscriptionStripeMetadataSchema = objectType({
13104
- id: stringType(),
13105
- items: arrayType(subscriptionStripeMetadataItemSchema),
13106
- invoice: objectType({
13107
- id: stringType(),
13108
- hosted_invoice_url: stringType().nullable(),
13109
- }),
13110
- });
13111
- const subscriptionSchema = objectType({
13112
- planId: stringType(),
13113
- pendingPlanId: stringType().nullable(),
13114
- status: subscriptionStatusEnum,
13115
- startedAt: numberType(),
13116
- currentPeriodEnd: numberType(),
13117
- stripe: subscriptionStripeMetadataSchema,
13118
- source: subscriptionSourceEnum,
13119
- usage: recordType(usageEventTypeEnum, numberType()),
13120
- });
13121
-
13122
- const coverLetterTemplateSchema = z.object({
13123
- id: z.string(),
13124
- name: z.string(),
13125
- description: z.string().nullable(),
13126
- template: z.string(),
13127
- instructions: z.string(),
13128
- });
13129
- const createCoverLetterTemplateSchema = coverLetterTemplateSchema.pick({
13130
- name: true,
13131
- template: true,
13132
- instructions: true,
13133
- });
13134
-
13135
- const organizationMemberRoleEnum = z.enum(["admin", "member"]);
13136
- const organizationMemberSchema = objectType({
13137
- role: organizationMemberRoleEnum,
13138
- joinedAt: numberType(),
13139
- invitedBy: stringType(),
13140
- });
13141
-
13142
- const onboardingProgressSchema = z.object({
13143
- profileSetup: z.boolean(),
13144
- campaignCreated: z.boolean(),
13145
- filtersAdded: z.boolean(),
13146
- automationEnabled: z.boolean(),
13147
- startCampaign: z.boolean(),
13148
- });
13149
-
13150
- const organizationTypeSchema = z.enum(['agency', 'freelancer']);
13151
- const organizationTierEnum = z.enum(['free', 'premium']);
13152
- const limitsSchema = objectType({
13153
- monthlyCredits: numberType(),
13154
- usedCredits: numberType(),
13155
- extraCredits: numberType(),
13156
- });
13157
- const oneTimePaymentSchema = z.object({
13158
- paidAt: z.number().optional(),
13159
- amount: z.number().optional(),
13160
- currency: z.string().optional(),
13161
- status: z.string(),
13162
- paymentIntentId: z.string().optional(),
13163
- error: z.string().optional(),
13164
- });
13165
- const oneTimePaymentsSchema = z.object({
13166
- usBidderAccountPayment: oneTimePaymentSchema.optional(),
13167
- });
13168
- const organizationSchema = objectType({
13169
- id: stringType(),
13170
- name: stringType(),
13171
- type: organizationTypeSchema,
13172
- associatedBidders: z.array(stringType()).nullable(),
13173
- subscription: subscriptionSchema.nullable(),
13174
- active: booleanType(),
13175
- limits: limitsSchema,
13176
- billing: billingSchema.nullable(),
13177
- lastBidTime: numberType().nullable(),
13178
- nextScheduledBidTime: numberType().nullable(),
13179
- createdAt: numberType(),
13180
- updatedAt: numberType(),
13181
- openRouterApiKey: stringType().nullable(),
13182
- appTrialEndsAt: numberType().nullable(),
13183
- oneTimePayments: oneTimePaymentsSchema.optional(),
13184
- });
13185
- const caseStudySchema = objectType({
13186
- id: stringType(),
13187
- title: stringType(),
13188
- description: stringType(),
13189
- });
13190
- z.object({
13191
- type: z.enum(['freelancer', 'agency']),
13192
- name: z.string(),
13193
- summary: z.string(),
13194
- coreServices: z.string(),
13195
- toolsSkillsTechnologies: z.string(),
13196
- approach: z.string(),
13197
- icp: z.string(),
13198
- projectsTheyAvoid: z.string(),
13199
- spokenLanguages: z.string(),
13200
- agencyInfo: z.object({
13201
- location: z.array(z.string()),
13202
- website: z.string().url(),
13203
- teamSize: z.number(),
13204
- }),
13205
- caseStudies: z.array(caseStudySchema),
13206
- });
13207
- const createOrganizationSchema = organizationSchema.pick({
13208
- name: true,
13209
- type: true,
13210
- });
13211
- const trackUsageEventTypeEnum = z.enum([
13212
- 'suitabilityComplete',
13213
- 'proposalComplete',
13214
- 'biddingComplete',
13215
- ]);
13216
- const trackUsagePayloadSchema = objectType({
13217
- event: usageEventTypeEnum,
13218
- campaignId: stringType().nullish(),
13219
- });
13220
- const questionRulesSchema = objectType({
13221
- question: stringType(),
13222
- answer: stringType(),
13223
- category: stringType(),
13224
- });
13225
- const aiConfigSchema = objectType({
13226
- questionHandling: z.string().nullable(),
13227
- questionRules: arrayType(questionRulesSchema).nullable(),
13228
- disqualifierRules: z.string().nullable(),
13229
- userInstructions: z.string().nullable(),
13230
- });
13231
- const notificationConfigSchema = objectType({
13232
- emailEnabled: booleanType(),
13233
- discordWebhookUrl: stringType().nullable(),
13234
- slackWebhookUrl: stringType().nullable(),
13235
- });
13236
- const organizationSettingsSchema = objectType({
13237
- aiConfig: aiConfigSchema,
13238
- });
13239
- const subscribePayloadSchema = objectType({
13240
- planId: stringType().min(1, 'Plan id is required.'),
13241
- paymentMethodId: stringType().min(1, 'Payment method is required.'),
13242
- toltReferral: stringType().optional(),
13243
- couponCode: stringType().nullish(),
13244
- });
13245
-
13246
- const campaignExpensesSchema = z.object({
13247
- biddingAmount: z.number().default(0),
13248
- boostingAmount: z.number().default(0),
13249
- boosted: z.number().default(0),
13250
- });
12931
+ const campaignExpensesSchema = z.object({
12932
+ biddingAmount: z.number().default(0),
12933
+ boostingAmount: z.number().default(0),
12934
+ boosted: z.number().default(0),
12935
+ });
13251
12936
 
13252
12937
  const bidConfigSchema = z.object({
13253
12938
  agencyName: z.string().nullable(),
@@ -13261,6 +12946,11 @@ const campaignStatusSchema = z.union([
13261
12946
  z.literal('paused'),
13262
12947
  z.literal('error'),
13263
12948
  ]);
12949
+ const biddingHourlyRateStrategy = z.enum([
12950
+ 'match_job_budget',
12951
+ 'match_profile_rate',
12952
+ 'fixed_rate',
12953
+ ]);
13264
12954
  const campaignSchema = z.object({
13265
12955
  id: z.string(),
13266
12956
  name: z.string(),
@@ -13275,6 +12965,9 @@ const campaignSchema = z.object({
13275
12965
  monthlyBudget: z.number().nullable(),
13276
12966
  // suitabilityThreshold: z.number().min(0).max(100).nullable().default(0),
13277
12967
  boostingThreshold: z.number().min(0).max(100).nullable().default(0),
12968
+ biddingDelayInMinutes: z.number().default(5),
12969
+ biddingHourlyRateStrategy: biddingHourlyRateStrategy,
12970
+ biddingFixedHourlyRate: z.number().nullable(),
13278
12971
  leadCounts: z.record(leadStatusSchema, z.number()).nullable(),
13279
12972
  expenses: campaignExpensesSchema,
13280
12973
  notificationsEnabled: z.boolean().nullable(),
@@ -13440,97 +13133,429 @@ const updateCampaignAnalyticsSchema = z.object({
13440
13133
  ])),
13441
13134
  });
13442
13135
 
13443
- const campaignNotificationType = z.enum([
13444
- 'suitableLead',
13445
- 'proposalSent',
13446
- 'proposalViewed',
13447
- 'proposalReplied',
13448
- 'noConnects',
13449
- 'accountDisconnected',
13450
- 'biddingWarning',
13451
- ]);
13452
- const chatbotChannelSchema = z.object({
13453
- id: z.string(),
13454
- name: z.string(),
13455
- });
13456
- const chatbotPlatforms = z.enum(['discord']);
13457
- const chatbotSchema = z.object({
13458
- guildId: z.string(),
13459
- channels: z.array(chatbotChannelSchema),
13460
- selectedChannelId: z.string().nullable(),
13461
- notificationsEnabled: z.boolean().default(true),
13462
- notificationSettings: z.record(campaignNotificationType, z.boolean().default(true)),
13463
- organizationId: z.string(),
13464
- campaignId: z.string(),
13465
- createdAt: z.number(),
13466
- updatedAt: z.number(),
13467
- });
13468
- const createChatbotSchema = chatbotSchema.pick({
13469
- guildId: true,
13470
- channels: true,
13471
- organizationId: true,
13472
- campaignId: true,
13473
- });
13474
- const updateChatbotSchema = chatbotSchema.pick({
13475
- selectedChannelId: true,
13476
- notificationsEnabled: true,
13477
- notificationSettings: true,
13478
- });
13479
- const sendNotificationRequestSchema = z.object({
13480
- organizationId: z.string(),
13481
- campaignId: z.string(),
13482
- leadId: z.string(),
13483
- notificationType: campaignNotificationType,
13484
- message: z.string().optional(),
13485
- });
13486
- const CAMPAIGN_NOTIFICATION_TYPES = {
13487
- suitableLead: 'Suitable Lead',
13488
- proposalSent: 'Proposal Sent',
13489
- proposalViewed: 'Proposal Viewed',
13490
- proposalReplied: 'Proposal Replied',
13491
- noConnects: 'No Connects',
13492
- accountDisconnected: 'Account Disconnected',
13493
- biddingWarning: 'Bidding Warning',
13136
+ const campaignNotificationType = z.enum([
13137
+ 'suitableLead',
13138
+ 'proposalSent',
13139
+ 'proposalViewed',
13140
+ 'proposalReplied',
13141
+ 'noConnects',
13142
+ 'accountDisconnected',
13143
+ 'biddingWarning',
13144
+ ]);
13145
+ const chatbotChannelSchema = z.object({
13146
+ id: z.string(),
13147
+ name: z.string(),
13148
+ });
13149
+ const chatbotPlatforms = z.enum(['discord', 'slack']);
13150
+ const chatbotSchema = z.object({
13151
+ accessToken: z.string().optional(),
13152
+ refreshToken: z.string().optional(),
13153
+ workspaceId: z.string(),
13154
+ channels: z.array(chatbotChannelSchema),
13155
+ selectedChannelId: z.string().nullable(),
13156
+ notificationsEnabled: z.boolean().default(true),
13157
+ notificationSettings: z.record(campaignNotificationType, z.boolean().default(true)),
13158
+ organizationId: z.string(),
13159
+ campaignId: z.string(),
13160
+ createdAt: z.number(),
13161
+ updatedAt: z.number(),
13162
+ });
13163
+ const createChatbotSchema = chatbotSchema.pick({
13164
+ workspaceId: true,
13165
+ accessToken: true,
13166
+ refreshToken: true,
13167
+ channels: true,
13168
+ organizationId: true,
13169
+ campaignId: true,
13170
+ });
13171
+ const updateChatbotSchema = chatbotSchema.pick({
13172
+ selectedChannelId: true,
13173
+ notificationsEnabled: true,
13174
+ notificationSettings: true,
13175
+ });
13176
+ const sendNotificationRequestSchema = z.object({
13177
+ organizationId: z.string(),
13178
+ campaignId: z.string(),
13179
+ leadId: z.string(),
13180
+ notificationType: campaignNotificationType,
13181
+ message: z.string().optional(),
13182
+ });
13183
+ const updateSuitableLeadNotificationType = z.enum([
13184
+ 'proceeded',
13185
+ 'feedback-provided',
13186
+ ]);
13187
+ const updateSuitableLeadNotificationBodySchema = z.object({
13188
+ type: updateSuitableLeadNotificationType,
13189
+ });
13190
+ const CAMPAIGN_NOTIFICATION_TYPES = {
13191
+ suitableLead: 'Suitable Lead',
13192
+ proposalSent: 'Proposal Sent',
13193
+ proposalViewed: 'Proposal Viewed',
13194
+ proposalReplied: 'Proposal Replied',
13195
+ noConnects: 'No Connects',
13196
+ accountDisconnected: 'Account Disconnected',
13197
+ biddingWarning: 'Bidding Warning',
13198
+ };
13199
+ const CAMPAIGN_NOTIFICATION_SETTINGS = {
13200
+ suitableLead: 'When Lancer determines a job is suitable for your company',
13201
+ proposalSent: 'When a proposal is successfully submitted',
13202
+ proposalViewed: 'When a client views your proposal',
13203
+ proposalReplied: 'When a client replies to your proposal',
13204
+ noConnects: 'When your Agency profile has run out of Upwork connects',
13205
+ accountDisconnected: 'When there is an issue with your Upwork Bidder account',
13206
+ biddingWarning: 'When there is a bidding warning',
13207
+ };
13208
+
13209
+ const campaignCountByStatusSchema = z.object({
13210
+ // Using z.enum values to create a schema with all possible job statuses
13211
+ ...Object.fromEntries(Object.values(agentStatusSchema.enum).map((status) => [
13212
+ status,
13213
+ z.object({
13214
+ boosted: z.number(),
13215
+ organic: z.number(),
13216
+ total: z.number(),
13217
+ }),
13218
+ ])),
13219
+ });
13220
+ const campaignInsightsSchema = z.object({
13221
+ pipelineHealth: campaignCountByStatusSchema,
13222
+ biddingAmount: z.number().default(0),
13223
+ boostingAmount: z.number().default(0),
13224
+ boostedProposalsCount: z.number().default(0),
13225
+ totalProposalsCount: z.number().default(0),
13226
+ totalExpenses: z.number().default(0),
13227
+ suitabilityRange0to10: z.number(),
13228
+ suitabilityRange10to20: z.number(),
13229
+ suitabilityRange20to30: z.number(),
13230
+ suitabilityRange30to40: z.number(),
13231
+ suitabilityRange40to50: z.number(),
13232
+ suitabilityRange50to60: z.number(),
13233
+ suitabilityRange60to70: z.number(),
13234
+ suitabilityRange70to80: z.number(),
13235
+ suitabilityRange80to90: z.number(),
13236
+ suitabilityRange90to100: z.number(),
13237
+ });
13238
+
13239
+ const bidPayloadProposalDataSchema = z.object({
13240
+ coverLetter: z.string(),
13241
+ questionAnswerPairs: questionAnswerPairSchema.array().nullable(),
13242
+ boostingEnabled: z.boolean(),
13243
+ maximumBoost: z.number().nullable(),
13244
+ biddingHourlyRateStrategy: biddingHourlyRateStrategy,
13245
+ biddingFixedHourlyRate: z.number().nullable(),
13246
+ isHourlyRate: z.boolean(),
13247
+ jobMaxHourlyRate: z.number().nullable(),
13248
+ });
13249
+ const freelancerBidProposalDataSchema = bidPayloadProposalDataSchema;
13250
+ const agencyBidProposalDataSchema = bidPayloadProposalDataSchema.extend({
13251
+ agencyName: z.string(),
13252
+ contractorName: z.string(),
13253
+ specializedProfile: z.string().nullable(),
13254
+ });
13255
+ const bidPayloadSchema = z.object({
13256
+ organizationId: z.string(),
13257
+ campaignId: z.string(),
13258
+ lead: leadSchema,
13259
+ jobUrl: z.string(),
13260
+ username: z.string(),
13261
+ password: z.string(),
13262
+ });
13263
+ const agencyBidPayloadSchema = bidPayloadSchema.extend({
13264
+ proposalData: agencyBidProposalDataSchema,
13265
+ });
13266
+ const freelancerBidPayloadSchema = bidPayloadSchema.extend({
13267
+ proposalData: freelancerBidProposalDataSchema,
13268
+ });
13269
+ const bidDtoSchema = z.object({
13270
+ organizationId: z.string(),
13271
+ campaignId: z.string(),
13272
+ leadId: z.string(),
13273
+ });
13274
+
13275
+ const bidSuccessSchema = z.object({
13276
+ status: z.literal("success"),
13277
+ biddingAmount: z.number(),
13278
+ boosted: z.boolean(),
13279
+ boostingAmount: z.number(),
13280
+ });
13281
+ const bidFailedSchema = z.object({
13282
+ status: z.literal("failed"),
13283
+ errorMessage: z.string(),
13284
+ });
13285
+
13286
+ class CloudflareChallengeFailedException extends Error {
13287
+ code = 'CLOUDFLARE_CHALLENGE_FAILED_EXCEPTION';
13288
+ constructor(url, errorMessage) {
13289
+ super(`Cloudflare challenge failed for ${url}\n\n ${errorMessage}`);
13290
+ }
13291
+ }
13292
+ const cloudflareProtectionFailure = (url, errorMessage) => new CloudflareChallengeFailedException(url, errorMessage);
13293
+
13294
+ class DeleteMultiloginProfileException extends Error {
13295
+ code = 'DELETE_MULTILOGIN_PROFILE_EXCEPTION';
13296
+ constructor(message) {
13297
+ super(message);
13298
+ }
13299
+ }
13300
+ const deleteMultiloginProfileException = (message) => new DeleteMultiloginProfileException(message);
13301
+
13302
+ class DropdownOptionNotPresentException extends Error {
13303
+ code = 'DROPDOWN_OPTION_NOT_PRESENT_EXCEPTION';
13304
+ constructor(selector, option) {
13305
+ super(`${selector} does not contain option ${option}`);
13306
+ }
13307
+ }
13308
+ function dropdownOptionNotPresentException(selector, option) {
13309
+ return new DropdownOptionNotPresentException(selector, option);
13310
+ }
13311
+
13312
+ class ElementNotClickableException extends Error {
13313
+ code = 'ELEMENT_NOT_CLICKABLE_EXCEPTION';
13314
+ constructor(context, message) {
13315
+ super(`${context} is not clickable: ${message}`);
13316
+ }
13317
+ }
13318
+ function elementNotClickableException(elementInfo, message) {
13319
+ return new ElementNotClickableException(JSON.stringify(elementInfo), message);
13320
+ }
13321
+
13322
+ class EvaluateElementException extends Error {
13323
+ code = 'EVALUATE_ELEMENT_EXCEPTION';
13324
+ constructor(element, message) {
13325
+ super(`Element evaluation for ${JSON.stringify(element)} failed: ${message}`);
13326
+ }
13327
+ }
13328
+ function evaluateElementException(element, message) {
13329
+ return new EvaluateElementException(element, message);
13330
+ }
13331
+
13332
+ class EvaluateFunctionException extends Error {
13333
+ code = 'EVALUATE_FUNCTION_EXCEPTION';
13334
+ constructor(fn, args, message) {
13335
+ super(`Evaluation function ${fn.toString()} failed with selectors: ${args} \n\n Error Message: ${message}`);
13336
+ }
13337
+ }
13338
+ function evaluateFunctionException(fn, args, message) {
13339
+ return new EvaluateFunctionException(fn, args, message);
13340
+ }
13341
+
13342
+ class GetMultiloginBrowserException extends Error {
13343
+ code = 'GET_MULTILOGIN_BROWSER_EXCEPTION';
13344
+ constructor(message) {
13345
+ super(message);
13346
+ }
13347
+ }
13348
+ const getMultiloginBrowserException = (message) => new GetMultiloginBrowserException(message);
13349
+
13350
+ class IncorrectSecurityQuestionAnswerException extends Error {
13351
+ code = 'INCORRECT_SECURITY_QUESTION_ANSWER_EXCEPTION';
13352
+ constructor(message) {
13353
+ super(message);
13354
+ }
13355
+ }
13356
+ const incorrectSecurityQuestionAnswerException = (message) => new IncorrectSecurityQuestionAnswerException(message);
13357
+
13358
+ class InitBrowserException extends Error {
13359
+ code = 'INIT_BROWSER_EXCEPTION';
13360
+ constructor(message) {
13361
+ super(message);
13362
+ }
13363
+ }
13364
+ const initBrowserException = (message) => new InitBrowserException(message);
13365
+
13366
+ class InsufficientConnectsException extends Error {
13367
+ code = 'INSUFFICIENT_CONNECTS_EXCEPTION';
13368
+ constructor(message) {
13369
+ super(message);
13370
+ }
13371
+ }
13372
+ const insufficientConnectsException = (message) => new InsufficientConnectsException(message);
13373
+
13374
+ class InvalidCredentialsException extends Error {
13375
+ code = 'INVALID_CREDENTIALS_EXCEPTION';
13376
+ constructor(message) {
13377
+ super(message);
13378
+ }
13379
+ }
13380
+ const invalidCredentialsException = (message) => new InvalidCredentialsException(message);
13381
+
13382
+ class InvalidJobUrlException extends Error {
13383
+ code = 'INVALID_JOB_URL_EXCEPTION';
13384
+ constructor(message) {
13385
+ super(message);
13386
+ }
13387
+ }
13388
+ function invalidJobUrlException(message) {
13389
+ return new InvalidJobUrlException(message);
13390
+ }
13391
+
13392
+ class LoginFailedException extends Error {
13393
+ code = 'LOGIN_FAILED_EXCEPTION';
13394
+ constructor(message) {
13395
+ super(message);
13396
+ }
13397
+ }
13398
+ const loginFailedException = (message) => {
13399
+ return new LoginFailedException(message);
13494
13400
  };
13495
- const CAMPAIGN_NOTIFICATION_SETTINGS = {
13496
- suitableLead: 'When Lancer determines a job is suitable for your company',
13497
- proposalSent: 'When a proposal is successfully submitted',
13498
- proposalViewed: 'When a client views your proposal',
13499
- proposalReplied: 'When a client replies to your proposal',
13500
- noConnects: 'When your Agency profile has run out of Upwork connects',
13501
- accountDisconnected: 'When there is an issue with your Upwork Bidder account',
13502
- biddingWarning: 'When there is a bidding warning',
13401
+
13402
+ class MultiloginAuthenticationException extends Error {
13403
+ code = 'MULTILOGIN_AUTHENTICATION_EXCEPTION';
13404
+ constructor(message) {
13405
+ super(message);
13406
+ }
13407
+ }
13408
+ const multiloginAuthenticationException = (message) => new MultiloginAuthenticationException(message);
13409
+
13410
+ class NavigationTimeoutException extends Error {
13411
+ code = 'NAVIGATION_TIMEOUT_EXCEPTION';
13412
+ constructor(url, message) {
13413
+ super(`Navigation to ${url} timed out: ${message}`);
13414
+ }
13415
+ }
13416
+ const navigationTimeoutException = (url, message) => new NavigationTimeoutException(url, message);
13417
+
13418
+ class NewBrowserPageException extends Error {
13419
+ code = 'NEW_BROWSER_PAGE_EXCEPTION';
13420
+ constructor(profileId, message) {
13421
+ super(`Browser page for profile ${profileId} not found. \n\n Error Message: ${message}`);
13422
+ }
13423
+ }
13424
+ const newBrowserPageException = (profileId, message) => new NewBrowserPageException(profileId, message);
13425
+
13426
+ class NewPageException extends Error {
13427
+ code = 'NEW_PAGE_EXCEPTION';
13428
+ constructor(message) {
13429
+ super(message);
13430
+ }
13431
+ }
13432
+ const newPageException = (message) => new NewPageException(message);
13433
+
13434
+ class GoToUrlException extends Error {
13435
+ code = 'GO_TO_URL_EXCEPTION';
13436
+ constructor(url, message) {
13437
+ super(`Error opening new url: ${url}. \n\n Error Message: ${message}`);
13438
+ }
13439
+ }
13440
+ const goToUrlException = (url, message) => new GoToUrlException(url, message);
13441
+
13442
+ class ParseConnectsException extends Error {
13443
+ code = 'PARSE_CONNECTS_EXCEPTION';
13444
+ constructor() {
13445
+ super('Failed to parse connects');
13446
+ }
13447
+ }
13448
+ const parseConnectsException = () => new ParseConnectsException();
13449
+
13450
+ class ProposalErrorAlertException extends Error {
13451
+ code = 'PROPOSAL_ERROR_ALERT_EXCEPTION';
13452
+ constructor(message) {
13453
+ super(message);
13454
+ }
13455
+ }
13456
+ const proposalErrorAlertException = (message) => new ProposalErrorAlertException(message);
13457
+
13458
+ class ProposalFormWarningAlertException extends Error {
13459
+ code = 'PROPOSAL_FORM_WARNING_ALERT_EXCEPTION';
13460
+ constructor(message) {
13461
+ super(message);
13462
+ }
13463
+ }
13464
+ function proposalFormWarningAlertException(message) {
13465
+ return new ProposalFormWarningAlertException(message);
13466
+ }
13467
+
13468
+ class ProposalGenerationFailedException extends Error {
13469
+ code = 'PROPOSAL_GENERATION_FAILED_EXCEPTION';
13470
+ constructor(message, organizationId, campaignId, leadId) {
13471
+ super(`Proposal generation failed for lead ${leadId} in campaign ${campaignId} in organization ${organizationId}\n\n${message}`);
13472
+ }
13473
+ }
13474
+ const proposalGenerationFailed = (message, leadId, campaignId, organizationId) => new ProposalGenerationFailedException(message, organizationId, campaignId, leadId);
13475
+
13476
+ class ProposalSubmitFailedException extends Error {
13477
+ code = 'PROPOSAL_SUBMIT_FAILED';
13478
+ constructor(message) {
13479
+ super(message);
13480
+ }
13481
+ }
13482
+ const proposalSubmitFailedException = (message) => {
13483
+ return new ProposalSubmitFailedException(message);
13503
13484
  };
13504
13485
 
13505
- const campaignCountByStatusSchema = z.object({
13506
- // Using z.enum values to create a schema with all possible job statuses
13507
- ...Object.fromEntries(Object.values(agentStatusSchema.enum).map((status) => [
13508
- status,
13509
- z.object({
13510
- boosted: z.number(),
13511
- organic: z.number(),
13512
- total: z.number(),
13513
- }),
13514
- ])),
13515
- });
13516
- const campaignInsightsSchema = z.object({
13517
- pipelineHealth: campaignCountByStatusSchema,
13518
- biddingAmount: z.number().default(0),
13519
- boostingAmount: z.number().default(0),
13520
- boostedProposalsCount: z.number().default(0),
13521
- totalProposalsCount: z.number().default(0),
13522
- totalExpenses: z.number().default(0),
13523
- suitabilityRange0to10: z.number(),
13524
- suitabilityRange10to20: z.number(),
13525
- suitabilityRange20to30: z.number(),
13526
- suitabilityRange30to40: z.number(),
13527
- suitabilityRange40to50: z.number(),
13528
- suitabilityRange50to60: z.number(),
13529
- suitabilityRange60to70: z.number(),
13530
- suitabilityRange70to80: z.number(),
13531
- suitabilityRange80to90: z.number(),
13532
- suitabilityRange90to100: z.number(),
13533
- });
13486
+ class PuppeteerConnectionErrorException extends Error {
13487
+ code = 'PUPPETEER_CONNECTION_ERROR_EXCEPTION';
13488
+ constructor(message) {
13489
+ super(message);
13490
+ }
13491
+ }
13492
+ const puppeteerConnectionErrorException = (message) => new PuppeteerConnectionErrorException(message);
13493
+
13494
+ class QuestionPairNotMatchingException extends Error {
13495
+ code = 'QUESTION_PAIR_NOT_MATCHING';
13496
+ constructor(upworkQuestion, generatedQuestion) {
13497
+ super(`Question pair not matching: ${upworkQuestion} !== ${generatedQuestion}`);
13498
+ }
13499
+ }
13500
+ const questionPairNotMatchingException = (upworkQuestion, generatedQuestion) => {
13501
+ return new QuestionPairNotMatchingException(upworkQuestion, generatedQuestion);
13502
+ };
13503
+
13504
+ class SelectAgencyException extends Error {
13505
+ code = 'SELECT_AGENCY_EXCEPTION';
13506
+ constructor(agencyName, message) {
13507
+ super(`Failed to select agency ${agencyName}: ${message}`);
13508
+ }
13509
+ }
13510
+ function selectAgencyException(agencyName, message) {
13511
+ return new SelectAgencyException(agencyName, message);
13512
+ }
13513
+
13514
+ class SelectContractorException extends Error {
13515
+ code = 'SELECT_CONTRACTOR_EXCEPTION';
13516
+ constructor(contractorName, message) {
13517
+ super(`Failed to select contractor ${contractorName}: ${message}`);
13518
+ }
13519
+ }
13520
+ function selectContractorException(contractorName, message) {
13521
+ return new SelectContractorException(contractorName, message);
13522
+ }
13523
+
13524
+ class SelectorNotFoundError extends Error {
13525
+ code = 'SELECTOR_NOT_FOUND_ERROR';
13526
+ constructor(selector, context) {
13527
+ const message = context
13528
+ ? `Element matching selector "${selector}" not found within ${context}.`
13529
+ : `Element matching selector "${selector}" not found.`;
13530
+ super(message);
13531
+ }
13532
+ }
13533
+ const selectorNotFoundError = (selector, context) => new SelectorNotFoundError(selector, context);
13534
+
13535
+ class TypedValueInFieldNotMatchingException extends Error {
13536
+ code = 'TYPED_VALUE_IN_FIELD_NOT_MATCHING_EXCEPTION';
13537
+ constructor(element, inputValue, correctValue) {
13538
+ super(`Input value ${inputValue} does not match correct value ${correctValue} for element ${JSON.stringify(element)}`);
13539
+ }
13540
+ }
13541
+ const typedValueInFieldNotMatchingException = (element, inputValue, correctValue) => new TypedValueInFieldNotMatchingException(element, inputValue, correctValue);
13542
+
13543
+ class TypingInputFieldException extends Error {
13544
+ code = 'TYPING_INPUT_FIELD_EXCEPTION';
13545
+ constructor(element, message) {
13546
+ const identifier = JSON.stringify(element);
13547
+ super(`${identifier} - ${message}`);
13548
+ }
13549
+ }
13550
+ const typingInputFieldException = (element, message) => new TypingInputFieldException(element, message);
13551
+
13552
+ class WaitForFunctionTimeoutError extends Error {
13553
+ code = 'WAIT_FOR_FUNCTION_TIMEOUT_ERROR';
13554
+ constructor(fn, timeout) {
13555
+ super(`Timeout waiting for function "${fn.toString()}" after ${timeout}ms.`);
13556
+ }
13557
+ }
13558
+ const waitForFunctionTimeoutError = (fn, timeout) => new WaitForFunctionTimeoutError(fn, timeout);
13534
13559
 
13535
13560
  const invoiceStripeMetadataLineSchema = objectType({
13536
13561
  description: stringType(),
@@ -14630,6 +14655,7 @@ exports.bidderInstanceSchema = bidderInstanceSchema;
14630
14655
  exports.bidderInstanceStatusEnum = bidderInstanceStatusEnum;
14631
14656
  exports.biddingCompletedEventMetadata = biddingCompletedEventMetadata;
14632
14657
  exports.biddingFailedEventMetadata = biddingFailedEventMetadata;
14658
+ exports.biddingHourlyRateStrategy = biddingHourlyRateStrategy;
14633
14659
  exports.biddingRejectedWithFeedbackEventMetadata = biddingRejectedWithFeedbackEventMetadata;
14634
14660
  exports.booleanSchema = booleanSchema;
14635
14661
  exports.buildRoute = buildRoute;
@@ -14859,6 +14885,8 @@ exports.updateCampaignSchema = updateCampaignSchema;
14859
14885
  exports.updateChatbotSchema = updateChatbotSchema;
14860
14886
  exports.updateLeadStatusSchema = updateLeadStatusSchema;
14861
14887
  exports.updateScraperAccountSchema = updateScraperAccountSchema;
14888
+ exports.updateSuitableLeadNotificationBodySchema = updateSuitableLeadNotificationBodySchema;
14889
+ exports.updateSuitableLeadNotificationType = updateSuitableLeadNotificationType;
14862
14890
  exports.upworkAccountConnectSchema = upworkAccountConnectSchema;
14863
14891
  exports.upworkAccountConnectStatusSchema = upworkAccountConnectStatusSchema;
14864
14892
  exports.upworkJobSchema = upworkJobSchema;