lancer-shared 1.2.139 → 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.
@@ -12743,513 +12743,196 @@ const generateLeadCountsRequestSchema = z.object({
12743
12743
  campaignId: z.string().optional(),
12744
12744
  });
12745
12745
 
12746
- const bidPayloadProposalDataSchema = z.object({
12747
- coverLetter: z.string(),
12748
- questionAnswerPairs: questionAnswerPairSchema.array().nullable(),
12749
- boostingEnabled: z.boolean(),
12750
- 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(),
12751
12756
  });
12752
- const freelancerBidProposalDataSchema = bidPayloadProposalDataSchema;
12753
- const agencyBidProposalDataSchema = bidPayloadProposalDataSchema.extend({
12754
- agencyName: z.string(),
12755
- contractorName: z.string(),
12756
- specializedProfile: z.string().nullable(),
12757
+ const usageEventSchema = objectType({
12758
+ organizationId: stringType(),
12759
+ typeId: usageEventTypeEnum,
12760
+ timestamp: numberType(),
12761
+ metadata: usageEventMetadataSchema,
12757
12762
  });
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(),
12763
+
12764
+ const billingStripeMetadataSchema = objectType({
12765
+ customer: objectType({ id: stringType().nullable() }),
12765
12766
  });
12766
- const agencyBidPayloadSchema = bidPayloadSchema.extend({
12767
- proposalData: agencyBidProposalDataSchema,
12767
+ const billingSchema = objectType({
12768
+ savedCard: booleanType(),
12769
+ stripe: billingStripeMetadataSchema,
12768
12770
  });
12769
- const freelancerBidPayloadSchema = bidPayloadSchema.extend({
12770
- 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
+ }),
12771
12787
  });
12772
- const bidDtoSchema = z.object({
12773
- organizationId: z.string(),
12774
- campaignId: z.string(),
12775
- 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()),
12776
12805
  });
12777
12806
 
12778
- const bidSuccessSchema = z.object({
12779
- status: z.literal("success"),
12780
- biddingAmount: z.number(),
12781
- boosted: z.boolean(),
12782
- 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(),
12783
12813
  });
12784
- const bidFailedSchema = z.object({
12785
- status: z.literal("failed"),
12786
- errorMessage: z.string(),
12814
+ const createCoverLetterTemplateSchema = coverLetterTemplateSchema.pick({
12815
+ name: true,
12816
+ template: true,
12817
+ instructions: true,
12787
12818
  });
12788
12819
 
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);
12820
+ const organizationMemberRoleEnum = z.enum(["admin", "member"]);
12821
+ const organizationMemberSchema = objectType({
12822
+ role: organizationMemberRoleEnum,
12823
+ joinedAt: numberType(),
12824
+ invitedBy: stringType(),
12825
+ });
12804
12826
 
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
- }
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
+ });
12814
12834
 
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
- }
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
+ });
12824
12930
 
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
- });
12931
+ const campaignExpensesSchema = z.object({
12932
+ biddingAmount: z.number().default(0),
12933
+ boostingAmount: z.number().default(0),
12934
+ boosted: z.number().default(0),
12935
+ });
13253
12936
 
13254
12937
  const bidConfigSchema = z.object({
13255
12938
  agencyName: z.string().nullable(),
@@ -13263,6 +12946,11 @@ const campaignStatusSchema = z.union([
13263
12946
  z.literal('paused'),
13264
12947
  z.literal('error'),
13265
12948
  ]);
12949
+ const biddingHourlyRateStrategy = z.enum([
12950
+ 'match_job_budget',
12951
+ 'match_profile_rate',
12952
+ 'fixed_rate',
12953
+ ]);
13266
12954
  const campaignSchema = z.object({
13267
12955
  id: z.string(),
13268
12956
  name: z.string(),
@@ -13277,6 +12965,9 @@ const campaignSchema = z.object({
13277
12965
  monthlyBudget: z.number().nullable(),
13278
12966
  // suitabilityThreshold: z.number().min(0).max(100).nullable().default(0),
13279
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(),
13280
12971
  leadCounts: z.record(leadStatusSchema, z.number()).nullable(),
13281
12972
  expenses: campaignExpensesSchema,
13282
12973
  notificationsEnabled: z.boolean().nullable(),
@@ -13369,181 +13060,502 @@ const campaignStatusActivityExtraSchema = z.object({
13369
13060
  status: z.enum(["started", "paused", "created", "error"]),
13370
13061
  creditBalance: z.number(),
13371
13062
  });
13372
- const campaignStatusActivitySchema = baseActivitySchema.extend({
13373
- ...campaignStatusActivityExtraSchema.shape,
13063
+ const campaignStatusActivitySchema = baseActivitySchema.extend({
13064
+ ...campaignStatusActivityExtraSchema.shape,
13065
+ });
13066
+ const leadAnalysisActivityExtraSchema = z.object({
13067
+ type: z.literal("lead_analysis"),
13068
+ lead: leadSchema.pick({
13069
+ id: true,
13070
+ title: true,
13071
+ datetime: true,
13072
+ jobUrl: true,
13073
+ }),
13074
+ suitabilityRating: z.number().min(0).max(100),
13075
+ creditBalance: z.number(),
13076
+ });
13077
+ const leadAnalysisActivitySchema = baseActivitySchema.extend({
13078
+ ...leadAnalysisActivityExtraSchema.shape,
13079
+ });
13080
+ const leadStatusActivityExtraSchema = z.object({
13081
+ type: z.literal("lead_status"),
13082
+ status: leadStatusSchema,
13083
+ lead: leadSchema.pick({
13084
+ id: true,
13085
+ title: true,
13086
+ datetime: true,
13087
+ jobUrl: true,
13088
+ }),
13089
+ creditBalance: z.number(),
13090
+ });
13091
+ const leadStatusActivitySchema = baseActivitySchema.extend({
13092
+ ...leadStatusActivityExtraSchema.shape,
13093
+ });
13094
+ const proposalSentActivityExtraSchema = z.object({
13095
+ type: z.literal("proposal_sent"),
13096
+ lead: leadSchema.pick({
13097
+ id: true,
13098
+ title: true,
13099
+ datetime: true,
13100
+ jobUrl: true,
13101
+ }),
13102
+ creditBalance: z.number(),
13103
+ });
13104
+ const proposalSentActivitySchema = baseActivitySchema.extend({
13105
+ ...proposalSentActivityExtraSchema.shape,
13106
+ });
13107
+ const campaignActivitySchema = z.discriminatedUnion("type", [
13108
+ campaignStatusActivitySchema,
13109
+ leadAnalysisActivitySchema,
13110
+ leadStatusActivitySchema,
13111
+ proposalSentActivitySchema,
13112
+ ]);
13113
+ const campaignActivityCreateSchema = z.discriminatedUnion("type", [
13114
+ campaignStatusActivityExtraSchema,
13115
+ leadAnalysisActivityExtraSchema,
13116
+ leadStatusActivityExtraSchema,
13117
+ proposalSentActivityExtraSchema,
13118
+ ]);
13119
+ const updateCampaignAnalyticsSchema = z.object({
13120
+ organizationId: z.string(),
13121
+ campaignId: z.string(),
13122
+ fields: z.array(z.enum([
13123
+ "contacted",
13124
+ "viewed",
13125
+ "replied",
13126
+ "won",
13127
+ "leadsAnalyzed",
13128
+ "leadsFailed",
13129
+ "proposalsFailed",
13130
+ "suitableJobs",
13131
+ "unsuitableJobs",
13132
+ "wonAmount",
13133
+ ])),
13134
+ });
13135
+
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
+ ])),
13374
13219
  });
13375
- const leadAnalysisActivityExtraSchema = z.object({
13376
- type: z.literal("lead_analysis"),
13377
- lead: leadSchema.pick({
13378
- id: true,
13379
- title: true,
13380
- datetime: true,
13381
- jobUrl: true,
13382
- }),
13383
- suitabilityRating: z.number().min(0).max(100),
13384
- creditBalance: z.number(),
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(),
13385
13237
  });
13386
- const leadAnalysisActivitySchema = baseActivitySchema.extend({
13387
- ...leadAnalysisActivityExtraSchema.shape,
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(),
13388
13248
  });
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(),
13249
+ const freelancerBidProposalDataSchema = bidPayloadProposalDataSchema;
13250
+ const agencyBidProposalDataSchema = bidPayloadProposalDataSchema.extend({
13251
+ agencyName: z.string(),
13252
+ contractorName: z.string(),
13253
+ specializedProfile: z.string().nullable(),
13399
13254
  });
13400
- const leadStatusActivitySchema = baseActivitySchema.extend({
13401
- ...leadStatusActivityExtraSchema.shape,
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(),
13402
13262
  });
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(),
13263
+ const agencyBidPayloadSchema = bidPayloadSchema.extend({
13264
+ proposalData: agencyBidProposalDataSchema,
13412
13265
  });
13413
- const proposalSentActivitySchema = baseActivitySchema.extend({
13414
- ...proposalSentActivityExtraSchema.shape,
13266
+ const freelancerBidPayloadSchema = bidPayloadSchema.extend({
13267
+ proposalData: freelancerBidProposalDataSchema,
13415
13268
  });
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({
13269
+ const bidDtoSchema = z.object({
13429
13270
  organizationId: z.string(),
13430
13271
  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
- ])),
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(),
13443
13284
  });
13444
13285
 
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',
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);
13400
+ };
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);
13507
13484
  };
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',
13485
+
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);
13516
13502
  };
13517
13503
 
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
- });
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);
13547
13559
 
13548
13560
  const invoiceStripeMetadataLineSchema = objectType({
13549
13561
  description: stringType(),
@@ -14643,6 +14655,7 @@ exports.bidderInstanceSchema = bidderInstanceSchema;
14643
14655
  exports.bidderInstanceStatusEnum = bidderInstanceStatusEnum;
14644
14656
  exports.biddingCompletedEventMetadata = biddingCompletedEventMetadata;
14645
14657
  exports.biddingFailedEventMetadata = biddingFailedEventMetadata;
14658
+ exports.biddingHourlyRateStrategy = biddingHourlyRateStrategy;
14646
14659
  exports.biddingRejectedWithFeedbackEventMetadata = biddingRejectedWithFeedbackEventMetadata;
14647
14660
  exports.booleanSchema = booleanSchema;
14648
14661
  exports.buildRoute = buildRoute;